From 7c63441b20c8674cad3b2f49343aa92536dcd5db Mon Sep 17 00:00:00 2001 From: Andrew6810 <16847730+andrew6180@users.noreply.github.com> Date: Sat, 5 Nov 2022 22:29:01 -0700 Subject: [PATCH] Fix average ilvl to copy default ui --- ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua index ae4234e..7bcc491 100644 --- a/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua +++ b/ElvUI_Enhanced/Modules/Blizzard/CharacterFrame.lua @@ -108,6 +108,7 @@ local GREEN_FONT_COLOR_CODE = GREEN_FONT_COLOR_CODE local HEALTH_PER_STAMINA = HEALTH_PER_STAMINA local HIGHLIGHT_FONT_COLOR_CODE = HIGHLIGHT_FONT_COLOR_CODE local INVSLOT_BODY = INVSLOT_BODY +local INVSLOT_RANGED = INVSLOT_RANGED local INVSLOT_MAINHAND = INVSLOT_MAINHAND local MANA_PER_INTELLECT = MANA_PER_INTELLECT local MANA_REGEN_FROM_SPIRIT = MANA_REGEN_FROM_SPIRIT @@ -809,12 +810,13 @@ end ]] local function GetAverageItemLevel() - local items = 16 + local items = 15 local ilvl = 0 local colorCount, sumR, sumG, sumB = 0, 0, 0, 0 - for slotID = 1, 18 do - if slotID ~= INVSLOT_BODY then + -- same ilvl calculation as C_Player:GetAverageItemLevel() + for slot = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do + if slot ~= INVSLOT_BODY and slot ~= INVSLOT_TABARD and slot ~= INVSLOT_RANGED and slot ~= INVSLOT_OFFHAND then local itemLink = GetInventoryItemLink("player", slotID) if itemLink then @@ -827,10 +829,6 @@ local function GetAverageItemLevel() sumR = sumR + qualityColors[quality][1] sumG = sumG + qualityColors[quality][2] sumB = sumB + qualityColors[quality][3] - - if slotID == INVSLOT_MAINHAND and (itemEquipLoc ~= "INVTYPE_2HWEAPON" or titanGrip) then - items = 17 - end end end end