From 02378d67cc807b2fd15fa02d3b42dbc3aa3035fa Mon Sep 17 00:00:00 2001 From: romracer Date: Wed, 5 Jun 2024 13:24:17 -0500 Subject: [PATCH] Fix itemrack set matching in tooltips Use exact IDs for items in bags/inventory, and base IDs for links. This fixes the problem where you might have two of the same item but with different runes applied. Before this fix, ItemRack would show both items as belonging to both sets, which is only true if the exact item from the set wasn't found at time of equip. Now, we'll only show set information in tooltips for items in bags/ inventory if that exact item is part of a set. Links from other players will still show sets you have that include the same base ID. --- ItemRack/ItemRack.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ItemRack/ItemRack.lua b/ItemRack/ItemRack.lua index 652a041..0366e58 100644 --- a/ItemRack/ItemRack.lua +++ b/ItemRack/ItemRack.lua @@ -460,11 +460,11 @@ function ItemRack.UpdateClassSpecificStuff() end function ItemRack.OnSetBagItem(tooltip, bag, slot) - ItemRack.ListSetsHavingItem(tooltip, ItemRack.GetID(bag, slot)) + ItemRack.ListSetsHavingItem(tooltip, ItemRack.GetID(bag, slot), true) end function ItemRack.OnSetInventoryItem(tooltip, unit, inv_slot) - ItemRack.ListSetsHavingItem(tooltip, ItemRack.GetID(inv_slot)) + ItemRack.ListSetsHavingItem(tooltip, ItemRack.GetID(inv_slot), true) end function ItemRack.OnSetHyperlink(tooltip, link) @@ -474,16 +474,23 @@ end do local data = {} - function ItemRack.ListSetsHavingItem(tooltip, id) + function ItemRack.ListSetsHavingItem(tooltip, id, exact) if ItemRackSettings.ShowSetInTooltip ~= "ON" then return end - local same_ids = ItemRack.SameID if not id or id == 0 then return end + local same_ids = ItemRack.SameID for name, set in pairs(ItemRackUser.Sets) do for _, item in pairs(set.equip) do - if same_ids(item, id) then - data[name] = true + if exact then + item = ItemRack.UpdateIRString(item) + if item==id then + data[name] = true + end + else + if same_ids(item, id) then + data[name] = true + end end end end