Scripts/kalimdor: Use proper headers to optimize compile, code style and general cleanup.

Closes #6419 (pr)
This commit is contained in:
4m1g0
2012-05-19 15:11:09 +01:00
committed by Nay
parent 9474902479
commit 524e30e57b
27 changed files with 1114 additions and 1080 deletions
+106 -90
View File
@@ -28,7 +28,8 @@ npc_torek
npc_ruul_snowhoof
EndContentData */
#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
/*####
@@ -78,32 +79,31 @@ class npc_torek : public CreatureScript
void WaypointReached(uint32 waypointId)
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
if (Player* player = GetPlayerForEscort())
{
case 1:
Talk(SAY_MOVE, player->GetGUID());
break;
case 8:
Talk(SAY_PREPARE, player->GetGUID());
break;
case 19:
//TODO: verify location and creatures amount.
me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 20:
DoScriptText(SAY_WIN, me, player);
Completed = true;
player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
break;
case 21:
Talk(SAY_END, player->GetGUID());
break;
switch (waypointId)
{
case 1:
Talk(SAY_MOVE, player->GetGUID());
break;
case 8:
Talk(SAY_PREPARE, player->GetGUID());
break;
case 19:
//TODO: verify location and creatures amount.
me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 20:
DoScriptText(SAY_WIN, me, player);
Completed = true;
player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
break;
case 21:
Talk(SAY_END, player->GetGUID());
break;
}
}
}
@@ -169,8 +169,26 @@ class npc_torek : public CreatureScript
# npc_ruul_snowhoof
####*/
#define QUEST_FREEDOM_TO_RUUL 6482
#define GO_CAGE 178147
enum RuulSnowhoof
{
NPC_THISTLEFUR_URSA = 3921,
NPC_THISTLEFUR_TOTEMIC = 3922,
NPC_THISTLEFUR_PATHFINDER = 3926,
QUEST_FREEDOM_TO_RUUL = 6482,
GO_CAGE = 178147
};
Position const RuulSnowhoofSummonsCoord[6] =
{
{3449.218018f, -587.825073f, 174.978867f, 4.714445f},
{3446.384521f, -587.830872f, 175.186279f, 4.714445f},
{3444.218994f, -587.835327f, 175.380600f, 4.714445f},
{3508.344482f, -492.024261f, 186.929031f, 4.145029f},
{3506.265625f, -490.531006f, 186.740128f, 4.239277f},
{3503.682373f, -489.393799f, 186.629684f, 4.349232f}
};
class npc_ruul_snowhoof : public CreatureScript
{
@@ -195,14 +213,14 @@ class npc_ruul_snowhoof : public CreatureScript
Cage->SetGoState(GO_STATE_ACTIVE);
break;
case 13:
me->SummonCreature(3922, 3449.218018f, -587.825073f, 174.978867f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3921, 3446.384521f, -587.830872f, 175.186279f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3926, 3444.218994f, -587.835327f, 175.380600f, 4.714445f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[0], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[1], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[2], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 19:
me->SummonCreature(3922, 3508.344482f, -492.024261f, 186.929031f, 4.145029f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3921, 3506.265625f, -490.531006f, 186.740128f, 4.239277f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(3926, 3503.682373f, -489.393799f, 186.629684f, 4.349232f, TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_TOTEMIC, RuulSnowhoofSummonsCoord[3], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_URSA, RuulSnowhoofSummonsCoord[4], TEMPSUMMON_DEAD_DESPAWN, 60000);
me->SummonCreature(NPC_THISTLEFUR_PATHFINDER, RuulSnowhoofSummonsCoord[5], TEMPSUMMON_DEAD_DESPAWN, 60000);
break;
case 21:
player->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, me);
@@ -214,8 +232,7 @@ class npc_ruul_snowhoof : public CreatureScript
void Reset()
{
GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20);
if (Cage)
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_READY);
}
@@ -249,7 +266,7 @@ class npc_ruul_snowhoof : public CreatureScript
}
};
enum eEnums
enum Muglash
{
SAY_MUG_START1 = -1800054,
SAY_MUG_START2 = -1800055,
@@ -278,21 +295,21 @@ enum eEnums
NPC_MUGLASH = 12717
};
static float m_afFirstNagaCoord[3][3]=
Position const FirstNagaCoord[3] =
{
{3603.504150f, 1122.631104f, 1.635f}, // rider
{3589.293945f, 1148.664063f, 5.565f}, // sorceress
{3609.925537f, 1168.759521f, -1.168f} // razortail
{3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider
{3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress
{3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail
};
static float m_afSecondNagaCoord[3][3]=
Position const SecondNagaCoord[3] =
{
{3609.925537f, 1168.759521f, -1.168f}, // witch
{3645.652100f, 1139.425415f, 1.322f}, // priest
{3583.602051f, 1128.405762f, 2.347f} // myrmidon
{3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch
{3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest
{3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon
};
static float m_fVorshaCoord[]={3633.056885f, 1172.924072f, -5.388f};
Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f};
class npc_muglash : public CreatureScript
{
@@ -303,9 +320,9 @@ class npc_muglash : public CreatureScript
{
npc_muglashAI(Creature* creature) : npc_escortAI(creature) { }
uint32 m_uiWaveId;
uint32 m_uiEventTimer;
bool m_bIsBrazierExtinguished;
uint8 WaveId;
uint32 EventTimer;
bool IsBrazierExtinguished;
void JustSummoned(Creature* summoned)
{
@@ -314,34 +331,33 @@ class npc_muglash : public CreatureScript
void WaypointReached(uint32 waypointId)
{
Player* player = GetPlayerForEscort();
switch (waypointId)
if (Player* player = GetPlayerForEscort())
{
case 0:
if (player)
switch (waypointId)
{
case 0:
DoScriptText(SAY_MUG_START2, me, player);
break;
case 24:
if (player)
break;
case 24:
DoScriptText(SAY_MUG_BRAZIER, me, player);
if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
{
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
SetEscortPaused(true);
}
break;
case 25:
DoScriptText(SAY_MUG_GRATITUDE, me);
player->GroupEventHappens(QUEST_VORSHA, me);
break;
case 26:
DoScriptText(SAY_MUG_PATROL, me);
break;
case 27:
DoScriptText(SAY_MUG_RETURN, me);
break;
if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
{
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
SetEscortPaused(true);
}
break;
case 25:
DoScriptText(SAY_MUG_GRATITUDE, me);
player->GroupEventHappens(QUEST_VORSHA, me);
break;
case 26:
DoScriptText(SAY_MUG_PATROL, me);
break;
case 27:
DoScriptText(SAY_MUG_RETURN, me);
break;
}
}
}
@@ -358,9 +374,9 @@ class npc_muglash : public CreatureScript
void Reset()
{
m_uiEventTimer = 10000;
m_uiWaveId = 0;
m_bIsBrazierExtinguished = false;
EventTimer = 10000;
WaveId = 0;
IsBrazierExtinguished = false;
}
void JustDied(Unit* /*killer*/)
@@ -372,20 +388,20 @@ class npc_muglash : public CreatureScript
void DoWaveSummon()
{
switch (m_uiWaveId)
switch (WaveId)
{
case 1:
me->SummonCreature(NPC_WRATH_RIDER, m_afFirstNagaCoord[0][0], m_afFirstNagaCoord[0][1], m_afFirstNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_SORCERESS, m_afFirstNagaCoord[1][0], m_afFirstNagaCoord[1][1], m_afFirstNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_RAZORTAIL, m_afFirstNagaCoord[2][0], m_afFirstNagaCoord[2][1], m_afFirstNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_RIDER, FirstNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_SORCERESS, FirstNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_RAZORTAIL, FirstNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 2:
me->SummonCreature(NPC_WRATH_PRIESTESS, m_afSecondNagaCoord[0][0], m_afSecondNagaCoord[0][1], m_afSecondNagaCoord[0][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_MYRMIDON, m_afSecondNagaCoord[1][0], m_afSecondNagaCoord[1][1], m_afSecondNagaCoord[1][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_SEAWITCH, m_afSecondNagaCoord[2][0], m_afSecondNagaCoord[2][1], m_afSecondNagaCoord[2][2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_PRIESTESS, SecondNagaCoord[0], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_MYRMIDON, SecondNagaCoord[1], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_WRATH_SEAWITCH, SecondNagaCoord[2], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 3:
me->SummonCreature(NPC_VORSHA, m_fVorshaCoord[0], m_fVorshaCoord[1], m_fVorshaCoord[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
me->SummonCreature(NPC_VORSHA, VorshaCoord, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
break;
case 4:
SetEscortPaused(false);
@@ -400,16 +416,16 @@ class npc_muglash : public CreatureScript
if (!me->getVictim())
{
if (HasEscortState(STATE_ESCORT_PAUSED) && m_bIsBrazierExtinguished)
if (HasEscortState(STATE_ESCORT_PAUSED) && IsBrazierExtinguished)
{
if (m_uiEventTimer < uiDiff)
if (EventTimer < uiDiff)
{
++m_uiWaveId;
++WaveId;
DoWaveSummon();
m_uiEventTimer = 10000;
EventTimer = 10000;
}
else
m_uiEventTimer -= uiDiff;
EventTimer -= uiDiff;
}
return;
}
@@ -451,7 +467,7 @@ class go_naga_brazier : public GameObjectScript
{
DoScriptText(SAY_MUG_BRAZIER_WAIT, creature);
pEscortAI->m_bIsBrazierExtinguished = true;
pEscortAI->IsBrazierExtinguished = true;
return false;
}
}