diff --git a/libs/StatLogic-1.0/StatLogic-1.0.lua b/libs/StatLogic-1.0/StatLogic-1.0.lua index 43d687e..ce912b5 100644 --- a/libs/StatLogic-1.0/StatLogic-1.0.lua +++ b/libs/StatLogic-1.0/StatLogic-1.0.lua @@ -123,40 +123,21 @@ end -------------------- -- Item Set Cache -- -------------------- --- Maps ItemID to SetID -local item_set_cache = {} -- Maps SetID to number of equipped pieces local equipped_sets = setmetatable({}, { __index = function(t, set) + local equipped = 0 + for i = 1, INVSLOT_LAST_EQUIPPED do local itemID = GetInventoryItemID("player", i) - if item_set_cache[itemID] == set then - t[set] = (rawget(t, set) or 0) + 1 - else - local name = GetItemSetInfo(set) - if name then - local itemLink = GetInventoryItemLink("player", i) - tip:ClearLines() - if itemLink then tip:SetHyperlink(itemLink) end - for j = 1, tip:NumLines() do - local text = StatLogicTooltip[j]:GetText() - if text:find(name) then - item_set_cache[itemID] = set - t[set] = (rawget(t, set) or 0) + 1 - break - end - end - else - t[set] = 0 - end + if itemID and select(16, GetItemInfo(itemID)) == set then + equipped = equipped + 1 end end - if not rawget(t, set) then - -- Set to zero so we don't scan again until next UNIT_INVENTORY_CHANGED - t[set] = 0 - end - return rawget(t, set) + + t[set] = equipped + return equipped end })