本文整理匯總了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.");
}