private bool CheckLoot(Mobile m, bool criminalAction) { if (m_Owner == null || m == m_Owner) { return(true); } Party p = Party.Get(m_Owner); if (p != null && p.Contains(m)) { return(true); } if (TreasureTheme.IsOverlandTheme(m_type) == true) { return(true); } Map map = this.Map; if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) { if (criminalAction) { m.CriminalAction(true); } else { m.SendLocalizedMessage(1010630); // Taking someone else's treasure is a criminal offense! } return(true); } m.SendLocalizedMessage(1010631); // You did not discover this chest! return(false); }
public static void Fill(LockableContainer cont, int level, bool IsThemed, ChestThemeType type) { cont.Movable = false; // the speial Overland Treasure Hunter NPC 'unlocks' the chest for you! if (TreasureTheme.IsOverlandTheme(type) == false) { cont.TrapType = Utility.RandomBool() ? TrapType.PoisonTrap : TrapType.ExplosionTrap; cont.TrapPower = level * 25; cont.Locked = true; } switch (level) { case 1: cont.RequiredSkill = 36; break; case 2: cont.RequiredSkill = 76; break; case 3: cont.RequiredSkill = 84; break; case 4: cont.RequiredSkill = 92; break; case 5: cont.RequiredSkill = 100; break; } cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; // add theme loot AddThemeLoot(cont, level, type); // now for the gold cont.DropItem(new Gold(level * 1000)); //if not a undead or pirate chest add scrolls if (type != ChestThemeType.Pirate || type != ChestThemeType.Undead) { // adam: Changed to drop scrolls appropriatre for the level. for (int i = 0; i < level * 5; ++i) { int minCircle = level; int maxCircle = (level + 3); PackScroll(cont, minCircle, maxCircle); } } // magic armor and weapons int count = MagicArmsThrottle(level); // calc amount of magic armor and weapons to drop if (IsThemed == true) { count /= 2; // adam: Less loot if a themed chest because they get other goodies. } for (int i = 0; i < count; ++i) { Item item; item = Loot.RandomArmorOrShieldOrWeapon(); item = Loot.ImbueWeaponOrArmor(item, level, 0.05, false); // erl: SDrop chance // .. if (Server.Engines.SDrop.SDropTest(item, CoreAI.EScrollChance)) { // Drop a scroll instead EnchantedScroll escroll = Loot.GenEScroll((object)item); // Delete the original item item.Delete(); // Re-reference item to escroll and continue item = (Item)escroll; } // .. cont.DropItem(item); } PackRegs(cont, level * 20); PackGems(cont, level * 10); }