I honestly had a difficult time following what that author was doing with the math, but it looked like they were trying to cumulatively add to a value they kept saving without actually keeping track of the session's starting point. In the custom display function, replace it all with the following code:
Code:
function()
--start at 0 each update
local display=0
local honor=UnitHonor("player")
local max=UnitHonorMax("player")
local level=UnitHonorLevel("player")
if not WA_HonorBar_Honor then
--starting honor and level
setglobal("WA_HonorBar_Honor",honor)
setglobal("WA_HonorBar_Level",level)
end
--save each level's max
setglobal("WA_HonorBar_Max_"..level,max)
--calculate each level
for i=WA_HonorBar_Level,level do
if level==WA_HonorBar_Level then
--current level is the starting level, current-start only
display=honor-WA_HonorBar_Honor
elseif i==WA_HonorBar_Level then
--the first level in the session, max-start
display=getglobal("WA_HonorBar_Max_"..i)-WA_HonorBar_Honor
elseif i==level then
--the current level, cumulative+current
display=display+honor
else
--any levels between starting level and current level, add entire max
display=display+getglobal("WA_HonorBar_Max_"..i)
end
end
return display
end
Keep in mind that your starting point is wiped if you /reload your UI, since WeakAuras does not provide a method for auras to save data outside the UI, so auras can't tell the difference between logging in and reloading. I did some simple testing by forcing different honor and levels, the resulting value on the left worked with my testing.