fix(Core/Loot): Send Retrieval Mail for lost disenchant mats

This commit is contained in:
Ollie Armitage
2021-12-07 01:13:58 +00:00
committed by GitHub
parent 1f645099b6
commit bb6b7f2fab

View File

@@ -1510,8 +1510,28 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap)
roll->getLoot()->NotifyItemRemoved(roll->itemSlot);
roll->getLoot()->unlootedCount--;
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid);
player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 13262); // Disenchant
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count);
if(msg == EQUIP_ERR_OK)
{
player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true);
}
else
{
Loot loot;
loot.FillLoot(pProto->DisenchantID, LootTemplates_Disenchant, player, true);
uint32 max_slot = loot.GetMaxSlotInLootFor(player);
for(uint32 i = 0; i < max_slot; i++)
{
LootItem* lootItem = loot.LootItemInSlot(i, player);
player->SendEquipError(msg, nullptr, nullptr, lootItem->itemid);
player->SendItemRetrievalMail(lootItem->itemid, lootItem->count);
}
}
}
}
}