Core/Spells: Fixed checking free inventory space for some spells that have bad dbc data

This commit is contained in:
Shauren authored and Ovahlord committed 2022-09-12 09:15:27 +02:00
1 parent c237b056b3
commit eeef100e08
1 file changed
+7 -3
+7 -3
View File
@@ -7126,13 +7126,17 @@ SpellCastResult Spell::CheckItems(uint32* param1 /*= nullptr*/, uint32* param2 /
if (m_spellInfo->Effects[i].ItemType)
{
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType);
if (!itemTemplate)
return SPELL_FAILED_ITEM_NOT_FOUND;
uint32 createCount = std::clamp<uint32>(m_spellInfo->Effects[i].CalcValue(), 1u, itemTemplate->GetMaxStackSize());
ItemPosCountVec dest;
InventoryResult msg = target->ToPlayer()->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, m_spellInfo->Effects[i].CalcValue());
InventoryResult msg = target->ToPlayer()->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, createCount);
if (msg != EQUIP_ERR_OK)
{
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType);
/// @todo Needs review
if (itemTemplate && !itemTemplate->GetItemLimitCategory())
if (!itemTemplate->GetItemLimitCategory())
{
player->SendEquipError(msg, nullptr, nullptr, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;