@@ -81,24 +81,26 @@ local function GetPlayerItemLevel()
8181 [INVSLOT_BODY ] = true ,
8282 [INVSLOT_TABARD ] = true
8383 }
84+ local playerItemLevel = 0
8485 if GetAverageItemLevel then
85- return select (2 , GetAverageItemLevel ())
86- end
87- local t , c = 0 , 0
88- for i = INVSLOT_FIRST_EQUIPPED , INVSLOT_LAST_EQUIPPED do
89- if not IGNORED_ILVL_SLOTS [i ] then
90- local k = GetInventoryItemLink (" player" , i )
91- if k then
92- local l = select (4 , GetItemInfo (k ))
93- t = t + l
86+ playerItemLevel = select (2 , GetAverageItemLevel ())
87+ else
88+ local t , c = 0 , 0
89+ for i = INVSLOT_FIRST_EQUIPPED , INVSLOT_LAST_EQUIPPED do
90+ if not IGNORED_ILVL_SLOTS [i ] then
91+ local k = GetInventoryItemLink (" player" , i )
92+ if k then
93+ local l = select (4 , GetItemInfo (k ))
94+ t = t + l
95+ end
96+ c = c + 1
9497 end
95- c = c + 1
98+ end
99+ if c > 0 then
100+ playerItemLevel = t / c
96101 end
97102 end
98- if c > 0 then
99- return t / c
100- end
101- return 0
103+ return (" %.2f" ):format (playerItemLevel )
102104end
103105
104106-- From AceConsole-3.0.lua
@@ -223,7 +225,7 @@ function SimpleCalc:GetVariables()
223225 silver = function () return GetMoney () / 100 end ,
224226 gold = function () return GetMoney () / 10000 end ,
225227 maxxp = function () return UnitXPMax (p ) end ,
226- ilvl = function () return ( " %.2f " ): format ( GetPlayerItemLevel ()) end ,
228+ ilvl = GetPlayerItemLevel ,
227229 xp = function () return UnitXP (p ) end ,
228230 xpleft = function () if UnitLevel (p ) == GetMaxPlayerLevel () then return 0 end return UnitXPMax (p ) - UnitXP (p ) end ,
229231 last = function () return SimpleCalc_LastResult end ,
0 commit comments