예제 #1
0
		/// <summary>
		/// Attempts to buy now
		/// </summary>
		/// <param name="m">The user trying to purchase</param>
		/// <returns>True if the item has been sold</returns>
		public bool DoBuyNow( Mobile m )
		{
			if ( !Banker.Withdraw( m, m_BuyNow ) )
			{
				m.SendMessage( AuctionConfig.MessageHue, AuctionSystem.ST[ 211 ] );
				return false;
			}

			AuctionSystem.Auctions.Remove( this );

			if ( HighestBid != null )
			{
				HighestBid.Outbid( this );
			}

			// Simulate bid
			Bid bid = new Bid( m, BuyNow );
			m_Bids.Insert( 0, bid );

			AuctionGoldCheck gold = new AuctionGoldCheck( this, AuctionResult.BuyNow );
			AuctionItemCheck item = new AuctionItemCheck( this, AuctionResult.BuyNow );

			GiveItemTo( m, item );
			GiveItemTo( m_Owner, gold );

			// Over.
			AuctionLog.WriteEnd( this, AuctionResult.BuyNow, m, null );

			return true;
		}
예제 #2
0
		public static Bid Deserialize( GenericReader reader, int version )
		{
			Bid bid = new Bid();

			switch ( version )
			{
				case 1:
				case 0:
					bid.m_Mobile = reader.ReadMobile();
					bid.m_Amount = reader.ReadInt();
					bid.m_Time = reader.ReadDateTime();
					break;
			}

			return bid;
		}
예제 #3
0
        private void MakeGump()
        {
            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            int numOfPages = (m_Bids.Count - 1) / 10 + 1;

            if (m_Bids.Count == 0)
            {
                numOfPages = 0;
            }

            AddPage(0);
            AddImageTiled(0, 0, 297, 282, 5174);
            AddImageTiled(1, 1, 295, 280, 2702);
            AddAlphaRegion(1, 1, 295, 280);
            AddLabel(12, 5, 33, AuctionSystem.ST[86]);

            AddLabel(160, 5, 273, string.Format(AuctionSystem.ST[18], m_Page + 1, numOfPages));
            AddImageTiled(10, 30, 277, 221, 5174);
            AddImageTiled(11, 31, 39, 19, 9274);
            AddAlphaRegion(11, 31, 39, 19);
            AddImageTiled(51, 31, 104, 19, 9274);
            AddAlphaRegion(51, 31, 104, 19);
            AddLabel(55, 30, 273, AuctionSystem.ST[87]);
            AddImageTiled(156, 31, 129, 19, 9274);
            AddAlphaRegion(156, 31, 129, 19);
            AddLabel(160, 30, 273, AuctionSystem.ST[88]);

            for (int i = 0; i < 10; i++)
            {
                AddImageTiled(11, 51 + i * 20, 39, 19, 9264);
                AddAlphaRegion(11, 51 + i * 20, 39, 19);
                AddImageTiled(51, 51 + i * 20, 104, 19, 9264);
                AddAlphaRegion(51, 51 + i * 20, 104, 19);
                AddImageTiled(156, 51 + i * 20, 129, 19, 9264);
                AddAlphaRegion(156, 51 + i * 20, 129, 19);

                if (m_Page * 10 + i < m_Bids.Count)
                {
                    Bid bid = m_Bids[m_Page * 10 + i] as Bid;
                    AddLabel(15, 50 + i * 20, 88, (m_Page * 10 + i + 1).ToString());
                    AddLabelCropped(55, 50 + i * 20, 100, 19, 88, bid.Mobile != null ? bid.Mobile.Name : AuctionSystem.ST[78]);
                    AddLabel(160, 50 + i * 20, 88, bid.Amount.ToString("#,0"));
                }
            }

            AddButton(10, 255, 4011, 4012, 0, GumpButtonType.Reply, 0);
            AddLabel(48, 257, 88, AuctionSystem.ST[89]);

            // PREV PAGE: 1
            if (m_Page > 0)
            {
                AddButton(250, 8, 9706, 9707, 1, GumpButtonType.Reply, 0);
            }

            // NEXT PAGE: 2
            if (m_Page < numOfPages - 1)
            {
                AddButton(270, 8, 9702, 9703, 2, GumpButtonType.Reply, 0);
            }
        }