diff --git a/NetClient/Program.cs b/NetClient/Program.cs index bd0871c..43f5936 100644 --- a/NetClient/Program.cs +++ b/NetClient/Program.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using MoreLinq; using OpenEQ.Netcode; using static System.Console; @@ -11,8 +12,14 @@ static string Input(string prompt) { } static void Main(string[] args) { - while(true) { - var loginStream = new LoginStream(args[0], int.Parse(args[1])); + WriteLine("Starting NETClient"); + + var host = GetIndexValueOrDefault(args, 0, "127.0.0.1", (string value) => value); + var port = GetIndexValueOrDefault(args, 1, 5999, (string value) => int.Parse(value)); + WriteLine($"Connecting to LoginServer @ {host}:{port}"); + + while(true) { + var loginStream = new LoginStream(host, port); loginStream.LoginSuccess += (_, success) => { if(success) { WriteLine($"Login succeeded (accountID={loginStream.AccountID}). Requesting server list"); @@ -41,14 +48,26 @@ static void Main(string[] args) { ConnectWorld(loginStream, server.Value); }; - loginStream.Login(Input("Username"), Input("Password")); + var username = Input("Username"); + var password = Input("Password"); + + loginStream.Login(username, password); while(!loginStream.Disconnecting) Task.Delay(100).Wait(); } } - static void ConnectWorld(LoginStream ls, ServerListElement server) { + private static TResult GetIndexValueOrDefault(string[] args, int index, TResult defaultValue, Func parser) + { + if (args.Length <= index) + { + return defaultValue; + } + return parser(args[index]); + } + + static void ConnectWorld(LoginStream ls, ServerListElement server) { WriteLine($"Selected {server}. Connecting."); var worldStream = new WorldStream(server.WorldIP, 9000, ls.AccountID, ls.SessionKey); diff --git a/Netcode/LoginPackets.cs b/Netcode/LoginPackets.cs index 7e02fb7..5f8075d 100644 --- a/Netcode/LoginPackets.cs +++ b/Netcode/LoginPackets.cs @@ -1,572 +1,572 @@ -/* -* o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o -* /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ -* /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ -* o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o -* <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> -* \ | | / \ \o / \ | | \ / \ | | / \ // -* \ / \o/ v\ \o/ \o o/ \o o \o/ / -* o o | | <\ | | | v\ /v v\ <| | | o -* <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> -* -* THIS FILE IS GENERATED BY structgen.py/structs.yml -* DO NOT EDIT -* -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using static OpenEQ.Netcode.Utility; - -namespace OpenEQ.Netcode { - public enum ServerStatus { - Up = 0, - Locked = 4, - Down = 1 - } - internal static class ServerStatus_Helper { - internal static ServerStatus Unpack(this ServerStatus val, BinaryReader br) { - switch(br.ReadUInt32()) { - case 0: case 2: - return ServerStatus.Up; - case 4: - return ServerStatus.Locked; - default: - return ServerStatus.Down; - } - } - } - - public struct ServerListElement : IEQStruct { - public string WorldIP; - public uint ServerListID; - public uint RuntimeID; - public string Longname; - public string Language; - public string Region; - public ServerStatus Status; - public uint PlayersOnline; - - public ServerListElement(string WorldIP, uint ServerListID, uint RuntimeID, string Longname, string Language, string Region, ServerStatus Status, uint PlayersOnline) : this() { - this.WorldIP = WorldIP; - this.ServerListID = ServerListID; - this.RuntimeID = RuntimeID; - this.Longname = Longname; - this.Language = Language; - this.Region = Region; - this.Status = Status; - this.PlayersOnline = PlayersOnline; - } - - public ServerListElement(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ServerListElement(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - WorldIP = br.ReadString(-1); - ServerListID = br.ReadUInt32(); - RuntimeID = br.ReadUInt32(); - Longname = br.ReadString(-1); - Language = br.ReadString(-1); - Region = br.ReadString(-1); - Status = ((ServerStatus) 0).Unpack(br); - PlayersOnline = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(WorldIP.ToBytes()); - bw.Write(ServerListID); - bw.Write(RuntimeID); - bw.Write(Longname.ToBytes()); - bw.Write(Language.ToBytes()); - bw.Write(Region.ToBytes()); - bw.Write((uint) Status); - bw.Write(PlayersOnline); - } - - public override string ToString() { - var ret = "struct ServerListElement {\n"; - ret += "\tWorldIP = "; - try { - ret += $"{ Indentify(WorldIP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tServerListID = "; - try { - ret += $"{ Indentify(ServerListID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRuntimeID = "; - try { - ret += $"{ Indentify(RuntimeID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLongname = "; - try { - ret += $"{ Indentify(Longname) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLanguage = "; - try { - ret += $"{ Indentify(Language) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRegion = "; - try { - ret += $"{ Indentify(Region) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStatus = "; - try { - ret += $"{ Indentify(Status) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPlayersOnline = "; - try { - ret += $"{ Indentify(PlayersOnline) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct LoginReply : IEQStruct { - byte message; - byte unk1; - byte unk2; - byte unk3; - byte unk4; - byte unk5; - byte unk6; - byte unk7; - public uint AcctID; - public string Key; - public uint FailedAttempts; - - public LoginReply(uint AcctID, string Key, uint FailedAttempts) : this() { - this.AcctID = AcctID; - this.Key = Key; - this.FailedAttempts = FailedAttempts; - } - - public LoginReply(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public LoginReply(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - message = br.ReadByte(); - unk1 = br.ReadByte(); - unk2 = br.ReadByte(); - unk3 = br.ReadByte(); - unk4 = br.ReadByte(); - unk5 = br.ReadByte(); - unk6 = br.ReadByte(); - unk7 = br.ReadByte(); - AcctID = br.ReadUInt32(); - Key = br.ReadString(11); - FailedAttempts = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(message); - bw.Write(unk1); - bw.Write(unk2); - bw.Write(unk3); - bw.Write(unk4); - bw.Write(unk5); - bw.Write(unk6); - bw.Write(unk7); - bw.Write(AcctID); - bw.Write(Key.ToBytes(11)); - bw.Write(FailedAttempts); - } - - public override string ToString() { - var ret = "struct LoginReply {\n"; - ret += "\tAcctID = "; - try { - ret += $"{ Indentify(AcctID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tKey = "; - try { - ret += $"{ Indentify(Key) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFailedAttempts = "; - try { - ret += $"{ Indentify(FailedAttempts) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SessionReady : IEQStruct { - uint unk1; - uint unk2; - uint unk3; - - public SessionReady(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SessionReady(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - unk1 = br.ReadUInt32(); - unk2 = br.ReadUInt32(); - unk3 = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(unk1); - bw.Write(unk2); - bw.Write(unk3); - } - - public override string ToString() { - var ret = "struct SessionReady {\n"; - return ret + "}"; - } - } - - public struct ServerListHeader : IEQStruct { - uint unk1; - uint unk2; - uint unk3; - uint unk4; - uint serverCount; - public List Servers; - - public ServerListHeader(List Servers) : this() { - this.Servers = Servers; - } - - public ServerListHeader(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ServerListHeader(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - unk1 = br.ReadUInt32(); - unk2 = br.ReadUInt32(); - unk3 = br.ReadUInt32(); - unk4 = br.ReadUInt32(); - serverCount = br.ReadUInt32(); - Servers = new List(); - for(var i = 0; i < serverCount; ++i) { - Servers.Add(new ServerListElement(br)); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(unk1); - bw.Write(unk2); - bw.Write(unk3); - bw.Write(unk4); - bw.Write(serverCount); - for(var i = 0; i < serverCount; ++i) { - Servers[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct ServerListHeader {\n"; - ret += "\tServers = "; - try { - ret += "{\n"; - for(int i = 0, e = Servers.Count; i < e; ++i) - ret += $"\t\t{ Indentify(Servers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Login : IEQStruct { - ushort unk1; - ushort unk2; - ushort unk3; - ushort unk4; - ushort unk5; - - public Login(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Login(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - unk1 = br.ReadUInt16(); - unk2 = br.ReadUInt16(); - unk3 = br.ReadUInt16(); - unk4 = br.ReadUInt16(); - unk5 = br.ReadUInt16(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(unk1); - bw.Write(unk2); - bw.Write(unk3); - bw.Write(unk4); - bw.Write(unk5); - } - - public override string ToString() { - var ret = "struct Login {\n"; - return ret + "}"; - } - } - - public struct PlayResponse : IEQStruct { - public byte Sequence; - uint unk1; - uint unk2; - byte unk3; - public bool Allowed; - public ushort Message; - ushort unk4; - byte unk5; - public uint ServerRuntimeID; - - public PlayResponse(byte Sequence, bool Allowed, ushort Message, uint ServerRuntimeID) : this() { - this.Sequence = Sequence; - this.Allowed = Allowed; - this.Message = Message; - this.ServerRuntimeID = ServerRuntimeID; - } - - public PlayResponse(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PlayResponse(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Sequence = br.ReadByte(); - unk1 = br.ReadUInt32(); - unk2 = br.ReadUInt32(); - unk3 = br.ReadByte(); - Allowed = br.ReadByte() != 0; - Message = br.ReadUInt16(); - unk4 = br.ReadUInt16(); - unk5 = br.ReadByte(); - ServerRuntimeID = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Sequence); - bw.Write(unk1); - bw.Write(unk2); - bw.Write(unk3); - bw.Write((byte) (Allowed ? 1 : 0)); - bw.Write(Message); - bw.Write(unk4); - bw.Write(unk5); - bw.Write(ServerRuntimeID); - } - - public override string ToString() { - var ret = "struct PlayResponse {\n"; - ret += "\tSequence = "; - try { - ret += $"{ Indentify(Sequence) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAllowed = "; - try { - ret += $"{ Indentify(Allowed) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMessage = "; - try { - ret += $"{ Indentify(Message) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tServerRuntimeID = "; - try { - ret += $"{ Indentify(ServerRuntimeID) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PlayRequest : IEQStruct { - public ushort Sequence; - uint unk1; - uint unk2; - public uint ServerRuntimeID; - - public PlayRequest(ushort Sequence, uint ServerRuntimeID) : this() { - this.Sequence = Sequence; - this.ServerRuntimeID = ServerRuntimeID; - } - - public PlayRequest(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PlayRequest(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Sequence = br.ReadUInt16(); - unk1 = br.ReadUInt32(); - unk2 = br.ReadUInt32(); - ServerRuntimeID = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Sequence); - bw.Write(unk1); - bw.Write(unk2); - bw.Write(ServerRuntimeID); - } - - public override string ToString() { - var ret = "struct PlayRequest {\n"; - ret += "\tSequence = "; - try { - ret += $"{ Indentify(Sequence) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tServerRuntimeID = "; - try { - ret += $"{ Indentify(ServerRuntimeID) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } -} + /* + * o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o + * /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ + * /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ + * o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o + * <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> + * \ | | / \ \o / \ | | \ / \ | | / \ // + * \ / \o/ v\ \o/ \o o/ \o o \o/ / + * o o | | <\ | | | v\ /v v\ <| | | o + * <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> + * + * THIS FILE IS GENERATED BY structgen.py/structs.yml + * DO NOT EDIT + * + */ + +using System; +using System.Collections.Generic; +using System.IO; +using static OpenEQ.Netcode.Utility; + +namespace OpenEQ.Netcode { + public enum ServerStatus { + Up = 0, + Locked = 4, + Down = 1 + } + internal static class ServerStatus_Helper { + internal static ServerStatus Unpack(this ServerStatus val, BinaryReader br) { + switch(br.ReadUInt32()) { + case 0: case 2: + return ServerStatus.Up; + case 4: + return ServerStatus.Locked; + default: + return ServerStatus.Down; + } + } + } + + public struct ServerListElement : IEQStruct { + public string WorldIP; + public uint ServerListID; + public uint RuntimeID; + public string Longname; + public string Language; + public string Region; + public ServerStatus Status; + public uint PlayersOnline; + + public ServerListElement(string WorldIP, uint ServerListID, uint RuntimeID, string Longname, string Language, string Region, ServerStatus Status, uint PlayersOnline) : this() { + this.WorldIP = WorldIP; + this.ServerListID = ServerListID; + this.RuntimeID = RuntimeID; + this.Longname = Longname; + this.Language = Language; + this.Region = Region; + this.Status = Status; + this.PlayersOnline = PlayersOnline; + } + + public ServerListElement(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ServerListElement(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + WorldIP = br.ReadString(-1); + ServerListID = br.ReadUInt32(); + RuntimeID = br.ReadUInt32(); + Longname = br.ReadString(-1); + Language = br.ReadString(-1); + Region = br.ReadString(-1); + Status = ((ServerStatus) 0).Unpack(br); + PlayersOnline = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(WorldIP.ToBytes()); + bw.Write(ServerListID); + bw.Write(RuntimeID); + bw.Write(Longname.ToBytes()); + bw.Write(Language.ToBytes()); + bw.Write(Region.ToBytes()); + bw.Write((uint) Status); + bw.Write(PlayersOnline); + } + + public override string ToString() { + var ret = "struct ServerListElement {\n"; + ret += "\tWorldIP = "; + try { + ret += $"{ Indentify(WorldIP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tServerListID = "; + try { + ret += $"{ Indentify(ServerListID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRuntimeID = "; + try { + ret += $"{ Indentify(RuntimeID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLongname = "; + try { + ret += $"{ Indentify(Longname) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLanguage = "; + try { + ret += $"{ Indentify(Language) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRegion = "; + try { + ret += $"{ Indentify(Region) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStatus = "; + try { + ret += $"{ Indentify(Status) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPlayersOnline = "; + try { + ret += $"{ Indentify(PlayersOnline) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct LoginReply : IEQStruct { + byte message; + byte unk1; + byte unk2; + byte unk3; + byte unk4; + byte unk5; + byte unk6; + byte unk7; + public uint AcctID; + public string Key; + public uint FailedAttempts; + + public LoginReply(uint AcctID, string Key, uint FailedAttempts) : this() { + this.AcctID = AcctID; + this.Key = Key; + this.FailedAttempts = FailedAttempts; + } + + public LoginReply(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public LoginReply(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + message = br.ReadByte(); + unk1 = br.ReadByte(); + unk2 = br.ReadByte(); + unk3 = br.ReadByte(); + unk4 = br.ReadByte(); + unk5 = br.ReadByte(); + unk6 = br.ReadByte(); + unk7 = br.ReadByte(); + AcctID = br.ReadUInt32(); + Key = br.ReadString(11); + FailedAttempts = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(message); + bw.Write(unk1); + bw.Write(unk2); + bw.Write(unk3); + bw.Write(unk4); + bw.Write(unk5); + bw.Write(unk6); + bw.Write(unk7); + bw.Write(AcctID); + bw.Write(Key.ToBytes(11)); + bw.Write(FailedAttempts); + } + + public override string ToString() { + var ret = "struct LoginReply {\n"; + ret += "\tAcctID = "; + try { + ret += $"{ Indentify(AcctID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tKey = "; + try { + ret += $"{ Indentify(Key) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFailedAttempts = "; + try { + ret += $"{ Indentify(FailedAttempts) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SessionReady : IEQStruct { + uint unk1; + uint unk2; + uint unk3; + + public SessionReady(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SessionReady(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + unk1 = br.ReadUInt32(); + unk2 = br.ReadUInt32(); + unk3 = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(unk1); + bw.Write(unk2); + bw.Write(unk3); + } + + public override string ToString() { + var ret = "struct SessionReady {\n"; + return ret + "}"; + } + } + + public struct ServerListHeader : IEQStruct { + uint unk1; + uint unk2; + uint unk3; + uint unk4; + uint serverCount; + public List Servers; + + public ServerListHeader(List Servers) : this() { + this.Servers = Servers; + } + + public ServerListHeader(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ServerListHeader(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + unk1 = br.ReadUInt32(); + unk2 = br.ReadUInt32(); + unk3 = br.ReadUInt32(); + unk4 = br.ReadUInt32(); + serverCount = br.ReadUInt32(); + Servers = new List(); + for(var i = 0; i < serverCount; ++i) { + Servers.Add(new ServerListElement(br)); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(unk1); + bw.Write(unk2); + bw.Write(unk3); + bw.Write(unk4); + bw.Write(serverCount); + for(var i = 0; i < serverCount; ++i) { + Servers[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct ServerListHeader {\n"; + ret += "\tServers = "; + try { + ret += "{\n"; + for(int i = 0, e = Servers.Count; i < e; ++i) + ret += $"\t\t{ Indentify(Servers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Login : IEQStruct { + ushort unk1; + ushort unk2; + ushort unk3; + ushort unk4; + ushort unk5; + + public Login(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Login(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + unk1 = br.ReadUInt16(); + unk2 = br.ReadUInt16(); + unk3 = br.ReadUInt16(); + unk4 = br.ReadUInt16(); + unk5 = br.ReadUInt16(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(unk1); + bw.Write(unk2); + bw.Write(unk3); + bw.Write(unk4); + bw.Write(unk5); + } + + public override string ToString() { + var ret = "struct Login {\n"; + return ret + "}"; + } + } + + public struct PlayResponse : IEQStruct { + public byte Sequence; + uint unk1; + uint unk2; + byte unk3; + public bool Allowed; + public ushort Message; + ushort unk4; + byte unk5; + public uint ServerRuntimeID; + + public PlayResponse(byte Sequence, bool Allowed, ushort Message, uint ServerRuntimeID) : this() { + this.Sequence = Sequence; + this.Allowed = Allowed; + this.Message = Message; + this.ServerRuntimeID = ServerRuntimeID; + } + + public PlayResponse(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PlayResponse(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Sequence = br.ReadByte(); + unk1 = br.ReadUInt32(); + unk2 = br.ReadUInt32(); + unk3 = br.ReadByte(); + Allowed = br.ReadByte() != 0; + Message = br.ReadUInt16(); + unk4 = br.ReadUInt16(); + unk5 = br.ReadByte(); + ServerRuntimeID = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Sequence); + bw.Write(unk1); + bw.Write(unk2); + bw.Write(unk3); + bw.Write((byte) (Allowed ? 1 : 0)); + bw.Write(Message); + bw.Write(unk4); + bw.Write(unk5); + bw.Write(ServerRuntimeID); + } + + public override string ToString() { + var ret = "struct PlayResponse {\n"; + ret += "\tSequence = "; + try { + ret += $"{ Indentify(Sequence) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAllowed = "; + try { + ret += $"{ Indentify(Allowed) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMessage = "; + try { + ret += $"{ Indentify(Message) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tServerRuntimeID = "; + try { + ret += $"{ Indentify(ServerRuntimeID) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PlayRequest : IEQStruct { + public ushort Sequence; + uint unk1; + uint unk2; + public uint ServerRuntimeID; + + public PlayRequest(ushort Sequence, uint ServerRuntimeID) : this() { + this.Sequence = Sequence; + this.ServerRuntimeID = ServerRuntimeID; + } + + public PlayRequest(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PlayRequest(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Sequence = br.ReadUInt16(); + unk1 = br.ReadUInt32(); + unk2 = br.ReadUInt32(); + ServerRuntimeID = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Sequence); + bw.Write(unk1); + bw.Write(unk2); + bw.Write(ServerRuntimeID); + } + + public override string ToString() { + var ret = "struct PlayRequest {\n"; + ret += "\tSequence = "; + try { + ret += $"{ Indentify(Sequence) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tServerRuntimeID = "; + try { + ret += $"{ Indentify(ServerRuntimeID) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } +} diff --git a/Netcode/LoginStream.cs b/Netcode/LoginStream.cs index 389c876..263641d 100644 --- a/Netcode/LoginStream.cs +++ b/Netcode/LoginStream.cs @@ -54,16 +54,20 @@ protected override void HandleAppPacket(AppPacket packet) { Send(AppPacket.Create(LoginOp.Login, new Login(), CryptoBlob)); break; case LoginOp.LoginAccepted: - if(packet.Data.Length < 90) + if(packet.Data.Length < 27) LoginSuccess?.Invoke(this, false); else { var dec = Decrypt(packet.Data, 10); var rep = new LoginReply(dec); - AccountID = rep.AcctID; - SessionKey = rep.Key; - LoginSuccess?.Invoke(this, true); - } - + if (String.IsNullOrWhiteSpace(rep.Key)) + LoginSuccess?.Invoke(this, false); + else + { + AccountID = rep.AcctID; + SessionKey = rep.Key; + LoginSuccess?.Invoke(this, true); + } + } break; case LoginOp.ServerListResponse: var header = packet.Get(); diff --git a/Netcode/WorldPackets.cs b/Netcode/WorldPackets.cs index 04d7cd4..feaf585 100644 --- a/Netcode/WorldPackets.cs +++ b/Netcode/WorldPackets.cs @@ -1,831 +1,831 @@ -/* -* o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o -* /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ -* /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ -* o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o -* <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> -* \ | | / \ \o / \ | | \ / \ | | / \ // -* \ / \o/ v\ \o/ \o o/ \o o \o/ / -* o o | | <\ | | | v\ /v v\ <| | | o -* <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> -* -* THIS FILE IS GENERATED BY structgen.py/structs.yml -* DO NOT EDIT -* -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using static OpenEQ.Netcode.Utility; - -namespace OpenEQ.Netcode { - public struct EnterWorld : IEQStruct { - public string Name; - public bool Tutorial; - public bool GoHome; - - public EnterWorld(string Name, bool Tutorial, bool GoHome) : this() { - this.Name = Name; - this.Tutorial = Tutorial; - this.GoHome = GoHome; - } - - public EnterWorld(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public EnterWorld(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(64); - Tutorial = br.ReadUInt32() != 0; - GoHome = br.ReadUInt32() != 0; - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(64)); - bw.Write((uint) (Tutorial ? 1 : 0)); - bw.Write((uint) (GoHome ? 1 : 0)); - } - - public override string ToString() { - var ret = "struct EnterWorld {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTutorial = "; - try { - ret += $"{ Indentify(Tutorial) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGoHome = "; - try { - ret += $"{ Indentify(GoHome) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct CharacterSelectEntry : IEQStruct { - public byte Level; - public byte HairStyle; - public bool Gender; - public string Name; - public byte Beard; - public byte HairColor; - public byte Face; - byte[] equipment; - public uint PrimaryID; - public uint SecondaryID; - byte unknown15; - public uint Deity; - public ushort Zone; - public ushort Instance; - public bool GoHome; - byte unknown19; - public uint Race; - public bool Tutorial; - public byte Class; - public byte EyeColor1; - public byte BeardColor; - public byte EyeColor2; - public uint DrakkinHeritage; - public uint DrakkinTattoo; - public uint DrakkinDetails; - byte unknown; - - public CharacterSelectEntry(byte Level, byte HairStyle, bool Gender, string Name, byte Beard, byte HairColor, byte Face, uint PrimaryID, uint SecondaryID, uint Deity, ushort Zone, ushort Instance, bool GoHome, uint Race, bool Tutorial, byte Class, byte EyeColor1, byte BeardColor, byte EyeColor2, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails) : this() { - this.Level = Level; - this.HairStyle = HairStyle; - this.Gender = Gender; - this.Name = Name; - this.Beard = Beard; - this.HairColor = HairColor; - this.Face = Face; - this.PrimaryID = PrimaryID; - this.SecondaryID = SecondaryID; - this.Deity = Deity; - this.Zone = Zone; - this.Instance = Instance; - this.GoHome = GoHome; - this.Race = Race; - this.Tutorial = Tutorial; - this.Class = Class; - this.EyeColor1 = EyeColor1; - this.BeardColor = BeardColor; - this.EyeColor2 = EyeColor2; - this.DrakkinHeritage = DrakkinHeritage; - this.DrakkinTattoo = DrakkinTattoo; - this.DrakkinDetails = DrakkinDetails; - } - - public CharacterSelectEntry(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public CharacterSelectEntry(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Level = br.ReadByte(); - HairStyle = br.ReadByte(); - Gender = br.ReadByte() != 0; - Name = br.ReadString(-1); - Beard = br.ReadByte(); - HairColor = br.ReadByte(); - Face = br.ReadByte(); - equipment = new byte[9 * 4 * 4]; - for(var i = 0; i < 9 * 4 * 4; ++i) { - equipment[i] = br.ReadByte(); - } - PrimaryID = br.ReadUInt32(); - SecondaryID = br.ReadUInt32(); - unknown15 = br.ReadByte(); - Deity = br.ReadUInt32(); - Zone = br.ReadUInt16(); - Instance = br.ReadUInt16(); - GoHome = br.ReadByte() != 0; - unknown19 = br.ReadByte(); - Race = br.ReadUInt32(); - Tutorial = br.ReadByte() != 0; - Class = br.ReadByte(); - EyeColor1 = br.ReadByte(); - BeardColor = br.ReadByte(); - EyeColor2 = br.ReadByte(); - DrakkinHeritage = br.ReadUInt32(); - DrakkinTattoo = br.ReadUInt32(); - DrakkinDetails = br.ReadUInt32(); - unknown = br.ReadByte(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Level); - bw.Write(HairStyle); - bw.Write((byte) (Gender ? 1 : 0)); - bw.Write(Name.ToBytes()); - bw.Write(Beard); - bw.Write(HairColor); - bw.Write(Face); - for(var i = 0; i < 9 * 4 * 4; ++i) { - bw.Write(equipment[i]); - } - bw.Write(PrimaryID); - bw.Write(SecondaryID); - bw.Write(unknown15); - bw.Write(Deity); - bw.Write(Zone); - bw.Write(Instance); - bw.Write((byte) (GoHome ? 1 : 0)); - bw.Write(unknown19); - bw.Write(Race); - bw.Write((byte) (Tutorial ? 1 : 0)); - bw.Write(Class); - bw.Write(EyeColor1); - bw.Write(BeardColor); - bw.Write(EyeColor2); - bw.Write(DrakkinHeritage); - bw.Write(DrakkinTattoo); - bw.Write(DrakkinDetails); - bw.Write(unknown); - } - - public override string ToString() { - var ret = "struct CharacterSelectEntry {\n"; - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairStyle = "; - try { - ret += $"{ Indentify(HairStyle) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGender = "; - try { - ret += $"{ Indentify(Gender) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeard = "; - try { - ret += $"{ Indentify(Beard) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairColor = "; - try { - ret += $"{ Indentify(HairColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFace = "; - try { - ret += $"{ Indentify(Face) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPrimaryID = "; - try { - ret += $"{ Indentify(PrimaryID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSecondaryID = "; - try { - ret += $"{ Indentify(SecondaryID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeity = "; - try { - ret += $"{ Indentify(Deity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZone = "; - try { - ret += $"{ Indentify(Zone) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tInstance = "; - try { - ret += $"{ Indentify(Instance) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGoHome = "; - try { - ret += $"{ Indentify(GoHome) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTutorial = "; - try { - ret += $"{ Indentify(Tutorial) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor1 = "; - try { - ret += $"{ Indentify(EyeColor1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeardColor = "; - try { - ret += $"{ Indentify(BeardColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor2 = "; - try { - ret += $"{ Indentify(EyeColor2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinHeritage = "; - try { - ret += $"{ Indentify(DrakkinHeritage) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinTattoo = "; - try { - ret += $"{ Indentify(DrakkinTattoo) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinDetails = "; - try { - ret += $"{ Indentify(DrakkinDetails) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct CharCreate : IEQStruct { - public uint Class_; - public uint Haircolor; - public uint BeardColor; - public uint Beard; - public uint Gender; - public uint Race; - public uint StartZone; - public uint HairStyle; - public uint Deity; - public uint STR; - public uint STA; - public uint AGI; - public uint DEX; - public uint WIS; - public uint INT; - public uint CHA; - public uint Face; - public uint EyeColor1; - public uint EyeColor2; - public uint DrakkinHeritage; - public uint DrakkinTattoo; - public uint DrakkinDetails; - public uint Tutorial; - - public CharCreate(uint Class_, uint Haircolor, uint BeardColor, uint Beard, uint Gender, uint Race, uint StartZone, uint HairStyle, uint Deity, uint STR, uint STA, uint AGI, uint DEX, uint WIS, uint INT, uint CHA, uint Face, uint EyeColor1, uint EyeColor2, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails, uint Tutorial) : this() { - this.Class_ = Class_; - this.Haircolor = Haircolor; - this.BeardColor = BeardColor; - this.Beard = Beard; - this.Gender = Gender; - this.Race = Race; - this.StartZone = StartZone; - this.HairStyle = HairStyle; - this.Deity = Deity; - this.STR = STR; - this.STA = STA; - this.AGI = AGI; - this.DEX = DEX; - this.WIS = WIS; - this.INT = INT; - this.CHA = CHA; - this.Face = Face; - this.EyeColor1 = EyeColor1; - this.EyeColor2 = EyeColor2; - this.DrakkinHeritage = DrakkinHeritage; - this.DrakkinTattoo = DrakkinTattoo; - this.DrakkinDetails = DrakkinDetails; - this.Tutorial = Tutorial; - } - - public CharCreate(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public CharCreate(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Class_ = br.ReadUInt32(); - Haircolor = br.ReadUInt32(); - BeardColor = br.ReadUInt32(); - Beard = br.ReadUInt32(); - Gender = br.ReadUInt32(); - Race = br.ReadUInt32(); - StartZone = br.ReadUInt32(); - HairStyle = br.ReadUInt32(); - Deity = br.ReadUInt32(); - STR = br.ReadUInt32(); - STA = br.ReadUInt32(); - AGI = br.ReadUInt32(); - DEX = br.ReadUInt32(); - WIS = br.ReadUInt32(); - INT = br.ReadUInt32(); - CHA = br.ReadUInt32(); - Face = br.ReadUInt32(); - EyeColor1 = br.ReadUInt32(); - EyeColor2 = br.ReadUInt32(); - DrakkinHeritage = br.ReadUInt32(); - DrakkinTattoo = br.ReadUInt32(); - DrakkinDetails = br.ReadUInt32(); - Tutorial = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Class_); - bw.Write(Haircolor); - bw.Write(BeardColor); - bw.Write(Beard); - bw.Write(Gender); - bw.Write(Race); - bw.Write(StartZone); - bw.Write(HairStyle); - bw.Write(Deity); - bw.Write(STR); - bw.Write(STA); - bw.Write(AGI); - bw.Write(DEX); - bw.Write(WIS); - bw.Write(INT); - bw.Write(CHA); - bw.Write(Face); - bw.Write(EyeColor1); - bw.Write(EyeColor2); - bw.Write(DrakkinHeritage); - bw.Write(DrakkinTattoo); - bw.Write(DrakkinDetails); - bw.Write(Tutorial); - } - - public override string ToString() { - var ret = "struct CharCreate {\n"; - ret += "\tClass_ = "; - try { - ret += $"{ Indentify(Class_) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHaircolor = "; - try { - ret += $"{ Indentify(Haircolor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeardColor = "; - try { - ret += $"{ Indentify(BeardColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeard = "; - try { - ret += $"{ Indentify(Beard) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGender = "; - try { - ret += $"{ Indentify(Gender) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStartZone = "; - try { - ret += $"{ Indentify(StartZone) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairStyle = "; - try { - ret += $"{ Indentify(HairStyle) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeity = "; - try { - ret += $"{ Indentify(Deity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSTR = "; - try { - ret += $"{ Indentify(STR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSTA = "; - try { - ret += $"{ Indentify(STA) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAGI = "; - try { - ret += $"{ Indentify(AGI) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDEX = "; - try { - ret += $"{ Indentify(DEX) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWIS = "; - try { - ret += $"{ Indentify(WIS) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tINT = "; - try { - ret += $"{ Indentify(INT) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCHA = "; - try { - ret += $"{ Indentify(CHA) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFace = "; - try { - ret += $"{ Indentify(Face) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor1 = "; - try { - ret += $"{ Indentify(EyeColor1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor2 = "; - try { - ret += $"{ Indentify(EyeColor2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinHeritage = "; - try { - ret += $"{ Indentify(DrakkinHeritage) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinTattoo = "; - try { - ret += $"{ Indentify(DrakkinTattoo) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinDetails = "; - try { - ret += $"{ Indentify(DrakkinDetails) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTutorial = "; - try { - ret += $"{ Indentify(Tutorial) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct NameApproval : IEQStruct { - public string Name; - public uint Race; - public uint Class; - public uint Unknown; - - public NameApproval(string Name, uint Race, uint Class, uint Unknown) : this() { - this.Name = Name; - this.Race = Race; - this.Class = Class; - this.Unknown = Unknown; - } - - public NameApproval(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public NameApproval(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(64); - Race = br.ReadUInt32(); - Class = br.ReadUInt32(); - Unknown = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(64)); - bw.Write(Race); - bw.Write(Class); - bw.Write(Unknown); - } - - public override string ToString() { - var ret = "struct NameApproval {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tUnknown = "; - try { - ret += $"{ Indentify(Unknown) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct CharacterSelect : IEQStruct { - uint charCount; - uint totalChars; - public List Characters; - - public CharacterSelect(List Characters) : this() { - this.Characters = Characters; - } - - public CharacterSelect(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public CharacterSelect(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - charCount = br.ReadUInt32(); - totalChars = br.ReadUInt32(); - Characters = new List(); - for(var i = 0; i < charCount; ++i) { - Characters.Add(new CharacterSelectEntry(br)); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(charCount); - bw.Write(totalChars); - for(var i = 0; i < charCount; ++i) { - Characters[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct CharacterSelect {\n"; - ret += "\tCharacters = "; - try { - ret += "{\n"; - for(int i = 0, e = Characters.Count; i < e; ++i) - ret += $"\t\t{ Indentify(Characters[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct ZoneServerInfo : IEQStruct { - public string Host; - public ushort Port; - - public ZoneServerInfo(string Host, ushort Port) : this() { - this.Host = Host; - this.Port = Port; - } - - public ZoneServerInfo(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ZoneServerInfo(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Host = br.ReadString(128); - Port = br.ReadUInt16(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Host.ToBytes(128)); - bw.Write(Port); - } - - public override string ToString() { - var ret = "struct ZoneServerInfo {\n"; - ret += "\tHost = "; - try { - ret += $"{ Indentify(Host) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPort = "; - try { - ret += $"{ Indentify(Port) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } -} + /* + * o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o + * /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ + * /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ + * o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o + * <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> + * \ | | / \ \o / \ | | \ / \ | | / \ // + * \ / \o/ v\ \o/ \o o/ \o o \o/ / + * o o | | <\ | | | v\ /v v\ <| | | o + * <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> + * + * THIS FILE IS GENERATED BY structgen.py/structs.yml + * DO NOT EDIT + * + */ + +using System; +using System.Collections.Generic; +using System.IO; +using static OpenEQ.Netcode.Utility; + +namespace OpenEQ.Netcode { + public struct EnterWorld : IEQStruct { + public string Name; + public bool Tutorial; + public bool GoHome; + + public EnterWorld(string Name, bool Tutorial, bool GoHome) : this() { + this.Name = Name; + this.Tutorial = Tutorial; + this.GoHome = GoHome; + } + + public EnterWorld(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public EnterWorld(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(64); + Tutorial = br.ReadUInt32() != 0; + GoHome = br.ReadUInt32() != 0; + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(64)); + bw.Write((uint) (Tutorial ? 1 : 0)); + bw.Write((uint) (GoHome ? 1 : 0)); + } + + public override string ToString() { + var ret = "struct EnterWorld {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTutorial = "; + try { + ret += $"{ Indentify(Tutorial) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGoHome = "; + try { + ret += $"{ Indentify(GoHome) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct CharacterSelectEntry : IEQStruct { + public byte Level; + public byte HairStyle; + public bool Gender; + public string Name; + public byte Beard; + public byte HairColor; + public byte Face; + byte[] equipment; + public uint PrimaryID; + public uint SecondaryID; + byte unknown15; + public uint Deity; + public ushort Zone; + public ushort Instance; + public bool GoHome; + byte unknown19; + public uint Race; + public bool Tutorial; + public byte Class; + public byte EyeColor1; + public byte BeardColor; + public byte EyeColor2; + public uint DrakkinHeritage; + public uint DrakkinTattoo; + public uint DrakkinDetails; + byte unknown; + + public CharacterSelectEntry(byte Level, byte HairStyle, bool Gender, string Name, byte Beard, byte HairColor, byte Face, uint PrimaryID, uint SecondaryID, uint Deity, ushort Zone, ushort Instance, bool GoHome, uint Race, bool Tutorial, byte Class, byte EyeColor1, byte BeardColor, byte EyeColor2, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails) : this() { + this.Level = Level; + this.HairStyle = HairStyle; + this.Gender = Gender; + this.Name = Name; + this.Beard = Beard; + this.HairColor = HairColor; + this.Face = Face; + this.PrimaryID = PrimaryID; + this.SecondaryID = SecondaryID; + this.Deity = Deity; + this.Zone = Zone; + this.Instance = Instance; + this.GoHome = GoHome; + this.Race = Race; + this.Tutorial = Tutorial; + this.Class = Class; + this.EyeColor1 = EyeColor1; + this.BeardColor = BeardColor; + this.EyeColor2 = EyeColor2; + this.DrakkinHeritage = DrakkinHeritage; + this.DrakkinTattoo = DrakkinTattoo; + this.DrakkinDetails = DrakkinDetails; + } + + public CharacterSelectEntry(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public CharacterSelectEntry(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Level = br.ReadByte(); + HairStyle = br.ReadByte(); + Gender = br.ReadByte() != 0; + Name = br.ReadString(-1); + Beard = br.ReadByte(); + HairColor = br.ReadByte(); + Face = br.ReadByte(); + equipment = new byte[9 * 4 * 4]; + for(var i = 0; i < 9 * 4 * 4; ++i) { + equipment[i] = br.ReadByte(); + } + PrimaryID = br.ReadUInt32(); + SecondaryID = br.ReadUInt32(); + unknown15 = br.ReadByte(); + Deity = br.ReadUInt32(); + Zone = br.ReadUInt16(); + Instance = br.ReadUInt16(); + GoHome = br.ReadByte() != 0; + unknown19 = br.ReadByte(); + Race = br.ReadUInt32(); + Tutorial = br.ReadByte() != 0; + Class = br.ReadByte(); + EyeColor1 = br.ReadByte(); + BeardColor = br.ReadByte(); + EyeColor2 = br.ReadByte(); + DrakkinHeritage = br.ReadUInt32(); + DrakkinTattoo = br.ReadUInt32(); + DrakkinDetails = br.ReadUInt32(); + unknown = br.ReadByte(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Level); + bw.Write(HairStyle); + bw.Write((byte) (Gender ? 1 : 0)); + bw.Write(Name.ToBytes()); + bw.Write(Beard); + bw.Write(HairColor); + bw.Write(Face); + for(var i = 0; i < 9 * 4 * 4; ++i) { + bw.Write(equipment[i]); + } + bw.Write(PrimaryID); + bw.Write(SecondaryID); + bw.Write(unknown15); + bw.Write(Deity); + bw.Write(Zone); + bw.Write(Instance); + bw.Write((byte) (GoHome ? 1 : 0)); + bw.Write(unknown19); + bw.Write(Race); + bw.Write((byte) (Tutorial ? 1 : 0)); + bw.Write(Class); + bw.Write(EyeColor1); + bw.Write(BeardColor); + bw.Write(EyeColor2); + bw.Write(DrakkinHeritage); + bw.Write(DrakkinTattoo); + bw.Write(DrakkinDetails); + bw.Write(unknown); + } + + public override string ToString() { + var ret = "struct CharacterSelectEntry {\n"; + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairStyle = "; + try { + ret += $"{ Indentify(HairStyle) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGender = "; + try { + ret += $"{ Indentify(Gender) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeard = "; + try { + ret += $"{ Indentify(Beard) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairColor = "; + try { + ret += $"{ Indentify(HairColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFace = "; + try { + ret += $"{ Indentify(Face) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPrimaryID = "; + try { + ret += $"{ Indentify(PrimaryID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSecondaryID = "; + try { + ret += $"{ Indentify(SecondaryID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeity = "; + try { + ret += $"{ Indentify(Deity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZone = "; + try { + ret += $"{ Indentify(Zone) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tInstance = "; + try { + ret += $"{ Indentify(Instance) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGoHome = "; + try { + ret += $"{ Indentify(GoHome) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTutorial = "; + try { + ret += $"{ Indentify(Tutorial) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor1 = "; + try { + ret += $"{ Indentify(EyeColor1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeardColor = "; + try { + ret += $"{ Indentify(BeardColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor2 = "; + try { + ret += $"{ Indentify(EyeColor2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinHeritage = "; + try { + ret += $"{ Indentify(DrakkinHeritage) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinTattoo = "; + try { + ret += $"{ Indentify(DrakkinTattoo) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinDetails = "; + try { + ret += $"{ Indentify(DrakkinDetails) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct CharCreate : IEQStruct { + public uint Class_; + public uint Haircolor; + public uint BeardColor; + public uint Beard; + public uint Gender; + public uint Race; + public uint StartZone; + public uint HairStyle; + public uint Deity; + public uint STR; + public uint STA; + public uint AGI; + public uint DEX; + public uint WIS; + public uint INT; + public uint CHA; + public uint Face; + public uint EyeColor1; + public uint EyeColor2; + public uint DrakkinHeritage; + public uint DrakkinTattoo; + public uint DrakkinDetails; + public uint Tutorial; + + public CharCreate(uint Class_, uint Haircolor, uint BeardColor, uint Beard, uint Gender, uint Race, uint StartZone, uint HairStyle, uint Deity, uint STR, uint STA, uint AGI, uint DEX, uint WIS, uint INT, uint CHA, uint Face, uint EyeColor1, uint EyeColor2, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails, uint Tutorial) : this() { + this.Class_ = Class_; + this.Haircolor = Haircolor; + this.BeardColor = BeardColor; + this.Beard = Beard; + this.Gender = Gender; + this.Race = Race; + this.StartZone = StartZone; + this.HairStyle = HairStyle; + this.Deity = Deity; + this.STR = STR; + this.STA = STA; + this.AGI = AGI; + this.DEX = DEX; + this.WIS = WIS; + this.INT = INT; + this.CHA = CHA; + this.Face = Face; + this.EyeColor1 = EyeColor1; + this.EyeColor2 = EyeColor2; + this.DrakkinHeritage = DrakkinHeritage; + this.DrakkinTattoo = DrakkinTattoo; + this.DrakkinDetails = DrakkinDetails; + this.Tutorial = Tutorial; + } + + public CharCreate(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public CharCreate(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Class_ = br.ReadUInt32(); + Haircolor = br.ReadUInt32(); + BeardColor = br.ReadUInt32(); + Beard = br.ReadUInt32(); + Gender = br.ReadUInt32(); + Race = br.ReadUInt32(); + StartZone = br.ReadUInt32(); + HairStyle = br.ReadUInt32(); + Deity = br.ReadUInt32(); + STR = br.ReadUInt32(); + STA = br.ReadUInt32(); + AGI = br.ReadUInt32(); + DEX = br.ReadUInt32(); + WIS = br.ReadUInt32(); + INT = br.ReadUInt32(); + CHA = br.ReadUInt32(); + Face = br.ReadUInt32(); + EyeColor1 = br.ReadUInt32(); + EyeColor2 = br.ReadUInt32(); + DrakkinHeritage = br.ReadUInt32(); + DrakkinTattoo = br.ReadUInt32(); + DrakkinDetails = br.ReadUInt32(); + Tutorial = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Class_); + bw.Write(Haircolor); + bw.Write(BeardColor); + bw.Write(Beard); + bw.Write(Gender); + bw.Write(Race); + bw.Write(StartZone); + bw.Write(HairStyle); + bw.Write(Deity); + bw.Write(STR); + bw.Write(STA); + bw.Write(AGI); + bw.Write(DEX); + bw.Write(WIS); + bw.Write(INT); + bw.Write(CHA); + bw.Write(Face); + bw.Write(EyeColor1); + bw.Write(EyeColor2); + bw.Write(DrakkinHeritage); + bw.Write(DrakkinTattoo); + bw.Write(DrakkinDetails); + bw.Write(Tutorial); + } + + public override string ToString() { + var ret = "struct CharCreate {\n"; + ret += "\tClass_ = "; + try { + ret += $"{ Indentify(Class_) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHaircolor = "; + try { + ret += $"{ Indentify(Haircolor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeardColor = "; + try { + ret += $"{ Indentify(BeardColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeard = "; + try { + ret += $"{ Indentify(Beard) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGender = "; + try { + ret += $"{ Indentify(Gender) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStartZone = "; + try { + ret += $"{ Indentify(StartZone) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairStyle = "; + try { + ret += $"{ Indentify(HairStyle) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeity = "; + try { + ret += $"{ Indentify(Deity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSTR = "; + try { + ret += $"{ Indentify(STR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSTA = "; + try { + ret += $"{ Indentify(STA) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAGI = "; + try { + ret += $"{ Indentify(AGI) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDEX = "; + try { + ret += $"{ Indentify(DEX) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWIS = "; + try { + ret += $"{ Indentify(WIS) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tINT = "; + try { + ret += $"{ Indentify(INT) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCHA = "; + try { + ret += $"{ Indentify(CHA) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFace = "; + try { + ret += $"{ Indentify(Face) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor1 = "; + try { + ret += $"{ Indentify(EyeColor1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor2 = "; + try { + ret += $"{ Indentify(EyeColor2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinHeritage = "; + try { + ret += $"{ Indentify(DrakkinHeritage) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinTattoo = "; + try { + ret += $"{ Indentify(DrakkinTattoo) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinDetails = "; + try { + ret += $"{ Indentify(DrakkinDetails) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTutorial = "; + try { + ret += $"{ Indentify(Tutorial) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct NameApproval : IEQStruct { + public string Name; + public uint Race; + public uint Class; + public uint Unknown; + + public NameApproval(string Name, uint Race, uint Class, uint Unknown) : this() { + this.Name = Name; + this.Race = Race; + this.Class = Class; + this.Unknown = Unknown; + } + + public NameApproval(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public NameApproval(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(64); + Race = br.ReadUInt32(); + Class = br.ReadUInt32(); + Unknown = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(64)); + bw.Write(Race); + bw.Write(Class); + bw.Write(Unknown); + } + + public override string ToString() { + var ret = "struct NameApproval {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tUnknown = "; + try { + ret += $"{ Indentify(Unknown) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct CharacterSelect : IEQStruct { + uint charCount; + uint totalChars; + public List Characters; + + public CharacterSelect(List Characters) : this() { + this.Characters = Characters; + } + + public CharacterSelect(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public CharacterSelect(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + charCount = br.ReadUInt32(); + totalChars = br.ReadUInt32(); + Characters = new List(); + for(var i = 0; i < charCount; ++i) { + Characters.Add(new CharacterSelectEntry(br)); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(charCount); + bw.Write(totalChars); + for(var i = 0; i < charCount; ++i) { + Characters[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct CharacterSelect {\n"; + ret += "\tCharacters = "; + try { + ret += "{\n"; + for(int i = 0, e = Characters.Count; i < e; ++i) + ret += $"\t\t{ Indentify(Characters[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct ZoneServerInfo : IEQStruct { + public string Host; + public ushort Port; + + public ZoneServerInfo(string Host, ushort Port) : this() { + this.Host = Host; + this.Port = Port; + } + + public ZoneServerInfo(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ZoneServerInfo(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Host = br.ReadString(128); + Port = br.ReadUInt16(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Host.ToBytes(128)); + bw.Write(Port); + } + + public override string ToString() { + var ret = "struct ZoneServerInfo {\n"; + ret += "\tHost = "; + try { + ret += $"{ Indentify(Host) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPort = "; + try { + ret += $"{ Indentify(Port) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } +} diff --git a/Netcode/WorldStream.cs b/Netcode/WorldStream.cs index 92739ec..c804fee 100644 --- a/Netcode/WorldStream.cs +++ b/Netcode/WorldStream.cs @@ -34,7 +34,7 @@ protected override void HandleSessionResponse(Packet packet) { } protected override void HandleAppPacket(AppPacket packet) { - WriteLine($"Foo? {(WorldOp) packet.Opcode}"); + WriteLine($"WorldStream: {(WorldOp) packet.Opcode}"); switch((WorldOp) packet.Opcode) { case WorldOp.GuildsList: break; diff --git a/Netcode/ZonePackets.cs b/Netcode/ZonePackets.cs index c92c9ff..f02b40e 100644 --- a/Netcode/ZonePackets.cs +++ b/Netcode/ZonePackets.cs @@ -1,7298 +1,7298 @@ -/* -* o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o -* /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ -* /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ -* o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o -* <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> -* \ | | / \ \o / \ | | \ / \ | | / \ // -* \ / \o/ v\ \o/ \o o/ \o o \o/ / -* o o | | <\ | | | v\ /v v\ <| | | o -* <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> -* -* THIS FILE IS GENERATED BY structgen.py/structs.yml -* DO NOT EDIT -* -*/ - -using System; -using System.Collections.Generic; -using System.IO; -using static OpenEQ.Netcode.Utility; - -using static OpenEQ.Netcode.ZoneConstants.Constants; -namespace OpenEQ.Netcode.ZoneConstants { - internal static class Constants { - public const int BUFF_COUNT = 30; - public const int BANDOLIERS_SIZE = 20; - public const int MAX_PP_MEMSPELL = 12; - public const int MAX_PP_SKILL = 100; - public const int SKILLARRAY_SIZE = 100; - public const int MAX_PP_DISCIPLINES = 200; - public const int MAX_PLAYER_TRIBUTES = 5; - public const int MAX_GROUP_MEMBERS = 6; - public const int MAX_PP_AA_ARRAY = 300; - public const int POTIONBELT_SIZE = 5; - public const int MAX_RECAST_TYPES = 20; - public const int MAX_PP_SPELLBOOK = 720; - public const int MAX_PP_LANGUAGE = 25; - public const int BANDOLIER_ITEM_COUNT = 4; - } -} - -namespace OpenEQ.Netcode { - public enum CharType : byte { - PC = 0, - NPC = 1, - PCCorpse = 2, - NPCCorpse = 3 - } - internal static class CharType_Helper { - internal static CharType Unpack(this CharType val, BinaryReader br) { - switch(br.ReadByte()) { - case 0: - return CharType.PC; - case 1: - return CharType.NPC; - case 2: - return CharType.PCCorpse; - default: - return CharType.NPCCorpse; - } - } - } - - public enum WeatherType { - Normal = 0, - Snow = 2, - Rain = 49 - } - internal static class WeatherType_Helper { - internal static WeatherType Unpack(this WeatherType val, BinaryReader br) { - switch(br.ReadUInt32()) { - case 0: - return WeatherType.Normal; - case 2: - return WeatherType.Snow; - default: - return WeatherType.Rain; - } - } - } - - public enum GuildRank : sbyte { - Member = 0, - Officer = 1, - Leader = 2, - None = -1 - } - internal static class GuildRank_Helper { - internal static GuildRank Unpack(this GuildRank val, BinaryReader br) { - switch(br.ReadSByte()) { - case 0: - return GuildRank.Member; - case 1: - return GuildRank.Officer; - case 2: - return GuildRank.Leader; - default: - return GuildRank.None; - } - } - } - - public enum Gender { - Male = 0, - Female = 1, - Monster = 2 - } - internal static class Gender_Helper { - internal static Gender Unpack(this Gender val, BinaryReader br) { - switch(br.ReadUInt32()) { - case 0: - return Gender.Male; - case 1: - return Gender.Female; - default: - return Gender.Monster; - } - } - } - - public enum Race { - Human = 1, - Barbarian = 2, - Erudite = 3, - WoodElf = 4, - HighElf = 5, - DarkElf = 6, - HalfElf = 7, - Dwarf = 8, - Troll = 9, - Ogre = 10, - Halfling = 11, - Gnome = 12, - Iksar = 13, - Vahshir = 14, - Froglok = 15, - Drakkin = 16, - Unknown = 0 - } - internal static class Race_Helper { - internal static Race Unpack(this Race val, BinaryReader br) { - switch(br.ReadUInt32()) { - case 1: - return Race.Human; - case 2: - return Race.Barbarian; - case 3: - return Race.Erudite; - case 4: - return Race.WoodElf; - case 5: - return Race.HighElf; - case 6: - return Race.DarkElf; - case 7: - return Race.HalfElf; - case 8: - return Race.Dwarf; - case 9: - return Race.Troll; - case 10: - return Race.Ogre; - case 11: - return Race.Halfling; - case 12: - return Race.Gnome; - case 13: - return Race.Iksar; - case 14: - return Race.Vahshir; - case 15: - return Race.Froglok; - case 16: - return Race.Drakkin; - default: - return Race.Unknown; - } - } - } - - public enum Roleplay : byte { - NonAnon = 0, - Anon = 1, - Roleplay = 2 - } - internal static class Roleplay_Helper { - internal static Roleplay Unpack(this Roleplay val, BinaryReader br) { - switch(br.ReadByte()) { - case 0: - return Roleplay.NonAnon; - case 1: - return Roleplay.Anon; - default: - return Roleplay.Roleplay; - } - } - } - - public enum AATitle { - None = 0, - General = 1, - Archtype = 2, - ClassAARank = 3 - } - internal static class AATitle_Helper { - internal static AATitle Unpack(this AATitle val, BinaryReader br) { - switch(br.ReadUInt32()) { - case 0: - return AATitle.None; - case 1: - return AATitle.General; - case 2: - return AATitle.Archtype; - default: - return AATitle.ClassAARank; - } - } - } - - public struct ClientUpdatePositionSub1 : IEQStruct { - public short DeltaHeading; - - public ClientUpdatePositionSub1(short DeltaHeading) : this() { - this.DeltaHeading = DeltaHeading; - } - - public ClientUpdatePositionSub1(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ClientUpdatePositionSub1(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - uint _databuf; - _databuf = br.ReadUInt32(); - DeltaHeading = (short) (((int) (_databuf & 0x3FF) ^ 0x200) - 0x200); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - } - - public override string ToString() { - var ret = "bitfield ClientUpdatePositionSub1 {\n"; - ret += "\tDeltaHeading = "; - try { - ret += $"{ Indentify(DeltaHeading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SpawnPosition : IEQStruct { - public short DeltaX; - public short DeltaHeading; - public short DeltaY; - public int Y; - public short Animation; - public ushort Heading; - public int X; - public int Z; - public short DeltaZ; - - public SpawnPosition(short DeltaX, short DeltaHeading, short DeltaY, int Y, short Animation, ushort Heading, int X, int Z, short DeltaZ) : this() { - this.DeltaX = DeltaX; - this.DeltaHeading = DeltaHeading; - this.DeltaY = DeltaY; - this.Y = Y; - this.Animation = Animation; - this.Heading = Heading; - this.X = X; - this.Z = Z; - this.DeltaZ = DeltaZ; - } - - public SpawnPosition(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SpawnPosition(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ulong _databuf; - _databuf = br.ReadUInt64(); - DeltaX = (short) (((int) ((_databuf >> 12) & 0x1FFF) ^ 0x1000) - 0x1000); - DeltaHeading = (short) (((int) ((_databuf >> 32) & 0x3FF) ^ 0x200) - 0x200); - DeltaY = (short) (((int) ((_databuf >> 42) & 0x1FFF) ^ 0x1000) - 0x1000); - _databuf = br.ReadUInt64(); - Y = ((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000; - Animation = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); - Heading = (ushort) ((_databuf >> 32) & 0xFFF); - X = ((int) ((_databuf >> 44) & 0x7FFFF) ^ 0x40000) - 0x40000; - _databuf = br.ReadUInt32(); - Z = ((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000; - DeltaZ = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - } - - public override string ToString() { - var ret = "bitfield SpawnPosition {\n"; - ret += "\tDeltaX = "; - try { - ret += $"{ Indentify(DeltaX) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaHeading = "; - try { - ret += $"{ Indentify(DeltaHeading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaY = "; - try { - ret += $"{ Indentify(DeltaY) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tY = "; - try { - ret += $"{ Indentify(Y) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAnimation = "; - try { - ret += $"{ Indentify(Animation) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tX = "; - try { - ret += $"{ Indentify(X) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZ = "; - try { - ret += $"{ Indentify(Z) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaZ = "; - try { - ret += $"{ Indentify(DeltaZ) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct ClientUpdatePositionSub2 : IEQStruct { - public ushort Animation; - public ushort Heading; - - public ClientUpdatePositionSub2(ushort Animation, ushort Heading) : this() { - this.Animation = Animation; - this.Heading = Heading; - } - - public ClientUpdatePositionSub2(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ClientUpdatePositionSub2(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - uint _databuf; - _databuf = br.ReadUInt32(); - Animation = (ushort) (_databuf & 0x3FF); - Heading = (ushort) ((_databuf >> 10) & 0xFFF); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - } - - public override string ToString() { - var ret = "bitfield ClientUpdatePositionSub2 {\n"; - ret += "\tAnimation = "; - try { - ret += $"{ Indentify(Animation) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SpawnBitfields : IEQStruct { - public bool Pet; - public bool AFK; - public bool Sneak; - public bool LFG; - public bool Invisible; - public bool GM; - public Roleplay Roleplay; - public Gender Gender; - public bool Linkdead; - public bool BetaBuffed; - public bool ShowHelm; - public bool Targetable; - public bool HotkeyTargetable; - public bool ShowName; - public bool Statue; - public bool Trader; - public bool Buyer; - - public SpawnBitfields(bool Pet, bool AFK, bool Sneak, bool LFG, bool Invisible, bool GM, Roleplay Roleplay, Gender Gender, bool Linkdead, bool BetaBuffed, bool ShowHelm, bool Targetable, bool HotkeyTargetable, bool ShowName, bool Statue, bool Trader, bool Buyer) : this() { - this.Pet = Pet; - this.AFK = AFK; - this.Sneak = Sneak; - this.LFG = LFG; - this.Invisible = Invisible; - this.GM = GM; - this.Roleplay = Roleplay; - this.Gender = Gender; - this.Linkdead = Linkdead; - this.BetaBuffed = BetaBuffed; - this.ShowHelm = ShowHelm; - this.Targetable = Targetable; - this.HotkeyTargetable = HotkeyTargetable; - this.ShowName = ShowName; - this.Statue = Statue; - this.Trader = Trader; - this.Buyer = Buyer; - } - - public SpawnBitfields(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SpawnBitfields(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - uint _databuf; - _databuf = br.ReadUInt32(); - Pet = (_databuf & 0x1) != 0; - AFK = ((_databuf >> 1) & 0x1) != 0; - Sneak = ((_databuf >> 2) & 0x1) != 0; - LFG = ((_databuf >> 3) & 0x1) != 0; - Invisible = ((_databuf >> 5) & 0x1) != 0; - GM = ((_databuf >> 17) & 0x1) != 0; - Roleplay = (Roleplay) ((_databuf >> 18) & 0x3); - Gender = (Gender) ((_databuf >> 20) & 0x3); - Linkdead = ((_databuf >> 22) & 0x1) != 0; - BetaBuffed = ((_databuf >> 23) & 0x1) != 0; - ShowHelm = ((_databuf >> 24) & 0x1) != 0; - Targetable = ((_databuf >> 26) & 0x1) != 0; - HotkeyTargetable = ((_databuf >> 27) & 0x1) != 0; - ShowName = ((_databuf >> 28) & 0x1) != 0; - Statue = ((_databuf >> 29) & 0x1) != 0; - Trader = ((_databuf >> 30) & 0x1) != 0; - Buyer = ((_databuf >> 31) & 0x1) != 0; - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - } - - public override string ToString() { - var ret = "bitfield SpawnBitfields {\n"; - ret += "\tPet = "; - try { - ret += $"{ Indentify(Pet) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAFK = "; - try { - ret += $"{ Indentify(AFK) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSneak = "; - try { - ret += $"{ Indentify(Sneak) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLFG = "; - try { - ret += $"{ Indentify(LFG) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tInvisible = "; - try { - ret += $"{ Indentify(Invisible) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGM = "; - try { - ret += $"{ Indentify(GM) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRoleplay = "; - try { - ret += $"{ Indentify(Roleplay) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGender = "; - try { - ret += $"{ Indentify(Gender) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLinkdead = "; - try { - ret += $"{ Indentify(Linkdead) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBetaBuffed = "; - try { - ret += $"{ Indentify(BetaBuffed) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tShowHelm = "; - try { - ret += $"{ Indentify(ShowHelm) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTargetable = "; - try { - ret += $"{ Indentify(Targetable) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHotkeyTargetable = "; - try { - ret += $"{ Indentify(HotkeyTargetable) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tShowName = "; - try { - ret += $"{ Indentify(ShowName) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStatue = "; - try { - ret += $"{ Indentify(Statue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTrader = "; - try { - ret += $"{ Indentify(Trader) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBuyer = "; - try { - ret += $"{ Indentify(Buyer) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct UpdatePosition : IEQStruct { - public short DeltaX; - public short DeltaHeading; - public short DeltaY; - public int Y; - public short Animation; - public ushort Heading; - public int X; - public int Z; - public short DeltaZ; - - public UpdatePosition(short DeltaX, short DeltaHeading, short DeltaY, int Y, short Animation, ushort Heading, int X, int Z, short DeltaZ) : this() { - this.DeltaX = DeltaX; - this.DeltaHeading = DeltaHeading; - this.DeltaY = DeltaY; - this.Y = Y; - this.Animation = Animation; - this.Heading = Heading; - this.X = X; - this.Z = Z; - this.DeltaZ = DeltaZ; - } - - public UpdatePosition(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public UpdatePosition(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ulong _databuf; - _databuf = br.ReadUInt64(); - DeltaX = (short) (((int) ((_databuf >> 12) & 0x1FFF) ^ 0x1000) - 0x1000); - DeltaHeading = (short) (((int) ((_databuf >> 32) & 0x3FF) ^ 0x200) - 0x200); - DeltaY = (short) (((int) ((_databuf >> 42) & 0x1FFF) ^ 0x1000) - 0x1000); - _databuf = br.ReadUInt64(); - Y = ((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000; - Animation = (short) (((int) ((_databuf >> 19) & 0x3FF) ^ 0x200) - 0x200); - Heading = (ushort) ((_databuf >> 32) & 0xFFF); - X = ((int) ((_databuf >> 44) & 0x7FFFF) ^ 0x40000) - 0x40000; - _databuf = br.ReadUInt32(); - Z = ((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000; - DeltaZ = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - } - - public override string ToString() { - var ret = "bitfield UpdatePosition {\n"; - ret += "\tDeltaX = "; - try { - ret += $"{ Indentify(DeltaX) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaHeading = "; - try { - ret += $"{ Indentify(DeltaHeading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaY = "; - try { - ret += $"{ Indentify(DeltaY) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tY = "; - try { - ret += $"{ Indentify(Y) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAnimation = "; - try { - ret += $"{ Indentify(Animation) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tX = "; - try { - ret += $"{ Indentify(X) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZ = "; - try { - ret += $"{ Indentify(Z) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaZ = "; - try { - ret += $"{ Indentify(DeltaZ) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Tint : IEQStruct { - public byte Blue; - public byte Green; - public byte Red; - public byte UseTint; - - public Tint(byte Blue, byte Green, byte Red, byte UseTint) : this() { - this.Blue = Blue; - this.Green = Green; - this.Red = Red; - this.UseTint = UseTint; - } - - public Tint(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Tint(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Blue = br.ReadByte(); - Green = br.ReadByte(); - Red = br.ReadByte(); - UseTint = br.ReadByte(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Blue); - bw.Write(Green); - bw.Write(Red); - bw.Write(UseTint); - } - - public override string ToString() { - var ret = "struct Tint {\n"; - ret += "\tBlue = "; - try { - ret += $"{ Indentify(Blue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGreen = "; - try { - ret += $"{ Indentify(Green) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRed = "; - try { - ret += $"{ Indentify(Red) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tUseTint = "; - try { - ret += $"{ Indentify(UseTint) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PlayerPositionUpdate : IEQStruct { - public ushort ID; - public UpdatePosition Position; - - public PlayerPositionUpdate(ushort ID, UpdatePosition Position) : this() { - this.ID = ID; - this.Position = Position; - } - - public PlayerPositionUpdate(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PlayerPositionUpdate(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ID = br.ReadUInt16(); - Position = new UpdatePosition(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(ID); - Position.Pack(bw); - } - - public override string ToString() { - var ret = "struct PlayerPositionUpdate {\n"; - ret += "\tID = "; - try { - ret += $"{ Indentify(ID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPosition = "; - try { - ret += $"{ Indentify(Position) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct ItemFaction : IEQStruct { - public uint Mod; - public int Amt; - - public ItemFaction(uint Mod, int Amt) : this() { - this.Mod = Mod; - this.Amt = Amt; - } - - public ItemFaction(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ItemFaction(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Mod = br.ReadUInt32(); - Amt = br.ReadInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Mod); - bw.Write(Amt); - } - - public override string ToString() { - var ret = "struct ItemFaction {\n"; - ret += "\tMod = "; - try { - ret += $"{ Indentify(Mod) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAmt = "; - try { - ret += $"{ Indentify(Amt) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Texture : IEQStruct { - public uint Material; - uint unknown1; - public uint EliteMaterial; - - public Texture(uint Material, uint EliteMaterial) : this() { - this.Material = Material; - this.EliteMaterial = EliteMaterial; - } - - public Texture(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Texture(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Material = br.ReadUInt32(); - unknown1 = br.ReadUInt32(); - EliteMaterial = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Material); - bw.Write(unknown1); - bw.Write(EliteMaterial); - } - - public override string ToString() { - var ret = "struct Texture {\n"; - ret += "\tMaterial = "; - try { - ret += $"{ Indentify(Material) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEliteMaterial = "; - try { - ret += $"{ Indentify(EliteMaterial) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct GenEffect : IEQStruct { - public int Effect; - public byte Level2; - public uint Type; - public byte Level; - public int MaxCharges; - public int CastTime; - public uint Recast; - public int RecastType; - public uint Procreate; - public string Name; - - public GenEffect(int Effect, byte Level2, uint Type, byte Level, int MaxCharges, int CastTime, uint Recast, int RecastType, uint Procreate, string Name) : this() { - this.Effect = Effect; - this.Level2 = Level2; - this.Type = Type; - this.Level = Level; - this.MaxCharges = MaxCharges; - this.CastTime = CastTime; - this.Recast = Recast; - this.RecastType = RecastType; - this.Procreate = Procreate; - this.Name = Name; - } - - public GenEffect(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public GenEffect(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Effect = br.ReadInt32(); - Level2 = br.ReadByte(); - Type = br.ReadUInt32(); - Level = br.ReadByte(); - MaxCharges = br.ReadInt32(); - CastTime = br.ReadInt32(); - Recast = br.ReadUInt32(); - RecastType = br.ReadInt32(); - Procreate = br.ReadUInt32(); - Name = br.ReadString(-1); - br.ReadBytes(4); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Effect); - bw.Write(Level2); - bw.Write(Type); - bw.Write(Level); - bw.Write(MaxCharges); - bw.Write(CastTime); - bw.Write(Recast); - bw.Write(RecastType); - bw.Write(Procreate); - bw.Write(Name.ToBytes()); - bw.Write(new byte[4]); - } - - public override string ToString() { - var ret = "struct GenEffect {\n"; - ret += "\tEffect = "; - try { - ret += $"{ Indentify(Effect) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel2 = "; - try { - ret += $"{ Indentify(Level2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tType = "; - try { - ret += $"{ Indentify(Type) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMaxCharges = "; - try { - ret += $"{ Indentify(MaxCharges) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCastTime = "; - try { - ret += $"{ Indentify(CastTime) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRecast = "; - try { - ret += $"{ Indentify(Recast) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRecastType = "; - try { - ret += $"{ Indentify(RecastType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tProcreate = "; - try { - ret += $"{ Indentify(Procreate) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct CompletedTasks : IEQStruct { - uint count; - public List Tasks; - - public CompletedTasks(List Tasks) : this() { - this.Tasks = Tasks; - } - - public CompletedTasks(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public CompletedTasks(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - count = br.ReadUInt32(); - Tasks = new List(); - for(var i = 0; i < count; ++i) { - Tasks.Add(new TaskInfo(br)); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(count); - for(var i = 0; i < count; ++i) { - Tasks[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct CompletedTasks {\n"; - ret += "\tTasks = "; - try { - ret += "{\n"; - for(int i = 0, e = Tasks.Count; i < e; ++i) - ret += $"\t\t{ Indentify(Tasks[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Tribute : IEQStruct { - public uint TributeID; - public uint Tier; - - public Tribute(uint TributeID, uint Tier) : this() { - this.TributeID = TributeID; - this.Tier = Tier; - } - - public Tribute(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Tribute(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - TributeID = br.ReadUInt32(); - Tier = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(TributeID); - bw.Write(Tier); - } - - public override string ToString() { - var ret = "struct Tribute {\n"; - ret += "\tTributeID = "; - try { - ret += $"{ Indentify(TributeID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTier = "; - try { - ret += $"{ Indentify(Tier) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TimeOfDay : IEQStruct { - public byte Hour; - public byte Minute; - public byte Day; - public byte Month; - public uint Year; - - public TimeOfDay(byte Hour, byte Minute, byte Day, byte Month, uint Year) : this() { - this.Hour = Hour; - this.Minute = Minute; - this.Day = Day; - this.Month = Month; - this.Year = Year; - } - - public TimeOfDay(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TimeOfDay(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Hour = br.ReadByte(); - Minute = br.ReadByte(); - Day = br.ReadByte(); - Month = br.ReadByte(); - Year = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Hour); - bw.Write(Minute); - bw.Write(Day); - bw.Write(Month); - bw.Write(Year); - } - - public override string ToString() { - var ret = "struct TimeOfDay {\n"; - ret += "\tHour = "; - try { - ret += $"{ Indentify(Hour) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMinute = "; - try { - ret += $"{ Indentify(Minute) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDay = "; - try { - ret += $"{ Indentify(Day) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMonth = "; - try { - ret += $"{ Indentify(Month) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tYear = "; - try { - ret += $"{ Indentify(Year) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct LdonPoints : IEQStruct { - public int Guk; - public int Mir; - public int Mmc; - public int Ruj; - public int Tak; - public int Available; - - public LdonPoints(int Guk, int Mir, int Mmc, int Ruj, int Tak, int Available) : this() { - this.Guk = Guk; - this.Mir = Mir; - this.Mmc = Mmc; - this.Ruj = Ruj; - this.Tak = Tak; - this.Available = Available; - } - - public LdonPoints(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public LdonPoints(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Guk = br.ReadInt32(); - Mir = br.ReadInt32(); - Mmc = br.ReadInt32(); - Ruj = br.ReadInt32(); - Tak = br.ReadInt32(); - Available = br.ReadInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Guk); - bw.Write(Mir); - bw.Write(Mmc); - bw.Write(Ruj); - bw.Write(Tak); - bw.Write(Available); - } - - public override string ToString() { - var ret = "struct LdonPoints {\n"; - ret += "\tGuk = "; - try { - ret += $"{ Indentify(Guk) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMir = "; - try { - ret += $"{ Indentify(Mir) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMmc = "; - try { - ret += $"{ Indentify(Mmc) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRuj = "; - try { - ret += $"{ Indentify(Ruj) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTak = "; - try { - ret += $"{ Indentify(Tak) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAvailable = "; - try { - ret += $"{ Indentify(Available) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Autoconsent : IEQStruct { - public bool Group; - public bool Raid; - public bool Guild; - - public Autoconsent(bool Group, bool Raid, bool Guild) : this() { - this.Group = Group; - this.Raid = Raid; - this.Guild = Guild; - } - - public Autoconsent(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Autoconsent(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Group = br.ReadByte() != 0; - Raid = br.ReadByte() != 0; - Guild = br.ReadByte() != 0; - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write((byte) (Group ? 1 : 0)); - bw.Write((byte) (Raid ? 1 : 0)); - bw.Write((byte) (Guild ? 1 : 0)); - } - - public override string ToString() { - var ret = "struct Autoconsent {\n"; - ret += "\tGroup = "; - try { - ret += $"{ Indentify(Group) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRaid = "; - try { - ret += $"{ Indentify(Raid) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuild = "; - try { - ret += $"{ Indentify(Guild) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TintProfile : IEQStruct { - public Tint Head; - public Tint Chest; - public Tint Arms; - public Tint Wrist; - public Tint Hands; - public Tint Legs; - public Tint Feet; - public Tint Primary; - public Tint Secondary; - - public TintProfile(Tint Head, Tint Chest, Tint Arms, Tint Wrist, Tint Hands, Tint Legs, Tint Feet, Tint Primary, Tint Secondary) : this() { - this.Head = Head; - this.Chest = Chest; - this.Arms = Arms; - this.Wrist = Wrist; - this.Hands = Hands; - this.Legs = Legs; - this.Feet = Feet; - this.Primary = Primary; - this.Secondary = Secondary; - } - - public TintProfile(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TintProfile(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Head = new Tint(br); - Chest = new Tint(br); - Arms = new Tint(br); - Wrist = new Tint(br); - Hands = new Tint(br); - Legs = new Tint(br); - Feet = new Tint(br); - Primary = new Tint(br); - Secondary = new Tint(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - Head.Pack(bw); - Chest.Pack(bw); - Arms.Pack(bw); - Wrist.Pack(bw); - Hands.Pack(bw); - Legs.Pack(bw); - Feet.Pack(bw); - Primary.Pack(bw); - Secondary.Pack(bw); - } - - public override string ToString() { - var ret = "struct TintProfile {\n"; - ret += "\tHead = "; - try { - ret += $"{ Indentify(Head) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tChest = "; - try { - ret += $"{ Indentify(Chest) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tArms = "; - try { - ret += $"{ Indentify(Arms) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWrist = "; - try { - ret += $"{ Indentify(Wrist) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHands = "; - try { - ret += $"{ Indentify(Hands) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLegs = "; - try { - ret += $"{ Indentify(Legs) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFeet = "; - try { - ret += $"{ Indentify(Feet) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPrimary = "; - try { - ret += $"{ Indentify(Primary) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSecondary = "; - try { - ret += $"{ Indentify(Secondary) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct AAArray : IEQStruct { - public uint AA; - public uint Value; - public uint Charges; - - public AAArray(uint AA, uint Value, uint Charges) : this() { - this.AA = AA; - this.Value = Value; - this.Charges = Charges; - } - - public AAArray(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public AAArray(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - AA = br.ReadUInt32(); - Value = br.ReadUInt32(); - Charges = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(AA); - bw.Write(Value); - bw.Write(Charges); - } - - public override string ToString() { - var ret = "struct AAArray {\n"; - ret += "\tAA = "; - try { - ret += $"{ Indentify(AA) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tValue = "; - try { - ret += $"{ Indentify(Value) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCharges = "; - try { - ret += $"{ Indentify(Charges) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct EvolvingItem : IEQStruct { - public int EvoLevel; - public double Progress; - public bool Activated; - public int EvoMaxLevel; - - public EvolvingItem(int EvoLevel, double Progress, bool Activated, int EvoMaxLevel) : this() { - this.EvoLevel = EvoLevel; - this.Progress = Progress; - this.Activated = Activated; - this.EvoMaxLevel = EvoMaxLevel; - } - - public EvolvingItem(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public EvolvingItem(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - br.ReadBytes(4); - EvoLevel = br.ReadInt32(); - Progress = br.ReadDouble(); - Activated = br.ReadByte() != 0; - EvoMaxLevel = br.ReadInt32(); - br.ReadBytes(4); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(new byte[4]); - bw.Write(EvoLevel); - bw.Write(Progress); - bw.Write((byte) (Activated ? 1 : 0)); - bw.Write(EvoMaxLevel); - bw.Write(new byte[4]); - } - - public override string ToString() { - var ret = "struct EvolvingItem {\n"; - ret += "\tEvoLevel = "; - try { - ret += $"{ Indentify(EvoLevel) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tProgress = "; - try { - ret += $"{ Indentify(Progress) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tActivated = "; - try { - ret += $"{ Indentify(Activated) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEvoMaxLevel = "; - try { - ret += $"{ Indentify(EvoMaxLevel) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Door : IEQStruct { - public string Name; - public float[] Position; - public float Heading; - public uint Incline; - public uint Size; - public byte DoorID; - public byte OpenType; - public byte StateAtSpawn; - public byte InvertState; - public uint Param; - - public Door(string Name, float[] Position, float Heading, uint Incline, uint Size, byte DoorID, byte OpenType, byte StateAtSpawn, byte InvertState, uint Param) : this() { - this.Name = Name; - this.Position = Position; - this.Heading = Heading; - this.Incline = Incline; - this.Size = Size; - this.DoorID = DoorID; - this.OpenType = OpenType; - this.StateAtSpawn = StateAtSpawn; - this.InvertState = InvertState; - this.Param = Param; - } - - public Door(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Door(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(32); - Position = new float[3]; - for(var i = 0; i < 3; ++i) { - Position[i] = br.ReadSingle(); - } - Heading = br.ReadSingle(); - Incline = br.ReadUInt32(); - Size = br.ReadUInt32(); - br.ReadBytes(4); - DoorID = br.ReadByte(); - OpenType = br.ReadByte(); - StateAtSpawn = br.ReadByte(); - InvertState = br.ReadByte(); - Param = br.ReadUInt32(); - br.ReadBytes(24); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(32)); - for(var i = 0; i < 3; ++i) { - bw.Write(Position[i]); - } - bw.Write(Heading); - bw.Write(Incline); - bw.Write(Size); - bw.Write(new byte[4]); - bw.Write(DoorID); - bw.Write(OpenType); - bw.Write(StateAtSpawn); - bw.Write(InvertState); - bw.Write(Param); - bw.Write(new byte[24]); - } - - public override string ToString() { - var ret = "struct Door {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPosition = "; - try { - ret += "{\n"; - for(int i = 0, e = Position.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Position[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIncline = "; - try { - ret += $"{ Indentify(Incline) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSize = "; - try { - ret += $"{ Indentify(Size) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDoorID = "; - try { - ret += $"{ Indentify(DoorID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tOpenType = "; - try { - ret += $"{ Indentify(OpenType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStateAtSpawn = "; - try { - ret += $"{ Indentify(StateAtSpawn) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tInvertState = "; - try { - ret += $"{ Indentify(InvertState) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tParam = "; - try { - ret += $"{ Indentify(Param) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct CharInventory : IEQStruct { - public uint ItemCount; - public SerializedItem[] Items; - - public CharInventory(uint ItemCount, SerializedItem[] Items) : this() { - this.ItemCount = ItemCount; - this.Items = Items; - } - - public CharInventory(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public CharInventory(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ItemCount = br.ReadUInt32(); - Items = new SerializedItem[ItemCount]; - for(var i = 0; i < ItemCount; ++i) { - Items[i] = new SerializedItem(br); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(ItemCount); - for(var i = 0; i < ItemCount; ++i) { - Items[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct CharInventory {\n"; - ret += "\tItemCount = "; - try { - ret += $"{ Indentify(ItemCount) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tItems = "; - try { - ret += "{\n"; - for(int i = 0, e = Items.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Items[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SerializedItem : IEQStruct { - public uint StackSize; - public uint Slot; - public uint Price; - public uint MerchantSlot; - public uint ScaledValue; - public uint InstanceID; - public uint LastCastTime; - public uint Charges; - bool _IsNoDrop; - public bool IsEvolving; - public EvolvingItem Evolution; - public string OrnamentIconFile; - public ushort OrnamentIcon; - public bool IsCopied; - public byte ItemClass; - public string Name; - public string Lore; - public string IDFile; - public uint ID; - public byte Weight; - public bool IsNoRent; - public bool IsNoDrop; - public byte Attune; - public byte Size; - public uint Slots; - public uint Price2; - public uint Icon; - public uint BenefitFlag; - public byte TradeSkills; - public sbyte CR; - public sbyte DR; - public sbyte PR; - public sbyte MR; - public sbyte FR; - public sbyte SVCorruption; - public sbyte AStr; - public sbyte ASta; - public sbyte AAgi; - public sbyte ADex; - public sbyte ACha; - public sbyte AInt; - public sbyte AWis; - public int HP; - public int Mana; - public uint End; - public int AC; - public int Regen; - public int ManaRegen; - public int EndRegen; - public uint Classes; - public uint Races; - public uint Deity; - public int SkillModValue; - public uint SkillModMax; - public uint SkillModType; - public uint BaneDmgRace; - public uint BaneDmgBody; - public uint BaneDmgRaceAmt; - public int BaneDmgAmt; - public byte Magic; - public int CastTime; - public uint ReqLevel; - public uint RecLevel; - public uint RecSkill; - public uint BardType; - public int BardValue; - public byte Light; - public byte Delay; - public byte ElemDmgType; - public byte ElemDmgAmt; - public byte Range; - public uint Damage; - public uint Color; - public byte ItemType; - public uint Material; - public uint EliteMaterial; - public float SellRate; - public int CombatEffects; - public int Shielding; - public int StunResist; - public int StrikeThrough; - public int ExtraDmgSkill; - public int ExtraDmgAmt; - public int SpellShield; - public int Avoidance; - public int Accuracy; - public uint CharmFileID; - public ItemFaction[] Factions; - public string CharmFile; - public uint AugType; - public uint AugRestrict; - public AugSlot[] AugSlots; - public uint LdonPointType; - public uint LdonTheme; - public uint LdonPrice; - public uint LdonSellbackRate; - public uint LdonSold; - public byte BagType; - public byte BagSlots; - public byte BagSize; - public byte WeightReduction; - public byte Book; - public byte BookType; - public string Filename; - public int LoreGroup; - public byte Artifact; - public byte SummonedFlag; - public uint Favor; - public byte FvNoDrop; - public int DotShield; - public int Atk; - public int Haste; - public int DamageShield; - public uint GuildFavor; - public uint AugDistil; - public bool NoPet; - public byte PotionBeltEnabled; - public uint PotionBeltSlots; - public uint StackSize2; - public byte NoTransfer; - public ushort ExpendableArrow; - public GenEffect ClickEffect; - public GenEffect ProcEffect; - public GenEffect[] WornEffects; - public uint ScriptFileID; - public byte QuestItem; - public uint Purity; - public uint BackstabDmg; - public uint DSMitigation; - public int HeroicStr; - public int HeroicInt; - public int HeroicWis; - public int HeroicAgi; - public int HeroicDex; - public int HeroicSta; - public int HeroicCha; - public int HeroicMR; - public int HeroicFR; - public int HeroicCR; - public int HeroicDR; - public int HeroicPR; - public int HeroicSVCorrupt; - public int HealAmt; - public int SpellDmg; - public int Clairvoyance; - public uint EvolveString; - public uint SubItemCount; - public SerializedItem[] SubItems; - - public SerializedItem(uint StackSize, uint Slot, uint Price, uint MerchantSlot, uint ScaledValue, uint InstanceID, uint LastCastTime, uint Charges, bool IsEvolving, EvolvingItem Evolution, string OrnamentIconFile, ushort OrnamentIcon, bool IsCopied, byte ItemClass, string Name, string Lore, string IDFile, uint ID, byte Weight, bool IsNoRent, bool IsNoDrop, byte Attune, byte Size, uint Slots, uint Price2, uint Icon, uint BenefitFlag, byte TradeSkills, sbyte CR, sbyte DR, sbyte PR, sbyte MR, sbyte FR, sbyte SVCorruption, sbyte AStr, sbyte ASta, sbyte AAgi, sbyte ADex, sbyte ACha, sbyte AInt, sbyte AWis, int HP, int Mana, uint End, int AC, int Regen, int ManaRegen, int EndRegen, uint Classes, uint Races, uint Deity, int SkillModValue, uint SkillModMax, uint SkillModType, uint BaneDmgRace, uint BaneDmgBody, uint BaneDmgRaceAmt, int BaneDmgAmt, byte Magic, int CastTime, uint ReqLevel, uint RecLevel, uint RecSkill, uint BardType, int BardValue, byte Light, byte Delay, byte ElemDmgType, byte ElemDmgAmt, byte Range, uint Damage, uint Color, byte ItemType, uint Material, uint EliteMaterial, float SellRate, int CombatEffects, int Shielding, int StunResist, int StrikeThrough, int ExtraDmgSkill, int ExtraDmgAmt, int SpellShield, int Avoidance, int Accuracy, uint CharmFileID, ItemFaction[] Factions, string CharmFile, uint AugType, uint AugRestrict, AugSlot[] AugSlots, uint LdonPointType, uint LdonTheme, uint LdonPrice, uint LdonSellbackRate, uint LdonSold, byte BagType, byte BagSlots, byte BagSize, byte WeightReduction, byte Book, byte BookType, string Filename, int LoreGroup, byte Artifact, byte SummonedFlag, uint Favor, byte FvNoDrop, int DotShield, int Atk, int Haste, int DamageShield, uint GuildFavor, uint AugDistil, bool NoPet, byte PotionBeltEnabled, uint PotionBeltSlots, uint StackSize2, byte NoTransfer, ushort ExpendableArrow, GenEffect ClickEffect, GenEffect ProcEffect, GenEffect[] WornEffects, uint ScriptFileID, byte QuestItem, uint Purity, uint BackstabDmg, uint DSMitigation, int HeroicStr, int HeroicInt, int HeroicWis, int HeroicAgi, int HeroicDex, int HeroicSta, int HeroicCha, int HeroicMR, int HeroicFR, int HeroicCR, int HeroicDR, int HeroicPR, int HeroicSVCorrupt, int HealAmt, int SpellDmg, int Clairvoyance, uint EvolveString, uint SubItemCount, SerializedItem[] SubItems) : this() { - this.StackSize = StackSize; - this.Slot = Slot; - this.Price = Price; - this.MerchantSlot = MerchantSlot; - this.ScaledValue = ScaledValue; - this.InstanceID = InstanceID; - this.LastCastTime = LastCastTime; - this.Charges = Charges; - this.IsEvolving = IsEvolving; - this.Evolution = Evolution; - this.OrnamentIconFile = OrnamentIconFile; - this.OrnamentIcon = OrnamentIcon; - this.IsCopied = IsCopied; - this.ItemClass = ItemClass; - this.Name = Name; - this.Lore = Lore; - this.IDFile = IDFile; - this.ID = ID; - this.Weight = Weight; - this.IsNoRent = IsNoRent; - this.IsNoDrop = IsNoDrop; - this.Attune = Attune; - this.Size = Size; - this.Slots = Slots; - this.Price2 = Price2; - this.Icon = Icon; - this.BenefitFlag = BenefitFlag; - this.TradeSkills = TradeSkills; - this.CR = CR; - this.DR = DR; - this.PR = PR; - this.MR = MR; - this.FR = FR; - this.SVCorruption = SVCorruption; - this.AStr = AStr; - this.ASta = ASta; - this.AAgi = AAgi; - this.ADex = ADex; - this.ACha = ACha; - this.AInt = AInt; - this.AWis = AWis; - this.HP = HP; - this.Mana = Mana; - this.End = End; - this.AC = AC; - this.Regen = Regen; - this.ManaRegen = ManaRegen; - this.EndRegen = EndRegen; - this.Classes = Classes; - this.Races = Races; - this.Deity = Deity; - this.SkillModValue = SkillModValue; - this.SkillModMax = SkillModMax; - this.SkillModType = SkillModType; - this.BaneDmgRace = BaneDmgRace; - this.BaneDmgBody = BaneDmgBody; - this.BaneDmgRaceAmt = BaneDmgRaceAmt; - this.BaneDmgAmt = BaneDmgAmt; - this.Magic = Magic; - this.CastTime = CastTime; - this.ReqLevel = ReqLevel; - this.RecLevel = RecLevel; - this.RecSkill = RecSkill; - this.BardType = BardType; - this.BardValue = BardValue; - this.Light = Light; - this.Delay = Delay; - this.ElemDmgType = ElemDmgType; - this.ElemDmgAmt = ElemDmgAmt; - this.Range = Range; - this.Damage = Damage; - this.Color = Color; - this.ItemType = ItemType; - this.Material = Material; - this.EliteMaterial = EliteMaterial; - this.SellRate = SellRate; - this.CombatEffects = CombatEffects; - this.Shielding = Shielding; - this.StunResist = StunResist; - this.StrikeThrough = StrikeThrough; - this.ExtraDmgSkill = ExtraDmgSkill; - this.ExtraDmgAmt = ExtraDmgAmt; - this.SpellShield = SpellShield; - this.Avoidance = Avoidance; - this.Accuracy = Accuracy; - this.CharmFileID = CharmFileID; - this.Factions = Factions; - this.CharmFile = CharmFile; - this.AugType = AugType; - this.AugRestrict = AugRestrict; - this.AugSlots = AugSlots; - this.LdonPointType = LdonPointType; - this.LdonTheme = LdonTheme; - this.LdonPrice = LdonPrice; - this.LdonSellbackRate = LdonSellbackRate; - this.LdonSold = LdonSold; - this.BagType = BagType; - this.BagSlots = BagSlots; - this.BagSize = BagSize; - this.WeightReduction = WeightReduction; - this.Book = Book; - this.BookType = BookType; - this.Filename = Filename; - this.LoreGroup = LoreGroup; - this.Artifact = Artifact; - this.SummonedFlag = SummonedFlag; - this.Favor = Favor; - this.FvNoDrop = FvNoDrop; - this.DotShield = DotShield; - this.Atk = Atk; - this.Haste = Haste; - this.DamageShield = DamageShield; - this.GuildFavor = GuildFavor; - this.AugDistil = AugDistil; - this.NoPet = NoPet; - this.PotionBeltEnabled = PotionBeltEnabled; - this.PotionBeltSlots = PotionBeltSlots; - this.StackSize2 = StackSize2; - this.NoTransfer = NoTransfer; - this.ExpendableArrow = ExpendableArrow; - this.ClickEffect = ClickEffect; - this.ProcEffect = ProcEffect; - this.WornEffects = WornEffects; - this.ScriptFileID = ScriptFileID; - this.QuestItem = QuestItem; - this.Purity = Purity; - this.BackstabDmg = BackstabDmg; - this.DSMitigation = DSMitigation; - this.HeroicStr = HeroicStr; - this.HeroicInt = HeroicInt; - this.HeroicWis = HeroicWis; - this.HeroicAgi = HeroicAgi; - this.HeroicDex = HeroicDex; - this.HeroicSta = HeroicSta; - this.HeroicCha = HeroicCha; - this.HeroicMR = HeroicMR; - this.HeroicFR = HeroicFR; - this.HeroicCR = HeroicCR; - this.HeroicDR = HeroicDR; - this.HeroicPR = HeroicPR; - this.HeroicSVCorrupt = HeroicSVCorrupt; - this.HealAmt = HealAmt; - this.SpellDmg = SpellDmg; - this.Clairvoyance = Clairvoyance; - this.EvolveString = EvolveString; - this.SubItemCount = SubItemCount; - this.SubItems = SubItems; - } - - public SerializedItem(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SerializedItem(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - StackSize = br.ReadUInt32(); - br.ReadBytes(4); - Slot = br.ReadUInt32(); - Price = br.ReadUInt32(); - MerchantSlot = br.ReadUInt32(); - ScaledValue = br.ReadUInt32(); - InstanceID = br.ReadUInt32(); - br.ReadBytes(4); - LastCastTime = br.ReadUInt32(); - Charges = br.ReadUInt32(); - _IsNoDrop = br.ReadUInt32() != 0; - br.ReadBytes(12); - IsEvolving = br.ReadByte() != 0; - if(IsEvolving) { - Evolution = new EvolvingItem(br); - } - OrnamentIconFile = br.ReadString(-1); - OrnamentIcon = br.ReadUInt16(); - br.ReadBytes(2); - IsCopied = br.ReadByte() != 0; - ItemClass = br.ReadByte(); - Name = br.ReadString(-1); - Lore = br.ReadString(-1); - IDFile = br.ReadString(-1); - ID = br.ReadUInt32(); - Weight = br.ReadByte(); - IsNoRent = br.ReadByte() != 0; - IsNoDrop = br.ReadByte() != 0; - Attune = br.ReadByte(); - Size = br.ReadByte(); - Slots = br.ReadUInt32(); - Price2 = br.ReadUInt32(); - Icon = br.ReadUInt32(); - br.ReadBytes(2); - BenefitFlag = br.ReadUInt32(); - TradeSkills = br.ReadByte(); - CR = br.ReadSByte(); - DR = br.ReadSByte(); - PR = br.ReadSByte(); - MR = br.ReadSByte(); - FR = br.ReadSByte(); - SVCorruption = br.ReadSByte(); - AStr = br.ReadSByte(); - ASta = br.ReadSByte(); - AAgi = br.ReadSByte(); - ADex = br.ReadSByte(); - ACha = br.ReadSByte(); - AInt = br.ReadSByte(); - AWis = br.ReadSByte(); - HP = br.ReadInt32(); - Mana = br.ReadInt32(); - End = br.ReadUInt32(); - AC = br.ReadInt32(); - Regen = br.ReadInt32(); - ManaRegen = br.ReadInt32(); - EndRegen = br.ReadInt32(); - Classes = br.ReadUInt32(); - Races = br.ReadUInt32(); - Deity = br.ReadUInt32(); - SkillModValue = br.ReadInt32(); - SkillModMax = br.ReadUInt32(); - SkillModType = br.ReadUInt32(); - BaneDmgRace = br.ReadUInt32(); - BaneDmgBody = br.ReadUInt32(); - BaneDmgRaceAmt = br.ReadUInt32(); - BaneDmgAmt = br.ReadInt32(); - Magic = br.ReadByte(); - CastTime = br.ReadInt32(); - ReqLevel = br.ReadUInt32(); - RecLevel = br.ReadUInt32(); - RecSkill = br.ReadUInt32(); - BardType = br.ReadUInt32(); - BardValue = br.ReadInt32(); - Light = br.ReadByte(); - Delay = br.ReadByte(); - ElemDmgType = br.ReadByte(); - ElemDmgAmt = br.ReadByte(); - Range = br.ReadByte(); - Damage = br.ReadUInt32(); - Color = br.ReadUInt32(); - ItemType = br.ReadByte(); - Material = br.ReadUInt32(); - br.ReadBytes(4); - EliteMaterial = br.ReadUInt32(); - SellRate = br.ReadSingle(); - CombatEffects = br.ReadInt32(); - Shielding = br.ReadInt32(); - StunResist = br.ReadInt32(); - StrikeThrough = br.ReadInt32(); - ExtraDmgSkill = br.ReadInt32(); - ExtraDmgAmt = br.ReadInt32(); - SpellShield = br.ReadInt32(); - Avoidance = br.ReadInt32(); - Accuracy = br.ReadInt32(); - CharmFileID = br.ReadUInt32(); - Factions = new ItemFaction[4]; - for(var i = 0; i < 4; ++i) { - Factions[i] = new ItemFaction(br); - } - CharmFile = br.ReadString(-1); - AugType = br.ReadUInt32(); - AugRestrict = br.ReadUInt32(); - AugSlots = new AugSlot[5]; - for(var i = 0; i < 5; ++i) { - AugSlots[i] = new AugSlot(br); - } - LdonPointType = br.ReadUInt32(); - LdonTheme = br.ReadUInt32(); - LdonPrice = br.ReadUInt32(); - LdonSellbackRate = br.ReadUInt32(); - LdonSold = br.ReadUInt32(); - BagType = br.ReadByte(); - BagSlots = br.ReadByte(); - BagSize = br.ReadByte(); - WeightReduction = br.ReadByte(); - Book = br.ReadByte(); - BookType = br.ReadByte(); - Filename = br.ReadString(-1); - LoreGroup = br.ReadInt32(); - Artifact = br.ReadByte(); - SummonedFlag = br.ReadByte(); - Favor = br.ReadUInt32(); - FvNoDrop = br.ReadByte(); - DotShield = br.ReadInt32(); - Atk = br.ReadInt32(); - Haste = br.ReadInt32(); - DamageShield = br.ReadInt32(); - GuildFavor = br.ReadUInt32(); - AugDistil = br.ReadUInt32(); - br.ReadBytes(8); - NoPet = br.ReadByte() != 0; - br.ReadBytes(1); - PotionBeltEnabled = br.ReadByte(); - PotionBeltSlots = br.ReadUInt32(); - StackSize2 = br.ReadUInt32(); - NoTransfer = br.ReadByte(); - ExpendableArrow = br.ReadUInt16(); - br.ReadBytes(4*4+3); - ClickEffect = new GenEffect(br); - ProcEffect = new GenEffect(br); - WornEffects = new GenEffect[4]; - for(var i = 0; i < 4; ++i) { - WornEffects[i] = new GenEffect(br); - } - ScriptFileID = br.ReadUInt32(); - QuestItem = br.ReadByte(); - br.ReadBytes(4); - Purity = br.ReadUInt32(); - BackstabDmg = br.ReadUInt32(); - DSMitigation = br.ReadUInt32(); - HeroicStr = br.ReadInt32(); - HeroicInt = br.ReadInt32(); - HeroicWis = br.ReadInt32(); - HeroicAgi = br.ReadInt32(); - HeroicDex = br.ReadInt32(); - HeroicSta = br.ReadInt32(); - HeroicCha = br.ReadInt32(); - HeroicMR = br.ReadInt32(); - HeroicFR = br.ReadInt32(); - HeroicCR = br.ReadInt32(); - HeroicDR = br.ReadInt32(); - HeroicPR = br.ReadInt32(); - HeroicSVCorrupt = br.ReadInt32(); - HealAmt = br.ReadInt32(); - SpellDmg = br.ReadInt32(); - Clairvoyance = br.ReadInt32(); - br.ReadBytes(1); - EvolveString = br.ReadUInt32(); - br.ReadBytes(1+4*3); - SubItemCount = br.ReadUInt32(); - SubItems = new SerializedItem[SubItemCount]; - for(var i = 0; i < SubItemCount; ++i) { - SubItems[i] = new SerializedItem(br); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(StackSize); - bw.Write(new byte[4]); - bw.Write(Slot); - bw.Write(Price); - bw.Write(MerchantSlot); - bw.Write(ScaledValue); - bw.Write(InstanceID); - bw.Write(new byte[4]); - bw.Write(LastCastTime); - bw.Write(Charges); - bw.Write((uint) (_IsNoDrop ? 1 : 0)); - bw.Write(new byte[12]); - bw.Write((byte) (IsEvolving ? 1 : 0)); - if(IsEvolving) { - Evolution.Pack(bw); - } - bw.Write(OrnamentIconFile.ToBytes()); - bw.Write(OrnamentIcon); - bw.Write(new byte[2]); - bw.Write((byte) (IsCopied ? 1 : 0)); - bw.Write(ItemClass); - bw.Write(Name.ToBytes()); - bw.Write(Lore.ToBytes()); - bw.Write(IDFile.ToBytes()); - bw.Write(ID); - bw.Write(Weight); - bw.Write((byte) (IsNoRent ? 1 : 0)); - bw.Write((byte) (IsNoDrop ? 1 : 0)); - bw.Write(Attune); - bw.Write(Size); - bw.Write(Slots); - bw.Write(Price2); - bw.Write(Icon); - bw.Write(new byte[2]); - bw.Write(BenefitFlag); - bw.Write(TradeSkills); - bw.Write(CR); - bw.Write(DR); - bw.Write(PR); - bw.Write(MR); - bw.Write(FR); - bw.Write(SVCorruption); - bw.Write(AStr); - bw.Write(ASta); - bw.Write(AAgi); - bw.Write(ADex); - bw.Write(ACha); - bw.Write(AInt); - bw.Write(AWis); - bw.Write(HP); - bw.Write(Mana); - bw.Write(End); - bw.Write(AC); - bw.Write(Regen); - bw.Write(ManaRegen); - bw.Write(EndRegen); - bw.Write(Classes); - bw.Write(Races); - bw.Write(Deity); - bw.Write(SkillModValue); - bw.Write(SkillModMax); - bw.Write(SkillModType); - bw.Write(BaneDmgRace); - bw.Write(BaneDmgBody); - bw.Write(BaneDmgRaceAmt); - bw.Write(BaneDmgAmt); - bw.Write(Magic); - bw.Write(CastTime); - bw.Write(ReqLevel); - bw.Write(RecLevel); - bw.Write(RecSkill); - bw.Write(BardType); - bw.Write(BardValue); - bw.Write(Light); - bw.Write(Delay); - bw.Write(ElemDmgType); - bw.Write(ElemDmgAmt); - bw.Write(Range); - bw.Write(Damage); - bw.Write(Color); - bw.Write(ItemType); - bw.Write(Material); - bw.Write(new byte[4]); - bw.Write(EliteMaterial); - bw.Write(SellRate); - bw.Write(CombatEffects); - bw.Write(Shielding); - bw.Write(StunResist); - bw.Write(StrikeThrough); - bw.Write(ExtraDmgSkill); - bw.Write(ExtraDmgAmt); - bw.Write(SpellShield); - bw.Write(Avoidance); - bw.Write(Accuracy); - bw.Write(CharmFileID); - for(var i = 0; i < 4; ++i) { - Factions[i].Pack(bw); - } - bw.Write(CharmFile.ToBytes()); - bw.Write(AugType); - bw.Write(AugRestrict); - for(var i = 0; i < 5; ++i) { - AugSlots[i].Pack(bw); - } - bw.Write(LdonPointType); - bw.Write(LdonTheme); - bw.Write(LdonPrice); - bw.Write(LdonSellbackRate); - bw.Write(LdonSold); - bw.Write(BagType); - bw.Write(BagSlots); - bw.Write(BagSize); - bw.Write(WeightReduction); - bw.Write(Book); - bw.Write(BookType); - bw.Write(Filename.ToBytes()); - bw.Write(LoreGroup); - bw.Write(Artifact); - bw.Write(SummonedFlag); - bw.Write(Favor); - bw.Write(FvNoDrop); - bw.Write(DotShield); - bw.Write(Atk); - bw.Write(Haste); - bw.Write(DamageShield); - bw.Write(GuildFavor); - bw.Write(AugDistil); - bw.Write(new byte[8]); - bw.Write((byte) (NoPet ? 1 : 0)); - bw.Write(new byte[1]); - bw.Write(PotionBeltEnabled); - bw.Write(PotionBeltSlots); - bw.Write(StackSize2); - bw.Write(NoTransfer); - bw.Write(ExpendableArrow); - bw.Write(new byte[4*4+3]); - ClickEffect.Pack(bw); - ProcEffect.Pack(bw); - for(var i = 0; i < 4; ++i) { - WornEffects[i].Pack(bw); - } - bw.Write(ScriptFileID); - bw.Write(QuestItem); - bw.Write(new byte[4]); - bw.Write(Purity); - bw.Write(BackstabDmg); - bw.Write(DSMitigation); - bw.Write(HeroicStr); - bw.Write(HeroicInt); - bw.Write(HeroicWis); - bw.Write(HeroicAgi); - bw.Write(HeroicDex); - bw.Write(HeroicSta); - bw.Write(HeroicCha); - bw.Write(HeroicMR); - bw.Write(HeroicFR); - bw.Write(HeroicCR); - bw.Write(HeroicDR); - bw.Write(HeroicPR); - bw.Write(HeroicSVCorrupt); - bw.Write(HealAmt); - bw.Write(SpellDmg); - bw.Write(Clairvoyance); - bw.Write(new byte[1]); - bw.Write(EvolveString); - bw.Write(new byte[1+4*3]); - bw.Write(SubItemCount); - for(var i = 0; i < SubItemCount; ++i) { - SubItems[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct SerializedItem {\n"; - ret += "\tStackSize = "; - try { - ret += $"{ Indentify(StackSize) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSlot = "; - try { - ret += $"{ Indentify(Slot) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPrice = "; - try { - ret += $"{ Indentify(Price) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMerchantSlot = "; - try { - ret += $"{ Indentify(MerchantSlot) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tScaledValue = "; - try { - ret += $"{ Indentify(ScaledValue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tInstanceID = "; - try { - ret += $"{ Indentify(InstanceID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastCastTime = "; - try { - ret += $"{ Indentify(LastCastTime) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCharges = "; - try { - ret += $"{ Indentify(Charges) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIsEvolving = "; - try { - ret += $"{ Indentify(IsEvolving) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - if(IsEvolving) { - ret += "\tEvolution = "; - try { - ret += $"{ Indentify(Evolution) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - ret += "\tOrnamentIconFile = "; - try { - ret += $"{ Indentify(OrnamentIconFile) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tOrnamentIcon = "; - try { - ret += $"{ Indentify(OrnamentIcon) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIsCopied = "; - try { - ret += $"{ Indentify(IsCopied) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tItemClass = "; - try { - ret += $"{ Indentify(ItemClass) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLore = "; - try { - ret += $"{ Indentify(Lore) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIDFile = "; - try { - ret += $"{ Indentify(IDFile) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tID = "; - try { - ret += $"{ Indentify(ID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWeight = "; - try { - ret += $"{ Indentify(Weight) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIsNoRent = "; - try { - ret += $"{ Indentify(IsNoRent) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIsNoDrop = "; - try { - ret += $"{ Indentify(IsNoDrop) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAttune = "; - try { - ret += $"{ Indentify(Attune) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSize = "; - try { - ret += $"{ Indentify(Size) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSlots = "; - try { - ret += $"{ Indentify(Slots) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPrice2 = "; - try { - ret += $"{ Indentify(Price2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIcon = "; - try { - ret += $"{ Indentify(Icon) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBenefitFlag = "; - try { - ret += $"{ Indentify(BenefitFlag) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTradeSkills = "; - try { - ret += $"{ Indentify(TradeSkills) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCR = "; - try { - ret += $"{ Indentify(CR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDR = "; - try { - ret += $"{ Indentify(DR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPR = "; - try { - ret += $"{ Indentify(PR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMR = "; - try { - ret += $"{ Indentify(MR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFR = "; - try { - ret += $"{ Indentify(FR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSVCorruption = "; - try { - ret += $"{ Indentify(SVCorruption) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAStr = "; - try { - ret += $"{ Indentify(AStr) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tASta = "; - try { - ret += $"{ Indentify(ASta) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAAgi = "; - try { - ret += $"{ Indentify(AAgi) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tADex = "; - try { - ret += $"{ Indentify(ADex) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tACha = "; - try { - ret += $"{ Indentify(ACha) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAInt = "; - try { - ret += $"{ Indentify(AInt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAWis = "; - try { - ret += $"{ Indentify(AWis) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHP = "; - try { - ret += $"{ Indentify(HP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMana = "; - try { - ret += $"{ Indentify(Mana) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEnd = "; - try { - ret += $"{ Indentify(End) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAC = "; - try { - ret += $"{ Indentify(AC) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRegen = "; - try { - ret += $"{ Indentify(Regen) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tManaRegen = "; - try { - ret += $"{ Indentify(ManaRegen) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEndRegen = "; - try { - ret += $"{ Indentify(EndRegen) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClasses = "; - try { - ret += $"{ Indentify(Classes) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRaces = "; - try { - ret += $"{ Indentify(Races) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeity = "; - try { - ret += $"{ Indentify(Deity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSkillModValue = "; - try { - ret += $"{ Indentify(SkillModValue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSkillModMax = "; - try { - ret += $"{ Indentify(SkillModMax) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSkillModType = "; - try { - ret += $"{ Indentify(SkillModType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBaneDmgRace = "; - try { - ret += $"{ Indentify(BaneDmgRace) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBaneDmgBody = "; - try { - ret += $"{ Indentify(BaneDmgBody) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBaneDmgRaceAmt = "; - try { - ret += $"{ Indentify(BaneDmgRaceAmt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBaneDmgAmt = "; - try { - ret += $"{ Indentify(BaneDmgAmt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMagic = "; - try { - ret += $"{ Indentify(Magic) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCastTime = "; - try { - ret += $"{ Indentify(CastTime) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tReqLevel = "; - try { - ret += $"{ Indentify(ReqLevel) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRecLevel = "; - try { - ret += $"{ Indentify(RecLevel) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRecSkill = "; - try { - ret += $"{ Indentify(RecSkill) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBardType = "; - try { - ret += $"{ Indentify(BardType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBardValue = "; - try { - ret += $"{ Indentify(BardValue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLight = "; - try { - ret += $"{ Indentify(Light) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDelay = "; - try { - ret += $"{ Indentify(Delay) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tElemDmgType = "; - try { - ret += $"{ Indentify(ElemDmgType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tElemDmgAmt = "; - try { - ret += $"{ Indentify(ElemDmgAmt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRange = "; - try { - ret += $"{ Indentify(Range) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDamage = "; - try { - ret += $"{ Indentify(Damage) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tColor = "; - try { - ret += $"{ Indentify(Color) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tItemType = "; - try { - ret += $"{ Indentify(ItemType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMaterial = "; - try { - ret += $"{ Indentify(Material) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEliteMaterial = "; - try { - ret += $"{ Indentify(EliteMaterial) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSellRate = "; - try { - ret += $"{ Indentify(SellRate) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCombatEffects = "; - try { - ret += $"{ Indentify(CombatEffects) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tShielding = "; - try { - ret += $"{ Indentify(Shielding) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStunResist = "; - try { - ret += $"{ Indentify(StunResist) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStrikeThrough = "; - try { - ret += $"{ Indentify(StrikeThrough) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tExtraDmgSkill = "; - try { - ret += $"{ Indentify(ExtraDmgSkill) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tExtraDmgAmt = "; - try { - ret += $"{ Indentify(ExtraDmgAmt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpellShield = "; - try { - ret += $"{ Indentify(SpellShield) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAvoidance = "; - try { - ret += $"{ Indentify(Avoidance) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAccuracy = "; - try { - ret += $"{ Indentify(Accuracy) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCharmFileID = "; - try { - ret += $"{ Indentify(CharmFileID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFactions = "; - try { - ret += "{\n"; - for(int i = 0, e = Factions.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Factions[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCharmFile = "; - try { - ret += $"{ Indentify(CharmFile) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAugType = "; - try { - ret += $"{ Indentify(AugType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAugRestrict = "; - try { - ret += $"{ Indentify(AugRestrict) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAugSlots = "; - try { - ret += "{\n"; - for(int i = 0, e = AugSlots.Length; i < e; ++i) - ret += $"\t\t{ Indentify(AugSlots[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonPointType = "; - try { - ret += $"{ Indentify(LdonPointType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonTheme = "; - try { - ret += $"{ Indentify(LdonTheme) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonPrice = "; - try { - ret += $"{ Indentify(LdonPrice) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonSellbackRate = "; - try { - ret += $"{ Indentify(LdonSellbackRate) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonSold = "; - try { - ret += $"{ Indentify(LdonSold) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBagType = "; - try { - ret += $"{ Indentify(BagType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBagSlots = "; - try { - ret += $"{ Indentify(BagSlots) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBagSize = "; - try { - ret += $"{ Indentify(BagSize) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWeightReduction = "; - try { - ret += $"{ Indentify(WeightReduction) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBook = "; - try { - ret += $"{ Indentify(Book) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBookType = "; - try { - ret += $"{ Indentify(BookType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFilename = "; - try { - ret += $"{ Indentify(Filename) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLoreGroup = "; - try { - ret += $"{ Indentify(LoreGroup) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tArtifact = "; - try { - ret += $"{ Indentify(Artifact) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSummonedFlag = "; - try { - ret += $"{ Indentify(SummonedFlag) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFavor = "; - try { - ret += $"{ Indentify(Favor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFvNoDrop = "; - try { - ret += $"{ Indentify(FvNoDrop) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDotShield = "; - try { - ret += $"{ Indentify(DotShield) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAtk = "; - try { - ret += $"{ Indentify(Atk) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHaste = "; - try { - ret += $"{ Indentify(Haste) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDamageShield = "; - try { - ret += $"{ Indentify(DamageShield) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildFavor = "; - try { - ret += $"{ Indentify(GuildFavor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAugDistil = "; - try { - ret += $"{ Indentify(AugDistil) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tNoPet = "; - try { - ret += $"{ Indentify(NoPet) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPotionBeltEnabled = "; - try { - ret += $"{ Indentify(PotionBeltEnabled) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPotionBeltSlots = "; - try { - ret += $"{ Indentify(PotionBeltSlots) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStackSize2 = "; - try { - ret += $"{ Indentify(StackSize2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tNoTransfer = "; - try { - ret += $"{ Indentify(NoTransfer) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tExpendableArrow = "; - try { - ret += $"{ Indentify(ExpendableArrow) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClickEffect = "; - try { - ret += $"{ Indentify(ClickEffect) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tProcEffect = "; - try { - ret += $"{ Indentify(ProcEffect) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWornEffects = "; - try { - ret += "{\n"; - for(int i = 0, e = WornEffects.Length; i < e; ++i) - ret += $"\t\t{ Indentify(WornEffects[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tScriptFileID = "; - try { - ret += $"{ Indentify(ScriptFileID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tQuestItem = "; - try { - ret += $"{ Indentify(QuestItem) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPurity = "; - try { - ret += $"{ Indentify(Purity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBackstabDmg = "; - try { - ret += $"{ Indentify(BackstabDmg) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDSMitigation = "; - try { - ret += $"{ Indentify(DSMitigation) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicStr = "; - try { - ret += $"{ Indentify(HeroicStr) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicInt = "; - try { - ret += $"{ Indentify(HeroicInt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicWis = "; - try { - ret += $"{ Indentify(HeroicWis) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicAgi = "; - try { - ret += $"{ Indentify(HeroicAgi) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicDex = "; - try { - ret += $"{ Indentify(HeroicDex) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicSta = "; - try { - ret += $"{ Indentify(HeroicSta) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicCha = "; - try { - ret += $"{ Indentify(HeroicCha) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicMR = "; - try { - ret += $"{ Indentify(HeroicMR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicFR = "; - try { - ret += $"{ Indentify(HeroicFR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicCR = "; - try { - ret += $"{ Indentify(HeroicCR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicDR = "; - try { - ret += $"{ Indentify(HeroicDR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicPR = "; - try { - ret += $"{ Indentify(HeroicPR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeroicSVCorrupt = "; - try { - ret += $"{ Indentify(HeroicSVCorrupt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHealAmt = "; - try { - ret += $"{ Indentify(HealAmt) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpellDmg = "; - try { - ret += $"{ Indentify(SpellDmg) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClairvoyance = "; - try { - ret += $"{ Indentify(Clairvoyance) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEvolveString = "; - try { - ret += $"{ Indentify(EvolveString) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSubItemCount = "; - try { - ret += $"{ Indentify(SubItemCount) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSubItems = "; - try { - ret += "{\n"; - for(int i = 0, e = SubItems.Length; i < e; ++i) - ret += $"\t\t{ Indentify(SubItems[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Bandolier : IEQStruct { - public string Name; - public PotionBandolierItem[] Items; - - public Bandolier(string Name, PotionBandolierItem[] Items) : this() { - this.Name = Name; - this.Items = Items; - } - - public Bandolier(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Bandolier(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(32); - Items = new PotionBandolierItem[BANDOLIER_ITEM_COUNT]; - for(var i = 0; i < BANDOLIER_ITEM_COUNT; ++i) { - Items[i] = new PotionBandolierItem(br); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(32)); - for(var i = 0; i < BANDOLIER_ITEM_COUNT; ++i) { - Items[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct Bandolier {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tItems = "; - try { - ret += "{\n"; - for(int i = 0, e = Items.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Items[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct GroupMember : IEQStruct { - public string Name; - - public GroupMember(string Name) : this() { - this.Name = Name; - } - - public GroupMember(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public GroupMember(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(64); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(64)); - } - - public override string ToString() { - var ret = "struct GroupMember {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct LeadershipAA : IEQStruct { - public SubLeadershipAA Group; - public SubLeadershipAA Raid; - - public LeadershipAA(SubLeadershipAA Group, SubLeadershipAA Raid) : this() { - this.Group = Group; - this.Raid = Raid; - } - - public LeadershipAA(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public LeadershipAA(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Group = new SubLeadershipAA(br); - Raid = new SubLeadershipAA(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - Group.Pack(bw); - Raid.Pack(bw); - } - - public override string ToString() { - var ret = "struct LeadershipAA {\n"; - ret += "\tGroup = "; - try { - ret += $"{ Indentify(Group) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRaid = "; - try { - ret += $"{ Indentify(Raid) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TributeTimer : IEQStruct { - public uint TimeLeft; - - public TributeTimer(uint TimeLeft) : this() { - this.TimeLeft = TimeLeft; - } - - public TributeTimer(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TributeTimer(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - TimeLeft = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(TimeLeft); - } - - public override string ToString() { - var ret = "struct TributeTimer {\n"; - ret += "\tTimeLeft = "; - try { - ret += $"{ Indentify(TimeLeft) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TextureProfile : IEQStruct { - public Texture Head; - public Texture Chest; - public Texture Arms; - public Texture Wrist; - public Texture Hands; - public Texture Legs; - public Texture Feet; - public Texture Primary; - public Texture Secondary; - - public TextureProfile(Texture Head, Texture Chest, Texture Arms, Texture Wrist, Texture Hands, Texture Legs, Texture Feet, Texture Primary, Texture Secondary) : this() { - this.Head = Head; - this.Chest = Chest; - this.Arms = Arms; - this.Wrist = Wrist; - this.Hands = Hands; - this.Legs = Legs; - this.Feet = Feet; - this.Primary = Primary; - this.Secondary = Secondary; - } - - public TextureProfile(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TextureProfile(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Head = new Texture(br); - Chest = new Texture(br); - Arms = new Texture(br); - Wrist = new Texture(br); - Hands = new Texture(br); - Legs = new Texture(br); - Feet = new Texture(br); - Primary = new Texture(br); - Secondary = new Texture(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - Head.Pack(bw); - Chest.Pack(bw); - Arms.Pack(bw); - Wrist.Pack(bw); - Hands.Pack(bw); - Legs.Pack(bw); - Feet.Pack(bw); - Primary.Pack(bw); - Secondary.Pack(bw); - } - - public override string ToString() { - var ret = "struct TextureProfile {\n"; - ret += "\tHead = "; - try { - ret += $"{ Indentify(Head) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tChest = "; - try { - ret += $"{ Indentify(Chest) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tArms = "; - try { - ret += $"{ Indentify(Arms) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWrist = "; - try { - ret += $"{ Indentify(Wrist) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHands = "; - try { - ret += $"{ Indentify(Hands) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLegs = "; - try { - ret += $"{ Indentify(Legs) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFeet = "; - try { - ret += $"{ Indentify(Feet) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPrimary = "; - try { - ret += $"{ Indentify(Primary) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSecondary = "; - try { - ret += $"{ Indentify(Secondary) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PVPStatsEntry : IEQStruct { - public string Name; - public uint Level; - public uint Race; - public uint Class; - public uint Zone; - public uint Time; - public uint Points; - - public PVPStatsEntry(string Name, uint Level, uint Race, uint Class, uint Zone, uint Time, uint Points) : this() { - this.Name = Name; - this.Level = Level; - this.Race = Race; - this.Class = Class; - this.Zone = Zone; - this.Time = Time; - this.Points = Points; - } - - public PVPStatsEntry(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PVPStatsEntry(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(64); - Level = br.ReadUInt32(); - Race = br.ReadUInt32(); - Class = br.ReadUInt32(); - Zone = br.ReadUInt32(); - Time = br.ReadUInt32(); - Points = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes(64)); - bw.Write(Level); - bw.Write(Race); - bw.Write(Class); - bw.Write(Zone); - bw.Write(Time); - bw.Write(Points); - } - - public override string ToString() { - var ret = "struct PVPStatsEntry {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZone = "; - try { - ret += $"{ Indentify(Zone) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTime = "; - try { - ret += $"{ Indentify(Time) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPoints = "; - try { - ret += $"{ Indentify(Points) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PotionBandolierItem : IEQStruct { - public uint ID; - public uint Icon; - public string Name; - - public PotionBandolierItem(uint ID, uint Icon, string Name) : this() { - this.ID = ID; - this.Icon = Icon; - this.Name = Name; - } - - public PotionBandolierItem(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PotionBandolierItem(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ID = br.ReadUInt32(); - Icon = br.ReadUInt32(); - Name = br.ReadString(64); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(ID); - bw.Write(Icon); - bw.Write(Name.ToBytes(64)); - } - - public override string ToString() { - var ret = "struct PotionBandolierItem {\n"; - ret += "\tID = "; - try { - ret += $"{ Indentify(ID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIcon = "; - try { - ret += $"{ Indentify(Icon) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PVPStats : IEQStruct { - public uint Kills; - public uint Deaths; - public uint CurrentPoints; - public uint CareerPoints; - public uint BestKillStreak; - public uint WorstDeathStreak; - public uint CurrentKillStreak; - public PVPStatsEntry LastKill; - public PVPStatsEntry LastDeath; - public uint KillsInLast24Hours; - public PVPStatsEntry[] RecentKills; - - public PVPStats(uint Kills, uint Deaths, uint CurrentPoints, uint CareerPoints, uint BestKillStreak, uint WorstDeathStreak, uint CurrentKillStreak, PVPStatsEntry LastKill, PVPStatsEntry LastDeath, uint KillsInLast24Hours, PVPStatsEntry[] RecentKills) : this() { - this.Kills = Kills; - this.Deaths = Deaths; - this.CurrentPoints = CurrentPoints; - this.CareerPoints = CareerPoints; - this.BestKillStreak = BestKillStreak; - this.WorstDeathStreak = WorstDeathStreak; - this.CurrentKillStreak = CurrentKillStreak; - this.LastKill = LastKill; - this.LastDeath = LastDeath; - this.KillsInLast24Hours = KillsInLast24Hours; - this.RecentKills = RecentKills; - } - - public PVPStats(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PVPStats(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Kills = br.ReadUInt32(); - Deaths = br.ReadUInt32(); - CurrentPoints = br.ReadUInt32(); - CareerPoints = br.ReadUInt32(); - BestKillStreak = br.ReadUInt32(); - WorstDeathStreak = br.ReadUInt32(); - CurrentKillStreak = br.ReadUInt32(); - LastKill = new PVPStatsEntry(br); - LastDeath = new PVPStatsEntry(br); - KillsInLast24Hours = br.ReadUInt32(); - RecentKills = new PVPStatsEntry[50]; - for(var i = 0; i < 50; ++i) { - RecentKills[i] = new PVPStatsEntry(br); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Kills); - bw.Write(Deaths); - bw.Write(CurrentPoints); - bw.Write(CareerPoints); - bw.Write(BestKillStreak); - bw.Write(WorstDeathStreak); - bw.Write(CurrentKillStreak); - LastKill.Pack(bw); - LastDeath.Pack(bw); - bw.Write(KillsInLast24Hours); - for(var i = 0; i < 50; ++i) { - RecentKills[i].Pack(bw); - } - } - - public override string ToString() { - var ret = "struct PVPStats {\n"; - ret += "\tKills = "; - try { - ret += $"{ Indentify(Kills) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeaths = "; - try { - ret += $"{ Indentify(Deaths) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurrentPoints = "; - try { - ret += $"{ Indentify(CurrentPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCareerPoints = "; - try { - ret += $"{ Indentify(CareerPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBestKillStreak = "; - try { - ret += $"{ Indentify(BestKillStreak) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWorstDeathStreak = "; - try { - ret += $"{ Indentify(WorstDeathStreak) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurrentKillStreak = "; - try { - ret += $"{ Indentify(CurrentKillStreak) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastKill = "; - try { - ret += $"{ Indentify(LastKill) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastDeath = "; - try { - ret += $"{ Indentify(LastDeath) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tKillsInLast24Hours = "; - try { - ret += $"{ Indentify(KillsInLast24Hours) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Bind : IEQStruct { - public uint ZoneID; - public float X; - public float Y; - public float Z; - public float Heading; - - public Bind(uint ZoneID, float X, float Y, float Z, float Heading) : this() { - this.ZoneID = ZoneID; - this.X = X; - this.Y = Y; - this.Z = Z; - this.Heading = Heading; - } - - public Bind(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Bind(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ZoneID = br.ReadUInt32(); - X = br.ReadSingle(); - Y = br.ReadSingle(); - Z = br.ReadSingle(); - Heading = br.ReadSingle(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(ZoneID); - bw.Write(X); - bw.Write(Y); - bw.Write(Z); - bw.Write(Heading); - } - - public override string ToString() { - var ret = "struct Bind {\n"; - ret += "\tZoneID = "; - try { - ret += $"{ Indentify(ZoneID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tX = "; - try { - ret += $"{ Indentify(X) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tY = "; - try { - ret += $"{ Indentify(Y) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZ = "; - try { - ret += $"{ Indentify(Z) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TributeInfo : IEQStruct { - public bool Active; - public uint[] Tributes; - public uint[] Tiers; - public uint TributeMasterID; - - public TributeInfo(bool Active, uint[] Tributes, uint[] Tiers, uint TributeMasterID) : this() { - this.Active = Active; - this.Tributes = Tributes; - this.Tiers = Tiers; - this.TributeMasterID = TributeMasterID; - } - - public TributeInfo(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TributeInfo(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Active = br.ReadUInt32() != 0; - Tributes = new uint[MAX_PLAYER_TRIBUTES]; - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - Tributes[i] = br.ReadUInt32(); - } - Tiers = new uint[MAX_PLAYER_TRIBUTES]; - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - Tiers[i] = br.ReadUInt32(); - } - TributeMasterID = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write((uint) (Active ? 1 : 0)); - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - bw.Write(Tributes[i]); - } - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - bw.Write(Tiers[i]); - } - bw.Write(TributeMasterID); - } - - public override string ToString() { - var ret = "struct TributeInfo {\n"; - ret += "\tActive = "; - try { - ret += $"{ Indentify(Active) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTributes = "; - try { - ret += "{\n"; - for(int i = 0, e = Tributes.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Tributes[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTiers = "; - try { - ret += "{\n"; - for(int i = 0, e = Tiers.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Tiers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTributeMasterID = "; - try { - ret += $"{ Indentify(TributeMasterID) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct PlayerProfile : IEQStruct { - uint checksum; - public Gender Gender; - public uint Race; - public uint Class; - public byte Level; - byte unkLevel; - public Bind[] Binds; - public uint Deity; - public uint Intoxication; - public uint[] SpellSlotRefresh; - public uint AbilitySlotRefresh; - public byte HairColor; - public byte BeardColor; - public byte EyeColor1; - public byte EyeColor2; - public byte HairStyle; - public byte Beard; - public TextureProfile Equipment; - public TintProfile ItemTint; - public AAArray[] AAArray; - public uint Points; - public uint Mana; - public uint CurHP; - public uint STR; - public uint STA; - public uint CHA; - public uint DEX; - public uint INT; - public uint AGI; - public uint WIS; - public byte Face; - public uint[] SpellBook; - public uint[] MemSpells; - public Money PlayerMoney; - public Money CursorMoney; - public uint[] Skills; - public uint Toxicity; - public uint Thirst; - public uint Hunger; - public SpellBuff[] Buffs; - public uint[] Disciplines; - public uint[] RecastTimers; - public uint Endurance; - public uint AAPointsSpent; - public uint AAPoints; - public Bandolier[] Bandoliers; - public PotionBandolierItem[] PotionBelt; - public uint AvailableSlots; - public string Name; - public string LastName; - public uint GuildID; - public uint Birthday; - public uint LastLogin; - public uint AccountStartdate; - public uint TimePlayed; - public bool PVP; - public Roleplay Roleplay; - public bool GM; - public GuildRank GuildRank; - public uint GuildBanker; - public uint Experience; - uint timeEntitledOnAccount; - public byte[] Languages; - public float X; - public float Y; - public float Z; - public float Heading; - public Money BankMoney; - public uint PlatinumShared; - uint expansions; - public bool Autosplit; - public ushort ZoneID; - public ushort ZoneInstance; - public GroupMember[] GroupMembers; - public string GroupLeader; - public uint EntityID; - public bool LeadAAActive; - public LdonPoints LdonPoints; - public float TributeTimeRemaining; - public uint CareerTributePoints; - public uint TributePoints; - public bool TributeActive; - public Tribute[] Tributes; - public double GroupLeadershipExp; - public double RaidLeadershipExp; - public uint GroupLeadershipPoints; - public uint RaidLeadershipPoints; - public LeadershipAA LeaderAbilities; - public uint AirRemaining; - public PVPStats PVPStats; - public uint AAExperience; - public uint CurrentRadCrystals; - public uint CareerRadCrystals; - public uint CurrentEbonCrystals; - public uint CareerEbonCrystals; - public Autoconsent Autoconsent; - public uint Level3; - public bool ShowHelm; - public uint RestTimer; - - public PlayerProfile(Gender Gender, uint Race, uint Class, byte Level, Bind[] Binds, uint Deity, uint Intoxication, uint[] SpellSlotRefresh, uint AbilitySlotRefresh, byte HairColor, byte BeardColor, byte EyeColor1, byte EyeColor2, byte HairStyle, byte Beard, TextureProfile Equipment, TintProfile ItemTint, AAArray[] AAArray, uint Points, uint Mana, uint CurHP, uint STR, uint STA, uint CHA, uint DEX, uint INT, uint AGI, uint WIS, byte Face, uint[] SpellBook, uint[] MemSpells, Money PlayerMoney, Money CursorMoney, uint[] Skills, uint Toxicity, uint Thirst, uint Hunger, SpellBuff[] Buffs, uint[] Disciplines, uint[] RecastTimers, uint Endurance, uint AAPointsSpent, uint AAPoints, Bandolier[] Bandoliers, PotionBandolierItem[] PotionBelt, uint AvailableSlots, string Name, string LastName, uint GuildID, uint Birthday, uint LastLogin, uint AccountStartdate, uint TimePlayed, bool PVP, Roleplay Roleplay, bool GM, GuildRank GuildRank, uint GuildBanker, uint Experience, byte[] Languages, float X, float Y, float Z, float Heading, Money BankMoney, uint PlatinumShared, bool Autosplit, ushort ZoneID, ushort ZoneInstance, GroupMember[] GroupMembers, string GroupLeader, uint EntityID, bool LeadAAActive, LdonPoints LdonPoints, float TributeTimeRemaining, uint CareerTributePoints, uint TributePoints, bool TributeActive, Tribute[] Tributes, double GroupLeadershipExp, double RaidLeadershipExp, uint GroupLeadershipPoints, uint RaidLeadershipPoints, LeadershipAA LeaderAbilities, uint AirRemaining, PVPStats PVPStats, uint AAExperience, uint CurrentRadCrystals, uint CareerRadCrystals, uint CurrentEbonCrystals, uint CareerEbonCrystals, Autoconsent Autoconsent, uint Level3, bool ShowHelm, uint RestTimer) : this() { - this.Gender = Gender; - this.Race = Race; - this.Class = Class; - this.Level = Level; - this.Binds = Binds; - this.Deity = Deity; - this.Intoxication = Intoxication; - this.SpellSlotRefresh = SpellSlotRefresh; - this.AbilitySlotRefresh = AbilitySlotRefresh; - this.HairColor = HairColor; - this.BeardColor = BeardColor; - this.EyeColor1 = EyeColor1; - this.EyeColor2 = EyeColor2; - this.HairStyle = HairStyle; - this.Beard = Beard; - this.Equipment = Equipment; - this.ItemTint = ItemTint; - this.AAArray = AAArray; - this.Points = Points; - this.Mana = Mana; - this.CurHP = CurHP; - this.STR = STR; - this.STA = STA; - this.CHA = CHA; - this.DEX = DEX; - this.INT = INT; - this.AGI = AGI; - this.WIS = WIS; - this.Face = Face; - this.SpellBook = SpellBook; - this.MemSpells = MemSpells; - this.PlayerMoney = PlayerMoney; - this.CursorMoney = CursorMoney; - this.Skills = Skills; - this.Toxicity = Toxicity; - this.Thirst = Thirst; - this.Hunger = Hunger; - this.Buffs = Buffs; - this.Disciplines = Disciplines; - this.RecastTimers = RecastTimers; - this.Endurance = Endurance; - this.AAPointsSpent = AAPointsSpent; - this.AAPoints = AAPoints; - this.Bandoliers = Bandoliers; - this.PotionBelt = PotionBelt; - this.AvailableSlots = AvailableSlots; - this.Name = Name; - this.LastName = LastName; - this.GuildID = GuildID; - this.Birthday = Birthday; - this.LastLogin = LastLogin; - this.AccountStartdate = AccountStartdate; - this.TimePlayed = TimePlayed; - this.PVP = PVP; - this.Roleplay = Roleplay; - this.GM = GM; - this.GuildRank = GuildRank; - this.GuildBanker = GuildBanker; - this.Experience = Experience; - this.Languages = Languages; - this.X = X; - this.Y = Y; - this.Z = Z; - this.Heading = Heading; - this.BankMoney = BankMoney; - this.PlatinumShared = PlatinumShared; - this.Autosplit = Autosplit; - this.ZoneID = ZoneID; - this.ZoneInstance = ZoneInstance; - this.GroupMembers = GroupMembers; - this.GroupLeader = GroupLeader; - this.EntityID = EntityID; - this.LeadAAActive = LeadAAActive; - this.LdonPoints = LdonPoints; - this.TributeTimeRemaining = TributeTimeRemaining; - this.CareerTributePoints = CareerTributePoints; - this.TributePoints = TributePoints; - this.TributeActive = TributeActive; - this.Tributes = Tributes; - this.GroupLeadershipExp = GroupLeadershipExp; - this.RaidLeadershipExp = RaidLeadershipExp; - this.GroupLeadershipPoints = GroupLeadershipPoints; - this.RaidLeadershipPoints = RaidLeadershipPoints; - this.LeaderAbilities = LeaderAbilities; - this.AirRemaining = AirRemaining; - this.PVPStats = PVPStats; - this.AAExperience = AAExperience; - this.CurrentRadCrystals = CurrentRadCrystals; - this.CareerRadCrystals = CareerRadCrystals; - this.CurrentEbonCrystals = CurrentEbonCrystals; - this.CareerEbonCrystals = CareerEbonCrystals; - this.Autoconsent = Autoconsent; - this.Level3 = Level3; - this.ShowHelm = ShowHelm; - this.RestTimer = RestTimer; - } - - public PlayerProfile(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public PlayerProfile(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - checksum = br.ReadUInt32(); - Gender = ((Gender) 0).Unpack(br); - Race = br.ReadUInt32(); - Class = br.ReadUInt32(); - br.ReadBytes(40); - Level = br.ReadByte(); - unkLevel = br.ReadByte(); - br.ReadBytes(2); - Binds = new Bind[5]; - for(var i = 0; i < 5; ++i) { - Binds[i] = new Bind(br); - } - Deity = br.ReadUInt32(); - Intoxication = br.ReadUInt32(); - SpellSlotRefresh = new uint[MAX_PP_MEMSPELL]; - for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { - SpellSlotRefresh[i] = br.ReadUInt32(); - } - br.ReadBytes(6); - AbilitySlotRefresh = br.ReadUInt32(); - HairColor = br.ReadByte(); - BeardColor = br.ReadByte(); - EyeColor1 = br.ReadByte(); - EyeColor2 = br.ReadByte(); - HairStyle = br.ReadByte(); - Beard = br.ReadByte(); - br.ReadBytes(4); - Equipment = new TextureProfile(br); - br.ReadBytes(168); - ItemTint = new TintProfile(br); - AAArray = new AAArray[MAX_PP_AA_ARRAY]; - for(var i = 0; i < MAX_PP_AA_ARRAY; ++i) { - AAArray[i] = new AAArray(br); - } - Points = br.ReadUInt32(); - Mana = br.ReadUInt32(); - CurHP = br.ReadUInt32(); - STR = br.ReadUInt32(); - STA = br.ReadUInt32(); - CHA = br.ReadUInt32(); - DEX = br.ReadUInt32(); - INT = br.ReadUInt32(); - AGI = br.ReadUInt32(); - WIS = br.ReadUInt32(); - br.ReadBytes(28); - Face = br.ReadByte(); - br.ReadBytes(147); - SpellBook = new uint[MAX_PP_SPELLBOOK]; - for(var i = 0; i < MAX_PP_SPELLBOOK; ++i) { - SpellBook[i] = br.ReadUInt32(); - } - MemSpells = new uint[MAX_PP_MEMSPELL]; - for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { - MemSpells[i] = br.ReadUInt32(); - } - br.ReadBytes(20); - PlayerMoney = new Money(br); - CursorMoney = new Money(br); - Skills = new uint[MAX_PP_SKILL]; - for(var i = 0; i < MAX_PP_SKILL; ++i) { - Skills[i] = br.ReadUInt32(); - } - br.ReadBytes(136); - Toxicity = br.ReadUInt32(); - Thirst = br.ReadUInt32(); - Hunger = br.ReadUInt32(); - Buffs = new SpellBuff[BUFF_COUNT]; - for(var i = 0; i < BUFF_COUNT; ++i) { - Buffs[i] = new SpellBuff(br); - } - Disciplines = new uint[MAX_PP_DISCIPLINES]; - for(var i = 0; i < MAX_PP_DISCIPLINES; ++i) { - Disciplines[i] = br.ReadUInt32(); - } - RecastTimers = new uint[MAX_RECAST_TYPES]; - for(var i = 0; i < MAX_RECAST_TYPES; ++i) { - RecastTimers[i] = br.ReadUInt32(); - } - br.ReadBytes(160); - Endurance = br.ReadUInt32(); - br.ReadBytes(20); - AAPointsSpent = br.ReadUInt32(); - AAPoints = br.ReadUInt32(); - br.ReadBytes(4); - Bandoliers = new Bandolier[BANDOLIERS_SIZE]; - for(var i = 0; i < BANDOLIERS_SIZE; ++i) { - Bandoliers[i] = new Bandolier(br); - } - PotionBelt = new PotionBandolierItem[POTIONBELT_SIZE]; - for(var i = 0; i < POTIONBELT_SIZE; ++i) { - PotionBelt[i] = new PotionBandolierItem(br); - } - br.ReadBytes(8); - AvailableSlots = br.ReadUInt32(); - br.ReadBytes(80); - Name = br.ReadString(64); - LastName = br.ReadString(32); - br.ReadBytes(8); - GuildID = br.ReadUInt32(); - Birthday = br.ReadUInt32(); - LastLogin = br.ReadUInt32(); - AccountStartdate = br.ReadUInt32(); - TimePlayed = br.ReadUInt32(); - PVP = br.ReadByte() != 0; - Roleplay = ((Roleplay) 0).Unpack(br); - GM = br.ReadByte() != 0; - GuildRank = ((GuildRank) 0).Unpack(br); - GuildBanker = br.ReadUInt32(); - br.ReadBytes(4); - Experience = br.ReadUInt32(); - br.ReadBytes(8); - timeEntitledOnAccount = br.ReadUInt32(); - Languages = new byte[MAX_PP_LANGUAGE]; - for(var i = 0; i < MAX_PP_LANGUAGE; ++i) { - Languages[i] = br.ReadByte(); - } - br.ReadBytes(7); - X = br.ReadSingle(); - Y = br.ReadSingle(); - Z = br.ReadSingle(); - Heading = br.ReadSingle(); - br.ReadBytes(4); - BankMoney = new Money(br); - PlatinumShared = br.ReadUInt32(); - br.ReadBytes(1036); - expansions = br.ReadUInt32(); - br.ReadBytes(12); - Autosplit = br.ReadUInt32() != 0; - br.ReadBytes(16); - ZoneID = br.ReadUInt16(); - ZoneInstance = br.ReadUInt16(); - GroupMembers = new GroupMember[MAX_GROUP_MEMBERS]; - for(var i = 0; i < MAX_GROUP_MEMBERS; ++i) { - GroupMembers[i] = new GroupMember(br); - } - GroupLeader = br.ReadString(64); - br.ReadBytes(540); - EntityID = br.ReadUInt32(); - LeadAAActive = br.ReadUInt32() != 0; - br.ReadBytes(4); - LdonPoints = new LdonPoints(br); - br.ReadBytes(9*4+4+4*6+72); - TributeTimeRemaining = br.ReadSingle(); - CareerTributePoints = br.ReadUInt32(); - br.ReadBytes(4); - TributePoints = br.ReadUInt32(); - br.ReadBytes(4); - TributeActive = br.ReadUInt32() != 0; - Tributes = new Tribute[MAX_PLAYER_TRIBUTES]; - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - Tributes[i] = new Tribute(br); - } - br.ReadBytes(4); - GroupLeadershipExp = br.ReadDouble(); - RaidLeadershipExp = br.ReadDouble(); - GroupLeadershipPoints = br.ReadUInt32(); - RaidLeadershipPoints = br.ReadUInt32(); - LeaderAbilities = new LeadershipAA(br); - br.ReadBytes(128); - AirRemaining = br.ReadUInt32(); - PVPStats = new PVPStats(br); - AAExperience = br.ReadUInt32(); - br.ReadBytes(40); - CurrentRadCrystals = br.ReadUInt32(); - CareerRadCrystals = br.ReadUInt32(); - CurrentEbonCrystals = br.ReadUInt32(); - CareerEbonCrystals = br.ReadUInt32(); - Autoconsent = new Autoconsent(br); - br.ReadBytes(1); - Level3 = br.ReadUInt32(); - ShowHelm = br.ReadUInt32() != 0; - RestTimer = br.ReadUInt32(); - br.ReadBytes(1036); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(checksum); - bw.Write((uint) Gender); - bw.Write(Race); - bw.Write(Class); - bw.Write(new byte[40]); - bw.Write(Level); - bw.Write(unkLevel); - bw.Write(new byte[2]); - for(var i = 0; i < 5; ++i) { - Binds[i].Pack(bw); - } - bw.Write(Deity); - bw.Write(Intoxication); - for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { - bw.Write(SpellSlotRefresh[i]); - } - bw.Write(new byte[6]); - bw.Write(AbilitySlotRefresh); - bw.Write(HairColor); - bw.Write(BeardColor); - bw.Write(EyeColor1); - bw.Write(EyeColor2); - bw.Write(HairStyle); - bw.Write(Beard); - bw.Write(new byte[4]); - Equipment.Pack(bw); - bw.Write(new byte[168]); - ItemTint.Pack(bw); - for(var i = 0; i < MAX_PP_AA_ARRAY; ++i) { - AAArray[i].Pack(bw); - } - bw.Write(Points); - bw.Write(Mana); - bw.Write(CurHP); - bw.Write(STR); - bw.Write(STA); - bw.Write(CHA); - bw.Write(DEX); - bw.Write(INT); - bw.Write(AGI); - bw.Write(WIS); - bw.Write(new byte[28]); - bw.Write(Face); - bw.Write(new byte[147]); - for(var i = 0; i < MAX_PP_SPELLBOOK; ++i) { - bw.Write(SpellBook[i]); - } - for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { - bw.Write(MemSpells[i]); - } - bw.Write(new byte[20]); - PlayerMoney.Pack(bw); - CursorMoney.Pack(bw); - for(var i = 0; i < MAX_PP_SKILL; ++i) { - bw.Write(Skills[i]); - } - bw.Write(new byte[136]); - bw.Write(Toxicity); - bw.Write(Thirst); - bw.Write(Hunger); - for(var i = 0; i < BUFF_COUNT; ++i) { - Buffs[i].Pack(bw); - } - for(var i = 0; i < MAX_PP_DISCIPLINES; ++i) { - bw.Write(Disciplines[i]); - } - for(var i = 0; i < MAX_RECAST_TYPES; ++i) { - bw.Write(RecastTimers[i]); - } - bw.Write(new byte[160]); - bw.Write(Endurance); - bw.Write(new byte[20]); - bw.Write(AAPointsSpent); - bw.Write(AAPoints); - bw.Write(new byte[4]); - for(var i = 0; i < BANDOLIERS_SIZE; ++i) { - Bandoliers[i].Pack(bw); - } - for(var i = 0; i < POTIONBELT_SIZE; ++i) { - PotionBelt[i].Pack(bw); - } - bw.Write(new byte[8]); - bw.Write(AvailableSlots); - bw.Write(new byte[80]); - bw.Write(Name.ToBytes(64)); - bw.Write(LastName.ToBytes(32)); - bw.Write(new byte[8]); - bw.Write(GuildID); - bw.Write(Birthday); - bw.Write(LastLogin); - bw.Write(AccountStartdate); - bw.Write(TimePlayed); - bw.Write((byte) (PVP ? 1 : 0)); - bw.Write((byte) Roleplay); - bw.Write((byte) (GM ? 1 : 0)); - bw.Write((sbyte) GuildRank); - bw.Write(GuildBanker); - bw.Write(new byte[4]); - bw.Write(Experience); - bw.Write(new byte[8]); - bw.Write(timeEntitledOnAccount); - for(var i = 0; i < MAX_PP_LANGUAGE; ++i) { - bw.Write(Languages[i]); - } - bw.Write(new byte[7]); - bw.Write(X); - bw.Write(Y); - bw.Write(Z); - bw.Write(Heading); - bw.Write(new byte[4]); - BankMoney.Pack(bw); - bw.Write(PlatinumShared); - bw.Write(new byte[1036]); - bw.Write(expansions); - bw.Write(new byte[12]); - bw.Write((uint) (Autosplit ? 1 : 0)); - bw.Write(new byte[16]); - bw.Write(ZoneID); - bw.Write(ZoneInstance); - for(var i = 0; i < MAX_GROUP_MEMBERS; ++i) { - GroupMembers[i].Pack(bw); - } - bw.Write(GroupLeader.ToBytes(64)); - bw.Write(new byte[540]); - bw.Write(EntityID); - bw.Write((uint) (LeadAAActive ? 1 : 0)); - bw.Write(new byte[4]); - LdonPoints.Pack(bw); - bw.Write(new byte[9*4+4+4*6+72]); - bw.Write(TributeTimeRemaining); - bw.Write(CareerTributePoints); - bw.Write(new byte[4]); - bw.Write(TributePoints); - bw.Write(new byte[4]); - bw.Write((uint) (TributeActive ? 1 : 0)); - for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { - Tributes[i].Pack(bw); - } - bw.Write(new byte[4]); - bw.Write(GroupLeadershipExp); - bw.Write(RaidLeadershipExp); - bw.Write(GroupLeadershipPoints); - bw.Write(RaidLeadershipPoints); - LeaderAbilities.Pack(bw); - bw.Write(new byte[128]); - bw.Write(AirRemaining); - PVPStats.Pack(bw); - bw.Write(AAExperience); - bw.Write(new byte[40]); - bw.Write(CurrentRadCrystals); - bw.Write(CareerRadCrystals); - bw.Write(CurrentEbonCrystals); - bw.Write(CareerEbonCrystals); - Autoconsent.Pack(bw); - bw.Write(new byte[1]); - bw.Write(Level3); - bw.Write((uint) (ShowHelm ? 1 : 0)); - bw.Write(RestTimer); - bw.Write(new byte[1036]); - } - - public override string ToString() { - var ret = "struct PlayerProfile {\n"; - ret += "\tGender = "; - try { - ret += $"{ Indentify(Gender) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBinds = "; - try { - ret += "{\n"; - for(int i = 0, e = Binds.Length; i < e; ++i) - ret += $"\t\t{ Indentify(Binds[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeity = "; - try { - ret += $"{ Indentify(Deity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tIntoxication = "; - try { - ret += $"{ Indentify(Intoxication) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAbilitySlotRefresh = "; - try { - ret += $"{ Indentify(AbilitySlotRefresh) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairColor = "; - try { - ret += $"{ Indentify(HairColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeardColor = "; - try { - ret += $"{ Indentify(BeardColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor1 = "; - try { - ret += $"{ Indentify(EyeColor1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor2 = "; - try { - ret += $"{ Indentify(EyeColor2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairStyle = "; - try { - ret += $"{ Indentify(HairStyle) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeard = "; - try { - ret += $"{ Indentify(Beard) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEquipment = "; - try { - ret += $"{ Indentify(Equipment) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tItemTint = "; - try { - ret += $"{ Indentify(ItemTint) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPoints = "; - try { - ret += $"{ Indentify(Points) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tMana = "; - try { - ret += $"{ Indentify(Mana) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurHP = "; - try { - ret += $"{ Indentify(CurHP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSTR = "; - try { - ret += $"{ Indentify(STR) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSTA = "; - try { - ret += $"{ Indentify(STA) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCHA = "; - try { - ret += $"{ Indentify(CHA) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDEX = "; - try { - ret += $"{ Indentify(DEX) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tINT = "; - try { - ret += $"{ Indentify(INT) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAGI = "; - try { - ret += $"{ Indentify(AGI) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWIS = "; - try { - ret += $"{ Indentify(WIS) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFace = "; - try { - ret += $"{ Indentify(Face) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPlayerMoney = "; - try { - ret += $"{ Indentify(PlayerMoney) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCursorMoney = "; - try { - ret += $"{ Indentify(CursorMoney) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tToxicity = "; - try { - ret += $"{ Indentify(Toxicity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tThirst = "; - try { - ret += $"{ Indentify(Thirst) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHunger = "; - try { - ret += $"{ Indentify(Hunger) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEndurance = "; - try { - ret += $"{ Indentify(Endurance) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAAPointsSpent = "; - try { - ret += $"{ Indentify(AAPointsSpent) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAAPoints = "; - try { - ret += $"{ Indentify(AAPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAvailableSlots = "; - try { - ret += $"{ Indentify(AvailableSlots) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastName = "; - try { - ret += $"{ Indentify(LastName) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildID = "; - try { - ret += $"{ Indentify(GuildID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBirthday = "; - try { - ret += $"{ Indentify(Birthday) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastLogin = "; - try { - ret += $"{ Indentify(LastLogin) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAccountStartdate = "; - try { - ret += $"{ Indentify(AccountStartdate) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTimePlayed = "; - try { - ret += $"{ Indentify(TimePlayed) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPVP = "; - try { - ret += $"{ Indentify(PVP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRoleplay = "; - try { - ret += $"{ Indentify(Roleplay) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGM = "; - try { - ret += $"{ Indentify(GM) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildRank = "; - try { - ret += $"{ Indentify(GuildRank) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildBanker = "; - try { - ret += $"{ Indentify(GuildBanker) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tExperience = "; - try { - ret += $"{ Indentify(Experience) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tX = "; - try { - ret += $"{ Indentify(X) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tY = "; - try { - ret += $"{ Indentify(Y) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZ = "; - try { - ret += $"{ Indentify(Z) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHeading = "; - try { - ret += $"{ Indentify(Heading) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBankMoney = "; - try { - ret += $"{ Indentify(BankMoney) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPlatinumShared = "; - try { - ret += $"{ Indentify(PlatinumShared) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAutosplit = "; - try { - ret += $"{ Indentify(Autosplit) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZoneID = "; - try { - ret += $"{ Indentify(ZoneID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZoneInstance = "; - try { - ret += $"{ Indentify(ZoneInstance) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGroupMembers = "; - try { - ret += "{\n"; - for(int i = 0, e = GroupMembers.Length; i < e; ++i) - ret += $"\t\t{ Indentify(GroupMembers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t},\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGroupLeader = "; - try { - ret += $"{ Indentify(GroupLeader) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEntityID = "; - try { - ret += $"{ Indentify(EntityID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLeadAAActive = "; - try { - ret += $"{ Indentify(LeadAAActive) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLdonPoints = "; - try { - ret += $"{ Indentify(LdonPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTributeTimeRemaining = "; - try { - ret += $"{ Indentify(TributeTimeRemaining) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCareerTributePoints = "; - try { - ret += $"{ Indentify(CareerTributePoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTributePoints = "; - try { - ret += $"{ Indentify(TributePoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTributeActive = "; - try { - ret += $"{ Indentify(TributeActive) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGroupLeadershipExp = "; - try { - ret += $"{ Indentify(GroupLeadershipExp) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRaidLeadershipExp = "; - try { - ret += $"{ Indentify(RaidLeadershipExp) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGroupLeadershipPoints = "; - try { - ret += $"{ Indentify(GroupLeadershipPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRaidLeadershipPoints = "; - try { - ret += $"{ Indentify(RaidLeadershipPoints) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLeaderAbilities = "; - try { - ret += $"{ Indentify(LeaderAbilities) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAirRemaining = "; - try { - ret += $"{ Indentify(AirRemaining) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPVPStats = "; - try { - ret += $"{ Indentify(PVPStats) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAAExperience = "; - try { - ret += $"{ Indentify(AAExperience) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurrentRadCrystals = "; - try { - ret += $"{ Indentify(CurrentRadCrystals) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCareerRadCrystals = "; - try { - ret += $"{ Indentify(CareerRadCrystals) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurrentEbonCrystals = "; - try { - ret += $"{ Indentify(CurrentEbonCrystals) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCareerEbonCrystals = "; - try { - ret += $"{ Indentify(CareerEbonCrystals) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAutoconsent = "; - try { - ret += $"{ Indentify(Autoconsent) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel3 = "; - try { - ret += $"{ Indentify(Level3) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tShowHelm = "; - try { - ret += $"{ Indentify(ShowHelm) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRestTimer = "; - try { - ret += $"{ Indentify(RestTimer) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SpellBuff : IEQStruct { - public byte EffectType; - public byte Level; - public float BardModifier; - public uint SpellID; - public uint Duration; - public uint NumHits; - public uint CasterID; - public int[] SlotData; - - public SpellBuff(byte EffectType, byte Level, float BardModifier, uint SpellID, uint Duration, uint NumHits, uint CasterID, int[] SlotData) : this() { - this.EffectType = EffectType; - this.Level = Level; - this.BardModifier = BardModifier; - this.SpellID = SpellID; - this.Duration = Duration; - this.NumHits = NumHits; - this.CasterID = CasterID; - this.SlotData = SlotData; - } - - public SpellBuff(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SpellBuff(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - EffectType = br.ReadByte(); - Level = br.ReadByte(); - br.ReadBytes(2); - BardModifier = br.ReadSingle(); - SpellID = br.ReadUInt32(); - Duration = br.ReadUInt32(); - NumHits = br.ReadUInt32(); - CasterID = br.ReadUInt32(); - br.ReadBytes(4); - SlotData = new int[12]; - for(var i = 0; i < 12; ++i) { - SlotData[i] = br.ReadInt32(); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(EffectType); - bw.Write(Level); - bw.Write(new byte[2]); - bw.Write(BardModifier); - bw.Write(SpellID); - bw.Write(Duration); - bw.Write(NumHits); - bw.Write(CasterID); - bw.Write(new byte[4]); - for(var i = 0; i < 12; ++i) { - bw.Write(SlotData[i]); - } - } - - public override string ToString() { - var ret = "struct SpellBuff {\n"; - ret += "\tEffectType = "; - try { - ret += $"{ Indentify(EffectType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBardModifier = "; - try { - ret += $"{ Indentify(BardModifier) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpellID = "; - try { - ret += $"{ Indentify(SpellID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDuration = "; - try { - ret += $"{ Indentify(Duration) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tNumHits = "; - try { - ret += $"{ Indentify(NumHits) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCasterID = "; - try { - ret += $"{ Indentify(CasterID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSlotData = "; - try { - ret += "{\n"; - for(int i = 0, e = SlotData.Length; i < e; ++i) - ret += $"\t\t{ Indentify(SlotData[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; - ret += "\t}\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct ClientPlayerPositionUpdate : IEQStruct { - public ushort ID; - public ushort Sequence; - uint unknown0004; - public float X; - public float Y; - public ClientUpdatePositionSub1 Sub1; - public float DeltaX; - public float DeltaY; - public float Z; - public float DeltaZ; - public ClientUpdatePositionSub2 Sub2; - - public ClientPlayerPositionUpdate(ushort ID, ushort Sequence, float X, float Y, ClientUpdatePositionSub1 Sub1, float DeltaX, float DeltaY, float Z, float DeltaZ, ClientUpdatePositionSub2 Sub2) : this() { - this.ID = ID; - this.Sequence = Sequence; - this.X = X; - this.Y = Y; - this.Sub1 = Sub1; - this.DeltaX = DeltaX; - this.DeltaY = DeltaY; - this.Z = Z; - this.DeltaZ = DeltaZ; - this.Sub2 = Sub2; - } - - public ClientPlayerPositionUpdate(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ClientPlayerPositionUpdate(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - ID = br.ReadUInt16(); - Sequence = br.ReadUInt16(); - unknown0004 = br.ReadUInt32(); - X = br.ReadSingle(); - Y = br.ReadSingle(); - Sub1 = new ClientUpdatePositionSub1(br); - DeltaX = br.ReadSingle(); - DeltaY = br.ReadSingle(); - Z = br.ReadSingle(); - DeltaZ = br.ReadSingle(); - Sub2 = new ClientUpdatePositionSub2(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(ID); - bw.Write(Sequence); - bw.Write(unknown0004); - bw.Write(X); - bw.Write(Y); - Sub1.Pack(bw); - bw.Write(DeltaX); - bw.Write(DeltaY); - bw.Write(Z); - bw.Write(DeltaZ); - Sub2.Pack(bw); - } - - public override string ToString() { - var ret = "struct ClientPlayerPositionUpdate {\n"; - ret += "\tID = "; - try { - ret += $"{ Indentify(ID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSequence = "; - try { - ret += $"{ Indentify(Sequence) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tX = "; - try { - ret += $"{ Indentify(X) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tY = "; - try { - ret += $"{ Indentify(Y) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSub1 = "; - try { - ret += $"{ Indentify(Sub1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaX = "; - try { - ret += $"{ Indentify(DeltaX) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaY = "; - try { - ret += $"{ Indentify(DeltaY) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZ = "; - try { - ret += $"{ Indentify(Z) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeltaZ = "; - try { - ret += $"{ Indentify(DeltaZ) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSub2 = "; - try { - ret += $"{ Indentify(Sub2) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TaskActivity : IEQStruct { - public uint SequenceNumber; - public uint TaskID; - public uint ActivityID; - public uint ActivityType; - public uint Optional; - public string Text1; - public string Text2; - public uint GoalCount; - public uint ZoneID; - public string Text3; - public uint DoneCount; - - public TaskActivity(uint SequenceNumber, uint TaskID, uint ActivityID, uint ActivityType, uint Optional, string Text1, string Text2, uint GoalCount, uint ZoneID, string Text3, uint DoneCount) : this() { - this.SequenceNumber = SequenceNumber; - this.TaskID = TaskID; - this.ActivityID = ActivityID; - this.ActivityType = ActivityType; - this.Optional = Optional; - this.Text1 = Text1; - this.Text2 = Text2; - this.GoalCount = GoalCount; - this.ZoneID = ZoneID; - this.Text3 = Text3; - this.DoneCount = DoneCount; - } - - public TaskActivity(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TaskActivity(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - SequenceNumber = br.ReadUInt32(); - br.ReadBytes(4); - TaskID = br.ReadUInt32(); - ActivityID = br.ReadUInt32(); - br.ReadBytes(4); - ActivityType = br.ReadUInt32(); - Optional = br.ReadUInt32(); - br.ReadBytes(4); - Text1 = br.ReadString(-1); - Text2 = br.ReadString(-1); - GoalCount = br.ReadUInt32(); - br.ReadBytes(8); - ZoneID = br.ReadUInt32(); - br.ReadBytes(4); - Text3 = br.ReadString(-1); - DoneCount = br.ReadUInt32(); - br.ReadBytes(4); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(SequenceNumber); - bw.Write(new byte[4]); - bw.Write(TaskID); - bw.Write(ActivityID); - bw.Write(new byte[4]); - bw.Write(ActivityType); - bw.Write(Optional); - bw.Write(new byte[4]); - bw.Write(Text1.ToBytes()); - bw.Write(Text2.ToBytes()); - bw.Write(GoalCount); - bw.Write(new byte[8]); - bw.Write(ZoneID); - bw.Write(new byte[4]); - bw.Write(Text3.ToBytes()); - bw.Write(DoneCount); - bw.Write(new byte[4]); - } - - public override string ToString() { - var ret = "struct TaskActivity {\n"; - ret += "\tSequenceNumber = "; - try { - ret += $"{ Indentify(SequenceNumber) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTaskID = "; - try { - ret += $"{ Indentify(TaskID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tActivityID = "; - try { - ret += $"{ Indentify(ActivityID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tActivityType = "; - try { - ret += $"{ Indentify(ActivityType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tOptional = "; - try { - ret += $"{ Indentify(Optional) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tText1 = "; - try { - ret += $"{ Indentify(Text1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tText2 = "; - try { - ret += $"{ Indentify(Text2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGoalCount = "; - try { - ret += $"{ Indentify(GoalCount) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tZoneID = "; - try { - ret += $"{ Indentify(ZoneID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tText3 = "; - try { - ret += $"{ Indentify(Text3) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDoneCount = "; - try { - ret += $"{ Indentify(DoneCount) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Spawn : IEQStruct { - public string Name; - public uint SpawnID; - public byte Level; - public CharType CharType; - public SpawnBitfields SpawnFlags; - public byte OtherFlags; - public float Size; - public byte Face; - public float WalkSpeed; - public float RunSpeed; - public Race Race; - public byte ShowName; - public uint BodyType; - public byte CurHP; - public byte HairColor; - public byte BeardColor; - public byte EyeColor1; - public byte EyeColor2; - public byte HairStyle; - public byte Beard; - public uint DrakkinHeritage; - public uint DrakkinTattoo; - public uint DrakkinDetails; - public byte Statue; - public uint Deity; - public uint GuildID; - public GuildRank GuildRank; - public byte Class; - public bool PVP; - public byte StandState; - public byte Light; - public byte FlyMode; - public byte EquipChest2; - public byte Helm; - public string LastName; - public AATitle AATitle; - public uint PetOwnerID; - public uint PlayerState; - public SpawnPosition Position; - public TintProfile EquipmentTint; - public TextureProfile Equipment; - public string Title; - public string Suffix; - public bool IsMercenary; - - public Spawn(string Name, uint SpawnID, byte Level, CharType CharType, SpawnBitfields SpawnFlags, byte OtherFlags, float Size, byte Face, float WalkSpeed, float RunSpeed, Race Race, byte ShowName, uint BodyType, byte CurHP, byte HairColor, byte BeardColor, byte EyeColor1, byte EyeColor2, byte HairStyle, byte Beard, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails, byte Statue, uint Deity, uint GuildID, GuildRank GuildRank, byte Class, bool PVP, byte StandState, byte Light, byte FlyMode, byte EquipChest2, byte Helm, string LastName, AATitle AATitle, uint PetOwnerID, uint PlayerState, SpawnPosition Position, TintProfile EquipmentTint, TextureProfile Equipment, string Title, string Suffix, bool IsMercenary) : this() { - this.Name = Name; - this.SpawnID = SpawnID; - this.Level = Level; - this.CharType = CharType; - this.SpawnFlags = SpawnFlags; - this.OtherFlags = OtherFlags; - this.Size = Size; - this.Face = Face; - this.WalkSpeed = WalkSpeed; - this.RunSpeed = RunSpeed; - this.Race = Race; - this.ShowName = ShowName; - this.BodyType = BodyType; - this.CurHP = CurHP; - this.HairColor = HairColor; - this.BeardColor = BeardColor; - this.EyeColor1 = EyeColor1; - this.EyeColor2 = EyeColor2; - this.HairStyle = HairStyle; - this.Beard = Beard; - this.DrakkinHeritage = DrakkinHeritage; - this.DrakkinTattoo = DrakkinTattoo; - this.DrakkinDetails = DrakkinDetails; - this.Statue = Statue; - this.Deity = Deity; - this.GuildID = GuildID; - this.GuildRank = GuildRank; - this.Class = Class; - this.PVP = PVP; - this.StandState = StandState; - this.Light = Light; - this.FlyMode = FlyMode; - this.EquipChest2 = EquipChest2; - this.Helm = Helm; - this.LastName = LastName; - this.AATitle = AATitle; - this.PetOwnerID = PetOwnerID; - this.PlayerState = PlayerState; - this.Position = Position; - this.EquipmentTint = EquipmentTint; - this.Equipment = Equipment; - this.Title = Title; - this.Suffix = Suffix; - this.IsMercenary = IsMercenary; - } - - public Spawn(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Spawn(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Name = br.ReadString(-1); - SpawnID = br.ReadUInt32(); - Level = br.ReadByte(); - br.ReadBytes(4); - CharType = ((CharType) 0).Unpack(br); - SpawnFlags = new SpawnBitfields(br); - OtherFlags = br.ReadByte(); - br.ReadBytes(8); - Size = br.ReadSingle(); - Face = br.ReadByte(); - WalkSpeed = br.ReadSingle(); - RunSpeed = br.ReadSingle(); - Race = ((Race) 0).Unpack(br); - ShowName = br.ReadByte(); - BodyType = br.ReadUInt32(); - CurHP = br.ReadByte(); - HairColor = br.ReadByte(); - BeardColor = br.ReadByte(); - EyeColor1 = br.ReadByte(); - EyeColor2 = br.ReadByte(); - HairStyle = br.ReadByte(); - Beard = br.ReadByte(); - DrakkinHeritage = br.ReadUInt32(); - DrakkinTattoo = br.ReadUInt32(); - DrakkinDetails = br.ReadUInt32(); - Statue = br.ReadByte(); - Deity = br.ReadUInt32(); - GuildID = br.ReadUInt32(); - GuildRank = ((GuildRank) 0).Unpack(br); - br.ReadBytes(3); - Class = br.ReadByte(); - PVP = br.ReadByte() != 0; - StandState = br.ReadByte(); - Light = br.ReadByte(); - FlyMode = br.ReadByte(); - EquipChest2 = br.ReadByte(); - br.ReadBytes(2); - Helm = br.ReadByte(); - LastName = br.ReadString(-1); - AATitle = ((AATitle) 0).Unpack(br); - br.ReadBytes(1); - PetOwnerID = br.ReadUInt32(); - br.ReadBytes(1); - PlayerState = br.ReadUInt32(); - br.ReadBytes(5*4); - Position = new SpawnPosition(br); - EquipmentTint = new TintProfile(br); - if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { - Equipment = new TextureProfile(br); - } - if((OtherFlags & 4) != 0) { - Title = br.ReadString(-1); - } - if((OtherFlags & 8) != 0) { - Suffix = br.ReadString(-1); - } - br.ReadBytes(8); - IsMercenary = br.ReadByte() != 0; - br.ReadBytes(28); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Name.ToBytes()); - bw.Write(SpawnID); - bw.Write(Level); - bw.Write(new byte[4]); - bw.Write((byte) CharType); - SpawnFlags.Pack(bw); - bw.Write(OtherFlags); - bw.Write(new byte[8]); - bw.Write(Size); - bw.Write(Face); - bw.Write(WalkSpeed); - bw.Write(RunSpeed); - bw.Write((uint) Race); - bw.Write(ShowName); - bw.Write(BodyType); - bw.Write(CurHP); - bw.Write(HairColor); - bw.Write(BeardColor); - bw.Write(EyeColor1); - bw.Write(EyeColor2); - bw.Write(HairStyle); - bw.Write(Beard); - bw.Write(DrakkinHeritage); - bw.Write(DrakkinTattoo); - bw.Write(DrakkinDetails); - bw.Write(Statue); - bw.Write(Deity); - bw.Write(GuildID); - bw.Write((sbyte) GuildRank); - bw.Write(new byte[3]); - bw.Write(Class); - bw.Write((byte) (PVP ? 1 : 0)); - bw.Write(StandState); - bw.Write(Light); - bw.Write(FlyMode); - bw.Write(EquipChest2); - bw.Write(new byte[2]); - bw.Write(Helm); - bw.Write(LastName.ToBytes()); - bw.Write((uint) AATitle); - bw.Write(new byte[1]); - bw.Write(PetOwnerID); - bw.Write(new byte[1]); - bw.Write(PlayerState); - bw.Write(new byte[5*4]); - Position.Pack(bw); - EquipmentTint.Pack(bw); - if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { - Equipment.Pack(bw); - } - if((OtherFlags & 4) != 0) { - bw.Write(Title.ToBytes()); - } - if((OtherFlags & 8) != 0) { - bw.Write(Suffix.ToBytes()); - } - bw.Write(new byte[8]); - bw.Write((byte) (IsMercenary ? 1 : 0)); - bw.Write(new byte[28]); - } - - public override string ToString() { - var ret = "struct Spawn {\n"; - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpawnID = "; - try { - ret += $"{ Indentify(SpawnID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLevel = "; - try { - ret += $"{ Indentify(Level) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCharType = "; - try { - ret += $"{ Indentify(CharType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpawnFlags = "; - try { - ret += $"{ Indentify(SpawnFlags) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tOtherFlags = "; - try { - ret += $"{ Indentify(OtherFlags) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSize = "; - try { - ret += $"{ Indentify(Size) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFace = "; - try { - ret += $"{ Indentify(Face) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tWalkSpeed = "; - try { - ret += $"{ Indentify(WalkSpeed) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRunSpeed = "; - try { - ret += $"{ Indentify(RunSpeed) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tShowName = "; - try { - ret += $"{ Indentify(ShowName) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBodyType = "; - try { - ret += $"{ Indentify(BodyType) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCurHP = "; - try { - ret += $"{ Indentify(CurHP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairColor = "; - try { - ret += $"{ Indentify(HairColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeardColor = "; - try { - ret += $"{ Indentify(BeardColor) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor1 = "; - try { - ret += $"{ Indentify(EyeColor1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEyeColor2 = "; - try { - ret += $"{ Indentify(EyeColor2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHairStyle = "; - try { - ret += $"{ Indentify(HairStyle) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tBeard = "; - try { - ret += $"{ Indentify(Beard) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinHeritage = "; - try { - ret += $"{ Indentify(DrakkinHeritage) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinTattoo = "; - try { - ret += $"{ Indentify(DrakkinTattoo) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDrakkinDetails = "; - try { - ret += $"{ Indentify(DrakkinDetails) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStatue = "; - try { - ret += $"{ Indentify(Statue) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDeity = "; - try { - ret += $"{ Indentify(Deity) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildID = "; - try { - ret += $"{ Indentify(GuildID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGuildRank = "; - try { - ret += $"{ Indentify(GuildRank) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPVP = "; - try { - ret += $"{ Indentify(PVP) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStandState = "; - try { - ret += $"{ Indentify(StandState) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLight = "; - try { - ret += $"{ Indentify(Light) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFlyMode = "; - try { - ret += $"{ Indentify(FlyMode) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEquipChest2 = "; - try { - ret += $"{ Indentify(EquipChest2) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHelm = "; - try { - ret += $"{ Indentify(Helm) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastName = "; - try { - ret += $"{ Indentify(LastName) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tAATitle = "; - try { - ret += $"{ Indentify(AATitle) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPetOwnerID = "; - try { - ret += $"{ Indentify(PetOwnerID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPlayerState = "; - try { - ret += $"{ Indentify(PlayerState) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPosition = "; - try { - ret += $"{ Indentify(Position) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEquipmentTint = "; - try { - ret += $"{ Indentify(EquipmentTint) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { - ret += "\tEquipment = "; - try { - ret += $"{ Indentify(Equipment) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - if((OtherFlags & 4) != 0) { - ret += "\tTitle = "; - try { - ret += $"{ Indentify(Title) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - if((OtherFlags & 8) != 0) { - ret += "\tSuffix = "; - try { - ret += $"{ Indentify(Suffix) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - ret += "\tIsMercenary = "; - try { - ret += $"{ Indentify(IsMercenary) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct ClientZoneEntry : IEQStruct { - uint unk; - public string CharName; - - public ClientZoneEntry(string CharName) : this() { - this.CharName = CharName; - } - - public ClientZoneEntry(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public ClientZoneEntry(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - unk = br.ReadUInt32(); - CharName = br.ReadString(64); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(unk); - bw.Write(CharName.ToBytes(64)); - } - - public override string ToString() { - var ret = "struct ClientZoneEntry {\n"; - ret += "\tCharName = "; - try { - ret += $"{ Indentify(CharName) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct AugSlot : IEQStruct { - public uint Type; - public bool Visible; - - public AugSlot(uint Type, bool Visible) : this() { - this.Type = Type; - this.Visible = Visible; - } - - public AugSlot(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public AugSlot(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Type = br.ReadUInt32(); - Visible = br.ReadByte() != 0; - br.ReadBytes(1); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Type); - bw.Write((byte) (Visible ? 1 : 0)); - bw.Write(new byte[1]); - } - - public override string ToString() { - var ret = "struct AugSlot {\n"; - ret += "\tType = "; - try { - ret += $"{ Indentify(Type) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tVisible = "; - try { - ret += $"{ Indentify(Visible) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Money : IEQStruct { - public uint Platinum; - public uint Gold; - public uint Silver; - public uint Copper; - - public Money(uint Platinum, uint Gold, uint Silver, uint Copper) : this() { - this.Platinum = Platinum; - this.Gold = Gold; - this.Silver = Silver; - this.Copper = Copper; - } - - public Money(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Money(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Platinum = br.ReadUInt32(); - Gold = br.ReadUInt32(); - Silver = br.ReadUInt32(); - Copper = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Platinum); - bw.Write(Gold); - bw.Write(Silver); - bw.Write(Copper); - } - - public override string ToString() { - var ret = "struct Money {\n"; - ret += "\tPlatinum = "; - try { - ret += $"{ Indentify(Platinum) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tGold = "; - try { - ret += $"{ Indentify(Gold) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSilver = "; - try { - ret += $"{ Indentify(Silver) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCopper = "; - try { - ret += $"{ Indentify(Copper) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct SubLeadershipAA : IEQStruct { - public uint MarkNPC; - public uint NPCHealth; - public uint DelegateMainAssist; - public uint DelegateMarkNPC; - uint _4; - uint _5; - uint _6; - public uint SpellAwareness; - public uint OffenseEnhancement; - public uint ManaEnhancement; - public uint HealthEnhancement; - public uint HealthRegeneration; - public uint FindPathToPC; - public uint HealthOfTargetsTarget; - uint _14; - uint _15; - - public SubLeadershipAA(uint MarkNPC, uint NPCHealth, uint DelegateMainAssist, uint DelegateMarkNPC, uint SpellAwareness, uint OffenseEnhancement, uint ManaEnhancement, uint HealthEnhancement, uint HealthRegeneration, uint FindPathToPC, uint HealthOfTargetsTarget) : this() { - this.MarkNPC = MarkNPC; - this.NPCHealth = NPCHealth; - this.DelegateMainAssist = DelegateMainAssist; - this.DelegateMarkNPC = DelegateMarkNPC; - this.SpellAwareness = SpellAwareness; - this.OffenseEnhancement = OffenseEnhancement; - this.ManaEnhancement = ManaEnhancement; - this.HealthEnhancement = HealthEnhancement; - this.HealthRegeneration = HealthRegeneration; - this.FindPathToPC = FindPathToPC; - this.HealthOfTargetsTarget = HealthOfTargetsTarget; - } - - public SubLeadershipAA(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public SubLeadershipAA(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - MarkNPC = br.ReadUInt32(); - NPCHealth = br.ReadUInt32(); - DelegateMainAssist = br.ReadUInt32(); - DelegateMarkNPC = br.ReadUInt32(); - _4 = br.ReadUInt32(); - _5 = br.ReadUInt32(); - _6 = br.ReadUInt32(); - SpellAwareness = br.ReadUInt32(); - OffenseEnhancement = br.ReadUInt32(); - ManaEnhancement = br.ReadUInt32(); - HealthEnhancement = br.ReadUInt32(); - HealthRegeneration = br.ReadUInt32(); - FindPathToPC = br.ReadUInt32(); - HealthOfTargetsTarget = br.ReadUInt32(); - _14 = br.ReadUInt32(); - _15 = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(MarkNPC); - bw.Write(NPCHealth); - bw.Write(DelegateMainAssist); - bw.Write(DelegateMarkNPC); - bw.Write(_4); - bw.Write(_5); - bw.Write(_6); - bw.Write(SpellAwareness); - bw.Write(OffenseEnhancement); - bw.Write(ManaEnhancement); - bw.Write(HealthEnhancement); - bw.Write(HealthRegeneration); - bw.Write(FindPathToPC); - bw.Write(HealthOfTargetsTarget); - bw.Write(_14); - bw.Write(_15); - } - - public override string ToString() { - var ret = "struct SubLeadershipAA {\n"; - ret += "\tMarkNPC = "; - try { - ret += $"{ Indentify(MarkNPC) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tNPCHealth = "; - try { - ret += $"{ Indentify(NPCHealth) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDelegateMainAssist = "; - try { - ret += $"{ Indentify(DelegateMainAssist) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDelegateMarkNPC = "; - try { - ret += $"{ Indentify(DelegateMarkNPC) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tSpellAwareness = "; - try { - ret += $"{ Indentify(SpellAwareness) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tOffenseEnhancement = "; - try { - ret += $"{ Indentify(OffenseEnhancement) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tManaEnhancement = "; - try { - ret += $"{ Indentify(ManaEnhancement) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHealthEnhancement = "; - try { - ret += $"{ Indentify(HealthEnhancement) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHealthRegeneration = "; - try { - ret += $"{ Indentify(HealthRegeneration) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tFindPathToPC = "; - try { - ret += $"{ Indentify(FindPathToPC) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tHealthOfTargetsTarget = "; - try { - ret += $"{ Indentify(HealthOfTargetsTarget) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct TaskDescription : IEQStruct { - public uint SequenceNumber; - public uint TaskID; - public string Title; - public uint Duration; - public uint StartTime; - public string Description; - public uint RewardCount; - public string RewardText; - public uint Points; - - public TaskDescription(uint SequenceNumber, uint TaskID, string Title, uint Duration, uint StartTime, string Description, uint RewardCount, string RewardText, uint Points) : this() { - this.SequenceNumber = SequenceNumber; - this.TaskID = TaskID; - this.Title = Title; - this.Duration = Duration; - this.StartTime = StartTime; - this.Description = Description; - this.RewardCount = RewardCount; - this.RewardText = RewardText; - this.Points = Points; - } - - public TaskDescription(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TaskDescription(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - SequenceNumber = br.ReadUInt32(); - TaskID = br.ReadUInt32(); - br.ReadBytes(4*2+1); - Title = br.ReadString(-1); - Duration = br.ReadUInt32(); - br.ReadBytes(4); - StartTime = br.ReadUInt32(); - Description = br.ReadString(-1); - RewardCount = br.ReadUInt32(); - br.ReadBytes(4*2+2); - RewardText = br.ReadString(-1); - Points = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(SequenceNumber); - bw.Write(TaskID); - bw.Write(new byte[4*2+1]); - bw.Write(Title.ToBytes()); - bw.Write(Duration); - bw.Write(new byte[4]); - bw.Write(StartTime); - bw.Write(Description.ToBytes()); - bw.Write(RewardCount); - bw.Write(new byte[4*2+2]); - bw.Write(RewardText.ToBytes()); - bw.Write(Points); - } - - public override string ToString() { - var ret = "struct TaskDescription {\n"; - ret += "\tSequenceNumber = "; - try { - ret += $"{ Indentify(SequenceNumber) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTaskID = "; - try { - ret += $"{ Indentify(TaskID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTitle = "; - try { - ret += $"{ Indentify(Title) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDuration = "; - try { - ret += $"{ Indentify(Duration) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tStartTime = "; - try { - ret += $"{ Indentify(StartTime) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tDescription = "; - try { - ret += $"{ Indentify(Description) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRewardCount = "; - try { - ret += $"{ Indentify(RewardCount) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRewardText = "; - try { - ret += $"{ Indentify(RewardText) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tPoints = "; - try { - ret += $"{ Indentify(Points) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct Weather : IEQStruct { - public uint Val1; - public WeatherType Type; - - public Weather(uint Val1, WeatherType Type) : this() { - this.Val1 = Val1; - this.Type = Type; - } - - public Weather(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public Weather(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Val1 = br.ReadUInt32(); - Type = ((WeatherType) 0).Unpack(br); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(Val1); - bw.Write((uint) Type); - } - - public override string ToString() { - var ret = "struct Weather {\n"; - ret += "\tVal1 = "; - try { - ret += $"{ Indentify(Val1) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tType = "; - try { - ret += $"{ Indentify(Type) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct FindableNPC : IEQStruct { - public bool Remove; - public uint EntityID; - public string Name; - public string LastName; - public uint Race; - public byte Class; - - public FindableNPC(bool Remove, uint EntityID, string Name, string LastName, uint Race, byte Class) : this() { - this.Remove = Remove; - this.EntityID = EntityID; - this.Name = Name; - this.LastName = LastName; - this.Race = Race; - this.Class = Class; - } - - public FindableNPC(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public FindableNPC(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - Remove = br.ReadUInt32() != 0; - EntityID = br.ReadUInt32(); - Name = br.ReadString(64); - LastName = br.ReadString(32); - Race = br.ReadUInt32(); - Class = br.ReadByte(); - br.ReadBytes(3); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write((uint) (Remove ? 1 : 0)); - bw.Write(EntityID); - bw.Write(Name.ToBytes(64)); - bw.Write(LastName.ToBytes(32)); - bw.Write(Race); - bw.Write(Class); - bw.Write(new byte[3]); - } - - public override string ToString() { - var ret = "struct FindableNPC {\n"; - ret += "\tRemove = "; - try { - ret += $"{ Indentify(Remove) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tEntityID = "; - try { - ret += $"{ Indentify(EntityID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tLastName = "; - try { - ret += $"{ Indentify(LastName) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRace = "; - try { - ret += $"{ Indentify(Race) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tClass = "; - try { - ret += $"{ Indentify(Class) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } - - public struct XTarget : IEQStruct { - public uint MaxXTargets; - public bool RestFlag; - public uint Slot; - public byte Role; - public uint TargetID; - public string Name; - - public XTarget(uint MaxXTargets, bool RestFlag, uint Slot, byte Role, uint TargetID, string Name) : this() { - this.MaxXTargets = MaxXTargets; - this.RestFlag = RestFlag; - this.Slot = Slot; - this.Role = Role; - this.TargetID = TargetID; - this.Name = Name; - } - - public XTarget(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public XTarget(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - MaxXTargets = br.ReadUInt32(); - RestFlag = br.ReadUInt32() != 0; - if(RestFlag) { - Slot = br.ReadUInt32(); - } - if(RestFlag) { - Role = br.ReadByte(); - } - if(RestFlag) { - TargetID = br.ReadUInt32(); - } - if(RestFlag) { - Name = br.ReadString(-1); - } - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(MaxXTargets); - bw.Write((uint) (RestFlag ? 1 : 0)); - if(RestFlag) { - bw.Write(Slot); - } - if(RestFlag) { - bw.Write(Role); - } - if(RestFlag) { - bw.Write(TargetID); - } - if(RestFlag) { - bw.Write(Name.ToBytes()); - } - } - - public override string ToString() { - var ret = "struct XTarget {\n"; - ret += "\tMaxXTargets = "; - try { - ret += $"{ Indentify(MaxXTargets) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tRestFlag = "; - try { - ret += $"{ Indentify(RestFlag) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - if(RestFlag) { - ret += "\tSlot = "; - try { - ret += $"{ Indentify(Slot) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - if(RestFlag) { - ret += "\tRole = "; - try { - ret += $"{ Indentify(Role) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - if(RestFlag) { - ret += "\tTargetID = "; - try { - ret += $"{ Indentify(TargetID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - if(RestFlag) { - ret += "\tName = "; - try { - ret += $"{ Indentify(Name) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - } - return ret + "}"; - } - } - - public struct TaskInfo : IEQStruct { - public uint TaskID; - public string Title; - public uint CompletedTime; - - public TaskInfo(uint TaskID, string Title, uint CompletedTime) : this() { - this.TaskID = TaskID; - this.Title = Title; - this.CompletedTime = CompletedTime; - } - - public TaskInfo(byte[] data, int offset = 0) : this() { - Unpack(data, offset); - } - public TaskInfo(BinaryReader br) : this() { - Unpack(br); - } - public void Unpack(byte[] data, int offset = 0) { - using(var ms = new MemoryStream(data, offset, data.Length - offset)) { - using(var br = new BinaryReader(ms)) { - Unpack(br); - } - } - } - public void Unpack(BinaryReader br) { - TaskID = br.ReadUInt32(); - Title = br.ReadString(-1); - CompletedTime = br.ReadUInt32(); - } - - public byte[] Pack() { - using(var ms = new MemoryStream()) { - using(var bw = new BinaryWriter(ms)) { - Pack(bw); - return ms.ToArray(); - } - } - } - public void Pack(BinaryWriter bw) { - bw.Write(TaskID); - bw.Write(Title.ToBytes()); - bw.Write(CompletedTime); - } - - public override string ToString() { - var ret = "struct TaskInfo {\n"; - ret += "\tTaskID = "; - try { - ret += $"{ Indentify(TaskID) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tTitle = "; - try { - ret += $"{ Indentify(Title) },\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - ret += "\tCompletedTime = "; - try { - ret += $"{ Indentify(CompletedTime) }\n"; - } catch(NullReferenceException) { - ret += "!!NULL!!\n"; - } - return ret + "}"; - } - } -} + /* + * o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o + * /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ + * /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ + * o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o + * <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> + * \ | | / \ \o / \ | | \ / \ | | / \ // + * \ / \o/ v\ \o/ \o o/ \o o \o/ / + * o o | | <\ | | | v\ /v v\ <| | | o + * <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> + * + * THIS FILE IS GENERATED BY structgen.py/structs.yml + * DO NOT EDIT + * + */ + +using System; +using System.Collections.Generic; +using System.IO; +using static OpenEQ.Netcode.Utility; + +using static OpenEQ.Netcode.ZoneConstants.Constants; +namespace OpenEQ.Netcode.ZoneConstants { + internal static class Constants { + public const int BUFF_COUNT = 30; + public const int BANDOLIERS_SIZE = 20; + public const int MAX_PP_MEMSPELL = 12; + public const int MAX_PP_SKILL = 100; + public const int SKILLARRAY_SIZE = 100; + public const int MAX_PP_DISCIPLINES = 200; + public const int MAX_PLAYER_TRIBUTES = 5; + public const int MAX_GROUP_MEMBERS = 6; + public const int MAX_PP_AA_ARRAY = 300; + public const int POTIONBELT_SIZE = 5; + public const int MAX_RECAST_TYPES = 20; + public const int MAX_PP_SPELLBOOK = 720; + public const int MAX_PP_LANGUAGE = 25; + public const int BANDOLIER_ITEM_COUNT = 4; + } +} + +namespace OpenEQ.Netcode { + public enum CharType : byte { + PC = 0, + NPC = 1, + PCCorpse = 2, + NPCCorpse = 3 + } + internal static class CharType_Helper { + internal static CharType Unpack(this CharType val, BinaryReader br) { + switch(br.ReadByte()) { + case 0: + return CharType.PC; + case 1: + return CharType.NPC; + case 2: + return CharType.PCCorpse; + default: + return CharType.NPCCorpse; + } + } + } + + public enum WeatherType { + Normal = 0, + Snow = 2, + Rain = 49 + } + internal static class WeatherType_Helper { + internal static WeatherType Unpack(this WeatherType val, BinaryReader br) { + switch(br.ReadUInt32()) { + case 0: + return WeatherType.Normal; + case 2: + return WeatherType.Snow; + default: + return WeatherType.Rain; + } + } + } + + public enum GuildRank : sbyte { + Member = 0, + Officer = 1, + Leader = 2, + None = -1 + } + internal static class GuildRank_Helper { + internal static GuildRank Unpack(this GuildRank val, BinaryReader br) { + switch(br.ReadSByte()) { + case 0: + return GuildRank.Member; + case 1: + return GuildRank.Officer; + case 2: + return GuildRank.Leader; + default: + return GuildRank.None; + } + } + } + + public enum Gender { + Male = 0, + Female = 1, + Monster = 2 + } + internal static class Gender_Helper { + internal static Gender Unpack(this Gender val, BinaryReader br) { + switch(br.ReadUInt32()) { + case 0: + return Gender.Male; + case 1: + return Gender.Female; + default: + return Gender.Monster; + } + } + } + + public enum Race { + Human = 1, + Barbarian = 2, + Erudite = 3, + WoodElf = 4, + HighElf = 5, + DarkElf = 6, + HalfElf = 7, + Dwarf = 8, + Troll = 9, + Ogre = 10, + Halfling = 11, + Gnome = 12, + Iksar = 13, + Vahshir = 14, + Froglok = 15, + Drakkin = 16, + Unknown = 0 + } + internal static class Race_Helper { + internal static Race Unpack(this Race val, BinaryReader br) { + switch(br.ReadUInt32()) { + case 1: + return Race.Human; + case 2: + return Race.Barbarian; + case 3: + return Race.Erudite; + case 4: + return Race.WoodElf; + case 5: + return Race.HighElf; + case 6: + return Race.DarkElf; + case 7: + return Race.HalfElf; + case 8: + return Race.Dwarf; + case 9: + return Race.Troll; + case 10: + return Race.Ogre; + case 11: + return Race.Halfling; + case 12: + return Race.Gnome; + case 13: + return Race.Iksar; + case 14: + return Race.Vahshir; + case 15: + return Race.Froglok; + case 16: + return Race.Drakkin; + default: + return Race.Unknown; + } + } + } + + public enum Roleplay : byte { + NonAnon = 0, + Anon = 1, + Roleplay = 2 + } + internal static class Roleplay_Helper { + internal static Roleplay Unpack(this Roleplay val, BinaryReader br) { + switch(br.ReadByte()) { + case 0: + return Roleplay.NonAnon; + case 1: + return Roleplay.Anon; + default: + return Roleplay.Roleplay; + } + } + } + + public enum AATitle { + None = 0, + General = 1, + Archtype = 2, + ClassAARank = 3 + } + internal static class AATitle_Helper { + internal static AATitle Unpack(this AATitle val, BinaryReader br) { + switch(br.ReadUInt32()) { + case 0: + return AATitle.None; + case 1: + return AATitle.General; + case 2: + return AATitle.Archtype; + default: + return AATitle.ClassAARank; + } + } + } + + public struct ClientUpdatePositionSub1 : IEQStruct { + public short DeltaHeading; + + public ClientUpdatePositionSub1(short DeltaHeading) : this() { + this.DeltaHeading = DeltaHeading; + } + + public ClientUpdatePositionSub1(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ClientUpdatePositionSub1(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + uint _databuf; + _databuf = br.ReadUInt32(); + DeltaHeading = (short) (((int) (_databuf & 0x3FF) ^ 0x200) - 0x200); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + } + + public override string ToString() { + var ret = "bitfield ClientUpdatePositionSub1 {\n"; + ret += "\tDeltaHeading = "; + try { + ret += $"{ Indentify(DeltaHeading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SpawnPosition : IEQStruct { + public short DeltaX; + public short DeltaHeading; + public short DeltaY; + public int Y; + public short Animation; + public ushort Heading; + public int X; + public int Z; + public short DeltaZ; + + public SpawnPosition(short DeltaX, short DeltaHeading, short DeltaY, int Y, short Animation, ushort Heading, int X, int Z, short DeltaZ) : this() { + this.DeltaX = DeltaX; + this.DeltaHeading = DeltaHeading; + this.DeltaY = DeltaY; + this.Y = Y; + this.Animation = Animation; + this.Heading = Heading; + this.X = X; + this.Z = Z; + this.DeltaZ = DeltaZ; + } + + public SpawnPosition(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SpawnPosition(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ulong _databuf; + _databuf = br.ReadUInt64(); + DeltaX = (short) (((int) ((_databuf >> 12) & 0x1FFF) ^ 0x1000) - 0x1000); + DeltaHeading = (short) (((int) ((_databuf >> 32) & 0x3FF) ^ 0x200) - 0x200); + DeltaY = (short) (((int) ((_databuf >> 42) & 0x1FFF) ^ 0x1000) - 0x1000); + _databuf = br.ReadUInt64(); + Y = (int) (((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000); + Animation = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); + Heading = (ushort) ((_databuf >> 32) & 0xFFF); + X = (int) (((int) ((_databuf >> 44) & 0x7FFFF) ^ 0x40000) - 0x40000); + _databuf = br.ReadUInt32(); + Z = (int) (((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000); + DeltaZ = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + } + + public override string ToString() { + var ret = "bitfield SpawnPosition {\n"; + ret += "\tDeltaX = "; + try { + ret += $"{ Indentify(DeltaX) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaHeading = "; + try { + ret += $"{ Indentify(DeltaHeading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaY = "; + try { + ret += $"{ Indentify(DeltaY) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tY = "; + try { + ret += $"{ Indentify(Y) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAnimation = "; + try { + ret += $"{ Indentify(Animation) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tX = "; + try { + ret += $"{ Indentify(X) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZ = "; + try { + ret += $"{ Indentify(Z) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaZ = "; + try { + ret += $"{ Indentify(DeltaZ) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct ClientUpdatePositionSub2 : IEQStruct { + public ushort Animation; + public ushort Heading; + + public ClientUpdatePositionSub2(ushort Animation, ushort Heading) : this() { + this.Animation = Animation; + this.Heading = Heading; + } + + public ClientUpdatePositionSub2(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ClientUpdatePositionSub2(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + uint _databuf; + _databuf = br.ReadUInt32(); + Animation = (ushort) (_databuf & 0x3FF); + Heading = (ushort) ((_databuf >> 10) & 0xFFF); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + } + + public override string ToString() { + var ret = "bitfield ClientUpdatePositionSub2 {\n"; + ret += "\tAnimation = "; + try { + ret += $"{ Indentify(Animation) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SpawnBitfields : IEQStruct { + public bool Pet; + public bool AFK; + public bool Sneak; + public bool LFG; + public bool Invisible; + public bool GM; + public Roleplay Roleplay; + public Gender Gender; + public bool Linkdead; + public bool BetaBuffed; + public bool ShowHelm; + public bool Targetable; + public bool HotkeyTargetable; + public bool ShowName; + public bool Statue; + public bool Trader; + public bool Buyer; + + public SpawnBitfields(bool Pet, bool AFK, bool Sneak, bool LFG, bool Invisible, bool GM, Roleplay Roleplay, Gender Gender, bool Linkdead, bool BetaBuffed, bool ShowHelm, bool Targetable, bool HotkeyTargetable, bool ShowName, bool Statue, bool Trader, bool Buyer) : this() { + this.Pet = Pet; + this.AFK = AFK; + this.Sneak = Sneak; + this.LFG = LFG; + this.Invisible = Invisible; + this.GM = GM; + this.Roleplay = Roleplay; + this.Gender = Gender; + this.Linkdead = Linkdead; + this.BetaBuffed = BetaBuffed; + this.ShowHelm = ShowHelm; + this.Targetable = Targetable; + this.HotkeyTargetable = HotkeyTargetable; + this.ShowName = ShowName; + this.Statue = Statue; + this.Trader = Trader; + this.Buyer = Buyer; + } + + public SpawnBitfields(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SpawnBitfields(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + uint _databuf; + _databuf = br.ReadUInt32(); + Pet = (bool) ((_databuf & 0x1) != 0); + AFK = (bool) (((_databuf >> 1) & 0x1) != 0); + Sneak = (bool) (((_databuf >> 2) & 0x1) != 0); + LFG = (bool) (((_databuf >> 3) & 0x1) != 0); + Invisible = (bool) (((_databuf >> 5) & 0x1) != 0); + GM = (bool) (((_databuf >> 17) & 0x1) != 0); + Roleplay = (Roleplay) ((_databuf >> 18) & 0x3); + Gender = (Gender) ((_databuf >> 20) & 0x3); + Linkdead = (bool) (((_databuf >> 22) & 0x1) != 0); + BetaBuffed = (bool) (((_databuf >> 23) & 0x1) != 0); + ShowHelm = (bool) (((_databuf >> 24) & 0x1) != 0); + Targetable = (bool) (((_databuf >> 26) & 0x1) != 0); + HotkeyTargetable = (bool) (((_databuf >> 27) & 0x1) != 0); + ShowName = (bool) (((_databuf >> 28) & 0x1) != 0); + Statue = (bool) (((_databuf >> 29) & 0x1) != 0); + Trader = (bool) (((_databuf >> 30) & 0x1) != 0); + Buyer = (bool) (((_databuf >> 31) & 0x1) != 0); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + } + + public override string ToString() { + var ret = "bitfield SpawnBitfields {\n"; + ret += "\tPet = "; + try { + ret += $"{ Indentify(Pet) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAFK = "; + try { + ret += $"{ Indentify(AFK) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSneak = "; + try { + ret += $"{ Indentify(Sneak) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLFG = "; + try { + ret += $"{ Indentify(LFG) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tInvisible = "; + try { + ret += $"{ Indentify(Invisible) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGM = "; + try { + ret += $"{ Indentify(GM) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRoleplay = "; + try { + ret += $"{ Indentify(Roleplay) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGender = "; + try { + ret += $"{ Indentify(Gender) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLinkdead = "; + try { + ret += $"{ Indentify(Linkdead) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBetaBuffed = "; + try { + ret += $"{ Indentify(BetaBuffed) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tShowHelm = "; + try { + ret += $"{ Indentify(ShowHelm) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTargetable = "; + try { + ret += $"{ Indentify(Targetable) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHotkeyTargetable = "; + try { + ret += $"{ Indentify(HotkeyTargetable) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tShowName = "; + try { + ret += $"{ Indentify(ShowName) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStatue = "; + try { + ret += $"{ Indentify(Statue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTrader = "; + try { + ret += $"{ Indentify(Trader) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBuyer = "; + try { + ret += $"{ Indentify(Buyer) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct UpdatePosition : IEQStruct { + public short DeltaX; + public short DeltaHeading; + public short DeltaY; + public int Y; + public short Animation; + public ushort Heading; + public int X; + public int Z; + public short DeltaZ; + + public UpdatePosition(short DeltaX, short DeltaHeading, short DeltaY, int Y, short Animation, ushort Heading, int X, int Z, short DeltaZ) : this() { + this.DeltaX = DeltaX; + this.DeltaHeading = DeltaHeading; + this.DeltaY = DeltaY; + this.Y = Y; + this.Animation = Animation; + this.Heading = Heading; + this.X = X; + this.Z = Z; + this.DeltaZ = DeltaZ; + } + + public UpdatePosition(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public UpdatePosition(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ulong _databuf; + _databuf = br.ReadUInt64(); + DeltaX = (short) (((int) ((_databuf >> 12) & 0x1FFF) ^ 0x1000) - 0x1000); + DeltaHeading = (short) (((int) ((_databuf >> 32) & 0x3FF) ^ 0x200) - 0x200); + DeltaY = (short) (((int) ((_databuf >> 42) & 0x1FFF) ^ 0x1000) - 0x1000); + _databuf = br.ReadUInt64(); + Y = (int) (((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000); + Animation = (short) (((int) ((_databuf >> 19) & 0x3FF) ^ 0x200) - 0x200); + Heading = (ushort) ((_databuf >> 32) & 0xFFF); + X = (int) (((int) ((_databuf >> 44) & 0x7FFFF) ^ 0x40000) - 0x40000); + _databuf = br.ReadUInt32(); + Z = (int) (((int) (_databuf & 0x7FFFF) ^ 0x40000) - 0x40000); + DeltaZ = (short) (((int) ((_databuf >> 19) & 0x1FFF) ^ 0x1000) - 0x1000); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + } + + public override string ToString() { + var ret = "bitfield UpdatePosition {\n"; + ret += "\tDeltaX = "; + try { + ret += $"{ Indentify(DeltaX) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaHeading = "; + try { + ret += $"{ Indentify(DeltaHeading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaY = "; + try { + ret += $"{ Indentify(DeltaY) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tY = "; + try { + ret += $"{ Indentify(Y) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAnimation = "; + try { + ret += $"{ Indentify(Animation) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tX = "; + try { + ret += $"{ Indentify(X) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZ = "; + try { + ret += $"{ Indentify(Z) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaZ = "; + try { + ret += $"{ Indentify(DeltaZ) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Tint : IEQStruct { + public byte Blue; + public byte Green; + public byte Red; + public byte UseTint; + + public Tint(byte Blue, byte Green, byte Red, byte UseTint) : this() { + this.Blue = Blue; + this.Green = Green; + this.Red = Red; + this.UseTint = UseTint; + } + + public Tint(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Tint(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Blue = br.ReadByte(); + Green = br.ReadByte(); + Red = br.ReadByte(); + UseTint = br.ReadByte(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Blue); + bw.Write(Green); + bw.Write(Red); + bw.Write(UseTint); + } + + public override string ToString() { + var ret = "struct Tint {\n"; + ret += "\tBlue = "; + try { + ret += $"{ Indentify(Blue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGreen = "; + try { + ret += $"{ Indentify(Green) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRed = "; + try { + ret += $"{ Indentify(Red) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tUseTint = "; + try { + ret += $"{ Indentify(UseTint) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PlayerPositionUpdate : IEQStruct { + public ushort ID; + public UpdatePosition Position; + + public PlayerPositionUpdate(ushort ID, UpdatePosition Position) : this() { + this.ID = ID; + this.Position = Position; + } + + public PlayerPositionUpdate(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PlayerPositionUpdate(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ID = br.ReadUInt16(); + Position = new UpdatePosition(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(ID); + Position.Pack(bw); + } + + public override string ToString() { + var ret = "struct PlayerPositionUpdate {\n"; + ret += "\tID = "; + try { + ret += $"{ Indentify(ID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPosition = "; + try { + ret += $"{ Indentify(Position) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct ItemFaction : IEQStruct { + public uint Mod; + public int Amt; + + public ItemFaction(uint Mod, int Amt) : this() { + this.Mod = Mod; + this.Amt = Amt; + } + + public ItemFaction(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ItemFaction(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Mod = br.ReadUInt32(); + Amt = br.ReadInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Mod); + bw.Write(Amt); + } + + public override string ToString() { + var ret = "struct ItemFaction {\n"; + ret += "\tMod = "; + try { + ret += $"{ Indentify(Mod) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAmt = "; + try { + ret += $"{ Indentify(Amt) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Texture : IEQStruct { + public uint Material; + uint unknown1; + public uint EliteMaterial; + + public Texture(uint Material, uint EliteMaterial) : this() { + this.Material = Material; + this.EliteMaterial = EliteMaterial; + } + + public Texture(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Texture(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Material = br.ReadUInt32(); + unknown1 = br.ReadUInt32(); + EliteMaterial = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Material); + bw.Write(unknown1); + bw.Write(EliteMaterial); + } + + public override string ToString() { + var ret = "struct Texture {\n"; + ret += "\tMaterial = "; + try { + ret += $"{ Indentify(Material) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEliteMaterial = "; + try { + ret += $"{ Indentify(EliteMaterial) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct GenEffect : IEQStruct { + public int Effect; + public byte Level2; + public uint Type; + public byte Level; + public int MaxCharges; + public int CastTime; + public uint Recast; + public int RecastType; + public uint Procreate; + public string Name; + + public GenEffect(int Effect, byte Level2, uint Type, byte Level, int MaxCharges, int CastTime, uint Recast, int RecastType, uint Procreate, string Name) : this() { + this.Effect = Effect; + this.Level2 = Level2; + this.Type = Type; + this.Level = Level; + this.MaxCharges = MaxCharges; + this.CastTime = CastTime; + this.Recast = Recast; + this.RecastType = RecastType; + this.Procreate = Procreate; + this.Name = Name; + } + + public GenEffect(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public GenEffect(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Effect = br.ReadInt32(); + Level2 = br.ReadByte(); + Type = br.ReadUInt32(); + Level = br.ReadByte(); + MaxCharges = br.ReadInt32(); + CastTime = br.ReadInt32(); + Recast = br.ReadUInt32(); + RecastType = br.ReadInt32(); + Procreate = br.ReadUInt32(); + Name = br.ReadString(-1); + br.ReadBytes(4); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Effect); + bw.Write(Level2); + bw.Write(Type); + bw.Write(Level); + bw.Write(MaxCharges); + bw.Write(CastTime); + bw.Write(Recast); + bw.Write(RecastType); + bw.Write(Procreate); + bw.Write(Name.ToBytes()); + bw.Write(new byte[4]); + } + + public override string ToString() { + var ret = "struct GenEffect {\n"; + ret += "\tEffect = "; + try { + ret += $"{ Indentify(Effect) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel2 = "; + try { + ret += $"{ Indentify(Level2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tType = "; + try { + ret += $"{ Indentify(Type) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMaxCharges = "; + try { + ret += $"{ Indentify(MaxCharges) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCastTime = "; + try { + ret += $"{ Indentify(CastTime) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRecast = "; + try { + ret += $"{ Indentify(Recast) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRecastType = "; + try { + ret += $"{ Indentify(RecastType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tProcreate = "; + try { + ret += $"{ Indentify(Procreate) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct CompletedTasks : IEQStruct { + uint count; + public List Tasks; + + public CompletedTasks(List Tasks) : this() { + this.Tasks = Tasks; + } + + public CompletedTasks(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public CompletedTasks(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + count = br.ReadUInt32(); + Tasks = new List(); + for(var i = 0; i < count; ++i) { + Tasks.Add(new TaskInfo(br)); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(count); + for(var i = 0; i < count; ++i) { + Tasks[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct CompletedTasks {\n"; + ret += "\tTasks = "; + try { + ret += "{\n"; + for(int i = 0, e = Tasks.Count; i < e; ++i) + ret += $"\t\t{ Indentify(Tasks[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Tribute : IEQStruct { + public uint TributeID; + public uint Tier; + + public Tribute(uint TributeID, uint Tier) : this() { + this.TributeID = TributeID; + this.Tier = Tier; + } + + public Tribute(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Tribute(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + TributeID = br.ReadUInt32(); + Tier = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(TributeID); + bw.Write(Tier); + } + + public override string ToString() { + var ret = "struct Tribute {\n"; + ret += "\tTributeID = "; + try { + ret += $"{ Indentify(TributeID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTier = "; + try { + ret += $"{ Indentify(Tier) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TimeOfDay : IEQStruct { + public byte Hour; + public byte Minute; + public byte Day; + public byte Month; + public uint Year; + + public TimeOfDay(byte Hour, byte Minute, byte Day, byte Month, uint Year) : this() { + this.Hour = Hour; + this.Minute = Minute; + this.Day = Day; + this.Month = Month; + this.Year = Year; + } + + public TimeOfDay(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TimeOfDay(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Hour = br.ReadByte(); + Minute = br.ReadByte(); + Day = br.ReadByte(); + Month = br.ReadByte(); + Year = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Hour); + bw.Write(Minute); + bw.Write(Day); + bw.Write(Month); + bw.Write(Year); + } + + public override string ToString() { + var ret = "struct TimeOfDay {\n"; + ret += "\tHour = "; + try { + ret += $"{ Indentify(Hour) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMinute = "; + try { + ret += $"{ Indentify(Minute) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDay = "; + try { + ret += $"{ Indentify(Day) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMonth = "; + try { + ret += $"{ Indentify(Month) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tYear = "; + try { + ret += $"{ Indentify(Year) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct LdonPoints : IEQStruct { + public int Guk; + public int Mir; + public int Mmc; + public int Ruj; + public int Tak; + public int Available; + + public LdonPoints(int Guk, int Mir, int Mmc, int Ruj, int Tak, int Available) : this() { + this.Guk = Guk; + this.Mir = Mir; + this.Mmc = Mmc; + this.Ruj = Ruj; + this.Tak = Tak; + this.Available = Available; + } + + public LdonPoints(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public LdonPoints(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Guk = br.ReadInt32(); + Mir = br.ReadInt32(); + Mmc = br.ReadInt32(); + Ruj = br.ReadInt32(); + Tak = br.ReadInt32(); + Available = br.ReadInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Guk); + bw.Write(Mir); + bw.Write(Mmc); + bw.Write(Ruj); + bw.Write(Tak); + bw.Write(Available); + } + + public override string ToString() { + var ret = "struct LdonPoints {\n"; + ret += "\tGuk = "; + try { + ret += $"{ Indentify(Guk) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMir = "; + try { + ret += $"{ Indentify(Mir) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMmc = "; + try { + ret += $"{ Indentify(Mmc) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRuj = "; + try { + ret += $"{ Indentify(Ruj) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTak = "; + try { + ret += $"{ Indentify(Tak) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAvailable = "; + try { + ret += $"{ Indentify(Available) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Autoconsent : IEQStruct { + public bool Group; + public bool Raid; + public bool Guild; + + public Autoconsent(bool Group, bool Raid, bool Guild) : this() { + this.Group = Group; + this.Raid = Raid; + this.Guild = Guild; + } + + public Autoconsent(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Autoconsent(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Group = br.ReadByte() != 0; + Raid = br.ReadByte() != 0; + Guild = br.ReadByte() != 0; + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write((byte) (Group ? 1 : 0)); + bw.Write((byte) (Raid ? 1 : 0)); + bw.Write((byte) (Guild ? 1 : 0)); + } + + public override string ToString() { + var ret = "struct Autoconsent {\n"; + ret += "\tGroup = "; + try { + ret += $"{ Indentify(Group) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRaid = "; + try { + ret += $"{ Indentify(Raid) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuild = "; + try { + ret += $"{ Indentify(Guild) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TintProfile : IEQStruct { + public Tint Head; + public Tint Chest; + public Tint Arms; + public Tint Wrist; + public Tint Hands; + public Tint Legs; + public Tint Feet; + public Tint Primary; + public Tint Secondary; + + public TintProfile(Tint Head, Tint Chest, Tint Arms, Tint Wrist, Tint Hands, Tint Legs, Tint Feet, Tint Primary, Tint Secondary) : this() { + this.Head = Head; + this.Chest = Chest; + this.Arms = Arms; + this.Wrist = Wrist; + this.Hands = Hands; + this.Legs = Legs; + this.Feet = Feet; + this.Primary = Primary; + this.Secondary = Secondary; + } + + public TintProfile(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TintProfile(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Head = new Tint(br); + Chest = new Tint(br); + Arms = new Tint(br); + Wrist = new Tint(br); + Hands = new Tint(br); + Legs = new Tint(br); + Feet = new Tint(br); + Primary = new Tint(br); + Secondary = new Tint(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + Head.Pack(bw); + Chest.Pack(bw); + Arms.Pack(bw); + Wrist.Pack(bw); + Hands.Pack(bw); + Legs.Pack(bw); + Feet.Pack(bw); + Primary.Pack(bw); + Secondary.Pack(bw); + } + + public override string ToString() { + var ret = "struct TintProfile {\n"; + ret += "\tHead = "; + try { + ret += $"{ Indentify(Head) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tChest = "; + try { + ret += $"{ Indentify(Chest) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tArms = "; + try { + ret += $"{ Indentify(Arms) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWrist = "; + try { + ret += $"{ Indentify(Wrist) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHands = "; + try { + ret += $"{ Indentify(Hands) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLegs = "; + try { + ret += $"{ Indentify(Legs) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFeet = "; + try { + ret += $"{ Indentify(Feet) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPrimary = "; + try { + ret += $"{ Indentify(Primary) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSecondary = "; + try { + ret += $"{ Indentify(Secondary) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct AAArray : IEQStruct { + public uint AA; + public uint Value; + public uint Charges; + + public AAArray(uint AA, uint Value, uint Charges) : this() { + this.AA = AA; + this.Value = Value; + this.Charges = Charges; + } + + public AAArray(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public AAArray(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + AA = br.ReadUInt32(); + Value = br.ReadUInt32(); + Charges = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(AA); + bw.Write(Value); + bw.Write(Charges); + } + + public override string ToString() { + var ret = "struct AAArray {\n"; + ret += "\tAA = "; + try { + ret += $"{ Indentify(AA) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tValue = "; + try { + ret += $"{ Indentify(Value) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCharges = "; + try { + ret += $"{ Indentify(Charges) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct EvolvingItem : IEQStruct { + public int EvoLevel; + public double Progress; + public bool Activated; + public int EvoMaxLevel; + + public EvolvingItem(int EvoLevel, double Progress, bool Activated, int EvoMaxLevel) : this() { + this.EvoLevel = EvoLevel; + this.Progress = Progress; + this.Activated = Activated; + this.EvoMaxLevel = EvoMaxLevel; + } + + public EvolvingItem(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public EvolvingItem(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + br.ReadBytes(4); + EvoLevel = br.ReadInt32(); + Progress = br.ReadDouble(); + Activated = br.ReadByte() != 0; + EvoMaxLevel = br.ReadInt32(); + br.ReadBytes(4); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(new byte[4]); + bw.Write(EvoLevel); + bw.Write(Progress); + bw.Write((byte) (Activated ? 1 : 0)); + bw.Write(EvoMaxLevel); + bw.Write(new byte[4]); + } + + public override string ToString() { + var ret = "struct EvolvingItem {\n"; + ret += "\tEvoLevel = "; + try { + ret += $"{ Indentify(EvoLevel) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tProgress = "; + try { + ret += $"{ Indentify(Progress) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tActivated = "; + try { + ret += $"{ Indentify(Activated) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEvoMaxLevel = "; + try { + ret += $"{ Indentify(EvoMaxLevel) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Door : IEQStruct { + public string Name; + public float[] Position; + public float Heading; + public uint Incline; + public uint Size; + public byte DoorID; + public byte OpenType; + public byte StateAtSpawn; + public byte InvertState; + public uint Param; + + public Door(string Name, float[] Position, float Heading, uint Incline, uint Size, byte DoorID, byte OpenType, byte StateAtSpawn, byte InvertState, uint Param) : this() { + this.Name = Name; + this.Position = Position; + this.Heading = Heading; + this.Incline = Incline; + this.Size = Size; + this.DoorID = DoorID; + this.OpenType = OpenType; + this.StateAtSpawn = StateAtSpawn; + this.InvertState = InvertState; + this.Param = Param; + } + + public Door(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Door(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(32); + Position = new float[3]; + for(var i = 0; i < 3; ++i) { + Position[i] = br.ReadSingle(); + } + Heading = br.ReadSingle(); + Incline = br.ReadUInt32(); + Size = br.ReadUInt32(); + br.ReadBytes(4); + DoorID = br.ReadByte(); + OpenType = br.ReadByte(); + StateAtSpawn = br.ReadByte(); + InvertState = br.ReadByte(); + Param = br.ReadUInt32(); + br.ReadBytes(24); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(32)); + for(var i = 0; i < 3; ++i) { + bw.Write(Position[i]); + } + bw.Write(Heading); + bw.Write(Incline); + bw.Write(Size); + bw.Write(new byte[4]); + bw.Write(DoorID); + bw.Write(OpenType); + bw.Write(StateAtSpawn); + bw.Write(InvertState); + bw.Write(Param); + bw.Write(new byte[24]); + } + + public override string ToString() { + var ret = "struct Door {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPosition = "; + try { + ret += "{\n"; + for(int i = 0, e = Position.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Position[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIncline = "; + try { + ret += $"{ Indentify(Incline) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSize = "; + try { + ret += $"{ Indentify(Size) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDoorID = "; + try { + ret += $"{ Indentify(DoorID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tOpenType = "; + try { + ret += $"{ Indentify(OpenType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStateAtSpawn = "; + try { + ret += $"{ Indentify(StateAtSpawn) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tInvertState = "; + try { + ret += $"{ Indentify(InvertState) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tParam = "; + try { + ret += $"{ Indentify(Param) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct CharInventory : IEQStruct { + public uint ItemCount; + public SerializedItem[] Items; + + public CharInventory(uint ItemCount, SerializedItem[] Items) : this() { + this.ItemCount = ItemCount; + this.Items = Items; + } + + public CharInventory(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public CharInventory(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ItemCount = br.ReadUInt32(); + Items = new SerializedItem[ItemCount]; + for(var i = 0; i < ItemCount; ++i) { + Items[i] = new SerializedItem(br); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(ItemCount); + for(var i = 0; i < ItemCount; ++i) { + Items[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct CharInventory {\n"; + ret += "\tItemCount = "; + try { + ret += $"{ Indentify(ItemCount) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tItems = "; + try { + ret += "{\n"; + for(int i = 0, e = Items.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Items[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SerializedItem : IEQStruct { + public uint StackSize; + public uint Slot; + public uint Price; + public uint MerchantSlot; + public uint ScaledValue; + public uint InstanceID; + public uint LastCastTime; + public uint Charges; + bool _IsNoDrop; + public bool IsEvolving; + public EvolvingItem Evolution; + public string OrnamentIconFile; + public ushort OrnamentIcon; + public bool IsCopied; + public byte ItemClass; + public string Name; + public string Lore; + public string IDFile; + public uint ID; + public byte Weight; + public bool IsNoRent; + public bool IsNoDrop; + public byte Attune; + public byte Size; + public uint Slots; + public uint Price2; + public uint Icon; + public uint BenefitFlag; + public byte TradeSkills; + public sbyte CR; + public sbyte DR; + public sbyte PR; + public sbyte MR; + public sbyte FR; + public sbyte SVCorruption; + public sbyte AStr; + public sbyte ASta; + public sbyte AAgi; + public sbyte ADex; + public sbyte ACha; + public sbyte AInt; + public sbyte AWis; + public int HP; + public int Mana; + public uint End; + public int AC; + public int Regen; + public int ManaRegen; + public int EndRegen; + public uint Classes; + public uint Races; + public uint Deity; + public int SkillModValue; + public uint SkillModMax; + public uint SkillModType; + public uint BaneDmgRace; + public uint BaneDmgBody; + public uint BaneDmgRaceAmt; + public int BaneDmgAmt; + public byte Magic; + public int CastTime; + public uint ReqLevel; + public uint RecLevel; + public uint RecSkill; + public uint BardType; + public int BardValue; + public byte Light; + public byte Delay; + public byte ElemDmgType; + public byte ElemDmgAmt; + public byte Range; + public uint Damage; + public uint Color; + public byte ItemType; + public uint Material; + public uint EliteMaterial; + public float SellRate; + public int CombatEffects; + public int Shielding; + public int StunResist; + public int StrikeThrough; + public int ExtraDmgSkill; + public int ExtraDmgAmt; + public int SpellShield; + public int Avoidance; + public int Accuracy; + public uint CharmFileID; + public ItemFaction[] Factions; + public string CharmFile; + public uint AugType; + public uint AugRestrict; + public AugSlot[] AugSlots; + public uint LdonPointType; + public uint LdonTheme; + public uint LdonPrice; + public uint LdonSellbackRate; + public uint LdonSold; + public byte BagType; + public byte BagSlots; + public byte BagSize; + public byte WeightReduction; + public byte Book; + public byte BookType; + public string Filename; + public int LoreGroup; + public byte Artifact; + public byte SummonedFlag; + public uint Favor; + public byte FvNoDrop; + public int DotShield; + public int Atk; + public int Haste; + public int DamageShield; + public uint GuildFavor; + public uint AugDistil; + public bool NoPet; + public byte PotionBeltEnabled; + public uint PotionBeltSlots; + public uint StackSize2; + public byte NoTransfer; + public ushort ExpendableArrow; + public GenEffect ClickEffect; + public GenEffect ProcEffect; + public GenEffect[] WornEffects; + public uint ScriptFileID; + public byte QuestItem; + public uint Purity; + public uint BackstabDmg; + public uint DSMitigation; + public int HeroicStr; + public int HeroicInt; + public int HeroicWis; + public int HeroicAgi; + public int HeroicDex; + public int HeroicSta; + public int HeroicCha; + public int HeroicMR; + public int HeroicFR; + public int HeroicCR; + public int HeroicDR; + public int HeroicPR; + public int HeroicSVCorrupt; + public int HealAmt; + public int SpellDmg; + public int Clairvoyance; + public uint EvolveString; + public uint SubItemCount; + public SerializedItem[] SubItems; + + public SerializedItem(uint StackSize, uint Slot, uint Price, uint MerchantSlot, uint ScaledValue, uint InstanceID, uint LastCastTime, uint Charges, bool IsEvolving, EvolvingItem Evolution, string OrnamentIconFile, ushort OrnamentIcon, bool IsCopied, byte ItemClass, string Name, string Lore, string IDFile, uint ID, byte Weight, bool IsNoRent, bool IsNoDrop, byte Attune, byte Size, uint Slots, uint Price2, uint Icon, uint BenefitFlag, byte TradeSkills, sbyte CR, sbyte DR, sbyte PR, sbyte MR, sbyte FR, sbyte SVCorruption, sbyte AStr, sbyte ASta, sbyte AAgi, sbyte ADex, sbyte ACha, sbyte AInt, sbyte AWis, int HP, int Mana, uint End, int AC, int Regen, int ManaRegen, int EndRegen, uint Classes, uint Races, uint Deity, int SkillModValue, uint SkillModMax, uint SkillModType, uint BaneDmgRace, uint BaneDmgBody, uint BaneDmgRaceAmt, int BaneDmgAmt, byte Magic, int CastTime, uint ReqLevel, uint RecLevel, uint RecSkill, uint BardType, int BardValue, byte Light, byte Delay, byte ElemDmgType, byte ElemDmgAmt, byte Range, uint Damage, uint Color, byte ItemType, uint Material, uint EliteMaterial, float SellRate, int CombatEffects, int Shielding, int StunResist, int StrikeThrough, int ExtraDmgSkill, int ExtraDmgAmt, int SpellShield, int Avoidance, int Accuracy, uint CharmFileID, ItemFaction[] Factions, string CharmFile, uint AugType, uint AugRestrict, AugSlot[] AugSlots, uint LdonPointType, uint LdonTheme, uint LdonPrice, uint LdonSellbackRate, uint LdonSold, byte BagType, byte BagSlots, byte BagSize, byte WeightReduction, byte Book, byte BookType, string Filename, int LoreGroup, byte Artifact, byte SummonedFlag, uint Favor, byte FvNoDrop, int DotShield, int Atk, int Haste, int DamageShield, uint GuildFavor, uint AugDistil, bool NoPet, byte PotionBeltEnabled, uint PotionBeltSlots, uint StackSize2, byte NoTransfer, ushort ExpendableArrow, GenEffect ClickEffect, GenEffect ProcEffect, GenEffect[] WornEffects, uint ScriptFileID, byte QuestItem, uint Purity, uint BackstabDmg, uint DSMitigation, int HeroicStr, int HeroicInt, int HeroicWis, int HeroicAgi, int HeroicDex, int HeroicSta, int HeroicCha, int HeroicMR, int HeroicFR, int HeroicCR, int HeroicDR, int HeroicPR, int HeroicSVCorrupt, int HealAmt, int SpellDmg, int Clairvoyance, uint EvolveString, uint SubItemCount, SerializedItem[] SubItems) : this() { + this.StackSize = StackSize; + this.Slot = Slot; + this.Price = Price; + this.MerchantSlot = MerchantSlot; + this.ScaledValue = ScaledValue; + this.InstanceID = InstanceID; + this.LastCastTime = LastCastTime; + this.Charges = Charges; + this.IsEvolving = IsEvolving; + this.Evolution = Evolution; + this.OrnamentIconFile = OrnamentIconFile; + this.OrnamentIcon = OrnamentIcon; + this.IsCopied = IsCopied; + this.ItemClass = ItemClass; + this.Name = Name; + this.Lore = Lore; + this.IDFile = IDFile; + this.ID = ID; + this.Weight = Weight; + this.IsNoRent = IsNoRent; + this.IsNoDrop = IsNoDrop; + this.Attune = Attune; + this.Size = Size; + this.Slots = Slots; + this.Price2 = Price2; + this.Icon = Icon; + this.BenefitFlag = BenefitFlag; + this.TradeSkills = TradeSkills; + this.CR = CR; + this.DR = DR; + this.PR = PR; + this.MR = MR; + this.FR = FR; + this.SVCorruption = SVCorruption; + this.AStr = AStr; + this.ASta = ASta; + this.AAgi = AAgi; + this.ADex = ADex; + this.ACha = ACha; + this.AInt = AInt; + this.AWis = AWis; + this.HP = HP; + this.Mana = Mana; + this.End = End; + this.AC = AC; + this.Regen = Regen; + this.ManaRegen = ManaRegen; + this.EndRegen = EndRegen; + this.Classes = Classes; + this.Races = Races; + this.Deity = Deity; + this.SkillModValue = SkillModValue; + this.SkillModMax = SkillModMax; + this.SkillModType = SkillModType; + this.BaneDmgRace = BaneDmgRace; + this.BaneDmgBody = BaneDmgBody; + this.BaneDmgRaceAmt = BaneDmgRaceAmt; + this.BaneDmgAmt = BaneDmgAmt; + this.Magic = Magic; + this.CastTime = CastTime; + this.ReqLevel = ReqLevel; + this.RecLevel = RecLevel; + this.RecSkill = RecSkill; + this.BardType = BardType; + this.BardValue = BardValue; + this.Light = Light; + this.Delay = Delay; + this.ElemDmgType = ElemDmgType; + this.ElemDmgAmt = ElemDmgAmt; + this.Range = Range; + this.Damage = Damage; + this.Color = Color; + this.ItemType = ItemType; + this.Material = Material; + this.EliteMaterial = EliteMaterial; + this.SellRate = SellRate; + this.CombatEffects = CombatEffects; + this.Shielding = Shielding; + this.StunResist = StunResist; + this.StrikeThrough = StrikeThrough; + this.ExtraDmgSkill = ExtraDmgSkill; + this.ExtraDmgAmt = ExtraDmgAmt; + this.SpellShield = SpellShield; + this.Avoidance = Avoidance; + this.Accuracy = Accuracy; + this.CharmFileID = CharmFileID; + this.Factions = Factions; + this.CharmFile = CharmFile; + this.AugType = AugType; + this.AugRestrict = AugRestrict; + this.AugSlots = AugSlots; + this.LdonPointType = LdonPointType; + this.LdonTheme = LdonTheme; + this.LdonPrice = LdonPrice; + this.LdonSellbackRate = LdonSellbackRate; + this.LdonSold = LdonSold; + this.BagType = BagType; + this.BagSlots = BagSlots; + this.BagSize = BagSize; + this.WeightReduction = WeightReduction; + this.Book = Book; + this.BookType = BookType; + this.Filename = Filename; + this.LoreGroup = LoreGroup; + this.Artifact = Artifact; + this.SummonedFlag = SummonedFlag; + this.Favor = Favor; + this.FvNoDrop = FvNoDrop; + this.DotShield = DotShield; + this.Atk = Atk; + this.Haste = Haste; + this.DamageShield = DamageShield; + this.GuildFavor = GuildFavor; + this.AugDistil = AugDistil; + this.NoPet = NoPet; + this.PotionBeltEnabled = PotionBeltEnabled; + this.PotionBeltSlots = PotionBeltSlots; + this.StackSize2 = StackSize2; + this.NoTransfer = NoTransfer; + this.ExpendableArrow = ExpendableArrow; + this.ClickEffect = ClickEffect; + this.ProcEffect = ProcEffect; + this.WornEffects = WornEffects; + this.ScriptFileID = ScriptFileID; + this.QuestItem = QuestItem; + this.Purity = Purity; + this.BackstabDmg = BackstabDmg; + this.DSMitigation = DSMitigation; + this.HeroicStr = HeroicStr; + this.HeroicInt = HeroicInt; + this.HeroicWis = HeroicWis; + this.HeroicAgi = HeroicAgi; + this.HeroicDex = HeroicDex; + this.HeroicSta = HeroicSta; + this.HeroicCha = HeroicCha; + this.HeroicMR = HeroicMR; + this.HeroicFR = HeroicFR; + this.HeroicCR = HeroicCR; + this.HeroicDR = HeroicDR; + this.HeroicPR = HeroicPR; + this.HeroicSVCorrupt = HeroicSVCorrupt; + this.HealAmt = HealAmt; + this.SpellDmg = SpellDmg; + this.Clairvoyance = Clairvoyance; + this.EvolveString = EvolveString; + this.SubItemCount = SubItemCount; + this.SubItems = SubItems; + } + + public SerializedItem(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SerializedItem(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + StackSize = br.ReadUInt32(); + br.ReadBytes(4); + Slot = br.ReadUInt32(); + Price = br.ReadUInt32(); + MerchantSlot = br.ReadUInt32(); + ScaledValue = br.ReadUInt32(); + InstanceID = br.ReadUInt32(); + br.ReadBytes(4); + LastCastTime = br.ReadUInt32(); + Charges = br.ReadUInt32(); + _IsNoDrop = br.ReadUInt32() != 0; + br.ReadBytes(12); + IsEvolving = br.ReadByte() != 0; + if(IsEvolving) { + Evolution = new EvolvingItem(br); + } + OrnamentIconFile = br.ReadString(-1); + OrnamentIcon = br.ReadUInt16(); + br.ReadBytes(2); + IsCopied = br.ReadByte() != 0; + ItemClass = br.ReadByte(); + Name = br.ReadString(-1); + Lore = br.ReadString(-1); + IDFile = br.ReadString(-1); + ID = br.ReadUInt32(); + Weight = br.ReadByte(); + IsNoRent = br.ReadByte() != 0; + IsNoDrop = br.ReadByte() != 0; + Attune = br.ReadByte(); + Size = br.ReadByte(); + Slots = br.ReadUInt32(); + Price2 = br.ReadUInt32(); + Icon = br.ReadUInt32(); + br.ReadBytes(2); + BenefitFlag = br.ReadUInt32(); + TradeSkills = br.ReadByte(); + CR = br.ReadSByte(); + DR = br.ReadSByte(); + PR = br.ReadSByte(); + MR = br.ReadSByte(); + FR = br.ReadSByte(); + SVCorruption = br.ReadSByte(); + AStr = br.ReadSByte(); + ASta = br.ReadSByte(); + AAgi = br.ReadSByte(); + ADex = br.ReadSByte(); + ACha = br.ReadSByte(); + AInt = br.ReadSByte(); + AWis = br.ReadSByte(); + HP = br.ReadInt32(); + Mana = br.ReadInt32(); + End = br.ReadUInt32(); + AC = br.ReadInt32(); + Regen = br.ReadInt32(); + ManaRegen = br.ReadInt32(); + EndRegen = br.ReadInt32(); + Classes = br.ReadUInt32(); + Races = br.ReadUInt32(); + Deity = br.ReadUInt32(); + SkillModValue = br.ReadInt32(); + SkillModMax = br.ReadUInt32(); + SkillModType = br.ReadUInt32(); + BaneDmgRace = br.ReadUInt32(); + BaneDmgBody = br.ReadUInt32(); + BaneDmgRaceAmt = br.ReadUInt32(); + BaneDmgAmt = br.ReadInt32(); + Magic = br.ReadByte(); + CastTime = br.ReadInt32(); + ReqLevel = br.ReadUInt32(); + RecLevel = br.ReadUInt32(); + RecSkill = br.ReadUInt32(); + BardType = br.ReadUInt32(); + BardValue = br.ReadInt32(); + Light = br.ReadByte(); + Delay = br.ReadByte(); + ElemDmgType = br.ReadByte(); + ElemDmgAmt = br.ReadByte(); + Range = br.ReadByte(); + Damage = br.ReadUInt32(); + Color = br.ReadUInt32(); + ItemType = br.ReadByte(); + Material = br.ReadUInt32(); + br.ReadBytes(4); + EliteMaterial = br.ReadUInt32(); + SellRate = br.ReadSingle(); + CombatEffects = br.ReadInt32(); + Shielding = br.ReadInt32(); + StunResist = br.ReadInt32(); + StrikeThrough = br.ReadInt32(); + ExtraDmgSkill = br.ReadInt32(); + ExtraDmgAmt = br.ReadInt32(); + SpellShield = br.ReadInt32(); + Avoidance = br.ReadInt32(); + Accuracy = br.ReadInt32(); + CharmFileID = br.ReadUInt32(); + Factions = new ItemFaction[4]; + for(var i = 0; i < 4; ++i) { + Factions[i] = new ItemFaction(br); + } + CharmFile = br.ReadString(-1); + AugType = br.ReadUInt32(); + AugRestrict = br.ReadUInt32(); + AugSlots = new AugSlot[5]; + for(var i = 0; i < 5; ++i) { + AugSlots[i] = new AugSlot(br); + } + LdonPointType = br.ReadUInt32(); + LdonTheme = br.ReadUInt32(); + LdonPrice = br.ReadUInt32(); + LdonSellbackRate = br.ReadUInt32(); + LdonSold = br.ReadUInt32(); + BagType = br.ReadByte(); + BagSlots = br.ReadByte(); + BagSize = br.ReadByte(); + WeightReduction = br.ReadByte(); + Book = br.ReadByte(); + BookType = br.ReadByte(); + Filename = br.ReadString(-1); + LoreGroup = br.ReadInt32(); + Artifact = br.ReadByte(); + SummonedFlag = br.ReadByte(); + Favor = br.ReadUInt32(); + FvNoDrop = br.ReadByte(); + DotShield = br.ReadInt32(); + Atk = br.ReadInt32(); + Haste = br.ReadInt32(); + DamageShield = br.ReadInt32(); + GuildFavor = br.ReadUInt32(); + AugDistil = br.ReadUInt32(); + br.ReadBytes(8); + NoPet = br.ReadByte() != 0; + br.ReadBytes(1); + PotionBeltEnabled = br.ReadByte(); + PotionBeltSlots = br.ReadUInt32(); + StackSize2 = br.ReadUInt32(); + NoTransfer = br.ReadByte(); + ExpendableArrow = br.ReadUInt16(); + br.ReadBytes(4*4+3); + ClickEffect = new GenEffect(br); + ProcEffect = new GenEffect(br); + WornEffects = new GenEffect[4]; + for(var i = 0; i < 4; ++i) { + WornEffects[i] = new GenEffect(br); + } + ScriptFileID = br.ReadUInt32(); + QuestItem = br.ReadByte(); + br.ReadBytes(4); + Purity = br.ReadUInt32(); + BackstabDmg = br.ReadUInt32(); + DSMitigation = br.ReadUInt32(); + HeroicStr = br.ReadInt32(); + HeroicInt = br.ReadInt32(); + HeroicWis = br.ReadInt32(); + HeroicAgi = br.ReadInt32(); + HeroicDex = br.ReadInt32(); + HeroicSta = br.ReadInt32(); + HeroicCha = br.ReadInt32(); + HeroicMR = br.ReadInt32(); + HeroicFR = br.ReadInt32(); + HeroicCR = br.ReadInt32(); + HeroicDR = br.ReadInt32(); + HeroicPR = br.ReadInt32(); + HeroicSVCorrupt = br.ReadInt32(); + HealAmt = br.ReadInt32(); + SpellDmg = br.ReadInt32(); + Clairvoyance = br.ReadInt32(); + br.ReadBytes(1); + EvolveString = br.ReadUInt32(); + br.ReadBytes(1+4*3); + SubItemCount = br.ReadUInt32(); + SubItems = new SerializedItem[SubItemCount]; + for(var i = 0; i < SubItemCount; ++i) { + SubItems[i] = new SerializedItem(br); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(StackSize); + bw.Write(new byte[4]); + bw.Write(Slot); + bw.Write(Price); + bw.Write(MerchantSlot); + bw.Write(ScaledValue); + bw.Write(InstanceID); + bw.Write(new byte[4]); + bw.Write(LastCastTime); + bw.Write(Charges); + bw.Write((uint) (_IsNoDrop ? 1 : 0)); + bw.Write(new byte[12]); + bw.Write((byte) (IsEvolving ? 1 : 0)); + if(IsEvolving) { + Evolution.Pack(bw); + } + bw.Write(OrnamentIconFile.ToBytes()); + bw.Write(OrnamentIcon); + bw.Write(new byte[2]); + bw.Write((byte) (IsCopied ? 1 : 0)); + bw.Write(ItemClass); + bw.Write(Name.ToBytes()); + bw.Write(Lore.ToBytes()); + bw.Write(IDFile.ToBytes()); + bw.Write(ID); + bw.Write(Weight); + bw.Write((byte) (IsNoRent ? 1 : 0)); + bw.Write((byte) (IsNoDrop ? 1 : 0)); + bw.Write(Attune); + bw.Write(Size); + bw.Write(Slots); + bw.Write(Price2); + bw.Write(Icon); + bw.Write(new byte[2]); + bw.Write(BenefitFlag); + bw.Write(TradeSkills); + bw.Write(CR); + bw.Write(DR); + bw.Write(PR); + bw.Write(MR); + bw.Write(FR); + bw.Write(SVCorruption); + bw.Write(AStr); + bw.Write(ASta); + bw.Write(AAgi); + bw.Write(ADex); + bw.Write(ACha); + bw.Write(AInt); + bw.Write(AWis); + bw.Write(HP); + bw.Write(Mana); + bw.Write(End); + bw.Write(AC); + bw.Write(Regen); + bw.Write(ManaRegen); + bw.Write(EndRegen); + bw.Write(Classes); + bw.Write(Races); + bw.Write(Deity); + bw.Write(SkillModValue); + bw.Write(SkillModMax); + bw.Write(SkillModType); + bw.Write(BaneDmgRace); + bw.Write(BaneDmgBody); + bw.Write(BaneDmgRaceAmt); + bw.Write(BaneDmgAmt); + bw.Write(Magic); + bw.Write(CastTime); + bw.Write(ReqLevel); + bw.Write(RecLevel); + bw.Write(RecSkill); + bw.Write(BardType); + bw.Write(BardValue); + bw.Write(Light); + bw.Write(Delay); + bw.Write(ElemDmgType); + bw.Write(ElemDmgAmt); + bw.Write(Range); + bw.Write(Damage); + bw.Write(Color); + bw.Write(ItemType); + bw.Write(Material); + bw.Write(new byte[4]); + bw.Write(EliteMaterial); + bw.Write(SellRate); + bw.Write(CombatEffects); + bw.Write(Shielding); + bw.Write(StunResist); + bw.Write(StrikeThrough); + bw.Write(ExtraDmgSkill); + bw.Write(ExtraDmgAmt); + bw.Write(SpellShield); + bw.Write(Avoidance); + bw.Write(Accuracy); + bw.Write(CharmFileID); + for(var i = 0; i < 4; ++i) { + Factions[i].Pack(bw); + } + bw.Write(CharmFile.ToBytes()); + bw.Write(AugType); + bw.Write(AugRestrict); + for(var i = 0; i < 5; ++i) { + AugSlots[i].Pack(bw); + } + bw.Write(LdonPointType); + bw.Write(LdonTheme); + bw.Write(LdonPrice); + bw.Write(LdonSellbackRate); + bw.Write(LdonSold); + bw.Write(BagType); + bw.Write(BagSlots); + bw.Write(BagSize); + bw.Write(WeightReduction); + bw.Write(Book); + bw.Write(BookType); + bw.Write(Filename.ToBytes()); + bw.Write(LoreGroup); + bw.Write(Artifact); + bw.Write(SummonedFlag); + bw.Write(Favor); + bw.Write(FvNoDrop); + bw.Write(DotShield); + bw.Write(Atk); + bw.Write(Haste); + bw.Write(DamageShield); + bw.Write(GuildFavor); + bw.Write(AugDistil); + bw.Write(new byte[8]); + bw.Write((byte) (NoPet ? 1 : 0)); + bw.Write(new byte[1]); + bw.Write(PotionBeltEnabled); + bw.Write(PotionBeltSlots); + bw.Write(StackSize2); + bw.Write(NoTransfer); + bw.Write(ExpendableArrow); + bw.Write(new byte[4*4+3]); + ClickEffect.Pack(bw); + ProcEffect.Pack(bw); + for(var i = 0; i < 4; ++i) { + WornEffects[i].Pack(bw); + } + bw.Write(ScriptFileID); + bw.Write(QuestItem); + bw.Write(new byte[4]); + bw.Write(Purity); + bw.Write(BackstabDmg); + bw.Write(DSMitigation); + bw.Write(HeroicStr); + bw.Write(HeroicInt); + bw.Write(HeroicWis); + bw.Write(HeroicAgi); + bw.Write(HeroicDex); + bw.Write(HeroicSta); + bw.Write(HeroicCha); + bw.Write(HeroicMR); + bw.Write(HeroicFR); + bw.Write(HeroicCR); + bw.Write(HeroicDR); + bw.Write(HeroicPR); + bw.Write(HeroicSVCorrupt); + bw.Write(HealAmt); + bw.Write(SpellDmg); + bw.Write(Clairvoyance); + bw.Write(new byte[1]); + bw.Write(EvolveString); + bw.Write(new byte[1+4*3]); + bw.Write(SubItemCount); + for(var i = 0; i < SubItemCount; ++i) { + SubItems[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct SerializedItem {\n"; + ret += "\tStackSize = "; + try { + ret += $"{ Indentify(StackSize) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSlot = "; + try { + ret += $"{ Indentify(Slot) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPrice = "; + try { + ret += $"{ Indentify(Price) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMerchantSlot = "; + try { + ret += $"{ Indentify(MerchantSlot) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tScaledValue = "; + try { + ret += $"{ Indentify(ScaledValue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tInstanceID = "; + try { + ret += $"{ Indentify(InstanceID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastCastTime = "; + try { + ret += $"{ Indentify(LastCastTime) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCharges = "; + try { + ret += $"{ Indentify(Charges) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIsEvolving = "; + try { + ret += $"{ Indentify(IsEvolving) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + if(IsEvolving) { + ret += "\tEvolution = "; + try { + ret += $"{ Indentify(Evolution) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + ret += "\tOrnamentIconFile = "; + try { + ret += $"{ Indentify(OrnamentIconFile) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tOrnamentIcon = "; + try { + ret += $"{ Indentify(OrnamentIcon) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIsCopied = "; + try { + ret += $"{ Indentify(IsCopied) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tItemClass = "; + try { + ret += $"{ Indentify(ItemClass) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLore = "; + try { + ret += $"{ Indentify(Lore) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIDFile = "; + try { + ret += $"{ Indentify(IDFile) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tID = "; + try { + ret += $"{ Indentify(ID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWeight = "; + try { + ret += $"{ Indentify(Weight) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIsNoRent = "; + try { + ret += $"{ Indentify(IsNoRent) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIsNoDrop = "; + try { + ret += $"{ Indentify(IsNoDrop) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAttune = "; + try { + ret += $"{ Indentify(Attune) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSize = "; + try { + ret += $"{ Indentify(Size) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSlots = "; + try { + ret += $"{ Indentify(Slots) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPrice2 = "; + try { + ret += $"{ Indentify(Price2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIcon = "; + try { + ret += $"{ Indentify(Icon) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBenefitFlag = "; + try { + ret += $"{ Indentify(BenefitFlag) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTradeSkills = "; + try { + ret += $"{ Indentify(TradeSkills) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCR = "; + try { + ret += $"{ Indentify(CR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDR = "; + try { + ret += $"{ Indentify(DR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPR = "; + try { + ret += $"{ Indentify(PR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMR = "; + try { + ret += $"{ Indentify(MR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFR = "; + try { + ret += $"{ Indentify(FR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSVCorruption = "; + try { + ret += $"{ Indentify(SVCorruption) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAStr = "; + try { + ret += $"{ Indentify(AStr) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tASta = "; + try { + ret += $"{ Indentify(ASta) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAAgi = "; + try { + ret += $"{ Indentify(AAgi) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tADex = "; + try { + ret += $"{ Indentify(ADex) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tACha = "; + try { + ret += $"{ Indentify(ACha) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAInt = "; + try { + ret += $"{ Indentify(AInt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAWis = "; + try { + ret += $"{ Indentify(AWis) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHP = "; + try { + ret += $"{ Indentify(HP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMana = "; + try { + ret += $"{ Indentify(Mana) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEnd = "; + try { + ret += $"{ Indentify(End) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAC = "; + try { + ret += $"{ Indentify(AC) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRegen = "; + try { + ret += $"{ Indentify(Regen) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tManaRegen = "; + try { + ret += $"{ Indentify(ManaRegen) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEndRegen = "; + try { + ret += $"{ Indentify(EndRegen) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClasses = "; + try { + ret += $"{ Indentify(Classes) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRaces = "; + try { + ret += $"{ Indentify(Races) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeity = "; + try { + ret += $"{ Indentify(Deity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSkillModValue = "; + try { + ret += $"{ Indentify(SkillModValue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSkillModMax = "; + try { + ret += $"{ Indentify(SkillModMax) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSkillModType = "; + try { + ret += $"{ Indentify(SkillModType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBaneDmgRace = "; + try { + ret += $"{ Indentify(BaneDmgRace) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBaneDmgBody = "; + try { + ret += $"{ Indentify(BaneDmgBody) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBaneDmgRaceAmt = "; + try { + ret += $"{ Indentify(BaneDmgRaceAmt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBaneDmgAmt = "; + try { + ret += $"{ Indentify(BaneDmgAmt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMagic = "; + try { + ret += $"{ Indentify(Magic) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCastTime = "; + try { + ret += $"{ Indentify(CastTime) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tReqLevel = "; + try { + ret += $"{ Indentify(ReqLevel) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRecLevel = "; + try { + ret += $"{ Indentify(RecLevel) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRecSkill = "; + try { + ret += $"{ Indentify(RecSkill) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBardType = "; + try { + ret += $"{ Indentify(BardType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBardValue = "; + try { + ret += $"{ Indentify(BardValue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLight = "; + try { + ret += $"{ Indentify(Light) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDelay = "; + try { + ret += $"{ Indentify(Delay) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tElemDmgType = "; + try { + ret += $"{ Indentify(ElemDmgType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tElemDmgAmt = "; + try { + ret += $"{ Indentify(ElemDmgAmt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRange = "; + try { + ret += $"{ Indentify(Range) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDamage = "; + try { + ret += $"{ Indentify(Damage) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tColor = "; + try { + ret += $"{ Indentify(Color) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tItemType = "; + try { + ret += $"{ Indentify(ItemType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMaterial = "; + try { + ret += $"{ Indentify(Material) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEliteMaterial = "; + try { + ret += $"{ Indentify(EliteMaterial) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSellRate = "; + try { + ret += $"{ Indentify(SellRate) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCombatEffects = "; + try { + ret += $"{ Indentify(CombatEffects) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tShielding = "; + try { + ret += $"{ Indentify(Shielding) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStunResist = "; + try { + ret += $"{ Indentify(StunResist) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStrikeThrough = "; + try { + ret += $"{ Indentify(StrikeThrough) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tExtraDmgSkill = "; + try { + ret += $"{ Indentify(ExtraDmgSkill) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tExtraDmgAmt = "; + try { + ret += $"{ Indentify(ExtraDmgAmt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpellShield = "; + try { + ret += $"{ Indentify(SpellShield) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAvoidance = "; + try { + ret += $"{ Indentify(Avoidance) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAccuracy = "; + try { + ret += $"{ Indentify(Accuracy) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCharmFileID = "; + try { + ret += $"{ Indentify(CharmFileID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFactions = "; + try { + ret += "{\n"; + for(int i = 0, e = Factions.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Factions[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCharmFile = "; + try { + ret += $"{ Indentify(CharmFile) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAugType = "; + try { + ret += $"{ Indentify(AugType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAugRestrict = "; + try { + ret += $"{ Indentify(AugRestrict) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAugSlots = "; + try { + ret += "{\n"; + for(int i = 0, e = AugSlots.Length; i < e; ++i) + ret += $"\t\t{ Indentify(AugSlots[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonPointType = "; + try { + ret += $"{ Indentify(LdonPointType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonTheme = "; + try { + ret += $"{ Indentify(LdonTheme) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonPrice = "; + try { + ret += $"{ Indentify(LdonPrice) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonSellbackRate = "; + try { + ret += $"{ Indentify(LdonSellbackRate) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonSold = "; + try { + ret += $"{ Indentify(LdonSold) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBagType = "; + try { + ret += $"{ Indentify(BagType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBagSlots = "; + try { + ret += $"{ Indentify(BagSlots) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBagSize = "; + try { + ret += $"{ Indentify(BagSize) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWeightReduction = "; + try { + ret += $"{ Indentify(WeightReduction) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBook = "; + try { + ret += $"{ Indentify(Book) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBookType = "; + try { + ret += $"{ Indentify(BookType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFilename = "; + try { + ret += $"{ Indentify(Filename) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLoreGroup = "; + try { + ret += $"{ Indentify(LoreGroup) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tArtifact = "; + try { + ret += $"{ Indentify(Artifact) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSummonedFlag = "; + try { + ret += $"{ Indentify(SummonedFlag) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFavor = "; + try { + ret += $"{ Indentify(Favor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFvNoDrop = "; + try { + ret += $"{ Indentify(FvNoDrop) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDotShield = "; + try { + ret += $"{ Indentify(DotShield) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAtk = "; + try { + ret += $"{ Indentify(Atk) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHaste = "; + try { + ret += $"{ Indentify(Haste) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDamageShield = "; + try { + ret += $"{ Indentify(DamageShield) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildFavor = "; + try { + ret += $"{ Indentify(GuildFavor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAugDistil = "; + try { + ret += $"{ Indentify(AugDistil) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tNoPet = "; + try { + ret += $"{ Indentify(NoPet) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPotionBeltEnabled = "; + try { + ret += $"{ Indentify(PotionBeltEnabled) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPotionBeltSlots = "; + try { + ret += $"{ Indentify(PotionBeltSlots) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStackSize2 = "; + try { + ret += $"{ Indentify(StackSize2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tNoTransfer = "; + try { + ret += $"{ Indentify(NoTransfer) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tExpendableArrow = "; + try { + ret += $"{ Indentify(ExpendableArrow) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClickEffect = "; + try { + ret += $"{ Indentify(ClickEffect) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tProcEffect = "; + try { + ret += $"{ Indentify(ProcEffect) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWornEffects = "; + try { + ret += "{\n"; + for(int i = 0, e = WornEffects.Length; i < e; ++i) + ret += $"\t\t{ Indentify(WornEffects[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tScriptFileID = "; + try { + ret += $"{ Indentify(ScriptFileID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tQuestItem = "; + try { + ret += $"{ Indentify(QuestItem) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPurity = "; + try { + ret += $"{ Indentify(Purity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBackstabDmg = "; + try { + ret += $"{ Indentify(BackstabDmg) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDSMitigation = "; + try { + ret += $"{ Indentify(DSMitigation) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicStr = "; + try { + ret += $"{ Indentify(HeroicStr) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicInt = "; + try { + ret += $"{ Indentify(HeroicInt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicWis = "; + try { + ret += $"{ Indentify(HeroicWis) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicAgi = "; + try { + ret += $"{ Indentify(HeroicAgi) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicDex = "; + try { + ret += $"{ Indentify(HeroicDex) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicSta = "; + try { + ret += $"{ Indentify(HeroicSta) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicCha = "; + try { + ret += $"{ Indentify(HeroicCha) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicMR = "; + try { + ret += $"{ Indentify(HeroicMR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicFR = "; + try { + ret += $"{ Indentify(HeroicFR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicCR = "; + try { + ret += $"{ Indentify(HeroicCR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicDR = "; + try { + ret += $"{ Indentify(HeroicDR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicPR = "; + try { + ret += $"{ Indentify(HeroicPR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeroicSVCorrupt = "; + try { + ret += $"{ Indentify(HeroicSVCorrupt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHealAmt = "; + try { + ret += $"{ Indentify(HealAmt) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpellDmg = "; + try { + ret += $"{ Indentify(SpellDmg) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClairvoyance = "; + try { + ret += $"{ Indentify(Clairvoyance) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEvolveString = "; + try { + ret += $"{ Indentify(EvolveString) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSubItemCount = "; + try { + ret += $"{ Indentify(SubItemCount) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSubItems = "; + try { + ret += "{\n"; + for(int i = 0, e = SubItems.Length; i < e; ++i) + ret += $"\t\t{ Indentify(SubItems[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Bandolier : IEQStruct { + public string Name; + public PotionBandolierItem[] Items; + + public Bandolier(string Name, PotionBandolierItem[] Items) : this() { + this.Name = Name; + this.Items = Items; + } + + public Bandolier(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Bandolier(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(32); + Items = new PotionBandolierItem[BANDOLIER_ITEM_COUNT]; + for(var i = 0; i < BANDOLIER_ITEM_COUNT; ++i) { + Items[i] = new PotionBandolierItem(br); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(32)); + for(var i = 0; i < BANDOLIER_ITEM_COUNT; ++i) { + Items[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct Bandolier {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tItems = "; + try { + ret += "{\n"; + for(int i = 0, e = Items.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Items[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct GroupMember : IEQStruct { + public string Name; + + public GroupMember(string Name) : this() { + this.Name = Name; + } + + public GroupMember(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public GroupMember(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(64); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(64)); + } + + public override string ToString() { + var ret = "struct GroupMember {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct LeadershipAA : IEQStruct { + public SubLeadershipAA Group; + public SubLeadershipAA Raid; + + public LeadershipAA(SubLeadershipAA Group, SubLeadershipAA Raid) : this() { + this.Group = Group; + this.Raid = Raid; + } + + public LeadershipAA(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public LeadershipAA(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Group = new SubLeadershipAA(br); + Raid = new SubLeadershipAA(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + Group.Pack(bw); + Raid.Pack(bw); + } + + public override string ToString() { + var ret = "struct LeadershipAA {\n"; + ret += "\tGroup = "; + try { + ret += $"{ Indentify(Group) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRaid = "; + try { + ret += $"{ Indentify(Raid) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TributeTimer : IEQStruct { + public uint TimeLeft; + + public TributeTimer(uint TimeLeft) : this() { + this.TimeLeft = TimeLeft; + } + + public TributeTimer(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TributeTimer(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + TimeLeft = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(TimeLeft); + } + + public override string ToString() { + var ret = "struct TributeTimer {\n"; + ret += "\tTimeLeft = "; + try { + ret += $"{ Indentify(TimeLeft) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TextureProfile : IEQStruct { + public Texture Head; + public Texture Chest; + public Texture Arms; + public Texture Wrist; + public Texture Hands; + public Texture Legs; + public Texture Feet; + public Texture Primary; + public Texture Secondary; + + public TextureProfile(Texture Head, Texture Chest, Texture Arms, Texture Wrist, Texture Hands, Texture Legs, Texture Feet, Texture Primary, Texture Secondary) : this() { + this.Head = Head; + this.Chest = Chest; + this.Arms = Arms; + this.Wrist = Wrist; + this.Hands = Hands; + this.Legs = Legs; + this.Feet = Feet; + this.Primary = Primary; + this.Secondary = Secondary; + } + + public TextureProfile(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TextureProfile(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Head = new Texture(br); + Chest = new Texture(br); + Arms = new Texture(br); + Wrist = new Texture(br); + Hands = new Texture(br); + Legs = new Texture(br); + Feet = new Texture(br); + Primary = new Texture(br); + Secondary = new Texture(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + Head.Pack(bw); + Chest.Pack(bw); + Arms.Pack(bw); + Wrist.Pack(bw); + Hands.Pack(bw); + Legs.Pack(bw); + Feet.Pack(bw); + Primary.Pack(bw); + Secondary.Pack(bw); + } + + public override string ToString() { + var ret = "struct TextureProfile {\n"; + ret += "\tHead = "; + try { + ret += $"{ Indentify(Head) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tChest = "; + try { + ret += $"{ Indentify(Chest) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tArms = "; + try { + ret += $"{ Indentify(Arms) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWrist = "; + try { + ret += $"{ Indentify(Wrist) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHands = "; + try { + ret += $"{ Indentify(Hands) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLegs = "; + try { + ret += $"{ Indentify(Legs) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFeet = "; + try { + ret += $"{ Indentify(Feet) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPrimary = "; + try { + ret += $"{ Indentify(Primary) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSecondary = "; + try { + ret += $"{ Indentify(Secondary) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PVPStatsEntry : IEQStruct { + public string Name; + public uint Level; + public uint Race; + public uint Class; + public uint Zone; + public uint Time; + public uint Points; + + public PVPStatsEntry(string Name, uint Level, uint Race, uint Class, uint Zone, uint Time, uint Points) : this() { + this.Name = Name; + this.Level = Level; + this.Race = Race; + this.Class = Class; + this.Zone = Zone; + this.Time = Time; + this.Points = Points; + } + + public PVPStatsEntry(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PVPStatsEntry(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(64); + Level = br.ReadUInt32(); + Race = br.ReadUInt32(); + Class = br.ReadUInt32(); + Zone = br.ReadUInt32(); + Time = br.ReadUInt32(); + Points = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes(64)); + bw.Write(Level); + bw.Write(Race); + bw.Write(Class); + bw.Write(Zone); + bw.Write(Time); + bw.Write(Points); + } + + public override string ToString() { + var ret = "struct PVPStatsEntry {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZone = "; + try { + ret += $"{ Indentify(Zone) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTime = "; + try { + ret += $"{ Indentify(Time) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPoints = "; + try { + ret += $"{ Indentify(Points) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PotionBandolierItem : IEQStruct { + public uint ID; + public uint Icon; + public string Name; + + public PotionBandolierItem(uint ID, uint Icon, string Name) : this() { + this.ID = ID; + this.Icon = Icon; + this.Name = Name; + } + + public PotionBandolierItem(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PotionBandolierItem(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ID = br.ReadUInt32(); + Icon = br.ReadUInt32(); + Name = br.ReadString(64); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(ID); + bw.Write(Icon); + bw.Write(Name.ToBytes(64)); + } + + public override string ToString() { + var ret = "struct PotionBandolierItem {\n"; + ret += "\tID = "; + try { + ret += $"{ Indentify(ID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIcon = "; + try { + ret += $"{ Indentify(Icon) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PVPStats : IEQStruct { + public uint Kills; + public uint Deaths; + public uint CurrentPoints; + public uint CareerPoints; + public uint BestKillStreak; + public uint WorstDeathStreak; + public uint CurrentKillStreak; + public PVPStatsEntry LastKill; + public PVPStatsEntry LastDeath; + public uint KillsInLast24Hours; + public PVPStatsEntry[] RecentKills; + + public PVPStats(uint Kills, uint Deaths, uint CurrentPoints, uint CareerPoints, uint BestKillStreak, uint WorstDeathStreak, uint CurrentKillStreak, PVPStatsEntry LastKill, PVPStatsEntry LastDeath, uint KillsInLast24Hours, PVPStatsEntry[] RecentKills) : this() { + this.Kills = Kills; + this.Deaths = Deaths; + this.CurrentPoints = CurrentPoints; + this.CareerPoints = CareerPoints; + this.BestKillStreak = BestKillStreak; + this.WorstDeathStreak = WorstDeathStreak; + this.CurrentKillStreak = CurrentKillStreak; + this.LastKill = LastKill; + this.LastDeath = LastDeath; + this.KillsInLast24Hours = KillsInLast24Hours; + this.RecentKills = RecentKills; + } + + public PVPStats(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PVPStats(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Kills = br.ReadUInt32(); + Deaths = br.ReadUInt32(); + CurrentPoints = br.ReadUInt32(); + CareerPoints = br.ReadUInt32(); + BestKillStreak = br.ReadUInt32(); + WorstDeathStreak = br.ReadUInt32(); + CurrentKillStreak = br.ReadUInt32(); + LastKill = new PVPStatsEntry(br); + LastDeath = new PVPStatsEntry(br); + KillsInLast24Hours = br.ReadUInt32(); + RecentKills = new PVPStatsEntry[50]; + for(var i = 0; i < 50; ++i) { + RecentKills[i] = new PVPStatsEntry(br); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Kills); + bw.Write(Deaths); + bw.Write(CurrentPoints); + bw.Write(CareerPoints); + bw.Write(BestKillStreak); + bw.Write(WorstDeathStreak); + bw.Write(CurrentKillStreak); + LastKill.Pack(bw); + LastDeath.Pack(bw); + bw.Write(KillsInLast24Hours); + for(var i = 0; i < 50; ++i) { + RecentKills[i].Pack(bw); + } + } + + public override string ToString() { + var ret = "struct PVPStats {\n"; + ret += "\tKills = "; + try { + ret += $"{ Indentify(Kills) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeaths = "; + try { + ret += $"{ Indentify(Deaths) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurrentPoints = "; + try { + ret += $"{ Indentify(CurrentPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCareerPoints = "; + try { + ret += $"{ Indentify(CareerPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBestKillStreak = "; + try { + ret += $"{ Indentify(BestKillStreak) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWorstDeathStreak = "; + try { + ret += $"{ Indentify(WorstDeathStreak) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurrentKillStreak = "; + try { + ret += $"{ Indentify(CurrentKillStreak) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastKill = "; + try { + ret += $"{ Indentify(LastKill) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastDeath = "; + try { + ret += $"{ Indentify(LastDeath) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tKillsInLast24Hours = "; + try { + ret += $"{ Indentify(KillsInLast24Hours) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Bind : IEQStruct { + public uint ZoneID; + public float X; + public float Y; + public float Z; + public float Heading; + + public Bind(uint ZoneID, float X, float Y, float Z, float Heading) : this() { + this.ZoneID = ZoneID; + this.X = X; + this.Y = Y; + this.Z = Z; + this.Heading = Heading; + } + + public Bind(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Bind(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ZoneID = br.ReadUInt32(); + X = br.ReadSingle(); + Y = br.ReadSingle(); + Z = br.ReadSingle(); + Heading = br.ReadSingle(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(ZoneID); + bw.Write(X); + bw.Write(Y); + bw.Write(Z); + bw.Write(Heading); + } + + public override string ToString() { + var ret = "struct Bind {\n"; + ret += "\tZoneID = "; + try { + ret += $"{ Indentify(ZoneID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tX = "; + try { + ret += $"{ Indentify(X) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tY = "; + try { + ret += $"{ Indentify(Y) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZ = "; + try { + ret += $"{ Indentify(Z) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TributeInfo : IEQStruct { + public bool Active; + public uint[] Tributes; + public uint[] Tiers; + public uint TributeMasterID; + + public TributeInfo(bool Active, uint[] Tributes, uint[] Tiers, uint TributeMasterID) : this() { + this.Active = Active; + this.Tributes = Tributes; + this.Tiers = Tiers; + this.TributeMasterID = TributeMasterID; + } + + public TributeInfo(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TributeInfo(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Active = br.ReadUInt32() != 0; + Tributes = new uint[MAX_PLAYER_TRIBUTES]; + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + Tributes[i] = br.ReadUInt32(); + } + Tiers = new uint[MAX_PLAYER_TRIBUTES]; + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + Tiers[i] = br.ReadUInt32(); + } + TributeMasterID = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write((uint) (Active ? 1 : 0)); + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + bw.Write(Tributes[i]); + } + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + bw.Write(Tiers[i]); + } + bw.Write(TributeMasterID); + } + + public override string ToString() { + var ret = "struct TributeInfo {\n"; + ret += "\tActive = "; + try { + ret += $"{ Indentify(Active) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTributes = "; + try { + ret += "{\n"; + for(int i = 0, e = Tributes.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Tributes[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTiers = "; + try { + ret += "{\n"; + for(int i = 0, e = Tiers.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Tiers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTributeMasterID = "; + try { + ret += $"{ Indentify(TributeMasterID) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct PlayerProfile : IEQStruct { + uint checksum; + public Gender Gender; + public uint Race; + public uint Class; + public byte Level; + byte unkLevel; + public Bind[] Binds; + public uint Deity; + public uint Intoxication; + public uint[] SpellSlotRefresh; + public uint AbilitySlotRefresh; + public byte HairColor; + public byte BeardColor; + public byte EyeColor1; + public byte EyeColor2; + public byte HairStyle; + public byte Beard; + public TextureProfile Equipment; + public TintProfile ItemTint; + public AAArray[] AAArray; + public uint Points; + public uint Mana; + public uint CurHP; + public uint STR; + public uint STA; + public uint CHA; + public uint DEX; + public uint INT; + public uint AGI; + public uint WIS; + public byte Face; + public uint[] SpellBook; + public uint[] MemSpells; + public Money PlayerMoney; + public Money CursorMoney; + public uint[] Skills; + public uint Toxicity; + public uint Thirst; + public uint Hunger; + public SpellBuff[] Buffs; + public uint[] Disciplines; + public uint[] RecastTimers; + public uint Endurance; + public uint AAPointsSpent; + public uint AAPoints; + public Bandolier[] Bandoliers; + public PotionBandolierItem[] PotionBelt; + public uint AvailableSlots; + public string Name; + public string LastName; + public uint GuildID; + public uint Birthday; + public uint LastLogin; + public uint AccountStartdate; + public uint TimePlayed; + public bool PVP; + public Roleplay Roleplay; + public bool GM; + public GuildRank GuildRank; + public uint GuildBanker; + public uint Experience; + uint timeEntitledOnAccount; + public byte[] Languages; + public float X; + public float Y; + public float Z; + public float Heading; + public Money BankMoney; + public uint PlatinumShared; + uint expansions; + public bool Autosplit; + public ushort ZoneID; + public ushort ZoneInstance; + public GroupMember[] GroupMembers; + public string GroupLeader; + public uint EntityID; + public bool LeadAAActive; + public LdonPoints LdonPoints; + public float TributeTimeRemaining; + public uint CareerTributePoints; + public uint TributePoints; + public bool TributeActive; + public Tribute[] Tributes; + public double GroupLeadershipExp; + public double RaidLeadershipExp; + public uint GroupLeadershipPoints; + public uint RaidLeadershipPoints; + public LeadershipAA LeaderAbilities; + public uint AirRemaining; + public PVPStats PVPStats; + public uint AAExperience; + public uint CurrentRadCrystals; + public uint CareerRadCrystals; + public uint CurrentEbonCrystals; + public uint CareerEbonCrystals; + public Autoconsent Autoconsent; + public uint Level3; + public bool ShowHelm; + public uint RestTimer; + + public PlayerProfile(Gender Gender, uint Race, uint Class, byte Level, Bind[] Binds, uint Deity, uint Intoxication, uint[] SpellSlotRefresh, uint AbilitySlotRefresh, byte HairColor, byte BeardColor, byte EyeColor1, byte EyeColor2, byte HairStyle, byte Beard, TextureProfile Equipment, TintProfile ItemTint, AAArray[] AAArray, uint Points, uint Mana, uint CurHP, uint STR, uint STA, uint CHA, uint DEX, uint INT, uint AGI, uint WIS, byte Face, uint[] SpellBook, uint[] MemSpells, Money PlayerMoney, Money CursorMoney, uint[] Skills, uint Toxicity, uint Thirst, uint Hunger, SpellBuff[] Buffs, uint[] Disciplines, uint[] RecastTimers, uint Endurance, uint AAPointsSpent, uint AAPoints, Bandolier[] Bandoliers, PotionBandolierItem[] PotionBelt, uint AvailableSlots, string Name, string LastName, uint GuildID, uint Birthday, uint LastLogin, uint AccountStartdate, uint TimePlayed, bool PVP, Roleplay Roleplay, bool GM, GuildRank GuildRank, uint GuildBanker, uint Experience, byte[] Languages, float X, float Y, float Z, float Heading, Money BankMoney, uint PlatinumShared, bool Autosplit, ushort ZoneID, ushort ZoneInstance, GroupMember[] GroupMembers, string GroupLeader, uint EntityID, bool LeadAAActive, LdonPoints LdonPoints, float TributeTimeRemaining, uint CareerTributePoints, uint TributePoints, bool TributeActive, Tribute[] Tributes, double GroupLeadershipExp, double RaidLeadershipExp, uint GroupLeadershipPoints, uint RaidLeadershipPoints, LeadershipAA LeaderAbilities, uint AirRemaining, PVPStats PVPStats, uint AAExperience, uint CurrentRadCrystals, uint CareerRadCrystals, uint CurrentEbonCrystals, uint CareerEbonCrystals, Autoconsent Autoconsent, uint Level3, bool ShowHelm, uint RestTimer) : this() { + this.Gender = Gender; + this.Race = Race; + this.Class = Class; + this.Level = Level; + this.Binds = Binds; + this.Deity = Deity; + this.Intoxication = Intoxication; + this.SpellSlotRefresh = SpellSlotRefresh; + this.AbilitySlotRefresh = AbilitySlotRefresh; + this.HairColor = HairColor; + this.BeardColor = BeardColor; + this.EyeColor1 = EyeColor1; + this.EyeColor2 = EyeColor2; + this.HairStyle = HairStyle; + this.Beard = Beard; + this.Equipment = Equipment; + this.ItemTint = ItemTint; + this.AAArray = AAArray; + this.Points = Points; + this.Mana = Mana; + this.CurHP = CurHP; + this.STR = STR; + this.STA = STA; + this.CHA = CHA; + this.DEX = DEX; + this.INT = INT; + this.AGI = AGI; + this.WIS = WIS; + this.Face = Face; + this.SpellBook = SpellBook; + this.MemSpells = MemSpells; + this.PlayerMoney = PlayerMoney; + this.CursorMoney = CursorMoney; + this.Skills = Skills; + this.Toxicity = Toxicity; + this.Thirst = Thirst; + this.Hunger = Hunger; + this.Buffs = Buffs; + this.Disciplines = Disciplines; + this.RecastTimers = RecastTimers; + this.Endurance = Endurance; + this.AAPointsSpent = AAPointsSpent; + this.AAPoints = AAPoints; + this.Bandoliers = Bandoliers; + this.PotionBelt = PotionBelt; + this.AvailableSlots = AvailableSlots; + this.Name = Name; + this.LastName = LastName; + this.GuildID = GuildID; + this.Birthday = Birthday; + this.LastLogin = LastLogin; + this.AccountStartdate = AccountStartdate; + this.TimePlayed = TimePlayed; + this.PVP = PVP; + this.Roleplay = Roleplay; + this.GM = GM; + this.GuildRank = GuildRank; + this.GuildBanker = GuildBanker; + this.Experience = Experience; + this.Languages = Languages; + this.X = X; + this.Y = Y; + this.Z = Z; + this.Heading = Heading; + this.BankMoney = BankMoney; + this.PlatinumShared = PlatinumShared; + this.Autosplit = Autosplit; + this.ZoneID = ZoneID; + this.ZoneInstance = ZoneInstance; + this.GroupMembers = GroupMembers; + this.GroupLeader = GroupLeader; + this.EntityID = EntityID; + this.LeadAAActive = LeadAAActive; + this.LdonPoints = LdonPoints; + this.TributeTimeRemaining = TributeTimeRemaining; + this.CareerTributePoints = CareerTributePoints; + this.TributePoints = TributePoints; + this.TributeActive = TributeActive; + this.Tributes = Tributes; + this.GroupLeadershipExp = GroupLeadershipExp; + this.RaidLeadershipExp = RaidLeadershipExp; + this.GroupLeadershipPoints = GroupLeadershipPoints; + this.RaidLeadershipPoints = RaidLeadershipPoints; + this.LeaderAbilities = LeaderAbilities; + this.AirRemaining = AirRemaining; + this.PVPStats = PVPStats; + this.AAExperience = AAExperience; + this.CurrentRadCrystals = CurrentRadCrystals; + this.CareerRadCrystals = CareerRadCrystals; + this.CurrentEbonCrystals = CurrentEbonCrystals; + this.CareerEbonCrystals = CareerEbonCrystals; + this.Autoconsent = Autoconsent; + this.Level3 = Level3; + this.ShowHelm = ShowHelm; + this.RestTimer = RestTimer; + } + + public PlayerProfile(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public PlayerProfile(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + checksum = br.ReadUInt32(); + Gender = ((Gender) 0).Unpack(br); + Race = br.ReadUInt32(); + Class = br.ReadUInt32(); + br.ReadBytes(40); + Level = br.ReadByte(); + unkLevel = br.ReadByte(); + br.ReadBytes(2); + Binds = new Bind[5]; + for(var i = 0; i < 5; ++i) { + Binds[i] = new Bind(br); + } + Deity = br.ReadUInt32(); + Intoxication = br.ReadUInt32(); + SpellSlotRefresh = new uint[MAX_PP_MEMSPELL]; + for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { + SpellSlotRefresh[i] = br.ReadUInt32(); + } + br.ReadBytes(6); + AbilitySlotRefresh = br.ReadUInt32(); + HairColor = br.ReadByte(); + BeardColor = br.ReadByte(); + EyeColor1 = br.ReadByte(); + EyeColor2 = br.ReadByte(); + HairStyle = br.ReadByte(); + Beard = br.ReadByte(); + br.ReadBytes(4); + Equipment = new TextureProfile(br); + br.ReadBytes(168); + ItemTint = new TintProfile(br); + AAArray = new AAArray[MAX_PP_AA_ARRAY]; + for(var i = 0; i < MAX_PP_AA_ARRAY; ++i) { + AAArray[i] = new AAArray(br); + } + Points = br.ReadUInt32(); + Mana = br.ReadUInt32(); + CurHP = br.ReadUInt32(); + STR = br.ReadUInt32(); + STA = br.ReadUInt32(); + CHA = br.ReadUInt32(); + DEX = br.ReadUInt32(); + INT = br.ReadUInt32(); + AGI = br.ReadUInt32(); + WIS = br.ReadUInt32(); + br.ReadBytes(28); + Face = br.ReadByte(); + br.ReadBytes(147); + SpellBook = new uint[MAX_PP_SPELLBOOK]; + for(var i = 0; i < MAX_PP_SPELLBOOK; ++i) { + SpellBook[i] = br.ReadUInt32(); + } + MemSpells = new uint[MAX_PP_MEMSPELL]; + for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { + MemSpells[i] = br.ReadUInt32(); + } + br.ReadBytes(20); + PlayerMoney = new Money(br); + CursorMoney = new Money(br); + Skills = new uint[MAX_PP_SKILL]; + for(var i = 0; i < MAX_PP_SKILL; ++i) { + Skills[i] = br.ReadUInt32(); + } + br.ReadBytes(136); + Toxicity = br.ReadUInt32(); + Thirst = br.ReadUInt32(); + Hunger = br.ReadUInt32(); + Buffs = new SpellBuff[BUFF_COUNT]; + for(var i = 0; i < BUFF_COUNT; ++i) { + Buffs[i] = new SpellBuff(br); + } + Disciplines = new uint[MAX_PP_DISCIPLINES]; + for(var i = 0; i < MAX_PP_DISCIPLINES; ++i) { + Disciplines[i] = br.ReadUInt32(); + } + RecastTimers = new uint[MAX_RECAST_TYPES]; + for(var i = 0; i < MAX_RECAST_TYPES; ++i) { + RecastTimers[i] = br.ReadUInt32(); + } + br.ReadBytes(160); + Endurance = br.ReadUInt32(); + br.ReadBytes(20); + AAPointsSpent = br.ReadUInt32(); + AAPoints = br.ReadUInt32(); + br.ReadBytes(4); + Bandoliers = new Bandolier[BANDOLIERS_SIZE]; + for(var i = 0; i < BANDOLIERS_SIZE; ++i) { + Bandoliers[i] = new Bandolier(br); + } + PotionBelt = new PotionBandolierItem[POTIONBELT_SIZE]; + for(var i = 0; i < POTIONBELT_SIZE; ++i) { + PotionBelt[i] = new PotionBandolierItem(br); + } + br.ReadBytes(8); + AvailableSlots = br.ReadUInt32(); + br.ReadBytes(80); + Name = br.ReadString(64); + LastName = br.ReadString(32); + br.ReadBytes(8); + GuildID = br.ReadUInt32(); + Birthday = br.ReadUInt32(); + LastLogin = br.ReadUInt32(); + AccountStartdate = br.ReadUInt32(); + TimePlayed = br.ReadUInt32(); + PVP = br.ReadByte() != 0; + Roleplay = ((Roleplay) 0).Unpack(br); + GM = br.ReadByte() != 0; + GuildRank = ((GuildRank) 0).Unpack(br); + GuildBanker = br.ReadUInt32(); + br.ReadBytes(4); + Experience = br.ReadUInt32(); + br.ReadBytes(8); + timeEntitledOnAccount = br.ReadUInt32(); + Languages = new byte[MAX_PP_LANGUAGE]; + for(var i = 0; i < MAX_PP_LANGUAGE; ++i) { + Languages[i] = br.ReadByte(); + } + br.ReadBytes(7); + X = br.ReadSingle(); + Y = br.ReadSingle(); + Z = br.ReadSingle(); + Heading = br.ReadSingle(); + br.ReadBytes(4); + BankMoney = new Money(br); + PlatinumShared = br.ReadUInt32(); + br.ReadBytes(1036); + expansions = br.ReadUInt32(); + br.ReadBytes(12); + Autosplit = br.ReadUInt32() != 0; + br.ReadBytes(16); + ZoneID = br.ReadUInt16(); + ZoneInstance = br.ReadUInt16(); + GroupMembers = new GroupMember[MAX_GROUP_MEMBERS]; + for(var i = 0; i < MAX_GROUP_MEMBERS; ++i) { + GroupMembers[i] = new GroupMember(br); + } + GroupLeader = br.ReadString(64); + br.ReadBytes(540); + EntityID = br.ReadUInt32(); + LeadAAActive = br.ReadUInt32() != 0; + br.ReadBytes(4); + LdonPoints = new LdonPoints(br); + br.ReadBytes(9*4+4+4*6+72); + TributeTimeRemaining = br.ReadSingle(); + CareerTributePoints = br.ReadUInt32(); + br.ReadBytes(4); + TributePoints = br.ReadUInt32(); + br.ReadBytes(4); + TributeActive = br.ReadUInt32() != 0; + Tributes = new Tribute[MAX_PLAYER_TRIBUTES]; + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + Tributes[i] = new Tribute(br); + } + br.ReadBytes(4); + GroupLeadershipExp = br.ReadDouble(); + RaidLeadershipExp = br.ReadDouble(); + GroupLeadershipPoints = br.ReadUInt32(); + RaidLeadershipPoints = br.ReadUInt32(); + LeaderAbilities = new LeadershipAA(br); + br.ReadBytes(128); + AirRemaining = br.ReadUInt32(); + PVPStats = new PVPStats(br); + AAExperience = br.ReadUInt32(); + br.ReadBytes(40); + CurrentRadCrystals = br.ReadUInt32(); + CareerRadCrystals = br.ReadUInt32(); + CurrentEbonCrystals = br.ReadUInt32(); + CareerEbonCrystals = br.ReadUInt32(); + Autoconsent = new Autoconsent(br); + br.ReadBytes(1); + Level3 = br.ReadUInt32(); + ShowHelm = br.ReadUInt32() != 0; + RestTimer = br.ReadUInt32(); + br.ReadBytes(1036); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(checksum); + bw.Write((uint) Gender); + bw.Write(Race); + bw.Write(Class); + bw.Write(new byte[40]); + bw.Write(Level); + bw.Write(unkLevel); + bw.Write(new byte[2]); + for(var i = 0; i < 5; ++i) { + Binds[i].Pack(bw); + } + bw.Write(Deity); + bw.Write(Intoxication); + for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { + bw.Write(SpellSlotRefresh[i]); + } + bw.Write(new byte[6]); + bw.Write(AbilitySlotRefresh); + bw.Write(HairColor); + bw.Write(BeardColor); + bw.Write(EyeColor1); + bw.Write(EyeColor2); + bw.Write(HairStyle); + bw.Write(Beard); + bw.Write(new byte[4]); + Equipment.Pack(bw); + bw.Write(new byte[168]); + ItemTint.Pack(bw); + for(var i = 0; i < MAX_PP_AA_ARRAY; ++i) { + AAArray[i].Pack(bw); + } + bw.Write(Points); + bw.Write(Mana); + bw.Write(CurHP); + bw.Write(STR); + bw.Write(STA); + bw.Write(CHA); + bw.Write(DEX); + bw.Write(INT); + bw.Write(AGI); + bw.Write(WIS); + bw.Write(new byte[28]); + bw.Write(Face); + bw.Write(new byte[147]); + for(var i = 0; i < MAX_PP_SPELLBOOK; ++i) { + bw.Write(SpellBook[i]); + } + for(var i = 0; i < MAX_PP_MEMSPELL; ++i) { + bw.Write(MemSpells[i]); + } + bw.Write(new byte[20]); + PlayerMoney.Pack(bw); + CursorMoney.Pack(bw); + for(var i = 0; i < MAX_PP_SKILL; ++i) { + bw.Write(Skills[i]); + } + bw.Write(new byte[136]); + bw.Write(Toxicity); + bw.Write(Thirst); + bw.Write(Hunger); + for(var i = 0; i < BUFF_COUNT; ++i) { + Buffs[i].Pack(bw); + } + for(var i = 0; i < MAX_PP_DISCIPLINES; ++i) { + bw.Write(Disciplines[i]); + } + for(var i = 0; i < MAX_RECAST_TYPES; ++i) { + bw.Write(RecastTimers[i]); + } + bw.Write(new byte[160]); + bw.Write(Endurance); + bw.Write(new byte[20]); + bw.Write(AAPointsSpent); + bw.Write(AAPoints); + bw.Write(new byte[4]); + for(var i = 0; i < BANDOLIERS_SIZE; ++i) { + Bandoliers[i].Pack(bw); + } + for(var i = 0; i < POTIONBELT_SIZE; ++i) { + PotionBelt[i].Pack(bw); + } + bw.Write(new byte[8]); + bw.Write(AvailableSlots); + bw.Write(new byte[80]); + bw.Write(Name.ToBytes(64)); + bw.Write(LastName.ToBytes(32)); + bw.Write(new byte[8]); + bw.Write(GuildID); + bw.Write(Birthday); + bw.Write(LastLogin); + bw.Write(AccountStartdate); + bw.Write(TimePlayed); + bw.Write((byte) (PVP ? 1 : 0)); + bw.Write((byte) Roleplay); + bw.Write((byte) (GM ? 1 : 0)); + bw.Write((sbyte) GuildRank); + bw.Write(GuildBanker); + bw.Write(new byte[4]); + bw.Write(Experience); + bw.Write(new byte[8]); + bw.Write(timeEntitledOnAccount); + for(var i = 0; i < MAX_PP_LANGUAGE; ++i) { + bw.Write(Languages[i]); + } + bw.Write(new byte[7]); + bw.Write(X); + bw.Write(Y); + bw.Write(Z); + bw.Write(Heading); + bw.Write(new byte[4]); + BankMoney.Pack(bw); + bw.Write(PlatinumShared); + bw.Write(new byte[1036]); + bw.Write(expansions); + bw.Write(new byte[12]); + bw.Write((uint) (Autosplit ? 1 : 0)); + bw.Write(new byte[16]); + bw.Write(ZoneID); + bw.Write(ZoneInstance); + for(var i = 0; i < MAX_GROUP_MEMBERS; ++i) { + GroupMembers[i].Pack(bw); + } + bw.Write(GroupLeader.ToBytes(64)); + bw.Write(new byte[540]); + bw.Write(EntityID); + bw.Write((uint) (LeadAAActive ? 1 : 0)); + bw.Write(new byte[4]); + LdonPoints.Pack(bw); + bw.Write(new byte[9*4+4+4*6+72]); + bw.Write(TributeTimeRemaining); + bw.Write(CareerTributePoints); + bw.Write(new byte[4]); + bw.Write(TributePoints); + bw.Write(new byte[4]); + bw.Write((uint) (TributeActive ? 1 : 0)); + for(var i = 0; i < MAX_PLAYER_TRIBUTES; ++i) { + Tributes[i].Pack(bw); + } + bw.Write(new byte[4]); + bw.Write(GroupLeadershipExp); + bw.Write(RaidLeadershipExp); + bw.Write(GroupLeadershipPoints); + bw.Write(RaidLeadershipPoints); + LeaderAbilities.Pack(bw); + bw.Write(new byte[128]); + bw.Write(AirRemaining); + PVPStats.Pack(bw); + bw.Write(AAExperience); + bw.Write(new byte[40]); + bw.Write(CurrentRadCrystals); + bw.Write(CareerRadCrystals); + bw.Write(CurrentEbonCrystals); + bw.Write(CareerEbonCrystals); + Autoconsent.Pack(bw); + bw.Write(new byte[1]); + bw.Write(Level3); + bw.Write((uint) (ShowHelm ? 1 : 0)); + bw.Write(RestTimer); + bw.Write(new byte[1036]); + } + + public override string ToString() { + var ret = "struct PlayerProfile {\n"; + ret += "\tGender = "; + try { + ret += $"{ Indentify(Gender) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBinds = "; + try { + ret += "{\n"; + for(int i = 0, e = Binds.Length; i < e; ++i) + ret += $"\t\t{ Indentify(Binds[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeity = "; + try { + ret += $"{ Indentify(Deity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tIntoxication = "; + try { + ret += $"{ Indentify(Intoxication) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAbilitySlotRefresh = "; + try { + ret += $"{ Indentify(AbilitySlotRefresh) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairColor = "; + try { + ret += $"{ Indentify(HairColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeardColor = "; + try { + ret += $"{ Indentify(BeardColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor1 = "; + try { + ret += $"{ Indentify(EyeColor1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor2 = "; + try { + ret += $"{ Indentify(EyeColor2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairStyle = "; + try { + ret += $"{ Indentify(HairStyle) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeard = "; + try { + ret += $"{ Indentify(Beard) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEquipment = "; + try { + ret += $"{ Indentify(Equipment) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tItemTint = "; + try { + ret += $"{ Indentify(ItemTint) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPoints = "; + try { + ret += $"{ Indentify(Points) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tMana = "; + try { + ret += $"{ Indentify(Mana) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurHP = "; + try { + ret += $"{ Indentify(CurHP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSTR = "; + try { + ret += $"{ Indentify(STR) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSTA = "; + try { + ret += $"{ Indentify(STA) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCHA = "; + try { + ret += $"{ Indentify(CHA) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDEX = "; + try { + ret += $"{ Indentify(DEX) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tINT = "; + try { + ret += $"{ Indentify(INT) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAGI = "; + try { + ret += $"{ Indentify(AGI) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWIS = "; + try { + ret += $"{ Indentify(WIS) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFace = "; + try { + ret += $"{ Indentify(Face) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPlayerMoney = "; + try { + ret += $"{ Indentify(PlayerMoney) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCursorMoney = "; + try { + ret += $"{ Indentify(CursorMoney) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tToxicity = "; + try { + ret += $"{ Indentify(Toxicity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tThirst = "; + try { + ret += $"{ Indentify(Thirst) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHunger = "; + try { + ret += $"{ Indentify(Hunger) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEndurance = "; + try { + ret += $"{ Indentify(Endurance) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAAPointsSpent = "; + try { + ret += $"{ Indentify(AAPointsSpent) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAAPoints = "; + try { + ret += $"{ Indentify(AAPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAvailableSlots = "; + try { + ret += $"{ Indentify(AvailableSlots) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastName = "; + try { + ret += $"{ Indentify(LastName) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildID = "; + try { + ret += $"{ Indentify(GuildID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBirthday = "; + try { + ret += $"{ Indentify(Birthday) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastLogin = "; + try { + ret += $"{ Indentify(LastLogin) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAccountStartdate = "; + try { + ret += $"{ Indentify(AccountStartdate) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTimePlayed = "; + try { + ret += $"{ Indentify(TimePlayed) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPVP = "; + try { + ret += $"{ Indentify(PVP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRoleplay = "; + try { + ret += $"{ Indentify(Roleplay) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGM = "; + try { + ret += $"{ Indentify(GM) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildRank = "; + try { + ret += $"{ Indentify(GuildRank) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildBanker = "; + try { + ret += $"{ Indentify(GuildBanker) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tExperience = "; + try { + ret += $"{ Indentify(Experience) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tX = "; + try { + ret += $"{ Indentify(X) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tY = "; + try { + ret += $"{ Indentify(Y) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZ = "; + try { + ret += $"{ Indentify(Z) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHeading = "; + try { + ret += $"{ Indentify(Heading) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBankMoney = "; + try { + ret += $"{ Indentify(BankMoney) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPlatinumShared = "; + try { + ret += $"{ Indentify(PlatinumShared) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAutosplit = "; + try { + ret += $"{ Indentify(Autosplit) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZoneID = "; + try { + ret += $"{ Indentify(ZoneID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZoneInstance = "; + try { + ret += $"{ Indentify(ZoneInstance) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGroupMembers = "; + try { + ret += "{\n"; + for(int i = 0, e = GroupMembers.Length; i < e; ++i) + ret += $"\t\t{ Indentify(GroupMembers[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t},\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGroupLeader = "; + try { + ret += $"{ Indentify(GroupLeader) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEntityID = "; + try { + ret += $"{ Indentify(EntityID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLeadAAActive = "; + try { + ret += $"{ Indentify(LeadAAActive) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLdonPoints = "; + try { + ret += $"{ Indentify(LdonPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTributeTimeRemaining = "; + try { + ret += $"{ Indentify(TributeTimeRemaining) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCareerTributePoints = "; + try { + ret += $"{ Indentify(CareerTributePoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTributePoints = "; + try { + ret += $"{ Indentify(TributePoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTributeActive = "; + try { + ret += $"{ Indentify(TributeActive) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGroupLeadershipExp = "; + try { + ret += $"{ Indentify(GroupLeadershipExp) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRaidLeadershipExp = "; + try { + ret += $"{ Indentify(RaidLeadershipExp) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGroupLeadershipPoints = "; + try { + ret += $"{ Indentify(GroupLeadershipPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRaidLeadershipPoints = "; + try { + ret += $"{ Indentify(RaidLeadershipPoints) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLeaderAbilities = "; + try { + ret += $"{ Indentify(LeaderAbilities) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAirRemaining = "; + try { + ret += $"{ Indentify(AirRemaining) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPVPStats = "; + try { + ret += $"{ Indentify(PVPStats) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAAExperience = "; + try { + ret += $"{ Indentify(AAExperience) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurrentRadCrystals = "; + try { + ret += $"{ Indentify(CurrentRadCrystals) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCareerRadCrystals = "; + try { + ret += $"{ Indentify(CareerRadCrystals) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurrentEbonCrystals = "; + try { + ret += $"{ Indentify(CurrentEbonCrystals) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCareerEbonCrystals = "; + try { + ret += $"{ Indentify(CareerEbonCrystals) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAutoconsent = "; + try { + ret += $"{ Indentify(Autoconsent) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel3 = "; + try { + ret += $"{ Indentify(Level3) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tShowHelm = "; + try { + ret += $"{ Indentify(ShowHelm) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRestTimer = "; + try { + ret += $"{ Indentify(RestTimer) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SpellBuff : IEQStruct { + public byte EffectType; + public byte Level; + public float BardModifier; + public uint SpellID; + public uint Duration; + public uint NumHits; + public uint CasterID; + public int[] SlotData; + + public SpellBuff(byte EffectType, byte Level, float BardModifier, uint SpellID, uint Duration, uint NumHits, uint CasterID, int[] SlotData) : this() { + this.EffectType = EffectType; + this.Level = Level; + this.BardModifier = BardModifier; + this.SpellID = SpellID; + this.Duration = Duration; + this.NumHits = NumHits; + this.CasterID = CasterID; + this.SlotData = SlotData; + } + + public SpellBuff(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SpellBuff(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + EffectType = br.ReadByte(); + Level = br.ReadByte(); + br.ReadBytes(2); + BardModifier = br.ReadSingle(); + SpellID = br.ReadUInt32(); + Duration = br.ReadUInt32(); + NumHits = br.ReadUInt32(); + CasterID = br.ReadUInt32(); + br.ReadBytes(4); + SlotData = new int[12]; + for(var i = 0; i < 12; ++i) { + SlotData[i] = br.ReadInt32(); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(EffectType); + bw.Write(Level); + bw.Write(new byte[2]); + bw.Write(BardModifier); + bw.Write(SpellID); + bw.Write(Duration); + bw.Write(NumHits); + bw.Write(CasterID); + bw.Write(new byte[4]); + for(var i = 0; i < 12; ++i) { + bw.Write(SlotData[i]); + } + } + + public override string ToString() { + var ret = "struct SpellBuff {\n"; + ret += "\tEffectType = "; + try { + ret += $"{ Indentify(EffectType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBardModifier = "; + try { + ret += $"{ Indentify(BardModifier) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpellID = "; + try { + ret += $"{ Indentify(SpellID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDuration = "; + try { + ret += $"{ Indentify(Duration) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tNumHits = "; + try { + ret += $"{ Indentify(NumHits) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCasterID = "; + try { + ret += $"{ Indentify(CasterID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSlotData = "; + try { + ret += "{\n"; + for(int i = 0, e = SlotData.Length; i < e; ++i) + ret += $"\t\t{ Indentify(SlotData[i], 2) }" + (i != e - 1 ? "," : "") + "\n"; + ret += "\t}\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct ClientPlayerPositionUpdate : IEQStruct { + public ushort ID; + public ushort Sequence; + uint unknown0004; + public float X; + public float Y; + public ClientUpdatePositionSub1 Sub1; + public float DeltaX; + public float DeltaY; + public float Z; + public float DeltaZ; + public ClientUpdatePositionSub2 Sub2; + + public ClientPlayerPositionUpdate(ushort ID, ushort Sequence, float X, float Y, ClientUpdatePositionSub1 Sub1, float DeltaX, float DeltaY, float Z, float DeltaZ, ClientUpdatePositionSub2 Sub2) : this() { + this.ID = ID; + this.Sequence = Sequence; + this.X = X; + this.Y = Y; + this.Sub1 = Sub1; + this.DeltaX = DeltaX; + this.DeltaY = DeltaY; + this.Z = Z; + this.DeltaZ = DeltaZ; + this.Sub2 = Sub2; + } + + public ClientPlayerPositionUpdate(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ClientPlayerPositionUpdate(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + ID = br.ReadUInt16(); + Sequence = br.ReadUInt16(); + unknown0004 = br.ReadUInt32(); + X = br.ReadSingle(); + Y = br.ReadSingle(); + Sub1 = new ClientUpdatePositionSub1(br); + DeltaX = br.ReadSingle(); + DeltaY = br.ReadSingle(); + Z = br.ReadSingle(); + DeltaZ = br.ReadSingle(); + Sub2 = new ClientUpdatePositionSub2(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(ID); + bw.Write(Sequence); + bw.Write(unknown0004); + bw.Write(X); + bw.Write(Y); + Sub1.Pack(bw); + bw.Write(DeltaX); + bw.Write(DeltaY); + bw.Write(Z); + bw.Write(DeltaZ); + Sub2.Pack(bw); + } + + public override string ToString() { + var ret = "struct ClientPlayerPositionUpdate {\n"; + ret += "\tID = "; + try { + ret += $"{ Indentify(ID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSequence = "; + try { + ret += $"{ Indentify(Sequence) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tX = "; + try { + ret += $"{ Indentify(X) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tY = "; + try { + ret += $"{ Indentify(Y) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSub1 = "; + try { + ret += $"{ Indentify(Sub1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaX = "; + try { + ret += $"{ Indentify(DeltaX) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaY = "; + try { + ret += $"{ Indentify(DeltaY) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZ = "; + try { + ret += $"{ Indentify(Z) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeltaZ = "; + try { + ret += $"{ Indentify(DeltaZ) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSub2 = "; + try { + ret += $"{ Indentify(Sub2) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TaskActivity : IEQStruct { + public uint SequenceNumber; + public uint TaskID; + public uint ActivityID; + public uint ActivityType; + public uint Optional; + public string Text1; + public string Text2; + public uint GoalCount; + public uint ZoneID; + public string Text3; + public uint DoneCount; + + public TaskActivity(uint SequenceNumber, uint TaskID, uint ActivityID, uint ActivityType, uint Optional, string Text1, string Text2, uint GoalCount, uint ZoneID, string Text3, uint DoneCount) : this() { + this.SequenceNumber = SequenceNumber; + this.TaskID = TaskID; + this.ActivityID = ActivityID; + this.ActivityType = ActivityType; + this.Optional = Optional; + this.Text1 = Text1; + this.Text2 = Text2; + this.GoalCount = GoalCount; + this.ZoneID = ZoneID; + this.Text3 = Text3; + this.DoneCount = DoneCount; + } + + public TaskActivity(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TaskActivity(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + SequenceNumber = br.ReadUInt32(); + br.ReadBytes(4); + TaskID = br.ReadUInt32(); + ActivityID = br.ReadUInt32(); + br.ReadBytes(4); + ActivityType = br.ReadUInt32(); + Optional = br.ReadUInt32(); + br.ReadBytes(4); + Text1 = br.ReadString(-1); + Text2 = br.ReadString(-1); + GoalCount = br.ReadUInt32(); + br.ReadBytes(8); + ZoneID = br.ReadUInt32(); + br.ReadBytes(4); + Text3 = br.ReadString(-1); + DoneCount = br.ReadUInt32(); + br.ReadBytes(4); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(SequenceNumber); + bw.Write(new byte[4]); + bw.Write(TaskID); + bw.Write(ActivityID); + bw.Write(new byte[4]); + bw.Write(ActivityType); + bw.Write(Optional); + bw.Write(new byte[4]); + bw.Write(Text1.ToBytes()); + bw.Write(Text2.ToBytes()); + bw.Write(GoalCount); + bw.Write(new byte[8]); + bw.Write(ZoneID); + bw.Write(new byte[4]); + bw.Write(Text3.ToBytes()); + bw.Write(DoneCount); + bw.Write(new byte[4]); + } + + public override string ToString() { + var ret = "struct TaskActivity {\n"; + ret += "\tSequenceNumber = "; + try { + ret += $"{ Indentify(SequenceNumber) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTaskID = "; + try { + ret += $"{ Indentify(TaskID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tActivityID = "; + try { + ret += $"{ Indentify(ActivityID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tActivityType = "; + try { + ret += $"{ Indentify(ActivityType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tOptional = "; + try { + ret += $"{ Indentify(Optional) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tText1 = "; + try { + ret += $"{ Indentify(Text1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tText2 = "; + try { + ret += $"{ Indentify(Text2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGoalCount = "; + try { + ret += $"{ Indentify(GoalCount) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tZoneID = "; + try { + ret += $"{ Indentify(ZoneID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tText3 = "; + try { + ret += $"{ Indentify(Text3) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDoneCount = "; + try { + ret += $"{ Indentify(DoneCount) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Spawn : IEQStruct { + public string Name; + public uint SpawnID; + public byte Level; + public CharType CharType; + public SpawnBitfields SpawnFlags; + public byte OtherFlags; + public float Size; + public byte Face; + public float WalkSpeed; + public float RunSpeed; + public Race Race; + public byte ShowName; + public uint BodyType; + public byte CurHP; + public byte HairColor; + public byte BeardColor; + public byte EyeColor1; + public byte EyeColor2; + public byte HairStyle; + public byte Beard; + public uint DrakkinHeritage; + public uint DrakkinTattoo; + public uint DrakkinDetails; + public byte Statue; + public uint Deity; + public uint GuildID; + public GuildRank GuildRank; + public byte Class; + public bool PVP; + public byte StandState; + public byte Light; + public byte FlyMode; + public byte EquipChest2; + public byte Helm; + public string LastName; + public AATitle AATitle; + public uint PetOwnerID; + public uint PlayerState; + public SpawnPosition Position; + public TintProfile EquipmentTint; + public TextureProfile Equipment; + public string Title; + public string Suffix; + public bool IsMercenary; + + public Spawn(string Name, uint SpawnID, byte Level, CharType CharType, SpawnBitfields SpawnFlags, byte OtherFlags, float Size, byte Face, float WalkSpeed, float RunSpeed, Race Race, byte ShowName, uint BodyType, byte CurHP, byte HairColor, byte BeardColor, byte EyeColor1, byte EyeColor2, byte HairStyle, byte Beard, uint DrakkinHeritage, uint DrakkinTattoo, uint DrakkinDetails, byte Statue, uint Deity, uint GuildID, GuildRank GuildRank, byte Class, bool PVP, byte StandState, byte Light, byte FlyMode, byte EquipChest2, byte Helm, string LastName, AATitle AATitle, uint PetOwnerID, uint PlayerState, SpawnPosition Position, TintProfile EquipmentTint, TextureProfile Equipment, string Title, string Suffix, bool IsMercenary) : this() { + this.Name = Name; + this.SpawnID = SpawnID; + this.Level = Level; + this.CharType = CharType; + this.SpawnFlags = SpawnFlags; + this.OtherFlags = OtherFlags; + this.Size = Size; + this.Face = Face; + this.WalkSpeed = WalkSpeed; + this.RunSpeed = RunSpeed; + this.Race = Race; + this.ShowName = ShowName; + this.BodyType = BodyType; + this.CurHP = CurHP; + this.HairColor = HairColor; + this.BeardColor = BeardColor; + this.EyeColor1 = EyeColor1; + this.EyeColor2 = EyeColor2; + this.HairStyle = HairStyle; + this.Beard = Beard; + this.DrakkinHeritage = DrakkinHeritage; + this.DrakkinTattoo = DrakkinTattoo; + this.DrakkinDetails = DrakkinDetails; + this.Statue = Statue; + this.Deity = Deity; + this.GuildID = GuildID; + this.GuildRank = GuildRank; + this.Class = Class; + this.PVP = PVP; + this.StandState = StandState; + this.Light = Light; + this.FlyMode = FlyMode; + this.EquipChest2 = EquipChest2; + this.Helm = Helm; + this.LastName = LastName; + this.AATitle = AATitle; + this.PetOwnerID = PetOwnerID; + this.PlayerState = PlayerState; + this.Position = Position; + this.EquipmentTint = EquipmentTint; + this.Equipment = Equipment; + this.Title = Title; + this.Suffix = Suffix; + this.IsMercenary = IsMercenary; + } + + public Spawn(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Spawn(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Name = br.ReadString(-1); + SpawnID = br.ReadUInt32(); + Level = br.ReadByte(); + br.ReadBytes(4); + CharType = ((CharType) 0).Unpack(br); + SpawnFlags = new SpawnBitfields(br); + OtherFlags = br.ReadByte(); + br.ReadBytes(8); + Size = br.ReadSingle(); + Face = br.ReadByte(); + WalkSpeed = br.ReadSingle(); + RunSpeed = br.ReadSingle(); + Race = ((Race) 0).Unpack(br); + ShowName = br.ReadByte(); + BodyType = br.ReadUInt32(); + CurHP = br.ReadByte(); + HairColor = br.ReadByte(); + BeardColor = br.ReadByte(); + EyeColor1 = br.ReadByte(); + EyeColor2 = br.ReadByte(); + HairStyle = br.ReadByte(); + Beard = br.ReadByte(); + DrakkinHeritage = br.ReadUInt32(); + DrakkinTattoo = br.ReadUInt32(); + DrakkinDetails = br.ReadUInt32(); + Statue = br.ReadByte(); + Deity = br.ReadUInt32(); + GuildID = br.ReadUInt32(); + GuildRank = ((GuildRank) 0).Unpack(br); + br.ReadBytes(3); + Class = br.ReadByte(); + PVP = br.ReadByte() != 0; + StandState = br.ReadByte(); + Light = br.ReadByte(); + FlyMode = br.ReadByte(); + EquipChest2 = br.ReadByte(); + br.ReadBytes(2); + Helm = br.ReadByte(); + LastName = br.ReadString(-1); + AATitle = ((AATitle) 0).Unpack(br); + br.ReadBytes(1); + PetOwnerID = br.ReadUInt32(); + br.ReadBytes(1); + PlayerState = br.ReadUInt32(); + br.ReadBytes(5*4); + Position = new SpawnPosition(br); + EquipmentTint = new TintProfile(br); + if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { + Equipment = new TextureProfile(br); + } + if((OtherFlags & 4) != 0) { + Title = br.ReadString(-1); + } + if((OtherFlags & 8) != 0) { + Suffix = br.ReadString(-1); + } + br.ReadBytes(8); + IsMercenary = br.ReadByte() != 0; + br.ReadBytes(28); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Name.ToBytes()); + bw.Write(SpawnID); + bw.Write(Level); + bw.Write(new byte[4]); + bw.Write((byte) CharType); + SpawnFlags.Pack(bw); + bw.Write(OtherFlags); + bw.Write(new byte[8]); + bw.Write(Size); + bw.Write(Face); + bw.Write(WalkSpeed); + bw.Write(RunSpeed); + bw.Write((uint) Race); + bw.Write(ShowName); + bw.Write(BodyType); + bw.Write(CurHP); + bw.Write(HairColor); + bw.Write(BeardColor); + bw.Write(EyeColor1); + bw.Write(EyeColor2); + bw.Write(HairStyle); + bw.Write(Beard); + bw.Write(DrakkinHeritage); + bw.Write(DrakkinTattoo); + bw.Write(DrakkinDetails); + bw.Write(Statue); + bw.Write(Deity); + bw.Write(GuildID); + bw.Write((sbyte) GuildRank); + bw.Write(new byte[3]); + bw.Write(Class); + bw.Write((byte) (PVP ? 1 : 0)); + bw.Write(StandState); + bw.Write(Light); + bw.Write(FlyMode); + bw.Write(EquipChest2); + bw.Write(new byte[2]); + bw.Write(Helm); + bw.Write(LastName.ToBytes()); + bw.Write((uint) AATitle); + bw.Write(new byte[1]); + bw.Write(PetOwnerID); + bw.Write(new byte[1]); + bw.Write(PlayerState); + bw.Write(new byte[5*4]); + Position.Pack(bw); + EquipmentTint.Pack(bw); + if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { + Equipment.Pack(bw); + } + if((OtherFlags & 4) != 0) { + bw.Write(Title.ToBytes()); + } + if((OtherFlags & 8) != 0) { + bw.Write(Suffix.ToBytes()); + } + bw.Write(new byte[8]); + bw.Write((byte) (IsMercenary ? 1 : 0)); + bw.Write(new byte[28]); + } + + public override string ToString() { + var ret = "struct Spawn {\n"; + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpawnID = "; + try { + ret += $"{ Indentify(SpawnID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLevel = "; + try { + ret += $"{ Indentify(Level) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCharType = "; + try { + ret += $"{ Indentify(CharType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpawnFlags = "; + try { + ret += $"{ Indentify(SpawnFlags) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tOtherFlags = "; + try { + ret += $"{ Indentify(OtherFlags) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSize = "; + try { + ret += $"{ Indentify(Size) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFace = "; + try { + ret += $"{ Indentify(Face) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tWalkSpeed = "; + try { + ret += $"{ Indentify(WalkSpeed) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRunSpeed = "; + try { + ret += $"{ Indentify(RunSpeed) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tShowName = "; + try { + ret += $"{ Indentify(ShowName) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBodyType = "; + try { + ret += $"{ Indentify(BodyType) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCurHP = "; + try { + ret += $"{ Indentify(CurHP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairColor = "; + try { + ret += $"{ Indentify(HairColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeardColor = "; + try { + ret += $"{ Indentify(BeardColor) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor1 = "; + try { + ret += $"{ Indentify(EyeColor1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEyeColor2 = "; + try { + ret += $"{ Indentify(EyeColor2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHairStyle = "; + try { + ret += $"{ Indentify(HairStyle) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tBeard = "; + try { + ret += $"{ Indentify(Beard) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinHeritage = "; + try { + ret += $"{ Indentify(DrakkinHeritage) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinTattoo = "; + try { + ret += $"{ Indentify(DrakkinTattoo) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDrakkinDetails = "; + try { + ret += $"{ Indentify(DrakkinDetails) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStatue = "; + try { + ret += $"{ Indentify(Statue) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDeity = "; + try { + ret += $"{ Indentify(Deity) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildID = "; + try { + ret += $"{ Indentify(GuildID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGuildRank = "; + try { + ret += $"{ Indentify(GuildRank) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPVP = "; + try { + ret += $"{ Indentify(PVP) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStandState = "; + try { + ret += $"{ Indentify(StandState) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLight = "; + try { + ret += $"{ Indentify(Light) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFlyMode = "; + try { + ret += $"{ Indentify(FlyMode) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEquipChest2 = "; + try { + ret += $"{ Indentify(EquipChest2) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHelm = "; + try { + ret += $"{ Indentify(Helm) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastName = "; + try { + ret += $"{ Indentify(LastName) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tAATitle = "; + try { + ret += $"{ Indentify(AATitle) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPetOwnerID = "; + try { + ret += $"{ Indentify(PetOwnerID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPlayerState = "; + try { + ret += $"{ Indentify(PlayerState) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPosition = "; + try { + ret += $"{ Indentify(Position) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEquipmentTint = "; + try { + ret += $"{ Indentify(EquipmentTint) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + if(CharType == CharType.PC || (int) Race == 12 || (int) Race == 128 || (int) Race == 130 || (int) Race == 330 || (int) Race == 522) { + ret += "\tEquipment = "; + try { + ret += $"{ Indentify(Equipment) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + if((OtherFlags & 4) != 0) { + ret += "\tTitle = "; + try { + ret += $"{ Indentify(Title) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + if((OtherFlags & 8) != 0) { + ret += "\tSuffix = "; + try { + ret += $"{ Indentify(Suffix) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + ret += "\tIsMercenary = "; + try { + ret += $"{ Indentify(IsMercenary) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct ClientZoneEntry : IEQStruct { + uint unk; + public string CharName; + + public ClientZoneEntry(string CharName) : this() { + this.CharName = CharName; + } + + public ClientZoneEntry(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public ClientZoneEntry(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + unk = br.ReadUInt32(); + CharName = br.ReadString(64); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(unk); + bw.Write(CharName.ToBytes(64)); + } + + public override string ToString() { + var ret = "struct ClientZoneEntry {\n"; + ret += "\tCharName = "; + try { + ret += $"{ Indentify(CharName) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct AugSlot : IEQStruct { + public uint Type; + public bool Visible; + + public AugSlot(uint Type, bool Visible) : this() { + this.Type = Type; + this.Visible = Visible; + } + + public AugSlot(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public AugSlot(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Type = br.ReadUInt32(); + Visible = br.ReadByte() != 0; + br.ReadBytes(1); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Type); + bw.Write((byte) (Visible ? 1 : 0)); + bw.Write(new byte[1]); + } + + public override string ToString() { + var ret = "struct AugSlot {\n"; + ret += "\tType = "; + try { + ret += $"{ Indentify(Type) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tVisible = "; + try { + ret += $"{ Indentify(Visible) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Money : IEQStruct { + public uint Platinum; + public uint Gold; + public uint Silver; + public uint Copper; + + public Money(uint Platinum, uint Gold, uint Silver, uint Copper) : this() { + this.Platinum = Platinum; + this.Gold = Gold; + this.Silver = Silver; + this.Copper = Copper; + } + + public Money(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Money(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Platinum = br.ReadUInt32(); + Gold = br.ReadUInt32(); + Silver = br.ReadUInt32(); + Copper = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Platinum); + bw.Write(Gold); + bw.Write(Silver); + bw.Write(Copper); + } + + public override string ToString() { + var ret = "struct Money {\n"; + ret += "\tPlatinum = "; + try { + ret += $"{ Indentify(Platinum) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tGold = "; + try { + ret += $"{ Indentify(Gold) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSilver = "; + try { + ret += $"{ Indentify(Silver) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCopper = "; + try { + ret += $"{ Indentify(Copper) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct SubLeadershipAA : IEQStruct { + public uint MarkNPC; + public uint NPCHealth; + public uint DelegateMainAssist; + public uint DelegateMarkNPC; + uint _4; + uint _5; + uint _6; + public uint SpellAwareness; + public uint OffenseEnhancement; + public uint ManaEnhancement; + public uint HealthEnhancement; + public uint HealthRegeneration; + public uint FindPathToPC; + public uint HealthOfTargetsTarget; + uint _14; + uint _15; + + public SubLeadershipAA(uint MarkNPC, uint NPCHealth, uint DelegateMainAssist, uint DelegateMarkNPC, uint SpellAwareness, uint OffenseEnhancement, uint ManaEnhancement, uint HealthEnhancement, uint HealthRegeneration, uint FindPathToPC, uint HealthOfTargetsTarget) : this() { + this.MarkNPC = MarkNPC; + this.NPCHealth = NPCHealth; + this.DelegateMainAssist = DelegateMainAssist; + this.DelegateMarkNPC = DelegateMarkNPC; + this.SpellAwareness = SpellAwareness; + this.OffenseEnhancement = OffenseEnhancement; + this.ManaEnhancement = ManaEnhancement; + this.HealthEnhancement = HealthEnhancement; + this.HealthRegeneration = HealthRegeneration; + this.FindPathToPC = FindPathToPC; + this.HealthOfTargetsTarget = HealthOfTargetsTarget; + } + + public SubLeadershipAA(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public SubLeadershipAA(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + MarkNPC = br.ReadUInt32(); + NPCHealth = br.ReadUInt32(); + DelegateMainAssist = br.ReadUInt32(); + DelegateMarkNPC = br.ReadUInt32(); + _4 = br.ReadUInt32(); + _5 = br.ReadUInt32(); + _6 = br.ReadUInt32(); + SpellAwareness = br.ReadUInt32(); + OffenseEnhancement = br.ReadUInt32(); + ManaEnhancement = br.ReadUInt32(); + HealthEnhancement = br.ReadUInt32(); + HealthRegeneration = br.ReadUInt32(); + FindPathToPC = br.ReadUInt32(); + HealthOfTargetsTarget = br.ReadUInt32(); + _14 = br.ReadUInt32(); + _15 = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(MarkNPC); + bw.Write(NPCHealth); + bw.Write(DelegateMainAssist); + bw.Write(DelegateMarkNPC); + bw.Write(_4); + bw.Write(_5); + bw.Write(_6); + bw.Write(SpellAwareness); + bw.Write(OffenseEnhancement); + bw.Write(ManaEnhancement); + bw.Write(HealthEnhancement); + bw.Write(HealthRegeneration); + bw.Write(FindPathToPC); + bw.Write(HealthOfTargetsTarget); + bw.Write(_14); + bw.Write(_15); + } + + public override string ToString() { + var ret = "struct SubLeadershipAA {\n"; + ret += "\tMarkNPC = "; + try { + ret += $"{ Indentify(MarkNPC) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tNPCHealth = "; + try { + ret += $"{ Indentify(NPCHealth) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDelegateMainAssist = "; + try { + ret += $"{ Indentify(DelegateMainAssist) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDelegateMarkNPC = "; + try { + ret += $"{ Indentify(DelegateMarkNPC) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tSpellAwareness = "; + try { + ret += $"{ Indentify(SpellAwareness) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tOffenseEnhancement = "; + try { + ret += $"{ Indentify(OffenseEnhancement) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tManaEnhancement = "; + try { + ret += $"{ Indentify(ManaEnhancement) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHealthEnhancement = "; + try { + ret += $"{ Indentify(HealthEnhancement) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHealthRegeneration = "; + try { + ret += $"{ Indentify(HealthRegeneration) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tFindPathToPC = "; + try { + ret += $"{ Indentify(FindPathToPC) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tHealthOfTargetsTarget = "; + try { + ret += $"{ Indentify(HealthOfTargetsTarget) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct TaskDescription : IEQStruct { + public uint SequenceNumber; + public uint TaskID; + public string Title; + public uint Duration; + public uint StartTime; + public string Description; + public uint RewardCount; + public string RewardText; + public uint Points; + + public TaskDescription(uint SequenceNumber, uint TaskID, string Title, uint Duration, uint StartTime, string Description, uint RewardCount, string RewardText, uint Points) : this() { + this.SequenceNumber = SequenceNumber; + this.TaskID = TaskID; + this.Title = Title; + this.Duration = Duration; + this.StartTime = StartTime; + this.Description = Description; + this.RewardCount = RewardCount; + this.RewardText = RewardText; + this.Points = Points; + } + + public TaskDescription(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TaskDescription(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + SequenceNumber = br.ReadUInt32(); + TaskID = br.ReadUInt32(); + br.ReadBytes(4*2+1); + Title = br.ReadString(-1); + Duration = br.ReadUInt32(); + br.ReadBytes(4); + StartTime = br.ReadUInt32(); + Description = br.ReadString(-1); + RewardCount = br.ReadUInt32(); + br.ReadBytes(4*2+2); + RewardText = br.ReadString(-1); + Points = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(SequenceNumber); + bw.Write(TaskID); + bw.Write(new byte[4*2+1]); + bw.Write(Title.ToBytes()); + bw.Write(Duration); + bw.Write(new byte[4]); + bw.Write(StartTime); + bw.Write(Description.ToBytes()); + bw.Write(RewardCount); + bw.Write(new byte[4*2+2]); + bw.Write(RewardText.ToBytes()); + bw.Write(Points); + } + + public override string ToString() { + var ret = "struct TaskDescription {\n"; + ret += "\tSequenceNumber = "; + try { + ret += $"{ Indentify(SequenceNumber) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTaskID = "; + try { + ret += $"{ Indentify(TaskID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTitle = "; + try { + ret += $"{ Indentify(Title) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDuration = "; + try { + ret += $"{ Indentify(Duration) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tStartTime = "; + try { + ret += $"{ Indentify(StartTime) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tDescription = "; + try { + ret += $"{ Indentify(Description) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRewardCount = "; + try { + ret += $"{ Indentify(RewardCount) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRewardText = "; + try { + ret += $"{ Indentify(RewardText) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tPoints = "; + try { + ret += $"{ Indentify(Points) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct Weather : IEQStruct { + public uint Val1; + public WeatherType Type; + + public Weather(uint Val1, WeatherType Type) : this() { + this.Val1 = Val1; + this.Type = Type; + } + + public Weather(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public Weather(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Val1 = br.ReadUInt32(); + Type = ((WeatherType) 0).Unpack(br); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(Val1); + bw.Write((uint) Type); + } + + public override string ToString() { + var ret = "struct Weather {\n"; + ret += "\tVal1 = "; + try { + ret += $"{ Indentify(Val1) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tType = "; + try { + ret += $"{ Indentify(Type) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct FindableNPC : IEQStruct { + public bool Remove; + public uint EntityID; + public string Name; + public string LastName; + public uint Race; + public byte Class; + + public FindableNPC(bool Remove, uint EntityID, string Name, string LastName, uint Race, byte Class) : this() { + this.Remove = Remove; + this.EntityID = EntityID; + this.Name = Name; + this.LastName = LastName; + this.Race = Race; + this.Class = Class; + } + + public FindableNPC(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public FindableNPC(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + Remove = br.ReadUInt32() != 0; + EntityID = br.ReadUInt32(); + Name = br.ReadString(64); + LastName = br.ReadString(32); + Race = br.ReadUInt32(); + Class = br.ReadByte(); + br.ReadBytes(3); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write((uint) (Remove ? 1 : 0)); + bw.Write(EntityID); + bw.Write(Name.ToBytes(64)); + bw.Write(LastName.ToBytes(32)); + bw.Write(Race); + bw.Write(Class); + bw.Write(new byte[3]); + } + + public override string ToString() { + var ret = "struct FindableNPC {\n"; + ret += "\tRemove = "; + try { + ret += $"{ Indentify(Remove) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tEntityID = "; + try { + ret += $"{ Indentify(EntityID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tLastName = "; + try { + ret += $"{ Indentify(LastName) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRace = "; + try { + ret += $"{ Indentify(Race) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tClass = "; + try { + ret += $"{ Indentify(Class) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } + + public struct XTarget : IEQStruct { + public uint MaxXTargets; + public bool RestFlag; + public uint Slot; + public byte Role; + public uint TargetID; + public string Name; + + public XTarget(uint MaxXTargets, bool RestFlag, uint Slot, byte Role, uint TargetID, string Name) : this() { + this.MaxXTargets = MaxXTargets; + this.RestFlag = RestFlag; + this.Slot = Slot; + this.Role = Role; + this.TargetID = TargetID; + this.Name = Name; + } + + public XTarget(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public XTarget(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + MaxXTargets = br.ReadUInt32(); + RestFlag = br.ReadUInt32() != 0; + if(RestFlag) { + Slot = br.ReadUInt32(); + } + if(RestFlag) { + Role = br.ReadByte(); + } + if(RestFlag) { + TargetID = br.ReadUInt32(); + } + if(RestFlag) { + Name = br.ReadString(-1); + } + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(MaxXTargets); + bw.Write((uint) (RestFlag ? 1 : 0)); + if(RestFlag) { + bw.Write(Slot); + } + if(RestFlag) { + bw.Write(Role); + } + if(RestFlag) { + bw.Write(TargetID); + } + if(RestFlag) { + bw.Write(Name.ToBytes()); + } + } + + public override string ToString() { + var ret = "struct XTarget {\n"; + ret += "\tMaxXTargets = "; + try { + ret += $"{ Indentify(MaxXTargets) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tRestFlag = "; + try { + ret += $"{ Indentify(RestFlag) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + if(RestFlag) { + ret += "\tSlot = "; + try { + ret += $"{ Indentify(Slot) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + if(RestFlag) { + ret += "\tRole = "; + try { + ret += $"{ Indentify(Role) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + if(RestFlag) { + ret += "\tTargetID = "; + try { + ret += $"{ Indentify(TargetID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + if(RestFlag) { + ret += "\tName = "; + try { + ret += $"{ Indentify(Name) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + } + return ret + "}"; + } + } + + public struct TaskInfo : IEQStruct { + public uint TaskID; + public string Title; + public uint CompletedTime; + + public TaskInfo(uint TaskID, string Title, uint CompletedTime) : this() { + this.TaskID = TaskID; + this.Title = Title; + this.CompletedTime = CompletedTime; + } + + public TaskInfo(byte[] data, int offset = 0) : this() { + Unpack(data, offset); + } + public TaskInfo(BinaryReader br) : this() { + Unpack(br); + } + public void Unpack(byte[] data, int offset = 0) { + using(var ms = new MemoryStream(data, offset, data.Length - offset)) { + using(var br = new BinaryReader(ms)) { + Unpack(br); + } + } + } + public void Unpack(BinaryReader br) { + TaskID = br.ReadUInt32(); + Title = br.ReadString(-1); + CompletedTime = br.ReadUInt32(); + } + + public byte[] Pack() { + using(var ms = new MemoryStream()) { + using(var bw = new BinaryWriter(ms)) { + Pack(bw); + return ms.ToArray(); + } + } + } + public void Pack(BinaryWriter bw) { + bw.Write(TaskID); + bw.Write(Title.ToBytes()); + bw.Write(CompletedTime); + } + + public override string ToString() { + var ret = "struct TaskInfo {\n"; + ret += "\tTaskID = "; + try { + ret += $"{ Indentify(TaskID) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tTitle = "; + try { + ret += $"{ Indentify(Title) },\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + ret += "\tCompletedTime = "; + try { + ret += $"{ Indentify(CompletedTime) }\n"; + } catch(NullReferenceException) { + ret += "!!NULL!!\n"; + } + return ret + "}"; + } + } +} diff --git a/Netcode/requirements.txt b/Netcode/requirements.txt new file mode 100644 index 0000000..888e0f4 --- /dev/null +++ b/Netcode/requirements.txt @@ -0,0 +1,6 @@ +# Requirements for structgen.py +# Use following command: +# For python 2.7 where install is located at C:\Python27 +# Prompt> C:\Python27\Scripts\pip.exe install -r requirements.txt + +pyyaml==5.1.2 \ No newline at end of file diff --git a/Netcode/structgen.py b/Netcode/structgen.py index c2f8ebb..826ec0a 100644 --- a/Netcode/structgen.py +++ b/Netcode/structgen.py @@ -1,6 +1,6 @@ import sys, yaml from pprint import pprint -from math import * +from math import ceil typemap = dict( uint8='byte', @@ -302,7 +302,7 @@ def pack(self, name, ws='', array=False): # - def unpack(self, name, data, ws='', array=False): + def unpack(self, name, data=None, ws='', array=False): if self.base == 'skip': return @@ -419,7 +419,7 @@ def declare(self): if cur_read - cur_off == 0: print '\t\t\t_databuf = br.Read%s();' % unit else: - print '\t\t\t_databuf = (br.Read%s() << %i) | (_databuf >> );' % (unit, cur_read - cur_off, cur_off) + print '\t\t\t_databuf = (br.Read%s() << %i) | (_databuf >> %i);' % (unit, cur_read - cur_off, cur_off) assert type.bits <= gap_read + (cur_read - cur_off) cur_read += gap_read - cur_off cur_off = 0 @@ -515,77 +515,83 @@ def pack(self): def unpack(self): pass + pass + +if __name__ == "__main__": + sfile = yaml.load(file('structs.yml'), Loader=yaml.SafeLoader) + + sdefs = {top : ( + {name : Struct(name, struct) for name, struct in d['structs'].items()} if 'structs' in d else {}, + {name : Bitfield(name, bf) for name, bf in d['bitfields'].items()} if 'bitfields' in d else {}, + {name : Enum(name, enum) for name, enum in d['enums'].items()} if 'enums' in d else {}, + {name : value for name, value in d['constants'].items()} if 'constants' in d else {} + ) for top, d in sfile.items()} + allEnums = {enum.name : enum for ns, (structs, bitfields, enums, constants) in sdefs.items() for name, enum in enums.items()} + + nsfiles = dict( + login='LoginPackets.cs', + world='WorldPackets.cs', + zone='ZonePackets.cs', + ) + + for ns, (structs, bitfields, enums, constants) in sdefs.items(): + with file(nsfiles[ns], 'w') as fp: + sys.stdout = fp + print r''' /* + * o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o + * /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ + * /> <\ < > / \o / \ < > / \ <\ / \ \o/ < > / \ <\ + * o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o + * <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> + * \ | | / \ \o / \ | | \ / \ | | / \ // + * \ / \o/ v\ \o/ \o o/ \o o \o/ / + * o o | | <\ | | | v\ /v v\ <| | | o + * <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> + * + * THIS FILE IS GENERATED BY structgen.py/structs.yml + * DO NOT EDIT + * + */ +''' + print 'using System;' + print 'using System.Collections.Generic;' + print 'using System.IO;' + print 'using static OpenEQ.Netcode.Utility;' + + if len(constants): + print + print 'using static OpenEQ.Netcode.%sConstants.Constants;' % ns.title() + print 'namespace OpenEQ.Netcode.%sConstants {' % ns.title() + print '\tinternal static class Constants {' + for name, value in constants.items(): + print '\t\tpublic const int %s = %i;' % (name, value) + print '\t}' + print '}' -sfile = yaml.load(file('structs.yml')) - -sdefs = {top : ( - {name : Struct(name, struct) for name, struct in d['structs'].items()} if 'structs' in d else {}, - {name : Bitfield(name, bf) for name, bf in d['bitfields'].items()} if 'bitfields' in d else {}, - {name : Enum(name, enum) for name, enum in d['enums'].items()} if 'enums' in d else {}, - {name : value for name, value in d['constants'].items()} if 'constants' in d else {} -) for top, d in sfile.items()} -allEnums = {enum.name : enum for ns, (structs, bitfields, enums, constants) in sdefs.items() for name, enum in enums.items()} - -nsfiles = dict( - login='LoginPackets.cs', - world='WorldPackets.cs', - zone='ZonePackets.cs', -) - -for ns, (structs, bitfields, enums, constants) in sdefs.items(): - with file(nsfiles[ns], 'w') as fp: - sys.stdout = fp - print '''/* -* o__ __o o__ __o__/_ o o o__ __o__/_ o__ __o o ____o__ __o____ o__ __o__/_ o__ __o -* /v v\ <| v <|\ <|> <| v <| v\ <|> / \ / \ <| v <| v\ -* /> <\ < > / \\o / \ < > / \ <\ / \ \o/ < > / \ <\ -* o/ | \o/ v\ \o/ | \o/ o/ o/ \o | | \o/ \o -* <| _\__o__ o__/_ | <\ | o__/_ |__ _<| <|__ __|> < > o__/_ | |> -* \\ | | / \ \o / \ | | \ / \ | | / \ // -* \ / \o/ v\ \o/ \o o/ \o o \o/ / -* o o | | <\ | | | v\ /v v\ <| | | o -* <\__ __/> / \ _\o__/_ / \ < \ / \ _\o__/_ / \ <\ /> <\ / \ / \ _\o__/_ / \ __/> -* -* THIS FILE IS GENERATED BY structgen.py/structs.yml -* DO NOT EDIT -* -*/''' - print 'using System;' - print 'using System.Collections.Generic;' - print 'using System.IO;' - print 'using static OpenEQ.Netcode.Utility;' - - if len(constants): print - print 'using static OpenEQ.Netcode.%sConstants.Constants;' % ns.title() - print 'namespace OpenEQ.Netcode.%sConstants {' % ns.title() - print '\tinternal static class Constants {' - for name, value in constants.items(): - print '\t\tpublic const int %s = %i;' % (name, value) - print '\t}' - print '}' - - print - print 'namespace OpenEQ.Netcode {' + print 'namespace OpenEQ.Netcode {' + + if len(enums): + for i, (name, enum) in enumerate(enums.items()): + enum.declare() + if i != len(enums) - 1: + print + if len(enums) and len(bitfields): + print - if len(enums): - for i, (name, enum) in enumerate(enums.items()): - enum.declare() - if i != len(enums) - 1: + for i, (name, bitfield) in enumerate(bitfields.items()): + bitfield.declare() + if i != len(bitfields) - 1: print - if len(enums) and len(bitfields): - print - for i, (name, bitfield) in enumerate(bitfields.items()): - bitfield.declare() - if i != len(bitfields) - 1: + if (len(bitfields) and len(structs)) or (len(bitfields) == 0 and len(enums) and len(structs)): print - if (len(bitfields) and len(structs)) or (len(bitfields) == 0 and len(enums) and len(structs)): - print + for i, (name, struct) in enumerate(structs.items()): + struct.declare() + if i != len(structs) - 1: + print + print '}' + + pass - for i, (name, struct) in enumerate(structs.items()): - struct.declare() - if i != len(structs) - 1: - print - print '}'