mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-19 20:02:25 +00:00
Validate expedition invite response server side
Stores expedition invite data on client
This commit is contained in:
parent
43963783db
commit
d92c0e330d
@ -21,8 +21,6 @@
|
||||
class Client;
|
||||
class EQApplicationPacket;
|
||||
class EQStream;
|
||||
class Expedition;
|
||||
class ExpeditionLockoutTimer;
|
||||
class Group;
|
||||
class NPC;
|
||||
class Object;
|
||||
@ -54,6 +52,7 @@ namespace EQ
|
||||
#include "aggromanager.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "expedition.h"
|
||||
#include "dynamiczone.h"
|
||||
#include "merc.h"
|
||||
#include "mob.h"
|
||||
@ -1126,14 +1125,14 @@ public:
|
||||
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);
|
||||
uint32 GetPendingExpeditionInviteID() const { return m_pending_expedition_invite_id; }
|
||||
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(std::string expedition_name = {});
|
||||
void RemoveExpeditionLockout(const std::string& expedition_name, const std::string& event_name, bool update_db = false);
|
||||
void SetPendingExpeditionInvite(uint32 id) { m_pending_expedition_invite_id = id; }
|
||||
void SendExpeditionLockoutTimers();
|
||||
void SetExpeditionID(uint32 expedition_id) { m_expedition_id = expedition_id; };
|
||||
void SetPendingExpeditionInvite(ExpeditionInvite&& invite) { m_pending_expedition_invite = invite; }
|
||||
void LoadAllExpeditionLockouts();
|
||||
void UpdateExpeditionInfoAndLockouts();
|
||||
void DzListTimers();
|
||||
@ -1699,7 +1698,7 @@ private:
|
||||
int client_max_level;
|
||||
|
||||
uint32 m_expedition_id = 0;
|
||||
uint32 m_pending_expedition_invite_id = 0;
|
||||
ExpeditionInvite m_pending_expedition_invite { 0 };
|
||||
std::vector<ExpeditionLockoutTimer> m_expedition_lockouts;
|
||||
DynamicZoneLocation m_quest_compass;
|
||||
|
||||
|
||||
@ -5665,13 +5665,14 @@ void Client::Handle_OP_DzChooseZoneReply(const EQApplicationPacket *app)
|
||||
|
||||
void Client::Handle_OP_DzExpeditionInviteResponse(const EQApplicationPacket *app)
|
||||
{
|
||||
auto expedition = Expedition::FindCachedExpeditionByID(m_pending_expedition_invite_id);
|
||||
m_pending_expedition_invite_id = 0;
|
||||
auto expedition = Expedition::FindCachedExpeditionByID(m_pending_expedition_invite.expedition_id);
|
||||
std::string swap_remove_name = m_pending_expedition_invite.swap_remove_name;
|
||||
m_pending_expedition_invite = { 0 }; // clear before re-validating
|
||||
|
||||
if (expedition)
|
||||
{
|
||||
auto dzmsg = reinterpret_cast<ExpeditionInviteResponse_Struct*>(app->pBuffer);
|
||||
expedition->DzInviteResponse(this, dzmsg->accepted, dzmsg->swapping, dzmsg->swap_name);
|
||||
expedition->DzInviteResponse(this, dzmsg->accepted, swap_remove_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -612,7 +612,7 @@ void Expedition::SendClientExpeditionInvite(
|
||||
m_id, client->GetName(), inviter_name, swap_remove_name
|
||||
);
|
||||
|
||||
client->SetPendingExpeditionInvite(m_id);
|
||||
client->SetPendingExpeditionInvite(ExpeditionInvite{m_id, inviter_name, swap_remove_name});
|
||||
|
||||
client->MessageString(
|
||||
Chat::System, EXPEDITION_ASKED_TO_JOIN, m_leader.name.c_str(), m_expedition_name.c_str()
|
||||
@ -731,8 +731,7 @@ bool Expedition::ProcessAddConflicts(Client* leader_client, Client* add_client,
|
||||
return has_conflict;
|
||||
}
|
||||
|
||||
void Expedition::DzInviteResponse(
|
||||
Client* add_client, bool accepted, bool has_swap_name, std::string swap_remove_name)
|
||||
void Expedition::DzInviteResponse(Client* add_client, bool accepted, const std::string& swap_remove_name)
|
||||
{
|
||||
if (!add_client)
|
||||
{
|
||||
@ -740,8 +739,8 @@ void Expedition::DzInviteResponse(
|
||||
}
|
||||
|
||||
LogExpeditionsModerate(
|
||||
"Invite response by [{}] accepted [{}] swapping [{}] swap_name [{}]",
|
||||
add_client->GetName(), accepted, has_swap_name, swap_remove_name
|
||||
"Invite response by [{}] accepted [{}] swap_name [{}]",
|
||||
add_client->GetName(), accepted, swap_remove_name
|
||||
);
|
||||
|
||||
// a null leader_client is handled by SendLeaderMessage fallbacks
|
||||
@ -754,7 +753,7 @@ void Expedition::DzInviteResponse(
|
||||
return;
|
||||
}
|
||||
|
||||
bool was_swap_invite = (has_swap_name && !swap_remove_name.empty());
|
||||
bool was_swap_invite = !swap_remove_name.empty();
|
||||
bool has_conflicts = ProcessAddConflicts(leader_client, add_client, was_swap_invite);
|
||||
|
||||
// error if swapping and character was already removed before the accept
|
||||
|
||||
@ -60,6 +60,13 @@ struct ExpeditionMember
|
||||
: char_id(char_id_), name(name_), status(status_) {}
|
||||
};
|
||||
|
||||
struct ExpeditionInvite
|
||||
{
|
||||
uint32_t expedition_id;
|
||||
std::string inviter_name;
|
||||
std::string swap_remove_name;
|
||||
};
|
||||
|
||||
class Expedition
|
||||
{
|
||||
public:
|
||||
@ -111,7 +118,7 @@ public:
|
||||
|
||||
void DzAddPlayer(Client* requester, std::string add_char_name, std::string swap_remove_name = {});
|
||||
void DzAddPlayerContinue(std::string leader_name, std::string add_char_name, std::string swap_remove_name = {});
|
||||
void DzInviteResponse(Client* add_client, bool accepted, bool has_swap_name, std::string swap_remove_name);
|
||||
void DzInviteResponse(Client* add_client, bool accepted, const std::string& swap_remove_name);
|
||||
void DzMakeLeader(Client* requester, std::string new_leader_name);
|
||||
void DzPlayerList(Client* requester);
|
||||
void DzRemovePlayer(Client* requester, std::string remove_char_name);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user