RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0] Random Loot Resources

Cervontose

Wanderer
[RunUO 2.0] Random Loot Resources

Hello everyone! This here is my first public release, so bear with me if there are any problems, or bad practices! I'm glad to finally see this working... It's been a dream of mine for quite some time.

This script is compatable with the latest RunUO 2.0 release (Final). It can be modified very easily to fit your shards resources even if you have custom ones!

I tried to comment what I did as best as I could... I hope I didn't forget anything!

EDIT
This script has been updated! I went away for a while and did not realize I made a few mistakes. I've fixed them, and balanced the chances a bit better.
I'd also like to thank runuo_user for updating and adding a common custom resource pack to this for your use!runuo_user's quick resource modification

Description

This system does the following to all lootpack based drops.

Items now will have a chance at being found to be crafted with resource types!
Wood items have a chance to drop with different wood resources.
Leather items have a chance to drop with different leather resources.
Metal items have a chance to drop with different resources.

In addition to this... Each dropped item has a small chance at being exceptional as well!

Installation
This script release modifies LootPack.cs
You can install this one of two ways.
1: Simple copy and replace your original LootPack.cs in your Scripts/Misc folder.
The attached file LootPack2.0 is compatible with the unmodified RunUo 2.0 Final release.

2:In Lootpack.cs you will find the following code.


Code:
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 );

After this, copy and paste this code below it.

Code:
#region Items Resource/Exceptional Mutate
						if ( item is BaseStaff || item is BaseRanged || item is Club ) // Check to see if item is made of wood - Staffs, Bows, and Club.
						{
							BaseWeapon woodweapon = (BaseWeapon)item; // Taking the created item, setting it as woodweapon itemtype to add modifiers.
							int ww_chancewheel = Utility.Random( 600 ); // Random number for chance of woods to be mutated
							
                            if ( ww_chancewheel <= 12 ) //If the ww_chance number is generated as less then 12, continue with code in brackets.
                            {     woodweapon.Resource = CraftResource.Frostwood; // Taking created item that was type woodweapon and setting the resource to Woodtype
                            }else if ( ww_chancewheel <= 20 )
                            {     woodweapon.Resource = CraftResource.Bloodwood;
                            }else if ( ww_chancewheel <= 31 )
                            {     woodweapon.Resource = CraftResource.Heartwood;
                            }else if ( ww_chancewheel <= 47 )
                            {     woodweapon.Resource = CraftResource.YewWood;
                            }else if ( ww_chancewheel <= 78 )
                            {     woodweapon.Resource = CraftResource.AshWood;
                            }else if ( ww_chancewheel <= 121 )
                            {     woodweapon.Resource = CraftResource.OakWood;
                            }else // If the random number does not meet any of the above, it does this.
                            {     woodweapon.Resource = CraftResource.RegularWood;
                            }
							
							if ( 0.25 > Utility.RandomDouble() ) // 25% chance for creating item which is exceptional
							woodweapon.Quality = WeaponQuality.Exceptional;		
						}
						
						else if ( item is BaseWeapon )
						{
						BaseWeapon metalweapon = (BaseWeapon)item;
							int mw_chancewheel = Utility.Random( 600 );
                            if ( mw_chancewheel <= 12 )
                            {     metalweapon.Resource = CraftResource.Valorite;
                            }else if ( mw_chancewheel <= 20 )
                            {     metalweapon.Resource = CraftResource.Verite;
                            }else if ( mw_chancewheel <= 31 )
                            {     metalweapon.Resource = CraftResource.Agapite;
                            }else if ( mw_chancewheel <= 47 )
                            {     metalweapon.Resource = CraftResource.Gold;
                            }else if ( mw_chancewheel <= 78 )
                            {     metalweapon.Resource = CraftResource.Bronze;
                            }else if ( mw_chancewheel <= 121 )
                            {     metalweapon.Resource = CraftResource.Copper;
                            }else if ( mw_chancewheel <= 142 )
                            {     metalweapon.Resource = CraftResource.ShadowIron;
                            }else if ( mw_chancewheel <= 159 )
                            {     metalweapon.Resource = CraftResource.DullCopper;
                            }else
                            {     metalweapon.Resource = CraftResource.Iron;
                            } 	
                            if ( 0.25 > Utility.RandomDouble() )
							metalweapon.Quality = WeaponQuality.Exceptional;								
						}
	
					if ( item is BaseArmor )
				    {
					    BaseArmor armortype = (BaseArmor)item;
						if  ( armortype.Resource == CraftResource.Iron )
						{ 
                            int ma_chancewheel = Utility.Random( 600 );
                            if ( ma_chancewheel <= 12 )
                            {     armortype.Resource = CraftResource.Valorite;
                            }else if ( ma_chancewheel <= 20 )
                            {     armortype.Resource = CraftResource.Verite;
                            }else if ( ma_chancewheel <= 31 )
                            {     armortype.Resource = CraftResource.Agapite;
                            }else if ( ma_chancewheel <= 47 )
                            {     armortype.Resource = CraftResource.Gold;
                            }else if ( ma_chancewheel <= 78 )
                            {     armortype.Resource = CraftResource.Bronze;
                            }else if ( ma_chancewheel <= 121 )
                            {     armortype.Resource = CraftResource.Copper;
                            }else if ( ma_chancewheel <= 142 )
                            {     armortype.Resource = CraftResource.ShadowIron;
                            }else if ( ma_chancewheel <= 159 )
                            {     armortype.Resource = CraftResource.DullCopper;
                            }else
                            {     armortype.Resource = CraftResource.Iron;
                            }
						}

						if  ( armortype.Resource == CraftResource.RegularLeather )
						{ 
                            int la_chancewheel = Utility.Random( 600 );
                            if ( la_chancewheel <= 12 )
                            {     armortype.Resource = CraftResource.BarbedLeather;
                            }else if ( la_chancewheel <= 47 )
                            {     armortype.Resource = CraftResource.HornedLeather;
                            }else if ( la_chancewheel <= 142  )
                            {     armortype.Resource = CraftResource.SpinedLeather;
                            }else
                            {     armortype.Resource = CraftResource.RegularLeather;
                            }
						}

						if  ( armortype.Resource == CraftResource.RegularWood )
						{
							int wa_chancewheel = Utility.Random( 600 );
                            if ( wa_chancewheel <= 12 )
                            {     armortype.Resource = CraftResource.Frostwood;
                            }else if ( wa_chancewheel <= 20 )
                            {     armortype.Resource = CraftResource.Bloodwood;
                            }else if ( wa_chancewheel <= 31 )
                            {     armortype.Resource = CraftResource.Heartwood;
                            }else if ( wa_chancewheel <= 78 )
                            {     armortype.Resource = CraftResource.YewWood;
                            }else if ( wa_chancewheel <= 121 )
                            {     armortype.Resource = CraftResource.AshWood;
                            }else if ( wa_chancewheel <= 142 )
                            {     armortype.Resource = CraftResource.OakWood;
                            }else
                            {     armortype.Resource = CraftResource.RegularWood;						
							}
						}
						
						if ( 0.25 > Utility.RandomDouble() )
						armortype.Quality = ArmorQuality.Exceptional;
						#endregion

Restart your shard, and happy hunting to your players... That is all that is needed... After a restart, everything will be golden to appear in loot from lootpack drops!

I would like to thank Lord_Greywolf for assisting me on how to define a few things in the scripts... Funny how you can miss things by such a tiny bit :D So, thank you very much!
 

Attachments

  • LootPack2.0.zip
    5.7 KB · Views: 74

Gorelord13

Wanderer
Umm i am a Tad confused, is this the system that allowes items to drop off any creature at a %? like if i killed a DarkFather it would say something like "You have a XXX% chance of getting a Artifact" that system? if not could someone post the link to this system please. Thank You
 

Cervontose

Wanderer
Gorelord13;831609 said:
Umm i am a Tad confused, is this the system that allowes items to drop off any creature at a %? like if i killed a DarkFather it would say something like "You have a XXX% chance of getting a Artifact" that system? if not could someone post the link to this system please. Thank You

The loot from random creatures like Bone Knight's, Lich's, Dragon's/etc will have a chance at having resource types other then just plain. (Valorite, bronze, leather types, etc) As well as being exceptional.
 

Fixxxer

Sorceror
a bit of a problem

I had edits already to my lootpack.cs and after using compare it to the two files I got it up and running however now all creatures drop only very small amounts of gold, killing dread horn only gave 8 gold, and skeletons give 1 gold. Any help on this would be great thanks.

This is the edited lootpack I am using.
Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using System.Collections.Generic;
using Server.Engines.XmlSpawner2;

namespace Server
{
	public class LootPack
	{
		public static int GetLuckChance( Mobile killer, Mobile victim )
		{
			if ( !Core.AOS )
				return 0;

			int luck = killer.Luck;

			PlayerMobile pmKiller = killer as PlayerMobile;
			if( pmKiller != null && pmKiller.SentHonorContext != null && pmKiller.SentHonorContext.Target == victim )
				luck += pmKiller.SentHonorContext.PerfectionLuckBonus;

			if ( luck < 0 )
				return 0;

			if ( !Core.SE && luck > 1200 )
				luck = 1200;

			return (int)(Math.Pow( luck, 1 / 1.8 ) * 100);
		}

		public static int GetLuckChanceForKiller( Mobile dead )
		{
			List<DamageStore> list = BaseCreature.GetLootingRights( dead.DamageEntries, dead.HitsMax );

			DamageStore highest = null;

			for ( int i = 0; i < list.Count; ++i )
			{
				DamageStore ds = list[i];

				if ( ds.m_HasRight && (highest == null || ds.m_Damage > highest.m_Damage) )
					highest = ds;
			}

			if ( highest == null )
				return 0;

			return GetLuckChance( highest.m_Mobile, dead );
		}

		public static bool CheckLuck( int chance )
		{
			return ( chance > Utility.Random( 10000 ) );
		}

		private LootPackEntry[] m_Entries;

		public LootPack( LootPackEntry[] entries )
		{
			m_Entries = entries;
		}

		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 );

				if ( item != null )
				{
					if ( !item.Stackable || !cont.TryDropItem( from, item, false ) )
						cont.DropItem( item );
				}
			}
		}

		public static readonly LootPackItem[] Gold = new LootPackItem[]
			{
				new LootPackItem( typeof( Gold ), 1 )
			};

		//ARTEGORDONMOD
		// socket lootpack drop mod
		private static readonly LootPackItem[] SocketAugmentation = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseSocketAugmentation ), 1 )
			};

		public static readonly LootPackItem[] Instruments = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseInstrument ), 1 )
			};


		public static readonly LootPackItem[] LowScrollItems = new LootPackItem[]
			{
				new LootPackItem( typeof( ClumsyScroll ), 1 )
			};

		public static readonly LootPackItem[] MedScrollItems = new LootPackItem[]
			{
				new LootPackItem( typeof( ArchCureScroll ), 1 )
			};

		public static readonly LootPackItem[] HighScrollItems = new LootPackItem[]
			{
				new LootPackItem( typeof( SummonAirElementalScroll ), 1 )
			};

		public static readonly LootPackItem[] GemItems = new LootPackItem[]
			{
				new LootPackItem( typeof( Amber ), 1 )
			};

		public static readonly LootPackItem[] PotionItems = new LootPackItem[]
			{
				new LootPackItem( typeof( AgilityPotion ), 1 ),
				new LootPackItem( typeof( StrengthPotion ), 1 ),
				new LootPackItem( typeof( RefreshPotion ), 1 ),
				new LootPackItem( typeof( LesserCurePotion ), 1 ),
				new LootPackItem( typeof( LesserHealPotion ), 1 ),
				new LootPackItem( typeof( LesserPoisonPotion ), 1 )
			};

		#region Old Magic Items
		public static readonly LootPackItem[] OldMagicItems = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseJewel ), 1 ),
				new LootPackItem( typeof( BaseArmor ), 4 ),
				new LootPackItem( typeof( BaseWeapon ), 3 ),
				new LootPackItem( typeof( BaseRanged ), 1 ),
				new LootPackItem( typeof( BaseShield ), 1 )
			};
		#endregion

		#region AOS Magic Items
		public static readonly LootPackItem[] AosMagicItemsPoor = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 3 ),
				new LootPackItem( typeof( BaseRanged ), 1 ),
				new LootPackItem( typeof( BaseArmor ), 4 ),
				new LootPackItem( typeof( BaseShield ), 1 ),
				new LootPackItem( typeof( BaseJewel ), 2 )
			};

		public static readonly LootPackItem[] AosMagicItemsMeagerType1 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 56 ),
				new LootPackItem( typeof( BaseRanged ), 14 ),
				new LootPackItem( typeof( BaseArmor ), 81 ),
				new LootPackItem( typeof( BaseShield ), 11 ),
				new LootPackItem( typeof( BaseJewel ), 42 )
			};

		public static readonly LootPackItem[] AosMagicItemsMeagerType2 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 28 ),
				new LootPackItem( typeof( BaseRanged ), 7 ),
				new LootPackItem( typeof( BaseArmor ), 40 ),
				new LootPackItem( typeof( BaseShield ), 5 ),
				new LootPackItem( typeof( BaseJewel ), 21 )
			};

		public static readonly LootPackItem[] AosMagicItemsAverageType1 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 90 ),
				new LootPackItem( typeof( BaseRanged ), 23 ),
				new LootPackItem( typeof( BaseArmor ), 130 ),
				new LootPackItem( typeof( BaseShield ), 17 ),
				new LootPackItem( typeof( BaseJewel ), 68 )
			};

		public static readonly LootPackItem[] AosMagicItemsAverageType2 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 54 ),
				new LootPackItem( typeof( BaseRanged ), 13 ),
				new LootPackItem( typeof( BaseArmor ), 77 ),
				new LootPackItem( typeof( BaseShield ), 10 ),
				new LootPackItem( typeof( BaseJewel ), 40 )
			};

		public static readonly LootPackItem[] AosMagicItemsRichType1 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 211 ),
				new LootPackItem( typeof( BaseRanged ), 53 ),
				new LootPackItem( typeof( BaseArmor ), 303 ),
				new LootPackItem( typeof( BaseShield ), 39 ),
				new LootPackItem( typeof( BaseJewel ), 158 )
			};

		public static readonly LootPackItem[] AosMagicItemsRichType2 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 170 ),
				new LootPackItem( typeof( BaseRanged ), 43 ),
				new LootPackItem( typeof( BaseArmor ), 245 ),
				new LootPackItem( typeof( BaseShield ), 32 ),
				new LootPackItem( typeof( BaseJewel ), 128 )
			};

		public static readonly LootPackItem[] AosMagicItemsFilthyRichType1 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 219 ),
				new LootPackItem( typeof( BaseRanged ), 55 ),
				new LootPackItem( typeof( BaseArmor ), 315 ),
				new LootPackItem( typeof( BaseShield ), 41 ),
				new LootPackItem( typeof( BaseJewel ), 164 )
			};

		public static readonly LootPackItem[] AosMagicItemsFilthyRichType2 = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 239 ),
				new LootPackItem( typeof( BaseRanged ), 60 ),
				new LootPackItem( typeof( BaseArmor ), 343 ),
				new LootPackItem( typeof( BaseShield ), 90 ),
				new LootPackItem( typeof( BaseJewel ), 45 )
			};

		public static readonly LootPackItem[] AosMagicItemsUltraRich = new LootPackItem[]
			{
				new LootPackItem( typeof( BaseWeapon ), 276 ),
				new LootPackItem( typeof( BaseRanged ), 69 ),
				new LootPackItem( typeof( BaseArmor ), 397 ),
				new LootPackItem( typeof( BaseShield ), 52 ),
				new LootPackItem( typeof( BaseJewel ), 207 )
			};
		#endregion

		#region SE definitions
		public static readonly LootPack SePoor = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "2d10+20" ),
				new LootPackEntry( false, AosMagicItemsPoor,		  1.00, 1, 5, 0, 100 ),
				new LootPackEntry( false, Instruments,				  0.02, 1 )
			} );

		public static readonly LootPack SeMeager = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "4d10+40" ),
				new LootPackEntry( false, AosMagicItemsMeagerType1,	 20.40, 1, 2, 0, 50 ),
				new LootPackEntry( false, AosMagicItemsMeagerType2,	 10.20, 1, 5, 0, 100 ),
				new LootPackEntry( false, Instruments,				  0.10, 1 )
			} );

		public static readonly LootPack SeAverage = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "8d10+100" ),
				new LootPackEntry( false, AosMagicItemsAverageType1, 32.80, 1, 3, 0, 50 ),
				new LootPackEntry( false, AosMagicItemsAverageType1, 32.80, 1, 4, 0, 75 ),
				new LootPackEntry( false, AosMagicItemsAverageType2, 19.50, 1, 5, 0, 100 ),
				new LootPackEntry( false, Instruments,				  0.40, 1 )
			} );

		public static readonly LootPack SeRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "15d10+225" ),
				new LootPackEntry( false, AosMagicItemsRichType1,	 76.30, 1, 4, 0, 75 ),
				new LootPackEntry( false, AosMagicItemsRichType1,	 76.30, 1, 4, 0, 75 ),
				new LootPackEntry( false, AosMagicItemsRichType2,	 61.70, 1, 5, 0, 100 ),
				new LootPackEntry( false, Instruments,				  1.00, 1 )
			} );

		public static readonly LootPack SeFilthyRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						   100.00, "3d100+400" ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType1,	79.50, 1, 5, 0, 100 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType1,	79.50, 1, 5, 0, 100 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType2,	77.60, 1, 5, 25, 100 ),
				new LootPackEntry( false, Instruments,					 2.00, 1 )
			} );

		public static readonly LootPack SeUltraRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "6d100+600" ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, Instruments,				  2.00, 1 )
			} );

		public static readonly LootPack SeSuperBoss = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,						100.00, "10d100+800" ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 50, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 50, 100 ),
				new LootPackEntry( false, Instruments,				  2.00, 1 )
			} );
		#endregion

		#region AOS definitions
		public static readonly LootPack AosPoor = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "1d10+10" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			0.02, 1 ),
				new LootPackEntry( false, AosMagicItemsPoor,	  0.02, 1, 5, 0, 90 ),
				new LootPackEntry( false, Instruments,	  0.02, 1 )
			} );

		public static readonly LootPack AosMeager = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "3d10+20" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			0.10, 1 ),
				new LootPackEntry( false, AosMagicItemsMeagerType1,	  1.00, 1, 2, 0, 10 ),
				new LootPackEntry( false, AosMagicItemsMeagerType2,	  0.20, 1, 5, 0, 90 ),
				new LootPackEntry( false, Instruments,	  0.10, 1 )
			} );

		public static readonly LootPack AosAverage = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d10+50" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			0.40, 1 ),
				new LootPackEntry( false, AosMagicItemsAverageType1,  5.00, 1, 4, 0, 20 ),
				new LootPackEntry( false, AosMagicItemsAverageType1,  2.00, 1, 3, 0, 50 ),
				new LootPackEntry( false, AosMagicItemsAverageType2,  0.50, 1, 5, 0, 90 ),
				new LootPackEntry( false, Instruments,	  0.40, 1 )
			} );

		public static readonly LootPack AosRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "10d10+150" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			1.00, 1 ),
				new LootPackEntry( false, AosMagicItemsRichType1,	 20.00, 1, 4, 0, 40 ),
				new LootPackEntry( false, AosMagicItemsRichType1,	 10.00, 1, 5, 0, 60 ),
				new LootPackEntry( false, AosMagicItemsRichType2,	  1.00, 1, 5, 0, 90 ),
				new LootPackEntry( false, Instruments,	  1.00, 1 )
			} );

		public static readonly LootPack AosFilthyRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "2d100+200" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			2.00, 1 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType1,	 33.00, 1, 4, 0, 50 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType1,	 33.00, 1, 4, 0, 60 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType2,	 20.00, 1, 5, 0, 75 ),
				new LootPackEntry( false, AosMagicItemsFilthyRichType2,	  5.00, 1, 5, 0, 100 ),
				new LootPackEntry( false, Instruments,	  2.00, 1 )
			} );

		public static readonly LootPack AosUltraRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d100+500" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			2.00, 1 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 35, 100 ),
				new LootPackEntry( false, Instruments,	  2.00, 1 )
			} );

		public static readonly LootPack AosSuperBoss = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d100+500" ),
				// ARTEGORDONMOD
				// socket lootpack drop mod
				new LootPackEntry( false, SocketAugmentation,			2.00, 1 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 25, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 33, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 50, 100 ),
				new LootPackEntry( false, AosMagicItemsUltraRich,	100.00, 1, 5, 50, 100 ),
				new LootPackEntry( false, Instruments,	  2.00, 1 )
			} );
		#endregion

		#region Pre-AOS definitions
		public static readonly LootPack OldPoor = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "1d25" ),
				new LootPackEntry( false, Instruments,	  0.02, 1 )
			} );

		public static readonly LootPack OldMeager = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d10+25" ),
				new LootPackEntry( false, Instruments,	  0.10, 1 ),
				new LootPackEntry( false, OldMagicItems,  1.00, 1, 1, 0, 60 ),
				new LootPackEntry( false, OldMagicItems,  0.20, 1, 1, 10, 70 )
			} );

		public static readonly LootPack OldAverage = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "10d10+50" ),
				new LootPackEntry( false, Instruments,	  0.40, 1 ),
				new LootPackEntry( false, OldMagicItems,  5.00, 1, 1, 20, 80 ),
				new LootPackEntry( false, OldMagicItems,  2.00, 1, 1, 30, 90 ),
				new LootPackEntry( false, OldMagicItems,  0.50, 1, 1, 40, 100 )
			} );

		public static readonly LootPack OldRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "10d10+250" ),
				new LootPackEntry( false, Instruments,	  1.00, 1 ),
				new LootPackEntry( false, OldMagicItems, 20.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems, 10.00, 1, 1, 65, 100 ),
				new LootPackEntry( false, OldMagicItems,  1.00, 1, 1, 70, 100 )
			} );

		public static readonly LootPack OldFilthyRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "2d125+400" ),
				new LootPackEntry( false, Instruments,	  2.00, 1 ),
				new LootPackEntry( false, OldMagicItems, 33.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems, 33.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems, 20.00, 1, 1, 70, 100 ),
				new LootPackEntry( false, OldMagicItems,  5.00, 1, 1, 80, 100 )
			} );

		public static readonly LootPack OldUltraRich = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d100+500" ),
				new LootPackEntry( false, Instruments,	  2.00, 1 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 40, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 40, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 60, 100 )
			} );

		public static readonly LootPack OldSuperBoss = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry(  true, Gold,			100.00, "5d100+500" ),
				new LootPackEntry( false, Instruments,	  2.00, 1 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 40, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 40, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 40, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 50, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 60, 100 ),
				new LootPackEntry( false, OldMagicItems,	100.00, 1, 1, 70, 100 )
			} );
		#endregion

		#region Generic accessors
		public static LootPack Poor{ get{ return Core.AOS ? AosPoor : OldPoor; } }
		public static LootPack Meager{ get{ return Core.AOS ? AosMeager : OldMeager; } }
		public static LootPack Average{ get{ return Core.AOS ? AosAverage : OldAverage; } }
		public static LootPack Rich{ get{ return Core.AOS ? AosRich : OldRich; } }
		public static LootPack FilthyRich{ get{ return Core.AOS ? AosFilthyRich : OldFilthyRich; } }
		public static LootPack UltraRich{ get{ return Core.AOS ? AosUltraRich : OldUltraRich; } }
		public static LootPack SuperBoss{ get{ return Core.AOS ? AosSuperBoss : OldSuperBoss; } }
		#endregion

		public static readonly LootPack LowScrolls = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry( false, LowScrollItems,	100.00, 1 )
			} );

		public static readonly LootPack MedScrolls = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry( false, MedScrollItems,	100.00, 1 )
			} );

		public static readonly LootPack HighScrolls = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry( false, HighScrollItems,	100.00, 1 )
			} );

		public static readonly LootPack Gems = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry( false, GemItems,			100.00, 1 )
			} );

		public static readonly LootPack Potions = new LootPack( new LootPackEntry[]
			{
				new LootPackEntry( false, PotionItems,		100.00, 1 )
			} );
	}

	public class LootPackEntry
	{
		private int m_Chance;
		private LootPackDice m_Quantity;

		private int m_MaxProps, m_MinIntensity, m_MaxIntensity;

		private bool m_AtSpawnTime;

		private LootPackItem[] m_Items;

		public int Chance
		{
			get{ return m_Chance; }
			set{ m_Chance = value; }
		}

		public LootPackDice Quantity
		{
			get{ return m_Quantity; }
			set{ m_Quantity = value; }
		}

		public int MaxProps
		{
			get{ return m_MaxProps; }
			set{ m_MaxProps = value; }
		}

		public int MinIntensity
		{
			get{ return m_MinIntensity; }
			set{ m_MinIntensity = value; }
		}

		public int MaxIntensity
		{
			get{ return m_MaxIntensity; }
			set{ m_MaxIntensity = value; }
		}

		public LootPackItem[] Items
		{
			get{ return m_Items; }
			set{ m_Items = value; }
		}

		private static bool IsInTokuno( Mobile m )
		{
                   // ARTEGORDONMOD
            // allow lootpack construction without a mobile
            if (m == null) return false;

			if ( m.Region.IsPartOf( "Fan Dancer's Dojo" ) )
				return true;

			if ( m.Region.IsPartOf( "Yomotsu Mines" ) )
				return true;

			return ( m.Map == Map.Tokuno );
		}

		#region Mondain's Legacy
		private static bool IsMondain( Mobile m )
		{
			if ( m == null ) 
				return false;
			
			if ( m.Region.IsPartOf( "Twisted Weald" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Sanctuary" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Prism of Light" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Citadel" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Bedlam" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Blighted Grove" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Painted Caves" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Palace of Paroxysmus" ) )
				return true;
				
			if ( m.Region.IsPartOf( "Painted Caves" ) )
				return true;
				
			return false;
		}
		#endregion

		public Item Construct( Mobile from, int luckChance, bool spawning )
		{
			if ( m_AtSpawnTime != spawning )
				return null;

			int totalChance = 0;

			for ( int i = 0; i < m_Items.Length; ++i )
				totalChance += m_Items[i].Chance;

			int rnd = Utility.Random( totalChance );

			for ( int i = 0; i < m_Items.Length; ++i )
			{
				LootPackItem item = m_Items[i];

				if ( rnd < item.Chance )
					return Mutate( from, luckChance, item.Construct( IsInTokuno( from ), IsMondain( from ) ) );

				rnd -= item.Chance;
			}

			return null;
		}

		private int GetRandomOldBonus()
		{
			int rnd = Utility.RandomMinMax( m_MinIntensity, m_MaxIntensity );

			if ( 50 > rnd )
				return 1;
			else
				rnd -= 50;

			if ( 25 > rnd )
				return 2;
			else
				rnd -= 25;

			if ( 14 > rnd )
				return 3;
			else
				rnd -= 14;

			if ( 8 > rnd )
				return 4;

			return 5;
		}

		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;

						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 );
						
                        #region Items Resource/Exceptional Mutate
						if ( item is BaseStaff || item is BaseRanged || item is Club ) // Check to see if item is made of wood - Staffs, Bows, and Club.
						{
							BaseWeapon woodweapon = (BaseWeapon)item; // Taking the created item, setting it as woodweapon itemtype to add modifiers.
							int ww_chancewheel = Utility.Random( 640 ); // Random number for chance of woods to be mutated
							
                            if ( ww_chancewheel < 12 ) //If the ww_chance number is generated as less then 12, continue with code in brackets.
                            {
                                woodweapon.Resource = CraftResource.Frostwood; // Taking created item that was type woodweapon and setting the resource to Woodtype
                            }
                            else if ( ww_chancewheel < 36 )
                            {
                                woodweapon.Resource = CraftResource.Bloodwood;
                            }
                            else if ( ww_chancewheel < 86 )
                            {
                                woodweapon.Resource = CraftResource.Heartwood;
                            }
                            else if ( ww_chancewheel < 156 )
                            {
                                woodweapon.Resource = CraftResource.YewWood;
                            }
                            else if ( ww_chancewheel < 211 )
                            {
                                woodweapon.Resource = CraftResource.AshWood;
                            }
                            else if ( ww_chancewheel < 321 )
                            {
                                woodweapon.Resource = CraftResource.OakWood;
                            }
                            else // If the random number does not meet any of the above, it does this.
                            {
                                woodweapon.Resource = CraftResource.RegularWood;
                            }
							
							if ( 0.15 > Utility.RandomDouble() ) // 15% chance for creating item which is exceptional
							woodweapon.Quality = WeaponQuality.Exceptional;

                             
								
						}
						
						else if ( item is BaseWeapon )
						{
						BaseWeapon metalweapon = (BaseWeapon)item;
							int mw_chancewheel = Utility.Random( 1000 );
                            if ( mw_chancewheel < 21 )
                            {
                                metalweapon.Resource = CraftResource.Valorite;
                            }
                            else if ( mw_chancewheel < 46 )
                            {
                                metalweapon.Resource = CraftResource.Verite;
                            }
                            else if ( mw_chancewheel < 86 )
                            {
                                metalweapon.Resource = CraftResource.Agapite;
                            }
                            else if ( mw_chancewheel < 101 )
                            {
                                metalweapon.Resource = CraftResource.Gold;
                            }
                            else if ( mw_chancewheel < 161 )
                            {
                                metalweapon.Resource = CraftResource.Bronze;
                            }
                            else if ( mw_chancewheel < 221 )
                            {
                                metalweapon.Resource = CraftResource.Copper;
                            }
                            else if ( mw_chancewheel < 301 )
                            {
                                metalweapon.Resource = CraftResource.ShadowIron;
                            }
                            else if ( mw_chancewheel < 451 )
                            {
                                metalweapon.Resource = CraftResource.DullCopper;
                            }
                            else
                            {
                                metalweapon.Resource = CraftResource.Iron;
                            } 	

                            if ( 0.15 > Utility.RandomDouble() )
							metalweapon.Quality = WeaponQuality.Exceptional;							
								
						}
						
					if ( item is BaseArmor )
				    {
					    BaseArmor armortype = (BaseArmor)item;
						if  ( armortype.Resource == CraftResource.Iron )
						{ 
						
                            int ma_chancewheel = Utility.Random( 1000 );
                            if ( ma_chancewheel < 21 )
                            {
                                armortype.Resource = CraftResource.Valorite;
                            }
                            else if ( ma_chancewheel < 46 )
                            {
                                armortype.Resource = CraftResource.Verite;
                            }
                            else if ( ma_chancewheel < 86 )
                            {
                                armortype.Resource = CraftResource.Agapite;
                            }
                            else if ( ma_chancewheel < 101 )
                            {
                                armortype.Resource = CraftResource.Gold;
                            }
                            else if ( ma_chancewheel < 161 )
                            {
                                armortype.Resource = CraftResource.Bronze;
                            }
                            else if ( ma_chancewheel < 221 )
                            {
                                armortype.Resource = CraftResource.Copper;
                            }
                            else if ( ma_chancewheel < 301 )
                            {
                                armortype.Resource = CraftResource.ShadowIron;
                            }
                            else if ( ma_chancewheel < 451 )
                            {
                                armortype.Resource = CraftResource.DullCopper;
                            }
                            else
                            {
                                armortype.Resource = CraftResource.Iron;
                            }
						}
						if  ( armortype.Resource == CraftResource.RegularLeather )
						{ 
						
                            int la_chancewheel = Utility.Random( 500 );
                            if ( la_chancewheel < 21 )
                            {
                                armortype.Resource = CraftResource.BarbedLeather;
                            }
                            else if ( la_chancewheel < 111 )
                            {
                                armortype.Resource = CraftResource.HornedLeather;
                            }
                            else if ( la_chancewheel < 231  )
                            {
                                armortype.Resource = CraftResource.SpinedLeather;
                            }
                            else
                            {
                                armortype.Resource = CraftResource.RegularLeather;
                            }
						}
						if  ( armortype.Resource == CraftResource.RegularWood )
						{
							int wa_chancewheel = Utility.Random( 640 );

                            if ( wa_chancewheel < 1 )
                            {
                                armortype.Resource = CraftResource.Frostwood;
                            }
                            else if ( wa_chancewheel < 36)
                            {
                                armortype.Resource = CraftResource.Bloodwood;
                            }
                            else if ( wa_chancewheel < 66 )
                            {
                                armortype.Resource = CraftResource.Heartwood;
                            }
                            else if ( wa_chancewheel < 121 )
                            {
                                armortype.Resource = CraftResource.YewWood;
                            }
                            else if ( wa_chancewheel < 261 )
                            {
                                armortype.Resource = CraftResource.AshWood;
                            }
                            else if ( wa_chancewheel < 321 )
                            {
                                armortype.Resource = CraftResource.OakWood;
                            }
                            else
                            {
                                armortype.Resource = CraftResource.RegularWood;						
							}
						}
						
						if ( 0.15 > Utility.RandomDouble() )
						armortype.Quality = ArmorQuality.Exceptional;
						#endregion
					}
					
					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 LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, string quantity ) : this( atSpawnTime, items, chance, new LootPackDice( quantity ), 0, 0, 0 )
		{
		}

		public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, int quantity ) : this( atSpawnTime, items, chance, new LootPackDice( 0, 0, quantity ), 0, 0, 0 )
		{
		}

		public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, string quantity, int maxProps, int minIntensity, int maxIntensity ) : this( atSpawnTime, items, chance, new LootPackDice( quantity ), maxProps, minIntensity, maxIntensity )
		{
		}

		public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, int quantity, int maxProps, int minIntensity, int maxIntensity ) : this( atSpawnTime, items, chance, new LootPackDice( 0, 0, quantity ), maxProps, minIntensity, maxIntensity )
		{
		}

		public LootPackEntry( bool atSpawnTime, LootPackItem[] items, double chance, LootPackDice quantity, int maxProps, int minIntensity, int maxIntensity )
		{
			m_AtSpawnTime = atSpawnTime;
			m_Items = items;
			m_Chance = (int)(100 * chance);
			m_Quantity = quantity;
			m_MaxProps = maxProps;
			m_MinIntensity = minIntensity;
			m_MaxIntensity = maxIntensity;
		}

		public int GetBonusProperties()
		{
			int p0=0, p1=0, p2=0, p3=0, p4=0, p5=0;

			switch ( m_MaxProps )
			{
				case 1: p0= 3; p1= 1; break;
				case 2: p0= 6; p1= 3; p2= 1; break;
				case 3: p0=10; p1= 6; p2= 3; p3= 1; break;
				case 4: p0=16; p1=12; p2= 6; p3= 5; p4=1; break;
				case 5: p0=30; p1=25; p2=20; p3=15; p4=9; p5=1; break;
			}

			int pc = p0+p1+p2+p3+p4+p5;

			int rnd = Utility.Random( pc );

			if ( rnd < p5 )
				return 5;
			else
				rnd -= p5;

			if ( rnd < p4 )
				return 4;
			else
				rnd -= p4;

			if ( rnd < p3 )
				return 3;
			else
				rnd -= p3;

			if ( rnd < p2 )
				return 2;
			else
				rnd -= p2;

			if ( rnd < p1 )
				return 1;

			return 0;
		}
	}

	public class LootPackItem
	{
		private Type m_Type;
		private int m_Chance;

		public Type Type
		{
			get{ return m_Type; }
			set{ m_Type = value; }
		}

		public int Chance
		{
			get{ return m_Chance; }
			set{ m_Chance = value; }
		}

		private static Type[]   m_BlankTypes = new Type[]{ typeof( BlankScroll ) };
		private static Type[][] m_NecroTypes = new Type[][]
			{
				new Type[] // low
				{
					typeof( AnimateDeadScroll ),		typeof( BloodOathScroll ),		typeof( CorpseSkinScroll ),	typeof( CurseWeaponScroll ),
					typeof( EvilOmenScroll ),			typeof( HorrificBeastScroll ),	typeof( MindRotScroll ),	typeof( PainSpikeScroll ),
					typeof( SummonFamiliarScroll ),		typeof( WraithFormScroll )
				},
				new Type[] // med
				{
					typeof( LichFormScroll ),			typeof( PoisonStrikeScroll ),	typeof( StrangleScroll ),	typeof( WitherScroll )
				},

				((Core.SE) ?
				new Type[] // high
				{
					typeof( VengefulSpiritScroll ),		typeof( VampiricEmbraceScroll ), typeof( ExorcismScroll )
				} : 
				new Type[] // high
				{
					typeof( VengefulSpiritScroll ),		typeof( VampiricEmbraceScroll )
				})
			};

		public static Item RandomScroll( int index, int minCircle, int maxCircle )
		{
			--minCircle;
			--maxCircle;

			int scrollCount = ((maxCircle - minCircle) + 1) * 8;

			if ( index == 0 )
				scrollCount += m_BlankTypes.Length;

			if ( Core.AOS )
				scrollCount += m_NecroTypes[index].Length;

			int rnd = Utility.Random( scrollCount );

			if ( index == 0 && rnd < m_BlankTypes.Length )
				return Loot.Construct( m_BlankTypes );
			else if ( index == 0 )
				rnd -= m_BlankTypes.Length;

			if ( Core.AOS && rnd < m_NecroTypes.Length )
				return Loot.Construct( m_NecroTypes[index] );
			else if ( Core.AOS )
				rnd -= m_NecroTypes[index].Length;

			return Loot.RandomScroll( minCircle * 8, (maxCircle * 8) + 7, SpellbookType.Regular );
		}

		public Item Construct( bool inTokuno, bool isMondain )
		{
			try
			{
				Item item;

				if ( m_Type == typeof( BaseRanged ) )
					item = Loot.RandomRangedWeapon( inTokuno, isMondain );
				else if ( m_Type == typeof( BaseWeapon ) )
					item = Loot.RandomWeapon( inTokuno, isMondain );
				else if ( m_Type == typeof( BaseArmor ) )
					item = Loot.RandomArmorOrHat( inTokuno, isMondain );
				else if ( m_Type == typeof( BaseShield ) )
					item = Loot.RandomShield();
				else if ( m_Type == typeof( BaseJewel ) )
					item = Core.AOS ? Loot.RandomJewelry() : Loot.RandomArmorOrShieldOrWeapon();
				else if ( m_Type == typeof( BaseInstrument ) )
					item = Loot.RandomInstrument();
				else if ( m_Type == typeof( Amber ) ) // gem
					item = Loot.RandomGem();
				//ARTEGORDONMODMOD
				// socket lootpack drop mod
				else if ( m_Type == typeof( BaseSocketAugmentation ) ) // socket augmentation
					item = Loot.RandomAugment();
				else if ( m_Type == typeof( ClumsyScroll ) ) // low scroll
					item = RandomScroll( 0, 1, 3 );
				else if ( m_Type == typeof( ArchCureScroll ) ) // med scroll
					item = RandomScroll( 1, 4, 7 );
				else if ( m_Type == typeof( SummonAirElementalScroll ) ) // high scroll
					item = RandomScroll( 2, 8, 8 );
				else
					item = Activator.CreateInstance( m_Type ) as Item;

				return item;
			}
			catch
			{
			}

			return null;
		}

		public LootPackItem( Type type, int chance )
		{
			m_Type = type;
			m_Chance = chance;
		}
	}

	public class LootPackDice
	{
		private int m_Count, m_Sides, m_Bonus;

		public int Count
		{
			get{ return m_Count; }
			set{ m_Count = value; }
		}

		public int Sides
		{
			get{ return m_Sides; }
			set{ m_Sides = value; }
		}

		public int Bonus
		{
			get{ return m_Bonus; }
			set{ m_Bonus = value; }
		}

		public int Roll()
		{
			int v = m_Bonus;

			for ( int i = 0; i < m_Count; ++i )
				v += Utility.Random( 1, m_Sides );

			return v;
		}

		public LootPackDice( string str )
		{
			int start = 0;
			int index = str.IndexOf( 'd', start );

			if ( index < start )
				return;

			m_Count = Utility.ToInt32( str.Substring( start, index-start ) );

			bool negative;

			start = index + 1;
			index = str.IndexOf( '+', start );

			if ( negative = (index < start) )
				index = str.IndexOf( '-', start );

			if ( index < start )
				index = str.Length;

			m_Sides = Utility.ToInt32( str.Substring( start, index-start ) );

			if ( index == str.Length )
				return;

			start = index + 1;
			index = str.Length;

			m_Bonus = Utility.ToInt32( str.Substring( start, index-start ) );

			if ( negative )
				m_Bonus *= -1;
		}

		public LootPackDice( int count, int sides, int bonus )
		{
			m_Count = count;
			m_Sides = sides;
			m_Bonus = bonus;
		}
	}
}
 

Fixxxer

Sorceror
I was just hoping someone can take a look at this and see if they can find the problem with the gold drop, its been a week and no response, I cant figure it out.
 

migzilla

Sorceror
My lootpack looks significantly different than yours, my recommendation is that you go and redownload whatever version of runuo you are running, then recompare your modified file to the original until you find which lines have been modified. You could also let people know which of the many versions of runuo you have to get someone to volunteer help a little quicker. I am running Callandor2k's svn with ML and mine has a bunch of edits yours does not have so I don;t know what your original looked like.
 

Fixxxer

Sorceror
I have been through it and redid it a few times, but I still can't find the problem with the gold drop.
 

Fixxxer

Sorceror
sorry to bump this thread but I still havent found an answer to my problem and I was really hoping someone in the RunUO community could help me out with this, thanks.
 

PitHelvit

Sorceror
Your brackets are wrong. Lemme figure them out and I'll post your corrected file

EDIT: Here we go. Try and see if it works. I haven't compiled it, so not 100% sure :p

Basically you skipped the part where it actually created the amount for everything not weapon or armor related, that's why you were only getting 1 gold coin for each loot pack the mob had.
 

Attachments

  • LootPack.cs
    42.2 KB · Views: 24

Fixxxer

Sorceror
Posted in the wrong one but Thanks a bunch again and thankyou for taking the time to help me on this.
 

runuo_user

Wanderer
dood...
great idea and script but whats wrong with your codin ?
its *** as hell
somewhere is tabs, somewhere is spaces, sometimes new {} goes right, some other times - left
tons of empty lines, tons of empty lines filled by tabs or spaces
a lot of spaces after end of lines...
at least fact of using spaces and tabs to make rows makes me think that at least two different ppl coded that thing


its been a long and hard to adopt this one to popular resources script pack (i forgot who it was "by")
but job is done so here is my code

in lootpack.cs, in "public Item Mutate( Mobile from, int luckChance, Item item )" part, find:
Code:
						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 );

and add this cute code just below:
Code:
//material change
#region Items Resource/Exceptional Mutate
	if ( item is BaseStaff || item is BaseRanged || item is Club ) // Check to see if item is made of wood - Staffs, Bows, and Club.
	{	BaseWeapon woodweapon = (BaseWeapon)item; // Taking the created item, setting it as woodweapon itemtype to add modifiers.
		int ww_chancewheel = Utility.Random( 1000 ); // Random number for chance of woods to be mutated
		if ( ww_chancewheel < 10 ) //If the ww_chance number is generated as less then 12, continue with code in brackets.
		{	woodweapon.Resource = CraftResource.Cherry; // Taking created item that was type woodweapon and setting the resource to Woodtype
		}else if ( ww_chancewheel < 30 )
		{	woodweapon.Resource = CraftResource.Cedar;
		}else if ( ww_chancewheel < 70 )
		{	woodweapon.Resource = CraftResource.Pine;
		}else if ( ww_chancewheel < 80 )
		{	woodweapon.Resource = CraftResource.Heartwood;
		}else if ( ww_chancewheel < 100 )
		{	woodweapon.Resource = CraftResource.Yew;
		}else if ( ww_chancewheel < 140 )
		{	woodweapon.Resource = CraftResource.Ash;
		}else // If the random number does not meet any of the above, it does this.
		{	woodweapon.Resource = CraftResource.Log;
		}
	}
	else if ( item is BaseWeapon )
	{	BaseWeapon metalweapon = (BaseWeapon)item;
		int mw_chancewheel = Utility.Random( 6000 );
		if ( mw_chancewheel < 10 )
		{	metalweapon.Resource = CraftResource.Moonstone;
		}else if ( mw_chancewheel < 30 )
		{	metalweapon.Resource = CraftResource.Jade;
		}else if ( mw_chancewheel < 70 )
		{	metalweapon.Resource = CraftResource.Obsidian;
		}else if ( mw_chancewheel < 120 )
		{	metalweapon.Resource = CraftResource.Mythril;
		}else if ( mw_chancewheel < 180 )
		{	metalweapon.Resource = CraftResource.Platinum;
		}else if ( mw_chancewheel < 250 )
		{	metalweapon.Resource = CraftResource.Silver;
		}else if ( mw_chancewheel < 330 )
		{	metalweapon.Resource = CraftResource.Valorite;
		}else if ( mw_chancewheel < 420 )
		{	metalweapon.Resource = CraftResource.Verite;
		}else if ( mw_chancewheel < 520 )
		{	metalweapon.Resource = CraftResource.Agapite;
		}else if ( mw_chancewheel < 630 )
		{	metalweapon.Resource = CraftResource.Gold;
		}else if ( mw_chancewheel < 750 )
		{	metalweapon.Resource = CraftResource.Bronze;
		}else if ( mw_chancewheel < 880 )
		{	metalweapon.Resource = CraftResource.Copper;
		}else if ( mw_chancewheel < 1020 )
		{	metalweapon.Resource = CraftResource.ShadowIron;
		}else if ( mw_chancewheel < 1170 )
		{	metalweapon.Resource = CraftResource.DullCopper;
		}else
		{	metalweapon.Resource = CraftResource.Iron;
		}
	}

	if ( item is BaseArmor )
	{	BaseArmor armortype = (BaseArmor)item;
		if ( armortype.Resource == CraftResource.Iron )
		{	int ma_chancewheel = Utility.Random( 5000 );
			if ( ma_chancewheel < 10 )
			{	armortype.Resource = CraftResource.Moonstone;
			}else if ( ma_chancewheel < 30 )
			{	armortype.Resource = CraftResource.Jade;
			}else if ( ma_chancewheel < 70 )
			{	armortype.Resource = CraftResource.Obsidian;
			}else if ( ma_chancewheel < 120 )
			{	armortype.Resource = CraftResource.Mythril;
			}else if ( ma_chancewheel < 180 )
			{	armortype.Resource = CraftResource.Platinum;
			}else if ( ma_chancewheel < 250 )
			{	armortype.Resource = CraftResource.Silver;
			}else if ( ma_chancewheel < 330 )
			{	armortype.Resource = CraftResource.Valorite;
			}else if ( ma_chancewheel < 420 )
			{	armortype.Resource = CraftResource.Verite;
			}else if ( ma_chancewheel < 520 )
			{	armortype.Resource = CraftResource.Agapite;
			}else if ( ma_chancewheel < 630 )
			{	armortype.Resource = CraftResource.Gold;
			}else if ( ma_chancewheel < 750 )
			{	armortype.Resource = CraftResource.Bronze;
			}else if ( ma_chancewheel < 880 )
			{	armortype.Resource = CraftResource.Copper;
			}else if ( ma_chancewheel < 1020 )
			{	armortype.Resource = CraftResource.ShadowIron;
			}else if ( ma_chancewheel < 1170 )
			{	armortype.Resource = CraftResource.DullCopper;
			}else
			{	armortype.Resource = CraftResource.Iron;
			}
		}
		if  ( armortype.Resource == CraftResource.RegularLeather )
		{	int la_chancewheel = Utility.Random( 1000 );
			if ( la_chancewheel < 10 )
			{	armortype.Resource = CraftResource.BarbedLeather;
			}else if ( la_chancewheel < 30 )
			{	armortype.Resource = CraftResource.HornedLeather;
			}else if ( la_chancewheel < 70  )
			{	armortype.Resource = CraftResource.SpinedLeather;
			}else
			{	armortype.Resource = CraftResource.RegularLeather;
			}
		}
		if  ( armortype.Resource == CraftResource.Log )
		{	int wa_chancewheel = Utility.Random( 1000 );
			if ( wa_chancewheel < 10 )
			{	armortype.Resource = CraftResource.Cherry;
			}else if ( wa_chancewheel < 30)
			{	armortype.Resource = CraftResource.Cedar;
			}else if ( wa_chancewheel < 70 )
			{	armortype.Resource = CraftResource.Pine;
			}else if ( wa_chancewheel < 80 )
			{	armortype.Resource = CraftResource.Heartwood;
			}else if ( wa_chancewheel < 100 )
			{	armortype.Resource = CraftResource.Yew;
			}else if ( wa_chancewheel < 140 )
			{	armortype.Resource = CraftResource.Ash;
			}else
			{	armortype.Resource = CraftResource.Log;						
			}
		}
	}
#endregion
//material change

so it works with more materials from that pack
and also easier to edit
(=^_^=)
 

Cervontose

Wanderer
Fixxxer;839167 said:
Posted in the wrong one but Thanks a bunch again and thankyou for taking the time to help me on this.

Did you finally get this fixed? I'm sorry for the late response. I've updated the script to 'working' standards, and you should no longer have any of those problems. Check the edited attachment, or merge the changes your self :)
Again, sorry for the long response time!
 
Top