From c541f4f5deb99522772f9ee12b06e8aedb3d87a5 Mon Sep 17 00:00:00 2001 From: Trisjdc Date: Thu, 24 Jul 2014 03:48:35 +0100 Subject: Scripts/Four Horsemen: Horsemen's main spells should only explicitly target players --- src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index ca478244d2a..9a9e7aa6849 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -354,7 +354,7 @@ public: if (caster) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) DoCast(target, SPELL_PRIMARY(id)); } else -- cgit v1.2.3 From 26496375f8f180628588eabab18169cdbf3702f3 Mon Sep 17 00:00:00 2001 From: karn Date: Tue, 1 Jul 2014 17:29:19 +0200 Subject: Script/IoC: Move some spell scripts from spell_generic to isle_of_conquest cpp Signed-off-by: DDuarte --- src/server/scripts/Northrend/isle_of_conquest.cpp | 125 ++++++++++++++++++++++ src/server/scripts/Spells/spell_generic.cpp | 123 --------------------- 2 files changed, 125 insertions(+), 123 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 8cdfce90bc9..88958806f6b 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -20,6 +20,9 @@ #include "PassiveAI.h" #include "BattlegroundIC.h" #include "Player.h" +#include "Vehicle.h" +#include "SpellScript.h" +#include "SpellInfo.h" // TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs. // Even adding ReactState Passive we still have issues using SmartAI. @@ -70,7 +73,129 @@ class npc_four_car_garage : public CreatureScript } }; +class spell_gen_gunship_portal : public SpellScriptLoader +{ + public: + spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } + + class spell_gen_gunship_portal_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_gunship_portal_SpellScript); + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) + if (bg->GetTypeID(true) == BATTLEGROUND_IC) + bg->DoAction(1, caster->GetGUID()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_gen_gunship_portal_SpellScript(); + } +}; + +enum ParachuteIC +{ + SPELL_PARACHUTE_IC = 66657 +}; + +class spell_gen_parachute_ic : public SpellScriptLoader +{ + public: + spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } + + class spell_gen_parachute_ic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_parachute_ic_AuraScript); + + void HandleTriggerSpell(AuraEffect const* /*aurEff*/) + { + if (Player* target = GetTarget()->ToPlayer()) + if (target->m_movementInfo.fallTime > 2000) + target->CastSpell(target, SPELL_PARACHUTE_IC, true); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_parachute_ic_AuraScript(); + } +}; + +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*/) + { + if (Player* player = GetHitPlayer()) + player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage + } + + void Launch() + { + WorldLocation const* const position = GetExplTargetDest(); + + 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() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); + AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_gen_launch_SpellScript(); + } +}; + void AddSC_isle_of_conquest() { new npc_four_car_garage(); + new spell_gen_gunship_portal(); + new spell_gen_parachute_ic(); + new spell_gen_launch(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 43f33f996ad..1d5443e54d6 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1640,93 +1640,6 @@ class spell_gen_gnomish_transporter : public SpellScriptLoader } }; -class spell_gen_gunship_portal : public SpellScriptLoader -{ - public: - spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } - - class spell_gen_gunship_portal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_gunship_portal_SpellScript); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - void HandleScript(SpellEffIndex /*effIndex*/) - { - Player* caster = GetCaster()->ToPlayer(); - if (Battleground* bg = caster->GetBattleground()) - if (bg->GetTypeID(true) == BATTLEGROUND_IC) - bg->DoAction(1, caster->GetGUID()); - } - - void Register() override - { - OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_gen_gunship_portal_SpellScript(); - } -}; - -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*/) - { - if (Player* player = GetHitPlayer()) - player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage - } - - void Launch() - { - WorldLocation const* const position = GetExplTargetDest(); - - 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() override - { - OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); - AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); - } - }; - - SpellScript* GetSpellScript() const override - { - return new spell_gen_launch_SpellScript(); - } -}; - - class spell_gen_lifeblood : public SpellScriptLoader { public: @@ -2783,39 +2696,6 @@ class spell_gen_parachute : public SpellScriptLoader } }; -enum ParachuteIC -{ - SPELL_PARACHUTE_IC = 66657 -}; - -class spell_gen_parachute_ic : public SpellScriptLoader -{ - public: - spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } - - class spell_gen_parachute_ic_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_parachute_ic_AuraScript); - - void HandleTriggerSpell(AuraEffect const* /*aurEff*/) - { - if (Player* target = GetTarget()->ToPlayer()) - if (target->m_movementInfo.fallTime > 2000) - target->CastSpell(target, SPELL_PARACHUTE_IC, true); - } - - void Register() override - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const override - { - return new spell_gen_parachute_ic_AuraScript(); - } -}; - enum PetSummoned { NPC_DOOMGUARD = 11859, @@ -3766,8 +3646,6 @@ void AddSC_generic_spell_scripts() new spell_gen_gadgetzan_transporter_backfire(); new spell_gen_gift_of_naaru(); new spell_gen_gnomish_transporter(); - new spell_gen_gunship_portal(); - new spell_gen_launch(); new spell_gen_lifeblood(); new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); @@ -3791,7 +3669,6 @@ void AddSC_generic_spell_scripts() new spell_gen_oracle_wolvar_reputation(); new spell_gen_orc_disguise(); new spell_gen_parachute(); - new spell_gen_parachute_ic(); new spell_gen_pet_summoned(); new spell_gen_profession_research(); new spell_gen_remove_flight_auras(); -- cgit v1.2.3 From 73df8f838157333a7efec55e4cd1bc88b1829845 Mon Sep 17 00:00:00 2001 From: DDuarte Date: Thu, 24 Jul 2014 03:48:11 +0100 Subject: Scripts/IoC: Rename spell_gen_* spells to spell_ioc_* (Additions to 6bb63ab7db679d9c) Closes #12414 (PR) --- .../2014_07_24_04_world_spell_script_names.sql | 3 ++ src/server/scripts/Northrend/isle_of_conquest.cpp | 44 +++++++++++----------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 sql/updates/world/2014_07_24_04_world_spell_script_names.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2014_07_24_04_world_spell_script_names.sql b/sql/updates/world/2014_07_24_04_world_spell_script_names.sql new file mode 100644 index 00000000000..4a7a1ff648c --- /dev/null +++ b/sql/updates/world/2014_07_24_04_world_spell_script_names.sql @@ -0,0 +1,3 @@ +UPDATE `spell_script_names` SET `ScriptName`='spell_ioc_gunship_portal' WHERE `ScriptName`='spell_gen_gunship_portal'; +UPDATE `spell_script_names` SET `ScriptName`='spell_ioc_parachute_ic' WHERE `ScriptName`='spell_gen_parachute_ic'; +UPDATE `spell_script_names` SET `ScriptName`='spell_ioc_launch' WHERE `ScriptName`='spell_gen_launch'; diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp index 88958806f6b..14763577c66 100644 --- a/src/server/scripts/Northrend/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/isle_of_conquest.cpp @@ -73,14 +73,14 @@ class npc_four_car_garage : public CreatureScript } }; -class spell_gen_gunship_portal : public SpellScriptLoader +class spell_ioc_gunship_portal : public SpellScriptLoader { public: - spell_gen_gunship_portal() : SpellScriptLoader("spell_gen_gunship_portal") { } + spell_ioc_gunship_portal() : SpellScriptLoader("spell_ioc_gunship_portal") { } - class spell_gen_gunship_portal_SpellScript : public SpellScript + class spell_ioc_gunship_portal_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_gunship_portal_SpellScript); + PrepareSpellScript(spell_ioc_gunship_portal_SpellScript); bool Load() override { @@ -97,13 +97,13 @@ class spell_gen_gunship_portal : public SpellScriptLoader void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_gen_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_ioc_gunship_portal_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const override { - return new spell_gen_gunship_portal_SpellScript(); + return new spell_ioc_gunship_portal_SpellScript(); } }; @@ -112,14 +112,14 @@ enum ParachuteIC SPELL_PARACHUTE_IC = 66657 }; -class spell_gen_parachute_ic : public SpellScriptLoader +class spell_ioc_parachute_ic : public SpellScriptLoader { public: - spell_gen_parachute_ic() : SpellScriptLoader("spell_gen_parachute_ic") { } + spell_ioc_parachute_ic() : SpellScriptLoader("spell_ioc_parachute_ic") { } - class spell_gen_parachute_ic_AuraScript : public AuraScript + class spell_ioc_parachute_ic_AuraScript : public AuraScript { - PrepareAuraScript(spell_gen_parachute_ic_AuraScript); + PrepareAuraScript(spell_ioc_parachute_ic_AuraScript); void HandleTriggerSpell(AuraEffect const* /*aurEff*/) { @@ -130,13 +130,13 @@ class spell_gen_parachute_ic : public SpellScriptLoader void Register() override { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_ioc_parachute_ic_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; AuraScript* GetAuraScript() const override { - return new spell_gen_parachute_ic_AuraScript(); + return new spell_ioc_parachute_ic_AuraScript(); } }; @@ -145,14 +145,14 @@ enum Launch SPELL_LAUNCH_NO_FALLING_DAMAGE = 66251 }; -class spell_gen_launch : public SpellScriptLoader +class spell_ioc_launch : public SpellScriptLoader { public: - spell_gen_launch() : SpellScriptLoader("spell_gen_launch") { } + spell_ioc_launch() : SpellScriptLoader("spell_ioc_launch") { } - class spell_gen_launch_SpellScript : public SpellScript + class spell_ioc_launch_SpellScript : public SpellScript { - PrepareSpellScript(spell_gen_launch_SpellScript); + PrepareSpellScript(spell_ioc_launch_SpellScript); void HandleScript(SpellEffIndex /*effIndex*/) { @@ -181,21 +181,21 @@ class spell_gen_launch : public SpellScriptLoader void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_gen_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); - AfterHit += SpellHitFn(spell_gen_launch_SpellScript::Launch); + OnEffectHitTarget += SpellEffectFn(spell_ioc_launch_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); + AfterHit += SpellHitFn(spell_ioc_launch_SpellScript::Launch); } }; SpellScript* GetSpellScript() const override { - return new spell_gen_launch_SpellScript(); + return new spell_ioc_launch_SpellScript(); } }; void AddSC_isle_of_conquest() { new npc_four_car_garage(); - new spell_gen_gunship_portal(); - new spell_gen_parachute_ic(); - new spell_gen_launch(); + new spell_ioc_gunship_portal(); + new spell_ioc_parachute_ic(); + new spell_ioc_launch(); } -- cgit v1.2.3 From 296956e06e02c06135aab6c5d86535b7e256a6b0 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 24 Jul 2014 16:14:25 +0200 Subject: Revert "Core/Spells: Death and Decay" This reverts commit 02d56e00bc256f224b7d05f90af2c0af7cb287bf. --- .../2014_07_24_08_world_spell_script_names.sql | 3 +++ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 7 ------ src/server/scripts/Northrend/zone_dalaran.cpp | 6 ++--- src/server/scripts/Spells/spell_dk.cpp | 29 ++++++++++++++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 sql/updates/world/2014_07_24_08_world_spell_script_names.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2014_07_24_08_world_spell_script_names.sql b/sql/updates/world/2014_07_24_08_world_spell_script_names.sql new file mode 100644 index 00000000000..16c12b70c5a --- /dev/null +++ b/sql/updates/world/2014_07_24_08_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM spell_script_names WHERE spell_id=-43265; +INSERT INTO spell_script_names VALUES +(-43265, 'spell_dk_death_and_decay'); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 2205f0d4607..1894776c990 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5457,13 +5457,6 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const target->DealDamage(target, damage, NULL, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); break; } - // Death and Decay - if (GetSpellInfo()->SpellFamilyFlags[0] & 0x20) - { - if (caster) - target->CastCustomSpell(target, 52212, &m_amount, NULL, NULL, true, 0, this, caster->GetGUID()); - break; - } // Blood of the North // Reaping // Death Rune Mastery diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 4cd0e929cd2..fb5e63a2301 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -202,7 +202,7 @@ class npc_minigob_manabonk : public CreatureScript me->setActive(true); } - void Reset() + void Reset() override { me->SetVisible(false); events.ScheduleEvent(EVENT_SELECT_TARGET, IN_MILLISECONDS); @@ -232,7 +232,7 @@ class npc_minigob_manabonk : public CreatureScript CharacterDatabase.CommitTransaction(trans); } - void UpdateAI(uint32 diff) + void UpdateAI(uint32 diff) override { events.Update(diff); @@ -276,7 +276,7 @@ class npc_minigob_manabonk : public CreatureScript EventMap events; }; - CreatureAI* GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const override { return new npc_minigob_manabonkAI(creature); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 84608ba42f1..1d6dcdfaa6d 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -36,6 +36,7 @@ enum DeathKnightSpells SPELL_DK_BLOOD_PRESENCE = 48266, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999, SPELL_DK_CORPSE_EXPLOSION_VISUAL = 51270, + SPELL_DK_DEATH_AND_DECAY_DAMAGE = 52212, SPELL_DK_DEATH_COIL_DAMAGE = 47632, SPELL_DK_DEATH_COIL_HEAL = 47633, SPELL_DK_DEATH_STRIKE_HEAL = 45470, @@ -445,6 +446,33 @@ class spell_dk_corpse_explosion : public SpellScriptLoader } }; +class spell_dk_death_and_decay : public SpellScriptLoader +{ + public: + spell_dk_death_and_decay() : SpellScriptLoader("spell_dk_death_and_decay") { } + + class spell_dk_death_and_decay_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_death_and_decay_AuraScript); + + void HandleDummyTick(AuraEffect const* aurEff) + { + if (Unit* caster = GetCaster()) + caster->CastCustomSpell(SPELL_DK_DEATH_AND_DECAY_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_dk_death_and_decay_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_dk_death_and_decay_AuraScript(); + } +}; + // -47541, 52375, 59134, -62900 - Death Coil class spell_dk_death_coil : public SpellScriptLoader { @@ -1545,6 +1573,7 @@ void AddSC_deathknight_spell_scripts() new spell_dk_blood_boil(); new spell_dk_blood_gorged(); new spell_dk_corpse_explosion(); + new spell_dk_death_and_decay(); new spell_dk_death_coil(); new spell_dk_death_gate(); new spell_dk_death_grip(); -- cgit v1.2.3