Core/PacketIO: Fixed BattlefieldStatusHeader structure and QueueID values for other battleground types
Port From (https://github.com/TrinityCore/TrinityCore/commit/d435d5d5ba7040a0de16d5b97202b2e61fd03344)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ulong> QueueID = new List<ulong>();
|
||||
public byte RangeMin;
|
||||
public byte RangeMax;
|
||||
public byte TeamSize;
|
||||
|
||||
Reference in New Issue
Block a user