public Parser(Client client) { _client = client; _client.Disconnected += new Client.DisconnectedEventHandler(OnClientDisconnected); _client.Send(new Utils.Objects.Packet(PacketID.HelloGameMessage)); }
private void OnClientDisconnected(Client sender) { if (_account != null) { if (_character != null) { _character.Disposition.Map.Updated -= ParseEvent; Environment.Instance.ActorSpeaked -= ParseEvent; _character.Disposition.Map.RemoveActor(_character); _character.State = Network.Enums.PlayerStateEnum.NOT_CONNECTED; _character.Client = null; _character.PrivateMessageReceived = null; _character.LastUse = Environment.Instance.Now; } _account.Connected = false; _account.CurrentCharacter = null; _account.LastIp = _client.IP; } _client.Disconnected -= OnClientDisconnected; }
private void OnClientDisconnected(Client sender) { if (Run && _clients.Remove(sender)) Utils.MyConsole.WriteLine ( sender.IP, ConsoleType.Disconnect, ConsoleWriter.Game ); }