public bool TryConnect(Client client) { if (client?.Account == null) { return(false); } client.Id = Interlocked.Increment(ref _nextClientId); var plrInfo = new PlayerInfo { AccountId = client.Account.AccountId, GuildId = client.Account.GuildId, Name = client.Account.Name, WorldInstance = -1 }; Clients[client] = plrInfo; // recalculate usage statistics Config.serverInfo.players = ConMan.GetPlayerCount(); Config.serverInfo.maxPlayers = Config.serverSettings.maxPlayers; Config.serverInfo.queueLength = ConMan.QueueLength(); Config.serverInfo.playerList.Add(plrInfo); return(true); }
public void Disconnect(Client client) { var player = client.Player; player?.Owner?.LeaveWorld(player); PlayerInfo plrInfo; Clients.TryRemove(client, out plrInfo); // recalculate usage statistics Config.serverInfo.players = ConMan.GetPlayerCount(); Config.serverInfo.playerList.Remove(plrInfo); }
public void Disconnect(Client client) { var player = client.Player; player?.Owner?.LeaveWorld(player); Clients.TryRemove(client, out var plrInfo); // recalculate usage statistics Config.serverInfo.players = ConMan.GetPlayerCount(); Config.serverInfo.maxPlayers = Config.serverSettings.maxPlayers; Config.serverInfo.queueLength = ConMan.QueueLength(); Config.serverInfo.playerList.Remove(plrInfo); }