mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-25 02:08:23 +00:00
[Expeditions] Decouple dz updates from expeditions (#1303)
Use internal dz messages to process duration and location changes Add world DynamicZone class (later this will inherit from a base) Add FindDynamicZoneByID to get dz from zone and world system caches
This commit is contained in:
+4
-14
@@ -21,6 +21,7 @@
|
||||
#ifndef WORLD_EXPEDITION_H
|
||||
#define WORLD_EXPEDITION_H
|
||||
|
||||
#include "dynamic_zone.h"
|
||||
#include "../common/timer.h"
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
@@ -30,8 +31,7 @@ class Expedition
|
||||
{
|
||||
public:
|
||||
Expedition() = default;
|
||||
Expedition(uint32_t expedition_id, uint32_t dz_id, uint32_t dz_instance_id,
|
||||
uint32_t dz_zone_id, uint32_t expire_time, uint32_t duration, uint32_t leader_id);
|
||||
Expedition(uint32_t expedition_id, const DynamicZone& dz, uint32_t leader_id);
|
||||
|
||||
void AddMember(uint32_t character_id);
|
||||
void RemoveMember(uint32_t character_id);
|
||||
@@ -39,38 +39,28 @@ public:
|
||||
void CheckExpireWarning();
|
||||
void CheckLeader();
|
||||
void ChooseNewLeader();
|
||||
DynamicZone& GetDynamicZone() { return m_dynamic_zone; }
|
||||
uint32_t GetID() const { return m_expedition_id; }
|
||||
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_dz_instance_id); }
|
||||
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_dz_zone_id); }
|
||||
bool HasMember(uint32_t character_id);
|
||||
bool IsEmpty() const { return m_member_ids.empty(); }
|
||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||
bool IsPendingDelete() const { return m_pending_delete; }
|
||||
bool IsValid() const { return m_expedition_id != 0; }
|
||||
void SendZonesDurationUpdate();
|
||||
void SendZonesExpeditionDeleted();
|
||||
void SendZonesExpireWarning(uint32_t minutes_remaining);
|
||||
bool SetNewLeader(uint32_t new_leader_id);
|
||||
void SetPendingDelete(bool pending) { m_pending_delete = pending; }
|
||||
void UpdateDzSecondsRemaining(uint32_t seconds_remaining);
|
||||
std::chrono::system_clock::duration GetRemainingDuration() const;
|
||||
|
||||
private:
|
||||
void SendZonesLeaderChanged();
|
||||
|
||||
uint32_t m_expedition_id = 0;
|
||||
uint32_t m_dz_id = 0;
|
||||
uint32_t m_dz_instance_id = 0;
|
||||
uint32_t m_dz_zone_id = 0;
|
||||
uint32_t m_leader_id = 0;
|
||||
bool m_pending_delete = false;
|
||||
bool m_choose_leader_needed = false;
|
||||
Timer m_choose_leader_cooldown_timer;
|
||||
Timer m_warning_cooldown_timer;
|
||||
DynamicZone m_dynamic_zone;
|
||||
std::vector<uint32_t> m_member_ids;
|
||||
std::chrono::seconds m_duration;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user