mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
Remove assignments in conditions
This commit is contained in:
parent
371265d143
commit
9689787e56
@ -1064,29 +1064,34 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
|
||||
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))))
|
||||
{
|
||||
if (s->instance_id == 0) {
|
||||
owner_zs = zoneserver_list.FindByZoneID(s->zone_id);
|
||||
}
|
||||
else {
|
||||
owner_zs = zoneserver_list.FindByInstanceID(s->instance_id);
|
||||
}
|
||||
|
||||
if (owner_zs) {
|
||||
owner_zs->SendPacket(pack);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
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)
|
||||
{
|
||||
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))
|
||||
{
|
||||
ClientListEntry* cle = client_list.FindCharacter(s->grantname);
|
||||
if (cle) {
|
||||
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);
|
||||
}
|
||||
if (cle->instance() == 0) {
|
||||
granted_zs = zoneserver_list.FindByZoneID(cle->zone());
|
||||
}
|
||||
else {
|
||||
granted_zs = zoneserver_list.FindByInstanceID(cle->instance());
|
||||
}
|
||||
// avoid sending twice if owner and granted are in same zone
|
||||
if (granted_zs && granted_zs != owner_zs) {
|
||||
granted_zs->SendPacket(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,10 +283,16 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob (
|
||||
allowed_looters[i] = 0;
|
||||
}
|
||||
|
||||
Group* grp = nullptr;
|
||||
Raid* raid = nullptr;
|
||||
consent_group_id = (client->AutoConsentGroupEnabled() && (grp = client->GetGroup())) ? grp->GetID() : 0;
|
||||
consent_raid_id = (client->AutoConsentRaidEnabled() && (raid = client->GetRaid())) ? raid->GetID() : 0;
|
||||
if (client->AutoConsentGroupEnabled()) {
|
||||
Group* grp = client->GetGroup();
|
||||
consent_group_id = grp ? grp->GetID() : 0;
|
||||
}
|
||||
|
||||
if (client->AutoConsentRaidEnabled()) {
|
||||
Raid* raid = client->GetRaid();
|
||||
consent_raid_id = raid ? raid->GetID() : 0;
|
||||
}
|
||||
|
||||
consent_guild_id = client->AutoConsentGuildEnabled() ? client->GuildID() : 0;
|
||||
|
||||
is_corpse_changed = true;
|
||||
@ -1474,13 +1480,20 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!consented) {
|
||||
Group* grp = nullptr;
|
||||
Raid* raid = nullptr;
|
||||
if ((consent_guild_id && consent_guild_id != GUILD_NONE && client->GuildID() == consent_guild_id) ||
|
||||
(consent_group_id && (grp = client->GetGroup()) && grp->GetID() == consent_group_id) ||
|
||||
(consent_raid_id && (raid = client->GetRaid()) && raid->GetID() == consent_raid_id))
|
||||
{
|
||||
if (!consented && consent_guild_id && consent_guild_id != GUILD_NONE) {
|
||||
if (client->GuildID() == consent_guild_id) {
|
||||
consented = true;
|
||||
}
|
||||
}
|
||||
if (!consented && consent_group_id) {
|
||||
Group* grp = client->GetGroup();
|
||||
if (grp && grp->GetID() == consent_group_id) {
|
||||
consented = true;
|
||||
}
|
||||
}
|
||||
if (!consented && consent_raid_id) {
|
||||
Raid* raid = client->GetRaid();
|
||||
if (raid && raid->GetID() == consent_raid_id) {
|
||||
consented = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1467,8 +1467,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
}
|
||||
|
||||
if (found_corpse)
|
||||
{
|
||||
if (found_corpse) {
|
||||
// forward the grant/deny message for this zone to both owner and granted
|
||||
auto outapp = new ServerPacket(ServerOP_Consent_Response, sizeof(ServerOP_Consent_Struct));
|
||||
ServerOP_Consent_Struct* scs = (ServerOP_Consent_Struct*)outapp->pBuffer;
|
||||
@ -1484,10 +1483,9 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
}
|
||||
case ServerOP_Consent_Response: {
|
||||
ServerOP_Consent_Struct* s = (ServerOP_Consent_Struct*)pack->pBuffer;
|
||||
if (s->consent_type == EQEmu::consent::Normal)
|
||||
{
|
||||
if (Client* client = entity_list.GetClientByName(s->grantname))
|
||||
{
|
||||
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;
|
||||
@ -1495,12 +1493,12 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
strcpy(crs->ownername, s->ownername);
|
||||
crs->permission = s->permission;
|
||||
strn0cpy(crs->zonename, s->zonename, sizeof(crs->zonename));
|
||||
client->QueuePacket(outapp);
|
||||
grant_client->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
}
|
||||
if (Client* client = entity_list.GetClientByName(s->ownername))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user