private void HandlePlayerInfoListRequest(PlayerInfoListRequestPacket packet)
        {
            if (!Authorized)
            {
                SendPacket(new AuthorizationDisconnectPacket {
                    Reason = "Not authorized!"
                });
                return;
            }

            List <PlayerInfo> Player = new List <PlayerInfo>();

            for (int i = 0; i < Core.Player.Count; i++)
            {
                Player.Add(new PlayerInfo()
                {
                    Name      = Core.Player[i].Name,
                    IP        = ((IPEndPoint)Core.Player[i].Network.Client.Client.RemoteEndPoint).Address.ToString(),
                    LevelFile = Core.Player[i].LevelFile,
                    Position  = new Vector3(Core.Player[i].Position_X, Core.Player[i].Position_Y, Core.Player[i].Position_Z),
                    Ping      = 0,
                    PlayTime  = DateTime.Now - Core.Player[i].Network.LoginStartTime
                });
            }

            SendPacket(new PlayerInfoListResponsePacket {
                PlayerInfos = Player.ToArray()
            });
        }
Пример #2
0
        private void HandlePlayerInfoListRequest(PlayerInfoListRequestPacket packet)
        {
            if (!Authorized)
            {
                SendPacket(new AuthorizationDisconnectPacket {
                    Reason = "Not authorized!"
                });
                return;
            }

            SendPacket(new PlayerInfoListResponsePacket {
                PlayerInfos = Module.AllClientsSelect(clients => clients.ClientInfos().ToList()).ToArray()
            });
        }