aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/zone_grizzly_hills.cpp520
1 files changed, 259 insertions, 261 deletions
diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
index 0f3a312c1bc..543514122f6 100644
--- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp
@@ -27,33 +27,34 @@
## Quest 12027: Mr. Floppy's Perilous Adventure
######*/
-enum eFloppy
+enum Floppy
{
+ // Creature
NPC_MRFLOPPY = 26589,
NPC_HUNGRY_WORG = 26586,
- NPC_RAVENOUS_WORG = 26590, //RWORG
+ NPC_RAVENOUS_WORG = 26590, // RWORG
NPC_EMILY = 26588,
-
+ // Quest
QUEST_PERILOUS_ADVENTURE = 12027,
-
- SPELL_MRFLOPPY = 47184, //vehicle aura
-
- SAY_WORGHAGGRO1 = 0, //Um... I think one of those wolves is back...
- SAY_WORGHAGGRO2 = 1, //He's going for Mr. Floppy!
- SAY_WORGRAGGRO3 = 2, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
- SAY_WORGRAGGRO4 = 3, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
- SAY_RANDOMAGGRO = 4, //There's a big meanie attacking Mr. Floppy! Help!
- SAY_VICTORY1 = 5, //Let's get out of here before more wolves find us!
- SAY_VICTORY2 = 6, //Don't go toward the light, Mr. Floppy!
- SAY_VICTORY3 = 7, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
- SAY_VICTORY4 = 8, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
- TEXT_EMOTE_WP1 = 9, //Mr. Floppy revives
- TEXT_EMOTE_AGGRO = 10, //The Ravenous Worg chomps down on Mr. Floppy
- SAY_QUEST_ACCEPT = 11, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
- SAY_QUEST_COMPLETE = 12 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
+ // Spell
+ SPELL_MRFLOPPY = 47184, // vehicle aura
+ // Text
+ SAY_WORGHAGGRO1 = 0, // Um... I think one of those wolves is back...
+ SAY_WORGHAGGRO2 = 1, // He's going for Mr. Floppy!
+ SAY_WORGRAGGRO3 = 2, // Oh, no! Look, it's another wolf, and it's a biiiiiig one!
+ SAY_WORGRAGGRO4 = 3, // He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
+ SAY_RANDOMAGGRO = 4, // There's a big meanie attacking Mr. Floppy! Help!
+ SAY_VICTORY1 = 5, // Let's get out of here before more wolves find us!
+ SAY_VICTORY2 = 6, // Don't go toward the light, Mr. Floppy!
+ SAY_VICTORY3 = 7, // Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
+ SAY_VICTORY4 = 8, // I think I see the camp! We're almost home, Mr. Floppy! Let's go!
+ TEXT_EMOTE_WP1 = 9, // Mr. Floppy revives
+ TEXT_EMOTE_AGGRO = 10, // The Ravenous Worg chomps down on Mr. Floppy
+ SAY_QUEST_ACCEPT = 11, // Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
+ SAY_QUEST_COMPLETE = 12 // Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
};
-//emily
+// emily
class npc_emily : public CreatureScript
{
public:
@@ -63,13 +64,6 @@ public:
{
npc_emilyAI(Creature* creature) : npc_escortAI(creature) { }
- uint32 m_uiChatTimer;
-
- uint64 RWORGGUID;
- uint64 MrfloppyGUID;
-
- bool Completed;
-
void JustSummoned(Creature* summoned)
{
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 50.0f))
@@ -88,55 +82,55 @@ public:
{
case 9:
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(me, NPC_MRFLOPPY, 100.0f))
- MrfloppyGUID = Mrfloppy->GetGUID();
+ _mrfloppyGUID = Mrfloppy->GetGUID();
break;
case 10:
- if (Unit::GetCreature(*me, MrfloppyGUID))
+ if (Unit::GetCreature(*me, _mrfloppyGUID))
{
Talk(SAY_WORGHAGGRO1);
me->SummonCreature(NPC_HUNGRY_WORG, me->GetPositionX()+5, me->GetPositionY()+2, me->GetPositionZ()+1, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
}
break;
case 11:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break;
case 17:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
Talk(SAY_WORGRAGGRO3);
if (Creature* RWORG = me->SummonCreature(NPC_RAVENOUS_WORG, me->GetPositionX()+10, me->GetPositionY()+8, me->GetPositionZ()+2, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000))
{
RWORG->setFaction(35);
- RWORGGUID = RWORG->GetGUID();
+ _RavenousworgGUID = RWORG->GetGUID();
}
break;
case 18:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
{
- if (Creature* RWORG = Unit::GetCreature(*me, RWORGGUID))
+ if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
RWORG->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
DoCast(Mrfloppy, SPELL_MRFLOPPY);
}
break;
case 19:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
{
if (Mrfloppy->HasAura(SPELL_MRFLOPPY, 0))
{
- if (Creature* RWORG = Unit::GetCreature(*me, RWORGGUID))
+ if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
Mrfloppy->EnterVehicle(RWORG);
}
}
break;
case 20:
- if (Creature* RWORG = Unit::GetCreature(*me, RWORGGUID))
+ if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
RWORG->HandleEmoteCommand(34);
break;
case 21:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
{
- if (Creature* RWORG = Unit::GetCreature(*me, RWORGGUID))
+ if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
{
RWORG->Kill(Mrfloppy);
Mrfloppy->ExitVehicle();
@@ -147,11 +141,11 @@ public:
}
break;
case 22:
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
{
if (Mrfloppy->isDead())
{
- if (Creature* RWORG = Unit::GetCreature(*me, RWORGGUID))
+ if (Creature* RWORG = Unit::GetCreature(*me, _RavenousworgGUID))
RWORG->DisappearAndDie();
me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE);
@@ -163,7 +157,6 @@ public:
case 24:
if (player)
{
- Completed = true;
player->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me);
Talk(SAY_QUEST_COMPLETE, player->GetGUID());
}
@@ -174,7 +167,7 @@ public:
break;
case 27:
me->DisappearAndDie();
- if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
+ if (Creature* Mrfloppy = Unit::GetCreature(*me, _mrfloppyGUID))
Mrfloppy->DisappearAndDie();
break;
}
@@ -187,23 +180,13 @@ public:
void Reset()
{
- m_uiChatTimer = 4000;
- MrfloppyGUID = 0;
- RWORGGUID = 0;
+ _mrfloppyGUID = 0;
+ _RavenousworgGUID = 0;
}
- void UpdateAI(uint32 uiDiff)
- {
- npc_escortAI::UpdateAI(uiDiff);
-
- if (HasEscortState(STATE_ESCORT_ESCORTING))
- {
- if (m_uiChatTimer <= uiDiff)
- m_uiChatTimer = 12000;
- else
- m_uiChatTimer -= uiDiff;
- }
- }
+ private:
+ uint64 _RavenousworgGUID;
+ uint64 _mrfloppyGUID;
};
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
@@ -226,7 +209,7 @@ public:
}
};
-//mrfloppy
+// mrfloppy
class npc_mrfloppy : public CreatureScript
{
public:
@@ -236,10 +219,6 @@ public:
{
npc_mrfloppyAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 EmilyGUID;
- uint64 RWORGGUID;
- uint64 HWORGGUID;
-
void Reset() {}
void EnterCombat(Unit* Who)
@@ -277,21 +256,21 @@ public:
}
};
-// Outhouse Bunny
+/*######
+## Quest 12227: Doing Your Duty
+######*/
-enum eOuthouseBunny
+enum Outhouse
{
+ // Sound
+ SOUND_FEMALE = 12671,
+ SOUND_MALE = 12670,
+ // Spell
SPELL_OUTHOUSE_GROANS = 48382,
SPELL_CAMERA_SHAKE = 47533,
SPELL_DUST_FIELD = 48329
};
-enum eSounds
-{
- SOUND_FEMALE = 12671,
- SOUND_MALE = 12670
-};
-
class npc_outhouse_bunny : public CreatureScript
{
public:
@@ -301,32 +280,29 @@ public:
{
npc_outhouse_bunnyAI(Creature* creature) : ScriptedAI(creature) {}
- uint8 m_counter;
- uint8 m_gender;
-
void Reset()
{
- m_counter = 0;
- m_gender = 0;
+ _counter = 0;
+ _gender = 0;
}
- void SetData(uint32 uiType, uint32 uiData)
+ void SetData(uint32 Type, uint32 Data)
{
- if (uiType == 1)
- m_gender = uiData;
+ if (Type == 1)
+ _gender = Data;
}
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
+ void SpellHit(Unit* Caster, const SpellInfo* Spell)
{
- if (pSpell->Id == SPELL_OUTHOUSE_GROANS)
+ if (Spell->Id == SPELL_OUTHOUSE_GROANS)
{
- ++m_counter;
- if (m_counter < 5)
- DoCast(pCaster, SPELL_CAMERA_SHAKE, true);
+ ++_counter;
+ if (_counter < 5)
+ DoCast(Caster, SPELL_CAMERA_SHAKE, true);
else
- m_counter = 0;
+ _counter = 0;
DoCast(me, SPELL_DUST_FIELD, true);
- switch (m_gender)
+ switch (_gender)
{
case GENDER_FEMALE:
DoPlaySoundToSet(me, SOUND_FEMALE);
@@ -338,6 +314,9 @@ public:
}
}
}
+ private:
+ uint8 _counter;
+ uint8 _gender;
};
CreatureAI* GetAI(Creature* creature) const
@@ -348,8 +327,9 @@ public:
// Tallhorn Stage
-enum etallhornstage
+enum TallhornStage
{
+ //Gameobject
OBJECT_HAUNCH = 188665
};
@@ -362,16 +342,14 @@ public:
{
npc_tallhorn_stagAI(Creature* creature) : ScriptedAI(creature) {}
- uint8 m_uiPhase;
-
void Reset()
{
- m_uiPhase = 1;
+ _phase = 1;
}
- void UpdateAI(uint32 /*uiDiff*/)
+ void UpdateAI(uint32 /*diff*/)
{
- if (m_uiPhase == 1)
+ if (_phase == 1)
{
if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f))
{
@@ -379,10 +357,12 @@ public:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
}
- m_uiPhase = 0;
+ _phase = 0;
}
DoMeleeAttackIfReady();
}
+ private:
+ uint8 _phase;
};
CreatureAI* GetAI(Creature* creature) const
@@ -393,9 +373,16 @@ public:
// Amberpine Woodsman
-enum eamberpinewoodsman
+enum AmberpineWoodsman
{
- TALLHORN_STAG = 26363
+ // Creature
+ NPC_TALLHORN_STAG = 26363
+};
+
+enum AmberpineWoodsmanEvents
+{
+ EVENT_WOODSMAN_1 = 1,
+ EVENT_WOODSMAN_2 = 2
};
class npc_amberpine_woodsman : public CreatureScript
@@ -407,48 +394,40 @@ public:
{
npc_amberpine_woodsmanAI(Creature* creature) : ScriptedAI(creature) {}
- uint8 m_uiPhase;
- uint32 m_uiTimer;
-
void Reset()
{
- m_uiTimer = 0;
- m_uiPhase = 1;
- }
-
- void UpdateAI(uint32 uiDiff)
- {
- // call this each update tick?
- if (me->FindNearestCreature(TALLHORN_STAG, 0.2f))
+ if (me->FindNearestCreature(NPC_TALLHORN_STAG, 0.2f))
{
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
}
else
- if (m_uiPhase)
+ _events.ScheduleEvent(EVENT_WOODSMAN_1, 0);
+ }
+
+ void UpdateAI(uint32 diff)
+ {
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
{
- if (m_uiTimer <= uiDiff)
- {
- switch (m_uiPhase)
- {
- case 1:
- me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LOOT);
- m_uiTimer = 3000;
- m_uiPhase = 2;
- break;
- case 2:
- me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H);
- m_uiTimer = 4000;
- m_uiPhase = 1;
- break;
- }
- }
- else
- m_uiTimer -= uiDiff;
+ case EVENT_WOODSMAN_1:
+ me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_LOOT);
+ _events.ScheduleEvent(EVENT_WOODSMAN_2, 3000);
+ break;
+ case EVENT_WOODSMAN_2:
+ me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK1H);
+ _events.ScheduleEvent(EVENT_WOODSMAN_1, 4000);
+ break;
+ default:
+ break;
}
- ScriptedAI::UpdateAI(uiDiff);
-
+ }
UpdateVictim();
}
+ private:
+ EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const
@@ -456,16 +435,21 @@ public:
return new npc_amberpine_woodsmanAI(creature);
}
};
+
/*######
## Quest 12288: Overwhelmed!
######*/
-enum eSkirmisher
+enum Skirmisher
{
+ // Creature
+ NPC_CREDIT = 27466,
+ // Quest
+ QUEST_OVERWHELMED = 12288,
+ // Spell
SPELL_RENEW_SKIRMISHER = 48812,
- CREDIT_NPC = 27466,
-
- RANDOM_SAY = 0,
+ // Text
+ SAY_RANDOM = 0
};
class npc_wounded_skirmisher : public CreatureScript
@@ -477,35 +461,31 @@ public:
{
npc_wounded_skirmisherAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 uiPlayerGUID;
-
- uint32 DespawnTimer;
-
void Reset()
{
- DespawnTimer = 5000;
- uiPlayerGUID = 0;
+ _despawnTimer = 5000;
+ _playerGUID = 0;
}
void MovementInform(uint32, uint32 id)
{
if (id == 1)
- me->DespawnOrUnsummon(DespawnTimer);
+ me->DespawnOrUnsummon(_despawnTimer);
}
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER
- && caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE)
+ && caster->ToPlayer()->GetQuestStatus(QUEST_OVERWHELMED) == QUEST_STATUS_INCOMPLETE)
{
- caster->ToPlayer()->KilledMonsterCredit(CREDIT_NPC, 0);
- sCreatureTextMgr->SendChat(me, RANDOM_SAY, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, caster->ToPlayer());
+ caster->ToPlayer()->KilledMonsterCredit(NPC_CREDIT, 0);
+ Talk(SAY_RANDOM);
if (me->IsStandState())
me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+7, me->GetPositionY()+7, me->GetPositionZ());
else
{
me->SetStandState(UNIT_STAND_STATE_STAND);
- me->DespawnOrUnsummon(DespawnTimer);
+ me->DespawnOrUnsummon(_despawnTimer);
}
}
}
@@ -517,6 +497,9 @@ public:
DoMeleeAttackIfReady();
}
+ private:
+ uint64 _playerGUID;
+ uint32 _despawnTimer;
};
CreatureAI* GetAI(Creature* creature) const
@@ -526,15 +509,21 @@ public:
};
/*Lightning Sentry - if you kill it when you have your Minion with you, you will get a quest credit*/
-enum eSentry
+enum Sentry
{
- QUEST_OR_MAYBE_WE_DONT_A = 12138,
- QUEST_OR_MAYBE_WE_DONT_H = 12198,
-
- NPC_LIGHTNING_SENTRY = 26407,
- NPC_WAR_GOLEM = 27017,
+ //Creature
+ NPC_LIGHTNING_SENTRY = 26407,
+ NPC_WAR_GOLEM = 27017,
+ // Quest
+ QUEST_OR_MAYBE_WE_DONT_A = 12138,
+ QUEST_OR_MAYBE_WE_DONT_H = 12198,
+ // Spell
+ SPELL_CHARGED_SENTRY_TOTEM = 52703
+};
- SPELL_CHARGED_SENTRY_TOTEM = 52703,
+enum SentryEvents
+{
+ EVENT_SENTRY = 1
};
class npc_lightning_sentry : public CreatureScript
@@ -542,34 +531,37 @@ class npc_lightning_sentry : public CreatureScript
public:
npc_lightning_sentry() : CreatureScript("npc_lightning_sentry") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_lightning_sentryAI(creature);
- }
-
struct npc_lightning_sentryAI : public ScriptedAI
{
npc_lightning_sentryAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 uiChargedSentryTotem;
-
void Reset()
{
- uiChargedSentryTotem = urand(10000, 12000);
+ _events.ScheduleEvent(EVENT_SENTRY, 4000);
}
- void UpdateAI(uint32 uiDiff)
+ void UpdateAI(uint32 diff)
{
if (!UpdateVictim())
return;
- if (uiChargedSentryTotem <= uiDiff)
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
{
- DoCast(SPELL_CHARGED_SENTRY_TOTEM);
- uiChargedSentryTotem = urand(10000, 12000);
+ switch (eventId)
+ {
+ case EVENT_WOODSMAN_1:
+ DoCast(SPELL_CHARGED_SENTRY_TOTEM);
+ _events.ScheduleEvent(EVENT_SENTRY, urand(10000, 12000));
+ break;
+ default:
+ break;
+ }
}
- else
- uiChargedSentryTotem -= uiDiff;
+
+ if (!UpdateVictim())
+ return;
DoMeleeAttackIfReady();
}
@@ -586,104 +578,113 @@ public:
}
}
}
+ private:
+ EventMap _events;
};
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_lightning_sentryAI(creature);
+ }
};
/*Venture co. Straggler - when you cast Smoke Bomb, he will yell and run away*/
-enum eSmokeEmOut
+enum SmokeEmOut
{
- SAY_SEO = 0,
+ // Quest
QUEST_SMOKE_EM_OUT_A = 12323,
QUEST_SMOKE_EM_OUT_H = 12324,
+ // Spell
SPELL_SMOKE_BOMB = 49075,
SPELL_CHOP = 43410,
SPELL_VENTURE_STRAGGLER_CREDIT = 49093,
+ // Text
+ SAY_SEO = 0
+};
+
+enum StragglerEvents
+{
+ EVENT_STRAGGLER_1 = 1,
+ EVENT_STRAGGLER_2 = 2,
+ EVENT_STRAGGLER_3 = 3,
+ EVENT_STRAGGLER_4 = 4,
+ EVENT_CHOP = 5
};
class npc_venture_co_straggler : public CreatureScript
{
- public:
- npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
+public:
+ npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
+
+ struct npc_venture_co_stragglerAI : public ScriptedAI
+ {
+ npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
- struct npc_venture_co_stragglerAI : public ScriptedAI
+ void Reset()
{
- npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
+ _playerGUID = 0;
- uint64 uiPlayerGUID;
- uint32 uiRunAwayTimer;
- uint32 uiTimer;
- uint32 uiChopTimer;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
- void Reset()
- {
- uiPlayerGUID = 0;
- uiTimer = 0;
- uiRunAwayTimer = 0;
- uiChopTimer = urand(10000, 12500);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_AGGRESSIVE);
- }
+ void UpdateAI(uint32 diff)
+ {
+ _events.Update(diff);
- void UpdateAI(uint32 uiDiff)
+ while (uint32 eventId = _events.ExecuteEvent())
{
- if (uiPlayerGUID && uiRunAwayTimer <= uiDiff)
+ switch (eventId)
{
- if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
- {
- switch (uiTimer)
- {
- case 0:
- DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 1:
- Talk(SAY_SEO);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 2:
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 3:
- me->DisappearAndDie();
- uiTimer = 0;
- break;
- }
- }
+ case EVENT_STRAGGLER_1:
+ if (Player* player = Unit::GetPlayer(*me, _playerGUID))
+ DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
+ _events.ScheduleEvent(EVENT_STRAGGLER_2, 2500);
+ break;
+ case EVENT_STRAGGLER_2:
+ Talk(SAY_SEO);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
+ _events.ScheduleEvent(EVENT_STRAGGLER_3, 2500);
+ break;
+ case EVENT_STRAGGLER_3:
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
+ _events.ScheduleEvent(EVENT_STRAGGLER_4, 2500);
+ break;
+ case EVENT_STRAGGLER_4:
+ me->DisappearAndDie();
+ break;
+ case EVENT_CHOP:
+ if (UpdateVictim())
+ DoCast(me->GetVictim(), SPELL_CHOP);
+ _events.ScheduleEvent(EVENT_CHOP, 10000, 12000);
+ break;
+ default:
+ break;
}
- else if (uiRunAwayTimer)
- uiRunAwayTimer -= uiDiff;
-
- if (!UpdateVictim())
- return;
+ }
- if (uiChopTimer <= uiDiff)
- {
- DoCast(me->GetVictim(), SPELL_CHOP);
- uiChopTimer = urand(10000, 12000);
- }
- else
- uiChopTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- DoMeleeAttackIfReady();
- }
+ DoMeleeAttackIfReady();
+ }
- void SpellHit(Unit* caster, SpellInfo const* spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
- {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_PASSIVE);
- me->CombatStop(false);
- uiPlayerGUID = caster->GetGUID();
- uiRunAwayTimer = 3500;
- }
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_PASSIVE);
+ me->CombatStop(false);
+ _playerGUID = caster->GetGUID();
+ _events.ScheduleEvent(EVENT_STRAGGLER_1, 3500);
}
+ }
+
+ private:
+ EventMap _events;
+ uint64 _playerGUID;
};
CreatureAI* GetAI(Creature* creature) const
@@ -693,26 +694,23 @@ class npc_venture_co_straggler : public CreatureScript
};
/*######
-## Quest A Blade Fit For A Champion
+## Quest: A Blade Fit For A Champion
######*/
enum LakeFrog
{
+ // Creature
+ NPC_LAKE_FROG = 33211,
+ NPC_LAKE_FROG_QUEST = 33224,
+ NPC_MAIDEN_OF_ASHWOOD_LAKE = 33220,
+ // Items
+ ITEM_WARTS_B_GONE_LIP_BALM = 44986,
// Spells
SPELL_WARTSBGONE_LIP_BALM = 62574,
SPELL_FROG_LOVE = 62537, // for 1 minute !
SPELL_WARTS = 62581,
SPELL_MAIDEN_OF_ASHWOOD_LAKE_TRANSFORM = 62550,
SPELL_SUMMON_ASHWOOD_BRAND = 62554,
-
- // Items
- ITEM_WARTS_B_GONE_LIP_BALM = 44986,
-
- // Creature
- NPC_LAKE_FROG = 33211,
- NPC_LAKE_FROG_QUEST = 33224,
- NPC_MAIDEN_OF_ASHWOOD_LAKE = 33220,
-
// Text
SAY_MAIDEN_0 = 0,
SAY_MAIDEN_1 = 1
@@ -720,17 +718,17 @@ enum LakeFrog
enum LakeFrogEvents
{
- EVENT_SCRIPT_1 = 1,
- EVENT_SCRIPT_2 = 2,
- EVENT_SCRIPT_3 = 3,
- EVENT_SCRIPT_4 = 4,
- EVENT_SCRIPT_5 = 5
+ EVENT_LAKEFROG_1 = 1,
+ EVENT_LAKEFROG_2 = 2,
+ EVENT_LAKEFROG_3 = 3,
+ EVENT_LAKEFROG_4 = 4,
+ EVENT_LAKEFROG_5 = 5
};
class npc_lake_frog : public CreatureScript
{
- public:
- npc_lake_frog() : CreatureScript("npc_lake_frog") { }
+public:
+ npc_lake_frog() : CreatureScript("npc_lake_frog") { }
struct npc_lake_frogAI : public ScriptedAI
{
@@ -756,24 +754,24 @@ class npc_lake_frog : public CreatureScript
{
switch (eventId)
{
- case EVENT_SCRIPT_1:
+ case EVENT_LAKEFROG_1:
DoCast(me, SPELL_MAIDEN_OF_ASHWOOD_LAKE_TRANSFORM);
me->SetEntry(NPC_MAIDEN_OF_ASHWOOD_LAKE);
- _events.ScheduleEvent(EVENT_SCRIPT_2, 2000);
+ _events.ScheduleEvent(EVENT_LAKEFROG_2, 2000);
break;
- case EVENT_SCRIPT_2:
+ case EVENT_LAKEFROG_2:
Talk(SAY_MAIDEN_0);
- _events.ScheduleEvent(EVENT_SCRIPT_3, 3000);
+ _events.ScheduleEvent(EVENT_LAKEFROG_3, 3000);
break;
- case EVENT_SCRIPT_3:
+ case EVENT_LAKEFROG_3:
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- _events.ScheduleEvent(EVENT_SCRIPT_4, 25000);
+ _events.ScheduleEvent(EVENT_LAKEFROG_4, 25000);
break;
- case EVENT_SCRIPT_4:
+ case EVENT_LAKEFROG_4:
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- _events.ScheduleEvent(EVENT_SCRIPT_5, 2000);
+ _events.ScheduleEvent(EVENT_LAKEFROG_5, 2000);
break;
- case EVENT_SCRIPT_5:
+ case EVENT_LAKEFROG_5:
Talk(SAY_MAIDEN_1);
me->DespawnOrUnsummon(4000);
break;
@@ -807,7 +805,7 @@ class npc_lake_frog : public CreatureScript
me->GetMotionMaster()->MoveIdle();
me->SetFacingToObject(player);
_runningScript = true;
- _events.ScheduleEvent(EVENT_SCRIPT_1, 2000);
+ _events.ScheduleEvent(EVENT_LAKEFROG_1, 2000);
}
}
}