From 8a3cca0150c052478de70ee700f75c861ebbaa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Wed, 8 Aug 2018 10:38:42 +0200 Subject: [PATCH] Fixed problems with LDB honor display --- REFlex.lua | 23 ++++++++++++++++------- REFlexFunctions.lua | 13 ++++++++++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/REFlex.lua b/REFlex.lua index 4882989..c2a88d5 100644 --- a/REFlex.lua +++ b/REFlex.lua @@ -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 @@ -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() @@ -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 diff --git a/REFlexFunctions.lua b/REFlexFunctions.lua index c0ab874..4af0c14 100644 --- a/REFlexFunctions.lua +++ b/REFlexFunctions.lua @@ -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 @@ -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