本文整理汇总了C#中Server.Items.Backpack.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# Backpack.Delete方法的具体用法?C# Backpack.Delete怎么用?C# Backpack.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Items.Backpack
的用法示例。
在下文中一共展示了Backpack.Delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLootBackpack
public virtual void AddLootBackpack(LootPack pack)
{
if (pack == null)
return;
if (Summoned)
return;
Container backpack = Backpack;
if (backpack == null)
{
backpack = new Backpack();
backpack.Movable = false;
AddItem(backpack);
}
//find top most container
while (backpack.FindItemByType(typeof(Backpack)) != null)
backpack = (Container)backpack.FindItemByType(typeof(Backpack));
Container LootBag = new Backpack();
backpack.DropItem(LootBag);
//base loot
pack.Generate(this, LootBag, m_Spawning, m_KillersLuck);
if (LootBag.Items.Count <= 0 && pack != LootPack.Undead)
{
LootBag.Delete();
return;
}
//extras
if (pack == LootPack.Poor)
{
switch (Utility.RandomMinMax(1, 2))
{
case 0: AddLootBackpack(LootPack.Poor); break;
case 1: AddLootGold(LootPack.PoorPile); break;
case 2: AddLootPouch(LootPack.PoorPouch); break;
}
}
else if (pack == LootPack.Meager)
{
switch (Utility.RandomMinMax(1,2))
{
case 0: AddLootBackpack(LootPack.Meager); break;
case 1: AddLootGold(LootPack.MeagerPile); break;
case 2: AddLootPouch(LootPack.MeagerPouch); break;
}
}
else if (pack == LootPack.Average)
{
switch (Utility.RandomMinMax(1, 2))
{
case 0: AddLootBackpack(LootPack.Average); break;
case 1: AddLootGold(LootPack.AveragePile); break;
case 2: AddLootPouch(LootPack.AveragePouch); break;
}
}
else if (pack == LootPack.Rich)
{
switch (Utility.RandomMinMax(1, 2))
{
case 0: AddLootBackpack(LootPack.Rich); break;
case 1: AddLootGold(LootPack.RichPile); break;
case 2: AddLootPouch(LootPack.RichPouch); break;
}
}
else if (pack == LootPack.FilthyRich)
{
switch (Utility.RandomMinMax(1,2))
{
case 0: AddLootBackpack(LootPack.FilthyRich); break;
case 1: AddLootGold(LootPack.FilthyRichPile); break;
case 2: AddLootPouch(LootPack.FilthyRichPouch); break;
}
}
else if (pack == LootPack.UltraRich)
{
switch (Utility.RandomMinMax(1, 2))
{
case 0: AddLootBackpack(LootPack.UltraRich); break;
case 1: AddLootGold(LootPack.UltraRichPile); break;
case 2: AddLootPouch(LootPack.UltraRichPouch); break;
}
}
else if (pack == LootPack.SuperBoss)
{
switch (Utility.RandomMinMax(1, 2))
{
case 0: AddLootBackpack(LootPack.SuperBoss); break;
case 1: AddLootGold(LootPack.SuperBossPile); break;
case 2: AddLootPouch(LootPack.SuperBossPouch); break;
}
}
else if (pack == LootPack.Special)
{
//.........这里部分代码省略.........
示例2: Destroy
public override void Destroy( bool toBackpack )
{
if ( RentalGold > 0 && House != null && House.IsAosRules )
{
if ( House.MovingCrate == null )
House.MovingCrate = new MovingCrate( House );
Banker.Deposit( House.MovingCrate, RentalGold );
RentalGold = 0;
}
if ( HoldGold > 0 && Owner != null)
{
Banker.Deposit(Owner, HoldGold);
HoldGold = 0;
}
List<Item> list = GetItems();
if ( list.Count > 0 && Owner != null && Owner.BankBox != null && Owner.BankBox.TotalItems < 124)
if ( ( !toBackpack || this.Map == Map.Internal ) && House != null && House.IsAosRules )
{
int itemsCanDrop = 124 - Owner.BankBox.TotalItems;
Backpack bag = new Backpack();
bag.Name = "Vendor Inventory Bag";
foreach ( Item item in list )
{
if (item is Container)
{
if (((Container)item).TotalItems == 0)
item.Delete();
else if (((Container)item).TotalItems < itemsCanDrop - 1)
{
bag.DropItem( item );
itemsCanDrop -= ((Container)item).TotalItems + 1;
}
}
else if (itemsCanDrop > 0)
{
bag.DropItem( item );
itemsCanDrop--;
}
}
if (bag.TotalItems > 0)
Owner.BankBox.DropItem( bag );
else bag.Delete();
}
base.Destroy( toBackpack );
}