From 0400504adc6439b93cb62efa57871f6391dce286 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Fri, 4 Feb 2022 06:07:46 -0500 Subject: [PATCH] [Bug Fix] NPC::CountItem and Corpse::CountItem 0 Charge Item Fix. (#1959) - Fixes an issue where 0 charged or out of charge items do not count towards the return value. --- zone/corpse.cpp | 2 +- zone/npc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 654aa4b00..bfedf47d1 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1570,7 +1570,7 @@ uint16 Corpse::CountItem(uint32 item_id) { } if (loot_item->item_id == item_id) { - item_count += loot_item->charges; + item_count += loot_item->charges > 0 ? loot_item->charges : 1; } } return item_count; diff --git a/zone/npc.cpp b/zone/npc.cpp index a10713d06..5226efaa3 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -758,7 +758,7 @@ uint16 NPC::CountItem(uint32 item_id) { } if (loot_item->item_id == item_id) { - item_count += loot_item->charges; + item_count += loot_item->charges > 0 ? loot_item->charges : 1; } } return item_count;