mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Queryserv] Dropped Item Logging
This commit is contained in:
@@ -876,6 +876,7 @@ public:
|
||||
void SetStats(uint8 type,int16 set_val);
|
||||
void IncStats(uint8 type,int16 increase_val);
|
||||
void DropItem(int16 slot_id, bool recurse = true);
|
||||
void DropItemQS(EQEmu::ItemInstance* inst, bool pickup);
|
||||
|
||||
int GetItemLinkHash(const EQEmu::ItemInstance* inst); // move to ItemData..or make use of the pre-calculated database field
|
||||
|
||||
|
||||
@@ -688,10 +688,79 @@ void Client::DropItem(int16 slot_id, bool recurse)
|
||||
object->StartDecay();
|
||||
|
||||
Log(Logs::General, Logs::Inventory, "Item drop handled ut assolet");
|
||||
DropItemQS(inst, false);
|
||||
|
||||
safe_delete(inst);
|
||||
}
|
||||
|
||||
void Client::DropItemQS(EQEmu::ItemInstance* inst, bool pickup) {
|
||||
if (RuleB(QueryServ, PlayerDropItems)) {
|
||||
QSPlayerDropItem_Struct qs_audit;
|
||||
std::list<void*> event_details;
|
||||
memset(&qs_audit, 0, sizeof(QSPlayerDropItem_Struct));
|
||||
|
||||
qs_audit.char_id = this->character_id;
|
||||
qs_audit.pickup = pickup;
|
||||
qs_audit.zone_id = this->GetZoneID();
|
||||
qs_audit.x = (int) this->GetX();
|
||||
qs_audit.y = (int) this->GetY();
|
||||
qs_audit.z = (int) this->GetZ();
|
||||
|
||||
if (inst) {
|
||||
auto detail = new QSDropItems_Struct;
|
||||
detail->item_id = inst->GetID();
|
||||
detail->charges = inst->IsClassBag() ? 1 : inst->GetCharges();
|
||||
detail->aug_1 = inst->GetAugmentItemID(1);
|
||||
detail->aug_2 = inst->GetAugmentItemID(2);
|
||||
detail->aug_3 = inst->GetAugmentItemID(3);
|
||||
detail->aug_4 = inst->GetAugmentItemID(4);
|
||||
detail->aug_5 = inst->GetAugmentItemID(5);
|
||||
event_details.push_back(detail);
|
||||
|
||||
if (inst->IsClassBag()) {
|
||||
for (uint8 sub_slot = EQEmu::invbag::SLOT_BEGIN; (sub_slot <= EQEmu::invbag::SLOT_END); ++sub_slot) { // this is to catch ALL items
|
||||
const EQEmu::ItemInstance* bag_inst = inst->GetItem(sub_slot);
|
||||
if (bag_inst) {
|
||||
detail = new QSDropItems_Struct;
|
||||
detail->item_id = bag_inst->GetID();
|
||||
detail->charges = (!bag_inst->IsStackable() ? 1 : bag_inst->GetCharges());
|
||||
detail->aug_1 = bag_inst->GetAugmentItemID(1);
|
||||
detail->aug_2 = bag_inst->GetAugmentItemID(2);
|
||||
detail->aug_3 = bag_inst->GetAugmentItemID(3);
|
||||
detail->aug_4 = bag_inst->GetAugmentItemID(4);
|
||||
detail->aug_5 = bag_inst->GetAugmentItemID(5);
|
||||
event_details.push_back(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
qs_audit._detail_count = event_details.size();
|
||||
|
||||
auto qs_pack = new ServerPacket(
|
||||
ServerOP_QSPlayerDropItem,
|
||||
sizeof(QSPlayerDropItem_Struct) +
|
||||
(sizeof(QSDropItems_Struct) * qs_audit._detail_count));
|
||||
QSPlayerDropItem_Struct* qs_buf = (QSPlayerDropItem_Struct*) qs_pack->pBuffer;
|
||||
|
||||
memcpy(qs_buf, &qs_audit, sizeof(QSPlayerDropItem_Struct));
|
||||
|
||||
int offset = 0;
|
||||
|
||||
for (auto iter = event_details.begin(); iter != event_details.end(); ++iter, ++offset) {
|
||||
QSDropItems_Struct* detail = reinterpret_cast<QSDropItems_Struct*>(*iter);
|
||||
qs_buf->items[offset] = *detail;
|
||||
safe_delete(detail);
|
||||
}
|
||||
|
||||
event_details.clear();
|
||||
|
||||
if (worldserver.Connected())
|
||||
worldserver.SendPacket(qs_pack);
|
||||
|
||||
safe_delete(qs_pack);
|
||||
}
|
||||
}
|
||||
|
||||
// Drop inst
|
||||
void Client::DropInst(const EQEmu::ItemInstance* inst)
|
||||
{
|
||||
|
||||
@@ -528,6 +528,8 @@ bool Object::HandleClick(Client* sender, const ClickObject_Struct* click_object)
|
||||
if(cursordelete) // delete the item if it's a duplicate lore. We have to do this because the client expects the item packet
|
||||
sender->DeleteItemInInventory(EQEmu::invslot::slotCursor);
|
||||
|
||||
sender->DropItemQS(m_inst, true);
|
||||
|
||||
if(!m_ground_spawn)
|
||||
safe_delete(m_inst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user