* Converted hunter spell scripts to the new format (mostly for example purposes for the rest of the team).

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-06 19:46:02 +02:00
parent 255158f535
commit 7f6fe6394c
9 changed files with 208 additions and 178 deletions

View File

@@ -33,4 +33,4 @@ void AddSC_deathknight_spell_scripts()
newscript->GetSpellScript = &GetSpellScript_spell_dk_;
newscript->RegisterSelf();
*/
}
}

View File

@@ -33,4 +33,4 @@ void AddSC_druid_spell_scripts()
newscript->GetSpellScript = &GetSpellScript_spell_dru_;
newscript->RegisterSelf();
*/
}
}

View File

@@ -34,4 +34,4 @@ void AddSC_generic_spell_scripts()
newscript->GetSpellScript = &GetSpellScript_spell_gen_;
newscript->RegisterSelf();
*/
}
}

View File

@@ -34,198 +34,227 @@ enum HunterSpells
HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045,
};
class spell_hun_last_stand_pet_SpellScript : public SpellScript
class spell_hun_last_stand_pet : public SpellHandlerScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
public:
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
int32 healthModSpellBasePoints0 = int32(caster->GetMaxHealth()*0.3);
caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_hun_last_stand_pet()
{
return new spell_hun_last_stand_pet_SpellScript();
}
class spell_hun_masters_call_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
Unit *unitTarget = GetHitUnit();
if (caster->GetTypeId() != TYPEID_PLAYER || !unitTarget)
return;
if (Pet *pet = caster->ToPlayer()->GetPet())
if (pet->isAlive())
pet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex), true);
}
void Register()
{
// add dummy effect spell handler to Master's Call
EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript * GetSpellScript_spell_hun_masters_call()
{
return new spell_hun_masters_call_SpellScript();
}
class spell_hun_readiness_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
spell_hun_last_stand_pet()
: SpellHandlerScript("spell_hun_last_stand_pet")
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
GetSpellRecoveryTime(spellInfo) > 0)
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true);
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Readiness
EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
class spell_hun_last_stand_pet_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
int32 healthModSpellBasePoints0 = int32(caster->GetMaxHealth()*0.3);
caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_last_stand_pet_SpellScript();
}
};
SpellScript * GetSpellScript_spell_hun_readiness()
class spell_hun_masters_call : public SpellHandlerScript
{
return new spell_hun_readiness_SpellScript();
}
public:
class spell_hun_pet_heart_of_the_phoenix : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
return false;
if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
spell_hun_masters_call()
: SpellHandlerScript("spell_hun_masters_call")
{
}
void HandleScript(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return;
caster->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
}
class spell_hun_masters_call_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
Unit *unitTarget = GetHitUnit();
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
if (caster->GetTypeId() != TYPEID_PLAYER || !unitTarget)
return;
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
if (Pet *pet = caster->ToPlayer()->GetPet())
if (pet->isAlive())
pet->CastSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), effIndex), true);
}
void Register()
{
// add dummy effect spell handler to Master's Call
EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_masters_call_SpellScript();
}
};
SpellScript * GetSpellScript_spell_hun_pet_heart_of_the_phoenix()
class spell_hun_readiness : public SpellHandlerScript
{
return new spell_hun_pet_heart_of_the_phoenix();
}
public:
class spell_hun_pet_carrion_feeder : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
spell_hun_readiness()
: SpellHandlerScript("spell_hun_readiness")
{
}
void HandleDummy(SpellEffIndex effIndex)
{
if (!GetHitUnit())
return;
Unit *caster = GetCaster();
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
}
class spell_hun_readiness_SpellScript : public SpellScript
{
void HandleDummy(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->GetTypeId() != TYPEID_PLAYER)
return;
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
GetSpellRecoveryTime(spellInfo) > 0)
caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true);
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Readiness
EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_readiness_SpellScript();
}
};
SpellScript * GetSpellScript_spell_hun_pet_carrion_feeder()
class spell_hun_pet_heart_of_the_phoenix : public SpellHandlerScript
{
return new spell_hun_pet_carrion_feeder();
}
public:
spell_hun_pet_heart_of_the_phoenix()
: SpellHandlerScript("spell_hun_pet_heart_of_the_phoenix")
{
}
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED))
return false;
if (!sSpellStore.LookupEntry(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
void HandleScript(SpellEffIndex effIndex)
{
Unit *caster = GetCaster();
if (caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return;
caster->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_heart_of_the_phoenix_SpellScript();
}
};
class spell_hun_pet_carrion_feeder : public SpellHandlerScript
{
public:
spell_hun_pet_carrion_feeder()
: SpellHandlerScript("spell_hun_pet_carrion_feeder")
{
}
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (!GetHitUnit())
return;
Unit *caster = GetCaster();
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_carrion_feeder_SpellScript();
}
};
void AddSC_hunter_spell_scripts()
{
Script *newscript;
newscript = new Script;
newscript->Name = "spell_hun_last_stand_pet";
newscript->GetSpellScript = &GetSpellScript_spell_hun_last_stand_pet;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_hun_masters_call";
newscript->GetSpellScript = &GetSpellScript_spell_hun_masters_call;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_hun_readiness";
newscript->GetSpellScript = &GetSpellScript_spell_hun_readiness;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_hun_pet_heart_of_the_phoenix";
newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_heart_of_the_phoenix;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_hun_pet_carrion_feeder";
newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_carrion_feeder;
newscript->RegisterSelf();
new spell_hun_last_stand_pet();
new spell_hun_masters_call();
new spell_hun_readiness();
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_pet_carrion_feeder();
}

View File

@@ -102,7 +102,8 @@ class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
}
};
const uint32 spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] = {
const uint32 spell_mage_polymorph_cast_visual_SpellScript::spell_list[6] =
{
SPELL_MAGE_SQUIRREL_FORM,
SPELL_MAGE_GIRAFFE_FORM,
SPELL_MAGE_SERPENT_FORM,
@@ -171,4 +172,4 @@ void AddSC_mage_spell_scripts()
newscript->Name = "spell_mage_summon_water_elemental";
newscript->GetSpellScript = &GetSpellScript_spell_mage_summon_water_elemental;
newscript->RegisterSelf();
}
}

View File

@@ -195,4 +195,4 @@ void AddSC_rogue_spell_scripts()
newscript->Name = "spell_rog_shiv";
newscript->GetSpellScript = &GetSpellScript_spell_rog_shiv;
newscript->RegisterSelf();
}
}

View File

@@ -33,4 +33,4 @@ void AddSC_shaman_spell_scripts()
newscript->GetSpellScript = &GetSpellScript_spell_sha_;
newscript->RegisterSelf();
*/
}
}

View File

@@ -33,4 +33,4 @@ void AddSC_warlock_spell_scripts()
newscript->GetSpellScript = &GetSpellScript_spell_warl_;
newscript->RegisterSelf();
*/
}
}

View File

@@ -96,4 +96,4 @@ void AddSC_warrior_spell_scripts()
newscript->Name = "spell_warr_warriors_wrath";
newscript->GetSpellScript = &GetSpellScript_spell_warr_warriors_wrath;
newscript->RegisterSelf();
}
}