| 46 | uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes |
| 47 | GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo |
| 48 | }; |
| 49 | |
| 50 | struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!) |
| 51 | { |
| 52 | std::map<uint64, PlayerQueueInfo*> Players; // player queue info map |
| 53 | uint32 Team; // Player team (ALLIANCE/HORDE) |
| 54 | bool IsRated; // rated |
| 55 | uint32 BgTypeId; // battleground type id |
| 56 | uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG |
| 57 | uint32 ArenaTeamId; // team id if rated match |
| 58 | uint32 JoinTime; // time when group was added |
42 | | uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes |
43 | | uint32 Team; // Player team (ALLIANCE/HORDE) |
44 | | bool IsRated; |
45 | | bool AsGroup; // uint32 GroupId; |
46 | | uint8 ArenaType; |
47 | | }; |
48 | | |
49 | | struct PlayersCount |
50 | | { |
51 | | uint32 Alliance; |
52 | | uint32 Horde; |
53 | | }; |
54 | | |
55 | | template<class _Kty, class _Ty> class bgqueue: public std::map<_Kty, _Ty> |
56 | | { |
57 | | public: |
58 | | uint32 Alliance; |
59 | | uint32 Horde; |
60 | | //bool Ready; // not used now |
61 | | //uint32 AverageTime; //not already implemented (it should be average time in queue for last 10 players) |
62 | | }; |
63 | | |
| 60 | uint32 ArenaTeamRating; // if rated match, inited to the rating of the team |
| 61 | }; |
| 62 | |
| 63 | class BattleGround; |
69 | | /* |
70 | | uint32 GetType(); |
71 | | void SetType(uint32 type);*/ |
72 | | |
73 | | void Update(uint32 bgTypeId, uint32 queue_id); |
74 | | |
75 | | void AddPlayer(Player *plr, uint32 bgTypeId); |
| 69 | |
| 70 | void Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype = 0, bool isRated = false, uint32 minRating = 0); |
| 71 | |
| 72 | GroupQueueInfo * AddGroup(Player * leader, uint32 BgTypeId, uint8 ArenaType, bool isRated, uint32 ArenaRating, uint32 ArenaTeamId = 0); |
| 73 | void AddPlayer(Player *plr, GroupQueueInfo * ginfo); |
80 | | typedef std::list<uint64> PlayerGuidsSortedByTimeQueue; |
81 | | PlayerGuidsSortedByTimeQueue m_PlayersSortedByWaitTime[MAX_BATTLEGROUND_QUEUES]; |
| 80 | |
| 81 | typedef std::list<GroupQueueInfo*> QueuedGroupsList; |
| 82 | QueuedGroupsList m_QueuedGroups[MAX_BATTLEGROUND_QUEUES]; |
| 83 | |
| 84 | // class to hold pointers to the groups eligible for a specific selection pool building mode |
| 85 | class EligibleGroups : public std::list<GroupQueueInfo *> |
| 86 | { |
| 87 | public: |
| 88 | 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); |
| 89 | void RemoveGroup(GroupQueueInfo * ginfo); |
| 90 | }; |
| 91 | |
| 92 | EligibleGroups m_EligibleGroups; |
| 93 | |
| 94 | // class to select and invite groups to bg |
| 95 | class SelectionPool |
| 96 | { |
| 97 | public: |
| 98 | void Init(); |
| 99 | void AddGroup(GroupQueueInfo * group); |
| 100 | GroupQueueInfo * GetMaximalGroup(); |
| 101 | void RemoveGroup(GroupQueueInfo * group); |
| 102 | uint32 GetPlayerCount() const {return PlayerCount;} |
| 103 | public: |
| 104 | std::list<GroupQueueInfo *> SelectedGroups; |
| 105 | private: |
| 106 | uint32 PlayerCount; |
| 107 | GroupQueueInfo * MaxGroup; |
| 108 | }; |
| 109 | |
| 110 | enum SelectionPoolBuildMode |
| 111 | { |
| 112 | NORMAL_ALLIANCE, |
| 113 | NORMAL_HORDE, |
| 114 | ONESIDE_ALLIANCE_TEAM1, |
| 115 | ONESIDE_ALLIANCE_TEAM2, |
| 116 | ONESIDE_HORDE_TEAM1, |
| 117 | ONESIDE_HORDE_TEAM2, |
| 118 | |
| 119 | NUM_SELECTION_POOL_TYPES |
| 120 | }; |
| 121 | |
| 122 | SelectionPool m_SelectionPools[NUM_SELECTION_POOL_TYPES]; |
| 123 | |
| 124 | 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); |
| 125 | |
| 126 | private: |
| 127 | |
| 128 | bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side); |
135 | | void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2); |
| 180 | void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint32 arenatype = 0, uint8 israted = 0); |
155 | 203 | 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); |
156 | 204 | |
157 | 205 | inline void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; }; |
| 219 | |
| 220 | bool IsArenaType(uint32 bgTypeId) const; |
| 221 | bool IsBattleGroundType(uint32 bgTypeId) const; |
| 222 | uint32 BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) const; |
| 223 | uint32 BGTemplateId(uint32 bgQueueTypeId) const; |
| 224 | uint8 BGArenaType(uint32 bgQueueTypeId) const; |
| 225 | |
| 226 | uint32 GetMaxRatingDifference() const {return m_MaxRatingDifference;} |
| 227 | uint32 GetRatingDiscardTimer() const {return m_RatingDiscardTimer;} |
| 228 | |
| 229 | void InitAutomaticArenaPointDistribution(); |
| 230 | void DistributeArenaPoints(); |
| 231 | uint32 GetPrematureFinishTime() const {return m_PrematureFinishTimer;} |
| 232 | void ToggleArenaTesting(); |
| 233 | const bool isArenaTesting() const { return m_ArenaTesting; } |