* Some consistency changes.
* Move spell 6962 to spell scripts and make sure to set deathstate. --HG-- branch : trunk
This commit is contained in:
@@ -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