diff options
| author | XTZGZoReX <none@none> | 2010-08-06 19:46:02 +0200 | 
|---|---|---|
| committer | XTZGZoReX <none@none> | 2010-08-06 19:46:02 +0200 | 
| commit | 7f6fe6394ce72635972ac6fbfa7a4657b3c008a2 (patch) | |
| tree | 8978901574ec4ce02a075b1ee10adf38b45569ff /src/server/scripts | |
| parent | 255158f5358fc8a9a2e7d9ece0ff4b5f1d84c0c8 (diff) | |
* Converted hunter spell scripts to the new format (mostly for example purposes for the rest of the team).
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts')
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 369 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 5 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warlock.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 2 | 
9 files changed, 209 insertions, 179 deletions
| diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index b8b32d248ff..b5c5b603217 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -33,4 +33,4 @@ void AddSC_deathknight_spell_scripts()      newscript->GetSpellScript = &GetSpellScript_spell_dk_;      newscript->RegisterSelf();      */ -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 49f0cae2ade..00bca49ccd6 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -33,4 +33,4 @@ void AddSC_druid_spell_scripts()      newscript->GetSpellScript = &GetSpellScript_spell_dru_;      newscript->RegisterSelf();      */ -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 7020d267345..99e43d732b5 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -34,4 +34,4 @@ void AddSC_generic_spell_scripts()      newscript->GetSpellScript = &GetSpellScript_spell_gen_;      newscript->RegisterSelf();      */ -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index ce0d97e5191..c46fae68fa6 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -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; -    } - -    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); -    } -}; +    public: -SpellScript * GetSpellScript_spell_hun_last_stand_pet() -{ -    return new spell_hun_last_stand_pet_SpellScript(); -} +        spell_hun_last_stand_pet() +            : SpellHandlerScript("spell_hun_last_stand_pet") +        { +        } -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); -    } +        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_masters_call() +class spell_hun_masters_call : public SpellHandlerScript  { -    return new spell_hun_masters_call_SpellScript(); -} +    public: -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_masters_call() +            : SpellHandlerScript("spell_hun_masters_call")          { -            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_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() const +        { +            return new spell_hun_masters_call_SpellScript(); +        }  }; -SpellScript * GetSpellScript_spell_hun_readiness() +class spell_hun_readiness : 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; -    } - -    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::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); -    } - -    bool Load() -    { -        if (!GetCaster()->isPet()) -            return false; -        return true; -    } +        spell_hun_readiness() +            : SpellHandlerScript("spell_hun_readiness") +        { +        } + +        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();) +                { +                    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); +            } +        }; + +        SpellScript* GetSpellScript() const +        { +            return new spell_hun_readiness_SpellScript(); +        }  }; -SpellScript * GetSpellScript_spell_hun_pet_heart_of_the_phoenix() +class spell_hun_pet_heart_of_the_phoenix : 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; -    } - -    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::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); -    } - -    bool Load() -    { -        if (!GetCaster()->isPet()) -            return false; -        return true; -    } +        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(); +        }  }; -SpellScript * GetSpellScript_spell_hun_pet_carrion_feeder() +class spell_hun_pet_carrion_feeder : public SpellHandlerScript  { -    return new spell_hun_pet_carrion_feeder(); -} +    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();  } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 583f76e254e..0e937f748e2 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -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(); -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 6a43ea56b90..f4aec79128f 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -195,4 +195,4 @@ void AddSC_rogue_spell_scripts()      newscript->Name = "spell_rog_shiv";      newscript->GetSpellScript = &GetSpellScript_spell_rog_shiv;      newscript->RegisterSelf(); -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index f689a3c68ee..d4f23c7fdfa 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -33,4 +33,4 @@ void AddSC_shaman_spell_scripts()      newscript->GetSpellScript = &GetSpellScript_spell_sha_;      newscript->RegisterSelf();      */ -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 24ee8d682a2..4700c2ad422 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -33,4 +33,4 @@ void AddSC_warlock_spell_scripts()      newscript->GetSpellScript = &GetSpellScript_spell_warl_;      newscript->RegisterSelf();      */ -}
\ No newline at end of file +} diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 7d674a9b7db..a59c34e70cc 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -96,4 +96,4 @@ void AddSC_warrior_spell_scripts()      newscript->Name = "spell_warr_warriors_wrath";      newscript->GetSpellScript = &GetSpellScript_spell_warr_warriors_wrath;      newscript->RegisterSelf(); -}
\ No newline at end of file +} | 
