Skip to content

Commit

Permalink
Fix itemrack set matching in tooltips
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
romracer authored and Rottenbeer committed Sep 26, 2024
1 parent f3f8340 commit 02378d6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ItemRack/ItemRack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 02378d6

Please sign in to comment.