[svn] -enabled instantiated battlegrounds
-enabled arena matches -rewritten battleground queuing to support joining as group -removed queue announcements --HG-- branch : trunk
This commit is contained in:
+106
-34
@@ -34,51 +34,98 @@ typedef std::deque<BattleGround*> BGFreeSlotQueueType;
|
||||
|
||||
#define MAX_BATTLEGROUND_TYPES 9 // each BG type will be in array
|
||||
|
||||
struct PlayerQueueInfo
|
||||
#define MAX_BATTLEGROUND_QUEUE_TYPES 8
|
||||
|
||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
|
||||
|
||||
struct GroupQueueInfo; // type predefinition
|
||||
struct PlayerQueueInfo // stores information for players in queue
|
||||
{
|
||||
uint32 InviteTime; // first invite time
|
||||
uint32 LastInviteTime; // last invite time
|
||||
uint32 IsInvitedToBGInstanceGUID; // was invited to certain BG
|
||||
uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes
|
||||
GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo
|
||||
};
|
||||
|
||||
struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!)
|
||||
{
|
||||
std::map<uint64, PlayerQueueInfo*> Players; // player queue info map
|
||||
uint32 Team; // Player team (ALLIANCE/HORDE)
|
||||
bool IsRated;
|
||||
bool AsGroup; // uint32 GroupId;
|
||||
uint8 ArenaType;
|
||||
};
|
||||
|
||||
struct PlayersCount
|
||||
{
|
||||
uint32 Alliance;
|
||||
uint32 Horde;
|
||||
};
|
||||
|
||||
template<class _Kty, class _Ty> class bgqueue: public std::map<_Kty, _Ty>
|
||||
{
|
||||
public:
|
||||
uint32 Alliance;
|
||||
uint32 Horde;
|
||||
//bool Ready; // not used now
|
||||
//uint32 AverageTime; //not already implemented (it should be average time in queue for last 10 players)
|
||||
bool IsRated; // rated
|
||||
uint32 BgTypeId; // battleground type id
|
||||
uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG
|
||||
uint32 ArenaTeamId; // team id if rated match
|
||||
uint32 JoinTime; // time when group was added
|
||||
uint32 IsInvitedToBGInstanceGUID; // was invited to certain BG
|
||||
uint32 ArenaTeamRating; // if rated match, inited to the rating of the team
|
||||
};
|
||||
|
||||
class BattleGround;
|
||||
class BattleGroundQueue
|
||||
{
|
||||
public:
|
||||
BattleGroundQueue();
|
||||
~BattleGroundQueue();
|
||||
/*
|
||||
uint32 GetType();
|
||||
void SetType(uint32 type);*/
|
||||
|
||||
void Update(uint32 bgTypeId, uint32 queue_id);
|
||||
void Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype = 0, bool isRated = false, uint32 minRating = 0);
|
||||
|
||||
void AddPlayer(Player *plr, uint32 bgTypeId);
|
||||
GroupQueueInfo * AddGroup(Player * leader, uint32 BgTypeId, uint8 ArenaType, bool isRated, uint32 ArenaRating, uint32 ArenaTeamId = 0);
|
||||
void AddPlayer(Player *plr, GroupQueueInfo * ginfo);
|
||||
void RemovePlayer(uint64 guid, bool decreaseInvitedCount);
|
||||
void DecreaseGroupLength(uint32 queueId, uint32 AsGroup);
|
||||
void BGEndedRemoveInvites(BattleGround * bg);
|
||||
|
||||
typedef bgqueue<uint64, PlayerQueueInfo> QueuedPlayersMap;
|
||||
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers[MAX_BATTLEGROUND_QUEUES];
|
||||
typedef std::list<uint64> PlayerGuidsSortedByTimeQueue;
|
||||
PlayerGuidsSortedByTimeQueue m_PlayersSortedByWaitTime[MAX_BATTLEGROUND_QUEUES];
|
||||
|
||||
typedef std::list<GroupQueueInfo*> QueuedGroupsList;
|
||||
QueuedGroupsList m_QueuedGroups[MAX_BATTLEGROUND_QUEUES];
|
||||
|
||||
// class to hold pointers to the groups eligible for a specific selection pool building mode
|
||||
class EligibleGroups : public std::list<GroupQueueInfo *>
|
||||
{
|
||||
public:
|
||||
void Init(QueuedGroupsList * source, uint32 BgTypeId, uint32 side, uint32 MaxPlayers, uint8 ArenaType = 0, bool IsRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0);
|
||||
void RemoveGroup(GroupQueueInfo * ginfo);
|
||||
};
|
||||
|
||||
EligibleGroups m_EligibleGroups;
|
||||
|
||||
// class to select and invite groups to bg
|
||||
class SelectionPool
|
||||
{
|
||||
public:
|
||||
void Init();
|
||||
void AddGroup(GroupQueueInfo * group);
|
||||
GroupQueueInfo * GetMaximalGroup();
|
||||
void RemoveGroup(GroupQueueInfo * group);
|
||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||
public:
|
||||
std::list<GroupQueueInfo *> SelectedGroups;
|
||||
private:
|
||||
uint32 PlayerCount;
|
||||
GroupQueueInfo * MaxGroup;
|
||||
};
|
||||
|
||||
enum SelectionPoolBuildMode
|
||||
{
|
||||
NORMAL_ALLIANCE,
|
||||
NORMAL_HORDE,
|
||||
ONESIDE_ALLIANCE_TEAM1,
|
||||
ONESIDE_ALLIANCE_TEAM2,
|
||||
ONESIDE_HORDE_TEAM1,
|
||||
ONESIDE_HORDE_TEAM2,
|
||||
|
||||
NUM_SELECTION_POOL_TYPES
|
||||
};
|
||||
|
||||
SelectionPool m_SelectionPools[NUM_SELECTION_POOL_TYPES];
|
||||
|
||||
bool BuildSelectionPool(uint32 bgTypeId, uint32 queue_id, uint32 MinPlayers, uint32 MaxPlayers, SelectionPoolBuildMode mode, uint8 ArenaType = 0, bool isRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0);
|
||||
|
||||
private:
|
||||
|
||||
bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -96,7 +143,6 @@ class BGQueueInviteEvent : public BasicEvent
|
||||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -116,7 +162,6 @@ class BGQueueRemoveEvent : public BasicEvent
|
||||
uint32 m_PlayersTeam;
|
||||
};
|
||||
|
||||
|
||||
class BattleGroundMgr
|
||||
{
|
||||
public:
|
||||
@@ -132,18 +177,18 @@ class BattleGroundMgr
|
||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, uint32 bgTypeId);
|
||||
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
|
||||
void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg);
|
||||
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2);
|
||||
void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint32 arenatype = 0, uint8 israted = 0);
|
||||
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
|
||||
|
||||
/* Player invitation */
|
||||
// called from Queue update, or from Addplayer to queue
|
||||
void InvitePlayer(Player* plr, uint32 bgInstanceGUID);
|
||||
void InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 team);
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGroundSet::iterator GetBattleGroundsBegin() { return m_BattleGrounds.begin(); };
|
||||
BattleGroundSet::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); };
|
||||
|
||||
BattleGround* GetBattleGround(uint8 ID)
|
||||
BattleGround* GetBattleGround(uint32 ID)
|
||||
{
|
||||
BattleGroundSet::iterator i = m_BattleGrounds.find(ID);
|
||||
if(i != m_BattleGrounds.end())
|
||||
@@ -152,9 +197,13 @@ class BattleGroundMgr
|
||||
return NULL;
|
||||
};
|
||||
|
||||
BattleGround * GetBattleGroundTemplate(uint32 bgTypeId);
|
||||
BattleGround * CreateNewBattleGround(uint32 bgTypeId);
|
||||
|
||||
uint32 CreateBattleGround(uint32 bgTypeId, 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);
|
||||
|
||||
inline void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; };
|
||||
void RemoveBattleGround(uint32 instanceID);
|
||||
|
||||
void CreateInitialBattleGrounds();
|
||||
|
||||
@@ -162,16 +211,39 @@ class BattleGroundMgr
|
||||
|
||||
/* Battleground queues */
|
||||
//these queues are instantiated when creating BattlegroundMrg
|
||||
BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_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_TYPES];
|
||||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, uint64 guid);
|
||||
|
||||
bool IsArenaType(uint32 bgTypeId) const;
|
||||
bool IsBattleGroundType(uint32 bgTypeId) const;
|
||||
uint32 BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) const;
|
||||
uint32 BGTemplateId(uint32 bgQueueTypeId) const;
|
||||
uint8 BGArenaType(uint32 bgQueueTypeId) const;
|
||||
|
||||
uint32 GetMaxRatingDifference() const {return m_MaxRatingDifference;}
|
||||
uint32 GetRatingDiscardTimer() const {return m_RatingDiscardTimer;}
|
||||
|
||||
void InitAutomaticArenaPointDistribution();
|
||||
void DistributeArenaPoints();
|
||||
uint32 GetPrematureFinishTime() const {return m_PrematureFinishTimer;}
|
||||
void ToggleArenaTesting();
|
||||
const bool isArenaTesting() const { return m_ArenaTesting; }
|
||||
|
||||
private:
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGroundSet m_BattleGrounds;
|
||||
uint32 m_MaxRatingDifference;
|
||||
uint32 m_RatingDiscardTimer;
|
||||
uint32 m_NextRatingDiscardUpdate;
|
||||
bool m_AutoDistributePoints;
|
||||
uint64 m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_PrematureFinishTimer;
|
||||
bool m_ArenaTesting;
|
||||
};
|
||||
|
||||
#define sBattleGroundMgr MaNGOS::Singleton<BattleGroundMgr>::Instance()
|
||||
|
||||
Reference in New Issue
Block a user