/// <summary>
        /// Executes the command and sends response.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="i">The package info.</param>
        public override void ExecuteCommand(PlayerSession s, Package p)
        {
            var Request = new PacketBRequestInitialConnection(p.Content);

            if (s.Logger.IsDebugEnabled)
            {
                s.Logger.Debug($"Execute command: {Request}");
            }

            PacketBResponseInitialConnection ResponseContent;

            ResponseContent = new PacketBResponseInitialConnection(Request.Xuid, 0, 1, string.Empty, string.Empty, GamePort, string.Empty, string.Empty);

            if (s.Logger.IsDebugEnabled)
            {
                s.Logger.Debug($"Command response: {ResponseContent}");
            }

            var Response = ResponseContent.ToByteArray();
            var Package  = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, Response.Length, PacketTypes.BResponseInitialConnection, p.HeaderRequestId, Response);

            var ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }
Example #2
0
        /// <summary>
        /// Executes the command and sends response.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">The package info.</param>
        public override void ExecuteCommand(Session s, Package p)
        {
            PacketBRequestInitialConnection Request = new PacketBRequestInitialConnection(p.Content);

            Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {Request}");

            ConnectionResponseTypes ResponseResult;

            if (ConfigurationManager.AppSettings["MaintenanceMode"] == "1")
            {
                ResponseResult = ConnectionResponseTypes.Maintenance;
            }
            else if (!s.IsAuthenticated)
            {
                ResponseResult = ConnectionResponseTypes.TimeOut1;
            }
            else if (!s.Player.ACL.Items.Contains(PlayerACL.ConnectAuthServer))
            {
                ResponseResult = ConnectionResponseTypes.Banned;
            }
            else
            {
                ResponseResult = ConnectionResponseTypes.Allowed;
            }

            PacketBResponseInitialConnection ResponseContent = new PacketBResponseInitialConnection(Request.Xuid, 0, ResponseResult, string.Empty, string.Empty, GamePort, string.Empty, string.Empty);

            Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {ResponseContent}");

            byte[] Response = ResponseContent.ToByteArray();

            Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BResponseInitialConnection, p.HeaderRequestId, Response);

            byte[] ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }