Core/Scripts: Applied some Coding Standards.

--HG--
branch : trunk
This commit is contained in:
_manuel_
2010-10-21 23:24:12 -03:00
parent a1319a2020
commit 4ab3b63646
3 changed files with 73 additions and 64 deletions
@@ -63,59 +63,60 @@ class boss_archaedas : public CreatureScript
struct boss_archaedasAI : public ScriptedAI struct boss_archaedasAI : public ScriptedAI
{ {
boss_archaedasAI(Creature *c) : ScriptedAI(c) boss_archaedasAI(Creature* pCreature) : ScriptedAI(pCreature)
{ {
pInstance = me->GetInstanceScript(); pInstance = me->GetInstanceScript();
} }
uint32 uiTremorTimer; uint32 uiTremorTimer;
int32 iAwakenTimer; int32 iAwakenTimer;
uint32 WallMinionTimer; uint32 uiWallMinionTimer;
bool bWakingUp; bool bWakingUp;
bool guardiansAwake; bool bGuardiansAwake;
bool vaultWalkersAwake; bool bVaultWalkersAwake;
InstanceScript* pInstance; InstanceScript* pInstance;
void Reset() void Reset()
{ {
uiTremorTimer = 60000; uiTremorTimer = 60000;
iAwakenTimer = 0; iAwakenTimer = 0;
WallMinionTimer = 10000; uiWallMinionTimer = 10000;
bWakingUp = false; bWakingUp = false;
guardiansAwake = false; bGuardiansAwake = false;
vaultWalkersAwake = false; bVaultWalkersAwake = false;
if (pInstance) if (pInstance)
pInstance->SetData (NULL, 5); // respawn any dead minions pInstance->SetData(NULL, 5); // respawn any dead minions
me->setFaction(35); me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
} }
void ActivateMinion (uint64 guid, bool flag) void ActivateMinion(uint64 uiGuid, bool bFlag)
{ {
Unit *minion = Unit::GetUnit(*me, guid); Unit* pMinion = Unit::GetUnit(*me, uiGuid);
if (minion && minion->isAlive()) if (pMinion && pMinion->isAlive())
{ {
DoCast (minion, SPELL_AWAKEN_VAULT_WALKER, flag); DoCast(pMinion, SPELL_AWAKEN_VAULT_WALKER, bFlag);
minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN,true); pMinion->CastSpell(pMinion, SPELL_ARCHAEDAS_AWAKEN,true);
} }
} }
void EnterCombat(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
me->setFaction (14); me->setFaction(14);
me->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag (UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
} }
void SpellHit (Unit* /*caster*/, const SpellEntry *spell) void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
{ {
// Being woken up from the altar, start the awaken sequence // Being woken up from the altar, start the awaken sequence
if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN)) { if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
{
me->MonsterYell(SAY_AGGRO,LANG_UNIVERSAL,NULL); me->MonsterYell(SAY_AGGRO,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(me,SOUND_AGGRO); DoPlaySoundToSet(me,SOUND_AGGRO);
iAwakenTimer = 4000; iAwakenTimer = 4000;
@@ -129,15 +130,17 @@ class boss_archaedas : public CreatureScript
DoPlaySoundToSet(me, SOUND_KILL); DoPlaySoundToSet(me, SOUND_KILL);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 uiDiff)
{ {
if (!pInstance) if (!pInstance)
return; return;
// we're still doing awaken animation // we're still doing awaken animation
if (bWakingUp && iAwakenTimer >= 0) { if (bWakingUp && iAwakenTimer >= 0)
iAwakenTimer -= diff; {
iAwakenTimer -= uiDiff;
return; // dont do anything until we are done return; // dont do anything until we are done
} else if (bWakingUp && iAwakenTimer <= 0) { } else if (bWakingUp && iAwakenTimer <= 0)
{
bWakingUp = false; bWakingUp = false;
AttackStart(Unit::GetUnit(*me, pInstance->GetData64(0))); AttackStart(Unit::GetUnit(*me, pInstance->GetData64(0)));
return; // dont want to continue until we finish the AttackStart method return; // dont want to continue until we finish the AttackStart method
@@ -148,14 +151,16 @@ class boss_archaedas : public CreatureScript
return; return;
// wake a wall minion // wake a wall minion
if (WallMinionTimer <= diff) { if (uiWallMinionTimer <= uiDiff)
{
pInstance->SetData (DATA_MINIONS, IN_PROGRESS); pInstance->SetData (DATA_MINIONS, IN_PROGRESS);
WallMinionTimer = 10000; uiWallMinionTimer = 10000;
} else WallMinionTimer -= diff; } else uiWallMinionTimer -= uiDiff;
//If we are <66 summon the guardians //If we are <66 summon the guardians
if (!guardiansAwake && !HealthAbovePct(66)) { if (!bGuardiansAwake && !HealthAbovePct(66))
{
ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1 ActivateMinion(pInstance->GetData64(5),true); // EarthenGuardian1
ActivateMinion(pInstance->GetData64(6),true); // EarthenGuardian2 ActivateMinion(pInstance->GetData64(6),true); // EarthenGuardian2
ActivateMinion(pInstance->GetData64(7),true); // EarthenGuardian3 ActivateMinion(pInstance->GetData64(7),true); // EarthenGuardian3
@@ -164,33 +169,35 @@ class boss_archaedas : public CreatureScript
ActivateMinion(pInstance->GetData64(10),false); // EarthenGuardian6 ActivateMinion(pInstance->GetData64(10),false); // EarthenGuardian6
me->MonsterYell(SAY_SUMMON,LANG_UNIVERSAL, NULL); me->MonsterYell(SAY_SUMMON,LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(me, SOUND_SUMMON); DoPlaySoundToSet(me, SOUND_SUMMON);
guardiansAwake = true; bGuardiansAwake = true;
} }
//If we are <33 summon the vault walkers //If we are <33 summon the vault walkers
if (!vaultWalkersAwake && !HealthAbovePct(33)) { if (!bVaultWalkersAwake && !HealthAbovePct(33))
{
ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1 ActivateMinion(pInstance->GetData64(1),true); // VaultWalker1
ActivateMinion(pInstance->GetData64(2),true); // VaultWalker2 ActivateMinion(pInstance->GetData64(2),true); // VaultWalker2
ActivateMinion(pInstance->GetData64(3),true); // VaultWalker3 ActivateMinion(pInstance->GetData64(3),true); // VaultWalker3
ActivateMinion(pInstance->GetData64(4),false); // VaultWalker4 ActivateMinion(pInstance->GetData64(4),false); // VaultWalker4
me->MonsterYell(SAY_SUMMON2, LANG_UNIVERSAL, NULL); me->MonsterYell(SAY_SUMMON2, LANG_UNIVERSAL, NULL);
DoPlaySoundToSet(me, SOUND_SUMMON2); DoPlaySoundToSet(me, SOUND_SUMMON2);
vaultWalkersAwake = true; bVaultWalkersAwake = true;
} }
if (uiTremorTimer <= diff) if (uiTremorTimer <= uiDiff)
{ {
//Cast //Cast
DoCast(me->getVictim(), SPELL_GROUND_TREMOR); DoCast(me->getVictim(), SPELL_GROUND_TREMOR);
//45 seconds until we should cast this agian //45 seconds until we should cast this agian
uiTremorTimer = 45000; uiTremorTimer = 45000;
} else uiTremorTimer -= diff; } else uiTremorTimer -= uiDiff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void JustDied (Unit * /*pKiller*/) { void JustDied (Unit * /*pKiller*/)
{
if (pInstance) if (pInstance)
{ {
pInstance->SetData(DATA_ANCIENT_DOOR, DONE); // open the vault door pInstance->SetData(DATA_ANCIENT_DOOR, DONE); // open the vault door
@@ -262,7 +269,8 @@ class mob_archaedas_minions : public CreatureScript
void SpellHit (Unit* /*caster*/, const SpellEntry *spell) { void SpellHit (Unit* /*caster*/, const SpellEntry *spell) {
// time to wake up, start animation // time to wake up, start animation
if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN)){ if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
{
iAwakenTimer = 5000; iAwakenTimer = 5000;
bWakingUp = true; bWakingUp = true;
} }
@@ -274,13 +282,15 @@ class mob_archaedas_minions : public CreatureScript
ScriptedAI::MoveInLineOfSight(who); ScriptedAI::MoveInLineOfSight(who);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 uiDiff)
{ {
// we're still in the awaken animation // we're still in the awaken animation
if (bWakingUp && iAwakenTimer >= 0) { if (bWakingUp && iAwakenTimer >= 0)
iAwakenTimer -= diff; {
iAwakenTimer -= uiDiff;
return; // dont do anything until we are done return; // dont do anything until we are done
} else if (bWakingUp && iAwakenTimer <= 0) { } else if (bWakingUp && iAwakenTimer <= 0)
{
bWakingUp = false; bWakingUp = false;
bAmIAwake = true; bAmIAwake = true;
// AttackStart(Unit::GetUnit(*me, pInstance->GetData64(0))); // whoWokeArchaedasGUID // AttackStart(Unit::GetUnit(*me, pInstance->GetData64(0))); // whoWokeArchaedasGUID
@@ -321,9 +331,9 @@ class mob_stonekeepers : public CreatureScript
struct mob_stonekeepersAI : public ScriptedAI struct mob_stonekeepersAI : public ScriptedAI
{ {
mob_stonekeepersAI(Creature *c) : ScriptedAI(c) mob_stonekeepersAI(Creature* pCreature) : ScriptedAI(pCreature)
{ {
pInstance = (me->GetInstanceScript()); pInstance = me->GetInstanceScript();
} }
InstanceScript* pInstance; InstanceScript* pInstance;
@@ -338,9 +348,9 @@ class mob_stonekeepers : public CreatureScript
void EnterCombat(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
me->setFaction (14); me->setFaction(14);
me->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
} }
void UpdateAI(const uint32 /*diff*/) void UpdateAI(const uint32 /*diff*/)
@@ -42,7 +42,7 @@ class boss_ironaya : public CreatureScript
struct boss_ironayaAI : public ScriptedAI struct boss_ironayaAI : public ScriptedAI
{ {
boss_ironayaAI(Creature *c) : ScriptedAI(c) {} boss_ironayaAI(Creature* pCreature) : ScriptedAI(pCreature) {}
uint32 uiArcingTimer; uint32 uiArcingTimer;
bool bHasCastedWstomp; bool bHasCastedWstomp;
@@ -60,7 +60,7 @@ class boss_ironaya : public CreatureScript
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 uiDiff)
{ {
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) if (!UpdateVictim())
@@ -72,24 +72,24 @@ class boss_ironaya : public CreatureScript
DoCast(me->getVictim(), SPELL_KNOCKAWAY, true); DoCast(me->getVictim(), SPELL_KNOCKAWAY, true);
// current aggro target is knocked away pick new target // current aggro target is knocked away pick new target
Unit* Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
if (!Target || Target == me->getVictim()) if (!pTarget || pTarget == me->getVictim())
Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1);
if (Target) if (pTarget)
me->TauntApply(Target); me->TauntApply(pTarget);
//Shouldn't cast this agian //Shouldn't cast this agian
bHasCastedKnockaway = true; bHasCastedKnockaway = true;
} }
//uiArcingTimer //uiArcingTimer
if (uiArcingTimer <= diff) if (uiArcingTimer <= uiDiff)
{ {
DoCast(me, SPELL_ARCINGSMASH); DoCast(me, SPELL_ARCINGSMASH);
uiArcingTimer = 13000; uiArcingTimer = 13000;
} else uiArcingTimer -= diff; } else uiArcingTimer -= uiDiff;
if (!bHasCastedWstomp && HealthBelowPct(25)) if (!bHasCastedWstomp && HealthBelowPct(25))
{ {
@@ -53,7 +53,7 @@ class mob_jadespine_basilisk : public CreatureScript
struct mob_jadespine_basiliskAI : public ScriptedAI struct mob_jadespine_basiliskAI : public ScriptedAI
{ {
mob_jadespine_basiliskAI(Creature *c) : ScriptedAI(c) {} mob_jadespine_basiliskAI(Creature* pCreature) : ScriptedAI(pCreature) {}
uint32 uiCslumberTimer; uint32 uiCslumberTimer;
@@ -66,14 +66,14 @@ class mob_jadespine_basilisk : public CreatureScript
{ {
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 uiDiff)
{ {
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
//uiCslumberTimer //uiCslumberTimer
if (uiCslumberTimer <= diff) if (uiCslumberTimer <= uiDiff)
{ {
//Cast //Cast
DoCastVictim(SPELL_CRYSTALLINE_SLUMBER, true); DoCastVictim(SPELL_CRYSTALLINE_SLUMBER, true);
@@ -81,15 +81,15 @@ class mob_jadespine_basilisk : public CreatureScript
//Stop attacking target thast asleep and pick new target //Stop attacking target thast asleep and pick new target
uiCslumberTimer = 28000; uiCslumberTimer = 28000;
Unit* Target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
if (!Target || Target == me->getVictim()) if (!pTarget || pTarget == me->getVictim())
Target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (Target) if (pTarget)
me->TauntApply(Target); me->TauntApply(pTarget);
} else uiCslumberTimer -= diff; } else uiCslumberTimer -= uiDiff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
@@ -112,10 +112,9 @@ class go_keystone_chamber : public GameObjectScript
public: public:
go_keystone_chamber() : GameObjectScript("go_keystone_chamber") { } go_keystone_chamber() : GameObjectScript("go_keystone_chamber") { }
bool OnGossipHello(Player *pPlayer, GameObject * pGo) bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo)
{ {
if (InstanceScript* pInstance = pGo->GetInstanceScript()) if (InstanceScript* pInstance = pGo->GetInstanceScript())
if (pInstance)
pInstance->SetData(DATA_IRONAYA_SEAL, IN_PROGRESS); //door animation and save state. pInstance->SetData(DATA_IRONAYA_SEAL, IN_PROGRESS); //door animation and save state.
return false; return false;
@@ -139,7 +138,7 @@ class AreaTrigger_at_map_chamber : public AreaTriggerScript
bool OnTrigger(Player* pPlayer, AreaTriggerEntry const* /*trigger*/) bool OnTrigger(Player* pPlayer, AreaTriggerEntry const* /*trigger*/)
{ {
if (pPlayer && ((Player*)pPlayer)->GetQuestStatus(QUEST_HIDDEN_CHAMBER) == QUEST_STATUS_INCOMPLETE) if (pPlayer->GetQuestStatus(QUEST_HIDDEN_CHAMBER) == QUEST_STATUS_INCOMPLETE)
pPlayer->AreaExploredOrEventHappens(QUEST_HIDDEN_CHAMBER); pPlayer->AreaExploredOrEventHappens(QUEST_HIDDEN_CHAMBER);
return true; return true;