/// <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)
        {
            PacketBRequestAndIncrementScenarioIdPacket Request = new PacketBRequestAndIncrementScenarioIdPacket(p.Content);

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

            Player ObjPlayer = s.Player;

            int Scenarioid = ObjPlayer.Empire.CurrentCharacter.Nextscenarioid + Request.Increment;

            ObjPlayer.Empire.CurrentCharacter.Nextscenarioid = Scenarioid;

            PacketBResponseScenarioIdPacket ResponseContent = new PacketBResponseScenarioIdPacket(Scenarioid);

            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.BResponseScenarioIdPacket, p.HeaderRequestId, Response);

            byte[] ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }
示例#2
0
        /// <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(Session s, Package p)
        {
            var Request = new PacketBRequestAndIncrementScenarioIdPacket(p.Content);

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

            PacketBResponseScenarioIdPacket ResponseContent = new PacketBResponseScenarioIdPacket(s.scenarioID);

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

            byte[] Response = ResponseContent.ToByteArray();

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

            byte[] ToSend = Package.ToByteArray();

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