[Cleanup] Cleaning up Raid.cpp (#3125)

* [Cleanup] Cleanup Raid.cpp

* cleanup

* fix is_bot instances

* bracket cleanup

* bracket cleanup

* rename variables in struct

* fix for merge
This commit is contained in:
Aeadoin
2023-03-20 11:39:14 -04:00
committed by GitHub
parent 2415645b86
commit d6b954a4b9
33 changed files with 846 additions and 779 deletions
+29 -15
View File
@@ -1062,30 +1062,32 @@ void Corpse::AllowPlayerLoot(Mob *them, uint8 slot) {
}
void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) {
if (!client)
if (!client) {
return;
}
// Added 12/08. Started compressing loot struct on live.
if(player_corpse_depop) {
if (player_corpse_depop) {
SendLootReqErrorPacket(client, LootResponse::SomeoneElse);
return;
}
if(IsPlayerCorpse() && !corpse_db_id) { // really should try to resave in this case
if (IsPlayerCorpse() && !corpse_db_id) { // really should try to resave in this case
// SendLootReqErrorPacket(client, 0);
client->Message(Chat::Red, "Warning: Corpse's dbid = 0! Corpse will not survive zone shutdown!");
std::cout << "Error: PlayerCorpse::MakeLootRequestPackets: dbid = 0!" << std::endl;
// return;
}
if(is_locked && client->Admin() < AccountStatus::GMAdmin) {
if (is_locked && client->Admin() < AccountStatus::GMAdmin) {
SendLootReqErrorPacket(client, LootResponse::SomeoneElse);
client->Message(Chat::Red, "Error: Corpse locked by GM.");
return;
}
if(!being_looted_by || (being_looted_by != 0xFFFFFFFF && !entity_list.GetID(being_looted_by)))
if (!being_looted_by || (being_looted_by != 0xFFFFFFFF && !entity_list.GetID(being_looted_by))) {
being_looted_by = 0xFFFFFFFF;
}
if (DistanceSquaredNoZ(client->GetPosition(), m_Position) > 625) {
SendLootReqErrorPacket(client, LootResponse::TooFar);
@@ -1102,23 +1104,29 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
// loot_request_type is scoped to class Corpse and reset on a per-loot session basis
if (client->GetGM()) {
if (client->Admin() >= AccountStatus::GMAdmin)
if (client->Admin() >= AccountStatus::GMAdmin) {
loot_request_type = LootRequestType::GMAllowed;
else
} else {
loot_request_type = LootRequestType::GMPeek;
}
}
else {
if (IsPlayerCorpse()) {
if (char_id == client->CharacterID()) {
loot_request_type = LootRequestType::Self;
}
else if (CanPlayerLoot(client->CharacterID())) {
if (GetPlayerKillItem() == -1)
if (GetPlayerKillItem() == -1) {
loot_request_type = LootRequestType::AllowedPVPAll;
else if (GetPlayerKillItem() == 1)
} else if (GetPlayerKillItem() == 1) {
loot_request_type = LootRequestType::AllowedPVPSingle;
else if (GetPlayerKillItem() > 1)
} else if (GetPlayerKillItem() > 1) {
loot_request_type = LootRequestType::AllowedPVPDefined;
}
}
}
else if ((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) {
@@ -1140,8 +1148,9 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
// process coin
bool loot_coin = false;
std::string tmp;
if (database.GetVariable("LootCoin", tmp))
if (database.GetVariable("LootCoin", tmp)) {
loot_coin = (tmp[0] == 1 && tmp[1] == '\0');
}
if (loot_request_type == LootRequestType::GMPeek || loot_request_type == LootRequestType::GMAllowed) {
if (
@@ -1314,8 +1323,9 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
{
if (!client)
if (!client) {
return;
}
auto lootitem = (LootingItem_Struct *)app->pBuffer;
@@ -1325,8 +1335,10 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
client->QueuePacket(app);
SendEndLootErrorPacket(client);
// unlock corpse for others
if (IsBeingLootedBy(client))
if (IsBeingLootedBy(client)) {
ResetLooter();
}
return;
}
@@ -1334,8 +1346,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
client->QueuePacket(app);
SendEndLootErrorPacket(client);
// unlock corpse for others
if (IsBeingLootedBy(client))
if (IsBeingLootedBy(client)) {
ResetLooter();
}
return;
}
@@ -1345,8 +1358,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
client->QueuePacket(app);
SendEndLootErrorPacket(client);
/* Unlock corpse for others */
if (IsBeingLootedBy(client))
if (IsBeingLootedBy(client)) {
ResetLooter();
}
return;
}