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


C# Mobile.CheckAlive方法代码示例

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


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

示例1: OnTarget

            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is Spellbook )
                {
                    if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 )
                    {
                        Spellbook book = (Spellbook)targeted;

                        SpellbookType type = Spellbook.GetTypeForSpell( m_Scroll.SpellID );

                        if ( type != book.SpellbookType )
                        {
                        }
                        else if ( book.HasSpell( m_Scroll.SpellID ) )
                        {
                            from.SendAsciiMessage( "That spell is already present in that spellbook." ); // That spell is already present in that spellbook.
                        }
                        else
                        {
                            int val = m_Scroll.SpellID - book.BookOffset;

                            if ( val >= 0 && val < book.BookCount )
                            {
                                book.Content |= (ulong)1 << val;

                                m_Scroll.Consume();

                                from.Send( new Network.PlaySound( 0x249, book.GetWorldLocation() ) );
                            }
                        }
                    }
                }
            }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:33,代码来源:AddToSpellbookEntry.cs

示例2: BeginRelease

 public virtual void BeginRelease(Mobile from)
 {
     if (!Deleted && Controlled && from == ControlMaster && from.CheckAlive())
     {
         EndRelease(from);
     }
 }
开发者ID:youhide,项目名称:ServUO,代码行数:7,代码来源:BaseFamiliar.cs

示例3: GetContextMenuEntries

		public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
		{
			base.GetContextMenuEntries(from, list);

			if (from.CheckAlive() && IsChildOf(from.Backpack))
			{
				list.Add(new NameBookEntry(from, this));
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:9,代码来源:TMapBook.cs

示例4: OnDoubleClick

		public override void OnDoubleClick( Mobile from )
		{
			if ( !Movable )
				return;

			if( from.InRange( this.GetWorldLocation(), 2 ) == false )
			{
				from.SendLocalizedMessage( 500486 );	//That is too far away.
				return;
			}
			else if ( squire == null || squire.Deleted )
			{
				from.SendMessage( "Your squire has been sold into slavery." );
				return;
			}
			else if( !from.CheckAlive() )
			{
				from.SendLocalizedMessage( 1060190 );	//You cannot do that while dead!
			}
			else if ( from.Followers + squire.ControlSlots > from.FollowersMax )
			{
				from.SendMessage( "You have too many followers to call your squire." );
				return;
			}
			else
			{
				bool alreadyOwned = squire.Owners.Contains( from );
				if (!alreadyOwned)
				{
					squire.Owners.Add( from );
				}

				//Make the Squire belong to their master again.
				squire.SetControlMaster( from );
				m_KillTheSquire = false;

				//Bring the Squire to their master.
				squire.Location = from.Location;
				squire.Map = from.Map;

				//Set the Squire to follow their master.
				squire.ControlTarget = from;
				squire.ControlOrder = OrderType.Follow;
				
				//Just in case someone messed with the system.
				if ( squire.Summoned )
					squire.SummonMaster = from;

				this.Delete();
			}



		}
开发者ID:Tukaramdas,项目名称:ServUO-EC-Test-Fork,代码行数:54,代码来源:CarrierPigeon.cs

示例5: VerifyPlacement

		public bool VerifyPlacement( Mobile from, Rectangle2D area )
		{
			if( !from.CheckAlive() )
				return false;

			foreach( Item i in from.GetItemsInRange( 12 ) )
			{
				if( (i is TravelTent || i is TentAddon) && area.Contains( i ) )
					return false;
			}

			Region region = Region.Find( from.Location, from.Map );

			if( from.AccessLevel >= AccessLevel.GameMaster || region.AllowHousing( from, from.Location ) )
				return true;
			else if( !from.Map.CanFit( from.Location, 16 ) )
				return false;
			else if( region is TreasureRegion )
				return false;

			return (from.AccessLevel >= AccessLevel.GameMaster || region.AllowHousing( from, from.Location ));
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:22,代码来源:TravelTent.cs

示例6: OnResponse

			public override void OnResponse(Mobile from, string text)
			{
				if (text.Length > 40)
				{
					text = text.Substring(0, 40);
				}

				if (!from.CheckAlive() || !m_Book.IsChildOf(from.Backpack))
				{
					return;
				}

				m_Book.Name = Utility.FixHtml(text.Trim());

				from.SendMessage("This TMap Book name has been changed");
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:16,代码来源:TMapBook.cs

示例7: EndRelease

		public virtual void EndRelease( Mobile from )
		{
			if ( from == null || (!Deleted && Controlled && from == ControlMaster && from.CheckAlive()) )
			{
				Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 1, 13, 2100, 3, 5042, 0 );
				PlaySound( 0x201 );
				Delete();
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:9,代码来源:BaseFamiliar.cs

示例8: VendorSell

		public virtual void VendorSell( Mobile from )
		{
			if ( !IsActiveBuyer )
				return;

			if ( !from.CheckAlive() )
				return;

			if ( !CheckVendorAccess( from ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return;
			}

			Container pack = from.Backpack;

			if ( pack != null )
			{
				IShopSellInfo[] info = GetSellInfo();

				Dictionary<Item, SellItemState> table = new Dictionary<Item, SellItemState>();

				foreach ( IShopSellInfo ssi in info )
				{
					Item[] items = pack.FindItemsByType( ssi.Types );

					foreach ( Item item in items )
					{
						if ( item is Container && ( (Container)item ).Items.Count != 0 )
							continue;

						if ( item.IsStandardLoot() && item.Movable && ssi.IsSellable( item ) )
							table[item] = new SellItemState( item, ssi.GetSellPriceFor( item ), ssi.GetNameFor( item ) );
					}
				}

				if ( table.Count > 0 )
				{
					SendPacksTo( from );

					from.Send( new VendorSellList( this, table.Values ) );
				}
				else
				{
					Say( true, "You have nothing I would be interested in." );
				}
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:48,代码来源:BaseVendor.cs

示例9: BeginClaimList

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

			var list = new List<BaseCreature>();

			for (int i = 0; i < from.Stabled.Count; ++i)
			{
				var pet = from.Stabled[i] as BaseCreature;

				if (pet == null || pet.Deleted)
				{
					if (pet != null)
					{
						pet.IsStabled = false;
					}

					from.Stabled.RemoveAt(i);
					--i;
					continue;
				}

				list.Add(pet);
			}

			if (list.Count > 0)
			{
				from.SendGump(new ClaimListGump(this, from, list));
			}
			else
			{
				SayTo(from, 502671); // But I have no animals stabled with me at the moment!
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:37,代码来源:AnimalTrainer.cs

示例10: OnSecureTrade

			public override void OnSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
			{
				if (Deleted)
				{
					return;
				}

				Delete();

				if (m_Creature == null || m_Creature.Deleted || m_Creature.ControlMaster != from || !from.CheckAlive() ||
					!to.CheckAlive())
				{
					return;
				}

				if (from.Map != m_Creature.Map || !from.InRange(m_Creature, 14))
				{
					return;
				}

				if (accepted)
				{
					if (m_Creature.SetControlMaster(to))
					{
						if (m_Creature.Summoned)
						{
							m_Creature.SummonMaster = to;
						}

						m_Creature.ControlTarget = to;
						m_Creature.ControlOrder = OrderType.Follow;

						m_Creature.BondingBegin = DateTime.MinValue;
						m_Creature.OwnerAbandonTime = DateTime.MinValue;
						m_Creature.IsBonded = false;

						m_Creature.PlaySound(m_Creature.GetIdleSound());

						string args = String.Format("{0}\t{1}\t{2}", from.Name, m_Creature.Name, to.Name);

						from.SendLocalizedMessage(1043253, args); // You have transferred your pet to ~3_GETTER~.
						to.SendLocalizedMessage(1043252, args); // ~1_NAME~ has transferred the allegiance of ~2_PET_NAME~ to you.
					}
				}
			}
开发者ID:Crome696,项目名称:ServUO,代码行数:45,代码来源:BaseAI.cs

示例11: OnSellItems

		public virtual bool OnSellItems( Mobile seller, List<SellItemResponse> list )
		{
			if ( !IsActiveBuyer )
				return false;

			if ( !seller.CheckAlive() )
				return false;

			if ( !CheckVendorAccess( seller ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return false;
			}

			seller.PlaySound( 0x32 );

			IShopSellInfo[] info = GetSellInfo();
			IBuyItemInfo[] buyInfo = this.GetBuyInfo();
			int GiveGold = 0;
			int Sold = 0;
			Container cont;

			foreach ( SellItemResponse resp in list )
			{
				if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || ( resp.Item is Container && ( (Container)resp.Item ).Items.Count != 0 ) )
					continue;

				foreach ( IShopSellInfo ssi in info )
				{
					if ( ssi.IsSellable( resp.Item ) )
					{
						Sold++;
						break;
					}
				}
			}

			if ( Sold > MaxSell )
			{
				SayTo( seller, true, "You may only sell {0} items at a time!", MaxSell );
				return false;
			}
			else if ( Sold == 0 )
			{
				return true;
			}

			foreach ( SellItemResponse resp in list )
			{
				if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || ( resp.Item is Container && ( (Container)resp.Item ).Items.Count != 0 ) )
					continue;

				foreach ( IShopSellInfo ssi in info )
				{
					if ( ssi.IsSellable( resp.Item ) )
					{
						int amount = resp.Amount;

						if ( amount > resp.Item.Amount )
							amount = resp.Item.Amount;

						if ( ssi.IsResellable( resp.Item ) )
						{
							bool found = false;

							foreach ( IBuyItemInfo bii in buyInfo )
							{
								if ( bii.Restock( resp.Item, amount ) )
								{
									resp.Item.Consume( amount );
									found = true;

									break;
								}
							}

							if ( !found )
							{
								cont = this.BuyPack;

								if ( amount < resp.Item.Amount )
								{
									Item item = Mobile.LiftItemDupe( resp.Item, resp.Item.Amount - amount );

									if ( item != null )
									{
										item.SetLastMoved();
										cont.DropItem( item );
									}
									else
									{
										resp.Item.SetLastMoved();
										cont.DropItem( resp.Item );
									}
								}
								else
								{
									resp.Item.SetLastMoved();
									cont.DropItem( resp.Item );
								}
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:last-wish,代码行数:101,代码来源:BaseVendor.cs

示例12: OnSellItems

        public virtual bool OnSellItems(Mobile seller, ArrayList list)
        {
            if (!IsActiveBuyer)
                return false;

            if (!seller.CheckAlive())
                return false;

            if (!CheckVendorAccess(seller))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }

            seller.PlaySound(0x32);

            IShopSellInfo[] info = GetSellInfo();
            IBuyItemInfo[] buyInfo = this.GetBuyInfo();
            int GiveGold = 0;
            int Sold = 0;
            Container cont;
            ArrayList delete = new ArrayList();
            ArrayList drop = new ArrayList();

            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0)
                    continue;

                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        Sold++;
                        GiveGold += ssi.GetSellPriceFor(resp.Item) * resp.Amount;
                        break;
                    }
                }
            }

            if (Sold > MaxSell)
            {
                SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell);
                return false;
            }
            else if (Sold == 0)
            {
                return true;
            }
            else if (GiveGold > m_cash)
            {
                SayTo(seller, true, "Unfortunately I can't afford any more items. Please come back later.", MaxSell);
                return false;
            }
            GiveGold = 0;

            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0)
                    continue;

                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        int amount = resp.Amount;

                        if (amount > resp.Item.Amount)
                            amount = resp.Item.Amount;

                        if (ssi.IsResellable(resp.Item))
                        {
                            bool found = false;

                            foreach (IBuyItemInfo bii in buyInfo)
                            {
                                if (bii.Restock(resp.Item, amount))
                                {
                                    resp.Item.Consume(amount);
                                    found = true;

                                    break;
                                }
                            }

                            if (!found)
                            {
                                cont = this.BuyPack;

                                if (amount < resp.Item.Amount)
                                {
                                    resp.Item.Amount -= amount;
                                    Item item = resp.Item.Dupe(amount);
                                    item.SetLastMoved();
                                    cont.DropItem(item);
                                }
                                else
                                {
                                    resp.Item.SetLastMoved();
                                    cont.DropItem(resp.Item);
//.........这里部分代码省略.........
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:101,代码来源:BaseVendor.cs

示例13: BeginCustomize

		public void BeginCustomize( Mobile m )
		{
			if( !m.CheckAlive() ) {
				return;
			} else if ( SpellHelper.CheckCombat( m ) ) {
				m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
				return;
			}

			RelocateEntities();

			foreach( Item item in GetItems() )
			{
				item.Location = BanLocation;
			}

			foreach( Mobile mobile in GetMobiles() )
			{
				if( mobile != m )
					mobile.Location = BanLocation;
			}

			DesignContext.Add( m, this );
			m.Send( new BeginHouseCustomization( this ) );

			NetState ns = m.NetState;
			if( ns != null )
				SendInfoTo( ns );

			DesignState.SendDetailedInfoTo( ns );
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:31,代码来源:HouseFoundation.cs

示例14: OnResponse

			public override void OnResponse( Mobile from, string text )
			{
				if ( text.Length > 40 )
					text = text.Substring( 0, 40 );

				if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
				{
					m_Book.BookName = Utility.FixHtml( text.Trim() );

					from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
				}
			}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:12,代码来源:BulkOrderBook.cs

示例15: Claim

		public void Claim(Mobile from, string petName)
		{
			if (Deleted || !from.CheckAlive())
			{
				return;
			}

			bool claimed = false;
			int stabled = 0;

			bool claimByName = petName != null;

			for (int i = 0; i < from.Stabled.Count; ++i)
			{
				var pet = from.Stabled[i] as BaseCreature;

				if (pet == null || pet.Deleted)
				{
					if (pet != null)
					{
						pet.IsStabled = false;
					}

					from.Stabled.RemoveAt(i);
					--i;
					continue;
				}

				++stabled;

				if (claimByName && !Insensitive.Equals(pet.Name, petName))
				{
					continue;
				}

				if (CanClaim(from, pet))
				{
					int totalClaim = StablePrice * ((DateTime.UtcNow - pet.StabledDate).Days / ChargeFrequency);

					if (totalClaim <= 0 || from.AccessLevel >= AccessLevel.GameMaster ||
						Banker.WithdrawPackAndBank(from, TypeOfCurrency, totalClaim))
					{
						DoClaim(from, pet);
						from.Stabled.RemoveAt(i--);

						if (from is PlayerMobile)
						{
							((PlayerMobile)from).AutoStabled.Remove(pet);
						}

						claimed = true;
					}
					else
					{
						SayTo(from, "{0} remained in the stables because you require {0} {1}.", pet.Name, totalClaim, TypeOfCurrency.Name);
					}
				}
				else
				{
					SayTo(from, 1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers.
				}
			}

			if (claimed)
			{
				SayTo(from, 1042559); // Here you go... and good day to you!
			}
			else if (stabled == 0)
			{
				SayTo(from, 502671); // But I have no animals stabled with me at the moment!
			}
			else if (claimByName)
			{
				BeginClaimList(from);
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:76,代码来源:AnimalTrainer.cs


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