Core/Spells: don't allow spells with SPELL_EFFECT_CREATE_ITEM_2 to be cast if there isn't enough space in inventory
This commit is contained in:
1 parent
85893e9a44
commit
2f5fd3f227
4 files changed
+61
-42
No files matched your search
@@ -1402,31 +1402,20 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex)
|
||||
|
||||
Player* player = unitTarget->ToPlayer();
|
||||
|
||||
uint32 item_id = m_spellInfo->Effects[effIndex].ItemType;
|
||||
|
||||
if (item_id)
|
||||
DoCreateItem(effIndex, item_id);
|
||||
|
||||
// special case: fake item replaced by generate using spell_loot_template
|
||||
// Pick a random item from spell_loot_template
|
||||
if (m_spellInfo->IsLootCrafting())
|
||||
{
|
||||
if (item_id)
|
||||
{
|
||||
if (!player->HasItemCount(item_id))
|
||||
return;
|
||||
|
||||
// remove reagent
|
||||
uint32 count = 1;
|
||||
player->DestroyItemCount(item_id, count, true);
|
||||
|
||||
// create some random items
|
||||
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);
|
||||
}
|
||||
else
|
||||
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); // create some random items
|
||||
|
||||
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, false);
|
||||
player->UpdateCraftSkill(m_spellInfo->Id);
|
||||
}
|
||||
else // If there's no random loot entries for this spell, pick the item associated with this spell
|
||||
{
|
||||
uint32 item_id = m_spellInfo->Effects[effIndex].ItemType;
|
||||
|
||||
if (item_id)
|
||||
DoCreateItem(effIndex, item_id);
|
||||
}
|
||||
|
||||
/// @todo ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user