private bool FinishItem(PgItemSkillLink item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey) { if (contentTable.Count == 0) { return(Program.ReportFailure(parsedFile, parsedKey, $"At least one skill expected in a skill link")); } foreach (KeyValuePair <string, object> Entry in contentTable) { string Key = Entry.Key; object Value = Entry.Value; PgSkill ParsedSkill = null !; if (!ParserSkill.Parse((PgSkill valueSkill) => ParsedSkill = valueSkill, Key, parsedFile, parsedKey)) { return(false); } int ParsedLevel = -1; if (!SetIntProperty((int valueInt) => ParsedLevel = valueInt, Value)) { return(false); } if (item.SkillTable.ContainsKey(ParsedSkill.Key)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Skill {Key} already parsed in skill link")); } item.SkillTable.Add(ParsedSkill.Key, ParsedLevel); } return(true); }
private static bool FinishItemActiveCombatSkill(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) { PgQuestObjectiveRequirementActiveCombatSkill NewItem = new PgQuestObjectiveRequirementActiveCombatSkill(); 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 "Skill": Result = ParserSkill.Parse((PgSkill valueSkill) => NewItem.Skill_Key = valueSkill.Key, Value, parsedFile, parsedKey); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
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); }
private bool FinishItem(PgPower 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 "Prefix": Result = SetStringProperty((string valueString) => item.Prefix = valueString, Value); break; case "Suffix": Result = SetStringProperty((string valueString) => item.Suffix = valueString, Value); break; case "Tiers": Result = ParseTiers(item, Value, parsedFile, parsedKey); break; case "Slots": Result = StringToEnumConversion <ItemSlot> .TryParseList(Value, item.SlotList); break; case "Skill": Result = ParserSkill.Parse((PgSkill valueSkill) => item.Skill_Key = valueSkill.Key, Value, parsedFile, parsedKey); break; case "IsUnavailable": Result = SetBoolProperty((bool valueBool) => item.RawIsUnavailable = valueBool, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private bool ParseSourceAutomaticFromSkill(ref object?item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey) { bool Result = true; PgSourceAutomaticFromSkill NewSource = new PgSourceAutomaticFromSkill(); foreach (KeyValuePair <string, object> Entry in contentTable) { string Key = Entry.Key; object Value = Entry.Value; switch (Key) { case "Type": break; case "SkillTypeId": Result = ParserSkill.Parse((PgSkill valueSkill) => NewSource.Skill_Key = valueSkill.Key, Value, parsedFile, parsedKey); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } if (Result) { item = NewSource; return(true); } else { return(false); } }
private bool ParseInteraction(PgLevelCapInteractionList item, string interaction, int level, string parsedFile, string parsedKey) { if (interaction.Length > 0 && char.IsDigit(interaction[interaction.Length - 1])) { int FirstDigitIndex = interaction.Length - 1; while (FirstDigitIndex > 0 && char.IsDigit(interaction[FirstDigitIndex - 1])) { FirstDigitIndex--; } if (FirstDigitIndex > 0 && interaction[FirstDigitIndex - 1] != '_' && interaction[FirstDigitIndex - 1] != ' ') { interaction = interaction.Substring(0, FirstDigitIndex) + "_" + interaction.Substring(FirstDigitIndex); } } string[] Split = interaction.Split('_'); if (Split.Length < 3 || Split[0] != "LevelCap") { return(Program.ReportFailure($"Invalid level cap interaction '{interaction}'")); } string MergedSkill = string.Empty; int i; for (i = 1; i + 1 < Split.Length; i++) { if (MergedSkill.Length > 0) { MergedSkill += "_"; } MergedSkill += Split[i]; } if (MergedSkill == "Dance") { MergedSkill = "Performance_Dance"; } PgSkill ParsedSkill = null !; if (!ParserSkill.Parse((PgSkill valueSkill) => ParsedSkill = valueSkill, MergedSkill, parsedFile, parsedKey)) { return(false); } int OtherLevel; if (!int.TryParse(Split[i], out OtherLevel) || OtherLevel <= 0) { return(Program.ReportFailure($"Invalid level cap interaction '{interaction}'")); } if (OtherLevel != level + 10 && OtherLevel != level + 5) { return(Program.ReportFailure("Inconsistent interaction level cap")); } PgLevelCapInteraction NewInteraction = new PgLevelCapInteraction(); NewInteraction.RawLevel = level; NewInteraction.RawRangeUnlock = OtherLevel - level; NewInteraction.Skill_Key = ParsedSkill.Key; ParsingContext.AddSuplementaryObject(NewInteraction); item.List.Add(NewInteraction); return(true); }
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); }
private bool FinishItem(PgQuest item, Dictionary <string, object> contentTable, Dictionary <string, Json.Token> contentTypeTable, List <object> itemCollection, Json.Token lastItemType, string parsedFile, string parsedKey) { bool Result = true; int? RawTSysLevel = null; foreach (KeyValuePair <string, object> Entry in contentTable) { string Key = Entry.Key; object Value = Entry.Value; switch (Key) { case "InternalName": Result = SetStringProperty((string valueString) => item.InternalName = valueString, Value); break; case "Name": Result = SetStringProperty((string valueString) => item.Name = valueString, Value); break; case "Description": Result = SetStringProperty((string valueString) => item.Description = Tools.CleanedUpString(valueString), Value); break; case "Version": Result = SetIntProperty((int valueInt) => item.RawVersion = valueInt, Value); break; case "RequirementsToSustain": Result = Inserter <PgQuestRequirement> .AddKeylessArray(item.QuestRequirementToSustainList, Value); break; case "ReuseTime_Minutes": Result = SetTimeProperty(() => item.RawReuseTime, (TimeSpan valueTime) => item.RawReuseTime = valueTime, 1, Value); break; case "ReuseTime_Hours": Result = SetTimeProperty(() => item.RawReuseTime, (TimeSpan valueTime) => item.RawReuseTime = valueTime, 60, Value); break; case "ReuseTime_Days": Result = SetTimeProperty(() => item.RawReuseTime, (TimeSpan valueTime) => item.RawReuseTime = valueTime, 60 * 24, Value); break; case "IsCancellable": Result = SetBoolProperty((bool valueBool) => item.SetIsCancellable(valueBool), Value); break; case "Objectives": Result = Inserter <PgQuestObjective> .AddKeylessArray(item.QuestObjectiveList, Value); break; /* case "Rewards_XP": * Result = Inserter<PgQuestReward>.AddKeylessArray(item.QuestRewardList, Value); * break;*/ /* case "Rewards_Currency": * Result = Inserter<PgQuestReward>.AddKeylessArray(item.QuestRewardList, Value); * break;*/ case "Rewards_Items": Result = Inserter <PgQuestReward> .AddKeylessArray(item.QuestRewardList, Value); break; case "Reward_CombatXP": Result = ParseRewardCombatXp(item, Value, parsedFile, parsedKey); break; case "QuestNpc": Result = Inserter <PgQuest> .SetNpc((PgNpcLocation npcLocation) => item.QuestNpc = npcLocation, Value, parsedFile, parsedKey); break; case "FavorNpc": Result = Inserter <PgQuest> .SetNpc((PgNpcLocation npcLocation) => item.FavorNpc = npcLocation, Value, parsedFile, parsedKey); break; case "PrefaceText": Result = SetStringProperty((string valueString) => item.PrefaceText = Tools.CleanedUpString(valueString), Value); break; case "SuccessText": Result = SetStringProperty((string valueString) => item.SuccessText = Tools.CleanedUpString(valueString), Value); break; case "MidwayText": Result = SetStringProperty((string valueString) => item.MidwayText = Tools.CleanedUpString(valueString), Value); break; case "PrerequisiteFavorLevel": Result = StringToEnumConversion <Favor> .SetEnum((Favor valueEnum) => item.PrerequisiteFavorLevel = valueEnum, Value); break; case "Rewards_Favor": Result = ParseRewardFavor(item, Value, parsedFile, parsedKey); break; /* case "Rewards_Recipes": * Result = ParseRewardRecipes(item, Value, parsedFile, parsedKey); * break;*/ /* case "Rewards_Ability": * Result = ParseRewardAbility(item, Value, parsedFile, parsedKey); * break;*/ case "Requirements": Result = Inserter <PgQuestRequirement> .AddKeylessArray(item.QuestRequirementList, Value); break; case "Reward_Favor": Result = ParseRewardFavor(item, Value, parsedFile, parsedKey); break; case "Rewards": Result = Inserter <PgQuestReward> .AddKeylessArray(item.QuestRewardList, Value); break; case "PreGiveItems": Result = Inserter <PgQuestReward> .AddKeylessArray(item.PreGiveItemList, Value); break; case "TSysLevel": Result = SetIntProperty((int valueInt) => RawTSysLevel = valueInt, Value); break; /*case "Reward_Gold": * Result = ParseRewardCurrency(item, Value, parsedFile, parsedKey); * break;*/ case "Rewards_NamedLootProfile": Result = ParseRewardNamedLootProfile(item, Value, parsedFile, parsedKey); break; case "PreGiveRecipes": Result = Inserter <PgRecipe> .AddPgObjectArrayByInternalName <PgRecipe>(item.PreGiveRecipeList, Value); break; case "Keywords": Result = StringToEnumConversion <QuestKeyword> .TryParseList(Value, item.KeywordList); break; case "Rewards_Effects": Result = ParseRewardEffects(item, Value, parsedFile, parsedKey); break; case "IsAutoPreface": Result = SetBoolProperty((bool valueBool) => item.SetIsAutoPreface(valueBool), Value); break; case "IsAutoWrapUp": Result = SetBoolProperty((bool valueBool) => item.SetIsAutoWrapUp(valueBool), Value); break; case "GroupingName": Result = StringToEnumConversion <QuestGroupingName> .SetEnum((QuestGroupingName valueEnum) => item.GroupingName = valueEnum, Value); break; case "IsGuildQuest": Result = SetBoolProperty((bool valueBool) => item.SetIsGuildQuest(valueBool), Value); break; case "NumExpectedParticipants": Result = SetIntProperty((int valueInt) => item.RawNumExpectedParticipants = valueInt, Value); break; case "Level": Result = SetIntProperty((int valueInt) => item.RawLevel = valueInt, Value); break; case "WorkOrderSkill": Result = ParserSkill.Parse((PgSkill valueSkill) => item.WorkOrderSkill_Key = valueSkill.Key, Value, parsedFile, parsedKey); break; case "DisplayedLocation": Result = StringToEnumConversion <MapAreaName> .SetEnum((MapAreaName valueEnum) => item.DisplayedLocation = valueEnum, Value); break; case "FollowUpQuests": Result = ParseFollowUpQuests(item, Value, parsedFile, parsedKey); break; case "PreGiveEffects": Result = ParsePreGiveEffects(item, Value, parsedFile, parsedKey); break; case "MidwayGiveItems": Result = Inserter <PgQuestReward> .AddKeylessArray(item.QuestMidwayGiveItemList, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } if (Result) { if (item.RawLevel.HasValue && RawTSysLevel.HasValue) { return(Program.ReportFailure(parsedFile, parsedKey, "Both levels set")); } if (RawTSysLevel.HasValue) { Debug.Assert(!item.RawLevel.HasValue); item.RawLevel = RawTSysLevel; } } return(Result); }