Codestyle: Renamed some battleground variables and changed some other things to fit codestyle

This commit is contained in:
Subv
2012-02-11 19:44:10 -05:00
parent d0110dae9d
commit d3a510957e
17 changed files with 335 additions and 343 deletions
+55 -55
View File
@@ -194,26 +194,26 @@ Battleground::Battleground()
m_HonorMode = BG_NORMAL; m_HonorMode = BG_NORMAL;
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set to some default existing values //we must set to some default existing values
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
} }
Battleground::~Battleground() Battleground::~Battleground()
{ {
// remove objects and creatures // remove objects and creatures
// (this is done automatically in mapmanager update, when the instance is reset after the reset time) // (this is done automatically in mapmanager update, when the instance is reset after the reset time)
uint32 size = uint32(m_BgCreatures.size()); uint32 size = uint32(BgCreatures.size());
for (uint32 i = 0; i < size; ++i) for (uint32 i = 0; i < size; ++i)
DelCreature(i); DelCreature(i);
size = uint32(m_BgObjects.size()); size = uint32(BgObjects.size());
for (uint32 i = 0; i < size; ++i) for (uint32 i = 0; i < size; ++i)
DelObject(i); DelObject(i);
@@ -229,7 +229,7 @@ Battleground::~Battleground()
// remove from bg free slot queue // remove from bg free slot queue
RemoveFromBGFreeSlotQueue(); RemoveFromBGFreeSlotQueue();
for (BattlegroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr)
delete itr->second; delete itr->second;
} }
@@ -452,21 +452,21 @@ inline void Battleground::_ProcessJoin(uint32 diff)
} }
StartingEventCloseDoors(); StartingEventCloseDoors();
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FIRST]);
// First start warning - 2 or 1 minute // First start warning - 2 or 1 minute
SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL);
} }
// After 1 minute or 30 seconds, warning is signalled // After 1 minute or 30 seconds, warning is signalled
else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2))
{ {
m_Events |= BG_STARTING_EVENT_2; m_Events |= BG_STARTING_EVENT_2;
SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL);
} }
// After 30 or 15 seconds, warning is signalled // After 30 or 15 seconds, warning is signalled
else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3))
{ {
m_Events |= BG_STARTING_EVENT_3; m_Events |= BG_STARTING_EVENT_3;
SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL);
} }
// Delay expired (atfer 2 or 1 minute) // Delay expired (atfer 2 or 1 minute)
else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
@@ -475,9 +475,9 @@ inline void Battleground::_ProcessJoin(uint32 diff)
StartingEventOpenDoors(); StartingEventOpenDoors();
SendWarningToAll(m_StartMessageIds[BG_STARTING_EVENT_FOURTH]); SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]);
SetStatus(STATUS_IN_PROGRESS); SetStatus(STATUS_IN_PROGRESS);
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
// Remove preparation // Remove preparation
if (isArena()) if (isArena())
@@ -919,11 +919,11 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
participant = true; participant = true;
} }
BattlegroundScoreMap::iterator itr2 = m_PlayerScores.find(guid); BattlegroundScoreMap::iterator itr2 = PlayerScores.find(guid);
if (itr2 != m_PlayerScores.end()) if (itr2 != PlayerScores.end())
{ {
delete itr2->second; // delete player's score delete itr2->second; // delete player's score
m_PlayerScores.erase(itr2); PlayerScores.erase(itr2);
} }
RemovePlayerFromResurrectQueue(guid); RemovePlayerFromResurrectQueue(guid);
@@ -1057,9 +1057,9 @@ void Battleground::Reset()
m_Players.clear(); m_Players.clear();
for (BattlegroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr)
delete itr->second; delete itr->second;
m_PlayerScores.clear(); PlayerScores.clear();
ResetBGSubclass(); ResetBGSubclass();
} }
@@ -1331,8 +1331,8 @@ bool Battleground::HasFreeSlots() const
void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
//this procedure is called from virtual function implemented in bg subclass //this procedure is called from virtual function implemented in bg subclass
BattlegroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::const_iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
switch (type) switch (type)
@@ -1401,8 +1401,8 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid)
bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/) bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/)
{ {
// If the assert is called, means that m_BgObjects must be resized! // If the assert is called, means that BgObjects must be resized!
ASSERT(type < m_BgObjects.size()); ASSERT(type < BgObjects.size());
Map* map = FindBgMap(); Map* map = FindBgMap();
if (!map) if (!map)
@@ -1449,7 +1449,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
delete go; delete go;
return false; return false;
} }
m_BgObjects[type] = go->GetGUID(); BgObjects[type] = go->GetGUID();
return true; return true;
} }
@@ -1457,7 +1457,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
// It would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code // It would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
void Battleground::DoorClose(uint32 type) void Battleground::DoorClose(uint32 type)
{ {
if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]))
{ {
// If doors are open, close it // If doors are open, close it
if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY)
@@ -1469,12 +1469,12 @@ void Battleground::DoorClose(uint32 type)
} }
else else
sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
} }
void Battleground::DoorOpen(uint32 type) void Battleground::DoorOpen(uint32 type)
{ {
if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]))
{ {
// Change state to be sure they will be opened // Change state to be sure they will be opened
obj->SetLootState(GO_READY); obj->SetLootState(GO_READY);
@@ -1482,31 +1482,31 @@ void Battleground::DoorOpen(uint32 type)
} }
else else
sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
} }
GameObject* Battleground::GetBGObject(uint32 type) GameObject* Battleground::GetBGObject(uint32 type)
{ {
GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type]); GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
if (!obj) if (!obj)
sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
return obj; return obj;
} }
Creature* Battleground::GetBGCreature(uint32 type) Creature* Battleground::GetBGCreature(uint32 type)
{ {
Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type]); Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
if (!creature) if (!creature)
sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgCreatures[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
return creature; return creature;
} }
void Battleground::SpawnBGObject(uint32 type, uint32 respawntime) void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
{ {
if (Map* map = FindBgMap()) if (Map* map = FindBgMap())
if (GameObject* obj = map->GetGameObject(m_BgObjects[type])) if (GameObject* obj = map->GetGameObject(BgObjects[type]))
{ {
if (respawntime) if (respawntime)
obj->SetLootState(GO_JUST_DEACTIVATED); obj->SetLootState(GO_JUST_DEACTIVATED);
@@ -1521,8 +1521,8 @@ void Battleground::SpawnBGObject(uint32 type, uint32 respawntime)
Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime) Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime)
{ {
// If the assert is called, means that m_BgCreatures must be resized! // If the assert is called, means that BgCreatures must be resized!
ASSERT(type < m_BgCreatures.size()); ASSERT(type < BgCreatures.size());
Map* map = FindBgMap(); Map* map = FindBgMap();
if (!map) if (!map)
@@ -1557,7 +1557,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
return NULL; return NULL;
} }
m_BgCreatures[type] = creature->GetGUID(); BgCreatures[type] = creature->GetGUID();
if (respawntime) if (respawntime)
creature->SetRespawnDelay(respawntime); creature->SetRespawnDelay(respawntime);
@@ -1567,37 +1567,37 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
bool Battleground::DelCreature(uint32 type) bool Battleground::DelCreature(uint32 type)
{ {
if (!m_BgCreatures[type]) if (!BgCreatures[type])
return true; return true;
if (Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type])) if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]))
{ {
creature->AddObjectToRemoveList(); creature->AddObjectToRemoveList();
m_BgCreatures[type] = 0; BgCreatures[type] = 0;
return true; return true;
} }
sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgCreatures[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
m_BgCreatures[type] = 0; BgCreatures[type] = 0;
return false; return false;
} }
bool Battleground::DelObject(uint32 type) bool Battleground::DelObject(uint32 type)
{ {
if (!m_BgObjects[type]) if (!BgObjects[type])
return true; return true;
if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]))
{ {
obj->SetRespawnTime(0); // not save respawn time obj->SetRespawnTime(0); // not save respawn time
obj->Delete(); obj->Delete();
m_BgObjects[type] = 0; BgObjects[type] = 0;
return true; return true;
} }
sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
m_BgObjects[type] = 0; BgObjects[type] = 0;
return false; return false;
} }
@@ -1715,8 +1715,8 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
return; return;
// Change buff type, when buff is used: // Change buff type, when buff is used:
int32 index = m_BgObjects.size() - 1; int32 index = BgObjects.size() - 1;
while (index >= 0 && m_BgObjects[index] != go_guid) while (index >= 0 && BgObjects[index] != go_guid)
index--; index--;
if (index < 0) if (index < 0)
{ {
@@ -1837,8 +1837,8 @@ void Battleground::SetHoliday(bool is_holiday)
int32 Battleground::GetObjectType(uint64 guid) int32 Battleground::GetObjectType(uint64 guid)
{ {
for (uint32 i = 0; i < m_BgObjects.size(); ++i) for (uint32 i = 0; i < BgObjects.size(); ++i)
if (m_BgObjects[i] == guid) if (BgObjects[i] == guid)
return i; return i;
sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
GUID_LOPART(guid), m_MapId, m_InstanceID); GUID_LOPART(guid), m_MapId, m_InstanceID);
+8 -8
View File
@@ -411,9 +411,9 @@ class Battleground
uint32 GetPlayersSize() const { return m_Players.size(); } uint32 GetPlayersSize() const { return m_Players.size(); }
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap; typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
@@ -539,8 +539,8 @@ class Battleground
// TODO: make this protected: // TODO: make this protected:
typedef std::vector<uint64> BGObjects; typedef std::vector<uint64> BGObjects;
typedef std::vector<uint64> BGCreatures; typedef std::vector<uint64> BGCreatures;
BGObjects m_BgObjects; BGObjects BgObjects;
BGCreatures m_BgCreatures; BGCreatures BgCreatures;
void SpawnBGObject(uint32 type, uint32 respawntime); void SpawnBGObject(uint32 type, uint32 respawntime);
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0);
Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0); Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0);
@@ -589,7 +589,7 @@ class Battleground
void _ProcessJoin(uint32 diff); void _ProcessJoin(uint32 diff);
// Scorekeeping // Scorekeeping
BattlegroundScoreMap m_PlayerScores; // Player scores BattlegroundScoreMap PlayerScores; // Player scores
// must be implemented in BG subclass // must be implemented in BG subclass
virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) {} virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) {}
@@ -600,9 +600,9 @@ class Battleground
// these are important variables used for starting messages // these are important variables used for starting messages
uint8 m_Events; uint8 m_Events;
BattlegroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]; BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT];
// this must be filled in constructors! // this must be filled in constructors!
uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]; uint32 StartMessageIds[BG_STARTING_EVENT_COUNT];
bool m_BuffChange; bool m_BuffChange;
bool m_IsRandom; bool m_IsRandom;
@@ -23,15 +23,15 @@
BattlegroundAA::BattlegroundAA() BattlegroundAA::BattlegroundAA()
{ {
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundAA::~BattlegroundAA() BattlegroundAA::~BattlegroundAA()
@@ -53,7 +53,7 @@ void BattlegroundAA::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundAAScore* sc = new BattlegroundAAScore; BattlegroundAAScore* sc = new BattlegroundAAScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
@@ -31,13 +31,13 @@
BattlegroundAB::BattlegroundAB() BattlegroundAB::BattlegroundAB()
{ {
m_BuffChange = true; m_BuffChange = true;
m_BgObjects.resize(BG_AB_OBJECT_MAX); BgObjects.resize(BG_AB_OBJECT_MAX);
m_BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
} }
BattlegroundAB::~BattlegroundAB() BattlegroundAB::~BattlegroundAB()
@@ -202,7 +202,7 @@ void BattlegroundAB::AddPlayer(Player* player)
//create score and add it to map, default values are set in the constructor //create score and add it to map, default values are set in the constructor
BattlegroundABScore* sc = new BattlegroundABScore; BattlegroundABScore* sc = new BattlegroundABScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
@@ -395,7 +395,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]];
if (!ghost_list.empty()) if (!ghost_list.empty())
{ {
WorldSafeLocsEntry const* ClosestGrave = NULL; WorldSafeLocsEntry const* ClosestGrave = NULL;
@@ -413,7 +413,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node)
} }
} }
if (m_BgCreatures[node]) if (BgCreatures[node])
DelCreature(node); DelCreature(node);
// buff object isn't despawned // buff object isn't despawned
@@ -426,11 +426,11 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
return; return;
uint8 node = BG_AB_NODE_STABLES; uint8 node = BG_AB_NODE_STABLES;
GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[node*8+7]); GameObject* obj = GetBgMap()->GetGameObject(BgObjects[node*8+7]);
while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10)))) while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10))))
{ {
++node; ++node;
obj = GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); obj = GetBgMap()->GetGameObject(BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
} }
if (node == BG_AB_DYNAMIC_NODES_COUNT) if (node == BG_AB_DYNAMIC_NODES_COUNT)
@@ -614,7 +614,7 @@ void BattlegroundAB::Reset()
} }
for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers
if (m_BgCreatures[i]) if (BgCreatures[i])
DelCreature(i); DelCreature(i);
} }
@@ -673,8 +673,8 @@ WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player)
void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
switch (type) switch (type)
@@ -29,13 +29,13 @@
BattlegroundAV::BattlegroundAV() BattlegroundAV::BattlegroundAV()
{ {
m_BgObjects.resize(BG_AV_OBJECT_MAX); BgObjects.resize(BG_AV_OBJECT_MAX);
m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN;
} }
BattlegroundAV::~BattlegroundAV() BattlegroundAV::~BattlegroundAV()
@@ -430,7 +430,7 @@ void BattlegroundAV::AddPlayer(Player* player)
Battleground::AddPlayer(player); Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundAVScore* sc = new BattlegroundAVScore; BattlegroundAVScore* sc = new BattlegroundAVScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
if (m_MaxLevel == 0) if (m_MaxLevel == 0)
m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information.. m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
@@ -532,8 +532,8 @@ void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
switch (type) switch (type)
@@ -585,7 +585,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
{ {
uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH; uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH;
//despawn marshal //despawn marshal
if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp); DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else else
sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
@@ -649,10 +649,10 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine);
if (mine == AV_SOUTH_MINE) if (mine == AV_SOUTH_MINE)
for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
if (m_BgCreatures[i]) if (BgCreatures[i])
DelCreature(i); //TODO just set the respawntime to 999999 DelCreature(i); //TODO just set the respawntime to 999999
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++) for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++)
if (m_BgCreatures[i]) if (BgCreatures[i])
DelCreature(i); //TODO here also DelCreature(i); //TODO here also
} }
SendMineWorldStates(mine); SendMineWorldStates(mine);
@@ -750,7 +750,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
else else
creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3; creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
//spiritguide //spiritguide
if (m_BgCreatures[node]) if (BgCreatures[node])
DelCreature(node); DelCreature(node);
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
sLog->outError("AV: couldn't spawn spiritguide at node %i", node); sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
@@ -783,10 +783,10 @@ void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
{ {
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
for (uint8 i=0; i<4; i++) for (uint8 i=0; i<4; i++)
if (m_BgCreatures[c_place+i]) if (BgCreatures[c_place+i])
DelCreature(c_place+i); DelCreature(c_place+i);
//spiritguide //spiritguide
if (!IsTower(node) && m_BgCreatures[node]) if (!IsTower(node) && BgCreatures[node])
DelCreature(node); DelCreature(node);
//remove bonus honor aura trigger creature when node is lost //remove bonus honor aura trigger creature when node is lost
@@ -1029,7 +1029,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_ONE_DAY); //teeamaura despawn SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_ONE_DAY); //teeamaura despawn
// Those who are waiting to resurrect at this object are taken to the closest own object's graveyard // Those who are waiting to resurrect at this object are taken to the closest own object's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]];
if (!ghost_list.empty()) if (!ghost_list.empty())
{ {
Player* player; Player* player;
@@ -1044,7 +1044,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
else else
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
} }
m_ReviveQueue[m_BgCreatures[node]].clear(); m_ReviveQueue[BgCreatures[node]].clear();
} }
} }
DePopulateNode(node); DePopulateNode(node);
@@ -1490,7 +1490,7 @@ void BattlegroundAV::ResetBGSubclass()
m_Mine_Timer=AV_MINE_TICK_TIMER; m_Mine_Timer=AV_MINE_TICK_TIMER;
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++) for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
if (m_BgCreatures[i]) if (BgCreatures[i])
DelCreature(i); DelCreature(i);
} }
@@ -26,17 +26,17 @@
BattlegroundBE::BattlegroundBE() BattlegroundBE::BattlegroundBE()
{ {
m_BgObjects.resize(BG_BE_OBJECT_MAX); BgObjects.resize(BG_BE_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundBE::~BattlegroundBE() BattlegroundBE::~BattlegroundBE()
@@ -68,7 +68,7 @@ void BattlegroundBE::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundBEScore* sc = new BattlegroundBEScore; BattlegroundBEScore* sc = new BattlegroundBEScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState(); UpdateArenaWorldState();
} }
@@ -116,10 +116,10 @@ void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
switch (Trigger) switch (Trigger)
{ {
case 4538: // buff trigger? case 4538: // buff trigger?
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1]; //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_1];
break; break;
case 4539: // buff trigger? case 4539: // buff trigger?
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2]; //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2];
break; break;
default: default:
sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
@@ -164,8 +164,8 @@ bool BattlegroundBE::SetupBattleground()
void BattlegroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
//there is nothing special in this score //there is nothing special in this score
@@ -26,17 +26,17 @@
BattlegroundDS::BattlegroundDS() BattlegroundDS::BattlegroundDS()
{ {
m_BgObjects.resize(BG_DS_OBJECT_MAX); BgObjects.resize(BG_DS_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundDS::~BattlegroundDS() BattlegroundDS::~BattlegroundDS()
@@ -59,7 +59,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
} }
else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision
{ {
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
gob->SetGoState(GO_STATE_READY); gob->SetGoState(GO_STATE_READY);
setWaterFallTimer(BG_DS_WATERFALL_DURATION); setWaterFallTimer(BG_DS_WATERFALL_DURATION);
@@ -68,7 +68,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff)
else //if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Remove collision and water else //if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Remove collision and water
{ {
// turn off collision // turn off collision
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
gob->SetGoState(GO_STATE_ACTIVE); gob->SetGoState(GO_STATE_ACTIVE);
DoorOpen(BG_DS_OBJECT_WATER_2); DoorOpen(BG_DS_OBJECT_WATER_2);
@@ -101,7 +101,7 @@ void BattlegroundDS::StartingEventOpenDoors()
DoorOpen(BG_DS_OBJECT_WATER_2); DoorOpen(BG_DS_OBJECT_WATER_2);
// Turn off collision // Turn off collision
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1]))
gob->SetGoState(GO_STATE_ACTIVE); gob->SetGoState(GO_STATE_ACTIVE);
} }
@@ -109,9 +109,9 @@ void BattlegroundDS::AddPlayer(Player* player)
{ {
Battleground::AddPlayer(player); Battleground::AddPlayer(player);
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundDSScore* sc = new BattlegroundDSScore; BattlegroundDSScore* score = new BattlegroundDSScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = score;
UpdateArenaWorldState(); UpdateArenaWorldState();
} }
@@ -81,14 +81,14 @@ class BattlegroundDS : public Battleground
void HandleKillPlayer(Player* player, Player* killer); void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* player); bool HandlePlayerUnderMap(Player* player);
private: private:
uint32 m_waterTimer; uint32 _waterfallTimer;
uint8 m_waterfallStatus; uint8 _waterfallStatus;
virtual void PostUpdateImpl(uint32 diff); virtual void PostUpdateImpl(uint32 diff);
protected: protected:
uint32 getWaterFallStatus() { return m_waterfallStatus; }; uint32 getWaterFallStatus() { return _waterfallStatus; };
void setWaterFallStatus(uint32 status) { m_waterfallStatus = status; }; void setWaterFallStatus(uint32 status) { _waterfallStatus = status; };
void setWaterFallTimer(uint32 timer) { m_waterTimer = timer; }; void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; };
uint32 getWaterFallTimer() { return m_waterTimer; }; uint32 getWaterFallTimer() { return _waterfallTimer; };
}; };
#endif #endif
@@ -37,17 +37,17 @@ uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
BattlegroundEY::BattlegroundEY() BattlegroundEY::BattlegroundEY()
{ {
m_BuffChange = true; m_BuffChange = true;
m_BgObjects.resize(BG_EY_OBJECT_MAX); BgObjects.resize(BG_EY_OBJECT_MAX);
m_BgCreatures.resize(BG_EY_CREATURES_MAX); BgCreatures.resize(BG_EY_CREATURES_MAX);
m_Points_Trigger[FEL_REAVER] = TR_FEL_REAVER_BUFF; m_Points_Trigger[FEL_REAVER] = TR_FEL_REAVER_BUFF;
m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF;
m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF;
m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF;
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN;
} }
BattlegroundEY::~BattlegroundEY() BattlegroundEY::~BattlegroundEY()
@@ -143,7 +143,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
GameObject* obj = NULL; GameObject* obj = NULL;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i) for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
{ {
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); obj = HashMapHolder<GameObject>::Find(BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]);
if (obj) if (obj)
{ {
uint8 j = 0; uint8 j = 0;
@@ -183,7 +183,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
GameObject* obj = NULL; GameObject* obj = NULL;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i) for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
{ {
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); obj = HashMapHolder<GameObject>::Find(BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]);
if (obj) if (obj)
{ {
uint8 j = 0; uint8 j = 0;
@@ -340,7 +340,7 @@ void BattlegroundEY::AddPlayer(Player* player)
m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID()); m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID());
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
@@ -735,7 +735,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
else else
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source); SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
if (m_BgCreatures[Point]) if (BgCreatures[Point])
DelCreature(Point); DelCreature(Point);
WorldSafeLocsEntry const* sg = NULL; WorldSafeLocsEntry const* sg = NULL;
@@ -807,8 +807,8 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType
void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found if (itr == PlayerScores.end()) // player not found
return; return;
switch (type) switch (type)
@@ -28,13 +28,13 @@
BattlegroundIC::BattlegroundIC() BattlegroundIC::BattlegroundIC()
{ {
m_BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS); BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS);
m_BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS); BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS);
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN;
for (uint8 i = 0; i < 2; i++) for (uint8 i = 0; i < 2; i++)
factionReinforcements[i] = MAX_REINFORCEMENTS; factionReinforcements[i] = MAX_REINFORCEMENTS;
@@ -298,7 +298,7 @@ void BattlegroundIC::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundICScore* sc = new BattlegroundICScore; BattlegroundICScore* sc = new BattlegroundICScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H)) if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_QUARRY, true); player->CastSpell(player, SPELL_QUARRY, true);
@@ -327,9 +327,9 @@ void BattlegroundIC::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
std::map<uint64, BattlegroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID()); std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
switch (type) switch (type)
@@ -476,7 +476,7 @@ void BattlegroundIC::EndBattleground(uint32 winner)
void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType) void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType)
{ {
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]]; std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]];
if (!ghost_list.empty()) if (!ghost_list.empty())
{ {
WorldSafeLocsEntry const* ClosestGrave = NULL; WorldSafeLocsEntry const* ClosestGrave = NULL;
@@ -528,7 +528,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
// if we are here means that the point has been lost, or it is the first capture // if we are here means that the point has been lost, or it is the first capture
if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY) if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
if (m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2]) if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2); DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
@@ -26,17 +26,17 @@
BattlegroundNA::BattlegroundNA() BattlegroundNA::BattlegroundNA()
{ {
m_BgObjects.resize(BG_NA_OBJECT_MAX); BgObjects.resize(BG_NA_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundNA::~BattlegroundNA() BattlegroundNA::~BattlegroundNA()
@@ -65,7 +65,7 @@ void BattlegroundNA::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundNAScore* sc = new BattlegroundNAScore; BattlegroundNAScore* sc = new BattlegroundNAScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState(); UpdateArenaWorldState();
} }
@@ -24,10 +24,10 @@
BattlegroundRB::BattlegroundRB() BattlegroundRB::BattlegroundRB()
{ {
//TODO FIX ME! //TODO FIX ME!
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
} }
BattlegroundRB::~BattlegroundRB() BattlegroundRB::~BattlegroundRB()
@@ -49,7 +49,7 @@ void BattlegroundRB::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundRBScore* sc = new BattlegroundRBScore; BattlegroundRBScore* sc = new BattlegroundRBScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
@@ -65,9 +65,9 @@ void BattlegroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
std::map<uint64, BattlegroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID()); std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor); Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
@@ -26,17 +26,17 @@
BattlegroundRL::BattlegroundRL() BattlegroundRL::BattlegroundRL()
{ {
m_BgObjects.resize(BG_RL_OBJECT_MAX); BgObjects.resize(BG_RL_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundRL::~BattlegroundRL() BattlegroundRL::~BattlegroundRL()
@@ -65,7 +65,7 @@ void BattlegroundRL::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundRLScore* sc = new BattlegroundRLScore; BattlegroundRLScore* sc = new BattlegroundRLScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
UpdateArenaWorldState(); UpdateArenaWorldState();
} }
@@ -26,17 +26,17 @@
BattlegroundRV::BattlegroundRV() BattlegroundRV::BattlegroundRV()
{ {
m_BgObjects.resize(BG_RV_OBJECT_MAX); BgObjects.resize(BG_RV_OBJECT_MAX);
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
//we must set messageIds //we must set messageIds
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
} }
BattlegroundRV::~BattlegroundRV() BattlegroundRV::~BattlegroundRV()
@@ -110,7 +110,7 @@ void BattlegroundRV::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundRVScore* sc = new BattlegroundRVScore; BattlegroundRVScore* sc = new BattlegroundRVScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
@@ -229,7 +229,7 @@ void BattlegroundRV::TogglePillarCollision(bool apply)
{ {
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i)
{ {
if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[i])) if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[i]))
{ {
if (i >= BG_RV_OBJECT_PILAR_COLLISION_1) if (i >= BG_RV_OBJECT_PILAR_COLLISION_1)
{ {
@@ -26,12 +26,12 @@
BattlegroundSA::BattlegroundSA() BattlegroundSA::BattlegroundSA()
{ {
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN;
m_BgObjects.resize(BG_SA_MAXOBJ); BgObjects.resize(BG_SA_MAXOBJ);
m_BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY);
TimerEnabled = false; TimerEnabled = false;
UpdateWaitTimer = 0; UpdateWaitTimer = 0;
SignaledRoundTwo = false; SignaledRoundTwo = false;
@@ -460,7 +460,7 @@ void BattlegroundSA::AddPlayer(Player* player)
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
} }
SendTransportInit(player); SendTransportInit(player);
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
@@ -476,8 +476,8 @@ void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
void BattlegroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found... if (itr == PlayerScores.end()) // player not found...
return; return;
if (type == SCORE_DESTROYED_DEMOLISHER) if (type == SCORE_DESTROYED_DEMOLISHER)
@@ -563,7 +563,7 @@ void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer)
*/ */
void BattlegroundSA::OverrideGunFaction() void BattlegroundSA::OverrideGunFaction()
{ {
if (!m_BgCreatures[0]) if (!BgCreatures[0])
return; return;
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
@@ -581,7 +581,7 @@ void BattlegroundSA::OverrideGunFaction()
void BattlegroundSA::DemolisherStartState(bool start) void BattlegroundSA::DemolisherStartState(bool start)
{ {
if (!m_BgCreatures[0]) if (!BgCreatures[0])
return; return;
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
@@ -863,7 +863,7 @@ void BattlegroundSA::UpdateDemolisherSpawns()
{ {
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
{ {
if (m_BgCreatures[i]) if (BgCreatures[i])
{ {
if (Creature* Demolisher = GetBGCreature(i)) if (Creature* Demolisher = GetBGCreature(i))
{ {
@@ -898,12 +898,12 @@ void BattlegroundSA::UpdateDemolisherSpawns()
void BattlegroundSA::SendTransportInit(Player* player) void BattlegroundSA::SendTransportInit(Player* player)
{ {
if (m_BgObjects[BG_SA_BOAT_ONE] || m_BgObjects[BG_SA_BOAT_TWO]) if (BgObjects[BG_SA_BOAT_ONE] || BgObjects[BG_SA_BOAT_TWO])
{ {
UpdateData transData; UpdateData transData;
if (m_BgObjects[BG_SA_BOAT_ONE]) if (BgObjects[BG_SA_BOAT_ONE])
GetBGObject(BG_SA_BOAT_ONE)->BuildCreateUpdateBlockForPlayer(&transData, player); GetBGObject(BG_SA_BOAT_ONE)->BuildCreateUpdateBlockForPlayer(&transData, player);
if (m_BgObjects[BG_SA_BOAT_TWO]) if (BgObjects[BG_SA_BOAT_TWO])
GetBGObject(BG_SA_BOAT_TWO)->BuildCreateUpdateBlockForPlayer(&transData, player); GetBGObject(BG_SA_BOAT_TWO)->BuildCreateUpdateBlockForPlayer(&transData, player);
WorldPacket packet; WorldPacket packet;
transData.BuildPacket(&packet); transData.BuildPacket(&packet);
@@ -913,12 +913,12 @@ void BattlegroundSA::SendTransportInit(Player* player)
void BattlegroundSA::SendTransportsRemove(Player* player) void BattlegroundSA::SendTransportsRemove(Player* player)
{ {
if (m_BgObjects[BG_SA_BOAT_ONE] || m_BgObjects[BG_SA_BOAT_TWO]) if (BgObjects[BG_SA_BOAT_ONE] || BgObjects[BG_SA_BOAT_TWO])
{ {
UpdateData transData; UpdateData transData;
if (m_BgObjects[BG_SA_BOAT_ONE]) if (BgObjects[BG_SA_BOAT_ONE])
GetBGObject(BG_SA_BOAT_ONE)->BuildOutOfRangeUpdateBlock(&transData); GetBGObject(BG_SA_BOAT_ONE)->BuildOutOfRangeUpdateBlock(&transData);
if (m_BgObjects[BG_SA_BOAT_TWO]) if (BgObjects[BG_SA_BOAT_TWO])
GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData); GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData);
WorldPacket packet; WorldPacket packet;
transData.BuildPacket(&packet); transData.BuildPacket(&packet);
@@ -42,20 +42,15 @@ uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
{60, 40, 80} // holiday {60, 40, 80} // holiday
}; };
uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
{0, 35, 0}, // normal honor
{0, 45, 0} // holiday
};
BattlegroundWS::BattlegroundWS() BattlegroundWS::BattlegroundWS()
{ {
m_BgObjects.resize(BG_WS_OBJECT_MAX); BgObjects.resize(BG_WS_OBJECT_MAX);
m_BgCreatures.resize(BG_CREATURES_MAX_WS); BgCreatures.resize(BG_CREATURES_MAX_WS);
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
} }
BattlegroundWS::~BattlegroundWS() BattlegroundWS::~BattlegroundWS()
@@ -75,96 +70,93 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
else // Horde has more points and thus wins else // Horde has more points and thus wins
EndBattleground(HORDE); EndBattleground(HORDE);
} }
else if (GetTeamScore(HORDE) == 0) else if (GetTeamScore(HORDE) == 0)
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleground(m_LastFlagCaptureTeam); EndBattleground(_lastFlagCaptureTeam);
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
EndBattleground(HORDE); EndBattleground(HORDE);
else else
EndBattleground(ALLIANCE); EndBattleground(ALLIANCE);
} }
else if (GetStartTime() > uint32(m_minutesElapsed * MINUTE * IN_MILLISECONDS)) else if (GetStartTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS))
{ {
++m_minutesElapsed; ++_minutesElapsed;
UpdateWorldState(BG_WS_STATE_TIMER, 25 - m_minutesElapsed); UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
} }
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{ {
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff; _flagsTimer[BG_TEAM_ALLIANCE] -= diff;
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0) if (_flagsTimer[BG_TEAM_ALLIANCE] < 0)
{ {
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0; _flagsTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlag(ALLIANCE, true); RespawnFlag(ALLIANCE, true);
} }
} }
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
{ {
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff; _flagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0) if (_flagsDropTimer[BG_TEAM_ALLIANCE] < 0)
{ {
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0; _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlagAfterDrop(ALLIANCE); RespawnFlagAfterDrop(ALLIANCE);
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
} }
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{ {
m_FlagsTimer[BG_TEAM_HORDE] -= diff; _flagsTimer[BG_TEAM_HORDE] -= diff;
if (m_FlagsTimer[BG_TEAM_HORDE] < 0) if (_flagsTimer[BG_TEAM_HORDE] < 0)
{ {
m_FlagsTimer[BG_TEAM_HORDE] = 0; _flagsTimer[BG_TEAM_HORDE] = 0;
RespawnFlag(HORDE, true); RespawnFlag(HORDE, true);
} }
} }
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
{ {
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff; _flagsDropTimer[BG_TEAM_HORDE] -= diff;
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0) if (_flagsDropTimer[BG_TEAM_HORDE] < 0)
{ {
m_FlagsDropTimer[BG_TEAM_HORDE] = 0; _flagsDropTimer[BG_TEAM_HORDE] = 0;
RespawnFlagAfterDrop(HORDE); RespawnFlagAfterDrop(HORDE);
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
} }
if (m_BothFlagsKept) if (_bothFlagsKept)
{ {
m_FlagSpellForceTimer += diff; _flagSpellForceTimer += diff;
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes if (_flagDebuffState == 0 && _flagSpellForceTimer >= 10*MINUTE*IN_MILLISECONDS) //10 minutes
{
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
m_FlagDebuffState = 1;
}
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
{
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
{ {
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
_flagDebuffState = 1;
} }
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1])) else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 900000) //15 minutes
{ {
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); {
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
{
player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true);
}
_flagDebuffState = 2;
} }
m_FlagDebuffState = 2;
}
} }
else else
{ {
m_FlagSpellForceTimer = 0; //reset timer. _flagSpellForceTimer = 0; //reset timer.
m_FlagDebuffState = 0; _flagDebuffState = 0;
} }
} }
} }
@@ -208,7 +200,7 @@ void BattlegroundWS::AddPlayer(Player* player)
//create score and add it to map, default values are set in constructor //create score and add it to map, default values are set in constructor
BattlegroundWGScore* sc = new BattlegroundWGScore; BattlegroundWGScore* sc = new BattlegroundWGScore;
m_PlayerScores[player->GetGUID()] = sc; PlayerScores[player->GetGUID()] = sc;
} }
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
@@ -216,12 +208,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
if (Team == ALLIANCE) if (Team == ALLIANCE)
{ {
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag"); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag");
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
} }
else else
{ {
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag"); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag");
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
} }
if (captured) if (captured)
@@ -232,7 +224,7 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound...
} }
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
@@ -260,7 +252,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
SetDroppedFlagGUID(0, team); SetDroppedFlagGUID(0, team);
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
@@ -277,12 +269,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
return; return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet) // horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player // Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1); AddPoint(ALLIANCE, 1);
@@ -295,12 +287,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
return; return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet) // alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player // Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1); AddPoint(HORDE, 1);
@@ -345,7 +337,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
} }
else else
{ {
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; _flagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
} }
} }
@@ -388,11 +380,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{ {
SetHordeFlagPicker(0); SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
set = true; set = true;
} }
@@ -405,11 +397,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{ {
SetAllianceFlagPicker(0); SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
set = true; set = true;
} }
@@ -431,7 +423,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
} }
m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; _flagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
} }
} }
@@ -445,40 +437,40 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
//alliance flag picked up from base //alliance flag picked up from base
if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) && this->BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
{ {
message_id = LANG_BG_WS_PICKEDUP_AF; message_id = LANG_BG_WS_PICKEDUP_AF;
type = CHAT_MSG_BG_SYSTEM_HORDE; type = CHAT_MSG_BG_SYSTEM_HORDE;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
SetAllianceFlagPicker(Source->GetGUID()); SetAllianceFlagPicker(Source->GetGUID());
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier //update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true); Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED); Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true; _bothFlagsKept = true;
} }
//horde flag picked up from base //horde flag picked up from base
if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) && this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
{ {
message_id = LANG_BG_WS_PICKEDUP_HF; message_id = LANG_BG_WS_PICKEDUP_HF;
type = CHAT_MSG_BG_SYSTEM_ALLIANCE; type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
SetHordeFlagPicker(Source->GetGUID()); SetHordeFlagPicker(Source->GetGUID());
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier //update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true); Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED); Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
m_BothFlagsKept = true; _bothFlagsKept = true;
} }
//Alliance flag on ground(not in base) (returned or picked up again from ground!) //Alliance flag on ground(not in base) (returned or picked up again from ground!)
@@ -493,7 +485,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
else else
{ {
@@ -503,11 +495,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
SetAllianceFlagPicker(Source->GetGUID()); SetAllianceFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true); Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true); Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true); Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
} }
@@ -527,7 +519,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
m_BothFlagsKept = false; _bothFlagsKept = false;
} }
else else
{ {
@@ -537,11 +529,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
SetHordeFlagPicker(Source->GetGUID()); SetHordeFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true); Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
if (m_FlagDebuffState == 1) if (_flagDebuffState == 1)
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true); Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
if (m_FlagDebuffState == 2) if (_flagDebuffState == 2)
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true); Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
} }
@@ -610,30 +602,30 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
switch (Trigger) switch (Trigger)
{ {
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update(). case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1]; //buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
break; break;
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update(). case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2]; //buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
break; break;
case 3706: // Alliance elixir of regeneration spawn case 3706: // Alliance elixir of regeneration spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1]; //buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_1];
break; break;
case 3708: // Horde elixir of regeneration spawn case 3708: // Horde elixir of regeneration spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2]; //buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_2];
break; break;
case 3707: // Alliance elixir of berserk spawn case 3707: // Alliance elixir of berserk spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1]; //buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_1];
break; break;
case 3709: // Horde elixir of berserk spawn case 3709: // Horde elixir of berserk spawn
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2]; //buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
break; break;
case 3646: // Alliance Flag spawn case 3646: // Alliance Flag spawn
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE]) if (_flagState[BG_TEAM_HORDE] && !_flagState[BG_TEAM_ALLIANCE])
if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID()) if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
EventPlayerCapturedFlag(Source); EventPlayerCapturedFlag(Source);
break; break;
case 3647: // Horde Flag spawn case 3647: // Horde Flag spawn
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE]) if (_flagState[BG_TEAM_ALLIANCE] && !_flagState[BG_TEAM_HORDE])
if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID()) if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
EventPlayerCapturedFlag(Source); EventPlayerCapturedFlag(Source);
break; break;
@@ -710,8 +702,8 @@ void BattlegroundWS::Reset()
m_FlagKeepers[BG_TEAM_HORDE] = 0; m_FlagKeepers[BG_TEAM_HORDE] = 0;
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0;
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
@@ -719,13 +711,13 @@ void BattlegroundWS::Reset()
m_HonorWinKills = (isBGWeekend) ? 3 : 1; m_HonorWinKills = (isBGWeekend) ? 3 : 1;
m_HonorEndKills = (isBGWeekend) ? 4 : 2; m_HonorEndKills = (isBGWeekend) ? 4 : 2;
// For WorldState // For WorldState
m_minutesElapsed = 0; _minutesElapsed = 0;
m_LastFlagCaptureTeam = 0; _lastFlagCaptureTeam = 0;
/* Spirit nodes is static at this BG and then not required deleting at BG reset. /* Spirit nodes is static at this BG and then not required deleting at BG reset.
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
DelCreature(WS_SPIRIT_MAIN_ALLIANCE); DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE]) if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
DelCreature(WS_SPIRIT_MAIN_HORDE); DelCreature(WS_SPIRIT_MAIN_HORDE);
*/ */
} }
@@ -757,8 +749,8 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{ {
BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found if (itr == PlayerScores.end()) // player not found
return; return;
switch (type) switch (type)
@@ -805,16 +797,16 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) else if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
else else
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) else if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1); data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
else else
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0); data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0);
@@ -824,17 +816,17 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
if (GetStatus() == STATUS_IN_PROGRESS) if (GetStatus() == STATUS_IN_PROGRESS)
{ {
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1);
data << uint32(BG_WS_STATE_TIMER) << uint32(25-m_minutesElapsed); data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed);
} }
else else
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0); data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0);
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
else else
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2);
else else
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1); data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1);
@@ -180,7 +180,7 @@ class BattlegroundWS : public Battleground
bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; } bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
void RespawnFlag(uint32 Team, bool captured); void RespawnFlag(uint32 Team, bool captured);
void RespawnFlagAfterDrop(uint32 Team); void RespawnFlagAfterDrop(uint32 Team);
uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; } uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
/* Battleground Events */ /* Battleground Events */
virtual void EventPlayerDroppedFlag(Player* Source); virtual void EventPlayerDroppedFlag(Player* Source);
@@ -196,7 +196,7 @@ class BattlegroundWS : public Battleground
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
void UpdateFlagState(uint32 team, uint32 value); void UpdateFlagState(uint32 team, uint32 value);
void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; } void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team); void UpdateTeamScore(uint32 team);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
@@ -211,18 +211,18 @@ class BattlegroundWS : public Battleground
private: private:
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
uint64 m_DroppedFlagGUID[2]; uint64 m_DroppedFlagGUID[2];
uint8 m_FlagState[2]; // for checking flag state uint8 _flagState[2]; // for checking flag state
int32 m_FlagsTimer[2]; int32 _flagsTimer[2];
int32 m_FlagsDropTimer[2]; int32 _flagsDropTimer[2];
uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal uint32 _lastFlagCaptureTeam; // Winner is based on this if score is equal
uint32 m_ReputationCapture; uint32 m_ReputationCapture;
uint32 m_HonorWinKills; uint32 m_HonorWinKills;
uint32 m_HonorEndKills; uint32 m_HonorEndKills;
int32 m_FlagSpellForceTimer; int32 _flagSpellForceTimer;
bool m_BothFlagsKept; bool _bothFlagsKept;
uint8 m_FlagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
uint8 m_minutesElapsed; uint8 _minutesElapsed;
virtual void PostUpdateImpl(uint32 diff); virtual void PostUpdateImpl(uint32 diff);
}; };