aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/duskwood.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/EasternKingdoms/duskwood.cpp')
-rw-r--r--src/server/scripts/EasternKingdoms/duskwood.cpp136
1 files changed, 70 insertions, 66 deletions
diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp
index 3dcf9a01f6a..f40aa0fd86f 100644
--- a/src/server/scripts/EasternKingdoms/duskwood.cpp
+++ b/src/server/scripts/EasternKingdoms/duskwood.cpp
@@ -28,24 +28,30 @@ EndScriptData */
/*######
# at_twilight_grove
######*/
-
-bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*at*/)
+ class at_twilight_grove : public AreaTriggerScript
{
- if (pPlayer->HasQuestForItem(21149))
+public:
+ at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { }
+
+ bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/)
{
- if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000))
- {
- TCorrupter->setFaction(14);
- TCorrupter->SetMaxHealth(832750);
- }
- if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000))
+ if (pPlayer->HasQuestForItem(21149))
{
- CorrupterSpeaker->SetName("Twilight Corrupter");
- CorrupterSpeaker->SetVisibility(VISIBILITY_ON);
- CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID());
+ if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000))
+ {
+ TCorrupter->setFaction(14);
+ TCorrupter->SetMaxHealth(832750);
+ }
+ if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000))
+ {
+ CorrupterSpeaker->SetName("Twilight Corrupter");
+ CorrupterSpeaker->SetVisibility(VISIBILITY_ON);
+ CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID());
+ }
}
- }
- return false;
+ return false;
+ };
+
};
/*######
@@ -55,74 +61,72 @@ bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*a
#define SPELL_SOUL_CORRUPTION 25805
#define SPELL_CREATURE_OF_NIGHTMARE 25806
#define SPELL_LEVEL_UP 24312
-
-struct boss_twilight_corrupterAI : public ScriptedAI
+ class boss_twilight_corrupter : public CreatureScript
{
- boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {}
+public:
+ boss_twilight_corrupter() : CreatureScript("boss_twilight_corrupter") { }
- uint32 SoulCorruption_Timer;
- uint32 CreatureOfNightmare_Timer;
- uint8 KillCount;
-
- void Reset()
- {
- SoulCorruption_Timer = 15000;
- CreatureOfNightmare_Timer = 30000;
- KillCount = 0;
- }
- void EnterCombat(Unit* /*who*/)
+ CreatureAI* GetAI(Creature* pCreature) const
{
- me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID());
+ return new boss_twilight_corrupterAI (pCreature);
}
- void KilledUnit(Unit* victim)
+ struct boss_twilight_corrupterAI : public ScriptedAI
{
- if (victim->GetTypeId() == TYPEID_PLAYER)
+ boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 SoulCorruption_Timer;
+ uint32 CreatureOfNightmare_Timer;
+ uint8 KillCount;
+
+ void Reset()
+ {
+ SoulCorruption_Timer = 15000;
+ CreatureOfNightmare_Timer = 30000;
+ KillCount = 0;
+ }
+ void EnterCombat(Unit* /*who*/)
{
- ++KillCount;
- me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true);
+ me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID());
+ }
- if (KillCount == 3)
+ void KilledUnit(Unit* victim)
+ {
+ if (victim->GetTypeId() == TYPEID_PLAYER)
{
- DoCast(me, SPELL_LEVEL_UP, true);
- KillCount = 0;
+ ++KillCount;
+ me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true);
+
+ if (KillCount == 3)
+ {
+ DoCast(me, SPELL_LEVEL_UP, true);
+ KillCount = 0;
+ }
}
}
- }
- void UpdateAI(const uint32 diff)
- {
- if (!UpdateVictim())
- return;
- if (SoulCorruption_Timer <= diff)
+ void UpdateAI(const uint32 diff)
{
- DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION);
- SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers
- } else SoulCorruption_Timer-=diff;
- if (CreatureOfNightmare_Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE);
- CreatureOfNightmare_Timer = 45000; //gotta confirm Timers
- } else CreatureOfNightmare_Timer-=diff;
- DoMeleeAttackIfReady();
+ if (!UpdateVictim())
+ return;
+ if (SoulCorruption_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION);
+ SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers
+ } else SoulCorruption_Timer-=diff;
+ if (CreatureOfNightmare_Timer <= diff)
+ {
+ DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE);
+ CreatureOfNightmare_Timer = 45000; //gotta confirm Timers
+ } else CreatureOfNightmare_Timer-=diff;
+ DoMeleeAttackIfReady();
+ };
};
+
};
-CreatureAI* GetAI_boss_twilight_corrupter(Creature* pCreature)
-{
- return new boss_twilight_corrupterAI (pCreature);
-}
void AddSC_duskwood()
{
- Script *newscript;
-
- newscript = new Script;
- newscript->Name = "boss_twilight_corrupter";
- newscript->GetAI = &GetAI_boss_twilight_corrupter;
- newscript->RegisterSelf();
-
- newscript = new Script;
- newscript->Name = "at_twilight_grove";
- newscript->pAreaTrigger = &AreaTrigger_at_twilight_grove;
- newscript->RegisterSelf();
+ new boss_twilight_corrupter();
+ new at_twilight_grove();
}