Let client handle consent confirmation messages to corpse owner

This commit is contained in:
hg 2020-02-02 14:12:13 -05:00
parent 14c070f845
commit e09b0ae1e9
4 changed files with 17 additions and 21 deletions

View File

@ -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;
};

View File

@ -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();

View File

@ -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

View File

@ -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;
}