private bool FinishItem(PgAbilityAmmo 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 "ItemKeyword": Result = StringToEnumConversion <ItemKeyword> .SetEnum((ItemKeyword valueEnum) => item.ItemKeyword = valueEnum, Value); break; case "Count": Result = SetIntProperty((int valueInt) => item.RawCount = valueInt, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private bool FinishItem(PgSpecialValue 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 "Label": Result = SetStringProperty((string valueString) => item.Label = valueString, Value); break; case "Suffix": Result = SetStringProperty((string valueString) => item.Suffix = valueString, Value); break; case "Value": Result = SetFloatProperty((float valueFloat) => item.RawValue = valueFloat, Value); break; case "AttributesThatDelta": Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatDeltaList, Value); break; case "AttributesThatMod": Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatModList, Value); break; case "AttributesThatModBase": Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatModBaseList, Value); break; case "DisplayType": Result = StringToEnumConversion <DisplayType> .SetEnum((DisplayType valueEnum) => item.DisplayType = valueEnum, Value); break; case "SkipIfZero": Result = SetBoolProperty((bool valueBool) => item.RawSkipIfZero = valueBool, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private bool ParseDroppedAppearance(PgItem item, object value, string parsedFile, string parsedKey) { if (!(value is string ValueString)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{value}' was expected to be a string")); } string AppearanceString; int index = ValueString.IndexOf('('); if (index > 0) { if (index >= ValueString.Length - 2 || !ValueString.EndsWith(")")) { return(Program.ReportFailure(parsedFile, parsedKey, $"'{value}' is an invalid dropped appareance")); } AppearanceString = ValueString.Substring(0, index); string[] Details = ValueString.Substring(index + 1, ValueString.Length - index - 2).Split(';'); if (!ParseDroppedAppearanceDetails(item, Details, parsedFile, parsedKey)) { return(false); } } else { AppearanceString = ValueString; } return(StringToEnumConversion <ItemDroppedAppearance> .SetEnum((ItemDroppedAppearance valueEnum) => item.DroppedAppearance = valueEnum, AppearanceString)); }
private static bool FinishItemPetCount(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) { PgQuestObjectiveRequirementPetCount NewItem = new PgQuestObjectiveRequirementPetCount(); 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 "MinCount": Result = SetIntProperty((int valueInt) => NewItem.MinCount = valueInt, Value); break; case "MaxCount": Result = SetIntProperty((int valueInt) => NewItem.MaxCount = valueInt, Value); break; case "PetTypeTag": Result = StringToEnumConversion <RecipeKeyword> .SetEnum((RecipeKeyword valueEnum) => NewItem.PetTypeTag = valueEnum, Value); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
private static bool FinishItemMinFavorLevel(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) { PgQuestRequirementMinFavorLevel NewItem = new PgQuestRequirementMinFavorLevel(); 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 "Npc": Result = Inserter <PgQuest> .SetNpc((PgNpcLocation npcLocation) => NewItem.FavorNpc = npcLocation, Value, parsedFile, parsedKey); break; case "Level": Result = StringToEnumConversion <Favor> .SetEnum((Favor valueEnum) => NewItem.FavorLevel = valueEnum, Value); break; /*case "Quest": * Result = Inserter<PgQuest>.SetItemByInternalName((PgQuest valueQuest) => NewItem.QuestList.Add(valueQuest), Value); * break;*/ default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
private bool FinishItem(PgLoreBook 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 "Title": Result = SetStringProperty((string valueString) => item.Title = valueString, Value); break; case "LocationHint": Result = SetStringProperty((string valueString) => item.LocationHint = valueString, Value); break; case "Category": Result = ParserLoreBookInfoCategory(item, Value, parsedFile, parsedKey); break; case "Keywords": Result = StringToEnumConversion <LoreBookKeyword> .TryParseList(Value, item.KeywordList); break; case "IsClientLocal": Result = SetBoolProperty((bool valueBool) => item.RawIsClientLocal = valueBool, Value); break; case "Visibility": Result = StringToEnumConversion <LoreBookVisibility> .SetEnum((LoreBookVisibility valueEnum) => item.Visibility = valueEnum, Value); break; case "InternalName": Result = SetStringProperty((string valueString) => item.InternalName = valueString, Value); break; case "Text": Result = SetStringProperty((string valueString) => item.Text = Tools.CleanedUpString(valueString), Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private bool FinishItem(PgItemBehavior 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 "UseVerb": Result = StringToEnumConversion <ItemUseVerb> .SetEnum((ItemUseVerb valueEnum) => item.UseVerb = valueEnum, Value); break; case "UseRequirements": Result = StringToEnumConversion <ItemUseRequirement> .TryParseList(Value, item.UseRequirementList); break; case "UseAnimation": Result = StringToEnumConversion <ItemUseAnimation> .SetEnum((ItemUseAnimation valueEnum) => item.UseAnimation = valueEnum, Value); break; case "UseDelayAnimation": Result = StringToEnumConversion <ItemUseAnimation> .SetEnum((ItemUseAnimation valueEnum) => item.UseDelayAnimation = valueEnum, Value); break; case "MetabolismCost": Result = SetIntProperty((int valueInt) => item.RawMetabolismCost = valueInt, Value); break; case "UseDelay": Result = SetFloatProperty((float valueFloat) => item.RawUseDelay = valueFloat, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } if (!contentTable.ContainsKey("UseVerb")) { Result = Program.ReportFailure(parsedFile, parsedKey, "Behavior has no verb"); } return(Result); }
private static bool FinishItemWorkOrderCurrency(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) { PgQuestRewardWorkOrderCurrency NewItem = new PgQuestRewardWorkOrderCurrency(); 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 "Currency": Result = StringToEnumConversion <Currency> .SetEnum((Currency valueEnum) => NewItem.Currency = valueEnum, Value); break; case "Amount": Result = SetIntProperty((int valueInt) => NewItem.RawAmount = valueInt, Value); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
public static bool ParseAreaEvent(object value, string parsedFile, string parsedKey, out MapAreaName areaName) { areaName = MapAreaName.Internal_None; if (!(value is string AreaString)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{value}' was expected to be a string")); } if (AreaString == "Daytime") { areaName = MapAreaName.Daytime; StringToEnumConversion <MapAreaName> .SetCustomParsedEnum(areaName); return(true); } if (AreaString == "PovusNightlyQuest") { areaName = MapAreaName.PovusNightlyQuest; StringToEnumConversion <MapAreaName> .SetCustomParsedEnum(areaName); return(true); } int AreaIndex = AreaString.LastIndexOf('_'); if (AreaIndex > 0) { int KeyIndex = AreaString.LastIndexOf('_', AreaIndex - 1); if (KeyIndex > 0) { string AreaName = AreaString.Substring(AreaIndex + 1); string KeyName = AreaString.Substring(KeyIndex + 1, AreaIndex - KeyIndex - 1); string QuestName = AreaString.Substring(0, KeyIndex); if (AreaName == "Ilmari") { AreaName = "Desert1"; } else if (AreaName == "Kur") { AreaName = "KurMountains"; } MapAreaName ParsedAreaName = MapAreaName.Internal_None; bool Result = StringToEnumConversion <MapAreaName> .SetEnum((MapAreaName valueEnum) => ParsedAreaName = valueEnum, AreaName); areaName = ParsedAreaName; return(Result); } } return(Program.ReportFailure(parsedFile, parsedKey, $"Unknown area '{AreaString}'")); }
private bool FinishItem(PgAttribute 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 "Label": Result = SetStringProperty((string valueString) => item.Label = valueString, Value); break; case "IconIds": Result = ParseIcondIds(item, Value, parsedFile, parsedKey); break; case "Tooltip": Result = SetStringProperty((string valueString) => item.Tooltip = valueString, Value); break; case "DisplayType": Result = StringToEnumConversion <DisplayType> .SetEnum((DisplayType valueEnum) => item.DisplayType = valueEnum, Value); break; case "IsHidden": Result = SetBoolProperty((bool valueBool) => item.RawIsHidden = valueBool, Value); break; case "DisplayRule": Result = StringToEnumConversion <DisplayRule> .SetEnum((DisplayRule valueEnum) => item.DisplayRule = valueEnum, Value); break; case "DefaultValue": Result = SetFloatProperty((float valueFloat) => item.RawDefaultValue = valueFloat, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private bool ParseInternamName(PgXpTable item, object value, string parsedFile, string parsedKey) { if (!(value is string ValueString)) { return(Program.ReportFailure($"Value '{value}' was expected to be a string")); } item.InternalName = ValueString; StringToEnumConversion <XpTableEnum> .SetEnum((XpTableEnum valueEnum) => item.AsEnum = valueEnum, value); return(true); }
private bool FinishItem(PgAIAbility 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 "minLevel": Result = SetIntProperty((int valueInt) => item.RawMinLevel = valueInt, Value); break; case "maxLevel": Result = SetIntProperty((int valueInt) => item.RawMaxLevel = valueInt, Value); break; case "minDistance": Result = SetIntProperty((int valueInt) => item.RawMinDistance = valueInt, Value); break; case "minRange": Result = SetFloatProperty((float valueFloat) => item.RawMinRange = valueFloat, Value); break; case "maxRange": Result = SetIntProperty((int valueInt) => item.RawMaxRange = valueInt, Value); break; case "cue": Result = StringToEnumConversion <AbilityCue> .SetEnum((AbilityCue valueEnum) => item.Cue = valueEnum, Value); break; case "cueVal": Result = SetIntProperty((int valueInt) => item.RawCueValue = valueInt, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }
private static bool FinishItemInteractionFlagSet(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) { PgAbilityRequirementInteractionFlagSet NewItem = new PgAbilityRequirementInteractionFlagSet(); 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 "InteractionFlag": Result = StringToEnumConversion <InteractionFlag> .SetEnum((InteractionFlag valueEnum) => NewItem.InteractionFlag = valueEnum, 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); } }
private static bool FinishEquipmentSlotEmpty(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) { PgQuestObjectiveRequirementEquipmentSlotEmpty NewItem = new PgQuestObjectiveRequirementEquipmentSlotEmpty(); 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 "Slot": Result = StringToEnumConversion <ItemSlot> .SetEnum((ItemSlot valueEnum) => NewItem.Slot = valueEnum, Value); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { item = NewItem; return(true); } else { return(false); } }
private bool ParseAreaName(PgNpc item, object value, string parsedFile, string parsedKey) { if (!(value is string ValueKey)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Value '{value}' was expected to be a string")); } if (!ValueKey.StartsWith("Area")) { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid area name '{ValueKey}'")); } string ValueAreaName = ValueKey.Substring(4); return(StringToEnumConversion <MapAreaName> .SetEnum((MapAreaName valueEnum) => item.AreaName = valueEnum, ValueAreaName)); }
private static bool FinishItemDisallowedItemKeyword(PgAbilityRequirementDisallowedItemKeyword 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) { 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 "MaxCount": Result = ParseEquippedItemKeywordMaxCount(Value, parsedFile, parsedKey); break; case "Keyword": Result = StringToEnumConversion <ItemKeyword> .SetEnum((ItemKeyword valueEnum) => item.Keyword = valueEnum, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } } if (!Result) { break; } } return(Result); }
private bool FinishItem(PgRecipeCost 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 "Currency": Result = StringToEnumConversion <RecipeCurrency> .SetEnum((RecipeCurrency valueEnum) => item.Currency = valueEnum, Value); break; case "Price": Result = SetFloatProperty((float valueFloat) => item.RawPrice = valueFloat, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } if (Result) { if (item.Currency == RecipeCurrency.Internal_None || !item.RawPrice.HasValue) { return(Program.ReportFailure(parsedFile, parsedKey, "Missing cost info")); } } return(Result); }
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); }
private static bool FinishItemRace(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) { bool Result = true; Race AllowedRace = Race.Internal_None; Race DisallowedRace = Race.Internal_None; 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 "AllowedRace": Result = StringToEnumConversion <Race> .SetEnum((Race valueEnum) => AllowedRace = valueEnum, Value); break; case "DisallowedRace": Result = StringToEnumConversion <Race> .SetEnum((Race valueEnum) => DisallowedRace = valueEnum, Value); break; default: Result = Program.ReportFailure("Unexpected failure"); break; } } if (!Result) { break; } } if (Result) { if (AllowedRace != Race.Internal_None && DisallowedRace != Race.Internal_None) { return(Program.ReportFailure(parsedFile, parsedKey, "Unexpected allowed and disallowed race")); } else if (AllowedRace == Race.Internal_None && DisallowedRace == Race.Internal_None) { return(Program.ReportFailure(parsedFile, parsedKey, "Missing race")); } else if (AllowedRace != Race.Internal_None) { Debug.Assert(DisallowedRace == Race.Internal_None); PgQuestRequirementAllowedRace NewItem = new PgQuestRequirementAllowedRace() { Race = AllowedRace }; item = NewItem; return(true); } else { Debug.Assert(AllowedRace == Race.Internal_None); PgQuestRequirementDisallowedRace NewItem = new PgQuestRequirementDisallowedRace() { Race = DisallowedRace }; item = NewItem; return(true); } } else { return(false); } }
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); }
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 ParseDroppedAppearanceDetails(PgItem item, string[] details, string parsedFile, string parsedKey) { bool Result = true; foreach (string Detail in details) { string[] Splitted = Detail.Split('='); if (Splitted.Length != 2) { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid pair in dropped appaearance detail '{Detail}'")); } string DetailKey = Splitted[0].Trim(); string DetailValue = Splitted[1].Trim(); if (string.IsNullOrEmpty(DetailKey) || string.IsNullOrEmpty(DetailValue)) { return(Program.ReportFailure(parsedFile, parsedKey, $"Empty key or value in dropped appaearance detail '{Detail}'")); } switch (DetailKey) { case "Skin": if (DetailValue.StartsWith("^")) { Result = StringToEnumConversion <AppearanceSkin> .SetEnum((AppearanceSkin valueEnum) => item.ItemAppearanceSkin = valueEnum, DetailValue.Substring(1)); } else { Result = Program.ReportFailure(parsedFile, parsedKey, $"Unknown key in dropped appaearance detail '{Detail}'"); } break; case "^Skin": Result = StringToEnumConversion <AppearanceSkin> .SetEnum((AppearanceSkin valueEnum) => item.ItemAppearanceSkin = valueEnum, DetailValue); break; case "^Cork": Result = StringToEnumConversion <AppearanceSkin> .SetEnum((AppearanceSkin valueEnum) => item.ItemAppearanceCork = valueEnum, DetailValue); break; case "^Food": Result = StringToEnumConversion <AppearanceSkin> .SetEnum((AppearanceSkin valueEnum) => item.ItemAppearanceFood = valueEnum, DetailValue); break; case "^Plate": Result = StringToEnumConversion <AppearanceSkin> .SetEnum((AppearanceSkin valueEnum) => item.ItemAppearancePlate = valueEnum, DetailValue); break; case "Skin_Color": Result = ParseDroppedAppearanceSkinColor(item, DetailValue, parsedFile, parsedKey); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Unknown key in dropped appaearance detail '{Detail}'"); break; } if (!Result) { break; } } return(Result); }
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); }
private bool FinishItem(PgDoT 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 "DamagePerTick": Result = SetIntProperty((int valueInt) => item.RawDamagePerTick = valueInt, Value); break; case "NumTicks": Result = SetIntProperty((int valueInt) => item.RawNumTicks = valueInt, Value); break; case "Duration": Result = SetIntProperty((int valueInt) => item.RawDuration = valueInt, Value); break; case "DamageType": Result = StringToEnumConversion <DamageType> .SetEnum((DamageType valueEnum) => item.DamageType = valueEnum, Value); break; case "SpecialRules": Result = StringToEnumConversion <DoTSpecialRule> .TryParseList(Value, item.SpecialRuleList); break; case "AttributesThatDelta": Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatDeltaList, Value); break; case "AttributesThatMod": Result = Inserter <PgAttribute> .AddPgObjectArrayByKey <PgAttribute>(item.AttributesThatModList, Value); break; case "Preface": Result = SetStringProperty((string valueString) => item.Preface = valueString, Value); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } if (!Result) { return(false); } if (item.RawDamagePerTick == null) { return(Program.ReportFailure(parsedFile, parsedKey, $"Unexpected empty damage per tick")); } if (item.DamageType == DamageType.Internal_None || item.DamageType == DamageType.Internal_Empty) { return(Program.ReportFailure(parsedFile, parsedKey, $"Unexpected empty damage type")); } if (item.RawNumTicks == null) { return(Program.ReportFailure(parsedFile, parsedKey, $"Unexpected empty num tick")); } if (item.RawDuration == null) { return(Program.ReportFailure(parsedFile, parsedKey, $"Unexpected empty duration")); } return(true); }
private bool ParseKeywordAsEquipmentSlot(PgNpcPreference item, string value, string parsedFile, string parsedKey) { return(StringToEnumConversion <ItemSlot> .SetEnum((ItemSlot valueEnum) => item.SlotRequirement = valueEnum, value)); }
private bool FinishItem(PgEffect 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 "Name": Result = SetStringProperty((string valueString) => item.Name = valueString, Value); break; case "Desc": Result = SetStringProperty((string valueString) => item.Description = valueString, Value); break; case "IconId": Result = SetIconIdProperty((int valueInt) => item.RawIconId = valueInt, Value); break; case "DisplayMode": Result = StringToEnumConversion <EffectDisplayMode> .SetEnum((EffectDisplayMode valueEnum) => item.DisplayMode = valueEnum, Value); break; case "SpewText": Result = SetStringProperty((string valueString) => item.SpewText = valueString, Value); break; case "Particle": Result = StringToEnumConversion <EffectParticle> .SetEnum((EffectParticle valueEnum) => item.Particle = valueEnum, Value); break; case "StackingType": Result = StringToEnumConversion <EffectStackingType> .SetEnum((EffectStackingType valueEnum) => item.StackingType = valueEnum, Value); break; case "StackingPriority": Result = SetIntProperty((int valueInt) => item.RawStackingPriority = valueInt, Value); break; case "Duration": ParseDuration(item, Value, parsedFile, parsedKey); break; case "Keywords": Result = StringToEnumConversion <EffectKeyword> .TryParseList(Value, item.KeywordList); break; case "AbilityKeywords": Result = StringToEnumConversion <AbilityKeyword> .TryParseList(Value, item.AbilityKeywordList); break; default: Result = Program.ReportFailure(parsedFile, parsedKey, $"Key '{Key}' not handled"); break; } if (!Result) { break; } } return(Result); }