コード例 #1
0
        public override void OnDoubleClick(Mobile from)
        {
            BankBox box = from.FindBankNoCreate();

            if (box != null && IsChildOf(box))
            {
                Delete();

                int deposited = 0;

                int toAdd = m_Worth;

                Platinum Platinum;

                while (toAdd > 60000)
                {
                    Platinum = new Platinum(60000);

                    if (box.TryDropItem(from, Platinum, false))
                    {
                        toAdd     -= 60000;
                        deposited += 60000;
                    }
                    else
                    {
                        Platinum.Delete();

                        from.AddToBackpack(new PlatinumBankCheck(toAdd));
                        toAdd = 0;

                        break;
                    }
                }

                if (toAdd > 0)
                {
                    Platinum = new Platinum(toAdd);

                    if (box.TryDropItem(from, Platinum, false))
                    {
                        deposited += toAdd;
                    }
                    else
                    {
                        Platinum.Delete();

                        from.AddToBackpack(new PlatinumBankCheck(toAdd));
                    }
                }

                // Platinum was deposited in your account:
                from.SendLocalizedMessage(1042672, true, " " + deposited.ToString());
            }
            else
            {
                from.SendLocalizedMessage(1047026);                   // That must be in your bank box to use it.
            }
        }
コード例 #2
0
		public override void OnDoubleClick( Mobile from )
		{
			BankBox box = from.FindBankNoCreate();

			if ( box != null && IsChildOf( box ) )
			{
				Delete();

				int deposited = 0;

				int toAdd = m_Worth;

				Platinum Platinum;

				while ( toAdd > 60000 )
				{
					Platinum = new Platinum( 60000 );

					if ( box.TryDropItem( from, Platinum, false ) )
					{
						toAdd -= 60000;
						deposited += 60000;
					}
					else
					{
						Platinum.Delete();

						from.AddToBackpack( new PlatinumBankCheck( toAdd ) );
						toAdd = 0;

						break;
					}
				}

				if ( toAdd > 0 )
				{
					Platinum = new Platinum( toAdd );

					if ( box.TryDropItem( from, Platinum, false ) )
					{
						deposited += toAdd;
					}
					else
					{
						Platinum.Delete();

						from.AddToBackpack( new PlatinumBankCheck( toAdd ) );
					}
				}

				// Platinum was deposited in your account:
				from.SendLocalizedMessage( 1042672, true, " " + deposited.ToString() );
			}
			else
			{
				from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
			}
		}