Skip to content

Commit

Permalink
Arenas/Ring of Valor: fire lines should only be lit when the arena ba…
Browse files Browse the repository at this point in the history
…ttle begins.
  • Loading branch information
Warpten committed Mar 27, 2012
1 parent 613d536 commit c1ba5c8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
46 changes: 22 additions & 24 deletions src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
Expand Up @@ -32,7 +32,7 @@ BattlegroundRV::BattlegroundRV()
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds
// we must set messageIds
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
Expand All @@ -46,40 +46,32 @@ BattlegroundRV::~BattlegroundRV()

void BattlegroundRV::PostUpdateImpl(uint32 diff)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;

if (getTimer() < diff)
{
switch (getState())
{
case BG_RV_STATE_OPEN_FENCES:
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
// Open fire (only at game start)
for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
DoorOpen(i);
setTimer(BG_RV_CLOSE_FIRE_TIMER);
setState(BG_RV_STATE_CLOSE_FIRE);
break;
case BG_RV_STATE_CLOSE_FIRE:
for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
DoorClose(i);
setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
setState(BG_RV_STATE_OPEN_PILARS);
// Fire got closed after five seconds, leaves twenty seconds before toggling pillars
setTimer(BG_RV_FIRE_TO_PILLAR_TIMER);
setState(BG_RV_STATE_SWITCH_PILLARS);
break;
case BG_RV_STATE_OPEN_PILARS:
case BG_RV_STATE_SWITCH_PILLARS:
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
DoorOpen(i);
TogglePillarCollision(false);
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
setState(BG_RV_STATE_OPEN_FIRE);
break;
case BG_RV_STATE_OPEN_FIRE:
// FIXME: after 3.2.0 it's only decorative and should be opened only one time at battle start
for (uint8 i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
DoorOpen(i);
setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
setState(BG_RV_STATE_CLOSE_PILARS);
break;
case BG_RV_STATE_CLOSE_PILARS:
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
DoorOpen(i);
TogglePillarCollision(true);
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
setState(BG_RV_STATE_CLOSE_FIRE);
TogglePillarCollision();
setTimer(BG_RV_PILLAR_SWITCH_TIMER);
break;
}
}
Expand All @@ -103,7 +95,9 @@ void BattlegroundRV::StartingEventOpenDoors()
setState(BG_RV_STATE_OPEN_FENCES);
setTimer(BG_RV_FIRST_TIMER);

TogglePillarCollision(true);
// Should be false at first, TogglePillarCollision will do it.
SetPillarCollision(true);
TogglePillarCollision();
}

void BattlegroundRV::AddPlayer(Player* player)
Expand Down Expand Up @@ -227,8 +221,10 @@ bool BattlegroundRV::SetupBattleground()
}


void BattlegroundRV::TogglePillarCollision(bool apply)
void BattlegroundRV::TogglePillarCollision()
{
bool apply = GetPillarCollision();

for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i)
{
if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[i]))
Expand All @@ -249,4 +245,6 @@ void BattlegroundRV::TogglePillarCollision(bool apply)
gob->SendUpdateToPlayer(player);
}
}

SetPillarCollision(!apply);
}
15 changes: 9 additions & 6 deletions src/server/game/Battlegrounds/Zones/BattlegroundRV.h
Expand Up @@ -79,12 +79,12 @@ enum BattlegroundRVObjects
enum BattlegroundRVData
{
BG_RV_STATE_OPEN_FENCES,
BG_RV_STATE_OPEN_PILARS,
BG_RV_STATE_CLOSE_PILARS,
BG_RV_STATE_OPEN_FIRE,
BG_RV_STATE_SWITCH_PILLARS,
BG_RV_STATE_CLOSE_FIRE,
BG_RV_FIRE_TO_PILAR_TIMER = 20000,
BG_RV_PILAR_TO_FIRE_TIMER = 5000,

BG_RV_PILLAR_SWITCH_TIMER = 25000,
BG_RV_FIRE_TO_PILLAR_TIMER = 20000,
BG_RV_CLOSE_FIRE_TIMER = 5000,
BG_RV_FIRST_TIMER = 20133,
BG_RV_WORLD_STATE_A = 0xe10,
BG_RV_WORLD_STATE_H = 0xe11,
Expand Down Expand Up @@ -120,6 +120,7 @@ class BattlegroundRV : public Battleground
private:
uint32 Timer;
uint32 State;
bool PillarCollision;

virtual void PostUpdateImpl(uint32 diff);

Expand All @@ -129,6 +130,8 @@ class BattlegroundRV : public Battleground

uint32 getState() { return State; };
void setState(uint32 state) { State = state; };
void TogglePillarCollision(bool apply);
void TogglePillarCollision();
bool GetPillarCollision() { return PillarCollision; }
void SetPillarCollision(bool apply) { PillarCollision = apply; }
};
#endif

0 comments on commit c1ba5c8

Please sign in to comment.