* 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
@@ -35,8 +35,8 @@
#include "DisableMgr.h"
#include "ScriptMgr.h"
#include "MapManager.h"
#include "BattleGround.h"
#include "BattleGroundAB.h"
#include "Battleground.h"
#include "BattlegroundAB.h"
#include "Map.h"
#include "InstanceData.h"
@@ -328,7 +328,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
return IsHolidayActive(HolidayIds(holiday.id));
case ACHIEVEMENT_CRITERIA_DATA_TYPE_BG_LOSS_TEAM_SCORE:
{
BattleGround* bg = source->GetBattleGround();
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE,bg_loss_team_score.min_score,bg_loss_team_score.max_score);
@@ -796,7 +796,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// some hardcoded requirements
else
{
BattleGround* bg = GetPlayer()->GetBattleGround();
Battleground* bg = GetPlayer()->GetBattleground();
if (!bg)
continue;
@@ -806,7 +806,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
if (bg->GetTypeID(true) != BATTLEGROUND_AB)
continue;
if (!((BattleGroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam()))
if (!((BattlegroundAB*)bg)->IsTeamScores500Disadvantage(GetPlayer()->GetTeam()))
continue;
break;
}
@@ -945,7 +945,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
if (achievIdByArenaSlot[j] == achievement->ID)
{
BattleGround* bg = GetPlayer()->GetBattleGround();
Battleground* bg = GetPlayer()->GetBattleground();
if (!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != j)
notfit = true;
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);
+4 -4
View File
@@ -20,7 +20,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
file(GLOB_RECURSE sources_BattleGrounds BattleGrounds/*.cpp BattleGrounds/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
file(GLOB_RECURSE sources_Combat Combat/*.cpp Combat/*.h)
@@ -58,7 +58,7 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
${sources_BattleGrounds}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
${sources_Combat}
@@ -134,8 +134,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
+3 -3
View File
@@ -29,7 +29,7 @@
#include "Unit.h"
#include "GossipDef.h"
#include "Language.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include <fstream>
#include "ObjectMgr.h"
#include "Cell.h"
@@ -649,13 +649,13 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
bool ChatHandler::HandleDebugBattlegroundCommand(const char * /*args*/)
{
sBattleGroundMgr.ToggleTesting();
sBattlegroundMgr.ToggleTesting();
return true;
}
bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
{
sBattleGroundMgr.ToggleArenaTesting();
sBattlegroundMgr.ToggleArenaTesting();
return true;
}
+13 -13
View File
@@ -816,7 +816,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
Map* pMap = m_session->GetPlayer()->GetMap();
if (pMap->IsBattleGroundOrArena())
if (pMap->IsBattlegroundOrArena())
{
// only allow if gm mode is on
if (!_player->isGameMaster())
@@ -826,7 +826,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
return false;
}
// if both players are in different bgs
else if (target->GetBattleGroundId() && m_session->GetPlayer()->GetBattleGroundId() != target->GetBattleGroundId())
else if (target->GetBattlegroundId() && m_session->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
{
target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
//PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,nameLink.c_str());
@@ -835,10 +835,10 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
}
// all's well, set bg id
// when porting out from the bg, it will be reset to 0
target->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId());
target->SetBattlegroundId(m_session->GetPlayer()->GetBattlegroundId(), m_session->GetPlayer()->GetBattlegroundTypeId());
// remember current position as entry point for return at bg end teleportation
if (!target->GetMap()->IsBattleGroundOrArena())
target->SetBattleGroundEntryPoint();
if (!target->GetMap()->IsBattlegroundOrArena())
target->SetBattlegroundEntryPoint();
}
else if (pMap->IsDungeon())
{
@@ -933,7 +933,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
std::string chrNameLink = playerLink(target_name);
Map* cMap = target->GetMap();
if (cMap->IsBattleGroundOrArena())
if (cMap->IsBattlegroundOrArena())
{
// only allow if gm mode is on
if (!_player->isGameMaster())
@@ -943,7 +943,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
return false;
}
// if both players are in different bgs
else if (_player->GetBattleGroundId() && _player->GetBattleGroundId() != target->GetBattleGroundId())
else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
{
_player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
//PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chrNameLink.c_str());
@@ -952,10 +952,10 @@ bool ChatHandler::HandleGonameCommand(const char* args)
}
// all's well, set bg id
// when porting out from the bg, it will be reset to 0
_player->SetBattleGroundId(target->GetBattleGroundId(), target->GetBattleGroundTypeId());
_player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
// remember current position as entry point for return at bg end teleportation
if (!_player->GetMap()->IsBattleGroundOrArena())
_player->SetBattleGroundEntryPoint();
if (!_player->GetMap()->IsBattlegroundOrArena())
_player->SetBattlegroundEntryPoint();
}
else if (cMap->IsDungeon())
{
@@ -2214,7 +2214,7 @@ bool ChatHandler::HandleTeleCommand(const char * args)
}
MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
if (!me || me->IsBattleGroundOrArena())
if (!me || me->IsBattlegroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
@@ -2454,7 +2454,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
}
/* MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
if (!me || me->IsBattleGroundOrArena())
if (!me || me->IsBattlegroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
@@ -2538,7 +2538,7 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
}
MapEntry const * me = sMapStore.LookupEntry(tele->mapId);
if (!me || me->IsBattleGroundOrArena())
if (!me || me->IsBattlegroundOrArena())
{
SendSysMessage(LANG_CANNOT_TELE_TO_BG);
SetSentErrorMessage(true);
+2 -2
View File
@@ -48,7 +48,7 @@
#include "Config.h"
#include "Util.h"
#include "ItemEnchantmentMgr.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "InstanceSaveMgr.h"
#include "InstanceData.h"
#include "CreatureEventAIMgr.h"
@@ -6890,7 +6890,7 @@ bool ChatHandler::HandleSendMessageCommand(const char *args)
bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/)
{
sBattleGroundMgr.DistributeArenaPoints();
sBattlegroundMgr.DistributeArenaPoints();
return true;
}
+1 -1
View File
@@ -32,7 +32,7 @@
// also see MAX_LEVEL and GT_MAX_LEVEL define
#define STRONG_MAX_LEVEL 255
enum BattleGroundBracketId // bracketId for level ranges
enum BattlegroundBracketId // bracketId for level ranges
{
BG_BRACKET_ID_FIRST = 0,
BG_BRACKET_ID_LAST = 15
+1 -1
View File
@@ -820,7 +820,7 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
return NULL;
}
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id)
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
{
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
+1 -1
View File
@@ -63,7 +63,7 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
uint32 const* /*[3]*/ GetTalentTabPages(uint8 cls);
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundBracketId id);
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
extern DBCStorage <AchievementEntry> sAchievementStore;
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
+3 -3
View File
@@ -1172,9 +1172,9 @@ struct MapEntry
bool IsNonRaidDungeon() const { return map_type == MAP_INSTANCE; }
bool Instanceable() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID || map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsRaid() const { return map_type == MAP_RAID; }
bool IsBattleGround() const { return map_type == MAP_BATTLEGROUND; }
bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; }
bool IsBattleArena() const { return map_type == MAP_ARENA; }
bool IsBattleGroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
{
@@ -1222,7 +1222,7 @@ struct PvPDifficultyEntry
uint32 difficulty; // 5
// helpers
BattleGroundBracketId GetBracketId() const { return BattleGroundBracketId(bracketId); }
BattlegroundBracketId GetBracketId() const { return BattlegroundBracketId(bracketId); }
};
struct QuestSortEntry
+1 -1
View File
@@ -249,7 +249,7 @@ void LFGMgr::Join(Player *plr)
// Previous checks before joining
LfgJoinResult result = LFG_JOIN_OK;
if (plr->InBattleGround() || plr->InArena())
if (plr->InBattleground() || plr->InArena())
result = LFG_JOIN_USING_BG_SYSTEM;
else if (plr->HasAura(LFG_SPELL_DESERTER))
result = LFG_JOIN_DESERTER;
@@ -38,7 +38,7 @@
#include "Formulas.h"
#include "WaypointMovementGenerator.h"
#include "InstanceData.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -892,7 +892,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
if (!isBattleMaster())
return false;
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry());
BattlegroundTypeId bgTypeId = sBattlegroundMgr.GetBattleMasterBG(GetEntry());
if (!msg)
return pPlayer->GetBGAccessByLevel(bgTypeId);
@@ -35,10 +35,10 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "InstanceData.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "Util.h"
#include "OutdoorPvPMgr.h"
#include "BattleGroundAV.h"
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
@@ -348,7 +348,7 @@ void GameObject::Update(uint32 diff)
Unit* owner = GetOwner();
Unit* ok = NULL; // pointer to appropriate target if found any
bool IsBattleGroundTrap = false;
bool IsBattlegroundTrap = false;
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
float radius = (goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
@@ -362,7 +362,7 @@ void GameObject::Update(uint32 diff)
break;
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
IsBattleGroundTrap = true;
IsBattlegroundTrap = true;
if (!radius)
return;
@@ -400,11 +400,11 @@ void GameObject::Update(uint32 diff)
if (owner) // || goInfo->trap.charges == 1)
SetLootState(GO_JUST_DEACTIVATED);
if (IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
if (IsBattlegroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
{
//BattleGround gameobjects case
if (ok->ToPlayer()->InBattleGround())
if (BattleGround *bg = ok->ToPlayer()->GetBattleGround())
//Battleground gameobjects case
if (ok->ToPlayer()->InBattleground())
if (Battleground *bg = ok->ToPlayer()->GetBattleground())
bg->HandleTriggerBuff(GetGUID());
}
}
@@ -860,8 +860,8 @@ bool GameObject::ActivateToQuest(Player *pTarget) const
//TODO: fix this hack
//look for battlegroundAV for some objects which are only activated after mine gots captured by own team
if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S)
if (BattleGround *bg = pTarget->GetBattleGround())
if (bg->GetTypeID(true) == BATTLEGROUND_AV && !(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(),pTarget->GetTeam())))
if (Battleground *bg = pTarget->GetBattleground())
if (bg->GetTypeID(true) == BATTLEGROUND_AV && !(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(),pTarget->GetTeam())))
return false;
return true;
}
@@ -1151,7 +1151,7 @@ void GameObject::Use(Unit* user)
break;
}
if (BattleGround* bg = player->GetBattleGround())
if (Battleground* bg = player->GetBattleground())
bg->EventPlayerUsedGO(player, this);
player->CastedCreatureOrGO(info->id, GetGUID(), 0);
@@ -1387,10 +1387,10 @@ void GameObject::Use(Unit* user)
Player* player = (Player*)user;
if (player->CanUseBattleGroundObject())
if (player->CanUseBattlegroundObject())
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
Battleground *bg = player->GetBattleground();
if (!bg)
return;
if (player->GetVehicle())
@@ -1414,10 +1414,10 @@ void GameObject::Use(Unit* user)
Player* player = (Player*)user;
if (player->CanUseBattleGroundObject())
if (player->CanUseBattlegroundObject())
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
Battleground *bg = player->GetBattleground();
if (!bg)
return;
if( player->GetVehicle())
@@ -1601,13 +1601,13 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->building.destroyedDisplayId);
EventInform(m_goInfo->building.destroyedEvent);
if (pwho)
if (BattleGround* bg = pwho->GetBattleGround())
if (Battleground* bg = pwho->GetBattleground())
bg->DestroyGate(pwho, this, m_goInfo->building.destroyedEvent);
hitType = BG_OBJECT_DMG_HIT_TYPE_JUST_DESTROYED;
sScriptMgr.OnGameObjectDestroyed(pwho, this, m_goInfo->building.destroyedEvent);
}
if (pwho)
if (BattleGround* bg = pwho->GetBattleGround())
if (Battleground* bg = pwho->GetBattleground())
bg->EventPlayerDamagedGO(pwho, this, hitType, m_goInfo->building.destroyedEvent);
}
else // from intact to damaged
@@ -1629,7 +1629,7 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
hitType = BG_OBJECT_DMG_HIT_TYPE_JUST_HIGH_DAMAGED;
}
if (pwho)
if (BattleGround* bg = pwho->GetBattleGround())
if (Battleground* bg = pwho->GetBattleground())
bg->EventPlayerDamagedGO(pwho, this, hitType, m_goInfo->building.destroyedEvent);
}
SetGoAnimProgress(m_goValue->building.health*255/(m_goInfo->building.intactNumHits + m_goInfo->building.damagedNumHits));
+1 -1
View File
@@ -1845,7 +1845,7 @@ void WorldObject::SetZoneScript()
{
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceData();
else if (!map->IsBattleGroundOrArena())
else if (!map->IsBattlegroundOrArena())
m_zoneScript = sOutdoorPvPMgr.GetZoneScript(GetZoneId());
}
}
+58 -58
View File
@@ -52,9 +52,9 @@
#include "Util.h"
#include "Transport.h"
#include "Weather.h"
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "BattleGroundMgr.h"
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
#include "ArenaTeam.h"
@@ -482,8 +482,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
{
m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattleGroundQueueID[j].invitedToInstance = 0;
m_bgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattlegroundQueueID[j].invitedToInstance = 0;
}
m_logintime = time(NULL);
@@ -1731,7 +1731,7 @@ bool Player::ToggleAFK()
bool state = HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK);
// afk player not allowed in battleground
if (state && InBattleGround())
if (state && InBattleground())
LeaveBattleground();
return state;
@@ -1822,7 +1822,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// don't let enter battlegrounds without assigned battleground id (for example through areatrigger)...
// don't let gm level > 1 either
if (!InBattleGround() && mEntry->IsBattleGroundOrArena())
if (!InBattleground() && mEntry->IsBattlegroundOrArena())
return false;
// client without expansion support
@@ -1949,7 +1949,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
ResetContestedPvP();
// remove player from battleground on far teleport (when changing maps)
if (BattleGround const* bg = GetBattleGround())
if (Battleground const* bg = GetBattleground())
{
// Note: at battleground join battleground id set before teleport
// and we already will found "current" battleground
@@ -4811,7 +4811,7 @@ void Player::CreateCorpse()
flags |= CORPSE_FLAG_HIDE_HELM;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
flags |= CORPSE_FLAG_HIDE_CLOAK;
if (InBattleGround() && !InArena())
if (InBattleground() && !InArena())
flags |= CORPSE_FLAG_LOOTABLE; // to be able to remove insignia
corpse->SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
@@ -4835,7 +4835,7 @@ void Player::CreateCorpse()
}
// we do not need to save corpses for BG/arenas
if (!GetMap()->IsBattleGroundOrArena())
if (!GetMap()->IsBattlegroundOrArena())
corpse->SaveToDB();
// register for player, but not show
@@ -5086,7 +5086,7 @@ void Player::RepopAtGraveyard()
WorldSafeLocsEntry const *ClosestGrave = NULL;
// Special handle for battleground maps
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
ClosestGrave = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
@@ -6686,7 +6686,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt
UpdateHonorFields();
// do not reward honor in arenas, but return true to enable onkill spellproc
if (InBattleGround() && GetBattleGround() && GetBattleGround()->isArena())
if (InBattleground() && GetBattleground() && GetBattleground()->isArena())
return true;
// Promote to float for calculations
@@ -6783,9 +6783,9 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt
ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, honor, true);
if (InBattleGround() && honor > 0)
if (InBattleground() && honor > 0)
{
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
{
bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping
}
@@ -6800,9 +6800,9 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt
{
// Check if allowed to receive it in current map
uint8 MapType = sWorld.getConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
if ((MapType == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if ((MapType == 1 && !InBattleground() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|| (MapType == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|| (MapType == 3 && !InBattleGround()))
|| (MapType == 3 && !InBattleground()))
return true;
uint32 noSpaceForCount = 0;
@@ -6990,7 +6990,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
break;
case AREATEAM_NONE:
// overwrite for battlegrounds, maybe batter some zone flags but current known not 100% fit to this
pvpInfo.inHostileArea = sWorld.IsPvPRealm() || InBattleGround() || zone->flags & AREA_FLAG_OUTDOOR_PVP;
pvpInfo.inHostileArea = sWorld.IsPvPRealm() || InBattleground() || zone->flags & AREA_FLAG_OUTDOOR_PVP;
break;
default: // 6 in fact
pvpInfo.inHostileArea = false;
@@ -8155,7 +8155,7 @@ bool Player::CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const
Called by remove insignia spell effect */
void Player::RemovedInsignia(Player* looterPlr)
{
if (!GetBattleGroundId())
if (!GetBattlegroundId())
return;
// If not released spirit, do it !
@@ -8223,9 +8223,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
//TODO: fix this big hack
if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S))
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
if (bg->GetTypeID(true) == BATTLEGROUND_AV)
if (!(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(),GetTeam())))
if (!(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(),GetTeam())))
{
SendLootRelease(guid);
return;
@@ -8351,7 +8351,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
bones->lootForBody = true;
uint32 pLevel = bones->loot.gold;
bones->loot.clear();
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
if (bg->GetTypeID(true) == BATTLEGROUND_AV)
loot->FillLoot(1, LootTemplates_Creature, this, true);
// It may need a better formula
@@ -8526,7 +8526,7 @@ void Player::SendUpdateWorldState(uint32 Field, uint32 Value)
void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
{
// data depends on zoneid/mapid...
BattleGround* bg = GetBattleGround();
Battleground* bg = GetBattleground();
uint16 NumberOfFields = 0;
uint32 mapid = GetMapId();
OutdoorPvP * pvp = sOutdoorPvPMgr.GetOutdoorPvPToZoneId(zoneid);
@@ -9107,7 +9107,7 @@ void Player::SendBGWeekendWorldStates()
BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(i);
if (bl && bl->HolidayWorldStateId)
{
if (BattleGroundMgr::IsBGWeekend((BattleGroundTypeId)bl->id))
if (BattlegroundMgr::IsBGWeekend((BattlegroundTypeId)bl->id))
SendUpdateWorldState(bl->HolidayWorldStateId, 1);
else
SendUpdateWorldState(bl->HolidayWorldStateId, 0);
@@ -10892,7 +10892,7 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo
if (isInCombat())
return EQUIP_ERR_NOT_IN_COMBAT;
if (BattleGround* bg = GetBattleGround())
if (Battleground* bg = GetBattleground())
if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
@@ -11024,7 +11024,7 @@ uint8 Player::CanUnequipItem(uint16 pos, bool swap) const
if (isInCombat())
return EQUIP_ERR_NOT_IN_COMBAT;
if (BattleGround* bg = GetBattleGround())
if (Battleground* bg = GetBattleground())
if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
@@ -13702,7 +13702,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
break;
case GOSSIP_OPTION_BATTLEFIELD:
{
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(pSource->GetEntry());
BattlegroundTypeId bgTypeId = sBattlegroundMgr.GetBattleMasterBG(pSource->GetEntry());
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
@@ -15469,7 +15469,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
// hide quest if player is in raid-group and quest is no raid quest
if (GetGroup() && GetGroup()->isRaidGroup() && !qinfo->IsAllowedInRaid())
if (!InBattleGround()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
if (!InBattleground()) //there are two ways.. we can make every bg-quest a raidquest, or add this code here.. i don't know if this can be exploited by other quests, but i think all other quests depend on a specific area.. but keep this in mind, if something strange happens later
continue;
// There should be no mixed ReqItem/ReqSource drop
@@ -15971,18 +15971,18 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
RelocateToHomebind();
}
// Player was saved in Arena or Bg
else if (mapEntry && mapEntry->IsBattleGroundOrArena())
else if (mapEntry && mapEntry->IsBattlegroundOrArena())
{
BattleGround *currentBg = NULL;
if (m_bgData.bgInstanceID) //saved in BattleGround
currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
Battleground *currentBg = NULL;
if (m_bgData.bgInstanceID) //saved in Battleground
currentBg = sBattlegroundMgr.GetBattleground(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
bool player_at_bg = currentBg && currentBg->IsPlayerInBattleGround(GetGUID());
bool player_at_bg = currentBg && currentBg->IsPlayerInBattleground(GetGUID());
if (player_at_bg && currentBg->GetStatus() != STATUS_WAIT_LEAVE)
{
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(true), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId);
BattlegroundQueueTypeId bgQueueTypeId = sBattlegroundMgr.BGQueueTypeId(currentBg->GetTypeID(true), currentBg->GetArenaType());
AddBattlegroundQueueId(bgQueueTypeId);
m_bgData.bgTypeID = currentBg->GetTypeID(true);
@@ -15990,7 +15990,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
currentBg->EventPlayerLoggedIn(this, GetGUID());
currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), m_bgData.bgTeam);
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
SetInviteForBattlegroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
}
// Bg was not found - go to Entry Point
else
@@ -16000,7 +16000,7 @@ bool Player::LoadFromDB(uint32 guid, SqlQueryHolder *holder)
currentBg->RemovePlayerAtLeave(GetGUID(), false, true);
// Do not look for instance if bg not found
const WorldLocation& _loc = GetBattleGroundEntryPoint();
const WorldLocation& _loc = GetBattlegroundEntryPoint();
mapId = _loc.GetMapId(); instanceId = 0;
if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
@@ -18462,7 +18462,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
return;
}
if (returnreagent && (pet || m_temporaryUnsummonedPetNumber) && !InBattleGround())
if (returnreagent && (pet || m_temporaryUnsummonedPetNumber) && !InBattleground())
{
//returning of reagents only for players, so best done here
uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell;
@@ -20205,7 +20205,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
}
}
void Player::SetBattleGroundEntryPoint()
void Player::SetBattlegroundEntryPoint()
{
// Taxi path store
if (!m_taxi.empty())
@@ -20241,10 +20241,10 @@ void Player::SetBattleGroundEntryPoint()
return;
}
else
sLog.outError("SetBattleGroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
sLog.outError("SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
}
// If new entry point is not BG or arena set it
else if (!GetMap()->IsBattleGroundOrArena())
else if (!GetMap()->IsBattlegroundOrArena())
{
m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return;
@@ -20257,12 +20257,12 @@ void Player::SetBattleGroundEntryPoint()
void Player::LeaveBattleground(bool teleportToEntryPoint)
{
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
{
bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true);
// call after remove to be sure that player resurrected for correct cast
if (bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
if (bg->isBattleground() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
{
if (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)
{
@@ -20300,8 +20300,8 @@ bool Player::CanReportAfkDueToLimit()
///This player has been blamed to be inactive in a battleground
void Player::ReportedAfkBy(Player* reporter)
{
BattleGround *bg = GetBattleGround();
if (!bg || bg != reporter->GetBattleGround() || GetTeam() != reporter->GetTeam())
Battleground *bg = GetBattleground();
if (!bg || bg != reporter->GetBattleground() || GetTeam() != reporter->GetTeam())
return;
// check if player has 'Idle' or 'Inactive' debuff
@@ -20461,7 +20461,7 @@ bool Player::IsVisibleInGridForPlayer(Player const * pl) const
return true;
// It seems in battleground everyone sees everyone, except the enemy-faction ghosts
if (InBattleGround())
if (InBattleground())
{
if (!(isAlive() || m_deathTimer > 0) && !IsFriendlyTo(pl))
return false;
@@ -21284,27 +21284,27 @@ void Player::ResetWeeklyQuestStatus()
m_WeeklyQuestChanged = false;
}
BattleGround* Player::GetBattleGround() const
Battleground* Player::GetBattleground() const
{
if (GetBattleGroundId() == 0)
if (GetBattlegroundId() == 0)
return NULL;
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgData.bgTypeID);
return sBattlegroundMgr.GetBattleground(GetBattlegroundId(), m_bgData.bgTypeID);
}
bool Player::InArena() const
{
BattleGround *bg = GetBattleGround();
Battleground *bg = GetBattleground();
if (!bg || !bg->isArena())
return false;
return true;
}
bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const
bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
{
// get a template bg instead of running one
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
Battleground *bg = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg)
return false;
@@ -21451,7 +21451,7 @@ void Player::SummonIfPossible(bool agree)
// drop flag at summon
// this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag
if (BattleGround *bg = GetBattleGround())
if (Battleground *bg = GetBattleground())
bg->EventPlayerDroppedFlag(this);
m_summon_expire = 0;
@@ -22043,13 +22043,13 @@ PartyResult Player::CanUninviteFromGroup() const
if (!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
return ERR_NOT_LEADER;
if (InBattleGround())
if (InBattleground())
return ERR_INVITE_RESTRICTED;
return ERR_PARTY_RESULT_OK;
}
void Player::SetBattleGroundRaid(Group* group, int8 subgroup)
void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
{
//we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup());
@@ -22059,7 +22059,7 @@ void Player::SetBattleGroundRaid(Group* group, int8 subgroup)
m_group.setSubGroup((uint8)subgroup);
}
void Player::RemoveFromBattleGroundRaid()
void Player::RemoveFromBattlegroundRaid()
{
//remove existing reference
m_group.unlink();
@@ -22219,12 +22219,12 @@ WorldObject* Player::GetViewpoint() const
return NULL;
}
bool Player::CanUseBattleGroundObject()
bool Player::CanUseBattlegroundObject()
{
// TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
// maybe gameobject code should handle that ForceReaction usage
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
return (//InBattleGround() && // in battleground - not need, check in other cases
return (//InBattleground() && // in battleground - not need, check in other cases
//!IsMounted() && - not correct, player is dismounted when he clicks on flag
//player cannot use object when he is invulnerable (immune)
!isTotalImmune() && // not totally immune
@@ -23653,7 +23653,7 @@ void Player::ActivateSpec(uint8 spec)
// TODO:
// HACK: this shouldn't be checked at such a low level function but rather at the moment the spell is casted
if (GetMap()->IsBattleGround() && !HasAura(44521)) // In BattleGround with no Preparation buff
if (GetMap()->IsBattleground() && !HasAura(44521)) // In Battleground with no Preparation buff
return;
if (IsNonMeleeSpellCasted(false))
+43 -43
View File
@@ -37,7 +37,7 @@
#include "Util.h" // for Tokens typedef
#include "AchievementMgr.h"
#include "ReputationMgr.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "DBCEnums.h"
#include "LFG.h"
@@ -899,7 +899,7 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
class Player;
/// Holder for BattleGround data
/// Holder for Battleground data
struct BGData
{
BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0),
@@ -907,7 +907,7 @@ struct BGData
uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID,
/// when player is teleported to BG - (it is battleground's GUID)
BattleGroundTypeId bgTypeID;
BattlegroundTypeId bgTypeID;
std::set<uint32> bgAfkReporter;
uint8 bgAfkReportedCount;
@@ -2016,92 +2016,92 @@ class Player : public Unit, public GridObject<Player>
/*** BATTLEGROUND SYSTEM ***/
/*********************************************************/
bool InBattleGround() const { return m_bgData.bgInstanceID != 0; }
bool InBattleground() const { return m_bgData.bgInstanceID != 0; }
bool InArena() const;
uint32 GetBattleGroundId() const { return m_bgData.bgInstanceID; }
BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgData.bgTypeID; }
BattleGround* GetBattleGround() const;
uint32 GetBattlegroundId() const { return m_bgData.bgInstanceID; }
BattlegroundTypeId GetBattlegroundTypeId() const { return m_bgData.bgTypeID; }
Battleground* GetBattleground() const;
bool InBattleGroundQueue() const
bool InBattlegroundQueue() const
{
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
if (m_bgBattlegroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
return true;
return false;
}
BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; }
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
BattlegroundQueueTypeId GetBattlegroundQueueTypeId(uint32 index) const { return m_bgBattlegroundQueueID[index].bgQueueTypeId; }
uint32 GetBattlegroundQueueIndex(BattlegroundQueueTypeId bgQueueTypeId) const
{
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return i;
return PLAYER_MAX_BATTLEGROUND_QUEUES;
}
bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
bool IsInvitedForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
{
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return m_bgBattleGroundQueueID[i].invitedToInstance != 0;
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
return m_bgBattlegroundQueueID[i].invitedToInstance != 0;
return false;
}
bool InBattleGroundQueueForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
bool InBattlegroundQueueForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId) const
{
return GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
return GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES;
}
void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId)
void SetBattlegroundId(uint32 val, BattlegroundTypeId bgTypeId)
{
m_bgData.bgInstanceID = val;
m_bgData.bgTypeID = bgTypeId;
}
uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
uint32 AddBattlegroundQueueId(BattlegroundQueueTypeId val)
{
for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattlegroundQueueID[i].bgQueueTypeId == val)
{
m_bgBattleGroundQueueID[i].bgQueueTypeId = val;
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
m_bgBattlegroundQueueID[i].bgQueueTypeId = val;
m_bgBattlegroundQueueID[i].invitedToInstance = 0;
return i;
}
}
return PLAYER_MAX_BATTLEGROUND_QUEUES;
}
bool HasFreeBattleGroundQueueId()
bool HasFreeBattlegroundQueueId()
{
for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
return true;
return false;
}
void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val)
void RemoveBattlegroundQueueId(BattlegroundQueueTypeId val)
{
for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == val)
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == val)
{
m_bgBattleGroundQueueID[i].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattleGroundQueueID[i].invitedToInstance = 0;
m_bgBattlegroundQueueID[i].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattlegroundQueueID[i].invitedToInstance = 0;
return;
}
}
}
void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId)
void SetInviteForBattlegroundQueueType(BattlegroundQueueTypeId bgQueueTypeId, uint32 instanceId)
{
for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
m_bgBattleGroundQueueID[i].invitedToInstance = instanceId;
if (m_bgBattlegroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
m_bgBattlegroundQueueID[i].invitedToInstance = instanceId;
}
bool IsInvitedForBattleGroundInstance(uint32 instanceId) const
bool IsInvitedForBattlegroundInstance(uint32 instanceId) const
{
for (uint8 i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
if (m_bgBattlegroundQueueID[i].invitedToInstance == instanceId)
return true;
return false;
}
WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgData.joinPos; }
void SetBattleGroundEntryPoint();
WorldLocation const& GetBattlegroundEntryPoint() const { return m_bgData.joinPos; }
void SetBattlegroundEntryPoint();
void SetBGTeam(uint32 team) { m_bgData.bgTeam = team; }
uint32 GetBGTeam() const { return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam(); }
@@ -2112,9 +2112,9 @@ class Player : public Unit, public GridObject<Player>
void ReportedAfkBy(Player* reporter);
void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const;
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
bool isTotalImmunity();
bool CanUseBattleGroundObject();
bool CanUseBattlegroundObject();
bool isTotalImmune();
bool CanCaptureTowerPoint();
@@ -2290,9 +2290,9 @@ class Player : public Unit, public GridObject<Player>
void SetAuraUpdateMaskForRaid(uint8 slot) { m_auraRaidUpdateMask |= (uint64(1) << slot); }
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
// BattleGround Group System
void SetBattleGroundRaid(Group *group, int8 subgroup = -1);
void RemoveFromBattleGroundRaid();
// Battleground Group System
void SetBattlegroundRaid(Group *group, int8 subgroup = -1);
void RemoveFromBattlegroundRaid();
Group * GetOriginalGroup() { return m_originalGroup.getTarget(); }
GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
@@ -2361,13 +2361,13 @@ class Player : public Unit, public GridObject<Player>
/*
this is an array of BG queues (BgTypeIDs) in which is player
*/
struct BgBattleGroundQueueID_Rec
struct BgBattlegroundQueueID_Rec
{
BattleGroundQueueTypeId bgQueueTypeId;
BattlegroundQueueTypeId bgQueueTypeId;
uint32 invitedToInstance;
};
BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
BgBattlegroundQueueID_Rec m_bgBattlegroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
BGData m_bgData;
bool m_IsBGRandomWinner;
+11 -11
View File
@@ -42,7 +42,7 @@
#include "Pet.h"
#include "Util.h"
#include "Totem.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "OutdoorPvP.h"
#include "InstanceSaveMgr.h"
#include "GridNotifiersImpl.h"
@@ -687,7 +687,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// in bg, count dmg if victim is also a player
if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
if (BattleGround *bg = killer->GetBattleGround())
if (Battleground *bg = killer->GetBattleground())
{
// FIXME: kept by compatibility. don't know in BG if the restriction apply.
bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
@@ -9817,7 +9817,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
// overheal = addhealth - gain
unit->SendHealSpellLog(pVictim, spellProto->Id, addhealth, addhealth - gain, absorb, critical);
if (BattleGround *bg = unit->ToPlayer()->GetBattleGround())
if (Battleground *bg = unit->ToPlayer()->GetBattleground())
bg->UpdatePlayerScore((Player*)unit, SCORE_HEALING_DONE, gain);
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
@@ -11631,7 +11631,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId)
Pet* pet = this->ToPlayer()->GetPet();
if (pet)
{
BattleGround *bg = ToPlayer()->GetBattleGround();
Battleground *bg = ToPlayer()->GetBattleground();
// don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
if (bg && bg->isArena())
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
@@ -15046,7 +15046,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
pVictim->ToPlayer()->SetPvPDeath(player != NULL);
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !pVictim->ToPlayer()->InBattleGround()) || (player && sWorld.getConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
if ((durabilityLoss && !player && !pVictim->ToPlayer()->InBattleground()) || (player && sWorld.getConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
{
DEBUG_LOG("We are dead, losing %u percent durability", sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH));
pVictim->ToPlayer()->DurabilityLossAll(sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH),false);
@@ -15123,9 +15123,9 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
// battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
if (player && player->InBattleGround())
if (player && player->InBattleground())
{
if (BattleGround *bg = player->GetBattleGround())
if (Battleground *bg = player->GetBattleground())
{
if (pVictim->GetTypeId() == TYPEID_PLAYER)
bg->HandleKillPlayer((Player*)pVictim, player);
@@ -15396,7 +15396,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
// Set charmed
Map* pMap = GetMap();
if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleGround()))
if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleground()))
setFaction(charmer->getFaction());
charmer->SetCharm(this, true);
@@ -15496,7 +15496,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
getHostileRefManager().deleteReferences();
DeleteThreatList();
Map* pMap = GetMap();
if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleGround()))
if (!IsVehicle() || (IsVehicle() && pMap && !pMap->IsBattleground()))
RestoreFaction();
GetMotionMaster()->InitDefault();
@@ -16336,8 +16336,8 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
this->ToPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
// drop flag at invisible in bg
if (this->ToPlayer()->InBattleGround())
if (BattleGround *bg = this->ToPlayer()->GetBattleGround())
if (this->ToPlayer()->InBattleground())
if (Battleground *bg = this->ToPlayer()->GetBattleground())
bg->EventPlayerDroppedFlag(this->ToPlayer());
}
+10 -10
View File
@@ -29,7 +29,7 @@
#include "MapManager.h"
#include "GossipDef.h"
#include "Player.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
{
@@ -929,7 +929,7 @@ void GameEventMgr::LoadFromDB()
}
// set all flags to 0
mGameEventBattleGroundHolidays.resize(mGameEvent.size(),0);
mGameEventBattlegroundHolidays.resize(mGameEvent.size(),0);
// load game event battleground flags
sLog.outString("Loading Game Event Battleground Data...");
@@ -966,7 +966,7 @@ void GameEventMgr::LoadFromDB()
++count;
mGameEventBattleGroundHolidays[event_id] = fields[1].GetUInt32();
mGameEventBattlegroundHolidays[event_id] = fields[1].GetUInt32();
} while (result->NextRow());
sLog.outString();
@@ -1172,7 +1172,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
// remove vendor items
UpdateEventNPCVendor(event_id, false);
// update bg holiday
UpdateBattleGroundSettings();
UpdateBattlegroundSettings();
}
void GameEventMgr::ApplyNewEvent(uint16 event_id)
@@ -1203,7 +1203,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
// add vendor items
UpdateEventNPCVendor(event_id, true);
// update bg holiday
UpdateBattleGroundSettings();
UpdateBattlegroundSettings();
}
void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
@@ -1230,12 +1230,12 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
}
}
void GameEventMgr::UpdateBattleGroundSettings()
void GameEventMgr::UpdateBattlegroundSettings()
{
uint32 mask = 0;
for (ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
mask |= mGameEventBattleGroundHolidays[*itr];
sBattleGroundMgr.SetHolidayWeekends(mask);
mask |= mGameEventBattlegroundHolidays[*itr];
sBattlegroundMgr.SetHolidayWeekends(mask);
}
void GameEventMgr::UpdateEventNPCVendor(uint16 event_id, bool activate)
@@ -1579,14 +1579,14 @@ void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate)
GameEventData const& event = mGameEvent[event_id];
if (event.holiday_id != HOLIDAY_NONE)
{
BattleGroundTypeId bgTypeId = BattleGroundMgr::WeekendHolidayIdToBGType(event.holiday_id);
BattlegroundTypeId bgTypeId = BattlegroundMgr::WeekendHolidayIdToBGType(event.holiday_id);
if (bgTypeId != BATTLEGROUND_TYPE_NONE)
{
BattlemasterListEntry const * bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (bl && bl->HolidayWorldStateId)
{
WorldPacket data;
sBattleGroundMgr.BuildUpdateWorldStatePacket(&data, bl->HolidayWorldStateId, Activate ? 1 : 0);
sBattlegroundMgr.BuildUpdateWorldStatePacket(&data, bl->HolidayWorldStateId, Activate ? 1 : 0);
sWorld.SendGlobalMessage(&data);
}
}
+2 -2
View File
@@ -128,7 +128,7 @@ class GameEventMgr
void UpdateWorldStates(uint16 event_id, bool Activate);
void UpdateEventNPCFlags(uint16 event_id);
void UpdateEventNPCVendor(uint16 event_id, bool activate);
void UpdateBattleGroundSettings();
void UpdateBattlegroundSettings();
bool CheckOneGameEventConditions(uint16 event_id);
void SaveWorldEventStateToDB(uint16 event_id);
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
@@ -163,7 +163,7 @@ class GameEventMgr
//GameEventGuidMap mGameEventGameobjectGuids;
GameEventIdMap mGameEventPoolIds;
GameEventDataMap mGameEvent;
GameEventBitmask mGameEventBattleGroundHolidays;
GameEventBitmask mGameEventBattlegroundHolidays;
QuestIdToEventConditionMap mQuestToEventConditions;
GameEventNPCFlagMap mGameEventNPCFlags;
GuidEventNpcGossipIdMap mNPCGossipIds;
+1 -1
View File
@@ -306,7 +306,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool /*insign
// create the bones only if the map and the grid is loaded at the corpse's location
// ignore bones creating option in case insignia
if (map && (insignia ||
(map->IsBattleGroundOrArena() ? sWorld.getConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getConfig(CONFIG_DEATH_BONES_WORLD))) &&
(map->IsBattlegroundOrArena() ? sWorld.getConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getConfig(CONFIG_DEATH_BONES_WORLD))) &&
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
{
// Create bones, don't change Corpse
+13 -13
View File
@@ -28,8 +28,8 @@
#include "Group.h"
#include "Formulas.h"
#include "ObjectAccessor.h"
#include "BattleGround.h"
#include "BattleGroundMgr.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "MapManager.h"
#include "InstanceSaveMgr.h"
#include "MapInstanced.h"
@@ -420,7 +420,7 @@ void Group::Disband(bool hideDestroy)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
if (isBGGroup())
player->RemoveFromBattleGroundRaid();
player->RemoveFromBattlegroundRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -1081,7 +1081,7 @@ void Group::SendUpdate()
data << uint8(m_groupType); // group type (flags in 3.3)
data << uint8(citr->group);
data << uint8(citr->flags);
data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup?
data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattlegroundGroup?
if (m_groupType & GROUPTYPE_LFD)
{
data << uint8(0);
@@ -1221,9 +1221,9 @@ bool Group::_addMember(const uint64 &guid, const char* name, uint8 group)
if (player)
{
player->SetGroupInvite(NULL);
//if player is in group and he is being added to BG raid group, then call SetBattleGroundRaid()
//if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
if (player->GetGroup() && isBGGroup())
player->SetBattleGroundRaid(this, group);
player->SetBattlegroundRaid(this, group);
//if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
else if (player->GetGroup())
player->SetOriginalGroup(this, group);
@@ -1258,7 +1258,7 @@ bool Group::_removeMember(const uint64 &guid)
{
//if we are removing player from battleground raid
if (isBGGroup())
player->RemoveFromBattleGroundRaid();
player->RemoveFromBattlegroundRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -1561,7 +1561,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
}
}
GroupJoinBattlegroundResult Group::CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 /*MaxPlayerCount*/, bool isRated, uint32 arenaSlot)
GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 /*MaxPlayerCount*/, bool isRated, uint32 arenaSlot)
{
BattlemasterListEntry const* bgEntry = sBattlemasterListStore.LookupEntry(bgOrTemplate->GetTypeID());
if (!bgEntry)
@@ -1590,7 +1590,7 @@ GroupJoinBattlegroundResult Group::CanJoinBattleGroundQueue(BattleGround const*
uint32 arenaTeamId = reference->GetArenaTeamId(arenaSlot);
uint32 team = reference->GetTeam();
BattleGroundQueueTypeId bgQueueTypeIdRandom = BattleGroundMgr::BGQueueTypeId(BATTLEGROUND_RB, 0);
BattlegroundQueueTypeId bgQueueTypeIdRandom = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_RB, 0);
// check every member of the group to be able to join
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
@@ -1610,19 +1610,19 @@ GroupJoinBattlegroundResult Group::CanJoinBattleGroundQueue(BattleGround const*
if (isRated && member->GetArenaTeamId(arenaSlot) != arenaTeamId)
return ERR_BATTLEGROUND_JOIN_FAILED;
// don't let join if someone from the group is already in that bg queue
if (member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeId))
if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeId))
return ERR_BATTLEGROUND_JOIN_FAILED; // not blizz-like
// don't let join if someone from the group is in bg queue random
if (member->InBattleGroundQueueForBattleGroundQueueType(bgQueueTypeIdRandom))
if (member->InBattlegroundQueueForBattlegroundQueueType(bgQueueTypeIdRandom))
return ERR_IN_RANDOM_BG;
// don't let join to bg queue random if someone from the group is already in bg queue
if (bgOrTemplate->GetTypeID() == BATTLEGROUND_RB && member->InBattleGroundQueue())
if (bgOrTemplate->GetTypeID() == BATTLEGROUND_RB && member->InBattlegroundQueue())
return ERR_IN_NON_RANDOM_BG;
// check for deserter debuff in case not arena queue
if (bgOrTemplate->GetTypeID() != BATTLEGROUND_AA && !member->CanJoinToBattleground())
return ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS;
// check if member can join any more battleground queues
if (!member->HasFreeBattleGroundQueueId())
if (!member->HasFreeBattlegroundQueueId())
return ERR_BATTLEGROUND_TOO_MANY_QUEUES; // not blizz-like
}
return GroupJoinBattlegroundResult(bgOrTemplate->GetTypeID());
+5 -5
View File
@@ -23,7 +23,7 @@
#include "GroupReference.h"
#include "GroupRefManager.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "LootMgr.h"
#include "DBCEnums.h"
#include "Unit.h"
@@ -77,7 +77,7 @@ enum GroupType
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
};
class BattleGround;
class Battleground;
enum GroupUpdateFlags
{
@@ -270,8 +270,8 @@ class Group
// some additional raid methods
void ConvertToRaid();
void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; }
GroupJoinBattlegroundResult CanJoinBattleGroundQueue(BattleGround const* bgOrTemplate, BattleGroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void SetBattlegroundGroup(Battleground *bg) { m_bgGroup = bg; }
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(const uint64 &guid, const uint8 &group);
void ChangeMembersGroup(Player *player, const uint8 &group);
@@ -449,7 +449,7 @@ class Group
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
BattleGround* m_bgGroup;
Battleground* m_bgGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
+2 -2
View File
@@ -30,7 +30,7 @@
#include "Unit.h"
#include "Language.h"
#include "DBCStores.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "Item.h"
#include "AuctionHouseMgr.h"
@@ -926,7 +926,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
if (sender.GetMailMessageType() == MAIL_AUCTION && m_items.empty() && !m_money)
expire_delay = sWorld.getConfig(CONFIG_MAIL_DELIVERY_DELAY);
// mail from battlemaster (rewardmarks) should last only one day
else if (sender.GetMailMessageType() == MAIL_CREATURE && sBattleGroundMgr.GetBattleMasterBG(sender.GetSenderId()) != BATTLEGROUND_TYPE_NONE)
else if (sender.GetMailMessageType() == MAIL_CREATURE && sBattlegroundMgr.GetBattleMasterBG(sender.GetSenderId()) != BATTLEGROUND_TYPE_NONE)
expire_delay = DAY;
// default case: expire time if COD 3 days, if no COD 30 days
else
+12 -12
View File
@@ -2009,7 +2009,7 @@ void Map::DelayedUpdate(const uint32 t_diff)
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
// This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended
if (!IsBattleGroundOrArena())
if (!IsBattlegroundOrArena())
{
for (GridRefManager<NGridType>::iterator i = GridRefManager<NGridType>::begin(); i != GridRefManager<NGridType>::end();)
{
@@ -2598,25 +2598,25 @@ uint32 InstanceMap::GetMaxResetDelay() const
/* ******* Battleground Instance Maps ******* */
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
: Map(id, expiry, InstanceId, spawnMode, _parent)
{
//lets initialize visibility distance for BG/Arenas
BattleGroundMap::InitVisibilityDistance();
BattlegroundMap::InitVisibilityDistance();
}
BattleGroundMap::~BattleGroundMap()
BattlegroundMap::~BattlegroundMap()
{
}
void BattleGroundMap::InitVisibilityDistance()
void BattlegroundMap::InitVisibilityDistance()
{
//init visibility distance for BG/Arenas
m_VisibleDistance = World::GetMaxVisibleDistanceInBGArenas();
m_VisibilityNotifyPeriod = World::GetVisibilityNotifyPeriodInBGArenas();
}
bool BattleGroundMap::CanEnter(Player * player)
bool BattlegroundMap::CanEnter(Player * player)
{
if (player->GetMapRef().getTarget() == this)
{
@@ -2625,7 +2625,7 @@ bool BattleGroundMap::CanEnter(Player * player)
return false;
}
if (player->GetBattleGroundId() != GetInstanceId())
if (player->GetBattlegroundId() != GetInstanceId())
return false;
// player number limit is checked in bgmgr, no need to do it here
@@ -2633,7 +2633,7 @@ bool BattleGroundMap::CanEnter(Player * player)
return Map::CanEnter(player);
}
bool BattleGroundMap::Add(Player * player)
bool BattlegroundMap::Add(Player * player)
{
{
ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, Lock, false);
@@ -2646,24 +2646,24 @@ bool BattleGroundMap::Add(Player * player)
return Map::Add(player);
}
void BattleGroundMap::Remove(Player *player, bool remove)
void BattlegroundMap::Remove(Player *player, bool remove)
{
sLog.outDetail("MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
Map::Remove(player, remove);
}
void BattleGroundMap::SetUnload()
void BattlegroundMap::SetUnload()
{
m_unloadTimer = MIN_UNLOAD_DELAY;
}
void BattleGroundMap::RemoveAllPlayers()
void BattlegroundMap::RemoveAllPlayers()
{
if (HavePlayers())
for (MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
if (Player* plr = itr->getSource())
if (!plr->IsBeingTeleportedFar())
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
plr->TeleportTo(plr->GetBattlegroundEntryPoint());
}
+10 -10
View File
@@ -50,7 +50,7 @@ class CreatureGroup;
struct ScriptInfo;
struct ScriptAction;
struct Position;
class BattleGround;
class Battleground;
class MapInstanced;
class InstanceMap;
@@ -369,9 +369,9 @@ class Map : public GridRefManager<NGridType>
bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
bool IsRaidOrHeroicDungeon() const { return IsRaid() || i_spawnMode > DUNGEON_DIFFICULTY_NORMAL; }
bool IsHeroic() const { return IsRaid() ? i_spawnMode >= RAID_DIFFICULTY_10MAN_HEROIC : i_spawnMode >= DUNGEON_DIFFICULTY_HEROIC; }
bool IsBattleGround() const { return i_mapEntry && i_mapEntry->IsBattleGround(); }
bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
bool IsBattleGroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattleGroundOrArena(); }
bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }
bool GetEntrancePos(int32 &mapid, float &x, float &y)
{
if (!i_mapEntry)
@@ -520,7 +520,7 @@ class Map : public GridRefManager<NGridType>
time_t i_gridExpiry;
//used for fast base_map (e.g. MapInstanced class object) search for
//InstanceMaps and BattleGroundMaps...
//InstanceMaps and BattlegroundMaps...
Map* m_parentMap;
NGridType* i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
@@ -610,11 +610,11 @@ class InstanceMap : public Map
uint32 i_script_id;
};
class BattleGroundMap : public Map
class BattlegroundMap : public Map
{
public:
BattleGroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattleGroundMap();
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattlegroundMap();
bool Add(Player *);
void Remove(Player *, bool);
@@ -624,10 +624,10 @@ class BattleGroundMap : public Map
void RemoveAllPlayers();
virtual void InitVisibilityDistance();
BattleGround* GetBG() { return m_bg; }
void SetBG(BattleGround* bg) { m_bg = bg; }
Battleground* GetBG() { return m_bg; }
void SetBG(Battleground* bg) { m_bg = bg; }
private:
BattleGround* m_bg;
Battleground* m_bg;
};
/*inline
+8 -8
View File
@@ -21,7 +21,7 @@
#include "MapInstanced.h"
#include "ObjectMgr.h"
#include "MapManager.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "VMapFactory.h"
#include "InstanceSaveMgr.h"
#include "World.h"
@@ -116,15 +116,15 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
Map* map = NULL;
uint32 NewInstanceId = 0; // instanceId of the resulting map
if (IsBattleGroundOrArena())
if (IsBattlegroundOrArena())
{
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
NewInstanceId = player->GetBattleGroundId();
NewInstanceId = player->GetBattlegroundId();
if (!NewInstanceId) return NULL;
map = _FindMap(NewInstanceId);
if (!map)
map = CreateBattleGround(NewInstanceId, player->GetBattleGround());
map = CreateBattleground(NewInstanceId, player->GetBattleground());
}
else
{
@@ -202,19 +202,19 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
return map;
}
BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId, BattleGround* bg)
BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg)
{
// load/create a map
ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL);
sLog.outDebug("MapInstanced::CreateBattleGround: map bg %d for %d created.", InstanceId, GetId());
sLog.outDebug("MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId());
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(),bg->GetMinLevel());
uint8 spawnMode = bracketEntry ? bracketEntry->difficulty : REGULAR_DIFFICULTY;
BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode);
ASSERT(map->IsBattleGroundOrArena());
BattlegroundMap *map = new BattlegroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode);
ASSERT(map->IsBattlegroundOrArena());
map->SetBG(bg);
bg->SetBgMap(map);
+1 -1
View File
@@ -64,7 +64,7 @@ class MapInstanced : public Map
private:
InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty);
BattleGroundMap* CreateBattleGround(uint32 InstanceId, BattleGround* bg);
BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg);
InstancedMaps m_InstancedMaps;
@@ -2715,7 +2715,7 @@ enum BanReturn
};
// indexes of BattlemasterList.dbc
enum BattleGroundTypeId
enum BattlegroundTypeId
{
BATTLEGROUND_TYPE_NONE = 0,
BATTLEGROUND_AV = 1,
+15 -15
View File
@@ -479,8 +479,8 @@ void ScriptMgr::OnCreateMap(Map* map)
itr->second->OnCreate((InstanceMap*)map);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnCreate((BattleGroundMap*)map);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnCreate((BattlegroundMap*)map);
SCR_MAP_END;
}
@@ -496,8 +496,8 @@ void ScriptMgr::OnDestroyMap(Map* map)
itr->second->OnDestroy((InstanceMap*)map);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnDestroy((BattleGroundMap*)map);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnDestroy((BattlegroundMap*)map);
SCR_MAP_END;
}
@@ -514,8 +514,8 @@ void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
itr->second->OnLoadGridMap((InstanceMap*)map, gmap, gx, gy);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnLoadGridMap((BattleGroundMap*)map, gmap, gx, gy);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnLoadGridMap((BattlegroundMap*)map, gmap, gx, gy);
SCR_MAP_END;
}
@@ -532,8 +532,8 @@ void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
itr->second->OnUnloadGridMap((InstanceMap*)map, gmap, gx, gy);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnUnloadGridMap((BattleGroundMap*)map, gmap, gx, gy);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnUnloadGridMap((BattlegroundMap*)map, gmap, gx, gy);
SCR_MAP_END;
}
@@ -550,8 +550,8 @@ void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
itr->second->OnPlayerEnter((InstanceMap*)map, player);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnPlayerEnter((BattleGroundMap*)map, player);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnPlayerEnter((BattlegroundMap*)map, player);
SCR_MAP_END;
}
@@ -568,8 +568,8 @@ void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player)
itr->second->OnPlayerLeave((InstanceMap*)map, player);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnPlayerLeave((BattleGroundMap*)map, player);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnPlayerLeave((BattlegroundMap*)map, player);
SCR_MAP_END;
}
@@ -585,8 +585,8 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
itr->second->OnUpdate((InstanceMap*)map, diff);
SCR_MAP_END;
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleGround);
itr->second->OnUpdate((BattleGroundMap*)map, diff);
SCR_MAP_BGN(BattlegroundMapScript, map, itr, end, entry, IsBattleground);
itr->second->OnUpdate((BattlegroundMap*)map, diff);
SCR_MAP_END;
}
@@ -849,7 +849,7 @@ bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
return tmpscript->OnTrigger(player, trigger);
}
BattleGround* ScriptMgr::CreateBattleground(BattleGroundTypeId typeId)
Battleground* ScriptMgr::CreateBattleground(BattlegroundTypeId typeId)
{
// TODO: Implement script-side battlegrounds.
ASSERT(false);
+7 -7
View File
@@ -26,7 +26,7 @@
#include "DBCStructure.h"
#include "Config.h"
#include "ObjectMgr.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "OutdoorPvPMgr.h"
#include "SharedDefines.h"
#include "Chat.h"
@@ -425,14 +425,14 @@ class InstanceMapScript : public ScriptObject, public MapScript<InstanceMap>
virtual InstanceData* GetInstanceData(InstanceMap* map) const { return NULL; }
};
class BattlegroundMapScript : public ScriptObject, public MapScript<BattleGroundMap>
class BattlegroundMapScript : public ScriptObject, public MapScript<BattlegroundMap>
{
protected:
BattlegroundMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<BattleGroundMap>(mapId)
: ScriptObject(name), MapScript<BattlegroundMap>(mapId)
{
if (GetEntry() && !GetEntry()->IsBattleGround())
if (GetEntry() && !GetEntry()->IsBattleground())
sLog.outError("BattlegroundMapScript for map %u is invalid.", mapId);
}
@@ -582,8 +582,8 @@ class BattlegroundScript : public ScriptObject
bool IsDatabaseBound() const { return true; }
// Should return a fully valid BattleGround object for the type ID.
virtual BattleGround* GetBattleground() const = 0;
// Should return a fully valid Battleground object for the type ID.
virtual Battleground* GetBattleground() const = 0;
};
class OutdoorPvPScript : public ScriptObject
@@ -893,7 +893,7 @@ class ScriptMgr
public: /* BattlegroundScript */
BattleGround* CreateBattleground(BattleGroundTypeId typeId);
Battleground* CreateBattleground(BattlegroundTypeId typeId);
public: /* OutdoorPvPScript */
@@ -25,9 +25,9 @@
#include "WorldSession.h"
#include "ArenaTeam.h"
#include "BattleGroundMgr.h"
#include "BattleGroundWS.h"
#include "BattleGround.h"
#include "BattlegroundMgr.h"
#include "BattlegroundWS.h"
#include "Battleground.h"
#include "Chat.h"
#include "Language.h"
#include "Log.h"
@@ -52,7 +52,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
// Stop the npc if moving
unit->StopMoving();
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
BattlegroundTypeId bgTypeId = sBattlegroundMgr.GetBattleMasterBG(unit->GetEntry());
if (!_player->GetBGAccessByLevel(bgTypeId))
{
@@ -64,10 +64,10 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
SendBattlegGroundList(guid, bgTypeId);
}
void WorldSession::SendBattlegGroundList(uint64 guid, BattleGroundTypeId bgTypeId)
void WorldSession::SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
{
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId, 0);
sBattlegroundMgr.BuildBattlegroundListPacket(&data, guid, _player, bgTypeId, 0);
SendPacket(&data);
}
@@ -97,25 +97,25 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
return;
}
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
sLog.outDebug("WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
// can do this, since it's battleground, not arena
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
BattleGroundQueueTypeId bgQueueTypeIdRandom = BattleGroundMgr::BGQueueTypeId(BATTLEGROUND_RB, 0);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0);
BattlegroundQueueTypeId bgQueueTypeIdRandom = BattlegroundMgr::BGQueueTypeId(BATTLEGROUND_RB, 0);
// ignore if player is already in BG
if (_player->InBattleGround())
if (_player->InBattleground())
return;
// get bg instance or bg template if instance not found
BattleGround *bg = NULL;
Battleground *bg = NULL;
if (instanceId)
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
bg = sBattlegroundMgr.GetBattlegroundThroughClientInstance(instanceId, bgTypeId);
if (!bg)
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
bg = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg)
return;
@@ -133,53 +133,53 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (!_player->CanJoinToBattleground())
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data);
return;
}
if (_player->GetBattleGroundQueueIndex(bgQueueTypeIdRandom) < PLAYER_MAX_BATTLEGROUND_QUEUES)
if (_player->GetBattlegroundQueueIndex(bgQueueTypeIdRandom) < PLAYER_MAX_BATTLEGROUND_QUEUES)
{
//player is already in random queue
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_RANDOM_BG);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
return;
}
if (_player->InBattleGroundQueue() && bgTypeId == BATTLEGROUND_RB)
if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB)
{
//player is already in queue, can't start random queue
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_NON_RANDOM_BG);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_NON_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
return;
}
// check if already in queue
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
if (_player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
//player is already in this queue
return;
// check if has free queue slots
if (!_player->HasFreeBattleGroundQueueId())
if (!_player->HasFreeBattlegroundQueueId())
{
WorldPacket data;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_TOO_MANY_QUEUES);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, ERR_BATTLEGROUND_TOO_MANY_QUEUES);
_player->GetSession()->SendPacket(&data);
return;
}
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
BattlegroundQueue& bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
// already checked if queueSlot is valid, now just get it
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId);
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
}
@@ -191,10 +191,10 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
return;
if (grp->GetLeaderGUID() != _player->GetGUID())
return;
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
BattlegroundQueue& bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
GroupQueueInfo * ginfo = NULL;
uint32 avgTime = 0;
@@ -214,33 +214,33 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (err <= 0)
{
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
continue;
}
// add to queue
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
uint32 queueSlot = member->AddBattlegroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
member->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
}
sLog.outDebug("Battleground: group end");
}
sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
sBattlegroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
{
// empty opcode
sLog.outDebug("WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
BattleGround *bg = _player->GetBattleGround();
Battleground *bg = _player->GetBattleground();
if (!bg) // can't be received if player not in battleground
return;
@@ -251,11 +251,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
uint32 count1 = 0; //always constant zero?
uint32 count2 = 0; //count of next fields
Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
Player *ali_plr = objmgr.GetPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID());
if (ali_plr)
++count2;
Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
Player *horde_plr = objmgr.GetPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID());
if (horde_plr)
++count2;
@@ -307,12 +307,12 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
{
sLog.outDebug("WORLD: Recvd MSG_PVP_LOG_DATA Message");
BattleGround *bg = _player->GetBattleGround();
Battleground *bg = _player->GetBattleground();
if (!bg)
return;
WorldPacket data;
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
sBattlegroundMgr.BuildPvpLogDataPacket(&data, bg);
SendPacket(&data);
sLog.outDebug("WORLD: Sent MSG_PVP_LOG_DATA Message");
@@ -339,7 +339,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data)
}
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundListPacket(&data, 0, _player, BattleGroundTypeId(bgTypeId), fromWhere);
sBattlegroundMgr.BuildBattlegroundListPacket(&data, 0, _player, BattlegroundTypeId(bgTypeId), fromWhere);
SendPacket(&data);
}
@@ -360,17 +360,17 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", bgTypeId_);
return;
}
if (!_player->InBattleGroundQueue())
if (!_player->InBattlegroundQueue())
{
sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), he is not in bg_queue.", _player->GetGUIDLow());
return;
}
//get GroupQueueInfo from BattleGroundQueue
BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_);
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function
//get GroupQueueInfo from BattlegroundQueue
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, type);
BattlegroundQueue& bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattlegroundQueue::RemovePlayer() function
GroupQueueInfo ginfo;
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
{
@@ -384,11 +384,11 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
return;
}
BattleGround *bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
Battleground *bg = sBattlegroundMgr.GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
// bg template might and must be used in case of leaving queue, when instance is not created yet
if (!bg && action == 0)
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
bg = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg)
{
sLog.outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);
@@ -408,7 +408,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
{
//send bg command result to show nice message
WorldPacket data2;
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data2);
action = 0;
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
@@ -421,16 +421,16 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
action = 0;
}
}
uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId);
uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId);
WorldPacket data;
switch(action)
{
case 1: // port to battleground
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
if (!_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
return; // cheating?
if (!_player->InBattleGround())
_player->SetBattleGroundEntryPoint();
if (!_player->InBattleground())
_player->SetBattlegroundEntryPoint();
// resurrect the player
if (!_player->isAlive())
@@ -445,21 +445,21 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
_player->CleanupAfterTaxiFlight();
}
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
_player->GetSession()->SendPacket(&data);
// remove battleground queue status from BGmgr
bgQueue.RemovePlayer(_player->GetGUID(), false);
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
if (BattleGround *currentBg = _player->GetBattleGround())
// also this is required to prevent stuck at old battleground after SetBattlegroundId set to new
if (Battleground *currentBg = _player->GetBattleground())
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
// set the destination instance id
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
_player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId);
// set the destination team
_player->SetBGTeam(ginfo.Team);
// bg->HandleBeforeTeleportToBattleGround(_player);
sBattleGroundMgr.SendToBattleGround(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
// bg->HandleBeforeTeleportToBattleground(_player);
sBattlegroundMgr.SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
// add only in HandleMoveWorldPortAck()
// bg->AddPlayer(_player,team);
sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId);
@@ -476,12 +476,12 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
at->SaveToDB();
}
}
_player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
_player->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
bgQueue.RemovePlayer(_player->GetGUID(), true);
// player left queue, we should update it - do not update Arena Queue
if (!ginfo.ArenaType)
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
sBattlegroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
SendPacket(&data);
sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
break;
@@ -497,12 +497,12 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
recv_data.read_skip<uint8>(); // unk1
recv_data.read_skip<uint8>(); // unk2
recv_data.read_skip<uint32>(); // BattleGroundTypeId
recv_data.read_skip<uint32>(); // BattlegroundTypeId
recv_data.read_skip<uint16>(); // unk3
// not allow leave battleground in combat
if (_player->isInCombat())
if (BattleGround* bg = _player->GetBattleGround())
if (Battleground* bg = _player->GetBattleground())
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
return;
@@ -516,47 +516,47 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
WorldPacket data;
// we must update all queues here
BattleGround *bg = NULL;
Battleground *bg = NULL;
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i);
if (!bgQueueTypeId)
continue;
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
if (bgTypeId == _player->GetBattleGroundTypeId())
BattlegroundTypeId bgTypeId = BattlegroundMgr::BGTemplateId(bgQueueTypeId);
uint8 arenaType = BattlegroundMgr::BGArenaType(bgQueueTypeId);
if (bgTypeId == _player->GetBattlegroundTypeId())
{
bg = _player->GetBattleGround();
bg = _player->GetBattleground();
//i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
//so i must use bg pointer to get that information
if (bg && bg->GetArenaType() == arenaType)
{
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
// send status in BattleGround
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), arenaType);
// send status in Battleground
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, i, STATUS_IN_PROGRESS, bg->GetEndTime(), bg->GetStartTime(), arenaType);
SendPacket(&data);
continue;
}
}
//we are sending update to player about queue - he can be invited there!
//get GroupQueueInfo for queue status
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
BattlegroundQueue& bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
GroupQueueInfo ginfo;
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
continue;
if (ginfo.IsInvitedToBGInstanceGUID)
{
bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
bg = sBattlegroundMgr.GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
if (!bg)
continue;
uint32 remainingTime = getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime);
// send status invited to BattleGround
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
// send status invited to Battleground
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
SendPacket(&data);
}
else
{
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
bg = sBattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg)
continue;
@@ -566,8 +566,8 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
continue;
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, bracketEntry->GetBracketId());
// send status in BattleGround Queue
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType);
// send status in Battleground Queue
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType);
SendPacket(&data);
}
}
@@ -577,7 +577,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
{
sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
BattleGround *bg = _player->GetBattleGround();
Battleground *bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
@@ -590,7 +590,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
return;
if (bg)
sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
sBattlegroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
}
@@ -598,7 +598,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
{
sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
BattleGround *bg = _player->GetBattleGround();
Battleground *bg = _player->GetBattleground();
uint64 guid;
recv_data >> guid;
@@ -629,7 +629,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
recv_data >> guid >> arenaslot >> asGroup >> isRated;
// ignore if we already in BG or BG queue
if (_player->InBattleGround())
if (_player->InBattleground())
return;
Creature *unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -659,7 +659,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
}
//check existance
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA);
Battleground* bg = sBattlegroundMgr.GetBattlegroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
sLog.outError("Battleground: template bg (all arenas) not found");
@@ -672,8 +672,8 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
return;
}
BattleGroundTypeId bgTypeId = bg->GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
BattlegroundTypeId bgTypeId = bg->GetTypeID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenatype);
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(),_player->getLevel());
if (!bracketEntry)
return;
@@ -683,11 +683,11 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
if (!asGroup)
{
// check if already in queue
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
if (_player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
//player is already in this queue
return;
// check if has free queue slots
if (!_player->HasFreeBattleGroundQueueId())
if (!_player->HasFreeBattlegroundQueueId())
return;
}
else
@@ -698,7 +698,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
return;
if (grp->GetLeaderGUID() != _player->GetGUID())
return;
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
}
uint32 ateamId = 0;
@@ -737,7 +737,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
arenaRating = 1;
}
BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
BattlegroundQueue &bgQueue = sBattlegroundMgr.m_BattlegroundQueues[bgQueueTypeId];
if (asGroup)
{
uint32 avgTime = 0;
@@ -767,18 +767,18 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
if (err <= 0)
{
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
continue;
}
// add to queue
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);
uint32 queueSlot = member->AddBattlegroundQueueId(bgQueueTypeId);
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
member->GetSession()->SendPacket(&data);
sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
sBattlegroundMgr.BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
}
@@ -787,15 +787,15 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
{
GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, ateamId);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId);
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
sBattlegroundMgr.BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
SendPacket(&data);
sLog.outDebug("Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
}
sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
sBattlegroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data)
@@ -369,7 +369,7 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recv_data*/)
if (!GetPlayer()->GetGroup())
return;
if (_player->InBattleGround())
if (_player->InBattleground())
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED);
return;
@@ -522,7 +522,7 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recv_data*/)
if (!group)
return;
if (_player->InBattleGround())
if (_player->InBattleground())
return;
/** error handling **/
@@ -38,7 +38,7 @@
#include "zlib.h"
#include "ObjectAccessor.h"
#include "Object.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "OutdoorPvP.h"
#include "Pet.h"
#include "SocialMgr.h"
@@ -761,7 +761,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
return;
// resurrect
GetPlayer()->ResurrectPlayer(GetPlayer()->InBattleGround() ? 1.0f : 0.5f);
GetPlayer()->ResurrectPlayer(GetPlayer()->InBattleground() ? 1.0f : 0.5f);
// spawn bones
GetPlayer()->SpawnCorpseBones();
@@ -911,9 +911,9 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
return;
}
if (GetPlayer()->InBattleGround())
if (GetPlayer()->InBattleground())
{
BattleGround* bg = GetPlayer()->GetBattleGround();
Battleground* bg = GetPlayer()->GetBattleground();
if (bg)
if (bg->GetStatus() == STATUS_IN_PROGRESS)
bg->HandleAreaTrigger(GetPlayer(), Trigger_ID);
@@ -29,7 +29,7 @@
#include "SpellAuras.h"
#include "MapManager.h"
#include "Transport.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "WaypointMovementGenerator.h"
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
@@ -102,20 +102,20 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// battleground state prepare (in case join to BG), at relogin/tele player not invited
// only add to bg group and object, if the player was invited (else he entered through command)
if (_player->InBattleGround())
if (_player->InBattleground())
{
// cleanup setting if outdated
if (!mEntry->IsBattleGroundOrArena())
if (!mEntry->IsBattlegroundOrArena())
{
// We're not in BG
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE);
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE);
// reset destination bg team
_player->SetBGTeam(0);
}
// join to bg case
else if (BattleGround *bg = _player->GetBattleGround())
else if (Battleground *bg = _player->GetBattleground())
{
if (_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
if (_player->IsInvitedForBattlegroundInstance(_player->GetBattlegroundId()))
bg->AddPlayer(_player);
}
}
@@ -125,7 +125,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// flight fast teleport case
if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if (!_player->InBattleGround())
if (!_player->InBattleground())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
@@ -149,7 +149,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
}
}
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattleGroundOrArena();
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena();
if (mInstance)
{
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
@@ -371,9 +371,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
if (movementInfo.pos.GetPositionZ() < -500.0f)
{
if (plMover->InBattleGround()
&& plMover->GetBattleGround()
&& plMover->GetBattleGround()->HandlePlayerUnderMap(_player))
if (plMover->InBattleground()
&& plMover->GetBattleground()
&& plMover->GetBattleground()->HandlePlayerUnderMap(_player))
{
// do nothing, the handle already did if returned true
}
@@ -33,8 +33,8 @@
#include "ObjectAccessor.h"
#include "Creature.h"
#include "Pet.h"
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "Guild.h"
#include "ScriptMgr.h"
@@ -331,11 +331,11 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
// If spiritguide, no need for gossip menu, just put player into resurrect queue
if (unit->isSpiritGuide())
{
BattleGround *bg = _player->GetBattleGround();
Battleground *bg = _player->GetBattleground();
if (bg)
{
bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID());
sBattleGroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
sBattlegroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, unit->GetGUID());
return;
}
}
@@ -30,8 +30,8 @@
#include "QuestDef.h"
#include "ObjectAccessor.h"
#include "Group.h"
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "Battleground.h"
#include "BattlegroundAV.h"
#include "ScriptMgr.h"
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
@@ -455,10 +455,10 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
if (pQuest)
{
// TODO: need a virtual function
if (GetPlayer()->InBattleGround())
if (BattleGround* bg = GetPlayer()->GetBattleGround())
if (GetPlayer()->InBattleground())
if (Battleground* bg = GetPlayer()->GetBattleground())
if (bg->GetTypeID() == BATTLEGROUND_AV)
((BattleGroundAV*)bg)->HandleQuestComplete(quest, GetPlayer());
((BattlegroundAV*)bg)->HandleQuestComplete(quest, GetPlayer());
if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE)
{
+1 -1
View File
@@ -773,7 +773,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x2E6*/ { "SMSG_WARDEN_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2E7*/ { "CMSG_WARDEN_DATA", STATUS_LOGGEDIN, &WorldSession::HandleWardenDataOpcode },
/*0x2E8*/ { "SMSG_GROUP_JOINED_BATTLEGROUND", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2E9*/ { "MSG_BATTLEGROUND_PLAYER_POSITIONS", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundPlayerPositionsOpcode},
/*0x2E9*/ { "MSG_BATTLEGROUND_PLAYER_POSITIONS", STATUS_LOGGEDIN, &WorldSession::HandleBattlegroundPlayerPositionsOpcode},
/*0x2EA*/ { "CMSG_PET_STOP_ATTACK", STATUS_NEVER, &WorldSession::Handle_NULL },
/*0x2EB*/ { "SMSG_BINDER_CONFIRM", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2EC*/ { "SMSG_BATTLEGROUND_PLAYER_JOINED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
+6 -6
View File
@@ -36,7 +36,7 @@
#include "Guild.h"
#include "World.h"
#include "ObjectAccessor.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvPMgr.h"
#include "MapManager.h"
#include "SocialMgr.h"
@@ -370,7 +370,7 @@ void WorldSession::LogoutPlayer(bool Save)
// give bg rewards and update counters like kill by first from attackers
// this can't be called for all attackers.
if (!aset.empty())
if (BattleGround *bg = _player->GetBattleGround())
if (Battleground *bg = _player->GetBattleground())
bg->HandleKillPlayer(_player,*aset.begin());
}
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
@@ -383,7 +383,7 @@ void WorldSession::LogoutPlayer(bool Save)
_player->RepopAtGraveyard();
}
//drop a flag if player is carrying it
if (BattleGround *bg = _player->GetBattleGround())
if (Battleground *bg = _player->GetBattleground())
bg->EventPlayerLoggedOut(_player);
///- Teleport to home if the player is in an invalid instance
@@ -394,10 +394,10 @@ void WorldSession::LogoutPlayer(bool Save)
for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
{
if (BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i))
if (BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i))
{
_player->RemoveBattleGroundQueueId(bgQueueTypeId);
sBattleGroundMgr.m_BattleGroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
sBattlegroundMgr.m_BattlegroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
}
}
+3 -3
View File
@@ -203,7 +203,7 @@ class WorldSession
void SendAttackStop(Unit const* enemy);
void SendBattlegGroundList(uint64 guid, BattleGroundTypeId bgTypeId);
void SendBattlegGroundList(uint64 guid, BattlegroundTypeId bgTypeId);
void SendTradeStatus(TradeStatus status);
void SendUpdateTrade(bool trader_data = true);
@@ -669,10 +669,10 @@ class WorldSession
void HandleTotemDestroyed(WorldPacket& recv_data);
void HandleDismissCritter(WorldPacket& recv_data);
//BattleGround
//Battleground
void HandleBattlemasterHelloOpcode(WorldPacket &recv_data);
void HandleBattlemasterJoinOpcode(WorldPacket &recv_data);
void HandleBattleGroundPlayerPositionsOpcode(WorldPacket& recv_data);
void HandleBattlegroundPlayerPositionsOpcode(WorldPacket& recv_data);
void HandlePVPLogDataOpcode(WorldPacket &recv_data);
void HandleBattleFieldPortOpcode(WorldPacket &recv_data);
void HandleBattlefieldListOpcode(WorldPacket &recv_data);
@@ -30,7 +30,7 @@
#include "Util.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "OutdoorPvPMgr.h"
#include "Formulas.h"
#include "GridNotifiers.h"
@@ -1538,7 +1538,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
// add HoTs to amount healed in bgs
if (caster->GetTypeId() == TYPEID_PLAYER)
if (BattleGround *bg = caster->ToPlayer()->GetBattleGround())
if (Battleground *bg = caster->ToPlayer()->GetBattleground())
bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain);
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
@@ -2781,8 +2781,8 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
if (target->GetTypeId() == TYPEID_PLAYER)
{
// drop flag at invisible in bg
if (target->ToPlayer()->InBattleGround())
if (BattleGround *bg = target->ToPlayer()->GetBattleGround())
if (target->ToPlayer()->InBattleground())
if (Battleground *bg = target->ToPlayer()->GetBattleground())
bg->EventPlayerDroppedFlag(target->ToPlayer());
// GM-mode have mask 0xFFFFFFFF
@@ -4232,9 +4232,9 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uin
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
if (target->ToPlayer()->InBattleGround())
if (target->ToPlayer()->InBattleground())
{
if (BattleGround *bg = target->ToPlayer()->GetBattleGround())
if (Battleground *bg = target->ToPlayer()->GetBattleground())
bg->EventPlayerDroppedFlag(target->ToPlayer());
}
else
@@ -5687,7 +5687,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
if (BattleGround *bg = target->ToPlayer()->GetBattleGround())
if (Battleground *bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
break;
case 36730: // Flame Strike
+7 -7
View File
@@ -44,7 +44,7 @@
#include "SharedDefines.h"
#include "LootMgr.h"
#include "VMapFactory.h"
#include "BattleGround.h"
#include "Battleground.h"
#include "Util.h"
#include "TemporarySummon.h"
#include "Vehicle.h"
@@ -4614,7 +4614,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// only allow triggered spells if at an ended battleground
if (!m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
if (BattleGround * bg = m_caster->ToPlayer()->GetBattleGround())
if (Battleground * bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
return SPELL_FAILED_DONT_REPORT;
@@ -4876,7 +4876,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Spell casted only on battleground
if ((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER)
if (!m_caster->ToPlayer()->InBattleGround())
if (!m_caster->ToPlayer()->InBattleground())
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
// do not allow spells to be cast in arenas
@@ -5275,8 +5275,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_spellInfo->Id != 1842 || m_targets.getGOTarget() &&
m_targets.getGOTarget()->GetGOInfo()->type != GAMEOBJECT_TYPE_TRAP)
if (m_caster->ToPlayer()->InBattleGround() && // In BattleGround players can use only flags and banners
!m_caster->ToPlayer()->CanUseBattleGroundObject())
if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners
!m_caster->ToPlayer()->CanUseBattlegroundObject())
return SPELL_FAILED_TRY_AGAIN;
// get the lock entry
@@ -5398,7 +5398,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
//Do not allow to cast it before BG starts.
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (BattleGround const *bg = m_caster->ToPlayer()->GetBattleGround())
if (Battleground const *bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN;
break;
@@ -5547,7 +5547,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
bool AllowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattleGroundOrArena();
bool AllowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattlegroundOrArena();
InstanceTemplate const *it = objmgr.GetInstanceTemplate(m_caster->GetMapId());
if (it)
AllowMount = it->allowMount;
+14 -14
View File
@@ -45,10 +45,10 @@
#include "Creature.h"
#include "Totem.h"
#include "CreatureAI.h"
#include "BattleGroundMgr.h"
#include "BattleGround.h"
#include "BattleGroundEY.h"
#include "BattleGroundWS.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "BattlegroundEY.h"
#include "BattlegroundWS.h"
#include "OutdoorPvPMgr.h"
#include "Language.h"
#include "SocialMgr.h"
@@ -1370,7 +1370,7 @@ void Spell::EffectDummy(uint32 i)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
if (BattleGround* bg = m_caster->ToPlayer()->GetBattleGround())
if (Battleground* bg = m_caster->ToPlayer()->GetBattleground())
bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
m_caster->CastSpell(m_caster, 30452, true, NULL);
@@ -2879,7 +2879,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
// for battleground marks send by mail if not add all expected
if (no_space > 0 && bgType)
{
if (BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(BattleGroundTypeId(bgType)))
if (Battleground* bg = sBattlegroundMgr.GetBattlegroundTemplate(BattlegroundTypeId(bgType)))
bg->SendRewardMarkByMail(player, newitemid, no_space);
}
*/
@@ -3165,9 +3165,9 @@ void Spell::EffectOpenLock(uint32 effIndex)
if (goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune ||
goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)
{
//CanUseBattleGroundObject() already called in CheckCast()
//CanUseBattlegroundObject() already called in CheckCast()
// in battleground check
if (BattleGround *bg = player->GetBattleGround())
if (Battleground *bg = player->GetBattleground())
{
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
return;
@@ -3175,9 +3175,9 @@ void Spell::EffectOpenLock(uint32 effIndex)
}
else if (goInfo->type == GAMEOBJECT_TYPE_FLAGSTAND)
{
//CanUseBattleGroundObject() already called in CheckCast()
//CanUseBattlegroundObject() already called in CheckCast()
// in battleground check
if (BattleGround *bg = player->GetBattleGround())
if (Battleground *bg = player->GetBattleground())
{
if (bg->GetTypeID(true) == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
@@ -4657,7 +4657,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *pl = m_caster->ToPlayer();
BattleGround* bg = pl->GetBattleGround();
Battleground* bg = pl->GetBattleground();
switch(pGameObj->GetMapId())
{
@@ -4670,7 +4670,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
if (pl->GetTeam() == team)
team = HORDE;
((BattleGroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(),team);
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(),team);
}
break;
}
@@ -4678,7 +4678,7 @@ void Spell::EffectSummonObjectWild(uint32 i)
{
if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
{
((BattleGroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
((BattlegroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
}
break;
}
@@ -7123,7 +7123,7 @@ void Spell::EffectSkill(uint32 /*i*/)
sLog.outDebug("WORLD: SkillEFFECT");
}
/* There is currently no need for this effect. We handle it in BattleGround.cpp
/* There is currently no need for this effect. We handle it in Battleground.cpp
If we would handle the resurrection here, the spiritguide would instantly disappear as the
player revives, and so we wouldn't see the spirit heal visual effect on the npc.
This is why we use a half sec delay between the visual effect and the resurrection itself */
+8 -8
View File
@@ -26,7 +26,7 @@
#include "World.h"
#include "Chat.h"
#include "Spell.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "CreatureAI.h"
#include "MapManager.h"
@@ -2699,9 +2699,9 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
{
case 23333: // Warsong Flag
case 23335: // Silverwing Flag
return map_id == 489 && player && player->InBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
case 34976: // Netherstorm Flag
return map_id == 566 && player && player->InBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
case 2584: // Waiting to Resurrect
case 22011: // Spirit Heal Channel
case 22012: // Spirit Heal
@@ -2714,7 +2714,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
if (!mapEntry)
return SPELL_FAILED_INCORRECT_AREA;
return zone_id == 4197 || (mapEntry->IsBattleGround() && player && player->InBattleGround()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
return zone_id == 4197 || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
}
case 44521: // Preparation
{
@@ -2725,10 +2725,10 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
if (!mapEntry)
return SPELL_FAILED_INCORRECT_AREA;
if (!mapEntry->IsBattleGround())
if (!mapEntry->IsBattleground())
return SPELL_FAILED_REQUIRES_AREA;
BattleGround* bg = player->GetBattleGround();
Battleground* bg = player->GetBattleground();
return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
}
case 32724: // Gold Team (Alliance)
@@ -2740,7 +2740,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
if (!mapEntry)
return SPELL_FAILED_INCORRECT_AREA;
return mapEntry->IsBattleArena() && player && player->InBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
}
case 32727: // Arena Preparation
{
@@ -2754,7 +2754,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
if (!mapEntry->IsBattleArena())
return SPELL_FAILED_REQUIRES_AREA;
BattleGround *bg = player->GetBattleGround();
Battleground *bg = player->GetBattleground();
return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
}
}
+12 -12
View File
@@ -48,7 +48,7 @@
#include "ItemEnchantmentMgr.h"
#include "MapManager.h"
#include "CreatureAIRegistry.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvPMgr.h"
#include "TemporarySummon.h"
#include "WaypointMovementGenerator.h"
@@ -1042,10 +1042,10 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] = MAX_LEVEL;
m_configs[CONFIG_QUEST_IGNORE_RAID] = sConfig.GetBoolDefault("Quests.IgnoreRaid", false);
m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfig.GetIntDefault("BattleGround.Random.ResetHour", 6);
m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfig.GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_configs[CONFIG_RANDOM_BG_RESET_HOUR] < 0 || m_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{
sLog.outError("BattleGround.Random.ResetHour (%i) can't be load. Set to 6.", m_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
sLog.outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
}
@@ -1087,8 +1087,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfig.GetBoolDefault("Battleground.QueueAnnouncer.Enable", false);
m_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfig.GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false);
m_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfig.GetIntDefault ("Battleground.InvitationType", 0);
m_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfig.GetIntDefault ("BattleGround.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
m_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfig.GetIntDefault ("BattleGround.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS);
m_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfig.GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
m_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfig.GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS);
m_configs[CONFIG_BG_XP_FOR_KILL] = sConfig.GetBoolDefault("Battleground.GiveXPForKills", false);
m_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfig.GetIntDefault ("Arena.MaxRatingDifference", 150);
m_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfig.GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
@@ -1264,7 +1264,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_CHATLOG_GUILD] = sConfig.GetBoolDefault("ChatLogs.Guild", false);
m_configs[CONFIG_CHATLOG_PUBLIC] = sConfig.GetBoolDefault("ChatLogs.Public", false);
m_configs[CONFIG_CHATLOG_ADDON] = sConfig.GetBoolDefault("ChatLogs.Addon", false);
m_configs[CONFIG_CHATLOG_BGROUND] = sConfig.GetBoolDefault("ChatLogs.BattleGround", false);
m_configs[CONFIG_CHATLOG_BGROUND] = sConfig.GetBoolDefault("ChatLogs.Battleground", false);
sScriptMgr.OnConfigLoad(reload);
}
@@ -1579,7 +1579,7 @@ void World::SetInitialWorldSettings()
objmgr.LoadGameObjectForQuests();
sLog.outString("Loading BattleMasters...");
sBattleGroundMgr.LoadBattleMastersEntry();
sBattlegroundMgr.LoadBattleMastersEntry();
sLog.outString("Loading GameTeleports...");
objmgr.LoadGameTele();
@@ -1721,9 +1721,9 @@ void World::SetInitialWorldSettings()
sLFGMgr.InitLFG();
///- Initialize Battlegrounds
sLog.outString("Starting BattleGround System");
sBattleGroundMgr.CreateInitialBattleGrounds();
sBattleGroundMgr.InitAutomaticArenaPointDistribution();
sLog.outString("Starting Battleground System");
sBattlegroundMgr.CreateInitialBattlegrounds();
sBattlegroundMgr.InitAutomaticArenaPointDistribution();
///- Initialize outdoor pvp
sLog.outString("Starting Outdoor PvP System");
@@ -1996,8 +1996,8 @@ void World::Update(uint32 diff)
}
}
sBattleGroundMgr.Update(diff);
RecordTimeDiff("UpdateBattleGroundMgr");
sBattlegroundMgr.Update(diff);
RecordTimeDiff("UpdateBattlegroundMgr");
sOutdoorPvPMgr.Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
+2 -2
View File
@@ -64,8 +64,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse/AuctionHouseBot
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds
${CMAKE_SOURCE_DIR}/src/server/game/BattleGrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
@@ -28,7 +28,7 @@
#include "WorldSocketMgr.h"
#include "Database/DatabaseEnv.h"
#include "ScriptMgr.h"
#include "BattleGroundMgr.h"
#include "BattlegroundMgr.h"
#include "MapManager.h"
#include "Timer.h"
#include "WorldRunnable.h"
@@ -93,7 +93,7 @@ void WorldRunnable::run()
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call
// unload battleground templates before different singletons destroyed
sBattleGroundMgr.DeleteAllBattleGrounds();
sBattlegroundMgr.DeleteAllBattlegrounds();
sWorldSocketMgr->StopNetwork();