private bool ParseArea(Action <MapAreaName> setter, object value, string parsedFile, string parsedKey) { if (!(value is string ValueString)) { return(Program.ReportFailure($"Value {value} was expected to be a string")); } MapAreaName Area; if (ValueString == "*") { Area = MapAreaName.Any; StringToEnumConversion <MapAreaName> .SetCustomParsedEnum(Area); } else if (ValueString.StartsWith("Area")) { string AreaString = ValueString.Substring(4); if (!StringToEnumConversion <MapAreaName> .TryParse(AreaString, out Area)) { return(false); } } else { return(Program.ReportFailure($"Invalid area name {ValueString}")); } setter(Area); return(true); }
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}'")); }
public Sentence(string format, List <CombatKeyword> combatKeywordList, SignInterpretation signInterpretation) { Format = format; AssociatedKeywordList = combatKeywordList; SignInterpretation = signInterpretation; foreach (CombatKeyword Keyword in AssociatedKeywordList) { StringToEnumConversion <CombatKeyword> .SetCustomParsedEnum(Keyword); } }
public Sentence(string format, CombatKeyword associatedKeyword) { Format = format; AssociatedKeywordList = new List <CombatKeyword>() { associatedKeyword }; SignInterpretation = SignInterpretation.Normal; foreach (CombatKeyword Keyword in AssociatedKeywordList) { StringToEnumConversion <CombatKeyword> .SetCustomParsedEnum(Keyword); } }
private bool ParseKeywordAsRarity(PgNpcPreference item, string value, string parsedFile, string parsedKey) { if (value == "Uncommon") { item.RarityRequirement = RecipeItemKey.Rarity_Uncommon; } else if (value == "Common") { item.RarityRequirement = RecipeItemKey.Rarity_Common; } else { return(Program.ReportFailure(parsedFile, parsedKey, $"Invalid rarity '{value}'")); } StringToEnumConversion <RecipeItemKey> .SetCustomParsedEnum(item.RarityRequirement); return(true); }