diff --git a/Source/Framework/Constants/BattleGroundsConst.cs b/Source/Framework/Constants/BattleGroundsConst.cs index 42d8a04b9..ea7002a06 100644 --- a/Source/Framework/Constants/BattleGroundsConst.cs +++ b/Source/Framework/Constants/BattleGroundsConst.cs @@ -155,6 +155,15 @@ namespace Framework.Constants Max } + public enum BattlegroundQueueIdType + { + Battleground = 0, + Arena = 1, + Wargame = 2, + Cheat = 3, + ArenaSkirmish = 4 + } + public enum BattlegroundQueueInvitationType { NoBalance = 0, // no balance: N+M vs N players diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index 647c2be66..0cdd325ec 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -1803,7 +1803,11 @@ namespace Game.BattleGrounds public ulong GetQueueId() { - return (ulong)_battlegroundTemplate.Id | 0x1F10000000000000ul; + BattlegroundQueueIdType type = BattlegroundQueueIdType.Battleground; + if (IsArena()) + type = IsRated() ? BattlegroundQueueIdType.Arena : BattlegroundQueueIdType.ArenaSkirmish; + + return (ulong)_battlegroundTemplate.Id | (ulong)type << 16 | 0x1F10000000000000; } public BattlegroundTypeId GetTypeID(bool getRandom = false) diff --git a/Source/Game/BattleGrounds/BattleGroundManager.cs b/Source/Game/BattleGrounds/BattleGroundManager.cs index 0a3cd48b0..299a1583d 100644 --- a/Source/Game/BattleGrounds/BattleGroundManager.cs +++ b/Source/Game/BattleGrounds/BattleGroundManager.cs @@ -124,14 +124,14 @@ namespace Game.BattleGrounds } } - void BuildBattlegroundStatusHeader(ref BattlefieldStatusHeader header, Battleground bg, Player player, uint ticketId, uint joinTime, ArenaTypes arenaType) + void BuildBattlegroundStatusHeader(BattlefieldStatusHeader header, Battleground bg, Player player, uint ticketId, uint joinTime, ArenaTypes arenaType) { header.Ticket = new RideTicket(); header.Ticket.RequesterGuid = player.GetGUID(); header.Ticket.Id = ticketId; header.Ticket.Type = RideType.Battlegrounds; header.Ticket.Time = (int)joinTime; - header.QueueID = bg.GetQueueId(); + header.QueueID.Add(bg.GetQueueId()); header.RangeMin = (byte)bg.GetMinLevel(); header.RangeMax = (byte)bg.GetMaxLevel(); header.TeamSize = (byte)(bg.IsArena() ? arenaType : 0); @@ -152,7 +152,7 @@ namespace Game.BattleGrounds public void BuildBattlegroundStatusNeedConfirmation(out BattlefieldStatusNeedConfirmation battlefieldStatus, Battleground bg, Player player, uint ticketId, uint joinTime, uint timeout, ArenaTypes arenaType) { battlefieldStatus = new BattlefieldStatusNeedConfirmation(); - BuildBattlegroundStatusHeader(ref battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); + BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); battlefieldStatus.Mapid = bg.GetMapId(); battlefieldStatus.Timeout = timeout; battlefieldStatus.Role = 0; @@ -161,7 +161,7 @@ namespace Game.BattleGrounds public void BuildBattlegroundStatusActive(out BattlefieldStatusActive battlefieldStatus, Battleground bg, Player player, uint ticketId, uint joinTime, ArenaTypes arenaType) { battlefieldStatus = new BattlefieldStatusActive(); - BuildBattlegroundStatusHeader(ref battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); + BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); battlefieldStatus.ShutdownTimer = bg.GetRemainingTime(); battlefieldStatus.ArenaFaction = (byte)(player.GetBGTeam() == Team.Horde ? TeamId.Horde : TeamId.Alliance); battlefieldStatus.LeftEarly = false; @@ -172,7 +172,7 @@ namespace Game.BattleGrounds public void BuildBattlegroundStatusQueued(out BattlefieldStatusQueued battlefieldStatus, Battleground bg, Player player, uint ticketId, uint joinTime, uint avgWaitTime, ArenaTypes arenaType, bool asGroup) { battlefieldStatus = new BattlefieldStatusQueued(); - BuildBattlegroundStatusHeader(ref battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); + BuildBattlegroundStatusHeader(battlefieldStatus.Hdr, bg, player, ticketId, joinTime, arenaType); battlefieldStatus.AverageWaitTime = avgWaitTime; battlefieldStatus.AsGroup = asGroup; battlefieldStatus.SuspendedQueue = false; diff --git a/Source/Game/Network/Packets/BattleGroundPackets.cs b/Source/Game/Network/Packets/BattleGroundPackets.cs index 2f415ad6f..499bcd641 100644 --- a/Source/Game/Network/Packets/BattleGroundPackets.cs +++ b/Source/Game/Network/Packets/BattleGroundPackets.cs @@ -245,7 +245,7 @@ namespace Game.Network.Packets public uint Timeout; public uint Mapid; - public BattlefieldStatusHeader Hdr; + public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); public byte Role; } @@ -264,7 +264,7 @@ namespace Game.Network.Packets _worldPacket.FlushBits(); } - public BattlefieldStatusHeader Hdr; + public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); public uint ShutdownTimer; public byte ArenaFaction; public bool LeftEarly; @@ -288,7 +288,7 @@ namespace Game.Network.Packets } public uint AverageWaitTime; - public BattlefieldStatusHeader Hdr; + public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader(); public bool AsGroup; public bool SuspendedQueue; public bool EligibleForMatchmaking; @@ -570,23 +570,27 @@ namespace Game.Network.Packets } //Structs - public struct BattlefieldStatusHeader + public class BattlefieldStatusHeader { public void Write(WorldPacket data) { Ticket.Write(data); - data.WriteUInt64(QueueID); + data.WriteInt32(QueueID.Count); data.WriteUInt8(RangeMin); data.WriteUInt8(RangeMax); data.WriteUInt8(TeamSize); data.WriteUInt32(InstanceID); + + foreach (ulong queueID in QueueID) + data.WriteUInt64(queueID); + data.WriteBit(RegisteredMatch); data.WriteBit(TournamentRules); data.FlushBits(); } public RideTicket Ticket; - public ulong QueueID; + public List QueueID = new List(); public byte RangeMin; public byte RangeMax; public byte TeamSize;