* Some consistency changes.
* Move spell 6962 to spell scripts and make sure to set deathstate. --HG-- branch : trunk
This commit is contained in:
@@ -145,11 +145,11 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
|
||||
distance /= 4;
|
||||
break;
|
||||
case 15:
|
||||
angle = i_cur_angle + static_cast<float>(M_PI*3/4.0f);
|
||||
angle = i_cur_angle + static_cast<float>(M_PI*3/4);
|
||||
distance /= 2;
|
||||
break;
|
||||
case 16:
|
||||
angle = i_cur_angle - static_cast<float>(M_PI*3/4.0f);
|
||||
angle = i_cur_angle - static_cast<float>(M_PI*3/4);
|
||||
distance /= 2;
|
||||
break;
|
||||
case 17:
|
||||
|
||||
@@ -4624,38 +4624,6 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
{
|
||||
switch(m_spellInfo->Id)
|
||||
{
|
||||
case 6962:
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* plr = m_caster->ToPlayer();
|
||||
if (plr && plr->GetLastPetNumber())
|
||||
{
|
||||
PetType NewPetType = (plr->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
|
||||
if (Pet* NewPet = new Pet(plr,NewPetType))
|
||||
{
|
||||
if (NewPet->LoadPetFromDB(plr, 0, plr->GetLastPetNumber(), true))
|
||||
{
|
||||
NewPet->SetHealth(NewPet->GetMaxHealth());
|
||||
NewPet->SetPower(NewPet->getPowerType(),NewPet->GetMaxPower(NewPet->getPowerType()));
|
||||
|
||||
switch (NewPet->GetEntry())
|
||||
{
|
||||
case 11859:
|
||||
case 89:
|
||||
NewPet->SetEntry(416);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
delete NewPet;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Glyph of Backstab
|
||||
case 63975:
|
||||
{
|
||||
|
||||
@@ -24,35 +24,99 @@
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
|
||||
enum NPCEntries
|
||||
{
|
||||
NPC_DOOMGUARD = 11859,
|
||||
NPC_INFERNAL = 89,
|
||||
NPC_IMP = 416,
|
||||
};
|
||||
|
||||
class spell_gen_remove_flight_auras : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_gen_remove_flight_auras() : SpellHandlerScript("spell_gen_remove_flight_auras") {}
|
||||
public:
|
||||
spell_gen_remove_flight_auras() : SpellHandlerScript("spell_gen_remove_flight_auras") {}
|
||||
|
||||
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
|
||||
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
|
||||
{
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit *target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
target->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_remove_flight_auras_SpellScript;
|
||||
Unit *target = GetHitUnit();
|
||||
if (!target)
|
||||
return;
|
||||
target->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_remove_flight_auras_SpellScript;
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_pet_summoned : public SpellHandlerScript
|
||||
{
|
||||
public:
|
||||
spell_gen_pet_summoned() : SpellHandlerScript("spell_gen_pet_summoned") { }
|
||||
|
||||
class spell_gen_pet_summonedSpellScript : public SpellScript
|
||||
{
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit *caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* plr = caster->ToPlayer();
|
||||
if (plr && plr->GetLastPetNumber())
|
||||
{
|
||||
PetType NewPetType = (plr->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
|
||||
if (Pet* NewPet = new Pet(plr, NewPetType))
|
||||
{
|
||||
if (NewPet->LoadPetFromDB(plr, 0, plr->GetLastPetNumber(), true))
|
||||
{
|
||||
// revive the pet if it is dead
|
||||
if (NewPet->getDeathState() == DEAD)
|
||||
NewPet->setDeathState(ALIVE);
|
||||
|
||||
NewPet->SetHealth(NewPet->GetMaxHealth());
|
||||
NewPet->SetPower(NewPet->getPowerType(),NewPet->GetMaxPower(NewPet->getPowerType()));
|
||||
|
||||
switch (NewPet->GetEntry())
|
||||
{
|
||||
case NPC_DOOMGUARD:
|
||||
case NPC_INFERNAL:
|
||||
NewPet->SetEntry(NPC_IMP);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
delete NewPet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
EffectHandlers += EffectHandlerFn(spell_gen_pet_summonedSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_pet_summonedSpellScript;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_remove_flight_auras;
|
||||
new spell_gen_pet_summoned;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user