Send lockout times with client rounding offset

Add 60s to lockout times sent to clients. Lockout timers
are rounded down to the nearest minute when displayed

This replaces the lockout leeway rule with better behavior
This commit is contained in:
hg
2020-10-08 19:03:43 -04:00
parent ca113cdd85
commit 3a1eb51890
3 changed files with 7 additions and 11 deletions
+5 -1
View File
@@ -9766,6 +9766,10 @@ void Client::SendExpeditionLockoutTimers()
{
std::vector<ExpeditionLockoutTimerEntry_Struct> lockout_entries;
// client displays lockouts rounded down to nearest minute, send lockouts
// with 60s offset added to compensate (live does this too)
constexpr uint32_t rounding_seconds = 60;
// erases expired lockouts while building lockout timer list
for (auto it = m_expedition_lockouts.begin(); it != m_expedition_lockouts.end();)
{
@@ -9778,7 +9782,7 @@ void Client::SendExpeditionLockoutTimers()
{
ExpeditionLockoutTimerEntry_Struct lockout;
strn0cpy(lockout.expedition_name, it->GetExpeditionName().c_str(), sizeof(lockout.expedition_name));
lockout.seconds_remaining = seconds_remaining;
lockout.seconds_remaining = seconds_remaining + rounding_seconds;
lockout.event_type = it->IsReplayTimer() ? Expedition::REPLAY_TIMER_ID : Expedition::EVENT_TIMER_ID;
strn0cpy(lockout.event_name, it->GetEventName().c_str(), sizeof(lockout.event_name));
+2 -9
View File
@@ -191,12 +191,9 @@ bool ExpeditionRequest::LoadLeaderLockouts()
// leader's lockouts are used to check member conflicts and later stored in expedition
auto lockouts = ExpeditionDatabase::LoadCharacterLockouts(m_leader_id, m_expedition_name);
auto leeway_seconds = static_cast<uint32_t>(RuleI(Expedition, RequestExpiredLockoutLeewaySeconds));
for (auto& lockout : lockouts)
{
bool is_expired = lockout.IsExpired() || lockout.GetSecondsRemaining() <= leeway_seconds;
if (!is_expired)
if (!lockout.IsExpired())
{
m_lockouts.emplace(lockout.GetEventName(), lockout);
@@ -226,8 +223,6 @@ bool ExpeditionRequest::CheckMembersForConflicts(const std::vector<std::string>&
std::vector<ExpeditionRequestConflict> member_lockout_conflicts;
auto leeway_seconds = static_cast<uint32_t>(RuleI(Expedition, RequestExpiredLockoutLeewaySeconds));
uint32_t last_character_id = 0;
for (auto row = results.begin(); row != results.end(); ++row)
{
@@ -270,9 +265,7 @@ bool ExpeditionRequest::CheckMembersForConflicts(const std::vector<std::string>&
ExpeditionLockoutTimer lockout{row[3], m_expedition_name, row[6], expire_time, duration};
// client window hides timers with less than 60s remaining, optionally count as expired
bool is_expired = lockout.IsExpired() || lockout.GetSecondsRemaining() <= leeway_seconds;
if (!is_expired)
if (!lockout.IsExpired())
{
if (lockout.IsReplayTimer())
{