diff --git a/LocaleExtra/enUS.lua b/LocaleExtra/enUS.lua index ee9de12..004dfc0 100644 --- a/LocaleExtra/enUS.lua +++ b/LocaleExtra/enUS.lua @@ -422,13 +422,386 @@ Addon:AddExtraReplacement("Average Range", -- Spellpower -Addon:AddExtraReplacement("Spellpower text", +Addon:AddExtraReplacement("Spell Power Proc", { - INPUT = "damage and healing done by magical spells and effects", - OUTPUT = "Spellpower", + INPUT = "[Ii]ncreases damage and healing done by magical spells and effects by up to (%d+)", + OUTPUT = function(power) + return "+" .. power .. " " .. Addon.statsInfo["Spell Power"]:GetAlias() + end, } ) +if Addon.isTBC then + Addon:AddExtraReplacement("Enchants", + { + -- Spell Crit and Spell Power Enchant + INPUT = "Spell Critical Strike Rating and %+([%d,]+) Spell Damage and Healing", + OUTPUT = function(power) + return Addon.statsInfo["Spell Critical Strike Rating"]:GetAlias() .. " and +" .. power .. " " .. Addon.statsInfo["Spell Power"]:GetAlias() + end, + }, + { + -- Spell Power and Spell Hit Enchant + INPUT = "Spell Power and %+([%d,]+) Spell Hit Rating", + OUTPUT = function(hit) + return Addon.statsInfo["Spell Power"]:GetAlias() .. " and +" .. hit .. " " .. Addon.statsInfo["Spell Hit Rating"]:GetAlias() + end, + }, + { + -- Healing and Spell Damage and Mana Regen Enchant (Classic) + INPUT = "%+([%d,]+) Healing Spells and %+([%d,]+) Damage Spells and (%d+) Mana [Pp]er 5 sec%.?", + OUTPUT = function(healing, damage, mp5) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " +" .. mp5 .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + }, + { + -- Healing and Spell Damage and Mana Regen Enchant + INPUT = "%+([%d,]+) Healing and %+([%d,]+) Spell Damage and (%d+) Mana [Pp]er 5 sec%.?", + OUTPUT = function(healing, damage, mp5) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. mp5 .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + }, + { + -- Healing, Spell Damage and Mana Regen Enchant + INPUT = "%+([%d,]+) Healing %+([%d,]+) Spell Damage and (%d+) Mana [Pp]er 5 sec%.?", + OUTPUT = function(healing, damage, mp5) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. mp5 .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + }, + { + -- Healing, Spell Damage and Mana Regen Enchant (2) + INPUT = "%+([%d,]+) Healing and %+([%d,]+) Spell Damage and %+(%d+) Mana Regen", + OUTPUT = function(healing, damage, mp5) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. mp5 .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + }, + { + -- Healing, Spell Damage and Stamina Enchant + INPUT = "%+([%d,]+) Healing and %+([%d,]+) Spell Damage and %+([%d,]+) Stamina", + OUTPUT = function(healing, damage, stamina) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. stamina .. " " .. Addon.statsInfo["Stamina"]:GetAlias() + end, + }, + { + -- Healing, Spell Damage and Stamina Enchant (2) + INPUT = "%+([%d,]+) Healing %+([%d,]+) Spell Damage and %+([%d,]+) Stamina", + OUTPUT = function(healing, damage, stamina) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. stamina .. " " .. Addon.statsInfo["Stamina"]:GetAlias() + end, + }, + { + -- Healing, Spell Damage and Stamina Enchant (Classic Spells) + INPUT = "%+([%d,]+) Healing Spells and %+([%d,]+) Damage Spells and %+([%d,]+) Stamina", + OUTPUT = function(healing, damage, stamina) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " and +" .. stamina .. " " .. Addon.statsInfo["Stamina"]:GetAlias() + end, + }, + { + -- Healing and Spell Damage Enchant + INPUT = "%+([%d,]+) Healing Spells and %+([%d,]+) Damage Spells", + OUTPUT = function(healing, damage) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() + end, + }, + { + -- Healing and Spell Damage Enchant + INPUT = "%+([%d,]+) Healing and %+([%d,]+) Spell Damage", + OUTPUT = function(healing, damage) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() + end, + }, + { + -- Spell Damage and Healing Enchant + INPUT = "%+([%d,]+) Spell Damage and %+([%d,]+) Healing", + OUTPUT = function(damage, healing) + return "+" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " +" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() + end, + }, + { + -- Defense Rating and Dodge Rating Enchant + INPUT = "%+([%d,]+) Defense Rating and %+([%d,]+) Dodge Rating", + OUTPUT = function(defense, dodge) + return "+" .. defense .. " " .. Addon.statsInfo["Defense Rating"]:GetAlias() .. " and +" .. dodge .. " " .. Addon.statsInfo["Dodge Rating"]:GetAlias() + end, + }, + { + -- Dodge Rating and Defense Rating Enchant + INPUT = "%+([%d,]+) Dodge Rating and %+([%d,]+) Defense Rating", + OUTPUT = function(dodge, defense) + return "+" .. dodge .. " " .. Addon.statsInfo["Dodge Rating"]:GetAlias() .. " and +" .. defense .. " " .. Addon.statsInfo["Defense Rating"]:GetAlias() + end, + }, + { + -- Attack Power and Hit Rating Enchant + INPUT = "%+([%d,]+) Attack Power and %+([%d,]+) Hit Rating", + OUTPUT = function(ap, hit) + return "+" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() .. " and +" .. hit .. " " .. Addon.statsInfo["Physical Hit Rating"]:GetAlias() + end, + }, + { + -- Hit Rating and Attack Power Enchant + INPUT = "%+([%d,]+) Hit Rating and %+([%d,]+) Attack Power", + OUTPUT = function(hit, ap) + return "+" .. hit .. " " .. Addon.statsInfo["Physical Hit Rating"]:GetAlias() .. " and +" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() + end, + }, + { + -- Spell Damage and Healing Enchant (to Spell Power) + INPUT = "%+([%d,]+) Spell Damage and Healing", + OUTPUT = function(power) + return "+" .. power .. " " .. Addon.statsInfo["Spell Power"]:GetAlias() + end, + }, + { + -- Spell Penetration Enchant + INPUT = "%+([%d,]+) Spell Penetration", + OUTPUT = function(pen) + return "+" .. pen .. " " .. Addon.statsInfo["Spell Penetration"]:GetAlias() + end, + }, + { + -- All Resistances Enchant + INPUT = "%+([%d,]+) All Resistances", + OUTPUT = function(resist) + return "+" .. resist .. " " .. Addon.statsInfo["All Resistance"]:GetAlias() + end, + }, + { + -- Spell Critical Strike Rating Enchant + INPUT = "%+([%d,]+) Spell Critical Strike Rating", + OUTPUT = function(crit) + return "+" .. crit .. " " .. Addon.statsInfo["Spell Critical Strike Rating"]:GetAlias() + end, + }, + { + -- Critical Strike Rating Enchant + INPUT = "%+([%d,]+) Critical Strike Rating", + OUTPUT = function(crit) + return "+" .. crit .. " " .. Addon.statsInfo["Physical Critical Strike Rating"]:GetAlias() + end, + }, + { + -- Spell Hit Rating Enchant + INPUT = "%+([%d,]+) Spell Hit Rating", + OUTPUT = function(hit) + return "+" .. hit .. " " .. Addon.statsInfo["Spell Hit Rating"]:GetAlias() + end, + }, + { + -- Dodge Rating Enchant + INPUT = "%+([%d,]+) Dodge Rating", + OUTPUT = function(dodge) + return "+" .. dodge .. " " .. Addon.statsInfo["Dodge Rating"]:GetAlias() + end, + }, + { + -- Attack Power and Critical Strike Rating Enchant + INPUT = "%+([%d,]+) Attack Power and %+([%d,]+) Critical Strike Rating", + OUTPUT = function(ap, crit) + return "+" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() .. " and +" .. crit .. " " .. Addon.statsInfo["Physical Critical Strike Rating"]:GetAlias() + end, + }, + { + -- Critical Strike Rating and Attack Power Enchant + INPUT = "%+([%d,]+) Critical Strike Rating and %+([%d,]+) Attack Power", + OUTPUT = function(crit, ap) + return "+" .. crit .. " " .. Addon.statsInfo["Physical Critical Strike Rating"]:GetAlias() .. " and +" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() + end, + }, + { + -- Mana every 5 sec. Enchant + INPUT = "%+([%d,]+) mana every 5 sec%.?", + OUTPUT = function(regen) + return "+" .. regen .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + }, + { + -- Mana Regen and Healing Enchant + INPUT = "%+([%d,]+) Mana Regen and %+([%d,]+) Healing", + OUTPUT = function(regen, healing) + return "+" .. regen .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() .. " and +" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Spell Damage and Healing Trinket Procs", + { + -- Spell Damage and Healing Trinket + INPUT = "Increases spell damage by up to (%d+) and healing by up to (%d+) for (%d+) sec%.%s*(.*)", + OUTPUT = function(damage, healing, duration, cooldown) + return "+" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " +" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " for " .. duration .. " sec. " .. cooldown + end, + }, + { + -- Healing and Spell Damage Trinket + INPUT = "Increases healing done by spells.-by up to (%d+) and damage done by spells by up to (%d+) for (%d+) sec%.%s*(.*)", + OUTPUT = function(healing, damage, duration, cooldown) + return "+" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " for " .. duration .. " sec. " .. cooldown + end, + }, + { + -- Eye of the Dead Trinket + INPUT = "Increases healing done by the next (%d+) spells by up to (%d+) and damage done by up to (%d+) for (%d+) sec%.%s*(.*)", + OUTPUT = function(count, healing, damage, duration, cooldown) + return "Your next " .. count .. " spells have +" .. healing .. " " .. Addon.statsInfo["Healing"]:GetAlias() .. " +" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() .. " for " .. duration .. " sec. " .. cooldown + end, + } + ) + + Addon:AddExtraReplacement("Haste Trinket Procs", + { + -- Spell Haste Trinket Proc (1) + INPUT = "increase your spell haste rating by (%d+)", + OUTPUT = function(haste) + return "+" .. haste .. " " .. Addon.statsInfo["Spell Haste Rating"]:GetAlias() + end, + }, + { + -- Spell Haste Trinket Proc (2) + INPUT = "increasing spell haste rating by (%d+)", + OUTPUT = function(haste) + return "+" .. haste .. " " .. Addon.statsInfo["Spell Haste Rating"]:GetAlias() + end, + }, + { + -- Physical Haste Trinket Proc (1) + INPUT = "Increases haste rating by (%d+)", + OUTPUT = function(haste) + return "+" .. haste .. " " .. Addon.statsInfo["Physical Haste Rating"]:GetAlias() + end, + }, + { + -- Physical Haste Trinket Proc (2) + INPUT = "Increases your haste rating by (%d+)", + OUTPUT = function(haste) + return "+" .. haste .. " " .. Addon.statsInfo["Physical Haste Rating"]:GetAlias() + end, + }, + { + -- Physical Haste Trinket Proc (3) + INPUT = "increase your haste rating by (%d+)", + OUTPUT = function(haste) + return "+" .. haste .. " " .. Addon.statsInfo["Physical Haste Rating"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Spell Damage Trinket Proc", + { + INPUT = "[Gg]rants (%d+) increased spell damage", + OUTPUT = function(damage) + return "+" .. damage .. " " .. Addon.statsInfo["Spell Damage"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Attack Power Trinket Procs", + { + -- Attack Power Trinket Proc (1) + INPUT = "[Ii]ncreases? your attack power by (%d+)", + OUTPUT = function(ap) + return "+" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() + end, + }, + { + -- Attack Power Trinket Proc (2) + INPUT = "[Ii]ncreases? attack power by (%d+)", + OUTPUT = function(ap) + return "+" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() + end, + }, + { + -- Attack Power Penalty Proc + INPUT = "decreases your melee and ranged attack power by (%d+)", + OUTPUT = function(ap) + return "-" .. ap .. " " .. Addon.statsInfo["Attack Power"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Armor Penetration Trinket Proc", + { + INPUT = "gives?%s+you%s+([%d,]+)%s+[Aa]rmor%s+[Pp]enetration", + OUTPUT = function(ap) + return "+" .. ap .. " " .. Addon.statsInfo["Armor Penetration Rating"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Spell Power Trinket Procs", + { + -- Spell Power Trinket Proc + INPUT = "[Ii]ncreases? your spell damage and healing by (%d+)", + OUTPUT = function(power) + return "+" .. power .. " " .. Addon.statsInfo["Spell Power"]:GetAlias() + end, + }, + { + -- Spell damage and healing Proc + INPUT = "you will gain up to (%d+) spell damage and healing", + OUTPUT = function(power) + return "to +" .. power .. " " .. Addon.statsInfo["Spell Power"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Spirit Trinket Proc", + { + INPUT = "[Ii]ncreases? your Spirit by %+?(%d+)", + OUTPUT = function(spirit) + return "+" .. spirit .. " " .. Addon.statsInfo["Spirit"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Tank Trinket Procs", + { + -- Dodge Trinket Proc + INPUT = "Increases dodge rating by (%d+)", + OUTPUT = function(dodge) + return "+" .. dodge .. " " .. Addon.statsInfo["Dodge Rating"]:GetAlias() + end, + }, + { + -- Defense Trinket Proc + INPUT = "Increases your defense rating by (%d+)", + OUTPUT = function(defense) + return "+" .. defense .. " " .. Addon.statsInfo["Defense Rating"]:GetAlias() + end, + }, + { + -- Block Value Proc (1) + INPUT = "[Ii]ncreases your shield block value by (%d+)", + OUTPUT = function(value) + return "+" .. value .. " " .. Addon.statsInfo["Block Value"]:GetAlias() + end, + }, + { + -- Block Value Proc (2) + INPUT = "[Ii]ncreases the block value of your shield by (%d+)", + OUTPUT = function(value) + return "+" .. value .. " " .. Addon.statsInfo["Block Value"]:GetAlias() + end, + }, + { + -- Block Rating Proc + INPUT = "Increases block rating by (%d+)", + OUTPUT = function(value) + return "+" .. value .. " " .. Addon.statsInfo["Block Rating"]:GetAlias() + end, + } + ) + + Addon:AddExtraReplacement("Mana Regen Trinket Proc", + { + INPUT = "bonus%s+of%s+(%d+)%s+mana%s+regen%s+per%s+5%s+sec", + OUTPUT = function(regen) + return "+" .. regen .. " " .. Addon.statsInfo["Mana Regeneration"]:GetAlias() + end, + } + ) +end + -- Temp Stat Buff Addon:AddExtraReplacement("Temp Stat Buff", { @@ -443,12 +816,4 @@ Addon:AddExtraReplacement("Temp Stat Buff", INPUT = "Increases ?y?o?u?r? ([^%d]-) by up to ([%d,]+%%?) (for %d+ sec%.?)", -- Dark Iron Smoking Pipe OUTPUT = "+%2 %1 %3", } -) - - - - - - - - +) \ No newline at end of file diff --git a/Operations/RewordLine.lua b/Operations/RewordLine.lua index 958dd1e..38282cc 100644 --- a/Operations/RewordLine.lua +++ b/Operations/RewordLine.lua @@ -60,7 +60,7 @@ local embeddedStatLines = Addon:MakeLookupTable{ "SecondaryStat", "Enchant", "EnchantOnUse", - "Socket", +-- "Socket", "SetBonus", } @@ -69,10 +69,14 @@ local miscRewordLines = Addon:MakeLookupTable{ "SecondaryStat", "Enchant", "EnchantOnUse", - "Socket", +-- "Socket", "SetBonus", } +local function IsPermanentEnchantText(text) + return strFind(text, "[Pp]ermanent") or strFind(text, "[Dd]auerhaft") or strFind(text, "영구") or strFind(text, "永久") or strFind(text, "[Пп]остоянн") +end + function Addon:RewordLine(tooltip, line, tooltipData) local isRatingBusterActive = RatingBuster and RatingBuster.ProcessLine and true or false @@ -90,7 +94,7 @@ function Addon:RewordLine(tooltip, line, tooltipData) text, line.rewordRight = unpack(cache, 1, 2) else - if not line.stat and miscRewordLines[line.type] and self:GetOption("doReword", "Miscellaneous") then + if not line.stat and miscRewordLines[line.type] and not IsPermanentEnchantText(text) and self:GetOption("doReword", "Miscellaneous") then -- localeExtra replacements if self:GetOption("allow", "reword") then for _, definition in ipairs(self:GetExtraReplacements()) do @@ -281,7 +285,7 @@ function Addon:RewordLine(tooltip, line, tooltipData) end end - if not line.stat and embeddedStatLines[line.type] and (self:GetOption("allow", "reword") or self:GetOption("allow", "recolor")) then + if not line.stat and embeddedStatLines[line.type] and not IsPermanentEnchantText(text) and (self:GetOption("allow", "reword") or self:GetOption("allow", "recolor")) then -- rename and recolor stats in the middle of non-stat lines local lowerText = strLower(text) @@ -298,9 +302,9 @@ function Addon:RewordLine(tooltip, line, tooltipData) local replacements = {} for stat, statInfo in pairs(self.statsInfo) do - if statInfo.GetNormalName then - local normalName = strLower(statInfo:GetNormalName()) - local capturePattern = "%+?" .. self.L["%d[%d,%.]+"] .. " *" .. self:CoverSpecialCharacters(normalName) + if statInfo.GetAlias then + local normalName = strLower(statInfo:GetAlias()) + local capturePattern = "%+?" .. self.L["%d[%d,%.]*"] .. " *" .. self:CoverSpecialCharacters(normalName) local startI, endI = strFind(lowerText, capturePattern) while startI do local isInRatingBusterAddition = false @@ -317,45 +321,50 @@ function Addon:RewordLine(tooltip, line, tooltipData) end end end - tblSort(replacements, function(a, b) return b[1] < a[1] end) - local highest, failed + tblSort(replacements, function(a, b) + if a[1] ~= b[1] then + return b[1] < a[1] + else + return b[2] < a[2] + end + end) + local filteredReplacements = {} + local leftmostStart for _, replacement in ipairs(replacements) do local startI, endI, stat = unpack(replacement) - if highest and endI >= highest then - failed = true + if not leftmostStart or endI < leftmostStart then + tinsert(filteredReplacements, replacement) + leftmostStart = startI end - highest = startI end - if not failed then - for _, replacement in ipairs(replacements) do - local startI, endI, stat = unpack(replacement) - local statInfo = self.statsInfo[stat] - - local statText = strSub(text, startI, endI) - local replacementText = statText - if self:GetOption("allow", "reword") then - local plus, number = strMatch(statText, "(%+?)(" .. self.L["%d[%d,%.]+"] .. ")") - if number and strFind(number, "%d") then -- needed for dealing with false positives like title line of 103945 - local defaultForm = statInfo:GetDefaultForm(number) - local normalForm = statInfo:ConvertToNormalForm(defaultForm) - local aliasForm = statInfo:Reword(normalForm, normalForm) - if plus == "" then - aliasForm = strGsub(aliasForm, "^%+", "") -- won't work in some locales - end - - replacementText = aliasForm - if self:GetOption("allow", "recolor") then - replacementText = self:MakeColorCode(statInfo.color, replacementText) - end + for _, replacement in ipairs(filteredReplacements) do + local startI, endI, stat = unpack(replacement) + local statInfo = self.statsInfo[stat] + + local statText = strSub(text, startI, endI) + local replacementText = statText + if self:GetOption("allow", "reword") then + local plus, number = strMatch(statText, "(%+?)(" .. self.L["%d[%d,%.]*"] .. ")") + if number and strFind(number, "%d") then -- needed for dealing with false positives like title line of 103945 + local defaultForm = statInfo:GetDefaultForm(number) + local normalForm = statInfo:ConvertToNormalForm(defaultForm) + local aliasForm = statInfo:Reword(normalForm, normalForm) + if plus == "" then + aliasForm = strGsub(aliasForm, "^%+", "") -- won't work in some locales end - else - if self:GetOption("allow", "recolor") then - replacementText = self:MakeColorCode(statInfo.color, replacementText) + + replacementText = aliasForm + if self:GetOption("allow", "recolor") and self:GetOption("doRecolor", stat) then + replacementText = self:MakeColorCode(self:GetOption("color", stat), replacementText) end end - - text = strSub(text, 1, startI-1) .. replacementText .. strSub(text, endI+1) + else + if self:GetOption("allow", "recolor") and self:GetOption("doRecolor", stat) then + replacementText = self:MakeColorCode(self:GetOption("color", stat), replacementText) + end end + + text = strSub(text, 1, startI-1) .. replacementText .. strSub(text, endI+1) end end