Scripts/Mage: Unsummon current mage's Water Elemental before summoning a new one

Closes #8433
This commit is contained in:
Souler authored and Nay committed 2013-01-29 15:10:47 +00:00
1 parent 4aa4fce89a
commit d92347bc22
1 file changed
+9
+9
View File
@@ -25,6 +25,7 @@
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "Pet.h"
enum MageSpells
{
@@ -904,6 +905,14 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Player* player = caster->ToPlayer())
if (Guardian* elemental = player->GetGuardianPet())
// Check if the pet we are going to unsummon is the mage's water elemental
if (elemental->GetEntry() == sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY)->Effects[EFFECT_0].MiscValue ||
elemental->GetEntry() == sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT)->Effects[EFFECT_0].MiscValue)
elemental->UnSummon();
// Glyph of Eternal Water
if (caster->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT, true);