mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
[Tasks] Only update loot tasks for NPC corpses (#2513)
This fixes a bug that allowed looting items from a player's corpse to
increment a task if it didn't have an npc target defined. It looks
like this bug existed before the changes in 7482cfc0.
This also now passes count for task loot updates to handle item stacks.
Also fixes incorrectly casting Corpse to NPC on loot update
This commit is contained in:
+6
-2
@@ -1370,6 +1370,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
}
|
||||
}
|
||||
|
||||
// get count for task update before it's mutated by AutoPutLootInInventory
|
||||
int count = inst->IsStackable() ? inst->GetCharges() : 1;
|
||||
|
||||
/* First add it to the looter - this will do the bag contents too */
|
||||
if (lootitem->auto_loot > 0) {
|
||||
if (!client->AutoPutLootInInventory(*inst, true, true, bag_item_data))
|
||||
@@ -1380,8 +1383,9 @@ void Corpse::LootItem(Client *client, const EQApplicationPacket *app)
|
||||
}
|
||||
|
||||
/* Update any tasks that have an activity to loot this item */
|
||||
if (RuleB(TaskSystem, EnableTaskSystem))
|
||||
client->UpdateTasksForItem(TaskActivityType::Loot, IsNPCCorpse() ? CastToNPC() : nullptr, item->ID);
|
||||
if (RuleB(TaskSystem, EnableTaskSystem) && IsNPCCorpse()) {
|
||||
client->UpdateTasksOnLoot(this, item->ID, count);
|
||||
}
|
||||
|
||||
/* Remove it from Corpse */
|
||||
if (item_data) {
|
||||
|
||||
Reference in New Issue
Block a user