From 999843dfefd59a48878af7957a6fa5fc00fe2af2 Mon Sep 17 00:00:00 2001 From: profPlum Date: Tue, 23 Jul 2013 01:51:24 +0100 Subject: Scripts/VH: fix for violet hold's activation crystals Closes #10129 --- .../Northrend/VioletHold/instance_violet_hold.cpp | 92 ++++++++++++++++++++-- .../scripts/Northrend/VioletHold/violet_hold.cpp | 2 +- .../scripts/Northrend/VioletHold/violet_hold.h | 3 +- 3 files changed, 90 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 2c65300cd4c..5f8a39b7c92 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -21,6 +21,10 @@ #include "violet_hold.h" #include "Player.h" #include "TemporarySummon.h" +#include "ScriptMgr.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #define MAX_ENCOUNTER 3 @@ -61,7 +65,8 @@ enum AzureSaboteurSpells enum CrystalSpells { - SPELL_ARCANE_LIGHTNING = 57912 + SPELL_ARCANE_LIGHTNING = 57930, + SPELL_ARCANE_SPHERE_PASSIVE = 44263 }; enum Events @@ -79,6 +84,7 @@ const Position PortalLocation[] = {1908.31f, 809.657f, 38.7037f, 3.08701f} // WP 6 }; +const Position ArcaneSphere = {1887.060059f, 806.151001f, 61.321602f, 0.0f}; const Position BossStartMove1 = {1894.684448f, 739.390503f, 47.668003f, 0.0f}; const Position BossStartMove2 = {1875.173950f, 860.832703f, 43.333565f, 0.0f}; const Position BossStartMove21 = {1858.854614f, 855.071411f, 43.333565f, 0.0f}; @@ -140,7 +146,7 @@ public: uint64 uiTeleportationPortal; uint64 uiSaboteurPortal; - uint64 uiActivationCrystal[3]; + uint64 uiActivationCrystal[4]; uint32 uiActivationTimer; uint32 uiCyanigosaEventTimer; @@ -308,7 +314,7 @@ public: uiMainDoor = go->GetGUID(); break; case GO_ACTIVATION_CRYSTAL: - if (uiCountActivationCrystals < 3) + if (uiCountActivationCrystals < 4) uiActivationCrystal[uiCountActivationCrystals++] = go->GetGUID(); break; } @@ -401,6 +407,11 @@ public: pMainDoor->SetGoState(GO_STATE_READY); uiWaveCount = 1; bActive = true; + for (int i = 0; i < 4; ++i) + { + if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i])) + pCrystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. } break; @@ -710,6 +721,12 @@ public: SetData(DATA_WAVE_COUNT, 0); uiMainEventPhase = NOT_STARTED; + for (int i = 0; i < 4; ++i) + { + if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i])) + pCrystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { pSinclari->SetVisible(true); @@ -791,13 +808,28 @@ public: void ActivateCrystal() { + // just to make things easier we'll get the a gameobject from the map + GameObject* invoker=instance->GetGameObject(uiActivationCrystal[0]); + + SpellInfo const* spellInfoLightning=sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING); + if (!spellInfoLightning) + return; + + // the orb + TempSummon* trigger=invoker->SummonCreature(DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0); + + if ( !trigger ) + return; + + // visuals + trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID()); + // Kill all mobs registered with SetData64(ADD_TRASH_MOB) - /// @todo All visual, spells etc for (std::set::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) { Creature* creature = instance->GetCreature(*itr); if (creature && creature->IsAlive()) - creature->CastSpell(creature, SPELL_ARCANE_LIGHTNING, true); // Who should cast the spell? + trigger->Kill(creature); } } @@ -814,7 +846,57 @@ public: }; }; +class npc_violet_hold_arcane_sphere : public CreatureScript +{ +public: + npc_violet_hold_arcane_sphere() : CreatureScript("npc_violet_hold_arcane_sphere") { } + + CreatureAI* GetAI(Creature* c) const + { + return new npc_violet_hold_arcane_sphereAI(c); + } + + struct npc_violet_hold_arcane_sphereAI : public ScriptedAI + { + npc_violet_hold_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { Reset(); } + + uint32 DespawnTimer; + + void Reset() + { + DespawnTimer = 3000; + + me->SetDisableGravity(true); + DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(uint32 diff) + { + if (DespawnTimer <= diff) + me->Kill(me); + else + DespawnTimer -= diff; + } + }; +}; + +class go_activation_crystal : public GameObjectScript +{ +public: + go_activation_crystal() : GameObjectScript("go_activation_crystal") { } + + bool OnGossipHello(Player* /*player*/, GameObject* go) + { + go->EventInform(EVENT_ACTIVATE_CRYSTAL); + return false; + } +}; + void AddSC_instance_violet_hold() { + new go_activation_crystal(); + new npc_violet_hold_arcane_sphere(); new instance_violet_hold(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index d168a7277b9..0ce7c494808 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -120,7 +120,7 @@ enum TrashDoorSpell enum Spells { SPELL_PORTAL_CHANNEL = 58012, - SPELL_CRYSTALL_ACTIVATION = 57804 + SPELL_CRYSTAL_ACTIVATION = 57804 }; enum Sinclari diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index 014d3edff77..d2fcd701c78 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -92,7 +92,8 @@ enum CreaturesIds CREATURE_CYANIGOSA = 31134, CREATURE_SINCLARI = 30658, CREATURE_SABOTEOUR = 31079, - NPC_VIOLET_HOLD_GUARD = 30659 + NPC_VIOLET_HOLD_GUARD = 30659, + DEFENSE_SYSTEM = 30837 }; enum WorldStateIds -- cgit v1.2.3 From a3aa3f65fdf366de0f6111fb0569607de34d9d16 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 23 Jul 2013 02:13:09 +0100 Subject: Scripts/VH: Refactor commit 999843d --- sql/updates/world/2013_06_27_18_world_misc.sql | 7 -- sql/updates/world/2013_07_23_00_world_misc.sql | 7 ++ .../Northrend/VioletHold/instance_violet_hold.cpp | 93 ++++------------------ .../scripts/Northrend/VioletHold/violet_hold.cpp | 64 +++++++++++++-- .../scripts/Northrend/VioletHold/violet_hold.h | 7 +- 5 files changed, 87 insertions(+), 91 deletions(-) delete mode 100644 sql/updates/world/2013_06_27_18_world_misc.sql create mode 100644 sql/updates/world/2013_07_23_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2013_06_27_18_world_misc.sql b/sql/updates/world/2013_06_27_18_world_misc.sql deleted file mode 100644 index 7af0b741eff..00000000000 --- a/sql/updates/world/2013_06_27_18_world_misc.sql +++ /dev/null @@ -1,7 +0,0 @@ -UPDATE `gameobject_template` SET `flags`=48, `ScriptName`='go_activation_crystal' WHERE `entry`=193611; - -UPDATE `creature_template` -SET `flags_extra'=130,'ScriptName'='npc_violet_hold_arcane_sphere' -WHERE 'entry'=30837; - -INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES (13, 1, 57930, 0, 0, 32, 0, 16, 0, 0, 1, 0, 0, '', NULL); diff --git a/sql/updates/world/2013_07_23_00_world_misc.sql b/sql/updates/world/2013_07_23_00_world_misc.sql new file mode 100644 index 00000000000..8e69c7bb785 --- /dev/null +++ b/sql/updates/world/2013_07_23_00_world_misc.sql @@ -0,0 +1,7 @@ +UPDATE `gameobject_template` SET `flags`=48, `ScriptName`='go_activation_crystal' WHERE `entry`=193611; + +UPDATE `creature_template` SET `flags_extra`=130, `ScriptName`='npc_violet_hold_arcane_sphere' WHERE `entry`=30837; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=1 AND `SourceEntry`=57930; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 57930, 0, 0, 32, 0, 16, 0, 0, 1, 0, 0, '', 'Spell Arcane Lightning hit players'); diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 5f8a39b7c92..483d243c51d 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -21,10 +21,6 @@ #include "violet_hold.h" #include "Player.h" #include "TemporarySummon.h" -#include "ScriptMgr.h" -#include "SpellAuras.h" -#include "SpellAuraEffects.h" -#include "SpellScript.h" #define MAX_ENCOUNTER 3 @@ -65,13 +61,7 @@ enum AzureSaboteurSpells enum CrystalSpells { - SPELL_ARCANE_LIGHTNING = 57930, - SPELL_ARCANE_SPHERE_PASSIVE = 44263 -}; - -enum Events -{ - EVENT_ACTIVATE_CRYSTAL = 20001 + SPELL_ARCANE_LIGHTNING = 57930 }; const Position PortalLocation[] = @@ -403,15 +393,13 @@ public: uiMainEventPhase = data; if (data == IN_PROGRESS) // Start event { - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_READY); + if (GameObject* mainDoor = instance->GetGameObject(uiMainDoor)) + mainDoor->SetGoState(GO_STATE_READY); uiWaveCount = 1; bActive = true; for (int i = 0; i < 4; ++i) - { - if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i])) - pCrystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i])) + crystal->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. } break; @@ -711,7 +699,7 @@ public: } // if main event is in progress and players have wiped then reset instance - if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) + if (uiMainEventPhase == IN_PROGRESS && CheckWipe()) { SetData(DATA_REMOVE_NPC, 1); StartBossEncounter(uiFirstBoss, false); @@ -722,10 +710,8 @@ public: uiMainEventPhase = NOT_STARTED; for (int i = 0; i < 4; ++i) - { - if (GameObject* pCrystal = instance->GetGameObject(uiActivationCrystal[i])) - pCrystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + if (GameObject* crystal = instance->GetGameObject(uiActivationCrystal[i])) + crystal->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); if (Creature* pSinclari = instance->GetCreature(uiSinclari)) { @@ -808,17 +794,18 @@ public: void ActivateCrystal() { - // just to make things easier we'll get the a gameobject from the map - GameObject* invoker=instance->GetGameObject(uiActivationCrystal[0]); + // just to make things easier we'll get the gameobject from the map + GameObject* invoker = instance->GetGameObject(uiActivationCrystal[0]); + if (!invoker) + return; - SpellInfo const* spellInfoLightning=sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING); + SpellInfo const* spellInfoLightning = sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING); if (!spellInfoLightning) return; // the orb - TempSummon* trigger=invoker->SummonCreature(DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0); - - if ( !trigger ) + TempSummon* trigger = invoker->SummonCreature(NPC_DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0); + if (!trigger) return; // visuals @@ -846,57 +833,7 @@ public: }; }; -class npc_violet_hold_arcane_sphere : public CreatureScript -{ -public: - npc_violet_hold_arcane_sphere() : CreatureScript("npc_violet_hold_arcane_sphere") { } - - CreatureAI* GetAI(Creature* c) const - { - return new npc_violet_hold_arcane_sphereAI(c); - } - - struct npc_violet_hold_arcane_sphereAI : public ScriptedAI - { - npc_violet_hold_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { Reset(); } - - uint32 DespawnTimer; - - void Reset() - { - DespawnTimer = 3000; - - me->SetDisableGravity(true); - DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); - } - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(uint32 diff) - { - if (DespawnTimer <= diff) - me->Kill(me); - else - DespawnTimer -= diff; - } - }; -}; - -class go_activation_crystal : public GameObjectScript -{ -public: - go_activation_crystal() : GameObjectScript("go_activation_crystal") { } - - bool OnGossipHello(Player* /*player*/, GameObject* go) - { - go->EventInform(EVENT_ACTIVATE_CRYSTAL); - return false; - } -}; - void AddSC_instance_violet_hold() { - new go_activation_crystal(); - new npc_violet_hold_arcane_sphere(); new instance_violet_hold(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 0ce7c494808..0cec919737a 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -21,6 +21,9 @@ #include "ScriptedEscortAI.h" #include "violet_hold.h" #include "Player.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" #define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay." #define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right" @@ -108,8 +111,8 @@ enum AzureStalkerSpells enum AzureSaboteurSpells { - SABOTEUR_SHIELD_DISRUPTION = 58291, - SABOTEUR_SHIELD_EFFECT = 45775 + SABOTEUR_SHIELD_DISRUPTION = 58291, + SABOTEUR_SHIELD_EFFECT = 45775 }; enum TrashDoorSpell @@ -119,13 +122,14 @@ enum TrashDoorSpell enum Spells { - SPELL_PORTAL_CHANNEL = 58012, - SPELL_CRYSTAL_ACTIVATION = 57804 + SPELL_PORTAL_CHANNEL = 58012, + SPELL_CRYSTAL_ACTIVATION = 57804, + SPELL_ARCANE_SPHERE_PASSIVE = 44263 }; enum Sinclari { - SAY_SINCLARI_1 = 0 + SAY_SINCLARI_1 = 0 }; float FirstPortalWPs [6][3] = @@ -1320,7 +1324,55 @@ public: DoMeleeAttackIfReady(); } }; +}; + + +class npc_violet_hold_arcane_sphere : public CreatureScript +{ +public: + npc_violet_hold_arcane_sphere() : CreatureScript("npc_violet_hold_arcane_sphere") { } + + struct npc_violet_hold_arcane_sphereAI : public ScriptedAI + { + npc_violet_hold_arcane_sphereAI(Creature* creature) : ScriptedAI(creature) { } + + uint32 DespawnTimer; + + void Reset() OVERRIDE + { + DespawnTimer = 3000; + + me->SetDisableGravity(true); + DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); + } + + void EnterCombat(Unit * /*who*/) OVERRIDE {} + + void UpdateAI(uint32 diff) OVERRIDE + { + if (DespawnTimer <= diff) + me->Kill(me); + else + DespawnTimer -= diff; + } + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_violet_hold_arcane_sphereAI(creature); + } +}; + +class go_activation_crystal : public GameObjectScript +{ +public: + go_activation_crystal() : GameObjectScript("go_activation_crystal") { } + + bool OnGossipHello(Player * /*player*/, GameObject* go) OVERRIDE + { + go->EventInform(EVENT_ACTIVATE_CRYSTAL); + return false; + } }; void AddSC_violet_hold() @@ -1336,4 +1388,6 @@ void AddSC_violet_hold() new npc_azure_raider(); new npc_azure_stalker(); new npc_azure_saboteur(); + new npc_violet_hold_arcane_sphere(); + new go_activation_crystal(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index d2fcd701c78..f288af43ed2 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -93,7 +93,7 @@ enum CreaturesIds CREATURE_SINCLARI = 30658, CREATURE_SABOTEOUR = 31079, NPC_VIOLET_HOLD_GUARD = 30659, - DEFENSE_SYSTEM = 30837 + NPC_DEFENSE_SYSTEM = 30837 }; enum WorldStateIds @@ -103,4 +103,9 @@ enum WorldStateIds WORLD_STATE_VH_WAVE_COUNT = 3810, }; +enum Events +{ + EVENT_ACTIVATE_CRYSTAL = 20001 +}; + #endif -- cgit v1.2.3 From ce79e3a078e6617c7ca515ecf28fc671a5283b67 Mon Sep 17 00:00:00 2001 From: Warpten Date: Tue, 23 Jul 2013 14:38:44 +0200 Subject: Core/Auras: Implemented Aura::GetScriptByName. --- src/server/game/Spells/Auras/SpellAuras.cpp | 8 ++++++++ src/server/game/Spells/Auras/SpellAuras.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 2acf9087c06..65b644fa082 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -347,6 +347,14 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false) // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs } +AuraScript* Aura::GetScriptByName(std::string const& scriptName) const +{ + for (std::list::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr) + if ((*itr)->_GetScriptName()->compare(scriptName) == 0) + return *itr; + return NULL; +} + void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount) { // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 56927a09ae6..e865d415438 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -234,6 +234,8 @@ class Aura bool CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo); void CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo); + AuraScript* GetScriptByName(std::string const& scriptName) const; + std::list m_loadedScripts; private: void _DeleteRemovedApplications(); -- cgit v1.2.3 From e11714e9488a958ff80a82dce7e41aa0b7b787b7 Mon Sep 17 00:00:00 2001 From: keke222 Date: Tue, 23 Jul 2013 00:19:33 +0200 Subject: Scripts/Onyxia's Lair: Fixed movement during flight phase and set proper InhabitType Closes #10335 --- sql/updates/world/2013_07_23_02_world_creature_template.sql | 1 + src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2013_07_23_02_world_creature_template.sql (limited to 'src') diff --git a/sql/updates/world/2013_07_23_02_world_creature_template.sql b/sql/updates/world/2013_07_23_02_world_creature_template.sql new file mode 100644 index 00000000000..b55999040f1 --- /dev/null +++ b/sql/updates/world/2013_07_23_02_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `InhabitType` = 5 WHERE `entry` = 10184; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index afcbf1f0046..0adc6190d4b 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -413,7 +413,7 @@ public: } break; case EVENT_MOVEMENT: // Phase PHASE_BREATH - if (!IsMoving) + if (!IsMoving && !(me->HasUnitState(UNIT_STATE_CASTING))) { SetNextRandomPoint(); PointData = GetMoveData(); -- cgit v1.2.3 From 99c67c103d0555fb79c9b68d97008c825484e20d Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 22 Jul 2013 22:15:22 +0200 Subject: Scripts/Spells: backport some SpellScripts from 4.3.4 branch - Fix Earth Shield - Fix Necrotic Touch - Fix Reflective Shield Closes #9145, #9163, #9665 --- .../2013_07_24_00_world_spell_script_names.sql | 11 ++ src/server/game/Entities/Unit/Unit.cpp | 55 +------- src/server/scripts/Spells/spell_dk.cpp | 52 +++++++- src/server/scripts/Spells/spell_item.cpp | 90 ++++++++++++- src/server/scripts/Spells/spell_paladin.cpp | 38 ++++++ src/server/scripts/Spells/spell_priest.cpp | 50 +++++++- src/server/scripts/Spells/spell_shaman.cpp | 142 +++++++++++++++++++-- src/server/scripts/Spells/spell_warlock.cpp | 55 ++++++-- src/server/scripts/Spells/spell_warrior.cpp | 15 ++- 9 files changed, 415 insertions(+), 93 deletions(-) create mode 100644 sql/updates/world/2013_07_24_00_world_spell_script_names.sql (limited to 'src') diff --git a/sql/updates/world/2013_07_24_00_world_spell_script_names.sql b/sql/updates/world/2013_07_24_00_world_spell_script_names.sql new file mode 100644 index 00000000000..8c156fb2e57 --- /dev/null +++ b/sql/updates/world/2013_07_24_00_world_spell_script_names.sql @@ -0,0 +1,11 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (63310,50421,23780,33896,37594,37705,23551,23552,23572); +INSERT INTO `spell_script_names`(`spell_id`, `ScriptName`) VALUES +(63310,'spell_warl_glyph_of_shadowflame'), +(50421,'spell_dk_scent_of_blood'), +(23780,'spell_item_aegis_of_preservation'), +(33896,'spell_item_desperate_defense'), +(37594,'spell_pri_item_greater_heal_refund'), +(37705,'spell_pal_item_healing_discount'), +(23551,'spell_sha_item_lightning_shield'), +(23552,'spell_sha_item_lightning_shield_trigger'), +(23572,'spell_sha_item_mana_surge'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 021b86d4b51..a4839b0d45d 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -5733,12 +5733,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere } switch (dummySpell->Id) { - // Glyph of Shadowflame - case 63310: - { - triggered_spell_id = 63311; - break; - } // Nightfall case 18094: case 18095: @@ -7712,12 +7706,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case SPELLFAMILY_GENERIC: switch (auraSpellInfo->Id) { - case 23780: // Aegis of Preservation (Aegis of Preservation trinket) - trigger_spell_id = 23781; - break; - case 33896: // Desperate Defense (Stonescythe Whelp, Stonescythe Alpha, Stonescythe Ambusher) - trigger_spell_id = 33898; - break; case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket) // Pct value stored in dummy basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100; @@ -7800,14 +7788,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } } break; - case SPELLFAMILY_WARRIOR: - if (auraSpellInfo->Id == 50421) // Scent of Blood - { - CastSpell(this, 50422, true); - RemoveAuraFromStack(auraSpellInfo->Id); - return false; - } - break; case SPELLFAMILY_WARLOCK: { // Drain Soul @@ -7853,11 +7833,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg } case SPELLFAMILY_PRIEST: { - // Greater Heal Refund - if (auraSpellInfo->Id == 37594) - trigger_spell_id = 37595; // Blessed Recovery - else if (auraSpellInfo->SpellIconID == 1875) + if (auraSpellInfo->SpellIconID == 1875) { switch (auraSpellInfo->Id) { @@ -7949,13 +7926,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { switch (auraSpellInfo->Id) { - // Healing Discount - case 37705: - { - trigger_spell_id = 37706; - target = this; - break; - } // Soul Preserver case 60510: { @@ -8062,29 +8032,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg { switch (auraSpellInfo->Id) { - // Lightning Shield (The Ten Storms set) - case 23551: - { - trigger_spell_id = 23552; - target = victim; - break; - } - // Damage from Lightning Shield (The Ten Storms set) - case 23552: - { - trigger_spell_id = 27635; - break; - } - // Mana Surge (The Earthfury set) - case 23572: - { - if (!procSpell) - return false; - basepoints0 = int32(CalculatePct(procSpell->ManaCost, 35)); - trigger_spell_id = 23571; - target = this; - break; - } case 30881: // Nature's Guardian Rank 1 case 30883: // Nature's Guardian Rank 2 case 30884: // Nature's Guardian Rank 3 diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 0399134fddb..6b19daadf89 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -32,6 +32,7 @@ enum DeathKnightSpells SPELL_DK_BLACK_ICE_R1 = 49140, SPELL_DK_BLOOD_BOIL_TRIGGERED = 65658, SPELL_DK_BLOOD_GORGED_HEAL = 50454, + SPELL_DK_BLOOD_PRESENCE = 48266, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999, SPELL_DK_CORPSE_EXPLOSION_VISUAL = 51270, SPELL_DK_DEATH_COIL_DAMAGE = 47632, @@ -39,21 +40,21 @@ enum DeathKnightSpells SPELL_DK_DEATH_STRIKE_HEAL = 45470, SPELL_DK_GHOUL_EXPLODE = 47496, SPELL_DK_GLYPH_OF_ICEBOUND_FORTITUDE = 58625, - SPELL_DK_RUNIC_POWER_ENERGIZE = 49088, - SPELL_DK_SCOURGE_STRIKE_TRIGGERED = 70890, - SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189, - SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284, - SPELL_DK_BLOOD_PRESENCE = 48266, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, - SPELL_DK_UNHOLY_PRESENCE = 48265, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962, SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736, + SPELL_DK_RUNIC_POWER_ENERGIZE = 49088, + SPELL_DK_SCENT_OF_BLOOD = 50422, + SPELL_DK_SCOURGE_STRIKE_TRIGGERED = 70890, + SPELL_DK_UNHOLY_PRESENCE = 48265, + SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189, + SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284 }; enum DeathKnightSpellIcons { - DK_ICON_ID_IMPROVED_DEATH_STRIKE = 2751, + DK_ICON_ID_IMPROVED_DEATH_STRIKE = 2751 }; // 50462 - Anti-Magic Shell (on raid member) @@ -807,6 +808,42 @@ class spell_dk_rune_tap_party : public SpellScriptLoader } }; +// 50421 - Scent of Blood +class spell_dk_scent_of_blood : public SpellScriptLoader +{ + public: + spell_dk_scent_of_blood() : SpellScriptLoader("spell_dk_scent_of_blood") { } + + class spell_dk_scent_of_blood_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_scent_of_blood_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCENT_OF_BLOOD)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_DK_SCENT_OF_BLOOD, true, NULL, aurEff); + GetTarget()->RemoveAuraFromStack(GetSpellInfo()->Id); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_dk_scent_of_blood_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_dk_scent_of_blood_AuraScript(); + } +}; + // 55090 - Scourge Strike (55265, 55270, 55271) class spell_dk_scourge_strike : public SpellScriptLoader { @@ -1023,6 +1060,7 @@ void AddSC_deathknight_spell_scripts() new spell_dk_improved_blood_presence(); new spell_dk_improved_unholy_presence(); new spell_dk_rune_tap_party(); + new spell_dk_scent_of_blood(); new spell_dk_scourge_strike(); new spell_dk_spell_deflection(); new spell_dk_vampiric_blood(); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 9b8e7d489ce..64fc835bff9 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -73,6 +73,46 @@ class spell_item_trigger_spell : public SpellScriptLoader } }; +enum AegisOfPreservation +{ + SPELL_AEGIS_HEAL = 23781 +}; + +// 23780 - Aegis of Preservation +class spell_item_aegis_of_preservation : public SpellScriptLoader +{ + public: + spell_item_aegis_of_preservation() : SpellScriptLoader("spell_item_aegis_of_preservation") { } + + class spell_item_aegis_of_preservation_AuraScript : public AuraScript + { + PrepareAuraScript(spell_item_aegis_of_preservation_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AEGIS_HEAL)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_AEGIS_HEAL, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_item_aegis_of_preservation_AuraScript::HandleProc, EFFECT_1, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_item_aegis_of_preservation_AuraScript(); + } +}; + // 26400 - Arcane Shroud class spell_item_arcane_shroud : public SpellScriptLoader { @@ -217,6 +257,46 @@ class spell_item_defibrillate : public SpellScriptLoader uint32 _failSpell; }; +enum DesperateDefense +{ + SPELL_DESPERATE_RAGE = 33898 +}; + +// 33896 - Desperate Defense +class spell_item_desperate_defense : public SpellScriptLoader +{ + public: + spell_item_desperate_defense() : SpellScriptLoader("spell_item_desperate_defense") { } + + class spell_item_desperate_defense_AuraScript : public AuraScript + { + PrepareAuraScript(spell_item_desperate_defense_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_DESPERATE_RAGE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_DESPERATE_RAGE, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_item_desperate_defense_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_item_desperate_defense_AuraScript(); + } +}; + // http://www.wowhead.com/item=6522 Deviate Fish // 8063 Deviate Fish enum DeviateFishSpells @@ -523,15 +603,21 @@ class spell_item_necrotic_touch : public SpellScriptLoader return true; } + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetProcTarget() && eventInfo.GetProcTarget()->IsAlive(); + } + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); int32 bp = CalculatePct(int32(eventInfo.GetDamageInfo()->GetDamage()), aurEff->GetAmount()); - GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, GetTarget(), true, NULL, aurEff); + GetTarget()->CastCustomSpell(SPELL_ITEM_NECROTIC_TOUCH_PROC, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, NULL, aurEff); } void Register() OVERRIDE { + DoCheckProc += AuraCheckProcFn(spell_item_necrotic_touch_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_item_necrotic_touch_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -2477,11 +2563,13 @@ void AddSC_item_spell_scripts() // 23075 Mithril Mechanical Dragonling new spell_item_trigger_spell("spell_item_mithril_mechanical_dragonling", SPELL_MITHRIL_MECHANICAL_DRAGONLING); + new spell_item_aegis_of_preservation(); new spell_item_arcane_shroud(); new spell_item_blessing_of_ancient_kings(); new spell_item_defibrillate("spell_item_goblin_jumper_cables", 67, SPELL_GOBLIN_JUMPER_CABLES_FAIL); new spell_item_defibrillate("spell_item_goblin_jumper_cables_xl", 50, SPELL_GOBLIN_JUMPER_CABLES_XL_FAIL); new spell_item_defibrillate("spell_item_gnomish_army_knife", 33); + new spell_item_desperate_defense(); new spell_item_deviate_fish(); new spell_item_flask_of_the_north(); new spell_item_gnomish_death_ray(); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index fa3c6be7f72..e98c6d86f60 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -55,6 +55,8 @@ enum PaladinSpells SPELL_PALADIN_HAND_OF_SACRIFICE = 6940, SPELL_PALADIN_DIVINE_SACRIFICE = 64205, + SPELL_PALADIN_ITEM_HEALING_TRANCE = 37706, + SPELL_PALADIN_GLYPH_OF_SALVATION = 63225, SPELL_PALADIN_RIGHTEOUS_DEFENSE_TAUNT = 31790, @@ -587,6 +589,41 @@ class spell_pal_hand_of_salvation : public SpellScriptLoader } }; +// 37705 - Healing Discount +class spell_pal_item_healing_discount : public SpellScriptLoader +{ + public: + spell_pal_item_healing_discount() : SpellScriptLoader("spell_pal_item_healing_discount") { } + + class spell_pal_item_healing_discount_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_item_healing_discount_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_PALADIN_ITEM_HEALING_TRANCE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_PALADIN_ITEM_HEALING_TRANCE, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_pal_item_healing_discount_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_pal_item_healing_discount_AuraScript(); + } +}; + // -20473 - Holy Shock class spell_pal_holy_shock : public SpellScriptLoader { @@ -910,6 +947,7 @@ void AddSC_paladin_spell_scripts() new spell_pal_guarded_by_the_light(); new spell_pal_hand_of_sacrifice(); new spell_pal_hand_of_salvation(); + new spell_pal_item_healing_discount(); new spell_pal_holy_shock(); new spell_pal_judgement_of_command(); new spell_pal_lay_on_hands(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index cf52909ee3f..b18d3947a94 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -34,6 +34,7 @@ enum PriestSpells SPELL_PRIEST_GLYPH_OF_LIGHTWELL = 55673, SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL = 56161, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153, + SPELL_PRIEST_ITEM_EFFICIENCY = 37595, SPELL_PRIEST_MANA_LEECH_PROC = 34650, SPELL_PRIEST_PENANCE_R1 = 47540, SPELL_PRIEST_PENANCE_R1_DAMAGE = 47758, @@ -197,6 +198,41 @@ class spell_pri_guardian_spirit : public SpellScriptLoader } }; +// 37594 - Greater Heal Refund +class spell_pri_item_greater_heal_refund : public SpellScriptLoader +{ + public: + spell_pri_item_greater_heal_refund() : SpellScriptLoader("spell_pri_item_greater_heal_refund") { } + + class spell_pri_item_greater_heal_refund_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pri_item_greater_heal_refund_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_ITEM_EFFICIENCY)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_PRIEST_ITEM_EFFICIENCY, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_pri_item_greater_heal_refund_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_pri_item_greater_heal_refund_AuraScript(); + } +}; + // -7001 - Lightwell Renew class spell_pri_lightwell_renew : public SpellScriptLoader { @@ -491,12 +527,11 @@ class spell_pri_power_word_shield : public SpellScriptLoader if (dmgInfo.GetAttacker() == target) return; - if (Unit* caster = GetCaster()) - if (AuraEffect* talentAurEff = caster->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0)) - { - int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); - target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); - } + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0)) + { + int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + } } void Register() OVERRIDE @@ -633,7 +668,7 @@ class spell_pri_vampiric_touch : public SpellScriptLoader { PrepareAuraScript(spell_pri_vampiric_touch_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL)) return false; @@ -669,6 +704,7 @@ void AddSC_priest_spell_scripts() new spell_pri_divine_aegis(); new spell_pri_glyph_of_prayer_of_healing(); new spell_pri_guardian_spirit(); + new spell_pri_item_greater_heal_refund(); new spell_pri_lightwell_renew(); new spell_pri_mana_burn(); new spell_pri_mana_leech(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 69e02a37272..2ef905d0a79 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -41,6 +41,9 @@ enum ShamanSpells SPELL_SHAMAN_GLYPH_OF_HEALING_STREAM_TOTEM = 55456, SPELL_SHAMAN_GLYPH_OF_MANA_TIDE = 55441, SPELL_SHAMAN_GLYPH_OF_THUNDERSTORM = 62132, + SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD = 23552, + SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE = 27635, + SPELL_SHAMAN_ITEM_MANA_SURGE = 23571, SPELL_SHAMAN_LAVA_FLOWS_R1 = 51480, SPELL_SHAMAN_LAVA_FLOWS_TRIGGERED_R1 = 64694, SPELL_SHAMAN_MANA_SPRING_TOTEM_ENERGIZE = 52032, @@ -55,8 +58,8 @@ enum ShamanSpells enum ShamanSpellIcons { - SHAMAN_ICON_ID_RESTORATIVE_TOTEMS = 338, - SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW = 3087 + SHAMAN_ICON_ID_RESTORATIVE_TOTEMS = 338, + SHAMAN_ICON_ID_SHAMAN_LAVA_FLOW = 3087 }; // 52759 - Ancestral Awakening (Proc) @@ -128,8 +131,8 @@ class spell_sha_astral_shift : public SpellScriptLoader void Register() OVERRIDE { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_astral_shift_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_sha_astral_shift_AuraScript::Absorb, EFFECT_0); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_astral_shift_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_sha_astral_shift_AuraScript::Absorb, EFFECT_0); } }; @@ -302,17 +305,22 @@ class spell_sha_earth_shield : public SpellScriptLoader } } - void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + bool CheckProc(ProcEventInfo& /*eventInfo*/) { - PreventDefaultAction(); - //! HACK due to currenct proc system implementation if (Player* player = GetTarget()->ToPlayer()) if (player->HasSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL)) - return; + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); GetTarget()->CastCustomSpell(SPELL_SHAMAN_EARTH_SHIELD_HEAL, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); + /// @hack: due to currenct proc system implementation if (Player* player = GetTarget()->ToPlayer()) player->AddSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL, 0, time(NULL) + 3); } @@ -320,6 +328,7 @@ class spell_sha_earth_shield : public SpellScriptLoader void Register() OVERRIDE { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_earth_shield_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_DUMMY); + DoCheckProc += AuraCheckProcFn(spell_sha_earth_shield_AuraScript::CheckProc); OnEffectProc += AuraEffectProcFn(spell_sha_earth_shield_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); } }; @@ -632,6 +641,120 @@ class spell_sha_heroism : public SpellScriptLoader } }; +// 23551 - Lightning Shield +class spell_sha_item_lightning_shield : public SpellScriptLoader +{ + public: + spell_sha_item_lightning_shield() : SpellScriptLoader("spell_sha_item_lightning_shield") { } + + class spell_sha_item_lightning_shield_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_item_lightning_shield_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_sha_item_lightning_shield_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_sha_item_lightning_shield_AuraScript(); + } +}; + +// 23552 - Lightning Shield +class spell_sha_item_lightning_shield_trigger : public SpellScriptLoader +{ + public: + spell_sha_item_lightning_shield_trigger() : SpellScriptLoader("spell_sha_item_lightning_shield_trigger") { } + + class spell_sha_item_lightning_shield_trigger_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_item_lightning_shield_trigger_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_MANA_SURGE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->CastSpell(GetTarget(), SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_sha_item_lightning_shield_trigger_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_sha_item_lightning_shield_trigger_AuraScript(); + } +}; + +// 23572 - Mana Surge +class spell_sha_item_mana_surge : public SpellScriptLoader +{ + public: + spell_sha_item_mana_surge() : SpellScriptLoader("spell_sha_item_mana_surge") { } + + class spell_sha_item_mana_surge_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_item_mana_surge_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHAMAN_ITEM_LIGHTNING_SHIELD_DAMAGE)) + return false; + return true; + } + + bool CheckProc(ProcEventInfo& eventInfo) + { + return eventInfo.GetDamageInfo()->GetSpellInfo(); + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 mana = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetSchoolMask()); + int32 damage = CalculatePct(mana, 35); + + GetTarget()->CastCustomSpell(SPELL_SHAMAN_ITEM_MANA_SURGE, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff); + } + + void Register() OVERRIDE + { + DoCheckProc += AuraCheckProcFn(spell_sha_item_mana_surge_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_sha_item_mana_surge_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_sha_item_mana_surge_AuraScript(); + } +}; + // 60103 - Lava Lash class spell_sha_lava_lash : public SpellScriptLoader { @@ -851,6 +974,9 @@ void AddSC_shaman_spell_scripts() new spell_sha_flame_shock(); new spell_sha_healing_stream_totem(); new spell_sha_heroism(); + new spell_sha_item_lightning_shield(); + new spell_sha_item_lightning_shield_trigger(); + new spell_sha_item_mana_surge(); new spell_sha_lava_lash(); new spell_sha_mana_spring_totem(); new spell_sha_mana_tide_totem(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index be060e32030..62c56a40cc5 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -38,15 +38,16 @@ enum WarlockSpells SPELL_WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER = 54509, SPELL_WARLOCK_DEMONIC_EMPOWERMENT_IMP = 54444, SPELL_WARLOCK_FEL_SYNERGY_HEAL = 54181, + SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME = 63311, SPELL_WARLOCK_GLYPH_OF_SIPHON_LIFE = 63106, + SPELL_WARLOCK_HAUNT = 48181, + SPELL_WARLOCK_HAUNT_HEAL = 48210, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1 = 18692, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955, SPELL_WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956, - SPELL_WARLOCK_HAUNT = 48181, - SPELL_WARLOCK_HAUNT_HEAL = 48210, SPELL_WARLOCK_LIFE_TAP_ENERGIZE = 31818, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 = 32553, SPELL_WARLOCK_SOULSHATTER = 32835, @@ -205,7 +206,7 @@ class spell_warl_curse_of_doom : public SpellScriptLoader { PrepareAuraScript(spell_warl_curse_of_doom_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_CURSE_OF_DOOM_EFFECT)) return false; @@ -242,7 +243,7 @@ class spell_warl_curse_of_doom : public SpellScriptLoader } }; -// 48018 - Demonic Circle Summon +// 48018 - Demonic Circle: Summon class spell_warl_demonic_circle_summon : public SpellScriptLoader { public: @@ -294,7 +295,7 @@ class spell_warl_demonic_circle_summon : public SpellScriptLoader } }; -// 48020 - Demonic Circle Teleport +// 48020 - Demonic Circle: Teleport class spell_warl_demonic_circle_teleport : public SpellScriptLoader { public: @@ -464,6 +465,41 @@ class spell_warl_fel_synergy : public SpellScriptLoader } }; +// 63310 - Glyph of Shadowflame +class spell_warl_glyph_of_shadowflame : public SpellScriptLoader +{ + public: + spell_warl_glyph_of_shadowflame() : SpellScriptLoader("spell_warl_glyph_of_shadowflame") { } + + class spell_warl_glyph_of_shadowflame_AuraScript : public AuraScript + { + PrepareAuraScript(spell_warl_glyph_of_shadowflame_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARLOCK_GLYPH_OF_SHADOWFLAME, true, NULL, aurEff); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_warl_glyph_of_shadowflame_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_warl_glyph_of_shadowflame_AuraScript(); + } +}; + // -48181 - Haunt class spell_warl_haunt : public SpellScriptLoader { @@ -491,7 +527,7 @@ class spell_warl_haunt : public SpellScriptLoader { PrepareAuraScript(spell_warl_haunt_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_HAUNT_HEAL)) return false; @@ -753,7 +789,7 @@ class spell_warl_siphon_life : public SpellScriptLoader bool CheckProc(ProcEventInfo& eventInfo) { - return eventInfo.GetDamageInfo()->GetDamage(); + return eventInfo.GetDamageInfo()->GetDamage() && GetTarget()->IsAlive(); } void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -791,7 +827,7 @@ class spell_warl_soulshatter : public SpellScriptLoader { PrepareSpellScript(spell_warl_soulshatter_SpellScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_SOULSHATTER)) return false; @@ -830,7 +866,7 @@ class spell_warl_unstable_affliction : public SpellScriptLoader { PrepareAuraScript(spell_warl_unstable_affliction_AuraScript); - bool Validate(SpellInfo const* /*spell*/) OVERRIDE + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { if (!sSpellMgr->GetSpellInfo(SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL)) return false; @@ -870,6 +906,7 @@ void AddSC_warlock_spell_scripts() new spell_warl_demonic_empowerment(); new spell_warl_everlasting_affliction(); new spell_warl_fel_synergy(); + new spell_warl_glyph_of_shadowflame(); new spell_warl_haunt(); new spell_warl_health_funnel(); new spell_warl_life_tap(); diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 9e7ca75890f..3c0a94fdb0d 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -50,8 +50,11 @@ enum WarriorSpells SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_1 = 64849, SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_2 = 64850, SPELL_WARRIOR_VIGILANCE_PROC = 50725, - SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665, + SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665 +}; +enum MiscSpells +{ SPELL_PALADIN_BLESSING_OF_SANCTUARY = 20911, SPELL_PALADIN_GREATER_BLESSING_OF_SANCTUARY = 25899, SPELL_PRIEST_RENEWED_HOPE = 63944, @@ -60,7 +63,7 @@ enum WarriorSpells enum WarriorSpellIcons { - WARRIOR_ICON_ID_SUDDEN_DEATH = 1989, + WARRIOR_ICON_ID_SUDDEN_DEATH = 1989 }; // 23881 - Bloodthirst @@ -424,11 +427,9 @@ class spell_warr_last_stand : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* caster = GetCaster()) - { - int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); - caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); - } + Unit* caster = GetCaster(); + int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(GetEffectValue())); + caster->CastCustomSpell(caster, SPELL_WARRIOR_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); } void Register() OVERRIDE -- cgit v1.2.3