Skip to content

Commit

Permalink
Display runeforges in stat breakdown source lists
Browse files Browse the repository at this point in the history
  • Loading branch information
raethkcj committed Nov 6, 2024
1 parent e7b2a41 commit a4f072e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions RatingBuster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,10 @@ do
elseif case.set then
name = C_Item.GetItemSetInfo(case.set)
icon = [[Interface/PaperDollInfoFrame/UI-EquipmentManager-Toggle]]
elseif case.enchant then
name = StatLogic:GetEnchantText(case.enchant)
-- Currently, all enchant statMods are Death Knight Runeforges
icon = [[Interface/ICONS/Spell_DeathKnight_FrozenRuneWeapon]]
end
if name and icon then
local source = "|T"..icon..":20|t"..name
Expand Down
36 changes: 36 additions & 0 deletions libs/StatLogic/StatLogic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,42 @@ function StatLogic:GetGemID(item)
end
end

do
local baseItemLink = "item:9333:"
C_Item.RequestLoadItemDataByID(baseItemLink)

local function GetBaseItemText()
tip:ClearLines()
tip:SetHyperlink(baseItemLink)
local itemText = {}
for i = 1, tip:NumLines() do
local text = tip.sides.left[i]:GetText()
if text then
itemText[i] = text
end
end
return itemText
end
local baseItemText

---@param enchantID integer
---@return string
function StatLogic:GetEnchantText(enchantID)
if not baseItemText then
baseItemText = GetBaseItemText()
end
tip:ClearLines()
tip:SetHyperlink(baseItemLink .. enchantID)
for i = 1, tip:NumLines() do
local text = tip.sides.left[i]:GetText()
if text and baseItemText[i] ~= text then
return text
end
end
return ""
end
end

local function ConvertGenericStats(table)
for generic, ratings in pairs(StatLogic.GenericStatMap) do
if table[generic] then
Expand Down

0 comments on commit a4f072e

Please sign in to comment.