aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
authorMalcrom <malcromdev@gmail.com>2013-12-24 17:56:38 -0330
committerMalcrom <malcromdev@gmail.com>2013-12-24 17:56:38 -0330
commitb8e626199c9a894464eb7a71f030e8c6d75348cf (patch)
tree88a1fecb2f67609f6624b0f4c76ccde625e899ac /src/server/scripts/EasternKingdoms
parent20a2b691785b66a8a265f691c5ffd8affd6298f0 (diff)
Scripting/Multi: Some cleanup.
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/zone_hinterlands.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp117
-rw-r--r--src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp74
3 files changed, 100 insertions, 107 deletions
diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
index 5399e0c858e..718e69f78f0 100644
--- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp
@@ -24,7 +24,7 @@ SDCategory: The Hinterlands
EndScriptData */
/* ContentData
-npc_00x09hl
+npc_oox09hl
npc_rinji
EndContentData */
@@ -34,7 +34,7 @@ EndContentData */
#include "Player.h"
/*######
-## npc_00x09hl
+## npc_oox09hl
######*/
enum OOX
@@ -51,14 +51,14 @@ enum OOX
FACTION_ESCORTEE_H = 775
};
-class npc_00x09hl : public CreatureScript
+class npc_oox09hl : public CreatureScript
{
public:
- npc_00x09hl() : CreatureScript("npc_00x09hl") { }
+ npc_oox09hl() : CreatureScript("npc_oox09hl") { }
- struct npc_00x09hlAI : public npc_escortAI
+ struct npc_oox09hlAI : public npc_escortAI
{
- npc_00x09hlAI(Creature* creature) : npc_escortAI(creature) { }
+ npc_oox09hlAI(Creature* creature) : npc_escortAI(creature) { }
void Reset() OVERRIDE { }
@@ -132,7 +132,7 @@ public:
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
- return new npc_00x09hlAI(creature);
+ return new npc_oox09hlAI(creature);
}
};
@@ -329,6 +329,6 @@ public:
void AddSC_hinterlands()
{
- new npc_00x09hl();
+ new npc_oox09hl();
new npc_rinji();
}
diff --git a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
index 604d51f9d8f..8369c3c5560 100644
--- a/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_redridge_mountains.cpp
@@ -29,15 +29,13 @@ Script Data End */
enum CorporalKeeshan
{
QUEST_MISSING_IN_ACTION = 219,
-
- SAY_CORPORAL_1 = 0,
- SAY_CORPORAL_2 = 1,
- SAY_CORPORAL_3 = 2,
- SAY_CORPORAL_4 = 3,
- SAY_CORPORAL_5 = 4,
-
- SPELL_MOCKING_BLOW = 21008,
- SPELL_SHIELD_BASH = 11972,
+ SAY_CORPORAL_1 = 0,
+ SAY_CORPORAL_2 = 1,
+ SAY_CORPORAL_3 = 2,
+ SAY_CORPORAL_4 = 3,
+ SAY_CORPORAL_5 = 4,
+ SPELL_MOCKING_BLOW = 21008,
+ SPELL_SHIELD_BASH = 11972
};
class npc_corporal_keeshan : public CreatureScript
@@ -45,37 +43,25 @@ class npc_corporal_keeshan : public CreatureScript
public:
npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { }
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
- {
- if (quest->GetQuestId() == QUEST_MISSING_IN_ACTION)
- {
- CAST_AI(npc_corporal_keeshan::npc_corporal_keeshanAI, creature->AI())->Start(true, false, player->GetGUID(), quest);
- creature->AI()->Talk(SAY_CORPORAL_1);
- }
-
- return false;
- }
-
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return new npc_corporal_keeshanAI(creature);
- }
-
struct npc_corporal_keeshanAI : public npc_escortAI
{
npc_corporal_keeshanAI(Creature* creature) : npc_escortAI(creature) { }
- uint32 uiPhase;
- uint32 uiTimer;
- uint32 uiMockingBlowTimer;
- uint32 uiShieldBashTimer;
-
void Reset() OVERRIDE
{
- uiTimer = 0;
- uiPhase = 0;
- uiMockingBlowTimer = 5000;
- uiShieldBashTimer = 8000;
+ timer = 0;
+ phase = 0;
+ mockingBlowTimer = 5000;
+ shieldBashTimer = 8000;
+ }
+
+ void sQuestAccept(Player* player, Quest const* quest)
+ {
+ if (quest->GetQuestId() == QUEST_MISSING_IN_ACTION)
+ {
+ Talk(SAY_CORPORAL_1, player);
+ npc_escortAI::Start(true, false, player->GetGUID(), quest);
+ }
}
void WaypointReached(uint32 waypointId) OVERRIDE
@@ -91,82 +77,93 @@ public:
{
case 39:
SetEscortPaused(true);
- uiTimer = 2000;
- uiPhase = 1;
+ timer = 2000;
+ phase = 1;
break;
case 65:
me->SetWalk(false);
break;
case 115:
player->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION);
- uiTimer = 2000;
- uiPhase = 4;
+ timer = 2000;
+ phase = 4;
break;
}
}
- void UpdateAI(uint32 uiDiff) OVERRIDE
+ void UpdateAI(uint32 diff) OVERRIDE
{
if (HasEscortState(STATE_ESCORT_NONE))
return;
- npc_escortAI::UpdateAI(uiDiff);
+ npc_escortAI::UpdateAI(diff);
- if (uiPhase)
+ if (phase)
{
- if (uiTimer <= uiDiff)
+ if (timer <= diff)
{
- switch (uiPhase)
+ switch (phase)
{
case 1:
me->SetStandState(UNIT_STAND_STATE_SIT);
- uiTimer = 1000;
- uiPhase = 2;
+ timer = 1000;
+ phase = 2;
break;
case 2:
Talk(SAY_CORPORAL_2);
- uiTimer = 15000;
- uiPhase = 3;
+ timer = 15000;
+ phase = 3;
break;
case 3:
Talk(SAY_CORPORAL_3);
me->SetStandState(UNIT_STAND_STATE_STAND);
SetEscortPaused(false);
- uiTimer = 0;
- uiPhase = 0;
+ timer = 0;
+ phase = 0;
break;
case 4:
Talk(SAY_CORPORAL_4);
- uiTimer = 2500;
- uiPhase = 5;
+ timer = 2500;
+ phase = 5;
break;
case 5:
Talk(SAY_CORPORAL_5);
- uiTimer = 0;
- uiPhase = 0;
+ timer = 0;
+ phase = 0;
break;
}
- } else uiTimer -= uiDiff;
+ } else timer -= diff;
}
if (!UpdateVictim())
return;
- if (uiMockingBlowTimer <= uiDiff)
+ if (mockingBlowTimer <= diff)
{
DoCastVictim(SPELL_MOCKING_BLOW);
- uiMockingBlowTimer = 5000;
- } else uiMockingBlowTimer -= uiDiff;
+ mockingBlowTimer = 5000;
+ } else mockingBlowTimer -= diff;
- if (uiShieldBashTimer <= uiDiff)
+ if (shieldBashTimer <= diff)
{
DoCastVictim(SPELL_MOCKING_BLOW);
- uiShieldBashTimer = 8000;
- } else uiShieldBashTimer -= uiDiff;
+ shieldBashTimer = 8000;
+ } else shieldBashTimer -= diff;
DoMeleeAttackIfReady();
}
+
+ private:
+ uint32 phase;
+ uint32 timer;
+ uint32 mockingBlowTimer;
+ uint32 shieldBashTimer;
};
+
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new npc_corporal_keeshanAI(creature);
+ }
};
void AddSC_redridge_mountains()
diff --git a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
index 666ba8e592e..740200d3fdc 100644
--- a/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_swamp_of_sorrows.cpp
@@ -28,53 +28,31 @@
enum Galen
{
QUEST_GALENS_ESCAPE = 1393,
-
GO_GALENS_CAGE = 37118,
-
SAY_PERIODIC = 0,
SAY_QUEST_ACCEPTED = 1,
SAY_ATTACKED = 2,
SAY_QUEST_COMPLETE = 3,
EMOTE_WHISPER = 4,
- EMOTE_DISAPPEAR = 5,
+ EMOTE_DISAPPEAR = 5
};
class npc_galen_goodward : public CreatureScript
{
public:
-
npc_galen_goodward() : CreatureScript("npc_galen_goodward") { }
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
- {
- if (quest->GetQuestId() == QUEST_GALENS_ESCAPE)
- {
- CAST_AI(npc_galen_goodward::npc_galen_goodwardAI, creature->AI())->Start(false, false, player->GetGUID());
- creature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
- creature->AI()->Talk(SAY_QUEST_ACCEPTED);
- }
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const OVERRIDE
- {
- return new npc_galen_goodwardAI(creature);
- }
-
struct npc_galen_goodwardAI : public npc_escortAI
{
npc_galen_goodwardAI(Creature* creature) : npc_escortAI(creature)
{
- m_uiGalensCageGUID = 0;
+ galensCageGUID = 0;
Reset();
}
- uint64 m_uiGalensCageGUID;
- uint32 m_uiPeriodicSay;
-
void Reset() OVERRIDE
{
- m_uiPeriodicSay = 6000;
+ periodicSay = 6000;
}
void EnterCombat(Unit* who) OVERRIDE
@@ -83,21 +61,30 @@ public:
Talk(SAY_ATTACKED, who);
}
+ void sQuestAccept(Player* player, Quest const* quest)
+ {
+ if (quest->GetQuestId() == QUEST_GALENS_ESCAPE)
+ {
+ Talk(SAY_QUEST_ACCEPTED, player);
+ npc_escortAI::Start(false, false, player->GetGUID(), quest);
+ }
+ }
+
void WaypointStart(uint32 uiPointId) OVERRIDE
{
switch (uiPointId)
{
case 0:
{
- GameObject* pCage = NULL;
- if (m_uiGalensCageGUID)
- pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID);
+ GameObject* cage = NULL;
+ if (galensCageGUID)
+ cage = me->GetMap()->GetGameObject(galensCageGUID);
else
- pCage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
- if (pCage)
+ cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE);
+ if (cage)
{
- pCage->UseDoorOrButton();
- m_uiGalensCageGUID = pCage->GetGUID();
+ cage->UseDoorOrButton();
+ galensCageGUID = cage->GetGUID();
}
break;
}
@@ -112,8 +99,8 @@ public:
switch (waypointId)
{
case 0:
- if (GameObject* pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID))
- pCage->ResetDoorOrButton();
+ if (GameObject* cage = me->GetMap()->GetGameObject(galensCageGUID))
+ cage->ResetDoorOrButton();
break;
case 20:
if (Player* player = GetPlayerForEscort())
@@ -128,25 +115,34 @@ public:
}
}
- void UpdateAI(uint32 uiDiff) OVERRIDE
+ void UpdateAI(uint32 diff) OVERRIDE
{
- npc_escortAI::UpdateAI(uiDiff);
+ npc_escortAI::UpdateAI(diff);
if (HasEscortState(STATE_ESCORT_NONE))
return;
- if (m_uiPeriodicSay < uiDiff)
+ if (periodicSay < diff)
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
Talk(SAY_PERIODIC);
- m_uiPeriodicSay = 15000;
+ periodicSay = 15000;
}
else
- m_uiPeriodicSay -= uiDiff;
+ periodicSay -= diff;
DoMeleeAttackIfReady();
}
+
+ private:
+ uint64 galensCageGUID;
+ uint32 periodicSay;
};
+
+ CreatureAI* GetAI(Creature* creature) const OVERRIDE
+ {
+ return new npc_galen_goodwardAI(creature);
+ }
};
void AddSC_swamp_of_sorrows()