Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }