Beispiel #1
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)
        {
            PacketBRequestRegionMap Request = new PacketBRequestRegionMap(p.Content);

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

            Character ObjCharacter = s.Player.Empire.CurrentCharacter;

            ObjCharacter.Currentregion = Request.RegionId;

            ObjCharacter.Save();

            PacketBResponseRequestRegionMap ResponseContent = new PacketBResponseRequestRegionMap(1, (Request.RegionId == 0) ? ObjCharacter.Capscenario : Database.Regions[Request.RegionId].Mapname);

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

            byte[] ToSend = Package.ToByteArray();

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

            BRequestRetrievePersistentData.SendResponseCharacterDetails(s, p);

            SendResponseQuestGivers(s, p);
        }
        /// <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)
        {
            PacketBRequestAssignAdvisorPacket Request = new PacketBRequestAssignAdvisorPacket(p.Content);

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

            Player ObjPlayer = s.Player;

            byte Result = 0;

            if (ObjPlayer.Empire.CurrentCharacter.Assignedadvisors.Set(Request.Advisor))
            {
                BRequestRetrievePersistentData.SendResponseStringListAdvisorsAssigned(s, p);

                Result = 1;
            }

            PacketBRequestAssignAdvisorPacketResult ResponseContent = new PacketBRequestAssignAdvisorPacketResult(Result);

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

            byte[] ToSend = Package.ToByteArray();

            s.Send(ToSend, 0, ToSend.Length);
        }
Beispiel #3
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)
        {
            PacketBRequestUnitKillXp Request = new PacketBRequestUnitKillXp(p.Content);

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

            Character ObjCharacter = s.Player.Empire.CurrentCharacter;

            //@TODO
            // Level progress - Now character XP is renewed to last killed unit XP
            // Note: Last level has XP to gain
            //
            // int Level = ObjCharacter.Level;
            // int LevelXP = ObjCharacter.Resources.GetResource("XP");
            // int LevelXPMax = DatabaseHelper.GetMaximumXPforLevel(Level);
            // int LevelMax = DatabaseHelper.MaxCharacterlevel();

            ObjCharacter.Resources.SetResource("XP", Request.Xp);

            BRequestRetrievePersistentData.SendResponseCharacterDetails(s, p);
        }