diff options
author | Nay <dnpd.dd@gmail.com> | 2013-07-23 02:13:09 +0100 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2013-07-23 02:13:09 +0100 |
commit | a3aa3f65fdf366de0f6111fb0569607de34d9d16 (patch) | |
tree | be98192ebce2091597833df856035b54310db942 /src | |
parent | 999843dfefd59a48878af7957a6fa5fc00fe2af2 (diff) |
Scripts/VH: Refactor commit 999843d
Diffstat (limited to 'src')
3 files changed, 80 insertions, 84 deletions
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 |