コード例 #1
0
        public static void OnSelectServer(LoginClient client, IPacketStream packet)
        {
            if (packet.Length != 9)
            {
                return;
            }

            var selectServerPacket = new SelectServerPacket(packet);

            var server    = DependencyContainer.Instance.Resolve <ILoginServer>();
            var worldInfo = server.GetWorldByID(selectServerPacket.WorldId);

            if (worldInfo == null)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.CannotConnect);
                return;
            }

            // For some reason, the current game.exe has version -1. Maybe this is somehow connected with decrypted packages?
            // In any case, for now client version check is disabled.
            if (worldInfo.BuildVersion != selectServerPacket.BuildClient && selectServerPacket.BuildClient != -1)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.VersionDoesntMatch);
                return;
            }

            if (worldInfo.ConnectedUsers >= worldInfo.MaxAllowedUsers)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.ServerSaturated);
                return;
            }

            LoginPacketFactory.SelectServerSuccess(client, worldInfo.Host);
        }
コード例 #2
0
        private void HandleSelectServer(SelectServerPacket selectServerPacket)
        {
            var worldInfo = _server.GetWorldByID(selectServerPacket.WorldId);

            if (worldInfo == null)
            {
                LoginPacketFactory.SelectServerFailed(_client, SelectServer.CannotConnect);
                return;
            }

            // For some reason, the current game.exe has version -1. Maybe this is somehow connected with decrypted packages?
            // In any case, for now client version check is disabled.
            if (false && worldInfo.BuildVersion != selectServerPacket.BuildClient && selectServerPacket.BuildClient != -1)
            {
                LoginPacketFactory.SelectServerFailed(_client, SelectServer.VersionDoesntMatch);
                return;
            }

            if (worldInfo.ConnectedUsers >= worldInfo.MaxAllowedUsers)
            {
                LoginPacketFactory.SelectServerFailed(_client, SelectServer.ServerSaturated);
                return;
            }

            LoginPacketFactory.SelectServerSuccess(_client, worldInfo.Host);
        }
コード例 #3
0
        public static void OnSelectServer(LoginClient client, IPacketStream packet)
        {
            if (packet.Length != 9)
            {
                return;
            }

            var selectServerPacket = new SelectServerPacket(packet);

            var server    = DependencyContainer.Instance.Resolve <ILoginServer>();
            var worldInfo = server.GetWorldByID(selectServerPacket.WorldId);

            if (worldInfo == null)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.CannotConnect);
                return;
            }

            if (worldInfo.BuildVersion != selectServerPacket.BuildClient)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.VersionDoesntMatch);
                return;
            }

            if (worldInfo.ConnectedUsers >= worldInfo.MaxAllowedUsers)
            {
                LoginPacketFactory.SelectServerFailed(client, SelectServer.ServerSaturated);
                return;
            }

            LoginPacketFactory.SelectServerSuccess(client, worldInfo.Host);
        }