diff options
author | maanuel <manue.l@live.com.ar> | 2011-06-26 16:03:50 -0300 |
---|---|---|
committer | maanuel <manue.l@live.com.ar> | 2011-06-26 16:03:50 -0300 |
commit | 5c0c2ea8734fc8c2852aefafaf76aab1f15142b4 (patch) | |
tree | d10e3b4a4b0e8815d4f331ea3d83b6d307bd7654 | |
parent | e5db97a28ef14bbb7c503da636badbcb5e190184 (diff) |
Core/Spells: Fixed spell 62218 (Launch) used by npc 34793 (Catapult) in Isle of Conquest.
-rw-r--r-- | sql/scripts/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/world/2011_06_26_03_world_spell_script_names.sql | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 60 |
3 files changed, 63 insertions, 0 deletions
diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql index 45c971dd970..c26df5204a6 100644 --- a/sql/scripts/world_scripts_full.sql +++ b/sql/scripts/world_scripts_full.sql @@ -1927,6 +1927,7 @@ INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`, /* SPELLS */ INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES -- generic +( 66218, 'spell_gen_launch'), ( 39228, 'spell_gen_absorb0_hitlimit1'), ( 60218, 'spell_gen_absorb0_hitlimit1'), ( 6962, 'spell_gen_pet_summoned'), diff --git a/sql/updates/world/2011_06_26_03_world_spell_script_names.sql b/sql/updates/world/2011_06_26_03_world_spell_script_names.sql new file mode 100644 index 00000000000..c392a9f5ada --- /dev/null +++ b/sql/updates/world/2011_06_26_03_world_spell_script_names.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=66218; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (66218,'spell_gen_launch');
\ 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 67939a61f23..e7b6b146197 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1154,6 +1154,65 @@ public: } }; +enum Launch +{ + SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 +}; + +class spell_gen_launch : public SpellScriptLoader +{ + public: + spell_gen_launch() : SpellScriptLoader("spell_gen_launch") {} + + class spell_gen_launch_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_launch_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + + SpellEntry const* const spell = GetSpellInfo(); + + if (Player* player = GetHitPlayer()) + { + player->CastSpell(player,spell->EffectTriggerSpell[1],true); // changes the player's seat + player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE,player); // prevents falling damage + } + } + + void Launch() + { + WorldLocation const* const position = GetTargetDest(); + + if (Player* player = GetHitPlayer()) + { + player->ExitVehicle(); + + // A better research is needed + // There is no spell for this, the following calculation was based on void Spell::CalculateJumpSpeeds + + float speedZ = 10.0f; + float dist = position->GetExactDist2d(player->GetPositionX(),player->GetPositionY()); + float speedXY = dist; + + player->GetMotionMaster()->MoveJump(position->GetPositionX(),position->GetPositionY(),position->GetPositionZ(),speedXY,speedZ); + } + } + + void Register() + { + OnEffect += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); + AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_launch_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1181,4 +1240,5 @@ void AddSC_generic_spell_scripts() new spell_gen_lifeblood(); new spell_gen_magic_rooster(); new spell_gen_allow_cast_from_item_only(); + new spell_gen_launch(); } |