public void MakeTestPacket3(Stream network, string CharName) { byte[] rawChar = StringToChars(CharName); TGSKickReply packet = new TGSKickReply(); packet.h.seqno = 1; packet.h.size = (short)(rawChar.Length + Marshal.SizeOf(packet)); packet.h.type = (byte)EPacketType.GSKickReply; packet.result = 1; byte[] rawPacket = D2DBS.core.StructToBytes(packet); network.Write(rawPacket, 0, rawPacket.Length); network.Write(rawChar, 0, rawChar.Length); }
private int HandleKickReply(ConnInfo Conn, List <byte> buf) { TGSKickReply packet = new TGSKickReply(); int pos = Marshal.SizeOf(packet); packet = (TGSKickReply)D2DBS.core.BytesToStruct(buf.ToArray(), Marshal.SizeOf(packet), packet.GetType()); string[] Names = BytesToString(buf.GetRange(pos, buf.Count - pos)).Split('\0'); string CharName = Names[0]; if (packet.result == 1) { D2DBS.charlock.UnlockChar(CharName); D2DBS.log.Write("info", "Char `" + CharName + "` kicked from gs " + Conn.GSId.ToString()); } return(0); }