DepositUpTo() public static method

public static DepositUpTo ( Mobile from, int amount ) : int
from Mobile
amount int
return int
            public override void OnClick()
            {
                Mobile from = Owner.From;

                if (m_Vendor.Deleted || !from.CheckAlive() || !m_Vendor.IsLandlord(from))
                {
                    return;
                }

                if (m_Vendor.RentalGold > 0)
                {
                    int depositedGold = Banker.DepositUpTo(from, m_Vendor.RentalGold);
                    m_Vendor.RentalGold -= depositedGold;

                    if (depositedGold > 0)
                    {
                        from.SendLocalizedMessage(1060397, depositedGold.ToString());                           // ~1_AMOUNT~ gold has been deposited into your bank box.
                    }

                    if (m_Vendor.RentalGold > 0)
                    {
                        from.SendLocalizedMessage(500390);                           // Your bank box is full.
                    }
                }
            }
Esempio n. 2
0
            public override void OnClick()
            {
                Mobile from = Owner.From;

                if (m_Vendor.Deleted || !from.CheckAlive() || !m_Vendor.IsLandlord(from))
                {
                    return;
                }

                if (m_Vendor.RentalCurrency <= 0)
                {
                    return;
                }

                int depositedCurrency = Banker.DepositUpTo(from, m_Vendor.TypeOfCurrency, m_Vendor.RentalCurrency);

                m_Vendor.RentalCurrency -= depositedCurrency;

                if (depositedCurrency > 0)
                {
                    from.SendMessage(
                        "{0:#,0} {1} has been deposited into your bank box.", depositedCurrency, m_Vendor.TypeOfCurrency.Name);
                }

                if (m_Vendor.RentalCurrency > 0)
                {
                    from.SendLocalizedMessage(500390);                     // Your bank box is full.
                }
            }
Esempio n. 3
0
        public int GiveGold(Mobile to, int amount)
        {
            if (amount <= 0)
            {
                return(0);
            }

            if (amount > HoldGold)
            {
                SayTo(to, "I'm sorry, but I'm only holding {0} gold for you.", HoldGold.ToString());
                return(0);
            }

            int amountGiven = Banker.DepositUpTo(to, amount);

            HoldGold -= amountGiven;

            if (amountGiven > 0)
            {
                to.SendLocalizedMessage(1060397,
                                        amountGiven.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
            }

            if (amountGiven == 0)
            {
                SayTo(to, 1070755); // Your bank box cannot hold the gold you are requesting.  I will keep the gold until you can take it.
            }
            else if (amount > amountGiven)
            {
                SayTo(to, 1070756); // I can only give you part of the gold now, as your bank box is too full to hold the full amount.
            }
            else if (HoldGold > 0)
            {
                SayTo(to, 1042639); // Your gold has been transferred.
            }
            else
            {
                SayTo(to, 503234); // All the gold I have been carrying for you has been deposited into your bank account.
            }

            return(amountGiven);
        }
Esempio n. 4
0
 public static int DepositUpTo(Mobile from, int amount)
 {
     return(Banker.DepositUpTo(from, amount));
 }