Skip to content

Commit

Permalink
Cleanup changeMenu rune slot update
Browse files Browse the repository at this point in the history
  • Loading branch information
RagedUnicorn committed Jan 14, 2025
1 parent 59e75dc commit 493cbc5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
26 changes: 26 additions & 0 deletions gui/GM_EngraveFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,30 @@ function me.UpdateRuneSlotTexture(gearSlot, gearSlotMetaData)
end
end

--[[
Updates the changeMenu rune slot texture
@param {table} changeSlot
@param {table} item
]]--
function me.UpdateChangeMenuRuneSlotTexture(changeSlot, item)
if not mod.season.IsSodActive() then return end

if not mod.configuration.IsRuneSlotsEnabled() then
me.ClearChangeMenuRuneSlotTexture(changeSlot)
return
end

changeSlot.runeSlot.icon:SetTexture((item.rune and item.rune.iconTexture) or nil)
end

--[[
Clear the changeMenu rune slot texture
@param {table} slot
]]--
function me.ClearChangeMenuRuneSlotTexture(slot)
if not mod.season.IsSodActive() then return end

slot.runeSlot.icon:SetTexture(nil)
end
25 changes: 2 additions & 23 deletions gui/GM_GearBarChangeMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,12 @@ function me.UpdateChangeSlot(changeSlot, gearSlotMetaData, item, changeSlotSize)
changeSlot.runeAbilityId = (item.rune and item.rune.skillLineAbilityID) or nil
changeSlot.runeName = (item.rune and item.rune.name) or nil

me.UpdateRuneSlotTexture(changeSlot, item)
mod.engraveFrame.UpdateChangeMenuRuneSlotTexture(changeSlot, item)

changeSlot.itemTexture:SetTexture(item.icon)
changeSlot:Show()
end

--[[
Updates the rune slot texture if engraving is active
@param {table} changeSlot
@param {table} item
]]--
function me.UpdateRuneSlotTexture(changeSlot, item)
if not mod.engrave.IsEngravingActive() or not changeSlot.runeSlot then return end
changeSlot.runeSlot.icon:SetTexture((item.rune and item.rune.iconTexture) or nil)
end

--[[
Update the changeSlotSize to the configured one
Expand Down Expand Up @@ -279,22 +268,12 @@ function me.UpdateEmptyChangeSlot(changeMenu, itemCount, gearSlotMetaData, empty
emptyChangeMenuSlot.runeAbilityId = nil
emptyChangeMenuSlot.runeName = nil

me.ClearRuneSlotTexture(emptyChangeMenuSlot)
mod.engraveFrame.ClearChangeMenuRuneSlotTexture(emptyChangeMenuSlot)

emptyChangeMenuSlot.itemTexture:SetTexture(gearSlotMetaData.textureId)
emptyChangeMenuSlot:Show()
end

--[[
Clear the rune slot texture if engraving is active
@param {table} slot
]]--
function me.ClearRuneSlotTexture(slot)
if not mod.engrave.IsEngravingActive() or not slot.runeSlot then return end
slot.runeSlot.icon:SetTexture(nil)
end

--[[
Updates the changeMenuFrame size depending on how many changeslots are displayed at the time
Expand Down

0 comments on commit 493cbc5

Please sign in to comment.