Refactoring of BNetServer

This commit is contained in:
hondacrx
2020-07-12 00:06:43 -04:00
parent 4164384b72
commit 581d077acd
318 changed files with 2046 additions and 4694 deletions
@@ -0,0 +1,383 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
using Framework.Dynamic;
namespace Game.Networking.Packets
{
public class AllAchievementData : ServerPacket
{
public AllAchievementData() : base(ServerOpcodes.AllAchievementData, ConnectionType.Instance) { }
public override void Write()
{
Data.Write(_worldPacket);
}
public AllAchievements Data = new AllAchievements();
}
class AllAccountCriteria : ServerPacket
{
public AllAccountCriteria() : base(ServerOpcodes.AllAccountCriteria, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Progress.Count);
foreach (var progress in Progress)
progress.Write(_worldPacket);
}
public List<CriteriaProgressPkt> Progress = new List<CriteriaProgressPkt>();
}
public class RespondInspectAchievements : ServerPacket
{
public RespondInspectAchievements() : base(ServerOpcodes.RespondInspectAchievements, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Player);
Data.Write(_worldPacket);
}
public ObjectGuid Player;
public AllAchievements Data = new AllAchievements();
}
public class CriteriaUpdate : ServerPacket
{
public CriteriaUpdate() : base(ServerOpcodes.CriteriaUpdate, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(CriteriaID);
_worldPacket.WriteUInt64(Quantity);
_worldPacket.WritePackedGuid(PlayerGUID);
_worldPacket.WriteUInt32(Flags);
_worldPacket.WritePackedTime(CurrentTime);
_worldPacket.WriteUInt32(ElapsedTime);
_worldPacket.WriteUInt32(CreationTime);
_worldPacket.WriteBit(RafAcceptanceID.HasValue);
_worldPacket.FlushBits();
if (RafAcceptanceID.HasValue)
_worldPacket.WriteUInt64(RafAcceptanceID.Value);
}
public uint CriteriaID;
public ulong Quantity;
public ObjectGuid PlayerGUID;
public uint Flags;
public long CurrentTime;
public uint ElapsedTime;
public uint CreationTime;
public Optional<ulong> RafAcceptanceID;
}
class AccountCriteriaUpdate : ServerPacket
{
public AccountCriteriaUpdate() : base(ServerOpcodes.AccountCriteriaUpdate) { }
public override void Write()
{
Progress.Write(_worldPacket);
}
public CriteriaProgressPkt Progress;
}
public class CriteriaDeleted : ServerPacket
{
public CriteriaDeleted() : base(ServerOpcodes.CriteriaDeleted, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(CriteriaID);
}
public uint CriteriaID;
}
public class AchievementDeleted : ServerPacket
{
public AchievementDeleted() : base(ServerOpcodes.AchievementDeleted, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WriteUInt32(Immunities);
}
public uint AchievementID;
public uint Immunities; // this is just garbage, not used by client
}
public class AchievementEarned : ServerPacket
{
public AchievementEarned() : base(ServerOpcodes.AchievementEarned, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Sender);
_worldPacket.WritePackedGuid(Earner);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WritePackedTime(Time);
_worldPacket.WriteUInt32(EarnerNativeRealm);
_worldPacket.WriteUInt32(EarnerVirtualRealm);
_worldPacket.WriteBit(Initial);
_worldPacket.FlushBits();
}
public ObjectGuid Earner;
public uint EarnerNativeRealm;
public uint EarnerVirtualRealm;
public uint AchievementID;
public long Time;
public bool Initial;
public ObjectGuid Sender;
}
public class BroadcastAchievement : ServerPacket
{
public BroadcastAchievement() : base(ServerOpcodes.BroadcastAchievement) { }
public override void Write()
{
_worldPacket.WriteBits(Name.GetByteCount(), 7);
_worldPacket.WriteBit(GuildAchievement);
_worldPacket.WritePackedGuid(PlayerGUID);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WriteString(Name);
}
public ObjectGuid PlayerGUID;
public string Name = "";
public uint AchievementID;
public bool GuildAchievement;
}
public class GuildCriteriaUpdate : ServerPacket
{
public GuildCriteriaUpdate() : base(ServerOpcodes.GuildCriteriaUpdate) { }
public override void Write()
{
_worldPacket.WriteInt32(Progress.Count);
foreach (GuildCriteriaProgress progress in Progress)
{
_worldPacket.WriteUInt32(progress.CriteriaID);
_worldPacket.WriteUInt32(progress.DateCreated);
_worldPacket.WriteUInt32(progress.DateStarted);
_worldPacket.WritePackedTime(progress.DateUpdated);
_worldPacket.WriteUInt64(progress.Quantity);
_worldPacket.WritePackedGuid(progress.PlayerGUID);
_worldPacket.WriteInt32(progress.Flags);
}
}
public List<GuildCriteriaProgress> Progress = new List<GuildCriteriaProgress>();
}
public class GuildCriteriaDeleted : ServerPacket
{
public GuildCriteriaDeleted() : base(ServerOpcodes.GuildCriteriaDeleted) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GuildGUID);
_worldPacket.WriteUInt32(CriteriaID);
}
public ObjectGuid GuildGUID;
public uint CriteriaID;
}
public class GuildSetFocusedAchievement : ClientPacket
{
public GuildSetFocusedAchievement(WorldPacket packet) : base(packet) { }
public override void Read()
{
AchievementID = _worldPacket.ReadUInt32();
}
public uint AchievementID;
}
public class GuildAchievementDeleted : ServerPacket
{
public GuildAchievementDeleted() : base(ServerOpcodes.GuildAchievementDeleted) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GuildGUID);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WritePackedTime(TimeDeleted);
}
public ObjectGuid GuildGUID;
public uint AchievementID;
public long TimeDeleted;
}
public class GuildAchievementEarned : ServerPacket
{
public GuildAchievementEarned() : base(ServerOpcodes.GuildAchievementEarned) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GuildGUID);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WritePackedTime(TimeEarned);
}
public uint AchievementID;
public ObjectGuid GuildGUID;
public long TimeEarned;
}
public class AllGuildAchievements : ServerPacket
{
public AllGuildAchievements() : base(ServerOpcodes.AllGuildAchievements) { }
public override void Write()
{
_worldPacket.WriteInt32(Earned.Count);
foreach (EarnedAchievement earned in Earned)
earned.Write(_worldPacket);
}
public List<EarnedAchievement> Earned = new List<EarnedAchievement>();
}
class GuildGetAchievementMembers : ClientPacket
{
public GuildGetAchievementMembers(WorldPacket packet) : base(packet) { }
public override void Read()
{
PlayerGUID = _worldPacket.ReadPackedGuid();
GuildGUID = _worldPacket.ReadPackedGuid();
AchievementID = _worldPacket.ReadUInt32();
}
public ObjectGuid PlayerGUID;
public ObjectGuid GuildGUID;
public uint AchievementID;
}
class GuildAchievementMembers : ServerPacket
{
public GuildAchievementMembers() : base(ServerOpcodes.GuildAchievementMembers) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GuildGUID);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WriteInt32(Member.Count);
foreach (ObjectGuid guid in Member)
_worldPacket.WritePackedGuid(guid);
}
public ObjectGuid GuildGUID;
public uint AchievementID;
public List<ObjectGuid> Member = new List<ObjectGuid>();
}
//Structs
public struct EarnedAchievement
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Id);
data.WritePackedTime(Date);
data.WritePackedGuid(Owner);
data.WriteUInt32(VirtualRealmAddress);
data.WriteUInt32(NativeRealmAddress);
}
public uint Id;
public long Date;
public ObjectGuid Owner;
public uint VirtualRealmAddress;
public uint NativeRealmAddress;
}
public struct CriteriaProgressPkt
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Id);
data.WriteUInt64(Quantity);
data.WritePackedGuid(Player);
data.WritePackedTime(Date);
data.WriteUInt32(TimeFromStart);
data.WriteUInt32(TimeFromCreate);
data.WriteBits(Flags, 4);
data.WriteBit(RafAcceptanceID.HasValue);
data.FlushBits();
if (RafAcceptanceID.HasValue)
data.WriteUInt64(RafAcceptanceID.Value);
}
public uint Id;
public ulong Quantity;
public ObjectGuid Player;
public uint Flags;
public long Date;
public uint TimeFromStart;
public uint TimeFromCreate;
public Optional<ulong> RafAcceptanceID;
}
public struct GuildCriteriaProgress
{
public uint CriteriaID;
public uint DateCreated;
public uint DateStarted;
public long DateUpdated;
public ulong Quantity;
public ObjectGuid PlayerGUID;
public int Flags;
}
public class AllAchievements
{
public void Write(WorldPacket data)
{
data.WriteInt32(Earned.Count);
data.WriteInt32(Progress.Count);
foreach (EarnedAchievement earned in Earned)
earned.Write(data);
foreach (CriteriaProgressPkt progress in Progress)
progress.Write(data);
}
public List<EarnedAchievement> Earned = new List<EarnedAchievement>();
public List<CriteriaProgressPkt> Progress = new List<CriteriaProgressPkt>();
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
using Framework.Dynamic;
namespace Game.Networking.Packets
{
public struct AddOnInfo
{
public string Name;
public string Version;
public bool Loaded;
public bool Disabled;
public void Read(WorldPacket data)
{
data.ResetBitPos();
uint nameLength = data.ReadBits<uint>(10);
uint versionLength = data.ReadBits<uint>(10);
Loaded = data.HasBit();
Disabled = data.HasBit();
if (nameLength > 1)
{
Name = data.ReadString(nameLength - 1);
data.ReadUInt8(); // null terminator
}
if (versionLength > 1)
{
Version = data.ReadString(versionLength - 1);
data.ReadUInt8(); // null terminator
}
}
}
}
@@ -0,0 +1,108 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class AreaTriggerPkt : ClientPacket
{
public AreaTriggerPkt(WorldPacket packet) : base(packet) { }
public override void Read()
{
AreaTriggerID = _worldPacket.ReadUInt32();
Entered = _worldPacket.HasBit();
FromClient = _worldPacket.HasBit();
}
public uint AreaTriggerID;
public bool Entered;
public bool FromClient;
}
class AreaTriggerDenied : ServerPacket
{
public AreaTriggerDenied() : base(ServerOpcodes.AreaTriggerDenied) { }
public override void Write()
{
_worldPacket.WriteInt32(AreaTriggerID);
_worldPacket.WriteBit(Entered);
_worldPacket.FlushBits();
}
public int AreaTriggerID;
public bool Entered;
}
class AreaTriggerNoCorpse : ServerPacket
{
public AreaTriggerNoCorpse() : base(ServerOpcodes.AreaTriggerNoCorpse) { }
public override void Write() { }
}
class AreaTriggerRePath : ServerPacket
{
public AreaTriggerRePath() : base(ServerOpcodes.AreaTriggerRePath) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TriggerGUID);
_worldPacket.WriteBit(AreaTriggerSpline.HasValue);
_worldPacket.WriteBit(AreaTriggerCircularMovement.HasValue);
_worldPacket.FlushBits();
if (AreaTriggerSpline.HasValue)
AreaTriggerSpline.Value.Write(_worldPacket);
if (AreaTriggerCircularMovement.HasValue)
AreaTriggerCircularMovement.Value.Write(_worldPacket);
}
public Optional<AreaTriggerSplineInfo> AreaTriggerSpline;
public Optional<AreaTriggerCircularMovementInfo> AreaTriggerCircularMovement;
public ObjectGuid TriggerGUID;
}
//Structs
class AreaTriggerSplineInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(TimeToTarget);
data.WriteUInt32(ElapsedTimeForMovement);
data.WriteBits(Points.Count, 16);
data.FlushBits();
foreach (Vector3 point in Points)
data.WriteVector3(point);
}
public uint TimeToTarget;
public uint ElapsedTimeForMovement;
public List<Vector3> Points = new List<Vector3>();
}
}
@@ -0,0 +1,125 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class ArtifactAddPower : ClientPacket
{
public ArtifactAddPower(WorldPacket packet) : base(packet) { }
public override void Read()
{
ArtifactGUID = _worldPacket.ReadPackedGuid();
ForgeGUID = _worldPacket.ReadPackedGuid();
var powerCount = _worldPacket.ReadUInt32();
for (var i = 0; i < powerCount; ++i)
{
ArtifactPowerChoice artifactPowerChoice;
artifactPowerChoice.ArtifactPowerID = _worldPacket.ReadUInt32();
artifactPowerChoice.Rank = _worldPacket.ReadUInt8();
PowerChoices[i] = artifactPowerChoice;
}
}
public ObjectGuid ArtifactGUID;
public ObjectGuid ForgeGUID;
public Array<ArtifactPowerChoice> PowerChoices = new Array<ArtifactPowerChoice>(1);
public struct ArtifactPowerChoice
{
public uint ArtifactPowerID;
public byte Rank;
}
}
class ArtifactSetAppearance : ClientPacket
{
public ArtifactSetAppearance(WorldPacket packet) : base(packet) { }
public override void Read()
{
ArtifactGUID = _worldPacket.ReadPackedGuid();
ForgeGUID = _worldPacket.ReadPackedGuid();
ArtifactAppearanceID = _worldPacket.ReadInt32();
}
public ObjectGuid ArtifactGUID;
public ObjectGuid ForgeGUID;
public int ArtifactAppearanceID;
}
class ConfirmArtifactRespec : ClientPacket
{
public ConfirmArtifactRespec(WorldPacket packet) : base(packet) { }
public override void Read()
{
ArtifactGUID = _worldPacket.ReadPackedGuid();
NpcGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ArtifactGUID;
public ObjectGuid NpcGUID;
}
class ArtifactForgeOpened : ServerPacket
{
public ArtifactForgeOpened() : base(ServerOpcodes.ArtifactForgeOpened) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ArtifactGUID);
_worldPacket.WritePackedGuid(ForgeGUID);
}
public ObjectGuid ArtifactGUID;
public ObjectGuid ForgeGUID;
}
class ArtifactRespecConfirm : ServerPacket
{
public ArtifactRespecConfirm() : base(ServerOpcodes.ArtifactRespecConfirm) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ArtifactGUID);
_worldPacket.WritePackedGuid(NpcGUID);
}
public ObjectGuid ArtifactGUID;
public ObjectGuid NpcGUID;
}
class ArtifactXpGain : ServerPacket
{
public ArtifactXpGain() : base(ServerOpcodes.ArtifactXpGain) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ArtifactGUID);
_worldPacket.WriteUInt64(Amount);
}
public ObjectGuid ArtifactGUID;
public ulong Amount;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,456 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Cryptography;
using Framework.Dynamic;
using Framework.IO;
using Game.DataStorage;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Linq;
namespace Game.Networking.Packets
{
class Ping : ClientPacket
{
public Ping(WorldPacket packet) : base(packet) { }
public override void Read()
{
Serial = _worldPacket.ReadUInt32();
Latency = _worldPacket.ReadUInt32();
}
public uint Serial;
public uint Latency;
}
class Pong : ServerPacket
{
public Pong(uint serial) : base(ServerOpcodes.Pong)
{
Serial = serial;
}
public override void Write()
{
_worldPacket.WriteUInt32(Serial);
}
uint Serial;
}
class AuthChallenge : ServerPacket
{
public AuthChallenge() : base(ServerOpcodes.AuthChallenge) { }
public override void Write()
{
_worldPacket.WriteBytes(DosChallenge);
_worldPacket.WriteBytes(Challenge);
_worldPacket.WriteUInt8(DosZeroBits);
}
public byte[] Challenge = new byte[16];
public byte[] DosChallenge = new byte[32]; // Encryption seeds
public byte DosZeroBits;
}
class AuthSession : ClientPacket
{
public AuthSession(WorldPacket packet) : base(packet) { }
public override void Read()
{
DosResponse = _worldPacket.ReadUInt64();
RegionID = _worldPacket.ReadUInt32();
BattlegroupID = _worldPacket.ReadUInt32();
RealmID = _worldPacket.ReadUInt32();
for (var i = 0; i < LocalChallenge.GetLimit(); ++i)
LocalChallenge[i] = _worldPacket.ReadUInt8();
Digest = _worldPacket.ReadBytes(24);
UseIPv6 = _worldPacket.HasBit();
uint realmJoinTicketSize = _worldPacket.ReadUInt32();
if (realmJoinTicketSize != 0)
RealmJoinTicket = _worldPacket.ReadString(realmJoinTicketSize);
}
public uint RegionID;
public uint BattlegroupID;
public uint RealmID;
public Array<byte> LocalChallenge = new Array<byte>(16);
public byte[] Digest = new byte[24];
public ulong DosResponse;
public string RealmJoinTicket;
public bool UseIPv6;
}
class AuthResponse : ServerPacket
{
public AuthResponse() : base(ServerOpcodes.AuthResponse)
{
WaitInfo = new Optional<AuthWaitInfo>();
SuccessInfo = new Optional<AuthSuccessInfo>();
}
public override void Write()
{
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteBit(SuccessInfo.HasValue);
_worldPacket.WriteBit(WaitInfo.HasValue);
_worldPacket.FlushBits();
if (SuccessInfo.HasValue)
{
_worldPacket.WriteUInt32(SuccessInfo.Value.VirtualRealmAddress);
_worldPacket.WriteInt32(SuccessInfo.Value.VirtualRealms.Count);
_worldPacket.WriteUInt32(SuccessInfo.Value.TimeRested);
_worldPacket.WriteUInt8(SuccessInfo.Value.ActiveExpansionLevel);
_worldPacket.WriteUInt8(SuccessInfo.Value.AccountExpansionLevel);
_worldPacket.WriteUInt32(SuccessInfo.Value.TimeSecondsUntilPCKick);
_worldPacket.WriteInt32(SuccessInfo.Value.AvailableClasses.Count);
_worldPacket.WriteInt32(SuccessInfo.Value.Templates.Count);
_worldPacket.WriteUInt32(SuccessInfo.Value.CurrencyID);
_worldPacket.WriteUInt32(SuccessInfo.Value.Time);
foreach (var raceClassAvailability in SuccessInfo.Value.AvailableClasses)
{
_worldPacket.WriteUInt8(raceClassAvailability.RaceID);
_worldPacket.WriteInt32(raceClassAvailability.Classes.Count);
foreach (var classAvailability in raceClassAvailability.Classes)
{
_worldPacket.WriteUInt8(classAvailability.ClassID);
_worldPacket.WriteUInt8(classAvailability.ActiveExpansionLevel);
_worldPacket.WriteUInt8(classAvailability.AccountExpansionLevel);
}
}
_worldPacket.WriteBit(SuccessInfo.Value.IsExpansionTrial);
_worldPacket.WriteBit(SuccessInfo.Value.ForceCharacterTemplate);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersHorde.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersAlliance.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.ExpansionTrialExpiration.HasValue);
_worldPacket.FlushBits();
{
_worldPacket.WriteUInt32(SuccessInfo.Value.Billing.BillingPlan);
_worldPacket.WriteUInt32(SuccessInfo.Value.Billing.TimeRemain);
_worldPacket.WriteUInt32(SuccessInfo.Value.Billing.Unknown735);
// 3x same bit is not a mistake - preserves legacy client behavior of BillingPlanFlags::SESSION_IGR
_worldPacket.WriteBit(SuccessInfo.Value.Billing.InGameRoom); // inGameRoom check in function checking which lua event to fire when remaining time is near end - BILLING_NAG_DIALOG vs IGR_BILLING_NAG_DIALOG
_worldPacket.WriteBit(SuccessInfo.Value.Billing.InGameRoom); // inGameRoom lua return from Script_GetBillingPlan
_worldPacket.WriteBit(SuccessInfo.Value.Billing.InGameRoom); // not used anywhere in the client
_worldPacket.FlushBits();
}
if (SuccessInfo.Value.NumPlayersHorde.HasValue)
_worldPacket.WriteUInt16(SuccessInfo.Value.NumPlayersHorde.Value);
if (SuccessInfo.Value.NumPlayersAlliance.HasValue)
_worldPacket.WriteUInt16(SuccessInfo.Value.NumPlayersAlliance.Value);
if(SuccessInfo.Value.ExpansionTrialExpiration.HasValue)
_worldPacket.WriteInt32(SuccessInfo.Value.ExpansionTrialExpiration.Value);
foreach (VirtualRealmInfo virtualRealm in SuccessInfo.Value.VirtualRealms)
virtualRealm.Write(_worldPacket);
foreach (var templat in SuccessInfo.Value.Templates)
{
_worldPacket.WriteUInt32(templat.TemplateSetId);
_worldPacket.WriteInt32(templat.Classes.Count);
foreach (var templateClass in templat.Classes)
{
_worldPacket.WriteUInt8(templateClass.ClassID);
_worldPacket.WriteUInt8((byte)templateClass.FactionGroup);
}
_worldPacket.WriteBits(templat.Name.GetByteCount(), 7);
_worldPacket.WriteBits(templat.Description.GetByteCount(), 10);
_worldPacket.FlushBits();
_worldPacket.WriteString(templat.Name);
_worldPacket.WriteString(templat.Description);
}
}
if (WaitInfo.HasValue)
WaitInfo.Value.Write(_worldPacket);
}
public Optional<AuthSuccessInfo> SuccessInfo; // contains the packet data in case that it has account information (It is never set when WaitInfo is set), otherwise its contents are undefined.
public Optional<AuthWaitInfo> WaitInfo; // contains the queue wait information in case the account is in the login queue.
public BattlenetRpcErrorCode Result; // the result of the authentication process, possible values are @ref BattlenetRpcErrorCode
public class AuthSuccessInfo
{
public byte ActiveExpansionLevel; // the current server expansion, the possible values are in @ref Expansions
public byte AccountExpansionLevel; // the current expansion of this account, the possible values are in @ref Expansions
public uint TimeRested; // affects the return value of the GetBillingTimeRested() client API call, it is the number of seconds you have left until the experience points and loot you receive from creatures and quests is reduced. It is only used in the Asia region in retail, it's not implemented in TC and will probably never be.
public uint VirtualRealmAddress; // a special identifier made from the Index, BattleGroup and Region. @todo implement
public uint TimeSecondsUntilPCKick; // @todo research
public uint CurrencyID; // this is probably used for the ingame shop. @todo implement
public uint Time;
public BillingInfo Billing;
public List<VirtualRealmInfo> VirtualRealms = new List<VirtualRealmInfo>(); // list of realms connected to this one (inclusive) @todo implement
public List<CharacterTemplate> Templates = new List<CharacterTemplate>(); // list of pre-made character templates. @todo implement
public List<RaceClassAvailability> AvailableClasses; // the minimum AccountExpansion required to select the classes
public bool IsExpansionTrial;
public bool ForceCharacterTemplate; // forces the client to always use a character template when creating a new character. @see Templates. @todo implement
public Optional<ushort> NumPlayersHorde; // number of horde players in this realm. @todo implement
public Optional<ushort> NumPlayersAlliance; // number of alliance players in this realm. @todo implement
public Optional<int> ExpansionTrialExpiration; // expansion trial expiration unix timestamp
public struct BillingInfo
{
public uint BillingPlan;
public uint TimeRemain;
public uint Unknown735;
public bool InGameRoom;
}
}
}
class WaitQueueUpdate : ServerPacket
{
public WaitQueueUpdate() : base(ServerOpcodes.WaitQueueUpdate) { }
public override void Write()
{
WaitInfo.Write(_worldPacket);
}
public AuthWaitInfo WaitInfo;
}
class WaitQueueFinish : ServerPacket
{
public WaitQueueFinish() : base(ServerOpcodes.WaitQueueFinish) { }
public override void Write() { }
}
class ConnectTo : ServerPacket
{
public ConnectTo() : base(ServerOpcodes.ConnectTo)
{
Payload = new ConnectPayload();
}
public override void Write()
{
ByteBuffer whereBuffer = new ByteBuffer();
whereBuffer.WriteUInt8((byte)Payload.Where.Type);
switch (Payload.Where.Type)
{
case AddressType.IPv4:
whereBuffer.WriteBytes(Payload.Where.IPv4);
break;
case AddressType.IPv6:
whereBuffer.WriteBytes(Payload.Where.IPv6);
break;
case AddressType.NamedSocket:
whereBuffer.WriteString(Payload.Where.NameSocket);
break;
default:
break;
}
Sha256 hash = new Sha256();
hash.Process(whereBuffer.GetData(), (int)whereBuffer.GetSize());
hash.Process((uint)Payload.Where.Type);
hash.Finish(BitConverter.GetBytes(Payload.Port));
Payload.Signature = RsaCrypt.RSA.SignHash(hash.Digest, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1).Reverse().ToArray();
_worldPacket.WriteBytes(Payload.Signature, (uint)Payload.Signature.Length);
_worldPacket.WriteBytes(whereBuffer);
_worldPacket.WriteUInt16(Payload.Port);
_worldPacket.WriteUInt32((uint)Serial);
_worldPacket.WriteUInt8(Con);
_worldPacket.WriteUInt64(Key);
}
public ulong Key;
public ConnectToSerial Serial;
public ConnectPayload Payload;
public byte Con;
public class ConnectPayload
{
public SocketAddress Where;
public ushort Port;
public byte[] Signature = new byte[256];
}
public struct SocketAddress
{
public AddressType Type;
public byte[] IPv4;
public byte[] IPv6;
public string NameSocket;
}
public enum AddressType
{
IPv4 = 1,
IPv6 = 2,
NamedSocket = 3 // not supported by windows client
}
}
class AuthContinuedSession : ClientPacket
{
public AuthContinuedSession(WorldPacket packet) : base(packet) { }
public override void Read()
{
DosResponse = _worldPacket.ReadUInt64();
Key = _worldPacket.ReadUInt64();
LocalChallenge = _worldPacket.ReadBytes(16);
Digest = _worldPacket.ReadBytes(24);
}
public ulong DosResponse;
public ulong Key;
public byte[] LocalChallenge = new byte[16];
public byte[] Digest = new byte[24];
}
class ResumeComms : ServerPacket
{
public ResumeComms(ConnectionType connection) : base(ServerOpcodes.ResumeComms, connection) { }
public override void Write() { }
}
class ConnectToFailed : ClientPacket
{
public ConnectToFailed(WorldPacket packet) : base(packet) { }
public override void Read()
{
Serial = (ConnectToSerial)_worldPacket.ReadUInt32();
Con = _worldPacket.ReadUInt8();
}
public ConnectToSerial Serial;
byte Con;
}
class EnableEncryption : ServerPacket
{
byte[] EncryptionKey;
bool Enabled;
static byte[] EnableEncryptionSeed = { 0x90, 0x9C, 0xD0, 0x50, 0x5A, 0x2C, 0x14, 0xDD, 0x5C, 0x2C, 0xC0, 0x64, 0x14, 0xF3, 0xFE, 0xC9 };
public EnableEncryption(byte[] encryptionKey, bool enabled) : base(ServerOpcodes.EnableEncryption)
{
EncryptionKey = encryptionKey;
Enabled = enabled;
}
public override void Write()
{
HmacSha256 hash = new HmacSha256(EncryptionKey);
hash.Process(BitConverter.GetBytes(Enabled), 1);
hash.Finish(EnableEncryptionSeed, 16);
_worldPacket.WriteBytes(RsaCrypt.RSA.SignHash(hash.Digest, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1).Reverse().ToArray());
_worldPacket.WriteBit(Enabled);
_worldPacket.FlushBits();
}
}
//Structs
public struct AuthWaitInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(WaitCount);
data.WriteUInt32(WaitTime);
data.WriteBit(HasFCM);
data.FlushBits();
}
public uint WaitCount; // position of the account in the login queue
public uint WaitTime; // Wait time in login queue in minutes, if sent queued and this value is 0 client displays "unknown time"
public bool HasFCM; // true if the account has a forced character migration pending. @todo implement
}
struct VirtualRealmNameInfo
{
public VirtualRealmNameInfo(bool isHomeRealm, bool isInternalRealm, string realmNameActual, string realmNameNormalized)
{
IsLocal = isHomeRealm;
IsInternalRealm = isInternalRealm;
RealmNameActual = realmNameActual;
RealmNameNormalized = realmNameNormalized;
}
public void Write(WorldPacket data)
{
data.WriteBit(IsLocal);
data.WriteBit(IsInternalRealm);
data.WriteBits(RealmNameActual.GetByteCount(), 8);
data.WriteBits(RealmNameNormalized.GetByteCount(), 8);
data.FlushBits();
data.WriteString(RealmNameActual);
data.WriteString(RealmNameNormalized);
}
public bool IsLocal; // true if the realm is the same as the account's home realm
public bool IsInternalRealm; // @todo research
public string RealmNameActual; // the name of the realm
public string RealmNameNormalized; // the name of the realm without spaces
}
struct VirtualRealmInfo
{
public VirtualRealmInfo(uint realmAddress, bool isHomeRealm, bool isInternalRealm, string realmNameActual, string realmNameNormalized)
{
RealmAddress = realmAddress;
RealmNameInfo = new VirtualRealmNameInfo(isHomeRealm, isInternalRealm, realmNameActual, realmNameNormalized);
}
public void Write(WorldPacket data)
{
data.WriteUInt32(RealmAddress);
RealmNameInfo.Write(data);
}
public uint RealmAddress; // the virtual address of this realm, constructed as RealmHandle::Region << 24 | RealmHandle::Battlegroup << 16 | RealmHandle::Index
public VirtualRealmNameInfo RealmNameInfo;
}
}
@@ -0,0 +1,160 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using Framework.Dynamic;
namespace Game.Networking.Packets
{
class AzeriteXpGain : ServerPacket
{
public AzeriteXpGain() : base(ServerOpcodes.AzeriteXpGain) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt64(XP);
}
public ObjectGuid ItemGUID;
public ulong XP;
}
class AzeriteEssenceForgeOpened : ServerPacket
{
public AzeriteEssenceForgeOpened() : base(ServerOpcodes.AzeriteEssenceForgeOpened) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ForgeGUID);
}
public ObjectGuid ForgeGUID;
}
class AzeriteEssenceForgeClose : ServerPacket
{
public AzeriteEssenceForgeClose() : base(ServerOpcodes.AzeriteEssenceForgeClose) { }
public override void Write() { }
}
class AzeriteEssenceUnlockMilestone : ClientPacket
{
public AzeriteEssenceUnlockMilestone(WorldPacket packet) : base(packet) { }
public override void Read()
{
AzeriteItemMilestonePowerID = _worldPacket.ReadInt32();
}
public int AzeriteItemMilestonePowerID;
}
class AzeriteEssenceActivateEssence : ClientPacket
{
public AzeriteEssenceActivateEssence(WorldPacket packet) : base(packet) { }
public override void Read()
{
AzeriteEssenceID = _worldPacket.ReadUInt32();
Slot = _worldPacket.ReadUInt8();
}
public uint AzeriteEssenceID;
public byte Slot;
}
class AzeriteEssenceSelectionResult : ServerPacket
{
public AzeriteEssenceSelectionResult() : base(ServerOpcodes.AzeriteEssenceSelectionResult) { }
public override void Write()
{
_worldPacket.WriteBits((int)Reason, 4);
_worldPacket.WriteBit(Slot.HasValue);
_worldPacket.WriteUInt32(Arg);
_worldPacket.WriteUInt32(AzeriteEssenceID);
if (Slot.HasValue)
_worldPacket.WriteUInt8(Slot.Value);
}
public AzeriteEssenceActivateResult Reason;
public uint Arg;
public uint AzeriteEssenceID;
public byte? Slot;
}
class AzeriteEmpoweredItemViewed : ClientPacket
{
public AzeriteEmpoweredItemViewed(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGUID;
}
class AzeriteEmpoweredItemSelectPower : ClientPacket
{
public AzeriteEmpoweredItemSelectPower(WorldPacket packet) : base(packet) { }
public override void Read()
{
Tier = _worldPacket.ReadInt32();
AzeritePowerID = _worldPacket.ReadInt32();
ContainerSlot = _worldPacket.ReadUInt8();
Slot = _worldPacket.ReadUInt8();
}
public int Tier;
public int AzeritePowerID;
public byte ContainerSlot;
public byte Slot;
}
class AzeriteEmpoweredItemEquippedStatusChanged : ServerPacket
{
public AzeriteEmpoweredItemEquippedStatusChanged() : base(ServerOpcodes.AzeriteEmpoweredItemEquippedStatusChanged) { }
public override void Write()
{
_worldPacket.WriteBit(IsHeartEquipped);
_worldPacket.FlushBits();
}
public bool IsHeartEquipped;
}
class AzeriteEmpoweredItemRespecOpen : ServerPacket
{
public AzeriteEmpoweredItemRespecOpen(ObjectGuid npcGuid) : base(ServerOpcodes.AzeriteEmpoweredItemRespecOpen)
{
NpcGUID = npcGuid;
}
public override void Write()
{
_worldPacket.WritePackedGuid(NpcGUID);
}
public ObjectGuid NpcGUID;
}
}
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.Entities;
namespace Game.Networking.Packets
{
public class AutoBankItem : ClientPacket
{
public InvUpdate Inv;
public byte Bag;
public byte Slot;
public AutoBankItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
Bag = _worldPacket.ReadUInt8();
Slot = _worldPacket.ReadUInt8();
}
}
public class AutoStoreBankItem : ClientPacket
{
public InvUpdate Inv;
public byte Bag;
public byte Slot;
public AutoStoreBankItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
Bag = _worldPacket.ReadUInt8();
Slot = _worldPacket.ReadUInt8();
}
}
public class BuyBankSlot : ClientPacket
{
public BuyBankSlot(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
}
@@ -0,0 +1,681 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class PVPSeason : ServerPacket
{
public PVPSeason() : base(ServerOpcodes.PvpSeason) { }
public override void Write()
{
_worldPacket.WriteInt32(MythicPlusSeasonID);
_worldPacket.WriteInt32(CurrentSeason);
_worldPacket.WriteInt32(PreviousSeason);
_worldPacket.WriteInt32(PvpSeasonID);
}
public int MythicPlusSeasonID;
public int PreviousSeason;
public int CurrentSeason;
public int PvpSeasonID;
}
public class AreaSpiritHealerQuery : ClientPacket
{
public AreaSpiritHealerQuery(WorldPacket packet) : base(packet) { }
public override void Read()
{
HealerGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid HealerGuid;
}
public class AreaSpiritHealerQueue : ClientPacket
{
public AreaSpiritHealerQueue(WorldPacket packet) : base(packet) { }
public override void Read()
{
HealerGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid HealerGuid;
}
public class HearthAndResurrect : ClientPacket
{
public HearthAndResurrect(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class PVPLogDataRequest : ClientPacket
{
public PVPLogDataRequest(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class PVPLogDataMessage : ServerPacket
{
public PVPLogDataMessage() : base(ServerOpcodes.PvpLogData, ConnectionType.Instance) { }
public override void Write()
{
Data.Write(_worldPacket);
}
public PVPLogData Data;
}
public class BattlefieldStatusNone : ServerPacket
{
public BattlefieldStatusNone() : base(ServerOpcodes.BattlefieldStatusNone) { }
public override void Write()
{
Ticket.Write(_worldPacket);
}
public RideTicket Ticket = new RideTicket();
}
public class BattlefieldStatusNeedConfirmation : ServerPacket
{
public BattlefieldStatusNeedConfirmation() : base(ServerOpcodes.BattlefieldStatusNeedConfirmation) { }
public override void Write()
{
Hdr.Write(_worldPacket);
_worldPacket.WriteUInt32(Mapid);
_worldPacket.WriteUInt32(Timeout);
_worldPacket.WriteUInt8(Role);
}
public uint Timeout;
public uint Mapid;
public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader();
public byte Role;
}
public class BattlefieldStatusActive : ServerPacket
{
public BattlefieldStatusActive() : base(ServerOpcodes.BattlefieldStatusActive) { }
public override void Write()
{
Hdr.Write(_worldPacket);
_worldPacket.WriteUInt32(Mapid);
_worldPacket.WriteUInt32(ShutdownTimer);
_worldPacket.WriteUInt32(StartTimer);
_worldPacket.WriteBit(ArenaFaction);
_worldPacket.WriteBit(LeftEarly);
_worldPacket.FlushBits();
}
public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader();
public uint ShutdownTimer;
public byte ArenaFaction;
public bool LeftEarly;
public uint StartTimer;
public uint Mapid;
}
public class BattlefieldStatusQueued : ServerPacket
{
public BattlefieldStatusQueued() : base(ServerOpcodes.BattlefieldStatusQueued) { }
public override void Write()
{
Hdr.Write(_worldPacket);
_worldPacket.WriteUInt32(AverageWaitTime);
_worldPacket.WriteUInt32(WaitTime);
_worldPacket.WriteBit(AsGroup);
_worldPacket.WriteBit(EligibleForMatchmaking);
_worldPacket.WriteBit(SuspendedQueue);
_worldPacket.FlushBits();
}
public uint AverageWaitTime;
public BattlefieldStatusHeader Hdr = new BattlefieldStatusHeader();
public bool AsGroup;
public bool SuspendedQueue;
public bool EligibleForMatchmaking;
public uint WaitTime;
}
public class BattlefieldStatusFailed : ServerPacket
{
public BattlefieldStatusFailed() : base(ServerOpcodes.BattlefieldStatusFailed) { }
public override void Write()
{
Ticket.Write(_worldPacket);
_worldPacket.WriteUInt64(QueueID);
_worldPacket.WriteInt32(Reason);
_worldPacket.WritePackedGuid(ClientID);
}
public ulong QueueID;
public ObjectGuid ClientID;
public int Reason;
public RideTicket Ticket = new RideTicket();
}
class BattlemasterJoin : ClientPacket
{
public BattlemasterJoin(WorldPacket packet) : base(packet) { }
public override void Read()
{
var queueCount = _worldPacket.ReadUInt32();
Roles = _worldPacket.ReadUInt8();
BlacklistMap[0] = _worldPacket.ReadInt32();
BlacklistMap[1] = _worldPacket.ReadInt32();
for (var i = 0; i < queueCount; ++i)
QueueIDs[i] = _worldPacket.ReadUInt64();
}
public Array<ulong> QueueIDs = new Array<ulong>(1);
public byte Roles;
public int[] BlacklistMap = new int[2];
}
class BattlemasterJoinArena : ClientPacket
{
public BattlemasterJoinArena(WorldPacket packet) : base(packet) { }
public override void Read()
{
TeamSizeIndex = _worldPacket.ReadUInt8();
Roles = _worldPacket.ReadUInt8();
}
public byte TeamSizeIndex;
public byte Roles;
}
class BattlefieldLeave : ClientPacket
{
public BattlefieldLeave(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class BattlefieldPort : ClientPacket
{
public BattlefieldPort(WorldPacket packet) : base(packet) { }
public override void Read()
{
Ticket.Read(_worldPacket);
AcceptedInvite = _worldPacket.HasBit();
}
public RideTicket Ticket = new RideTicket();
public bool AcceptedInvite;
}
class BattlefieldListRequest : ClientPacket
{
public BattlefieldListRequest(WorldPacket packet) : base(packet) { }
public override void Read()
{
ListID = _worldPacket.ReadInt32();
}
public int ListID;
}
class BattlefieldList : ServerPacket
{
public BattlefieldList() : base(ServerOpcodes.BattlefieldList) { }
public override void Write()
{
_worldPacket.WritePackedGuid(BattlemasterGuid);
_worldPacket.WriteInt32(BattlemasterListID);
_worldPacket.WriteUInt8(MinLevel);
_worldPacket.WriteUInt8(MaxLevel);
_worldPacket.WriteInt32(Battlefields.Count);
foreach (var field in Battlefields)
_worldPacket.WriteInt32(field);
_worldPacket.WriteBit(PvpAnywhere);
_worldPacket.WriteBit(HasRandomWinToday);
_worldPacket.FlushBits();
}
public ObjectGuid BattlemasterGuid;
public int BattlemasterListID;
public byte MinLevel;
public byte MaxLevel;
public List<int> Battlefields = new List<int>(); // Players cannot join a specific Battleground instance anymore - this is always empty
public bool PvpAnywhere;
public bool HasRandomWinToday;
}
class GetPVPOptionsEnabled : ClientPacket
{
public GetPVPOptionsEnabled(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class PVPOptionsEnabled : ServerPacket
{
public PVPOptionsEnabled() : base(ServerOpcodes.PvpOptionsEnabled) { }
public override void Write()
{
_worldPacket.WriteBit(RatedBattlegrounds);
_worldPacket.WriteBit(PugBattlegrounds);
_worldPacket.WriteBit(WargameBattlegrounds);
_worldPacket.WriteBit(WargameArenas);
_worldPacket.WriteBit(RatedArenas);
_worldPacket.WriteBit(ArenaSkirmish);
_worldPacket.FlushBits();
}
public bool WargameArenas;
public bool RatedArenas;
public bool WargameBattlegrounds;
public bool ArenaSkirmish;
public bool PugBattlegrounds;
public bool RatedBattlegrounds;
}
class RequestBattlefieldStatus : ClientPacket
{
public RequestBattlefieldStatus(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class ReportPvPPlayerAFK : ClientPacket
{
public ReportPvPPlayerAFK(WorldPacket packet) : base(packet) { }
public override void Read()
{
Offender = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Offender;
}
class ReportPvPPlayerAFKResult : ServerPacket
{
public ReportPvPPlayerAFKResult() : base(ServerOpcodes.ReportPvpPlayerAfkResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Offender);
_worldPacket.WriteUInt8((byte)Result);
_worldPacket.WriteUInt8(NumBlackMarksOnOffender);
_worldPacket.WriteUInt8(NumPlayersIHaveReported);
}
public ObjectGuid Offender;
public byte NumPlayersIHaveReported = 0;
public byte NumBlackMarksOnOffender = 0;
public ResultCode Result = ResultCode.GenericFailure;
public enum ResultCode
{
Success = 0,
GenericFailure = 1, // there are more error codes but they are impossible to receive without modifying the client
AFKSystemEnabled = 5,
AFKSystemDisabled = 6
}
}
class BattlegroundPlayerPositions : ServerPacket
{
public BattlegroundPlayerPositions() : base(ServerOpcodes.BattlegroundPlayerPositions, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(FlagCarriers.Count);
foreach (var pos in FlagCarriers)
pos.Write(_worldPacket);
}
public List<BattlegroundPlayerPosition> FlagCarriers = new List<BattlegroundPlayerPosition>();
}
class BattlegroundPlayerJoined : ServerPacket
{
public BattlegroundPlayerJoined() : base(ServerOpcodes.BattlegroundPlayerJoined, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
public ObjectGuid Guid;
}
class BattlegroundPlayerLeft : ServerPacket
{
public BattlegroundPlayerLeft() : base(ServerOpcodes.BattlegroundPlayerLeft, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
public ObjectGuid Guid;
}
class DestroyArenaUnit : ServerPacket
{
public DestroyArenaUnit() : base(ServerOpcodes.DestroyArenaUnit) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
public ObjectGuid Guid;
}
class RequestPVPRewards : ClientPacket
{
public RequestPVPRewards(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class RequestPVPRewardsResponse : ServerPacket
{
public RequestPVPRewardsResponse() : base(ServerOpcodes.RequestPvpRewardsResponse) { }
public override void Write()
{
throw new NotImplementedException();
}
public uint RatedRewardPointsThisWeek;
public uint ArenaRewardPointsThisWeek;
public uint RatedMaxRewardPointsThisWeek;
public uint ArenaRewardPoints;
public uint RandomRewardPointsThisWeek;
public uint ArenaMaxRewardPointsThisWeek;
public uint RatedRewardPoints;
public uint MaxRewardPointsThisWeek;
public uint RewardPointsThisWeek;
public uint RandomMaxRewardPointsThisWeek;
}
class RequestRatedBattlefieldInfo : ClientPacket
{
public RequestRatedBattlefieldInfo(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class PVPMatchInit : ServerPacket
{
public PVPMatchInit() : base(ServerOpcodes.PvpMatchInit, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(MapID);
_worldPacket.WriteUInt8((byte)State);
_worldPacket.WriteInt32((int)StartTime);
_worldPacket.WriteInt32(Duration);
_worldPacket.WriteUInt8(ArenaFaction);
_worldPacket.WriteUInt32(BattlemasterListID);
_worldPacket.WriteBit(Registered);
_worldPacket.WriteBit(AffectsRating);
_worldPacket.FlushBits();
}
public enum MatchState
{
InProgress = 1,
Complete = 3,
Inactive = 4
}
public uint MapID;
public MatchState State = MatchState.Inactive;
public long StartTime;
public int Duration;
public byte ArenaFaction;
public uint BattlemasterListID;
public bool Registered;
public bool AffectsRating;
}
class PVPMatchEnd : ServerPacket
{
public PVPMatchEnd() : base(ServerOpcodes.PvpMatchEnd, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt8(Winner);
_worldPacket.WriteInt32(Duration);
_worldPacket.WriteBit(LogData.HasValue);
_worldPacket.FlushBits();
if (LogData.HasValue)
LogData.Value.Write(_worldPacket);
}
public byte Winner;
public int Duration;
public Optional<PVPLogData> LogData;
}
//Structs
public class PVPLogData
{
public List<PVPMatchPlayerStatistics> Statistics = new List<PVPMatchPlayerStatistics>();
public Optional<RatingData> Ratings;
public sbyte[] PlayerCount = new sbyte[2];
public class RatingData
{
public void Write(WorldPacket data)
{
foreach (var id in Prematch)
data.WriteUInt32(id);
foreach (var id in Postmatch)
data.WriteUInt32(id);
foreach (var id in PrematchMMR)
data.WriteUInt32(id);
}
public uint[] Prematch = new uint[2];
public uint[] Postmatch = new uint[2];
public uint[] PrematchMMR = new uint[2];
}
public struct HonorData
{
public void Write(WorldPacket data)
{
data.WriteUInt32(HonorKills);
data.WriteUInt32(Deaths);
data.WriteUInt32(ContributionPoints);
}
public uint HonorKills;
public uint Deaths;
public uint ContributionPoints;
}
public struct PVPMatchPlayerPVPStat
{
public int PvpStatID;
public uint PvpStatValue;
public PVPMatchPlayerPVPStat(int pvpStatID, uint pvpStatValue)
{
PvpStatID = pvpStatID;
PvpStatValue = pvpStatValue;
}
public void Write(WorldPacket data)
{
data.WriteInt32(PvpStatID);
data.WriteUInt32(PvpStatValue);
}
}
public class PVPMatchPlayerStatistics
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(PlayerGUID);
data.WriteUInt32(Kills);
data.WriteUInt32(DamageDone);
data.WriteUInt32(HealingDone);
data.WriteInt32(Stats.Count);
data.WriteInt32(PrimaryTalentTree);
data.WriteInt32(Sex);
data.WriteUInt32((uint)PlayerRace);
data.WriteInt32(PlayerClass);
data.WriteInt32(CreatureID);
data.WriteInt32(HonorLevel);
foreach (var pvpStat in Stats)
pvpStat.Write(data);
data.WriteBit(Faction);
data.WriteBit(IsInWorld);
data.WriteBit(Honor.HasValue);
data.WriteBit(PreMatchRating.HasValue);
data.WriteBit(RatingChange.HasValue);
data.WriteBit(PreMatchMMR.HasValue);
data.WriteBit(MmrChange.HasValue);
data.FlushBits();
if (Honor.HasValue)
Honor.Value.Write(data);
if (PreMatchRating.HasValue)
data.WriteUInt32(PreMatchRating.Value);
if (RatingChange.HasValue)
data.WriteInt32(RatingChange.Value);
if (PreMatchMMR.HasValue)
data.WriteUInt32(PreMatchMMR.Value);
if (MmrChange.HasValue)
data.WriteInt32(MmrChange.Value);
}
public ObjectGuid PlayerGUID;
public uint Kills;
public byte Faction;
public bool IsInWorld;
public Optional<HonorData> Honor;
public uint DamageDone;
public uint HealingDone;
public Optional<uint> PreMatchRating;
public Optional<int> RatingChange;
public Optional<uint> PreMatchMMR;
public Optional<int> MmrChange;
public List<PVPMatchPlayerPVPStat> Stats = new List<PVPMatchPlayerPVPStat>();
public int PrimaryTalentTree;
public int Sex;
public Race PlayerRace;
public int PlayerClass;
public int CreatureID;
public int HonorLevel;
}
public void Write(WorldPacket data)
{
data.WriteBit(Ratings.HasValue);
data.WriteInt32(Statistics.Count);
foreach (var count in PlayerCount)
data.WriteInt8(count);
if (Ratings.HasValue)
Ratings.Value.Write(data);
foreach (var player in Statistics)
player.Write(data);
}
}
public class BattlefieldStatusHeader
{
public void Write(WorldPacket data)
{
Ticket.Write(data);
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 List<ulong> QueueID = new List<ulong>();
public byte RangeMin;
public byte RangeMax;
public byte TeamSize;
public uint InstanceID;
public bool RegisteredMatch;
public bool TournamentRules;
}
public struct BattlegroundPlayerPosition
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WriteVector2(Pos);
data.WriteInt8(IconID);
data.WriteInt8(ArenaSlot);
}
public ObjectGuid Guid;
public Vector2 Pos;
public sbyte IconID;
public sbyte ArenaSlot;
}
}
@@ -0,0 +1,301 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class BattlePetJournal : ServerPacket
{
public BattlePetJournal() : base(ServerOpcodes.BattlePetJournal) { }
public override void Write()
{
_worldPacket.WriteUInt16(Trap);
_worldPacket.WriteInt32(Slots.Count);
_worldPacket.WriteInt32(Pets.Count);
_worldPacket.WriteInt32(MaxPets);
_worldPacket.WriteBit(HasJournalLock);
_worldPacket.FlushBits();
foreach (var slot in Slots)
slot.Write(_worldPacket);
foreach (var pet in Pets)
pet.Write(_worldPacket);
}
public ushort Trap;
bool HasJournalLock = true;
public List<BattlePetSlot> Slots = new List<BattlePetSlot>();
public List<BattlePetStruct> Pets = new List<BattlePetStruct>();
int MaxPets = 1000;
}
class BattlePetJournalLockAcquired : ServerPacket
{
public BattlePetJournalLockAcquired() : base(ServerOpcodes.BattlePetJournalLockAcquired) { }
public override void Write() { }
}
class BattlePetRequestJournal : ClientPacket
{
public BattlePetRequestJournal(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class BattlePetUpdates : ServerPacket
{
public BattlePetUpdates() : base(ServerOpcodes.BattlePetUpdates) { }
public override void Write()
{
_worldPacket.WriteInt32(Pets.Count);
_worldPacket.WriteBit(PetAdded);
_worldPacket.FlushBits();
foreach (var pet in Pets)
pet.Write(_worldPacket);
}
public List<BattlePetStruct> Pets = new List<BattlePetStruct>();
public bool PetAdded;
}
class PetBattleSlotUpdates : ServerPacket
{
public PetBattleSlotUpdates() : base(ServerOpcodes.PetBattleSlotUpdates) { }
public override void Write()
{
_worldPacket.WriteInt32(Slots.Count);
_worldPacket.WriteBit(NewSlot);
_worldPacket.WriteBit(AutoSlotted);
_worldPacket.FlushBits();
foreach (var slot in Slots)
slot.Write(_worldPacket);
}
public List<BattlePetSlot> Slots = new List<BattlePetSlot>();
public bool AutoSlotted;
public bool NewSlot;
}
class BattlePetSetBattleSlot : ClientPacket
{
public BattlePetSetBattleSlot(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
Slot = _worldPacket.ReadUInt8();
}
public ObjectGuid PetGuid;
public byte Slot;
}
class BattlePetModifyName : ClientPacket
{
public BattlePetModifyName(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
uint nameLength = _worldPacket.ReadBits<uint>(7);
if (_worldPacket.HasBit())
{
Declined = new DeclinedName();
byte[] declinedNameLengths = new byte[SharedConst.MaxDeclinedNameCases];
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
declinedNameLengths[i] = _worldPacket.ReadBits<byte>(7);
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
Declined.name[i] = _worldPacket.ReadString(declinedNameLengths[i]);
}
Name = _worldPacket.ReadString(nameLength);
}
public ObjectGuid PetGuid;
public string Name;
public DeclinedName Declined;
}
class BattlePetDeletePet : ClientPacket
{
public BattlePetDeletePet(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetGuid;
}
class BattlePetSetFlags : ClientPacket
{
public BattlePetSetFlags(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
Flags = _worldPacket.ReadUInt32();
ControlType = (FlagsControlType)_worldPacket.ReadBits<byte>(2);
}
public ObjectGuid PetGuid;
public uint Flags;
public FlagsControlType ControlType;
}
class CageBattlePet : ClientPacket
{
public CageBattlePet(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetGuid;
}
class BattlePetDeleted : ServerPacket
{
public BattlePetDeleted() : base(ServerOpcodes.BattlePetDeleted) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PetGuid);
}
public ObjectGuid PetGuid;
}
class BattlePetErrorPacket : ServerPacket
{
public BattlePetErrorPacket() : base(ServerOpcodes.BattlePetError) { }
public override void Write()
{
_worldPacket.WriteBits(Result, 3);
_worldPacket.WriteUInt32(CreatureID);
}
public BattlePetError Result;
public uint CreatureID;
}
class BattlePetSummon : ClientPacket
{
public BattlePetSummon(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetGuid;
}
//Structs
public struct BattlePetStruct
{
public void Write(WorldPacket data)
{
data .WritePackedGuid( Guid);
data.WriteUInt32(Species);
data.WriteUInt32(CreatureID);
data.WriteUInt32(CollarID);
data.WriteUInt16(Breed);
data.WriteUInt16(Level);
data.WriteUInt16(Exp);
data.WriteUInt16(Flags);
data.WriteUInt32(Power);
data.WriteUInt32(Health);
data.WriteUInt32(MaxHealth);
data .WriteUInt32( Speed);
data .WriteUInt8( Quality);
data.WriteBits(Name.GetByteCount(), 7);
data.WriteBit(OwnerInfo.HasValue); // HasOwnerInfo
data.WriteBit(Name.IsEmpty()); // NoRename
data.FlushBits();
data.WriteString(Name);
if (OwnerInfo.HasValue)
{
data.WritePackedGuid(OwnerInfo.Value.Guid);
data.WriteUInt32(OwnerInfo.Value.PlayerVirtualRealm); // Virtual
data.WriteUInt32(OwnerInfo.Value.PlayerNativeRealm); // Native
}
}
public struct BattlePetOwnerInfo
{
public ObjectGuid Guid;
public uint PlayerVirtualRealm;
public uint PlayerNativeRealm;
}
public ObjectGuid Guid;
public uint Species;
public uint CreatureID;
public uint CollarID;
public ushort Breed;
public ushort Level;
public ushort Exp;
public ushort Flags;
public uint Power;
public uint Health;
public uint MaxHealth;
public uint Speed;
public byte Quality;
public Optional<BattlePetOwnerInfo> OwnerInfo;
public string Name;
}
public class BattlePetSlot
{
public void Write(WorldPacket data)
{
data .WritePackedGuid(Pet.Guid.IsEmpty() ? ObjectGuid.Create(HighGuid.BattlePet, 0) : Pet.Guid);
data .WriteUInt32( CollarID);
data .WriteUInt8( Index);
data.WriteBit(Locked);
data.FlushBits();
}
public BattlePetStruct Pet;
public uint CollarID;
public byte Index;
public bool Locked = true;
}
}
@@ -0,0 +1,179 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
namespace Game.Networking.Packets
{
class BFMgrEntryInvite : ServerPacket
{
public BFMgrEntryInvite() : base(ServerOpcodes.None) { }
public override void Write()
{
_worldPacket.WriteUInt64(QueueID);
_worldPacket.WriteInt32(AreaID);
_worldPacket.WriteUInt32((uint)ExpireTime);
}
public ulong QueueID;
public int AreaID;
public long ExpireTime;
}
class BFMgrEntryInviteResponse : ClientPacket
{
public BFMgrEntryInviteResponse(WorldPacket packet) : base(packet) { }
public override void Read()
{
QueueID = _worldPacket.ReadUInt64();
AcceptedInvite = _worldPacket.HasBit();
}
public ulong QueueID;
public bool AcceptedInvite;
}
class BFMgrQueueInvite : ServerPacket
{
public BFMgrQueueInvite() : base(ServerOpcodes.None) { }
public override void Write()
{
_worldPacket.WriteUInt64(QueueID);
_worldPacket.WriteInt8((sbyte)BattleState);
_worldPacket.WriteUInt32(Timeout);
_worldPacket.WriteInt32(MinLevel);
_worldPacket.WriteInt32(MaxLevel);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32(InstanceID);
_worldPacket.WriteBit(Index);
_worldPacket.FlushBits();
}
public ulong QueueID;
public BattlefieldState BattleState;
public uint Timeout = uint.MaxValue; // unused in client
public int MinLevel; // unused in client
public int MaxLevel; // unused in client
public int MapID; // unused in client
public uint InstanceID; // unused in client
public sbyte Index; // unused in client
}
class BFMgrQueueInviteResponse : ClientPacket
{
public BFMgrQueueInviteResponse(WorldPacket packet) : base(packet) { }
public override void Read()
{
QueueID = _worldPacket.ReadUInt64();
AcceptedInvite = _worldPacket.HasBit();
}
public ulong QueueID;
public bool AcceptedInvite;
}
class BFMgrQueueRequestResponse : ServerPacket
{
public BFMgrQueueRequestResponse() : base(ServerOpcodes.None) { }
public override void Write()
{
_worldPacket.WriteUInt64(QueueID);
_worldPacket.WriteInt32(AreaID);
_worldPacket.WriteInt8(Result);
_worldPacket.WritePackedGuid(FailedPlayerGUID);
_worldPacket.WriteInt8((sbyte)BattleState);
_worldPacket.WriteBit(LoggingIn);
_worldPacket.FlushBits();
}
public ulong QueueID;
public int AreaID;
public sbyte Result;
public ObjectGuid FailedPlayerGUID;
public BattlefieldState BattleState;
public bool LoggingIn;
}
class BFMgrQueueExitRequest : ClientPacket
{
public BFMgrQueueExitRequest(WorldPacket packet) : base(packet) { }
public override void Read()
{
QueueID = _worldPacket.ReadUInt64();
}
public ulong QueueID;
}
class BFMgrEntering : ServerPacket
{
public BFMgrEntering() : base(ServerOpcodes.None, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBit(ClearedAFK);
_worldPacket.WriteBit(Relocated);
_worldPacket.WriteBit(OnOffense);
_worldPacket.WriteUInt64(QueueID);
}
public bool ClearedAFK;
public bool Relocated;
public bool OnOffense;
public ulong QueueID;
}
class BFMgrEjected : ServerPacket
{
public BFMgrEjected() : base(ServerOpcodes.None, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt64(QueueID);
_worldPacket.WriteInt8((sbyte)Reason);
_worldPacket.WriteInt8((sbyte)BattleState);
_worldPacket.WriteBit(Relocated);
_worldPacket.FlushBits();
}
public ulong QueueID;
public BFLeaveReason Reason;
public BattlefieldState BattleState;
public bool Relocated;
}
public class AreaSpiritHealerTime : ServerPacket
{
public AreaSpiritHealerTime() : base(ServerOpcodes.AreaSpiritHealerTime) { }
public override void Write()
{
_worldPacket.WritePackedGuid(HealerGuid);
_worldPacket.WriteUInt32(TimeLeft);
}
public ObjectGuid HealerGuid;
public uint TimeLeft;
}
}
@@ -0,0 +1,142 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class Notification : ServerPacket
{
public Notification() : base(ServerOpcodes.BattlenetNotification) { }
public override void Write()
{
Method.Write(_worldPacket);
_worldPacket.WriteUInt32(Data.GetSize());
_worldPacket.WriteBytes(Data);
}
public MethodCall Method;
public ByteBuffer Data = new ByteBuffer();
}
class Response : ServerPacket
{
public Response() : base(ServerOpcodes.BattlenetResponse) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)BnetStatus);
Method.Write(_worldPacket);
_worldPacket.WriteUInt32(Data.GetSize());
_worldPacket.WriteBytes(Data);
}
public BattlenetRpcErrorCode BnetStatus = BattlenetRpcErrorCode.Ok;
public MethodCall Method;
public ByteBuffer Data = new ByteBuffer();
}
class SetSessionState : ServerPacket
{
public SetSessionState() : base(ServerOpcodes.BattlenetSetSessionState) { }
public override void Write()
{
_worldPacket.WriteBits(State, 2);
_worldPacket.WriteBit(SuppressNotification);
_worldPacket.FlushBits();
}
public byte State;
public bool SuppressNotification;
}
class RealmListTicket : ServerPacket
{
public RealmListTicket() : base(ServerOpcodes.BattlenetRealmListTicket) { }
public override void Write()
{
_worldPacket.WriteUInt32(Token);
_worldPacket.WriteBit(Allow);
_worldPacket.WriteUInt32(Ticket.GetSize());
_worldPacket.WriteBytes(Ticket);
}
public uint Token;
public bool Allow = true;
public ByteBuffer Ticket;
}
class BattlenetRequest : ClientPacket
{
public BattlenetRequest(WorldPacket packet) : base(packet) { }
public override void Read()
{
Method.Read(_worldPacket);
uint protoSize = _worldPacket.ReadUInt32();
Data = _worldPacket.ReadBytes(protoSize);
}
public MethodCall Method;
public byte[] Data;
}
class RequestRealmListTicket : ClientPacket
{
public RequestRealmListTicket(WorldPacket packet) : base(packet) { }
public override void Read()
{
Token = _worldPacket.ReadUInt32();
for (var i = 0; i < Secret.GetLimit(); ++i)
Secret[i] = _worldPacket.ReadUInt8();
}
public uint Token;
public Array<byte> Secret = new Array<byte>(32);
}
struct MethodCall
{
public uint GetServiceHash() { return (uint)(Type >> 32); }
public uint GetMethodId() { return (uint)(Type & 0xFFFFFFFF); }
public void Read(ByteBuffer data)
{
Type = data.ReadUInt64();
ObjectId = data.ReadUInt64();
Token = data.ReadUInt32();
}
public void Write(ByteBuffer data)
{
data.WriteUInt64(Type);
data.WriteUInt64(ObjectId);
data.WriteUInt32(Token);
}
public ulong Type;
public ulong ObjectId;
public uint Token;
}
}
@@ -0,0 +1,190 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class BlackMarketOpen : ClientPacket
{
public BlackMarketOpen(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
class BlackMarketOpenResult : ServerPacket
{
public BlackMarketOpenResult() : base(ServerOpcodes.BlackMarketOpenResult) { }
public override void Write()
{
_worldPacket .WritePackedGuid(Guid);
_worldPacket.WriteBit(Enable);
_worldPacket.FlushBits();
}
public ObjectGuid Guid;
public bool Enable = true;
}
class BlackMarketRequestItems : ClientPacket
{
public BlackMarketRequestItems(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
LastUpdateID = _worldPacket.ReadUInt32();
}
public ObjectGuid Guid;
public uint LastUpdateID;
}
public class BlackMarketRequestItemsResult : ServerPacket
{
public BlackMarketRequestItemsResult() : base(ServerOpcodes.BlackMarketRequestItemsResult) { }
public override void Write()
{
_worldPacket.WriteInt32(LastUpdateID);
_worldPacket.WriteInt32(Items.Count);
foreach (BlackMarketItem item in Items)
item.Write(_worldPacket);
}
public int LastUpdateID;
public List<BlackMarketItem> Items = new List<BlackMarketItem>();
}
class BlackMarketBidOnItem : ClientPacket
{
public BlackMarketBidOnItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
MarketID = _worldPacket.ReadUInt32();
BidAmount = _worldPacket.ReadUInt64();
Item.Read(_worldPacket);
}
public ObjectGuid Guid;
public uint MarketID;
public ItemInstance Item = new ItemInstance();
public ulong BidAmount;
}
class BlackMarketBidOnItemResult : ServerPacket
{
public BlackMarketBidOnItemResult() : base(ServerOpcodes.BlackMarketBidOnItemResult) { }
public override void Write()
{
_worldPacket.WriteUInt32(MarketID);
_worldPacket.WriteUInt32((uint)Result);
Item.Write(_worldPacket);
}
public uint MarketID;
public ItemInstance Item;
public BlackMarketError Result;
}
class BlackMarketOutbid : ServerPacket
{
public BlackMarketOutbid() : base(ServerOpcodes.BlackMarketOutbid) { }
public override void Write()
{
_worldPacket.WriteUInt32(MarketID);
_worldPacket.WriteUInt32(RandomPropertiesID);
Item.Write(_worldPacket);
}
public uint MarketID;
public ItemInstance Item;
public uint RandomPropertiesID;
}
class BlackMarketWon : ServerPacket
{
public BlackMarketWon() : base(ServerOpcodes.BlackMarketWon) { }
public override void Write()
{
_worldPacket.WriteUInt32(MarketID);
_worldPacket.WriteInt32(RandomPropertiesID);
Item.Write(_worldPacket);
}
public uint MarketID;
public ItemInstance Item;
public int RandomPropertiesID;
}
public struct BlackMarketItem
{
public void Read(WorldPacket data)
{
MarketID = data.ReadUInt32();
SellerNPC = data.ReadUInt32();
Item.Read(data);
Quantity = data.ReadUInt32();
MinBid = data.ReadUInt64();
MinIncrement = data.ReadUInt64();
CurrentBid = data.ReadUInt64();
SecondsRemaining = data.ReadUInt32();
NumBids = data.ReadUInt32();
HighBid = data.HasBit();
}
public void Write(WorldPacket data)
{
data.WriteUInt32(MarketID);
data.WriteUInt32(SellerNPC);
data.WriteUInt32(Quantity);
data.WriteUInt64(MinBid);
data.WriteUInt64(MinIncrement);
data.WriteUInt64(CurrentBid);
data.WriteUInt32(SecondsRemaining);
data.WriteUInt32(NumBids);
Item.Write(data);
data.WriteBit(HighBid);
data.FlushBits();
}
public uint MarketID;
public uint SellerNPC;
public ItemInstance Item;
public uint Quantity;
public ulong MinBid;
public ulong MinIncrement;
public ulong CurrentBid;
public uint SecondsRemaining;
public uint NumBids;
public bool HighBid;
}
}
@@ -0,0 +1,931 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
using Framework.Dynamic;
namespace Game.Networking.Packets
{
class CalendarGetCalendar : ClientPacket
{
public CalendarGetCalendar(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class CalendarGetEvent : ClientPacket
{
public CalendarGetEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
}
public ulong EventID;
}
class CalendarCommunityFilter : ClientPacket
{
public CalendarCommunityFilter(WorldPacket packet) : base(packet) { }
public override void Read()
{
ClubId = _worldPacket.ReadUInt64();
MinLevel = _worldPacket.ReadUInt8();
MaxLevel = _worldPacket.ReadUInt8();
MaxRankOrder = _worldPacket.ReadUInt8();
}
public ulong ClubId;
public byte MinLevel = 1;
public byte MaxLevel = 100;
public byte MaxRankOrder;
}
class CalendarAddEvent : ClientPacket
{
public CalendarAddEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventInfo.Read(_worldPacket);
MaxSize = _worldPacket.ReadUInt32();
}
public uint MaxSize = 100;
public CalendarAddEventInfo EventInfo = new CalendarAddEventInfo();
}
class CalendarUpdateEvent : ClientPacket
{
public CalendarUpdateEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventInfo.Read(_worldPacket);
MaxSize = _worldPacket.ReadUInt32();
}
public uint MaxSize;
public CalendarUpdateEventInfo EventInfo;
}
class CalendarRemoveEvent : ClientPacket
{
public CalendarRemoveEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
ClubID = _worldPacket.ReadUInt64();
Flags = _worldPacket.ReadUInt32();
}
public ulong ModeratorID;
public ulong EventID;
public ulong ClubID;
public uint Flags;
}
class CalendarCopyEvent : ClientPacket
{
public CalendarCopyEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
EventClubID = _worldPacket.ReadUInt64();
Date = _worldPacket.ReadPackedTime();
}
public ulong ModeratorID;
public ulong EventID;
public ulong EventClubID;
public long Date;
}
class SCalendarEventInvite : ServerPacket
{
public SCalendarEventInvite() : base(ServerOpcodes.CalendarEventInvite) { }
public override void Write()
{
_worldPacket.WritePackedGuid(InviteGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteUInt64(InviteID);
_worldPacket.WriteUInt8(Level);
_worldPacket.WriteUInt8((byte)Status);
_worldPacket.WriteUInt8(Type);
_worldPacket.WritePackedTime(ResponseTime);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
}
public ulong InviteID;
public long ResponseTime;
public byte Level = 100;
public ObjectGuid InviteGuid;
public ulong EventID;
public byte Type;
public bool ClearPending;
public CalendarInviteStatus Status;
}
class CalendarSendCalendar : ServerPacket
{
public CalendarSendCalendar() : base(ServerOpcodes.CalendarSendCalendar) { }
public override void Write()
{
_worldPacket.WritePackedTime(ServerTime);
_worldPacket.WriteInt32(Invites.Count);
_worldPacket.WriteInt32(Events.Count);
_worldPacket.WriteInt32(RaidLockouts.Count);
foreach (var invite in Invites)
invite.Write(_worldPacket);
foreach (var lockout in RaidLockouts)
lockout.Write(_worldPacket);
foreach (var Event in Events)
Event.Write(_worldPacket);
}
public long ServerTime;
public List<CalendarSendCalendarInviteInfo> Invites = new List<CalendarSendCalendarInviteInfo>();
public List<CalendarSendCalendarRaidLockoutInfo> RaidLockouts = new List<CalendarSendCalendarRaidLockoutInfo>();
public List<CalendarSendCalendarEventInfo> Events = new List<CalendarSendCalendarEventInfo>();
}
class CalendarSendEvent : ServerPacket
{
public CalendarSendEvent() : base(ServerOpcodes.CalendarSendEvent) { }
public override void Write()
{
_worldPacket.WriteUInt8((byte)EventType);
_worldPacket.WritePackedGuid(OwnerGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteUInt8((byte)GetEventType);
_worldPacket.WriteInt32(TextureID);
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32((uint)LockDate);
_worldPacket.WritePackedGuid(EventGuildID);
_worldPacket.WriteInt32(Invites.Count);
_worldPacket.WriteBits(EventName.GetByteCount(), 8);
_worldPacket.WriteBits(Description.GetByteCount(), 11);
_worldPacket.FlushBits();
foreach (var invite in Invites)
invite.Write(_worldPacket);
_worldPacket.WriteString(EventName);
_worldPacket.WriteString(Description);
}
public ObjectGuid OwnerGuid;
public ObjectGuid EventGuildID;
public ulong EventID;
public long Date;
public long LockDate;
public CalendarFlags Flags;
public int TextureID;
public CalendarEventType GetEventType;
public CalendarSendEventType EventType;
public string Description;
public string EventName;
public List<CalendarEventInviteInfo> Invites = new List<CalendarEventInviteInfo>();
}
class CalendarEventInviteAlert : ServerPacket
{
public CalendarEventInviteAlert() : base(ServerOpcodes.CalendarEventInviteAlert) { }
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WriteUInt8((byte)EventType);
_worldPacket.WriteInt32(TextureID);
_worldPacket.WritePackedGuid(EventGuildID);
_worldPacket.WriteUInt64(InviteID);
_worldPacket.WriteUInt8((byte)Status);
_worldPacket.WriteUInt8((byte)ModeratorStatus);
// Todo: check order
_worldPacket.WritePackedGuid(InvitedByGuid);
_worldPacket.WritePackedGuid(OwnerGuid);
_worldPacket.WriteBits(EventName.GetByteCount(), 8);
_worldPacket.FlushBits();
_worldPacket.WriteString(EventName);
}
public ObjectGuid OwnerGuid;
public ObjectGuid EventGuildID;
public ObjectGuid InvitedByGuid;
public ulong InviteID;
public ulong EventID;
public CalendarFlags Flags;
public long Date;
public int TextureID;
public CalendarInviteStatus Status;
public CalendarEventType EventType;
public CalendarModerationRank ModeratorStatus;
public string EventName;
}
class CalendarEventInvite : ClientPacket
{
public CalendarEventInvite(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
ClubID = _worldPacket.ReadUInt64();
ushort nameLen = _worldPacket.ReadBits<ushort>(9);
Creating = _worldPacket.HasBit();
IsSignUp = _worldPacket.HasBit();
Name = _worldPacket.ReadString(nameLen);
}
public ulong ModeratorID;
public bool IsSignUp;
public bool Creating = true;
public ulong EventID;
public ulong ClubID;
public string Name;
}
class CalendarEventRSVP : ClientPacket
{
public CalendarEventRSVP(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
InviteID = _worldPacket.ReadUInt64();
Status = (CalendarInviteStatus)_worldPacket.ReadUInt8();
}
public ulong InviteID;
public ulong EventID;
public CalendarInviteStatus Status;
}
class CalendarEventInviteStatus : ServerPacket
{
public CalendarEventInviteStatus() : base(ServerOpcodes.CalendarEventInviteStatus) { }
public override void Write()
{
_worldPacket.WritePackedGuid(InviteGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WriteUInt8((byte)Status);
_worldPacket.WritePackedTime(ResponseTime);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
}
public CalendarFlags Flags;
public ulong EventID;
public CalendarInviteStatus Status;
public bool ClearPending;
public long ResponseTime;
public long Date;
public ObjectGuid InviteGuid;
}
class CalendarEventInviteRemoved : ServerPacket
{
public CalendarEventInviteRemoved() : base(ServerOpcodes.CalendarEventInviteRemoved) { }
public override void Write()
{
_worldPacket.WritePackedGuid(InviteGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteUInt32(Flags);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
}
public ObjectGuid InviteGuid;
public ulong EventID;
public uint Flags;
public bool ClearPending;
}
class CalendarEventInviteModeratorStatus : ServerPacket
{
public CalendarEventInviteModeratorStatus() : base(ServerOpcodes.CalendarEventInviteModeratorStatus) { }
public override void Write()
{
_worldPacket.WritePackedGuid(InviteGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteUInt8((byte)Status);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
}
public ObjectGuid InviteGuid;
public ulong EventID;
public CalendarInviteStatus Status;
public bool ClearPending;
}
class CalendarEventInviteRemovedAlert : ServerPacket
{
public CalendarEventInviteRemovedAlert() : base(ServerOpcodes.CalendarEventInviteRemovedAlert) { }
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WriteUInt8((byte)Status);
}
public ulong EventID;
public long Date;
public CalendarFlags Flags;
public CalendarInviteStatus Status;
}
class CalendarClearPendingAction : ServerPacket
{
public CalendarClearPendingAction() : base(ServerOpcodes.CalendarClearPendingAction) { }
public override void Write() { }
}
class CalendarEventUpdatedAlert : ServerPacket
{
public CalendarEventUpdatedAlert() : base(ServerOpcodes.CalendarEventUpdatedAlert) { }
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(OriginalDate);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32((uint)LockDate);
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WriteInt32(TextureID);
_worldPacket.WriteUInt8((byte)EventType);
_worldPacket.WriteBits(EventName.GetByteCount(), 8);
_worldPacket.WriteBits(Description.GetByteCount(), 11);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
_worldPacket.WriteString(EventName);
_worldPacket.WriteString(Description);
}
public ulong EventID;
public long Date;
public CalendarFlags Flags;
public long LockDate;
public long OriginalDate;
public int TextureID;
public CalendarEventType EventType;
public bool ClearPending;
public string Description;
public string EventName;
}
class CalendarEventRemovedAlert : ServerPacket
{
public CalendarEventRemovedAlert() : base(ServerOpcodes.CalendarEventRemovedAlert) { }
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
}
public ulong EventID;
public long Date;
public bool ClearPending;
}
class CalendarSendNumPending : ServerPacket
{
public CalendarSendNumPending(uint numPending) : base(ServerOpcodes.CalendarSendNumPending)
{
NumPending = numPending;
}
public override void Write()
{
_worldPacket.WriteUInt32(NumPending);
}
public uint NumPending;
}
class CalendarGetNumPending : ClientPacket
{
public CalendarGetNumPending(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class CalendarEventSignUp : ClientPacket
{
public CalendarEventSignUp(WorldPacket packet) : base(packet) { }
public override void Read()
{
EventID = _worldPacket.ReadUInt64();
ClubID = _worldPacket.ReadUInt64();
Tentative = _worldPacket.HasBit();
}
public bool Tentative;
public ulong EventID;
public ulong ClubID;
}
class CalendarRemoveInvite : ClientPacket
{
public CalendarRemoveInvite(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
InviteID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
EventID = _worldPacket.ReadUInt64();
}
public ObjectGuid Guid;
public ulong EventID;
public ulong ModeratorID;
public ulong InviteID;
}
class CalendarEventStatus : ClientPacket
{
public CalendarEventStatus(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
EventID = _worldPacket.ReadUInt64();
InviteID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
Status = _worldPacket.ReadUInt8();
}
public ObjectGuid Guid;
public ulong EventID;
public ulong ModeratorID;
public ulong InviteID;
public byte Status;
}
class SetSavedInstanceExtend : ClientPacket
{
public SetSavedInstanceExtend(WorldPacket packet) : base(packet) { }
public override void Read()
{
MapID = _worldPacket.ReadInt32();
DifficultyID = _worldPacket.ReadUInt32();
Extend = _worldPacket.HasBit();
}
public int MapID;
public bool Extend;
public uint DifficultyID;
}
class CalendarEventModeratorStatus : ClientPacket
{
public CalendarEventModeratorStatus(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
EventID = _worldPacket.ReadUInt64();
InviteID = _worldPacket.ReadUInt64();
ModeratorID = _worldPacket.ReadUInt64();
Status = _worldPacket.ReadUInt8();
}
public ObjectGuid Guid;
public ulong EventID;
public ulong InviteID;
public ulong ModeratorID;
public byte Status;
}
class CalendarCommandResult : ServerPacket
{
public CalendarCommandResult() : base(ServerOpcodes.CalendarCommandResult) { }
public CalendarCommandResult(byte command, CalendarError result, string name) : base(ServerOpcodes.CalendarCommandResult)
{
Command = command;
Result = result;
Name = name;
}
public override void Write()
{
_worldPacket.WriteUInt8(Command);
_worldPacket.WriteUInt8((byte)Result);
_worldPacket.WriteBits(Name.GetByteCount(), 9);
_worldPacket.FlushBits();
_worldPacket.WriteString(Name);
}
public byte Command;
public CalendarError Result;
public string Name;
}
class CalendarRaidLockoutAdded : ServerPacket
{
public CalendarRaidLockoutAdded() : base(ServerOpcodes.CalendarRaidLockoutAdded) { }
public override void Write()
{
_worldPacket.WriteUInt64(InstanceID);
_worldPacket.WriteUInt32(ServerTime);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32((uint)DifficultyID);
_worldPacket.WriteInt32(TimeRemaining);
}
public ulong InstanceID;
public Difficulty DifficultyID;
public int TimeRemaining;
public uint ServerTime;
public int MapID;
}
class CalendarRaidLockoutRemoved : ServerPacket
{
public CalendarRaidLockoutRemoved() : base(ServerOpcodes.CalendarRaidLockoutRemoved) { }
public override void Write()
{
_worldPacket.WriteUInt64(InstanceID);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32((uint)DifficultyID);
}
public ulong InstanceID;
public int MapID;
public Difficulty DifficultyID;
}
class CalendarRaidLockoutUpdated : ServerPacket
{
public CalendarRaidLockoutUpdated() : base(ServerOpcodes.CalendarRaidLockoutUpdated) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)ServerTime);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32(DifficultyID);
_worldPacket.WriteInt32(NewTimeRemaining);
_worldPacket.WriteInt32(OldTimeRemaining);
}
public int MapID;
public int OldTimeRemaining;
public long ServerTime;
public uint DifficultyID;
public int NewTimeRemaining;
}
class CalendarEventInitialInvites : ServerPacket
{
public CalendarEventInitialInvites() : base(ServerOpcodes.CalendarEventInitialInvites) { }
public override void Write()
{
_worldPacket.WriteInt32(Invites.Count);
foreach (var invite in Invites)
{
_worldPacket.WritePackedGuid(invite.InviteGuid);
_worldPacket.WriteUInt8(invite.Level);
}
}
public List<CalendarEventInitialInviteInfo> Invites = new List<CalendarEventInitialInviteInfo>();
}
class CalendarEventInviteStatusAlert : ServerPacket
{
public CalendarEventInviteStatusAlert() : base(ServerOpcodes.CalendarEventInviteStatusAlert) { }
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WritePackedTime(Date);
_worldPacket.WriteUInt32(Flags);
_worldPacket.WriteUInt8(Status);
}
public ulong EventID;
public uint Flags;
public long Date;
public byte Status;
}
class CalendarEventInviteNotesAlert : ServerPacket
{
public CalendarEventInviteNotesAlert(ulong eventID, string notes) : base(ServerOpcodes.CalendarEventInviteNotesAlert)
{
EventID = eventID;
Notes = notes;
}
public override void Write()
{
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteBits(Notes.GetByteCount(), 8);
_worldPacket.FlushBits();
_worldPacket.WriteString(Notes);
}
public ulong EventID;
public string Notes;
}
class CalendarEventInviteNotes : ServerPacket
{
public CalendarEventInviteNotes() : base(ServerOpcodes.CalendarEventInviteNotes) { }
public override void Write()
{
_worldPacket.WritePackedGuid(InviteGuid);
_worldPacket.WriteUInt64(EventID);
_worldPacket.WriteBits(Notes.GetByteCount(), 8);
_worldPacket.WriteBit(ClearPending);
_worldPacket.FlushBits();
_worldPacket.WriteString(Notes);
}
public ObjectGuid InviteGuid;
public ulong EventID;
public string Notes = "";
public bool ClearPending;
}
class CalendarComplain : ClientPacket
{
public CalendarComplain(WorldPacket packet) : base(packet) { }
public override void Read()
{
InvitedByGUID = _worldPacket.ReadPackedGuid();
EventID = _worldPacket.ReadUInt64();
InviteID = _worldPacket.ReadUInt64();
}
ObjectGuid InvitedByGUID;
ulong InviteID;
ulong EventID;
}
//Structs
struct CalendarAddEventInviteInfo
{
public void Read(WorldPacket data)
{
Guid = data.ReadPackedGuid();
Status = data.ReadUInt8();
Moderator = data.ReadUInt8();
bool hasUnused801_1 = data.HasBit();
bool hasUnused801_2 = data.HasBit();
bool hasUnused801_3 = data.HasBit();
if (hasUnused801_1)
Unused801_1.Set(data.ReadPackedGuid());
if (hasUnused801_2)
Unused801_2.Set(data.ReadUInt64());
if (hasUnused801_3)
Unused801_3.Set(data.ReadUInt64());
}
public ObjectGuid Guid;
public byte Status;
public byte Moderator;
public Optional<ObjectGuid> Unused801_1;
public Optional<ulong> Unused801_2;
public Optional<ulong> Unused801_3;
}
class CalendarAddEventInfo
{
public void Read(WorldPacket data)
{
ClubId = data.ReadUInt64();
EventType = data.ReadUInt8();
TextureID = data.ReadInt32();
Time = data.ReadPackedTime();
Flags = data.ReadUInt32();
var InviteCount = data.ReadUInt32();
byte titleLength = data.ReadBits<byte>(8);
ushort descriptionLength = data.ReadBits<ushort>(11);
for (var i = 0; i < InviteCount; ++i)
{
CalendarAddEventInviteInfo invite = new CalendarAddEventInviteInfo();
invite.Read(data);
Invites[i] = invite;
}
Title = data.ReadString(titleLength);
Description = data.ReadString(descriptionLength);
}
public ulong ClubId;
public string Title;
public string Description;
public byte EventType;
public int TextureID;
public long Time;
public uint Flags;
public CalendarAddEventInviteInfo[] Invites = new CalendarAddEventInviteInfo[(int)SharedConst.CalendarMaxInvites];
}
struct CalendarUpdateEventInfo
{
public void Read(WorldPacket data)
{
ClubID = data.ReadUInt64();
EventID = data.ReadUInt64();
ModeratorID = data.ReadUInt64();
EventType = data.ReadUInt8();
TextureID = data.ReadUInt32();
Time = data.ReadPackedTime();
Flags = data.ReadUInt32();
byte titleLen = data.ReadBits<byte>(8);
ushort descLen = data.ReadBits<ushort>(11);
Title = data.ReadString(titleLen);
Description = data.ReadString(descLen);
}
public ulong ClubID;
public ulong EventID;
public ulong ModeratorID;
public string Title;
public string Description;
public byte EventType;
public uint TextureID;
public long Time;
public uint Flags;
}
struct CalendarSendCalendarInviteInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt64(EventID);
data.WriteUInt64(InviteID);
data.WriteUInt8((byte)Status);
data.WriteUInt8((byte)Moderator);
data.WriteUInt8(InviteType);
data.WritePackedGuid(InviterGuid);
}
public ulong EventID;
public ulong InviteID;
public ObjectGuid InviterGuid;
public CalendarInviteStatus Status;
public CalendarModerationRank Moderator;
public byte InviteType;
}
struct CalendarSendCalendarRaidLockoutInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt64(InstanceID);
data.WriteInt32(MapID);
data.WriteUInt32(DifficultyID);
data.WriteUInt32((uint)ExpireTime);
}
public ulong InstanceID;
public int MapID;
public uint DifficultyID;
public long ExpireTime;
}
struct CalendarSendCalendarEventInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt64(EventID);
data.WriteUInt8((byte)EventType);
data.WritePackedTime(Date);
data.WriteUInt32((uint)Flags);
data.WriteInt32(TextureID);
data.WriteUInt64(EventClubID);
data.WritePackedGuid(OwnerGuid);
data.WriteBits(EventName.GetByteCount(), 8);
data.FlushBits();
data.WriteString(EventName);
}
public ulong EventID;
public string EventName;
public CalendarEventType EventType;
public long Date;
public CalendarFlags Flags;
public int TextureID;
public ulong EventClubID;
public ObjectGuid OwnerGuid;
}
class CalendarEventInviteInfo
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WriteUInt64(InviteID);
data.WriteUInt8(Level);
data.WriteUInt8((byte)Status);
data.WriteUInt8((byte)Moderator);
data.WriteUInt8(InviteType);
data.WritePackedTime(ResponseTime);
data.WriteBits(Notes.GetByteCount(), 8);
data.FlushBits();
data.WriteString(Notes);
}
public ObjectGuid Guid;
public ulong InviteID;
public long ResponseTime;
public byte Level = 1;
public CalendarInviteStatus Status;
public CalendarModerationRank Moderator;
public byte InviteType;
public string Notes;
}
class CalendarEventInitialInviteInfo
{
public CalendarEventInitialInviteInfo(ObjectGuid inviteGuid, byte level)
{
InviteGuid = inviteGuid;
Level = level;
}
public ObjectGuid InviteGuid;
public byte Level = 100;
}
}
@@ -0,0 +1,327 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class ChannelListResponse : ServerPacket
{
public ChannelListResponse() : base(ServerOpcodes.ChannelList)
{
Members = new List<ChannelPlayer>();
}
public override void Write()
{
_worldPacket.WriteBit(Display);
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteUInt32((uint)ChannelFlags);
_worldPacket.WriteInt32(Members.Count);
_worldPacket.WriteString(Channel);
foreach (ChannelPlayer player in Members)
{
_worldPacket.WritePackedGuid(player.Guid);
_worldPacket.WriteUInt32(player.VirtualRealmAddress);
_worldPacket.WriteUInt8((byte)player.Flags);
}
}
public List<ChannelPlayer> Members;
public string Channel; // Channel Name
public ChannelFlags ChannelFlags;
public bool Display;
public struct ChannelPlayer
{
public ChannelPlayer(ObjectGuid guid, uint realm, ChannelMemberFlags flags)
{
Guid = guid;
VirtualRealmAddress = realm;
Flags = flags;
}
public ObjectGuid Guid; // Player Guid
public uint VirtualRealmAddress;
public ChannelMemberFlags Flags;
}
}
public class ChannelNotify : ServerPacket
{
public ChannelNotify() : base(ServerOpcodes.ChannelNotify) { }
public override void Write()
{
_worldPacket.WriteBits(Type, 6);
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteBits(Sender.GetByteCount(), 6);
_worldPacket.WritePackedGuid(SenderGuid);
_worldPacket.WritePackedGuid(SenderAccountID);
_worldPacket.WriteUInt32(SenderVirtualRealm);
_worldPacket.WritePackedGuid(TargetGuid);
_worldPacket.WriteUInt32(TargetVirtualRealm);
_worldPacket.WriteInt32(ChatChannelID);
if (Type == ChatNotify.ModeChangeNotice)
{
_worldPacket.WriteUInt8((byte)OldFlags);
_worldPacket.WriteUInt8((byte)NewFlags);
}
_worldPacket.WriteString(Channel);
_worldPacket.WriteString(Sender);
}
public string Sender = "";
public ObjectGuid SenderGuid;
public ObjectGuid SenderAccountID;
public ChatNotify Type;
public ChannelMemberFlags OldFlags;
public ChannelMemberFlags NewFlags;
public string Channel;
public uint SenderVirtualRealm;
public ObjectGuid TargetGuid;
public uint TargetVirtualRealm;
public int ChatChannelID;
}
public class ChannelNotifyJoined : ServerPacket
{
public ChannelNotifyJoined() : base(ServerOpcodes.ChannelNotifyJoined) { }
public override void Write()
{
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteBits(ChannelWelcomeMsg.GetByteCount(), 11);
_worldPacket.WriteUInt32((uint)ChannelFlags);
_worldPacket.WriteInt32(ChatChannelID);
_worldPacket.WriteUInt64((ulong)InstanceID);
_worldPacket.WritePackedGuid(ChannelGUID);
_worldPacket.WriteString(Channel);
_worldPacket.WriteString(ChannelWelcomeMsg);
}
public string ChannelWelcomeMsg = "";
public int ChatChannelID;
public int InstanceID;
public ChannelFlags ChannelFlags;
public string Channel = "";
public ObjectGuid ChannelGUID;
}
public class ChannelNotifyLeft : ServerPacket
{
public ChannelNotifyLeft() : base(ServerOpcodes.ChannelNotifyLeft) { }
public override void Write()
{
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteBit(Suspended);
_worldPacket.WriteUInt32(ChatChannelID);
_worldPacket.WriteString(Channel);
}
public string Channel;
public uint ChatChannelID;
public bool Suspended;
}
class UserlistAdd : ServerPacket
{
public UserlistAdd() : base(ServerOpcodes.UserlistAdd) { }
public override void Write()
{
_worldPacket.WritePackedGuid(AddedUserGUID);
_worldPacket.WriteUInt8((byte)UserFlags);
_worldPacket.WriteUInt32((uint)ChannelFlags);
_worldPacket.WriteUInt32(ChannelID);
_worldPacket.WriteBits(ChannelName.GetByteCount(), 7);
_worldPacket.FlushBits();
_worldPacket.WriteString(ChannelName);
}
public ObjectGuid AddedUserGUID;
public ChannelFlags ChannelFlags;
public ChannelMemberFlags UserFlags;
public uint ChannelID;
public string ChannelName;
}
class UserlistRemove : ServerPacket
{
public UserlistRemove() : base(ServerOpcodes.UserlistRemove) { }
public override void Write()
{
_worldPacket.WritePackedGuid(RemovedUserGUID);
_worldPacket.WriteUInt32((uint)ChannelFlags);
_worldPacket.WriteUInt32(ChannelID);
_worldPacket.WriteBits(ChannelName.GetByteCount(), 7);
_worldPacket.FlushBits();
_worldPacket.WriteString(ChannelName);
}
public ObjectGuid RemovedUserGUID;
public ChannelFlags ChannelFlags;
public uint ChannelID;
public string ChannelName;
}
class UserlistUpdate : ServerPacket
{
public UserlistUpdate() : base(ServerOpcodes.UserlistUpdate) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UpdatedUserGUID);
_worldPacket.WriteUInt8((byte)UserFlags);
_worldPacket.WriteUInt32((uint)ChannelFlags);
_worldPacket.WriteUInt32(ChannelID);
_worldPacket.WriteBits(ChannelName.GetByteCount(), 7);
_worldPacket.FlushBits();
_worldPacket.WriteString(ChannelName);
}
public ObjectGuid UpdatedUserGUID;
public ChannelFlags ChannelFlags;
public ChannelMemberFlags UserFlags;
public uint ChannelID;
public string ChannelName;
}
class ChannelCommand : ClientPacket
{
public ChannelCommand(WorldPacket packet) : base(packet)
{
switch (GetOpcode())
{
case ClientOpcodes.ChatChannelAnnouncements:
case ClientOpcodes.ChatChannelDeclineInvite:
case ClientOpcodes.ChatChannelDisplayList:
case ClientOpcodes.ChatChannelList:
case ClientOpcodes.ChatChannelOwner:
break;
default:
//ABORT();
break;
}
}
public override void Read()
{
ChannelName = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(7));
}
public string ChannelName;
}
class ChannelPlayerCommand : ClientPacket
{
public ChannelPlayerCommand(WorldPacket packet) : base(packet)
{
switch (GetOpcode())
{
case ClientOpcodes.ChatChannelBan:
case ClientOpcodes.ChatChannelInvite:
case ClientOpcodes.ChatChannelKick:
case ClientOpcodes.ChatChannelModerator:
case ClientOpcodes.ChatChannelSetOwner:
case ClientOpcodes.ChatChannelSilenceAll:
case ClientOpcodes.ChatChannelUnban:
case ClientOpcodes.ChatChannelUnmoderator:
case ClientOpcodes.ChatChannelUnsilenceAll:
break;
default:
//ABORT();
break;
}
}
public override void Read()
{
uint channelNameLength = _worldPacket.ReadBits<uint>(7);
uint nameLength = _worldPacket.ReadBits<uint>(9);
ChannelName = _worldPacket.ReadString(channelNameLength);
Name = _worldPacket.ReadString(nameLength);
}
public string ChannelName;
public string Name;
}
class ChannelPassword : ClientPacket
{
public ChannelPassword(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint channelNameLength = _worldPacket.ReadBits<uint>(7);
uint passwordLength = _worldPacket.ReadBits<uint>(7);
ChannelName = _worldPacket.ReadString(channelNameLength);
Password = _worldPacket.ReadString(passwordLength);
}
public string ChannelName;
public string Password;
}
public class JoinChannel : ClientPacket
{
public JoinChannel(WorldPacket packet) : base(packet) { }
public override void Read()
{
ChatChannelId = _worldPacket.ReadInt32();
CreateVoiceSession = _worldPacket.HasBit();
Internal = _worldPacket.HasBit();
uint channelLength = _worldPacket.ReadBits<uint>(7);
uint passwordLength = _worldPacket.ReadBits<uint>(7);
ChannelName = _worldPacket.ReadString(channelLength);
Password = _worldPacket.ReadString(passwordLength);
}
public string Password;
public string ChannelName;
public bool CreateVoiceSession;
public int ChatChannelId;
public bool Internal;
}
public class LeaveChannel : ClientPacket
{
public LeaveChannel(WorldPacket packet) : base(packet) { }
public override void Read()
{
ZoneChannelID = _worldPacket.ReadInt32();
ChannelName = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(7));
}
public int ZoneChannelID;
public string ChannelName;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,470 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using Game.Groups;
using System;
using Framework.Dynamic;
namespace Game.Networking.Packets
{
public class ChatMessage : ClientPacket
{
public ChatMessage(WorldPacket packet) : base(packet) { }
public override void Read()
{
Language = (Language)_worldPacket.ReadInt32();
uint len = _worldPacket.ReadBits<uint>(9);
Text = _worldPacket.ReadString(len);
}
public string Text;
public Language Language = Language.Universal;
}
public class ChatMessageWhisper : ClientPacket
{
public ChatMessageWhisper(WorldPacket packet) : base(packet) { }
public override void Read()
{
Language = (Language)_worldPacket.ReadInt32();
uint targetLen = _worldPacket.ReadBits<uint>(9);
uint textLen = _worldPacket.ReadBits<uint>(9);
Target = _worldPacket.ReadString(targetLen);
Text = _worldPacket.ReadString(textLen);
}
public Language Language = Language.Universal;
public string Text;
public string Target;
}
public class ChatMessageChannel : ClientPacket
{
public ChatMessageChannel(WorldPacket packet) : base(packet) { }
public override void Read()
{
Language = (Language)_worldPacket.ReadInt32();
uint targetLen = _worldPacket.ReadBits<uint>(9);
uint textLen = _worldPacket.ReadBits<uint>(9);
Target = _worldPacket.ReadString(targetLen);
Text = _worldPacket.ReadString(textLen);
}
public Language Language = Language.Universal;
public string Text;
public string Target;
}
public class ChatAddonMessage : ClientPacket
{
public ChatAddonMessage(WorldPacket packet) : base(packet) { }
public override void Read()
{
Params.Read(_worldPacket);
}
public ChatAddonMessageParams Params = new ChatAddonMessageParams();
}
class ChatAddonMessageTargeted : ClientPacket
{
public ChatAddonMessageTargeted(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint targetLen = _worldPacket.ReadBits<uint>(9);
Params.Read(_worldPacket);
Target = _worldPacket.ReadString(targetLen);
}
public string Target;
public ChatAddonMessageParams Params = new ChatAddonMessageParams();
}
public class ChatMessageDND : ClientPacket
{
public ChatMessageDND(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint len = _worldPacket.ReadBits<uint>(9);
Text = _worldPacket.ReadString(len);
}
public string Text;
}
public class ChatMessageAFK : ClientPacket
{
public ChatMessageAFK(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint len = _worldPacket.ReadBits<uint>(9);
Text = _worldPacket.ReadString(len);
}
public string Text;
}
public class ChatMessageEmote : ClientPacket
{
public ChatMessageEmote(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint len = _worldPacket.ReadBits<uint>(9);
Text = _worldPacket.ReadString(len);
}
public string Text;
}
public class ChatPkt : ServerPacket
{
public ChatPkt() : base(ServerOpcodes.Chat) { }
public void Initialize(ChatMsg chatType, Language language, WorldObject sender, WorldObject receiver, string message, uint achievementId = 0, string channelName = "", Locale locale = Locale.enUS, string addonPrefix = "")
{
// Clear everything because same packet can be used multiple times
Clear();
SenderGUID.Clear();
SenderAccountGUID.Clear();
SenderGuildGUID.Clear();
PartyGUID.Clear();
TargetGUID.Clear();
SenderName = "";
TargetName = "";
_ChatFlags = ChatFlags.None;
SlashCmd = chatType;
_Language = language;
if (sender)
SetSender(sender, locale);
if (receiver)
SetReceiver(receiver, locale);
SenderVirtualAddress = Global.WorldMgr.GetVirtualRealmAddress();
TargetVirtualAddress = Global.WorldMgr.GetVirtualRealmAddress();
AchievementID = achievementId;
Channel = channelName;
Prefix = addonPrefix;
ChatText = message;
}
void SetSender(WorldObject sender, Locale locale)
{
SenderGUID = sender.GetGUID();
Creature creatureSender = sender.ToCreature();
if (creatureSender)
SenderName = creatureSender.GetName(locale);
Player playerSender = sender.ToPlayer();
if (playerSender)
{
SenderAccountGUID = playerSender.GetSession().GetAccountGUID();
_ChatFlags = playerSender.GetChatFlags();
SenderGuildGUID = ObjectGuid.Create(HighGuid.Guild, playerSender.GetGuildId());
Group group = playerSender.GetGroup();
if (group)
PartyGUID = group.GetGUID();
}
}
public void SetReceiver(WorldObject receiver, Locale locale)
{
TargetGUID = receiver.GetGUID();
Creature creatureReceiver = receiver.ToCreature();
if (creatureReceiver)
TargetName = creatureReceiver.GetName(locale);
}
public override void Write()
{
_worldPacket.WriteUInt8((byte)SlashCmd);
_worldPacket.WriteUInt32((uint)_Language);
_worldPacket.WritePackedGuid(SenderGUID);
_worldPacket.WritePackedGuid(SenderGuildGUID);
_worldPacket.WritePackedGuid(SenderAccountGUID);
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WriteUInt32(TargetVirtualAddress);
_worldPacket.WriteUInt32(SenderVirtualAddress);
_worldPacket.WritePackedGuid(PartyGUID);
_worldPacket.WriteUInt32(AchievementID);
_worldPacket.WriteFloat(DisplayTime);
_worldPacket.WriteBits(SenderName.GetByteCount(), 11);
_worldPacket.WriteBits(TargetName.GetByteCount(), 11);
_worldPacket.WriteBits(Prefix.GetByteCount(), 5);
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
_worldPacket.WriteBits(ChatText.GetByteCount(), 12);
_worldPacket.WriteBits((byte)_ChatFlags, 11);
_worldPacket.WriteBit(HideChatLog);
_worldPacket.WriteBit(FakeSenderName);
_worldPacket.WriteBit(Unused_801.HasValue);
_worldPacket.FlushBits();
_worldPacket.WriteString(SenderName);
_worldPacket.WriteString(TargetName);
_worldPacket.WriteString(Prefix);
_worldPacket.WriteString(Channel);
_worldPacket.WriteString(ChatText);
if (Unused_801.HasValue)
_worldPacket.WriteUInt32(Unused_801.Value);
}
public ChatMsg SlashCmd = 0;
public Language _Language = Language.Universal;
public ObjectGuid SenderGUID;
public ObjectGuid SenderGuildGUID;
public ObjectGuid SenderAccountGUID;
public ObjectGuid TargetGUID;
public ObjectGuid PartyGUID;
public uint SenderVirtualAddress;
public uint TargetVirtualAddress;
public string SenderName = "";
public string TargetName = "";
public string Prefix = "";
public string Channel = "";
public string ChatText = "";
public uint AchievementID;
public ChatFlags _ChatFlags = 0;
public float DisplayTime = 0.0f;
public Optional<uint> Unused_801;
public bool HideChatLog = false;
public bool FakeSenderName = false;
}
public class EmoteMessage : ServerPacket
{
public EmoteMessage() : base(ServerOpcodes.Emote, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteInt32(EmoteID);
}
public ObjectGuid Guid;
public int EmoteID;
}
public class CTextEmote : ClientPacket
{
public CTextEmote(WorldPacket packet) : base(packet) { }
public override void Read()
{
Target = _worldPacket.ReadPackedGuid();
EmoteID = _worldPacket.ReadInt32();
SoundIndex = _worldPacket.ReadInt32();
}
public ObjectGuid Target;
public int EmoteID;
public int SoundIndex;
}
public class STextEmote : ServerPacket
{
public STextEmote() : base(ServerOpcodes.TextEmote, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(SourceGUID);
_worldPacket.WritePackedGuid(SourceAccountGUID);
_worldPacket.WriteInt32(EmoteID);
_worldPacket.WriteInt32(SoundIndex);
_worldPacket.WritePackedGuid(TargetGUID);
}
public ObjectGuid SourceGUID;
public ObjectGuid SourceAccountGUID;
public ObjectGuid TargetGUID;
public int SoundIndex = -1;
public int EmoteID;
}
public class PrintNotification : ServerPacket
{
public PrintNotification(string notifyText) : base(ServerOpcodes.PrintNotification)
{
NotifyText = notifyText;
}
public override void Write()
{
_worldPacket.WriteBits(NotifyText.GetByteCount(), 12);
_worldPacket.WriteString(NotifyText);
}
public string NotifyText;
}
public class EmoteClient : ClientPacket
{
public EmoteClient(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class ChatPlayerNotfound : ServerPacket
{
public ChatPlayerNotfound(string name) : base(ServerOpcodes.ChatPlayerNotfound)
{
Name = name;
}
public override void Write()
{
_worldPacket.WriteBits(Name.GetByteCount(), 9);
_worldPacket.WriteString(Name);
}
string Name;
}
class ChatPlayerAmbiguous : ServerPacket
{
public ChatPlayerAmbiguous(string name) : base(ServerOpcodes.ChatPlayerAmbiguous)
{
Name = name;
}
public override void Write()
{
_worldPacket.WriteBits(Name.GetByteCount(), 9);
_worldPacket.WriteString(Name);
}
string Name;
}
class ChatRestricted : ServerPacket
{
public ChatRestricted(ChatRestrictionType reason) : base(ServerOpcodes.ChatRestricted)
{
Reason = reason;
}
public override void Write()
{
_worldPacket.WriteUInt8((byte)Reason);
}
ChatRestrictionType Reason;
}
class ChatServerMessage : ServerPacket
{
public ChatServerMessage() : base(ServerOpcodes.ChatServerMessage) { }
public override void Write()
{
_worldPacket.WriteInt32(MessageID);
_worldPacket.WriteBits(StringParam.GetByteCount(), 11);
_worldPacket.WriteString(StringParam);
}
public int MessageID;
public string StringParam = "";
}
class ChatRegisterAddonPrefixes : ClientPacket
{
public ChatRegisterAddonPrefixes(WorldPacket packet) : base(packet) { }
public override void Read()
{
int count = _worldPacket.ReadInt32();
for (int i = 0; i < count && i < 64; ++i)
Prefixes[i] = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(5));
}
public string[] Prefixes = new string[64];
}
class ChatUnregisterAllAddonPrefixes : ClientPacket
{
public ChatUnregisterAllAddonPrefixes(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class DefenseMessage : ServerPacket
{
public DefenseMessage() : base(ServerOpcodes.DefenseMessage) { }
public override void Write()
{
_worldPacket.WriteUInt32(ZoneID);
_worldPacket.WriteBits(MessageText.GetByteCount(), 12);
_worldPacket.FlushBits();
_worldPacket.WriteString(MessageText);
}
public uint ZoneID;
public string MessageText = "";
}
class ChatReportIgnored : ClientPacket
{
public ChatReportIgnored(WorldPacket packet) : base(packet) { }
public override void Read()
{
IgnoredGUID = _worldPacket.ReadPackedGuid();
Reason = _worldPacket.ReadUInt8();
}
public ObjectGuid IgnoredGUID;
public byte Reason;
}
public class ChatAddonMessageParams
{
public void Read(WorldPacket data)
{
uint prefixLen = data.ReadBits<uint>(5);
uint textLen = data.ReadBits<uint>(8);
IsLogged = data.HasBit();
Type = (ChatMsg)data.ReadInt32();
Prefix = data.ReadString(prefixLen);
Text = data.ReadString(textLen);
}
public string Prefix;
public string Text;
public ChatMsg Type = ChatMsg.Party;
public bool IsLogged;
}
}
@@ -0,0 +1,126 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using Game.Entities;
namespace Game.Networking.Packets
{
public class AccountDataTimes : ServerPacket
{
public AccountDataTimes() : base(ServerOpcodes.AccountDataTimes) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PlayerGuid);
_worldPacket.WriteUInt32(ServerTime);
for (int i = 0; i < (int)AccountDataTypes.Max; ++i)
_worldPacket.WriteUInt32(AccountTimes[i]);
}
public ObjectGuid PlayerGuid;
public uint ServerTime = 0;
public uint[] AccountTimes = new uint[(int)AccountDataTypes.Max];
}
public class ClientCacheVersion : ServerPacket
{
public ClientCacheVersion() : base(ServerOpcodes.CacheVersion) { }
public override void Write()
{
_worldPacket.WriteUInt32(CacheVersion);
}
public uint CacheVersion = 0;
}
public class RequestAccountData : ClientPacket
{
public RequestAccountData(WorldPacket packet) : base(packet) { }
public override void Read()
{
PlayerGuid = _worldPacket.ReadPackedGuid();
DataType = (AccountDataTypes)_worldPacket.ReadBits<uint>(3);
}
public ObjectGuid PlayerGuid;
public AccountDataTypes DataType = 0;
}
public class UpdateAccountData : ServerPacket
{
public UpdateAccountData() : base(ServerOpcodes.UpdateAccountData) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteUInt32(Time);
_worldPacket.WriteUInt32(Size);
_worldPacket.WriteBits(DataType, 3);
var bytes = CompressedData.GetData();
_worldPacket.WriteInt32(bytes.Length);
_worldPacket.WriteBytes(bytes);
}
public ObjectGuid Player;
public uint Time = 0; // UnixTime
public uint Size = 0; // decompressed size
public AccountDataTypes DataType = 0;
public ByteBuffer CompressedData;
}
public class UserClientUpdateAccountData : ClientPacket
{
public UserClientUpdateAccountData(WorldPacket packet) : base(packet) { }
public override void Read()
{
PlayerGuid = _worldPacket.ReadPackedGuid();
Time = _worldPacket.ReadUInt32();
Size = _worldPacket.ReadUInt32();
DataType = (AccountDataTypes)_worldPacket.ReadBits<uint>(3);
uint compressedSize = _worldPacket.ReadUInt32();
if (compressedSize != 0)
{
CompressedData = new ByteBuffer(_worldPacket.ReadBytes(compressedSize));
}
}
public ObjectGuid PlayerGuid;
public uint Time; // UnixTime
public uint Size; // decompressed size
public AccountDataTypes DataType = 0;
public ByteBuffer CompressedData;
}
class SetAdvancedCombatLogging : ClientPacket
{
public SetAdvancedCombatLogging(WorldPacket packet) : base(packet) { }
public override void Read()
{
Enable = _worldPacket.HasBit();
}
public bool Enable;
}
}
@@ -0,0 +1,43 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Game.Networking.Packets
{
public enum CollectionType
{
None = -1,
Toybox = 1,
Appearance = 3,
TransmogSet = 4
}
class CollectionItemSetFavorite : ClientPacket
{
public CollectionItemSetFavorite(WorldPacket packet) : base(packet) { }
public override void Read()
{
Type = (CollectionType)_worldPacket.ReadUInt32();
Id = _worldPacket.ReadUInt32();
IsFavorite = _worldPacket.HasBit();
}
public CollectionType Type;
public uint Id;
public bool IsFavorite;
}
}
@@ -0,0 +1,716 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class CombatLogServerPacket : ServerPacket
{
public CombatLogServerPacket(ServerOpcodes opcode, ConnectionType connection = ConnectionType.Realm) : base(opcode, connection)
{
LogData = new SpellCastLogData();
}
public override void Write() { }
public void DisableAdvancedCombatLogging()
{
LogData = null;
}
public void WriteLogDataBit()
{
_worldPacket.WriteBit(LogData != null);
}
public void FlushBits()
{
_worldPacket.FlushBits();
}
public void WriteLogData()
{
if (LogData != null)
LogData.Write(_worldPacket);
}
internal SpellCastLogData LogData;
}
class SpellNonMeleeDamageLog : CombatLogServerPacket
{
public SpellNonMeleeDamageLog() : base(ServerOpcodes.SpellNonMeleeDamageLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Me);
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WritePackedGuid(CastID);
_worldPacket.WriteInt32(SpellID);
_worldPacket.WriteInt32(SpellXSpellVisualID);
_worldPacket.WriteInt32(Damage);
_worldPacket.WriteInt32(OriginalDamage);
_worldPacket.WriteInt32(Overkill);
_worldPacket.WriteUInt8(SchoolMask);
_worldPacket.WriteInt32(Absorbed);
_worldPacket.WriteInt32(Resisted);
_worldPacket.WriteInt32(ShieldBlock);
_worldPacket.WriteBit(Periodic);
_worldPacket.WriteBits(Flags, 7);
_worldPacket.WriteBit(false); // Debug info
WriteLogDataBit();
_worldPacket.WriteBit(ContentTuning.HasValue);
FlushBits();
WriteLogData();
if (ContentTuning.HasValue)
ContentTuning.Value.Write(_worldPacket);
}
public ObjectGuid Me;
public ObjectGuid CasterGUID;
public ObjectGuid CastID;
public int SpellID;
public int SpellXSpellVisualID;
public int Damage;
public int OriginalDamage;
public int Overkill = -1;
public byte SchoolMask;
public int ShieldBlock;
public int Resisted;
public bool Periodic;
public int Absorbed;
public int Flags;
// Optional<SpellNonMeleeDamageLogDebugInfo> DebugInfo;
public Optional<ContentTuningParams> ContentTuning = new Optional<ContentTuningParams>();
}
class EnvironmentalDamageLog : CombatLogServerPacket
{
public EnvironmentalDamageLog() : base(ServerOpcodes.EnvironmentalDamageLog) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Victim);
_worldPacket.WriteUInt8((byte)Type);
_worldPacket.WriteInt32(Amount);
_worldPacket.WriteInt32(Resisted);
_worldPacket.WriteInt32(Absorbed);
WriteLogDataBit();
FlushBits();
WriteLogData();
}
public ObjectGuid Victim;
public EnviromentalDamage Type;
public int Amount;
public int Resisted;
public int Absorbed;
}
class SpellExecuteLog : CombatLogServerPacket
{
public SpellExecuteLog() : base(ServerOpcodes.SpellExecuteLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteInt32(Effects.Count);
foreach (SpellLogEffect effect in Effects)
{
_worldPacket.WriteInt32(effect.Effect);
_worldPacket.WriteInt32(effect.PowerDrainTargets.Count);
_worldPacket.WriteInt32(effect.ExtraAttacksTargets.Count);
_worldPacket.WriteInt32(effect.DurabilityDamageTargets.Count);
_worldPacket.WriteInt32(effect.GenericVictimTargets.Count);
_worldPacket.WriteInt32(effect.TradeSkillTargets.Count);
_worldPacket.WriteInt32(effect.FeedPetTargets.Count);
foreach (SpellLogEffectPowerDrainParams powerDrainTarget in effect.PowerDrainTargets)
{
_worldPacket.WritePackedGuid(powerDrainTarget.Victim);
_worldPacket.WriteUInt32(powerDrainTarget.Points);
_worldPacket.WriteUInt32(powerDrainTarget.PowerType);
_worldPacket.WriteFloat(powerDrainTarget.Amplitude);
}
foreach (SpellLogEffectExtraAttacksParams extraAttacksTarget in effect.ExtraAttacksTargets)
{
_worldPacket.WritePackedGuid(extraAttacksTarget.Victim);
_worldPacket.WriteUInt32(extraAttacksTarget.NumAttacks);
}
foreach (SpellLogEffectDurabilityDamageParams durabilityDamageTarget in effect.DurabilityDamageTargets)
{
_worldPacket.WritePackedGuid(durabilityDamageTarget.Victim);
_worldPacket.WriteInt32(durabilityDamageTarget.ItemID);
_worldPacket.WriteInt32(durabilityDamageTarget.Amount);
}
foreach (SpellLogEffectGenericVictimParams genericVictimTarget in effect.GenericVictimTargets)
_worldPacket.WritePackedGuid(genericVictimTarget.Victim);
foreach (SpellLogEffectTradeSkillItemParams tradeSkillTarget in effect.TradeSkillTargets)
_worldPacket.WriteInt32(tradeSkillTarget.ItemID);
foreach (SpellLogEffectFeedPetParams feedPetTarget in effect.FeedPetTargets)
_worldPacket.WriteInt32(feedPetTarget.ItemID);
}
WriteLogDataBit();
FlushBits();
WriteLogData();
}
public ObjectGuid Caster;
public uint SpellID;
public List<SpellLogEffect> Effects = new List<SpellLogEffect>();
public class SpellLogEffect
{
public int Effect;
public List<SpellLogEffectPowerDrainParams> PowerDrainTargets = new List<SpellLogEffectPowerDrainParams>();
public List<SpellLogEffectExtraAttacksParams> ExtraAttacksTargets = new List<SpellLogEffectExtraAttacksParams>();
public List<SpellLogEffectDurabilityDamageParams> DurabilityDamageTargets = new List<SpellLogEffectDurabilityDamageParams>();
public List<SpellLogEffectGenericVictimParams> GenericVictimTargets = new List<SpellLogEffectGenericVictimParams>();
public List<SpellLogEffectTradeSkillItemParams> TradeSkillTargets = new List<SpellLogEffectTradeSkillItemParams>();
public List<SpellLogEffectFeedPetParams> FeedPetTargets = new List<SpellLogEffectFeedPetParams>();
}
}
class SpellHealLog : CombatLogServerPacket
{
public SpellHealLog() : base(ServerOpcodes.SpellHealLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt32(Health);
_worldPacket.WriteInt32(OriginalHeal);
_worldPacket.WriteUInt32(OverHeal);
_worldPacket.WriteUInt32(Absorbed);
_worldPacket.WriteBit(Crit);
_worldPacket.WriteBit(CritRollMade.HasValue);
_worldPacket.WriteBit(CritRollNeeded.HasValue);
WriteLogDataBit();
_worldPacket.WriteBit(ContentTuning.HasValue);
FlushBits();
WriteLogData();
if (CritRollMade.HasValue)
_worldPacket.WriteFloat(CritRollMade.Value);
if (CritRollNeeded.HasValue)
_worldPacket.WriteFloat(CritRollNeeded.Value);
if (ContentTuning.HasValue)
ContentTuning.Value.Write(_worldPacket);
}
public ObjectGuid CasterGUID;
public ObjectGuid TargetGUID;
public uint SpellID;
public uint Health;
public int OriginalHeal;
public uint OverHeal;
public uint Absorbed;
public bool Crit;
public Optional<float> CritRollMade;
public Optional<float> CritRollNeeded;
Optional<ContentTuningParams> ContentTuning = new Optional<ContentTuningParams>();
}
class SpellPeriodicAuraLog : CombatLogServerPacket
{
public SpellPeriodicAuraLog() : base(ServerOpcodes.SpellPeriodicAuraLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteInt32(Effects.Count);
WriteLogDataBit();
FlushBits();
Effects.ForEach(p => p.Write(_worldPacket));
WriteLogData();
}
public ObjectGuid TargetGUID;
public ObjectGuid CasterGUID;
public uint SpellID;
public List<SpellLogEffect> Effects = new List<SpellLogEffect>();
public struct PeriodicalAuraLogEffectDebugInfo
{
public float CritRollMade;
public float CritRollNeeded;
}
public class SpellLogEffect
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Effect);
data.WriteUInt32(Amount);
data.WriteInt32(OriginalDamage);
data.WriteUInt32(OverHealOrKill);
data.WriteUInt32(SchoolMaskOrPower);
data.WriteUInt32(AbsorbedOrAmplitude);
data.WriteUInt32(Resisted);
data.WriteBit(Crit);
data.WriteBit(DebugInfo.HasValue);
data.WriteBit(ContentTuning.HasValue);
data.FlushBits();
if (ContentTuning.HasValue)
ContentTuning.Value.Write(data);
if (DebugInfo.HasValue)
{
data.WriteFloat(DebugInfo.Value.CritRollMade);
data.WriteFloat(DebugInfo.Value.CritRollNeeded);
}
}
public uint Effect;
public uint Amount;
public int OriginalDamage;
public uint OverHealOrKill;
public uint SchoolMaskOrPower;
public uint AbsorbedOrAmplitude;
public uint Resisted;
public bool Crit;
public Optional<PeriodicalAuraLogEffectDebugInfo> DebugInfo;
public Optional<ContentTuningParams> ContentTuning = new Optional<ContentTuningParams>();
}
}
class SpellInterruptLog : ServerPacket
{
public SpellInterruptLog() : base(ServerOpcodes.SpellInterruptLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WritePackedGuid(Victim);
_worldPacket.WriteUInt32(InterruptedSpellID);
_worldPacket.WriteUInt32(SpellID);
}
public ObjectGuid Caster;
public ObjectGuid Victim;
public uint InterruptedSpellID;
public uint SpellID;
}
class SpellDispellLog : ServerPacket
{
public SpellDispellLog() : base(ServerOpcodes.SpellDispellLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBit(IsSteal);
_worldPacket.WriteBit(IsBreak);
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WriteUInt32(DispelledBySpellID);
_worldPacket.WriteInt32(DispellData.Count);
foreach (var data in DispellData)
{
_worldPacket.WriteUInt32(data.SpellID);
_worldPacket.WriteBit(data.Harmful);
_worldPacket.WriteBit(data.Rolled.HasValue);
_worldPacket.WriteBit(data.Needed.HasValue);
if (data.Rolled.HasValue)
_worldPacket.WriteInt32(data.Rolled.Value);
if (data.Needed.HasValue)
_worldPacket.WriteInt32(data.Needed.Value);
_worldPacket.FlushBits();
}
}
public List<SpellDispellData> DispellData = new List<SpellDispellData>();
public ObjectGuid CasterGUID;
public ObjectGuid TargetGUID;
public uint DispelledBySpellID;
public bool IsBreak;
public bool IsSteal;
}
class SpellEnergizeLog : CombatLogServerPacket
{
public SpellEnergizeLog() : base(ServerOpcodes.SpellEnergizeLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt32((uint)Type);
_worldPacket.WriteInt32(Amount);
_worldPacket.WriteInt32(OverEnergize);
WriteLogDataBit();
FlushBits();
WriteLogData();
}
public ObjectGuid TargetGUID;
public ObjectGuid CasterGUID;
public uint SpellID;
public PowerType Type;
public int Amount;
public int OverEnergize;
}
public class SpellInstakillLog : ServerPacket
{
public SpellInstakillLog() : base(ServerOpcodes.SpellInstakillLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Target);
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WriteUInt32(SpellID);
}
public ObjectGuid Target;
public ObjectGuid Caster;
public uint SpellID;
}
class SpellMissLog : ServerPacket
{
public SpellMissLog() : base(ServerOpcodes.SpellMissLog, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WriteInt32(Entries.Count);
foreach (SpellLogMissEntry missEntry in Entries)
missEntry.Write(_worldPacket);
}
public uint SpellID;
public ObjectGuid Caster;
public List<SpellLogMissEntry> Entries = new List<SpellLogMissEntry>();
}
class ProcResist : ServerPacket
{
public ProcResist() : base(ServerOpcodes.ProcResist) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WritePackedGuid(Target);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteBit(Rolled.HasValue);
_worldPacket.WriteBit(Needed.HasValue);
_worldPacket.FlushBits();
if (Rolled.HasValue)
_worldPacket.WriteFloat(Rolled.Value);
if (Needed.HasValue)
_worldPacket.WriteFloat(Needed.Value);
}
public ObjectGuid Caster;
public ObjectGuid Target;
public uint SpellID;
public Optional<float> Rolled;
public Optional<float> Needed;
}
class SpellOrDamageImmune : ServerPacket
{
public SpellOrDamageImmune() : base(ServerOpcodes.SpellOrDamageImmune, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(CasterGUID);
_worldPacket.WritePackedGuid(VictimGUID);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteBit(IsPeriodic);
_worldPacket.FlushBits();
}
public ObjectGuid CasterGUID;
public ObjectGuid VictimGUID;
public uint SpellID;
public bool IsPeriodic;
}
class SpellDamageShield : CombatLogServerPacket
{
public SpellDamageShield() : base(ServerOpcodes.SpellDamageShield, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Attacker);
_worldPacket.WritePackedGuid(Defender);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt32(TotalDamage);
_worldPacket.WriteInt32(OriginalDamage);
_worldPacket.WriteUInt32(OverKill);
_worldPacket.WriteUInt32(SchoolMask);
_worldPacket.WriteUInt32(LogAbsorbed);
WriteLogDataBit();
FlushBits();
WriteLogData();
}
public ObjectGuid Attacker;
public ObjectGuid Defender;
public uint SpellID;
public uint TotalDamage;
public int OriginalDamage;
public uint OverKill;
public uint SchoolMask;
public uint LogAbsorbed;
}
class AttackerStateUpdate : CombatLogServerPacket
{
public AttackerStateUpdate() : base(ServerOpcodes.AttackerStateUpdate, ConnectionType.Instance)
{
SubDmg = new Optional<SubDamage>();
}
public override void Write()
{
WorldPacket attackRoundInfo = new WorldPacket();
attackRoundInfo.WriteUInt32((uint)hitInfo);
attackRoundInfo.WritePackedGuid(AttackerGUID);
attackRoundInfo.WritePackedGuid(VictimGUID);
attackRoundInfo.WriteInt32(Damage);
attackRoundInfo.WriteInt32(OriginalDamage);
attackRoundInfo.WriteInt32(OverDamage);
attackRoundInfo.WriteUInt8((byte)(SubDmg.HasValue ? 1 : 0));
if (SubDmg.HasValue)
{
attackRoundInfo.WriteInt32(SubDmg.Value.SchoolMask);
attackRoundInfo.WriteFloat(SubDmg.Value.FDamage);
attackRoundInfo.WriteInt32(SubDmg.Value.Damage);
if (hitInfo.HasAnyFlag(HitInfo.FullAbsorb | HitInfo.PartialAbsorb))
attackRoundInfo.WriteInt32(SubDmg.Value.Absorbed);
if (hitInfo.HasAnyFlag(HitInfo.FullResist | HitInfo.PartialResist))
attackRoundInfo.WriteInt32(SubDmg.Value.Resisted);
}
attackRoundInfo.WriteUInt8(VictimState);
attackRoundInfo.WriteUInt32(AttackerState);
attackRoundInfo.WriteUInt32(MeleeSpellID);
if (hitInfo.HasAnyFlag(HitInfo.Block))
attackRoundInfo.WriteInt32(BlockAmount);
if (hitInfo.HasAnyFlag(HitInfo.RageGain))
attackRoundInfo.WriteInt32(RageGained);
if (hitInfo.HasAnyFlag(HitInfo.Unk1))
{
attackRoundInfo.WriteUInt32(UnkState.State1);
attackRoundInfo.WriteFloat(UnkState.State2);
attackRoundInfo.WriteFloat(UnkState.State3);
attackRoundInfo.WriteFloat(UnkState.State4);
attackRoundInfo.WriteFloat(UnkState.State5);
attackRoundInfo.WriteFloat(UnkState.State6);
attackRoundInfo.WriteFloat(UnkState.State7);
attackRoundInfo.WriteFloat(UnkState.State8);
attackRoundInfo.WriteFloat(UnkState.State9);
attackRoundInfo.WriteFloat(UnkState.State10);
attackRoundInfo.WriteFloat(UnkState.State11);
attackRoundInfo.WriteUInt32(UnkState.State12);
}
if (hitInfo.HasAnyFlag(HitInfo.Block | HitInfo.Unk12))
attackRoundInfo.WriteFloat(Unk);
attackRoundInfo.WriteUInt8((byte)ContentTuning.TuningType);
attackRoundInfo.WriteUInt8(ContentTuning.TargetLevel);
attackRoundInfo.WriteUInt8(ContentTuning.Expansion);
attackRoundInfo.WriteUInt8(ContentTuning.TargetMinScalingLevel);
attackRoundInfo.WriteUInt8(ContentTuning.TargetMaxScalingLevel);
attackRoundInfo.WriteInt16(ContentTuning.PlayerLevelDelta);
attackRoundInfo.WriteInt8(ContentTuning.TargetScalingLevelDelta);
attackRoundInfo.WriteUInt16(ContentTuning.PlayerItemLevel);
attackRoundInfo.WriteUInt16(ContentTuning.TargetItemLevel);
attackRoundInfo.WriteUInt16(ContentTuning.ScalingHealthItemLevelCurveID);
attackRoundInfo.WriteUInt8((byte)(ContentTuning.ScalesWithItemLevel ? 1 : 0));
WriteLogDataBit();
FlushBits();
WriteLogData();
_worldPacket.WriteUInt32(attackRoundInfo.GetSize());
_worldPacket.WriteBytes(attackRoundInfo);
}
public HitInfo hitInfo; // Flags
public ObjectGuid AttackerGUID;
public ObjectGuid VictimGUID;
public int Damage;
public int OriginalDamage;
public int OverDamage = -1; // (damage - health) or -1 if unit is still alive
public Optional<SubDamage> SubDmg;
public byte VictimState;
public uint AttackerState;
public uint MeleeSpellID;
public int BlockAmount;
public int RageGained;
public UnkAttackerState UnkState;
public float Unk;
public ContentTuningParams ContentTuning = new ContentTuningParams();
}
//Structs
struct SpellLogEffectPowerDrainParams
{
public ObjectGuid Victim;
public uint Points;
public uint PowerType;
public float Amplitude;
}
struct SpellLogEffectExtraAttacksParams
{
public ObjectGuid Victim;
public uint NumAttacks;
}
struct SpellLogEffectDurabilityDamageParams
{
public ObjectGuid Victim;
public int ItemID;
public int Amount;
}
struct SpellLogEffectGenericVictimParams
{
public ObjectGuid Victim;
}
struct SpellLogEffectTradeSkillItemParams
{
public int ItemID;
}
struct SpellLogEffectFeedPetParams
{
public int ItemID;
}
struct SpellLogMissDebug
{
public void Write(WorldPacket data)
{
data.WriteFloat(HitRoll);
data.WriteFloat(HitRollNeeded);
}
public float HitRoll;
public float HitRollNeeded;
}
public class SpellLogMissEntry
{
public SpellLogMissEntry(ObjectGuid victim, byte missReason)
{
Victim = victim;
MissReason = missReason;
Debug = new Optional<SpellLogMissDebug>();
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(Victim);
data.WriteUInt8(MissReason);
if (data.WriteBit(Debug.HasValue))
Debug.Value.Write(data);
data.FlushBits();
}
public ObjectGuid Victim;
public byte MissReason;
Optional<SpellLogMissDebug> Debug;
}
struct SpellDispellData
{
public uint SpellID;
public bool Harmful;
public Optional<int> Rolled;
public Optional<int> Needed;
}
public struct SubDamage
{
public int SchoolMask;
public float FDamage; // Float damage (Most of the time equals to Damage)
public int Damage;
public int Absorbed;
public int Resisted;
}
public struct UnkAttackerState
{
public uint State1;
public float State2;
public float State3;
public float State4;
public float State5;
public float State6;
public float State7;
public float State8;
public float State9;
public float State10;
public float State11;
public uint State12;
}
}
@@ -0,0 +1,295 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class AttackSwing : ClientPacket
{
public AttackSwing(WorldPacket packet) : base(packet) { }
public override void Read()
{
Victim = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Victim;
}
public class AttackSwingError : ServerPacket
{
public AttackSwingError(AttackSwingErr reason = AttackSwingErr.CantAttack) : base(ServerOpcodes.AttackSwingError)
{
Reason = reason;
}
public override void Write()
{
_worldPacket.WriteBits((uint)Reason, 3);
_worldPacket.FlushBits();
}
AttackSwingErr Reason;
}
public class AttackStop : ClientPacket
{
public AttackStop(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class AttackStart : ServerPacket
{
public AttackStart() : base(ServerOpcodes.AttackStart, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Attacker);
_worldPacket.WritePackedGuid(Victim);
}
public ObjectGuid Attacker;
public ObjectGuid Victim;
}
public class SAttackStop : ServerPacket
{
public SAttackStop(Unit attacker, Unit victim) : base(ServerOpcodes.AttackStop, ConnectionType.Instance)
{
Attacker = attacker.GetGUID();
if (victim)
{
Victim = victim.GetGUID();
NowDead = victim.IsDead();
}
}
public override void Write()
{
_worldPacket.WritePackedGuid(Attacker);
_worldPacket.WritePackedGuid(Victim);
_worldPacket.WriteBit(NowDead);
_worldPacket.FlushBits();
}
public ObjectGuid Attacker;
public ObjectGuid Victim;
public bool NowDead;
}
public class ThreatUpdate : ServerPacket
{
public ThreatUpdate() : base(ServerOpcodes.ThreatUpdate, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteInt32(ThreatList.Count);
foreach (ThreatInfo threatInfo in ThreatList)
{
_worldPacket.WritePackedGuid(threatInfo.UnitGUID);
_worldPacket.WriteInt64(threatInfo.Threat);
}
}
public ObjectGuid UnitGUID;
public List<ThreatInfo> ThreatList = new List<ThreatInfo>();
}
public class HighestThreatUpdate : ServerPacket
{
public HighestThreatUpdate() : base(ServerOpcodes.HighestThreatUpdate, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WritePackedGuid(HighestThreatGUID);
_worldPacket.WriteInt32(ThreatList.Count);
foreach (ThreatInfo threatInfo in ThreatList)
{
_worldPacket.WritePackedGuid(threatInfo.UnitGUID);
_worldPacket.WriteInt64(threatInfo.Threat);
}
}
public ObjectGuid UnitGUID;
public List<ThreatInfo> ThreatList = new List<ThreatInfo>();
public ObjectGuid HighestThreatGUID;
}
public class ThreatRemove : ServerPacket
{
public ThreatRemove() : base(ServerOpcodes.ThreatRemove, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WritePackedGuid(AboutGUID);
}
public ObjectGuid AboutGUID; // Unit to remove threat from (e.g. player, pet, guardian)
public ObjectGuid UnitGUID; // Unit being attacked (e.g. creature, boss)
}
public class AIReaction : ServerPacket
{
public AIReaction() : base(ServerOpcodes.AiReaction, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteUInt32((uint)Reaction);
}
public ObjectGuid UnitGUID;
public AiReaction Reaction;
}
public class CancelCombat : ServerPacket
{
public CancelCombat() : base(ServerOpcodes.CancelCombat) { }
public override void Write() { }
}
public class PowerUpdate : ServerPacket
{
public PowerUpdate() : base(ServerOpcodes.PowerUpdate)
{
Powers = new List<PowerUpdatePower>();
}
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteInt32(Powers.Count);
foreach (var power in Powers)
{
_worldPacket.WriteInt32(power.Power);
_worldPacket.WriteUInt8(power.PowerType);
}
}
public ObjectGuid Guid;
public List<PowerUpdatePower> Powers;
}
public class SetSheathed : ClientPacket
{
public SetSheathed(WorldPacket packet) : base(packet) { }
public override void Read()
{
CurrentSheathState = _worldPacket.ReadInt32();
Animate = _worldPacket.HasBit();
}
public int CurrentSheathState;
public bool Animate = true;
}
public class CancelAutoRepeat : ServerPacket
{
public CancelAutoRepeat() : base(ServerOpcodes.CancelAutoRepeat) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
public ObjectGuid Guid;
}
public class HealthUpdate : ServerPacket
{
public HealthUpdate() : base(ServerOpcodes.HealthUpdate) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteInt64(Health);
}
public ObjectGuid Guid;
public long Health;
}
public class ThreatClear : ServerPacket
{
public ThreatClear() : base(ServerOpcodes.ThreatClear) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
}
public ObjectGuid UnitGUID;
}
class PvPCredit : ServerPacket
{
public PvPCredit() : base(ServerOpcodes.PvpCredit) { }
public override void Write()
{
_worldPacket.WriteInt32(OriginalHonor);
_worldPacket.WriteInt32(Honor);
_worldPacket.WritePackedGuid(Target);
_worldPacket.WriteUInt32(Rank);
}
public int OriginalHonor;
public int Honor;
public ObjectGuid Target;
public uint Rank;
}
class BreakTarget : ServerPacket
{
public BreakTarget() : base(ServerOpcodes.BreakTarget) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
}
public ObjectGuid UnitGUID;
}
//Structs
public struct ThreatInfo
{
public ObjectGuid UnitGUID;
public long Threat;
}
public struct PowerUpdatePower
{
public PowerUpdatePower(int power, byte powerType)
{
Power = power;
PowerType = powerType;
}
public int Power;
public byte PowerType;
}
}
@@ -0,0 +1,146 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
namespace Game.Networking.Packets
{
public class CanDuel : ClientPacket
{
public CanDuel(WorldPacket packet) : base(packet) { }
public override void Read()
{
TargetGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid TargetGUID;
}
public class CanDuelResult : ServerPacket
{
public CanDuelResult() : base(ServerOpcodes.CanDuelResult) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TargetGUID);
_worldPacket.WriteBit(Result);
_worldPacket.FlushBits();
}
public ObjectGuid TargetGUID;
public bool Result;
}
public class DuelComplete : ServerPacket
{
public DuelComplete() : base(ServerOpcodes.DuelComplete, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBit(Started);
_worldPacket.FlushBits();
}
public bool Started;
}
public class DuelCountdown : ServerPacket
{
public DuelCountdown(uint countdown) : base(ServerOpcodes.DuelCountdown)
{
Countdown = countdown;
}
public override void Write()
{
_worldPacket.WriteUInt32(Countdown);
}
uint Countdown;
}
public class DuelInBounds : ServerPacket
{
public DuelInBounds() : base(ServerOpcodes.DuelInBounds, ConnectionType.Instance) { }
public override void Write() { }
}
public class DuelOutOfBounds : ServerPacket
{
public DuelOutOfBounds() : base(ServerOpcodes.DuelOutOfBounds, ConnectionType.Instance) { }
public override void Write() { }
}
public class DuelRequested : ServerPacket
{
public DuelRequested() : base(ServerOpcodes.DuelRequested, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ArbiterGUID);
_worldPacket.WritePackedGuid(RequestedByGUID);
_worldPacket.WritePackedGuid(RequestedByWowAccount);
}
public ObjectGuid ArbiterGUID;
public ObjectGuid RequestedByGUID;
public ObjectGuid RequestedByWowAccount;
}
public class DuelResponse : ClientPacket
{
public DuelResponse(WorldPacket packet) : base(packet) { }
public override void Read()
{
ArbiterGUID = _worldPacket.ReadPackedGuid();
Accepted = _worldPacket.HasBit();
Forfeited = _worldPacket.HasBit();
}
public ObjectGuid ArbiterGUID;
public bool Accepted;
public bool Forfeited;
}
public class DuelWinner : ServerPacket
{
public DuelWinner() : base(ServerOpcodes.DuelWinner, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBits(BeatenName.GetByteCount(), 6);
_worldPacket.WriteBits(WinnerName.GetByteCount(), 6);
_worldPacket.WriteBit(Fled);
_worldPacket.WriteUInt32(BeatenVirtualRealmAddress);
_worldPacket.WriteUInt32(WinnerVirtualRealmAddress);
_worldPacket.WriteString(BeatenName);
_worldPacket.WriteString(WinnerName);
}
public string BeatenName;
public string WinnerName;
public uint BeatenVirtualRealmAddress;
public uint WinnerVirtualRealmAddress;
public bool Fled;
}
}
@@ -0,0 +1,173 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class EquipmentSetID : ServerPacket
{
public EquipmentSetID() : base(ServerOpcodes.EquipmentSetId, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt64(GUID);
_worldPacket.WriteInt32(Type);
_worldPacket.WriteUInt32(SetID);
}
public ulong GUID; // Set Identifier
public int Type;
public uint SetID; // Index
}
public class LoadEquipmentSet : ServerPacket
{
public LoadEquipmentSet() : base(ServerOpcodes.LoadEquipmentSet, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(SetData.Count);
foreach (var equipSet in SetData)
{
_worldPacket.WriteInt32((int)equipSet.Type);
_worldPacket.WriteUInt64(equipSet.Guid);
_worldPacket.WriteUInt32(equipSet.SetID);
_worldPacket.WriteUInt32(equipSet.IgnoreMask);
for (int i = 0; i < EquipmentSlot.End; ++i)
{
_worldPacket.WritePackedGuid(equipSet.Pieces[i]);
_worldPacket.WriteInt32(equipSet.Appearances[i]);
}
foreach (var id in equipSet.Enchants)
_worldPacket.WriteInt32(id);
_worldPacket.WriteBit(equipSet.AssignedSpecIndex != -1);
_worldPacket.WriteBits(equipSet.SetName.GetByteCount(), 8);
_worldPacket.WriteBits(equipSet.SetIcon.GetByteCount(), 9);
if (equipSet.AssignedSpecIndex != -1)
_worldPacket.WriteInt32(equipSet.AssignedSpecIndex);
_worldPacket.WriteString(equipSet.SetName);
_worldPacket.WriteString(equipSet.SetIcon);
}
}
public List<EquipmentSetInfo.EquipmentSetData> SetData = new List<EquipmentSetInfo.EquipmentSetData>();
}
public class SaveEquipmentSet : ClientPacket
{
public SaveEquipmentSet(WorldPacket packet) : base(packet)
{
Set = new EquipmentSetInfo.EquipmentSetData();
}
public override void Read()
{
Set.Type = (EquipmentSetInfo.EquipmentSetType)_worldPacket.ReadInt32();
Set.Guid = _worldPacket.ReadUInt64();
Set.SetID = _worldPacket.ReadUInt32();
Set.IgnoreMask = _worldPacket.ReadUInt32();
for (byte i = 0; i < EquipmentSlot.End; ++i)
{
Set.Pieces[i] = _worldPacket.ReadPackedGuid();
Set.Appearances[i] = _worldPacket.ReadInt32();
}
Set.Enchants[0] = _worldPacket.ReadInt32();
Set.Enchants[1] = _worldPacket.ReadInt32();
bool hasSpecIndex = _worldPacket.HasBit();
uint setNameLength = _worldPacket.ReadBits<uint>(8);
uint setIconLength = _worldPacket.ReadBits<uint>(9);
if (hasSpecIndex)
Set.AssignedSpecIndex = _worldPacket.ReadInt32();
Set.SetName = _worldPacket.ReadString(setNameLength);
Set.SetIcon = _worldPacket.ReadString(setIconLength);
}
public EquipmentSetInfo.EquipmentSetData Set;
}
class DeleteEquipmentSet : ClientPacket
{
public DeleteEquipmentSet(WorldPacket packet) : base(packet) { }
public override void Read()
{
ID = _worldPacket.ReadUInt64();
}
public ulong ID;
}
class UseEquipmentSet : ClientPacket
{
public UseEquipmentSet(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
for (byte i = 0; i < EquipmentSlot.End; ++i)
{
Items[i].Item = _worldPacket.ReadPackedGuid();
Items[i].ContainerSlot = _worldPacket.ReadUInt8();
Items[i].Slot = _worldPacket.ReadUInt8();
}
GUID = _worldPacket.ReadUInt64();
}
public InvUpdate Inv;
public EquipmentSetItem[] Items = new EquipmentSetItem[EquipmentSlot.End];
public ulong GUID; //Set Identifier
public struct EquipmentSetItem
{
public ObjectGuid Item;
public byte ContainerSlot;
public byte Slot;
}
}
class UseEquipmentSetResult : ServerPacket
{
public UseEquipmentSetResult() : base(ServerOpcodes.UseEquipmentSetResult) { }
public override void Write()
{
_worldPacket.WriteUInt64(GUID);
_worldPacket.WriteUInt8(Reason);
}
public ulong GUID; //Set Identifier
public byte Reason;
}
}
@@ -0,0 +1,152 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
namespace Game.Networking.Packets
{
public class GameObjUse : ClientPacket
{
public GameObjUse(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
public class GameObjReportUse : ClientPacket
{
public GameObjReportUse(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
class GameObjectDespawn : ServerPacket
{
public GameObjectDespawn() : base(ServerOpcodes.GameObjectDespawn) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ObjectGUID);
}
public ObjectGuid ObjectGUID;
}
class PageTextPkt : ServerPacket
{
public PageTextPkt() : base(ServerOpcodes.PageText) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GameObjectGUID);
}
public ObjectGuid GameObjectGUID;
}
class GameObjectActivateAnimKit : ServerPacket
{
public GameObjectActivateAnimKit() : base(ServerOpcodes.GameObjectActivateAnimKit, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ObjectGUID);
_worldPacket.WriteInt32(AnimKitID);
_worldPacket.WriteBit(Maintain);
_worldPacket.FlushBits();
}
public ObjectGuid ObjectGUID;
public int AnimKitID;
public bool Maintain;
}
class DestructibleBuildingDamage : ServerPacket
{
public DestructibleBuildingDamage() : base(ServerOpcodes.DestructibleBuildingDamage, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Target);
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WriteInt32(Damage);
_worldPacket.WriteUInt32(SpellID);
}
public ObjectGuid Target;
public ObjectGuid Caster;
public ObjectGuid Owner;
public int Damage;
public uint SpellID;
}
class FishNotHooked : ServerPacket
{
public FishNotHooked() : base(ServerOpcodes.FishNotHooked) { }
public override void Write() { }
}
class FishEscaped : ServerPacket
{
public FishEscaped() : base(ServerOpcodes.FishEscaped) { }
public override void Write() { }
}
class GameObjectCustomAnim : ServerPacket
{
public GameObjectCustomAnim() : base(ServerOpcodes.GameObjectCustomAnim, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ObjectGUID);
_worldPacket.WriteUInt32(CustomAnim);
_worldPacket.WriteBit(PlayAsDespawn);
_worldPacket.FlushBits();
}
public ObjectGuid ObjectGUID;
public uint CustomAnim;
public bool PlayAsDespawn;
}
class GameObjectUIAction : ServerPacket
{
public GameObjectUIAction() : base(ServerOpcodes.GameObjectUiAction, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ObjectGUID);
_worldPacket.WriteInt32(UILink);
}
public ObjectGuid ObjectGUID;
public int UILink;
}
}
@@ -0,0 +1,613 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.DataStorage;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class GarrisonCreateResult : ServerPacket
{
public GarrisonCreateResult() : base(ServerOpcodes.GarrisonCreateResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(Result);
_worldPacket.WriteUInt32(GarrSiteLevelID);
}
public uint GarrSiteLevelID;
public uint Result;
}
class GarrisonDeleteResult : ServerPacket
{
public GarrisonDeleteResult() : base(ServerOpcodes.GarrisonDeleteResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteUInt32(GarrSiteID);
}
public GarrisonError Result;
public uint GarrSiteID;
}
class GetGarrisonInfo : ClientPacket
{
public GetGarrisonInfo(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class GetGarrisonInfoResult : ServerPacket
{
public GetGarrisonInfoResult() : base(ServerOpcodes.GetGarrisonInfoResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(FactionIndex);
_worldPacket.WriteInt32(Garrisons.Count);
_worldPacket.WriteInt32(FollowerSoftCaps.Count);
foreach (FollowerSoftCapInfo followerSoftCapInfo in FollowerSoftCaps)
followerSoftCapInfo.Write(_worldPacket);
foreach (GarrisonInfo garrison in Garrisons)
garrison.Write(_worldPacket);
}
public uint FactionIndex;
public List<GarrisonInfo> Garrisons = new List<GarrisonInfo>();
public List<FollowerSoftCapInfo> FollowerSoftCaps = new List<FollowerSoftCapInfo>();
}
class GarrisonRemoteInfo : ServerPacket
{
public GarrisonRemoteInfo() : base(ServerOpcodes.GarrisonRemoteInfo, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Sites.Count);
foreach (GarrisonRemoteSiteInfo site in Sites)
site.Write(_worldPacket);
}
public List<GarrisonRemoteSiteInfo> Sites = new List<GarrisonRemoteSiteInfo>();
}
class GarrisonPurchaseBuilding : ClientPacket
{
public GarrisonPurchaseBuilding(WorldPacket packet) : base(packet) { }
public override void Read()
{
NpcGUID = _worldPacket.ReadPackedGuid();
PlotInstanceID = _worldPacket.ReadUInt32();
BuildingID = _worldPacket.ReadUInt32();
}
public ObjectGuid NpcGUID;
public uint BuildingID;
public uint PlotInstanceID;
}
class GarrisonPlaceBuildingResult : ServerPacket
{
public GarrisonPlaceBuildingResult() : base(ServerOpcodes.GarrisonPlaceBuildingResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
_worldPacket.WriteUInt32((uint)Result);
BuildingInfo.Write(_worldPacket);
_worldPacket.WriteBit(PlayActivationCinematic);
_worldPacket.FlushBits();
}
public GarrisonType GarrTypeID;
public GarrisonError Result;
public GarrisonBuildingInfo BuildingInfo = new GarrisonBuildingInfo();
public bool PlayActivationCinematic;
}
class GarrisonCancelConstruction : ClientPacket
{
public GarrisonCancelConstruction(WorldPacket packet) : base(packet) { }
public override void Read()
{
NpcGUID = _worldPacket.ReadPackedGuid();
PlotInstanceID = _worldPacket.ReadUInt32();
}
public ObjectGuid NpcGUID;
public uint PlotInstanceID;
}
class GarrisonBuildingRemoved : ServerPacket
{
public GarrisonBuildingRemoved() : base(ServerOpcodes.GarrisonBuildingRemoved, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteUInt32(GarrPlotInstanceID);
_worldPacket.WriteUInt32(GarrBuildingID);
}
public GarrisonType GarrTypeID;
public GarrisonError Result;
public uint GarrPlotInstanceID;
public uint GarrBuildingID;
}
class GarrisonLearnBlueprintResult : ServerPacket
{
public GarrisonLearnBlueprintResult() : base(ServerOpcodes.GarrisonLearnBlueprintResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteUInt32(BuildingID);
}
public GarrisonType GarrTypeID;
public uint BuildingID;
public GarrisonError Result;
}
class GarrisonUnlearnBlueprintResult : ServerPacket
{
public GarrisonUnlearnBlueprintResult() : base(ServerOpcodes.GarrisonUnlearnBlueprintResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteUInt32(BuildingID);
}
public GarrisonType GarrTypeID;
public uint BuildingID;
public GarrisonError Result;
}
class GarrisonRequestBlueprintAndSpecializationData : ClientPacket
{
public GarrisonRequestBlueprintAndSpecializationData(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class GarrisonRequestBlueprintAndSpecializationDataResult : ServerPacket
{
public GarrisonRequestBlueprintAndSpecializationDataResult() : base(ServerOpcodes.GarrisonRequestBlueprintAndSpecializationDataResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)GarrTypeID);
_worldPacket.WriteInt32(BlueprintsKnown != null ? BlueprintsKnown.Count : 0);
_worldPacket.WriteInt32(SpecializationsKnown != null ? SpecializationsKnown.Count : 0);
if (BlueprintsKnown != null)
foreach (uint blueprint in BlueprintsKnown)
_worldPacket.WriteUInt32(blueprint);
if (SpecializationsKnown != null)
foreach (uint specialization in SpecializationsKnown)
_worldPacket.WriteUInt32(specialization);
}
public GarrisonType GarrTypeID;
public List<uint> SpecializationsKnown = null;
public List<uint> BlueprintsKnown = null;
}
class GarrisonGetBuildingLandmarks : ClientPacket
{
public GarrisonGetBuildingLandmarks(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class GarrisonBuildingLandmarks : ServerPacket
{
public GarrisonBuildingLandmarks() : base(ServerOpcodes.GarrisonBuildingLandmarks, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Landmarks.Count);
foreach (GarrisonBuildingLandmark landmark in Landmarks)
landmark.Write(_worldPacket);
}
public List<GarrisonBuildingLandmark> Landmarks = new List<GarrisonBuildingLandmark>();
}
class GarrisonPlotPlaced : ServerPacket
{
public GarrisonPlotPlaced() : base(ServerOpcodes.GarrisonPlotPlaced, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
PlotInfo.Write(_worldPacket);
}
public GarrisonType GarrTypeID;
public GarrisonPlotInfo PlotInfo;
}
class GarrisonPlotRemoved : ServerPacket
{
public GarrisonPlotRemoved() : base(ServerOpcodes.GarrisonPlotRemoved, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(GarrPlotInstanceID);
}
public uint GarrPlotInstanceID;
}
class GarrisonAddFollowerResult : ServerPacket
{
public GarrisonAddFollowerResult() : base(ServerOpcodes.GarrisonAddFollowerResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32((int)GarrTypeID);
_worldPacket .WriteUInt32((uint)Result);
Follower.Write(_worldPacket);
}
public GarrisonType GarrTypeID;
public GarrisonFollower Follower;
public GarrisonError Result;
}
class GarrisonRemoveFollowerResult : ServerPacket
{
public GarrisonRemoveFollowerResult() : base(ServerOpcodes.GarrisonRemoveFollowerResult) { }
public override void Write()
{
_worldPacket.WriteUInt64(FollowerDBID);
_worldPacket.WriteInt32(GarrTypeID);
_worldPacket.WriteUInt32(Result);
_worldPacket.WriteUInt32(Destroyed);
}
public ulong FollowerDBID;
public int GarrTypeID;
public uint Result;
public uint Destroyed;
}
class GarrisonBuildingActivated : ServerPacket
{
public GarrisonBuildingActivated() : base(ServerOpcodes.GarrisonBuildingActivated, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(GarrPlotInstanceID);
}
public uint GarrPlotInstanceID;
}
//Structs
public struct GarrisonPlotInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrPlotInstanceID);
data.WriteXYZO(PlotPos);
data.WriteUInt32(PlotType);
}
public uint GarrPlotInstanceID;
public Position PlotPos;
public uint PlotType;
}
public class GarrisonBuildingInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrPlotInstanceID);
data.WriteUInt32(GarrBuildingID);
data.WriteUInt32((uint)TimeBuilt);
data.WriteUInt32(CurrentGarSpecID);
data.WriteUInt32((uint)TimeSpecCooldown);
data.WriteBit(Active);
data.FlushBits();
}
public uint GarrPlotInstanceID;
public uint GarrBuildingID;
public long TimeBuilt;
public uint CurrentGarSpecID;
public long TimeSpecCooldown = 2288912640; // 06/07/1906 18:35:44 - another in the series of magic blizz dates
public bool Active;
}
public class GarrisonFollower
{
public void Write(WorldPacket data)
{
data.WriteUInt64(DbID);
data.WriteUInt32(GarrFollowerID);
data.WriteUInt32(Quality);
data.WriteUInt32(FollowerLevel);
data.WriteUInt32(ItemLevelWeapon);
data.WriteUInt32(ItemLevelArmor);
data.WriteUInt32(Xp);
data.WriteUInt32(Durability);
data.WriteUInt32(CurrentBuildingID);
data.WriteUInt32(CurrentMissionID);
data.WriteInt32(AbilityID.Count);
data.WriteUInt32(ZoneSupportSpellID);
data.WriteUInt32(FollowerStatus);
AbilityID.ForEach(ability => data.WriteUInt32(ability.Id));
data.WriteBits(CustomName.GetByteCount(), 7);
data.FlushBits();
data.WriteString(CustomName);
}
public ulong DbID;
public uint GarrFollowerID;
public uint Quality;
public uint FollowerLevel;
public uint ItemLevelWeapon;
public uint ItemLevelArmor;
public uint Xp;
public uint Durability;
public uint CurrentBuildingID;
public uint CurrentMissionID;
public List<GarrAbilityRecord> AbilityID = new List<GarrAbilityRecord>();
public uint ZoneSupportSpellID;
public uint FollowerStatus;
public string CustomName = "";
}
class GarrisonMission
{
public void Write(WorldPacket data)
{
data.WriteUInt64(DbID);
data.WriteUInt32(MissionRecID);
data.WriteUInt32((uint)OfferTime);
data.WriteUInt32(OfferDuration);
data.WriteUInt32((uint)StartTime);
data.WriteUInt32(TravelDuration);
data.WriteUInt32(MissionDuration);
data.WriteUInt32(MissionState);
data.WriteUInt32(Unknown1);
data.WriteUInt32(Unknown2);
}
public ulong DbID;
public uint MissionRecID;
public long OfferTime;
public uint OfferDuration;
public long StartTime = 2288912640;
public uint TravelDuration;
public uint MissionDuration;
public uint MissionState;
public uint Unknown1 = 0;
public uint Unknown2 = 0;
}
struct GarrisonMissionReward
{
public void Write(WorldPacket data)
{
data.WriteInt32(ItemID);
data.WriteUInt32(Quantity);
data.WriteInt32(CurrencyID);
data.WriteUInt32(CurrencyQuantity);
data.WriteUInt32(FollowerXP);
data.WriteUInt32(BonusAbilityID);
data.WriteInt32(Unknown);
}
public int ItemID;
public uint Quantity;
public int CurrencyID;
public uint CurrencyQuantity;
public uint FollowerXP;
public uint BonusAbilityID;
public int Unknown;
}
struct GarrisonMissionBonusAbility
{
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrMssnBonusAbilityID);
data.WriteUInt32((uint)StartTime);
}
public uint GarrMssnBonusAbilityID;
public long StartTime;
}
struct GarrisonTalent
{
public void Write(WorldPacket data)
{
data.WriteInt32(GarrTalentID);
data.WriteInt32(Rank);
data.WriteUInt32((uint)ResearchStartTime);
data.WriteInt32(Flags);
}
public int GarrTalentID;
public int Rank;
public long ResearchStartTime;
public int Flags;
}
class GarrisonInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32((uint)GarrTypeID);
data.WriteUInt32(GarrSiteID);
data.WriteUInt32(GarrSiteLevelID);
data.WriteInt32(Buildings.Count);
data.WriteInt32(Plots.Count);
data.WriteInt32(Followers.Count);
data.WriteInt32(Missions.Count);
data.WriteInt32(MissionRewards.Count);
data.WriteInt32(MissionOvermaxRewards.Count);
data.WriteInt32(MissionAreaBonuses.Count);
data.WriteInt32(Talents.Count);
data.WriteInt32(CanStartMission.Count);
data.WriteInt32(ArchivedMissions.Count);
data.WriteUInt32(NumFollowerActivationsRemaining);
data.WriteUInt32(NumMissionsStartedToday);
foreach (GarrisonPlotInfo plot in Plots)
plot.Write(data);
foreach (GarrisonMission mission in Missions)
mission.Write(data);
foreach (List<GarrisonMissionReward> missionReward in MissionRewards)
data.WriteInt32(missionReward.Count);
foreach (List<GarrisonMissionReward> missionReward in MissionRewards)
foreach (GarrisonMissionReward missionRewardItem in missionReward)
missionRewardItem.Write(data);
foreach (List<GarrisonMissionReward> missionReward in MissionOvermaxRewards)
data.WriteInt32(missionReward.Count);
foreach (List<GarrisonMissionReward> missionReward in MissionOvermaxRewards)
foreach (GarrisonMissionReward missionRewardItem in missionReward)
missionRewardItem.Write(data);
foreach (GarrisonMissionBonusAbility areaBonus in MissionAreaBonuses)
areaBonus.Write(data);
foreach (GarrisonTalent talent in Talents)
talent.Write(data);
foreach(var id in ArchivedMissions)
data.WriteInt32(id);
foreach (GarrisonBuildingInfo building in Buildings)
building.Write(data);
foreach (bool canStartMission in CanStartMission)
data.WriteBit(canStartMission);
data.FlushBits();
foreach (GarrisonFollower follower in Followers)
follower.Write(data);
}
public GarrisonType GarrTypeID;
public uint GarrSiteID;
public uint GarrSiteLevelID;
public uint NumFollowerActivationsRemaining;
public uint NumMissionsStartedToday; // might mean something else, but sending 0 here enables follower abilities "Increase success chance of the first mission of the day by %."
public List<GarrisonPlotInfo> Plots = new List<GarrisonPlotInfo>();
public List<GarrisonBuildingInfo> Buildings = new List<GarrisonBuildingInfo>();
public List<GarrisonFollower> Followers = new List<GarrisonFollower>();
public List<GarrisonMission> Missions = new List<GarrisonMission>();
public List<List<GarrisonMissionReward>> MissionRewards = new List<List<GarrisonMissionReward>>();
public List<List<GarrisonMissionReward>> MissionOvermaxRewards = new List<List<GarrisonMissionReward>>();
public List<GarrisonMissionBonusAbility> MissionAreaBonuses = new List<GarrisonMissionBonusAbility>();
public List<GarrisonTalent> Talents = new List<GarrisonTalent>();
public List<bool> CanStartMission = new List<bool>();
public List<int> ArchivedMissions = new List<int>();
}
struct FollowerSoftCapInfo
{
public void Write(WorldPacket data)
{
data.WriteInt32(GarrFollowerTypeID);
data.WriteUInt32(Count);
}
public int GarrFollowerTypeID;
public uint Count;
}
struct GarrisonRemoteBuildingInfo
{
public GarrisonRemoteBuildingInfo(uint plotInstanceId, uint buildingId)
{
GarrPlotInstanceID = plotInstanceId;
GarrBuildingID = buildingId;
}
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrPlotInstanceID);
data.WriteUInt32(GarrBuildingID);
}
public uint GarrPlotInstanceID;
public uint GarrBuildingID;
}
class GarrisonRemoteSiteInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrSiteLevelID);
data.WriteInt32(Buildings.Count);
foreach (GarrisonRemoteBuildingInfo building in Buildings)
building.Write(data);
}
public uint GarrSiteLevelID;
public List<GarrisonRemoteBuildingInfo> Buildings = new List<GarrisonRemoteBuildingInfo>();
}
struct GarrisonBuildingLandmark
{
public GarrisonBuildingLandmark(uint buildingPlotInstId, Position pos)
{
GarrBuildingPlotInstID = buildingPlotInstId;
Pos = pos;
}
public void Write(WorldPacket data)
{
data.WriteUInt32(GarrBuildingPlotInstID);
data.WriteXYZ(Pos);
}
public uint GarrBuildingPlotInstID;
public Position Pos;
}
}
@@ -0,0 +1,343 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class LFGuildAddRecruit : ClientPacket
{
public LFGuildAddRecruit(WorldPacket packet) : base(packet) { }
public override void Read()
{
GuildGUID = _worldPacket.ReadPackedGuid();
PlayStyle = _worldPacket.ReadUInt32();
Availability = _worldPacket.ReadUInt32();
ClassRoles = _worldPacket.ReadUInt32();
Comment = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(10));
}
public ObjectGuid GuildGUID;
public uint Availability;
public uint ClassRoles;
public uint PlayStyle;
public string Comment;
}
class LFGuildApplicationsListChanged : ServerPacket
{
public LFGuildApplicationsListChanged() : base(ServerOpcodes.LfGuildApplicationsListChanged) { }
public override void Write() { }
}
class LFGuildApplicantListChanged : ServerPacket
{
public LFGuildApplicantListChanged() : base(ServerOpcodes.LfGuildApplicantListChanged) { }
public override void Write() { }
}
class LFGuildBrowse : ClientPacket
{
public LFGuildBrowse(WorldPacket packet) : base(packet) { }
public override void Read()
{
PlayStyle = _worldPacket.ReadUInt32();
Availability = _worldPacket.ReadUInt32();
ClassRoles = _worldPacket.ReadUInt32();
CharacterLevel = _worldPacket.ReadUInt32();
}
public uint CharacterLevel;
public uint Availability;
public uint ClassRoles;
public uint PlayStyle;
}
class LFGuildBrowseResult : ServerPacket
{
public LFGuildBrowseResult() : base(ServerOpcodes.LfGuildBrowse) { }
public override void Write()
{
_worldPacket.WriteInt32(Post.Count);
foreach (LFGuildBrowseData guildData in Post)
guildData.Write(_worldPacket);
}
public List<LFGuildBrowseData> Post = new List<LFGuildBrowseData>();
}
class LFGuildDeclineRecruit : ClientPacket
{
public LFGuildDeclineRecruit(WorldPacket packet) : base(packet) { }
public override void Read()
{
RecruitGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid RecruitGUID;
}
class LFGuildGetApplications : ClientPacket
{
public LFGuildGetApplications(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class LFGuildApplications : ServerPacket
{
public LFGuildApplications() : base(ServerOpcodes.LfGuildApplications) { }
public override void Write()
{
_worldPacket.WriteInt32(NumRemaining);
_worldPacket.WriteInt32(Application.Count);
foreach (LFGuildApplicationData application in Application)
application.Write(_worldPacket);
}
public List<LFGuildApplicationData> Application = new List<LFGuildApplicationData>();
public int NumRemaining;
}
class LFGuildGetGuildPost : ClientPacket
{
public LFGuildGetGuildPost(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class LFGuildPost : ServerPacket
{
public LFGuildPost() : base(ServerOpcodes.LfGuildPost) { }
public override void Write()
{
_worldPacket.WriteBit(Post.HasValue);
_worldPacket.FlushBits();
if (Post.HasValue)
Post.Value.Write(_worldPacket);
}
public Optional<GuildPostData> Post;
}
class LFGuildGetRecruits : ClientPacket
{
public LFGuildGetRecruits(WorldPacket packet) : base(packet) { }
public override void Read()
{
LastUpdate = _worldPacket.ReadUInt32();
}
public uint LastUpdate;
}
class LFGuildRecruits : ServerPacket
{
public LFGuildRecruits() : base(ServerOpcodes.LfGuildRecruits) { }
public override void Write()
{
_worldPacket.WriteInt32(Recruits.Count);
_worldPacket.WriteUInt32((uint)UpdateTime);
foreach (LFGuildRecruitData recruit in Recruits)
recruit.Write(_worldPacket);
}
public List<LFGuildRecruitData> Recruits = new List<LFGuildRecruitData>();
public long UpdateTime;
}
class LFGuildRemoveRecruit : ClientPacket
{
public LFGuildRemoveRecruit(WorldPacket packet) : base(packet) { }
public override void Read()
{
GuildGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid GuildGUID;
}
class LFGuildSetGuildPost : ClientPacket
{
public LFGuildSetGuildPost(WorldPacket packet) : base(packet) { }
public override void Read()
{
PlayStyle = _worldPacket.ReadUInt32();
Availability = _worldPacket.ReadUInt32();
ClassRoles = _worldPacket.ReadUInt32();
LevelRange = _worldPacket.ReadUInt32();
Active = _worldPacket.HasBit();
Comment = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(10));
}
public uint Availability;
public uint PlayStyle;
public uint ClassRoles;
public uint LevelRange;
public bool Active;
public string Comment;
}
//Structs
class LFGuildBrowseData
{
public void Write(WorldPacket data)
{
data.WriteBits(GuildName.GetByteCount(), 7);
data.WriteBits(Comment.GetByteCount(), 10);
data.WritePackedGuid(GuildGUID);
data.WriteUInt32(GuildVirtualRealm);
data.WriteInt32(GuildMembers);
data.WriteUInt32(GuildAchievementPoints);
data.WriteInt32(PlayStyle);
data.WriteInt32(Availability);
data.WriteInt32(ClassRoles);
data.WriteInt32(LevelRange);
data.WriteUInt32(EmblemStyle);
data.WriteUInt32(EmblemColor);
data.WriteUInt32(BorderStyle);
data.WriteUInt32(BorderColor);
data.WriteUInt32(Background);
data.WriteInt8(Cached);
data.WriteInt8(MembershipRequested);
data.WriteString(GuildName);
data.WriteString(Comment);
}
public string GuildName = "";
public ObjectGuid GuildGUID;
public uint GuildVirtualRealm;
public int GuildMembers;
public uint GuildAchievementPoints;
public int PlayStyle;
public int Availability;
public int ClassRoles;
public int LevelRange;
public uint EmblemStyle;
public uint EmblemColor;
public uint BorderStyle;
public uint BorderColor;
public uint Background;
public string Comment = "";
public sbyte Cached;
public sbyte MembershipRequested;
}
class LFGuildApplicationData
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(GuildGUID);
data.WriteUInt32(GuildVirtualRealm);
data.WriteInt32(ClassRoles);
data.WriteInt32(PlayStyle);
data.WriteInt32(Availability);
data.WriteUInt32(SecondsSinceCreated);
data.WriteUInt32(SecondsUntilExpiration);
data.WriteBits(GuildName.GetByteCount(), 7);
data.WriteBits(Comment.GetByteCount(), 10);
data.FlushBits();
data.WriteString(GuildName);
data.WriteString(Comment);
}
public ObjectGuid GuildGUID;
public uint GuildVirtualRealm;
public string GuildName = "";
public int ClassRoles;
public int PlayStyle;
public int Availability;
public uint SecondsSinceCreated;
public uint SecondsUntilExpiration;
public string Comment = "";
}
class GuildPostData
{
public void Write(WorldPacket data)
{
data.WriteBit(Active);
data.WriteBits(Comment.GetByteCount(), 10);
data.WriteInt32(PlayStyle);
data.WriteInt32(Availability);
data.WriteInt32(ClassRoles);
data.WriteInt32(LevelRange);
data.WriteInt32(SecondsRemaining);
data.WriteString(Comment);
}
public bool Active;
public int PlayStyle;
public int Availability;
public int ClassRoles;
public int LevelRange;
public int SecondsRemaining;
public string Comment = "";
}
class LFGuildRecruitData
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(RecruitGUID);
data.WriteUInt32(RecruitVirtualRealm);
data.WriteInt32(CharacterClass);
data.WriteInt32(CharacterGender);
data.WriteInt32(CharacterLevel);
data.WriteInt32(ClassRoles);
data.WriteInt32(PlayStyle);
data.WriteInt32(Availability);
data.WriteUInt32(SecondsSinceCreated);
data.WriteUInt32(SecondsUntilExpiration);
data.WriteBits(Name.GetByteCount(), 6);
data.WriteBits(Comment.GetByteCount(), 10);
data.FlushBits();
data.WriteString(Name);
data.WriteString(Comment);
}
public ObjectGuid RecruitGUID;
public string Name = "";
public uint RecruitVirtualRealm;
public string Comment = "";
public int CharacterClass;
public int CharacterGender;
public int CharacterLevel;
public int ClassRoles;
public int PlayStyle;
public int Availability;
public uint SecondsSinceCreated;
public uint SecondsUntilExpiration;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,164 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Framework.IO;
using Game.Entities;
using System.Collections.Generic;
using System;
using Game.DataStorage;
namespace Game.Networking.Packets
{
class DBQueryBulk : ClientPacket
{
public DBQueryBulk(WorldPacket packet) : base(packet) { }
public override void Read()
{
TableHash = _worldPacket.ReadUInt32();
uint count = _worldPacket.ReadBits<uint>(13);
for (uint i = 0; i < count; ++i)
{
Queries.Add(new DBQueryRecord(_worldPacket.ReadUInt32()));
}
}
public uint TableHash;
public List<DBQueryRecord> Queries = new List<DBQueryRecord>();
public struct DBQueryRecord
{
public DBQueryRecord(uint recordId)
{
RecordID = recordId;
}
public uint RecordID;
}
}
public class DBReply : ServerPacket
{
public DBReply() : base(ServerOpcodes.DbReply) { }
public override void Write()
{
_worldPacket.WriteUInt32(TableHash);
_worldPacket.WriteUInt32(RecordID);
_worldPacket.WriteUInt32(Timestamp);
_worldPacket.WriteBit(Allow);
_worldPacket.WriteUInt32(Data.GetSize());
_worldPacket.WriteBytes(Data.GetData());
}
public uint TableHash;
public uint Timestamp;
public uint RecordID;
public bool Allow;
public ByteBuffer Data = new ByteBuffer();
}
class AvailableHotfixes : ServerPacket
{
public AvailableHotfixes(int hotfixCacheVersion, uint hotfixCount, List<HotfixRecord> hotfixes) : base(ServerOpcodes.AvailableHotfixes)
{
HotfixCacheVersion = hotfixCacheVersion;
HotfixCount = hotfixCount;
Hotfixes = hotfixes;
}
public override void Write()
{
_worldPacket.WriteInt32(HotfixCacheVersion);
_worldPacket.WriteUInt32(HotfixCount);
foreach (HotfixRecord hotfixRecord in Hotfixes)
hotfixRecord.Write(_worldPacket);
}
public int HotfixCacheVersion;
public uint HotfixCount;
public List<HotfixRecord> Hotfixes;
}
class HotfixRequest : ClientPacket
{
public HotfixRequest(WorldPacket packet) : base(packet) { }
public override void Read()
{
ClientBuild = _worldPacket.ReadUInt32();
DataBuild = _worldPacket.ReadUInt32();
uint hotfixCount = _worldPacket.ReadUInt32();
for (var i = 0; i < hotfixCount; ++i)
{
HotfixRecord hotfixRecord = new HotfixRecord();
hotfixRecord.Read(_worldPacket);
Hotfixes.Add(hotfixRecord);
}
}
public uint ClientBuild;
public uint DataBuild;
public List<HotfixRecord> Hotfixes = new List<HotfixRecord>();
}
class HotfixResponse : ServerPacket
{
public HotfixResponse() : base(ServerOpcodes.HotfixResponse) { }
public override void Write()
{
_worldPacket.WriteInt32(Hotfixes.Count);
foreach (HotfixData hotfix in Hotfixes)
hotfix.Write(_worldPacket);
_worldPacket.WriteUInt32(HotfixContent.GetSize());
_worldPacket.WriteBytes(HotfixContent);
}
public List<HotfixData> Hotfixes = new List<HotfixData>();
public ByteBuffer HotfixContent = new ByteBuffer();
public class HotfixData
{
public void Write(WorldPacket data)
{
Record.Write(data);
if (Size.HasValue)
{
data.WriteUInt32(Size.Value);
data.WriteBit(true);
}
else
{
data.WriteUInt32(0);
data.WriteBit(false);
}
data.FlushBits();
}
public HotfixRecord Record;
public Optional<uint> Size;
}
}
}
@@ -0,0 +1,344 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System.Collections.Generic;
using System;
namespace Game.Networking.Packets
{
public class Inspect : ClientPacket
{
public Inspect(WorldPacket packet) : base(packet) { }
public override void Read()
{
Target = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Target;
}
public class InspectResult : ServerPacket
{
public InspectResult() : base(ServerOpcodes.InspectResult)
{
DisplayInfo = new PlayerModelDisplayInfo();
}
public override void Write()
{
DisplayInfo.Write(_worldPacket);
_worldPacket.WriteInt32(Glyphs.Count);
_worldPacket.WriteInt32(Talents.Count);
_worldPacket.WriteInt32(PvpTalents.Count);
_worldPacket.WriteInt32(ItemLevel);
_worldPacket.WriteUInt8(LifetimeMaxRank);
_worldPacket.WriteUInt16(TodayHK);
_worldPacket.WriteUInt16(YesterdayHK);
_worldPacket.WriteUInt32(LifetimeHK);
_worldPacket.WriteUInt32(HonorLevel);
for (int i = 0; i < Glyphs.Count; ++i)
_worldPacket.WriteUInt16(Glyphs[i]);
for (int i = 0; i < Talents.Count; ++i)
_worldPacket.WriteUInt16(Talents[i]);
for (int i = 0; i < PvpTalents.Count; ++i)
_worldPacket.WriteUInt16(PvpTalents[i]);
_worldPacket.WriteBit(GuildData.HasValue);
_worldPacket.WriteBit(AzeriteLevel.HasValue);
_worldPacket.FlushBits();
foreach (PVPBracketData bracket in Bracket)
bracket.Write(_worldPacket);
if (GuildData.HasValue)
GuildData.Value.Write(_worldPacket);
if (AzeriteLevel.HasValue)
_worldPacket.WriteUInt32((uint)AzeriteLevel);
}
public PlayerModelDisplayInfo DisplayInfo;
public List<ushort> Glyphs = new List<ushort>();
public List<ushort> Talents = new List<ushort>();
public List<ushort> PvpTalents = new List<ushort>();
public Optional<InspectGuildData> GuildData = new Optional<InspectGuildData>();
public Array<PVPBracketData> Bracket = new Array<PVPBracketData>(6);
public uint? AzeriteLevel;
public int ItemLevel;
public uint LifetimeHK;
public uint HonorLevel;
public ushort TodayHK;
public ushort YesterdayHK;
public byte LifetimeMaxRank;
}
public class QueryInspectAchievements : ClientPacket
{
public QueryInspectAchievements(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
/// RespondInspectAchievements in AchievementPackets
//Structs
public struct InspectEnchantData
{
public InspectEnchantData(uint id, byte index)
{
Id = id;
Index = index;
}
public void Write(WorldPacket data)
{
data.WriteUInt32(Id);
data.WriteUInt8(Index);
}
public uint Id;
public byte Index;
}
public class InspectItemData
{
public InspectItemData(Item item, byte index)
{
CreatorGUID = item.GetCreator();
Item = new ItemInstance(item);
Index = index;
Usable = true; // @todo
for (EnchantmentSlot enchant = 0; enchant < EnchantmentSlot.Max; ++enchant)
{
uint enchId = item.GetEnchantmentId(enchant);
if (enchId != 0)
Enchants.Add(new InspectEnchantData(enchId, (byte)enchant));
}
byte i = 0;
foreach (SocketedGem gemData in item.m_itemData.Gems)
{
if (gemData.ItemId != 0)
{
ItemGemData gem = new ItemGemData();
gem.Slot = i;
gem.Item = new ItemInstance(gemData);
Gems.Add(gem);
}
++i;
}
AzeriteItem azeriteItem = item.ToAzeriteItem();
if (azeriteItem != null)
{
SelectedAzeriteEssences essences = azeriteItem.GetSelectedAzeriteEssences();
if (essences != null)
{
for (byte slot = 0; slot < essences.AzeriteEssenceID.GetSize(); ++slot)
{
AzeriteEssenceData essence = new AzeriteEssenceData();
essence.Index = slot;
essence.AzeriteEssenceID = essences.AzeriteEssenceID[slot];
if (essence.AzeriteEssenceID != 0)
{
essence.Rank = azeriteItem.GetEssenceRank(essence.AzeriteEssenceID);
essence.SlotUnlocked = true;
}
else
essence.SlotUnlocked = azeriteItem.HasUnlockedEssenceSlot(slot);
AzeriteEssences.Add(essence);
}
}
}
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(CreatorGUID);
data.WriteUInt8(Index);
data.WriteInt32(AzeritePowers.Count);
data.WriteInt32(AzeriteEssences.Count);
foreach (var id in AzeritePowers)
data.WriteInt32(id);
Item.Write(data);
data.WriteBit(Usable);
data.WriteBits(Enchants.Count, 4);
data.WriteBits(Gems.Count, 2);
data.FlushBits();
foreach (var azeriteEssenceData in AzeriteEssences)
azeriteEssenceData.Write(data);
foreach (var enchantData in Enchants)
enchantData.Write(data);
foreach (var gem in Gems)
gem.Write(data);
}
public ObjectGuid CreatorGUID;
public ItemInstance Item;
public byte Index;
public bool Usable;
public List<InspectEnchantData> Enchants = new List<InspectEnchantData>();
public List<ItemGemData> Gems = new List<ItemGemData>();
public List<int> AzeritePowers = new List<int>();
public List<AzeriteEssenceData> AzeriteEssences = new List<AzeriteEssenceData>();
}
public class PlayerModelDisplayInfo
{
public ObjectGuid GUID;
public List<InspectItemData> Items = new List<InspectItemData>();
public string Name;
public uint SpecializationID;
public byte GenderID;
public byte Skin;
public byte HairColor;
public byte HairStyle;
public byte FacialHairStyle;
public byte Face;
public byte Race;
public byte ClassID;
public Array<byte> CustomDisplay = new Array<byte>(PlayerConst.CustomDisplaySize);
public void Initialize(Player player)
{
GUID = player.GetGUID();
SpecializationID = player.GetPrimarySpecialization();
Name = player.GetName();
GenderID = player.m_playerData.NativeSex;
Skin = player.m_playerData.SkinID;
HairColor = player.m_playerData.HairColorID;
HairStyle = player.m_playerData.HairStyleID;
FacialHairStyle = player.m_playerData.FacialHairStyleID;
Face = player.m_playerData.FaceID;
Race = (byte)player.GetRace();
ClassID = (byte)player.GetClass();
CustomDisplay.AddRange(player.m_playerData.CustomDisplayOption._values);
for (byte i = 0; i < EquipmentSlot.End; ++i)
{
Item item = player.GetItemByPos(InventorySlots.Bag0, i);
if (item != null)
Items.Add(new InspectItemData(item, i));
}
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(GUID);
data.WriteUInt32(SpecializationID);
data.WriteInt32(Items.Count);
data.WriteBits(Name.GetByteCount(), 6);
data.WriteUInt8(GenderID);
data.WriteUInt8(Skin);
data.WriteUInt8(HairColor);
data.WriteUInt8(HairStyle);
data.WriteUInt8(FacialHairStyle);
data.WriteUInt8(Face);
data.WriteUInt8(Race);
data.WriteUInt8(ClassID);
CustomDisplay.ForEach(id => data.WriteUInt8(id));
data.WriteString(Name);
foreach (InspectItemData item in Items)
item.Write(data);
}
}
public struct InspectGuildData
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(GuildGUID);
data.WriteInt32(NumGuildMembers);
data.WriteInt32(AchievementPoints);
}
public ObjectGuid GuildGUID;
public int NumGuildMembers;
public int AchievementPoints;
}
public struct PVPBracketData
{
public void Write(WorldPacket data)
{
data.WriteUInt8(Bracket);
data.WriteInt32(Rating);
data.WriteInt32(Rank);
data.WriteInt32(WeeklyPlayed);
data.WriteInt32(WeeklyWon);
data.WriteInt32(SeasonPlayed);
data.WriteInt32(SeasonWon);
data.WriteInt32(WeeklyBestRating);
data.WriteInt32(Unk710);
data.WriteInt32(Unk801_1);
data.WriteBit(Unk801_2);
data.FlushBits();
}
public int Rating;
public int Rank;
public int WeeklyPlayed;
public int WeeklyWon;
public int SeasonPlayed;
public int SeasonWon;
public int WeeklyBestRating;
public int Unk710;
public int Unk801_1;
public byte Bracket;
public bool Unk801_2;
}
public struct AzeriteEssenceData
{
public uint Index;
public uint AzeriteEssenceID;
public uint Rank;
public bool SlotUnlocked;
public void Write(WorldPacket data)
{
data.WriteUInt32(Index);
data.WriteUInt32(AzeriteEssenceID);
data.WriteUInt32(Rank);
data.WriteBit(SlotUnlocked);
data.FlushBits();
}
}
}
@@ -0,0 +1,297 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class UpdateLastInstance : ServerPacket
{
public UpdateLastInstance() : base(ServerOpcodes.UpdateLastInstance) { }
public override void Write()
{
_worldPacket.WriteUInt32(MapID);
}
public uint MapID;
}
class InstanceInfoPkt : ServerPacket
{
public InstanceInfoPkt() : base(ServerOpcodes.InstanceInfo) { }
public override void Write()
{
_worldPacket.WriteInt32(LockList.Count);
foreach (InstanceLock lockInfos in LockList)
lockInfos.Write(_worldPacket);
}
public List<InstanceLock> LockList = new List<InstanceLock>();
}
class ResetInstances : ClientPacket
{
public ResetInstances(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class InstanceReset : ServerPacket
{
public InstanceReset() : base(ServerOpcodes.InstanceReset) { }
public override void Write()
{
_worldPacket.WriteUInt32(MapID);
}
public uint MapID;
}
class InstanceResetFailed : ServerPacket
{
public InstanceResetFailed() : base(ServerOpcodes.InstanceResetFailed) { }
public override void Write()
{
_worldPacket.WriteUInt32(MapID);
_worldPacket.WriteBits(ResetFailedReason, 2);
_worldPacket.FlushBits();
}
public uint MapID;
public ResetFailedReason ResetFailedReason;
}
class ResetFailedNotify : ServerPacket
{
public ResetFailedNotify() : base(ServerOpcodes.ResetFailedNotify) { }
public override void Write() { }
}
class InstanceSaveCreated : ServerPacket
{
public InstanceSaveCreated() : base(ServerOpcodes.InstanceSaveCreated) { }
public override void Write()
{
_worldPacket.WriteBit(Gm);
_worldPacket.FlushBits();
}
public bool Gm;
}
class InstanceLockResponse : ClientPacket
{
public InstanceLockResponse(WorldPacket packet) : base(packet) { }
public override void Read()
{
AcceptLock = _worldPacket.HasBit();
}
public bool AcceptLock;
}
class RaidGroupOnly : ServerPacket
{
public RaidGroupOnly() : base(ServerOpcodes.RaidGroupOnly) { }
public override void Write()
{
_worldPacket.WriteInt32(Delay);
_worldPacket.WriteUInt32((uint)Reason);
}
public int Delay;
public RaidGroupReason Reason;
}
class PendingRaidLock : ServerPacket
{
public PendingRaidLock() : base(ServerOpcodes.PendingRaidLock) { }
public override void Write()
{
_worldPacket.WriteInt32(TimeUntilLock);
_worldPacket.WriteUInt32(CompletedMask);
_worldPacket.WriteBit(Extending);
_worldPacket.WriteBit(WarningOnly);
_worldPacket.FlushBits();
}
public int TimeUntilLock;
public uint CompletedMask;
public bool Extending;
public bool WarningOnly;
}
class RaidInstanceMessage : ServerPacket
{
public RaidInstanceMessage() : base(ServerOpcodes.RaidInstanceMessage) { }
public override void Write()
{
_worldPacket.WriteUInt8((byte)Type);
_worldPacket.WriteUInt32(MapID);
_worldPacket.WriteUInt32((uint)DifficultyID);
_worldPacket.WriteBit(Locked);
_worldPacket.WriteBit(Extended);
_worldPacket.FlushBits();
}
public InstanceResetWarningType Type;
public uint MapID;
public Difficulty DifficultyID;
public bool Locked;
public bool Extended;
}
class InstanceEncounterEngageUnit : ServerPacket
{
public InstanceEncounterEngageUnit() : base(ServerOpcodes.InstanceEncounterEngageUnit, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Unit);
_worldPacket.WriteUInt8(TargetFramePriority);
}
public ObjectGuid Unit;
public byte TargetFramePriority; // used to set the initial position of the frame if multiple frames are sent
}
class InstanceEncounterDisengageUnit : ServerPacket
{
public InstanceEncounterDisengageUnit() : base(ServerOpcodes.InstanceEncounterDisengageUnit, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Unit);
}
public ObjectGuid Unit;
}
class InstanceEncounterChangePriority : ServerPacket
{
public InstanceEncounterChangePriority() : base(ServerOpcodes.InstanceEncounterChangePriority, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Unit);
_worldPacket.WriteUInt8(TargetFramePriority);
}
public ObjectGuid Unit;
public byte TargetFramePriority; // used to update the position of the unit's current frame
}
class InstanceEncounterStart : ServerPacket
{
public InstanceEncounterStart() : base(ServerOpcodes.InstanceEncounterStart, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(InCombatResCount);
_worldPacket.WriteUInt32(MaxInCombatResCount);
_worldPacket.WriteUInt32(CombatResChargeRecovery);
_worldPacket.WriteUInt32(NextCombatResChargeTime);
_worldPacket.WriteBit(InProgress);
_worldPacket.FlushBits();
}
public uint InCombatResCount; // amount of usable battle ressurections
public uint MaxInCombatResCount;
public uint CombatResChargeRecovery;
public uint NextCombatResChargeTime;
public bool InProgress = true;
}
class InstanceEncounterEnd : ServerPacket
{
public InstanceEncounterEnd() : base(ServerOpcodes.InstanceEncounterEnd, ConnectionType.Instance) { }
public override void Write() { }
}
class InstanceEncounterInCombatResurrection : ServerPacket
{
public InstanceEncounterInCombatResurrection() : base(ServerOpcodes.InstanceEncounterInCombatResurrection, ConnectionType.Instance) { }
public override void Write() { }
}
class InstanceEncounterGainCombatResurrectionCharge : ServerPacket
{
public InstanceEncounterGainCombatResurrectionCharge() : base(ServerOpcodes.InstanceEncounterGainCombatResurrectionCharge, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(InCombatResCount);
_worldPacket.WriteUInt32(CombatResChargeRecovery);
}
public int InCombatResCount;
public uint CombatResChargeRecovery;
}
class BossKillCredit : ServerPacket
{
public BossKillCredit() : base(ServerOpcodes.BossKillCredit, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(DungeonEncounterID);
}
public uint DungeonEncounterID;
}
//Structs
public struct InstanceLock
{
public void Write(WorldPacket data)
{
data.WriteUInt32(MapID);
data.WriteUInt32(DifficultyID);
data.WriteUInt64(InstanceID);
data.WriteInt32(TimeRemaining);
data.WriteUInt32(CompletedMask);
data.WriteBit(Locked);
data.WriteBit(Extended);
data.FlushBits();
}
public ulong InstanceID;
public uint MapID;
public uint DifficultyID;
public int TimeRemaining;
public uint CompletedMask;
public bool Locked;
public bool Extended;
}
}
@@ -0,0 +1,992 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System.Collections.Generic;
using System.Linq;
namespace Game.Networking.Packets
{
public class BuyBackItem : ClientPacket
{
public BuyBackItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
VendorGUID = _worldPacket.ReadPackedGuid();
Slot = _worldPacket.ReadUInt32();
}
public ObjectGuid VendorGUID;
public uint Slot;
}
public class BuyItem : ClientPacket
{
public BuyItem(WorldPacket packet) : base(packet)
{
Item = new ItemInstance();
}
public override void Read()
{
VendorGUID = _worldPacket.ReadPackedGuid();
ContainerGUID = _worldPacket.ReadPackedGuid();
Quantity = _worldPacket.ReadInt32();
Muid = _worldPacket.ReadUInt32();
Slot = _worldPacket.ReadUInt32();
Item.Read(_worldPacket);
ItemType = (ItemVendorType)_worldPacket.ReadBits<int>(2);
}
public ObjectGuid VendorGUID;
public ItemInstance Item;
public uint Muid;
public uint Slot;
public ItemVendorType ItemType;
public int Quantity;
public ObjectGuid ContainerGUID;
}
public class BuySucceeded : ServerPacket
{
public BuySucceeded() : base(ServerOpcodes.BuySucceeded) { }
public override void Write()
{
_worldPacket.WritePackedGuid(VendorGUID);
_worldPacket.WriteUInt32(Muid);
_worldPacket.WriteUInt32(NewQuantity);
_worldPacket.WriteUInt32(QuantityBought);
}
public ObjectGuid VendorGUID;
public uint Muid;
public uint QuantityBought;
public uint NewQuantity;
}
public class BuyFailed : ServerPacket
{
public BuyFailed() : base(ServerOpcodes.BuyFailed) { }
public override void Write()
{
_worldPacket.WritePackedGuid(VendorGUID);
_worldPacket.WriteUInt32(Muid);
_worldPacket.WriteUInt8((byte)Reason);
}
public ObjectGuid VendorGUID;
public uint Muid;
public BuyResult Reason = BuyResult.CantFindItem;
}
public class GetItemPurchaseData : ClientPacket
{
public GetItemPurchaseData(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGUID;
}
class SetItemPurchaseData : ServerPacket
{
public SetItemPurchaseData() : base(ServerOpcodes.SetItemPurchaseData, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGUID);
Contents.Write(_worldPacket);
_worldPacket.WriteUInt32(Flags);
_worldPacket.WriteUInt32(PurchaseTime);
}
public uint PurchaseTime;
public uint Flags;
public ItemPurchaseContents Contents = new ItemPurchaseContents();
public ObjectGuid ItemGUID;
}
class ItemPurchaseRefund : ClientPacket
{
public ItemPurchaseRefund(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGUID;
}
class ItemPurchaseRefundResult : ServerPacket
{
public ItemPurchaseRefundResult() : base(ServerOpcodes.ItemPurchaseRefundResult, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt8(Result);
_worldPacket.WriteBit(Contents.HasValue);
_worldPacket.FlushBits();
if (Contents.HasValue)
Contents.Value.Write(_worldPacket);
}
public byte Result;
public ObjectGuid ItemGUID;
public Optional<ItemPurchaseContents> Contents;
}
class ItemExpirePurchaseRefund : ServerPacket
{
public ItemExpirePurchaseRefund() : base(ServerOpcodes.ItemExpirePurchaseRefund, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGUID);
}
public ObjectGuid ItemGUID;
}
public class RepairItem : ClientPacket
{
public RepairItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
NpcGUID = _worldPacket.ReadPackedGuid();
ItemGUID = _worldPacket.ReadPackedGuid();
UseGuildBank = _worldPacket.HasBit();
}
public ObjectGuid NpcGUID;
public ObjectGuid ItemGUID;
public bool UseGuildBank;
}
public class SellItem : ClientPacket
{
public SellItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
VendorGUID = _worldPacket.ReadPackedGuid();
ItemGUID = _worldPacket.ReadPackedGuid();
Amount = _worldPacket.ReadUInt32();
}
public ObjectGuid VendorGUID;
public ObjectGuid ItemGUID;
public uint Amount;
}
public class ItemTimeUpdate : ServerPacket
{
public ItemTimeUpdate() : base(ServerOpcodes.ItemTimeUpdate) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGuid);
_worldPacket.WriteUInt32(DurationLeft);
}
public ObjectGuid ItemGuid;
public uint DurationLeft;
}
public class SetProficiency : ServerPacket
{
public SetProficiency() : base(ServerOpcodes.SetProficiency, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(ProficiencyMask);
_worldPacket.WriteUInt8(ProficiencyClass);
}
public uint ProficiencyMask;
public byte ProficiencyClass;
}
public class InventoryChangeFailure : ServerPacket
{
public InventoryChangeFailure() : base(ServerOpcodes.InventoryChangeFailure) { }
public override void Write()
{
_worldPacket.WriteInt8((sbyte)BagResult);
_worldPacket.WritePackedGuid(Item[0]);
_worldPacket.WritePackedGuid(Item[1]);
_worldPacket.WriteUInt8(ContainerBSlot); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_WRONG_BAG_TYPE_2
switch (BagResult)
{
case InventoryResult.CantEquipLevelI:
case InventoryResult.PurchaseLevelTooLow:
_worldPacket.WriteInt32(Level);
break;
case InventoryResult.EventAutoequipBindConfirm:
_worldPacket.WritePackedGuid(SrcContainer);
_worldPacket.WriteInt32(SrcSlot);
_worldPacket.WritePackedGuid(DstContainer);
break;
case InventoryResult.ItemMaxLimitCategoryCountExceededIs:
case InventoryResult.ItemMaxLimitCategorySocketedExceededIs:
case InventoryResult.ItemMaxLimitCategoryEquippedExceededIs:
_worldPacket.WriteInt32(LimitCategory);
break;
}
}
public InventoryResult BagResult;
public byte ContainerBSlot;
public ObjectGuid SrcContainer;
public ObjectGuid DstContainer;
public int SrcSlot;
public int LimitCategory;
public int Level;
public ObjectGuid[] Item = new ObjectGuid[2];
}
public class SplitItem : ClientPacket
{
public SplitItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
FromPackSlot = _worldPacket.ReadUInt8();
FromSlot = _worldPacket.ReadUInt8();
ToPackSlot = _worldPacket.ReadUInt8();
ToSlot = _worldPacket.ReadUInt8();
Quantity = _worldPacket.ReadInt32();
}
public byte ToSlot;
public byte ToPackSlot;
public byte FromPackSlot;
public int Quantity;
public InvUpdate Inv;
public byte FromSlot;
}
public class SwapInvItem : ClientPacket
{
public SwapInvItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
Slot2 = _worldPacket.ReadUInt8();
Slot1 = _worldPacket.ReadUInt8();
}
public InvUpdate Inv;
public byte Slot1; // Source Slot
public byte Slot2; // Destination Slot
}
public class SwapItem : ClientPacket
{
public SwapItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
ContainerSlotB = _worldPacket.ReadUInt8();
ContainerSlotA = _worldPacket.ReadUInt8();
SlotB = _worldPacket.ReadUInt8();
SlotA = _worldPacket.ReadUInt8();
}
public InvUpdate Inv;
public byte SlotA;
public byte ContainerSlotB;
public byte SlotB;
public byte ContainerSlotA;
}
public class AutoEquipItem : ClientPacket
{
public AutoEquipItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
PackSlot = _worldPacket.ReadUInt8();
Slot = _worldPacket.ReadUInt8();
}
public byte Slot;
public InvUpdate Inv;
public byte PackSlot;
}
class AutoEquipItemSlot : ClientPacket
{
public AutoEquipItemSlot(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
Item = _worldPacket.ReadPackedGuid();
ItemDstSlot = _worldPacket.ReadUInt8();
}
public ObjectGuid Item;
public byte ItemDstSlot;
public InvUpdate Inv;
}
public class AutoStoreBagItem : ClientPacket
{
public AutoStoreBagItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
ContainerSlotB = _worldPacket.ReadUInt8();
ContainerSlotA = _worldPacket.ReadUInt8();
SlotA = _worldPacket.ReadUInt8();
}
public byte ContainerSlotB;
public InvUpdate Inv;
public byte ContainerSlotA;
public byte SlotA;
}
public class DestroyItem : ClientPacket
{
public DestroyItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Count = _worldPacket.ReadUInt32();
ContainerId = _worldPacket.ReadUInt8();
SlotNum = _worldPacket.ReadUInt8();
}
public uint Count;
public byte SlotNum;
public byte ContainerId;
}
public class SellResponse : ServerPacket
{
public SellResponse() : base(ServerOpcodes.SellResponse) { }
public override void Write()
{
_worldPacket.WritePackedGuid(VendorGUID);
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt8((byte)Reason);
}
public ObjectGuid VendorGUID;
public ObjectGuid ItemGUID;
public SellResult Reason = SellResult.Unk;
}
class ItemPushResult : ServerPacket
{
public ItemPushResult() : base(ServerOpcodes.ItemPushResult) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PlayerGUID);
_worldPacket.WriteUInt8(Slot);
_worldPacket.WriteInt32(SlotInBag);
_worldPacket.WriteInt32(QuestLogItemID);
_worldPacket.WriteUInt32(Quantity);
_worldPacket.WriteUInt32(QuantityInInventory);
_worldPacket.WriteInt32(DungeonEncounterID);
_worldPacket.WriteInt32(BattlePetSpeciesID);
_worldPacket.WriteInt32(BattlePetBreedID);
_worldPacket.WriteUInt32(BattlePetBreedQuality);
_worldPacket.WriteInt32(BattlePetLevel);
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteBit(Pushed);
_worldPacket.WriteBit(Created);
_worldPacket.WriteBits((uint)DisplayText, 3);
_worldPacket.WriteBit(IsBonusRoll);
_worldPacket.WriteBit(IsEncounterLoot);
_worldPacket.FlushBits();
Item.Write(_worldPacket);
}
public ObjectGuid PlayerGUID;
public byte Slot;
public int SlotInBag;
public ItemInstance Item;
public int QuestLogItemID;// Item ID used for updating quest progress
// only set if different than real ID (similar to CreatureTemplate.KillCredit)
public uint Quantity;
public uint QuantityInInventory;
public int DungeonEncounterID;
public int BattlePetSpeciesID;
public int BattlePetBreedID;
public uint BattlePetBreedQuality;
public int BattlePetLevel;
public ObjectGuid ItemGUID;
public bool Pushed;
public DisplayType DisplayText;
public bool Created;
public bool IsBonusRoll;
public bool IsEncounterLoot;
public enum DisplayType
{
Hidden = 0,
Normal = 1,
EncounterLoot = 2
}
}
class ReadItem : ClientPacket
{
public ReadItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
PackSlot = _worldPacket.ReadUInt8();
Slot = _worldPacket.ReadUInt8();
}
public byte PackSlot;
public byte Slot;
}
class ReadItemResultFailed : ServerPacket
{
public ReadItemResultFailed() : base(ServerOpcodes.ReadItemResultFailed) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Item);
_worldPacket.WriteUInt32(Delay);
_worldPacket.WriteBits(Subcode, 2);
_worldPacket.FlushBits();
}
public ObjectGuid Item;
public byte Subcode;
public uint Delay;
}
class ReadItemResultOK : ServerPacket
{
public ReadItemResultOK() : base(ServerOpcodes.ReadItemResultOk) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Item);
}
public ObjectGuid Item;
}
class WrapItem : ClientPacket
{
public WrapItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Inv = new InvUpdate(_worldPacket);
}
public InvUpdate Inv;
}
class EnchantmentLog : ServerPacket
{
public EnchantmentLog() : base(ServerOpcodes.EnchantmentLog) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Caster);
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(ItemGUID);
_worldPacket.WriteUInt32(ItemID);
_worldPacket.WriteUInt32(Enchantment);
_worldPacket.WriteUInt32(EnchantSlot);
}
public ObjectGuid Caster;
public ObjectGuid Owner;
public ObjectGuid ItemGUID;
public uint ItemID;
public uint EnchantSlot;
public uint Enchantment;
}
class CancelTempEnchantment : ClientPacket
{
public CancelTempEnchantment(WorldPacket packet) : base(packet) { }
public override void Read()
{
Slot = _worldPacket.ReadInt32();
}
public int Slot;
}
class ItemCooldown : ServerPacket
{
public ItemCooldown() : base(ServerOpcodes.ItemCooldown) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGuid);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt32(Cooldown);
}
public ObjectGuid ItemGuid;
public uint SpellID;
public uint Cooldown;
}
class ItemEnchantTimeUpdate : ServerPacket
{
public ItemEnchantTimeUpdate() : base(ServerOpcodes.ItemEnchantTimeUpdate, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(ItemGuid);
_worldPacket.WriteUInt32(DurationLeft);
_worldPacket.WriteUInt32(Slot);
_worldPacket.WritePackedGuid(OwnerGuid);
}
public ObjectGuid OwnerGuid;
public ObjectGuid ItemGuid;
public uint DurationLeft;
public uint Slot;
}
class UseCritterItem : ClientPacket
{
public UseCritterItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGuid;
}
class SocketGems : ClientPacket
{
public SocketGems(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGuid = _worldPacket.ReadPackedGuid();
for (int i = 0; i < ItemConst.MaxGemSockets; ++i)
GemItem[i] = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGuid;
public ObjectGuid[] GemItem = new ObjectGuid[ItemConst.MaxGemSockets];
}
class SocketGemsResult : ServerPacket
{
public SocketGemsResult() : base(ServerOpcodes.SocketGems, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Item);
}
public ObjectGuid Item;
}
class SortBags : ClientPacket
{
public SortBags(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class SortBankBags : ClientPacket
{
public SortBankBags(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class SortReagentBankBags : ClientPacket
{
public SortReagentBankBags(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class SortBagsResult : ServerPacket
{
public SortBagsResult() : base(ServerOpcodes.SortBagsResult, ConnectionType.Instance) { }
public override void Write() { }
}
class RemoveNewItem : ClientPacket
{
public RemoveNewItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGuid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGuid { get; set; }
}
class CharacterInventoryOverflowWarning : ServerPacket
{
public CharacterInventoryOverflowWarning() : base(ServerOpcodes.CharacterInventoryOverflowWarning) { }
public override void Write() { }
}
//Structs
public class ItemBonusInstanceData
{
public void Write(WorldPacket data)
{
data.WriteUInt8((byte)Context);
data.WriteInt32(BonusListIDs.Count);
foreach (uint bonusID in BonusListIDs)
data.WriteUInt32(bonusID);
}
public void Read(WorldPacket data)
{
Context = (ItemContext)data.ReadUInt8();
uint bonusListIdSize = data.ReadUInt32();
BonusListIDs = new List<uint>();
for (uint i = 0u; i < bonusListIdSize; ++i)
{
uint bonusId = data.ReadUInt32();
BonusListIDs.Add(bonusId);
}
}
public override int GetHashCode()
{
return Context.GetHashCode() ^ BonusListIDs.GetHashCode();
}
public override bool Equals(object obj)
{
if (obj is ItemBonusInstanceData)
return (ItemBonusInstanceData)obj == this;
return false;
}
public static bool operator ==(ItemBonusInstanceData left, ItemBonusInstanceData right)
{
if (left.Context != right.Context)
return false;
if (left.BonusListIDs.Count != right.BonusListIDs.Count)
return false;
return left.BonusListIDs.SequenceEqual(right.BonusListIDs);
}
public static bool operator !=(ItemBonusInstanceData left, ItemBonusInstanceData right)
{
return !(left == right);
}
public ItemContext Context;
public List<uint> BonusListIDs = new List<uint>();
}
public class ItemInstance
{
public ItemInstance() { }
public ItemInstance(Item item)
{
ItemID = item.GetEntry();
List<uint> bonusListIds = item.m_itemData.BonusListIDs;
if (!bonusListIds.Empty())
{
ItemBonus.HasValue = true;
ItemBonus.Value.BonusListIDs.AddRange(bonusListIds);
ItemBonus.Value.Context = item.GetContext();
}
uint mask = item.m_itemData.ModifiersMask;
if (mask != 0)
{
Modifications.HasValue = true;
for (int i = 0; mask != 0; mask >>= 1, ++i)
{
if ((mask & 1) != 0)
Modifications.Value.Insert(i, (int)item.GetModifier((ItemModifier)i));
}
}
}
public ItemInstance(Loots.LootItem lootItem)
{
ItemID = lootItem.itemid;
if (!lootItem.BonusListIDs.Empty() || lootItem.randomBonusListId != 0)
{
ItemBonus.HasValue = true;
ItemBonus.Value.BonusListIDs = lootItem.BonusListIDs;
ItemBonus.Value.Context = lootItem.context;
if (lootItem.randomBonusListId != 0)
ItemBonus.Value.BonusListIDs.Add(lootItem.randomBonusListId);
}
}
public ItemInstance(VoidStorageItem voidItem)
{
ItemID = voidItem.ItemEntry;
if (voidItem.FixedScalingLevel != 0 || voidItem.ArtifactKnowledgeLevel != 0)
{
Modifications.HasValue = true;
if (voidItem.FixedScalingLevel != 0)
Modifications.Value.Insert((int)ItemModifier.TimewalkerLevel, (int)voidItem.FixedScalingLevel);
if (voidItem.ArtifactKnowledgeLevel != 0)
Modifications.Value.Insert((int)ItemModifier.ArtifactKnowledgeLevel, (int)voidItem.ArtifactKnowledgeLevel);
}
if (!voidItem.BonusListIDs.Empty())
{
ItemBonus.HasValue = true;
ItemBonus.Value.Context = voidItem.Context;
ItemBonus.Value.BonusListIDs = voidItem.BonusListIDs;
}
}
public ItemInstance(SocketedGem gem)
{
ItemID = gem.ItemId;
ItemBonusInstanceData bonus = new ItemBonusInstanceData();
bonus.Context = (ItemContext)(byte)gem.Context;
foreach (ushort bonusListId in gem.BonusListIDs)
if (bonusListId != 0)
bonus.BonusListIDs.Add(bonusListId);
if (bonus.Context != 0 || !bonus.BonusListIDs.Empty())
ItemBonus.Set(bonus);
}
public void Write(WorldPacket data)
{
data.WriteUInt32(ItemID);
data.WriteBit(ItemBonus.HasValue);
data.WriteBit(Modifications.HasValue);
data.FlushBits();
if (ItemBonus.HasValue)
ItemBonus.Value.Write(data);
if (Modifications.HasValue)
Modifications.Value.Write(data);
}
public void Read(WorldPacket data)
{
ItemID = data.ReadUInt32();
ItemBonus.HasValue = data.HasBit();
Modifications.HasValue = data.HasBit();
data.ResetBitPos();
if (ItemBonus.HasValue)
ItemBonus.Value.Read(data);
if (Modifications.HasValue)
Modifications.Value.Read(data);
}
public override int GetHashCode()
{
return ItemID.GetHashCode() ^ ItemBonus.GetHashCode() ^ Modifications.GetHashCode();
}
public override bool Equals(object obj)
{
if (obj is ItemInstance)
return (ItemInstance)obj == this;
return false;
}
public static bool operator ==(ItemInstance left, ItemInstance right)
{
if (left.ItemID != right.ItemID)
return false;
if (left.ItemBonus.HasValue != right.ItemBonus.HasValue || left.Modifications.HasValue != right.Modifications.HasValue)
return false;
if (left.Modifications.HasValue && left.Modifications.Value != right.Modifications.Value)
return false;
if (left.ItemBonus.HasValue && left.ItemBonus.Value != right.ItemBonus.Value)
return false;
return true;
}
public static bool operator !=(ItemInstance left, ItemInstance right)
{
return !(left == right);
}
public uint ItemID;
public Optional<ItemBonusInstanceData> ItemBonus;
public Optional<CompactArray> Modifications;
}
public class ItemEnchantData
{
public ItemEnchantData(uint id, uint expiration, int charges, byte slot)
{
ID = id;
Expiration = expiration;
Charges = charges;
Slot = slot;
}
public void Write(WorldPacket data)
{
data.WriteUInt32(ID);
data.WriteUInt32(Expiration);
data.WriteInt32(Charges);
data.WriteUInt8(Slot);
}
public uint ID;
public uint Expiration;
public int Charges;
public byte Slot;
}
public class ItemGemData
{
public void Write(WorldPacket data)
{
data.WriteUInt8(Slot);
Item.Write(data);
}
public void Read(WorldPacket data)
{
Slot = data.ReadUInt8();
Item.Read(data);
}
public byte Slot;
public ItemInstance Item = new ItemInstance();
}
public struct InvUpdate
{
public InvUpdate(WorldPacket data)
{
Items = new List<InvItem>();
int size = data.ReadBits<int>(2);
for (int i = 0; i < size; ++i)
{
var item = new InvItem
{
ContainerSlot = data.ReadUInt8(),
Slot = data.ReadUInt8()
};
Items.Add(item);
}
}
public List<InvItem> Items;
public struct InvItem
{
public byte ContainerSlot;
public byte Slot;
}
}
struct ItemPurchaseRefundItem
{
public void Write(WorldPacket data)
{
data.WriteUInt32(ItemID);
data.WriteUInt32(ItemCount);
}
public uint ItemID;
public uint ItemCount;
}
struct ItemPurchaseRefundCurrency
{
public void Write(WorldPacket data)
{
data.WriteUInt32(CurrencyID);
data.WriteUInt32(CurrencyCount);
}
public uint CurrencyID;
public uint CurrencyCount;
}
class ItemPurchaseContents
{
public void Write(WorldPacket data)
{
data.WriteUInt64(Money);
for (int i = 0; i < 5; ++i)
Items[i].Write(data);
for (int i = 0; i < 5; ++i)
Currencies[i].Write(data);
}
public ulong Money;
public ItemPurchaseRefundItem[] Items = new ItemPurchaseRefundItem[5];
public ItemPurchaseRefundCurrency[] Currencies = new ItemPurchaseRefundCurrency[5];
}
}
@@ -0,0 +1,796 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class DFJoin : ClientPacket
{
public DFJoin(WorldPacket packet) : base(packet) { }
public override void Read()
{
QueueAsGroup = _worldPacket.HasBit();
Unknown = _worldPacket.HasBit();
PartyIndex = _worldPacket.ReadUInt8();
Roles = (LfgRoles)_worldPacket.ReadUInt32();
var slotsCount = _worldPacket.ReadInt32();
for (var i = 0; i < slotsCount; ++i) // Slots
Slots.Add(_worldPacket.ReadUInt32());
}
public bool QueueAsGroup;
bool Unknown; // Always false in 7.2.5
public byte PartyIndex;
public LfgRoles Roles;
public List<uint> Slots = new List<uint>();
}
class DFLeave : ClientPacket
{
public DFLeave(WorldPacket packet) : base(packet) { }
public override void Read()
{
Ticket.Read(_worldPacket);
}
public RideTicket Ticket = new RideTicket();
}
class DFProposalResponse : ClientPacket
{
public DFProposalResponse(WorldPacket packet) : base(packet) { }
public override void Read()
{
Ticket.Read(_worldPacket);
InstanceID = _worldPacket.ReadUInt64();
ProposalID = _worldPacket.ReadUInt32();
Accepted = _worldPacket.HasBit();
}
public RideTicket Ticket = new RideTicket();
public ulong InstanceID;
public uint ProposalID;
public bool Accepted;
}
class DFSetRoles : ClientPacket
{
public DFSetRoles(WorldPacket packet) : base(packet) { }
public override void Read()
{
RolesDesired = (LfgRoles)_worldPacket.ReadUInt32();
PartyIndex = _worldPacket.ReadUInt8();
}
public LfgRoles RolesDesired;
public byte PartyIndex;
}
class DFBootPlayerVote : ClientPacket
{
public DFBootPlayerVote(WorldPacket packet) : base(packet) { }
public override void Read()
{
Vote = _worldPacket.HasBit();
}
public bool Vote;
}
class DFTeleport : ClientPacket
{
public DFTeleport(WorldPacket packet) : base(packet) { }
public override void Read()
{
TeleportOut = _worldPacket.HasBit();
}
public bool TeleportOut;
}
class DFGetSystemInfo : ClientPacket
{
public DFGetSystemInfo(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player = _worldPacket.HasBit();
PartyIndex = _worldPacket.ReadUInt8();
}
public byte PartyIndex;
public bool Player;
}
class DFGetJoinStatus : ClientPacket
{
public DFGetJoinStatus(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class LfgPlayerInfo : ServerPacket
{
public LfgPlayerInfo() : base(ServerOpcodes.LfgPlayerInfo, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Dungeons.Count);
BlackList.Write(_worldPacket);
foreach (var dungeonInfo in Dungeons)
dungeonInfo.Write(_worldPacket);
}
public LFGBlackList BlackList = new LFGBlackList();
public List<LfgPlayerDungeonInfo> Dungeons = new List<LfgPlayerDungeonInfo>();
}
class LfgPartyInfo : ServerPacket
{
public LfgPartyInfo() : base(ServerOpcodes.LfgPartyInfo, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Player.Count);
foreach (var blackList in Player)
blackList.Write(_worldPacket);
}
public List<LFGBlackList> Player = new List<LFGBlackList>();
}
class LFGUpdateStatus : ServerPacket
{
public LFGUpdateStatus() : base(ServerOpcodes.LfgUpdateStatus) { }
public override void Write()
{
Ticket.Write(_worldPacket);
_worldPacket.WriteUInt8(SubType);
_worldPacket.WriteUInt8(Reason);
_worldPacket.WriteInt32(Slots.Count);
_worldPacket.WriteUInt32(RequestedRoles);
_worldPacket.WriteInt32(SuspendedPlayers.Count);
_worldPacket.WriteUInt32(QueueMapID);
foreach (var slot in Slots)
_worldPacket.WriteUInt32(slot);
foreach (var player in SuspendedPlayers)
_worldPacket.WritePackedGuid(player);
_worldPacket.WriteBit(IsParty);
_worldPacket.WriteBit(NotifyUI);
_worldPacket.WriteBit(Joined);
_worldPacket.WriteBit(LfgJoined);
_worldPacket.WriteBit(Queued);
_worldPacket.WriteBit(Unused);
_worldPacket.FlushBits();
}
public RideTicket Ticket = new RideTicket();
public byte SubType;
public byte Reason;
public List<uint> Slots = new List<uint>();
public uint RequestedRoles;
public List<ObjectGuid> SuspendedPlayers = new List<ObjectGuid>();
public uint QueueMapID;
public bool NotifyUI;
public bool IsParty;
public bool Joined;
public bool LfgJoined;
public bool Queued;
public bool Unused;
}
class RoleChosen : ServerPacket
{
public RoleChosen() : base(ServerOpcodes.RoleChosen) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteUInt32((uint)RoleMask);
_worldPacket.WriteBit(Accepted);
_worldPacket.FlushBits();
}
public ObjectGuid Player;
public LfgRoles RoleMask;
public bool Accepted;
}
class LFGRoleCheckUpdate : ServerPacket
{
public LFGRoleCheckUpdate() : base(ServerOpcodes.LfgRoleCheckUpdate) { }
public override void Write()
{
_worldPacket.WriteUInt8(PartyIndex);
_worldPacket.WriteUInt8(RoleCheckStatus);
_worldPacket.WriteInt32(JoinSlots.Count);
_worldPacket.WriteInt32(BgQueueIDs.Count);
_worldPacket.WriteInt32(GroupFinderActivityID);
_worldPacket.WriteInt32(Members.Count);
foreach (var slot in JoinSlots)
_worldPacket.WriteUInt32(slot);
foreach (ulong bgQueueID in BgQueueIDs)
_worldPacket.WriteUInt64(bgQueueID);
_worldPacket.WriteBit(IsBeginning);
_worldPacket.WriteBit(IsRequeue);
_worldPacket.FlushBits();
foreach (var member in Members)
member.Write(_worldPacket);
}
public byte PartyIndex;
public byte RoleCheckStatus;
public List<uint> JoinSlots = new List<uint>();
public List<ulong> BgQueueIDs = new List<ulong>();
public int GroupFinderActivityID = 0;
public List<LFGRoleCheckUpdateMember> Members = new List<LFGRoleCheckUpdateMember>();
public bool IsBeginning;
public bool IsRequeue;
}
class LFGJoinResult : ServerPacket
{
public LFGJoinResult() : base(ServerOpcodes.LfgJoinResult) { }
public override void Write()
{
Ticket.Write(_worldPacket);
_worldPacket.WriteUInt8(Result);
_worldPacket.WriteUInt8(ResultDetail);
_worldPacket.WriteInt32(BlackList.Count);
_worldPacket.WriteInt32(BlackListNames.Count);
foreach (LFGJoinBlackList blackList in BlackList)
blackList.Write(_worldPacket);
foreach (string str in BlackListNames)
_worldPacket.WriteBits(str.GetByteCount() + 1, 24);
foreach (string str in BlackListNames)
if (!str.IsEmpty())
_worldPacket.WriteCString(str);
}
public RideTicket Ticket = new RideTicket();
public byte Result;
public byte ResultDetail;
public List<LFGJoinBlackList> BlackList = new List<LFGJoinBlackList>();
public List<string> BlackListNames = new List<string>();
}
class LFGQueueStatus : ServerPacket
{
public LFGQueueStatus() : base(ServerOpcodes.LfgQueueStatus) { }
public override void Write()
{
Ticket.Write(_worldPacket);
_worldPacket.WriteUInt32(Slot);
_worldPacket.WriteUInt32(AvgWaitTimeMe);
_worldPacket.WriteUInt32(AvgWaitTime);
for (int i = 0; i < 3; i++)
{
_worldPacket.WriteUInt32(AvgWaitTimeByRole[i]);
_worldPacket.WriteUInt8(LastNeeded[i]);
}
_worldPacket.WriteUInt32(QueuedTime);
}
public RideTicket Ticket;
public uint Slot;
public uint AvgWaitTimeMe;
public uint AvgWaitTime;
public uint[] AvgWaitTimeByRole = new uint[3];
public byte[] LastNeeded = new byte[3];
public uint QueuedTime;
}
class LFGPlayerReward : ServerPacket
{
public LFGPlayerReward() : base(ServerOpcodes.LfgPlayerReward) { }
public override void Write()
{
_worldPacket.WriteUInt32(QueuedSlot);
_worldPacket.WriteUInt32(ActualSlot);
_worldPacket.WriteUInt32(RewardMoney);
_worldPacket.WriteUInt32(AddedXP);
_worldPacket.WriteInt32(Rewards.Count);
foreach (var reward in Rewards)
reward.Write(_worldPacket);
}
public uint QueuedSlot;
public uint ActualSlot;
public uint RewardMoney;
public uint AddedXP;
public List<LFGPlayerRewards> Rewards = new List<LFGPlayerRewards>();
}
class LfgBootPlayer : ServerPacket
{
public LfgBootPlayer() : base(ServerOpcodes.LfgBootPlayer, ConnectionType.Instance) { }
public override void Write()
{
Info.Write(_worldPacket);
}
public LfgBootInfo Info = new LfgBootInfo();
}
class LFGProposalUpdate : ServerPacket
{
public LFGProposalUpdate() : base(ServerOpcodes.LfgProposalUpdate) { }
public override void Write()
{
Ticket.Write(_worldPacket);
_worldPacket.WriteUInt64(InstanceID);
_worldPacket.WriteUInt32(ProposalID);
_worldPacket.WriteUInt32(Slot);
_worldPacket.WriteUInt8(State);
_worldPacket.WriteUInt32(CompletedMask);
_worldPacket.WriteUInt32(EncounterMask);
_worldPacket.WriteInt32(Players.Count);
_worldPacket.WriteUInt8(Unused);
_worldPacket.WriteBit(ValidCompletedMask);
_worldPacket.WriteBit(ProposalSilent);
_worldPacket.WriteBit(IsRequeue);
_worldPacket.FlushBits();
foreach (var player in Players)
player.Write(_worldPacket);
}
public RideTicket Ticket;
public ulong InstanceID;
public uint ProposalID;
public uint Slot;
public byte State;
public uint CompletedMask;
public uint EncounterMask;
public byte Unused;
public bool ValidCompletedMask;
public bool ProposalSilent;
public bool IsRequeue;
public List<LFGProposalUpdatePlayer> Players = new List<LFGProposalUpdatePlayer>();
}
class LfgDisabled : ServerPacket
{
public LfgDisabled() : base(ServerOpcodes.LfgDisabled, ConnectionType.Instance) { }
public override void Write() { }
}
class LfgOfferContinue : ServerPacket
{
public LfgOfferContinue(uint slot) : base(ServerOpcodes.LfgOfferContinue, ConnectionType.Instance)
{
Slot = slot;
}
public override void Write()
{
_worldPacket.WriteUInt32(Slot);
}
public uint Slot;
}
class LfgTeleportDenied : ServerPacket
{
public LfgTeleportDenied(LfgTeleportResult reason) : base(ServerOpcodes.LfgTeleportDenied, ConnectionType.Instance)
{
Reason = reason;
}
public override void Write()
{
_worldPacket.WriteBits(Reason, 4);
_worldPacket.FlushBits();
}
public LfgTeleportResult Reason;
}
//Structs
public class LFGBlackListSlot
{
public LFGBlackListSlot(uint slot, uint reason, int subReason1, int subReason2)
{
Slot = slot;
Reason = reason;
SubReason1 = subReason1;
SubReason2 = subReason2;
}
public uint Slot { get; set; }
public uint Reason { get; set; }
public int SubReason1 { get; set; }
public int SubReason2 { get; set; }
}
public class LFGBlackList
{
public void Write(WorldPacket data)
{
data.WriteBit(PlayerGuid.HasValue);
data.WriteInt32(Slot.Count);
if (PlayerGuid.HasValue)
data.WritePackedGuid(PlayerGuid.Value);
foreach (LFGBlackListSlot lfgBlackListSlot in Slot)
{
data.WriteUInt32(lfgBlackListSlot.Slot);
data.WriteUInt32(lfgBlackListSlot.Reason);
data.WriteInt32(lfgBlackListSlot.SubReason1);
data.WriteInt32(lfgBlackListSlot.SubReason2);
}
}
public Optional<ObjectGuid> PlayerGuid;
public List<LFGBlackListSlot> Slot = new List<LFGBlackListSlot>();
}
public struct LfgPlayerQuestRewardItem
{
public LfgPlayerQuestRewardItem(uint itemId, uint quantity)
{
ItemID = itemId;
Quantity = quantity;
}
public uint ItemID;
public uint Quantity;
}
public struct LfgPlayerQuestRewardCurrency
{
public LfgPlayerQuestRewardCurrency(uint currencyId, uint quantity)
{
CurrencyID = currencyId;
Quantity = quantity;
}
public uint CurrencyID;
public uint Quantity;
}
public class LfgPlayerQuestReward
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Mask);
data.WriteUInt32(RewardMoney);
data.WriteUInt32(RewardXP);
data.WriteInt32(Item.Count);
data.WriteInt32(Currency.Count);
data.WriteInt32(BonusCurrency.Count);
// Item
foreach (var item in Item)
{
data.WriteUInt32(item.ItemID);
data.WriteUInt32(item.Quantity);
}
// Currency
foreach (var currency in Currency)
{
data.WriteUInt32(currency.CurrencyID);
data.WriteUInt32(currency.Quantity);
}
// BonusCurrency
foreach (var bonusCurrency in BonusCurrency)
{
data.WriteUInt32(bonusCurrency.CurrencyID);
data.WriteUInt32(bonusCurrency.Quantity);
}
data.WriteBit(RewardSpellID.HasValue);
data.WriteBit(Unused1.HasValue);
data.WriteBit(Unused2.HasValue);
data.WriteBit(Honor.HasValue);
data.FlushBits();
if (RewardSpellID.HasValue)
data.WriteInt32(RewardSpellID.Value);
if (Unused1.HasValue)
data.WriteInt32(Unused1.Value);
if (Unused2.HasValue)
data.WriteUInt64(Unused2.Value);
if (Honor.HasValue)
data.WriteInt32(Honor.Value);
}
public uint Mask;
public uint RewardMoney;
public uint RewardXP;
public List<LfgPlayerQuestRewardItem> Item = new List<LfgPlayerQuestRewardItem>();
public List<LfgPlayerQuestRewardCurrency> Currency = new List<LfgPlayerQuestRewardCurrency>();
public List<LfgPlayerQuestRewardCurrency> BonusCurrency = new List<LfgPlayerQuestRewardCurrency>();
public Optional<int> RewardSpellID; // Only used by SMSG_LFG_PLAYER_INFO
public Optional<int> Unused1;
public Optional<ulong> Unused2;
public Optional<int> Honor; // Only used by SMSG_REQUEST_PVP_REWARDS_RESPONSE
}
public class LfgPlayerDungeonInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Slot);
data.WriteInt32(CompletionQuantity);
data.WriteInt32(CompletionLimit);
data.WriteInt32(CompletionCurrencyID);
data.WriteInt32(SpecificQuantity);
data.WriteInt32(SpecificLimit);
data.WriteInt32(OverallQuantity);
data.WriteInt32(OverallLimit);
data.WriteInt32(PurseWeeklyQuantity);
data.WriteInt32(PurseWeeklyLimit);
data.WriteInt32(PurseQuantity);
data.WriteInt32(PurseLimit);
data.WriteInt32(Quantity);
data.WriteUInt32(CompletedMask);
data.WriteUInt32(EncounterMask);
data.WriteInt32(ShortageReward.Count);
data.WriteBit(FirstReward);
data.WriteBit(ShortageEligible);
data.FlushBits();
Rewards.Write(data);
foreach (var shortageReward in ShortageReward)
shortageReward.Write(data);
}
public uint Slot;
public int CompletionQuantity;
public int CompletionLimit;
public int CompletionCurrencyID;
public int SpecificQuantity;
public int SpecificLimit;
public int OverallQuantity;
public int OverallLimit;
public int PurseWeeklyQuantity;
public int PurseWeeklyLimit;
public int PurseQuantity;
public int PurseLimit;
public int Quantity;
public uint CompletedMask;
public uint EncounterMask;
public bool FirstReward;
public bool ShortageEligible;
public LfgPlayerQuestReward Rewards = new LfgPlayerQuestReward();
public List<LfgPlayerQuestReward> ShortageReward = new List<LfgPlayerQuestReward>();
}
public class LFGRoleCheckUpdateMember
{
public LFGRoleCheckUpdateMember(ObjectGuid guid, uint rolesDesired, byte level, bool roleCheckComplete)
{
Guid = guid;
RolesDesired = rolesDesired;
Level = level;
RoleCheckComplete = roleCheckComplete;
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WriteUInt32(RolesDesired);
data.WriteUInt8(Level);
data.WriteBit(RoleCheckComplete);
data.FlushBits();
}
public ObjectGuid Guid;
public uint RolesDesired;
public byte Level;
public bool RoleCheckComplete;
}
public struct LFGJoinBlackListSlot
{
public LFGJoinBlackListSlot(int slot, int reason, int subReason1, int subReason2)
{
Slot = slot;
Reason = reason;
SubReason1 = subReason1;
SubReason2 = subReason2;
}
public int Slot { get; set; }
public int Reason { get; set; }
public int SubReason1 { get; set; }
public int SubReason2 { get; set; }
}
public class LFGJoinBlackList
{
public void Write(WorldPacket data)
{
data.WritePackedGuid(PlayerGuid);
data.WriteInt32(Slots.Count);
foreach (LFGJoinBlackListSlot lfgBlackListSlot in Slots)
{
data.WriteInt32(lfgBlackListSlot.Slot);
data.WriteInt32(lfgBlackListSlot.Reason);
data.WriteInt32(lfgBlackListSlot.SubReason1);
data.WriteInt32(lfgBlackListSlot.SubReason2);
}
}
public ObjectGuid PlayerGuid;
public List<LFGJoinBlackListSlot> Slots = new List<LFGJoinBlackListSlot>();
}
public struct LFGPlayerRewards
{
public LFGPlayerRewards(uint id, uint quantity, int bonusQuantity, bool isCurrency)
{
Quantity = quantity;
BonusQuantity = bonusQuantity;
RewardItem = new Optional<ItemInstance>();
RewardCurrency = new Optional<uint>();
if (!isCurrency)
{
RewardItem.HasValue = true;
RewardItem.Value.ItemID = id;
}
else
{
RewardCurrency.Set(id);
}
}
public void Write(WorldPacket data)
{
data.WriteBit(RewardItem.HasValue);
data.WriteBit(RewardCurrency.HasValue);
if (RewardItem.HasValue)
RewardItem.Value.Write(data);
data.WriteUInt32(Quantity);
data.WriteInt32(BonusQuantity);
if (RewardCurrency.HasValue)
data.WriteUInt32(RewardCurrency.Value);
}
public Optional<ItemInstance> RewardItem;
public Optional<uint> RewardCurrency;
public uint Quantity;
public int BonusQuantity;
}
public class LfgBootInfo
{
public void Write(WorldPacket data)
{
data.WriteBit(VoteInProgress);
data.WriteBit(VotePassed);
data.WriteBit(MyVoteCompleted);
data.WriteBit(MyVote);
data.WriteBits(Reason.GetByteCount(), 8);
data.WritePackedGuid(Target);
data.WriteUInt32(TotalVotes);
data.WriteUInt32(BootVotes);
data.WriteUInt32(TimeLeft);
data.WriteUInt32(VotesNeeded);
data.WriteString(Reason);
}
public bool VoteInProgress;
public bool VotePassed;
public bool MyVoteCompleted;
public bool MyVote;
public ObjectGuid Target;
public uint TotalVotes;
public uint BootVotes;
public uint TimeLeft;
public uint VotesNeeded;
public string Reason = "";
}
public struct LFGProposalUpdatePlayer
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Roles);
data.WriteBit(Me);
data.WriteBit(SameParty);
data.WriteBit(MyParty);
data.WriteBit(Responded);
data.WriteBit(Accepted);
data.FlushBits();
}
public uint Roles;
public bool Me;
public bool SameParty;
public bool MyParty;
public bool Responded;
public bool Accepted;
}
public class RideTicket
{
public void Read(WorldPacket data)
{
RequesterGuid = data.ReadPackedGuid();
Id = data.ReadUInt32();
Type = (RideType)data.ReadUInt32();
Time = data.ReadInt32();
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(RequesterGuid);
data.WriteUInt32(Id);
data.WriteUInt32((uint)Type);
data.WriteInt32(Time);
}
public ObjectGuid RequesterGuid;
public uint Id;
public RideType Type;
public int Time;
}
public enum RideType
{
None = 0,
Battlegrounds = 1,
Lfg = 2
}
}
@@ -0,0 +1,414 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class LootUnit : ClientPacket
{
public LootUnit(WorldPacket packet) : base(packet) { }
public override void Read()
{
Unit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Unit;
}
public class LootResponse : ServerPacket
{
public LootResponse() : base(ServerOpcodes.LootResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteUInt8((byte)FailureReason);
_worldPacket.WriteUInt8(AcquireReason);
_worldPacket.WriteUInt8((byte)LootMethod);
_worldPacket.WriteUInt8(Threshold);
_worldPacket.WriteUInt32(Coins);
_worldPacket.WriteInt32(Items.Count);
_worldPacket.WriteInt32(Currencies.Count);
_worldPacket.WriteBit(Acquired);
_worldPacket.WriteBit(AELooting);
_worldPacket.FlushBits();
foreach (LootItemData item in Items)
item.Write(_worldPacket);
foreach (LootCurrency currency in Currencies)
{
_worldPacket.WriteUInt32(currency.CurrencyID);
_worldPacket.WriteUInt32(currency.Quantity);
_worldPacket.WriteUInt8(currency.LootListID);
_worldPacket.WriteBits(currency.UIType, 3);
_worldPacket.FlushBits();
}
}
public ObjectGuid LootObj;
public ObjectGuid Owner;
public byte Threshold = 2; // Most common value, 2 = Uncommon
public LootMethod LootMethod;
public byte AcquireReason;
public LootError FailureReason = LootError.NoLoot; // Most common value
public uint Coins;
public List<LootItemData> Items = new List<LootItemData>();
public List<LootCurrency> Currencies = new List<LootCurrency>();
public bool Acquired;
public bool AELooting;
}
class LootItemPkt : ClientPacket
{
public LootItemPkt(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint Count = _worldPacket.ReadUInt32();
for (uint i = 0; i < Count; ++i)
{
var loot = new LootRequest()
{
Object = _worldPacket.ReadPackedGuid(),
LootListID = _worldPacket.ReadUInt8()
};
Loot.Add(loot);
}
}
public List<LootRequest> Loot = new List<LootRequest>();
}
class LootRemoved : ServerPacket
{
public LootRemoved() : base(ServerOpcodes.LootRemoved, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteUInt8(LootListID);
}
public ObjectGuid LootObj;
public ObjectGuid Owner;
public byte LootListID;
}
class LootRelease : ClientPacket
{
public LootRelease(WorldPacket packet) : base(packet) { }
public override void Read()
{
Unit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Unit;
}
class LootMoney : ClientPacket
{
public LootMoney(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class LootMoneyNotify : ServerPacket
{
public LootMoneyNotify() : base(ServerOpcodes.LootMoneyNotify) { }
public override void Write()
{
_worldPacket.WriteUInt64(Money);
_worldPacket.WriteUInt64(MoneyMod);
_worldPacket.WriteBit(SoleLooter);
_worldPacket.FlushBits();
}
public ulong Money;
public ulong MoneyMod;
public bool SoleLooter;
}
class CoinRemoved : ServerPacket
{
public CoinRemoved() : base(ServerOpcodes.CoinRemoved) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
}
public ObjectGuid LootObj;
}
class LootRoll : ClientPacket
{
public LootRoll(WorldPacket packet) : base(packet) { }
public override void Read()
{
LootObj = _worldPacket.ReadPackedGuid();
LootListID = _worldPacket.ReadUInt8();
RollType = (RollType)_worldPacket.ReadUInt8();
}
public ObjectGuid LootObj;
public byte LootListID;
public RollType RollType;
}
class LootReleaseResponse : ServerPacket
{
public LootReleaseResponse() : base(ServerOpcodes.LootRelease) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WritePackedGuid(Owner);
}
public ObjectGuid LootObj;
public ObjectGuid Owner;
}
class LootReleaseAll : ServerPacket
{
public LootReleaseAll() : base(ServerOpcodes.LootReleaseAll, ConnectionType.Instance) { }
public override void Write() { }
}
class LootList : ServerPacket
{
public LootList() : base(ServerOpcodes.LootList, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteBit(Master.HasValue);
_worldPacket.WriteBit(RoundRobinWinner.HasValue);
_worldPacket.FlushBits();
if (Master.HasValue)
_worldPacket.WritePackedGuid(Master.Value);
if (RoundRobinWinner.HasValue)
_worldPacket.WritePackedGuid(RoundRobinWinner.Value);
}
public ObjectGuid Owner;
public ObjectGuid LootObj;
public Optional<ObjectGuid> Master;
public Optional<ObjectGuid> RoundRobinWinner;
}
class SetLootSpecialization : ClientPacket
{
public SetLootSpecialization(WorldPacket packet) : base(packet) { }
public override void Read()
{
SpecID = _worldPacket.ReadUInt32();
}
public uint SpecID;
}
class StartLootRoll : ServerPacket
{
public StartLootRoll() : base(ServerOpcodes.StartLootRoll) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32(RollTime);
_worldPacket.WriteUInt8((byte)ValidRolls);
_worldPacket.WriteUInt8((byte)Method);
Item.Write(_worldPacket);
}
public ObjectGuid LootObj;
public int MapID;
public uint RollTime;
public LootMethod Method;
public RollMask ValidRolls;
public LootItemData Item = new LootItemData();
}
class LootRollBroadcast : ServerPacket
{
public LootRollBroadcast() : base(ServerOpcodes.LootRoll) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteInt32(Roll);
_worldPacket.WriteUInt8((byte)RollType);
Item.Write(_worldPacket);
_worldPacket.WriteBit(Autopassed);
_worldPacket.FlushBits();
}
public ObjectGuid LootObj;
public ObjectGuid Player;
public int Roll; // Roll value can be negative, it means that it is an "offspec" roll but only during roll selection broadcast (not when sending the result)
public RollType RollType;
public LootItemData Item = new LootItemData();
public bool Autopassed; // Triggers message |HlootHistory:%d|h[Loot]|h: You automatically passed on: %s because you cannot loot that item.
}
class LootRollWon : ServerPacket
{
public LootRollWon() : base(ServerOpcodes.LootRollWon) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WritePackedGuid(Winner);
_worldPacket.WriteInt32(Roll);
_worldPacket.WriteUInt8((byte)RollType);
Item.Write(_worldPacket);
_worldPacket.WriteBit(MainSpec);
_worldPacket.FlushBits();
}
public ObjectGuid LootObj;
public ObjectGuid Winner;
public int Roll;
public RollType RollType;
public LootItemData Item = new LootItemData();
public bool MainSpec;
}
class LootAllPassed : ServerPacket
{
public LootAllPassed() : base(ServerOpcodes.LootAllPassed) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
Item.Write(_worldPacket);
}
public ObjectGuid LootObj;
public LootItemData Item = new LootItemData();
}
class LootRollsComplete : ServerPacket
{
public LootRollsComplete() : base(ServerOpcodes.LootRollsComplete) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteUInt8(LootListID);
}
public ObjectGuid LootObj;
public byte LootListID;
}
class AELootTargets : ServerPacket
{
public AELootTargets(uint count) : base(ServerOpcodes.AeLootTargets, ConnectionType.Instance)
{
Count = count;
}
public override void Write()
{
_worldPacket.WriteUInt32(Count);
}
uint Count;
}
class AELootTargetsAck : ServerPacket
{
public AELootTargetsAck() : base(ServerOpcodes.AeLootTargetAck, ConnectionType.Instance) { }
public override void Write() { }
}
class MasterLootCandidateList : ServerPacket
{
public MasterLootCandidateList() : base(ServerOpcodes.MasterLootCandidateList) { }
public override void Write()
{
_worldPacket.WritePackedGuid(LootObj);
_worldPacket.WriteInt32(Players.Count);
Players.ForEach(guid => _worldPacket.WritePackedGuid(guid));
}
public List<ObjectGuid> Players = new List<ObjectGuid>();
public ObjectGuid LootObj;
}
//Structs
public class LootItemData
{
public void Write(WorldPacket data)
{
data.WriteBits(Type, 2);
data.WriteBits(UIType, 3);
data.WriteBit(CanTradeToTapList);
data.FlushBits();
Loot.Write(data); // WorldPackets::Item::ItemInstance
data.WriteUInt32(Quantity);
data.WriteUInt8(LootItemType);
data.WriteUInt8(LootListID);
}
public byte Type;
public LootSlotType UIType;
public uint Quantity;
public byte LootItemType;
public byte LootListID;
public bool CanTradeToTapList;
public ItemInstance Loot;
}
public struct LootCurrency
{
public uint CurrencyID;
public uint Quantity;
public byte LootListID;
public byte UIType;
}
public struct LootRequest
{
public ObjectGuid Object;
public byte LootListID;
}
}
@@ -0,0 +1,460 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using Game.Mails;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class MailGetList : ClientPacket
{
public MailGetList(WorldPacket packet) : base(packet) { }
public override void Read()
{
Mailbox = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Mailbox;
}
public class MailListResult : ServerPacket
{
public MailListResult() : base(ServerOpcodes.MailListResult) { }
public override void Write()
{
_worldPacket.WriteInt32(Mails.Count);
_worldPacket.WriteInt32(TotalNumRecords);
Mails.ForEach(p => p.Write(_worldPacket));
}
public int TotalNumRecords;
public List<MailListEntry> Mails = new List<MailListEntry>();
}
public class MailCreateTextItem : ClientPacket
{
public MailCreateTextItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Mailbox = _worldPacket.ReadPackedGuid();
MailID = _worldPacket.ReadUInt32();
}
public ObjectGuid Mailbox;
public uint MailID;
}
public class SendMail : ClientPacket
{
public SendMail(WorldPacket packet) : base(packet)
{
Info = new StructSendMail();
}
public override void Read()
{
Info.Mailbox = _worldPacket.ReadPackedGuid();
Info.StationeryID = _worldPacket.ReadInt32();
Info.SendMoney = _worldPacket.ReadInt64();
Info.Cod = _worldPacket.ReadInt64();
uint targetLength = _worldPacket.ReadBits<uint>(9);
uint subjectLength = _worldPacket.ReadBits<uint>(9);
uint bodyLength = _worldPacket.ReadBits<uint>(11);
uint count = _worldPacket.ReadBits<uint>(5);
Info.Target = _worldPacket.ReadString(targetLength);
Info.Subject = _worldPacket.ReadString(subjectLength);
Info.Body = _worldPacket.ReadString(bodyLength);
for (var i = 0; i < count; ++i)
{
var att = new StructSendMail.MailAttachment()
{
AttachPosition = _worldPacket.ReadUInt8(),
ItemGUID = _worldPacket.ReadPackedGuid()
};
Info.Attachments.Add(att);
}
}
public StructSendMail Info;
public class StructSendMail
{
public ObjectGuid Mailbox;
public int StationeryID;
public long SendMoney;
public long Cod;
public string Target;
public string Subject;
public string Body;
public List<MailAttachment> Attachments = new List<MailAttachment>();
public struct MailAttachment
{
public byte AttachPosition;
public ObjectGuid ItemGUID;
}
}
}
public class MailCommandResult : ServerPacket
{
public MailCommandResult() : base(ServerOpcodes.MailCommandResult) { }
public override void Write()
{
_worldPacket.WriteUInt32(MailID);
_worldPacket.WriteUInt32(Command);
_worldPacket.WriteUInt32(ErrorCode);
_worldPacket.WriteUInt32(BagResult);
_worldPacket.WriteUInt32(AttachID);
_worldPacket.WriteUInt32(QtyInInventory);
}
public uint MailID;
public uint Command;
public uint ErrorCode;
public uint BagResult;
public uint AttachID;
public uint QtyInInventory;
}
public class MailReturnToSender : ClientPacket
{
public MailReturnToSender(WorldPacket packet) : base(packet) { }
public override void Read()
{
MailID = _worldPacket.ReadUInt32();
SenderGUID = _worldPacket.ReadPackedGuid();
}
public uint MailID;
public ObjectGuid SenderGUID;
}
public class MailMarkAsRead : ClientPacket
{
public MailMarkAsRead(WorldPacket packet) : base(packet) { }
public override void Read()
{
Mailbox = _worldPacket.ReadPackedGuid();
MailID = _worldPacket.ReadUInt32();
BiReceipt = _worldPacket.HasBit();
}
public ObjectGuid Mailbox;
public uint MailID;
public bool BiReceipt;
}
public class MailDelete : ClientPacket
{
public MailDelete(WorldPacket packet) : base(packet) { }
public override void Read()
{
MailID = _worldPacket.ReadUInt32();
DeleteReason = _worldPacket.ReadInt32();
}
public uint MailID;
public int DeleteReason;
}
public class MailTakeItem : ClientPacket
{
public MailTakeItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Mailbox = _worldPacket.ReadPackedGuid();
MailID = _worldPacket.ReadUInt32();
AttachID = _worldPacket.ReadUInt32();
}
public ObjectGuid Mailbox;
public uint MailID;
public uint AttachID;
}
public class MailTakeMoney : ClientPacket
{
public MailTakeMoney(WorldPacket packet) : base(packet) { }
public override void Read()
{
Mailbox = _worldPacket.ReadPackedGuid();
MailID = _worldPacket.ReadUInt32();
Money = _worldPacket.ReadInt64();
}
public ObjectGuid Mailbox;
public uint MailID;
public long Money;
}
public class MailQueryNextMailTime : ClientPacket
{
public MailQueryNextMailTime(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class MailQueryNextTimeResult : ServerPacket
{
public MailQueryNextTimeResult() : base(ServerOpcodes.MailQueryNextTimeResult)
{
Next = new List<MailNextTimeEntry>();
}
public override void Write()
{
_worldPacket.WriteFloat(NextMailTime);
_worldPacket.WriteInt32(Next.Count);
foreach (var entry in Next)
{
_worldPacket.WritePackedGuid(entry.SenderGuid);
_worldPacket.WriteFloat(entry.TimeLeft);
_worldPacket.WriteInt32(entry.AltSenderID);
_worldPacket.WriteInt8(entry.AltSenderType);
_worldPacket.WriteInt32(entry.StationeryID);
}
}
public float NextMailTime;
public List<MailNextTimeEntry> Next;
public class MailNextTimeEntry
{
public MailNextTimeEntry(Mail mail)
{
switch (mail.messageType)
{
case MailMessageType.Normal:
SenderGuid = ObjectGuid.Create(HighGuid.Player, mail.sender);
break;
case MailMessageType.Auction:
case MailMessageType.Creature:
case MailMessageType.Gameobject:
case MailMessageType.Calendar:
AltSenderID = (int)mail.sender;
break;
}
TimeLeft = mail.deliver_time - Time.UnixTime;
AltSenderType = (sbyte)mail.messageType;
StationeryID = (int)mail.stationery;
}
public ObjectGuid SenderGuid;
public float TimeLeft;
public int AltSenderID;
public sbyte AltSenderType;
public int StationeryID;
}
}
public class NotifyReceivedMail : ServerPacket
{
public NotifyReceivedMail() : base(ServerOpcodes.NotifyReceivedMail) { }
public override void Write()
{
_worldPacket.WriteFloat(Delay);
}
public float Delay = 0.0f;
}
class ShowMailbox : ServerPacket
{
public ShowMailbox() : base(ServerOpcodes.ShowMailbox) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PostmasterGUID);
}
public ObjectGuid PostmasterGUID;
}
//Structs
public class MailAttachedItem
{
public MailAttachedItem(Item item, byte pos)
{
Position = pos;
AttachID = (int)item.GetGUID().GetCounter();
Item = new ItemInstance(item);
Count = item.GetCount();
Charges = item.GetSpellCharges();
MaxDurability = item.m_itemData.MaxDurability;
Durability = item.m_itemData.Durability;
Unlocked = !item.IsLocked();
for (EnchantmentSlot slot = 0; slot < EnchantmentSlot.MaxInspected; slot++)
{
if (item.GetEnchantmentId(slot) == 0)
continue;
Enchants.Add(new ItemEnchantData(item.GetEnchantmentId(slot), item.GetEnchantmentDuration(slot), (int)item.GetEnchantmentCharges(slot), (byte)slot));
}
byte i = 0;
foreach (SocketedGem gemData in item.m_itemData.Gems)
{
if (gemData.ItemId != 0)
{
ItemGemData gem = new ItemGemData();
gem.Slot = i;
gem.Item = new ItemInstance(gemData);
Gems.Add(gem);
}
++i;
}
}
public void Write(WorldPacket data)
{
data.WriteUInt8(Position);
data.WriteInt32(AttachID);
data.WriteUInt32(Count);
data.WriteInt32(Charges);
data.WriteUInt32(MaxDurability);
data.WriteUInt32(Durability);
Item.Write(data);
data.WriteBits(Enchants.Count, 4);
data.WriteBits(Gems.Count, 2);
data.WriteBit(Unlocked);
data.FlushBits();
foreach (ItemGemData gem in Gems)
gem.Write(data);
foreach (ItemEnchantData en in Enchants)
en.Write(data);
}
public byte Position;
public int AttachID;
public ItemInstance Item;
public uint Count;
public int Charges;
public uint MaxDurability;
public uint Durability;
public bool Unlocked;
List<ItemEnchantData> Enchants = new List<ItemEnchantData>();
List<ItemGemData> Gems= new List<ItemGemData>();
}
public class MailListEntry
{
public MailListEntry(Mail mail, Player player)
{
MailID = (int)mail.messageID;
SenderType = (byte)mail.messageType;
switch (mail.messageType)
{
case MailMessageType.Normal:
SenderCharacter.Set(ObjectGuid.Create(HighGuid.Player, mail.sender));
break;
case MailMessageType.Creature:
case MailMessageType.Gameobject:
case MailMessageType.Auction:
case MailMessageType.Calendar:
AltSenderID.Set((uint)mail.sender);
break;
}
Cod = mail.COD;
StationeryID = (int)mail.stationery;
SentMoney = mail.money;
Flags = (int)mail.checkMask;
DaysLeft = (float)(mail.expire_time - Time.UnixTime) / Time.Day;
MailTemplateID = (int)mail.mailTemplateId;
Subject = mail.subject;
Body = mail.body;
for (byte i = 0; i < mail.items.Count; i++)
{
Item item = player.GetMItem(mail.items[i].item_guid);
if (item)
Attachments.Add(new MailAttachedItem(item, i));
}
}
public void Write(WorldPacket data)
{
data.WriteInt32(MailID);
data.WriteUInt8(SenderType);
data.WriteUInt64(Cod);
data.WriteInt32(StationeryID);
data.WriteUInt64(SentMoney);
data.WriteInt32(Flags);
data.WriteFloat(DaysLeft);
data.WriteInt32(MailTemplateID);
data.WriteInt32(Attachments.Count);
data.WriteBit(SenderCharacter.HasValue);
data.WriteBit(AltSenderID.HasValue);
data.WriteBits(Subject.GetByteCount(), 8);
data.WriteBits(Body.GetByteCount(), 13);
data.FlushBits();
Attachments.ForEach(p => p.Write(data));
if (SenderCharacter.HasValue)
data.WritePackedGuid(SenderCharacter.Value);
if (AltSenderID.HasValue)
data.WriteUInt32(AltSenderID.Value);
data.WriteString(Subject);
data.WriteString(Body);
}
public int MailID;
public byte SenderType;
public Optional<ObjectGuid> SenderCharacter;
public Optional<uint> AltSenderID;
public ulong Cod;
public int StationeryID;
public ulong SentMoney;
public int Flags;
public float DaysLeft;
public int MailTemplateID;
public string Subject = "";
public string Body = "";
public List<MailAttachedItem> Attachments = new List<MailAttachedItem>();
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,363 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.GameMath;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
// CMSG_BANKER_ACTIVATE
// CMSG_BINDER_ACTIVATE
// CMSG_BINDER_CONFIRM
// CMSG_GOSSIP_HELLO
// CMSG_LIST_INVENTORY
// CMSG_TRAINER_LIST
// CMSG_BATTLEMASTER_HELLO
public class Hello : ClientPacket
{
public Hello(WorldPacket packet) : base(packet) { }
public override void Read()
{
Unit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Unit;
}
public class GossipMessagePkt : ServerPacket
{
public GossipMessagePkt() : base(ServerOpcodes.GossipMessage) { }
public override void Write()
{
_worldPacket.WritePackedGuid(GossipGUID);
_worldPacket.WriteInt32(GossipID);
_worldPacket.WriteInt32(FriendshipFactionID);
_worldPacket.WriteInt32(TextID);
_worldPacket.WriteInt32(GossipOptions.Count);
_worldPacket.WriteInt32(GossipText.Count);
foreach (ClientGossipOptions options in GossipOptions)
{
_worldPacket.WriteInt32(options.ClientOption);
_worldPacket.WriteUInt8(options.OptionNPC);
_worldPacket.WriteUInt8(options.OptionFlags);
_worldPacket.WriteInt32(options.OptionCost);
_worldPacket.WriteBits(options.Text.GetByteCount(), 12);
_worldPacket.WriteBits(options.Confirm.GetByteCount(), 12);
_worldPacket.FlushBits();
_worldPacket.WriteString(options.Text);
_worldPacket.WriteString(options.Confirm);
}
foreach (ClientGossipText text in GossipText)
{
_worldPacket.WriteInt32(text.QuestID);
_worldPacket.WriteInt32(text.QuestType);
_worldPacket.WriteInt32(text.QuestLevel);
_worldPacket.WriteInt32(text.QuestMaxScalingLevel);
_worldPacket.WriteInt32(text.QuestFlags);
_worldPacket.WriteInt32(text.QuestFlagsEx);
_worldPacket.WriteBit(text.Repeatable);
_worldPacket.WriteBits(text.QuestTitle.GetByteCount(), 9);
_worldPacket.FlushBits();
_worldPacket.WriteString(text.QuestTitle);
}
}
public List<ClientGossipOptions> GossipOptions = new List<ClientGossipOptions>();
public int FriendshipFactionID = 0;
public ObjectGuid GossipGUID;
public List<ClientGossipText> GossipText = new List<ClientGossipText>();
public int TextID = 0;
public int GossipID = 0;
}
public class GossipSelectOption : ClientPacket
{
public GossipSelectOption(WorldPacket packet) : base(packet) { }
public override void Read()
{
GossipUnit = _worldPacket.ReadPackedGuid();
GossipID = _worldPacket.ReadUInt32();
GossipIndex = _worldPacket.ReadUInt32();
uint length = _worldPacket.ReadBits<uint>(8);
PromotionCode = _worldPacket.ReadString(length);
}
public ObjectGuid GossipUnit;
public uint GossipIndex;
public uint GossipID;
public string PromotionCode;
}
public class GossipComplete : ServerPacket
{
public GossipComplete() : base(ServerOpcodes.GossipComplete) { }
public override void Write() { }
}
public class VendorInventory : ServerPacket
{
public VendorInventory() : base(ServerOpcodes.VendorInventory, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Vendor);
_worldPacket.WriteUInt8(Reason);
_worldPacket.WriteInt32(Items.Count);
foreach (VendorItemPkt item in Items)
item.Write(_worldPacket);
}
public byte Reason = 0;
public List<VendorItemPkt> Items = new List<VendorItemPkt>();
public ObjectGuid Vendor;
}
public class TrainerList : ServerPacket
{
public TrainerList() : base(ServerOpcodes.TrainerList, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TrainerGUID);
_worldPacket.WriteInt32(TrainerType);
_worldPacket.WriteInt32(TrainerID);
_worldPacket.WriteInt32(Spells.Count);
foreach (TrainerListSpell spell in Spells)
{
_worldPacket.WriteUInt32(spell.SpellID);
_worldPacket.WriteUInt32(spell.MoneyCost);
_worldPacket.WriteUInt32(spell.ReqSkillLine);
_worldPacket.WriteUInt32(spell.ReqSkillRank);
for (uint i = 0; i < SharedConst.MaxTrainerspellAbilityReqs; ++i)
_worldPacket.WriteUInt32(spell.ReqAbility[i]);
_worldPacket.WriteUInt8((byte)spell.Usable);
_worldPacket.WriteUInt8(spell.ReqLevel);
}
_worldPacket.WriteBits(Greeting.GetByteCount(), 11);
_worldPacket.FlushBits();
_worldPacket.WriteString(Greeting);
}
public ObjectGuid TrainerGUID;
public int TrainerType;
public int TrainerID = 1;
public List<TrainerListSpell> Spells = new List<TrainerListSpell>();
public string Greeting;
}
public class ShowBank : ServerPacket
{
public ShowBank() : base(ServerOpcodes.ShowBank, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
public ObjectGuid Guid;
}
public class PlayerTabardVendorActivate : ServerPacket
{
public PlayerTabardVendorActivate() : base(ServerOpcodes.PlayerTabardVendorActivate) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Vendor);
}
public ObjectGuid Vendor;
}
class GossipPOI : ServerPacket
{
public GossipPOI() : base(ServerOpcodes.GossipPoi) { }
public override void Write()
{
_worldPacket.WriteUInt32(Id);
_worldPacket.WriteFloat(Pos.X);
_worldPacket.WriteFloat(Pos.Y);
_worldPacket.WriteUInt32(Icon);
_worldPacket.WriteUInt32(Importance);
_worldPacket.WriteBits(Flags, 14);
_worldPacket.WriteBits(Name.GetByteCount(), 6);
_worldPacket.FlushBits();
_worldPacket.WriteString(Name);
}
public uint Id;
public uint Flags;
public Vector2 Pos;
public uint Icon;
public uint Importance;
public string Name;
}
class SpiritHealerActivate : ClientPacket
{
public SpiritHealerActivate(WorldPacket packet) : base(packet) { }
public override void Read()
{
Healer = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Healer;
}
public class SpiritHealerConfirm : ServerPacket
{
public SpiritHealerConfirm() : base(ServerOpcodes.SpiritHealerConfirm) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Unit);
}
public ObjectGuid Unit;
}
class TrainerBuySpell : ClientPacket
{
public TrainerBuySpell(WorldPacket packet) : base(packet) { }
public override void Read()
{
TrainerGUID = _worldPacket.ReadPackedGuid();
TrainerID = _worldPacket.ReadUInt32();
SpellID= _worldPacket.ReadUInt32();
}
public ObjectGuid TrainerGUID;
public uint TrainerID;
public uint SpellID;
}
class TrainerBuyFailed : ServerPacket
{
public TrainerBuyFailed() : base(ServerOpcodes.TrainerBuyFailed) { }
public override void Write()
{
_worldPacket.WritePackedGuid(TrainerGUID);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt32((uint)TrainerFailedReason);
}
public ObjectGuid TrainerGUID;
public uint SpellID;
public TrainerFailReason TrainerFailedReason;
}
class RequestStabledPets : ClientPacket
{
public RequestStabledPets(WorldPacket packet) : base(packet) { }
public override void Read()
{
StableMaster = _worldPacket.ReadPackedGuid();
}
public ObjectGuid StableMaster;
}
//Structs
public struct ClientGossipOptions
{
public int ClientOption;
public byte OptionNPC;
public byte OptionFlags;
public int OptionCost;
public string Text;
public string Confirm;
}
public class ClientGossipText
{
public int QuestID;
public int QuestType;
public int QuestLevel;
public int QuestMaxScalingLevel;
public bool Repeatable;
public string QuestTitle;
public int QuestFlags;
public int QuestFlagsEx;
}
public class VendorItemPkt
{
public void Write(WorldPacket data)
{
data.WriteInt32(MuID);
data.WriteInt32(Type);
data.WriteInt32(Quantity);
data.WriteUInt64(Price);
data.WriteInt32(Durability);
data.WriteInt32(StackCount);
data.WriteInt32(ExtendedCostID);
data.WriteInt32(PlayerConditionFailed);
Item.Write(data);
data.WriteBit(DoNotFilterOnVendor);
data.WriteBit(Refundable);
data.FlushBits();
}
public int MuID;
public int Type;
public ItemInstance Item = new ItemInstance();
public int Quantity = -1;
public ulong Price;
public int Durability;
public int StackCount;
public int ExtendedCostID;
public int PlayerConditionFailed;
public bool DoNotFilterOnVendor;
public bool Refundable;
}
public class TrainerListSpell
{
public uint SpellID;
public uint MoneyCost;
public uint ReqSkillLine;
public uint ReqSkillRank;
public uint[] ReqAbility = new uint[SharedConst.MaxTrainerspellAbilityReqs];
public TrainerSpellState Usable;
public byte ReqLevel;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,398 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.GameMath;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class DismissCritter : ClientPacket
{
public DismissCritter(WorldPacket packet) : base(packet) { }
public override void Read()
{
CritterGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid CritterGUID;
}
class RequestPetInfo : ClientPacket
{
public RequestPetInfo(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class PetAbandon : ClientPacket
{
public PetAbandon(WorldPacket packet) : base(packet) { }
public override void Read()
{
Pet = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Pet;
}
class PetStopAttack : ClientPacket
{
public PetStopAttack(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetGUID;
}
class PetSpellAutocast : ClientPacket
{
public PetSpellAutocast(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGUID = _worldPacket.ReadPackedGuid();
SpellID = _worldPacket.ReadUInt32();
AutocastEnabled = _worldPacket.HasBit();
}
public ObjectGuid PetGUID;
public uint SpellID;
public bool AutocastEnabled;
}
public class PetSpells : ServerPacket
{
public PetSpells() : base(ServerOpcodes.PetSpellsMessage, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PetGUID);
_worldPacket.WriteUInt16(CreatureFamily);
_worldPacket.WriteUInt16(Specialization);
_worldPacket.WriteUInt32(TimeLimit);
_worldPacket.WriteUInt16((ushort)((byte)CommandState | (Flag << 16)));
_worldPacket.WriteUInt8((byte)ReactState);
foreach (uint actionButton in ActionButtons)
_worldPacket.WriteUInt32(actionButton);
_worldPacket.WriteInt32(Actions.Count);
_worldPacket.WriteInt32(Cooldowns.Count);
_worldPacket.WriteInt32(SpellHistory.Count);
foreach (uint action in Actions)
_worldPacket.WriteUInt32(action);
foreach (PetSpellCooldown cooldown in Cooldowns)
{
_worldPacket.WriteUInt32(cooldown.SpellID);
_worldPacket.WriteUInt32(cooldown.Duration);
_worldPacket.WriteUInt32(cooldown.CategoryDuration);
_worldPacket.WriteFloat(cooldown.ModRate);
_worldPacket.WriteUInt16(cooldown.Category);
}
foreach (PetSpellHistory history in SpellHistory)
{
_worldPacket.WriteUInt32(history.CategoryID);
_worldPacket.WriteUInt32(history.RecoveryTime);
_worldPacket.WriteFloat(history.ChargeModRate);
_worldPacket.WriteInt8(history.ConsumedCharges);
}
}
public ObjectGuid PetGUID;
public ushort CreatureFamily;
public ushort Specialization;
public uint TimeLimit;
public ReactStates ReactState;
public CommandStates CommandState;
public byte Flag;
public uint[] ActionButtons = new uint[10];
public List<uint> Actions = new List<uint>();
public List<PetSpellCooldown> Cooldowns = new List<PetSpellCooldown>();
public List<PetSpellHistory> SpellHistory = new List<PetSpellHistory>();
}
class PetStableList : ServerPacket
{
public PetStableList() : base(ServerOpcodes.PetStableList, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(StableMaster);
_worldPacket.WriteInt32(Pets.Count);
foreach (PetStableInfo pet in Pets)
{
_worldPacket.WriteUInt32(pet.PetSlot);
_worldPacket.WriteUInt32(pet.PetNumber);
_worldPacket.WriteUInt32(pet.CreatureID);
_worldPacket.WriteUInt32(pet.DisplayID);
_worldPacket.WriteUInt32(pet.ExperienceLevel);
_worldPacket.WriteUInt8((byte)pet.PetFlags);
_worldPacket.WriteBits(pet.PetName.GetByteCount(), 8);
_worldPacket.WriteString(pet.PetName);
}
}
public ObjectGuid StableMaster;
public List<PetStableInfo> Pets = new List<PetStableInfo>();
}
class PetLearnedSpells : ServerPacket
{
public PetLearnedSpells() : base(ServerOpcodes.PetLearnedSpells, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Spells.Count);
foreach (uint spell in Spells)
_worldPacket.WriteUInt32(spell);
}
public List<uint> Spells = new List<uint>();
}
class PetUnlearnedSpells : ServerPacket
{
public PetUnlearnedSpells() : base(ServerOpcodes.PetUnlearnedSpells, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Spells.Count);
foreach (uint spell in Spells)
_worldPacket.WriteUInt32(spell);
}
public List<uint> Spells = new List<uint>();
}
class PetNameInvalid : ServerPacket
{
public PetNameInvalid() : base(ServerOpcodes.PetNameInvalid) { }
public override void Write()
{
_worldPacket.WriteUInt8((byte)Result);
_worldPacket.WritePackedGuid(RenameData.PetGUID);
_worldPacket.WriteInt32(RenameData.PetNumber);
_worldPacket.WriteUInt8((byte)RenameData.NewName.GetByteCount());
_worldPacket.WriteBit(RenameData.HasDeclinedNames);
if (RenameData.HasDeclinedNames)
{
for (int i = 0; i < SharedConst.MaxDeclinedNameCases; i++)
_worldPacket.WriteBits(RenameData.DeclinedNames.name[i].GetByteCount(), 7);
for (int i = 0; i < SharedConst.MaxDeclinedNameCases; i++)
_worldPacket.WriteString(RenameData.DeclinedNames.name[i]);
}
_worldPacket.WriteString(RenameData.NewName);
}
public PetRenameData RenameData;
public PetNameInvalidReason Result;
}
class PetRename : ClientPacket
{
public PetRename(WorldPacket packet) : base(packet) { }
public override void Read()
{
RenameData.PetGUID = _worldPacket.ReadPackedGuid();
RenameData.PetNumber = _worldPacket.ReadInt32();
uint nameLen = _worldPacket.ReadBits<uint>(8);
RenameData.HasDeclinedNames = _worldPacket.HasBit();
if (RenameData.HasDeclinedNames)
{
RenameData.DeclinedNames = new DeclinedName();
uint[] count = new uint[SharedConst.MaxDeclinedNameCases];
for (int i = 0; i < SharedConst.MaxDeclinedNameCases; i++)
count[i] = _worldPacket.ReadBits<uint>(7);
for (int i = 0; i < SharedConst.MaxDeclinedNameCases; i++)
RenameData.DeclinedNames.name[i] = _worldPacket.ReadString(count[i]);
}
RenameData.NewName = _worldPacket.ReadString(nameLen);
}
public PetRenameData RenameData;
}
class PetAction : ClientPacket
{
public PetAction(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGUID = _worldPacket.ReadPackedGuid();
Action = _worldPacket.ReadUInt32();
TargetGUID = _worldPacket.ReadPackedGuid();
ActionPosition = _worldPacket.ReadVector3();
}
public ObjectGuid PetGUID;
public uint Action;
public ObjectGuid TargetGUID;
public Vector3 ActionPosition;
}
class PetSetAction : ClientPacket
{
public PetSetAction(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGUID = _worldPacket.ReadPackedGuid();
Index = _worldPacket.ReadUInt32();
Action = _worldPacket.ReadUInt32();
}
public ObjectGuid PetGUID;
public uint Index;
public uint Action;
}
class PetActionSound : ServerPacket
{
public PetActionSound() : base(ServerOpcodes.PetStableResult) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteUInt32((uint)Action);
}
public ObjectGuid UnitGUID;
public PetTalk Action;
}
class PetActionFeedback : ServerPacket
{
public PetActionFeedback() : base(ServerOpcodes.PetStableResult) { }
public override void Write()
{
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteUInt8((byte)Response);
}
public uint SpellID;
public ActionFeedback Response;
}
class PetCancelAura : ClientPacket
{
public PetCancelAura(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetGUID = _worldPacket.ReadPackedGuid();
SpellID = _worldPacket.ReadUInt32();
}
public ObjectGuid PetGUID;
public uint SpellID;
}
class PetStableResult : ServerPacket
{
public PetStableResult(byte result) : base(ServerOpcodes.PetStableResult)
{
Result = result;
}
public override void Write()
{
_worldPacket.WriteUInt8(Result);
}
public byte Result;
}
class SetPetSpecialization : ServerPacket
{
public SetPetSpecialization() : base(ServerOpcodes.SetPetSpecialization) { }
public override void Write()
{
_worldPacket.WriteUInt16(SpecID);
}
public ushort SpecID;
}
//Structs
public class PetSpellCooldown
{
public uint SpellID;
public uint Duration;
public uint CategoryDuration;
public float ModRate = 1.0f;
public ushort Category;
}
public class PetSpellHistory
{
public uint CategoryID;
public uint RecoveryTime;
public float ChargeModRate = 1.0f;
public sbyte ConsumedCharges;
}
struct PetStableInfo
{
public uint PetSlot;
public uint PetNumber;
public uint CreatureID;
public uint DisplayID;
public uint ExperienceLevel;
public PetStableinfo PetFlags;
public string PetName;
}
struct PetRenameData
{
public ObjectGuid PetGUID;
public int PetNumber;
public string NewName;
public bool HasDeclinedNames;
public DeclinedName DeclinedNames;
}
}
@@ -0,0 +1,346 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Collections;
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class QueryPetition : ClientPacket
{
public QueryPetition(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetitionID = _worldPacket.ReadUInt32();
ItemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGUID;
public uint PetitionID;
}
public class QueryPetitionResponse : ServerPacket
{
public QueryPetitionResponse() : base(ServerOpcodes.QueryPetitionResponse) { }
public override void Write()
{
_worldPacket.WriteUInt32(PetitionID);
_worldPacket.WriteBit(Allow);
_worldPacket.FlushBits();
if (Allow)
Info.Write(_worldPacket);
}
public uint PetitionID = 0;
public bool Allow = false;
public PetitionInfo Info;
}
public class PetitionShowList : ClientPacket
{
public PetitionShowList(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetitionUnit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetitionUnit;
}
public class ServerPetitionShowList : ServerPacket
{
public ServerPetitionShowList() : base(ServerOpcodes.PetitionShowList) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Unit);
_worldPacket.WriteUInt32(Price);
}
public ObjectGuid Unit;
public uint Price = 0;
}
public class PetitionBuy : ClientPacket
{
public PetitionBuy(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint titleLen = _worldPacket.ReadBits<uint>(7);
Unit = _worldPacket.ReadPackedGuid();
Title = _worldPacket.ReadString(titleLen);
}
public ObjectGuid Unit;
public string Title;
}
public class PetitionShowSignatures : ClientPacket
{
public PetitionShowSignatures(WorldPacket packet) : base(packet) { }
public override void Read()
{
Item = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Item;
}
public class ServerPetitionShowSignatures : ServerPacket
{
public ServerPetitionShowSignatures() : base(ServerOpcodes.PetitionShowSignatures)
{
Signatures = new List<PetitionSignature>();
}
public override void Write()
{
_worldPacket.WritePackedGuid(Item);
_worldPacket.WritePackedGuid(Owner);
_worldPacket.WritePackedGuid(OwnerAccountID);
_worldPacket.WriteInt32(PetitionID);
_worldPacket.WriteInt32(Signatures.Count);
foreach (PetitionSignature signature in Signatures)
{
_worldPacket.WritePackedGuid(signature.Signer);
_worldPacket.WriteInt32(signature.Choice);
}
}
public ObjectGuid Item;
public ObjectGuid Owner;
public ObjectGuid OwnerAccountID;
public int PetitionID = 0;
public List<PetitionSignature> Signatures;
public struct PetitionSignature
{
public ObjectGuid Signer;
public int Choice;
}
}
public class SignPetition : ClientPacket
{
public SignPetition(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetitionGUID = _worldPacket.ReadPackedGuid();
Choice = _worldPacket.ReadUInt8();
}
public ObjectGuid PetitionGUID;
public byte Choice;
}
public class PetitionSignResults : ServerPacket
{
public PetitionSignResults() : base(ServerOpcodes.PetitionSignResults) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Item);
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteBits(Error, 4);
_worldPacket.FlushBits();
}
public ObjectGuid Item;
public ObjectGuid Player;
public PetitionSigns Error = 0;
}
public class PetitionAlreadySigned : ServerPacket
{
public PetitionAlreadySigned() : base(ServerOpcodes.PetitionAlreadySigned) { }
public override void Write()
{
_worldPacket.WritePackedGuid(SignerGUID);
}
public ObjectGuid SignerGUID;
}
public class DeclinePetition : ClientPacket
{
public DeclinePetition(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetitionGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid PetitionGUID;
}
public class TurnInPetition : ClientPacket
{
public TurnInPetition(WorldPacket packet) : base(packet) { }
public override void Read()
{
Item = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Item;
}
public class TurnInPetitionResult : ServerPacket
{
public TurnInPetitionResult() : base(ServerOpcodes.TurnInPetitionResult) { }
public override void Write()
{
_worldPacket.WriteBits(Result, 4);
_worldPacket.FlushBits();
}
public PetitionTurns Result = 0; // PetitionError
}
public class OfferPetition : ClientPacket
{
public OfferPetition(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemGUID = _worldPacket.ReadPackedGuid();
TargetPlayer = _worldPacket.ReadPackedGuid();
}
public ObjectGuid TargetPlayer;
public ObjectGuid ItemGUID;
}
public class OfferPetitionError : ServerPacket
{
public OfferPetitionError() : base(ServerOpcodes.OfferPetitionError) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PlayerGUID);
}
public ObjectGuid PlayerGUID;
}
public class PetitionRenameGuild : ClientPacket
{
public PetitionRenameGuild(WorldPacket packet) : base(packet) { }
public override void Read()
{
PetitionGuid = _worldPacket.ReadPackedGuid();
_worldPacket.ResetBitPos();
uint nameLen = _worldPacket.ReadBits<uint>(7);
NewGuildName = _worldPacket.ReadString(nameLen);
}
public ObjectGuid PetitionGuid;
public string NewGuildName;
}
public class PetitionRenameGuildResponse : ServerPacket
{
public PetitionRenameGuildResponse() : base(ServerOpcodes.PetitionRenameGuildResponse) { }
public override void Write()
{
_worldPacket.WritePackedGuid(PetitionGuid);
_worldPacket.WriteBits(NewGuildName.GetByteCount(), 7);
_worldPacket.FlushBits();
_worldPacket.WriteString(NewGuildName);
}
public ObjectGuid PetitionGuid;
public string NewGuildName;
}
public class PetitionInfo
{
public void Write(WorldPacket data)
{
data.WriteInt32(PetitionID);
data.WritePackedGuid(Petitioner);
data.WriteUInt32(MinSignatures);
data.WriteUInt32(MaxSignatures);
data.WriteInt32(DeadLine);
data.WriteInt32(IssueDate);
data.WriteInt32(AllowedGuildID);
data.WriteInt32(AllowedClasses);
data.WriteInt32(AllowedRaces);
data.WriteInt16(AllowedGender);
data.WriteInt32(AllowedMinLevel);
data.WriteInt32(AllowedMaxLevel);
data.WriteInt32(NumChoices);
data.WriteInt32(StaticType);
data.WriteUInt32(Muid);
data.WriteBits(Title.GetByteCount(), 7);
data.WriteBits(BodyText.GetByteCount(), 12);
for (byte i = 0; i < Choicetext.Length; i++)
data.WriteBits(Choicetext[i].GetByteCount(), 6);
data.FlushBits();
for (byte i = 0; i < Choicetext.Length; i++)
data.WriteString(Choicetext[i]);
data.WriteString(Title);
data.WriteString(BodyText);
}
public int PetitionID;
public ObjectGuid Petitioner;
public string Title;
public string BodyText;
public uint MinSignatures;
public uint MaxSignatures;
public int DeadLine;
public int IssueDate;
public int AllowedGuildID;
public int AllowedClasses;
public int AllowedRaces;
public short AllowedGender;
public int AllowedMinLevel;
public int AllowedMaxLevel;
public int NumChoices;
public int StaticType;
public uint Muid = 0;
public StringArray Choicetext = new StringArray(10);
}
}
@@ -0,0 +1,758 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Collections;
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Framework.IO;
using Game.Cache;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class QueryPlayerName : ClientPacket
{
public QueryPlayerName(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Player;
}
public class QueryPlayerNameResponse : ServerPacket
{
public QueryPlayerNameResponse() : base(ServerOpcodes.QueryPlayerNameResponse)
{
Data = new PlayerGuidLookupData();
}
public override void Write()
{
_worldPacket.WriteInt8((sbyte)Result);
_worldPacket.WritePackedGuid(Player);
if (Result == ResponseCodes.Success)
Data.Write(_worldPacket);
}
public ObjectGuid Player;
public ResponseCodes Result; // 0 - full packet, != 0 - only guid
public PlayerGuidLookupData Data;
}
public class QueryCreature : ClientPacket
{
public QueryCreature(WorldPacket packet) : base(packet) { }
public override void Read()
{
CreatureID = _worldPacket.ReadUInt32();
}
public uint CreatureID;
}
public class QueryCreatureResponse : ServerPacket
{
public QueryCreatureResponse() : base(ServerOpcodes.QueryCreatureResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(CreatureID);
_worldPacket.WriteBit(Allow);
_worldPacket.FlushBits();
if (Allow)
{
_worldPacket.WriteBits(Stats.Title.IsEmpty() ? 0 : Stats.Title.GetByteCount() + 1, 11);
_worldPacket.WriteBits(Stats.TitleAlt.IsEmpty() ? 0 : Stats.TitleAlt.GetByteCount() + 1, 11);
_worldPacket.WriteBits(Stats.CursorName.IsEmpty() ? 0 : Stats.CursorName.GetByteCount() + 1, 6);
_worldPacket.WriteBit(Stats.Leader);
for (var i = 0; i < SharedConst.MaxCreatureNames; ++i)
{
_worldPacket.WriteBits(Stats.Name[i].GetByteCount() + 1, 11);
_worldPacket.WriteBits(Stats.NameAlt[i].GetByteCount() + 1, 11);
}
for (var i = 0; i < SharedConst.MaxCreatureNames; ++i)
{
if (!string.IsNullOrEmpty(Stats.Name[i]))
_worldPacket.WriteCString(Stats.Name[i]);
if (!string.IsNullOrEmpty(Stats.NameAlt[i]))
_worldPacket.WriteCString(Stats.NameAlt[i]);
}
for (var i = 0; i < 2; ++i)
_worldPacket.WriteUInt32(Stats.Flags[i]);
_worldPacket.WriteInt32(Stats.CreatureType);
_worldPacket.WriteInt32(Stats.CreatureFamily);
_worldPacket.WriteInt32(Stats.Classification);
for (var i = 0; i < SharedConst.MaxCreatureKillCredit; ++i)
_worldPacket.WriteUInt32(Stats.ProxyCreatureID[i]);
_worldPacket.WriteInt32(Stats.Display.CreatureDisplay.Count);
_worldPacket.WriteFloat(Stats.Display.TotalProbability);
foreach (CreatureXDisplay display in Stats.Display.CreatureDisplay)
{
_worldPacket.WriteUInt32(display.CreatureDisplayID);
_worldPacket.WriteFloat(display.Scale);
_worldPacket.WriteFloat(display.Probability);
}
_worldPacket.WriteFloat(Stats.HpMulti);
_worldPacket.WriteFloat(Stats.EnergyMulti);
_worldPacket.WriteInt32(Stats.QuestItems.Count);
_worldPacket.WriteUInt32(Stats.CreatureMovementInfoID);
_worldPacket.WriteInt32(Stats.HealthScalingExpansion);
_worldPacket.WriteUInt32(Stats.RequiredExpansion);
_worldPacket.WriteUInt32(Stats.VignetteID);
_worldPacket.WriteInt32(Stats.Class);
_worldPacket.WriteFloat(Stats.FadeRegionRadius);
_worldPacket.WriteInt32(Stats.WidgetSetID);
_worldPacket.WriteInt32(Stats.WidgetSetUnitConditionID);
if (!Stats.Title.IsEmpty())
_worldPacket.WriteCString(Stats.Title);
if (!Stats.TitleAlt.IsEmpty())
_worldPacket.WriteCString(Stats.TitleAlt);
if (!Stats.CursorName.IsEmpty())
_worldPacket.WriteCString(Stats.CursorName);
foreach (var questItem in Stats.QuestItems)
_worldPacket.WriteUInt32(questItem);
}
}
public bool Allow;
public CreatureStats Stats;
public uint CreatureID;
}
public class QueryPageText : ClientPacket
{
public QueryPageText(WorldPacket packet) : base(packet) { }
public override void Read()
{
PageTextID = _worldPacket.ReadUInt32();
ItemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid ItemGUID;
public uint PageTextID;
}
public class QueryPageTextResponse : ServerPacket
{
public QueryPageTextResponse() : base(ServerOpcodes.QueryPageTextResponse) { }
public override void Write()
{
_worldPacket.WriteUInt32(PageTextID);
_worldPacket.WriteBit(Allow);
_worldPacket.FlushBits();
if (Allow)
{
_worldPacket.WriteInt32(Pages.Count);
foreach (PageTextInfo pageText in Pages)
pageText.Write(_worldPacket);
}
}
public uint PageTextID;
public bool Allow;
public List<PageTextInfo> Pages = new List<PageTextInfo>();
public struct PageTextInfo
{
public void Write(WorldPacket data)
{
data.WriteUInt32(Id);
data.WriteUInt32(NextPageID);
data.WriteInt32(PlayerConditionID);
data.WriteUInt8(Flags);
data.WriteBits(Text.GetByteCount(), 12);
data.FlushBits();
data.WriteString(Text);
}
public uint Id;
public uint NextPageID;
public int PlayerConditionID;
public byte Flags;
public string Text;
}
}
public class QueryNPCText : ClientPacket
{
public QueryNPCText(WorldPacket packet) : base(packet) { }
public override void Read()
{
TextID = _worldPacket.ReadUInt32();
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
public uint TextID;
}
public class QueryNPCTextResponse : ServerPacket
{
public QueryNPCTextResponse() : base(ServerOpcodes.QueryNpcTextResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(TextID);
_worldPacket.WriteBit(Allow);
_worldPacket.WriteInt32(Allow ? SharedConst.MaxNpcTextOptions * (4 + 4) : 0);
if (Allow)
{
for (uint i = 0; i < SharedConst.MaxNpcTextOptions; ++i)
_worldPacket.WriteFloat(Probabilities[i]);
for (uint i = 0; i < SharedConst.MaxNpcTextOptions; ++i)
_worldPacket.WriteUInt32(BroadcastTextID[i]);
}
}
public uint TextID;
public bool Allow;
public float[] Probabilities = new float[SharedConst.MaxNpcTextOptions];
public uint[] BroadcastTextID = new uint[SharedConst.MaxNpcTextOptions];
}
public class QueryGameObject : ClientPacket
{
public QueryGameObject(WorldPacket packet) : base(packet) { }
public override void Read()
{
GameObjectID = _worldPacket.ReadUInt32();
Guid = _worldPacket.ReadPackedGuid();
}
public uint GameObjectID;
public ObjectGuid Guid;
}
public class QueryGameObjectResponse : ServerPacket
{
public QueryGameObjectResponse() : base(ServerOpcodes.QueryGameObjectResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(GameObjectID);
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WriteBit(Allow);
_worldPacket.FlushBits();
ByteBuffer statsData = new ByteBuffer();
if (Allow)
{
statsData.WriteUInt32(Stats.Type);
statsData.WriteUInt32(Stats.DisplayID);
for (int i = 0; i < 4; i++)
statsData.WriteCString(Stats.Name[i]);
statsData.WriteCString(Stats.IconName);
statsData.WriteCString(Stats.CastBarCaption);
statsData.WriteCString(Stats.UnkString);
for (uint i = 0; i < SharedConst.MaxGOData; i++)
statsData.WriteInt32(Stats.Data[i]);
statsData.WriteFloat(Stats.Size);
statsData.WriteUInt8((byte)Stats.QuestItems.Count);
foreach (uint questItem in Stats.QuestItems)
statsData.WriteUInt32(questItem);
statsData.WriteUInt32(Stats.RequiredLevel);
}
_worldPacket.WriteUInt32(statsData.GetSize());
if (statsData.GetSize() != 0)
_worldPacket.WriteBytes(statsData);
}
public uint GameObjectID;
public ObjectGuid Guid;
public bool Allow;
public GameObjectStats Stats;
}
public class QueryCorpseLocationFromClient : ClientPacket
{
public QueryCorpseLocationFromClient(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Player;
}
public class CorpseLocation : ServerPacket
{
public CorpseLocation() : base(ServerOpcodes.CorpseLocation) { }
public override void Write()
{
_worldPacket.WriteBit(Valid);
_worldPacket.FlushBits();
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteInt32(ActualMapID);
_worldPacket.WriteVector3(Position);
_worldPacket.WriteInt32(MapID);
_worldPacket.WritePackedGuid(Transport);
}
public ObjectGuid Player;
public ObjectGuid Transport;
public Vector3 Position;
public int ActualMapID;
public int MapID;
public bool Valid;
}
public class QueryCorpseTransport : ClientPacket
{
public QueryCorpseTransport(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player = _worldPacket.ReadPackedGuid();
Transport = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Player;
public ObjectGuid Transport;
}
public class CorpseTransportQuery : ServerPacket
{
public CorpseTransportQuery() : base(ServerOpcodes.CorpseTransportQuery) { }
public override void Write()
{
_worldPacket.WritePackedGuid(Player);
_worldPacket.WriteVector3(Position);
_worldPacket.WriteFloat(Facing);
}
public ObjectGuid Player;
public Vector3 Position;
public float Facing;
}
public class QueryTime : ClientPacket
{
public QueryTime(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class QueryTimeResponse : ServerPacket
{
public QueryTimeResponse() : base(ServerOpcodes.QueryTimeResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)CurrentTime);
}
public long CurrentTime;
}
public class QuestPOIQuery : ClientPacket
{
public QuestPOIQuery(WorldPacket packet) : base(packet) { }
public override void Read()
{
MissingQuestCount = _worldPacket.ReadInt32();
for (byte i = 0; i < MissingQuestCount; ++i)
MissingQuestPOIs[i] = _worldPacket.ReadUInt32();
}
public int MissingQuestCount;
public uint[] MissingQuestPOIs = new uint[125];
}
public class QuestPOIQueryResponse : ServerPacket
{
public QuestPOIQueryResponse() : base(ServerOpcodes.QuestPoiQueryResponse) { }
public override void Write()
{
_worldPacket.WriteInt32(QuestPOIDataStats.Count);
_worldPacket.WriteInt32(QuestPOIDataStats.Count);
bool useCache = WorldConfig.GetBoolValue(WorldCfg.CacheDataQueries);
foreach (QuestPOIData questPOIData in QuestPOIDataStats)
{
if (useCache)
_worldPacket.WriteBytes(questPOIData.QueryDataBuffer);
else
questPOIData.Write(_worldPacket);
}
}
public List<QuestPOIData> QuestPOIDataStats = new List<QuestPOIData>();
}
class QueryQuestCompletionNPCs : ClientPacket
{
public QueryQuestCompletionNPCs(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint questCount = _worldPacket.ReadUInt32();
QuestCompletionNPCs = new uint[questCount];
for (uint i = 0; i < questCount; ++i)
QuestCompletionNPCs[i] = _worldPacket.ReadUInt32();
}
public uint[] QuestCompletionNPCs;
}
class QuestCompletionNPCResponse : ServerPacket
{
public QuestCompletionNPCResponse() : base(ServerOpcodes.QuestCompletionNpcResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(QuestCompletionNPCs.Count);
foreach (var quest in QuestCompletionNPCs)
{
_worldPacket.WriteUInt32(quest.QuestID);
_worldPacket.WriteInt32(quest.NPCs.Count);
foreach (var npc in quest.NPCs)
_worldPacket.WriteUInt32(npc);
}
}
public List<QuestCompletionNPC> QuestCompletionNPCs = new List<QuestCompletionNPC>();
}
class QueryPetName : ClientPacket
{
public QueryPetName(WorldPacket packet) : base(packet) { }
public override void Read()
{
UnitGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid UnitGUID;
}
class QueryPetNameResponse : ServerPacket
{
public QueryPetNameResponse() : base(ServerOpcodes.QueryPetNameResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteBit(Allow);
if (Allow)
{
_worldPacket.WriteBits(Name.GetByteCount(), 8);
_worldPacket.WriteBit(HasDeclined);
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
_worldPacket.WriteBits(DeclinedNames.name[i].GetByteCount(), 7);
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
_worldPacket.WriteString(DeclinedNames.name[i]);
_worldPacket.WriteUInt32(Timestamp);
_worldPacket.WriteString(Name);
}
_worldPacket.FlushBits();
}
public ObjectGuid UnitGUID;
public bool Allow;
public bool HasDeclined;
public DeclinedName DeclinedNames = new DeclinedName();
public uint Timestamp;
public string Name = "";
}
class ItemTextQuery : ClientPacket
{
public ItemTextQuery(WorldPacket packet) : base(packet) { }
public override void Read()
{
Id = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Id;
}
class QueryItemTextResponse : ServerPacket
{
public QueryItemTextResponse() : base(ServerOpcodes.QueryItemTextResponse) { }
public override void Write()
{
_worldPacket.WriteBit(Valid);
_worldPacket.WriteBits(Text.GetByteCount(), 13);
_worldPacket.FlushBits();
_worldPacket.WriteString(Text);
_worldPacket.WritePackedGuid(Id);
}
public ObjectGuid Id;
public bool Valid;
public string Text;
}
class QueryRealmName : ClientPacket
{
public QueryRealmName(WorldPacket packet) : base(packet) { }
public override void Read()
{
VirtualRealmAddress = _worldPacket.ReadUInt32();
}
public uint VirtualRealmAddress;
}
class RealmQueryResponse : ServerPacket
{
public RealmQueryResponse() : base(ServerOpcodes.RealmQueryResponse) { }
public override void Write()
{
_worldPacket.WriteUInt32(VirtualRealmAddress);
_worldPacket.WriteUInt8(LookupState);
if (LookupState == 0)
NameInfo.Write(_worldPacket);
}
public uint VirtualRealmAddress;
public byte LookupState;
public VirtualRealmNameInfo NameInfo;
}
//Structs
public class PlayerGuidLookupHint
{
public void Write(WorldPacket data)
{
data.WriteBit(VirtualRealmAddress.HasValue);
data.WriteBit(NativeRealmAddress.HasValue);
data.FlushBits();
if (VirtualRealmAddress.HasValue)
data.WriteUInt32(VirtualRealmAddress.Value);
if (NativeRealmAddress.HasValue)
data.WriteUInt32(NativeRealmAddress.Value);
}
public Optional<uint> VirtualRealmAddress = new Optional<uint>(); // current realm (?) (identifier made from the Index, BattleGroup and Region)
public Optional<uint> NativeRealmAddress = new Optional<uint>(); // original realm (?) (identifier made from the Index, BattleGroup and Region)
}
public class PlayerGuidLookupData
{
public bool Initialize(ObjectGuid guid, Player player = null)
{
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(guid);
if (characterInfo == null)
return false;
if (player)
{
Cypher.Assert(player.GetGUID() == guid);
AccountID = player.GetSession().GetAccountGUID();
BnetAccountID = player.GetSession().GetBattlenetAccountGUID();
Name = player.GetName();
RaceID = player.GetRace();
Sex = (Gender)(byte)player.m_playerData.NativeSex;
ClassID = player.GetClass();
Level = (byte)player.GetLevel();
DeclinedName names = player.GetDeclinedNames();
if (names != null)
DeclinedNames = names;
}
else
{
uint accountId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(guid);
uint bnetAccountId = Global.BNetAccountMgr.GetIdByGameAccount(accountId);
AccountID = ObjectGuid.Create(HighGuid.WowAccount, accountId);
BnetAccountID = ObjectGuid.Create(HighGuid.BNetAccount, bnetAccountId);
Name = characterInfo.Name;
RaceID = characterInfo.RaceId;
Sex = characterInfo.Sex;
ClassID = characterInfo.ClassId;
Level = characterInfo.Level;
}
IsDeleted = characterInfo.IsDeleted;
GuidActual = guid;
VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
return true;
}
public void Write(WorldPacket data)
{
data.WriteBit(IsDeleted);
data.WriteBits(Name.GetByteCount(), 6);
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
data.WriteBits(DeclinedNames.name[i].GetByteCount(), 7);
data.FlushBits();
for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; ++i)
data.WriteString(DeclinedNames.name[i]);
data.WritePackedGuid(AccountID);
data.WritePackedGuid(BnetAccountID);
data.WritePackedGuid(GuidActual);
data.WriteUInt64(GuildClubMemberID);
data.WriteUInt32(VirtualRealmAddress);
data.WriteUInt8((byte)RaceID);
data.WriteUInt8((byte)Sex);
data.WriteUInt8((byte)ClassID);
data.WriteUInt8(Level);
data.WriteString(Name);
}
public bool IsDeleted;
public ObjectGuid AccountID;
public ObjectGuid BnetAccountID;
public ObjectGuid GuidActual;
public string Name = "";
public ulong GuildClubMemberID; // same as bgs.protocol.club.v1.MemberId.unique_id
public uint VirtualRealmAddress;
public Race RaceID = Race.None;
public Gender Sex = Gender.None;
public Class ClassID = Class.None;
public byte Level;
public DeclinedName DeclinedNames = new DeclinedName();
}
public class CreatureXDisplay
{
public CreatureXDisplay(uint creatureDisplayID, float displayScale, float probability)
{
CreatureDisplayID = creatureDisplayID;
Scale = displayScale;
Probability = probability;
}
public uint CreatureDisplayID;
public float Scale = 1.0f;
public float Probability = 1.0f;
}
public class CreatureDisplayStats
{
public float TotalProbability;
public List<CreatureXDisplay> CreatureDisplay = new List<CreatureXDisplay>();
}
public class CreatureStats
{
public string Title;
public string TitleAlt;
public string CursorName;
public int CreatureType;
public int CreatureFamily;
public int Classification;
public CreatureDisplayStats Display = new CreatureDisplayStats();
public float HpMulti;
public float EnergyMulti;
public bool Leader;
public List<uint> QuestItems = new List<uint>();
public uint CreatureMovementInfoID;
public int HealthScalingExpansion;
public uint RequiredExpansion;
public uint VignetteID;
public int Class;
public float FadeRegionRadius;
public int WidgetSetID;
public int WidgetSetUnitConditionID;
public uint[] Flags = new uint[2];
public uint[] ProxyCreatureID = new uint[SharedConst.MaxCreatureKillCredit];
public StringArray Name = new StringArray(SharedConst.MaxCreatureNames);
public StringArray NameAlt = new StringArray(SharedConst.MaxCreatureNames);
}
public struct DBQueryRecord
{
public uint RecordID;
}
public class GameObjectStats
{
public string[] Name = new string[4];
public string IconName;
public string CastBarCaption;
public string UnkString;
public uint Type;
public uint DisplayID;
public int[] Data = new int[SharedConst.MaxGOData];
public float Size;
public List<uint> QuestItems = new List<uint>();
public uint RequiredLevel;
}
class QuestCompletionNPC
{
public uint QuestID;
public List<uint> NPCs = new List<uint>();
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
namespace Game.Networking.Packets
{
public class ReferAFriendFailure : ServerPacket
{
public ReferAFriendFailure() : base(ServerOpcodes.ReferAFriendFailure) { }
public override void Write()
{
_worldPacket .WriteInt32((int)Reason);
// Client uses this string only if Reason == ERR_REFER_A_FRIEND_NOT_IN_GROUP || Reason == ERR_REFER_A_FRIEND_SUMMON_OFFLINE_S
// but always reads it from packet
_worldPacket.WriteBits(Str.GetByteCount(), 6);
_worldPacket.WriteString(Str);
}
public string Str;
public ReferAFriendError Reason;
}
}
@@ -0,0 +1,121 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class InitializeFactions : ServerPacket
{
const ushort FactionCount = 350;
public InitializeFactions() : base(ServerOpcodes.InitializeFactions, ConnectionType.Instance) { }
public override void Write()
{
for (ushort i = 0; i < FactionCount; ++i)
{
_worldPacket.WriteUInt8((byte)FactionFlags[i]);
_worldPacket.WriteInt32(FactionStandings[i]);
}
for (ushort i = 0; i < FactionCount; ++i)
_worldPacket.WriteBit(FactionHasBonus[i]);
_worldPacket.FlushBits();
}
public int[] FactionStandings = new int[FactionCount];
public bool[] FactionHasBonus = new bool[FactionCount]; //@todo: implement faction bonus
public FactionFlags[] FactionFlags = new FactionFlags[FactionCount];
}
class RequestForcedReactions : ClientPacket
{
public RequestForcedReactions(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
class SetForcedReactions : ServerPacket
{
public SetForcedReactions() : base(ServerOpcodes.SetForcedReactions, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(Reactions.Count);
foreach (ForcedReaction reaction in Reactions)
reaction.Write(_worldPacket);
}
public List<ForcedReaction> Reactions = new List<ForcedReaction>();
}
class SetFactionStanding : ServerPacket
{
public SetFactionStanding() : base(ServerOpcodes.SetFactionStanding, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteFloat(ReferAFriendBonus);
_worldPacket.WriteFloat(BonusFromAchievementSystem);
_worldPacket.WriteInt32(Faction.Count);
foreach (FactionStandingData factionStanding in Faction)
factionStanding.Write(_worldPacket);
_worldPacket.WriteBit(ShowVisual);
_worldPacket.FlushBits();
}
public float ReferAFriendBonus;
public float BonusFromAchievementSystem;
public List<FactionStandingData> Faction = new List<FactionStandingData>();
public bool ShowVisual;
}
struct ForcedReaction
{
public void Write(WorldPacket data)
{
data.WriteInt32(Faction);
data.WriteInt32(Reaction);
}
public int Faction;
public int Reaction;
}
struct FactionStandingData
{
public FactionStandingData(int index, int standing)
{
Index = index;
Standing = standing;
}
public void Write(WorldPacket data)
{
data.WriteInt32(Index);
data.WriteInt32(Standing);
}
int Index;
int Standing;
}
}
@@ -0,0 +1,195 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Scenarios;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class ScenarioState : ServerPacket
{
public ScenarioState() : base(ServerOpcodes.ScenarioState, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(ScenarioID);
_worldPacket.WriteInt32(CurrentStep);
_worldPacket.WriteUInt32(DifficultyID);
_worldPacket.WriteUInt32(WaveCurrent);
_worldPacket.WriteUInt32(WaveMax);
_worldPacket.WriteUInt32(TimerDuration);
_worldPacket.WriteInt32(CriteriaProgress.Count);
_worldPacket.WriteInt32(BonusObjectives.Count);
_worldPacket.WriteInt32(PickedSteps.Count);
_worldPacket.WriteInt32(Spells.Count);
for (int i = 0; i < PickedSteps.Count; ++i)
_worldPacket.WriteUInt32(PickedSteps[i]);
_worldPacket.WriteBit(ScenarioComplete);
_worldPacket.FlushBits();
foreach (CriteriaProgressPkt progress in CriteriaProgress)
progress.Write(_worldPacket);
foreach (BonusObjectiveData bonusObjective in BonusObjectives)
bonusObjective.Write(_worldPacket);
foreach (ScenarioSpellUpdate spell in Spells)
spell.Write(_worldPacket);
}
public int ScenarioID;
public int CurrentStep = -1;
public uint DifficultyID;
public uint WaveCurrent;
public uint WaveMax;
public uint TimerDuration;
public List<CriteriaProgressPkt> CriteriaProgress = new List<CriteriaProgressPkt>();
public List<BonusObjectiveData> BonusObjectives = new List<BonusObjectiveData>();
public List<uint> PickedSteps = new List<uint>();
public List<ScenarioSpellUpdate> Spells = new List<ScenarioSpellUpdate>();
public bool ScenarioComplete = false;
}
class ScenarioProgressUpdate : ServerPacket
{
public ScenarioProgressUpdate() : base(ServerOpcodes.ScenarioProgressUpdate, ConnectionType.Instance) { }
public override void Write()
{
CriteriaProgress.Write(_worldPacket);
}
public CriteriaProgressPkt CriteriaProgress;
}
class ScenarioCompleted : ServerPacket
{
public ScenarioCompleted(uint scenarioId) : base(ServerOpcodes.ScenarioCompleted, ConnectionType.Instance)
{
ScenarioID = scenarioId;
}
public override void Write()
{
_worldPacket.WriteUInt32(ScenarioID);
}
public uint ScenarioID;
}
class ScenarioBoot : ServerPacket
{
public ScenarioBoot() : base(ServerOpcodes.ScenarioBoot, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteInt32(ScenarioID);
_worldPacket.WriteInt32(Unk1);
_worldPacket.WriteBits(Unk2, 2);
_worldPacket.FlushBits();
}
public int ScenarioID;
public int Unk1;
public byte Unk2;
}
class QueryScenarioPOI : ClientPacket
{
public QueryScenarioPOI(WorldPacket packet) : base(packet) { }
public override void Read()
{
var count = _worldPacket.ReadUInt32();
for (var i = 0; i < count; ++i)
MissingScenarioPOIs[i] = _worldPacket.ReadInt32();
}
public Array<int> MissingScenarioPOIs = new Array<int>(50);
}
class ScenarioPOIs : ServerPacket
{
public ScenarioPOIs() : base(ServerOpcodes.ScenarioPois) { }
public override void Write()
{
_worldPacket.WriteInt32(ScenarioPOIDataStats.Count);
foreach (ScenarioPOIData scenarioPOIData in ScenarioPOIDataStats)
{
_worldPacket.WriteInt32(scenarioPOIData.CriteriaTreeID);
_worldPacket.WriteInt32(scenarioPOIData.ScenarioPOIs.Count);
foreach (ScenarioPOI scenarioPOI in scenarioPOIData.ScenarioPOIs)
{
_worldPacket.WriteInt32(scenarioPOI.BlobIndex);
_worldPacket.WriteInt32(scenarioPOI.MapID);
_worldPacket.WriteInt32(scenarioPOI.UiMapID);
_worldPacket.WriteInt32(scenarioPOI.Priority);
_worldPacket.WriteInt32(scenarioPOI.Flags);
_worldPacket.WriteInt32(scenarioPOI.WorldEffectID);
_worldPacket.WriteInt32(scenarioPOI.PlayerConditionID);
_worldPacket.WriteInt32(scenarioPOI.Points.Count);
foreach (var scenarioPOIBlobPoint in scenarioPOI.Points)
{
_worldPacket.WriteInt32((int)scenarioPOIBlobPoint.X);
_worldPacket.WriteInt32((int)scenarioPOIBlobPoint.Y);
}
}
}
}
public List<ScenarioPOIData> ScenarioPOIDataStats = new List<ScenarioPOIData>();
}
struct BonusObjectiveData
{
public void Write(WorldPacket data)
{
data.WriteInt32(BonusObjectiveID);
data.WriteBit(ObjectiveComplete);
data.FlushBits();
}
public int BonusObjectiveID;
public bool ObjectiveComplete;
}
class ScenarioSpellUpdate
{
public void Write(WorldPacket data)
{
data.WriteUInt32(SpellID);
data.WriteBit(Usable);
data.FlushBits();
}
public uint SpellID;
public bool Usable = true;
}
struct ScenarioPOIData
{
public int CriteriaTreeID;
public List<ScenarioPOI> ScenarioPOIs;
}
}
@@ -0,0 +1,98 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
namespace Game.Networking.Packets
{
class PlayScene : ServerPacket
{
public PlayScene() : base(ServerOpcodes.PlayScene, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(SceneID);
_worldPacket.WriteUInt32(PlaybackFlags);
_worldPacket.WriteUInt32(SceneInstanceID);
_worldPacket.WriteUInt32(SceneScriptPackageID);
_worldPacket.WritePackedGuid(TransportGUID);
_worldPacket.WriteXYZO(Location);
_worldPacket.WriteBit(PerformTactCallbacks);
_worldPacket.FlushBits();
}
public uint SceneID;
public uint PlaybackFlags;
public uint SceneInstanceID;
public uint SceneScriptPackageID;
public ObjectGuid TransportGUID;
public Position Location;
public bool PerformTactCallbacks;
}
class CancelScene : ServerPacket
{
public CancelScene() : base(ServerOpcodes.CancelScene, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(SceneInstanceID);
}
public uint SceneInstanceID;
}
class SceneTriggerEvent : ClientPacket
{
public SceneTriggerEvent(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint len = _worldPacket.ReadBits<uint>(6);
SceneInstanceID = _worldPacket.ReadUInt32();
_Event = _worldPacket.ReadString(len);
}
public uint SceneInstanceID;
public string _Event;
}
class ScenePlaybackComplete : ClientPacket
{
public ScenePlaybackComplete(WorldPacket packet) : base(packet) { }
public override void Read()
{
SceneInstanceID = _worldPacket.ReadUInt32();
}
public uint SceneInstanceID;
}
class ScenePlaybackCanceled : ClientPacket
{
public ScenePlaybackCanceled(WorldPacket packet) : base(packet) { }
public override void Read()
{
SceneInstanceID = _worldPacket.ReadUInt32();
}
public uint SceneInstanceID;
}
}
@@ -0,0 +1,226 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class SendContactList : ClientPacket
{
public SendContactList(WorldPacket packet) : base(packet) { }
public override void Read()
{
Flags = (SocialFlag)_worldPacket.ReadUInt32();
}
public SocialFlag Flags;
}
public class ContactList : ServerPacket
{
public ContactList() : base(ServerOpcodes.ContactList)
{
Contacts = new List<ContactInfo>();
}
public override void Write()
{
_worldPacket.WriteUInt32((uint)Flags);
_worldPacket.WriteBits(Contacts.Count, 8);
_worldPacket.FlushBits();
Contacts.ForEach(p => p.Write(_worldPacket));
}
public List<ContactInfo> Contacts;
public SocialFlag Flags;
}
public class FriendStatusPkt : ServerPacket
{
public FriendStatusPkt() : base(ServerOpcodes.FriendStatus) { }
public void Initialize(ObjectGuid guid, FriendsResult result, FriendInfo friendInfo)
{
VirtualRealmAddress = Global.WorldMgr.GetVirtualRealmAddress();
Notes = friendInfo.Note;
ClassID = friendInfo.Class;
Status = friendInfo.Status;
Guid = guid;
WowAccountGuid = friendInfo.WowAccountGuid;
Level = friendInfo.Level;
AreaID = friendInfo.Area;
FriendResult = result;
}
public override void Write()
{
_worldPacket.WriteUInt8((byte)FriendResult);
_worldPacket.WritePackedGuid(Guid);
_worldPacket.WritePackedGuid(WowAccountGuid);
_worldPacket.WriteUInt32(VirtualRealmAddress);
_worldPacket.WriteUInt8((byte)Status);
_worldPacket.WriteUInt32(AreaID);
_worldPacket.WriteUInt32(Level);
_worldPacket.WriteUInt32((uint)ClassID);
_worldPacket.WriteBits(Notes.GetByteCount(), 10);
_worldPacket.WriteBit(Mobile);
_worldPacket.FlushBits();
_worldPacket.WriteString(Notes);
}
public uint VirtualRealmAddress;
public string Notes;
public Class ClassID = Class.None;
public FriendStatus Status;
public ObjectGuid Guid;
public ObjectGuid WowAccountGuid;
public uint Level;
public uint AreaID;
public FriendsResult FriendResult;
public bool Mobile;
}
public class AddFriend : ClientPacket
{
public AddFriend(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint nameLength = _worldPacket.ReadBits<uint>(9);
uint noteslength = _worldPacket.ReadBits<uint>(10);
Name = _worldPacket.ReadString(nameLength);
Notes = _worldPacket.ReadString(noteslength);
}
public string Notes;
public string Name;
}
public class DelFriend : ClientPacket
{
public DelFriend(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player.Read(_worldPacket);
}
public QualifiedGUID Player;
}
public class SetContactNotes : ClientPacket
{
public SetContactNotes(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player.Read(_worldPacket);
Notes = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(10));
}
public QualifiedGUID Player;
public string Notes;
}
public class AddIgnore : ClientPacket
{
public AddIgnore(WorldPacket packet) : base(packet) { }
public override void Read()
{
Name = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(9));
}
public string Name;
}
public class DelIgnore : ClientPacket
{
public DelIgnore(WorldPacket packet) : base(packet) { }
public override void Read()
{
Player.Read(_worldPacket);
}
public QualifiedGUID Player;
}
//Structs
public class ContactInfo
{
public ContactInfo(ObjectGuid guid, FriendInfo friendInfo)
{
Guid = guid;
WowAccountGuid = friendInfo.WowAccountGuid;
VirtualRealmAddr = Global.WorldMgr.GetVirtualRealmAddress();
NativeRealmAddr = Global.WorldMgr.GetVirtualRealmAddress();
TypeFlags = friendInfo.Flags;
Notes = friendInfo.Note;
Status = friendInfo.Status;
AreaID = friendInfo.Area;
Level = friendInfo.Level;
ClassID = friendInfo.Class;
}
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WritePackedGuid(WowAccountGuid);
data.WriteUInt32(VirtualRealmAddr);
data.WriteUInt32(NativeRealmAddr);
data.WriteUInt32((uint)TypeFlags);
data.WriteUInt8((byte)Status);
data.WriteUInt32(AreaID);
data.WriteUInt32(Level);
data.WriteUInt32((uint)ClassID);
data.WriteBits(Notes.GetByteCount(), 10);
data.WriteBit(Mobile);
data.FlushBits();
data.WriteString(Notes);
}
ObjectGuid Guid;
ObjectGuid WowAccountGuid;
uint VirtualRealmAddr;
uint NativeRealmAddr;
SocialFlag TypeFlags;
string Notes;
FriendStatus Status;
uint AreaID;
uint Level;
Class ClassID;
bool Mobile;
}
public struct QualifiedGUID
{
public void Read(WorldPacket data)
{
VirtualRealmAddress = data.ReadUInt32();
Guid = data.ReadPackedGuid();
}
public ObjectGuid Guid;
public uint VirtualRealmAddress;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,354 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using System;
using System.Collections.Generic;
using Game.Entities;
namespace Game.Networking.Packets
{
public class FeatureSystemStatus : ServerPacket
{
public FeatureSystemStatus() : base(ServerOpcodes.FeatureSystemStatus)
{
SessionAlert = new Optional<SessionAlertConfig>();
EuropaTicketSystemStatus = new Optional<EuropaTicketConfig>();
}
public override void Write()
{
_worldPacket.WriteUInt8(ComplaintStatus);
_worldPacket.WriteUInt32(ScrollOfResurrectionRequestsRemaining);
_worldPacket.WriteUInt32(ScrollOfResurrectionMaxRequestsPerDay);
_worldPacket.WriteUInt32(CfgRealmID);
_worldPacket.WriteInt32(CfgRealmRecID);
_worldPacket.WriteUInt32(RAFSystem.MaxRecruits);
_worldPacket.WriteUInt32(RAFSystem.MaxRecruitMonths);
_worldPacket.WriteUInt32(RAFSystem.MaxRecruitmentUses);
_worldPacket.WriteUInt32(RAFSystem.DaysInCycle);
_worldPacket.WriteUInt32(TwitterPostThrottleLimit);
_worldPacket.WriteUInt32(TwitterPostThrottleCooldown);
_worldPacket.WriteUInt32(TokenPollTimeSeconds);
_worldPacket.WriteInt64(TokenBalanceAmount);
_worldPacket.WriteUInt32(BpayStoreProductDeliveryDelay);
_worldPacket.WriteUInt32(ClubsPresenceUpdateTimer);
_worldPacket.WriteUInt32(HiddenUIClubsPresenceUpdateTimer);
_worldPacket.WriteBit(VoiceEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.HasValue);
_worldPacket.WriteBit(ScrollOfResurrectionEnabled);
_worldPacket.WriteBit(BpayStoreEnabled);
_worldPacket.WriteBit(BpayStoreAvailable);
_worldPacket.WriteBit(BpayStoreDisabledByParentalControls);
_worldPacket.WriteBit(ItemRestorationButtonEnabled);
_worldPacket.WriteBit(BrowserEnabled);
_worldPacket.WriteBit(SessionAlert.HasValue);
_worldPacket.WriteBit(RAFSystem.Enabled);
_worldPacket.WriteBit(RAFSystem.RecruitingEnabled);
_worldPacket.WriteBit(CharUndeleteEnabled);
_worldPacket.WriteBit(RestrictedAccount);
_worldPacket.WriteBit(CommerceSystemEnabled);
_worldPacket.WriteBit(TutorialsEnabled);
_worldPacket.WriteBit(NPETutorialsEnabled);
_worldPacket.WriteBit(TwitterEnabled);
_worldPacket.WriteBit(Unk67);
_worldPacket.WriteBit(WillKickFromWorld);
_worldPacket.WriteBit(KioskModeEnabled);
_worldPacket.WriteBit(CompetitiveModeEnabled);
_worldPacket.WriteBit(TokenBalanceEnabled);
_worldPacket.WriteBit(WarModeFeatureEnabled);
_worldPacket.WriteBit(ClubsEnabled);
_worldPacket.WriteBit(ClubsBattleNetClubTypeAllowed);
_worldPacket.WriteBit(ClubsCharacterClubTypeAllowed);
_worldPacket.WriteBit(ClubsPresenceUpdateEnabled);
_worldPacket.WriteBit(VoiceChatDisabledByParentalControl);
_worldPacket.WriteBit(VoiceChatMutedByParentalControl);
_worldPacket.WriteBit(QuestSessionEnabled);
_worldPacket.WriteBit(IsMuted);
_worldPacket.WriteBit(ClubFinderEnabled);
_worldPacket.FlushBits();
{
_worldPacket.WriteBit(QuickJoinConfig.ToastsDisabled);
_worldPacket.WriteFloat(QuickJoinConfig.ToastDuration);
_worldPacket.WriteFloat(QuickJoinConfig.DelayDuration);
_worldPacket.WriteFloat(QuickJoinConfig.QueueMultiplier);
_worldPacket.WriteFloat(QuickJoinConfig.PlayerMultiplier);
_worldPacket.WriteFloat(QuickJoinConfig.PlayerFriendValue);
_worldPacket.WriteFloat(QuickJoinConfig.PlayerGuildValue);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleInitialThreshold);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleDecayTime);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottlePrioritySpike);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleMinThreshold);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottlePvPPriorityNormal);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottlePvPPriorityLow);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottlePvPHonorThreshold);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleLfgListPriorityDefault);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleLfgListPriorityAbove);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleLfgListPriorityBelow);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleLfgListIlvlScalingAbove);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleLfgListIlvlScalingBelow);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleRfPriorityAbove);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleRfIlvlScalingAbove);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleDfMaxItemLevel);
_worldPacket.WriteFloat(QuickJoinConfig.ThrottleDfBestPriority);
}
if (SessionAlert.HasValue)
{
_worldPacket.WriteInt32(SessionAlert.Value.Delay);
_worldPacket.WriteInt32(SessionAlert.Value.Period);
_worldPacket.WriteInt32(SessionAlert.Value.DisplayTime);
}
_worldPacket.WriteBit(VoiceChatManagerSettings.IsSquelched);
_worldPacket.WritePackedGuid(VoiceChatManagerSettings.BnetAccountGuid);
_worldPacket.WritePackedGuid(VoiceChatManagerSettings.GuildGuid);
if (EuropaTicketSystemStatus.HasValue)
{
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.TicketsEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.BugsEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.ComplaintsEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.SuggestionsEnabled);
_worldPacket.WriteUInt32(EuropaTicketSystemStatus.Value.ThrottleState.MaxTries);
_worldPacket.WriteUInt32(EuropaTicketSystemStatus.Value.ThrottleState.PerMilliseconds);
_worldPacket.WriteUInt32(EuropaTicketSystemStatus.Value.ThrottleState.TryCount);
_worldPacket.WriteUInt32(EuropaTicketSystemStatus.Value.ThrottleState.LastResetTimeBeforeNow);
}
}
public bool VoiceEnabled;
public bool BrowserEnabled;
public bool BpayStoreAvailable;
public bool BpayStoreEnabled;
public Optional<SessionAlertConfig> SessionAlert;
public uint ScrollOfResurrectionMaxRequestsPerDay;
public bool ScrollOfResurrectionEnabled;
public Optional<EuropaTicketConfig> EuropaTicketSystemStatus;
public uint ScrollOfResurrectionRequestsRemaining;
public uint CfgRealmID;
public byte ComplaintStatus;
public int CfgRealmRecID;
public uint TwitterPostThrottleLimit;
public uint TwitterPostThrottleCooldown;
public uint TokenPollTimeSeconds;
public long TokenBalanceAmount;
public uint BpayStoreProductDeliveryDelay;
public uint ClubsPresenceUpdateTimer;
public uint HiddenUIClubsPresenceUpdateTimer; // Timer for updating club presence when communities ui frame is hidden
public bool ItemRestorationButtonEnabled;
public bool CharUndeleteEnabled; // Implemented
public bool BpayStoreDisabledByParentalControls;
public bool TwitterEnabled;
public bool CommerceSystemEnabled;
public bool Unk67;
public bool WillKickFromWorld;
public bool RestrictedAccount;
public bool TutorialsEnabled;
public bool NPETutorialsEnabled;
public bool KioskModeEnabled;
public bool CompetitiveModeEnabled;
public bool TokenBalanceEnabled;
public bool WarModeFeatureEnabled;
public bool ClubsEnabled;
public bool ClubsBattleNetClubTypeAllowed;
public bool ClubsCharacterClubTypeAllowed;
public bool ClubsPresenceUpdateEnabled;
public bool VoiceChatDisabledByParentalControl;
public bool VoiceChatMutedByParentalControl;
public bool QuestSessionEnabled;
public bool IsMuted;
public bool ClubFinderEnabled;
public SocialQueueConfig QuickJoinConfig;
public VoiceChatProxySettings VoiceChatManagerSettings;
public RafSystemFeatureInfo RAFSystem;
public struct SavedThrottleObjectState
{
public uint MaxTries;
public uint PerMilliseconds;
public uint TryCount;
public uint LastResetTimeBeforeNow;
}
public struct EuropaTicketConfig
{
public bool TicketsEnabled;
public bool BugsEnabled;
public bool ComplaintsEnabled;
public bool SuggestionsEnabled;
public SavedThrottleObjectState ThrottleState;
}
public struct SessionAlertConfig
{
public int Delay;
public int Period;
public int DisplayTime;
}
public struct SocialQueueConfig
{
public bool ToastsDisabled;
public float ToastDuration;
public float DelayDuration;
public float QueueMultiplier;
public float PlayerMultiplier;
public float PlayerFriendValue;
public float PlayerGuildValue;
public float ThrottleInitialThreshold;
public float ThrottleDecayTime;
public float ThrottlePrioritySpike;
public float ThrottleMinThreshold;
public float ThrottlePvPPriorityNormal;
public float ThrottlePvPPriorityLow;
public float ThrottlePvPHonorThreshold;
public float ThrottleLfgListPriorityDefault;
public float ThrottleLfgListPriorityAbove;
public float ThrottleLfgListPriorityBelow;
public float ThrottleLfgListIlvlScalingAbove;
public float ThrottleLfgListIlvlScalingBelow;
public float ThrottleRfPriorityAbove;
public float ThrottleRfIlvlScalingAbove;
public float ThrottleDfMaxItemLevel;
public float ThrottleDfBestPriority;
}
public struct VoiceChatProxySettings
{
public bool IsSquelched;
public ObjectGuid BnetAccountGuid;
public ObjectGuid GuildGuid;
}
public struct RafSystemFeatureInfo
{
public bool Enabled;
public bool RecruitingEnabled;
public uint MaxRecruits;
public uint MaxRecruitMonths;
public uint MaxRecruitmentUses;
public uint DaysInCycle;
}
}
public class FeatureSystemStatusGlueScreen : ServerPacket
{
public FeatureSystemStatusGlueScreen() : base(ServerOpcodes.FeatureSystemStatusGlueScreen) { }
public override void Write()
{
_worldPacket.WriteBit(BpayStoreEnabled);
_worldPacket.WriteBit(BpayStoreAvailable);
_worldPacket.WriteBit(BpayStoreDisabledByParentalControls);
_worldPacket.WriteBit(CharUndeleteEnabled);
_worldPacket.WriteBit(CommerceSystemEnabled);
_worldPacket.WriteBit(Unk14);
_worldPacket.WriteBit(WillKickFromWorld);
_worldPacket.WriteBit(IsExpansionPreorderInStore);
_worldPacket.WriteBit(KioskModeEnabled);
_worldPacket.WriteBit(CompetitiveModeEnabled);
_worldPacket.WriteBit(TrialBoostEnabled);
_worldPacket.WriteBit(TokenBalanceEnabled);
_worldPacket.WriteBit(LiveRegionCharacterListEnabled);
_worldPacket.WriteBit(LiveRegionCharacterCopyEnabled);
_worldPacket.WriteBit(LiveRegionAccountCopyEnabled);
_worldPacket.FlushBits();
_worldPacket.WriteUInt32(TokenPollTimeSeconds);
_worldPacket.WriteInt64(TokenBalanceAmount);
_worldPacket.WriteInt32(MaxCharactersPerRealm);
_worldPacket.WriteUInt32(BpayStoreProductDeliveryDelay);
_worldPacket.WriteInt32(ActiveCharacterUpgradeBoostType);
_worldPacket.WriteInt32(ActiveClassTrialBoostType);
_worldPacket.WriteInt32(MinimumExpansionLevel);
_worldPacket.WriteInt32(MaximumExpansionLevel);
}
public bool BpayStoreAvailable; // NYI
public bool BpayStoreDisabledByParentalControls; // NYI
public bool CharUndeleteEnabled;
public bool BpayStoreEnabled; // NYI
public bool CommerceSystemEnabled; // NYI
public bool Unk14; // NYI
public bool WillKickFromWorld; // NYI
public bool IsExpansionPreorderInStore; // NYI
public bool KioskModeEnabled; // NYI
public bool CompetitiveModeEnabled; // NYI
public bool TrialBoostEnabled; // NYI
public bool TokenBalanceEnabled; // NYI
public bool LiveRegionCharacterListEnabled; // NYI
public bool LiveRegionCharacterCopyEnabled; // NYI
public bool LiveRegionAccountCopyEnabled; // NYI
public uint TokenPollTimeSeconds; // NYI
public long TokenBalanceAmount; // NYI
public int MaxCharactersPerRealm;
public uint BpayStoreProductDeliveryDelay; // NYI
public int ActiveCharacterUpgradeBoostType; // NYI
public int ActiveClassTrialBoostType; // NYI
public int MinimumExpansionLevel;
public int MaximumExpansionLevel;
}
public class MOTD : ServerPacket
{
public MOTD() : base(ServerOpcodes.Motd) { }
public override void Write()
{
_worldPacket.WriteBits(Text.Count, 4);
_worldPacket.FlushBits();
foreach (var line in Text)
{
_worldPacket.WriteBits(line.GetByteCount(), 7);
_worldPacket.FlushBits();
_worldPacket.WriteString(line);
}
}
public List<string> Text;
}
public class SetTimeZoneInformation : ServerPacket
{
public SetTimeZoneInformation() : base(ServerOpcodes.SetTimeZoneInformation) { }
public override void Write()
{
_worldPacket.WriteBits(ServerTimeTZ.GetByteCount(), 7);
_worldPacket.WriteBits(GameTimeTZ.GetByteCount(), 7);
_worldPacket.WriteString(ServerTimeTZ);
_worldPacket.WriteString(GameTimeTZ);
}
public string ServerTimeTZ;
public string GameTimeTZ;
}
}
@@ -0,0 +1,215 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class UpdateTalentData : ServerPacket
{
public UpdateTalentData() : base(ServerOpcodes.UpdateTalentData, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt8(Info.ActiveGroup);
_worldPacket.WriteUInt32(Info.PrimarySpecialization);
_worldPacket.WriteInt32(Info.TalentGroups.Count);
foreach (var talentGroupInfo in Info.TalentGroups)
{
_worldPacket.WriteUInt32(talentGroupInfo.SpecID);
_worldPacket.WriteInt32(talentGroupInfo.TalentIDs.Count);
_worldPacket.WriteInt32(talentGroupInfo.PvPTalentIDs.Count);
foreach (var talentID in talentGroupInfo.TalentIDs)
_worldPacket.WriteUInt16(talentID);
foreach (ushort talentID in talentGroupInfo.PvPTalentIDs)
_worldPacket.WriteUInt16(talentID);
}
}
public TalentInfoUpdate Info = new TalentInfoUpdate();
public class TalentGroupInfo
{
public uint SpecID;
public List<ushort> TalentIDs = new List<ushort>();
public List<ushort> PvPTalentIDs = new List<ushort>();
}
public class TalentInfoUpdate
{
public byte ActiveGroup;
public uint PrimarySpecialization;
public List<TalentGroupInfo> TalentGroups = new List<TalentGroupInfo>();
}
}
class LearnTalents : ClientPacket
{
public LearnTalents(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint count = _worldPacket.ReadBits<uint>(6);
for (int i = 0; i < count; ++i)
Talents[i] = _worldPacket.ReadUInt16();
}
public Array<ushort> Talents = new Array<ushort>(PlayerConst.MaxTalentTiers);
}
class RespecWipeConfirm : ServerPacket
{
public RespecWipeConfirm() : base(ServerOpcodes.RespecWipeConfirm) { }
public override void Write()
{
_worldPacket.WriteInt8((sbyte)RespecType);
_worldPacket.WriteUInt32(Cost);
_worldPacket.WritePackedGuid(RespecMaster);
}
public ObjectGuid RespecMaster;
public uint Cost;
public SpecResetType RespecType;
}
class ConfirmRespecWipe : ClientPacket
{
public ConfirmRespecWipe(WorldPacket packet) : base(packet) { }
public override void Read()
{
RespecMaster = _worldPacket.ReadPackedGuid();
RespecType = (SpecResetType)_worldPacket.ReadUInt8();
}
public ObjectGuid RespecMaster;
public SpecResetType RespecType;
}
class LearnTalentsFailed : ServerPacket
{
public LearnTalentsFailed() : base(ServerOpcodes.LearnTalentsFailed) { }
public override void Write()
{
_worldPacket.WriteBits(Reason, 4);
_worldPacket.WriteInt32(SpellID);
_worldPacket.WriteInt32(Talents.Count);
foreach (var talent in Talents)
_worldPacket.WriteUInt16(talent);
}
public uint Reason;
public int SpellID;
public List<ushort> Talents = new List<ushort>();
}
class ActiveGlyphs : ServerPacket
{
public ActiveGlyphs() : base(ServerOpcodes.ActiveGlyphs) { }
public override void Write()
{
_worldPacket.WriteInt32(Glyphs.Count);
foreach (GlyphBinding glyph in Glyphs)
glyph.Write(_worldPacket);
_worldPacket.WriteBit(IsFullUpdate);
_worldPacket.FlushBits();
}
public List<GlyphBinding> Glyphs = new List<GlyphBinding>();
public bool IsFullUpdate;
}
class LearnPvpTalents : ClientPacket
{
public LearnPvpTalents(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint size = _worldPacket.ReadUInt32();
for (int i = 0; i < size; ++i)
Talents[i].Read(_worldPacket);
}
public Array<PvPTalent> Talents = new Array<PvPTalent>(4);
}
class LearnPvpTalentsFailed : ServerPacket
{
public LearnPvpTalentsFailed() : base(ServerOpcodes.LearnPvpTalentsFailed) { }
public override void Write()
{
_worldPacket.WriteBits(Reason, 4);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteInt32(Talents.Count);
foreach (var pvpTalent in Talents)
pvpTalent.Write(_worldPacket);
}
public uint Reason;
public uint SpellID;
public List<PvPTalent> Talents = new List<PvPTalent>();
}
//Structs
public struct PvPTalent
{
public ushort PvPTalentID;
public byte Slot;
public void Read(WorldPacket data)
{
PvPTalentID = data.ReadUInt16();
Slot = data.ReadUInt8();
}
public void Write(WorldPacket data)
{
data.WriteUInt16(PvPTalentID);
data.WriteUInt8(Slot);
}
}
struct GlyphBinding
{
public GlyphBinding(uint spellId, ushort glyphId)
{
SpellID = spellId;
GlyphID = glyphId;
}
public void Write(WorldPacket data)
{
data.WriteUInt32(SpellID);
data.WriteUInt16(GlyphID);
}
uint SpellID;
ushort GlyphID;
}
}
@@ -0,0 +1,155 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
namespace Game.Networking.Packets
{
class TaxiNodeStatusQuery : ClientPacket
{
public TaxiNodeStatusQuery(WorldPacket packet) : base(packet) { }
public override void Read()
{
UnitGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid UnitGUID;
}
class TaxiNodeStatusPkt : ServerPacket
{
public TaxiNodeStatusPkt() : base(ServerOpcodes.TaxiNodeStatus) { }
public override void Write()
{
_worldPacket .WritePackedGuid( Unit);
_worldPacket.WriteBits(Status, 2);
_worldPacket.FlushBits();
}
public TaxiNodeStatus Status; // replace with TaxiStatus enum
public ObjectGuid Unit;
}
public class ShowTaxiNodes : ServerPacket
{
public ShowTaxiNodes() : base(ServerOpcodes.ShowTaxiNodes) { }
public override void Write()
{
_worldPacket.WriteBit(WindowInfo.HasValue);
_worldPacket.FlushBits();
_worldPacket.WriteInt32(CanLandNodes.Length);
_worldPacket.WriteInt32(CanUseNodes.Length);
if (WindowInfo.HasValue)
{
_worldPacket.WritePackedGuid(WindowInfo.Value.UnitGUID);
_worldPacket.WriteInt32(WindowInfo.Value.CurrentNode);
}
foreach (var node in CanLandNodes)
_worldPacket.WriteUInt8(node);
foreach (var node in CanUseNodes)
_worldPacket.WriteUInt8(node);
}
public Optional<ShowTaxiNodesWindowInfo> WindowInfo;
public byte[] CanLandNodes = null; // Nodes known by player
public byte[] CanUseNodes = null; // Nodes available for use - this can temporarily disable a known node
}
class EnableTaxiNode : ClientPacket
{
public EnableTaxiNode(WorldPacket packet) : base(packet) { }
public override void Read()
{
Unit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Unit;
}
class TaxiQueryAvailableNodes : ClientPacket
{
public TaxiQueryAvailableNodes(WorldPacket packet) : base(packet) { }
public override void Read()
{
Unit = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Unit;
}
class ActivateTaxi : ClientPacket
{
public ActivateTaxi(WorldPacket packet) : base(packet) { }
public override void Read()
{
Vendor = _worldPacket.ReadPackedGuid();
Node = _worldPacket.ReadUInt32();
GroundMountID = _worldPacket.ReadUInt32();
FlyingMountID = _worldPacket.ReadUInt32();
}
public ObjectGuid Vendor;
public uint Node;
public uint GroundMountID;
public uint FlyingMountID;
}
class NewTaxiPath : ServerPacket
{
public NewTaxiPath() : base(ServerOpcodes.NewTaxiPath) { }
public override void Write() { }
}
class ActivateTaxiReplyPkt : ServerPacket
{
public ActivateTaxiReplyPkt() : base(ServerOpcodes.ActivateTaxiReply) { }
public override void Write()
{
_worldPacket.WriteBits(Reply, 4);
_worldPacket.FlushBits();
}
public ActivateTaxiReply Reply;
}
class TaxiRequestEarlyLanding : ClientPacket
{
public TaxiRequestEarlyLanding(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public struct ShowTaxiNodesWindowInfo
{
public ObjectGuid UnitGUID;
public int CurrentNode;
}
}
@@ -0,0 +1,581 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Framework.GameMath;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class GMTicketGetSystemStatus : ClientPacket
{
public GMTicketGetSystemStatus(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class GMTicketSystemStatusPkt : ServerPacket
{
public GMTicketSystemStatusPkt() : base(ServerOpcodes.GmTicketSystemStatus) { }
public override void Write()
{
_worldPacket.WriteInt32(Status);
}
public int Status;
}
public class GMTicketGetCaseStatus : ClientPacket
{
public GMTicketGetCaseStatus(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class GMTicketCaseStatus : ServerPacket
{
public GMTicketCaseStatus() : base(ServerOpcodes.GmTicketCaseStatus) { }
public override void Write()
{
_worldPacket.WriteInt32(Cases.Count);
foreach (var c in Cases)
{
_worldPacket.WriteInt32(c.CaseID);
_worldPacket.WriteInt32(c.CaseOpened);
_worldPacket.WriteInt32(c.CaseStatus);
_worldPacket.WriteInt16(c.CfgRealmID);
_worldPacket.WriteInt64(c.CharacterID);
_worldPacket.WriteInt32(c.WaitTimeOverrideMinutes);
_worldPacket.WriteBits(c.Url.GetByteCount(), 11);
_worldPacket.WriteBits(c.WaitTimeOverrideMessage.GetByteCount(), 10);
_worldPacket.WriteString(c.Url);
_worldPacket.WriteString(c.WaitTimeOverrideMessage);
}
}
public List<GMTicketCase> Cases = new List<GMTicketCase>();
public struct GMTicketCase
{
public int CaseID;
public int CaseOpened;
public int CaseStatus;
public short CfgRealmID;
public long CharacterID;
public int WaitTimeOverrideMinutes;
public string Url;
public string WaitTimeOverrideMessage;
}
}
public class GMTicketAcknowledgeSurvey : ClientPacket
{
public GMTicketAcknowledgeSurvey(WorldPacket packet) : base(packet) { }
public override void Read()
{
CaseID = _worldPacket.ReadInt32();
}
int CaseID;
}
public class SupportTicketSubmitBug : ClientPacket
{
public SupportTicketHeader Header;
public string Note;
public SupportTicketSubmitBug(WorldPacket packet) : base(packet) { }
public override void Read()
{
Header.Read(_worldPacket);
Note = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(10));
}
}
public class SupportTicketSubmitSuggestion : ClientPacket
{
public SupportTicketHeader Header;
public string Note;
public SupportTicketSubmitSuggestion(WorldPacket packet) : base(packet) { }
public override void Read()
{
Header.Read(_worldPacket);
Note = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(10));
}
}
public class SupportTicketSubmitComplaint : ClientPacket
{
public SupportTicketSubmitComplaint(WorldPacket packet) : base(packet) { }
public override void Read()
{
Header.Read(_worldPacket);
TargetCharacterGUID = _worldPacket.ReadPackedGuid();
ChatLog.Read(_worldPacket);
ComplaintType = _worldPacket.ReadBits<byte>(5);
uint noteLength = _worldPacket.ReadBits<uint>(10);
bool hasMailInfo = _worldPacket.HasBit();
bool hasCalendarInfo = _worldPacket.HasBit();
bool hasPetInfo = _worldPacket.HasBit();
bool hasGuildInfo = _worldPacket.HasBit();
bool hasLFGListSearchResult = _worldPacket.HasBit();
bool hasLFGListApplicant = _worldPacket.HasBit();
bool hasClubMessage = _worldPacket.HasBit();
bool hasClubFinderResult = _worldPacket.HasBit();
_worldPacket.ResetBitPos();
if (hasClubMessage)
{
CommunityMessage.HasValue = true;
CommunityMessage.Value.IsPlayerUsingVoice = _worldPacket.HasBit();
_worldPacket.ResetBitPos();
}
HorusChatLog.Read(_worldPacket);
Note = _worldPacket.ReadString(noteLength);
if (hasMailInfo)
{
MailInfo.HasValue = true;
MailInfo.Value.Read(_worldPacket);
}
if (hasCalendarInfo)
{
CalenderInfo.HasValue = true;
CalenderInfo.Value.Read(_worldPacket);
}
if (hasPetInfo)
{
PetInfo.HasValue = true;
PetInfo.Value.Read(_worldPacket);
}
if (hasGuildInfo)
{
GuildInfo.HasValue = true;
GuildInfo.Value.Read(_worldPacket);
}
if (hasLFGListSearchResult)
{
LFGListSearchResult.HasValue = true;
LFGListSearchResult.Value.Read(_worldPacket);
}
if (hasLFGListApplicant)
{
LFGListApplicant.HasValue = true;
LFGListApplicant.Value.Read(_worldPacket);
}
if (hasClubFinderResult)
{
ClubFinderResult.HasValue = true;
ClubFinderResult.Value.Read(_worldPacket);
}
}
public SupportTicketHeader Header;
public SupportTicketChatLog ChatLog;
public ObjectGuid TargetCharacterGUID;
public byte ComplaintType;
public string Note;
public SupportTicketHorusChatLog HorusChatLog;
public Optional<SupportTicketMailInfo> MailInfo;
public Optional<SupportTicketCalendarEventInfo> CalenderInfo;
public Optional<SupportTicketPetInfo> PetInfo;
public Optional<SupportTicketGuildInfo> GuildInfo;
public Optional<SupportTicketLFGListSearchResult> LFGListSearchResult;
public Optional<SupportTicketLFGListApplicant> LFGListApplicant;
public Optional<SupportTicketCommunityMessage> CommunityMessage;
public Optional<SupportTicketClubFinderResult> ClubFinderResult;
public struct SupportTicketChatLine
{
public uint Timestamp;
public string Text;
public SupportTicketChatLine(WorldPacket data)
{
Timestamp = data.ReadUInt32();
Text = data.ReadString(data.ReadBits<uint>(12));
}
public SupportTicketChatLine(uint timestamp, string text)
{
Timestamp = timestamp;
Text = text;
}
public void Read(WorldPacket data)
{
Timestamp = data.ReadUInt32();
Text = data.ReadString(data.ReadBits<uint>(12));
}
}
public class SupportTicketChatLog
{
public void Read(WorldPacket data)
{
uint linesCount = data.ReadUInt32();
ReportLineIndex.HasValue = data.HasBit();
data.ResetBitPos();
for (uint i = 0; i < linesCount; i++)
Lines.Add(new SupportTicketChatLine(data));
if (ReportLineIndex.HasValue)
ReportLineIndex.Value = data.ReadUInt32();
}
public List<SupportTicketChatLine> Lines = new List<SupportTicketChatLine>();
public Optional<uint> ReportLineIndex;
}
public struct SupportTicketHorusChatLine
{
public void Read(WorldPacket data)
{
Timestamp = data.ReadInt32();
AuthorGUID = data.ReadPackedGuid();
bool hasClubID = data.HasBit();
bool hasChannelGUID = data.HasBit();
bool hasRealmAddress = data.HasBit();
bool hasSlashCmd = data.HasBit();
uint textLength = data.ReadBits<uint>(12);
if (hasClubID)
{
ClubID.HasValue = true;
ClubID.Value = data.ReadUInt64();
}
if (hasChannelGUID)
{
ChannelGUID.HasValue = true;
ChannelGUID.Value = data.ReadPackedGuid();
}
if (hasRealmAddress)
{
RealmAddress.HasValue = true;
RealmAddress.Value.VirtualRealmAddress = data.ReadUInt32();
RealmAddress.Value.field_4 = data.ReadUInt16();
RealmAddress.Value.field_6 = data.ReadUInt8();
}
if (hasSlashCmd)
{
SlashCmd.HasValue = true;
SlashCmd.Value = data.ReadInt32();
}
Text = data.ReadString(textLength);
}
public struct SenderRealm
{
public uint VirtualRealmAddress;
public ushort field_4;
public byte field_6;
}
public int Timestamp;
public ObjectGuid AuthorGUID;
public Optional<ulong> ClubID;
public Optional<ObjectGuid> ChannelGUID;
public Optional<SenderRealm> RealmAddress;
public Optional<int> SlashCmd;
public string Text;
}
public class SupportTicketHorusChatLog
{
public List<SupportTicketHorusChatLine> Lines = new List<SupportTicketHorusChatLine>();
public void Read(WorldPacket data)
{
uint linesCount = data.ReadUInt32();
data.ResetBitPos();
for (uint i = 0; i < linesCount; i++)
{
var chatLine = new SupportTicketHorusChatLine();
chatLine.Read(data);
Lines.Add(chatLine);
}
}
}
public struct SupportTicketMailInfo
{
public void Read(WorldPacket data)
{
MailID = data.ReadInt32();
uint bodyLength = data.ReadBits<uint>(13);
uint subjectLength = data.ReadBits<uint>(9);
MailBody = data.ReadString(bodyLength);
MailSubject = data.ReadString(subjectLength);
}
public int MailID;
public string MailSubject;
public string MailBody;
}
public struct SupportTicketCalendarEventInfo
{
public void Read(WorldPacket data)
{
EventID = data.ReadUInt64();
InviteID = data.ReadUInt64();
EventTitle = data.ReadString(data.ReadBits<byte>(8));
}
public ulong EventID;
public ulong InviteID;
public string EventTitle;
}
public struct SupportTicketPetInfo
{
public void Read(WorldPacket data)
{
PetID = data.ReadPackedGuid();
PetName = data.ReadString(data.ReadBits<byte>(8));
}
public ObjectGuid PetID;
public string PetName;
}
public struct SupportTicketGuildInfo
{
public void Read(WorldPacket data)
{
byte nameLength = data.ReadBits<byte>(8);
GuildID = data.ReadPackedGuid();
GuildName = data.ReadString(nameLength);
}
public ObjectGuid GuildID;
public string GuildName;
}
public struct SupportTicketLFGListSearchResult
{
public void Read(WorldPacket data)
{
RideTicket = new RideTicket();
RideTicket.Read(data);
GroupFinderActivityID = data.ReadUInt32();
LastTitleAuthorGuid = data.ReadPackedGuid();
LastDescriptionAuthorGuid = data.ReadPackedGuid();
LastVoiceChatAuthorGuid = data.ReadPackedGuid();
ListingCreatorGuid = data.ReadPackedGuid();
Unknown735 = data.ReadPackedGuid();
byte titleLength = data.ReadBits<byte>(8);
byte descriptionLength = data.ReadBits<byte>(11);
byte voiceChatLength = data.ReadBits<byte>(8);
Title = data.ReadString(titleLength);
Description = data.ReadString(descriptionLength);
VoiceChat = data.ReadString(voiceChatLength);
}
public RideTicket RideTicket;
public uint GroupFinderActivityID;
public ObjectGuid LastTitleAuthorGuid;
public ObjectGuid LastDescriptionAuthorGuid;
public ObjectGuid LastVoiceChatAuthorGuid;
public ObjectGuid ListingCreatorGuid;
public ObjectGuid Unknown735;
public string Title;
public string Description;
public string VoiceChat;
}
public struct SupportTicketLFGListApplicant
{
public void Read(WorldPacket data)
{
RideTicket = new RideTicket();
RideTicket.Read(data);
Comment = data.ReadString(data.ReadBits<uint>(9));
}
public RideTicket RideTicket;
public string Comment;
}
public struct SupportTicketCommunityMessage
{
public bool IsPlayerUsingVoice;
}
public struct SupportTicketClubFinderResult
{
public ulong ClubFinderPostingID;
public ulong ClubID;
public ObjectGuid ClubFinderGUID;
public string ClubName;
public void Read(WorldPacket data)
{
ClubFinderPostingID = data.ReadUInt64();
ClubID = data.ReadUInt64();
ClubFinderGUID = data.ReadPackedGuid();
ClubName = data.ReadString(data.ReadBits<uint>(12));
}
}
}
class Complaint : ClientPacket
{
public Complaint(WorldPacket packet) : base(packet) { }
public override void Read()
{
ComplaintType = (SupportSpamType)_worldPacket.ReadUInt8();
Offender.Read(_worldPacket);
switch (ComplaintType)
{
case SupportSpamType.Mail:
MailID = _worldPacket.ReadUInt32();
break;
case SupportSpamType.Chat:
Chat.Read(_worldPacket);
break;
case SupportSpamType.Calendar:
EventGuid = _worldPacket.ReadUInt64();
InviteGuid = _worldPacket.ReadUInt64();
break;
}
}
public SupportSpamType ComplaintType;
ComplaintOffender Offender;
uint MailID;
ComplaintChat Chat;
ulong EventGuid;
ulong InviteGuid;
struct ComplaintOffender
{
public void Read(WorldPacket data)
{
PlayerGuid = data.ReadPackedGuid();
RealmAddress = data.ReadUInt32();
TimeSinceOffence = data.ReadUInt32();
}
public ObjectGuid PlayerGuid;
public uint RealmAddress;
public uint TimeSinceOffence;
}
struct ComplaintChat
{
public void Read(WorldPacket data)
{
Command = data.ReadUInt32();
ChannelID = data.ReadUInt32();
MessageLog = data.ReadString(data.ReadBits<uint>(12));
}
public uint Command;
public uint ChannelID;
public string MessageLog;
}
}
public class ComplaintResult : ServerPacket
{
public ComplaintResult() : base(ServerOpcodes.ComplaintResult) { }
public override void Write()
{
_worldPacket.WriteUInt32((uint)ComplaintType);
_worldPacket.WriteUInt8(Result);
}
public SupportSpamType ComplaintType;
public byte Result;
}
class BugReport : ClientPacket
{
public BugReport(WorldPacket packet) : base(packet) { }
public override void Read()
{
Type = _worldPacket.ReadBit();
uint diagLen = _worldPacket.ReadBits<uint>(12);
uint textLen = _worldPacket.ReadBits<uint>(10);
DiagInfo = _worldPacket.ReadString(diagLen);
Text = _worldPacket.ReadString(textLen);
}
public uint Type;
public string Text;
public string DiagInfo;
}
//Structs
public struct SupportTicketHeader
{
public void Read(WorldPacket packet)
{
MapID = packet.ReadUInt32();
Position = packet.ReadVector3();
Facing = packet.ReadFloat();
}
public uint MapID;
public Vector3 Position;
public float Facing;
}
}
@@ -0,0 +1,98 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class UpdateListedAuctionableTokens : ClientPacket
{
public UpdateListedAuctionableTokens(WorldPacket packet) : base(packet) { }
public override void Read()
{
UnkInt = _worldPacket.ReadUInt32();
}
public uint UnkInt;
}
class UpdateListedAuctionableTokensResponse : ServerPacket
{
public UpdateListedAuctionableTokensResponse() : base(ServerOpcodes.WowTokenUpdateAuctionableListResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(UnkInt);
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteInt32(AuctionableTokenAuctionableList.Count);
foreach (AuctionableTokenAuctionable auctionableTokenAuctionable in AuctionableTokenAuctionableList)
{
_worldPacket.WriteUInt64(auctionableTokenAuctionable.UnkInt1);
_worldPacket.WriteUInt32(auctionableTokenAuctionable.UnkInt2);
_worldPacket.WriteUInt32(auctionableTokenAuctionable.Owner);
_worldPacket.WriteUInt64(auctionableTokenAuctionable.BuyoutPrice);
_worldPacket.WriteUInt32(auctionableTokenAuctionable.EndTime);
}
}
public uint UnkInt; // send CMSG_UPDATE_WOW_TOKEN_AUCTIONABLE_LIST
public TokenResult Result;
List<AuctionableTokenAuctionable> AuctionableTokenAuctionableList =new List<AuctionableTokenAuctionable>();
struct AuctionableTokenAuctionable
{
public ulong UnkInt1;
public uint UnkInt2;
public uint Owner;
public ulong BuyoutPrice;
public uint EndTime;
}
}
class RequestWowTokenMarketPrice : ClientPacket
{
public RequestWowTokenMarketPrice(WorldPacket packet) : base(packet) { }
public override void Read()
{
UnkInt = _worldPacket.ReadUInt32();
}
public uint UnkInt;
}
class WowTokenMarketPriceResponse : ServerPacket
{
public WowTokenMarketPriceResponse() : base(ServerOpcodes.WowTokenMarketPriceResponse) { }
public override void Write()
{
_worldPacket.WriteUInt64(CurrentMarketPrice);
_worldPacket.WriteUInt32(UnkInt);
_worldPacket.WriteUInt32((uint)Result);
_worldPacket.WriteUInt32(AuctionDuration);
}
public ulong CurrentMarketPrice;
public uint UnkInt; // send CMSG_REQUEST_WOW_TOKEN_MARKET_PRICE
public TokenResult Result;
public uint AuctionDuration; // preset auction duration enum
}
}
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
namespace Game.Networking.Packets
{
class TotemDestroyed : ClientPacket
{
public TotemDestroyed(WorldPacket packet) : base(packet) { }
public override void Read()
{
Slot = _worldPacket.ReadUInt8();
TotemGUID = _worldPacket.ReadPackedGuid();
}
public ObjectGuid TotemGUID;
public byte Slot;
}
class TotemCreated : ServerPacket
{
public TotemCreated() : base(ServerOpcodes.TotemCreated) { }
public override void Write()
{
_worldPacket.WriteUInt8(Slot);
_worldPacket.WritePackedGuid(Totem);
_worldPacket.WriteUInt32(Duration);
_worldPacket.WriteUInt32(SpellID);
_worldPacket.WriteFloat(TimeMod);
_worldPacket.WriteBit(CannotDismiss);
_worldPacket.FlushBits();
}
public ObjectGuid Totem;
public uint SpellID;
public uint Duration;
public byte Slot;
public float TimeMod = 1.0f;
public bool CannotDismiss;
}
class TotemMoved : ServerPacket
{
public TotemMoved() : base(ServerOpcodes.TotemMoved) { }
public override void Write()
{
_worldPacket.WriteUInt8(Slot);
_worldPacket.WriteUInt8(NewSlot);
_worldPacket.WritePackedGuid(Totem);
}
public ObjectGuid Totem;
public byte Slot;
public byte NewSlot;
}
}
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
using System;
namespace Game.Networking.Packets
{
class AddToy : ClientPacket
{
public AddToy(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
class UseToy : ClientPacket
{
public UseToy(WorldPacket packet) : base(packet) { }
public override void Read()
{
Cast.Read(_worldPacket);
}
public SpellCastRequest Cast = new SpellCastRequest();
}
class AccountToysUpdate : ServerPacket
{
public AccountToysUpdate() : base(ServerOpcodes.AccountToysUpdate, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBit(IsFullUpdate);
_worldPacket.FlushBits();
// all lists have to have the same size
_worldPacket.WriteInt32(Toys.Count);
_worldPacket.WriteInt32(Toys.Count);
_worldPacket.WriteInt32(Toys.Count);
foreach (var pair in Toys)
_worldPacket.WriteUInt32(pair.Key);
foreach (var pair in Toys)
_worldPacket.WriteBit(pair.Value.HasAnyFlag(ToyFlags.Favorite));
foreach (var pair in Toys)
_worldPacket.WriteBit(pair.Value.HasAnyFlag(ToyFlags.HasFanfare));
_worldPacket.FlushBits();
}
public bool IsFullUpdate = false;
public Dictionary<uint, ToyFlags> Toys = new Dictionary<uint, ToyFlags>();
}
class ToyClearFanfare : ClientPacket
{
public ToyClearFanfare(WorldPacket packet) : base(packet) { }
public override void Read()
{
ItemID = _worldPacket.ReadUInt32();
}
public uint ItemID;
}
}
@@ -0,0 +1,268 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class AcceptTrade : ClientPacket
{
public AcceptTrade(WorldPacket packet) : base(packet) { }
public override void Read()
{
StateIndex = _worldPacket.ReadUInt32();
}
public uint StateIndex;
}
public class BeginTrade : ClientPacket
{
public BeginTrade(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class BusyTrade : ClientPacket
{
public BusyTrade(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class CancelTrade : ClientPacket
{
public CancelTrade(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class ClearTradeItem : ClientPacket
{
public ClearTradeItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
TradeSlot = _worldPacket.ReadUInt8();
}
public byte TradeSlot;
}
public class IgnoreTrade : ClientPacket
{
public IgnoreTrade(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class InitiateTrade : ClientPacket
{
public InitiateTrade(WorldPacket packet) : base(packet) { }
public override void Read()
{
Guid = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Guid;
}
public class SetTradeCurrency : ClientPacket
{
public SetTradeCurrency(WorldPacket packet) : base(packet) { }
public override void Read()
{
Type = _worldPacket.ReadUInt32();
Quantity = _worldPacket.ReadUInt32();
}
public uint Type;
public uint Quantity;
}
public class SetTradeGold : ClientPacket
{
public SetTradeGold(WorldPacket packet) : base(packet) { }
public override void Read()
{
Coinage = _worldPacket.ReadUInt64();
}
public ulong Coinage;
}
public class SetTradeItem : ClientPacket
{
public SetTradeItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
TradeSlot = _worldPacket.ReadUInt8();
PackSlot = _worldPacket.ReadUInt8();
ItemSlotInPack = _worldPacket.ReadUInt8();
}
public byte TradeSlot;
public byte PackSlot;
public byte ItemSlotInPack;
}
public class UnacceptTrade : ClientPacket
{
public UnacceptTrade(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class TradeStatusPkt : ServerPacket
{
public TradeStatusPkt() : base(ServerOpcodes.TradeStatus, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBit(PartnerIsSameBnetAccount);
_worldPacket.WriteBits(Status, 5);
switch (Status)
{
case TradeStatus.Failed:
_worldPacket.WriteBit(FailureForYou);
_worldPacket.WriteInt32((int)BagResult);
_worldPacket.WriteUInt32(ItemID);
break;
case TradeStatus.Initiated:
_worldPacket.WriteUInt32(Id);
break;
case TradeStatus.Proposed:
_worldPacket.WritePackedGuid(Partner);
_worldPacket.WritePackedGuid(PartnerAccount);
break;
case TradeStatus.WrongRealm:
case TradeStatus.NotOnTaplist:
_worldPacket.WriteUInt8(TradeSlot);
break;
case TradeStatus.NotEnoughCurrency:
case TradeStatus.CurrencyNotTradable:
_worldPacket.WriteInt32(CurrencyType);
_worldPacket.WriteInt32(CurrencyQuantity);
break;
default:
_worldPacket.FlushBits();
break;
}
}
public TradeStatus Status = TradeStatus.Initiated;
public byte TradeSlot;
public ObjectGuid PartnerAccount;
public ObjectGuid Partner;
public int CurrencyType;
public int CurrencyQuantity;
public bool FailureForYou;
public InventoryResult BagResult;
public uint ItemID;
public uint Id;
public bool PartnerIsSameBnetAccount;
}
public class TradeUpdated : ServerPacket
{
public TradeUpdated() : base(ServerOpcodes.TradeUpdated, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt8(WhichPlayer);
_worldPacket.WriteUInt32(Id);
_worldPacket.WriteUInt32(ClientStateIndex);
_worldPacket.WriteUInt32(CurrentStateIndex);
_worldPacket.WriteUInt64(Gold);
_worldPacket.WriteInt32(CurrencyType);
_worldPacket.WriteInt32(CurrencyQuantity);
_worldPacket.WriteInt32(ProposedEnchantment);
_worldPacket.WriteInt32(Items.Count);
Items.ForEach(item => item.Write(_worldPacket));
}
public class UnwrappedTradeItem
{
public void Write(WorldPacket data)
{
data.WriteInt32(EnchantID);
data.WriteInt32(OnUseEnchantmentID);
data.WritePackedGuid(Creator);
data.WriteInt32(Charges);
data.WriteUInt32(MaxDurability);
data.WriteUInt32(Durability);
data.WriteBits(Gems.Count, 2);
data.WriteBit(Lock);
data.FlushBits();
foreach (var gem in Gems)
gem.Write(data);
}
public ItemInstance Item;
public int EnchantID;
public int OnUseEnchantmentID;
public ObjectGuid Creator;
public int Charges;
public bool Lock;
public uint MaxDurability;
public uint Durability;
public List<ItemGemData> Gems = new List<ItemGemData>();
}
public class TradeItem
{
public void Write(WorldPacket data)
{
data.WriteUInt8(Slot);
data.WriteInt32(StackCount);
data.WritePackedGuid(GiftCreator);
Item.Write(data);
data.WriteBit(Unwrapped.HasValue);
data.FlushBits();
if (Unwrapped.HasValue)
Unwrapped.Value.Write(data);
}
public byte Slot;
public ItemInstance Item = new ItemInstance();
public int StackCount;
public ObjectGuid GiftCreator;
public Optional<UnwrappedTradeItem> Unwrapped;
}
public ulong Gold;
public uint CurrentStateIndex;
public byte WhichPlayer;
public uint ClientStateIndex;
public List<TradeItem> Items = new List<TradeItem>();
public int CurrencyType;
public uint Id;
public int ProposedEnchantment;
public int CurrencyQuantity;
}
}
@@ -0,0 +1,100 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class TransmogrifyItems : ClientPacket
{
public TransmogrifyItems(WorldPacket packet) : base(packet) { }
public override void Read()
{
var itemsCount = _worldPacket.ReadUInt32();
Npc = _worldPacket.ReadPackedGuid();
for (var i = 0; i < itemsCount; ++i)
{
TransmogrifyItem item = new TransmogrifyItem();
item.Read(_worldPacket);
Items[i] = item;
}
CurrentSpecOnly = _worldPacket.HasBit();
}
public ObjectGuid Npc;
public Array<TransmogrifyItem> Items = new Array<TransmogrifyItem>(13);
public bool CurrentSpecOnly;
}
class TransmogCollectionUpdate : ServerPacket
{
public TransmogCollectionUpdate() : base(ServerOpcodes.TransmogCollectionUpdate) { }
public override void Write()
{
_worldPacket.WriteBit(IsFullUpdate);
_worldPacket.WriteBit(IsSetFavorite);
_worldPacket.WriteInt32(FavoriteAppearances.Count);
_worldPacket.WriteInt32(NewAppearances.Count);
foreach (uint itemModifiedAppearanceId in FavoriteAppearances)
_worldPacket.WriteUInt32(itemModifiedAppearanceId);
foreach (var newAppearance in NewAppearances)
_worldPacket.WriteUInt32(newAppearance);
}
public bool IsFullUpdate;
public bool IsSetFavorite;
public List<uint> FavoriteAppearances = new List<uint>();
public List<uint> NewAppearances = new List<uint>();
}
class OpenTransmogrifier : ServerPacket
{
public OpenTransmogrifier(ObjectGuid guid) : base(ServerOpcodes.OpenTransmogrifier, ConnectionType.Instance)
{
Guid = guid;
}
public override void Write()
{
_worldPacket.WritePackedGuid(Guid);
}
ObjectGuid Guid;
}
struct TransmogrifyItem
{
public void Read(WorldPacket data)
{
ItemModifiedAppearanceID = data.ReadInt32();
Slot = data.ReadUInt32();
SpellItemEnchantmentID = data.ReadInt32();
}
public int ItemModifiedAppearanceID;
public uint Slot;
public int SpellItemEnchantmentID;
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
namespace Game.Networking.Packets
{
public class UpdateObject : ServerPacket
{
public UpdateObject() : base(ServerOpcodes.UpdateObject, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(NumObjUpdates);
_worldPacket.WriteUInt16(MapID);
_worldPacket.WriteBytes(Data);
}
public uint NumObjUpdates;
public ushort MapID;
public byte[] Data;
}
}
@@ -0,0 +1,160 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
namespace Game.Networking.Packets
{
public class MoveSetVehicleRecID : ServerPacket
{
public MoveSetVehicleRecID() : base(ServerOpcodes.MoveSetVehicleRecId) { }
public override void Write()
{
_worldPacket.WritePackedGuid(MoverGUID);
_worldPacket.WriteUInt32(SequenceIndex);
_worldPacket.WriteUInt32(VehicleRecID);
}
public ObjectGuid MoverGUID;
public uint SequenceIndex;
public uint VehicleRecID;
}
public class MoveSetVehicleRecIdAck : ClientPacket
{
public MoveSetVehicleRecIdAck(WorldPacket packet) : base(packet) { }
public override void Read()
{
Data.Read(_worldPacket);
VehicleRecID = _worldPacket.ReadInt32();
}
public MovementAck Data;
public int VehicleRecID;
}
public class SetVehicleRecID : ServerPacket
{
public SetVehicleRecID() : base(ServerOpcodes.SetVehicleRecId, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(VehicleGUID);
_worldPacket.WriteUInt32(VehicleRecID);
}
public ObjectGuid VehicleGUID;
public uint VehicleRecID;
}
public class OnCancelExpectedRideVehicleAura : ServerPacket
{
public OnCancelExpectedRideVehicleAura() : base(ServerOpcodes.OnCancelExpectedRideVehicleAura, ConnectionType.Instance) { }
public override void Write() { }
}
public class MoveDismissVehicle : ClientPacket
{
public MoveDismissVehicle(WorldPacket packet) : base(packet) { }
public override void Read()
{
Status = MovementExtensions.ReadMovementInfo(_worldPacket);
}
public MovementInfo Status;
}
public class RequestVehiclePrevSeat : ClientPacket
{
public RequestVehiclePrevSeat(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class RequestVehicleNextSeat : ClientPacket
{
public RequestVehicleNextSeat(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
public class MoveChangeVehicleSeats : ClientPacket
{
public MoveChangeVehicleSeats(WorldPacket packet) : base(packet) { }
public override void Read()
{
Status = MovementExtensions.ReadMovementInfo(_worldPacket);
DstVehicle = _worldPacket.ReadPackedGuid();
DstSeatIndex = _worldPacket.ReadUInt8();
}
public ObjectGuid DstVehicle;
public MovementInfo Status;
public byte DstSeatIndex = 255;
}
public class RequestVehicleSwitchSeat : ClientPacket
{
public RequestVehicleSwitchSeat(WorldPacket packet) : base(packet) { }
public override void Read()
{
Vehicle = _worldPacket.ReadPackedGuid();
SeatIndex = _worldPacket.ReadUInt8();
}
public ObjectGuid Vehicle;
public byte SeatIndex = 255;
}
public class RideVehicleInteract : ClientPacket
{
public RideVehicleInteract(WorldPacket packet) : base(packet) { }
public override void Read()
{
Vehicle = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Vehicle;
}
public class EjectPassenger : ClientPacket
{
public EjectPassenger(WorldPacket packet) : base(packet) { }
public override void Read()
{
Passenger = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Passenger;
}
public class RequestVehicleExit : ClientPacket
{
public RequestVehicleExit(WorldPacket packet) : base(packet) { }
public override void Read() { }
}
}
@@ -0,0 +1,183 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.Entities;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
class VoidTransferResult : ServerPacket
{
public VoidTransferResult(VoidTransferError result) : base(ServerOpcodes.VoidTransferResult, ConnectionType.Instance)
{
Result = result;
}
public override void Write()
{
_worldPacket.WriteInt32((int)Result);
}
public VoidTransferError Result;
}
class UnlockVoidStorage : ClientPacket
{
public UnlockVoidStorage(WorldPacket packet) : base(packet) { }
public override void Read()
{
Npc = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Npc;
}
class QueryVoidStorage : ClientPacket
{
public QueryVoidStorage(WorldPacket packet) : base(packet) { }
public override void Read()
{
Npc = _worldPacket.ReadPackedGuid();
}
public ObjectGuid Npc;
}
class VoidStorageFailed : ServerPacket
{
public VoidStorageFailed() : base(ServerOpcodes.VoidStorageFailed, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt8(Reason);
}
public byte Reason = 0;
}
class VoidStorageContents : ServerPacket
{
public VoidStorageContents() : base(ServerOpcodes.VoidStorageContents, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBits(Items.Count, 8);
_worldPacket.FlushBits();
foreach (VoidItem voidItem in Items)
voidItem.Write(_worldPacket);
}
public List<VoidItem> Items = new List<VoidItem>();
}
class VoidStorageTransfer : ClientPacket
{
public VoidStorageTransfer(WorldPacket packet) : base(packet) { }
public override void Read()
{
Npc = _worldPacket.ReadPackedGuid();
var DepositCount = _worldPacket.ReadInt32();
var WithdrawalCount = _worldPacket.ReadInt32();
for (uint i = 0; i < DepositCount; ++i)
Deposits[i] = _worldPacket.ReadPackedGuid();
for (uint i = 0; i < WithdrawalCount; ++i)
Withdrawals[i] = _worldPacket.ReadPackedGuid();
}
public ObjectGuid[] Withdrawals = new ObjectGuid[(int)SharedConst.VoidStorageMaxWithdraw];
public ObjectGuid[] Deposits = new ObjectGuid[(int)SharedConst.VoidStorageMaxDeposit];
public ObjectGuid Npc;
}
class VoidStorageTransferChanges : ServerPacket
{
public VoidStorageTransferChanges() : base(ServerOpcodes.VoidStorageTransferChanges, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteBits(AddedItems.Count, 4);
_worldPacket.WriteBits(RemovedItems.Count, 4);
_worldPacket.FlushBits();
foreach (VoidItem addedItem in AddedItems)
addedItem.Write(_worldPacket);
foreach (ObjectGuid removedItem in RemovedItems)
_worldPacket.WritePackedGuid(removedItem);
}
public List<ObjectGuid> RemovedItems = new List<ObjectGuid>();
public List<VoidItem> AddedItems = new List<VoidItem>();
}
class SwapVoidItem : ClientPacket
{
public SwapVoidItem(WorldPacket packet) : base(packet) { }
public override void Read()
{
Npc = _worldPacket.ReadPackedGuid();
VoidItemGuid = _worldPacket.ReadPackedGuid();
DstSlot = _worldPacket.ReadUInt32();
}
public ObjectGuid Npc;
public ObjectGuid VoidItemGuid;
public uint DstSlot;
}
class VoidItemSwapResponse : ServerPacket
{
public VoidItemSwapResponse() : base(ServerOpcodes.VoidItemSwapResponse, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WritePackedGuid(VoidItemA);
_worldPacket.WriteUInt32(VoidItemSlotA);
_worldPacket.WritePackedGuid(VoidItemB);
_worldPacket.WriteUInt32(VoidItemSlotB);
}
public ObjectGuid VoidItemA;
public ObjectGuid VoidItemB;
public uint VoidItemSlotA;
public uint VoidItemSlotB;
}
struct VoidItem
{
public void Write(WorldPacket data)
{
data .WritePackedGuid(Guid);
data .WritePackedGuid(Creator);
data .WriteUInt32(Slot);
Item.Write(data);
}
public ObjectGuid Guid;
public ObjectGuid Creator;
public uint Slot;
public ItemInstance Item;
}
}
@@ -0,0 +1,179 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
namespace Game.Networking.Packets
{
public enum WardenOpcodes
{
// Client.Server
CMSG_ModuleMissing = 0,
Cmsg_ModuleOk = 1,
Cmsg_CheatChecksResult = 2,
Cmsg_MemChecksResult = 3, // Only Sent If Mem_Check Bytes Doesn'T Match
Cmsg_HashResult = 4,
Cmsg_ModuleFailed = 5, // This Is Sent When Client Failed To Load Uploaded Module Due To Cache Fail
// Server.Client
Smsg_ModuleUse = 0,
Smsg_ModuleCache = 1,
Smsg_CheatChecksRequest = 2,
Smsg_ModuleInitialize = 3,
Smsg_MemChecksRequest = 4, // Byte Len; While (!Eof) { Byte Unk(1); Byte Index(++); String Module(Can Be 0); Int Offset; Byte Len; Byte[] Bytes_To_Compare[Len]; }
Smsg_HashRequest = 5
}
class WardenData : ClientPacket
{
public WardenData(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint size = _worldPacket.ReadUInt32();
if (size != 0)
Data = new ByteBuffer(_worldPacket.ReadBytes(size));
}
public ByteBuffer Data;
}
class WardenDataServer : ServerPacket
{
public WardenDataServer() : base(ServerOpcodes.WardenData) { }
public override void Write()
{
_worldPacket.WriteBytes(Data);
}
public ByteBuffer Data;
}
class WardenModuleTransfer : ByteBuffer
{
public byte[] Write()
{
WriteUInt8((byte)Command);
WriteUInt16(DataSize);
WriteBytes(Data, 500);
return GetData();
}
public WardenOpcodes Command;
public ushort DataSize;
public byte[] Data = new byte[500];
}
class WardenModuleUse : ByteBuffer
{
public byte[] Write()
{
WriteUInt8((byte)Command);
WriteBytes(ModuleId, 16);
WriteBytes(ModuleKey, 16);
WriteUInt32(Size);
return GetData();
}
public WardenOpcodes Command;
public byte[] ModuleId = new byte[16];
public byte[] ModuleKey = new byte[16];
public uint Size;
}
class WardenHashRequest : ByteBuffer
{
public byte[] Write()
{
WriteUInt8((byte)Command);
WriteBytes(Seed);
return GetData();
}
public WardenOpcodes Command;
public byte[] Seed = new byte[16];
}
class WardenInitModuleRequest : ByteBuffer
{
public byte[] Write()
{
WriteUInt8((byte)Command1);
WriteUInt16(Size1);
WriteUInt32(CheckSumm1);
WriteUInt8(Unk1);
WriteUInt8(Unk2);
WriteUInt8(Type);
WriteUInt8(String_library1);
foreach (var function in Function1)
WriteUInt32(function);
WriteUInt8((byte)Command2);
WriteUInt16(Size2);
WriteUInt32(CheckSumm2);
WriteUInt8(Unk3);
WriteUInt8(Unk4);
WriteUInt8(String_library2);
WriteUInt32(Function2);
WriteUInt8(Function2_set);
WriteUInt8((byte)Command3);
WriteUInt16(Size3);
WriteUInt32(CheckSumm3);
WriteUInt8(Unk5);
WriteUInt8(Unk6);
WriteUInt8(String_library3);
WriteUInt32(Function3);
WriteUInt8(Function3_set);
return GetData();
}
public WardenOpcodes Command1;
public ushort Size1;
public uint CheckSumm1;
public byte Unk1;
public byte Unk2;
public byte Type;
public byte String_library1;
public uint[] Function1 = new uint[4];
public WardenOpcodes Command2;
public ushort Size2;
public uint CheckSumm2;
public byte Unk3;
public byte Unk4;
public byte String_library2;
public uint Function2;
public byte Function2_set;
public WardenOpcodes Command3;
public ushort Size3;
public uint CheckSumm3;
public byte Unk5;
public byte Unk6;
public byte String_library3;
public uint Function3;
public byte Function3_set;
}
}
@@ -0,0 +1,173 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.Dynamic;
using Game.Entities;
using System;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class WhoIsRequest : ClientPacket
{
public WhoIsRequest(WorldPacket packet) : base(packet) { }
public override void Read()
{
CharName = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(6));
}
public string CharName;
}
public class WhoIsResponse : ServerPacket
{
public WhoIsResponse() : base(ServerOpcodes.WhoIs) { }
public override void Write()
{
_worldPacket.WriteBits(AccountName.GetByteCount(), 11);
_worldPacket.WriteString(AccountName);
}
public string AccountName;
}
public class WhoRequestPkt : ClientPacket
{
public WhoRequestPkt(WorldPacket packet) : base(packet) { }
public override void Read()
{
uint areasCount = _worldPacket.ReadBits<uint>(4);
Request.Read(_worldPacket);
for (int i = 0; i < areasCount; ++i)
Areas.Add(_worldPacket.ReadInt32());
}
public WhoRequest Request = new WhoRequest();
public List<int> Areas= new List<int>();
}
public class WhoResponsePkt : ServerPacket
{
public WhoResponsePkt() : base(ServerOpcodes.Who) { }
public override void Write()
{
_worldPacket.WriteBits(Response.Count, 6);
_worldPacket.FlushBits();
Response.ForEach(p => p.Write(_worldPacket));
}
public List<WhoEntry> Response = new List<WhoEntry>();
}
public struct WhoRequestServerInfo
{
public void Read(WorldPacket data)
{
FactionGroup = data.ReadInt32();
Locale = data.ReadInt32();
RequesterVirtualRealmAddress = data.ReadUInt32();
}
public int FactionGroup;
public int Locale;
public uint RequesterVirtualRealmAddress;
}
public class WhoRequest
{
public void Read(WorldPacket data)
{
MinLevel = data.ReadInt32();
MaxLevel = data.ReadInt32();
RaceFilter = data.ReadInt64();
ClassFilter = data.ReadInt32();
uint nameLength = data.ReadBits<uint>(6);
uint virtualRealmNameLength = data.ReadBits<uint>(9);
uint guildNameLength = data.ReadBits<uint>(7);
uint guildVirtualRealmNameLength = data.ReadBits<uint>(9);
uint wordsCount = data.ReadBits<uint>(3);
ShowEnemies = data.HasBit();
ShowArenaPlayers = data.HasBit();
ExactName = data.HasBit();
ServerInfo.HasValue = data.HasBit();
data.ResetBitPos();
for (int i = 0; i < wordsCount; ++i)
{
Words.Add(data.ReadString(data.ReadBits<uint>(7)));
data.ResetBitPos();
}
Name = data.ReadString(nameLength);
VirtualRealmName = data.ReadString(virtualRealmNameLength);
Guild = data.ReadString(guildNameLength);
GuildVirtualRealmName = data.ReadString(guildVirtualRealmNameLength);
if (ServerInfo.HasValue)
ServerInfo.Value.Read(data);
}
public int MinLevel;
public int MaxLevel;
public string Name;
public string VirtualRealmName;
public string Guild;
public string GuildVirtualRealmName;
public long RaceFilter;
public int ClassFilter = -1;
public List<string> Words = new List<string>();
public bool ShowEnemies;
public bool ShowArenaPlayers;
public bool ExactName;
public Optional<WhoRequestServerInfo> ServerInfo;
}
public class WhoEntry
{
public void Write(WorldPacket data)
{
PlayerData.Write(data);
data.WritePackedGuid(GuildGUID);
data.WriteUInt32(GuildVirtualRealmAddress);
data.WriteInt32(AreaID);
data.WriteBits(GuildName.GetByteCount(), 7);
data.WriteBit(IsGM);
data.WriteString(GuildName);
data.FlushBits();
}
public PlayerGuidLookupData PlayerData = new PlayerGuidLookupData();
public ObjectGuid GuildGUID;
public uint GuildVirtualRealmAddress;
public string GuildName = "";
public int AreaID;
public bool IsGM;
}
}
@@ -0,0 +1,86 @@
/*
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using System.Collections.Generic;
namespace Game.Networking.Packets
{
public class InitWorldStates : ServerPacket
{
public InitWorldStates() : base(ServerOpcodes.InitWorldStates, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(MapID);
_worldPacket.WriteUInt32(AreaID);
_worldPacket.WriteUInt32(SubareaID);
_worldPacket.WriteInt32(Worldstates.Count);
foreach (WorldStateInfo wsi in Worldstates)
{
_worldPacket.WriteUInt32(wsi.VariableID);
_worldPacket.WriteInt32(wsi.Value);
}
}
public void AddState(uint variableID, int value)
{
Worldstates.Add(new WorldStateInfo(variableID, value));
}
public void AddState(uint variableID, bool value)
{
Worldstates.Add(new WorldStateInfo(variableID, value ? 1 : 0));
}
public uint AreaID;
public uint SubareaID;
public uint MapID;
List<WorldStateInfo> Worldstates = new List<WorldStateInfo>();
struct WorldStateInfo
{
public WorldStateInfo(uint variableID, int value)
{
VariableID = variableID;
Value = value;
}
public uint VariableID;
public int Value;
}
}
public class UpdateWorldState : ServerPacket
{
public UpdateWorldState() : base(ServerOpcodes.UpdateWorldState, ConnectionType.Instance) { }
public override void Write()
{
_worldPacket.WriteUInt32(VariableID);
_worldPacket.WriteInt32(Value);
_worldPacket.WriteBit(Hidden);
_worldPacket.FlushBits();
}
public int Value;
public bool Hidden; // @todo: research
public uint VariableID;
}
}