Skip to content

Commit

Permalink
Fix SoD runes
Browse files Browse the repository at this point in the history
The previous code always got the rune ID for the rune applied to
the gear in the equipment slot, not necessarily the rune ID
applied to a piece of gear in your bags.  This fixes it to always
get the correct rune ID.
  • Loading branch information
romracer authored and Rottenbeer committed Sep 27, 2024
1 parent dd58d13 commit 547c906
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions ItemRack/ItemRack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,41 @@ function ItemRack.IsCata()
return wowtoc > 40000 and wowtoc < 50000
end

-- [[ Season of Discovery Runes ]]
function ItemRack.IsEngravingActive()
return C_Engraving and C_Engraving.IsEngravingEnabled()
end

do
if ItemRack.IsEngravingActive() then
function ItemRack.AppendRuneID(bag, slot)
if slot then
if C_Engraving.IsInventorySlotEngravable(bag, slot) then
local rune_info = C_Engraving.GetRuneForInventorySlot(bag, slot)
if rune_info then
return ":runeid:"..tostring(rune_info.skillLineAbilityID)
else
return ":runeid:0"
end
else
return ""
end
else
if C_Engraving.IsEquipmentSlotEngravable(bag) then
local rune_info = C_Engraving.GetRuneForEquipmentSlot(bag)
if rune_info then
return ":runeid:"..tostring(rune_info.skillLineAbilityID)
else
return ":runeid:0"
end
else
return ""
end
end
end
end
end

local GetContainerNumSlots, GetContainerItemLink, GetContainerItemID, GetContainerItemCooldown, GetContainerItemInfo, GetItemCooldown, PickupContainerItem, ContainerIDToInventoryID
if C_Container then
GetContainerNumSlots = C_Container.GetContainerNumSlots
Expand Down Expand Up @@ -648,30 +679,6 @@ function ItemRack.GetIRString(inputString,baseid,regular)
return string.match(inputString or "", (baseid and (regular and ItemRack.iSPatternBaseIDFromRegular or ItemRack.iSPatternBaseIDFromIR) or ItemRack.iSPatternRegularToIR)) or 0
end

-- [[ Season of Discovery Runes ]]
if ItemRack.IsEngravingActive() then
function ItemRack.AppendRuneID(bag, slot)
local inv_slot
if slot then
local item_id = GetContainerItemID(bag, slot)
if item_id then
inv_slot = C_Item.GetItemInventoryTypeByID(item_id)
end
else
inv_slot = bag
end
if inv_slot and C_Engraving.IsEquipmentSlotEngravable(inv_slot) then
local rune_info = C_Engraving.GetRuneForEquipmentSlot(inv_slot)
if rune_info then
return ":runeid:"..tostring(rune_info.skillLineAbilityID)
else
return ":runeid:0"
end
end
return ""
end
end

-- itemrack itemstring updater.
-- takes a saved ItemRack-style ID and returns an updated version with the latest player level and spec injected, which helps us update outdated IDs saved when the player was lower level or different spec
function ItemRack.UpdateIRString(itemRackID)
Expand Down

0 comments on commit 547c906

Please sign in to comment.