From e09b0ae1e9ca8573a1e213654765c690a216af46 Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Sun, 2 Feb 2020 14:12:13 -0500 Subject: [PATCH] Let client handle consent confirmation messages to corpse owner --- common/servertalk.h | 1 - zone/client.cpp | 1 - zone/string_ids.h | 2 -- zone/worldserver.cpp | 34 +++++++++++++++++----------------- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/common/servertalk.h b/common/servertalk.h index 2557941e7..aa3529756 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -870,7 +870,6 @@ struct ServerOP_Consent_Struct { uint8 permission; uint32 zone_id; uint16 instance_id; - uint32 message_string_id; uint8 consent_type; // 0 = normal, 1 = group, 2 = raid, 3 = guild uint32 consent_id; }; diff --git a/zone/client.cpp b/zone/client.cpp index fd1080797..31333dc57 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6272,7 +6272,6 @@ void Client::ConsentCorpses(const char* consent_name, bool deny) strn0cpy(scs->grantname, consent_name, sizeof(scs->grantname)); strn0cpy(scs->ownername, GetName(), sizeof(scs->ownername)); strn0cpy(scs->zonename, "Unknown", sizeof(scs->zonename)); - scs->message_string_id = 0; scs->permission = deny ? 0 : 1; scs->zone_id = zone->GetZoneID(); scs->instance_id = zone->GetInstanceID(); diff --git a/zone/string_ids.h b/zone/string_ids.h index 7c4066b55..3b17b6d5b 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -268,8 +268,6 @@ #define REZZ_ALREADY_PENDING 1379 //You were unable to restore the corpse to life, but you may have success with a later attempt. #define IN_USE 1406 //Someone else is using that. Try again later. #define DUEL_FLED 1408 //%1 has defeated %2 in a duel to the death! %3 has fled like a cowardly dog! -#define GIVE_CONSENT 1427 //You have given %1 permission to drag your corpse in %2. -#define DENY_CONSENT 1428 //You have denied %1 permission to drag your corpse in %2. #define MEMBER_OF_YOUR_GUILD 1429 #define OFFICER_OF_YOUR_GUILD 1430 #define LEADER_OF_YOUR_GUILD 1431 diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 2787d3c88..56f99067c 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -1475,7 +1475,6 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) if (zone) { strn0cpy(scs->zonename, zone->GetLongName(), sizeof(scs->zonename)); } - scs->message_string_id = s->permission ? GIVE_CONSENT : DENY_CONSENT; worldserver.SendPacket(outapp); safe_delete(outapp); } @@ -1483,24 +1482,25 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) } case ServerOP_Consent_Response: { ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer; + Client* owner_client = entity_list.GetClientByName(s->ownername); + Client* grant_client = nullptr; if (s->consent_type == EQEmu::consent::Normal) { - Client* grant_client = entity_list.GetClientByName(s->grantname); - if (grant_client) { - // send the message to the client being granted or denied permission - auto outapp = new EQApplicationPacket(OP_ConsentResponse, sizeof(ConsentResponse_Struct)); - ConsentResponse_Struct* crs = (ConsentResponse_Struct*)outapp->pBuffer; - strn0cpy(crs->grantname, s->grantname, sizeof(crs->grantname)); - strn0cpy(crs->ownername, s->ownername, sizeof(crs->ownername)); - crs->permission = s->permission; - strn0cpy(crs->zonename, s->zonename, sizeof(crs->zonename)); - grant_client->QueuePacket(outapp); - safe_delete(outapp); - } + grant_client = entity_list.GetClientByName(s->grantname); } - Client* client = entity_list.GetClientByName(s->ownername); - if (client) { - // send owner consent/deny confirmation message - client->MessageString(Chat::White, s->message_string_id, s->grantname, s->zonename); + if (owner_client || grant_client) { + auto outapp = new EQApplicationPacket(OP_ConsentResponse, sizeof(ConsentResponse_Struct)); + ConsentResponse_Struct* crs = (ConsentResponse_Struct*)outapp->pBuffer; + strn0cpy(crs->grantname, s->grantname, sizeof(crs->grantname)); + strn0cpy(crs->ownername, s->ownername, sizeof(crs->ownername)); + crs->permission = s->permission; + strn0cpy(crs->zonename, s->zonename, sizeof(crs->zonename)); + if (owner_client) { + owner_client->QueuePacket(outapp); // confirmation message to the owner + } + if (grant_client) { + grant_client->QueuePacket(outapp); // message to the client being granted/denied + } + safe_delete(outapp); } break; }