public void Generate(BaseCreature npc) { if (npc == null || npc.Summoned) { return; } for (int i = 0; i < m_Entries.Length; ++i) { LootPackEntry entry = m_Entries[i]; if (!(entry.Chance > Utility.Random(10000))) { continue; } Item item = entry.Construct(); if (item != null) { if (npc.Backpack == null) { npc.AddItem(new Backpack()); } if (!item.Stackable || !npc.Backpack.TryDropItem(npc, item, false)) { npc.Backpack.DropItem(item); } } } }