From 306612c732c928461d759081248c57783c18139b Mon Sep 17 00:00:00 2001 From: Rock5901 <75347238+Rock5901@users.noreply.github.com> Date: Thu, 10 Nov 2022 01:22:55 -0500 Subject: [PATCH] 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. --- ElvUI/Modules/Tooltip/Tooltip.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ElvUI/Modules/Tooltip/Tooltip.lua b/ElvUI/Modules/Tooltip/Tooltip.lua index 5d3ea86..dc38c72 100644 --- a/ElvUI/Modules/Tooltip/Tooltip.lua +++ b/ElvUI/Modules/Tooltip/Tooltip.lua @@ -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) \ No newline at end of file +E:RegisterModule(TT:GetName(), InitializeCallback)