mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 17:38:26 +00:00
[Expeditions] Let dz process its expired state (#1310)
Move early empty shutdown and process rate rules to DynamicZone scope This decouples the expired status check from expeditions into an internal dz method that can be called by its owning system
This commit is contained in:
@@ -35,6 +35,30 @@ DynamicZone* DynamicZone::FindDynamicZoneByID(uint32_t dz_id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DynamicZoneStatus DynamicZone::Process(bool force_expire)
|
||||
{
|
||||
DynamicZoneStatus status = DynamicZoneStatus::Normal;
|
||||
|
||||
if (force_expire || IsExpired())
|
||||
{
|
||||
status = DynamicZoneStatus::Expired;
|
||||
|
||||
auto dz_zoneserver = zoneserver_list.FindByInstanceID(GetInstanceID());
|
||||
if (!dz_zoneserver || dz_zoneserver->NumPlayers() == 0) // no clients inside dz
|
||||
{
|
||||
status = DynamicZoneStatus::ExpiredEmpty;
|
||||
|
||||
if (force_expire && !m_is_pending_early_shutdown && RuleB(DynamicZone, EmptyShutdownEnabled))
|
||||
{
|
||||
SetSecondsRemaining(RuleI(DynamicZone, EmptyShutdownDelaySeconds));
|
||||
m_is_pending_early_shutdown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
void DynamicZone::SetSecondsRemaining(uint32_t seconds_remaining)
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
|
||||
Reference in New Issue
Block a user