mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Expeditions] Move expedition code into DynamicZone (#4672)
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
This commit is contained in:
+29
-31
@@ -21,8 +21,7 @@
|
||||
class Client;
|
||||
class EQApplicationPacket;
|
||||
class DynamicZone;
|
||||
class Expedition;
|
||||
class ExpeditionLockoutTimer;
|
||||
class DzLockout;
|
||||
class ExpeditionRequest;
|
||||
class Group;
|
||||
class NPC;
|
||||
@@ -32,6 +31,7 @@ class Seperator;
|
||||
class ServerPacket;
|
||||
struct DynamicZoneLocation;
|
||||
enum WaterRegionType : int;
|
||||
enum class DynamicZoneMemberStatus;
|
||||
|
||||
namespace EQ
|
||||
{
|
||||
@@ -248,6 +248,13 @@ struct ClientReward
|
||||
uint32 amount;
|
||||
};
|
||||
|
||||
struct ExpeditionInvite
|
||||
{
|
||||
uint32_t dz_id;
|
||||
std::string inviter_name;
|
||||
std::string swap_name;
|
||||
};
|
||||
|
||||
class Client : public Mob
|
||||
{
|
||||
public:
|
||||
@@ -1565,32 +1572,24 @@ public:
|
||||
Client* client, const std::string& client_name, uint16_t chat_type,
|
||||
uint32_t string_id, const std::initializer_list<std::string>& arguments = {});
|
||||
|
||||
void AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool update_db = false);
|
||||
void AddExpeditionLockoutDuration(const std::string& expedition_name,
|
||||
const std::string& event_Name, int seconds, const std::string& uuid = {}, bool update_db = false);
|
||||
void AddNewExpeditionLockout(const std::string& expedition_name,
|
||||
const std::string& event_name, uint32_t duration, std::string uuid = {});
|
||||
Expedition* CreateExpedition(DynamicZone& dz, bool disable_messages = false);
|
||||
Expedition* CreateExpedition(const std::string& zone_name,
|
||||
uint32 version, uint32 duration, const std::string& expedition_name,
|
||||
uint32 min_players, uint32 max_players, bool disable_messages = false);
|
||||
Expedition* CreateExpeditionFromTemplate(uint32_t dz_template_id);
|
||||
Expedition* GetExpedition() const;
|
||||
uint32 GetExpeditionID() const { return m_expedition_id; }
|
||||
const ExpeditionLockoutTimer* GetExpeditionLockout(
|
||||
const std::string& expedition_name, const std::string& event_name, bool include_expired = false) const;
|
||||
const std::vector<ExpeditionLockoutTimer>& GetExpeditionLockouts() const { return m_expedition_lockouts; };
|
||||
std::vector<ExpeditionLockoutTimer> GetExpeditionLockouts(const std::string& expedition_name, bool include_expired = false);
|
||||
uint32 GetPendingExpeditionInviteID() const { return m_pending_expedition_invite.expedition_id; }
|
||||
bool HasExpeditionLockout(const std::string& expedition_name, const std::string& event_name, bool include_expired = false);
|
||||
bool IsInExpedition() const { return m_expedition_id != 0; }
|
||||
void RemoveAllExpeditionLockouts(const std::string& expedition_name, bool update_db = false);
|
||||
void RemoveExpeditionLockout(const std::string& expedition_name,
|
||||
const std::string& event_name, bool update_db = false);
|
||||
void RequestPendingExpeditionInvite();
|
||||
void SendExpeditionLockoutTimers();
|
||||
void SetExpeditionID(uint32 expedition_id) { m_expedition_id = expedition_id; };
|
||||
void SetPendingExpeditionInvite(ExpeditionInvite&& invite) { m_pending_expedition_invite = invite; }
|
||||
void AddDzLockout(const DzLockout& lockout, bool update_db = false);
|
||||
void AddDzLockout(const std::string& expedition, const std::string& event, uint32_t duration, std::string uuid = {});
|
||||
void AddDzLockoutDuration(const DzLockout& lockout, int seconds, const std::string& uuid = {}, bool update_db = false);
|
||||
DynamicZone* CreateExpedition(DynamicZone& dz, bool silent = false);
|
||||
DynamicZone* CreateExpedition(uint32 zone_id, uint32 version, uint32 duration, const std::string& name, uint32 min_players, uint32 max_players, bool silent = false);
|
||||
DynamicZone* CreateExpeditionFromTemplate(uint32_t dz_template_id);
|
||||
DynamicZone* GetExpedition() const;
|
||||
uint32 GetExpeditionID() const;
|
||||
const DzLockout* GetDzLockout(const std::string& expedition, const std::string& event) const;
|
||||
const std::vector<DzLockout>& GetDzLockouts() const { return m_dz_lockouts; };
|
||||
std::vector<DzLockout> GetDzLockouts(const std::string& expedition);
|
||||
uint32 GetPendingDzInviteID() const { return m_dz_invite.dz_id; }
|
||||
void SetPendingDzInvite(const ExpeditionInvite& invite) { m_dz_invite = invite; }
|
||||
void RequestPendingDzInvite() const;
|
||||
bool HasDzLockout(const std::string& expedition, const std::string& event) const;
|
||||
void RemoveDzLockouts(const std::string& expedition, bool update_db = false);
|
||||
void RemoveDzLockout(const std::string& expedition, const std::string& event, bool update_db = false);
|
||||
void SendDzLockoutTimers();
|
||||
void DzListTimers();
|
||||
void SetDzRemovalTimer(bool enable_timer);
|
||||
void SendDzCompassUpdate();
|
||||
@@ -2285,9 +2284,8 @@ private:
|
||||
|
||||
uint8 client_max_level;
|
||||
|
||||
uint32 m_expedition_id = 0;
|
||||
ExpeditionInvite m_pending_expedition_invite { 0 };
|
||||
std::vector<ExpeditionLockoutTimer> m_expedition_lockouts;
|
||||
ExpeditionInvite m_dz_invite = {};
|
||||
std::vector<DzLockout> m_dz_lockouts;
|
||||
glm::vec3 m_quest_compass;
|
||||
bool m_has_quest_compass = false;
|
||||
std::vector<uint32_t> m_dynamic_zone_ids;
|
||||
|
||||
Reference in New Issue
Block a user