From 547c90625cc15f37e869236e59dce76f63196aa3 Mon Sep 17 00:00:00 2001 From: romracer Date: Wed, 5 Jun 2024 09:48:35 -0500 Subject: [PATCH] Fix SoD runes 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. --- ItemRack/ItemRack.lua | 55 ++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/ItemRack/ItemRack.lua b/ItemRack/ItemRack.lua index da20407..ab98d0b 100644 --- a/ItemRack/ItemRack.lua +++ b/ItemRack/ItemRack.lua @@ -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 @@ -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)