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
+101 -107
View File
@@ -31,14 +31,16 @@ npc_clintar_spirit
npc_clintar_dreamwalker
EndContentData */
#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
/*######
## npc_bunthen_plainswind
######*/
enum eBunthen
enum Bunthen
{
QUEST_SEA_LION_HORDE = 30,
QUEST_SEA_LION_ALLY = 272,
@@ -218,70 +220,68 @@ public:
## npc_clintar_spirit
######*/
float Clintar_spirit_WP[41][5] =
float const Clintar_spirit_WP[41][5] =
{
//pos_x pos_y pos_z orien waitTime
{7465.28f, -3115.46f, 439.327f, 0.83f, 4000},
{7476.49f, -3101, 443.457f, 0.89f, 0},
{7486.57f, -3085.59f, 439.478f, 1.07f, 0},
{7472.19f, -3085.06f, 443.142f, 3.07f, 0},
{7456.92f, -3085.91f, 438.862f, 3.24f, 0},
{7446.68f, -3083.43f, 438.245f, 2.40f, 0},
{7446.17f, -3080.21f, 439.826f, 1.10f, 6000},
{7452.41f, -3085.8f, 438.984f, 5.78f, 0},
{7469.11f, -3084.94f, 443.048f, 6.25f, 0},
{7483.79f, -3085.44f, 439.607f, 6.25f, 0},
{7491.14f, -3090.96f, 439.983f, 5.44f, 0},
{7497.62f, -3098.22f, 436.854f, 5.44f, 0},
{7498.72f, -3113.41f, 434.596f, 4.84f, 0},
{7500.06f, -3122.51f, 434.749f, 5.17f, 0},
{7504.96f, -3131.53f, 434.475f, 4.74f, 0},
{7504.31f, -3133.53f, 435.693f, 3.84f, 6000},
{7504.55f, -3133.27f, 435.476f, 0.68f, 15000},
{7501.99f, -3126.01f, 434.93f, 1.83f, 0},
{7490.76f, -3114.97f, 434.431f, 2.51f, 0},
{7479.64f, -3105.51f, 431.123f, 1.83f, 0},
{7474.63f, -3086.59f, 428.994f, 1.83f, 2000},
{7472.96f, -3074.18f, 427.566f, 1.57f, 0},
{7472.25f, -3063, 428.268f, 1.55f, 0},
{7473.46f, -3054.22f, 427.588f, 0.36f, 0},
{7475.08f, -3053.6f, 428.653f, 0.36f, 6000},
{7474.66f, -3053.56f, 428.433f, 3.19f, 4000},
{7471.81f, -3058.84f, 427.073f, 4.29f, 0},
{7472.16f, -3064.91f, 427.772f, 4.95f, 0},
{7471.56f, -3085.36f, 428.924f, 4.72f, 0},
{7473.56f, -3093.48f, 429.294f, 5.04f, 0},
{7478.94f, -3104.29f, 430.638f, 5.23f, 0},
{7484.46f, -3109.61f, 432.769f, 5.79f, 0},
{7490.23f, -3111.08f, 434.431f, 0.02f, 0},
{7496.29f, -3108, 434.783f, 1.15f, 0},
{7497.46f, -3100.66f, 436.191f, 1.50f, 0},
{7495.64f, -3093.39f, 438.349f, 2.10f, 0},
{7492.44f, -3086.01f, 440.267f, 1.38f, 0},
{7498.26f, -3076.44f, 440.808f, 0.71f, 0},
{7506.4f, -3067.35f, 443.64f, 0.77f, 0},
{7518.37f, -3057.42f, 445.584f, 0.74f, 0},
{7517.51f, -3056.3f, 444.568f, 2.49f, 4500}
//pos_x pos_y pos_z orien waitTime
{7465.28f, -3115.46f, 439.327f, 0.83f, 4000},
{7476.49f, -3101, 443.457f, 0.89f, 0},
{7486.57f, -3085.59f, 439.478f, 1.07f, 0},
{7472.19f, -3085.06f, 443.142f, 3.07f, 0},
{7456.92f, -3085.91f, 438.862f, 3.24f, 0},
{7446.68f, -3083.43f, 438.245f, 2.40f, 0},
{7446.17f, -3080.21f, 439.826f, 1.10f, 6000},
{7452.41f, -3085.8f, 438.984f, 5.78f, 0},
{7469.11f, -3084.94f, 443.048f, 6.25f, 0},
{7483.79f, -3085.44f, 439.607f, 6.25f, 0},
{7491.14f, -3090.96f, 439.983f, 5.44f, 0},
{7497.62f, -3098.22f, 436.854f, 5.44f, 0},
{7498.72f, -3113.41f, 434.596f, 4.84f, 0},
{7500.06f, -3122.51f, 434.749f, 5.17f, 0},
{7504.96f, -3131.53f, 434.475f, 4.74f, 0},
{7504.31f, -3133.53f, 435.693f, 3.84f, 6000},
{7504.55f, -3133.27f, 435.476f, 0.68f, 15000},
{7501.99f, -3126.01f, 434.93f, 1.83f, 0},
{7490.76f, -3114.97f, 434.431f, 2.51f, 0},
{7479.64f, -3105.51f, 431.123f, 1.83f, 0},
{7474.63f, -3086.59f, 428.994f, 1.83f, 2000},
{7472.96f, -3074.18f, 427.566f, 1.57f, 0},
{7472.25f, -3063, 428.268f, 1.55f, 0},
{7473.46f, -3054.22f, 427.588f, 0.36f, 0},
{7475.08f, -3053.6f, 428.653f, 0.36f, 6000},
{7474.66f, -3053.56f, 428.433f, 3.19f, 4000},
{7471.81f, -3058.84f, 427.073f, 4.29f, 0},
{7472.16f, -3064.91f, 427.772f, 4.95f, 0},
{7471.56f, -3085.36f, 428.924f, 4.72f, 0},
{7473.56f, -3093.48f, 429.294f, 5.04f, 0},
{7478.94f, -3104.29f, 430.638f, 5.23f, 0},
{7484.46f, -3109.61f, 432.769f, 5.79f, 0},
{7490.23f, -3111.08f, 434.431f, 0.02f, 0},
{7496.29f, -3108, 434.783f, 1.15f, 0},
{7497.46f, -3100.66f, 436.191f, 1.50f, 0},
{7495.64f, -3093.39f, 438.349f, 2.10f, 0},
{7492.44f, -3086.01f, 440.267f, 1.38f, 0},
{7498.26f, -3076.44f, 440.808f, 0.71f, 0},
{7506.4f, -3067.35f, 443.64f, 0.77f, 0},
{7518.37f, -3057.42f, 445.584f, 0.74f, 0},
{7517.51f, -3056.3f, 444.568f, 2.49f, 4500}
};
#define ASPECT_RAVEN 22915
Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f};
Position const ClintarSpiritSummon = {7459.2275f, -3122.5632f, 438.9842f, 0.8594f};
#define ASPECT_RAVEN_SUMMON_X 7472.96f
#define ASPECT_RAVEN_SUMMON_Y -3074.18f
#define ASPECT_RAVEN_SUMMON_Z 427.566f
#define CLINTAR_SPIRIT_SUMMON_X 7459.2275f
#define CLINTAR_SPIRIT_SUMMON_Y -3122.5632f
#define CLINTAR_SPIRIT_SUMMON_Z 438.9842f
#define CLINTAR_SPIRIT_SUMMON_O 0.8594f
enum ClintarSpirit
{
ASPECT_RAVEN = 22915,
//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong.
#define CLINTAR_SPIRIT_SAY_START -1000286
#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 -1000287
#define CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 -1000288
#define CLINTAR_SPIRIT_SAY_GET_ONE -1000289
#define CLINTAR_SPIRIT_SAY_GET_TWO -1000290
#define CLINTAR_SPIRIT_SAY_GET_THREE -1000291
#define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292
//from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong.
CLINTAR_SPIRIT_SAY_START = -1000286,
CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287,
CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288,
CLINTAR_SPIRIT_SAY_GET_ONE = -1000289,
CLINTAR_SPIRIT_SAY_GET_TWO = -1000290,
CLINTAR_SPIRIT_SAY_GET_THREE = -1000291,
CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292
};
class npc_clintar_spirit : public CreatureScript
{
@@ -298,14 +298,14 @@ public:
public:
npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {}
uint32 Step;
uint8 Step;
uint32 CurrWP;
uint32 Event_Timer;
uint32 checkPlayer_Timer;
uint32 EventTimer;
uint32 checkPlayerTimer;
uint64 PlayerGUID;
bool Event_onWait;
bool EventOnWait;
void Reset()
{
@@ -313,10 +313,10 @@ public:
{
Step = 0;
CurrWP = 0;
Event_Timer = 0;
EventTimer = 0;
PlayerGUID = 0;
checkPlayer_Timer = 1000;
Event_onWait = false;
checkPlayerTimer = 1000;
EventOnWait = false;
}
}
@@ -347,8 +347,7 @@ public:
void EnterCombat(Unit* who)
{
uint32 rnd = rand()%2;
switch (rnd)
switch (urand(0, 1))
{
case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break;
case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break;
@@ -357,9 +356,7 @@ public:
void StartEvent(Player* player)
{
if (!player)
return;
if (player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
{
for (uint8 i = 0; i < 41; ++i)
{
@@ -381,18 +378,18 @@ public:
return;
}
if (!me->isInCombat() && !Event_onWait)
if (!me->isInCombat() && !EventOnWait)
{
if (checkPlayer_Timer <= diff)
if (checkPlayerTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player && player->isInCombat() && player->getAttackerForHelper())
AttackStart(player->getAttackerForHelper());
checkPlayer_Timer = 1000;
} else checkPlayer_Timer -= diff;
checkPlayerTimer = 1000;
} else checkPlayerTimer -= diff;
}
if (Event_onWait && Event_Timer <= diff)
if (EventOnWait && EventTimer <= diff)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
@@ -409,11 +406,11 @@ public:
{
case 0:
me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID);
Event_Timer = 8000;
EventTimer = 8000;
Step = 1;
break;
case 1:
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -422,13 +419,13 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
Event_Timer = 5000;
EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player);
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -437,12 +434,12 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
Event_Timer = 5000;
EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -451,11 +448,11 @@ public:
{
case 0:
DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player);
Event_Timer = 15000;
EventTimer = 15000;
Step = 1;
break;
case 1:
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -463,19 +460,16 @@ public:
switch (Step)
{
case 0:
{
Creature* mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000);
if (mob)
if (Creature* mob = me->SummonCreature(ASPECT_RAVEN, AspectRavenSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000))
{
mob->AddThreat(me, 10000.0f);
mob->AI()->AttackStart(me);
}
Event_Timer = 2000;
EventTimer = 2000;
Step = 1;
break;
}
case 1:
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -484,12 +478,12 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133);
Event_Timer = 5000;
EventTimer = 5000;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -498,11 +492,11 @@ public:
{
case 0:
DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player);
Event_Timer = 4000;
EventTimer = 4000;
Step = 1;
break;
case 1:
Event_onWait = false;
EventOnWait = false;
break;
}
break;
@@ -513,12 +507,12 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2);
DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player);
player->CompleteQuest(10965);
Event_Timer = 1500;
EventTimer = 1500;
Step = 1;
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
Event_Timer = 3000;
EventTimer = 3000;
Step = 2;
break;
case 2:
@@ -530,19 +524,19 @@ public:
}
break;
default:
Event_onWait = false;
EventOnWait = false;
break;
}
} else if (Event_onWait) Event_Timer -= diff;
} else if (EventOnWait) EventTimer -= diff;
}
void WaypointReached(uint32 waypointId)
{
CurrWP = waypointId;
Event_Timer = 0;
EventTimer = 0;
Step = 0;
Event_onWait = true;
EventOnWait = true;
}
};
@@ -552,7 +546,10 @@ public:
# npc_clintar_dreamwalker
####*/
#define CLINTAR_SPIRIT 22916
enum Clintar
{
CLINTAR_SPIRIT = 22916
};
class npc_clintar_dreamwalker : public CreatureScript
{
@@ -562,11 +559,8 @@ public:
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
{
if (quest->GetQuestId() == 10965)
{
Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000);
if (clintar_spirit)
if (Creature* clintar_spirit = creature->SummonCreature(CLINTAR_SPIRIT, ClintarSpiritSummon, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000))
CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(player);
}
return true;
}