Skip to content

Commit

Permalink
Vastly improve accuracy of honor LDB display.
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Feb 9, 2021
1 parent d2d5b52 commit c9aaa6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
13 changes: 5 additions & 8 deletions REFlex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function RE:OnLoad(self)
self:RegisterEvent("PVP_MATCH_COMPLETE")
self:RegisterEvent("CHAT_MSG_ADDON")
self:RegisterEvent("PVP_RATED_STATS_UPDATE")
self:RegisterEvent("CHAT_MSG_COMBAT_HONOR_GAIN")
self:RegisterEvent("CURRENCY_DISPLAY_UPDATE")
self:RegisterForDrag("LeftButton")
tinsert(_G.UISpecialFrames,"REFlexFrame")

Expand Down Expand Up @@ -411,14 +411,11 @@ function RE:OnEvent(_, event, ...)
end
RE.LDBUpdate = true
RE:UpdateLDB()
elseif event == "CHAT_MSG_COMBAT_HONOR_GAIN" then
local today = RE:ParseUTCTimestamp()
local points = tonumber(strmatch(select(1, ...), "%d+"))
if not RE.HDatabase[today] then
RE.HDatabase[today] = 0
elseif event == "CURRENCY_DISPLAY_UPDATE" then
local currency, _, quantity = ...
if currency and quantity and currency == 1792 and quantity > 0 then
RE:ParseHonor(quantity)
end
RE.HDatabase[today] = RE.HDatabase[today] + points
RE:UpdateLDB()
end
end

Expand Down
9 changes: 9 additions & 0 deletions REFlexFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ function RE:GetSessionHonor()
RE.Settings.Filters = savedFilters
end

function RE:ParseHonor(points)
local today = RE:ParseUTCTimestamp()
if not RE.HDatabase[today] then
RE.HDatabase[today] = 0
end
RE.HDatabase[today] = RE.HDatabase[today] + points
RE:UpdateLDB()
end

function RE:GetStats(filter, arena, skipLatest)
local ili = #RE.Database
local kb, topKB, hk, topHK, honor, topHonor, damage, topDamage, healing, topHealing = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Expand Down

0 comments on commit c9aaa6f

Please sign in to comment.