コード例 #1
0
        /// <summary>
        /// Sends BCharacterStringListPacket for vanities.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        public static void SendResponseStringListVanities(Session s, Package p)
        {
            Character ObjCharacter = s.Player.Empire.CurrentCharacter;

            if (ObjCharacter.Vanities.Items.Count > 0)
            {
                PacketBCharacterStringListPacket ResponseContent = new PacketBCharacterStringListPacket(StringListTypes.Vanities, ObjCharacter.Id, ObjCharacter.Vanities.ToXml);

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

                byte[] Response = ResponseContent.ToByteArray();

                Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BCharacterStringListPacket, 0, Response);

                byte[] ToSend = Package.ToByteArray();

                s.Send(ToSend, 0, ToSend.Length);
            }
        }
コード例 #2
0
        /// <summary>
        /// Sends BCharacterStringListPacket for inventory.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet PacketBRequestInventoryDataPacket or PacketBRequestPopulateVendor.</param>
        /// <param name="xml">The inventory xml.</param>
        public static void SendResponseStringListInventory(Session s, Package p, string xml)
        {
            if (!string.IsNullOrEmpty(xml))
            {
                Character ObjCharacter = s.Player.Empire.CurrentCharacter;

                PacketBCharacterStringListPacket ResponseContent = new PacketBCharacterStringListPacket(StringListTypes.Inventory, ObjCharacter.Id, xml);

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

                byte[] Response = ResponseContent.ToByteArray();

                Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BCharacterStringListPacket, 0, Response);

                byte[] ToSend = Package.ToByteArray();

                s.Send(ToSend, 0, ToSend.Length);
            }
        }
コード例 #3
0
        /// <summary>
        /// Sends BCharacterStringListPacket for advisors assigned.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        public static void SendResponseStringListAdvisorsAssigned(Session s, Package p)
        {
            Character ObjCharacter = s.Player.Empire.CurrentCharacter;

            string Assignedadvisors = ObjCharacter.Assignedadvisors.ToCommaString();

            if (!string.IsNullOrEmpty(Assignedadvisors))
            {
                PacketBCharacterStringListPacket ResponseContent = new PacketBCharacterStringListPacket(StringListTypes.AdvisorsAssigned, ObjCharacter.Id, Assignedadvisors);

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

                byte[] Response = ResponseContent.ToByteArray();

                Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BCharacterStringListPacket, 0, Response);

                byte[] ToSend = Package.ToByteArray();

                s.Send(ToSend, 0, ToSend.Length);
            }
        }
コード例 #4
0
        /// <summary>
        /// Sends BCharacterStringListPacket for regions.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        public static void SendResponseStringListRegions(Session s, Package p)
        {
            Character ObjCharacter = s.Player.Empire.CurrentCharacter;

            string Content = RegionHelper.GetRegionsXML();

            if (!string.IsNullOrEmpty(Content))
            {
                PacketBCharacterStringListPacket ResponseContent = new PacketBCharacterStringListPacket(StringListTypes.Regions, ObjCharacter.Id, Content);

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

                byte[] Response = ResponseContent.ToByteArray();

                Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BCharacterStringListPacket, 0, Response);

                byte[] ToSend = Package.ToByteArray();

                s.Send(ToSend, 0, ToSend.Length);
            }
        }
コード例 #5
0
        /// <summary>
        /// Sends BCharacterStringListPacket for vanities.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        /// <param name="r">Packet BRequestRetrievePersistentData content.</param>
        private static void _SendResponseStringListVanities(Session s, Package p, PacketBRequestRetrievePersistentData r)
        {
            string Content = File.ReadAllText($"{PathingHelper.tmpDir}BCharacterStringListVanitiesResponse.xml");

            if (string.IsNullOrEmpty(Content))
            {
                return;
            }

            PacketBCharacterStringListPacket ResponseContent = new PacketBCharacterStringListPacket(StringListTypes.Vanities, r.CharacterId, Content);

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

            byte[] ToSend = Package.ToByteArray();

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