mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
This removes the separate Expedition class and moves lockout code and
/dz command handlers into DynamicZone classes. It also refactors some
code to reduce bloat and some database usage.
This completes the effort of moving everything to DynamicZone that
started when implementing shared tasks. It also makes sense to do this
since expeditions are just dynamic zones internally despite dzs being
used for other types. Expedition specific things are just handled with
dz type checks.
Functionally nothing should change. This is mainly internal refactoring
and moving code around along with some bug fixes and reduced database
usage.
Main changes:
- The `expeditions` database table has been removed
- Expeditions no longer use a separate id, the expedition id is just the dz id
- Expedition lock state and replay timer option were moved to the
`dynamic_zones` table
- Expeditions no longer have a separate cache from dynamic zones
- Expedition creation no longer has every zone query the database to cache it
- Expedition internal lockouts are now stored on DynamicZone
- The `expedition_lockouts` table has been renamed to `dynamic_zone_lockouts`
- Fixed a small bug with the UpdateLockoutDuration api where the
internal lockout would get the time added twice in memory in the
initiating zone (this api is likely rarely used)
- Fixed an issue where use of the group/raid DoesAnyMemberHaveExpeditionLockout
api would query once for every out of zone character.
- This api now checks all members in the current zone first and only
performs a single bulk query for out of zone members if that check
is exhausted
- Deprecated the max_check_count param of DoesAnyMemberHaveExpeditionLockout,
the quest api still exists to avoid api break but a passed arg has no effect
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#ifndef WORLD_DYNAMIC_ZONE_H
|
|
#define WORLD_DYNAMIC_ZONE_H
|
|
|
|
#include "../common/dynamic_zone_base.h"
|
|
#include "../common/rulesys.h"
|
|
#include "../common/timer.h"
|
|
|
|
class Database;
|
|
class ServerPacket;
|
|
|
|
enum class DynamicZoneStatus
|
|
{
|
|
Unknown = 0,
|
|
Normal,
|
|
Expired,
|
|
ExpiredEmpty,
|
|
};
|
|
|
|
class DynamicZone : public DynamicZoneBase
|
|
{
|
|
public:
|
|
using DynamicZoneBase::DynamicZoneBase; // inherit base constructors
|
|
|
|
static DynamicZone* FindDynamicZoneByID(uint32_t dz_id);
|
|
|
|
void SetSecondsRemaining(uint32_t seconds_remaining) override;
|
|
|
|
void CacheMemberStatuses();
|
|
DynamicZoneStatus Process();
|
|
bool SetNewLeader(uint32_t member_id);
|
|
|
|
protected:
|
|
Database& GetDatabase() override;
|
|
void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed) override;
|
|
bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status) override;
|
|
bool SendServerPacket(ServerPacket* packet) override;
|
|
|
|
private:
|
|
friend class DynamicZoneManager;
|
|
|
|
void CheckExpireWarning();
|
|
void CheckLeader();
|
|
void ChooseNewLeader();
|
|
void SendZoneMemberStatuses(uint16_t zone_id, uint16_t instance_id);
|
|
void SendZonesDurationUpdate();
|
|
void SendZonesDynamicZoneDeleted();
|
|
void SendZonesExpireWarning(uint32_t minutes_remaining);
|
|
void SendZonesLeaderChanged();
|
|
|
|
bool m_is_pending_early_shutdown = false;
|
|
bool m_choose_leader_needed = false;
|
|
Timer m_choose_leader_cooldown_timer{ static_cast<uint32_t>(RuleI(Expedition, ChooseLeaderCooldownTime)) };
|
|
Timer m_warning_cooldown_timer{ 1 }; // non-zero so it's enabled initially
|
|
};
|
|
|
|
#endif
|