Skip to content

Commit

Permalink
Fixed problems with LDB honor display
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Aug 8, 2018
1 parent 23aaa89 commit 8a3cca0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
23 changes: 16 additions & 7 deletions REFlex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ function RE:OnEvent(_, event, ...)
ElvUI[1]:GetModule("Chat"):AddPluginIcons(ElvUISwag)
end

if RE.Settings.LDBMode == 1 then
RE:GetSessionHonor()
end

RE:UpdateBGData(true)
RE:UpdateArenaData(true)
elseif event == "ADDON_LOADED" and ... == "Blizzard_Calendar" then
Expand Down Expand Up @@ -834,13 +838,15 @@ function RE:UpdateConfig()
end

function RE:UpdateLDBTime()
RE.LDBTime = RE.SessionStart
if RE.Settings.LDBMode == 2 then
RE.LDBTime = RE:ParseUTCTimestamp()
elseif RE.Settings.LDBMode == 3 then
local resetday, hour = RE:GetWeeklyResetDay()
RE.LDBTime = RE:ParseUTCTimestamp() - (resetday * 86400) + (hour * 3600) + (RE.PlayerTimezone * 3600)
end
RE.LDBTime = RE.SessionStart
if RE.Settings.LDBMode == 1 and not RE.SessionHonor then
RE:GetSessionHonor()
elseif RE.Settings.LDBMode == 2 then
RE.LDBTime = RE:ParseUTCTimestamp()
elseif RE.Settings.LDBMode == 3 then
local resetday, hour = RE:GetWeeklyResetDay()
RE.LDBTime = RE:ParseUTCTimestamp() - (resetday * 86400) + (hour * 3600) + (RE.PlayerTimezone * 3600)
end
end

function RE:UpdateLDB()
Expand All @@ -852,6 +858,9 @@ function RE:UpdateLDB()
RE.LDBData.Won, RE.LDBData.Lost = RE:GetWinNumber(1, nil)
end
RE.LDBData.Honor = RE:GetHonor()
if RE.Settings.LDBMode == 1 then
RE.LDBData.Honor = RE.LDBData.Honor - RE.SessionHonor
end
RE.Settings.Filters = savedFilters

RE.LDBA = "|cFF00FF00"..RE.LDBData.Won.."|r|cFF9D9D9D-|r|cFFFF141C"..RE.LDBData.Lost.."|r |cFF9D9D9D|||r |cFFCC9900"..RE.LDBData.Honor.."|r |cFF9D9D9D|||r "..RE.LDBData.HK
Expand Down
13 changes: 10 additions & 3 deletions REFlexFunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ function RE:GetHonor()
from = RE:ParseUTCTimestamp()
elseif RE.Settings.LDBMode == 3 then
if RE.PlayerZone == "US" then
from = from - 54000
from = from - 54000 - (3600 * RE.PlayerTimezone)
elseif RE.PlayerZone == "CN" or RE.PlayerZone == "KR" then
from = from - 82800
from = from - 82800 - (3600 * RE.PlayerTimezone)
else
from = from - 25200
from = from - 25200 - (3600 * RE.PlayerTimezone)
end
end
for t, v in pairs(RE.HDatabase) do
Expand All @@ -227,6 +227,13 @@ function RE:GetHonor()
return honor
end

function RE:GetSessionHonor()
local savedFilters = RE.Settings.Filters
RE.Settings.Filters = {["Spec"] = _G.ALL, ["Map"] = 1, ["Bracket"] = 1, ["Date"] = {RE.SessionStart, 0}, ["Season"] = 0}
RE.SessionHonor = RE:GetHonor()
RE.Settings.Filters = savedFilters
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 8a3cca0

Please sign in to comment.