当前位置: 首页>>代码示例>>C#>>正文


C# Mobile.FindBankNoCreate方法代码示例

本文整理汇总了C#中Server.Mobile.FindBankNoCreate方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.FindBankNoCreate方法的具体用法?C# Mobile.FindBankNoCreate怎么用?C# Mobile.FindBankNoCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Mobile的用法示例。


在下文中一共展示了Mobile.FindBankNoCreate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Deposit

        public static bool Deposit( Mobile from, int amount )
        {
            BankBox box = from.FindBankNoCreate();
            if ( box == null )
                return false;

            List<Item> items = new List<Item>();

            while ( amount > 0 )
            {
                Item item;
                if ( amount < 5000 )
                {
                    item = new Gold( amount );
                    amount = 0;
                }
                else if ( amount <= 1000000 )
                {
                    item = new BankCheck( amount );
                    amount = 0;
                }
                else
                {
                    item = new BankCheck( 1000000 );
                    amount -= 1000000;
                }

                if ( box.TryDropItem( from, item, false ) )
                {
                    items.Add( item );
                }
                else
                {
                    item.Delete();
                    foreach ( Item curItem in items )
                    {
                        curItem.Delete();
                    }

                    return false;
                }
            }

            return true;
        }
开发者ID:zerodowned,项目名称:My-Stuff,代码行数:45,代码来源:AIOVendor+Stone.cs

示例2: OnTarget

			protected override void OnTarget( Mobile from, object s )
			{
				Container bank = from.FindBankNoCreate();
				
				if ( s == from )
				{
					from.SendMessage( "You cannot room yourself." );
				}
				else if ( s is PlayerMobile )
				{
					from.SendMessage( "That is not a Squire." );
				}
				else if ( !(s is Squire) )
				{
					from.SendMessage( "That is not a Squire." );
				}
				else
				{
					BaseCreature squi = ( BaseCreature )s;
					
					if ( squi.Mounted == true )
					{
						from.SendMessage( "Please dismount the Squire first, use [Dismount" );
					}
					else if ( squi.Summoned )
					{
						from.SendMessage( "How did you summon a squire with magic?" );
					}
					else if ( !squi.Alive )
					{
						from.SendMessage( "Please resurrect the Squire first." );
					}
					else
					{
						RoomCommandFunctions.Room( from, squi, true );
					}
				}
			}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:38,代码来源:Squire+Room.cs

示例3: AllowHousing

		public override bool AllowHousing( Mobile from, Point3D p )
		{
			if ( m_Stone == null )
				return false;

			if ( m_Stone.IsExpired )
				return true;

			if ( m_Stone.Deed == null )
				return false;

			Container pack = from.Backpack;

			if ( pack != null && ContainsDeed( pack ) )
				return true;

			BankBox bank = from.FindBankNoCreate();

			if ( bank != null && ContainsDeed( bank ) )
				return true;

			return false;
		}
开发者ID:nathanvy,项目名称:runuo,代码行数:23,代码来源:HouseRaffleRegion.cs

示例4: EndStable

		public void EndStable( Mobile from, BaseBlue pet )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( !pet.Controlled )
			{
				SayTo( from, "That cannot stay here!" ); // You can't stable that!
			}
			else if ( pet.ControlMaster != from )
			{
				SayTo( from, "He doesn't follow your orders!" ); // You do not own that pet!
			}
			else if ( pet.IsDeadPet )
			{
				SayTo( from, "A ghost!!!!" ); // Living pets only, please.
			}
			else if ( pet.Summoned )
			{
				SayTo( from, 502673 ); // I can not stable summoned creatures.
			}
			#region Mondain's Legacy
			else if ( pet.Allured )
			{
				SayTo( from, 1048053 ); // You can't stable that!
			}
			#endregion
			else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
			{
				SayTo( from, 1042563 ); // You need to unload your pet.
			}
			else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
			{
				SayTo( from, "That person is at war right now!" ); // I'm sorry.  Your pet seems to be busy.
			}
			else if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				SayTo( from, "Sorry, our Inn is full!" ); // You have too many pets in the stables!
			}
			else
			{
				Container bank = from.FindBankNoCreate();

				if ( ( from.Backpack != null && from.Backpack.ConsumeTotal( typeof( Gold ), 500 ) ) || ( bank != null && bank.ConsumeTotal( typeof( Gold ), 500 ) ) )
				{
					pet.ControlTarget = null;
					pet.ControlOrder = OrderType.Stay;
					pet.Internalize();

					pet.SetControlMaster( null );
					pet.SummonMaster = null;

					pet.IsStabled = true;

					from.Stabled.Add( pet );

					SayTo( from, "Enjoy your stay!" ); // [AOS: Your pet has been stabled.] Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
				}
				else
				{
					SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
				}
			}
		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:64,代码来源:InnMaid.cs

示例5: BeginStable

		public void BeginStable( Mobile from )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			Container bank = from.FindBankNoCreate();

			if ( ( from.Backpack == null || from.Backpack.GetAmount( typeof( Gold ) ) < 500 ) && ( bank == null || bank.GetAmount( typeof( Gold ) ) < 500 ) )
			{
				SayTo( from, "But who will pay for his stay?" ); // Thou dost not have enough gold, not even in thy bank account.
			}
			else
			{
				/* I charge 30 gold per pet for a real week's stable time.
										 * I will withdraw it from thy bank account.
										 * Which animal wouldst thou like to stable here?
										 */
				SayTo( from, "We charge 500 gold per day for a room at our fine establishment, who wishes to stay here?");

				from.Target = new StableTarget( this );
			}
		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:22,代码来源:InnMaid.cs

示例6: EndStable

		public void EndStable( Mobile from, BaseCreature pet )
		{
			if ( Deleted || !from.CheckAlive() )
				return;

			if ( pet.Body.IsHuman )
			{
				SayTo( from, 502672 ); // HA HA HA! Sorry, I am not an inn.
			}
			else if ( !pet.Controlled )
			{
				SayTo( from, 1048053 ); // You can't stable that!
			}
			else if ( pet.ControlMaster != from )
			{
				SayTo( from, 1042562 ); // You do not own that pet!
			}
			else if ( pet.IsDeadPet )
			{
				SayTo( from, 1049668 ); // Living pets only, please.
			}
			else if ( pet.Summoned )
			{
				SayTo( from, 502673 ); // I can not stable summoned creatures.
			}
            /*
			else if ( pet.Allured )
			{
				SayTo( from, 1048053 ); // You can't stable that!
			}
*/
			else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
			{
				SayTo( from, 1042563 ); // You need to unload your pet.
			}
			else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
			{
				SayTo( from, 1042564 ); // I'm sorry.  Your pet seems to be busy.
			}
			else if ( from.Stabled.Count >= GetMaxStabled( from ) )
			{
				SayTo( from, 1042565 ); // You have too many pets in the stables!
			}
			else
			{
				Container bank = from.FindBankNoCreate();

				if ( ( from.Backpack != null && from.Backpack.ConsumeTotal( typeof( Gold ), 30 ) ) || ( bank != null && bank.ConsumeTotal( typeof( Gold ), 30 ) ) )
				{
					pet.ControlTarget = null;
					pet.ControlOrder = OrderType.Stay;
					pet.Internalize();

					pet.SetControlMaster( null );
					pet.SummonMaster = null;

					pet.IsStabled = true;
                    pet.StabledBy = from;

					if ( Core.SE )	
						pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

					from.Stabled.Add( pet );

					SayTo( from, Core.AOS ? 1049677 : 502679 ); // [AOS: Your pet has been stabled.] Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
				}
				else
				{
					SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
				}
			}
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:72,代码来源:AnimalTrainer.cs

示例7: IsUsableBy

		public bool IsUsableBy( Mobile from )
		{
			Item root = RootParent as Item;
			return IsChildOf( from.Backpack ) || IsChildOf( from.FindBankNoCreate() ) || IsLockedDown && IsAccessibleTo( from ) || root != null && root.IsSecure && root.IsAccessibleTo( from );
		}
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:5,代码来源:PlantItem.cs

示例8: GetBalance

        public int GetBalance(Mobile from)
        {
            int balance = 0;

            Container bank = from.FindBankNoCreate();
            Container backpack = from.Backpack;
            Item[] DonatorDeeds;

            if (bank != null)
            {
                DonatorDeeds = bank.FindItemsByType(typeof(DonatorDeed));

                for (int i = 0; i < DonatorDeeds.Length; i++)
                    balance += DonatorDeeds[i].Amount;
            }

            if (backpack != null)
            {
                DonatorDeeds = backpack.FindItemsByType(typeof(DonatorDeed));

                for (int i = 0; i < DonatorDeeds.Length; i++)
                    balance += DonatorDeeds[i].Amount;
            }

            return balance;
        }
开发者ID:jasegiffin,项目名称:ServUO,代码行数:26,代码来源:VIPCore.cs

示例9: DepositUpTo

        public static int DepositUpTo( Mobile from, int amount )
        {
            BankBox box = from.FindBankNoCreate();
            if ( box == null )
                return 0;

            int amountLeft = amount;
            while ( amountLeft > 0 )
            {
                Item item;
                int amountGiven;

                if ( amountLeft < 5000 )
                {
                    item = new Gold( amountLeft );
                    amountGiven = amountLeft;
                }
                else if ( amountLeft <= 1000000 )
                {
                    item = new BankCheck( amountLeft );
                    amountGiven = amountLeft;
                }
                else
                {
                    item = new BankCheck( 1000000 );
                    amountGiven = 1000000;
                }

                if ( box.TryDropItem( from, item, false ) )
                {
                    amountLeft -= amountGiven;
                }
                else
                {
                    item.Delete();
                    break;
                }
            }

            return amount - amountLeft;
        }
开发者ID:zerodowned,项目名称:My-Stuff,代码行数:41,代码来源:AIOVendor+Stone.cs

示例10: PlacementWarning_Callback

		public void PlacementWarning_Callback( Mobile from, bool okay, object state )
		{
			if( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
				return;

			PreviewHouse prevHouse = (PreviewHouse)state;

			if( !okay )
			{
				prevHouse.Delete();
				return;
			}

			if( prevHouse.Deleted )
			{
				/* Too much time has passed and the test house you created has been deleted.
				 * Please try again!
				 */
				from.SendGump( new NoticeGump( 1060637, 30720, 1060647, 32512, 320, 180, null, null ) );

				return;
			}

			Point3D center = prevHouse.Location;
			Map map = prevHouse.Map;

			prevHouse.Delete();

			ArrayList toMove;
			//Point3D center = new Point3D( p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z );
			HousePlacementResult res = HousePlacement.Check( from, m_MultiID, center, out toMove );

			switch( res )
			{
				case HousePlacementResult.Valid:
					{
						if( from.AccessLevel < AccessLevel.GameMaster && BaseHouse.HasAccountHouse( from ) )
						{
							from.SendLocalizedMessage( 501271 ); // You already own a house, you may not place another!
						}
						else
						{
							BaseHouse house = ConstructHouse( from );

							if( house == null )
								return;

							house.Price = m_Cost;

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

							if( CurrencySystem.Consume( from.FindBankNoCreate(), CurrencySystem.typeofCopper, m_Cost ) )
							{
								from.SendMessage( "{0} copper has been withdrawn from your bank box.", m_Cost.ToString() );
							}
							else
							{
								house.RemoveKeys( from );
								house.Delete();
								from.SendLocalizedMessage( 1060646 ); // You do not have the funds available in your bank box to purchase this house.  Try placing a smaller house, or adding gold or checks to your bank box.
								return;
							}

							house.MoveToWorld( center, from.Map );

							for( int i = 0; i < toMove.Count; ++i )
							{
								object o = toMove[i];

								if( o is Mobile )
									((Mobile)o).Location = house.BanLocation;
								else if( o is Item )
									((Item)o).Location = house.BanLocation;
							}
						}

						break;
					}
				case HousePlacementResult.BadItem:
				case HousePlacementResult.BadLand:
				case HousePlacementResult.BadStatic:
				case HousePlacementResult.BadRegionHidden:
				case HousePlacementResult.NoSurface:
					{
						from.SendLocalizedMessage( 1043287 ); // The house could not be created here.  Either something is blocking the house, or the house would not be on valid terrain.
						break;
					}
				case HousePlacementResult.BadRegion:
					{
						from.SendLocalizedMessage( 501265 ); // Housing cannot be created in this area.
						break;
					}
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:97,代码来源:HousePlacementTool.cs

示例11: AddItem

		//code to finish adding an item - accessed by the add item target
		public void AddItem( Mobile from, object targeted )
		{
			if( from != null && !CanUse( from ) )
			{
				from.SendMessage( "You no longer can use that" );
				return;
			}
			
			//keep track of the item
			Item item = null;
			
			//keep track of the deed if it's a commodity deeds
			Item deed = null;
			
			int entryindex;
			
			if( !( targeted is Item ) )
			{
				if( from != null )
				{
					from.SendMessage( "this only works on items." );
				}
				return;
			}
			
			item = (Item)targeted;
			
			if( from != null && !item.IsChildOf( from.Backpack ) )
			{
				BankBox box = from.FindBankNoCreate();
				
				if( box == null || !item.IsChildOf( box ) )
				{
					from.SendMessage( "you can only add items from your backpack or bank box" );
					return;
				}
			}

			
			//Handle commodity deed insertion
			if( item is CommodityDeed )
			{
				if( ((CommodityDeed)item).Commodity == null )
				{
					if( from != null )
					{
						from.SendMessage( "there is nothing to add in that commodity deed." );
					}
					return;
				}
				//store the deed reference
				deed = item;
				
				//reference the commodity within the deed
				item = ((CommodityDeed)item).Commodity;
			}
			
			//this uses the overloadable comparison for the appropriate store entries, so that custom store entries
			//can provide custom comparisons with items through their Match() methods
			entryindex = StoreEntry.IndexOfItem( _StoreEntries, item, true );
			
			if( entryindex == -1 )
			{
				if( from != null )
				{
					from.SendMessage( "that cannot be stored in this." );
				}
				return;
				
			}
			
			//reference the item store entry
			StoreEntry entry = _StoreEntries[ entryindex ];
			
			if( !entry.Add( item ) )
			{
				if( from != null )
				{
					from.SendMessage( "that quantity cannot fit in this." );
				}
				return;
			}
			
			//don't delete items that are stuck in a stash list
			if( !( entry is StashEntry ) )
			{
				//delete the item after
				if( deed != null )
				{
					deed.Delete();
				}
				else
				{
					entry.AbsorbItem( item );
				}
			}
			
			
			
//.........这里部分代码省略.........
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:101,代码来源:ItemStore.cs

示例12: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			BankBox box = from.FindBankNoCreate();

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

				int deposited = 0;

				int toAdd = m_Worth;

				Copper copper;

				while ( toAdd > 60000 )
				{
					copper = new Copper( 60000 );

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

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

						break;
					}
				}

				if ( toAdd > 0 )
				{
					copper = new Copper( toAdd );

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

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

				// Gold 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.
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:58,代码来源:BankCheck.cs

示例13: BeginDryDock

        public void BeginDryDock( Mobile from, Mobile master )
        {
            if ( CheckDecay() )
                return;

            /*FIND GOLD*/
            int balance = 0;
            Item[] gold;

            Container bank = from.FindBankNoCreate();

            if (bank != null)
            {
                gold = bank.FindItemsByType(typeof(Gold));

                for (int i = 0; i < gold.Length; ++i)
                    balance += gold[i].Amount;
            }

            if (balance < 25)
            {
                master.Say(true, "Thou dost not have 25 gold in thy bank account.");
                return;
            }
            else
            {
                EndDryDock(from, master, bank);
            }

            /*DryDockResult result = CheckDryDock( from );

            if ( result == DryDockResult.Dead )
                from.SendAsciiMessage( "You appear to be dead." ); // You appear to be dead.
            else if ( result == DryDockResult.NoKey )
                from.SendAsciiMessage("You must have a key to the ship to dock the boat."); // You must have a key to the ship to dock the boat.
            else if ( result == DryDockResult.NotAnchored )
                from.SendAsciiMessage("You must lower the anchor to dock the boat."); // You must lower the anchor to dock the boat.
            else if ( result == DryDockResult.Mobiles )
                from.SendAsciiMessage("You cannot dock the ship with beings on board!"); // You cannot dock the ship with beings on board!
            else if ( result == DryDockResult.Items )
                from.SendAsciiMessage("You cannot dock the ship with a cluttered deck."); // You cannot dock the ship with a cluttered deck.
            else if ( result == DryDockResult.Hold )
                from.SendAsciiMessage("Make sure your hold is empty, and try again!"); // Make sure your hold is empty, and try again!
            else if ( result == DryDockResult.Valid )
                from.SendGump( new ConfirmDryDockGump( from, this ) );*/
        }
开发者ID:Godkong,项目名称:Origins,代码行数:46,代码来源:BaseBoat.cs

示例14: EndStable

        public void EndStable(Mobile from, BaseCreature pet)
        {
            if (Deleted || !from.CheckAlive())
                return;

            else if (!pet.Controlled || pet.ControlMaster != from)
            {
                from.SendLocalizedMessage(1042562); // You do not own that pet!
            }
            else if (pet.IsDeadPet)
            {
                from.SendLocalizedMessage(1049668); // Living pets only, please.
            }
            else if (pet.Summoned)
            {
                from.SendLocalizedMessage(502673); // I can not stable summoned creatures.
            }
            #region Mondain's Legacy
            else if (pet.Allured)
            {
                from.SendLocalizedMessage(1048053); // You can't stable that!
            }
            #endregion
            else if (pet.Body.IsHuman)
            {
                from.SendLocalizedMessage(502672); // HA HA HA! Sorry, I am not an inn.
            }
            else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendLocalizedMessage(1042564); // I'm sorry.  Your pet seems to be busy.
            }
            else if (from.Stabled.Count >= GetMaxStabled(from))
            {
                from.SendLocalizedMessage(1114325); // There is no more room in your chicken coop!
            }
            else
            {
                Container bank = from.FindBankNoCreate();

                if (bank != null && bank.ConsumeTotal(typeof(Gold), 30))
                {
                    pet.ControlTarget = null;
                    pet.ControlOrder = OrderType.Stay;
                    pet.Internalize();

                    pet.SetControlMaster(null);
                    pet.SummonMaster = null;

                    pet.IsStabled = true;

                    if (Core.SE)
                        pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy

                    from.Stabled.Add(pet);

                    from.SendLocalizedMessage(502679); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
                }
                else
                {
                    from.SendLocalizedMessage(502677); // But thou hast not the funds in thy bank account!
                }
            }
        }
开发者ID:suiy187,项目名称:runuocustom,代码行数:63,代码来源:ChickenCoop.cs

示例15: OnBuyItems


//.........这里部分代码省略.........
			{
				// Thou hast bought nothing!
				SayTo(buyer, 500190);
			}
			else if (validBuy.Count == 0)
			{
				// Your order cannot be fulfilled, please try again.
				SayTo(buyer, 500187);
			}

			if (validBuy.Count == 0)
			{
				return false;
			}

			bool bought = (buyer.AccessLevel >= AccessLevel.GameMaster);
			Container cont = buyer.Backpack;

			if (!bought && cont != null)
			{
				if (cont.ConsumeTotal(TokenType, totalCost))
				{
					bought = true;
				}
				else if (totalCost < 2000)
				{
					// Begging thy pardon, but thou casnt afford that.
					SayTo(buyer, 500192);
				}
			}

			if (!bought && totalCost >= 2000)
			{
				cont = buyer.FindBankNoCreate();

				if (cont != null && cont.ConsumeTotal(TokenType, totalCost))
				{
					bought = true;
					fromBank = true;
				}
				else
				{
					// Begging thy pardon, but thy bank account lacks these funds.
					SayTo(buyer, 500191);
				}
			}

			if (!bought)
			{
				return false;
			}

			buyer.PlaySound(0x32);

			cont = buyer.Backpack ?? buyer.BankBox;

			foreach (BuyItemResponse buy in validBuy)
			{
				Serial ser = buy.Serial;
				int amount = buy.Amount;

				if (amount < 1)
				{
					continue;
				}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:66,代码来源:TokenVendor.cs


注:本文中的Server.Mobile.FindBankNoCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。