Update tooltip.lua more ilvl nitpicks (#12)

Previously when holding shift while hovering yourself/other player, ilvl would calculate ranged/offhand slot
As well, if an item was not-equipped, your ilvl would go up because it did not add +1 item (therefor dividing by 1 less)

Issue still remains with inaccurate display, best guess is that it's from an error grabbing item data? Could be worth looking into, issue existed before I touched it: only changed the calculation itself.
Example: I try and look at someone iLvl by holding shift on them, tooltip says "97", I whisper to ask and they are 130, seems to only work half the time? I will look further when i have more time.
This commit is contained in:
Rock5901
2022-11-10 01:22:55 -05:00
committed by GitHub
parent 03a785988a
commit 306612c732
+10 -6
View File
@@ -173,13 +173,17 @@ end
function TT:GetItemLvL(unit)
local total, items = 0, 0
for i = 1, #inventorySlots do
local itemLink = GetInventoryItemLink(unit, GetInventorySlotInfo(inventorySlots[i]))
if inventorySlots[i]~="SecondaryHandSlot" and inventorySlots[i]~= "RangedSlot" then -- does not calculate offhand and ranged
local itemLink = GetInventoryItemLink(unit, GetInventorySlotInfo(inventorySlots[i]))
if itemLink then
local iLvl = select(4, GetItemInfo(itemLink))
if iLvl and iLvl > 0 then
if itemLink then
local iLvl = select(4, GetItemInfo(itemLink))
if iLvl then
items = items + 1
total = total + iLvl
end
else --if no item equipped in slot still calculate +1 item
items = items + 1
total = total + iLvl
end
end
end
@@ -715,4 +719,4 @@ local function InitializeCallback()
TT:Initialize()
end
E:RegisterModule(TT:GetName(), InitializeCallback)
E:RegisterModule(TT:GetName(), InitializeCallback)