/// <summary> /// This is called for every item that is dropped to a loot pack. /// Change the conditions here to add/remove Random Item Drops with REGULAR loot. /// </summary> /// <param name="item">item to be mutated</param> /// <param name="killer">Mobile.LastKiller</param> /// <param name="victim">the victim</param> public static bool GenerateRandomItem(Item item, Mobile killer, BaseCreature victim) { if (Enabled) { return(RunicReforging.GenerateRandomItem(item, killer, victim)); } return(false); }
/// <summary> /// This is called in BaseRunicTool to ensure all items use the new system, as long as its not palyermade. /// </summary> /// <param name="item"></param> /// <param name="luckChance">adjusted luck chance</param> /// <param name="attributeCount"></param> /// <param name="minIntensity"></param> /// <param name="maxIntensity"></param> public static void GenerateRandomItem(Item item, int luckChance, int attributeCount, int minIntensity, int maxIntensity) { int min = attributeCount * 2 * minIntensity; min = min + (int)(min * ((double)Utility.RandomMinMax(1, 4) / 10)); int max = attributeCount * 2 * maxIntensity; max = max + (int)(max * ((double)Utility.RandomMinMax(1, 4) / 10)); RunicReforging.GenerateRandomItem(item, luckChance, min, max); }
protected void AddLoot(Item item) { if (item == null) { return; } if (RandomItemGenerator.Enabled) { int min, max; TreasureMapChest.GetRandomItemStat(out min, out max); RunicReforging.GenerateRandomItem(item, 0, min, max); } DropItem(item); }
public void SpawnLoot() { List <Item> list = new List <Item>(Items); for (var index = 0; index < list.Count; index++) { Item item = list[index]; item.Delete(); } ColUtility.Free(list); int toSpawn = Utility.RandomMinMax(2, 4); for (int i = 0; i < toSpawn; i++) { Item item; if (i == 0) { item = Loot.RandomScroll(0, Loot.MageryScrollTypes.Length, SpellbookType.Regular); } else { item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(false, false, true); if (item is BaseWeapon weapon && 0.01 > Utility.RandomDouble()) { weapon.ExtendedWeaponAttributes.AssassinHoned = 1; } int min = 400; int max = 1400; RunicReforging.GenerateRandomItem(item, 0, min, max, Map); item.Hue = 1258; item.AttachSocket(new EnchantedHotItemSocket(this)); //EnchantedHotItem.AddItem(item, this); } DropItem(item); } }
public static void Fill(LockableContainer cont, int luck, int level, bool isSos, Map map) { cont.Movable = false; cont.Locked = true; int numberItems; if (level == 0) { cont.LockLevel = 0; // Can't be unlocked cont.DropItem(new Gold(Utility.RandomMinMax(50, 100))); if (Utility.RandomDouble() < 0.75) { cont.DropItem(new TreasureMap(0, Map.Trammel)); } } else { cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = level * 25; cont.TrapLevel = level; switch (level) { case 1: cont.RequiredSkill = 5; break; case 2: cont.RequiredSkill = 45; break; case 3: cont.RequiredSkill = 65; break; case 4: cont.RequiredSkill = 75; break; case 5: cont.RequiredSkill = 75; break; case 6: cont.RequiredSkill = 80; break; case 7: cont.RequiredSkill = 80; break; } cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; cont.DropItem(new Gold(level * 5000)); for (int i = 0; i < level * 5; ++i) { cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular)); } double propsScale = 1.0; if (Core.SE) { switch (level) { case 1: numberItems = 32; propsScale = 0.5625; break; case 2: numberItems = 40; propsScale = 0.6875; break; case 3: numberItems = 48; propsScale = 0.875; break; case 4: numberItems = 56; break; case 5: numberItems = 64; break; case 6: numberItems = 72; break; case 7: numberItems = 80; break; default: numberItems = 0; break; } } else { numberItems = level * 6; } for (int i = 0; i < numberItems; ++i) { Item item; if (Core.AOS) { item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(); } else { item = Loot.RandomArmorOrShieldOrWeapon(); } if (item != null && Core.HS && RandomItemGenerator.Enabled) { int min, max; GetRandomItemStat(out min, out max, propsScale); RunicReforging.GenerateRandomItem(item, luck, min, max, map); cont.DropItem(item); } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max); } else { weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6); } cont.DropItem(item); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max); } else { armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6); armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); } cont.DropItem(item); } else if (item is BaseHat) { BaseHat hat = (BaseHat)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max); } cont.DropItem(item); } else if (item is BaseJewel) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max); cont.DropItem(item); } } } int reagents; if (level == 0) { reagents = 12; } else { reagents = level + 1; } for (int i = 0; i < reagents; i++) { Item item = Loot.RandomPossibleReagent(); item.Amount = Utility.RandomMinMax(40, 60); cont.DropItem(item); } int gems; if (level == 0) { gems = 2; } else { gems = (level * 3) + 1; } for (int i = 0; i < gems; i++) { Item item = Loot.RandomGem(); cont.DropItem(item); } if (level > 1) { Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]); item.Amount = level; cont.DropItem(item); } Item arty = null; Item special = null; if (isSos) { if (0.004 * level > Utility.RandomDouble()) { arty = Loot.Construct(m_SOSArtifacts); } if (0.006 * level > Utility.RandomDouble()) { special = Loot.Construct(m_SOSDecor); } else if (0.009 * level > Utility.RandomDouble()) { special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map); } } else { if (level >= 7) { if (0.025 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelSevenOnly); } else if (0.10 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.25 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } arty = Loot.Construct(m_Artifacts); } else if (level >= 6) { if (0.025 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.10 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } arty = Loot.Construct(m_Artifacts); } else if (level >= 5) { if (0.05 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.25 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } } else if (.10 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } } if (arty != null) { Container pack = new Backpack(); pack.Hue = 1278; pack.DropItem(arty); cont.DropItem(pack); } if (special != null) { cont.DropItem(special); } if (Core.SA) { int rolls = 2; if (level >= 5) { rolls += level - 2; } RefinementComponent.Roll(cont, rolls, 0.10); } }
public virtual void Fill() { Reset(); List <Item> contains = new List <Item>(Items); foreach (var i in contains) { i.Delete(); } ColUtility.Free(contains); for (int i = 0; i < Utility.RandomMinMax(6, 12); i++) { DropItem(Loot.RandomGem()); } DropItem(new Gold(Utility.RandomMinMax(800, 1100))); Item item = null; if (0.30 > Utility.RandomDouble()) { switch (Utility.Random(7)) { case 0: item = new Bandage(Utility.Random(10, 30)); break; case 1: item = new SmokeBomb(); item.Amount = Utility.Random(3, 6); break; case 2: item = new InvisibilityPotion(); item.Amount = Utility.Random(1, 3); break; case 3: item = new Lockpick(Utility.Random(1, 10)); break; case 4: item = new DreadHornMane(Utility.Random(1, 2)); break; case 5: item = new Corruption(Utility.Random(1, 2)); break; case 6: item = new Taint(Utility.Random(1, 2)); break; } DropItem(item); } if (0.25 > Utility.RandomDouble()) { DropItem(new CounterfeitPlatinum()); } if (0.2 > Utility.RandomDouble()) { switch (Utility.Random(3)) { case 0: item = new ZombiePainting(); break; case 1: item = new SkeletonPortrait(); break; case 2: item = new LichPainting(); break; case 3: item = new RelicOfHydros(); break; case 4: item = new RelicOfLithos(); break; case 5: item = new RelicOfPyros(); break; case 6: item = new RelicOfStratos(); break; } DropItem(item); } if (0.1 > Utility.RandomDouble()) { item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this)); if (item != null) { TreasureMapChest.GetRandomItemStat(out int min, out int max, 1.0); RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Khaldun, Map); DropItem(item); } } }
private void Fill(int level) { TrapType = TrapType.ExplosionTrap; TrapPower = level * 25; TrapLevel = level; Locked = true; switch (level) { case 1: RequiredSkill = 36; break; case 2: RequiredSkill = 76; break; case 3: RequiredSkill = 84; break; case 4: RequiredSkill = 92; break; case 5: RequiredSkill = 100; break; case 6: RequiredSkill = 100; break; } LockLevel = RequiredSkill - 10; MaxLockLevel = RequiredSkill + 40; DropItem(new Gold(level * 200)); for (int i = 0; i < level; ++i) { DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular)); } for (int i = 0; i < level * 2; ++i) { Item item; if (Core.AOS) { item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(); } else { item = Loot.RandomArmorOrShieldOrWeapon(); } if (item != null && Core.HS && RandomItemGenerator.Enabled) { int min, max; TreasureMapChest.GetRandomItemStat(out min, out max); RunicReforging.GenerateRandomItem(item, 0, min, max); DropItem(item); continue; } if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max); } else { weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(6); weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(6); weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6); } DropItem(item); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max); } else { armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6); armor.Durability = (ArmorDurabilityLevel)Utility.Random(6); } DropItem(item); } else if (item is BaseHat) { BaseHat hat = (BaseHat)item; if (Core.AOS) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max); } DropItem(item); } else if (item is BaseJewel) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max); DropItem(item); } } for (int i = 0; i < level; i++) { Item item = Loot.RandomPossibleReagent(); item.Amount = Utility.RandomMinMax(40, 60); DropItem(item); } for (int i = 0; i < level; i++) { Item item = Loot.RandomGem(); DropItem(item); } DropItem(new TreasureMap(level + 1, (Siege.SiegeShard ? Map.Felucca : Utility.RandomBool() ? Map.Felucca : Map.Trammel))); }
public static void Fill(Mobile from, LockableContainer cont, int level, bool isSos) { var map = from.Map; var luck = from is PlayerMobile ? ((PlayerMobile)from).RealLuck : from.Luck; cont.Movable = false; cont.Locked = true; int count; if (level == 0) { cont.LockLevel = 0; // Can't be unlocked cont.DropItem(new Gold(Utility.RandomMinMax(50, 100))); if (Utility.RandomDouble() < 0.75) { cont.DropItem(new TreasureMap(0, Map.Trammel)); } } else { cont.TrapType = TrapType.ExplosionTrap; cont.TrapPower = level * 25; cont.TrapLevel = level; switch (level) { case 1: cont.RequiredSkill = 5; break; case 2: cont.RequiredSkill = 45; break; case 3: cont.RequiredSkill = 65; break; case 4: cont.RequiredSkill = 75; break; case 5: cont.RequiredSkill = 75; break; case 6: cont.RequiredSkill = 80; break; case 7: cont.RequiredSkill = 80; break; } cont.LockLevel = cont.RequiredSkill - 10; cont.MaxLockLevel = cont.RequiredSkill + 40; #region Gold cont.DropItem(new Gold(isSos ? level * 10000 : level * 5000)); #endregion #region Scrolls if (isSos) { switch (level) { default: count = 20; break; case 0: case 1: count = Utility.RandomMinMax(2, 5); break; case 2: count = Utility.RandomMinMax(10, 15); break; } } else { count = level * 5; } for (int i = 0; i < count; ++i) { cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular)); } #endregion #region Magical Items double propsScale = 1.0; switch (level) { case 1: count = isSos ? Utility.RandomMinMax(2, 6) : 32; propsScale = 0.5625; break; case 2: count = isSos ? Utility.RandomMinMax(10, 15) : 40; propsScale = 0.6875; break; case 3: count = isSos ? Utility.RandomMinMax(15, 20) : 48; propsScale = 0.875; break; case 4: count = isSos ? Utility.RandomMinMax(15, 20) : 56; break; case 5: count = isSos ? Utility.RandomMinMax(15, 20) : 64; break; case 6: count = isSos ? Utility.RandomMinMax(15, 20) : 72; break; case 7: count = isSos ? Utility.RandomMinMax(15, 20) : 80; break; default: count = 0; break; } for (int i = 0; i < count; ++i) { Item item; item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(); if (item != null && RandomItemGenerator.Enabled) { int min, max; GetRandomItemStat(out min, out max, propsScale); RunicReforging.GenerateRandomItem(item, luck, min, max, map); cont.DropItem(item); } else if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max); cont.DropItem(item); } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max); cont.DropItem(item); } else if (item is BaseHat) { BaseHat hat = (BaseHat)item; int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max); cont.DropItem(item); } else if (item is BaseJewel) { int attributeCount; int min, max; GetRandomAOSStats(out attributeCount, out min, out max); BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max); cont.DropItem(item); } } } #endregion #region Reagents if (isSos) { switch (level) { default: count = Utility.RandomMinMax(45, 60); break; case 0: case 1: count = Utility.RandomMinMax(15, 20); break; case 2: count = Utility.RandomMinMax(25, 40); break; } } else { count = level == 0 ? 12 : Utility.RandomMinMax(40, 60) * (level + 1); } for (int i = 0; i < count; i++) { cont.DropItemStacked(Loot.RandomPossibleReagent()); } #endregion #region Gems if (level == 0) { count = 2; } else { count = (level * 3) + 1; } for (int i = 0; i < count; i++) { cont.DropItem(Loot.RandomGem()); } #endregion #region Imbuing Ingreds if (level > 1) { Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]); item.Amount = level; cont.DropItem(item); } #endregion Item arty = null; Item special = null; if (isSos) { if (0.004 * level > Utility.RandomDouble()) { arty = Loot.Construct(m_SOSArtifacts); } if (0.006 * level > Utility.RandomDouble()) { special = Loot.Construct(m_SOSDecor); } else if (0.009 * level > Utility.RandomDouble()) { special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map); } } else { if (level >= 7) { if (0.025 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelSevenOnly); } else if (0.10 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.25 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } arty = Loot.Construct(m_Artifacts); } else if (level >= 6) { if (0.025 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.20 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } arty = Loot.Construct(m_Artifacts); } else if (level >= 5) { if (0.005 > Utility.RandomDouble()) { special = Loot.Construct(m_LevelFiveToSeven); } else if (0.15 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } } else if (.10 > Utility.RandomDouble()) { special = GetRandomSpecial(level, cont.Map); } } if (arty != null) { Container pack = new Backpack(); pack.Hue = 1278; pack.DropItem(arty); cont.DropItem(pack); } if (special != null) { cont.DropItem(special); } int rolls = 2; if (level >= 5) { rolls += level - 2; } RefinementComponent.Roll(cont, rolls, 0.10); }