Skip to content

Commit

Permalink
Core/Spells: Fixed checking free inventory space for some spells that…
Browse files Browse the repository at this point in the history
… have bad dbc data

Closes #24423
  • Loading branch information
Shauren committed Apr 10, 2020
1 parent a0d5088 commit 18b3673
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/server/game/Spells/Spell.cpp
Expand Up @@ -6630,13 +6630,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->ItemLimitCategory)
if (!itemTemplate->ItemLimitCategory)
{
player->SendEquipError(msg, nullptr, nullptr, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;
Expand Down

0 comments on commit 18b3673

Please sign in to comment.