本文整理汇总了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;
}
示例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;
}
示例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.");
}