aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms/wetlands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/EasternKingdoms/wetlands.cpp')
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp162
1 files changed, 83 insertions, 79 deletions
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index 084b673dacd..bfac81a4ba0 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -44,111 +44,124 @@ enum eTapokeSlim
NPC_SLIMS_FRIEND = 4971,
NPC_TAPOKE_SLIM_JAHN = 4962
};
-
-struct npc_tapoke_slim_jahnAI : public npc_escortAI
+ class npc_tapoke_slim_jahn : public CreatureScript
{
- npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { }
-
- bool m_bFriendSummoned;
+public:
+ npc_tapoke_slim_jahn() : CreatureScript("npc_tapoke_slim_jahn") { }
- void Reset()
+ CreatureAI* GetAI(Creature* pCreature) const
{
- if (!HasEscortState(STATE_ESCORT_ESCORTING))
- m_bFriendSummoned = false;
+ return new npc_tapoke_slim_jahnAI(pCreature);
}
- void WaypointReached(uint32 uiPointId)
+ struct npc_tapoke_slim_jahnAI : public npc_escortAI
{
- switch(uiPointId)
- {
- case 2:
- if (me->HasStealthAura())
- me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { }
- SetRun();
- me->setFaction(FACTION_ENEMY);
- break;
+ bool m_bFriendSummoned;
+
+ void Reset()
+ {
+ if (!HasEscortState(STATE_ESCORT_ESCORTING))
+ m_bFriendSummoned = false;
}
- }
- void EnterCombat(Unit* /*pWho*/)
- {
- Player* pPlayer = GetPlayerForEscort();
+ void WaypointReached(uint32 uiPointId)
+ {
+ switch(uiPointId)
+ {
+ case 2:
+ if (me->HasStealthAura())
+ me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+
+ SetRun();
+ me->setFaction(FACTION_ENEMY);
+ break;
+ }
+ }
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer)
+ void EnterCombat(Unit* /*pWho*/)
{
- for (uint8 i = 0; i < 3; ++i)
- DoCast(me, SPELL_CALL_FRIENDS, true);
+ Player* pPlayer = GetPlayerForEscort();
- m_bFriendSummoned = true;
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ DoCast(me, SPELL_CALL_FRIENDS, true);
+
+ m_bFriendSummoned = true;
+ }
}
- }
- void JustSummoned(Creature* pSummoned)
- {
- if (Player* pPlayer = GetPlayerForEscort())
- pSummoned->AI()->AttackStart(pPlayer);
- }
+ void JustSummoned(Creature* pSummoned)
+ {
+ if (Player* pPlayer = GetPlayerForEscort())
+ pSummoned->AI()->AttackStart(pPlayer);
+ }
- void AttackedBy(Unit* pAttacker)
- {
- if (me->getVictim())
- return;
+ void AttackedBy(Unit* pAttacker)
+ {
+ if (me->getVictim())
+ return;
- if (me->IsFriendlyTo(pAttacker))
- return;
+ if (me->IsFriendlyTo(pAttacker))
+ return;
- AttackStart(pAttacker);
- }
+ AttackStart(pAttacker);
+ }
- void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage)
- {
- if (me->GetHealth()*100 < me->GetMaxHealth()*20)
+ void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage)
{
- if (Player* pPlayer = GetPlayerForEscort())
+ if (me->GetHealth()*100 < me->GetMaxHealth()*20)
{
- if (pPlayer->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me);
+ if (Player* pPlayer = GetPlayerForEscort())
+ {
+ if (pPlayer->GetTypeId() == TYPEID_PLAYER)
+ CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me);
- uiDamage = 0;
+ uiDamage = 0;
- me->RestoreFaction();
- me->RemoveAllAuras();
- me->DeleteThreatList();
- me->CombatStop(true);
+ me->RestoreFaction();
+ me->RemoveAllAuras();
+ me->DeleteThreatList();
+ me->CombatStop(true);
- SetRun(false);
+ SetRun(false);
+ }
}
}
- }
+ };
+
};
-CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature)
-{
- return new npc_tapoke_slim_jahnAI(pCreature);
-}
/*######
## npc_mikhail
######*/
-
-bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
+ class npc_mikhail : public CreatureScript
{
- if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11)
+public:
+ npc_mikhail() : CreatureScript("npc_mikhail") { }
+
+ bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
- Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f);
+ if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11)
+ {
+ Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f);
- if (!pSlim)
- return false;
+ if (!pSlim)
+ return false;
- if (!pSlim->HasStealthAura())
- pSlim->CastSpell(pSlim, SPELL_STEALTH, true);
+ if (!pSlim->HasStealthAura())
+ pSlim->CastSpell(pSlim, SPELL_STEALTH, true);
- if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI()))
- pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
+ if (npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI, pSlim->AI()))
+ pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
+ }
+ return false;
}
- return false;
-}
+
+};
/*######
## AddSC
@@ -156,15 +169,6 @@ bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest*
void AddSC_wetlands()
{
- Script *newscript;
-
- newscript = new Script;
- newscript->Name = "npc_tapoke_slim_jahn";
- newscript->GetAI = &GetAI_npc_tapoke_slim_jahn;
- newscript->RegisterSelf();
-
- newscript = new Script;
- newscript->Name = "npc_mikhail";
- newscript->pQuestAccept = &QuestAccept_npc_mikhail;
- newscript->RegisterSelf();
+ new npc_tapoke_slim_jahn();
+ new npc_mikhail();
}