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 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); }