public static void RemovePlayer(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfInteger CNTX = (Blaze.TdfInteger)input[1]; Blaze.TdfInteger PID = (Blaze.TdfInteger)input[3]; Blaze.TdfInteger REAS = (Blaze.TdfInteger)input[4]; pi.game.removePlayer((int)PID.Value); GC.Collect(); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); foreach (PlayerInfo player in BlazeServer.allClients) { if (player != null && player.userId == PID.Value) { player.cntx = CNTX.Value; } } foreach (PlayerInfo player in pi.game.players) { if (player != null && player.userId != PID.Value) { try { AsyncGameManager.NotifyPlayerRemoved(player, p, player, player.ns, PID.Value, CNTX.Value, REAS.Value); } catch { Logger.Error("[CLNT] #" + pi.userId + " : 'RemovePlayer' peer crashed!"); } } } }
public static void SetGameAttributes(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); pi.game.ATTR = (Blaze.TdfDoubleList)input[0]; List <Blaze.Tdf> result = new List <Blaze.Tdf>(); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result); ns.Write(buff, 0, buff.Length); ns.Flush(); foreach (PlayerInfo peer in pi.game.players) { if (peer != null) { try { AsyncGameManager.NotifyGameSettingsChange(peer, p, pi, peer.ns); } catch { pi.game.removePlayer((int)peer.userId); Logger.Error("[CLNT] #" + pi.userId + " : 'SetGameAttributes' peer crashed!"); } } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } try { rtb2.Text = Blaze.HexDump(Blaze.PacketToRaw(Packets[n])); treeView1.Nodes.Clear(); rtb1.Text = ""; inlist = new List <Blaze.Tdf>(); inlistcount = 0; List <Blaze.Tdf> Fields = Blaze.ReadPacketContent(Packets[n]); foreach (Blaze.Tdf tdf in Fields) { treeView1.Nodes.Add(TdfToTree(tdf)); } } catch (Exception ex) { rtb1.Text = "Error:\n" + ex.Message; } }
public static void DestroyGame(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> result = new List <Blaze.Tdf>(); result.Add(Blaze.ReadPacketContent(p)[0]); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result); ns.Write(buff, 0, buff.Length); ns.Flush(); }
public static void AdvanceGameState(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); pi.game.GSTA = (uint)((Blaze.TdfInteger)input[1]).Value; byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); AsyncGameManager.NotifyGameStateChange(p, pi, ns); }
public static void Login(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { if (!pi.isServer) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfString TOKN = (Blaze.TdfString)input[3]; long id = Convert.ToInt32(TOKN.Value); foreach (Profile profile in Profiles.profiles) { if (profile.id == id) { pi.profile = profile; break; } } if (pi.profile == null) { BlazeServer.Log("[CLNT] #" + pi.userId + " Could not find player profile!", System.Drawing.Color.Red); return; } else { BlazeServer.Log("[CLNT] #" + pi.userId + " Client Playername = \"" + pi.profile.name + "\"", System.Drawing.Color.Blue); } } uint t = Blaze.GetUnixTimeStamp(); List <Blaze.Tdf> Result = new List <Blaze.Tdf>(); Result.Add(Blaze.TdfString.Create("LDHT", "")); Result.Add(Blaze.TdfInteger.Create("NTOS", 0)); Result.Add(Blaze.TdfString.Create("PCTK", "")); List <Blaze.TdfStruct> playerentries = new List <Blaze.TdfStruct>(); List <Blaze.Tdf> PlayerEntry = new List <Blaze.Tdf>(); PlayerEntry.Add(Blaze.TdfString.Create("DSNM", pi.profile.name)); PlayerEntry.Add(Blaze.TdfInteger.Create("LAST", t)); PlayerEntry.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); PlayerEntry.Add(Blaze.TdfInteger.Create("STAS", 2)); PlayerEntry.Add(Blaze.TdfInteger.Create("XREF", 0)); PlayerEntry.Add(Blaze.TdfInteger.Create("XTYP", 0)); playerentries.Add(Blaze.TdfStruct.Create("0", PlayerEntry)); Result.Add(Blaze.TdfList.Create("PLST", 3, 1, playerentries)); Result.Add(Blaze.TdfString.Create("PRIV", "")); Result.Add(Blaze.TdfString.Create("SKEY", "some_client_key")); Result.Add(Blaze.TdfInteger.Create("SPAM", 1)); Result.Add(Blaze.TdfString.Create("THST", "")); Result.Add(Blaze.TdfString.Create("TSUI", "")); Result.Add(Blaze.TdfString.Create("TURI", "")); Result.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); ns.Write(buff, 0, buff.Length); ns.Flush(); }
public static void RemovePlayer(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfInteger PID = (Blaze.TdfInteger)input[3]; pi.game.removePlayer((int)PID.Value); pi.game = null; GC.Collect(); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); }
public static void SetGameAttributes(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); pi.game.ATTR = (Blaze.TdfDoubleList)input[0]; List <Blaze.Tdf> result = new List <Blaze.Tdf>(); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result); ns.Write(buff, 0, buff.Length); ns.Flush(); AsyncGameManager.NotifyGameSettingsChange(p, pi, ns); }
public static void UpdateNetworkInfo(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfUnion addr = (Blaze.TdfUnion)input[0]; Blaze.TdfStruct valu = (Blaze.TdfStruct)addr.UnionContent; Blaze.TdfStruct inip = (Blaze.TdfStruct)valu.Values[1]; pi.inIp = (uint)((Blaze.TdfInteger)inip.Values[0]).Value; pi.exPort = pi.inPort = (uint)((Blaze.TdfInteger)inip.Values[1]).Value; byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); LookupUserInformation(p, pi, ns); }
public static string PrintPacket(Blaze.Packet p) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("[{0}][{1}:{2}] {3}", Blaze.PacketToDescriber(p), p.Component.ToString("X4"), p.Command.ToString("X4"), p.QType == 0 ? "from client" : "from server"); sb.AppendLine(); sb.AppendLine("{"); List <Blaze.Tdf> content = Blaze.ReadPacketContent(p); foreach (Blaze.Tdf tdf in content) { sb.Append(PrintTdf(tdf, 1)); } sb.AppendLine("}"); return(sb.ToString()); }
public static void UpdateNetworkInfo(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfUnion addr = (Blaze.TdfUnion)input[0]; Blaze.TdfStruct valu = (Blaze.TdfStruct)addr.UnionContent; Blaze.TdfStruct exip = (Blaze.TdfStruct)valu.Values[0]; Blaze.TdfStruct inip = (Blaze.TdfStruct)valu.Values[1]; pi.inIp = ((Blaze.TdfInteger)inip.Values[0]).Value; pi.exIp = ((Blaze.TdfInteger)exip.Values[0]).Value; pi.exPort = pi.inPort = (uint)((Blaze.TdfInteger)inip.Values[1]).Value; Blaze.TdfStruct nqos = (Blaze.TdfStruct)input[2]; pi.nat = ((Blaze.TdfInteger)nqos.Values[1]).Value; byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); AsyncUserSessions.UserSessionExtendedDataUpdateNotification(pi, p, pi, ns); }
public static void GetStatsAsyncNotification(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); string statSpace = ((Blaze.TdfString)input[2]).Value; long vid = ((Blaze.TdfInteger)input[7]).Value; long eid = ((List <long>)((Blaze.TdfList)input[1]).List)[0]; List <Blaze.Tdf> Result = new List <Blaze.Tdf>(); Result.Add(Blaze.TdfString.Create("GRNM", statSpace)); Result.Add(Blaze.TdfString.Create("KEY\0", "No_Scope_Defined")); Result.Add(Blaze.TdfInteger.Create("LAST", 1)); List <Blaze.Tdf> STS = new List <Blaze.Tdf>(); List <Blaze.TdfStruct> STAT = new List <Blaze.TdfStruct>(); List <Blaze.Tdf> e0 = new List <Blaze.Tdf>(); e0.Add(Blaze.TdfInteger.Create("EID\0", eid)); e0.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); e0.Add(Blaze.TdfInteger.Create("POFF", 0)); List <string> values = new List <string>(); if (statSpace == "crit") { values.AddRange(new string[] { pi.profile.level.ToString(), pi.profile.xp.ToString(), "10000" }); } else { values.AddRange(new string[] { pi.profile.kit.ToString(), pi.profile.head.ToString(), pi.profile.face.ToString(), pi.profile.shirt.ToString() }); } e0.Add(Blaze.TdfList.Create("STAT", 1, values.Count, values)); STAT.Add(Blaze.TdfStruct.Create("0", e0)); STS.Add(Blaze.TdfList.Create("STAT", 3, STAT.Count, STAT)); Result.Add(Blaze.TdfStruct.Create("STS\0", STS)); Result.Add(Blaze.TdfInteger.Create("VID\0", vid)); byte[] buff = Blaze.CreatePacket(7, 0x32, 0, 0x2000, 0, Result); ns.Write(buff, 0, buff.Length); ns.Flush(); BlazeServer.Log("[CLNT] #" + pi.userId + " [0007:0032] GetStatsAsyncNotification"); }
public static void UpdateMeshConnection(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); List <Blaze.TdfStruct> entries = (List <Blaze.TdfStruct>)((Blaze.TdfList)input[1]).List; Blaze.TdfInteger pid = (Blaze.TdfInteger)entries[0].Values[1]; Blaze.TdfInteger stat = (Blaze.TdfInteger)entries[0].Values[2]; byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>()); ns.Write(buff, 0, buff.Length); ns.Flush(); PlayerInfo target = null; foreach (PlayerInfo info in BlazeServer.allClients) { if (info.userId == pid.Value) { target = info; break; } } if (target != null) { if (stat.Value == 2) { if (pi.isServer) { AsyncUserSessions.UserSessionExtendedDataUpdateNotification(pi, p, target, ns); AsyncGameManager.NotifyGamePlayerStateChange(pi, p, target, ns, 4); AsyncGameManager.NotifyPlayerJoinCompleted(pi, p, target, ns); } else { AsyncGameManager.NotifyGamePlayerStateChange(pi, p, pi, ns, 4); AsyncGameManager.NotifyPlayerJoinCompleted(pi, p, pi, ns); } } else { AsyncUserSessions.NotifyUserRemoved(pi, p, pid.Value, ns); } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { int n = listBox1.SelectedIndex; if (n == -1) { return; } Blaze.Packet p; lock (_sync) { p = packets[n]; } tv1.Nodes.Clear(); inlistcount = 0; inlist = new List <Blaze.Tdf>(); List <Blaze.Tdf> Fields = Blaze.ReadPacketContent(p); foreach (Blaze.Tdf tdf in Fields) { tv1.Nodes.Add(TdfToTree(tdf)); } }
public static void GetStatGroup(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); string which = ((Blaze.TdfString)input[0]).Value; List <Blaze.Tdf> Result = new List <Blaze.Tdf>(); Result.Add(Blaze.TdfString.Create("CNAM", which)); if (which == "const") { Result.Add(Blaze.TdfString.Create("DESC", "Constant stats")); Result.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); Result.Add(Blaze.TdfString.Create("META", "")); Result.Add(Blaze.TdfString.Create("NAME", "const")); List <Blaze.TdfStruct> STAT = new List <Blaze.TdfStruct>(); STAT.Add(BlazeHelper.MakeStatGroupEntry(0, "const", "0", "CONST_KIT_LONG", "kit", "CONST_KIT")); STAT.Add(BlazeHelper.MakeStatGroupEntry(1, "const", "2", "CONST_HEAD_LONG", "head", "CONST_HEAD")); STAT.Add(BlazeHelper.MakeStatGroupEntry(2, "const", "0", "CONST_HAIR_LONG", "hair", "CONST_HAIR")); STAT.Add(BlazeHelper.MakeStatGroupEntry(3, "const", "0", "CONST_FACIAL_FEATURE_LONG", "facialFeature", "CONST_FACIAL_FEATURE")); Result.Add(Blaze.TdfList.Create("STAT", 3, 4, STAT)); } if (which == "crit") { Result.Add(Blaze.TdfString.Create("DESC", "Critical stats")); Result.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); Result.Add(Blaze.TdfString.Create("META", "")); Result.Add(Blaze.TdfString.Create("NAME", "crit")); List <Blaze.TdfStruct> STAT = new List <Blaze.TdfStruct>(); STAT.Add(BlazeHelper.MakeStatGroupEntry(0, "crit", pi.profile.level.ToString(), "CRIT_LEVEL_LONG", "level", "CRIT_LEVEL")); STAT.Add(BlazeHelper.MakeStatGroupEntry(1, "crit", pi.profile.xp.ToString(), "CRIT_XP_LONG", "xp", "CRIT_XP")); STAT.Add(BlazeHelper.MakeStatGroupEntry(2, "crit", "10000", "CRIT_ELO_LONG", "elo", "CRIT_ELO")); Result.Add(Blaze.TdfList.Create("STAT", 3, 3, STAT)); } byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); ns.Write(buff, 0, buff.Length); ns.Flush(); }
public static void GetStatGroup(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); string which = ((Blaze.TdfString)input[0]).Value; List <Blaze.Tdf> Result = new List <Blaze.Tdf>(); Result.Add(Blaze.TdfString.Create("CNAM", which)); if (which == "const") { Result.Add(Blaze.TdfString.Create("DESC", "Constant stats")); Result.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); Result.Add(Blaze.TdfString.Create("META", "")); Result.Add(Blaze.TdfString.Create("NAME", "const")); List <Blaze.TdfStruct> STAT = new List <Blaze.TdfStruct>(); List <Blaze.Tdf> E0 = new List <Blaze.Tdf>(); E0.Add(Blaze.TdfString.Create("CATG", "const")); E0.Add(Blaze.TdfString.Create("DFLT", "0")); E0.Add(Blaze.TdfInteger.Create("DRVD", 0)); E0.Add(Blaze.TdfString.Create("FRMT", "%d")); E0.Add(Blaze.TdfString.Create("KIND", "")); E0.Add(Blaze.TdfString.Create("LDSC", "CONST_KIT_LONG")); E0.Add(Blaze.TdfString.Create("META", "")); E0.Add(Blaze.TdfString.Create("NAME", "kit")); E0.Add(Blaze.TdfString.Create("SDSC", "CONST_KIT")); E0.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("0", E0)); List <Blaze.Tdf> E1 = new List <Blaze.Tdf>(); E1.Add(Blaze.TdfString.Create("CATG", "const")); E1.Add(Blaze.TdfString.Create("DFLT", "2")); E1.Add(Blaze.TdfInteger.Create("DRVD", 0)); E1.Add(Blaze.TdfString.Create("FRMT", "%d")); E1.Add(Blaze.TdfString.Create("KIND", "")); E1.Add(Blaze.TdfString.Create("LDSC", "CONST_HEAD_LONG")); E1.Add(Blaze.TdfString.Create("META", "")); E1.Add(Blaze.TdfString.Create("NAME", "head")); E1.Add(Blaze.TdfString.Create("SDSC", "CONST_HEAD")); E1.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("1", E1)); List <Blaze.Tdf> E2 = new List <Blaze.Tdf>(); E2.Add(Blaze.TdfString.Create("CATG", "const")); E2.Add(Blaze.TdfString.Create("DFLT", "0")); E2.Add(Blaze.TdfInteger.Create("DRVD", 0)); E2.Add(Blaze.TdfString.Create("FRMT", "%d")); E2.Add(Blaze.TdfString.Create("KIND", "")); E2.Add(Blaze.TdfString.Create("LDSC", "CONST_HAIR_LONG")); E2.Add(Blaze.TdfString.Create("META", "")); E2.Add(Blaze.TdfString.Create("NAME", "hair")); E2.Add(Blaze.TdfString.Create("SDSC", "CONST_HAIR")); E2.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("2", E2)); List <Blaze.Tdf> E3 = new List <Blaze.Tdf>(); E3.Add(Blaze.TdfString.Create("CATG", "const")); E3.Add(Blaze.TdfString.Create("DFLT", "0")); E3.Add(Blaze.TdfInteger.Create("DRVD", 0)); E3.Add(Blaze.TdfString.Create("FRMT", "%d")); E3.Add(Blaze.TdfString.Create("KIND", "")); E3.Add(Blaze.TdfString.Create("LDSC", "CONST_FACIAL_FEATURE_LONG")); E3.Add(Blaze.TdfString.Create("META", "")); E3.Add(Blaze.TdfString.Create("NAME", "facialFeature")); E3.Add(Blaze.TdfString.Create("SDSC", "CONST_FACIAL_FEATURE")); E3.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("3", E3)); Result.Add(Blaze.TdfList.Create("STAT", 3, 4, STAT)); } if (which == "crit") { Result.Add(Blaze.TdfString.Create("DESC", "Critical stats")); Result.Add(Blaze.TdfDoubleVal.Create("ETYP", new Blaze.DoubleVal(30722, 1))); Result.Add(Blaze.TdfString.Create("META", "")); Result.Add(Blaze.TdfString.Create("NAME", "crit")); List <Blaze.TdfStruct> STAT = new List <Blaze.TdfStruct>(); List <Blaze.Tdf> E0 = new List <Blaze.Tdf>(); E0.Add(Blaze.TdfString.Create("CATG", "crit")); E0.Add(Blaze.TdfString.Create("DFLT", "1")); E0.Add(Blaze.TdfInteger.Create("DRVD", 0)); E0.Add(Blaze.TdfString.Create("FRMT", "%d")); E0.Add(Blaze.TdfString.Create("KIND", "")); E0.Add(Blaze.TdfString.Create("LDSC", "CRIT_LEVEL_LONG")); E0.Add(Blaze.TdfString.Create("META", "")); E0.Add(Blaze.TdfString.Create("NAME", "level")); E0.Add(Blaze.TdfString.Create("SDSC", "CRIT_LEVEL")); E0.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("0", E0)); List <Blaze.Tdf> E1 = new List <Blaze.Tdf>(); E1.Add(Blaze.TdfString.Create("CATG", "crit")); E1.Add(Blaze.TdfString.Create("DFLT", "0")); E1.Add(Blaze.TdfInteger.Create("DRVD", 0)); E1.Add(Blaze.TdfString.Create("FRMT", "%d")); E1.Add(Blaze.TdfString.Create("KIND", "")); E1.Add(Blaze.TdfString.Create("LDSC", "CRIT_XP_LONG")); E1.Add(Blaze.TdfString.Create("META", "")); E1.Add(Blaze.TdfString.Create("NAME", "xp")); E1.Add(Blaze.TdfString.Create("SDSC", "CRIT_XP")); E1.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("1", E1)); List <Blaze.Tdf> E2 = new List <Blaze.Tdf>(); E2.Add(Blaze.TdfString.Create("CATG", "crit")); E2.Add(Blaze.TdfString.Create("DFLT", "0")); E2.Add(Blaze.TdfInteger.Create("DRVD", 0)); E2.Add(Blaze.TdfString.Create("FRMT", "%d")); E2.Add(Blaze.TdfString.Create("KIND", "")); E2.Add(Blaze.TdfString.Create("LDSC", "CRIT_ELO_LONG")); E2.Add(Blaze.TdfString.Create("META", "")); E2.Add(Blaze.TdfString.Create("NAME", "elo")); E2.Add(Blaze.TdfString.Create("SDSC", "CRIT_ELO")); E2.Add(Blaze.TdfInteger.Create("TYPE", 0)); STAT.Add(Blaze.TdfStruct.Create("2", E2)); Result.Add(Blaze.TdfList.Create("STAT", 3, 3, STAT)); } byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); ns.Write(buff, 0, buff.Length); ns.Flush(); }
private static void PreAuth(Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); Blaze.TdfStruct CDAT = (Blaze.TdfStruct)input[0]; Blaze.TdfInteger TYPE = (Blaze.TdfInteger)CDAT.Values[3]; pi.isServer = TYPE.Value != 0; if (pi.isServer) { pi.game = new GameInfo(); pi.profile = Profiles.Create("test-server", 999); pi.userId = 999; } Blaze.TdfStruct CINF = (Blaze.TdfStruct)input[1]; Blaze.TdfString CVER = (Blaze.TdfString)CINF.Values[4]; Blaze.TdfInteger LOC = (Blaze.TdfInteger)CINF.Values[7]; pi.loc = LOC.Value; pi.version = CVER.Value; BlazeServer.Log("[CLNT] #" + pi.userId + " is a " + (pi.isServer ? "server" : "client"), System.Drawing.Color.Blue); List <Blaze.Tdf> Result = new List <Blaze.Tdf>(); Result.Add(Blaze.TdfInteger.Create("ANON", 0)); Result.Add(Blaze.TdfString.Create("ASRC", "300294")); List <string> t = Helper.ConvertStringList("{1} {25} {4} {27} {28} {6} {7} {9} {10} {11} {30720} {30721} {30722} {30723} {20} {30725} {30726} {2000}"); List <long> t2 = new List <long>(); foreach (string v in t) { t2.Add(Convert.ToInt64(v)); } Result.Add(Blaze.TdfList.Create("CIDS", 0, t2.Count, t2)); t = new List <string>(); List <string> t3 = new List <string>(); Helper.ConvertDoubleStringList("{connIdleTimeout ; 90s} {defaultRequestTimeout ; 60s} {pingPeriod ; 20s} {voipHeadsetUpdateRate ; 1000} {xlspConnectionIdleTimeout ; 300}", out t, out t3); Blaze.TdfDoubleList conf2 = Blaze.TdfDoubleList.Create("CONF", 1, 1, t, t3, t.Count); List <Blaze.Tdf> t4 = new List <Blaze.Tdf>(); t4.Add(conf2); Result.Add(Blaze.TdfStruct.Create("CONF", t4)); Result.Add(Blaze.TdfString.Create("INST", "battlefield-assault-pc")); Result.Add(Blaze.TdfInteger.Create("MINR", 0)); Result.Add(Blaze.TdfString.Create("NASP", "cem_ea_id")); Result.Add(Blaze.TdfString.Create("PILD", "")); Result.Add(Blaze.TdfString.Create("PLAT", "pc")); List <Blaze.Tdf> QOSS = new List <Blaze.Tdf>(); List <Blaze.Tdf> BWPS = new List <Blaze.Tdf>(); BWPS.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP)); BWPS.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port)); BWPS.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name)); QOSS.Add(Blaze.TdfStruct.Create("BWPS", BWPS)); QOSS.Add(Blaze.TdfInteger.Create("LNP\0", 0xA)); List <Blaze.Tdf> LTPS1 = new List <Blaze.Tdf>(); LTPS1.Add(Blaze.TdfString.Create("PSA\0", ProviderInfo.QOS_IP)); LTPS1.Add(Blaze.TdfInteger.Create("PSP\0", ProviderInfo.QOS_Port)); LTPS1.Add(Blaze.TdfString.Create("SNA\0", ProviderInfo.QOS_Name)); List <Blaze.TdfStruct> LTPS = new List <Blaze.TdfStruct>(); LTPS.Add(Blaze.CreateStructStub(LTPS1)); t = Helper.ConvertStringList("{" + ProviderInfo.QOS_SName + "}"); QOSS.Add(Blaze.TdfDoubleList.Create("LTPS", 1, 3, t, LTPS, 1)); QOSS.Add(Blaze.TdfInteger.Create("SVID", 0x45410805)); Result.Add(Blaze.TdfStruct.Create("QOSS", QOSS)); Result.Add(Blaze.TdfString.Create("RSRC", "300294")); Result.Add(Blaze.TdfString.Create("SVER", "WV Server")); byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, Result); ns.Write(buff, 0, buff.Length); ns.Flush(); }
public static void NotifyServerGameSetup(PlayerInfo src, Blaze.Packet p, PlayerInfo pi, NetworkStream ns) { List <Blaze.Tdf> input = Blaze.ReadPacketContent(p); uint t = Blaze.GetUnixTimeStamp(); pi.game.GNAM = ((Blaze.TdfString)input[2]).Value; pi.game.GSET = ((Blaze.TdfInteger)input[3]).Value; pi.game.VOIP = ((Blaze.TdfInteger)input[21]).Value; pi.game.VSTR = ((Blaze.TdfString)input[22]).Value; List <Blaze.Tdf> result = new List <Blaze.Tdf>(); List <Blaze.Tdf> GAME = new List <Blaze.Tdf>(); GAME.Add(Blaze.TdfList.Create("ADMN", 0, 1, new List <long>(new long[] { pi.userId }))); GAME.Add(Blaze.TdfList.Create("CAP\0", 0, 2, new List <long>(new long[] { 0x20, 0 }))); GAME.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); GAME.Add(Blaze.TdfString.Create("GNAM", pi.game.GNAM)); GAME.Add(Blaze.TdfInteger.Create("GPVH", 666)); GAME.Add(Blaze.TdfInteger.Create("GSET", pi.game.GSET)); GAME.Add(Blaze.TdfInteger.Create("GSID", 1)); GAME.Add(Blaze.TdfInteger.Create("GSTA", pi.game.GSTA)); GAME.Add(Blaze.TdfString.Create("GTYP", "AssaultStandard")); GAME.Add(BlazeHelper.CreateNETField(pi, "HNET")); GAME.Add(Blaze.TdfInteger.Create("HSES", 13666)); GAME.Add(Blaze.TdfInteger.Create("IGNO", 0)); GAME.Add(Blaze.TdfInteger.Create("MCAP", 0x20)); GAME.Add(BlazeHelper.CreateNQOSField(pi, "NQOS")); GAME.Add(Blaze.TdfInteger.Create("NRES", 0)); GAME.Add(Blaze.TdfInteger.Create("NTOP", 1)); GAME.Add(Blaze.TdfString.Create("PGID", "")); List <Blaze.Tdf> PHST = new List <Blaze.Tdf>(); PHST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); GAME.Add(Blaze.TdfStruct.Create("PHST", PHST)); GAME.Add(Blaze.TdfInteger.Create("PRES", 1)); GAME.Add(Blaze.TdfString.Create("PSAS", "wv")); GAME.Add(Blaze.TdfInteger.Create("QCAP", 0x10)); GAME.Add(Blaze.TdfInteger.Create("SEED", 0x2CF2048F)); GAME.Add(Blaze.TdfInteger.Create("TCAP", 0x10)); List <Blaze.Tdf> THST = new List <Blaze.Tdf>(); THST.Add(Blaze.TdfInteger.Create("HPID", pi.userId)); GAME.Add(Blaze.TdfStruct.Create("THST", THST)); GAME.Add(Blaze.TdfList.Create("TIDS", 0, 2, new List <long>(new long[] { 1, 2 }))); GAME.Add(Blaze.TdfString.Create("UUID", "f5193367-c991-4429-aee4-8d5f3adab938")); GAME.Add(Blaze.TdfInteger.Create("VOIP", pi.game.VOIP)); GAME.Add(Blaze.TdfString.Create("VSTR", pi.game.VSTR)); result.Add(Blaze.TdfStruct.Create("GAME", GAME)); List <Blaze.TdfStruct> PROS = new List <Blaze.TdfStruct>(); List <Blaze.Tdf> ee0 = new List <Blaze.Tdf>(); ee0.Add(Blaze.TdfInteger.Create("EXID", pi.userId)); ee0.Add(Blaze.TdfInteger.Create("GID\0", pi.game.id)); ee0.Add(Blaze.TdfInteger.Create("LOC\0", pi.loc)); ee0.Add(Blaze.TdfString.Create("NAME", pi.profile.name)); ee0.Add(Blaze.TdfInteger.Create("PID\0", pi.userId)); ee0.Add(BlazeHelper.CreateNETFieldUnion(pi, "PNET")); ee0.Add(Blaze.TdfInteger.Create("SID\0", pi.slot)); ee0.Add(Blaze.TdfInteger.Create("SLOT", 0)); ee0.Add(Blaze.TdfInteger.Create("STAT", 2)); ee0.Add(Blaze.TdfInteger.Create("TIDX", 0xFFFF)); ee0.Add(Blaze.TdfInteger.Create("TIME", t)); ee0.Add(Blaze.TdfInteger.Create("UID\0", pi.userId)); PROS.Add(Blaze.TdfStruct.Create("0", ee0)); result.Add(Blaze.TdfList.Create("PROS", 3, 1, PROS)); List <Blaze.Tdf> VALU = new List <Blaze.Tdf>(); VALU.Add(Blaze.TdfInteger.Create("DCTX", 0)); result.Add(Blaze.TdfUnion.Create("REAS", 0, Blaze.TdfStruct.Create("VALU", VALU))); byte[] buff = Blaze.CreatePacket(p.Component, 0x14, 0, 0x2000, 0, result); ns.Write(buff, 0, buff.Length); ns.Flush(); BlazeServer.Log("[CLNT] #" + src.userId + " [0004:0014] NotifyServerGameSetup", System.Drawing.Color.Black); }