コード例 #1
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else 
			{
				BaseHouse building = BaseHouse.FindHouseAt( from );
				if ( building == m_house && this.Owner == from )
				{
					VendorRentalDuration m_Expire;
					m_Expire = VendorRentalDuration.Instances[(int)m_duration];
					PlayerVendor vendor = new RentedVendor( m_owner, m_house, m_Expire, m_rent, true, m_rent );
					vendor.MoveToWorld( from.Location, from.Map );
					this.Delete();
				}
				else
					from.SendMessage( "You may only use this in a vendor mall you have paid for a slot in!" );
			}
		}
コード例 #2
0
        protected override void AcceptOffer(Mobile from)
        {
            this.m_Contract.Offeree = null;

            if (!this.m_Contract.Map.CanFit(this.m_Contract.Location, 16, false, false))
            {
                this.m_Landlord.SendLocalizedMessage(1062486); // A vendor cannot exist at that location.  Please try again.
                return;
            }

            BaseHouse house = BaseHouse.FindHouseAt(this.m_Contract);
            if (house == null)
                return;

            int price = this.m_Contract.Price;
            int goldToGive;

            if (price > 0)
            {
                if (Banker.Withdraw(from, price))
                {
                    from.SendLocalizedMessage(1060398, price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.

                    int depositedGold = Banker.DepositUpTo(this.m_Landlord, price);
                    goldToGive = price - depositedGold;

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

                    if (goldToGive > 0)
                        this.m_Landlord.SendLocalizedMessage(500390); // Your bank box is full.
                }
                else
                {
                    from.SendLocalizedMessage(1062378); // You do not have enough gold in your bank account to cover the cost of the contract.
                    this.m_Landlord.SendLocalizedMessage(1062374, from.Name); // ~1_NAME~ has declined your vendor rental offer.

                    return;
                }
            }
            else
            {
                goldToGive = 0;
            }

            PlayerVendor vendor = new RentedVendor(from, house, this.m_Contract.Duration, price, this.m_Contract.LandlordRenew, goldToGive);
            vendor.MoveToWorld(this.m_Contract.Location, this.m_Contract.Map);

            this.m_Contract.Delete();

            from.SendLocalizedMessage(1062377); // You have accepted the offer and now own a vendor in this house.  Rental contract options and details may be viewed on this vendor via the 'Contract Options' context menu.
            this.m_Landlord.SendLocalizedMessage(1062376, from.Name); // ~1_NAME~ has accepted your vendor rental offer.  Rental contract details and options may be viewed on this vendor via the 'Contract Options' context menu.
        }
コード例 #3
0
		protected override void AcceptOffer(Mobile from)
		{
			m_Contract.Offeree = null;

			if (!m_Contract.Map.CanFit(m_Contract.Location, 16, false, false))
			{
				m_Landlord.SendLocalizedMessage(1062486); // A vendor cannot exist at that location.  Please try again.
				return;
			}

			BaseHouse house = BaseHouse.FindHouseAt(m_Contract);
			if (house == null)
			{
				return;
			}

			int price = m_Contract.Price;
			int currencyToGive;

			if (price > 0)
			{
				Type cType = m_Contract.Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);

				if (Banker.Withdraw(from, cType, price))
				{
					from.SendMessage("{0:#,0} {1} has been withdrawn from your bank box.", price, cType.Name);

					int depositedCurrency = Banker.DepositUpTo(m_Landlord, cType, price);
					currencyToGive = price - depositedCurrency;

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

					if (currencyToGive > 0)
					{
						m_Landlord.SendLocalizedMessage(500390); // Your bank box is full.
					}
				}
				else
				{
					from.SendMessage("You do not have enough {0} in your bank account to cover the cost of the contract.", cType.Name);

					m_Landlord.SendLocalizedMessage(1062374, from.Name); // ~1_NAME~ has declined your vendor rental offer.

					return;
				}
			}
			else
			{
				currencyToGive = 0;
			}

			PlayerVendor vendor = new RentedVendor(
				from, house, m_Contract.Duration, price, m_Contract.LandlordRenew, currencyToGive);
			vendor.MoveToWorld(m_Contract.Location, m_Contract.Map);

			m_Contract.Delete();

			// You have accepted the offer and now own a vendor in this house.  Rental contract options and details may be viewed on this vendor via the 'Contract Options' context menu.
			from.SendLocalizedMessage(1062377);

			// ~1_NAME~ has accepted your vendor rental offer.  Rental contract details and options may be viewed on this vendor via the 'Contract Options' context menu.
			m_Landlord.SendLocalizedMessage(1062376, from.Name);
		}