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

@@ -71,16 +71,30 @@ public:
{
if (LootItem* item = loot->LootItemInSlot(i, player))
{
if (player->AddItem(item->itemid, item->count))
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(item->itemid);
if (itemTemplate->MaxCount != 1)
{
if (player->AddItem(item->itemid, item->count))
{
player->SendNotifyLootItemRemoved(lootSlot);
player->SendLootRelease(player->GetLootGUID());
}
else if (sConfigMgr->GetOption<bool>("AOELoot.MailEnable", true))
{
player->SendItemRetrievalMail(item->itemid, item->count);
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());
}
else if (sConfigMgr->GetOption<bool>("AOELoot.MailEnable", true))
{
player->SendItemRetrievalMail(item->itemid, item->count);
ChatHandler(player->GetSession()).SendSysMessage(AOE_ITEM_IN_THE_MAIL);
}
}
}