/// <summary>
        /// Sends BGameCurrencyPacket for game currencies.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        public static void SendGameCurrency(Session s, Package p)
        {
            Player ObjPlayer = s.Player;

            if (ObjPlayer.Gamecurrencys.Items.Count > 0)
            {
                PacketBGameCurrencyPacket ResponseContent = new PacketBGameCurrencyPacket(ObjPlayer.Gamecurrencys.ToXml);

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

                byte[] Response = ResponseContent.ToByteArray();

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

                byte[] ToSend = Package.ToByteArray();

                s.Send(ToSend, 0, ToSend.Length);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Sends BGameCurrencyPacket for game currencies.
        /// </summary>
        /// <param name="s">The session.</param>
        /// <param name="p">Packet BRequestRetrievePersistentData.</param>
        /// <param name="r">Packet BRequestRetrievePersistentData content.</param>
        private static void _SendGameCurrency(Session s, Package p, PacketBRequestRetrievePersistentData r)
        {
            string Content = File.ReadAllText($"{PathingHelper.tmpDir}BGameCurrencyPacketGameCurrencyResponse.xml");

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

            PacketBGameCurrencyPacket ResponseContent = new PacketBGameCurrencyPacket(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.BGameCurrencyPacket, p.HeaderRequestId, Response);

            byte[] ToSend = Package.ToByteArray();

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