mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 15:58:36 +00:00
Implement consent for group/raid/guild and add Auto Consent support
Refactors consent to be more live accurate Message sent to owner and receiver for each zone a corpse is in Corpses now store consent list instead of clients holding corpse list Consent throttling added Message strings and colors updated Removed reporting invalid consent targets
This commit is contained in:
+23
-96
@@ -1057,110 +1057,37 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
break;
|
||||
}
|
||||
case ServerOP_Consent: {
|
||||
// Message string id's likely to be used here are:
|
||||
// CONSENT_YOURSELF = 399
|
||||
// CONSENT_INVALID_NAME = 397
|
||||
// TARGET_NOT_FOUND = 101
|
||||
ZoneServer* zs;
|
||||
ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
ClientListEntry* cle = client_list.FindCharacter(s->grantname);
|
||||
if (cle) {
|
||||
if (cle->instance() != 0)
|
||||
{
|
||||
zs = zoneserver_list.FindByInstanceID(cle->instance());
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct));
|
||||
ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
strcpy(scs->grantname, s->grantname);
|
||||
strcpy(scs->ownername, s->ownername);
|
||||
scs->permission = s->permission;
|
||||
scs->zone_id = s->zone_id;
|
||||
scs->instance_id = s->instance_id;
|
||||
scs->message_string_id = 101;
|
||||
zs = zoneserver_list.FindByInstanceID(s->instance_id);
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
LogInfo("Unable to locate zone record for instance id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->instance_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
zs = zoneserver_list.FindByZoneID(cle->zone());
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
// send target not found back to requester
|
||||
auto pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct));
|
||||
ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
strcpy(scs->grantname, s->grantname);
|
||||
strcpy(scs->ownername, s->ownername);
|
||||
scs->permission = s->permission;
|
||||
scs->zone_id = s->zone_id;
|
||||
scs->message_string_id = 101;
|
||||
zs = zoneserver_list.FindByZoneID(s->zone_id);
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// send target not found back to requester
|
||||
auto pack = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct));
|
||||
ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
strcpy(scs->grantname, s->grantname);
|
||||
strcpy(scs->ownername, s->ownername);
|
||||
scs->permission = s->permission;
|
||||
scs->zone_id = s->zone_id;
|
||||
scs->message_string_id = 397;
|
||||
zs = zoneserver_list.FindByZoneID(s->zone_id);
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
}
|
||||
safe_delete(pack);
|
||||
}
|
||||
zoneserver_list.SendPacket(pack); // update corpses in all zones
|
||||
break;
|
||||
}
|
||||
case ServerOP_Consent_Response: {
|
||||
// Message string id's likely to be used here are:
|
||||
// CONSENT_YOURSELF = 399
|
||||
// CONSENT_INVALID_NAME = 397
|
||||
// TARGET_NOT_FOUND = 101
|
||||
ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
if (s->instance_id != 0)
|
||||
|
||||
ZoneServer* owner_zs = nullptr;
|
||||
if ((s->instance_id != 0 && (owner_zs = zoneserver_list.FindByInstanceID(s->instance_id))) ||
|
||||
(s->instance_id == 0 && (owner_zs = zoneserver_list.FindByZoneID(s->zone_id))))
|
||||
{
|
||||
ZoneServer* zs = zoneserver_list.FindByInstanceID(s->instance_id);
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
LogInfo("Unable to locate zone record for instance id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->instance_id);
|
||||
}
|
||||
owner_zs->SendPacket(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZoneServer* zs = zoneserver_list.FindByZoneID(s->zone_id);
|
||||
if (zs) {
|
||||
zs->SendPacket(pack);
|
||||
}
|
||||
else {
|
||||
LogInfo("Unable to locate zone record for zone id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id);
|
||||
LogInfo("Unable to locate zone record for zone id [{}] or instance id [{}] in zoneserver list for ServerOP_Consent_Response operation", s->zone_id, s->instance_id);
|
||||
}
|
||||
|
||||
if (s->consent_type == EQEmu::consent::Normal)
|
||||
{
|
||||
// send the message to the client being granted or denied permission
|
||||
if (ClientListEntry* cle = client_list.FindCharacter(s->grantname))
|
||||
{
|
||||
ZoneServer* granted_zs = nullptr;
|
||||
if ((cle->instance() != 0 && (granted_zs = zoneserver_list.FindByInstanceID(cle->instance()))) ||
|
||||
(cle->instance() == 0 && (granted_zs = zoneserver_list.FindByZoneID(cle->zone()))))
|
||||
{
|
||||
// avoid sending twice if owner and granted are in same zone
|
||||
if (granted_zs != owner_zs) {
|
||||
granted_zs->SendPacket(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user