Skip to content

Commit

Permalink
"This week" filter now include the time between weekly resets
Browse files Browse the repository at this point in the history
AcidWeb committed Aug 2, 2018

Verified

This commit was signed with the committer’s verified signature.
ElDavoo Davide Palma
1 parent 4917e9d commit f49db01
Showing 3 changed files with 33 additions and 14 deletions.
21 changes: 8 additions & 13 deletions REFlex.lua
Original file line number Diff line number Diff line change
@@ -585,14 +585,12 @@ function RE:OnDateChange(_, mode)
elseif mode == 3 then
RE.Settings.Filters.Date = {time(t) - 86400 - RE.PlayerTimezone, time(t) - RE.PlayerTimezone}
elseif mode == 4 then
if d.weekday == 1 then
d.weekday = 6
else
d.weekday = d.weekday - 2
end
RE.Settings.Filters.Date = {time(t) - (d.weekday * 86400) - RE.PlayerTimezone, 0}
local resetday, hour = RE:GetWeeklyResetDay(d.weekday)
t.hour = hour
RE.Settings.Filters.Date = {time(t) - (resetday * 86400) - RE.PlayerTimezone, 0}
elseif mode == 5 then
t = {day = 1, month = d.month, year = d.year, hour = 0}
t.day = 1
t.hour = 0
RE.Settings.Filters.Date = {time(t) - RE.PlayerTimezone, 0}
elseif mode == 6 then
RE.Settings.Filters.Date = {0, 0}
@@ -794,12 +792,9 @@ function RE:UpdateLDBTime()
if RE.Settings.LDBMode == 2 then
RE.LDBTime = time(t) - RE.PlayerTimezone
elseif RE.Settings.LDBMode == 3 then
if d.weekday == 1 then
d.weekday = 6
else
d.weekday = d.weekday - 2
end
RE.LDBTime = time(t) - (d.weekday * 86400) - RE.PlayerTimezone
local resetday, hour = RE:GetWeeklyResetDay(d.weekday)
t.hour = hour
RE.LDBTime = time(t) - (resetday * 86400) - RE.PlayerTimezone
end
end

24 changes: 24 additions & 0 deletions REFlexFunctions.lua
Original file line number Diff line number Diff line change
@@ -665,6 +665,30 @@ function RE:GetConquestPoints()
return objectives[1].numFulfilled, objectives[1].numRequired
end

function RE:GetWeeklyResetDay(weekday)
local resetday, hour
if RE.PlayerZone == "US" then
hour = 15
if weekday >= 3 then
resetday = weekday - 3
else
resetday = weekday + 4
end
else
if RE.PlayerZone == "CN" or RE.PlayerZone == "KR" then
hour = 23
else
hour = 7
end
if weekday >= 4 then
resetday = weekday - 4
else
resetday = weekday + 3
end
end
return resetday, hour
end

function RE:Round(num, idp)
local mult = 10^(idp or 0)
return mfloor(num * mult + 0.5) / mult
2 changes: 1 addition & 1 deletion REFlexStructures.lua
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ RE.DefaultConfig = {
["CurrentTab"] = 1,
["Filters"] = {["Spec"] = ALL, ["Map"] = 1, ["Bracket"] = 1, ["Date"] = {0, 0}, ["Season"] = 0, ["DateMode"] = 1},
["FirstTime"] = true,
["LDBMode"] = 2,
["LDBMode"] = 3,
["LDBSide"] = "A",
["ConfigVersion"] = RE.Version
}

0 comments on commit f49db01

Please sign in to comment.