Regarding gaining xp couldnt you do:
Code:
...
local function calculate(event, isInitialLogin, isReloadingUi)
if event == "PLAYER_ENTERING_WORLD" and (isInitialLogin or isReloadingUi) then
maxxp = UnitXPMax("player")
currentxp = UnitXP("player")
else
newxp = UnitXP("player")
if event == "PLAYER_LEVEL_UP" then
gained = maxxp - currentxp + newxp
maxxp = UnitXPMax("player")
else
gained = newxp - currentxp
end
print(gained)
currentxp = newxp
end
end
local f = CreateFrame("FRAME")
f:RegisterEvent("PLAYER_XP_UPDATE")
f:RegisterEvent("PLAYER_LEVEL_UP")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript(
"OnEvent",
function(self, event, isInitialLogin, isReloadingUi)
calculate(event, isInitialLogin, isReloadingUi)
end
)
something similar but due to blizzards honor calculation a little bit more complicated for honor aswell...