Beispiel #1
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // Store this foe in quest as last Foe encountered
            // This will be used for subsequent pronoun macros, etc.
            ParentQuest.LastResourceReferenced = this;

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // _symbol_ name
                textOut = typeName;
                break;

            case MacroTypes.DetailsMacro:               // =symbol_ name
                textOut = displayName;
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
Beispiel #2
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // Check if this item is gold pieces
            bool isGoldPieces = false;

            if (item.ItemGroup == ItemGroups.Currency && item.GroupIndex == 0)
            {
                isGoldPieces = true;
            }

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
            case MacroTypes.DetailsMacro:               // Same as display name?
                if (artifact)
                {
                    textOut = item.shortName;
                }
                else
                {
                    textOut = (isGoldPieces) ? item.stackCount.ToString() : item.LongName;
                }
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Expand macro for a Place.
        /// </summary>
        /// <param name="macro">Macro type to expand.</param>
        /// <param name="text">Expanded text for this macro type. Empty if macro cannot be expanded.</param>
        /// <returns>True if macro expanded, otherwise false.</returns>
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Name of house/business (e.g. Odd Blades)
                textOut = siteDetails.buildingName;
                break;

            case MacroTypes.NameMacro2:                 // Name of location (e.g. Gothway Garden)
                textOut = siteDetails.locationName;
                break;

            case MacroTypes.NameMacro3:                 // Name of dungeon (e.g. Privateer's Hold) - Not sure about this one, need to test
                textOut = siteDetails.locationName;
                break;

            case MacroTypes.NameMacro4:                 // Name of region (e.g. Tigonus)
                textOut = siteDetails.regionName;
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // TODO:
            //  * Support for home town/building (believe this is just random unless NPC moved from a Place)
            //  * Support for %god (TEXT.RSC 4077-4084)
            //  * Support for pronoun (%g1, %g2, %g2, %g2self, %g3)
            //  * Support for class (not sure what NPCs have a class, need to see this used in a quest)
            //  * Support for faction (believe this is just the name of faction they belong to, e.g. The Merchants)

            // Store this person in quest as last Person encountered
            // This will be used for subsequent pronoun macros, etc.
            ParentQuest.LastResourceReferenced = this;

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
                textOut = displayName;
                break;

            case MacroTypes.NameMacro2:                 // Home building name
                textOut = GetHomeBuildingName();
                break;

            case MacroTypes.NameMacro3:                 // Home town name
                textOut = GetHomePlaceLocationName();
                break;

            case MacroTypes.NameMacro4:                 // Home region name
                textOut = GetHomePlaceRegionName();
                break;

            case MacroTypes.DetailsMacro:               // Race
                textOut = RaceTemplate.GetRaceDictionary()[(int)race].Name;
                break;

            case MacroTypes.FactionMacro:               // Faction macro
                // Want name of guild, not the person
                FactionFile.FactionData guildData;
                if (GameManager.Instance.PlayerEntity.FactionData.GetFactionData(ParentQuest.FactionId, out guildData))
                {
                    textOut = guildData.name;
                }
                else
                {
                    result = false;
                }
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
Beispiel #5
0
 /// <summary>
 /// Creates an item with pre-filled properties
 /// </summary>
 /// <param name="id"></param>
 /// <param name="key"></param>
 /// <param name="useInEditor"></param>
 /// <param name="cacheDuration"></param>
 /// <param name="alias"></param>
 /// <param name="name"></param>
 /// <param name="cacheByPage"></param>
 /// <param name="cacheByMember"></param>
 /// <param name="dontRender"></param>
 /// <param name="macroSource"></param>
 public Macro(int id, Guid key, bool useInEditor, int cacheDuration, string @alias, string name, bool cacheByPage, bool cacheByMember, bool dontRender, string macroSource, MacroTypes macroType)
     : this()
 {
     Id            = id;
     Key           = key;
     UseInEditor   = useInEditor;
     CacheDuration = cacheDuration;
     Alias         = alias.ToCleanString(CleanStringType.Alias);
     Name          = name;
     CacheByPage   = cacheByPage;
     CacheByMember = cacheByMember;
     DontRender    = dontRender;
     MacroSource   = macroSource;
     MacroType     = macroType;
 }
Beispiel #6
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // TODO:
            //  * Support for home town/building (believe this is just random unless NPC moved from a Place)
            //  * Support for %god (TEXT.RSC 4077-4084)
            //  * Support for pronoun (%g1, %g2, %g2, %g2self, %g3)
            //  * Support for class (not sure what NPCs have a class, need to see this used in a quest)
            //  * Support for faction (believe this is just the name of faction they belong to, e.g. The Merchants)

            // Store this person in quest as last Person encountered
            // This will be used for subsequent pronoun macros, etc.
            ParentQuest.LastPersonReferenced = this;

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
                textOut = displayName;
                break;

            case MacroTypes.NameMacro2:                 // Person residence name
                result = false;
                break;

            case MacroTypes.NameMacro3:                 // Home town name
                textOut = homeTownName;
                break;

            case MacroTypes.DetailsMacro:               // Class name
                result = false;
                break;

            case MacroTypes.FactionMacro:               // Faction macro
                result = false;
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
Beispiel #7
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
                textOut = item.LongName;
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            textOut = string.Empty;
            switch (macro)
            {
            case MacroTypes.DetailsMacro:
                if (DaggerfallUnity.Settings.ShowQuestJournalClocksAsCountdown)
                {
                    textOut = GetDaysString(remainingTimeInSeconds);
                }
                else
                {
                    textOut = GetDaysString(startingTimeInSeconds);
                }
                return(true);

            default:
                return(false);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Creates an instance for persisting a new item
 /// </summary>
 /// <param name="useInEditor"></param>
 /// <param name="cacheDuration"></param>
 /// <param name="alias"></param>
 /// <param name="name"></param>
 /// <param name="cacheByPage"></param>
 /// <param name="cacheByMember"></param>
 /// <param name="dontRender"></param>
 /// <param name="macroSource"></param>
 public Macro(string @alias, string name,
              string macroSource,
              MacroTypes macroType,
              bool cacheByPage   = false,
              bool cacheByMember = false,
              bool dontRender    = true,
              bool useInEditor   = false,
              int cacheDuration  = 0)
     : this()
 {
     UseInEditor   = useInEditor;
     CacheDuration = cacheDuration;
     Alias         = alias.ToCleanString(CleanStringType.Alias);
     Name          = name;
     CacheByPage   = cacheByPage;
     CacheByMember = cacheByMember;
     DontRender    = dontRender;
     MacroSource   = macroSource;
     MacroType     = macroType;
 }
Beispiel #10
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // _symbol_ name
                textOut = typeName;
                break;

            case MacroTypes.DetailsMacro:               // =symbol_ name
                textOut = displayName;
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
Beispiel #11
0
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // TODO:
            //  * Support for home town/building (believe this is just random unless NPC moved from a Place)
            //  * Support for pronoun (%g1, %g2, %g2, %g2self, %g3)
            //  * Support for class (not sure what NPCs have a class, need to see this used in a quest)
            //  * Support for faction (believe this is just the name of faction they belong to, e.g. The Merchants)

            // Store this person in quest as last Person encountered
            // This will be used for subsequent pronoun macros, etc.
            ParentQuest.LastResourceReferenced = this;

            Place dialogPlace = GetDialogPlace();

            if (dialogPlace != null)
            {
                ParentQuest.LastPlaceReferenced = dialogPlace;
            }

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
                textOut = displayName;
                break;

            case MacroTypes.NameMacro2:                 // building name
                textOut = (dialogPlace != null ? dialogPlace.SiteDetails.buildingName : BLANK);
                break;

            case MacroTypes.NameMacro3:                 // town name
                textOut = (dialogPlace != null ? dialogPlace.SiteDetails.locationName : BLANK);
                break;

            case MacroTypes.NameMacro4:                 // region name
                textOut = (dialogPlace != null ? dialogPlace.SiteDetails.regionName : BLANK);
                break;

            case MacroTypes.DetailsMacro:               // Details macro
                textOut = GetFlatDetailsString();
                break;

            case MacroTypes.FactionMacro:               // Faction macro
                if (isQuestor)
                {
                    // Want name of guild, not the person
                    FactionFile.FactionData guildData;
                    if (GameManager.Instance.PlayerEntity.FactionData.GetFactionData(ParentQuest.FactionId, out guildData))
                    {
                        textOut = guildData.name;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    textOut = factionData.name;
                }
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
        /// <summary>
        /// Expand a macro from this resource.
        /// </summary>
        /// <param name="macro">Type of macro to expand.</param>
        /// <param name="textOut">Expanded text for this macro type. Empty if macro cannot be expanded.</param>
        /// <returns>True if macro expanded, otherwise false.</returns>
        public virtual bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            textOut = string.Empty;

            return(false);
        }
Beispiel #13
0
 public SqlMacro(MacroTypes mtype, string Name, object Value)
 {
     this.MacroType = mtype;
     this.Name = Name;
     this.Value = Value;
 }