Clang-format Corpse::LootItem

This commit is contained in:
Michael Cook (mackal) 2016-12-16 16:03:44 -05:00
parent 8f5ba05e75
commit 019586abbd

View File

@ -1062,7 +1062,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
SendLootReqErrorPacket(client, LootResponse::LootAll);
}
void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
{
/* This gets sent no matter what as a sort of ACK */
client->QueuePacket(app);
@ -1091,7 +1092,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
SendEndLootErrorPacket(client);
return;
}
if (IsPlayerCorpse() && !CanPlayerLoot(client->CharacterID()) && !become_npc && (char_id != client->CharacterID() && client->Admin() < 150)) {
if (IsPlayerCorpse() && !CanPlayerLoot(client->CharacterID()) && !become_npc &&
(char_id != client->CharacterID() && client->Admin() < 150)) {
client->Message(13, "Error: This is a player corpse and you dont own it.");
SendEndLootErrorPacket(client);
return;
@ -1101,7 +1103,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
client->Message(13, "Error: Corpse locked by GM.");
return;
}
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) && GetPlayerKillItem() == 0){
if (IsPlayerCorpse() && (char_id != client->CharacterID()) && CanPlayerLoot(client->CharacterID()) &&
GetPlayerKillItem() == 0) {
client->Message(13, "Error: You cannot loot any more items from this corpse.");
SendEndLootErrorPacket(client);
ResetLooter();
@ -1115,11 +1118,11 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
memset(bag_item_data, 0, sizeof(bag_item_data));
if (GetPlayerKillItem() > 1) {
item = database.GetItem(GetPlayerKillItem());
}
else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1){
item_data = GetItem(lootitem->slot_id - EQEmu::legacy::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward
}
else{
} else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1) {
item_data =
GetItem(lootitem->slot_id -
EQEmu::legacy::CORPSE_BEGIN); // dont allow them to loot entire bags of items as pvp reward
} else {
item_data = GetItem(lootitem->slot_id - EQEmu::legacy::CORPSE_BEGIN, bag_item_data);
}
@ -1129,9 +1132,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (item != 0) {
if (item_data) {
inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1, item_data->aug_2, item_data->aug_3, item_data->aug_4, item_data->aug_5, item_data->aug_6, item_data->attuned);
}
else {
inst = database.CreateItem(item, item_data ? item_data->charges : 0, item_data->aug_1,
item_data->aug_2, item_data->aug_3, item_data->aug_4,
item_data->aug_5, item_data->aug_6, item_data->attuned);
} else {
inst = database.CreateItem(item);
}
}
@ -1163,7 +1167,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
char buf[88];
char q_corpse_name[64];
strcpy(q_corpse_name, corpse_name);
snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(), EntityList::RemoveNumbers(q_corpse_name));
snprintf(buf, 87, "%d %d %s", inst->GetItem()->ID, inst->GetCharges(),
EntityList::RemoveNumbers(q_corpse_name));
buf[87] = '\0';
std::vector<EQEmu::Any> args;
args.push_back(inst);
@ -1197,8 +1202,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (lootitem->auto_loot) {
if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data))
client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data);
}
else {
} else {
client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data);
}
@ -1208,8 +1212,10 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
/* Remove it from Corpse */
if (item_data) {
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id);
/* Delete needs to be before RemoveItem because its deletes the pointer for
* item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot,
item_data->item_id);
/* Delete Item Instance */
RemoveItem(item_data->lootslot);
}
@ -1218,8 +1224,11 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) {
for (int i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) {
if (bag_item_data[i]) {
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id);
/* Delete needs to be before RemoveItem because its deletes the pointer for
* item_data/bag_item_data */
database.DeleteItemOffCharacterCorpse(this->corpse_db_id,
bag_item_data[i]->equip_slot,
bag_item_data[i]->item_id);
/* Delete Item Instance */
RemoveItem(bag_item_data[i]);
}
@ -1242,17 +1251,17 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (!IsPlayerCorpse()) {
Group *g = client->GetGroup();
if (g != nullptr) {
g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str());
}
else {
g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE,
client->GetName(), item_link.c_str());
} else {
Raid *r = client->GetRaid();
if (r != nullptr) {
r->RaidMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str());
r->RaidMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE,
client->GetName(), item_link.c_str());
}
}
}
}
else {
} else {
SendEndLootErrorPacket(client);
safe_delete(inst);
return;
@ -1260,8 +1269,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
if (IsPlayerCorpse()) {
client->SendItemLink(inst);
}
else{
} else {
client->SendItemLink(inst, true);
}