mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add lockout timer multiplier rule
This allows servers to adjust all new lockout durations added during special events like live does
This commit is contained in:
parent
b965a165b1
commit
a3a6e55d22
@ -793,6 +793,7 @@ RULE_INT(Expedition, EmptyDzShutdownDelaySeconds, 1500, "Seconds to set dynamic
|
||||
RULE_INT(Expedition, RequestExpiredLockoutLeewaySeconds, 60, "Seconds remaining on lockout to count as expired for creation requests (client hides timers under 60s remaining)")
|
||||
RULE_INT(Expedition, WorldExpeditionProcessRateMS, 6000, "Timer interval (ms) that world checks expedition states")
|
||||
RULE_BOOL(Expedition, AlwaysNotifyNewLeaderOnChange, false, "Always notify clients when made expedition leader. If false (live-like) new leaders are only notified when made leader via /dzmakeleader")
|
||||
RULE_REAL(Expedition, LockoutDurationMultiplier, 1.0, "Multiplies lockout duration by this value when new lockouts are added")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(DynamicZone)
|
||||
|
||||
@ -485,7 +485,10 @@ void Expedition::AddLockoutDuration(const std::string& event_name, int seconds,
|
||||
}
|
||||
}
|
||||
|
||||
ExpeditionDatabase::AddLockoutDuration(m_members, lockout, seconds);
|
||||
// processing lockout duration applies multiplier again in client methods,
|
||||
// update database with modified value now but pass original on
|
||||
int modified_seconds = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
ExpeditionDatabase::AddLockoutDuration(m_members, lockout, modified_seconds);
|
||||
|
||||
ProcessLockoutDuration(lockout, seconds, members_only);
|
||||
SendWorldLockoutDuration(lockout, seconds, members_only);
|
||||
@ -498,6 +501,8 @@ void Expedition::UpdateLockoutDuration(
|
||||
auto it = m_lockouts.find(event_name);
|
||||
if (it != m_lockouts.end())
|
||||
{
|
||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
|
||||
uint64_t expire_time = it->second.GetStartTime() + seconds;
|
||||
AddLockout({ m_uuid, m_expedition_name, event_name, expire_time, seconds }, members_only);
|
||||
}
|
||||
@ -1339,7 +1344,8 @@ void Expedition::AddLockoutDurationClients(
|
||||
|
||||
if (!lockout_clients.empty())
|
||||
{
|
||||
ExpeditionDatabase::AddLockoutDuration(lockout_clients, lockout, seconds);
|
||||
int modified_seconds = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
ExpeditionDatabase::AddLockoutDuration(lockout_clients, lockout, modified_seconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
#include "expedition_lockout_timer.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/util/uuid.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
@ -44,6 +45,8 @@ ExpeditionLockoutTimer::ExpeditionLockoutTimer(
|
||||
ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
|
||||
const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
|
||||
{
|
||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
|
||||
if (uuid.empty())
|
||||
{
|
||||
uuid = EQ::Util::UUID::Generate().ToString();
|
||||
@ -88,6 +91,8 @@ bool ExpeditionLockoutTimer::IsSameLockout(
|
||||
|
||||
void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
|
||||
{
|
||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
|
||||
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
||||
|
||||
auto start_time = m_expire_time - m_duration;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user