本文整理汇总了C#中Server.Items.Backpack.TryDropItem方法的典型用法代码示例。如果您正苦于以下问题:C# Backpack.TryDropItem方法的具体用法?C# Backpack.TryDropItem怎么用?C# Backpack.TryDropItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Items.Backpack
的用法示例。
在下文中一共展示了Backpack.TryDropItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveItemsToBank
private bool MoveItemsToBank( Mobile m )
{
Backpack bag = new Backpack();
ArrayList equip = new ArrayList( m.Items );
if ( m.Backpack != null )
{
// count clothing items
int WornCount = 0;
foreach ( Item i in equip )
{
if ( Moongate.RestrictedItem(m, i) == false )
continue; // not clothes
else
WornCount++;
}
// erl: added check for Mobile.Alive property... will not return false if mobile is not alive
if (125 - m.BankBox.TotalItems - 1 - m.Backpack.TotalItems - WornCount < 0 && m.Alive)
{
return false;
}
// Unequip any items being worn
foreach ( Item i in equip )
{
if (Moongate.RestrictedItem(m, i) == false )
continue;
else
m.Backpack.DropItem( i );
}
// Get a count of all items in the player's backpack.
ArrayList items = new ArrayList( m.Backpack.Items );
// Drop our new bag in the player's bank
m.BankBox.DropItem( bag );
// Run through all items in player's pack, move them to the bag we just dropped in the bank
foreach ( Item i in items )
{
// If there's room, drop the item in the bank, otherwise drop it on the ground
if ( bag.TryDropItem( m, i, false ) || !m.Alive )
bag.DropItem( i );
else
i.DropToWorld( m, m.Location );
}
}
// Give them a Deathrobe, Stinger dagger, and a blank spell book
if ( m.Alive )
{
Item robe = new Server.Items.DeathRobe();
if ( !m.EquipItem( robe ) )
robe.Delete();
}
Item aiStinger = new Server.Items.AIStinger();
if ( !m.AddToBackpack( aiStinger ) )
aiStinger.Delete();
Item spellbook = new Server.Items.Spellbook();
if ( !m.AddToBackpack( spellbook ) )
spellbook.Delete();
return true;
}