public void Generate( Mobile from, Container cont, bool spawning, int luckChance ) { if ( cont == null ) return; bool checkLuck = true; for ( int i = 0; i < m_Entries.Length; ++i ) { LootPackEntry entry = m_Entries[i]; bool shouldAdd = ( entry.Chance > Utility.Random( 10000 ) ); if ( !shouldAdd && checkLuck ) { checkLuck = false; if ( LootPack.CheckLuck( luckChance ) ) shouldAdd = ( entry.Chance > Utility.Random( 10000 ) ); } if ( !shouldAdd ) continue; Item item = entry.Construct( from, luckChance, spawning ); if ( item != null ) { if ( !item.Stackable || !cont.TryDropItem( from, item, false ) ) cont.DropItem( item ); } } }
public Item Mutate( Mobile from, int luckChance, Item item ) { if ( item != null ) { if ( item is BaseWeapon && 1 > Utility.Random( 100 ) ) { item.Delete(); item = new FireHorn(); return item; } if ( item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat ) { int bonusProps = GetBonusProperties(); if ( bonusProps < m_MaxProps && LootPack.CheckLuck( luckChance ) ) ++bonusProps; int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if ( props > m_MaxProps ) props = m_MaxProps; if ( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo( (BaseWeapon) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo( (BaseArmor) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo( (BaseJewel) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseHat ) BaseRunicTool.ApplyAttributesTo( (BaseHat) item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); } else if ( item is BaseInstrument ) { SlayerName slayer = SlayerName.None; slayer = BaseRunicTool.GetRandomSlayer(); if ( slayer == SlayerName.None ) { item.Delete(); return null; } BaseInstrument instr = (BaseInstrument) item; instr.Slayer = slayer; } if ( item.Stackable ) item.Amount = m_Quantity.Roll(); } return item; }
public void Generate(Mobile from, Container cont, bool spawning) { if (cont == null) { return; } int luckChance = 0; if (!spawning) { luckChance = LootPack.GetLuckChanceForKiller(from); } for (int i = 0; i < m_Entries.Length; ++i) { LootPackEntry entry = m_Entries[i]; bool shouldAdd = entry.Chance > Utility.Random(10000); if (!shouldAdd) { if (LootPack.CheckLuck(luckChance)) { shouldAdd = entry.Chance > Utility.Random(10000); } } if (!shouldAdd) { continue; } Item item = entry.Construct(from, luckChance, spawning); if (item != null) { if (!item.Stackable || !cont.TryDropItem(from, item, false)) { cont.DropItem(item); } } } }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (Core.AOS) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > m_MaxProps) { props = m_MaxProps; } // Try to generate a new random item if (from is BaseCreature) { if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from)) { return(item); } } else if (RandomItemGenerator.GenerateRandomItem(item, null, null)) { return(item); } // Otherwise use the older style random generation if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat || item is BaseEarrings) { if (Core.AOS) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with too many properties. if (props > m_MaxProps) { props = m_MaxProps; } if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseEarrings) { BaseRunicTool.ApplyAttributesTo((BaseEarrings)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } if (bonusProps >= 5 || item is BaseEarrings) //Item is epic and should be cursed 95% chance { if (Utility.RandomDouble() > .05) { item.LootType = LootType.Cursed; } } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; if (instr.Slayer == SlayerName.None) { instr.Slayer = slayer; } else { instr.Slayer2 = slayer; } if (instr.Slayer2 != SlayerName.None) { if (Utility.RandomDouble() > .05) { item.LootType = LootType.Cursed; } } } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public void Generate(Mobile from, Container cont, bool spawning, int luckChance) { if (cont == null) { return; } bool checkLuck = Core.AOS; for (int i = 0; i < m_Entries.Length; ++i) { LootPackEntry entry = m_Entries[i]; bool shouldAdd = (entry.Chance > Utility.Random(10000)); if (!shouldAdd && checkLuck) { checkLuck = false; if (LootPack.CheckLuck(luckChance)) { shouldAdd = (entry.Chance > Utility.Random(10000)); } } if (!shouldAdd) { continue; } Item item = entry.Construct(from, luckChance, spawning); // Plume begin check Identification if (item is BaseWeapon || item is BaseArmor || item is BaseClothing || item is BaseJewel) { bool IsID = true; int bonusProps = entry.GetBonusProperties(); double min = (double)entry.MinIntensity; double max = (double)entry.MaxIntensity; if (bonusProps < entry.MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; double dblID = (((min / max) + (min / 5.0) + (max / 10.0)) * (props + props / 10.0)) / 100.0; if (props >= 5 && Utility.Random(0, 100) > 1) { IsID = false; } else if (dblID > Utility.RandomDouble()) { IsID = false; } if (!IsID) { if (item is BaseWeapon) { ((BaseWeapon)item).Identified = false; } else if (item is BaseArmor) { ((BaseArmor)item).Identified = false; } else if (item is BaseClothing) { ((BaseClothing)item).Identified = false; } else if (item is BaseJewel) { ((BaseJewel)item).Identified = false; } } } // End if (item != null) { if (!item.Stackable || !cont.TryDropItem(from, item, false)) { cont.DropItem(item); } } } }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel) { if (Core.AOS) { int bonusProps = GetBonusProperties(); if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { // Try to generate a new random item based on the creature killed if (RandomItemGenerator.Enabled && from is BaseCreature) { if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from)) { return(item); } } int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > m_MaxProps) { props = m_MaxProps; } // Use the older style random generation if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseHat) { BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; slayer = BaseRunicTool.GetRandomSlayer(); if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = ItemQuality.Normal; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon || item is BaseArmor || item is BaseJewel) { if (Core.AOS) { int bonusProps = GetBonusProperties(); int min = m_MinIntensity; int max = m_MaxIntensity; if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; if (item is BaseWeapon) { BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseArmor) { BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } else if (item is BaseJewel) { BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity); } } else // not aos { if (item is BaseWeapon) { BaseWeapon weapon = (BaseWeapon)item; if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); } if (20 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && 35 > Utility.Random(100)) { switch (Utility.Random(25)) { case 0: { weapon.Slayer = SlayerName.Silver; break; } case 1: { weapon.Slayer = SlayerName.OrcSlaying; break; } case 2: { weapon.Slayer = SlayerName.TrollSlaughter; break; } case 3: { weapon.Slayer = SlayerName.OgreTrashing; break; } case 4: { weapon.Slayer = SlayerName.Repond; break; } case 5: { weapon.Slayer = SlayerName.DragonSlaying; break; } case 6: { weapon.Slayer = SlayerName.Terathan; break; } case 7: { weapon.Slayer = SlayerName.LizardmanSlaughter; break; } case 8: { weapon.Slayer = SlayerName.ReptilianDeath; break; } case 9: { weapon.Slayer = SlayerName.DaemonDismissal; break; } case 10: { weapon.Slayer = SlayerName.GargoylesFoe; break; } case 11: { weapon.Slayer = SlayerName.BalronDamnation; break; } case 12: { weapon.Slayer = SlayerName.Exorcism; break; } case 13: { weapon.Slayer = SlayerName.Ophidian; break; } case 14: { weapon.Slayer = SlayerName.SpidersDeath; break; } case 15: { weapon.Slayer = SlayerName.ScorpionsBane; break; } case 16: { weapon.Slayer = SlayerName.ArachnidDoom; break; } case 17: { weapon.Slayer = SlayerName.FlameDousing; break; } case 18: { weapon.Slayer = SlayerName.WaterDissipation; break; } case 19: { weapon.Slayer = SlayerName.Vacuum; break; } case 20: { weapon.Slayer = SlayerName.ElementalHealth; break; } case 21: { weapon.Slayer = SlayerName.EarthShatter; break; } case 22: { weapon.Slayer = SlayerName.BloodDrinking; break; } case 23: { weapon.Slayer = SlayerName.SummerWind; break; } case 24: { weapon.Slayer = SlayerName.ElementalBan; break; } case 25: { weapon.Slayer = SlayerName.Fey; break; } } } } else if (item is BaseArmor) { BaseArmor armor = (BaseArmor)item; if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(); } } else if (item is BaseJewel) { BaseJewel jewel = (BaseJewel)item; if (80 > Utility.Random(100)) { jewel.Effect = (MagicEffect)Utility.Random(0, 11); jewel.Uses = Utility.Random(1, 10); } } } } else if (item is BaseInstrument) { SlayerName slayer = SlayerName.None; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = (BaseInstrument)item; instr.Quality = InstrumentQuality.Regular; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = m_Quantity.Roll(); } } return(item); }
public Item Mutate(Mobile from, int luckChance, Item item) { if (item != null) { if (item is BaseWeapon && 1 > Utility.Random(100)) { item.Delete(); item = new FireHorn(); return(item); } if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) { if (Core.AOS) { int bonusProps = GetBonusProperties(); if (bonusProps < MaxProps && LootPack.CheckLuck(luckChance)) { ++bonusProps; } int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if (props > MaxProps) { props = MaxProps; } if (item is BaseWeapon weapon) { BaseRunicTool.ApplyAttributesTo(weapon, false, luckChance, props, MinIntensity, MaxIntensity); } else if (item is BaseArmor armor) { BaseRunicTool.ApplyAttributesTo(armor, false, luckChance, props, MinIntensity, MaxIntensity); } else if (item is BaseJewel jewel) { BaseRunicTool.ApplyAttributesTo(jewel, false, luckChance, props, MinIntensity, MaxIntensity); } else if (item is BaseHat hat) { BaseRunicTool.ApplyAttributesTo(hat, false, luckChance, props, MinIntensity, MaxIntensity); } } else // not aos { if (item is BaseWeapon weapon) { if (80 > Utility.Random(100)) { weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); } if (60 > Utility.Random(100)) { weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { weapon.DurabilityLevel = (DurabilityLevel)GetRandomOldBonus(); } if (5 > Utility.Random(100)) { weapon.Slayer = SlayerName.Silver; } if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)) { weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } } else if (item is BaseArmor armor) { if (80 > Utility.Random(100)) { armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(); } if (40 > Utility.Random(100)) { armor.Durability = (DurabilityLevel)GetRandomOldBonus(); } } } } else if (item is BaseInstrument instrument) { SlayerName slayer; if (Core.AOS) { slayer = BaseRunicTool.GetRandomSlayer(); } else { slayer = SlayerGroup.GetLootSlayerType(from.GetType()); } if (slayer == SlayerName.None) { item.Delete(); return(null); } BaseInstrument instr = instrument; instr.Quality = ItemQuality.Normal; instr.Slayer = slayer; } if (item.Stackable) { item.Amount = Quantity.Roll(); } } return(item); }