Feat. Preventing the procurement of multiple unique items (#16)

This commit is contained in:
Walter Pagani
2023-07-10 23:44:50 -03:00
committed by GitHub
parent 4d52913ef1
commit 0b954e8309

View File

@@ -70,6 +70,10 @@ public:
for (uint32 i = 0; i < maxSlot; ++i)
{
if (LootItem* item = loot->LootItemInSlot(i, player))
{
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(item->itemid);
if (itemTemplate->MaxCount != 1)
{
if (player->AddItem(item->itemid, item->count))
{
@@ -82,6 +86,16 @@ public:
ChatHandler(player->GetSession()).SendSysMessage(AOE_ITEM_IN_THE_MAIL);
}
}
else
{
if (!player->HasItemCount(item->itemid, 1))
{
player->AddItem(item->itemid, item->count);
}
player->SendNotifyLootItemRemoved(lootSlot);
player->SendLootRelease(player->GetLootGUID());
}
}
}
if (!loot->empty())