Beispiel #1
0
        /// <summary>Remove gold from an RpgAccount.</summary>
        /// <exception cref="NotEnoughGoldException"></exception>
        public static void RemoveGold(this RpgAccount account, uint amount)
        {
            if (!account.HasEnoughGold(amount))
            {
                throw new NotEnoughGoldException();
            }

            account.RemoveItemCount(GoldId, amount);
        }
Beispiel #2
0
        /// <summary>Transfers gold from one RpgAccount to another.</summary>
        /// <exception cref="NotEnoughGoldException"></exception>
        public static void TransferGold(this RpgAccount source, RpgAccount target, uint amount)
        {
            if (!source.HasEnoughGold(amount))
            {
                throw new NotEnoughGoldException();
            }

            source.RemoveGold(amount);
            target.AddGold(amount);
        }