public static GameConfig Build(GameClientPacket packet) { GameConfig config = new GameConfig(); config.LfList = BanlistManager.GetIndex(packet.ReadUInt32()); config.BanList = BanlistManager.GetName(config.LfList); config.Rule = packet.ReadByte(); config.Mode = packet.ReadByte(); config.EnablePriority = Convert.ToBoolean(packet.ReadByte()); config.NoCheckDeck = Convert.ToBoolean(packet.ReadByte()); config.NoShuffleDeck = Convert.ToBoolean(packet.ReadByte()); //C++ padding: 5 bytes + 3 bytes = 8 bytes for (int i = 0; i < 3; i++) { packet.ReadByte(); } config.StartLp = packet.ReadInt32(); config.StartHand = packet.ReadByte(); config.DrawCount = packet.ReadByte(); config.GameTimer = packet.ReadInt16(); packet.ReadUnicode(20); config.Name = packet.ReadUnicode(30); if (string.IsNullOrEmpty(config.Name)) { config.Name = RoomManager.NewRandomRoomName(); } config.RoomString = config.Name; return(config); }
public static void Parse(this GameConfig config, HostInfo info) { config.LfList = BanlistManager.GetIndex(info.LfList); config.BanList = BanlistManager.GetName(config.LfList); config.Rule = info.Rule; config.Mode = info.Mode; config.EnablePriority = info.EnablePriority == 1; config.NoCheckDeck = info.NoCheckDeck == 1; config.NoShuffleDeck = info.NoShuffleDeck == 1; config.StartLp = (int)info.StartLp; config.StartHand = info.StartHand; config.DrawCount = info.DrawCount; config.GameTimer = info.GameTimer; }
public GameConfig(GameClientPacket packet) { LfList = BanlistManager.GetIndex(packet.ReadUInt32()); Rule = packet.ReadByte(); Mode = packet.ReadByte(); EnablePriority = Convert.ToBoolean(packet.ReadByte()); NoCheckDeck = Convert.ToBoolean(packet.ReadByte()); NoShuffleDeck = Convert.ToBoolean(packet.ReadByte()); //C++ padding: 5 bytes + 3 bytes = 8 bytes for (int i = 0; i < 3; i++) { packet.ReadByte(); } StartLp = packet.ReadInt32(); StartHand = packet.ReadByte(); DrawCount = packet.ReadByte(); GameTimer = packet.ReadInt16(); packet.ReadUnicode(20); Name = packet.ReadUnicode(30); if (string.IsNullOrEmpty(Name)) { Name = GameManager.RandomRoomName(); } }