示例#1
0
        /// <summary>
        /// Sends AcceptGiftR to client.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="gift">Negative response if null</param>
        public static void AcceptGiftR(LoginClient client, Gift gift)
        {
            var packet = new Packet(Op.AcceptGiftR, MabiId.Login);
            packet.PutByte(gift != null);

            if (gift != null)
            {
                packet.PutByte(gift.IsCharacter);
                packet.PutInt(0); // ?
                packet.PutInt(0); // ?
                packet.PutInt(gift.Type);
                // ?
            }

            client.Send(packet);
        }
示例#2
0
        /// <summary>
        /// Sends response to accept gift. Response will be negative if gift is null.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="gift"></param>
        public static void AcceptGiftResponse(LoginClient client, Gift gift)
        {
            var packet = new MabiPacket(Op.AcceptGiftR, Id.Login);
            if (gift != null)
            {
                packet.PutByte(true);
                packet.PutByte(gift.IsCharacter);
                packet.PutInt(0); // ?
                packet.PutInt(0); // ?
                packet.PutInt(gift.Type);
                // ?
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
示例#3
0
		/// <summary>
		/// Returns all gifts present for this account.
		/// </summary>
		/// <param name="accountId"></param>
		/// <returns></returns>
		public List<Gift> GetGifts(string accountId)
		{
			using (var conn = this.Connection)
			using (var mc = new MySqlCommand("SELECT * FROM `cards` WHERE `accountId` = @accountId AND `isGift`", conn))
			{
				mc.Parameters.AddWithValue("@accountId", accountId);

				var result = new List<Gift>();
				using (var reader = mc.ExecuteReader())
				{
					while (reader.Read())
					{
						var gift = new Gift();
						gift.Id = reader.GetInt64("cardId");
						gift.Type = reader.GetInt32("type");
						gift.Race = reader.GetInt32("race");
						gift.Message = reader.GetStringSafe("message");
						gift.Sender = reader.GetStringSafe("sender");
						gift.SenderServer = reader.GetStringSafe("senderServer");
						gift.Receiver = reader.GetStringSafe("receiver");
						gift.ReceiverServer = reader.GetStringSafe("receiverServer");
						gift.Added = reader.GetDateTimeSafe("added");

						result.Add(gift);
					}
				}

				return result;
			}
		}
示例#4
0
文件: Account.cs 项目: xKamuna/aura-1
 /// <summary>
 /// Deletes gift from account.
 /// </summary>
 /// <param name="gift"></param>
 public void DeleteGift(Gift gift)
 {
     LoginServer.Instance.Database.DeleteCard(gift);
     this.Gifts.Remove(gift);
 }
示例#5
0
        /// <summary>
        /// Returns all gifted cards present for this account.
        /// </summary>
        /// <param name="accountName"></param>
        /// <returns></returns>
        public List<Gift> GetGifts(string accountName)
        {
            using (var conn = MabiDb.Instance.GetConnection())
            {
                var mc = new MySqlCommand("SELECT * FROM `cards` WHERE `accountId` = @id AND `isGift`", conn);
                mc.Parameters.AddWithValue("@id", accountName);

                var result = new List<Gift>();
                using (var reader = mc.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var gift = new Gift();
                        gift.Id = reader.GetUInt32("cardId");
                        gift.Type = reader.GetUInt32("type");
                        gift.Race = reader.GetUInt32("race");
                        gift.Message = reader.GetStringSafe("message");
                        gift.Sender = reader.GetStringSafe("sender");
                        gift.SenderServer = reader.GetStringSafe("senderServer");
                        gift.Receiver = reader.GetStringSafe("receiver");
                        gift.ReceiverServer = reader.GetStringSafe("receiverServer");
                        gift.Added = reader["added"] as DateTime? ?? DateTime.Now;

                        result.Add(gift);
                    }
                }

                return result;
            }
        }
示例#6
0
		/// <summary>
		/// Deletes gift from account.
		/// </summary>
		/// <param name="gift"></param>
		public void DeleteGift(Gift gift)
		{
			LoginServer.Instance.Database.DeleteCard(gift);
			this.Gifts.Remove(gift);
		}
示例#7
0
		/// <summary>
		/// Changes gift to an ordinary card.
		/// </summary>
		/// <param name="gift"></param>
		public void ChangeGiftToCard(Gift gift)
		{
			this.Gifts.Remove(gift);

			if (gift.IsCharacter)
				this.CharacterCards.Add(gift);
			else
				this.PetCards.Add(gift);

			LoginServer.Instance.Database.ChangeGiftToCard(gift.Id);
		}
示例#8
0
文件: Account.cs 项目: pie3467/aura
 /// <summary>
 /// Deletes gift from account.
 /// </summary>
 /// <param name="gift"></param>
 public void DeleteGift(Gift gift)
 {
     LoginDb.Instance.DeleteCard(gift);
     this.Gifts.Remove(gift);
 }