private static bool IsBuggedDescription(string description, List <int> iconIdList, string startPattern, string endPattern, string attributeKey, out PgPowerEffect fixedEffect) { int StartIndex = description.IndexOf(startPattern); int EndIndex = description.LastIndexOf(endPattern); PgAttribute ParsedAttribute = null !; if (StartIndex == 0 && EndIndex > startPattern.Length && Tools.TryParseFloat(description.Substring(startPattern.Length, EndIndex - startPattern.Length), out float ParsedEffect, out FloatFormat ParsedEffectFormat) && Inserter <PgAttribute> .SetItemByKey((PgAttribute valueAttribute) => ParsedAttribute = valueAttribute, attributeKey)) { PgPowerEffectAttribute NewPowerEffectAttribute = new PgPowerEffectAttribute() { Description = description, IconIdList = iconIdList, AttributeEffect = ParsedEffect, AttributeEffectFormat = ParsedEffectFormat }; NewPowerEffectAttribute.SetAttribute(ParsedAttribute); fixedEffect = NewPowerEffectAttribute; return(true); }
private static bool ParseItemEffectSimple(string effectString, string parsedFile, string parsedKey, out PgPowerEffect powerEffect) { string Description = effectString.Trim(); List <int> IconIdList = new List <int>(); string IconIdPattern = "<icon="; for (; ;) { if (IconIdList.Count > 0 && Description.Contains(IconIdPattern)) { Description = Description.Trim(); } if (Description.Length < IconIdPattern.Length) { break; } if (!Description.StartsWith(IconIdPattern)) { break; } int EndIndex = Description.IndexOf('>'); if (EndIndex < IconIdPattern.Length + 1) { break; } string IdString = Description.Substring(IconIdPattern.Length, EndIndex - IconIdPattern.Length); int Id; if (!int.TryParse(IdString, out Id)) { break; } if (parsedKey == "power_24154" && Id == 3553) { Id = 3547; // Fix combo rip+bat stability -> bat stability icon. } if (!IconIdList.Contains(Id)) { IconIdList.Add(Id); } Description = Description.Substring(EndIndex + 1); } if (IsBuggedDescription(Description, IconIdList, out PgPowerEffect FixedEffect)) { powerEffect = FixedEffect; } else { powerEffect = new PgPowerEffectSimple() { Description = Description, IconIdList = IconIdList } }; return(true); }
private static bool IsBuggedDescription(string description, List <int> iconIdList, out PgPowerEffect fixedEffect) { if (IsBuggedDescription(description, iconIdList, "Tough Hoof deals ", " Trauma damage to the target each time they attack and damage you (within 8 seconds)", "BOOST_ABILITYDOT_TOUGHHOOF", out fixedEffect)) { return(true); } return(false); }
private static bool ParseItemEffectAttribute(string effectString, string parsedFile, string parsedKey, out PgPowerEffect powerEffect) { powerEffect = null !; string[] Split = effectString.Split('{'); if (Split.Length != 2 && Split.Length != 3) { return(false); } string AttributeName = Split[0]; string AttributeEffect = Split[1]; if (!AttributeName.EndsWith("}")) { return(false); } AttributeName = AttributeName.Substring(0, AttributeName.Length - 1); if (AttributeName.Contains("{") || AttributeName.Contains("}")) { return(false); } if (AttributeName.Length == 0 || AttributeEffect.Length == 0) { return(false); } PgAttribute ParsedAttribute = null !; if (!Inserter <PgAttribute> .SetItemByKey((PgAttribute valueAttribute) => ParsedAttribute = valueAttribute, AttributeName)) { return(false); } if (Split.Length == 3) { if (!AttributeEffect.EndsWith("}")) { return(false); } AttributeEffect = AttributeEffect.Substring(0, AttributeEffect.Length - 1); } if (!Tools.TryParseFloat(AttributeEffect, out float ParsedEffect, out FloatFormat ParsedEffectFormat)) { return(false); } if (ParsedEffectFormat != FloatFormat.Standard) { return(false); } PgPowerEffectAttribute NewPowerEffectAttribute; if (Split.Length == 3) { string AttributeSkill = Split[2]; PgSkill ParsedSkill = null !; if (AttributeSkill == "AnySkill") { ParsedSkill = PgSkill.AnySkill; } else if (!Inserter <PgSkill> .SetItemByKey((PgSkill valueSkill) => ParsedSkill = valueSkill, AttributeSkill)) { return(false); } NewPowerEffectAttribute = new PgPowerEffectAttribute() { AttributeEffect = ParsedEffect, AttributeEffectFormat = ParsedEffectFormat, Skill_Key = ParsedSkill.Key }; } else { NewPowerEffectAttribute = new PgPowerEffectAttribute() { AttributeEffect = ParsedEffect, AttributeEffectFormat = ParsedEffectFormat } }; NewPowerEffectAttribute.SetAttribute(ParsedAttribute); powerEffect = NewPowerEffectAttribute; return(true); }