Exemplo n.º 1
0
 public void ValidateNestedTagsTest()
 {
     Assert.AreEqual(_nestedTagDescription1Corrected, DescriptionValidator.Validate(_nestedTagDescription1));
     Assert.AreEqual(_nestedTagDescription2Corrected, DescriptionValidator.Validate(_nestedTagDescription2));
     Assert.AreEqual(_nestedTagDescription3Corrected, DescriptionValidator.Validate(_nestedTagDescription3));
     Assert.AreEqual(_nestedTagDescription4Corrected, DescriptionValidator.Validate(_nestedTagDescription4));
 }
Exemplo n.º 2
0
 public void ValidateRealDescriptionTest()
 {
     Assert.AreEqual(_diabloBlackSoulstoneCorrected, DescriptionValidator.Validate(_diabloBlackSoulstone));
     Assert.AreEqual(_dvaMechSelfDestructCorrected, DescriptionValidator.Validate(_dvaMechSelfDestruct));
     Assert.AreEqual(_valeeraCheapShotCorrected, DescriptionValidator.Validate(_valeeraCheapShot));
     Assert.AreEqual(_crusaderPunishSame, DescriptionValidator.Validate(_crusaderPunish));
 }
Exemplo n.º 3
0
 public void ValidatePlainTextTest()
 {
     Assert.AreEqual(_plainText1, DescriptionValidator.GetPlainText(_nestedTagDescription1, false, false));
     Assert.AreEqual(_plainText2, DescriptionValidator.GetPlainText(_nestedNewLineTagDescription2Corrected, false, false));
     Assert.AreEqual(_plainText3, DescriptionValidator.GetPlainText(_valeeraCheapShotCorrected, false, false));
     Assert.AreEqual(_plainText4Corrected, DescriptionValidator.GetPlainText(_plainText4, false, false));
     Assert.AreEqual(_plainText5Corrected, DescriptionValidator.GetPlainText(_plainText5, false, false));
 }
Exemplo n.º 4
0
 public void ValidateSpaceTagsTest()
 {
     Assert.AreEqual(_spaceTagDescription1, DescriptionValidator.GetColoredText(_spaceTagDescription1, true));
     Assert.AreEqual(_spaceTagDescription2, DescriptionValidator.GetColoredText(_spaceTagDescription2, true));
     Assert.AreEqual(_spaceTagDescription3, DescriptionValidator.GetColoredText(_spaceTagDescription3, true));
     Assert.AreEqual(_spaceTagNormalDescription1, DescriptionValidator.GetPlainText(_spaceTagDescription1, false, true));
     Assert.AreEqual(_spaceTagNormalDescription2, DescriptionValidator.GetPlainText(_spaceTagDescription2, true, true));
     Assert.AreEqual(_spaceTagNormalDescription3, DescriptionValidator.GetPlainText(_spaceTagDescription3, true, true));
 }
Exemplo n.º 5
0
        public static Description From(string value)
        {
            var description = new Description(value);
            var validator   = new DescriptionValidator();
            var results     = validator.Validate(description);

            description.SetValidationResult(results);
            return(description);
        }
        public async Task Error_description_not_object()
        {
            var manifest  = JObject.Parse(@"
{
    ""description"": ""not an object""
}
");
            var validator = new DescriptionValidator(manifest);
            var result    = await validator.ValidateAsync();

            Assert.AreEqual(1, result.ErrorMessages.Count);
            Assert.AreEqual(ValidationResult.MessageCode.DescriptionObjectRequired, result.ErrorMessages.First());
        }
        public async Task Error_short_description_not_string()
        {
            var manifest  = JObject.Parse(@"
{
    ""description"": {
        ""short"": 12345
    }
}
");
            var validator = new DescriptionValidator(manifest);
            var result    = await validator.ValidateAsync();

            Assert.IsTrue(result.ErrorMessages.Contains(ValidationResult.MessageCode.ShortDescriptionType));
        }
        public async Task Error_no_full_description()
        {
            var manifest  = JObject.Parse(@"
{
    ""description"": {
        ""no_full_desc_key"": 1
    }
}
");
            var validator = new DescriptionValidator(manifest);
            var result    = await validator.ValidateAsync();

            Assert.IsTrue(result.ErrorMessages.Contains(ValidationResult.MessageCode.FullDescriptionRequired));
        }
        public async Task Warning_short_description_contains_competitor_keyword()
        {
            var manifest  = JObject.Parse(@"
{
    ""description"": {
        ""short"": ""awesome app for slack""
    }
}
");
            var validator = new DescriptionValidator(manifest);
            var result    = await validator.ValidateAsync();

            Assert.IsTrue(result.WarningMessages.Contains(ValidationResult.MessageCode.ShortDescriptionCompetitor));
        }
        public async Task Warning_full_description_contains_short_description()
        {
            var manifest  = JObject.Parse(@"
{
    ""description"": {
        ""full"": ""Full description for my app"",
        ""short"": ""my app""
    }
}
");
            var validator = new DescriptionValidator(manifest);
            var result    = await validator.ValidateAsync();

            Assert.IsTrue(result.WarningMessages.Contains(ValidationResult.MessageCode.FullDescriptionContainsShortDescription));
        }
Exemplo n.º 11
0
 public void ValidateTest()
 {
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_noTagsDescription));           // no changes
     Assert.AreEqual(_normalTagsDescription1, DescriptionValidator.Validate(_normalTagsDescription1)); // no changes
     Assert.AreEqual(_normalTagsDescription2, DescriptionValidator.Validate(_normalTagsDescription2)); // no changes
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription1));
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription2));
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription3));
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription4));
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription5));
     Assert.AreEqual(_noTagsDescription, DescriptionValidator.Validate(_extraTagDescription6));
     Assert.AreEqual(_newLineTagDescription1, DescriptionValidator.Validate(_newLineTagDescription1));     // no changes
     Assert.AreEqual(_newLineTagDescription2, DescriptionValidator.Validate(_newLineTagDescription2));     // no changes
     Assert.AreEqual(_selfCloseTagDescription1, DescriptionValidator.Validate(_selfCloseTagDescription1)); // no changes
     Assert.AreEqual(_selfCloseTagDescription2, DescriptionValidator.Validate(_selfCloseTagDescription2)); // no changes
     Assert.AreEqual(_selfCloseTagDescription3, DescriptionValidator.Validate(_selfCloseTagDescription3)); // no changes
     Assert.AreEqual(_selfCloseTagDescription4, DescriptionValidator.Validate(_selfCloseTagDescription4)); // no changes
     Assert.AreEqual(_normalTagsDescription2, DescriptionValidator.Validate(_duplicateTagsDescription1));
     Assert.AreEqual(_normalTagsDescription2, DescriptionValidator.Validate(_duplicateTagsDescription2));
     Assert.AreEqual(_spaceTagDescription1, DescriptionValidator.Validate(_spaceTagDescription1)); // no changes
     Assert.AreEqual(_spaceTagDescription2, DescriptionValidator.Validate(_spaceTagDescription2)); // no changes
 }
Exemplo n.º 12
0
 public void ValidatePlainTextScalingTest()
 {
     Assert.AreEqual(_plainTextScaling1Corrected, DescriptionValidator.GetPlainText(_plainTextScaling1, false, true));
     Assert.AreEqual(_plainTextScaling2Corrected, DescriptionValidator.GetPlainText(_plainTextScaling2, false, true));
 }
Exemplo n.º 13
0
        private string ParseGameString(string tooltip, string splitter, bool nestedTooltip)
        {
            if (nestedTooltip)
            {
                tooltip = tooltip.Replace("'", "\"");
            }

            string[] parts = Regex.Split(tooltip, splitter);

            for (int i = 0; i < parts.Length; i++)
            {
                if (nestedTooltip)
                {
                    if (!parts[i].Contains("[d ref="))
                    {
                        continue;
                    }
                }
                else
                {
                    if (!parts[i].Contains("<d ref=") && !parts[i].Contains("<d const="))
                    {
                        continue;
                    }
                }

                string pathLookup = parts[i];

                // get and remove precision
                pathLookup = GetPrecision(pathLookup, out int?precision);

                // remove the player
                pathLookup = GetPlayer(pathLookup, out _);

                // perform xml data lookup to find values
                string mathPath = ParseValues(pathLookup.AsMemory());

                if (string.IsNullOrEmpty(Regex.Replace(mathPath, @"[/*+\-()]", string.Empty)))
                {
                    return(string.Empty);
                }

                // extract the scaling and the amount
                string scalingText = GetScalingText(mathPath, out int numOfScalingTexts);

                if (!string.IsNullOrEmpty(scalingText))
                {
                    mathPath = mathPath.Replace(scalingText, string.Empty);
                }

                double number = HeroesMathEval.CalculatePathEquation(mathPath.Trim('/'));

                if (precision.HasValue)
                {
                    parts[i] = Math.Round(number, precision.Value).ToString();
                }
                else
                {
                    parts[i] = Math.Round(number, 0).ToString();
                }

                if (!string.IsNullOrEmpty(scalingText))
                {
                    // only add the scaling in certain cases
                    if (numOfScalingTexts == 1 || (numOfScalingTexts > 1 && !mathPath.Contains('/')))
                    {
                        ReadOnlySpan <char> nextPart = parts[i + 1];
                        nextPart = nextPart.TrimStart();

                        if (nextPart.StartsWith("%"))
                        {
                            parts[i]    += $"%{scalingText}";
                            parts[i + 1] = parts[i + 1].ReplaceFirst("%", string.Empty);
                        }
                        else
                        {
                            parts[i] += $"{scalingText}";
                        }
                    }
                }
            }

            if (nestedTooltip)
            {
                return(string.Join(string.Empty, parts));
            }
            else
            {
                string joinDesc = string.Join(string.Empty, parts);

                foreach (Match match in Regex.Matches(joinDesc, @"[a-z]+""[a-z]+"))
                {
                    joinDesc = joinDesc.Replace(match.Value, match.Value.Replace("\"", "'"));
                }

                return(DescriptionValidator.Validate(joinDesc));
            }
        }
Exemplo n.º 14
0
 public void ValidateConvertedNewlineTagsTest()
 {
     Assert.AreEqual(_convertNewLineTagDescription1Corrected, DescriptionValidator.Validate(_convertNewLineTagDescription1));
     Assert.AreEqual(_convertNewLineTagDescription2Corrected, DescriptionValidator.Validate(_convertNewLineTagDescription2));
     Assert.AreEqual(_convertNewLineTagDescription3Corrected, DescriptionValidator.Validate(_convertNewLineTagDescription3));
 }
Exemplo n.º 15
0
 public void ValidateCaseTagsTest()
 {
     Assert.AreEqual(_upperCaseTagDescription1Corrected, DescriptionValidator.Validate(_upperCaseTagDescription1));
 }
Exemplo n.º 16
0
 public void ValidateErrorTextTest()
 {
     Assert.AreEqual(_errorText1Corrected, DescriptionValidator.GetColoredText(_errorText1, true));
     Assert.AreEqual(_errorText2Corrected, DescriptionValidator.GetPlainText(_errorText2, false, false));
     Assert.AreEqual(_errorText3Corrected, DescriptionValidator.GetPlainText(_errorText3, true, false));
 }
Exemplo n.º 17
0
 public void ValidateColoredTextScalingTest()
 {
     Assert.AreEqual(_coloredTextScaling1Corrected, DescriptionValidator.GetColoredText(_coloredTextScaling1, true));
     Assert.AreEqual(_coloredTextScaling2Corrected, DescriptionValidator.GetColoredText(_coloredTextScaling2, true));
 }
Exemplo n.º 18
0
 public void ValidateColoredTextTest()
 {
     Assert.AreEqual(_coloredText1Corrected, DescriptionValidator.GetColoredText(_coloredText1, false));
     Assert.AreEqual(_coloredText2Corrected, DescriptionValidator.GetColoredText(_coloredText2, false));
 }
Exemplo n.º 19
0
        private void SetCostData(XElement costElement, AbilityTalentBase abilityTalentBase)
        {
            if (costElement == null)
            {
                throw new ArgumentNullException(nameof(costElement));
            }
            if (abilityTalentBase == null)
            {
                throw new ArgumentNullException(nameof(abilityTalentBase));
            }

            XElement chargeElement = costElement.Element("Charge");

            if (chargeElement != null)
            {
                XElement countMaxElement   = chargeElement.Element("CountMax");
                XElement countStartElement = chargeElement.Element("CountStart");
                XElement countUseElement   = chargeElement.Element("CountUse");
                XElement hideCountElement  = chargeElement.Element("HideCount");
                XElement timeUseElement    = chargeElement.Element("TimeUse");

                // as attributes
                if (countMaxElement != null || countStartElement != null || countUseElement != null || hideCountElement != null || timeUseElement != null)
                {
                    if (countMaxElement != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountMax = int.Parse(GameData.GetValueFromAttribute(countMaxElement.Attribute("value").Value));
                    }

                    if (countStartElement != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountStart = int.Parse(GameData.GetValueFromAttribute(countStartElement.Attribute("value").Value));
                    }

                    if (countUseElement != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountUse = int.Parse(GameData.GetValueFromAttribute(countUseElement.Attribute("value").Value));
                    }

                    if (hideCountElement != null)
                    {
                        abilityTalentBase.Tooltip.Charges.IsHideCount = int.Parse(GameData.GetValueFromAttribute(hideCountElement.Attribute("value").Value)) == 1 ? true : false;
                    }

                    if (timeUseElement != null)
                    {
                        string cooldownValue = GameData.GetValueFromAttribute(timeUseElement.Attribute("value").Value);

                        string replaceText;
                        if (abilityTalentBase.Tooltip.Charges.CountMax.HasValue && abilityTalentBase.Tooltip.Charges.CountMax.Value > 1)
                        {
                            replaceText = GameData.GetGameString(DefaultData.StringChargeCooldownColon); // Charge Cooldown:<space>
                        }
                        else
                        {
                            replaceText = GameData.GetGameString(DefaultData.StringCooldownColon); // Cooldown:<space>
                        }
                        if (cooldownValue == "1")
                        {
                            abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownText)
                                                                                                        .Replace(GameData.GetGameString(DefaultData.StringCooldownColon), replaceText)
                                                                                                        .Replace(DefaultData.ReplacementCharacter, cooldownValue));
                        }
                        else
                        {
                            abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownPluralText)
                                                                                                        .Replace(GameData.GetGameString(DefaultData.StringCooldownColon), replaceText)
                                                                                                        .Replace(DefaultData.ReplacementCharacter, cooldownValue));
                        }
                    }
                }
                else // as elements
                {
                    XAttribute countMaxAttribute   = chargeElement.Attribute("CountMax");
                    XAttribute countStartAttribute = chargeElement.Attribute("CountStart");
                    XAttribute countUseAttribute   = chargeElement.Attribute("CountUse");
                    XAttribute hideCountAttribute  = chargeElement.Attribute("HideCount");
                    XAttribute timeUseAttribute    = chargeElement.Attribute("TimeUse");
                    if (countMaxAttribute != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountMax = int.Parse(GameData.GetValueFromAttribute(countMaxAttribute.Value));
                    }

                    if (countStartAttribute != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountStart = int.Parse(GameData.GetValueFromAttribute(countStartAttribute.Value));
                    }

                    if (countUseAttribute != null)
                    {
                        abilityTalentBase.Tooltip.Charges.CountUse = int.Parse(GameData.GetValueFromAttribute(countUseAttribute.Value));
                    }

                    if (hideCountAttribute != null)
                    {
                        abilityTalentBase.Tooltip.Charges.IsHideCount = int.Parse(GameData.GetValueFromAttribute(hideCountAttribute.Value)) == 1 ? true : false;
                    }

                    if (timeUseAttribute != null)
                    {
                        string cooldownValue = timeUseAttribute.Value;

                        string replaceText;
                        if (abilityTalentBase.Tooltip.Charges.CountMax.HasValue && abilityTalentBase.Tooltip.Charges.CountMax.Value > 1)
                        {
                            replaceText = GameData.GetGameString(DefaultData.StringChargeCooldownColon); // Charge Cooldown:<space>
                        }
                        else
                        {
                            replaceText = GameData.GetGameString(DefaultData.StringCooldownColon); // Cooldown:<space>
                        }
                        if (!string.IsNullOrEmpty(cooldownValue))
                        {
                            if (cooldownValue == "1")
                            {
                                abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownText)
                                                                                                            .Replace(GameData.GetGameString(DefaultData.StringCooldownColon), replaceText)
                                                                                                            .Replace(DefaultData.ReplacementCharacter, cooldownValue));
                            }
                            else
                            {
                                abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownPluralText)
                                                                                                            .Replace(GameData.GetGameString(DefaultData.StringCooldownColon), replaceText)
                                                                                                            .Replace(DefaultData.ReplacementCharacter, cooldownValue));
                            }
                        }
                    }
                }
            }

            // cooldown
            XElement cooldownElement = costElement.Element("Cooldown");

            if (cooldownElement != null)
            {
                string cooldownValue = GameData.GetValueFromAttribute(cooldownElement.Attribute("TimeUse")?.Value);
                if (!string.IsNullOrEmpty(cooldownValue))
                {
                    if (abilityTalentBase.Tooltip.Charges.HasCharges)
                    {
                        abilityTalentBase.Tooltip.Charges.RecastCooldown = double.Parse(cooldownValue);
                    }
                    else
                    {
                        double cooldown = double.Parse(cooldownValue);

                        if (cooldown == 1)
                        {
                            abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownText).Replace(DefaultData.ReplacementCharacter, cooldownValue));
                        }
                        else if (cooldown >= 1)
                        {
                            abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(GameData.GetGameString(DefaultData.AbilTooltipCooldownPluralText).Replace(DefaultData.ReplacementCharacter, cooldownValue));
                        }

                        if (cooldown < 1)
                        {
                            abilityTalentBase.Tooltip.Cooldown.ToggleCooldown = cooldown;
                        }
                    }
                }
            }

            // vitals
            XElement vitalElement = costElement.Element("Vital");

            if (vitalElement != null)
            {
                string vitalIndex = GameData.GetValueFromAttribute(vitalElement.Attribute("index").Value);
                string vitalValue = GameData.GetValueFromAttribute(vitalElement.Attribute("value").Value);

                if (vitalIndex == "Energy")
                {
                    abilityTalentBase.Tooltip.Energy.EnergyValue   = double.Parse(vitalValue);
                    abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(DescriptionValidator.Validate(GameData.GetGameString(DefaultData.ButtonData.ButtonTooltipEnergyVitalName).Replace(DefaultData.ReplacementCharacter, vitalValue)));
                }
            }
        }
Exemplo n.º 20
0
 public void ValidatePlainTextNewlineTest()
 {
     Assert.AreEqual(_plainTextNewline1, DescriptionValidator.GetPlainText(_nestedNewLineTagDescription1Corrected, true, false));
     Assert.AreEqual(_plainTextNewline2, DescriptionValidator.GetPlainText(_valeeraCheapShotCorrected, true, false));
     Assert.AreEqual(_plainTextNewline3Corrected, DescriptionValidator.GetPlainText(_plainTextNewline3, true, false));
 }
Exemplo n.º 21
0
 public void ValidateExtraSpaceInTagsTest()
 {
     Assert.AreEqual(_normalTagsDescription2, DescriptionValidator.Validate(_extraSpacesTagDescription1));
     Assert.AreEqual(_normalTagsDescription2, DescriptionValidator.Validate(_extraSpacesTagDescription2));
 }
Exemplo n.º 22
0
 public void ValidateEmptyTagsTest()
 {
     Assert.AreEqual(_emptyTagsDescription1Corrected, DescriptionValidator.Validate(_emptyTagsDescription1));
     Assert.AreEqual(_emptyTagsDescription2Corrected, DescriptionValidator.Validate(_emptyTagsDescription2));
     Assert.AreEqual(_emptyTagsDescription3Corrected, DescriptionValidator.Validate(_emptyTagsDescription3));
 }
Exemplo n.º 23
0
 public void ValidatePlainTextScalingNewlineTest()
 {
     Assert.AreEqual(_plainTextScalingNewline1Corrected, DescriptionValidator.GetPlainText(_plainTextScalingNewline1, true, true));
     Assert.AreEqual(_plainTextScalingNewline2Corrected, DescriptionValidator.GetPlainText(_plainTextScalingNewline2, true, true));
 }
Exemplo n.º 24
0
        /// <summary>
        /// Set all element data found in the button element.
        /// </summary>
        /// <param name="abilityTalentBase"></param>
        protected void SetTooltipData(XElement buttonElement, AbilityTalentBase abilityTalentBase)
        {
            if (buttonElement == null)
            {
                throw new ArgumentNullException(nameof(buttonElement));
            }
            if (abilityTalentBase == null)
            {
                throw new ArgumentNullException(nameof(abilityTalentBase));
            }

            string defaultEnergyValue = GameData.GetGameString(DefaultData.HeroEnergyTypeManaText);

            // "UI/Tooltip/Abil/<Type>
            string vitalEnergyValueTextTemp;
            string vitalLifeValueTextTemp;

            string overrideTextTemp = string.Empty;

            // look through each element to set overrides
            foreach (XElement element in buttonElement.Elements())
            {
                string elementName = element.Name.LocalName.ToUpper();

                if (elementName == "NAME")
                {
                    abilityTalentBase.Name = GameData.GetGameString(element.Attribute("value").Value);
                }
                else if (elementName == "ICON")
                {
                    abilityTalentBase.IconFileName = Path.GetFileName(PathHelper.GetFilePath(element.Attribute("value").Value));
                }
                else if (elementName == "TOOLTIP")
                {
                    string fullTooltipValue = element.Attribute("value").Value;

                    if (GameData.TryGetGameString(fullTooltipValue, out string fullDescription))
                    {
                        abilityTalentBase.Tooltip.FullTooltip = new TooltipDescription(fullDescription, Localization);
                    }
                }
                else if (elementName == "SIMPLEDISPLAYTEXT")
                {
                    string shortTooltipValue = element.Attribute("value").Value;

                    if (GameData.TryGetGameString(shortTooltipValue, out string shortDescription))
                    {
                        abilityTalentBase.Tooltip.ShortTooltip = new TooltipDescription(shortDescription, Localization);
                    }
                }
                else if (elementName == "TOOLTIPVITALNAME")
                {
                    string index = element.Attribute("index")?.Value;

                    if (index == "Energy")
                    {
                        vitalEnergyValueTextTemp = element.Attribute("value").Value;

                        if (string.IsNullOrEmpty(vitalEnergyValueTextTemp))
                        {
                            abilityTalentBase.Tooltip.Energy.EnergyTooltip = null;
                        }
                        else if (GameData.TryGetGameString(vitalEnergyValueTextTemp, out string overrideVitalName))
                        {
                            if (string.IsNullOrEmpty(abilityTalentBase.Tooltip.Energy.EnergyTooltip?.RawDescription))
                            {
                                abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName));
                            }
                            else if (overrideVitalName.Contains(DefaultData.ReplacementCharacter) && abilityTalentBase.Tooltip.Energy.EnergyValue.HasValue)
                            {
                                abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName.Replace(DefaultData.ReplacementCharacter, abilityTalentBase.Tooltip.Energy.EnergyValue.ToString())));
                            }
                            else if (overrideVitalName.Contains(DefaultData.ReplacementCharacter) && !string.IsNullOrEmpty(abilityTalentBase.Tooltip.Energy.EnergyTooltip.RawDescription) && !overrideTextTemp.StartsWith(defaultEnergyValue))
                            {
                                if (string.IsNullOrEmpty(overrideTextTemp))
                                {
                                    abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(string.Empty);
                                }
                                else
                                {
                                    abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName.Replace(DefaultData.ReplacementCharacter, overrideTextTemp)));
                                }
                            }
                        }
                    }
                    else if (index == "Life")
                    {
                        vitalLifeValueTextTemp = element.Attribute("value").Value;

                        if (string.IsNullOrEmpty(vitalLifeValueTextTemp))
                        {
                            abilityTalentBase.Tooltip.Life.LifeCostTooltip = null;
                        }
                        else if (GameData.TryGetGameString(vitalLifeValueTextTemp, out string overrideVitalName))
                        {
                            if (string.IsNullOrEmpty(abilityTalentBase.Tooltip.Life.LifeCostTooltip?.RawDescription))
                            {
                                abilityTalentBase.Tooltip.Life.LifeCostTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName));
                            }
                            else if (overrideVitalName.Contains(DefaultData.ReplacementCharacter))
                            {
                                abilityTalentBase.Tooltip.Life.LifeCostTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName.Replace(DefaultData.ReplacementCharacter, abilityTalentBase.Tooltip.Life.LifeValue.ToString())));
                            }
                            else
                            {
                                abilityTalentBase.Tooltip.Life.LifeCostTooltip = new TooltipDescription(DescriptionValidator.Validate(overrideVitalName.Replace(DefaultData.ReplacementCharacter, abilityTalentBase.Tooltip.Life.LifeCostTooltip.RawDescription)));
                            }
                        }
                    }
                }
                else if (elementName == "TOOLTIPVITALOVERRIDETEXT")
                {
                    if (GameData.TryGetGameString(element.Attribute("value").Value, out string text))
                    {
                        if (element.Attribute("index")?.Value == "Energy")
                        {
                            // check if overriding text starts with the energy text
                            if (!new TooltipDescription(DescriptionValidator.Validate(text)).PlainText.StartsWith(defaultEnergyValue))
                            {
                                if (GameData.TryGetGameString(DefaultData.ButtonData.ButtonTooltipEnergyVitalName, out string energyText)) // default
                                {
                                    overrideTextTemp = text;
                                    text             = DescriptionValidator.Validate(energyText.Replace(DefaultData.ReplacementCharacter, text));
                                }
                            }

                            abilityTalentBase.Tooltip.Energy.EnergyTooltip = new TooltipDescription(text);
                        }
                        else if (element.Attribute("index")?.Value == "Life")
                        {
                            abilityTalentBase.Tooltip.Life.LifeCostTooltip = new TooltipDescription(DescriptionValidator.Validate(abilityTalentBase.Tooltip.Life.LifeCostTooltip.RawDescription.Replace(DefaultData.ReplacementCharacter, text)));
                        }
                    }
                }
                else if (elementName == "TOOLTIPCOOLDOWNOVERRIDETEXT")
                {
                    string overrideValueText = element.Attribute("value").Value;
                    if (GameData.TryGetGameString(overrideValueText, out string text))
                    {
                        if (!text.StartsWith(GameData.GetGameString(DefaultData.StringCooldownColon)))
                        {
                            text = $"{GameData.GetGameString(DefaultData.StringCooldownColon)}{text}";
                        }

                        abilityTalentBase.Tooltip.Cooldown.CooldownTooltip = new TooltipDescription(DescriptionValidator.Validate(text));
                    }
                }
                else if (elementName == "TOOLTIPFLAGS")
                {
                    string index = element.Attribute("index").Value;

                    if (index == "ShowName" && element.Attribute("value").Value == "0")
                    {
                        abilityTalentBase.Name = string.Empty;
                    }
                    else if (index == "ShowHotkey")
                    {
                    }
                    else if (index == "ShowUsage" && element.Attribute("value").Value == "0")
                    {
                        abilityTalentBase.Tooltip.Life.LifeCostTooltip = null;
                        abilityTalentBase.Tooltip.Energy.EnergyTooltip = null;
                    }
                    else if (index == "ShowTime")
                    {
                    }
                    else if (index == "ShowCooldown" && element.Attribute("value").Value == "0")
                    {
                        // ignore, always show the cooldown
                    }
                    else if (index == "ShowRequirements")
                    {
                    }
                    else if (index == "ShowAutocast")
                    {
                    }
                }
            }

            // check if the life and energy string contain the replacement character
            if (abilityTalentBase.Tooltip.Life?.LifeCostTooltip != null && abilityTalentBase.Tooltip.Life.LifeCostTooltip.RawDescription.Contains(DefaultData.ReplacementCharacter))
            {
                abilityTalentBase.Tooltip.Life.LifeCostTooltip = null;
            }
            if (abilityTalentBase.Tooltip.Energy?.EnergyTooltip != null && abilityTalentBase.Tooltip.Energy.EnergyTooltip.RawDescription.Contains(DefaultData.ReplacementCharacter))
            {
                abilityTalentBase.Tooltip.Energy.EnergyTooltip = null;
            }
        }