Send expedition re-invite to clients that zone

Moves expedition message handling in world to Expedition method
for messages that need special handling
This commit is contained in:
hg
2020-05-18 23:26:00 -04:00
parent 20bfdac7e0
commit e79d03261a
10 changed files with 121 additions and 18 deletions
+12 -1
View File
@@ -9549,7 +9549,6 @@ void Client::SendCrossZoneMessageString(
void Client::UpdateExpeditionInfoAndLockouts()
{
// this is processed by client after entering a zone
// todo: live re-invites if client zoned with a pending invite window open
SendDzCompassUpdate();
auto expedition = GetExpedition();
@@ -9571,6 +9570,9 @@ void Client::UpdateExpeditionInfoAndLockouts()
}
LoadAllExpeditionLockouts();
// ask world for any pending invite we saved from a previous zone
RequestPendingExpeditionInvite();
}
Expedition* Client::CreateExpedition(DynamicZone& dz_instance, ExpeditionRequest& request)
@@ -9764,6 +9766,15 @@ void Client::SendExpeditionLockoutTimers()
QueuePacket(outapp.get());
}
void Client::RequestPendingExpeditionInvite()
{
uint32_t packsize = sizeof(ServerExpeditionCharacterID_Struct);
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionRequestInvite, packsize));
auto packbuf = reinterpret_cast<ServerExpeditionCharacterID_Struct*>(pack->pBuffer);
packbuf->character_id = CharacterID();
worldserver.SendPacket(pack.get());
}
void Client::DzListTimers()
{
// only lists player's current replay timer lockouts, not all event lockouts
+1
View File
@@ -1130,6 +1130,7 @@ public:
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, bool update_client = true);
void RequestPendingExpeditionInvite();
void SendExpeditionLockoutTimers();
void SetExpeditionID(uint32 expedition_id) { m_expedition_id = expedition_id; };
void SetPendingExpeditionInvite(ExpeditionInvite&& invite) { m_pending_expedition_invite = invite; }
+13 -2
View File
@@ -1269,6 +1269,16 @@ void Expedition::SendClientExpeditionInfo(Client* client)
}
}
void Expedition::SendWorldPendingInvite(const ExpeditionInvite& invite, const std::string& add_name)
{
LogExpeditions(
"Character [{}] saving pending invite from [{}] to expedition [{}] in world",
add_name, invite.inviter_name, invite.expedition_id
);
SendWorldAddPlayerInvite(invite.inviter_name, invite.swap_remove_name, add_name, true);
}
std::unique_ptr<EQApplicationPacket> Expedition::CreateInfoPacket(bool clear)
{
uint32_t outsize = sizeof(ExpeditionInfo_Struct);
@@ -1375,10 +1385,11 @@ void Expedition::SendWorldExpeditionUpdate(bool destroyed)
}
void Expedition::SendWorldAddPlayerInvite(
const std::string& inviter_name, const std::string& swap_remove_name, const std::string& add_name)
const std::string& inviter_name, const std::string& swap_remove_name, const std::string& add_name, bool pending)
{
auto server_opcode = pending ? ServerOP_ExpeditionSaveInvite : ServerOP_ExpeditionDzAddPlayer;
uint32_t pack_size = sizeof(ServerDzCommand_Struct);
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionDzAddPlayer, pack_size));
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(server_opcode, pack_size));
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
buf->expedition_id = GetID();
buf->is_char_online = false;
+2 -1
View File
@@ -115,6 +115,7 @@ public:
void RemoveLockout(const std::string& event_name);
void SendClientExpeditionInfo(Client* client);
void SendWorldPendingInvite(const ExpeditionInvite& invite, const std::string& add_name);
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 = {});
@@ -155,7 +156,7 @@ private:
void SendWorldDzLocationUpdate(uint16_t server_opcode, const DynamicZoneLocation& location);
void SendWorldExpeditionUpdate(bool destroyed = false);
void SendWorldGetOnlineMembers();
void SendWorldAddPlayerInvite(const std::string& inviter_name, const std::string& swap_remove_name, const std::string& add_name);
void SendWorldAddPlayerInvite(const std::string& inviter_name, const std::string& swap_remove_name, const std::string& add_name, bool pending = false);
void SendWorldLeaderChanged();
void SendWorldLockoutUpdate(const std::string& event_name, uint64_t expire_time, uint32_t duration, bool remove = false);
void SendWorldMakeLeaderRequest(const std::string& requester_name, const std::string& new_leader_name);
+10
View File
@@ -404,6 +404,16 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
if(this->GetPet())
entity_list.RemoveFromHateLists(this->GetPet());
if (GetPendingExpeditionInviteID() != 0)
{
// live re-invites if client zoned with a pending invite, save pending invite info in world
auto expedition = Expedition::FindCachedExpeditionByID(GetPendingExpeditionInviteID());
if (expedition)
{
expedition->SendWorldPendingInvite(m_pending_expedition_invite, GetName());
}
}
LogInfo("Zoning [{}] to: [{}] ([{}]) - ([{}]) x [{}] y [{}] z [{}]", m_pp.name, ZoneName(zone_id), zone_id, instance_id, dest_x, dest_y, dest_z);
//set the player's coordinates in the new zone so they have them