當前位置: 首頁>>代碼示例>>C#>>正文


C# PlayerMobile.GetItemsInRange方法代碼示例

本文整理匯總了C#中Server.Mobiles.PlayerMobile.GetItemsInRange方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerMobile.GetItemsInRange方法的具體用法?C# PlayerMobile.GetItemsInRange怎麽用?C# PlayerMobile.GetItemsInRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Mobiles.PlayerMobile的用法示例。


在下文中一共展示了PlayerMobile.GetItemsInRange方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FreeHueing

        private bool FreeHueing( PlayerMobile m )
        {
            foreach( Item item in m.GetItemsInRange(5) )
            {
                if( item is CreationChamberDyeTub )
                    return true;
            }

            return false;
        }
開發者ID:justdanofficial,項目名稱:khaeros,代碼行數:10,代碼來源:DyingTubGump.cs

示例2: DropItemInBagOrFeet

        public static bool DropItemInBagOrFeet(PlayerMobile player, MasterLooterBackpack backpack, Item item)
		{
			if ( player == null || item == null )
				return false;
			if ( backpack == null )
				backpack = GetMasterLooter(player);
			if ( backpack != null && backpack.TryDropItem(player, item, false) )
				return true;
			if ( player.Backpack != null && player.Backpack.TryDropItem(player, item, false) )
				return true;
			
			Map map = player.Map;
            if (map == null)
                return false;

            List<Item> atFeet = new List<Item>();
            foreach (Item obj in player.GetItemsInRange(0))
                atFeet.Add(obj);
            for (int i = 0; i < atFeet.Count; ++i)
            {
                Item check = atFeet[i];

                if (check.StackWith(player, item, false))
                    break;
            }
            item.MoveToWorld(player.Location, map);
			return true;
		}
開發者ID:Jascen,項目名稱:UOSmart,代碼行數:28,代碼來源:MasterLooterUtils.cs

示例3: Loot

		public void Loot( PlayerMobile player )
		{
			if ( !IsOwner(player) )
				return;
			List<Item> items = new List<Item>();
			List<Corpse> corpses = new List<Corpse>();

			foreach ( Item item in player.GetItemsInRange(3) )
			{
				if ( item is Corpse )
				{
					Corpse corpse = item as Corpse;
					if ( isCorpseLootable(player, corpse) )
						corpses.Add(corpse);
				}
				else if ( item.Movable && item.IsAccessibleTo(player) && isItemLootable(item) )
					items.Add(item);
 			}

			foreach ( Item item in items )
				TryDropItem(player, item, false);

				
			bool lootedAll = true;
			int totalTokens = 0;
			int retries = 3;
			foreach ( Corpse corpse in corpses )
			{
				if ( lootContainer(player, corpse) )
				{

					if ( DeleteAllCorpses || corpse.GetAmount(typeof(Item), false) == 0 )
					{

						int reward = getCorpseReward(corpse);

						if ( reward > 0 )
						{

							totalTokens += reward;
							//AddTokensAmount((ulong)reward);
							//AddGoldAmount((ulong)(reward*2));
						}

						corpse.Delete();
					}

				}
				else
				{
					lootedAll = false;
					if ( --retries == 0 )
						break;
				}
			}

			//if ( totalTokens > 0 )
			//{
			//	player.SendMessage(1173, "You gained " + totalTokens + " tokens for cleaning the shard.");
			//}
			//else
			//	player.SendMessage(1173, "You didn't gain a single token...");
			if ( !lootedAll )
				player.SendMessage(1173, "You can't loot all the items.");
		}
開發者ID:Jascen,項目名稱:UOSmart,代碼行數:65,代碼來源:MasterLooterBackpack.cs


注:本文中的Server.Mobiles.PlayerMobile.GetItemsInRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。