public Client(uint binaryAddress, INetWrapper netWrapper) { this.binaryAddress = binaryAddress; this.netWrapper = netWrapper; this.Player = new Player(this); this.IsConnected = true; }
protected override IClient CreateClient(uint binaryAddress, INetWrapper netWrapper) { var player = new TestingPlayer(); player.Client = new TestingClient(binaryAddress, netWrapper, player); return(player.Client); }
private void ConfigureAntiCheat(INetWrapper netWrapper, AntiCheatConfiguration configuration) { netWrapper.SetAntiCheatConfig( configuration.DisabledAntiCheat, configuration.HideAntiCheat, configuration.AllowGta3ImgMods, configuration.EnableSpecialDetections, configuration.FileChecks ); }
protected virtual IClient CreateClient(uint binaryAddress, INetWrapper netWrapper) { if (this.clientCreationMethod != null) { return(this.clientCreationMethod(binaryAddress, netWrapper)); } var player = new Player(); player.Client = new Client(binaryAddress, netWrapper, player); return(player.Client); }
private void EnqueueIncomingPacket(INetWrapper netWrapper, uint binaryAddress, PacketId packetId, byte[] data, uint?ping) { if (!this.clients[netWrapper].ContainsKey(binaryAddress)) { var client = this.clientCreationMethod?.Invoke(binaryAddress, netWrapper) ?? new Client(binaryAddress, netWrapper); AssociateElement(client.Player); this.clients[netWrapper][binaryAddress] = client; ClientConnected?.Invoke(client); } if (ping != null) { this.clients[netWrapper][binaryAddress].Ping = ping.Value; } this.packetReducer.EnqueuePacket(this.clients[netWrapper][binaryAddress], packetId, data); if ( packetId == PacketId.PACKET_ID_PLAYER_QUIT || packetId == PacketId.PACKET_ID_PLAYER_TIMEOUT || packetId == PacketId.PACKET_ID_PLAYER_NO_SOCKET ) { if (this.clients[netWrapper].ContainsKey(binaryAddress)) { var client = this.clients[netWrapper][binaryAddress]; client.IsConnected = false; var quitReason = packetId switch { PacketId.PACKET_ID_PLAYER_QUIT => QuitReason.Quit, PacketId.PACKET_ID_PLAYER_TIMEOUT => QuitReason.Timeout, PacketId.PACKET_ID_PLAYER_NO_SOCKET => QuitReason.Timeout, _ => throw new NotImplementedException() }; client.Player.TriggerDisconnected(quitReason); this.clients[netWrapper].Remove(binaryAddress); } } }
protected void RegisterNetWrapper(INetWrapper netWrapper) { netWrapper.PacketReceived += EnqueueIncomingPacket; this.clients[netWrapper] = new Dictionary <uint, Client>(); }
public TestingClient(uint address, INetWrapper netWrapper, TestingPlayer player) : base(address, netWrapper, player) { this.Address = address; this.ConnectionState = Enums.ClientConnectionState.Joined; }