mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
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:
+5
-1
@@ -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));
|
||||
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user