Code:
void PhaseOne()
{
if (EventStart == true)
{
SpawnTimer++;
if (SpawnTimer == 5 || SpawnTimer == 10)
{
for (int i = 0; i < 7; i++)
{
int Counter = 0;
while (Counter == 0)
{
if (FrozenWastes[i] == false && (rand()%3 == 0 || SpawnCounter > 0))
{
for (int x = 0; x < 10; x++)
{
uint32 SpawnID = 10*i + x;
_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SOLDIER_OF_THE_FROZEN_WASTES, SFrozenWastes[SpawnID].x, SFrozenWastes[SpawnID].y, SFrozenWastes[SpawnID].z, SFrozenWastes[SpawnID].o, false, false, 0, 0);
}
FrozenWastes[i] = true;
Counter++;
}
if (Abominations[i] == false && (rand()%3 == 0 || SpawnCounter > 0))
{
for (int x = 0; x < 3; x++)
{
uint32 SpawnID = 3*i + x;
_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_UNSTOPPABLE_ABOMINATION, Abomination[SpawnID].x, Abomination[SpawnID].y, Abomination[SpawnID].z, Abomination[SpawnID].o, false, false, 0, 0);
}
Abominations[i] = true;
Counter++;
}
if (SoulWeavers[i] == false && ((rand()%3 == 0 && Counter < 2) || Counter == 0 || SpawnCounter > 0))
{
uint32 SpawnID = i;
_unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SOUL_WEAVER, SoulWeaver[SpawnID].x, SoulWeaver[SpawnID].y, SoulWeaver[SpawnID].z, SoulWeaver[SpawnID].o, false, false, 0, 0);
SoulWeavers[i] = true;
Counter++;
}
if (SoulWeavers[i] == true && Abominations[i] == true && FrozenWastes[i] == true)
Counter = 1;
}
}
SpawnCounter++;
}
if (SpawnCounter == 5)
{
for (int i = 0; i < 7; i++)
{
FrozenWastes[i] = false;
Abominations[i] = false;
SoulWeavers[i] = false;
}
WaveTimer = rand()%6+100000;
EventStart = false;
SpawnCounter = 0;
PhaseTimer = 60;
SpawnTimer = 0;
}
}
else
{
PhaseTimer--;
WaveTimer--;
if (PhaseTimer == 5)
{
uint32 RandomSpeach = rand()%3;
switch (RandomSpeach)
{
case 0:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Pray for mercy!");
_unit->PlaySoundToSet(8809);
break;
case 1:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Scream your dying breath!");
_unit->PlaySoundToSet(8810);
break;
case 2:
_unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "The end is upon you!");
_unit->PlaySoundToSet(8811);
break;
}
}
if (PhaseTimer == 3)
DespawnTrash = true;
if (!PhaseTimer)
{
_unit->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
_unit->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
_unit->GetAIInterface()->disable_melee = false;
_unit->SetUInt64Value(UNIT_FIELD_FLAGS, 0);
_unit->GetAIInterface()->m_canMove = true;
DespawnTrash = false;
HelpDialog = 0;
GCounter = 0;
m_phase = 2;
return;
}
else if (!WaveTimer && PhaseTimer > 5)
{
uint32 SpawnPoint = RandomUInt(7);
uint32 RandomSU;
if (PhaseTimer > 250)
RandomSU = RandomUInt(4);
if (PhaseTimer <= 250 && PhaseTimer >= 150)
RandomSU = RandomUInt(5);
if (PhaseTimer <= 150 && PhaseTimer > 100)
RandomSU = RandomUInt(6);
if (PhaseTimer <= 100)
RandomSU = RandomUInt(7);
uint32 UnitType;
switch (RandomSU)
{
case 0:
case 1: UnitType = CN_SOLDIER_OF_THE_FROZEN_WASTES; break;
case 2:
case 4: UnitType = CN_SOUL_WEAVER; break;
case 3:
case 5:
case 6: UnitType = CN_UNSTOPPABLE_ABOMINATION; break;
default:
{
UnitType = CN_UNSTOPPABLE_ABOMINATION;
}
}
_unit->GetMapMgr()->GetInterface()->SpawnCreature(UnitType, Waves[SpawnPoint].x, Waves[SpawnPoint].y, Waves[SpawnPoint].z, Waves[SpawnPoint].o, false, false, 0, 0);
WaveTimer = rand()%11+10;
}
}
}