diff options
author | Shauren <none@none> | 2010-12-25 15:26:16 +0100 |
---|---|---|
committer | Shauren <none@none> | 2010-12-25 15:26:16 +0100 |
commit | 99ff32be289236da19c42eab9eebdfccf33c7a59 (patch) | |
tree | 89aa67cfa6f3e35f09dde50c914600741f426135 /src | |
parent | b181ba21d9d6c7c9514b265f43bbe098d8a4f284 (diff) |
Scripts/Spells: Added support for Red Rider Air Rifle (item 46725)
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 2092735d2f8..db095f048a8 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -741,6 +741,61 @@ public: } }; +enum AirRifleSpells +{ + SPELL_AIR_RIFLE_HOLD_VISUAL = 65582, + SPELL_AIR_RIFLE_SHOOT = 67532, + SPELL_AIR_RIFLE_SHOOT_SELF = 65577, +}; + +class spell_item_red_rider_air_rifle : public SpellScriptLoader +{ + public: + spell_item_red_rider_air_rifle() : SpellScriptLoader("spell_item_red_rider_air_rifle") { } + + class spell_item_red_rider_air_rifle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_red_rider_air_rifle_SpellScript); + + bool Validate(SpellEntry const* /*spell*/) + { + if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_HOLD_VISUAL)) + return false; + if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_SHOOT)) + return false; + if (!sSpellStore.LookupEntry(SPELL_AIR_RIFLE_SHOOT_SELF)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; + + GetCaster()->CastSpell(GetCaster(), SPELL_AIR_RIFLE_HOLD_VISUAL, true); + // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) + if (Player* player = GetCaster()->ToPlayer()) + player->RemoveGlobalCooldown(GetSpellInfo()); + if (urand(0, 4)) + GetCaster()->CastSpell(GetHitUnit(), SPELL_AIR_RIFLE_SHOOT, false); + else + GetCaster()->CastSpell(GetCaster(), SPELL_AIR_RIFLE_SHOOT_SELF, false); + } + + void Register() + { + OnEffect += SpellEffectFn(spell_item_red_rider_air_rifle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_red_rider_air_rifle_SpellScript(); + } +}; + enum eGenericData { SPELL_ARCANITE_DRAGONLING = 19804, @@ -771,4 +826,5 @@ void AddSC_item_spell_scripts() new spell_item_six_demon_bag(); new spell_item_underbelly_elixir(); new spell_item_shadowmourne(); + new spell_item_red_rider_air_rifle(); } |