mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: You should not be able to cast Create Healthstone if you already have one in your inventory
Closes #1498 Signed-off-by: Subv <s.v.h21@hotmail.com>
This commit is contained in:
@@ -172,6 +172,19 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
{
|
||||
uint8 spellRank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, NULL);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
return SPELL_FAILED_TOO_MANY_OF_ITEM;
|
||||
}
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
@@ -198,6 +211,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
OnCheckCast += SpellCheckCastFn(spell_warl_create_healthstone_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user