コード例 #1
0
ファイル: ParserSkill.cs プロジェクト: dlebansais/PgJsonParse
        private bool ParseInteractionFlagLevelCaps(PgSkill item, object value, string parsedFile, string parsedKey)
        {
            PgLevelCapInteractionList ParsedLevelCapInteractionList = null !;

            if (!Inserter <PgLevelCapInteractionList> .SetItemProperty((PgLevelCapInteractionList valueLevelCapInteractionList) => ParsedLevelCapInteractionList = valueLevelCapInteractionList, value))
            {
                return(false);
            }

            foreach (PgLevelCapInteraction Item in ParsedLevelCapInteractionList.List)
            {
                int    Level    = Item.Level;
                string?SkillKey = Item.Skill_Key;

                PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementLevelCapInteraction()
                {
                    RawLevel = Level, Skill_Key = SkillKey
                };

                ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                item.SkillAdvancementList.Add(NewSkillAdvancement);
            }

            return(true);
        }
コード例 #2
0
ファイル: ParserSkill.cs プロジェクト: dlebansais/PgJsonParse
        private bool ParseReports(PgSkill item, object value, string parsedFile, string parsedKey)
        {
            PgReportList ParsedPeportList = null !;

            if (!Inserter <PgReportList> .SetItemProperty((PgReportList valueReportList) => ParsedPeportList = valueReportList, value))
            {
                return(false);
            }

            foreach (PgReport Report in ParsedPeportList.List)
            {
                item.ReportList.Add(Report);
            }

            return(true);
        }
コード例 #3
0
ファイル: ParserPower.cs プロジェクト: dlebansais/PgJsonParse
        private static bool ParseTiers(PgPower item, object value, string parsedFile, string parsedKey)
        {
            PgPowerTierList PowerTierList = null !;

            if (!Inserter <PgPowerTierList> .SetItemProperty((PgPowerTierList valuePowerTierList) => PowerTierList = valuePowerTierList, value))
            {
                return(false);
            }

            if (PowerTierList.TierList.Count == 0)
            {
                return(Program.ReportFailure(parsedFile, parsedKey, $"Power with no tiers"));
            }

            item.TierList = PowerTierList.TierList;
            return(true);
        }
コード例 #4
0
ファイル: ParserAI.cs プロジェクト: dlebansais/PgJsonParse
        private bool FinishItem(PgAI 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 "Abilities":
                    Result = Inserter <PgAIAbilitySet> .SetItemProperty((PgAIAbilitySet valueAIAbilitySet) => item.Abilities = valueAIAbilitySet, Value);

                    break;

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

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

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

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

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

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

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

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

                    break;

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

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

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

                if (!Result)
                {
                    break;
                }
            }

            return(Result);
        }
コード例 #5
0
        private bool FinishItem(PgStorageVault 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 "NpcFriendlyName":
                    Result = SetStringProperty((string valueString) => item.NpcFriendlyName = valueString, Value);
                    break;

                case "Area":
                    Result = ParseArea((MapAreaName valueEnum) => item.Area = valueEnum, Value, parsedFile, parsedKey);
                    break;

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

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

                case "Levels":
                    Result = Inserter <PgStorageFavorLevel> .SetItemProperty((PgStorageFavorLevel valueStorageFavorLevel) => item.Levels = valueStorageFavorLevel, Value);

                    break;

                case "Requirements":
                    Result = Inserter <PgStorageRequirement> .SetItemProperty((PgStorageRequirement valueStorageRequirement) => item.Requirement = valueStorageRequirement, Value);

                    break;

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

                case "Grouping":
                    Result = ParseArea((MapAreaName valueEnum) => item.Grouping = valueEnum, Value, parsedFile, parsedKey);
                    break;

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

                    break;

                case "SlotAttribute":
                    Result = Inserter <PgAttribute> .SetItemByKey((PgAttribute valueAttribute) => item.SlotAttribute_Key = valueAttribute.Key, Value);

                    break;

                case "EventLevels":
                    Result = Inserter <PgStorageEventList> .SetItemProperty((PgStorageEventList valueStorageEventLevel) => item.EventLevels = valueStorageEventLevel, Value);

                    break;

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

                if (!Result)
                {
                    break;
                }
            }

            if (Result)
            {
                if (!item.RawHasAssociatedNpc.HasValue || item.HasAssociatedNpc)
                {
                    Inserter <PgQuest> .SetNpc((PgNpcLocation npcLocation) => item.AssociatedNpc = npcLocation, item.Key, parsedFile, parsedKey, ErrorControl.IgnoreIfNotFound);
                }
            }

            return(Result);
        }
コード例 #6
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);
        }
コード例 #7
0
ファイル: ParserSkill.cs プロジェクト: dlebansais/PgJsonParse
        private bool ParseRewards(PgSkill item, object value, string parsedFile, string parsedKey)
        {
            PgRewardList ParsedRewardList = null !;

            if (!Inserter <PgRewardList> .SetItemProperty((PgRewardList valueRewardList) => ParsedRewardList = valueRewardList, value))
            {
                return(false);
            }

            foreach (PgReward Reward in ParsedRewardList.List)
            {
                int         Level = Reward.RewardLevel;
                List <Race> RaceRestrictionList = Reward.RaceRestrictionList;
                string?     AbilityKey          = Reward.Ability_Key;
                string?     BonusLevelSkillKey  = Reward.BonusLevelSkill_Key;
                string?     RecipeKey           = Reward.Recipe_Key;
                string      Notes = Reward.Notes;

                if (AbilityKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardAbility()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Ability_Key = AbilityKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (BonusLevelSkillKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardBonusLevel()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, BonusLevelSkill_Key = BonusLevelSkillKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (RecipeKey != null)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementRewardRecipe()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Recipe_Key = RecipeKey
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }

                if (Notes.Length > 0)
                {
                    PgSkillAdvancement NewSkillAdvancement = new PgSkillAdvancementNotes()
                    {
                        RawLevel = Level, RaceRestrictionList = RaceRestrictionList, Text = Notes
                    };

                    ParsingContext.AddSuplementaryObject(NewSkillAdvancement);
                    item.SkillAdvancementList.Add(NewSkillAdvancement);
                }
            }

            return(true);
        }