mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Spells: Fixed checking free inventory space for some spells that have bad dbc data
Closes #24423
(cherry picked from commit 18b36734f6)
This commit is contained in:
@@ -6985,13 +6985,17 @@ SpellCastResult Spell::CheckItems(int32* param1 /*= nullptr*/, int32* param2 /*=
|
||||
|
||||
if (spellEffectInfo.ItemType)
|
||||
{
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(spellEffectInfo.ItemType);
|
||||
if (!itemTemplate)
|
||||
return SPELL_FAILED_ITEM_NOT_FOUND;
|
||||
|
||||
uint32 createCount = std::clamp<uint32>(spellEffectInfo.CalcValue(), 1u, itemTemplate->GetMaxStackSize());
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = target->ToPlayer()->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellEffectInfo.ItemType, spellEffectInfo.CalcValue());
|
||||
InventoryResult msg = target->ToPlayer()->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellEffectInfo.ItemType, createCount);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(spellEffectInfo.ItemType);
|
||||
/// @todo Needs review
|
||||
if (itemTemplate && !itemTemplate->GetItemLimitCategory())
|
||||
if (!itemTemplate->GetItemLimitCategory())
|
||||
{
|
||||
player->SendEquipError(msg, nullptr, nullptr, spellEffectInfo.ItemType);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
Reference in New Issue
Block a user