mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
Clang-format Corpse::LootItem
This commit is contained in:
parent
8f5ba05e75
commit
019586abbd
@ -1062,7 +1062,8 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
|||||||
SendLootReqErrorPacket(client, LootResponse::LootAll);
|
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 */
|
/* This gets sent no matter what as a sort of ACK */
|
||||||
client->QueuePacket(app);
|
client->QueuePacket(app);
|
||||||
|
|
||||||
@ -1091,7 +1092,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
return;
|
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.");
|
client->Message(13, "Error: This is a player corpse and you dont own it.");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
return;
|
return;
|
||||||
@ -1101,7 +1103,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
client->Message(13, "Error: Corpse locked by GM.");
|
client->Message(13, "Error: Corpse locked by GM.");
|
||||||
return;
|
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.");
|
client->Message(13, "Error: You cannot loot any more items from this corpse.");
|
||||||
SendEndLootErrorPacket(client);
|
SendEndLootErrorPacket(client);
|
||||||
ResetLooter();
|
ResetLooter();
|
||||||
@ -1115,11 +1118,11 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
memset(bag_item_data, 0, sizeof(bag_item_data));
|
memset(bag_item_data, 0, sizeof(bag_item_data));
|
||||||
if (GetPlayerKillItem() > 1) {
|
if (GetPlayerKillItem() > 1) {
|
||||||
item = database.GetItem(GetPlayerKillItem());
|
item = database.GetItem(GetPlayerKillItem());
|
||||||
}
|
} else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1) {
|
||||||
else if (GetPlayerKillItem() == -1 || GetPlayerKillItem() == 1){
|
item_data =
|
||||||
item_data = GetItem(lootitem->slot_id - EQEmu::legacy::CORPSE_BEGIN); //dont allow them to loot entire bags of items as pvp reward
|
GetItem(lootitem->slot_id -
|
||||||
}
|
EQEmu::legacy::CORPSE_BEGIN); // dont allow them to loot entire bags of items as pvp reward
|
||||||
else{
|
} else {
|
||||||
item_data = GetItem(lootitem->slot_id - EQEmu::legacy::CORPSE_BEGIN, bag_item_data);
|
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 != 0) {
|
||||||
if (item_data) {
|
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);
|
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,
|
||||||
else {
|
item_data->aug_5, item_data->aug_6, item_data->attuned);
|
||||||
|
} else {
|
||||||
inst = database.CreateItem(item);
|
inst = database.CreateItem(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1163,7 +1167,8 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
char buf[88];
|
char buf[88];
|
||||||
char q_corpse_name[64];
|
char q_corpse_name[64];
|
||||||
strcpy(q_corpse_name, corpse_name);
|
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';
|
buf[87] = '\0';
|
||||||
std::vector<EQEmu::Any> args;
|
std::vector<EQEmu::Any> args;
|
||||||
args.push_back(inst);
|
args.push_back(inst);
|
||||||
@ -1197,8 +1202,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (lootitem->auto_loot) {
|
if (lootitem->auto_loot) {
|
||||||
if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data))
|
if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data))
|
||||||
client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data);
|
client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
client->PutLootInInventory(EQEmu::inventory::slotCursor, *inst, bag_item_data);
|
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 */
|
/* Remove it from Corpse */
|
||||||
if (item_data) {
|
if (item_data) {
|
||||||
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */
|
/* Delete needs to be before RemoveItem because its deletes the pointer for
|
||||||
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot, item_data->item_id);
|
* item_data/bag_item_data */
|
||||||
|
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, item_data->equip_slot,
|
||||||
|
item_data->item_id);
|
||||||
/* Delete Item Instance */
|
/* Delete Item Instance */
|
||||||
RemoveItem(item_data->lootslot);
|
RemoveItem(item_data->lootslot);
|
||||||
}
|
}
|
||||||
@ -1218,8 +1224,11 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) {
|
if (item->IsClassBag() && (GetPlayerKillItem() != -1 || GetPlayerKillItem() != 1)) {
|
||||||
for (int i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) {
|
for (int i = EQEmu::inventory::containerBegin; i < EQEmu::inventory::ContainerCount; i++) {
|
||||||
if (bag_item_data[i]) {
|
if (bag_item_data[i]) {
|
||||||
/* Delete needs to be before RemoveItem because its deletes the pointer for item_data/bag_item_data */
|
/* Delete needs to be before RemoveItem because its deletes the pointer for
|
||||||
database.DeleteItemOffCharacterCorpse(this->corpse_db_id, bag_item_data[i]->equip_slot, bag_item_data[i]->item_id);
|
* 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 */
|
/* Delete Item Instance */
|
||||||
RemoveItem(bag_item_data[i]);
|
RemoveItem(bag_item_data[i]);
|
||||||
}
|
}
|
||||||
@ -1242,17 +1251,17 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
if (!IsPlayerCorpse()) {
|
if (!IsPlayerCorpse()) {
|
||||||
Group *g = client->GetGroup();
|
Group *g = client->GetGroup();
|
||||||
if (g != nullptr) {
|
if (g != nullptr) {
|
||||||
g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE, client->GetName(), item_link.c_str());
|
g->GroupMessage_StringID(client, MT_LootMessages, OTHER_LOOTED_MESSAGE,
|
||||||
}
|
client->GetName(), item_link.c_str());
|
||||||
else {
|
} else {
|
||||||
Raid *r = client->GetRaid();
|
Raid *r = client->GetRaid();
|
||||||
if (r != nullptr) {
|
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);
|
SendEndLootErrorPacket(client);
|
||||||
safe_delete(inst);
|
safe_delete(inst);
|
||||||
return;
|
return;
|
||||||
@ -1260,8 +1269,7 @@ void Corpse::LootItem(Client* client, const EQApplicationPacket* app) {
|
|||||||
|
|
||||||
if (IsPlayerCorpse()) {
|
if (IsPlayerCorpse()) {
|
||||||
client->SendItemLink(inst);
|
client->SendItemLink(inst);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
client->SendItemLink(inst, true);
|
client->SendItemLink(inst, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user