Example #1
0
        private bool ParseBestowRecipeList(PgItem item, object value, string parsedFile, string parsedKey)
        {
            if (!(value is List <object> ObjectList))
            {
                return(Program.ReportFailure($"Value '{value}' was expected to be a list"));
            }

            item.BestowRecipeList = new PgRecipeCollection();

            foreach (object Item in ObjectList)
            {
                if (!(Item is string RecipeInternalName))
                {
                    return(Program.ReportFailure($"Value '{Item}' was expected to be a string"));
                }

                PgRecipe ParsedRecipe = null !;
                if (!Inserter <PgRecipe> .SetItemByInternalName((PgRecipe valueRecipe) => ParsedRecipe = valueRecipe, RecipeInternalName))
                {
                    return(false);
                }

                item.BestowRecipeList.Add(ParsedRecipe.Key);
            }

            return(true);
        }
        private bool FinishItem(PgQuestRewardItem item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                switch (Key)
                {
                case "Item":
                    Result = Inserter <PgItem> .SetItemByInternalName((PgItem valueItem) => item.Item_Key = valueItem.Key, Value);

                    break;

                case "StackSize":
                    Result = SetIntProperty((int valueInt) => item.RawStackSize = valueInt, Value);
                    break;

                default:
                    Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                    break;
                }

                if (!Result)
                {
                    break;
                }
            }

            return(Result);
        }
Example #3
0
        private static bool FinishItemAbility(ref object?item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, List <string> knownFieldList, List <string> usedFieldList, string parsedFile, string parsedKey)
        {
            PgQuestRewardAbility NewItem = new PgQuestRewardAbility();

            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                if (!knownFieldList.Contains(Key))
                {
                    Result = Program.ReportFailure($"Unknown field {Key}");
                }
                else
                {
                    usedFieldList.Add(Key);

                    switch (Key)
                    {
                    case "T":
                        break;

                    case "Ability":
                        Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => NewItem.Ability_Key = valueAbility.Key, Value);

                        break;

                    default:
                        Result = Program.ReportFailure("Unexpected failure");
                        break;
                    }
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                item = NewItem;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private static bool FinishItemHasInventorySpaceFor(ref object?item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, List <string> knownFieldList, List <string> usedFieldList, string parsedFile, string parsedKey)
        {
            PgAbilityRequirementHasInventorySpaceFor NewItem = new PgAbilityRequirementHasInventorySpaceFor();

            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                if (!knownFieldList.Contains(Key))
                {
                    Result = Program.ReportFailure($"Unknown field {Key}");
                }
                else
                {
                    usedFieldList.Add(Key);

                    switch (Key)
                    {
                    case "T":
                        break;

                    case "Item":
                        Result = Inserter <PgItem> .SetItemByInternalName((PgItem valueItem) => NewItem.Item_Key = valueItem.Key, Value);

                        break;

                    default:
                        Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                        break;
                    }
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                item = NewItem;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        private bool FinishItem(PgReward item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                switch (Key)
                {
                case "Ability":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.Ability_Key = valueAbility.Key, Value);

                    break;

                case "BonusToSkill":
                    Result = ParserSkill.Parse((PgSkill valueSkill) => item.BonusLevelSkill_Key = valueSkill.Key, Value, parsedFile, parsedKey);
                    break;

                case "Recipe":
                    Result = Inserter <PgRecipe> .SetItemByInternalName((PgRecipe valueRecipe) => item.Recipe_Key = valueRecipe.Key, Value);

                    break;

                case "Notes":
                    Result = SetStringProperty((string valueString) => item.Notes = Tools.CleanedUpString(valueString), Value);
                    break;

                default:
                    Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                    break;
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                if (item.Ability_Key == null && item.BonusLevelSkill_Key == null && item.Recipe_Key == null && item.Notes.Length == 0)
                {
                    Result = Program.ReportFailure(parsedFile, parsedKey, "Not enough rewards");
                }
            }

            return(Result);
        }
Example #6
0
        private bool ParseSourceEffect(ref object?item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            if (!contentTable.ContainsKey("EffectName"))
            {
                return(Program.ReportFailure(parsedFile, parsedKey, "Source has no effect name"));
            }

            if (!(contentTable["EffectName"] is string EffectNameString))
            {
                return(Program.ReportFailure("Source effect name was expected to be a string"));
            }

            if (EffectNameString == "Learn Ability")
            {
                item = new PgSourceLearnAbility();
                return(true);
            }

            PgRecipe ParsedRecipe = null !;

            if (Inserter <PgRecipe> .SetItemByInternalName((PgRecipe valueRecipe) => ParsedRecipe = valueRecipe, EffectNameString, ErrorControl.IgnoreIfNotFound))
            {
                item = new PgSourceRecipe()
                {
                    Recipe_Key = ParsedRecipe.Key
                };
                return(true);
            }

            if (Inserter <PgRecipe> .SetItemByName((PgRecipe valueRecipe) => ParsedRecipe = valueRecipe, EffectNameString, ErrorControl.IgnoreIfNotFound))
            {
                item = new PgSourceRecipe()
                {
                    Recipe_Key = ParsedRecipe.Key
                };
                return(true);
            }

            PgEffect ParsedEffect = null !;

            if (Inserter <PgEffect> .SetItemByName((PgEffect valueEffect) => ParsedEffect = valueEffect, EffectNameString, ErrorControl.IgnoreIfNotFound))
            {
                item = new PgSourceEffect()
                {
                    Effect_Key = ParsedEffect.Key
                };
                return(true);
            }

            if (!contentTable.ContainsKey("EffectTypeId"))
            {
                return(Program.ReportFailure($"Unknown effect name {EffectNameString}"));
            }

            if (!(contentTable["EffectTypeId"] is string ValueString))
            {
                return(Program.ReportFailure($"Effect type id was expected to be a string"));
            }

            string EffectKey = $"effect_{ValueString}";

            if (Inserter <PgEffect> .SetItemByKey((PgEffect valueEffect) => ParsedEffect = valueEffect, EffectKey, ErrorControl.IgnoreIfNotFound))
            {
                item = new PgSourceEffect()
                {
                    Effect_Key = ParsedEffect.Key
                };
                return(true);
            }

            return(Program.ReportFailure($"Unknown effect name {EffectNameString}"));
        }
Example #7
0
        private bool FinishItem(PgItem item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            bool Result = true;
            Dictionary <ItemKeyword, List <float> > KeywordTable = new Dictionary <ItemKeyword, List <float> >();
            List <string>            KeywordValueList            = new List <string>();
            Dictionary <string, int> SkillRequirementTable       = new Dictionary <string, int>();

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                switch (Key)
                {
                case "BestowRecipes":
                    Result = ParseBestowRecipeList(item, Value, parsedFile, parsedKey);
                    break;

                case "BestowAbility":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.BestowAbility_Key = valueAbility.Key, Value);

                    break;

                case "BestowQuest":
                    Result = Inserter <PgQuest> .SetItemByInternalName((PgQuest valueQuest) => item.BestowQuest_Key = valueQuest.Key, Value);

                    break;

                case "AllowPrefix":
                    Result = SetBoolProperty((bool valueBool) => item.SetAllowPrefix(valueBool), Value);
                    break;

                case "AllowSuffix":
                    Result = SetBoolProperty((bool valueBool) => item.SetAllowSuffix(valueBool), Value);
                    break;

                case "CraftPoints":
                    Result = SetIntProperty((int valueInt) => item.RawCraftPoints = valueInt, Value);
                    break;

                case "CraftingTargetLevel":
                    Result = SetIntProperty((int valueInt) => item.RawCraftingTargetLevel = valueInt, Value);
                    break;

                case "Description":
                    Result = SetStringProperty((string valueString) => item.Description = valueString, Value);
                    break;

                case "DroppedAppearance":
                    Result = ParseDroppedAppearance(item, Value, parsedFile, parsedKey);
                    break;

                case "EffectDescs":
                    Result = ParseEffectDescriptionList(item.EffectDescriptionList, Value, parsedFile, parsedKey);
                    break;

                case "DyeColor":
                    Result = ParseDyeColor(item, Value, parsedFile, parsedKey);
                    break;

                case "EquipAppearance":
                    Result = SetStringProperty((string valueString) => item.EquipAppearance = valueString, Value);     // TODO: parse
                    break;

                case "EquipSlot":
                    Result = StringToEnumConversion <ItemSlot> .SetEnum((ItemSlot valueEnum) => item.EquipSlot = valueEnum, Value);

                    break;

                case "FoodDesc":
                    Result = SetStringProperty((string valueString) => item.FoodDesc = valueString, Value);     // TODO: parse
                    break;

                case "IconId":
                    Result = SetIconIdProperty((int valueInt) => item.RawIconId = valueInt, Value);
                    break;

                case "InternalName":
                    Result = SetStringProperty((string valueString) => item.InternalName = valueString, Value);
                    break;

                case "IsTemporary":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsTemporary(valueBool), Value);
                    break;

                case "IsCrafted":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsCrafted(valueBool), Value);
                    break;

                case "Keywords":
                    Result = ParseKeywordList(item, Value, KeywordTable, KeywordValueList, parsedFile, parsedKey);
                    break;

                case "MacGuffinQuestName":
                    Result = Inserter <PgQuest> .SetItemByInternalName((PgQuest valueQuest) => item.MacGuffinQuest_Key = valueQuest.Key, Value);

                    break;

                case "MaxCarryable":
                    Result = SetIntProperty((int valueInt) => item.RawMaxCarryable = valueInt, Value);
                    break;

                case "MaxOnVendor":
                    Result = SetIntProperty((int valueInt) => item.RawMaxOnVendor = valueInt, Value);
                    break;

                case "MaxStackSize":
                    Result = SetIntProperty((int valueInt) => item.RawMaxStackSize = valueInt, Value);
                    break;

                case "Name":
                    Result = SetStringProperty((string valueString) => item.Name = valueString, Value);
                    break;

                case "RequiredAppearance":
                    Result = StringToEnumConversion <Appearance> .SetEnum((Appearance valueEnum) => item.RequiredAppearance = valueEnum, Value);

                    break;

                case "SkillReqs":
                    Result = ParseSkillRequirements(item, Value, SkillRequirementTable, parsedFile, parsedKey);
                    break;

                case "StockDye":
                    Result = ParseStockDye(item, Value, parsedFile, parsedKey);
                    break;

                case "TSysProfile":
                    Result = StringToEnumConversion <Profile> .SetEnum((Profile valueEnum) => item.TSysProfile = valueEnum, Value);

                    break;

                case "Value":
                    Result = SetFloatProperty((float valueFloat) => item.RawValue = valueFloat, Value);
                    break;

                case "NumUses":
                    Result = SetIntProperty((int valueInt) => item.RawNumUses = valueInt, Value);
                    break;

                case "DestroyWhenUsedUp":
                    Result = SetBoolProperty((bool valueBool) => item.SetDestroyWhenUsedUp(valueBool), Value);
                    break;

                case "Behaviors":
                    Result = Inserter <PgItemBehavior> .AddKeylessArray(item.BehaviorList, Value);

                    break;

                case "DynamicCraftingSummary":
                    Result = SetStringProperty((string valueString) => item.DynamicCraftingSummary = valueString, Value);
                    break;

                case "IsSkillReqsDefaults":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsSkillReqsDefaults(valueBool), Value);
                    break;

                case "BestowTitle":
                    Result = Inserter <PgPlayerTitle> .SetItemByKey((PgPlayerTitle valuePlayerTitle) => item.BestowTitle_Key = valuePlayerTitle.Key, $"Title_{Value}");

                    break;

                case "BestowLoreBook":
                    Result = Inserter <PgLoreBook> .SetItemByKey((PgLoreBook valueLoreBook) => item.BestowLoreBook_Key = valueLoreBook.Key, $"Book_{Value}");

                    break;

                case "Lint_VendorNpc":
                    Result = StringToEnumConversion <WorkOrderSign> .SetEnum((WorkOrderSign valueEnum) => item.LintVendorNpc = valueEnum, Value);

                    break;

                case "MountedAppearance":
                    Result = SetStringProperty((string valueString) => item.MountedAppearance = valueString, Value);
                    break;

                case "AttuneOnPickup":
                    Result = SetBoolProperty((bool valueBool) => item.SetAttuneOnPickup(valueBool), Value);
                    break;

                default:
                    Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                    break;
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                item.KeywordTable          = KeywordTable;
                item.SkillRequirementTable = SkillRequirementTable;
            }

            return(Result);
        }
Example #8
0
        private bool FinishItem(PgAbility item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                switch (Key)
                {
                case "AbilityGroup":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.AbilityGroup_Key = valueAbility.Key, Value);

                    break;

                case "Animation":
                    Result = StringToEnumConversion <AbilityAnimation> .SetEnum((AbilityAnimation valueEnum) => item.Animation = valueEnum, Value);

                    break;

                case "AttributesThatModAmmoConsumeChance":
                    Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatModAmmoConsumeChanceList, Value);

                    break;

                case "AttributesThatDeltaDelayLoopTime":
                    Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatDeltaDelayLoopTimeList, Value);

                    break;

                case "AttributesThatDeltaPowerCost":
                    Result = ParseCostDeltaAttribute(item, Value, parsedFile, parsedKey);
                    break;

                case "AttributesThatDeltaResetTime":
                    Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatDeltaResetTimeList, Value);

                    break;

                case "AttributesThatDeltaWorksWhileStunned":
                    Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatDeltaWorksWhileStunnedList, Value);

                    break;

                case "AttributesThatModPowerCost":
                    Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatModPowerCostList, Value);

                    break;

                case "CanBeOnSidebar":
                    Result = SetBoolProperty((bool valueBool) => item.SetCanBeOnSidebar(valueBool), Value);
                    break;

                case "CanSuppressMonsterShout":
                    Result = SetBoolProperty((bool valueBool) => item.SetCanSuppressMonsterShout(valueBool), Value);
                    break;

                case "CanTargetUntargetableEnemies":
                    Result = SetBoolProperty((bool valueBool) => item.SetCanTargetUntargetableEnemies(valueBool), Value);
                    break;

                case "CausesOfDeath":
                    Result = StringToEnumConversion <Deaths> .TryParseList(Value, item.CausesOfDeathList);

                    break;

                case "Costs":
                    Result = ParseCosts(item, Value, parsedFile, parsedKey);
                    break;

                case "CombatRefreshBaseAmount":
                    Result = SetIntProperty((int valueInt) => item.RawCombatRefreshBaseAmount = valueInt, Value);
                    break;

                case "DamageType":
                    Result = StringToEnumConversion <DamageType> .SetEnum((DamageType valueEnum) => item.DamageType = valueEnum, DamageType.Internal_None, DamageType.Internal_Empty, Value);

                    break;

                case "DelayLoopIsAbortedIfAttacked":
                    Result = SetBoolProperty((bool valueBool) => item.SetDelayLoopIsAbortedIfAttacked(valueBool), Value);
                    break;

                case "DelayLoopMessage":
                    Result = SetStringProperty((string valueString) => item.DelayLoopMessage = valueString, Value);
                    break;

                case "DelayLoopTime":
                    Result = SetFloatProperty((float valueFloat) => item.RawDelayLoopTime = valueFloat, Value);
                    break;

                case "Description":
                    Result = SetStringProperty((string valueString) => item.Description = valueString, Value);
                    break;

                case "EffectKeywordsIndicatingEnabled":
                    Result = StringToEnumConversion <AbilityIndicatingEnabled> .SetEnum((AbilityIndicatingEnabled valueEnum) => item.EffectKeywordsIndicatingEnabled = valueEnum, Value);

                    break;

                case "ExtraKeywordsForTooltips":
                    Result = StringToEnumConversion <TooltipsExtraKeywords> .SetEnum((TooltipsExtraKeywords valueEnum) => item.ExtraKeywordsForTooltips = valueEnum, Value);

                    break;

                case "IconID":
                    Result = SetIconIdProperty((int valueInt) => item.RawIconId = valueInt, Value);
                    break;

                case "IgnoreEffectErrors":
                    Result = SetBoolProperty((bool valueBool) => item.SetIgnoreEffectErrors(valueBool), Value);
                    break;

                case "InternalAbility":
                    Result = SetBoolProperty((bool valueBool) => item.SetInternalAbility(valueBool), Value);
                    break;

                case "InternalName":
                    Result = SetStringProperty((string valueString) => item.InternalName = valueString, Value);
                    break;

                case "IsHarmless":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsHarmless(valueBool), Value);
                    break;

                case "ItemKeywordReqErrorMessage":
                    Result = SetStringProperty((string valueString) => item.ItemKeywordReqErrorMessage = valueString, Value);
                    break;

                case "ItemKeywordReqs":
                    Result = StringToEnumConversion <AbilityItemKeyword> .TryParseList(Value, item.ItemKeywordReqList);

                    break;

                case "Keywords":
                    Result = StringToEnumConversion <AbilityKeyword> .TryParseList(Value, item.KeywordList);

                    break;

                case "Level":
                    Result = SetIntProperty((int valueInt) => item.RawLevel = valueInt, Value);
                    break;

                case "Name":
                    Result = SetStringProperty((string valueString) => item.Name = valueString, Value);
                    break;

                case "PetTypeTagReq":
                    Result = StringToEnumConversion <AbilityPetType> .SetEnum((AbilityPetType valueEnum) => item.PetTypeTagReq = valueEnum, Value);

                    break;

                case "PetTypeTagReqMax":
                    Result = SetIntProperty((int valueInt) => item.RawPetTypeTagReqMax = valueInt, Value);
                    break;

                case "Prerequisite":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.Prerequisite_Key = valueAbility.Key, Value);

                    break;

                case "Projectile":
                    Result = StringToEnumConversion <AbilityProjectile> .SetEnum((AbilityProjectile valueEnum) => item.Projectile = valueEnum, Value);

                    break;

                case "PvE":
                    Result = Inserter <PgAbilityPvX> .SetItemProperty((PgAbilityPvX valueAbilityPvX) => item.PvE = valueAbilityPvX, Value);

                    break;

                case "PvP":
                    Result = Inserter <PgAbilityPvX> .SetItemProperty((PgAbilityPvX valueAbilityPvX) => item.PvP = valueAbilityPvX, Value);

                    break;

                case "ResetTime":
                    Result = SetFloatProperty((float valueFloat) => item.RawResetTime = valueFloat, Value);
                    break;

                case "SelfParticle":
                    Result = StringToEnumConversion <SelfParticle> .SetEnum((SelfParticle valueEnum) => item.SelfParticle = valueEnum, Value);

                    break;

                case "AmmoDescription":
                    Result = SetStringProperty((string valueString) => item.AmmoDescription = valueString, Value);
                    break;

                case "SharesResetTimerWith":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.SharesResetTimerWith_Key = valueAbility.Key, Value);

                    break;

                case "Skill":
                    Result = ParserSkill.Parse((PgSkill valueSkill) => item.Skill_Key = valueSkill.Key, Value, parsedFile, parsedKey);
                    break;

                case "SpecialCasterRequirements":
                    Result = Inserter <PgAbilityRequirement> .AddKeylessArray(item.SpecialCasterRequirementList, Value);

                    break;

                case "SpecialCasterRequirementsErrorMessage":
                    Result = SetStringProperty((string valueString) => item.SpecialCasterRequirementsErrorMessage = valueString, Value);
                    break;

                case "SpecialInfo":
                    Result = SetStringProperty((string valueString) => item.SpecialInfo = valueString, Value);
                    break;

                case "SpecialTargetingTypeReq":
                    Result = SetIntProperty((int valueInt) => item.RawSpecialTargetingTypeReq = valueInt, Value);
                    break;

                case "Target":
                    Result = StringToEnumConversion <AbilityTarget> .SetEnum((AbilityTarget valueEnum) => item.Target = valueEnum, Value);

                    break;

                case "TargetEffectKeywordReq":
                    Result = StringToEnumConversion <TargetEffectKeyword> .SetEnum((TargetEffectKeyword valueEnum) => item.TargetEffectKeywordReq = valueEnum, Value);

                    break;

                case "TargetParticle":
                    Result = StringToEnumConversion <AbilityTargetParticle> .SetEnum((AbilityTargetParticle valueEnum) => item.TargetParticle = valueEnum, Value);

                    break;

                case "UpgradeOf":
                    Result = Inserter <PgAbility> .SetItemByInternalName((PgAbility valueAbility) => item.UpgradeOf_Key = valueAbility.Key, Value);

                    break;

                case "WorksInCombat":
                    Result = SetBoolProperty((bool valueBool) => item.SetWorksInCombat(valueBool), Value);
                    break;

                case "WorksUnderwater":
                    Result = SetBoolProperty((bool valueBool) => item.SetWorksUnderwater(valueBool), Value);
                    break;

                case "WorksWhileFalling":
                    Result = SetBoolProperty((bool valueBool) => item.SetWorksWhileFalling(valueBool), Value);
                    break;

                case "DelayLoopIsOnlyUsedInCombat":
                    Result = SetBoolProperty((bool valueBool) => item.SetDelayLoopIsOnlyUsedInCombat(valueBool), Value);
                    break;

                case "AmmoKeywords":
                    Result = Inserter <PgAbilityAmmo> .AddKeylessArray(item.AmmoKeywordList, Value);

                    break;

                case "AmmoConsumeChance":
                    Result = SetFloatProperty((float valueFloat) => item.RawAmmoConsumeChance = valueFloat, Value);
                    break;

                case "AmmoStickChance":
                    Result = SetFloatProperty((float valueFloat) => item.RawAmmoStickChance = valueFloat, Value);
                    break;

                case "TargetTypeTagReq":
                    Result = ParseTargetTypeTagReq(item, Value, parsedFile, parsedKey);
                    break;

                case "WorksWhileMounted":
                    Result = SetBoolProperty((bool valueBool) => item.SetWorksWhileMounted(valueBool), Value);
                    break;

                case "SelfPreParticle":
                    Result = StringToEnumConversion <SelfPreParticle> .SetEnum((SelfPreParticle valueEnum) => item.SelfPreParticle = valueEnum, Value);

                    break;

                case "IsCosmeticPet":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsCosmeticPet(valueBool), Value);
                    break;

                case "WorksWhileStunned":
                    Result = SetBoolProperty((bool valueBool) => item.SetWorksWhileStunned(valueBool), Value);
                    break;

                default:
                    Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                    break;
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                if (item.PvE == null)
                {
                    return(Program.ReportFailure(parsedFile, parsedKey, $"PvE info missing"));
                }

                item.DigitStrippedName = CuteDigitStrippedName(item);
            }

            return(Result);
        }
Example #9
0
        private bool FinishItem(PgSkill item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey)
        {
            bool Result = true;

            foreach (KeyValuePair <string, object> Entry in contentTable)
            {
                string Key   = Entry.Key;
                object Value = Entry.Value;

                switch (Key)
                {
                case "Id":
                    Result = SetIntProperty((int valueInt) => item.RawId = valueInt, Value);
                    break;

                case "Description":
                    Result = SetStringProperty((string valueString) => item.Description = Tools.CleanedUpString(valueString), Value);
                    break;

                case "HideWhenZero":
                    Result = SetBoolProperty((bool valueBool) => item.SetHideWhenZero(valueBool), Value);
                    break;

                case "XpTable":
                    Result = Inserter <PgXpTable> .SetItemByInternalName((PgXpTable valueXpTable) => item.XpTable = valueXpTable, Value);

                    break;

                case "AdvancementTable":
                    Result = ParseAdvancementTable(item, Value, parsedFile, parsedKey);
                    break;

                case "Combat":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsCombatSkill(valueBool), Value);
                    break;

                case "TSysCompatibleCombatSkills":
                    Result = ParseCompatibleCombatSkills(item, Value, parsedFile, parsedKey);
                    break;

                case "MaxBonusLevels":
                    Result = SetIntProperty((int valueInt) => item.RawMaxBonusLevels = valueInt, Value);
                    break;

                case "InteractionFlagLevelCaps":
                    Result = ParseInteractionFlagLevelCaps(item, Value, parsedFile, parsedKey);
                    break;

                case "AdvancementHints":
                    Result = ParseAdvancementHints(item, Value, parsedFile, parsedKey);
                    break;

                case "Rewards":
                    Result = ParseRewards(item, Value, parsedFile, parsedKey);
                    break;

                case "Reports":
                    Result = ParseReports(item, Value, parsedFile, parsedKey);
                    break;

                case "Name":
                    Result = SetStringProperty((string valueString) => item.Name = valueString, Value);
                    break;

                case "Parents":
                    Result = Inserter <PgSkill> .AddPgObjectArrayByKey <PgSkill>(item.ParentSkillList, Value);

                    break;

                case "SkipBonusLevelsIfSkillUnlearned":
                    Result = SetBoolProperty((bool valueBool) => item.SetSkipBonusLevelsIfSkillUnlearned(valueBool), Value);
                    break;

                case "AuxCombat":
                    Result = SetBoolProperty((bool valueBool) => item.SetAuxCombat(valueBool), Value);
                    break;

                case "RecipeIngredientKeywords":
                    Result = StringToEnumConversion <ItemKeyword> .TryParseList(Value, item.RecipeIngredientKeywordList);

                    break;

                case "_RecipeIngredientKeywords":
                    Result = StringToEnumConversion <ItemKeyword> .TryParseList(Value, item.RecipeIngredientKeywordList);

                    break;

                case "GuestLevelCap":
                    Result = SetIntProperty((int valueInt) => item.RawGuestLevelCap = valueInt, Value);
                    break;

                case "IsFakeCombatSkill":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsFakeCombatSkill(valueBool), Value);
                    break;

                case "IsUmbrellaSkill":
                    Result = SetBoolProperty((bool valueBool) => item.SetIsUmbrellaSkill(valueBool), Value);
                    break;

                default:
                    Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled");
                    break;
                }

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                item.SkillAdvancementList.Sort(SortSkillAdvancementByLevel);
            }

            return(Result);
        }