* Rename: BattleGround -> Battleground.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-08 04:37:24 +02:00
parent 3d1efa6ed7
commit 909e332579
77 changed files with 1556 additions and 1556 deletions
File diff suppressed because it is too large Load Diff
+60 -60
View File
@@ -30,12 +30,12 @@ class GameObject;
class Group;
class Player;
class WorldPacket;
class BattleGroundMap;
class BattlegroundMap;
struct PvPDifficultyEntry;
struct WorldSafeLocsEntry;
enum BattleGroundSounds
enum BattlegroundSounds
{
SOUND_HORDE_WINS = 8454,
SOUND_ALLIANCE_WINS = 8455,
@@ -43,7 +43,7 @@ enum BattleGroundSounds
SOUND_BG_START_L70ETC = 11803,
};
enum BattleGroundQuests
enum BattlegroundQuests
{
SPELL_WS_QUEST_REWARD = 43483,
SPELL_AB_QUEST_REWARD = 43484,
@@ -55,7 +55,7 @@ enum BattleGroundQuests
SPELL_AB_QUEST_REWARD_5_BASES = 24064
};
enum BattleGroundMarks
enum BattlegroundMarks
{
SPELL_WS_MARK_LOSER = 24950,
SPELL_WS_MARK_WINNER = 24951,
@@ -72,19 +72,19 @@ enum BattleGroundMarks
ITEM_SA_MARK_OF_HONOR = 42425
};
enum BattleGroundMarksCount
enum BattlegroundMarksCount
{
ITEM_WINNER_COUNT = 3,
ITEM_LOSER_COUNT = 1
};
enum BattleGroundCreatures
enum BattlegroundCreatures
{
BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance
BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde
};
enum BattleGroundSpells
enum BattlegroundSpells
{
SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect
SPELL_SPIRIT_HEAL_CHANNEL = 22011, // Spirit Heal Channel
@@ -103,7 +103,7 @@ enum BattleGroundSpells
SPELL_HONORABLE_DEFENDER_60Y = 66157 // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
};
enum BattleGroundTimeIntervals
enum BattlegroundTimeIntervals
{
RESURRECTION_INTERVAL = 30000, // ms
//REMIND_INTERVAL = 10000, // ms
@@ -116,7 +116,7 @@ enum BattleGroundTimeIntervals
BUFF_RESPAWN_TIME = 180, // secs
};
enum BattleGroundStartTimeIntervals
enum BattlegroundStartTimeIntervals
{
BG_START_DELAY_2M = 120000, // ms (2 minutes)
BG_START_DELAY_1M = 60000, // ms (1 minute)
@@ -125,14 +125,14 @@ enum BattleGroundStartTimeIntervals
BG_START_DELAY_NONE = 0, // ms
};
enum BattleGroundBuffObjects
enum BattlegroundBuffObjects
{
BG_OBJECTID_SPEEDBUFF_ENTRY = 179871,
BG_OBJECTID_REGENBUFF_ENTRY = 179904,
BG_OBJECTID_BERSERKERBUFF_ENTRY = 179905
};
enum BattleGroundRandomRewards
enum BattlegroundRandomRewards
{
BG_REWARD_WINNER_HONOR_FIRST = 30,
BG_REWARD_WINNER_ARENA_FIRST = 25,
@@ -144,7 +144,7 @@ enum BattleGroundRandomRewards
const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
enum BattleGroundStatus
enum BattlegroundStatus
{
STATUS_NONE = 0, // first status, should mean bg is not instance
STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue
@@ -153,15 +153,15 @@ enum BattleGroundStatus
STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
};
struct BattleGroundPlayer
struct BattlegroundPlayer
{
time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes
uint32 Team; // Player's team
};
struct BattleGroundObjectInfo
struct BattlegroundObjectInfo
{
BattleGroundObjectInfo() : object(NULL), timer(0), spellid(0) {}
BattlegroundObjectInfo() : object(NULL), timer(0), spellid(0) {}
GameObject *object;
int32 timer;
@@ -169,7 +169,7 @@ struct BattleGroundObjectInfo
};
// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time
enum BattleGroundQueueTypeId
enum BattlegroundQueueTypeId
{
BATTLEGROUND_QUEUE_NONE = 0,
BATTLEGROUND_QUEUE_AV = 1,
@@ -220,27 +220,27 @@ enum ArenaType
ARENA_TYPE_5v5 = 5
};
enum BattleGroundType
enum BattlegroundType
{
TYPE_BATTLEGROUND = 3,
TYPE_ARENA = 4
};
enum BattleGroundWinner
enum BattlegroundWinner
{
WINNER_HORDE = 0,
WINNER_ALLIANCE = 1,
WINNER_NONE = 2
};
enum BattleGroundTeamId
enum BattlegroundTeamId
{
BG_TEAM_ALLIANCE = 0,
BG_TEAM_HORDE = 1
};
#define BG_TEAMS_COUNT 2
enum BattleGroundStartingEvents
enum BattlegroundStartingEvents
{
BG_STARTING_EVENT_NONE = 0x00,
BG_STARTING_EVENT_1 = 0x01,
@@ -249,7 +249,7 @@ enum BattleGroundStartingEvents
BG_STARTING_EVENT_4 = 0x08
};
enum BattleGroundStartingEventsIds
enum BattlegroundStartingEventsIds
{
BG_STARTING_EVENT_FIRST = 0,
BG_STARTING_EVENT_SECOND = 1,
@@ -288,13 +288,13 @@ enum GroupJoinBattlegroundResult
ERR_IN_NON_RANDOM_BG = -15, // Can't queue for Random Battleground while in another Battleground queue.
};
class BattleGroundScore
class BattlegroundScore
{
public:
BattleGroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
BonusHonor(0), DamageDone(0), HealingDone(0)
{}
virtual ~BattleGroundScore() {} //virtual destructor is used when deleting score from scores map
virtual ~BattlegroundScore() {} //virtual destructor is used when deleting score from scores map
uint32 KillingBlows;
uint32 Deaths;
@@ -320,17 +320,17 @@ This class is used to:
3. some certain cases, same for all battlegrounds
4. It has properties same for all battlegrounds
*/
class BattleGround
class Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
/* Construction */
BattleGround();
/*BattleGround(const BattleGround& bg);*/
virtual ~BattleGround();
Battleground();
/*Battleground(const Battleground& bg);*/
virtual ~Battleground();
virtual void Update(uint32 diff); // must be implemented in BG subclass of BG specific update code, but must in begginning call parent version
virtual bool SetupBattleGround() // must be implemented in BG subclass
virtual bool SetupBattleground() // must be implemented in BG subclass
{
return true;
}
@@ -350,10 +350,10 @@ class BattleGround
/* Battleground */
// Get methods:
char const* GetName() const { return m_Name; }
BattleGroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
BattleGroundBracketId GetBracketId() const { return m_BracketId; }
BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
BattlegroundBracketId GetBracketId() const { return m_BracketId; }
uint32 GetInstanceID() const { return m_InstanceID; }
BattleGroundStatus GetStatus() const { return m_Status; }
BattlegroundStatus GetStatus() const { return m_Status; }
uint32 GetClientInstanceID() const { return m_ClientInstanceID; }
uint32 GetStartTime() const { return m_StartTime; }
uint32 GetEndTime() const { return m_EndTime; }
@@ -377,12 +377,12 @@ class BattleGround
// Set methods:
void SetName(char const* Name) { m_Name = Name; }
void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; }
void SetRandomTypeID(BattleGroundTypeId TypeID) { m_RandomTypeID = TypeID; }
void SetTypeID(BattlegroundTypeId TypeID) { m_TypeID = TypeID; }
void SetRandomTypeID(BattlegroundTypeId TypeID) { m_RandomTypeID = TypeID; }
//here we can count minlevel and maxlevel for players
void SetBracket(PvPDifficultyEntry const* bracketEntry);
void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
void SetStatus(BattleGroundStatus Status) { m_Status = Status; }
void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
void SetStartTime(uint32 Time) { m_StartTime = Time; }
void SetEndTime(uint32 Time) { m_EndTime = Time; }
@@ -420,16 +420,16 @@ class BattleGround
uint32 GetFreeSlotsForTeam(uint32 Team) const;
bool isArena() const { return m_IsArena; }
bool isBattleGround() const { return !m_IsArena; }
bool isBattleground() const { return !m_IsArena; }
bool isRated() const { return m_IsRated; }
typedef std::map<uint64, BattleGroundPlayer> BattleGroundPlayerMap;
BattleGroundPlayerMap const& GetPlayers() const { return m_Players; }
typedef std::map<uint64, BattlegroundPlayer> BattlegroundPlayerMap;
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
typedef std::map<uint64, BattleGroundScore*> BattleGroundScoreMap;
BattleGroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
BattleGroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); }
uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
@@ -437,7 +437,7 @@ class BattleGround
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
void RemovePlayerFromResurrectQueue(uint64 player_guid);
void StartBattleGround();
void StartBattleground();
GameObject* GetBGObject(uint32 type);
Creature* GetBGCreature(uint32 type);
@@ -446,8 +446,8 @@ class BattleGround
uint32 GetMapId() const { return m_MapId; }
/* Map pointers */
void SetBgMap(BattleGroundMap* map) { m_Map = map; }
BattleGroundMap* GetBgMap()
void SetBgMap(BattlegroundMap* map) { m_Map = map; }
BattlegroundMap* GetBgMap()
{
ASSERT(m_Map);
return m_Map;
@@ -456,7 +456,7 @@ class BattleGround
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const
{
BattleGroundTeamId idx = GetTeamIndexByTeamId(TeamID);
BattlegroundTeamId idx = GetTeamIndexByTeamId(TeamID);
X = m_TeamStartLocX[idx];
Y = m_TeamStartLocY[idx];
Z = m_TeamStartLocZ[idx];
@@ -480,7 +480,7 @@ class BattleGround
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID);
void UpdateWorldState(uint32 Field, uint32 Value);
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *Source);
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
void BlockMovement(Player *plr);
void SendWarningToAll(int32 entry, ...);
@@ -496,7 +496,7 @@ class BattleGround
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
static BattleGroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
static BattlegroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
@@ -568,7 +568,7 @@ class BattleGround
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
uint32 GetPlayerTeam(uint64 guid);
uint32 GetOtherTeam(uint32 teamId);
bool IsPlayerInBattleGround(uint64 guid);
bool IsPlayerInBattleground(uint64 guid);
void SetDeleteThis() {m_SetDeleteThis = true;}
@@ -579,18 +579,18 @@ class BattleGround
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
protected:
//this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends BattleGround
//this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
void EndNow();
void PlayerAddedToBGCheckIfBGIsRunning(Player* plr);
/* Scorekeeping */
BattleGroundScoreMap m_PlayerScores; // Player scores
BattlegroundScoreMap m_PlayerScores; // Player scores
// must be implemented in BG subclass
virtual void RemovePlayer(Player * /*player*/, uint64 /*guid*/) {}
/* Player lists, those need to be accessible by inherited classes */
BattleGroundPlayerMap m_Players;
BattlegroundPlayerMap m_Players;
// Spirit Guide guid + Player list GUIDS
std::map<uint64, std::vector<uint64> > m_ReviveQueue;
@@ -598,7 +598,7 @@ class BattleGround
these are important variables used for starting messages
*/
uint8 m_Events;
BattleGroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT];
BattlegroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT];
//this must be filled in constructors!
uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT];
@@ -608,17 +608,17 @@ class BattleGround
BGHonorMode m_HonorMode;
private:
/* Battleground */
BattleGroundTypeId m_TypeID;
BattleGroundTypeId m_RandomTypeID;
uint32 m_InstanceID; //BattleGround Instance's GUID!
BattleGroundStatus m_Status;
BattlegroundTypeId m_TypeID;
BattlegroundTypeId m_RandomTypeID;
uint32 m_InstanceID; //Battleground Instance's GUID!
BattlegroundStatus m_Status;
uint32 m_ClientInstanceID; //the instance-id which is sent to the client and without any other internal use
uint32 m_StartTime;
int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
uint32 m_LastResurrectTime;
BattleGroundBracketId m_BracketId;
BattlegroundBracketId m_BracketId;
uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattleGroundMgr.BGFreeSlotQueue[bgTypeId] deque
bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
bool m_IsArena;
uint8 m_Winner; // 0=alliance, 1=horde, 2=none
@@ -659,7 +659,7 @@ class BattleGround
/* Start location */
uint32 m_MapId;
BattleGroundMap* m_Map;
BattlegroundMap* m_Map;
float m_TeamStartLocX[BG_TEAMS_COUNT];
float m_TeamStartLocY[BG_TEAMS_COUNT];
float m_TeamStartLocZ[BG_TEAMS_COUNT];
+162 -162
View File
@@ -25,20 +25,20 @@
#include "ArenaTeam.h"
#include "BattleGroundMgr.h"
#include "BattleGroundAV.h"
#include "BattleGroundAB.h"
#include "BattleGroundEY.h"
#include "BattleGroundWS.h"
#include "BattleGroundNA.h"
#include "BattleGroundBE.h"
#include "BattleGroundAA.h"
#include "BattleGroundRL.h"
#include "BattleGroundSA.h"
#include "BattleGroundDS.h"
#include "BattleGroundRV.h"
#include "BattleGroundIC.h"
#include "BattleGroundRB.h"
#include "BattlegroundMgr.h"
#include "BattlegroundAV.h"
#include "BattlegroundAB.h"
#include "BattlegroundEY.h"
#include "BattlegroundWS.h"
#include "BattlegroundNA.h"
#include "BattlegroundBE.h"
#include "BattlegroundAA.h"
#include "BattlegroundRL.h"
#include "BattlegroundSA.h"
#include "BattlegroundDS.h"
#include "BattlegroundRV.h"
#include "BattlegroundIC.h"
#include "BattlegroundRB.h"
#include "Chat.h"
#include "Map.h"
#include "MapInstanced.h"
@@ -54,29 +54,29 @@
/*** BATTLEGROUND MANAGER ***/
/*********************************************************/
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
BattlegroundMgr::BattlegroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
{
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
m_BattleGrounds[i].clear();
m_Battlegrounds[i].clear();
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
m_Testing=false;
}
BattleGroundMgr::~BattleGroundMgr()
BattlegroundMgr::~BattlegroundMgr()
{
DeleteAllBattleGrounds();
DeleteAllBattlegrounds();
}
void BattleGroundMgr::DeleteAllBattleGrounds()
void BattlegroundMgr::DeleteAllBattlegrounds()
{
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
{
for (BattleGroundSet::iterator itr = m_BattleGrounds[i].begin(); itr != m_BattleGrounds[i].end();)
for (BattlegroundSet::iterator itr = m_Battlegrounds[i].begin(); itr != m_Battlegrounds[i].end();)
{
BattleGround * bg = itr->second;
m_BattleGrounds[i].erase(itr++);
if (!m_ClientBattleGroundIds[i][bg->GetBracketId()].empty())
m_ClientBattleGroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
Battleground * bg = itr->second;
m_Battlegrounds[i].erase(itr++);
if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
delete bg;
}
}
@@ -84,23 +84,23 @@ void BattleGroundMgr::DeleteAllBattleGrounds()
// destroy template battlegrounds that listed only in queues (other already terminated)
for (uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId)
{
// ~BattleGround call unregistring BG from queue
// ~Battleground call unregistring BG from queue
while (!BGFreeSlotQueue[bgTypeId].empty())
delete BGFreeSlotQueue[bgTypeId].front();
}
}
// used to update running battlegrounds, and delete finished ones
void BattleGroundMgr::Update(uint32 diff)
void BattlegroundMgr::Update(uint32 diff)
{
BattleGroundSet::iterator itr, next;
BattlegroundSet::iterator itr, next;
for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
{
itr = m_BattleGrounds[i].begin();
itr = m_Battlegrounds[i].begin();
// skip updating battleground template
if (itr != m_BattleGrounds[i].end())
if (itr != m_Battlegrounds[i].end())
++itr;
for (; itr != m_BattleGrounds[i].end(); itr = next)
for (; itr != m_Battlegrounds[i].end(); itr = next)
{
next = itr;
++next;
@@ -109,10 +109,10 @@ void BattleGroundMgr::Update(uint32 diff)
// direct deletion caused crashes
if (itr->second->m_SetDeleteThis)
{
BattleGround * bg = itr->second;
m_BattleGrounds[i].erase(itr);
if (!m_ClientBattleGroundIds[i][bg->GetBracketId()].empty())
m_ClientBattleGroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
Battleground * bg = itr->second;
m_Battlegrounds[i].erase(itr);
if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
delete bg;
}
}
@@ -133,10 +133,10 @@ void BattleGroundMgr::Update(uint32 diff)
{
uint32 arenaRating = scheduled[i] >> 32;
uint8 arenaType = scheduled[i] >> 24 & 255;
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16 & 255);
BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255);
BattleGroundBracketId bracket_id = BattleGroundBracketId(scheduled[i] & 255);
m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, bracket_id, arenaType, arenaRating > 0, arenaRating);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255);
BattlegroundTypeId bgTypeId = BattlegroundTypeId((scheduled[i] >> 8) & 255);
BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255);
m_BattlegroundQueues[bgQueueTypeId].Update(bgTypeId, bracket_id, arenaType, arenaRating > 0, arenaRating);
}
}
@@ -147,12 +147,12 @@ void BattleGroundMgr::Update(uint32 diff)
if (m_NextRatingDiscardUpdate < diff)
{
// forced update for rated arenas (scan all, but skipped non rated)
sLog.outDebug("BattleGroundMgr: UPDATING ARENA QUEUES");
sLog.outDebug("BattlegroundMgr: UPDATING ARENA QUEUES");
for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattleGroundQueues[qtype].Update(
BATTLEGROUND_AA, BattleGroundBracketId(bracket),
BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId(qtype)), true, 0);
m_BattlegroundQueues[qtype].Update(
BATTLEGROUND_AA, BattlegroundBracketId(bracket),
BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId(qtype)), true, 0);
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
}
@@ -176,7 +176,7 @@ void BattleGroundMgr::Update(uint32 diff)
}
}
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype)
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype)
{
// we can be in 2 queues in same time...
@@ -192,7 +192,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
*data << uint32(QueueSlot); // queue id (0...1) - player can be in 2 queues in time
// The following segment is read as uint64 in client but can be appended as their original type.
*data << uint8(arenatype);
sLog.outDebug("BattleGroundMgr::BuildBattleGroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID());
sLog.outDebug("BattlegroundMgr::BuildBattlegroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID());
*data << uint8(bg->isArena() ? 0xC : 0x2);
*data << uint32(bg->GetTypeID());
*data << uint16(0x1F90);
@@ -229,7 +229,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
}
}
void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg)
{
uint8 type = (bg->isArena() ? 1 : 0);
// last check on 3.0.3
@@ -272,7 +272,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
*data << (int32)(bg->GetPlayerScoresSize());
for (BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
for (Battleground::BattlegroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
{
*data << (uint64)itr->first;
*data << (int32)itr->second->KillingBlows;
@@ -300,30 +300,30 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
{
case 489:
*data << (uint32)0x00000002; // count of next fields
*data << (uint32)((BattleGroundWGScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattleGroundWGScore*)itr->second)->FlagReturns; // flag returns
*data << (uint32)((BattlegroundWGScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattlegroundWGScore*)itr->second)->FlagReturns; // flag returns
break;
case 566:
*data << (uint32)0x00000001; // count of next fields
*data << (uint32)((BattleGroundEYScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattlegroundEYScore*)itr->second)->FlagCaptures; // flag captures
break;
case 529:
*data << (uint32)0x00000002; // count of next fields
*data << (uint32)((BattleGroundABScore*)itr->second)->BasesAssaulted; // bases asssulted
*data << (uint32)((BattleGroundABScore*)itr->second)->BasesDefended; // bases defended
*data << (uint32)((BattlegroundABScore*)itr->second)->BasesAssaulted; // bases asssulted
*data << (uint32)((BattlegroundABScore*)itr->second)->BasesDefended; // bases defended
break;
case 30:
*data << (uint32)0x00000005; // count of next fields
*data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted
*data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended
*data << (uint32)((BattleGroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted
*data << (uint32)((BattleGroundAVScore*)itr->second)->TowersDefended; // TowersDefended
*data << (uint32)((BattleGroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured
*data << (uint32)((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted
*data << (uint32)((BattlegroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended
*data << (uint32)((BattlegroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted
*data << (uint32)((BattlegroundAVScore*)itr->second)->TowersDefended; // TowersDefended
*data << (uint32)((BattlegroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured
break;
case 607:
*data << uint32(2);
*data << uint32(((BattleGroundSAScore*)itr->second)->demolishers_destroyed);
*data << uint32(((BattleGroundSAScore*)itr->second)->gates_destroyed);
*data << uint32(((BattlegroundSAScore*)itr->second)->demolishers_destroyed);
*data << uint32(((BattlegroundSAScore*)itr->second)->gates_destroyed);
break;
default:
*data << (int32)0; // 0
@@ -331,25 +331,25 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
}
case BATTLEGROUND_AV:
*data << (uint32)0x00000005; // count of next fields
*data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted
*data << (uint32)((BattleGroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended
*data << (uint32)((BattleGroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted
*data << (uint32)((BattleGroundAVScore*)itr->second)->TowersDefended; // TowersDefended
*data << (uint32)((BattleGroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured
*data << (uint32)((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted; // GraveyardsAssaulted
*data << (uint32)((BattlegroundAVScore*)itr->second)->GraveyardsDefended; // GraveyardsDefended
*data << (uint32)((BattlegroundAVScore*)itr->second)->TowersAssaulted; // TowersAssaulted
*data << (uint32)((BattlegroundAVScore*)itr->second)->TowersDefended; // TowersDefended
*data << (uint32)((BattlegroundAVScore*)itr->second)->MinesCaptured; // MinesCaptured
break;
case BATTLEGROUND_WS:
*data << (uint32)0x00000002; // count of next fields
*data << (uint32)((BattleGroundWGScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattleGroundWGScore*)itr->second)->FlagReturns; // flag returns
*data << (uint32)((BattlegroundWGScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattlegroundWGScore*)itr->second)->FlagReturns; // flag returns
break;
case BATTLEGROUND_AB:
*data << (uint32)0x00000002; // count of next fields
*data << (uint32)((BattleGroundABScore*)itr->second)->BasesAssaulted; // bases asssulted
*data << (uint32)((BattleGroundABScore*)itr->second)->BasesDefended; // bases defended
*data << (uint32)((BattlegroundABScore*)itr->second)->BasesAssaulted; // bases asssulted
*data << (uint32)((BattlegroundABScore*)itr->second)->BasesDefended; // bases defended
break;
case BATTLEGROUND_EY:
*data << (uint32)0x00000001; // count of next fields
*data << (uint32)((BattleGroundEYScore*)itr->second)->FlagCaptures; // flag captures
*data << (uint32)((BattlegroundEYScore*)itr->second)->FlagCaptures; // flag captures
break;
case BATTLEGROUND_NA:
case BATTLEGROUND_BE:
@@ -357,8 +357,8 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
case BATTLEGROUND_RL:
case BATTLEGROUND_SA:
*data << uint32(2);
*data << uint32(((BattleGroundSAScore*)itr->second)->demolishers_destroyed);
*data << uint32(((BattleGroundSAScore*)itr->second)->gates_destroyed);
*data << uint32(((BattlegroundSAScore*)itr->second)->demolishers_destroyed);
*data << uint32(((BattlegroundSAScore*)itr->second)->gates_destroyed);
break;
case BATTLEGROUND_DS: // wotlk
case BATTLEGROUND_RV: // wotlk
@@ -373,7 +373,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
}
}
void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result)
void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result)
{
data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
*data << int32(result);
@@ -381,43 +381,43 @@ void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, Grou
*data << uint64(0); // player guid
}
void BattleGroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value)
void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value)
{
data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4);
*data << uint32(field);
*data << uint32(value);
}
void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid)
void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid)
{
data->Initialize(SMSG_PLAY_SOUND, 4);
*data << uint32(soundid);
}
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid)
void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket *data, const uint64& guid)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
*data << uint64(guid);
}
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr)
void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket *data, Player *plr)
{
data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8);
*data << uint64(plr->GetGUID());
}
BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId)
Battleground * BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId)
{
//cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from
//cause at HandleBattlegroundJoinOpcode the clients sends the instanceid he gets from
//SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
Battleground* bg = GetBattlegroundTemplate(bgTypeId);
if (!bg)
return NULL;
if (bg->isArena())
return GetBattleGround(instanceId, bgTypeId);
return GetBattleground(instanceId, bgTypeId);
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
for (BattlegroundSet::iterator itr = m_Battlegrounds[bgTypeId].begin(); itr != m_Battlegrounds[bgTypeId].end(); ++itr)
{
if (itr->second->GetClientInstanceID() == instanceId)
return itr->second;
@@ -425,33 +425,33 @@ BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 inst
return NULL;
}
BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId)
Battleground * BattlegroundMgr::GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId)
{
if (!InstanceID)
return NULL;
//search if needed
BattleGroundSet::iterator itr;
BattlegroundSet::iterator itr;
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
{
itr = m_BattleGrounds[i].find(InstanceID);
if (itr != m_BattleGrounds[i].end())
itr = m_Battlegrounds[i].find(InstanceID);
if (itr != m_Battlegrounds[i].end())
return itr->second;
}
return NULL;
}
itr = m_BattleGrounds[bgTypeId].find(InstanceID);
return ((itr != m_BattleGrounds[bgTypeId].end()) ? itr->second : NULL);
itr = m_Battlegrounds[bgTypeId].find(InstanceID);
return ((itr != m_Battlegrounds[bgTypeId].end()) ? itr->second : NULL);
}
BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId)
Battleground * BattlegroundMgr::GetBattlegroundTemplate(BattlegroundTypeId bgTypeId)
{
//map is sorted and we can be sure that lowest instance id has only BG template
return m_BattleGrounds[bgTypeId].empty() ? NULL : m_BattleGrounds[bgTypeId].begin()->second;
return m_Battlegrounds[bgTypeId].empty() ? NULL : m_Battlegrounds[bgTypeId].begin()->second;
}
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
{
if (IsArenaType(bgTypeId))
return 0; //arenas don't have client-instanceids
@@ -463,26 +463,26 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
// the following works, because std::set is default ordered with "<"
// the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
uint32 lastId = 0;
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracket_id].end();)
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracket_id].end();)
{
if ((++lastId) != *itr) //if there is a gap between the ids, we will break..
break;
lastId = *itr;
}
m_ClientBattleGroundIds[bgTypeId][bracket_id].insert(lastId + 1);
m_ClientBattlegroundIds[bgTypeId][bracket_id].insert(lastId + 1);
return lastId + 1;
}
// create a new battleground that will really be used to play
BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
Battleground * BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
{
// get the template BG
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
BattleGroundSelectionWeightMap *selectionWeights = NULL;
Battleground *bg_template = GetBattlegroundTemplate(bgTypeId);
BattlegroundSelectionWeightMap *selectionWeights = NULL;
if (!bg_template)
{
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
sLog.outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
return NULL;
}
bool isRandom = false;
@@ -503,7 +503,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
uint32 selectedWeight = 0;
bgTypeId = BATTLEGROUND_TYPE_NONE;
// Get sum of all weights
for (BattleGroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
Weight += it->second;
if (!Weight)
return NULL;
@@ -512,7 +512,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
// Select the correct bg (if we have in DB A(10), B(20), C(10), D(15) --> [0---A---9|10---B---29|30---C---39|40---D---54])
Weight = 0;
for (BattleGroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
{
Weight += it->second;
if (selectedWeight < Weight)
@@ -521,56 +521,56 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
break;
}
}
bg_template = GetBattleGroundTemplate(bgTypeId);
bg_template = GetBattlegroundTemplate(bgTypeId);
if (!bg_template)
{
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
sLog.outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
return NULL;
}
}
BattleGround *bg = NULL;
Battleground *bg = NULL;
// create a copy of the BG template
switch(bgTypeId)
{
case BATTLEGROUND_AV:
bg = new BattleGroundAV(*(BattleGroundAV*)bg_template);
bg = new BattlegroundAV(*(BattlegroundAV*)bg_template);
break;
case BATTLEGROUND_WS:
bg = new BattleGroundWS(*(BattleGroundWS*)bg_template);
bg = new BattlegroundWS(*(BattlegroundWS*)bg_template);
break;
case BATTLEGROUND_AB:
bg = new BattleGroundAB(*(BattleGroundAB*)bg_template);
bg = new BattlegroundAB(*(BattlegroundAB*)bg_template);
break;
case BATTLEGROUND_NA:
bg = new BattleGroundNA(*(BattleGroundNA*)bg_template);
bg = new BattlegroundNA(*(BattlegroundNA*)bg_template);
break;
case BATTLEGROUND_BE:
bg = new BattleGroundBE(*(BattleGroundBE*)bg_template);
bg = new BattlegroundBE(*(BattlegroundBE*)bg_template);
break;
case BATTLEGROUND_AA:
bg = new BattleGroundAA(*(BattleGroundAA*)bg_template);
bg = new BattlegroundAA(*(BattlegroundAA*)bg_template);
break;
case BATTLEGROUND_EY:
bg = new BattleGroundEY(*(BattleGroundEY*)bg_template);
bg = new BattlegroundEY(*(BattlegroundEY*)bg_template);
break;
case BATTLEGROUND_RL:
bg = new BattleGroundRL(*(BattleGroundRL*)bg_template);
bg = new BattlegroundRL(*(BattlegroundRL*)bg_template);
break;
case BATTLEGROUND_SA:
bg = new BattleGroundSA(*(BattleGroundSA*)bg_template);
bg = new BattlegroundSA(*(BattlegroundSA*)bg_template);
break;
case BATTLEGROUND_DS:
bg = new BattleGroundDS(*(BattleGroundDS*)bg_template);
bg = new BattlegroundDS(*(BattlegroundDS*)bg_template);
break;
case BATTLEGROUND_RV:
bg = new BattleGroundRV(*(BattleGroundRV*)bg_template);
bg = new BattlegroundRV(*(BattlegroundRV*)bg_template);
break;
case BATTLEGROUND_IC:
bg = new BattleGroundIC(*(BattleGroundIC*)bg_template);
bg = new BattlegroundIC(*(BattlegroundIC*)bg_template);
break;
case BATTLEGROUND_RB:
bg = new BattleGroundRB(*(BattleGroundRB*)bg_template);
bg = new BattlegroundRB(*(BattlegroundRB*)bg_template);
break;
default:
//error, but it is handled few lines above
@@ -599,27 +599,27 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
}
// used to create the BG templates
uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId)
uint32 BattlegroundMgr::CreateBattleground(BattlegroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattlegroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId)
{
// Create the BG
BattleGround *bg = NULL;
Battleground *bg = NULL;
switch(bgTypeId)
{
case BATTLEGROUND_AV: bg = new BattleGroundAV; break;
case BATTLEGROUND_WS: bg = new BattleGroundWS; break;
case BATTLEGROUND_AB: bg = new BattleGroundAB; break;
case BATTLEGROUND_NA: bg = new BattleGroundNA; break;
case BATTLEGROUND_BE: bg = new BattleGroundBE; break;
case BATTLEGROUND_AA: bg = new BattleGroundAA; break;
case BATTLEGROUND_EY: bg = new BattleGroundEY; break;
case BATTLEGROUND_RL: bg = new BattleGroundRL; break;
case BATTLEGROUND_SA: bg = new BattleGroundSA; break;
case BATTLEGROUND_DS: bg = new BattleGroundDS; break;
case BATTLEGROUND_RV: bg = new BattleGroundRV; break;
case BATTLEGROUND_IC: bg = new BattleGroundIC; break;
case BATTLEGROUND_RB: bg = new BattleGroundRB; break;
case BATTLEGROUND_AV: bg = new BattlegroundAV; break;
case BATTLEGROUND_WS: bg = new BattlegroundWS; break;
case BATTLEGROUND_AB: bg = new BattlegroundAB; break;
case BATTLEGROUND_NA: bg = new BattlegroundNA; break;
case BATTLEGROUND_BE: bg = new BattlegroundBE; break;
case BATTLEGROUND_AA: bg = new BattlegroundAA; break;
case BATTLEGROUND_EY: bg = new BattlegroundEY; break;
case BATTLEGROUND_RL: bg = new BattlegroundRL; break;
case BATTLEGROUND_SA: bg = new BattlegroundSA; break;
case BATTLEGROUND_DS: bg = new BattlegroundDS; break;
case BATTLEGROUND_RV: bg = new BattlegroundRV; break;
case BATTLEGROUND_IC: bg = new BattlegroundIC; break;
case BATTLEGROUND_RB: bg = new BattlegroundRB; break;
default:
bg = new BattleGround;
bg = new Battleground;
break;
}
@@ -631,20 +631,20 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam);
bg->SetMinPlayers(MinPlayersPerTeam * 2);
bg->SetMaxPlayers(MaxPlayersPerTeam * 2);
bg->SetName(BattleGroundName);
bg->SetName(BattlegroundName);
bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO);
bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO);
bg->SetLevelRange(LevelMin, LevelMax);
bg->SetScriptId(scriptId);
// add bg to update list
AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg);
AddBattleground(bg->GetInstanceID(), bg->GetTypeID(), bg);
// return some not-null value, bgTypeId is good enough for me
return bgTypeId;
}
void BattleGroundMgr::CreateInitialBattleGrounds()
void BattlegroundMgr::CreateInitialBattlegrounds()
{
float AStartLoc[4];
float HStartLoc[4];
@@ -690,7 +690,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
continue;
}
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
BattlegroundTypeId bgTypeID = BattlegroundTypeId(bgTypeID_);
IsArena = (bl->type == TYPE_ARENA);
MinPlayersPerTeam = fields[1].GetUInt32();
@@ -759,7 +759,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
selectionWeight = fields[9].GetUInt8();
scriptId = objmgr.GetScriptId(fields[10].GetString());
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], scriptId))
if (!CreateBattleground(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], scriptId))
continue;
if (IsArena)
@@ -776,7 +776,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
sLog.outString(">> Loaded %u battlegrounds", count);
}
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
{
if (!sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
return;
@@ -794,7 +794,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution()
sLog.outDebug("Automatic Arena Point Distribution initialized.");
}
void BattleGroundMgr::DistributeArenaPoints()
void BattlegroundMgr::DistributeArenaPoints()
{
// used to distribute arena points based on last week's stats
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_START);
@@ -841,7 +841,7 @@ void BattleGroundMgr::DistributeArenaPoints()
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END);
}
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere)
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere)
{
if (!plr)
return;
@@ -888,13 +888,13 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
uint32 count = 0;
*data << uint32(0); // number of bg instances
if (BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId))
if (Battleground* bgTemplate = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId))
{
// expected bracket entry
if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(),plr->getLevel()))
{
BattleGroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattleGroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattleGroundIds[bgTypeId][bracketId].end();++itr)
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
{
*data << uint32(*itr);
++count;
@@ -905,9 +905,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
}
}
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
void BattlegroundMgr::SendToBattleground(Player *pl, uint32 instanceId, BattlegroundTypeId bgTypeId)
{
BattleGround *bg = GetBattleGround(instanceId, bgTypeId);
Battleground *bg = GetBattleground(instanceId, bgTypeId);
if (bg)
{
uint32 mapid = bg->GetMapId();
@@ -926,7 +926,7 @@ void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGr
}
}
void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid)
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, Battleground *bg, const uint64& guid)
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
@@ -936,7 +936,7 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *
pl->GetSession()->SendPacket(&data);
}
bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
{
return (bgTypeId == BATTLEGROUND_AA ||
bgTypeId == BATTLEGROUND_BE ||
@@ -947,7 +947,7 @@ bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId)
bgTypeId == BATTLEGROUND_DS);
}
BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType)
BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
{
switch(bgTypeId)
{
@@ -987,7 +987,7 @@ BattleGroundQueueTypeId BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgType
}
}
BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId)
BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId)
{
switch(bgQueueTypeId)
{
@@ -1010,11 +1010,11 @@ BattleGroundTypeId BattleGroundMgr::BGTemplateId(BattleGroundQueueTypeId bgQueue
case BATTLEGROUND_QUEUE_5v5:
return BATTLEGROUND_AA;
default:
return BattleGroundTypeId(0); // used for unknown template (it existed and do nothing)
return BattlegroundTypeId(0); // used for unknown template (it existed and do nothing)
}
}
uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
{
switch(bgQueueTypeId)
{
@@ -1029,7 +1029,7 @@ uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
}
}
void BattleGroundMgr::ToggleTesting()
void BattlegroundMgr::ToggleTesting()
{
m_Testing = !m_Testing;
if (m_Testing)
@@ -1038,7 +1038,7 @@ void BattleGroundMgr::ToggleTesting()
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
}
void BattleGroundMgr::ToggleArenaTesting()
void BattlegroundMgr::ToggleArenaTesting()
{
m_ArenaTesting = !m_ArenaTesting;
if (m_ArenaTesting)
@@ -1047,18 +1047,18 @@ void BattleGroundMgr::ToggleArenaTesting()
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
}
void BattleGroundMgr::SetHolidayWeekends(uint32 mask)
void BattlegroundMgr::SetHolidayWeekends(uint32 mask)
{
for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
{
if (BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype)))
if (Battleground * bg = GetBattlegroundTemplate(BattlegroundTypeId(bgtype)))
{
bg->SetHoliday(mask & (1 << bgtype));
}
}
}
void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
void BattlegroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
{
//This method must be atomic, TODO add mutex
//we will use only 1 number created of bgTypeId and bracket_id
@@ -1076,7 +1076,7 @@ void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, B
m_QueueUpdateScheduler.push_back(schedule_id);
}
uint32 BattleGroundMgr::GetMaxRatingDifference() const
uint32 BattlegroundMgr::GetMaxRatingDifference() const
{
// this is for stupid people who can't use brain and set max rating difference to 0
uint32 diff = sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE);
@@ -1085,17 +1085,17 @@ uint32 BattleGroundMgr::GetMaxRatingDifference() const
return diff;
}
uint32 BattleGroundMgr::GetRatingDiscardTimer() const
uint32 BattlegroundMgr::GetRatingDiscardTimer() const
{
return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER);
}
uint32 BattleGroundMgr::GetPrematureFinishTime() const
uint32 BattlegroundMgr::GetPrematureFinishTime() const
{
return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER);
}
void BattleGroundMgr::LoadBattleMastersEntry()
void BattlegroundMgr::LoadBattleMastersEntry()
{
mBattleMastersMap.clear(); // need for reload case
@@ -1130,7 +1130,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
continue;
}
mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId);
mBattleMastersMap[entry] = BattlegroundTypeId(bgTypeId);
} while (result->NextRow());
@@ -1138,7 +1138,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
sLog.outString(">> Loaded %u battlemaster entries", count);
}
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
{
switch (bgTypeId)
{
@@ -1150,7 +1150,7 @@ HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId
}
}
BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
BattlegroundTypeId BattlegroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
{
switch (holiday)
{
@@ -1162,12 +1162,12 @@ BattleGroundTypeId BattleGroundMgr::WeekendHolidayIdToBGType(HolidayIds holiday)
}
}
bool BattleGroundMgr::IsBGWeekend(BattleGroundTypeId bgTypeId)
bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
{
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
}
void BattleGroundMgr::DoCompleteAchievement(uint32 achievement, Player * player)
void BattlegroundMgr::DoCompleteAchievement(uint32 achievement, Player * player)
{
AchievementEntry const* AE = GetAchievementStore()->LookupEntry(achievement);
+42 -42
View File
@@ -23,64 +23,64 @@
#include "Common.h"
#include "DBCEnums.h"
#include "BattleGround.h"
#include "BattleGroundQueue.h"
#include "Battleground.h"
#include "BattlegroundQueue.h"
#include "ace/Singleton.h"
typedef std::map<uint32, BattleGround*> BattleGroundSet;
typedef std::map<uint32, Battleground*> BattlegroundSet;
typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap;
typedef UNORDERED_MAP<uint32, BattlegroundTypeId> BattleMastersMap;
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
#define WS_ARENA_DISTRIBUTION_TIME 20001 // Custom worldstate
class BattleGroundMgr
class BattlegroundMgr
{
/// Todo: Thread safety?
/* Construction */
friend class ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>;
BattleGroundMgr();
friend class ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>;
BattlegroundMgr();
public:
~BattleGroundMgr();
~BattlegroundMgr();
void Update(uint32 diff);
/* Packet Building */
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid);
void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId, uint8 fromWhere);
void BuildPlayerJoinedBattlegroundPacket(WorldPacket *data, Player *plr);
void BuildPlayerLeftBattlegroundPacket(WorldPacket *data, const uint64& guid);
void BuildBattlegroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype);
void BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg);
void BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype);
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid);
void SendAreaSpiritHealerQueryOpcode(Player *pl, Battleground *bg, const uint64& guid);
/* Battlegrounds */
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId);
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
Battleground* GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId);
BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
Battleground* GetBattlegroundTemplate(BattlegroundTypeId bgTypeId);
Battleground* CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId);
uint32 CreateBattleground(BattlegroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattlegroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId);
void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; };
void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); }
uint32 CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
void AddBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId, Battleground* BG) { m_Battlegrounds[bgTypeId][InstanceID] = BG; };
void RemoveBattleground(uint32 instanceID, BattlegroundTypeId bgTypeId) { m_Battlegrounds[bgTypeId].erase(instanceID); }
uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
void CreateInitialBattleGrounds();
void DeleteAllBattleGrounds();
void CreateInitialBattlegrounds();
void DeleteAllBattlegrounds();
void SendToBattleGround(Player *pl, uint32 InstanceID, BattleGroundTypeId bgTypeId);
void SendToBattleground(Player *pl, uint32 InstanceID, BattlegroundTypeId bgTypeId);
/* Battleground queues */
//these queues are instantiated when creating BattlegroundMrg
BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code
BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID];
void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id);
void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
uint32 GetMaxRatingDifference() const;
uint32 GetRatingDiscardTimer() const;
uint32 GetPrematureFinishTime() const;
@@ -92,7 +92,7 @@ class BattleGroundMgr
void SetHolidayWeekends(uint32 mask);
void LoadBattleMastersEntry();
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
{
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
if (itr != mBattleMastersMap.end())
@@ -103,26 +103,26 @@ class BattleGroundMgr
bool isArenaTesting() const { return m_ArenaTesting; }
bool isTesting() const { return m_Testing; }
static bool IsArenaType(BattleGroundTypeId bgTypeId);
static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); }
static BattleGroundQueueTypeId BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType);
static BattleGroundTypeId BGTemplateId(BattleGroundQueueTypeId bgQueueTypeId);
static uint8 BGArenaType(BattleGroundQueueTypeId bgQueueTypeId);
static bool IsArenaType(BattlegroundTypeId bgTypeId);
static bool IsBattlegroundType(BattlegroundTypeId bgTypeId) { return !BattlegroundMgr::IsArenaType(bgTypeId); }
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
static HolidayIds BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId);
static BattleGroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
static bool IsBGWeekend(BattleGroundTypeId bgTypeId);
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
void DoCompleteAchievement(uint32 achievement, Player * player = NULL);
private:
BattleMastersMap mBattleMastersMap;
typedef std::map<BattleGroundTypeId, uint8> BattleGroundSelectionWeightMap; // TypeId and its selectionWeight
typedef std::map<BattlegroundTypeId, uint8> BattlegroundSelectionWeightMap; // TypeId and its selectionWeight
/* Battlegrounds */
BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID];
BattleGroundSelectionWeightMap m_ArenaSelectionWeights;
BattleGroundSelectionWeightMap m_BGSelectionWeights;
BattlegroundSet m_Battlegrounds[MAX_BATTLEGROUND_TYPE_ID];
BattlegroundSelectionWeightMap m_ArenaSelectionWeights;
BattlegroundSelectionWeightMap m_BGSelectionWeights;
std::vector<uint64> m_QueueUpdateScheduler;
std::set<uint32> m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
std::set<uint32> m_ClientBattlegroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
uint32 m_NextRatingDiscardUpdate;
time_t m_NextAutoDistributionTime;
uint32 m_AutoDistributionTimeChecker;
@@ -130,6 +130,6 @@ class BattleGroundMgr
bool m_Testing;
};
#define sBattleGroundMgr (*ACE_Singleton<BattleGroundMgr, ACE_Null_Mutex>::instance())
#define sBattlegroundMgr (*ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>::instance())
#endif
@@ -18,16 +18,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGroundQueue.h"
#include "BattlegroundQueue.h"
#include "ArenaTeam.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
/*********************************************************/
/*** BATTLEGROUND QUEUE SYSTEM ***/
/*********************************************************/
BattleGroundQueue::BattleGroundQueue()
BattlegroundQueue::BattlegroundQueue()
{
for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i)
{
@@ -41,7 +41,7 @@ BattleGroundQueue::BattleGroundQueue()
}
}
BattleGroundQueue::~BattleGroundQueue()
BattlegroundQueue::~BattlegroundQueue()
{
m_QueuedPlayers.clear();
for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i)
@@ -60,7 +60,7 @@ BattleGroundQueue::~BattleGroundQueue()
/*********************************************************/
// selection pool initialization, used to clean up from prev selection
void BattleGroundQueue::SelectionPool::Init()
void BattlegroundQueue::SelectionPool::Init()
{
SelectedGroups.clear();
PlayerCount = 0;
@@ -70,7 +70,7 @@ void BattleGroundQueue::SelectionPool::Init()
// returns true when we need to try to add new group to selection pool
// returns false when selection pool is ok or when we kicked smaller group than we need to kick
// sometimes it can be called on empty selection pool
bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
bool BattlegroundQueue::SelectionPool::KickGroup(uint32 size)
{
//find maxgroup or LAST group with size == size and kick it
bool found = false;
@@ -103,7 +103,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
// used when building selection pools
// returns true if we can invite more players, or when we added group to selection pool
// returns false when selection pool is full
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
{
//if group is larger than desired count - don't allow to add it to pool
if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
@@ -123,9 +123,9 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de
/*********************************************************/
// add group or player (grp == NULL) to bg queue with the given leader and bg specifications
GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
GroupQueueInfo * BattlegroundQueue::AddGroup(Player *leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid)
{
BattleGroundBracketId bracketId = backetEntry->GetBracketId();
BattlegroundBracketId bracketId = backetEntry->GetBracketId();
// create new ginfo
GroupQueueInfo* ginfo = new GroupQueueInfo;
@@ -148,7 +148,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
index += BG_TEAMS_COUNT;
if (ginfo->Team == HORDE)
index++;
sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
sLog.outDebug("Adding Group to BattlegroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
uint32 lastOnlineTime = getMSTime();
@@ -191,7 +191,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
//announce to world, this code needs mutex
if (!isRated && !isPremade && sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
{
if (BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId))
if (Battleground* bg = sBattlegroundMgr.GetBattlegroundTemplate(ginfo->BgTypeId))
{
char const* bgName = bg->GetName();
uint32 MinPlayers = bg->GetMinPlayersPerTeam();
@@ -227,7 +227,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleG
return ginfo;
}
void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id)
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id)
{
uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime());
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
@@ -255,7 +255,7 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
(*lastPlayerAddedPointer) %= COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME;
}
uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id)
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id)
{
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
if (!ginfo->ArenaType)
@@ -277,7 +277,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
}
//remove player from queue and from group info, if group info is empty then remove it too
void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
{
//Player *plr = objmgr.GetPlayer(guid);
@@ -288,7 +288,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
itr = m_QueuedPlayers.find(guid);
if (itr == m_QueuedPlayers.end())
{
sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
sLog.outError("BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
return;
}
@@ -321,10 +321,10 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
sLog.outError("BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
return;
}
sLog.outDebug("BattleGroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
sLog.outDebug("BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
// ALL variables are correctly set
// We can ignore leveling up in queue - it should not cause crash
@@ -339,7 +339,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
// if invited to bg, and should decrease invited count, then do it
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
{
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
Battleground* bg = sBattlegroundMgr.GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
if (bg)
bg->DecreaseInvitedCount(group->Team);
}
@@ -386,13 +386,13 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
// first send removal information
if (Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
{
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
uint32 queueSlot = plr2->GetBattleGroundQueueIndex(bgQueueTypeId);
plr2->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to
Battleground * bg = sBattlegroundMgr.GetBattlegroundTemplate(group->BgTypeId);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
uint32 queueSlot = plr2->GetBattlegroundQueueIndex(bgQueueTypeId);
plr2->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to
// queue->removeplayer, it causes bugs
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
plr2->GetSession()->SendPacket(&data);
}
// then actually delete, this may delete the group as well!
@@ -401,7 +401,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
}
//returns true when player pl_guid is in queue and is invited to bgInstanceGuid
bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
bool BattlegroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid);
return (qItr != m_QueuedPlayers.end()
@@ -409,7 +409,7 @@ bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgIn
&& qItr->second.GroupInfo->RemoveInviteTime == removeTime);
}
bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo)
bool BattlegroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo)
{
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
if (qItr == m_QueuedPlayers.end())
@@ -418,7 +418,7 @@ bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInf
return true;
}
bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side)
bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, Battleground * bg, uint32 side)
{
// set side if needed
if (side)
@@ -429,9 +429,9 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
// not yet invited
// set invitation
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
BattleGroundTypeId bgTypeId = bg->GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, bg->GetArenaType());
BattleGroundBracketId bracket_id = bg->GetBracketId();
BattlegroundTypeId bgTypeId = bg->GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, bg->GetArenaType());
BattlegroundBracketId bracket_id = bg->GetBracketId();
// set ArenaTeamId for rated matches
if (bg->isArena() && bg->isRated())
@@ -450,12 +450,12 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
// invite the player
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
//sBattleGroundMgr.InvitePlayer(plr, bg, ginfo->Team);
//sBattlegroundMgr.InvitePlayer(plr, bg, ginfo->Team);
// set invited player counters
bg->IncreaseInvitedCount(ginfo->Team);
plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
plr->SetInviteForBattlegroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
// create remind invite events
BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime);
@@ -466,12 +466,12 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
WorldPacket data;
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
sLog.outDebug("Battleground: invited plr %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.",plr->GetName(),plr->GetGUIDLow(),bg->GetInstanceID(),queueSlot,bg->GetTypeID());
// send status packet
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
plr->GetSession()->SendPacket(&data);
}
return true;
@@ -485,7 +485,7 @@ This function is inviting players to already running battlegrounds
Invitation type is based on config file
large groups are disadvantageous, because they will be kicked first if invitation type = 1
*/
void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id)
void BattlegroundQueue::FillPlayersToBG(Battleground* bg, BattlegroundBracketId bracket_id)
{
int32 hordeFree = bg->GetFreeSlotsForTeam(HORDE);
int32 aliFree = bg->GetFreeSlotsForTeam(ALLIANCE);
@@ -512,8 +512,8 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
/*
if we reached this code, then we have to solve NP - complete problem called Subset sum problem
So one solution is to check all possible invitation subgroups, or we can use these conditions:
1. Last time when BattleGroundQueue::Update was executed we invited all possible players - so there is only small possibility
that we will invite now whole queue, because only 1 change has been made to queues from the last BattleGroundQueue::Update call
1. Last time when BattlegroundQueue::Update was executed we invited all possible players - so there is only small possibility
that we will invite now whole queue, because only 1 change has been made to queues from the last BattlegroundQueue::Update call
2. Other thing we should consider is group order in queue
*/
@@ -563,7 +563,7 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
// this method checks if premade versus premade battleground is possible
// then after 30 mins (default) in queue it moves premade group to normal queue
// it tries to invite as much players as it can - to MaxPlayersPerTeam, because premade groups have more than MinPlayersPerTeam players
bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
{
//check match
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty())
@@ -621,7 +621,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
}
// this method tries to create battleground or arena with MinPlayersPerTeam against MinPlayersPerTeam
bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers)
{
GroupsQueueType::const_iterator itr_team[BG_TEAMS_COUNT];
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
@@ -657,14 +657,14 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
return false;
}
//allow 1v0 if debug bg
if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
if (sBattlegroundMgr.isTesting() && bg_template->isBattleground() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
return true;
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;
}
// this method will check if we can invite players to same faction skirmish match
bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam)
bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam)
{
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
return false;
@@ -725,9 +725,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
/*
this method is called when group is inserted, or player / group is removed from BG Queue - there is only one player's status changed, so we don't use while (true) cycles to invite whole queue
it must be called after fully adding the members of a group to ensure group joining
should be called from BattleGround::RemovePlayer function in some cases
should be called from Battleground::RemovePlayer function in some cases
*/
void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating)
{
//if no players in queue - do nothing
if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() &&
@@ -739,15 +739,15 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
//battleground with free slot for player should be always in the beggining of the queue
// maybe it would be better to create bgfreeslotqueue for each bracket_id
BGFreeSlotQueueType::iterator itr, next;
for (itr = sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].begin(); itr != sBattleGroundMgr.BGFreeSlotQueue[bgTypeId].end(); itr = next)
for (itr = sBattlegroundMgr.BGFreeSlotQueue[bgTypeId].begin(); itr != sBattlegroundMgr.BGFreeSlotQueue[bgTypeId].end(); itr = next)
{
next = itr;
++next;
// DO NOT allow queue manager to invite new player to arena
if ((*itr)->isBattleGround() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
if ((*itr)->isBattleground() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
(*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
{
BattleGround* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
Battleground* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
// and iterator is invalid
// clear selection pools
@@ -773,7 +773,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
// finished iterating through the bgs with free slots, maybe we need to create a new bg
BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
Battleground * bg_template = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg_template)
{
sLog.outError("Battleground: Update: bg template not found for %u", bgTypeId);
@@ -790,11 +790,11 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
// get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!)
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
if (sBattleGroundMgr.isTesting())
if (sBattlegroundMgr.isTesting())
MinPlayersPerTeam = 1;
if (bg_template->isArena())
{
if (sBattleGroundMgr.isArenaTesting())
if (sBattlegroundMgr.isArenaTesting())
{
MaxPlayersPerTeam = 1;
MinPlayersPerTeam = 1;
@@ -825,16 +825,16 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
m_SelectionPools[BG_TEAM_HORDE].Init();
if (bg_template->isBattleGround())
if (bg_template->isBattleground())
{
//check if there is premade against premade match
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
{
//create new battleground
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, 0, false);
Battleground * bg2 = sBattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, 0, false);
if (!bg2)
{
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
sLog.outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
//invite those selection pools
@@ -842,7 +842,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
//start bg
bg2->StartBattleGround();
bg2->StartBattleground();
//clear structures
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
m_SelectionPools[BG_TEAM_HORDE].Init();
@@ -857,10 +857,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|| (bg_template->isArena() && CheckSkirmishForSameFaction(bracket_id, MinPlayersPerTeam)))
{
// we successfully created a pool
BattleGround * bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, false);
Battleground * bg2 = sBattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, arenaType, false);
if (!bg2)
{
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
sLog.outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
@@ -869,7 +869,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
// start bg
bg2->StartBattleGround();
bg2->StartBattleground();
}
}
else if (bg_template->isArena())
@@ -901,13 +901,13 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
}
//set rating range
uint32 arenaMinRating = (arenaRating <= sBattleGroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattleGroundMgr.GetMaxRatingDifference();
uint32 arenaMaxRating = arenaRating + sBattleGroundMgr.GetMaxRatingDifference();
uint32 arenaMinRating = (arenaRating <= sBattlegroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattlegroundMgr.GetMaxRatingDifference();
uint32 arenaMaxRating = arenaRating + sBattlegroundMgr.GetMaxRatingDifference();
// if max rating difference is set and the time past since server startup is greater than the rating discard time
// (after what time the ratings aren't taken into account when making teams) then
// the discard time is current_time - time_to_discard, teams that joined after that, will have their ratings taken into account
// else leave the discard time on 0, this way all ratings will be discarded
uint32 discardTime = getMSTime() - sBattleGroundMgr.GetRatingDiscardTimer();
uint32 discardTime = getMSTime() - sBattlegroundMgr.GetRatingDiscardTimer();
// we need to find 2 teams which will play next game
@@ -971,7 +971,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
//if we have 2 teams, then start new arena and invite players!
if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
{
BattleGround* arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, bracketEntry, arenaType, true);
Battleground* arena = sBattlegroundMgr.CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true);
if (!arena)
{
sLog.outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
@@ -1003,7 +1003,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
sLog.outDebug("Starting rated arena match!");
arena->StartBattleGround();
arena->StartBattleground();
}
}
}
@@ -1019,22 +1019,22 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
if (!plr)
return true;
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
Battleground* bg = sBattlegroundMgr.GetBattleground(m_BgInstanceGUID, m_BgTypeId);
//if battleground ended and its instance deleted - do nothing
if (!bg)
return true;
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattlegroundQueueIndex(bgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
{
// check if player is invited to this bg
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
BattlegroundQueue &bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
WorldPacket data;
//we must send remaining time in queue
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType);
plr->GetSession()->SendPacket(&data);
}
}
@@ -1062,27 +1062,27 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
Battleground* bg = sBattlegroundMgr.GetBattleground(m_BgInstanceGUID, m_BgTypeId);
//battleground can be deleted already when we are removing queue info
//bg pointer can be NULL! so use it carefully!
uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId);
uint32 queueSlot = plr->GetBattlegroundQueueIndex(m_BgQueueTypeId);
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
{
// check if player is in queue for this BG and if we are removing his invite event
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId];
BattlegroundQueue &bgQueue = sBattlegroundMgr.m_BattlegroundQueues[m_BgQueueTypeId];
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
plr->RemoveBattleGroundQueueId(m_BgQueueTypeId);
plr->RemoveBattlegroundQueueId(m_BgQueueTypeId);
bgQueue.RemovePlayer(m_PlayerGuid, true);
//update queues if battleground isn't ended
if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE)
sBattleGroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
if (bg && bg->isBattleground() && bg->GetStatus() != STATUS_WAIT_LEAVE)
sBattlegroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
plr->GetSession()->SendPacket(&data);
}
}
@@ -23,10 +23,10 @@
#include "Common.h"
#include "DBCEnums.h"
#include "BattleGround.h"
#include "Battleground.h"
//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
typedef std::list<BattleGround*> BGFreeSlotQueueType;
typedef std::list<Battleground*> BGFreeSlotQueueType;
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
@@ -41,7 +41,7 @@ struct GroupQueueInfo // stores informatio
{
std::map<uint64, PlayerQueueInfo*> Players; // player queue info map
uint32 Team; // Player team (ALLIANCE/HORDE)
BattleGroundTypeId BgTypeId; // battleground type id
BattlegroundTypeId BgTypeId; // battleground type id
bool IsRated; // rated
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
uint32 ArenaTeamId; // team id if rated match
@@ -52,7 +52,7 @@ struct GroupQueueInfo // stores informatio
uint32 OpponentsTeamRating; // for rated arena matches
};
enum BattleGroundQueueGroupTypes
enum BattlegroundQueueGroupTypes
{
BG_QUEUE_PREMADE_ALLIANCE = 0,
BG_QUEUE_PREMADE_HORDE = 1,
@@ -61,25 +61,25 @@ enum BattleGroundQueueGroupTypes
};
#define BG_QUEUE_GROUP_TYPES_COUNT 4
class BattleGround;
class BattleGroundQueue
class Battleground;
class BattlegroundQueue
{
public:
BattleGroundQueue();
~BattleGroundQueue();
BattlegroundQueue();
~BattlegroundQueue();
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
void Update(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0);
void FillPlayersToBG(BattleGround* bg, BattleGroundBracketId bracket_id);
bool CheckPremadeMatch(BattleGroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
bool CheckNormalMatch(BattleGround* bg_template, BattleGroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
void FillPlayersToBG(Battleground* bg, BattlegroundBracketId bracket_id);
bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam);
bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers);
bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam);
GroupQueueInfo * AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* backetEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0);
void RemovePlayer(const uint64& guid, bool decreaseInvitedCount);
bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime);
bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleGroundBracketId bracket_id);
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id);
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
@@ -117,7 +117,7 @@ class BattleGroundQueue
private:
bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side);
bool InviteGroupToBG(GroupQueueInfo * ginfo, Battleground * bg, uint32 side);
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
@@ -130,7 +130,7 @@ class BattleGroundQueue
class BGQueueInviteEvent : public BasicEvent
{
public:
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
{
};
@@ -141,7 +141,7 @@ class BGQueueInviteEvent : public BasicEvent
private:
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
BattleGroundTypeId m_BgTypeId;
BattlegroundTypeId m_BgTypeId;
uint8 m_ArenaType;
uint32 m_RemoveTime;
};
@@ -154,7 +154,7 @@ class BGQueueInviteEvent : public BasicEvent
class BGQueueRemoveEvent : public BasicEvent
{
public:
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime)
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattlegroundTypeId BgTypeId, BattlegroundQueueTypeId bgQueueTypeId, uint32 removeTime)
: m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_RemoveTime(removeTime), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId)
{}
@@ -166,8 +166,8 @@ class BGQueueRemoveEvent : public BasicEvent
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
uint32 m_RemoveTime;
BattleGroundTypeId m_BgTypeId;
BattleGroundQueueTypeId m_BgQueueTypeId;
BattlegroundTypeId m_BgTypeId;
BattlegroundQueueTypeId m_BgQueueTypeId;
};
#endif
@@ -18,12 +18,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundAA.h"
#include "Battleground.h"
#include "BattlegroundAA.h"
#include "Language.h"
#include "Player.h"
BattleGroundAA::BattleGroundAA()
BattlegroundAA::BattlegroundAA()
{
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
@@ -37,47 +37,47 @@ BattleGroundAA::BattleGroundAA()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundAA::~BattleGroundAA()
BattlegroundAA::~BattlegroundAA()
{
}
void BattleGroundAA::Update(uint32 diff)
void BattlegroundAA::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
}
void BattleGroundAA::StartingEventCloseDoors()
void BattlegroundAA::StartingEventCloseDoors()
{
}
void BattleGroundAA::StartingEventOpenDoors()
void BattlegroundAA::StartingEventOpenDoors()
{
}
void BattleGroundAA::AddPlayer(Player *plr)
void BattlegroundAA::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundAAScore* sc = new BattleGroundAAScore;
BattlegroundAAScore* sc = new BattlegroundAAScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
void BattlegroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
{
}
void BattleGroundAA::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundAA::HandleKillPlayer(Player* player, Player* killer)
{
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(player, killer);
}
void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattlegroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
{
}
bool BattleGroundAA::SetupBattleGround()
bool BattlegroundAA::SetupBattleground()
{
return true;
}
@@ -20,23 +20,23 @@
#ifndef __BATTLEGROUNDAA_H
#define __BATTLEGROUNDAA_H
class BattleGround;
class Battleground;
class BattleGroundAAScore : public BattleGroundScore
class BattlegroundAAScore : public BattlegroundScore
{
public:
BattleGroundAAScore() {};
virtual ~BattleGroundAAScore() {};
BattlegroundAAScore() {};
virtual ~BattlegroundAAScore() {};
//TODO fix me
};
class BattleGroundAA : public BattleGround
class BattlegroundAA : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundAA();
~BattleGroundAA();
BattlegroundAA();
~BattlegroundAA();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -46,7 +46,7 @@ class BattleGroundAA : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player *killer);
};
#endif
@@ -21,9 +21,9 @@
#include "World.h"
#include "WorldPacket.h"
#include "ObjectMgr.h"
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "BattleGroundAB.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "BattlegroundAB.h"
#include "Creature.h"
#include "Language.h"
#include "Object.h"
@@ -41,7 +41,7 @@ uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = {
150 // holiday
};
BattleGroundAB::BattleGroundAB()
BattlegroundAB::BattlegroundAB()
{
m_BuffChange = true;
m_BgObjects.resize(BG_AB_OBJECT_MAX);
@@ -53,13 +53,13 @@ BattleGroundAB::BattleGroundAB()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
}
BattleGroundAB::~BattleGroundAB()
BattlegroundAB::~BattlegroundAB()
{
}
void BattleGroundAB::Update(uint32 diff)
void BattlegroundAB::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -168,13 +168,13 @@ void BattleGroundAB::Update(uint32 diff)
// Test win condition
if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleGround(ALLIANCE);
EndBattleground(ALLIANCE);
if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleGround(HORDE);
EndBattleground(HORDE);
}
}
void BattleGroundAB::StartingEventCloseDoors()
void BattlegroundAB::StartingEventCloseDoors()
{
// despawn banners, auras and buffs
for (int obj = BG_AB_OBJECT_BANNER_NEUTRAL; obj < BG_AB_DYNAMIC_NODES_COUNT * 8; ++obj)
@@ -193,7 +193,7 @@ void BattleGroundAB::StartingEventCloseDoors()
_NodeOccupied(BG_AB_SPIRIT_HORDE,HORDE);
}
void BattleGroundAB::StartingEventOpenDoors()
void BattlegroundAB::StartingEventOpenDoors()
{
// spawn neutral banners
for (int banner = BG_AB_OBJECT_BANNER_NEUTRAL, i = 0; i < 5; banner += 8, ++i)
@@ -208,21 +208,21 @@ void BattleGroundAB::StartingEventOpenDoors()
DoorOpen(BG_AB_OBJECT_GATE_H);
}
void BattleGroundAB::AddPlayer(Player *plr)
void BattlegroundAB::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in the constructor
BattleGroundABScore* sc = new BattleGroundABScore;
BattlegroundABScore* sc = new BattlegroundABScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
void BattlegroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
{
}
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -258,7 +258,7 @@ void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
/* type: 0-neutral, 1-contested, 3-occupied
teamIndex: 0-ally, 1-horde */
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
void BattlegroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
{
// Just put it into the queue
if (delay)
@@ -280,7 +280,7 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
}
void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
{
uint8 obj = node*8 + type + teamIndex;
SpawnBGObject(obj, RESPAWN_ONE_DAY);
@@ -292,7 +292,7 @@ void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
SpawnBGObject(obj, RESPAWN_ONE_DAY);
}
int32 BattleGroundAB::_GetNodeNameId(uint8 node)
int32 BattlegroundAB::_GetNodeNameId(uint8 node)
{
switch (node)
{
@@ -307,7 +307,7 @@ int32 BattleGroundAB::_GetNodeNameId(uint8 node)
return 0;
}
void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
{
const uint8 plusArray[] = {0, 2, 3, 0, 1};
@@ -341,7 +341,7 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
data << uint32(0x745) << uint32(0x2); // 37 1861 unk
}
void BattleGroundAB::_SendNodeUpdate(uint8 node)
void BattlegroundAB::_SendNodeUpdate(uint8 node)
{
// Send node owner state update to refresh map icons on client
const uint8 plusArray[] = {0, 2, 3, 0, 1};
@@ -365,7 +365,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
}
void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
void BattlegroundAB::_NodeOccupied(uint8 node,Team team)
{
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team);
@@ -397,7 +397,7 @@ void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
}
}
void BattleGroundAB::_NodeDeOccupied(uint8 node)
void BattlegroundAB::_NodeDeOccupied(uint8 node)
{
if (node >= BG_AB_DYNAMIC_NODES_COUNT)
return;
@@ -432,7 +432,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
}
/* Invoked if a player used a banner as a gameobject */
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
void BattlegroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -451,7 +451,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
return;
}
BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
// Check if player really could use this banner, not cheated
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
@@ -559,7 +559,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
PlaySoundToAll(sound);
}
bool BattleGroundAB::SetupBattleGround()
bool BattlegroundAB::SetupBattleground()
{
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
@@ -573,7 +573,7 @@ bool BattleGroundAB::SetupBattleGround()
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i,BG_AB_OBJECTID_AURA_C,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
)
{
sLog.outErrorDb("BatteGroundAB: Failed to spawn some object BattleGround not created!");
sLog.outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
}
@@ -581,7 +581,7 @@ bool BattleGroundAB::SetupBattleGround()
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
)
{
sLog.outErrorDb("BatteGroundAB: Failed to spawn door object BattleGround not created!");
sLog.outErrorDb("BatteGroundAB: Failed to spawn door object Battleground not created!");
return false;
}
//buffs
@@ -597,10 +597,10 @@ bool BattleGroundAB::SetupBattleGround()
return true;
}
void BattleGroundAB::Reset()
void BattlegroundAB::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
@@ -611,7 +611,7 @@ void BattleGroundAB::Reset()
m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0;
m_ReputationScoreTics[BG_TEAM_HORDE] = 0;
m_IsInformedNearVictory = false;
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
bool isBGWeekend = sBattlegroundMgr.IsBGWeekend(GetTypeID());
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false;
@@ -630,7 +630,7 @@ void BattleGroundAB::Reset()
DelCreature(i);
}
void BattleGroundAB::EndBattleGround(uint32 winner)
void BattlegroundAB::EndBattleground(uint32 winner)
{
//win reward
if (winner == ALLIANCE)
@@ -641,12 +641,12 @@ void BattleGroundAB::EndBattleGround(uint32 winner)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player)
{
BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
// Is there any occupied node for this team?
std::vector<uint8> nodes;
@@ -683,29 +683,29 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
return good_entry;
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
{
case SCORE_BASES_ASSAULTED:
((BattleGroundABScore*)itr->second)->BasesAssaulted += value;
((BattlegroundABScore*)itr->second)->BasesAssaulted += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_ASSAULT_BASE);
break;
case SCORE_BASES_DEFENDED:
((BattleGroundABScore*)itr->second)->BasesDefended += value;
((BattlegroundABScore*)itr->second)->BasesDefended += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_DEFEND_BASE);
break;
default:
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
break;
}
}
bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const
bool BattlegroundAB::IsAllNodesConrolledByTeam(uint32 team) const
{
uint32 count = 0;
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
@@ -20,7 +20,7 @@
#ifndef __BATTLEGROUNDAB_H
#define __BATTLEGROUNDAB_H
class BattleGround;
class Battleground;
enum BG_AB_WorldStates
{
@@ -135,7 +135,7 @@ enum BG_AB_Score
};
/* do NOT change the order, else wrong behaviour */
enum BG_AB_BattleGroundNodes
enum BG_AB_BattlegroundNodes
{
BG_AB_NODE_STABLES = 0,
BG_AB_NODE_BLACKSMITH = 1,
@@ -232,22 +232,22 @@ struct BG_AB_BannerTimer
uint8 teamIndex;
};
class BattleGroundABScore : public BattleGroundScore
class BattlegroundABScore : public BattlegroundScore
{
public:
BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
virtual ~BattleGroundABScore() {};
BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
virtual ~BattlegroundABScore() {};
uint32 BasesAssaulted;
uint32 BasesDefended;
};
class BattleGroundAB : public BattleGround
class BattlegroundAB : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundAB();
~BattleGroundAB();
BattlegroundAB();
~BattlegroundAB();
void Update(uint32 diff);
void AddPlayer(Player *plr);
@@ -255,9 +255,9 @@ class BattleGroundAB : public BattleGround
virtual void StartingEventOpenDoors();
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
virtual bool SetupBattleGround();
virtual bool SetupBattleground();
virtual void Reset();
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
@@ -21,15 +21,15 @@
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "Miscellaneous/Formulas.h"
#include "GameObject.h"
#include "Miscellaneous/Language.h"
#include "Player.h"
#include "SpellAuras.h"
BattleGroundAV::BattleGroundAV()
BattlegroundAV::BattlegroundAV()
{
m_BgObjects.resize(BG_AV_OBJECT_MAX);
m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX);
@@ -40,25 +40,25 @@ BattleGroundAV::BattleGroundAV()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN;
}
BattleGroundAV::~BattleGroundAV()
BattlegroundAV::~BattlegroundAV()
{
}
const uint16 BattleGroundAV::GetBonusHonor(uint8 kills) //TODO: move this function to Battleground.cpp (needs to find a way to get m_MaxLevel)
const uint16 BattlegroundAV::GetBonusHonor(uint8 kills) //TODO: move this function to Battleground.cpp (needs to find a way to get m_MaxLevel)
{
return Trinity::Honor::hk_honor_at_level(m_MaxLevel, kills);
}
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundAV::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(player, killer);
UpdateScore(player->GetTeam(),-1);
}
void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
void BattlegroundAV::HandleKillUnit(Creature *unit, Player *killer)
{
sLog.outDebug("bg_av HandleKillUnit %i",unit->GetEntry());
if (GetStatus() != STATUS_IN_PROGRESS)
@@ -80,7 +80,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
CastSpellOnTeam(23658,HORDE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(729,BG_AV_REP_BOSS,HORDE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),HORDE);
EndBattleGround(HORDE);
EndBattleground(HORDE);
DelCreature(AV_CPLACE_TRIGGER17);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS][0])
@@ -88,7 +88,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
CastSpellOnTeam(23658,ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
RewardReputationToTeam(730,BG_AV_REP_BOSS,ALLIANCE);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_BOSS),ALLIANCE);
EndBattleGround(ALLIANCE);
EndBattleground(ALLIANCE);
DelCreature(AV_CPLACE_TRIGGER19);
}
else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN][0])
@@ -135,7 +135,7 @@ void BattleGroundAV::HandleKillUnit(Creature *unit, Player *killer)
ChangeMineOwner(AV_SOUTH_MINE,killer->GetTeam());
}
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
void BattlegroundAV::HandleQuestComplete(uint32 questid, Player *player)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;//maybe we should log this, cause this must be a cheater or a big bug
@@ -238,7 +238,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
}
}
void BattleGroundAV::UpdateScore(uint16 team, int16 points)
void BattlegroundAV::UpdateScore(uint16 team, int16 points)
{ //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
ASSERT(team == ALLIANCE || team == HORDE);
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
@@ -250,7 +250,7 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points)
if (m_Team_Scores[teamindex] < 1)
{
m_Team_Scores[teamindex]=0;
EndBattleGround(((teamindex == BG_TEAM_HORDE)?ALLIANCE:HORDE));
EndBattleground(((teamindex == BG_TEAM_HORDE)?ALLIANCE:HORDE));
}
else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
{
@@ -261,7 +261,7 @@ void BattleGroundAV::UpdateScore(uint16 team, int16 points)
}
}
Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
{
uint8 level;
bool isStatic = false;
@@ -341,9 +341,9 @@ Creature* BattleGroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
return creature;
}
void BattleGroundAV::Update(uint32 diff)
void BattlegroundAV::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -403,13 +403,13 @@ void BattleGroundAV::Update(uint32 diff)
}
}
void BattleGroundAV::StartingEventCloseDoors()
void BattlegroundAV::StartingEventCloseDoors()
{
DoorClose(BG_AV_OBJECT_DOOR_A);
DoorClose(BG_AV_OBJECT_DOOR_H);
}
void BattleGroundAV::StartingEventOpenDoors()
void BattlegroundAV::StartingEventOpenDoors()
{
sLog.outDebug("BG_AV: start spawning mine stuff");
for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++)
@@ -426,18 +426,18 @@ void BattleGroundAV::StartingEventOpenDoors()
DoorOpen(BG_AV_OBJECT_DOOR_A);
}
void BattleGroundAV::AddPlayer(Player *plr)
void BattlegroundAV::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundAVScore* sc = new BattleGroundAVScore;
BattlegroundAVScore* sc = new BattlegroundAVScore;
m_PlayerScores[plr->GetGUID()] = sc;
if (m_MaxLevel == 0)
m_MaxLevel=(plr->getLevel()%10 == 0)? plr->getLevel() : (plr->getLevel()-(plr->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
}
void BattleGroundAV::EndBattleGround(uint32 winner)
void BattlegroundAV::EndBattleground(uint32 winner)
{
//calculate bonuskills for both teams:
//first towers:
@@ -474,10 +474,10 @@ void BattleGroundAV::EndBattleGround(uint32 winner)
}
//TODO add enterevademode for all attacking creatures
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
void BattlegroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
{
if (!plr)
{
@@ -490,7 +490,7 @@ void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
}
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
@@ -530,47 +530,47 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
Source->CastSpell(Source, SpellId, true);
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
switch(type)
{
case SCORE_GRAVEYARDS_ASSAULTED:
((BattleGroundAVScore*)itr->second)->GraveyardsAssaulted += value;
((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_GRAVEYARD);
break;
case SCORE_GRAVEYARDS_DEFENDED:
((BattleGroundAVScore*)itr->second)->GraveyardsDefended += value;
((BattlegroundAVScore*)itr->second)->GraveyardsDefended += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_GRAVEYARD);
break;
case SCORE_TOWERS_ASSAULTED:
((BattleGroundAVScore*)itr->second)->TowersAssaulted += value;
((BattlegroundAVScore*)itr->second)->TowersAssaulted += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_TOWER);
break;
case SCORE_TOWERS_DEFENDED:
((BattleGroundAVScore*)itr->second)->TowersDefended += value;
((BattlegroundAVScore*)itr->second)->TowersDefended += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_TOWER);
break;
case SCORE_MINES_CAPTURED:
((BattleGroundAVScore*)itr->second)->MinesCaptured += value;
((BattlegroundAVScore*)itr->second)->MinesCaptured += value;
break;
case SCORE_LEADERS_KILLED:
((BattleGroundAVScore*)itr->second)->LeadersKilled += value;
((BattlegroundAVScore*)itr->second)->LeadersKilled += value;
break;
case SCORE_SECONDARY_OBJECTIVES:
((BattleGroundAVScore*)itr->second)->SecondaryObjectives += value;
((BattlegroundAVScore*)itr->second)->SecondaryObjectives += value;
break;
default:
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
break;
}
}
void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
{
uint32 object = GetObjectThroughNode(node);
@@ -631,7 +631,7 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
YellToAll(creature,buf,LANG_UNIVERSAL);
}
void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
{ //mine=0 northmine mine=1 southmin
//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
@@ -721,7 +721,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
return;
}
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
bool BattlegroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
{
if (GOId == BG_AV_OBJECTID_MINE_N)
return (m_Mine_Owner[AV_NORTH_MINE] == team);
@@ -730,7 +730,7 @@ bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId,uint32 team)
return true; //cause it's no mine'object it is ok if this is true
}
void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
{
uint32 owner = m_Nodes[node].Owner;
ASSERT(owner);
@@ -780,7 +780,7 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
{
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
for (uint8 i=0; i<4; i++)
@@ -795,7 +795,7 @@ void BattleGroundAV::DePopulateNode(BG_AV_Nodes node)
DelCreature(node + 302);//NULL checks are in DelCreature! 0-302 spirit guides
}
const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
const BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
{
sLog.outDebug("bg_AV getnodethroughobject %i",object);
if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER)
@@ -812,12 +812,12 @@ const BG_AV_Nodes BattleGroundAV::GetNodeThroughObject(uint32 object)
return BG_AV_Nodes(object - 29);
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE)
return BG_AV_NODES_SNOWFALL_GRAVE;
sLog.outError("BattleGroundAV: ERROR! GetPlace got a wrong object :(");
sLog.outError("BattlegroundAV: ERROR! GetPlace got a wrong object :(");
ASSERT(false);
return BG_AV_Nodes(0);
}
const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
const uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
{ //this function is the counterpart to GetNodeThroughObject()
sLog.outDebug("bg_AV GetObjectThroughNode %i",node);
if (m_Nodes[node].Owner == ALLIANCE)
@@ -848,14 +848,14 @@ const uint32 BattleGroundAV::GetObjectThroughNode(BG_AV_Nodes node)
}
else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
sLog.outError("BattleGroundAV: Error! GetPlaceNode couldn't resolve node %i",node);
sLog.outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i",node);
ASSERT(false);
return 0;
}
//called when using banner
void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
void BattlegroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -883,7 +883,7 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target
}
}
void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
{
ASSERT(GetStatus() == STATUS_IN_PROGRESS);
BG_AV_Nodes node = GetNodeThroughObject(object);
@@ -954,7 +954,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_GOOD:AV_SOUND_HORDE_GOOD);
}
void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
{
ASSERT(GetStatus() == STATUS_IN_PROGRESS);
@@ -1060,7 +1060,7 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
PlaySoundToAll((team == ALLIANCE)?AV_SOUND_ALLIANCE_ASSAULTS:AV_SOUND_HORDE_ASSAULTS);
}
void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
void BattlegroundAV::FillInitialWorldStates(WorldPacket& data)
{
bool stateok;
//graveyards
@@ -1099,7 +1099,7 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data)
SendMineWorldStates(AV_SOUTH_MINE);
}
const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray
const uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used for node worldstates and returns values which fit good into the worldstatesarray
{
//neutral stuff cant get handled (currently its only snowfall)
ASSERT(team != AV_NEUTRAL_TEAM);
@@ -1122,7 +1122,7 @@ const uint8 BattleGroundAV::GetWorldStateType(uint8 state, uint16 team) //this i
return 5; //this will crash the game, but i want to know if something is wrong here
}
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
void BattlegroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
{
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State,m_Nodes[node].Owner)],1);
if (m_Nodes[node].PrevOwner == AV_NEUTRAL_TEAM) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
@@ -1131,7 +1131,7 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState,m_Nodes[node].PrevOwner)],0);
}
void BattleGroundAV::SendMineWorldStates(uint32 mine)
void BattlegroundAV::SendMineWorldStates(uint32 mine)
{
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
// currently i'm sure, that this works (:
@@ -1158,7 +1158,7 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
UpdateWorldState(BG_AV_MineWorldStates[mine2][prevowner],0);
}
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const* BattlegroundAV::GetClosestGraveYard(Player* player)
{
WorldSafeLocsEntry const* pGraveyard = NULL;
WorldSafeLocsEntry const* entry = NULL;
@@ -1188,7 +1188,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
return pGraveyard;
}
bool BattleGroundAV::SetupBattleGround()
bool BattlegroundAV::SetupBattleground()
{
// Create starting objects
if (
@@ -1197,7 +1197,7 @@ bool BattleGroundAV::SetupBattleGround()
// horde gates
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0],BG_AV_DoorPositons[1][1],BG_AV_DoorPositons[1][2],BG_AV_DoorPositons[1][3],0,0,sin(BG_AV_DoorPositons[1][3]/2),cos(BG_AV_DoorPositons[1][3]/2),RESPAWN_IMMEDIATELY))
{
sLog.outErrorDb("BatteGroundAV: Failed to spawn some object BattleGround not created!1");
sLog.outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
}
@@ -1215,7 +1215,7 @@ bool BattleGroundAV::SetupBattleGround()
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3,BG_AV_OBJECTID_AURA_A,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3,BG_AV_OBJECTID_AURA_H,BG_AV_ObjectPos[i][0],BG_AV_ObjectPos[i][1],BG_AV_ObjectPos[i][2],BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!2");
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
}
}
@@ -1230,7 +1230,7 @@ bool BattleGroundAV::SetupBattleGround()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_A,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_PH,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!3");
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
}
}
@@ -1243,7 +1243,7 @@ bool BattleGroundAV::SetupBattleGround()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_PA,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)),BG_AV_OBJECTID_TOWER_BANNER_H,BG_AV_ObjectPos[i+8][0],BG_AV_ObjectPos[i+8][1],BG_AV_ObjectPos[i+8][2],BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!4");
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
}
}
@@ -1251,7 +1251,7 @@ bool BattleGroundAV::SetupBattleGround()
{
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!5.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i",i);
return false;
}
}
@@ -1265,7 +1265,7 @@ bool BattleGroundAV::SetupBattleGround()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_SMOKE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!6.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i",i);
return false;
}
}
@@ -1273,7 +1273,7 @@ bool BattleGroundAV::SetupBattleGround()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,BG_AV_OBJECTID_FIRE,BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!7.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i",i);
return false;
}
}
@@ -1283,7 +1283,7 @@ bool BattleGroundAV::SetupBattleGround()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,BG_AV_OBJECTID_MINE_N,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.5.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i",i);
return false;
}
}
@@ -1291,14 +1291,14 @@ bool BattleGroundAV::SetupBattleGround()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,BG_AV_OBJECTID_MINE_S,BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies BattleGround not created!7.6.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i",i);
return false;
}
}
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N ,BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],0,0,sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!8");
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
@@ -1308,7 +1308,7 @@ bool BattleGroundAV::SetupBattleGround()
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH ,BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2],BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],0,0,sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
{
sLog.outError("BatteGroundAV: Failed to spawn some object BattleGround not created!9.%i",i);
sLog.outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i",i);
return false;
}
}
@@ -1367,7 +1367,7 @@ bool BattleGroundAV::SetupBattleGround()
return true;
}
const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node)
const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
{
switch (node)
{
@@ -1395,7 +1395,7 @@ const char* BattleGroundAV::GetNodeName(BG_AV_Nodes node)
}
}
void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
{
if (m_Nodes[node].TotalOwner == team)
{
@@ -1425,7 +1425,7 @@ void BattleGroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
m_Nodes[node].State = POINT_ASSAULTED;
}
void BattleGroundAV::DestroyNode(BG_AV_Nodes node)
void BattlegroundAV::DestroyNode(BG_AV_Nodes node)
{
ASSERT(m_Nodes[node].State == POINT_ASSAULTED);
@@ -1436,7 +1436,7 @@ void BattleGroundAV::DestroyNode(BG_AV_Nodes node)
m_Nodes[node].Timer = 0;
}
void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
void BattlegroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
{
m_Nodes[node].TotalOwner = team;
m_Nodes[node].Owner = team;
@@ -1448,7 +1448,7 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, uint16 team, bool tower)
m_Nodes[node].Tower = tower;
}
void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
{
ASSERT(m_Nodes[node].TotalOwner == team);
ASSERT(m_Nodes[node].Owner != team);
@@ -1460,7 +1460,7 @@ void BattleGroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
m_Nodes[node].Timer = 0;
}
void BattleGroundAV::ResetBGSubclass()
void BattlegroundAV::ResetBGSubclass()
{
m_MaxLevel=0;
for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
@@ -21,7 +21,7 @@
#ifndef __BATTLEGROUNDAV_H
#define __BATTLEGROUNDAV_H
class BattleGround;
class Battleground;
#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!"
#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!"
@@ -1520,11 +1520,11 @@ struct BG_AV_NodeInfo
inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); }
class BattleGroundAVScore : public BattleGroundScore
class BattlegroundAVScore : public BattlegroundScore
{
public:
BattleGroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {};
virtual ~BattleGroundAVScore() {};
BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {};
virtual ~BattlegroundAVScore() {};
uint32 GraveyardsAssaulted;
uint32 GraveyardsDefended;
uint32 TowersAssaulted;
@@ -1534,13 +1534,13 @@ class BattleGroundAVScore : public BattleGroundScore
uint32 SecondaryObjectives;
};
class BattleGroundAV : public BattleGround
class BattlegroundAV : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundAV();
~BattleGroundAV();
BattlegroundAV();
~BattlegroundAV();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -1550,7 +1550,7 @@ class BattleGroundAV : public BattleGround
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
virtual void ResetBGSubclass();
/*general stuff*/
@@ -1564,7 +1564,7 @@ class BattleGroundAV : public BattleGround
void HandleQuestComplete(uint32 questid, Player *player);
bool PlayerCanDoMineQuest(int32 GOId,uint32 team);
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
@@ -18,15 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundBE.h"
#include "Battleground.h"
#include "BattlegroundBE.h"
#include "Language.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "WorldPacket.h"
BattleGroundBE::BattleGroundBE()
BattlegroundBE::BattlegroundBE()
{
m_BgObjects.resize(BG_BE_OBJECT_MAX);
@@ -41,14 +41,14 @@ BattleGroundBE::BattleGroundBE()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundBE::~BattleGroundBE()
BattlegroundBE::~BattlegroundBE()
{
}
void BattleGroundBE::Update(uint32 diff)
void BattlegroundBE::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
/*if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -56,7 +56,7 @@ void BattleGroundBE::Update(uint32 diff)
}*/
}
void BattleGroundBE::StartingEventCloseDoors()
void BattlegroundBE::StartingEventCloseDoors()
{
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
@@ -65,7 +65,7 @@ void BattleGroundBE::StartingEventCloseDoors()
SpawnBGObject(i, RESPAWN_ONE_DAY);
}
void BattleGroundBE::StartingEventOpenDoors()
void BattlegroundBE::StartingEventOpenDoors()
{
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i)
DoorOpen(i);
@@ -74,18 +74,18 @@ void BattleGroundBE::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattleGroundBE::AddPlayer(Player *plr)
void BattlegroundBE::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundBEScore* sc = new BattleGroundBEScore;
BattlegroundBEScore* sc = new BattlegroundBEScore;
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -94,7 +94,7 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
CheckArenaWinConditions();
}
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundBE::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -105,19 +105,19 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
return;
}
BattleGround::HandleKillPlayer(player,killer);
Battleground::HandleKillPlayer(player,killer);
UpdateArenaWorldState();
CheckArenaWinConditions();
}
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
bool BattlegroundBE::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false);
return true;
}
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
@@ -143,19 +143,19 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
// HandleTriggerBuff(buff_guid,Source);
}
void BattleGroundBE::FillInitialWorldStates(WorldPacket &data)
void BattlegroundBE::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0x9f3) << uint32(1); // 9
UpdateArenaWorldState();
}
void BattleGroundBE::Reset()
void BattlegroundBE::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
}
bool BattleGroundBE::SetupBattleGround()
bool BattlegroundBE::SetupBattleground()
{
// gates
if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
@@ -173,15 +173,15 @@ bool BattleGroundBE::SetupBattleGround()
return true;
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
//there is nothing special in this score
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
}
@@ -20,9 +20,9 @@
#ifndef __BATTLEGROUNDBE_H
#define __BATTLEGROUNDBE_H
class BattleGround;
class Battleground;
enum BattleGroundBEObjectTypes
enum BattlegroundBEObjectTypes
{
BG_BE_OBJECT_DOOR_1 = 0,
BG_BE_OBJECT_DOOR_2 = 1,
@@ -33,7 +33,7 @@ enum BattleGroundBEObjectTypes
BG_BE_OBJECT_MAX = 6
};
enum BattleGroundBEObjects
enum BattlegroundBEObjects
{
BG_BE_OBJECT_TYPE_DOOR_1 = 183971,
BG_BE_OBJECT_TYPE_DOOR_2 = 183973,
@@ -43,20 +43,20 @@ enum BattleGroundBEObjects
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
};
class BattleGroundBEScore : public BattleGroundScore
class BattlegroundBEScore : public BattlegroundScore
{
public:
BattleGroundBEScore() {};
virtual ~BattleGroundBEScore() {};
BattlegroundBEScore() {};
virtual ~BattlegroundBEScore() {};
};
class BattleGroundBE : public BattleGround
class BattlegroundBE : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundBE();
~BattleGroundBE();
BattlegroundBE();
~BattlegroundBE();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -66,7 +66,7 @@ class BattleGroundBE : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
@@ -16,15 +16,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundDS.h"
#include "Battleground.h"
#include "BattlegroundDS.h"
#include "Language.h"
#include "Player.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
BattleGroundDS::BattleGroundDS()
BattlegroundDS::BattlegroundDS()
{
m_BgObjects.resize(BG_DS_OBJECT_MAX);
@@ -39,14 +39,14 @@ BattleGroundDS::BattleGroundDS()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundDS::~BattleGroundDS()
BattlegroundDS::~BattlegroundDS()
{
}
void BattleGroundDS::Update(uint32 diff)
void BattlegroundDS::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (getWaterFallTimer() < diff)
{
if (isWaterFallActive())
@@ -68,13 +68,13 @@ void BattleGroundDS::Update(uint32 diff)
setWaterFallTimer(getWaterFallTimer() - diff);
}
void BattleGroundDS::StartingEventCloseDoors()
void BattlegroundDS::StartingEventCloseDoors()
{
for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundDS::StartingEventOpenDoors()
void BattlegroundDS::StartingEventOpenDoors()
{
for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
DoorOpen(i);
@@ -89,18 +89,18 @@ void BattleGroundDS::StartingEventOpenDoors()
SpawnBGObject(i, getWaterFallTimer());
}
void BattleGroundDS::AddPlayer(Player *plr)
void BattlegroundDS::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundDSScore* sc = new BattleGroundDSScore;
BattlegroundDSScore* sc = new BattlegroundDSScore;
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
void BattlegroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -109,24 +109,24 @@ void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
CheckArenaWinConditions();
}
void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!killer)
{
sLog.outError("BattleGroundDS: Killer player not found");
sLog.outError("BattlegroundDS: Killer player not found");
return;
}
BattleGround::HandleKillPlayer(player,killer);
Battleground::HandleKillPlayer(player,killer);
UpdateArenaWorldState();
CheckArenaWinConditions();
}
void BattleGroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -143,26 +143,26 @@ void BattleGroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger)
}
}
bool BattleGroundDS::HandlePlayerUnderMap(Player *player)
bool BattlegroundDS::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(), 1299.046, 784.825, 9.338, 2.422, false);
return true;
}
void BattleGroundDS::FillInitialWorldStates(WorldPacket &data)
void BattlegroundDS::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(3610) << uint32(1); // 9 show
UpdateArenaWorldState();
}
void BattleGroundDS::Reset()
void BattlegroundDS::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
}
bool BattleGroundDS::SetupBattleGround()
bool BattlegroundDS::SetupBattleground()
{
// gates
if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95, 817.2, 20.8096, 3.15, 0, 0, 0.99627, 0.0862864, RESPAWN_IMMEDIATELY)
@@ -18,9 +18,9 @@
#ifndef __BATTLEGROUNDDS_H
#define __BATTLEGROUNDDS_H
class BattleGround;
class Battleground;
enum BattleGroundDSObjectTypes
enum BattlegroundDSObjectTypes
{
BG_DS_OBJECT_DOOR_1 = 0,
BG_DS_OBJECT_DOOR_2 = 1,
@@ -31,7 +31,7 @@ enum BattleGroundDSObjectTypes
BG_DS_OBJECT_MAX = 6
};
enum BattleGroundDSObjects
enum BattlegroundDSObjects
{
BG_DS_OBJECT_TYPE_DOOR_1 = 192642,
BG_DS_OBJECT_TYPE_DOOR_2 = 192643,
@@ -41,28 +41,28 @@ enum BattleGroundDSObjects
BG_DS_OBJECT_TYPE_BUFF_2 = 184664
};
enum BattleGroundDSData
enum BattlegroundDSData
{ // These values are NOT blizzlike... need the correct data!
BG_DS_WATERFALL_TIMER_MIN = 30000,
BG_DS_WATERFALL_TIMER_MAX = 60000,
BG_DS_WATERFALL_DURATION = 10000,
};
class BattleGroundDSScore : public BattleGroundScore
class BattlegroundDSScore : public BattlegroundScore
{
public:
BattleGroundDSScore() {};
virtual ~BattleGroundDSScore() {};
BattlegroundDSScore() {};
virtual ~BattlegroundDSScore() {};
//TODO fix me
};
class BattleGroundDS : public BattleGround
class BattlegroundDS : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundDS();
~BattleGroundDS();
BattlegroundDS();
~BattlegroundDS();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -72,7 +72,7 @@ class BattleGroundDS : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
@@ -21,9 +21,9 @@
#include "ObjectMgr.h"
#include "World.h"
#include "WorldPacket.h"
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "BattleGroundEY.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "BattlegroundEY.h"
#include "Creature.h"
#include "Language.h"
#include "Object.h"
@@ -36,7 +36,7 @@ uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
200 // holiday
};
BattleGroundEY::BattleGroundEY()
BattlegroundEY::BattlegroundEY()
{
m_BuffChange = true;
m_BgObjects.resize(BG_EY_OBJECT_MAX);
@@ -52,13 +52,13 @@ BattleGroundEY::BattleGroundEY()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN;
}
BattleGroundEY::~BattleGroundEY()
BattlegroundEY::~BattlegroundEY()
{
}
void BattleGroundEY::Update(uint32 diff)
void BattlegroundEY::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -102,7 +102,7 @@ void BattleGroundEY::Update(uint32 diff)
}
}
void BattleGroundEY::StartingEventCloseDoors()
void BattlegroundEY::StartingEventCloseDoors()
{
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_IMMEDIATELY);
@@ -111,7 +111,7 @@ void BattleGroundEY::StartingEventCloseDoors()
SpawnBGObject(i, RESPAWN_ONE_DAY);
}
void BattleGroundEY::StartingEventOpenDoors()
void BattlegroundEY::StartingEventOpenDoors()
{
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_ONE_DAY);
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_ONE_DAY);
@@ -126,9 +126,9 @@ void BattleGroundEY::StartingEventOpenDoors()
}
}
void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
{
BattleGroundTeamId team_index = GetTeamIndexByTeamId(Team);
BattlegroundTeamId team_index = GetTeamIndexByTeamId(Team);
m_TeamScores[team_index] += Points;
m_HonorScoreTics[team_index] += Points;
if (m_HonorScoreTics[team_index] >= m_HonorTics)
@@ -139,7 +139,7 @@ void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
UpdateTeamScore(Team);
}
void BattleGroundEY::CheckSomeoneJoinedPoint()
void BattlegroundEY::CheckSomeoneJoinedPoint()
{
GameObject *obj = NULL;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
@@ -153,7 +153,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!plr)
{
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
sLog.outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
++j;
continue;
}
@@ -176,7 +176,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
}
}
void BattleGroundEY::CheckSomeoneLeftPoint()
void BattlegroundEY::CheckSomeoneLeftPoint()
{
//reset current point counts
for (uint8 i = 0; i < 2*EY_POINTS_MAX; ++i)
@@ -193,7 +193,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]);
if (!plr)
{
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
sLog.outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
@@ -218,7 +218,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
}
}
void BattleGroundEY::UpdatePointStatuses()
void BattlegroundEY::UpdatePointStatuses()
{
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
{
@@ -265,7 +265,7 @@ void BattleGroundEY::UpdatePointStatuses()
}
}
void BattleGroundEY::UpdateTeamScore(uint32 Team)
void BattlegroundEY::UpdateTeamScore(uint32 Team)
{
uint32 score = GetTeamScore(Team);
//TODO there should be some sound played when one team is near victory!! - and define variables
@@ -282,7 +282,7 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
if (score >= BG_EY_MAX_TEAM_SCORE)
{
score = BG_EY_MAX_TEAM_SCORE;
EndBattleGround(Team);
EndBattleground(Team);
}
if (Team == ALLIANCE)
@@ -291,7 +291,7 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
UpdateWorldState(EY_HORDE_RESOURCES, score);
}
void BattleGroundEY::EndBattleGround(uint32 winner)
void BattlegroundEY::EndBattleground(uint32 winner)
{
//win reward
if (winner == ALLIANCE)
@@ -302,10 +302,10 @@ void BattleGroundEY::EndBattleGround(uint32 winner)
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundEY::UpdatePointsCount(uint32 Team)
void BattlegroundEY::UpdatePointsCount(uint32 Team)
{
if (Team == ALLIANCE)
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
@@ -313,7 +313,7 @@ void BattleGroundEY::UpdatePointsCount(uint32 Team)
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
}
void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
{
//we MUST firstly send 0, after that we can send 1!!!
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
@@ -334,18 +334,18 @@ void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
}
}
void BattleGroundEY::AddPlayer(Player *plr)
void BattlegroundEY::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map
BattleGroundEYScore* sc = new BattleGroundEYScore;
BattlegroundEYScore* sc = new BattlegroundEYScore;
m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID());
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid)
{
// sometimes flag aura not removed :(
for (int j = EY_POINTS_MAX; j >= 0; --j)
@@ -369,7 +369,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
}
}
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -418,7 +418,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
}
}
bool BattleGroundEY::SetupBattleGround()
bool BattlegroundEY::SetupBattleground()
{
// doors
if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
@@ -475,7 +475,7 @@ bool BattleGroundEY::SetupBattleGround()
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY)
)
{
sLog.outErrorDb("BatteGroundEY: Failed to spawn some object BattleGround not created!");
sLog.outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
@@ -485,38 +485,38 @@ bool BattleGroundEY::SetupBattleGround()
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
if (!at)
{
sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
sLog.outError("BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
continue;
}
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
)
sLog.outError("BattleGroundEY: Cannot spawn buff");
sLog.outError("BattlegroundEY: Cannot spawn buff");
}
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
return true;
}
void BattleGroundEY::Reset()
void BattlegroundEY::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
@@ -530,7 +530,7 @@ void BattleGroundEY::Reset()
m_DroppedFlagGUID = 0;
m_PointAddingTimer = 0;
m_TowerCapCheckTimer = 0;
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
bool isBGWeekend = sBattlegroundMgr.IsBGWeekend(GetTypeID());
m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
@@ -545,7 +545,7 @@ void BattleGroundEY::Reset()
m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].reserve(30);
}
void BattleGroundEY::RespawnFlag(bool send_message)
void BattlegroundEY::RespawnFlag(bool send_message)
{
if (m_FlagCapturedBgObjectType > 0)
SpawnBGObject(m_FlagCapturedBgObjectType, RESPAWN_ONE_DAY);
@@ -563,7 +563,7 @@ void BattleGroundEY::RespawnFlag(bool send_message)
UpdateWorldState(NETHERSTORM_FLAG, 1);
}
void BattleGroundEY::RespawnFlagAfterDrop()
void BattlegroundEY::RespawnFlagAfterDrop()
{
RespawnFlag(true);
@@ -571,21 +571,21 @@ void BattleGroundEY::RespawnFlagAfterDrop()
if (obj)
obj->Delete();
else
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
sLog.outError("BattlegroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
SetDroppedFlagGUID(0);
}
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundEY::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(player, killer);
EventPlayerDroppedFlag(player);
}
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
void BattlegroundEY::EventPlayerDroppedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
@@ -621,7 +621,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
}
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
void BattlegroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
return;
@@ -653,7 +653,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
}
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
void BattlegroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -701,7 +701,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
DelCreature(Point + 6);//NULL checks are in DelCreature! 0-5 spirit guides
}
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
void BattlegroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -768,7 +768,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
}
}
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
void BattlegroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
{
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
return;
@@ -807,25 +807,25 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
break;
}
}
void BattleGroundEY::FillInitialWorldStates(WorldPacket& data)
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
{
data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]);
data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]);
@@ -875,7 +875,7 @@ void BattleGroundEY::FillInitialWorldStates(WorldPacket& data)
data << uint32(0xc0d) << uint32(0x17b);
}
WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const *BattlegroundEY::GetClosestGraveYard(Player* player)
{
uint32 g_id = 0;
@@ -895,7 +895,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
if (!entry)
{
sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!");
sLog.outError("BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!");
return NULL;
}
@@ -912,7 +912,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
if (!entry)
sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
sLog.outError("BattlegroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
else
{
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
@@ -928,7 +928,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
return nearestEntry;
}
bool BattleGroundEY::IsAllNodesConrolledByTeam(uint32 team) const
bool BattlegroundEY::IsAllNodesConrolledByTeam(uint32 team) const
{
uint32 count = 0;
for (int i = 0; i < EY_POINTS_MAX; ++i)
@@ -23,7 +23,7 @@
#include "Language.h"
class BattleGround;
class Battleground;
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILLISECONDS) //8 seconds
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILLISECONDS) //2 seconds
@@ -85,7 +85,7 @@ enum BG_EY_Spells
BG_EY_PLAYER_DROPPED_FLAG_SPELL = 34991
};
enum EYBattleGroundObjectEntry
enum EYBattlegroundObjectEntry
{
BG_OBJECT_A_DOOR_EY_ENTRY = 184719, //Alliance door
BG_OBJECT_H_DOOR_EY_ENTRY = 184720, //Horde door
@@ -101,7 +101,7 @@ enum EYBattleGroundObjectEntry
BG_OBJECT_DR_TOWER_CAP_EY_ENTRY = 184083 //Draenei Tower Cap Pt
};
enum EYBattleGroundPointsTrigger
enum EYBattlegroundPointsTrigger
{
TR_BLOOD_ELF_POINT = 4476,
TR_FEL_REALVER_POINT = 4514,
@@ -113,7 +113,7 @@ enum EYBattleGroundPointsTrigger
TR_DRAENEI_RUINS_BUFF = 4571
};
enum EYBattleGroundGaveyards
enum EYBattlegroundGaveyards
{
EY_GRAVEYARD_MAIN_ALLIANCE = 1103,
EY_GRAVEYARD_MAIN_HORDE = 1104,
@@ -123,7 +123,7 @@ enum EYBattleGroundGaveyards
EY_GRAVEYARD_MAGE_TOWER = 1108
};
enum EYBattleGroundPoints
enum EYBattlegroundPoints
{
FEL_REALVER = 0,
BLOOD_ELF = 1,
@@ -134,7 +134,7 @@ enum EYBattleGroundPoints
EY_POINTS_MAX = 4
};
enum EYBattleGroundCreaturesTypes
enum EYBattlegroundCreaturesTypes
{
EY_SPIRIT_FEL_REALVER = 0,
EY_SPIRIT_BLOOD_ELF = 1,
@@ -151,7 +151,7 @@ enum EYBattleGroundCreaturesTypes
BG_EY_CREATURES_MAX = 10
};
enum EYBattleGroundObjectTypes
enum EYBattlegroundObjectTypes
{
BG_EY_OBJECT_DOOR_A = 0,
BG_EY_OBJECT_DOOR_H = 1,
@@ -233,7 +233,7 @@ enum BG_EY_FlagState
BG_EY_FLAG_STATE_ON_GROUND = 3
};
enum EYBattleGroundPointState
enum EYBattlegroundPointState
{
EY_POINT_NO_OWNER = 0,
EY_POINT_STATE_UNCONTROLLED = 0,
@@ -245,9 +245,9 @@ enum BG_EY_Objectives
EY_OBJECTIVE_CAPTURE_FLAG = 183
};
struct BattleGroundEYPointIconsStruct
struct BattlegroundEYPointIconsStruct
{
BattleGroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex)
BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex)
: WorldStateControlIndex(_WorldStateControlIndex), WorldStateAllianceControlledIndex(_WorldStateAllianceControlledIndex), WorldStateHordeControlledIndex(_WorldStateHordeControlledIndex) {}
uint32 WorldStateControlIndex;
uint32 WorldStateAllianceControlledIndex;
@@ -262,9 +262,9 @@ const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = {
{2284.48f, 1731.23f, 1189.99f, 2.89725f} // MAGE_TOWER center
};
struct BattleGroundEYLoosingPointStruct
struct BattlegroundEYLoosingPointStruct
{
BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde)
BattlegroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde)
: SpawnNeutralObjectType(_SpawnNeutralObjectType),
DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde)
@@ -277,9 +277,9 @@ struct BattleGroundEYLoosingPointStruct
uint32 MessageIdHorde;
};
struct BattleGroundEYCapturingPointStruct
struct BattlegroundEYCapturingPointStruct
{
BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId)
BattlegroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId)
: DespawnNeutralObjectType(_DespawnNeutralObjectType),
SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde),
@@ -298,43 +298,43 @@ const uint8 BG_EY_TickPoints[EY_POINTS_MAX] = {1, 2, 5, 10};
const uint32 BG_EY_FlagPoints[EY_POINTS_MAX] = {75, 85, 100, 500};
//constant arrays:
const BattleGroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] =
const BattlegroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] =
{
BattleGroundEYPointIconsStruct(FEL_REAVER_UNCONTROL, FEL_REAVER_ALLIANCE_CONTROL, FEL_REAVER_HORDE_CONTROL),
BattleGroundEYPointIconsStruct(BLOOD_ELF_UNCONTROL, BLOOD_ELF_ALLIANCE_CONTROL, BLOOD_ELF_HORDE_CONTROL),
BattleGroundEYPointIconsStruct(DRAENEI_RUINS_UNCONTROL, DRAENEI_RUINS_ALLIANCE_CONTROL, DRAENEI_RUINS_HORDE_CONTROL),
BattleGroundEYPointIconsStruct(MAGE_TOWER_UNCONTROL, MAGE_TOWER_ALLIANCE_CONTROL, MAGE_TOWER_HORDE_CONTROL)
BattlegroundEYPointIconsStruct(FEL_REAVER_UNCONTROL, FEL_REAVER_ALLIANCE_CONTROL, FEL_REAVER_HORDE_CONTROL),
BattlegroundEYPointIconsStruct(BLOOD_ELF_UNCONTROL, BLOOD_ELF_ALLIANCE_CONTROL, BLOOD_ELF_HORDE_CONTROL),
BattlegroundEYPointIconsStruct(DRAENEI_RUINS_UNCONTROL, DRAENEI_RUINS_ALLIANCE_CONTROL, DRAENEI_RUINS_HORDE_CONTROL),
BattlegroundEYPointIconsStruct(MAGE_TOWER_UNCONTROL, MAGE_TOWER_ALLIANCE_CONTROL, MAGE_TOWER_HORDE_CONTROL)
};
const BattleGroundEYLoosingPointStruct m_LoosingPointTypes[EY_POINTS_MAX] =
const BattlegroundEYLoosingPointStruct m_LoosingPointTypes[EY_POINTS_MAX] =
{
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS),
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER),
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS),
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER)
BattlegroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS),
BattlegroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER),
BattlegroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS),
BattlegroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER)
};
const BattleGroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
{
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REALVER),
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF),
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS),
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER)
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REALVER),
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF),
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS),
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER)
};
class BattleGroundEYScore : public BattleGroundScore
class BattlegroundEYScore : public BattlegroundScore
{
public:
BattleGroundEYScore () : FlagCaptures(0) {};
virtual ~BattleGroundEYScore() {};
BattlegroundEYScore () : FlagCaptures(0) {};
virtual ~BattlegroundEYScore() {};
uint32 FlagCaptures;
};
class BattleGroundEY : public BattleGround
class BattlegroundEY : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundEY();
~BattleGroundEY();
BattlegroundEY();
~BattlegroundEY();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -355,10 +355,10 @@ class BattleGroundEY : public BattleGround
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player *player, Player *killer);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
virtual bool SetupBattleGround();
virtual bool SetupBattleground();
virtual void Reset();
void UpdateTeamScore(uint32 Team);
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
virtual void FillInitialWorldStates(WorldPacket& data);
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
@@ -17,11 +17,11 @@
*/
#include "Player.h"
#include "BattleGround.h"
#include "BattleGroundIC.h"
#include "Battleground.h"
#include "BattlegroundIC.h"
#include "Language.h"
BattleGroundIC::BattleGroundIC()
BattlegroundIC::BattlegroundIC()
{
m_BgCreatures.resize(2);
m_BgObjects.resize(5);
@@ -32,57 +32,57 @@ BattleGroundIC::BattleGroundIC()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
}
BattleGroundIC::~BattleGroundIC()
BattlegroundIC::~BattlegroundIC()
{
}
void BattleGroundIC::Update(uint32 diff)
void BattlegroundIC::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
}
void BattleGroundIC::StartingEventCloseDoors()
void BattlegroundIC::StartingEventCloseDoors()
{
}
void BattleGroundIC::StartingEventOpenDoors()
void BattlegroundIC::StartingEventOpenDoors()
{
}
void BattleGroundIC::AddPlayer(Player *plr)
void BattlegroundIC::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundICScore* sc = new BattleGroundICScore;
BattlegroundICScore* sc = new BattlegroundICScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
void BattlegroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
{
}
void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattlegroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
}
bool BattleGroundIC::SetupBattleGround()
bool BattlegroundIC::SetupBattleground()
{
AddObject(0, 195157, 459.72f, -419.93f, 42.55f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
AddObject(1, 195158, 797.72f, -1009.48f, 138.52f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
@@ -94,7 +94,7 @@ bool BattleGroundIC::SetupBattleGround()
return true;
}
void BattleGroundIC::SpawnLeader(uint32 teamid)
void BattlegroundIC::SpawnLeader(uint32 teamid)
{
if (teamid == ALLIANCE)
AddCreature(34924, 0, ALLIANCE, 307.03f, -833.04f, 48.91f, 6.23f, 10*MINUTE);
@@ -102,7 +102,7 @@ void BattleGroundIC::SpawnLeader(uint32 teamid)
AddCreature(34922, 1, HORDE, 1264.42f, -766.80f, 48.91f, 3.28f, 10*MINUTE);
}
void BattleGroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/)
void BattlegroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -111,21 +111,21 @@ void BattleGroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/)
if (entry == 34924)
{
RewardHonorToTeam(500,HORDE);
EndBattleGround(HORDE);
EndBattleground(HORDE);
}
else if (entry == 34922)
{
RewardHonorToTeam(500,ALLIANCE);
EndBattleGround(ALLIANCE);
EndBattleground(ALLIANCE);
}
}
void BattleGroundIC::EndBattleGround(uint32 winner)
void BattlegroundIC::EndBattleground(uint32 winner)
{
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundIC::EventPlayerClickedOnFlag(Player * /*source*/, GameObject* /*target_obj*/)
void BattlegroundIC::EventPlayerClickedOnFlag(Player * /*source*/, GameObject* /*target_obj*/)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -19,7 +19,7 @@
#ifndef __BATTLEGROUNDIC_H
#define __BATTLEGROUNDIC_H
class BattleGround;
class Battleground;
enum Buffs
{
@@ -33,20 +33,20 @@ enum BG_IC_Objectives
IC_OBJECTIVE_DEFEND_BASE = 246
};
class BattleGroundICScore : public BattleGroundScore
class BattlegroundICScore : public BattlegroundScore
{
public:
BattleGroundICScore() {};
virtual ~BattleGroundICScore() {};
BattlegroundICScore() {};
virtual ~BattlegroundICScore() {};
};
class BattleGroundIC : public BattleGround
class BattlegroundIC : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundIC();
~BattleGroundIC();
BattlegroundIC();
~BattlegroundIC();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -56,10 +56,10 @@ class BattleGroundIC : public BattleGround
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
void SpawnLeader(uint32 teamid);
void HandleKillUnit(Creature *unit, Player *killer);
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
/* Scorekeeping */
@@ -18,15 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundNA.h"
#include "Battleground.h"
#include "BattlegroundNA.h"
#include "Language.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "WorldPacket.h"
BattleGroundNA::BattleGroundNA()
BattlegroundNA::BattlegroundNA()
{
m_BgObjects.resize(BG_NA_OBJECT_MAX);
@@ -41,14 +41,14 @@ BattleGroundNA::BattleGroundNA()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundNA::~BattleGroundNA()
BattlegroundNA::~BattlegroundNA()
{
}
void BattleGroundNA::Update(uint32 diff)
void BattlegroundNA::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
/*if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -56,13 +56,13 @@ void BattleGroundNA::Update(uint32 diff)
}*/
}
void BattleGroundNA::StartingEventCloseDoors()
void BattlegroundNA::StartingEventCloseDoors()
{
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundNA::StartingEventOpenDoors()
void BattlegroundNA::StartingEventOpenDoors()
{
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i)
DoorOpen(i);
@@ -71,18 +71,18 @@ void BattleGroundNA::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattleGroundNA::AddPlayer(Player *plr)
void BattlegroundNA::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundNAScore* sc = new BattleGroundNAScore;
BattlegroundNAScore* sc = new BattlegroundNAScore;
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -91,30 +91,30 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
CheckArenaWinConditions();
}
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundNA::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!killer)
{
sLog.outError("BattleGroundNA: Killer player not found");
sLog.outError("BattlegroundNA: Killer player not found");
return;
}
BattleGround::HandleKillPlayer(player,killer);
Battleground::HandleKillPlayer(player,killer);
UpdateArenaWorldState();
CheckArenaWinConditions();
}
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
bool BattlegroundNA::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),4055.504395,2919.660645,13.611241,player->GetOrientation(),false);
return true;
}
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -136,19 +136,19 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
// HandleTriggerBuff(buff_guid,Source);
}
void BattleGroundNA::FillInitialWorldStates(WorldPacket &data)
void BattlegroundNA::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0xa11) << uint32(1); // 9
UpdateArenaWorldState();
}
void BattleGroundNA::Reset()
void BattlegroundNA::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
}
bool BattleGroundNA::SetupBattleGround()
bool BattlegroundNA::SetupBattleground()
{
// gates
if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
@@ -20,9 +20,9 @@
#ifndef __BATTLEGROUNDNA_H
#define __BATTLEGROUNDNA_H
class BattleGround;
class Battleground;
enum BattleGroundNAObjectTypes
enum BattlegroundNAObjectTypes
{
BG_NA_OBJECT_DOOR_1 = 0,
BG_NA_OBJECT_DOOR_2 = 1,
@@ -33,7 +33,7 @@ enum BattleGroundNAObjectTypes
BG_NA_OBJECT_MAX = 6
};
enum BattleGroundNAObjects
enum BattlegroundNAObjects
{
BG_NA_OBJECT_TYPE_DOOR_1 = 183978,
BG_NA_OBJECT_TYPE_DOOR_2 = 183980,
@@ -43,21 +43,21 @@ enum BattleGroundNAObjects
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
};
class BattleGroundNAScore : public BattleGroundScore
class BattlegroundNAScore : public BattlegroundScore
{
public:
BattleGroundNAScore() {};
virtual ~BattleGroundNAScore() {};
BattlegroundNAScore() {};
virtual ~BattlegroundNAScore() {};
//TODO fix me
};
class BattleGroundNA : public BattleGround
class BattlegroundNA : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundNA();
~BattleGroundNA();
BattlegroundNA();
~BattlegroundNA();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -67,7 +67,7 @@ class BattleGroundNA : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player *killer);
@@ -19,11 +19,11 @@
*/
#include "Player.h"
#include "BattleGround.h"
#include "BattleGroundRB.h"
#include "Battleground.h"
#include "BattlegroundRB.h"
#include "Language.h"
BattleGroundRB::BattleGroundRB()
BattlegroundRB::BattlegroundRB()
{
//TODO FIX ME!
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
@@ -32,50 +32,50 @@ BattleGroundRB::BattleGroundRB()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
}
BattleGroundRB::~BattleGroundRB()
BattlegroundRB::~BattlegroundRB()
{
}
void BattleGroundRB::Update(uint32 diff)
void BattlegroundRB::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
}
void BattleGroundRB::StartingEventCloseDoors()
void BattlegroundRB::StartingEventCloseDoors()
{
}
void BattleGroundRB::StartingEventOpenDoors()
void BattlegroundRB::StartingEventOpenDoors()
{
}
void BattleGroundRB::AddPlayer(Player *plr)
void BattlegroundRB::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundRBScore* sc = new BattleGroundRBScore;
BattlegroundRBScore* sc = new BattlegroundRBScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundRB::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
void BattlegroundRB::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
{
}
void BattleGroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattlegroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
}
@@ -21,22 +21,22 @@
#ifndef __BATTLEGROUNDRB_H
#define __BATTLEGROUNDRB_H
class BattleGround;
class Battleground;
class BattleGroundRBScore : public BattleGroundScore
class BattlegroundRBScore : public BattlegroundScore
{
public:
BattleGroundRBScore() {};
virtual ~BattleGroundRBScore() {};
BattlegroundRBScore() {};
virtual ~BattlegroundRBScore() {};
};
class BattleGroundRB : public BattleGround
class BattlegroundRB : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundRB();
~BattleGroundRB();
BattlegroundRB();
~BattlegroundRB();
void Update(uint32 diff);
virtual void AddPlayer(Player *plr);
@@ -18,15 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundRL.h"
#include "Battleground.h"
#include "BattlegroundRL.h"
#include "Language.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "WorldPacket.h"
BattleGroundRL::BattleGroundRL()
BattlegroundRL::BattlegroundRL()
{
m_BgObjects.resize(BG_RL_OBJECT_MAX);
@@ -41,14 +41,14 @@ BattleGroundRL::BattleGroundRL()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundRL::~BattleGroundRL()
BattlegroundRL::~BattlegroundRL()
{
}
void BattleGroundRL::Update(uint32 diff)
void BattlegroundRL::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
/*if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -56,13 +56,13 @@ void BattleGroundRL::Update(uint32 diff)
}*/
}
void BattleGroundRL::StartingEventCloseDoors()
void BattlegroundRL::StartingEventCloseDoors()
{
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundRL::StartingEventOpenDoors()
void BattlegroundRL::StartingEventOpenDoors()
{
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
DoorOpen(i);
@@ -71,18 +71,18 @@ void BattleGroundRL::StartingEventOpenDoors()
SpawnBGObject(i, 60);
}
void BattleGroundRL::AddPlayer(Player *plr)
void BattlegroundRL::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundRLScore* sc = new BattleGroundRLScore;
BattlegroundRLScore* sc = new BattlegroundRLScore;
m_PlayerScores[plr->GetGUID()] = sc;
UpdateArenaWorldState();
}
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -91,7 +91,7 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
CheckArenaWinConditions();
}
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundRL::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -102,19 +102,19 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
return;
}
BattleGround::HandleKillPlayer(player,killer);
Battleground::HandleKillPlayer(player,killer);
UpdateArenaWorldState();
CheckArenaWinConditions();
}
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
bool BattlegroundRL::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false);
return true;
}
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
@@ -137,19 +137,19 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
// HandleTriggerBuff(buff_guid,Source);
}
void BattleGroundRL::FillInitialWorldStates(WorldPacket &data)
void BattlegroundRL::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(0xbba) << uint32(1); // 9
UpdateArenaWorldState();
}
void BattleGroundRL::Reset()
void BattlegroundRL::Reset()
{
//call parent's reset
BattleGround::Reset();
Battleground::Reset();
}
bool BattleGroundRL::SetupBattleGround()
bool BattlegroundRL::SetupBattleground()
{
// gates
if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
@@ -20,9 +20,9 @@
#ifndef __BATTLEGROUNDRL_H
#define __BATTLEGROUNDRL_H
class BattleGround;
class Battleground;
enum BattleGroundRLObjectTypes
enum BattlegroundRLObjectTypes
{
BG_RL_OBJECT_DOOR_1 = 0,
BG_RL_OBJECT_DOOR_2 = 1,
@@ -31,7 +31,7 @@ enum BattleGroundRLObjectTypes
BG_RL_OBJECT_MAX = 4
};
enum BattleGroundRLObjects
enum BattlegroundRLObjects
{
BG_RL_OBJECT_TYPE_DOOR_1 = 185918,
BG_RL_OBJECT_TYPE_DOOR_2 = 185917,
@@ -39,21 +39,21 @@ enum BattleGroundRLObjects
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
};
class BattleGroundRLScore : public BattleGroundScore
class BattlegroundRLScore : public BattlegroundScore
{
public:
BattleGroundRLScore() {};
virtual ~BattleGroundRLScore() {};
BattlegroundRLScore() {};
virtual ~BattlegroundRLScore() {};
//TODO fix me
};
class BattleGroundRL : public BattleGround
class BattlegroundRL : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundRL();
~BattleGroundRL();
BattlegroundRL();
~BattlegroundRL();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -65,7 +65,7 @@ class BattleGroundRL : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player *killer);
bool HandlePlayerUnderMap(Player * plr);
};
@@ -18,15 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundRV.h"
#include "Battleground.h"
#include "BattlegroundRV.h"
#include "ObjectAccessor.h"
#include "Language.h"
#include "Player.h"
#include "WorldPacket.h"
#include "GameObject.h"
BattleGroundRV::BattleGroundRV()
BattlegroundRV::BattlegroundRV()
{
m_BgObjects.resize(BG_RV_OBJECT_MAX);
@@ -41,14 +41,14 @@ BattleGroundRV::BattleGroundRV()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
BattleGroundRV::~BattleGroundRV()
BattlegroundRV::~BattlegroundRV()
{
}
void BattleGroundRV::Update(uint32 diff)
void BattlegroundRV::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (getTimer() < diff)
{
@@ -92,11 +92,11 @@ void BattleGroundRV::Update(uint32 diff)
setTimer(getTimer() - diff);
}
void BattleGroundRV::StartingEventCloseDoors()
void BattlegroundRV::StartingEventCloseDoors()
{
}
void BattleGroundRV::StartingEventOpenDoors()
void BattlegroundRV::StartingEventOpenDoors()
{
// Buff respawn
SpawnBGObject(BG_RV_OBJECT_BUFF_1, 90);
@@ -112,11 +112,11 @@ void BattleGroundRV::StartingEventOpenDoors()
setTimer(BG_RV_FIRST_TIMER);
}
void BattleGroundRV::AddPlayer(Player *plr)
void BattlegroundRV::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundRVScore* sc = new BattleGroundRVScore;
BattlegroundRVScore* sc = new BattlegroundRVScore;
m_PlayerScores[plr->GetGUID()] = sc;
@@ -124,7 +124,7 @@ void BattleGroundRV::AddPlayer(Player *plr)
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
}
void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
void BattlegroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
{
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
@@ -135,18 +135,18 @@ void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
CheckArenaWinConditions();
}
void BattleGroundRV::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundRV::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!killer)
{
sLog.outError("BattleGroundRV: Killer player not found");
sLog.outError("BattlegroundRV: Killer player not found");
return;
}
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(player, killer);
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
@@ -154,14 +154,14 @@ void BattleGroundRV::HandleKillPlayer(Player *player, Player *killer)
CheckArenaWinConditions();
}
bool BattleGroundRV::HandlePlayerUnderMap(Player *player)
bool BattlegroundRV::HandlePlayerUnderMap(Player *player)
{
player->TeleportTo(GetMapId(), 763.5, -284, 28.276, 2.422, false);
return true;
}
void BattleGroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -178,20 +178,20 @@ void BattleGroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger)
}
}
void BattleGroundRV::FillInitialWorldStates(WorldPacket &data)
void BattlegroundRV::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(BG_RV_WORLD_STATE_A) << uint32(GetAlivePlayersCountByTeam(ALLIANCE));
data << uint32(BG_RV_WORLD_STATE_H) << uint32(GetAlivePlayersCountByTeam(HORDE));
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
}
void BattleGroundRV::Reset()
void BattlegroundRV::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
}
bool BattleGroundRV::SetupBattleGround()
bool BattlegroundRV::SetupBattleground()
{
// Fence
if (!AddObject(BG_RV_OBJECT_FENCE_1, BG_RV_OBJECT_TYPE_FENCE_1, 763.432373, -274.058197, 28.276695, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
@@ -20,9 +20,9 @@
#ifndef __BATTLEGROUNDRV_H
#define __BATTLEGROUNDRV_H
class BattleGround;
class Battleground;
enum BattleGroundRVObjectTypes
enum BattlegroundRVObjectTypes
{
BG_RV_OBJECT_BUFF_1,
BG_RV_OBJECT_BUFF_2,
@@ -53,7 +53,7 @@ enum BattleGroundRVObjectTypes
BG_RV_OBJECT_MAX,
};
enum BattleGroundRVObjects
enum BattlegroundRVObjects
{
BG_RV_OBJECT_TYPE_BUFF_1 = 184663,
BG_RV_OBJECT_TYPE_BUFF_2 = 184664,
@@ -82,7 +82,7 @@ enum BattleGroundRVObjects
BG_RV_OBJECT_TYPE_PILAR_4 = 194587, // ivory
};
enum BattleGroundRVData
enum BattlegroundRVData
{
BG_RV_STATE_OPEN_FENCES,
BG_RV_STATE_OPEN_PILARS,
@@ -97,20 +97,20 @@ enum BattleGroundRVData
BG_RV_WORLD_STATE = 0xe1a,
};
class BattleGroundRVScore : public BattleGroundScore
class BattlegroundRVScore : public BattlegroundScore
{
public:
BattleGroundRVScore() {};
virtual ~BattleGroundRVScore() {};
BattlegroundRVScore() {};
virtual ~BattlegroundRVScore() {};
};
class BattleGroundRV : public BattleGround
class BattlegroundRV : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundRV();
~BattleGroundRV();
BattlegroundRV();
~BattlegroundRV();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -122,7 +122,7 @@ class BattleGroundRV : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
bool SetupBattleGround();
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player *killer);
bool HandlePlayerUnderMap(Player * plr);
@@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundSA.h"
#include "Battleground.h"
#include "BattlegroundSA.h"
#include "Language.h"
#include "Player.h"
#include "GameObject.h"
@@ -25,7 +25,7 @@
#include "WorldPacket.h"
BattleGroundSA::BattleGroundSA()
BattlegroundSA::BattlegroundSA()
{
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES;
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE;
@@ -40,11 +40,11 @@ BattleGroundSA::BattleGroundSA()
InitSecondRound = false;
}
BattleGroundSA::~BattleGroundSA()
BattlegroundSA::~BattlegroundSA()
{
}
void BattleGroundSA::Reset()
void BattlegroundSA::Reset()
{
TotalTime = 0;
attackers = ((urand(0,1)) ? TEAM_ALLIANCE : TEAM_HORDE);
@@ -54,12 +54,12 @@ void BattleGroundSA::Reset()
status = BG_SA_WARMUP;
}
bool BattleGroundSA::SetupBattleGround()
bool BattlegroundSA::SetupBattleground()
{
return ResetObjs();
}
bool BattleGroundSA::ResetObjs()
bool BattlegroundSA::ResetObjs()
{
uint32 atF = BG_SA_Factions[attackers];
uint32 defF = BG_SA_Factions[attackers ? TEAM_ALLIANCE : TEAM_HORDE];
@@ -220,7 +220,7 @@ bool BattleGroundSA::ResetObjs()
return true;
}
void BattleGroundSA::StartShips()
void BattlegroundSA::StartShips()
{
if (ShipsStarted)
return;
@@ -230,7 +230,7 @@ void BattleGroundSA::StartShips()
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
{
if (Player* p = objmgr.GetPlayer(itr->first))
{
@@ -248,7 +248,7 @@ void BattleGroundSA::StartShips()
ShipsStarted = true;
}
void BattleGroundSA::Update(uint32 diff)
void BattlegroundSA::Update(uint32 diff)
{
if (InitSecondRound)
{
@@ -266,7 +266,7 @@ void BattleGroundSA::Update(uint32 diff)
return;
}
}
BattleGround::Update(diff);
Battleground::Update(diff);
TotalTime += diff;
if (status == BG_SA_WARMUP )
@@ -337,11 +337,11 @@ void BattleGroundSA::Update(uint32 diff)
RoundScores[1].winner = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
EndBattleground(NULL);
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
EndBattleground(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
EndBattleground(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
return;
}
}
@@ -353,15 +353,15 @@ void BattleGroundSA::Update(uint32 diff)
}
}
void BattleGroundSA::StartingEventCloseDoors()
void BattlegroundSA::StartingEventCloseDoors()
{
}
void BattleGroundSA::StartingEventOpenDoors()
void BattlegroundSA::StartingEventOpenDoors()
{
}
void BattleGroundSA::FillInitialWorldStates(WorldPacket& data)
void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
{
uint32 ally_attacks = uint32(attackers == TEAM_ALLIANCE ? 1 : 0);
uint32 horde_attacks = uint32(attackers == TEAM_HORDE ? 1 : 0);
@@ -401,11 +401,11 @@ void BattleGroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
}
void BattleGroundSA::AddPlayer(Player *plr)
void BattlegroundSA::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundSAScore* sc = new BattleGroundSAScore;
BattlegroundSAScore* sc = new BattlegroundSAScore;
if (!ShipsStarted)
{
@@ -433,34 +433,34 @@ void BattleGroundSA::AddPlayer(Player *plr)
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
void BattlegroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
{
}
void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
void BattlegroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found...
return;
if (type == SCORE_DESTROYED_DEMOLISHER)
((BattleGroundSAScore*)itr->second)->demolishers_destroyed += value;
((BattlegroundSAScore*)itr->second)->demolishers_destroyed += value;
else if (type == SCORE_DESTROYED_WALL)
((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
((BattlegroundSAScore*)itr->second)->gates_destroyed += value;
else
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
Battleground::UpdatePlayerScore(Source,type,value, doAddHonor);
}
void BattleGroundSA::TeleportPlayers()
void BattlegroundSA::TeleportPlayers()
{
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player *plr = objmgr.GetPlayer(itr->first))
{
@@ -493,7 +493,7 @@ void BattleGroundSA::TeleportPlayers()
}
}
void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent)
void BattlegroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent)
{
if (!go || !go->GetGOInfo())
return;
@@ -525,7 +525,7 @@ void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hit
}
}
void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer)
{
if (!unit)
return;
@@ -538,7 +538,7 @@ void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
You may ask what the fuck does it do?
Prevents owner overwriting guns faction with own.
*/
void BattleGroundSA::OverrideGunFaction()
void BattlegroundSA::OverrideGunFaction()
{
if (!m_BgCreatures[0])
return;
@@ -556,7 +556,7 @@ void BattleGroundSA::OverrideGunFaction()
}
}
void BattleGroundSA::DemolisherStartState(bool start)
void BattlegroundSA::DemolisherStartState(bool start)
{
if (!m_BgCreatures[0])
return;
@@ -573,7 +573,7 @@ void BattleGroundSA::DemolisherStartState(bool start)
}
}
void BattleGroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent)
void BattlegroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent)
{
uint32 i = GetGateIDFromDestroyEventID(destroyedEvent);
if (!GateStatus[i])
@@ -617,7 +617,7 @@ void BattleGroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroye
}
}
WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player)
{
uint32 safeloc = 0;
WorldSafeLocsEntry const* ret;
@@ -652,7 +652,7 @@ WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
return closest;
}
void BattleGroundSA::SendTime()
void BattlegroundSA::SendTime()
{
uint32 end_of_round = (BG_SA_ENDROUNDTIME - TotalTime);
UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000);
@@ -660,7 +660,7 @@ void BattleGroundSA::SendTime()
UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000);
}
void BattleGroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
void BattlegroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
switch(target_obj->GetEntry())
{
@@ -684,7 +684,7 @@ void BattleGroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target
};
}
void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
{
if (GraveyardStatus[i] == attackers)
return;
@@ -757,7 +757,7 @@ void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
};
}
void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{
if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED)
{
@@ -787,23 +787,23 @@ void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
RoundScores[1].winner = attackers;
RoundScores[1].time = TotalTime;ToggleTimer();
if (RoundScores[0].time == RoundScores[1].time)
EndBattleGround(NULL);
EndBattleground(NULL);
else if (RoundScores[0].time < RoundScores[1].time)
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
EndBattleground(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
else
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
EndBattleground(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
}
}
}
}
void BattleGroundSA::ToggleTimer()
void BattlegroundSA::ToggleTimer()
{
TimerEnabled = !TimerEnabled;
UpdateWorldState(BG_SA_ENABLE_TIMER, (TimerEnabled) ? 1 : 0);
}
void BattleGroundSA::EndBattleGround(uint32 winner)
void BattlegroundSA::EndBattleground(uint32 winner)
{
//honor reward for winning
if (winner == ALLIANCE)
@@ -815,10 +815,10 @@ void BattleGroundSA::EndBattleGround(uint32 winner)
RewardHonorToTeam(GetBonusHonorFromKill(2), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(2), HORDE);
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundSA::UpdateDemolisherSpawns()
void BattlegroundSA::UpdateDemolisherSpawns()
{
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
{
@@ -19,13 +19,13 @@
#ifndef __BATTLEGROUNDSA_H
#define __BATTLEGROUNDSA_H
class BattleGround;
class Battleground;
class BattleGroundSAScore : public BattleGroundScore
class BattlegroundSAScore : public BattlegroundScore
{
public:
BattleGroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {};
virtual ~BattleGroundSAScore() {};
BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {};
virtual ~BattlegroundSAScore() {};
uint8 demolishers_destroyed;
uint8 gates_destroyed;
};
@@ -399,20 +399,20 @@ struct BG_SA_RoundScore
uint32 time;
};
class BattleGroundSA : public BattleGround
class BattlegroundSA : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
BattleGroundSA();
~BattleGroundSA();
BattlegroundSA();
~BattlegroundSA();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
virtual void AddPlayer(Player *plr);
virtual void StartingEventCloseDoors();
virtual void StartingEventOpenDoors();
virtual bool SetupBattleGround();
virtual bool SetupBattleground();
virtual void Reset();
virtual void FillInitialWorldStates(WorldPacket& data);
virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent);
@@ -448,7 +448,7 @@ class BattleGroundSA : public BattleGround
}
return uws;
}
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
void RemovePlayer(Player *plr,uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
@@ -18,14 +18,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "BattleGround.h"
#include "BattleGroundWS.h"
#include "Battleground.h"
#include "BattlegroundWS.h"
#include "Creature.h"
#include "GameObject.h"
#include "Language.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
@@ -49,7 +49,7 @@ uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
{0,45,0} // holiday
};
BattleGroundWS::BattleGroundWS()
BattlegroundWS::BattlegroundWS()
{
m_BgObjects.resize(BG_WS_OBJECT_MAX);
m_BgCreatures.resize(BG_CREATURES_MAX_WS);
@@ -60,13 +60,13 @@ BattleGroundWS::BattleGroundWS()
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
}
BattleGroundWS::~BattleGroundWS()
BattlegroundWS::~BattlegroundWS()
{
}
void BattleGroundWS::Update(uint32 diff)
void BattlegroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
@@ -75,21 +75,21 @@ void BattleGroundWS::Update(uint32 diff)
if (GetTeamScore(ALLIANCE) == 0)
{
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
EndBattleGround(NULL);
EndBattleground(NULL);
else // Horde has more points and thus wins
EndBattleGround(HORDE);
EndBattleground(HORDE);
}
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
EndBattleGround(m_LastFlagCaptureTeam);
EndBattleground(m_LastFlagCaptureTeam);
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
EndBattleGround(HORDE);
EndBattleground(HORDE);
else
EndBattleGround(ALLIANCE);
EndBattleground(ALLIANCE);
}
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
{
@@ -173,7 +173,7 @@ void BattleGroundWS::Update(uint32 diff)
}
}
void BattleGroundWS::StartingEventCloseDoors()
void BattlegroundWS::StartingEventCloseDoors()
{
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i)
{
@@ -187,7 +187,7 @@ void BattleGroundWS::StartingEventCloseDoors()
UpdateWorldState(BG_WS_STATE_TIMER, 25);
}
void BattleGroundWS::StartingEventOpenDoors()
void BattlegroundWS::StartingEventOpenDoors()
{
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i)
DoorOpen(i);
@@ -203,16 +203,16 @@ void BattleGroundWS::StartingEventOpenDoors()
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
void BattleGroundWS::AddPlayer(Player *plr)
void BattlegroundWS::AddPlayer(Player *plr)
{
BattleGround::AddPlayer(plr);
Battleground::AddPlayer(plr);
//create score and add it to map, default values are set in constructor
BattleGroundWGScore* sc = new BattleGroundWGScore;
BattlegroundWGScore* sc = new BattlegroundWGScore;
m_PlayerScores[plr->GetGUID()] = sc;
}
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
{
if (Team == ALLIANCE)
{
@@ -236,7 +236,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
m_BothFlagsKept = false;
}
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -265,7 +265,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
m_BothFlagsKept = false;
}
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
void BattlegroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -343,7 +343,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner);
EndBattleGround(winner);
EndBattleground(winner);
}
else
{
@@ -351,7 +351,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
}
}
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
void BattlegroundWS::EventPlayerDroppedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
@@ -437,7 +437,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
}
}
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -556,14 +556,14 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
}
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid)
{
// sometimes flag aura not removed :(
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
{
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
sLog.outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false);
}
@@ -574,7 +574,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
{
if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
sLog.outError("BattlegroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false);
}
@@ -583,7 +583,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
}
}
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value)
{
if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
@@ -591,7 +591,7 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
}
void BattleGroundWS::UpdateTeamScore(uint32 team)
void BattlegroundWS::UpdateTeamScore(uint32 team)
{
if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
@@ -599,7 +599,7 @@ void BattleGroundWS::UpdateTeamScore(uint32 team)
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
}
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattlegroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
@@ -609,10 +609,10 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
//uint64 buff_guid = 0;
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];
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];
break;
case 3706: // Alliance elixir of regeneration spawn
@@ -652,7 +652,7 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
// HandleTriggerBuff(buff_guid,Source);
}
bool BattleGroundWS::SetupBattleGround()
bool BattlegroundWS::SetupBattleground()
{
// flags
if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
@@ -678,21 +678,21 @@ bool BattleGroundWS::SetupBattleGround()
|| !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY)
)
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
}
@@ -701,10 +701,10 @@ bool BattleGroundWS::SetupBattleGround()
return true;
}
void BattleGroundWS::Reset()
void BattlegroundWS::Reset()
{
//call parent's class reset
BattleGround::Reset();
Battleground::Reset();
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
m_FlagKeepers[BG_TEAM_HORDE] = 0;
@@ -714,7 +714,7 @@ void BattleGroundWS::Reset()
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
m_TeamScores[BG_TEAM_HORDE] = 0;
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
bool isBGWeekend = sBattlegroundMgr.IsBGWeekend(GetTypeID());
m_ReputationCapture = (isBGWeekend) ? 45 : 35;
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
@@ -730,7 +730,7 @@ void BattleGroundWS::Reset()
*/
}
void BattleGroundWS::EndBattleGround(uint32 winner)
void BattlegroundWS::EndBattleground(uint32 winner)
{
//win reward
if (winner == ALLIANCE)
@@ -741,43 +741,43 @@ void BattleGroundWS::EndBattleGround(uint32 winner)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
BattleGround::EndBattleGround(winner);
Battleground::EndBattleground(winner);
}
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
void BattlegroundWS::HandleKillPlayer(Player *player, Player *killer)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
EventPlayerDroppedFlag(player);
BattleGround::HandleKillPlayer(player, killer);
Battleground::HandleKillPlayer(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 = m_PlayerScores.find(Source->GetGUID());
if (itr == m_PlayerScores.end()) // player not found
return;
switch(type)
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
break;
case SCORE_FLAG_RETURNS: // flags returned
((BattleGroundWGScore*)itr->second)->FlagReturns += value;
((BattlegroundWGScore*)itr->second)->FlagReturns += value;
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
break;
default:
BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
break;
}
}
WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveYard(Player* player)
{
//if status in progress, it returns main graveyards with spiritguides
//else it will return the graveyard in the flagroom - this is especially good
@@ -800,7 +800,7 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
}
}
void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
{
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
@@ -21,7 +21,7 @@
#ifndef __BATTLEGROUNDWS_H
#define __BATTLEGROUNDWS_H
#include "BattleGround.h"
#include "Battleground.h"
enum BG_WS_TimerOrScore
{
@@ -144,23 +144,23 @@ enum BG_WS_Objectives
WS_OBJECTIVE_RETURN_FLAG = 44
};
class BattleGroundWGScore : public BattleGroundScore
class BattlegroundWGScore : public BattlegroundScore
{
public:
BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
virtual ~BattleGroundWGScore() {};
BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
virtual ~BattlegroundWGScore() {};
uint32 FlagCaptures;
uint32 FlagReturns;
};
class BattleGroundWS : public BattleGround
class BattlegroundWS : public Battleground
{
friend class BattleGroundMgr;
friend class BattlegroundMgr;
public:
/* Construction */
BattleGroundWS();
~BattleGroundWS();
BattlegroundWS();
~BattlegroundWS();
void Update(uint32 diff);
/* inherited from BattlegroundClass */
@@ -191,9 +191,9 @@ class BattleGroundWS : public BattleGround
void RemovePlayer(Player *plr, uint64 guid);
void HandleAreaTrigger(Player *Source, uint32 Trigger);
void HandleKillPlayer(Player *player, Player *killer);
bool SetupBattleGround();
bool SetupBattleground();
virtual void Reset();
void EndBattleGround(uint32 winner);
void EndBattleground(uint32 winner);
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
void UpdateFlagState(uint32 team, uint32 value);