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) { switch (Utility.RandomMinMax(1, 2)) { case 0: AddLootBackpack(LootPack.Special); break; case 1: AddLootGold(LootPack.SpecialPile); break; case 2: AddLootPouch(LootPack.SpecialPouch); break; } } else if (pack == LootPack.Undead) { LootBag.DropItem(Loot.RandomScroll(0, 64, SpellbookType.Regular)); if (Utility.Random(3) == 3) LootBag.DropItem(Loot.RandomPotion()); switch (Utility.Random(2)) { case 0: AddLootGold(LootPack.RichPile); break; case 1: AddLootPouch(LootPack.RichPouch); break; } } }
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 ); }