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 SVN] Daat99's OWLTR + FS: AnimalTamingSystem Gen2

Pure Insanity

Sorceror
I have tried adding both of these scripts to a fresh install of the latest ML Svn, yet no matter what. I get a ton of errors. I believe I've fixed most of them. Now I keep getting an error on every vendor. I'm guessing it has something to do with the basevendor script I'm using. But for the life of me I can't figure out where the error is. It says something about SBInfo not the right type. Says it needs to be an ArrayList. It throws this error for every vendor there is, and another error talking about SBInfo.Get

Here is my VendorBase.cs, hope someone can help me squash this bug.

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Network;
using Server.ContextMenus;
using Server.Mobiles;
using Server.Misc;
using Server.Engines.BulkOrders;
using Server.Regions;
using Server.Factions;

namespace Server.Mobiles
{
	public enum VendorShoeType
	{
		None,
		Shoes,
		Boots,
		Sandals,
		ThighBoots
	}

	public abstract class BaseVendor : BaseCreature, IVendor
	{
		private const int MaxSell = 500;

		protected abstract ArrayList SBInfos { get; }

		private ArrayList m_ArmorBuyInfo = new ArrayList();
		private ArrayList m_ArmorSellInfo = new ArrayList();
		
		private DateTime m_LastRestock;

		public override bool CanTeach { get { return true; } }

		public override bool PlayerRangeSensitive { get { return true; } }

		public virtual bool IsActiveVendor { get { return true; } }
		public virtual bool IsActiveBuyer { get { return IsActiveVendor; } } // response to vendor SELL
		public virtual bool IsActiveSeller { get { return IsActiveVendor; } } // repsonse to vendor BUY

		public virtual NpcGuild NpcGuild { get { return NpcGuild.None; } }

		public virtual bool IsInvulnerable { get { return true; } }

		public override bool ShowFameTitle { get { return false; } }

		public virtual bool IsValidBulkOrder( Item item )
		{
			return false;
		}

		public virtual Item CreateBulkOrder( Mobile from, bool fromContextMenu )
		{
			return null;
		}

		public virtual bool SupportsBulkOrders( Mobile from )
		{
			return false;
		}

		public virtual TimeSpan GetNextBulkOrder( Mobile from )
		{
			return TimeSpan.Zero;
		}

		public virtual void OnSuccessfulBulkOrderReceive( Mobile from )
		{
		}

		#region Faction
		public virtual int GetPriceScalar()
		{
			Town town = Town.FromRegion( this.Region );

			if ( town != null )
				return ( 100 + town.Tax );

			return 100;
		}

		public void UpdateBuyInfo()
		{
			int priceScalar = GetPriceScalar();

			IBuyItemInfo[] buyinfo = (IBuyItemInfo[])m_ArmorBuyInfo.ToArray( typeof( IBuyItemInfo ) );

			if ( buyinfo != null )
			{
				foreach ( IBuyItemInfo info in buyinfo )
					info.PriceScalar = priceScalar;
			}
		}
		#endregion

		private class BulkOrderInfoEntry : ContextMenuEntry
		{
			private Mobile m_From;
			private BaseVendor m_Vendor;

			public BulkOrderInfoEntry( Mobile from, BaseVendor vendor )
				: base( 6152, 6 )
			{
				m_From = from;
				m_Vendor = vendor;
			}

			public override void OnClick()
			{
				if ( m_Vendor.SupportsBulkOrders( m_From ) )
				{
					TimeSpan ts = m_Vendor.GetNextBulkOrder( m_From );

					int totalSeconds = (int)ts.TotalSeconds;
					int totalHours = ( totalSeconds + 3599 ) / 3600;
					int totalMinutes = ( totalSeconds + 59 ) / 60;

					if ( ( ( Core.SE ) ? totalMinutes == 0 : totalHours == 0 ) )
					{
						m_From.SendLocalizedMessage( 1049038 ); // You can get an order now.

						if ( Core.AOS )
						{
							Item bulkOrder = m_Vendor.CreateBulkOrder( m_From, true );

							if ( bulkOrder is SmallMobileBOD )
								m_From.SendGump( new SmallMobileBODAcceptGump( m_From, (SmallMobileBOD)bulkOrder ) );
							else if ( bulkOrder is LargeMobileBOD )
								m_From.SendGump( new LargeMobileBODAcceptGump( m_From, (LargeMobileBOD)bulkOrder ) );
							else if ( bulkOrder is LargeBOD )
								m_From.SendGump( new LargeBODAcceptGump( m_From, (LargeBOD)bulkOrder ) );
							else if ( bulkOrder is SmallBOD )
								m_From.SendGump( new SmallBODAcceptGump( m_From, (SmallBOD)bulkOrder ) );
						}
					}
					else
					{
						int oldSpeechHue = m_Vendor.SpeechHue;
						m_Vendor.SpeechHue = 0x3B2;

						if ( Core.SE )
							m_Vendor.SayTo( m_From, 1072058, totalMinutes.ToString() ); // An offer may be available in about ~1_minutes~ minutes.
						else
							m_Vendor.SayTo( m_From, 1049039, totalHours.ToString() ); // An offer may be available in about ~1_hours~ hours.

						m_Vendor.SpeechHue = oldSpeechHue;
					}
				}
			}
		}

		public BaseVendor( string title )
			: base( AIType.AI_Vendor, FightMode.None, 2, 1, 0.5, 2 )
		{
			LoadSBInfo();

			this.Title = title;
			InitBody();
			InitOutfit();

			Container pack;
			//these packs MUST exist, or the client will crash when the packets are sent
			pack = new Backpack();
			pack.Layer = Layer.ShopBuy;
			pack.Movable = false;
			pack.Visible = false;
			AddItem( pack );

			pack = new Backpack();
			pack.Layer = Layer.ShopResale;
			pack.Movable = false;
			pack.Visible = false;
			AddItem( pack );

			m_LastRestock = DateTime.Now;
		}

		public BaseVendor( Serial serial )
			: base( serial )
		{
		}

		public DateTime LastRestock
		{
			get
			{
				return m_LastRestock;
			}
			set
			{
				m_LastRestock = value;
			}
		}

		public virtual TimeSpan RestockDelay
		{
			get
			{
				return TimeSpan.FromHours( 1 );
			}
		}

		public Container BuyPack
		{
			get
			{
				Container pack = FindItemOnLayer( Layer.ShopBuy ) as Container;

				if ( pack == null )
				{
					pack = new Backpack();
					pack.Layer = Layer.ShopBuy;
					pack.Visible = false;
					AddItem( pack );
				}

				return pack;
			}
		}

		public abstract void InitSBInfo();

		public virtual bool IsTokunoVendor { get { return ( Map == Map.Tokuno ); } }

		protected void LoadSBInfo()
		{
			m_LastRestock = DateTime.Now;

			for ( int i = 0; i < m_ArmorBuyInfo.Count; ++i )
			{
				GenericBuyInfo buy = m_ArmorBuyInfo[i] as GenericBuyInfo;

				if ( buy != null )
					buy.DeleteDisplayEntity();
			}

			SBInfos.Clear();

			InitSBInfo();

			m_ArmorBuyInfo.Clear();
			m_ArmorSellInfo.Clear();

			for ( int i = 0; i < SBInfos.Count; i++ )
			{
				SBInfo sbInfo = (SBInfo)SBInfos[i];
				m_ArmorBuyInfo.AddRange( sbInfo.BuyInfo );
				m_ArmorSellInfo.Add( sbInfo.SellInfo );
			}
		}

		public virtual bool GetGender()
		{
			return Utility.RandomBool();
		}

		public virtual void InitBody()
		{
			InitStats( 100, 100, 25 );

			SpeechHue = Utility.RandomDyedHue();
			Hue = Utility.RandomSkinHue();

			if ( IsInvulnerable && !Core.AOS )
				NameHue = 0x35;

			if ( Female = GetGender() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "male" );
			}
		}

		public virtual int GetRandomHue()
		{
			switch ( Utility.Random( 5 ) )
			{
				default:
				case 0: return Utility.RandomBlueHue();
				case 1: return Utility.RandomGreenHue();
				case 2: return Utility.RandomRedHue();
				case 3: return Utility.RandomYellowHue();
				case 4: return Utility.RandomNeutralHue();
			}
		}

		public virtual int GetShoeHue()
		{
			if ( 0.1 > Utility.RandomDouble() )
				return 0;

			return Utility.RandomNeutralHue();
		}

		public virtual VendorShoeType ShoeType
		{
			get { return VendorShoeType.Shoes; }
		}

		public virtual int RandomBrightHue()
		{
			if ( 0.1 > Utility.RandomDouble() )
				return Utility.RandomList( 0x62, 0x71 );

			return Utility.RandomList( 0x03, 0x0D, 0x13, 0x1C, 0x21, 0x30, 0x37, 0x3A, 0x44, 0x59 );
		}

		public virtual void CheckMorph()
		{
			if ( CheckGargoyle() )
				return;

			if ( CheckNecromancer() )
				return;

			CheckTokuno();
		}

		public virtual bool CheckTokuno()
		{
			if ( this.Map != Map.Tokuno )
				return false;

			NameList n;

			if ( Female )
				n = NameList.GetNameList( "tokuno female" );
			else
				n = NameList.GetNameList( "tokuno male" );

			if ( !n.ContainsName( this.Name ) )
				TurnToTokuno();

			return true;
		}

		public virtual void TurnToTokuno()
		{
			if ( Female )
				this.Name = NameList.RandomName( "tokuno female" );
			else
				this.Name = NameList.RandomName( "tokuno male" );
		}

		public virtual bool CheckGargoyle()
		{
			Map map = this.Map;

			if ( map != Map.Ilshenar )
				return false;

			if ( !Region.IsPartOf( "Gargoyle City" ) )
				return false;

			if ( Body != 0x2F6 || ( Hue & 0x8000 ) == 0 )
				TurnToGargoyle();

			return true;
		}

		public virtual bool CheckNecromancer()
		{
			Map map = this.Map;

			if ( map != Map.Malas )
				return false;

			if ( !Region.IsPartOf( "Umbra" ) )
				return false;

			if ( Hue != 0x83E8 )
				TurnToNecromancer();

			return true;
		}

		public override void OnAfterSpawn()
		{
			CheckMorph();
		}

		protected override void OnMapChange( Map oldMap )
		{
			base.OnMapChange( oldMap );

			CheckMorph();

			LoadSBInfo();
		}

		public virtual int GetRandomNecromancerHue()
		{
			switch ( Utility.Random( 20 ) )
			{
				case 0: return 0;
				case 1: return 0x4E9;
				default: return Utility.RandomList( 0x485, 0x497 );
			}
		}

		public virtual void TurnToNecromancer()
		{
			for ( int i = 0; i < this.Items.Count; ++i )
			{
				Item item = this.Items[i];

				if ( item is Hair || item is Beard )
					item.Hue = 0;
				else if ( item is BaseClothing || item is BaseWeapon || item is BaseArmor || item is BaseTool )
					item.Hue = GetRandomNecromancerHue();
			}

			HairHue = 0;
			FacialHairHue = 0;

			Hue = 0x83E8;
		}

		public virtual void TurnToGargoyle()
		{
			for ( int i = 0; i < this.Items.Count; ++i )
			{
				Item item = this.Items[i];

				if ( item is BaseClothing || item is Hair || item is Beard )
					item.Delete();
			}

			HairItemID = 0;
			FacialHairItemID = 0;

			Body = 0x2F6;
			Hue = RandomBrightHue() | 0x8000;
			Name = NameList.RandomName( "gargoyle vendor" );

			CapitalizeTitle();
		}

		public virtual void CapitalizeTitle()
		{
			string title = this.Title;

			if ( title == null )
				return;

			string[] split = title.Split( ' ' );

			for ( int i = 0; i < split.Length; ++i )
			{
				if ( Insensitive.Equals( split[i], "the" ) )
					continue;

				if ( split[i].Length > 1 )
					split[i] = Char.ToUpper( split[i][0] ) + split[i].Substring( 1 );
				else if ( split[i].Length > 0 )
					split[i] = Char.ToUpper( split[i][0] ).ToString();
			}

			this.Title = String.Join( " ", split );
		}

		public virtual int GetHairHue()
		{
			return Utility.RandomHairHue();
		}

		public virtual void InitOutfit()
		{
			switch ( Utility.Random( 3 ) )
			{
				case 0: AddItem( new FancyShirt( GetRandomHue() ) ); break;
				case 1: AddItem( new Doublet( GetRandomHue() ) ); break;
				case 2: AddItem( new Shirt( GetRandomHue() ) ); break;
			}

			switch ( ShoeType )
			{
				case VendorShoeType.Shoes: AddItem( new Shoes( GetShoeHue() ) ); break;
				case VendorShoeType.Boots: AddItem( new Boots( GetShoeHue() ) ); break;
				case VendorShoeType.Sandals: AddItem( new Sandals( GetShoeHue() ) ); break;
				case VendorShoeType.ThighBoots: AddItem( new ThighBoots( GetShoeHue() ) ); break;
			}

			int hairHue = GetHairHue();

			Utility.AssignRandomHair( this, hairHue );
			Utility.AssignRandomFacialHair( this, hairHue );

			if ( Female )
			{
				switch ( Utility.Random( 6 ) )
				{
					case 0: AddItem( new ShortPants( GetRandomHue() ) ); break;
					case 1:
					case 2: AddItem( new Kilt( GetRandomHue() ) ); break;
					case 3:
					case 4:
					case 5: AddItem( new Skirt( GetRandomHue() ) ); break;
				}
			}
			else
			{
				switch ( Utility.Random( 2 ) )
				{
					case 0: AddItem( new LongPants( GetRandomHue() ) ); break;
					case 1: AddItem( new ShortPants( GetRandomHue() ) ); break;
				}
			}

			PackGold( 100, 200 );
		}

		public virtual void Restock()
		{
			m_LastRestock = DateTime.Now;

			IBuyItemInfo[] buyInfo = this.GetBuyInfo();

			foreach ( IBuyItemInfo bii in buyInfo )
				bii.OnRestock();
		}

		private static TimeSpan InventoryDecayTime = TimeSpan.FromHours( 1.0 );

		public virtual void VendorBuy( Mobile from )
		{
			if ( !IsActiveSeller )
				return;

			if ( !from.CheckAlive() )
				return;

			if ( !CheckVendorAccess( from ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return;
			}

			if ( DateTime.Now - m_LastRestock > RestockDelay )
				Restock();

			UpdateBuyInfo();

			int count = 0;
			ArrayList list;
			IBuyItemInfo[] buyInfo = this.GetBuyInfo();
			IShopSellInfo[] sellInfo = this.GetSellInfo();

			list = new ArrayList( buyInfo.Length );
			Container cont = this.BuyPack;

			List<ObjectPropertyList> opls = null;

			for ( int idx = 0; idx < buyInfo.Length; idx++ )
			{
				IBuyItemInfo buyItem = (IBuyItemInfo)buyInfo[idx];

				if ( buyItem.Amount <= 0 || list.Count >= 250 )
					continue;

				// NOTE: Only GBI supported; if you use another implementation of IBuyItemInfo, this will crash
				GenericBuyInfo gbi = (GenericBuyInfo)buyItem;
				IEntity disp = gbi.GetDisplayEntity();

				list.Add( new BuyItemState( buyItem.Name, cont.Serial, disp == null ? (Serial)0x7FC0FFEE : disp.Serial, buyItem.Price, buyItem.Amount, buyItem.ItemID, buyItem.Hue ) );
				count++;

				if ( opls == null ) {
					opls = new List<ObjectPropertyList>();
				}

				if ( disp is Item ) {
					opls.Add( ( ( Item ) disp ).PropertyList );
				} else if ( disp is Mobile ) {
					opls.Add( ( ( Mobile ) disp ).PropertyList );
				}
			}

			List<Item> playerItems = cont.Items;

			for ( int i = playerItems.Count - 1; i >= 0; --i )
			{
				if ( i >= playerItems.Count )
					continue;

				Item item = playerItems[i];

				if ( ( item.LastMoved + InventoryDecayTime ) <= DateTime.Now )
					item.Delete();
			}

			for ( int i = 0; i < playerItems.Count; ++i )
			{
				Item item = playerItems[i];

				int price = 0;
				string name = null;

				foreach ( IShopSellInfo ssi in sellInfo )
				{
					if ( ssi.IsSellable( item ) )
					{
						price = ssi.GetBuyPriceFor( item );
						name = ssi.GetNameFor( item );
						break;
					}
				}

				if ( name != null && list.Count < 250 )
				{
					list.Add( new BuyItemState( name, cont.Serial, item.Serial, price, item.Amount, item.ItemID, item.Hue ) );
					count++;

					if ( opls == null ) {
						opls = new List<ObjectPropertyList>();
					}

					opls.Add( item.PropertyList );
				}
			}

			//one (not all) of the packets uses a byte to describe number of items in the list.  Osi = dumb.
			//if ( list.Count > 255 )
			//	Console.WriteLine( "Vendor Warning: Vendor {0} has more than 255 buy items, may cause client errors!", this );

			if ( list.Count > 0 )
			{
				list.Sort( new BuyItemStateComparer() );

				SendPacksTo( from );

				if ( from.NetState == null )
					return;

				if ( from.NetState.IsPost6017 )
					from.Send( new VendorBuyContent6017( list ) );
				else
					from.Send( new VendorBuyContent( list ) );
				from.Send( new VendorBuyList( this, list ) );
				from.Send( new DisplayBuyList( this ) );
				from.Send( new MobileStatusExtended( from ) );//make sure their gold amount is sent

				if ( opls != null ) {
					for ( int i = 0; i < opls.Count; ++i ) {
						from.Send( opls[i] );
					}
				}

				SayTo( from, 500186 ); // Greetings.  Have a look around.
			}
		}

		public virtual void SendPacksTo( Mobile from )
		{
			Item pack = FindItemOnLayer( Layer.ShopBuy );

			if ( pack == null )
			{
				pack = new Backpack();
				pack.Layer = Layer.ShopBuy;
				pack.Movable = false;
				pack.Visible = false;
				AddItem( pack );
			}

			from.Send( new EquipUpdate( pack ) );

			pack = FindItemOnLayer( Layer.ShopSell );

			if ( pack != null )
				from.Send( new EquipUpdate( pack ) );

			pack = FindItemOnLayer( Layer.ShopResale );

			if ( pack == null )
			{
				pack = new Backpack();
				pack.Layer = Layer.ShopResale;
				pack.Movable = false;
				pack.Visible = false;
				AddItem( pack );
			}

			from.Send( new EquipUpdate( pack ) );
		}

		public virtual void VendorSell( Mobile from )
		{
			if ( !IsActiveBuyer )
				return;

			if ( !from.CheckAlive() )
				return;

			if ( !CheckVendorAccess( from ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return;
			}

			Container pack = from.Backpack;

			if ( pack != null )
			{
				IShopSellInfo[] info = GetSellInfo();

				Hashtable table = new Hashtable();

				foreach ( IShopSellInfo ssi in info )
				{
					Item[] items = pack.FindItemsByType( ssi.Types );

					foreach ( Item item in items )
					{
						if ( item is Container && ( (Container)item ).Items.Count != 0 )
							continue;

						if ( item.IsStandardLoot() && item.Movable && ssi.IsSellable( item ) )
							table[item] = new SellItemState( item, ssi.GetSellPriceFor( item ), ssi.GetNameFor( item ) );
					}
				}

				if ( table.Count > 0 )
				{
					SendPacksTo( from );

					from.Send( new VendorSellList( this, table ) );
				}
				else
				{
					Say( true, "You have nothing I would be interested in." );
				}
			}
		}

		public override bool OnDragDrop( Mobile from, Item dropped )
		{
		  // Modified by Hawkins for Daat99 and FS: ATS
			if ( dropped is SmallBOD || dropped is LargeBOD )
				daat99.daat99.ClaimBods( from, dropped );
			else if ( dropped is SmallMobileBOD || dropped is LargeMobileBOD )
			{
				if ( !IsValidBulkOrder( dropped ) || !SupportsBulkOrders( from ) )
				{
					SayTo( from, 1045130 ); // That order is for some other shopkeeper.
					return false;
				}
				else if ( ( dropped is SmallMobileBOD && !( (SmallMobileBOD)dropped ).Complete ) || ( dropped is LargeMobileBOD && !( (LargeMobileBOD)dropped ).Complete ) )
				{
					SayTo( from, 1045131 ); // You have not completed the order yet.
					return false;
				}

				Item reward;
				int gold, fame;

				if ( dropped is SmallMobileBOD )
					( (SmallMobileBOD)dropped ).GetRewards( out reward, out gold, out fame );
				else
					( (LargeMobileBOD)dropped ).GetRewards( out reward, out gold, out fame );

				from.SendSound( 0x3D );

				SayTo( from, 1045132 ); // Thank you so much!  Here is a reward for your effort.

				if ( reward != null )
					from.AddToBackpack( reward );

				if ( gold > 1000 )
					from.AddToBackpack( new BankCheck( gold ) );
				else if ( gold > 0 )
					from.AddToBackpack( new Gold( gold ) );

				Titles.AwardFame( from, fame, true );

				OnSuccessfulBulkOrderReceive( from );

				dropped.Delete();
				return true;
			}
			// End modified by Hawkins
			return base.OnDragDrop( from, dropped );
		}

		private GenericBuyInfo LookupDisplayObject( object obj )
		{
			IBuyItemInfo[] buyInfo = this.GetBuyInfo();

			for ( int i = 0; i < buyInfo.Length; ++i ) {
				GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[i];

				if ( gbi.GetDisplayEntity() == obj )
					return gbi;
			}

			return null;
		}

		private void ProcessSinglePurchase( BuyItemResponse buy, IBuyItemInfo bii, ArrayList validBuy, ref int controlSlots, ref bool fullPurchase, ref int totalCost )
		{
			int amount = buy.Amount;

			if ( amount > bii.Amount )
				amount = bii.Amount;

			if ( amount <= 0 )
				return;

			int slots = bii.ControlSlots * amount;

			if ( controlSlots >= slots )
			{
				controlSlots -= slots;
			}
			else
			{
				fullPurchase = false;
				return;
			}

			totalCost += bii.Price * amount;
			validBuy.Add( buy );
		}

		private void ProcessValidPurchase( int amount, IBuyItemInfo bii, Mobile buyer, Container cont )
		{
			if ( amount > bii.Amount )
				amount = bii.Amount;

			if ( amount < 1 )
				return;

			bii.Amount -= amount;

			IEntity o = bii.GetEntity();

			if ( o is Item )
			{
				Item item = (Item)o;

				if ( item.Stackable )
				{
					item.Amount = amount;

					if ( cont == null || !cont.TryDropItem( buyer, item, false ) )
						item.MoveToWorld( buyer.Location, buyer.Map );
				}
				else
				{
					item.Amount = 1;

					if ( cont == null || !cont.TryDropItem( buyer, item, false ) )
						item.MoveToWorld( buyer.Location, buyer.Map );

					for ( int i = 1; i < amount; i++ )
					{
						item = bii.GetEntity() as Item;

						if ( item != null )
						{
							item.Amount = 1;

							if ( cont == null || !cont.TryDropItem( buyer, item, false ) )
								item.MoveToWorld( buyer.Location, buyer.Map );
						}
					}
				}
			}
			else if ( o is Mobile )
			{
				Mobile m = (Mobile)o;

				m.Direction = (Direction)Utility.Random( 8 );
				m.MoveToWorld( buyer.Location, buyer.Map );
				m.PlaySound( m.GetIdleSound() );

				if ( m is BaseCreature )
					( (BaseCreature)m ).SetControlMaster( buyer );

				for ( int i = 1; i < amount; ++i )
				{
					m = bii.GetEntity() as Mobile;

					if ( m != null )
					{
						m.Direction = (Direction)Utility.Random( 8 );
						m.MoveToWorld( buyer.Location, buyer.Map );

						if ( m is BaseCreature )
							( (BaseCreature)m ).SetControlMaster( buyer );
					}
				}
			}
		}

		public virtual bool OnBuyItems( Mobile buyer, ArrayList list )
		{
			if ( !IsActiveSeller )
				return false;

			if ( !buyer.CheckAlive() )
				return false;

			if ( !CheckVendorAccess( buyer ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return false;
			}

			UpdateBuyInfo();

			IBuyItemInfo[] buyInfo = this.GetBuyInfo();
			IShopSellInfo[] info = GetSellInfo();
			int totalCost = 0;
			ArrayList validBuy = new ArrayList( list.Count );
			Container cont;
			bool bought = false;
			bool fromBank = false;
			bool fullPurchase = true;
			int controlSlots = buyer.FollowersMax - buyer.Followers;

			foreach ( BuyItemResponse buy in list )
			{
				Serial ser = buy.Serial;
				int amount = buy.Amount;

				if ( ser.IsItem )
				{
					Item item = World.FindItem( ser );

					if ( item == null )
						continue;

					GenericBuyInfo gbi = LookupDisplayObject( item );

					if ( gbi != null )
					{
						ProcessSinglePurchase( buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost );
					}
					else if ( item != this.BuyPack && item.IsChildOf( this.BuyPack ) )
					{
						if ( amount > item.Amount )
							amount = item.Amount;

						if ( amount <= 0 )
							continue;

						foreach ( IShopSellInfo ssi in info )
						{
							if ( ssi.IsSellable( item ) )
							{
								if ( ssi.IsResellable( item ) )
								{
									totalCost += ssi.GetBuyPriceFor( item ) * amount;
									validBuy.Add( buy );
									break;
								}
							}
						}
					}
				}
				else if ( ser.IsMobile )
				{
					Mobile mob = World.FindMobile( ser );

					if ( mob == null )
						continue;

					GenericBuyInfo gbi = LookupDisplayObject( mob );

					if ( gbi != null )
						ProcessSinglePurchase( buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost );
				}
			}//foreach

			if ( fullPurchase && validBuy.Count == 0 )
				SayTo( buyer, 500190 ); // Thou hast bought nothing!
			else if ( validBuy.Count == 0 )
				SayTo( buyer, 500187 ); // Your order cannot be fulfilled, please try again.

			if ( validBuy.Count == 0 )
				return false;

			bought = ( buyer.AccessLevel >= AccessLevel.GameMaster );

			cont = buyer.Backpack;
			if ( !bought && cont != null )
			{
				if ( cont.ConsumeTotal( typeof( Gold ), totalCost ) )
					bought = true;
				else if ( totalCost < 2000 )
					SayTo( buyer, 500192 );//Begging thy pardon, but thou casnt afford that.
			}

			if ( !bought && totalCost >= 2000 )
			{
				cont = buyer.FindBankNoCreate();
				if ( cont != null && cont.ConsumeTotal( typeof( Gold ), totalCost ) )
				{
					bought = true;
					fromBank = true;
				}
				else
				{
					SayTo( buyer, 500191 ); //Begging thy pardon, but thy bank account lacks these funds.
				}
			}

			if ( !bought )
				return false;
			else
				buyer.PlaySound( 0x32 );

			cont = buyer.Backpack;
			if ( cont == null )
				cont = buyer.BankBox;

			foreach ( BuyItemResponse buy in validBuy )
			{
				Serial ser = buy.Serial;
				int amount = buy.Amount;

				if ( amount < 1 )
					continue;

				if ( ser.IsItem )
				{
					Item item = World.FindItem( ser );

					if ( item == null )
						continue;

					GenericBuyInfo gbi = LookupDisplayObject( item );

					if ( gbi != null )
					{
						ProcessValidPurchase( amount, gbi, buyer, cont );
					}
					else
					{
						if ( amount > item.Amount )
							amount = item.Amount;

						foreach ( IShopSellInfo ssi in info )
						{
							if ( ssi.IsSellable( item ) )
							{
								if ( ssi.IsResellable( item ) )
								{
									Item buyItem;
									if ( amount >= item.Amount )
									{
										buyItem = item;
									}
									else
									{
										buyItem = Mobile.LiftItemDupe( item, item.Amount - amount );

										if ( buyItem == null )
											buyItem = item;
									}

									if ( cont == null || !cont.TryDropItem( buyer, buyItem, false ) )
										buyItem.MoveToWorld( buyer.Location, buyer.Map );

									break;
								}
							}
						}
					}
				}
				else if ( ser.IsMobile )
				{
					Mobile mob = World.FindMobile( ser );

					if ( mob == null )
						continue;

					GenericBuyInfo gbi = LookupDisplayObject( mob );

					if ( gbi != null )
						ProcessValidPurchase( amount, gbi, buyer, cont );
				}
			}//foreach

			if ( fullPurchase )
			{
				if ( buyer.AccessLevel >= AccessLevel.GameMaster )
					SayTo( buyer, true, "I would not presume to charge thee anything.  Here are the goods you requested." );
				else if ( fromBank )
					SayTo( buyer, true, "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.", totalCost );
				else
					SayTo( buyer, true, "The total of thy purchase is {0} gold.  My thanks for the patronage.", totalCost );
			}
			else
			{
				if ( buyer.AccessLevel >= AccessLevel.GameMaster )
					SayTo( buyer, true, "I would not presume to charge thee anything.  Unfortunately, I could not sell you all the goods you requested." );
				else if ( fromBank )
					SayTo( buyer, true, "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.", totalCost );
				else
					SayTo( buyer, true, "The total of thy purchase is {0} gold.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.", totalCost );
			}

			return true;
		}

		public virtual bool CheckVendorAccess( Mobile from )
		{
			GuardedRegion reg = (GuardedRegion)this.Region.GetRegion( typeof( GuardedRegion ) );

			if ( reg != null && !reg.CheckVendorAccess( this, from ) )
				return false;

			if ( this.Region != from.Region )
			{
				reg = (GuardedRegion)from.Region.GetRegion( typeof( GuardedRegion ) );

				if ( reg != null && !reg.CheckVendorAccess( this, from ) )
					return false;
			}

			return true;
		}

		public virtual bool OnSellItems( Mobile seller, ArrayList list )
		{
			if ( !IsActiveBuyer )
				return false;

			if ( !seller.CheckAlive() )
				return false;

			if ( !CheckVendorAccess( seller ) )
			{
				Say( 501522 ); // I shall not treat with scum like thee!
				return false;
			}

			seller.PlaySound( 0x32 );

			IShopSellInfo[] info = GetSellInfo();
			IBuyItemInfo[] buyInfo = this.GetBuyInfo();
			int GiveGold = 0;
			int Sold = 0;
			Container cont;
			ArrayList delete = new ArrayList();
			ArrayList drop = new ArrayList();

			foreach ( SellItemResponse resp in list )
			{
				if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || ( resp.Item is Container && ( (Container)resp.Item ).Items.Count != 0 ) )
					continue;

				foreach ( IShopSellInfo ssi in info )
				{
					if ( ssi.IsSellable( resp.Item ) )
					{
						Sold++;
						break;
					}
				}
			}

			if ( Sold > MaxSell )
			{
				SayTo( seller, true, "You may only sell {0} items at a time!", MaxSell );
				return false;
			}
			else if ( Sold == 0 )
			{
				return true;
			}

			foreach ( SellItemResponse resp in list )
			{
				if ( resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable || ( resp.Item is Container && ( (Container)resp.Item ).Items.Count != 0 ) )
					continue;

				foreach ( IShopSellInfo ssi in info )
				{
					if ( ssi.IsSellable( resp.Item ) )
					{
						int amount = resp.Amount;

						if ( amount > resp.Item.Amount )
							amount = resp.Item.Amount;

						if ( ssi.IsResellable( resp.Item ) )
						{
							bool found = false;

							foreach ( IBuyItemInfo bii in buyInfo )
							{
								if ( bii.Restock( resp.Item, amount ) )
								{
									resp.Item.Consume( amount );
									found = true;

									break;
								}
							}

							if ( !found )
							{
								cont = this.BuyPack;

								if ( amount < resp.Item.Amount )
								{
									Item item = Mobile.LiftItemDupe( resp.Item, resp.Item.Amount - amount );

									if ( item != null )
									{
										item.SetLastMoved();
										cont.DropItem( item );
									}
									else
									{
										resp.Item.SetLastMoved();
										cont.DropItem( resp.Item );
									}
								}
								else
								{
									resp.Item.SetLastMoved();
									cont.DropItem( resp.Item );
								}
							}
						}
						else
						{
							if ( amount < resp.Item.Amount )
								resp.Item.Amount -= amount;
							else
								resp.Item.Delete();
						}

						GiveGold += ssi.GetSellPriceFor( resp.Item ) * amount;
						break;
					}
				}
			}

			if ( GiveGold > 0 )
			{
				while ( GiveGold > 60000 )
				{
					seller.AddToBackpack( new Gold( 60000 ) );
					GiveGold -= 60000;
				}

				seller.AddToBackpack( new Gold( GiveGold ) );

				seller.PlaySound( 0x0037 );//Gold dropping sound

				if ( SupportsBulkOrders( seller ) )
				{
					Item bulkOrder = CreateBulkOrder( seller, false );

					if ( bulkOrder is LargeBOD )
						seller.SendGump( new LargeBODAcceptGump( seller, (LargeBOD)bulkOrder ) );
					else if ( bulkOrder is SmallBOD )
						seller.SendGump( new SmallBODAcceptGump( seller, (SmallBOD)bulkOrder ) );
					else if ( bulkOrder is SmallMobileBOD )
						seller.SendGump( new SmallMobileBODAcceptGump( seller, (SmallMobileBOD)bulkOrder ) );
					else if ( bulkOrder is LargeMobileBOD )
						seller.SendGump( new LargeMobileBODAcceptGump( seller, (LargeMobileBOD)bulkOrder ) );
				}
			}
			//no cliloc for this?
			//SayTo( seller, true, "Thank you! I bought {0} item{1}. Here is your {2}gp.", Sold, (Sold > 1 ? "s" : ""), GiveGold );

			return true;
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int)1 ); // version

			ArrayList sbInfos = this.SBInfos;

			for ( int i = 0; sbInfos != null && i < sbInfos.Count; ++i )
			{
				SBInfo sbInfo = (SBInfo)sbInfos[i];
				ArrayList buyInfo = sbInfo.BuyInfo;

				for ( int j = 0; buyInfo != null && j < buyInfo.Count; ++j )
				{
					GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[j];

					int maxAmount = gbi.MaxAmount;
					int doubled = 0;

					switch ( maxAmount )
					{
						case  40: doubled = 1; break;
						case  80: doubled = 2; break;
						case 160: doubled = 3; break;
						case 320: doubled = 4; break;
						case 640: doubled = 5; break;
						case 999: doubled = 6; break;
					}

					if ( doubled > 0 )
					{
						writer.WriteEncodedInt( 1 + ( ( j * sbInfos.Count ) + i ) );
						writer.WriteEncodedInt( doubled );
					}
				}
			}

			writer.WriteEncodedInt( 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			LoadSBInfo();

			ArrayList sbInfos = this.SBInfos;

			switch ( version )
			{
				case 1:
					{
						int index;

						while ( ( index = reader.ReadEncodedInt() ) > 0 )
						{
							int doubled = reader.ReadEncodedInt();

							if ( sbInfos != null )
							{
								index -= 1;
								int sbInfoIndex = index % sbInfos.Count;
								int buyInfoIndex = index / sbInfos.Count;

								if ( sbInfoIndex >= 0 && sbInfoIndex < sbInfos.Count )
								{
									SBInfo sbInfo = (SBInfo)sbInfos[sbInfoIndex];
									ArrayList buyInfo = sbInfo.BuyInfo;

									if ( buyInfo != null && buyInfoIndex >= 0 && buyInfoIndex < buyInfo.Count )
									{
										GenericBuyInfo gbi = (GenericBuyInfo)buyInfo[buyInfoIndex];

										int amount = 20;

										switch ( doubled )
										{
											case 1: amount = 40; break;
											case 2: amount = 80; break;
											case 3: amount = 160; break;
											case 4: amount = 320; break;
											case 5: amount = 640; break;
											case 6: amount = 999; break;
										}

										gbi.Amount = gbi.MaxAmount = amount;
									}
								}
							}
						}

						break;
					}
			}

			if ( IsParagon )
				IsParagon = false;

			if ( Core.AOS && NameHue == 0x35 )
				NameHue = -1;

			Timer.DelayCall( TimeSpan.Zero, new TimerCallback( CheckMorph ) );
		}

		public override void AddCustomContextEntries( Mobile from, List<ContextMenuEntry> list )
		{
			if ( from.Alive && IsActiveVendor )
			{
				if ( IsActiveSeller )
					list.Add( new VendorBuyEntry( from, this ) );

				if ( IsActiveBuyer )
					list.Add( new VendorSellEntry( from, this ) );

				if ( SupportsBulkOrders( from ) )
					list.Add( new BulkOrderInfoEntry( from, this ) );
			}

			base.AddCustomContextEntries( from, list );
		}

		public virtual IShopSellInfo[] GetSellInfo()
		{
			return (IShopSellInfo[])m_ArmorSellInfo.ToArray( typeof( IShopSellInfo ) );
		}

		public virtual IBuyItemInfo[] GetBuyInfo()
		{
			return (IBuyItemInfo[])m_ArmorBuyInfo.ToArray( typeof( IBuyItemInfo ) );
		}

		public override bool CanBeDamaged()
		{
			return !IsInvulnerable;
		}
	}
}

namespace Server.ContextMenus
{
	public class VendorBuyEntry : ContextMenuEntry
	{
		private BaseVendor m_Vendor;

		public VendorBuyEntry( Mobile from, BaseVendor vendor )
			: base( 6103, 8 )
		{
			m_Vendor = vendor;
			Enabled = vendor.CheckVendorAccess( from );
		}

		public override void OnClick()
		{
			m_Vendor.VendorBuy( this.Owner.From );
		}
	}

	public class VendorSellEntry : ContextMenuEntry
	{
		private BaseVendor m_Vendor;

		public VendorSellEntry( Mobile from, BaseVendor vendor )
			: base( 6104, 8 )
		{
			m_Vendor = vendor;
			Enabled = vendor.CheckVendorAccess( from );
		}

		public override void OnClick()
		{
			m_Vendor.VendorSell( this.Owner.From );
		}
	}
}

namespace Server
{
	public interface IShopSellInfo
	{
		//get display name for an item
		string GetNameFor( Item item );

		//get price for an item which the player is selling
		int GetSellPriceFor( Item item );

		//get price for an item which the player is buying
		int GetBuyPriceFor( Item item );

		//can we sell this item to this vendor?
		bool IsSellable( Item item );

		//What do we sell?
		Type[] Types { get; }

		//does the vendor resell this item?
		bool IsResellable( Item item );
	}

	public interface IBuyItemInfo
	{
		//get a new instance of an object (we just bought it)
		IEntity GetEntity();

		int ControlSlots { get; }

		int PriceScalar { get; set; }

		//display price of the item
		int Price { get; }

		//display name of the item
		string Name { get; }

		//display hue
		int Hue { get; }

		//display id
		int ItemID { get; }

		//amount in stock
		int Amount { get; set; }

		//max amount in stock
		int MaxAmount { get; }

		//Attempt to restock with item, (return true if restock sucessful)
		bool Restock( Item item, int amount );

		//called when its time for the whole shop to restock
		void OnRestock();
	}
}
 

Pure Insanity

Sorceror
Okay...I fixed the errors that it was giving me, but now it's throwing a lot more errors on other stuff. Any idea why I can't get this to work with a fresh install but others have no problems at all? I'm following the instructions exactly. Got the ML SVN, installed Daat's OWLTR and FS Animal Taming, nothing more. Did the edits that both required me to. For OWLTR, I just replaced all of the scripts in the modified folder like it said to do on a fresh install.

I'm starting to feel like an exterminator, going after all of these bugs. Get a few, and find a ton more. It never stops.
 

Orbit Storm

Sorceror
I was also wondering.. if this would be compatible with the latest SVN provided by Callandor.. SVN 520?

The latest update was for SVN 442.. I'm sort of weary about attempting to WinMerge anything, simply because of the immense about of troubles I had getting these systems to function with 2.0 Final.
 

Pure Insanity

Sorceror
I have it working on mine, and it's Callandor's svn. The latest. But I'm not going to lie, it was a complete pain the ass. When you do the merging, pay very close attention. You don't want to lose any methods or functions from your original file. And for things that will edit a lot of a function. Make sure it's not removing some old AOS stuff or even the new ML stuff, because it will. I suggest using an editor that does automatic backups as you do your edits, it comes in handy.

It took me a few days of playing exterminator on fixing the bugs that I ran into, but I eventually made it and got it up and running great. The only problems I've had, is from the FS Animal system. The bio engineering (dna system) seems to throw a null error and crash the shard for me. I haven't really bothered with fixing it, I'm just going to not let anyone use it till I get around to fixing it.
 

Orbit Storm

Sorceror
Heh.. well, I see what you mean about it being a pain in the ass. Since trying to merge everything, I've gone from one error to the next.

Initially I had an error with HelpInfo.cs. Turned out, the modified version of Docs.cs in the OWLTR package, was causing the error. So I simply replaced it with the default SVN script.

I dealt with a few others, can't remember exactly what they were.. but then I moved along to 40 errors pointing to the same thing: ICommodity. So I went through each script and commented the line out, hoping all the while it wouldn't cause an issue (but knowing it probably would). That rid me of those errors, but then led me straight to an error with BaseWeapon not being able to convert "string" to "int".

In short.. without someone just uploading their functioning copy, that is compatible with SVN 520.. I'll get nowhere with this. I spent over a month trying to get the damned system to work with 2.0 Final. I'm pretty determined to not deal with the same crap, for the same length of time. Either I luck out, and someone generously uploads their copy.. or I simply eradicate the system from my server and do without. =)
 

lemperor

Sorceror
OWLTR for SVN 520

Hail,

I'm in the same boat as you. What was your final resolution?



Orbit Storm;847584 said:
Heh.. well, I see what you mean about it being a pain in the ass. Since trying to merge everything, I've gone from one error to the next.

Initially I had an error with HelpInfo.cs. Turned out, the modified version of Docs.cs in the OWLTR package, was causing the error. So I simply replaced it with the default SVN script.

I dealt with a few others, can't remember exactly what they were.. but then I moved along to 40 errors pointing to the same thing: ICommodity. So I went through each script and commented the line out, hoping all the while it wouldn't cause an issue (but knowing it probably would). That rid me of those errors, but then led me straight to an error with BaseWeapon not being able to convert "string" to "int".

In short.. without someone just uploading their functioning copy, that is compatible with SVN 520.. I'll get nowhere with this. I spent over a month trying to get the damned system to work with 2.0 Final. I'm pretty determined to not deal with the same crap, for the same length of time. Either I luck out, and someone generously uploads their copy.. or I simply eradicate the system from my server and do without. =)
 

Pure Insanity

Sorceror
Orbit Storm;847584 said:
Heh.. well, I see what you mean about it being a pain in the ass. Since trying to merge everything, I've gone from one error to the next.

Initially I had an error with HelpInfo.cs. Turned out, the modified version of Docs.cs in the OWLTR package, was causing the error. So I simply replaced it with the default SVN script.

I dealt with a few others, can't remember exactly what they were.. but then I moved along to 40 errors pointing to the same thing: ICommodity. So I went through each script and commented the line out, hoping all the while it wouldn't cause an issue (but knowing it probably would). That rid me of those errors, but then led me straight to an error with BaseWeapon not being able to convert "string" to "int".

In short.. without someone just uploading their functioning copy, that is compatible with SVN 520.. I'll get nowhere with this. I spent over a month trying to get the damned system to work with 2.0 Final. I'm pretty determined to not deal with the same crap, for the same length of time. Either I luck out, and someone generously uploads their copy.. or I simply eradicate the system from my server and do without. =)

Erm...What file is it you're needing? The baseweapon? I have a copy that is working for mine, but I'm pretty sure I have other mods in the scripts. You would probably have to merge it, or go through and just copy the function that is throwing the error, replacing it with the one I have.
 

deides

Traveler
Hawkins;794010 said:
I don't know if anyone is with problems combining Daat99's OWLTR with the new SVN400. I thus put some effort in re-combine it to SVN400. I don't have the time to work on the FSATS Gen2 yet. So here attached is the standalone Daat99 OWLTR without the FSATS.

It is updated to cope with Callandor2k's package SVN442. Moreover, a long time existed bug is fixed such that an axe can cut logs into corresponding boards correctly.


Merged all files together, and server loads, but when mining I can only mine iron, and only chop regular logs... i messed up the harvestsystem i gess...

edit, Itried again fromscratch (individually merging each modified file) to see ifi could fox.. but now I am getting an error for board.cs- which I didnt have before! Go figure..... If anyone has been successful merging ML SVN 520 and thesesystems, PLEASE PLEAS PLEASE post here!!!!
 

crimson420

Wanderer
useing this system fs pet level system when i save and restart it keep asking

useing this system fs pet level system when i save and restart it keep asking to delet any pet i have on the sever and i remove it and start over with nothing spawned in the world but the dog and then it give me this every time i try to start my sever and i remove it and start it again and save and restart and this comes up again how do i fix this

HTML:
RunUO - [www.runuo.com] Version 2.0, Build 3638.18786
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 1 64-bit processor
Scripts: Compiling C# scripts...done (cached)
Scripts: Skipping VB.NET Scripts...done (use -vb to enable)
Scripts: Verifying...done (4186 items, 1180 mobiles)
ACC Registered: Server.ACC.CM.CentralMemory
Regions: Loading...Invalid region type 'Xanthos.JailSystem.Jail' in regions.xml
Invalid region type 'Xanthos.JailSystem.Jail' in regions.xml
done
World: Loading...An error was encountered while loading a saved object
 - Type: Server.Mobiles.Dog
 - Serial: 0x00000002
Delete the object? (y/n)
 

Pure Insanity

Sorceror
That error has nothing to do with the owltr or the fs system. Look in the regions.xml file for your jail system. There is an invalid region. Chances are it's a blank region or something else that's easy to spot. If not, just post a new topic in server support with your regions file.
 

Pure Insanity

Sorceror
Ah, does seem to be another error. Looks like it has to do with serializing your basecreature. Might want to double check it all to make sure you did the proper edits required by the both systems.
 

Mahmud100

Sorceror
BaseCreature error

I am getting this error can anyone steer me in the right direction

Code:
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Customs/Modified Distro Scripts/Mobiles/AI/Creature/BaseCreature.cs:
    CS1519: Line 2380: Invalid token 'if' in class, struct, or interface member
declaration
    CS1519: Line 2380: Invalid token '<=' in class, struct, or interface member
declaration
    CS1519: Line 2380: Invalid token '&&' in class, struct, or interface member
declaration
    CS1519: Line 2380: Invalid token '==' in class, struct, or interface member
declaration
    CS1519: Line 2382: Invalid token '=' in class, struct, or interface member
eclaration
    CS1519: Line 2382: Invalid token ';' in class, struct, or interface member
eclaration
    CS0116: Line 2385: A namespace does not directly contain members such as fi
lds or methods
    CS1518: Line 2395: Expected class, delegate, enum, interface, or struct
    CS1518: Line 2400: Expected class, delegate, enum, interface, or struct
    CS1518: Line 2408: Expected class, delegate, enum, interface, or struct
    CS1518: Line 2444: Expected class, delegate, enum, interface, or struct
    CS1518: Line 2447: Expected class, delegate, enum, interface, or struct
    CS1001: Line 2447: Identifier expected
    CS1518: Line 2447: Expected class, delegate, enum, interface, or struct
    CS1518: Line 2447: Expected class, delegate, enum, interface, or struct
    CS1001: Line 2447: Identifier expected
    CS1518: Line 2448: Expected class, delegate, enum, interface, or struct
    CS1022: Line 2450: Type or namespace definition, or end-of-file expected
    CS0101: Line 2447: The namespace '<global namespace>' already contains a de
inition for '?'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 

Pure Insanity

Sorceror
The Modified Distro Scrips does NOT go in your Customs folder. You make those edits to your distro files. Just find your basecreature script that already existed before this script package. And merge the differences into your distro file. I suggest you use WinMerge or Notepad++ to merge the edits.
 

Mahmud100

Sorceror
I decided to no use the Daat99 and just try to get the FS Taming to work first. I have merge and remerged this code and keep getting the same error.
Code:
RunUO - [www.runuo.com] Version 2.1, Build 3581.36459
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 4 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Customs/Modified Distro Scripts/Mobiles/AI/Creature/BaseCreature.cs:
    CS1519: Line 4720: Invalid token 'if' in class, struct, or interface member
declaration
    CS1519: Line 4720: Invalid token '==' in class, struct, or interface member
declaration
    CS1519: Line 4720: Invalid token '==' in class, struct, or interface member
declaration
    CS1519: Line 4726: Invalid token 'foreach' in class, struct, or interface me
mber declaration
    CS1002: Line 4726: ; expected
    CS1519: Line 4726: Invalid token ')' in class, struct, or interface member d
eclaration
    CS1519: Line 4728: Invalid token '==' in class, struct, or interface member
declaration
    CS1519: Line 4728: Invalid token ')' in class, struct, or interface member d
eclaration
    CS1519: Line 4729: Invalid token '=' in class, struct, or interface member d
eclaration
    CS0116: Line 4732: A namespace does not directly contain members such as fie
lds or methods
    CS1518: Line 4745: Expected class, delegate, enum, interface, or struct
    CS1518: Line 4777: Expected class, delegate, enum, interface, or struct
    CS1518: Line 4778: Expected class, delegate, enum, interface, or struct
    CS1518: Line 4780: Expected class, delegate, enum, interface, or struct
    CS1518: Line 4791: Expected class, delegate, enum, interface, or struct
    CS1518: Line 4797: Expected class, delegate, enum, interface, or struct
    CS1022: Line 4819: Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

here is the BaseCreature.cs, Please help me to find what I am doing wrong here.

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Regions;
using Server.Targeting;
using Server.Network;
using Server.Spells;
using Server.Misc;
using Server.Items;
using Server.Mobiles;
using Server.ContextMenus;
using Server.Engines.Quests;
using Server.Factions;
using Server.Spells.Bushido;
using Server.Spells.Spellweaving;
using Server.Spells.Necromancy;


namespace Server.Mobiles
{
    #region Enums
    /// <summary>
    /// Summary description for MobileAI.
    /// </summary>
    /// 
    public enum FightMode
    {
        None,			// Never focus on others
        Aggressor,		// Only attack aggressors
        Strongest,		// Attack the strongest
        Weakest,		// Attack the weakest
        Closest, 		// Attack the closest
        Evil			// Only attack aggressor -or- negative karma
    }

    public enum OrderType
    {
        None,			//When no order, let's roam
        Come,			//"(All/Name) come"  Summons all or one pet to your location.  
        Drop,			//"(Name) drop"  Drops its loot to the ground (if it carries any).  
        Follow,			//"(Name) follow"  Follows targeted being.  
        //"(All/Name) follow me"  Makes all or one pet follow you.  
        Friend,			//"(Name) friend"  Allows targeted player to confirm resurrection. 
        Unfriend,		// Remove a friend
        Guard,			//"(Name) guard"  Makes the specified pet guard you. Pets can only guard their owner. 
        //"(All/Name) guard me"  Makes all or one pet guard you.  
        Attack,			//"(All/Name) kill", 
        //"(All/Name) attack"  All or the specified pet(s) currently under your control attack the target. 
        Patrol,			//"(Name) patrol"  Roves between two or more guarded targets.  
        Release,		//"(Name) release"  Releases pet back into the wild (removes "tame" status). 
        Stay,			//"(All/Name) stay" All or the specified pet(s) will stop and stay in current spot. 
        Stop,			//"(All/Name) stop Cancels any current orders to attack, guard or follow.  
        Transfer		//"(Name) transfer" Transfers complete ownership to targeted player. 
    }

    [Flags]
    public enum FoodType
    {
        None = 0x0000,
        Meat = 0x0001,
        FruitsAndVegies = 0x0002,
        GrainsAndHay = 0x0004,
        Fish = 0x0008,
        Eggs = 0x0010,
        Gold = 0x0020
    }

    [Flags]
    public enum PackInstinct
    {
        None = 0x0000,
        Canine = 0x0001,
        Ostard = 0x0002,
        Feline = 0x0004,
        Arachnid = 0x0008,
        Daemon = 0x0010,
        Bear = 0x0020,
        Equine = 0x0040,
        Bull = 0x0080
    }

    public enum ScaleType
    {
        Red,
        Yellow,
        Black,
        Green,
        White,
        Blue,
        All
    }

    public enum MeatType
    {
        Ribs,
        Bird,
        LambLeg
    }

    public enum HideType
    {
        Regular,
        Spined,
        Horned,
        Barbed
    }

    #endregion

    public class DamageStore : IComparable
    {
        public Mobile m_Mobile;
        public int m_Damage;
        public bool m_HasRight;

        public DamageStore(Mobile m, int damage)
        {
            m_Mobile = m;
            m_Damage = damage;
        }

        public int CompareTo(object obj)
        {
            DamageStore ds = (DamageStore)obj;

            return ds.m_Damage - m_Damage;
        }
    }

    [AttributeUsage(AttributeTargets.Class)]
    public class FriendlyNameAttribute : Attribute
    {

        //future use: Talisman 'Protection/Bonus vs. Specific Creature
        private TextDefinition m_FriendlyName;

        public TextDefinition FriendlyName
        {
            get
            {
                return m_FriendlyName;
            }
        }

        public FriendlyNameAttribute(TextDefinition friendlyName)
        {
            m_FriendlyName = friendlyName;
        }

        public static TextDefinition GetFriendlyNameFor(Type t)
        {
            if (t.IsDefined(typeof(FriendlyNameAttribute), false))
            {
                object[] objs = t.GetCustomAttributes(typeof(FriendlyNameAttribute), false);

                if (objs != null && objs.Length > 0)
                {
                    FriendlyNameAttribute friendly = objs[0] as FriendlyNameAttribute;

                    return friendly.FriendlyName;
                }
            }

            return t.Name;
        }
    }

    public class BaseCreature : Mobile, IHonorTarget
    {
 		#region FS:ATS Edits
		private int m_RoarAttack;
		private int m_PetPoisonAttack;
		private int m_FireBreathAttack;

		private bool m_IsMating;

		private int m_ABPoints;
		private int m_Exp;
		private int m_NextLevel;
		private int m_Level = 1;
		private int m_MaxLevel;

		private bool m_AllowMating;

		private bool m_Evolves;
		private int m_Gen = 1;

		private DateTime m_MatingDelay;

		private int m_Form1;
		private int m_Form2;
		private int m_Form3;
		private int m_Form4;
		private int m_Form5;
		private int m_Form6;
		private int m_Form7;
		private int m_Form8;
		private int m_Form9;

		private int m_Sound1;
		private int m_Sound2;
		private int m_Sound3;
		private int m_Sound4;
		private int m_Sound5;
		private int m_Sound6;
		private int m_Sound7;
		private int m_Sound8;
		private int m_Sound9;

		private bool m_UsesForm1;
		private bool m_UsesForm2;
		private bool m_UsesForm3;
		private bool m_UsesForm4;
		private bool m_UsesForm5;
		private bool m_UsesForm6;
		private bool m_UsesForm7;
		private bool m_UsesForm8;
		private bool m_UsesForm9;

		public bool m_F0;
		public bool m_F1;
		public bool m_F2;
		public bool m_F3;
		public bool m_F4;
		public bool m_F5;
		public bool m_F6;
		public bool m_F7;
		public bool m_F8;
		public bool m_F9;

		[CommandProperty( AccessLevel.GameMaster )]
		public int RoarAttack
		{
			get{ return m_RoarAttack; }
			set{ m_RoarAttack = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int PetPoisonAttack
		{
			get{ return m_PetPoisonAttack; }
			set{ m_PetPoisonAttack = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int FireBreathAttack
		{
			get{ return m_FireBreathAttack; }
			set{ m_FireBreathAttack = value; }
		}

		[CommandProperty( AccessLevel.Administrator )]
		public DateTime MatingDelay
		{
			get{ return m_MatingDelay; }
			set{ m_MatingDelay = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int Generation
		{
			get{ return m_Gen; }
			set{ m_Gen = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int AbilityPoints
		{
			get{ return m_ABPoints; }
			set{ m_ABPoints = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int Exp
		{
			get{ return m_Exp; }
			set{ m_Exp = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int NextLevel
		{
			get{ return m_NextLevel; }
			set{ m_NextLevel = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int Level
		{
			get{ return m_Level; }
			set{ m_Level = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public int MaxLevel
		{
			get{ return m_MaxLevel; }
			set{ m_MaxLevel = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public bool Evolves
		{
			get{ return m_Evolves; }
			set{ m_Evolves = value; }
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public bool AllowMating
		{
			get{ return m_AllowMating; }
			set{ m_AllowMating = value; }
		}

		public int Form1
		{
			get{ return m_Form1; }
			set{ m_Form1 = value; }
		}

		public int Form2
		{
			get{ return m_Form2; }
			set{ m_Form2 = value; }
		}

		public int Form3
		{
			get{ return m_Form3; }
			set{ m_Form3 = value; }
		}

		public int Form4
		{
			get{ return m_Form4; }
			set{ m_Form4 = value; }
		}

		public int Form5
		{
			get{ return m_Form5; }
			set{ m_Form5 = value; }
		}

		public int Form6
		{
			get{ return m_Form6; }
			set{ m_Form6 = value; }
		}

		public int Form7
		{
			get{ return m_Form7; }
			set{ m_Form7 = value; }
		}

		public int Form8
		{
			get{ return m_Form8; }
			set{ m_Form8 = value; }
		}

		public int Form9
		{
			get{ return m_Form9; }
			set{ m_Form9 = value; }
		}

		public int Sound1
		{
			get{ return m_Sound1; }
			set{ m_Sound1 = value; }
		}

		public int Sound2
		{
			get{ return m_Sound2; }
			set{ m_Sound2 = value; }
		}

		public int Sound3
		{
			get{ return m_Sound3; }
			set{ m_Sound3 = value; }
		}

		public int Sound4
		{
			get{ return m_Sound4; }
			set{ m_Sound4 = value; }
		}

		public int Sound5
		{
			get{ return m_Sound5; }
			set{ m_Sound5 = value; }
		}

		public int Sound6
		{
			get{ return m_Sound6; }
			set{ m_Sound6 = value; }
		}

		public int Sound7
		{
			get{ return m_Sound7; }
			set{ m_Sound7 = value; }
		}

		public int Sound8
		{
			get{ return m_Sound8; }
			set{ m_Sound8 = value; }
		}

		public int Sound9
		{
			get{ return m_Sound9; }
			set{ m_Sound9 = value; }
		}

		public bool UsesForm1
		{
			get{ return m_UsesForm1; }
			set{ m_UsesForm1 = value; }
		}

		public bool UsesForm2
		{
			get{ return m_UsesForm2; }
			set{ m_UsesForm2 = value; }
		}

		public bool UsesForm3
		{
			get{ return m_UsesForm3; }
			set{ m_UsesForm3 = value; }
		}

		public bool UsesForm4
		{
			get{ return m_UsesForm4; }
			set{ m_UsesForm4 = value; }
		}

		public bool UsesForm5
		{
			get{ return m_UsesForm5; }
			set{ m_UsesForm5 = value; }
		}

		public bool UsesForm6
		{
			get{ return m_UsesForm6; }
			set{ m_UsesForm6 = value; }
		}

		public bool UsesForm7
		{
			get{ return m_UsesForm7; }
			set{ m_UsesForm7 = value; }
		}

		public bool UsesForm8
		{
			get{ return m_UsesForm8; }
			set{ m_UsesForm8 = value; }
		}

		public bool UsesForm9
		{
			get{ return m_UsesForm9; }
			set{ m_UsesForm9 = value; }
		}

		public bool F0
		{
			get{ return m_F0; }
			set{ m_F0 = value; }
		}

		public bool F1
		{
			get{ return m_F1; }
			set{ m_F1 = value; }
		}

		public bool F2
		{
			get{ return m_F2; }
			set{ m_F2 = value; }
		}

		public bool F3
		{
			get{ return m_F3; }
			set{ m_F3 = value; }
		}

		public bool F4
		{
			get{ return m_F4; }
			set{ m_F4 = value; }
		}

		public bool F5
		{
			get{ return m_F5; }
			set{ m_F5 = value; }
		}

		public bool F6
		{
			get{ return m_F6; }
			set{ m_F6 = value; }
		}

		public bool F7
		{
			get{ return m_F7; }
			set{ m_F7 = value; }
		}

		public bool F8
		{
			get{ return m_F8; }
			set{ m_F8 = value; }
		}

		public bool F9
		{
			get{ return m_F9; }
			set{ m_F9 = value; }
		}
		#endregion

       public const int MaxLoyalty = 100;

        #region Var declarations
        private BaseAI m_AI;					// THE AI

        private AIType m_CurrentAI;				// The current AI
        private AIType m_DefaultAI;				// The default AI

        private Mobile m_FocusMob;				// Use focus mob instead of combatant, maybe we don't whan to fight
        private FightMode m_FightMode;				// The style the mob uses

        private int m_iRangePerception;		// The view area
        private int m_iRangeFight;			// The fight distance

        private bool m_bDebugAI;			// Show debug AI messages

        private int m_iTeam;			// Monster Team

        private double m_dActiveSpeed;			// Timer speed when active
        private double m_dPassiveSpeed;		// Timer speed when not active
        private double m_dCurrentSpeed;		// The current speed, lets say it could be changed by something;

        private Point3D m_pHome;			// The home position of the creature, used by some AI
        private int m_iRangeHome = 10;		// The home range of the creature

        List<Type> m_arSpellAttack;		// List of attack spell/power
        List<Type> m_arSpellDefense;		// List of defensive spell/power

        private bool m_bControlled;			// Is controlled
        private Mobile m_ControlMaster;		// My master
        private Mobile m_ControlTarget;		// My target mobile
        private Point3D m_ControlDest;			// My target destination (patrol)
        private OrderType m_ControlOrder;			// My order

        private int m_Loyalty;

        private double m_dMinTameSkill;
        private bool m_bTamable;

        private bool m_bSummoned = false;
        private DateTime m_SummonEnd;
        private int m_iControlSlots = 1;

        private bool m_bBardProvoked = false;
        private bool m_bBardPacified = false;
        private Mobile m_bBardMaster = null;
        private Mobile m_bBardTarget = null;
        private DateTime m_timeBardEnd;
        private WayPoint m_CurrentWayPoint = null;
        private Point2D m_TargetLocation = Point2D.Zero;

        private Mobile m_SummonMaster;

        private int m_HitsMax = -1;
        private int m_StamMax = -1;
        private int m_ManaMax = -1;
        private int m_DamageMin = -1;
        private int m_DamageMax = -1;

        private int m_PhysicalResistance, m_PhysicalDamage = 100;
        private int m_FireResistance, m_FireDamage;
        private int m_ColdResistance, m_ColdDamage;
        private int m_PoisonResistance, m_PoisonDamage;
        private int m_EnergyResistance, m_EnergyDamage;
        private int m_ChaosDamage;
        private int m_DirectDamage;

        private List<Mobile> m_Owners;
        private List<Mobile> m_Friends;

        private bool m_IsStabled;

        private bool m_HasGeneratedLoot; // have we generated our loot yet?

        private bool m_Paragon;

        private bool m_IsPrisoner;

        #endregion

        public virtual InhumanSpeech SpeechType { get { return null; } }

        public bool IsStabled
        {
            get { return m_IsStabled; }
            set { m_IsStabled = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool IsPrisoner
        {
            get { return m_IsPrisoner; }
            set { m_IsPrisoner = value; }
        }

        protected DateTime SummonEnd
        {
            get { return m_SummonEnd; }
            set { m_SummonEnd = value; }
        }

        public virtual Faction FactionAllegiance { get { return null; } }
        public virtual int FactionSilverWorth { get { return 30; } }

        #region Bonding
        public const bool BondingEnabled = true;

        // region Mondain's Legacy
        public virtual bool IsBondable { get { return (BondingEnabled && !Summoned && !Allured); } }
        public virtual TimeSpan BondingDelay { get { return TimeSpan.FromDays(7.0); } }
        public virtual TimeSpan BondingAbandonDelay { get { return TimeSpan.FromDays(1.0); } }

        public override bool CanRegenHits { get { return !m_IsDeadPet && base.CanRegenHits; } }
        public override bool CanRegenStam { get { return !m_IsDeadPet && base.CanRegenStam; } }
        public override bool CanRegenMana { get { return !m_IsDeadPet && base.CanRegenMana; } }

        public override bool IsDeadBondedPet { get { return m_IsDeadPet; } }

        private bool m_IsBonded;
        private bool m_IsDeadPet;
        private DateTime m_BondingBegin;
        private DateTime m_OwnerAbandonTime;

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile LastOwner
        {
            get
            {
                if (m_Owners == null || m_Owners.Count == 0)
                    return null;

                return m_Owners[m_Owners.Count - 1];
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool IsBonded
        {
            get { return m_IsBonded; }
            set { m_IsBonded = value; InvalidateProperties(); }
        }

        public bool IsDeadPet
        {
            get { return m_IsDeadPet; }
            set { m_IsDeadPet = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public DateTime BondingBegin
        {
            get { return m_BondingBegin; }
            set { m_BondingBegin = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public DateTime OwnerAbandonTime
        {
            get { return m_OwnerAbandonTime; }
            set { m_OwnerAbandonTime = value; }
        }
        #endregion

        public virtual double WeaponAbilityChance { get { return 0.4; } }

        public virtual WeaponAbility GetWeaponAbility()
        {
            return null;
        }

        #region Elemental Resistance/Damage

        public override int BasePhysicalResistance { get { return m_PhysicalResistance; } }
        public override int BaseFireResistance { get { return m_FireResistance; } }
        public override int BaseColdResistance { get { return m_ColdResistance; } }
        public override int BasePoisonResistance { get { return m_PoisonResistance; } }
        public override int BaseEnergyResistance { get { return m_EnergyResistance; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int PhysicalResistanceSeed { get { return m_PhysicalResistance; } set { m_PhysicalResistance = value; UpdateResistances(); } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int FireResistSeed { get { return m_FireResistance; } set { m_FireResistance = value; UpdateResistances(); } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int ColdResistSeed { get { return m_ColdResistance; } set { m_ColdResistance = value; UpdateResistances(); } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int PoisonResistSeed { get { return m_PoisonResistance; } set { m_PoisonResistance = value; UpdateResistances(); } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int EnergyResistSeed { get { return m_EnergyResistance; } set { m_EnergyResistance = value; UpdateResistances(); } }


        [CommandProperty(AccessLevel.GameMaster)]
        public int PhysicalDamage { get { return m_PhysicalDamage; } set { m_PhysicalDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int FireDamage { get { return m_FireDamage; } set { m_FireDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int ColdDamage { get { return m_ColdDamage; } set { m_ColdDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int PoisonDamage { get { return m_PoisonDamage; } set { m_PoisonDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int EnergyDamage { get { return m_EnergyDamage; } set { m_EnergyDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int ChaosDamage { get { return m_ChaosDamage; } set { m_ChaosDamage = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int DirectDamage { get { return m_DirectDamage; } set { m_DirectDamage = value; } }

        #endregion

        [CommandProperty(AccessLevel.GameMaster)]
        public bool IsParagon
        {
            get { return m_Paragon; }
            set
            {
                if (m_Paragon == value)
                    return;
                else if (value)
                    Paragon.Convert(this);
                else
                    Paragon.UnConvert(this);

                m_Paragon = value;

                InvalidateProperties();
            }
        }

        public virtual FoodType FavoriteFood { get { return FoodType.Meat; } }
        public virtual PackInstinct PackInstinct { get { return PackInstinct.None; } }

        public List<Mobile> Owners { get { return m_Owners; } }

        public virtual bool AllowMaleTamer { get { return true; } }
        public virtual bool AllowFemaleTamer { get { return true; } }
        public virtual bool SubdueBeforeTame { get { return false; } }
        public virtual bool StatLossAfterTame { get { return SubdueBeforeTame; } }

        public virtual bool Commandable { get { return true; } }

        public virtual Poison HitPoison { get { return null; } }
        public virtual double HitPoisonChance { get { return 0.5; } }
        public virtual Poison PoisonImmune { get { return null; } }

        public virtual bool BardImmune { get { return false; } }
        public virtual bool Unprovokable { get { return BardImmune || m_IsDeadPet; } }
        public virtual bool Uncalmable { get { return BardImmune || m_IsDeadPet; } }
        public virtual bool AreaPeaceImmune { get { return BardImmune || m_IsDeadPet; } }

        public virtual bool BleedImmune { get { return false; } }
        public virtual double BonusPetDamageScalar { get { return 1.0; } }

        public virtual bool DeathAdderCharmable { get { return false; } }

        //TODO: Find the pub 31 tweaks to the DispelDifficulty and apply them of course.
        public virtual double DispelDifficulty { get { return 0.0; } } // at this skill level we dispel 50% chance
        public virtual double DispelFocus { get { return 20.0; } } // at difficulty - focus we have 0%, at difficulty + focus we have 100%
        public virtual bool DisplayWeight { get { return Backpack is StrongBackpack; } }

        #region Breath ability, like dragon fire breath
        private DateTime m_NextBreathTime;

        // Must be overriden in subclass to enable
        public virtual bool HasBreath { get { return false; } }

        // Base damage given is: CurrentHitPoints * BreathDamageScalar
        public virtual double BreathDamageScalar { get { return (Core.AOS ? 0.16 : 0.05); } }

        // Min/max seconds until next breath
        public virtual double BreathMinDelay { get { return 10.0; } }
        public virtual double BreathMaxDelay { get { return 15.0; } }

        // Creature stops moving for 1.0 seconds while breathing
        public virtual double BreathStallTime { get { return 1.0; } }

        // Effect is sent 1.3 seconds after BreathAngerSound and BreathAngerAnimation is played
        public virtual double BreathEffectDelay { get { return 1.3; } }

        // Damage is given 1.0 seconds after effect is sent
        public virtual double BreathDamageDelay { get { return 1.0; } }

        public virtual int BreathRange { get { return RangePerception; } }

        // Damage types
        public virtual int BreathPhysicalDamage { get { return 0; } }
        public virtual int BreathFireDamage { get { return 100; } }
        public virtual int BreathColdDamage { get { return 0; } }
        public virtual int BreathPoisonDamage { get { return 0; } }
        public virtual int BreathEnergyDamage { get { return 0; } }

        // Effect details and sound
        public virtual int BreathEffectItemID { get { return 0x36D4; } }
        public virtual int BreathEffectSpeed { get { return 5; } }
        public virtual int BreathEffectDuration { get { return 0; } }
        public virtual bool BreathEffectExplodes { get { return false; } }
        public virtual bool BreathEffectFixedDir { get { return false; } }
        public virtual int BreathEffectHue { get { return 0; } }
        public virtual int BreathEffectRenderMode { get { return 0; } }

        public virtual int BreathEffectSound { get { return 0x227; } }

        // Anger sound/animations
        public virtual int BreathAngerSound { get { return GetAngerSound(); } }
        public virtual int BreathAngerAnimation { get { return 12; } }

        public virtual void BreathStart(Mobile target)
        {
            BreathStallMovement();
            BreathPlayAngerSound();
            BreathPlayAngerAnimation();

            this.Direction = this.GetDirectionTo(target);

            Timer.DelayCall(TimeSpan.FromSeconds(BreathEffectDelay), new TimerStateCallback(BreathEffect_Callback), target);
        }

        public virtual void BreathStallMovement()
        {
            if (m_AI != null)
                m_AI.NextMove = DateTime.Now + TimeSpan.FromSeconds(BreathStallTime);
        }

        public virtual void BreathPlayAngerSound()
        {
            PlaySound(BreathAngerSound);
        }

        public virtual void BreathPlayAngerAnimation()
        {
            Animate(BreathAngerAnimation, 5, 1, true, false, 0);
        }

        public virtual void BreathEffect_Callback(object state)
        {
            Mobile target = (Mobile)state;

            if (!target.Alive || !CanBeHarmful(target))
                return;

            BreathPlayEffectSound();
            BreathPlayEffect(target);

            Timer.DelayCall(TimeSpan.FromSeconds(BreathDamageDelay), new TimerStateCallback(BreathDamage_Callback), target);
        }

        public virtual void BreathPlayEffectSound()
        {
            PlaySound(BreathEffectSound);
        }

        public virtual void BreathPlayEffect(Mobile target)
        {
            Effects.SendMovingEffect(this, target, BreathEffectItemID,
                BreathEffectSpeed, BreathEffectDuration, BreathEffectFixedDir,
                BreathEffectExplodes, BreathEffectHue, BreathEffectRenderMode);
        }

        public virtual void BreathDamage_Callback(object state)
        {
            Mobile target = (Mobile)state;

            if (CanBeHarmful(target))
            {
                DoHarmful(target);
                BreathDealDamage(target);
            }
        }

        public virtual void BreathDealDamage(Mobile target)
        {
            int physDamage = BreathPhysicalDamage;
            int fireDamage = BreathFireDamage;
            int coldDamage = BreathColdDamage;
            int poisDamage = BreathPoisonDamage;
            int nrgyDamage = BreathEnergyDamage;

            if (Evasion.CheckSpellEvasion(target))
                return;

            if (physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0)
            { // Unresistable damage even in AOS
                target.Damage(BreathComputeDamage(), this);
            }
            else
            {
                AOS.Damage(target, this, BreathComputeDamage(), physDamage, fireDamage, coldDamage, poisDamage, nrgyDamage);
            }
        }

        public virtual int BreathComputeDamage()
        {
            int damage = (int)(Hits * BreathDamageScalar);

            if (IsParagon)
                damage = (int)(damage / Paragon.HitsBuff);

            return damage;
        }
        #endregion

        #region Spill Acid
        public void SpillAcid(int Amount)
        {
            SpillAcid(null, Amount);
        }
        public void SpillAcid(Mobile target, int Amount)
        {
            if ((target != null && target.Map == null) || this.Map == null)
                return;

            for (int i = 0; i < Amount; ++i)
            {
                Point3D loc = this.Location;
                Map map = this.Map;
                Item acid = NewHarmfulItem();

                if (target != null && target.Map != null && Amount == 1)
                {
                    loc = target.Location;
                    map = target.Map;
                }
                else
                {
                    bool validLocation = false;
                    for (int j = 0; !validLocation && j < 10; ++j)
                    {
                        loc = new Point3D(
                            loc.X + (Utility.Random(0, 3) - 2),
                            loc.Y + (Utility.Random(0, 3) - 2),
                            loc.Z);
                        loc.Z = map.GetAverageZ(loc.X, loc.Y);
                        validLocation = map.CanFit(loc, 16, false, false);
                    }
                }
                acid.MoveToWorld(loc, map);
            }
        }

        /* 
            Solen Style, override me for other mobiles/items: 
            kappa+acidslime, grizzles+whatever, etc. 
        */
        public virtual Item NewHarmfulItem()
        {
            return new PoolOfAcid(TimeSpan.FromSeconds(10), 30, 30);
        }
 















       #endregion

        #region Flee!!!
        private DateTime m_EndFlee;

        public DateTime EndFleeTime
        {
            get { return m_EndFlee; }
            set { m_EndFlee = value; }
        }

        public virtual void StopFlee()
        {
            m_EndFlee = DateTime.MinValue;
        }

        public virtual bool CheckFlee()
        {
            if (m_EndFlee == DateTime.MinValue)
                return false;

            if (DateTime.Now >= m_EndFlee)
            {
                StopFlee();
                return false;
            }

            return true;
        }

        public virtual void BeginFlee(TimeSpan maxDuration)
        {
            m_EndFlee = DateTime.Now + maxDuration;
        }
        #endregion

        public BaseAI AIObject { get { return m_AI; } }

        public const int MaxOwners = 5;

        public virtual OppositionGroup OppositionGroup
        {
            get { return null; }
        }

        #region Friends
        public List<Mobile> Friends { get { return m_Friends; } }

        public virtual bool AllowNewPetFriend
        {
            get { return (m_Friends == null || m_Friends.Count < 5); }
        }

        public virtual bool IsPetFriend(Mobile m)
        {
            return (m_Friends != null && m_Friends.Contains(m));
        }

        public virtual void AddPetFriend(Mobile m)
        {
            if (m_Friends == null)
                m_Friends = new List<Mobile>();

            m_Friends.Add(m);
        }

        public virtual void RemovePetFriend(Mobile m)
        {
            if (m_Friends != null)
                m_Friends.Remove(m);
        }

        public virtual bool IsFriend(Mobile m)
        {
            OppositionGroup g = this.OppositionGroup;

            if (g != null && g.IsEnemy(this, m))
                return false;

            if (!(m is BaseCreature))
                return false;

            BaseCreature c = (BaseCreature)m;

            return (m_iTeam == c.m_iTeam && ((m_bSummoned || m_bControlled) == (c.m_bSummoned || c.m_bControlled))/* && c.Combatant != this */);
        }
        #endregion

        #region Allegiance
        public virtual Ethics.Ethic EthicAllegiance { get { return null; } }

        public enum Allegiance
        {
            None,
            Ally,
            Enemy
        }

        public virtual Allegiance GetFactionAllegiance(Mobile mob)
        {
            if (mob == null || mob.Map != Faction.Facet || FactionAllegiance == null)
                return Allegiance.None;

            Faction fac = Faction.Find(mob, true);

            if (fac == null)
                return Allegiance.None;

            return (fac == FactionAllegiance ? Allegiance.Ally : Allegiance.Enemy);
        }

        public virtual Allegiance GetEthicAllegiance(Mobile mob)
        {
            if (mob == null || mob.Map != Faction.Facet || EthicAllegiance == null)
                return Allegiance.None;

            Ethics.Ethic ethic = Ethics.Ethic.Find(mob, true);

            if (ethic == null)
                return Allegiance.None;

            return (ethic == EthicAllegiance ? Allegiance.Ally : Allegiance.Enemy);
        }
        #endregion

        public virtual bool IsEnemy(Mobile m)
        {
            OppositionGroup g = this.OppositionGroup;

            if (g != null && g.IsEnemy(this, m))
                return true;

            if (m is BaseGuard)
                return false;

            if (GetFactionAllegiance(m) == Allegiance.Ally)
                return false;

            Ethics.Ethic ourEthic = EthicAllegiance;
            Ethics.Player pl = Ethics.Player.Find(m, true);

            if (pl != null && pl.IsShielded && (ourEthic == null || ourEthic == pl.Ethic))
                return false;

            if (!(m is BaseCreature) || m is Server.Engines.Quests.Haven.MilitiaFighter)
                return true;

            if (TransformationSpellHelper.UnderTransformation(m, typeof(EtherealVoyageSpell)))
                return false;

            BaseCreature c = (BaseCreature)m;

            return (m_iTeam != c.m_iTeam || ((m_bSummoned || m_bControlled) != (c.m_bSummoned || c.m_bControlled))/* || c.Combatant == this*/ );
        }

        public override string ApplyNameSuffix(string suffix)
        {
            if (IsParagon)
            {
                if (suffix.Length == 0)
                    suffix = "(Paragon)";
                else
                    suffix = String.Concat(suffix, " (Paragon)");
            }

            return base.ApplyNameSuffix(suffix);
        }

        public virtual bool CheckControlChance(Mobile m)
        {
            if (GetControlChance(m) > Utility.RandomDouble())
            {
                Loyalty += 1;
                return true;
            }

            PlaySound(GetAngerSound());

            if (Body.IsAnimal)
                Animate(10, 5, 1, true, false, 0);
            else if (Body.IsMonster)
                Animate(18, 5, 1, true, false, 0);

            Loyalty -= 3;
            return false;
        }

        public virtual bool CanBeControlledBy(Mobile m)
        {
            return (GetControlChance(m) > 0.0);
        }

        public double GetControlChance(Mobile m)
        {
            return GetControlChance(m, false);
        }

        public virtual double GetControlChance(Mobile m, bool useBaseSkill)
        {
            if (m_dMinTameSkill <= 29.1 || m_bSummoned || m.AccessLevel >= AccessLevel.GameMaster)
                return 1.0;

            double dMinTameSkill = m_dMinTameSkill;

            if (dMinTameSkill > -24.9 && Server.SkillHandlers.AnimalTaming.CheckMastery(m, this))
                dMinTameSkill = -24.9;

            int taming = (int)((useBaseSkill ? m.Skills[SkillName.AnimalTaming].Base : m.Skills[SkillName.AnimalTaming].Value) * 10);
            int lore = (int)((useBaseSkill ? m.Skills[SkillName.AnimalLore].Base : m.Skills[SkillName.AnimalLore].Value) * 10);
            int bonus = 0, chance = 700;

            if (Core.ML)
            {
                int SkillBonus = taming - (int)(dMinTameSkill * 10);
                int LoreBonus = lore - (int)(dMinTameSkill * 10);

                int SkillMod = 6, LoreMod = 6;

                if (SkillBonus < 0)
                    SkillMod = 28;
                if (LoreBonus < 0)
                    LoreMod = 14;

                SkillBonus *= SkillMod;
                LoreBonus *= LoreMod;

                bonus = (SkillBonus + LoreBonus) / 2;
            }
            else
            {
                int difficulty = (int)(dMinTameSkill * 10);
                int weighted = ((taming * 4) + lore) / 5;
                bonus = weighted - difficulty;


                if (bonus <= 0)
                    bonus *= 14;
                else
                    bonus *= 6;
            }

            chance += bonus;

            if (chance >= 0 && chance < 200)
                chance = 200;
            else if (chance > 990)
                chance = 990;

            chance -= (MaxLoyalty - m_Loyalty) * 10;

            return ((double)chance / 1000);
        }

        private static Type[] m_AnimateDeadTypes = new Type[]
			{
				typeof( MoundOfMaggots ), typeof( HellSteed ), typeof( SkeletalMount ),
				typeof( WailingBanshee ), typeof( Wraith ), typeof( SkeletalDragon ),
				typeof( LichLord ), typeof( FleshGolem ), typeof( Lich ),
				typeof( SkeletalKnight ), typeof( BoneKnight ), typeof( Mummy ),
				typeof( SkeletalMage ), typeof( BoneMagi ), typeof( PatchworkSkeleton )
			};

        public virtual bool IsAnimatedDead
        {
            get
            {
                if (!Summoned)
                    return false;

                Type type = this.GetType();

                bool contains = false;

                for (int i = 0; !contains && i < m_AnimateDeadTypes.Length; ++i)
                    contains = (type == m_AnimateDeadTypes[i]);

                return contains;
            }
        }

        public virtual bool IsNecroFamiliar
        {
            get
            {
                if (!Summoned)
                    return false;

                if (m_ControlMaster != null && SummonFamiliarSpell.Table.Contains(m_ControlMaster))
                    return SummonFamiliarSpell.Table[m_ControlMaster] == this;

                return false;
            }
        }

        public override void Damage(int amount, Mobile from)
        {
            int oldHits = this.Hits;

            if (Core.AOS && !this.Summoned && this.Controlled && 0.2 > Utility.RandomDouble())
                amount = (int)(amount * BonusPetDamageScalar);

            if (Spells.Necromancy.EvilOmenSpell.CheckEffect(this))
                amount = (int)(amount * 1.25);

            Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath(from);

            if (oath == this)
            {
                amount = (int)(amount * 1.1);
                from.Damage(amount, from);
            }

            base.Damage(amount, from);

            if (SubdueBeforeTame && !Controlled)
            {
                if ((oldHits > (this.HitsMax / 10)) && (this.Hits <= (this.HitsMax / 10)))
                    PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "* The creature has been beaten into subjugation! *");
            }
        }











        public virtual bool DeleteCorpseOnDeath
        {
            get
            {
                return !Core.AOS && m_bSummoned;
            }
        }

        public override void SetLocation(Point3D newLocation, bool isTeleport)
        {
            base.SetLocation(newLocation, isTeleport);

            if (isTeleport && m_AI != null)
                m_AI.OnTeleported();
        }

        public override void OnBeforeSpawn(Point3D location, Map m)
        {
            if (Paragon.CheckConvert(this, location, m))
                IsParagon = true;

            base.OnBeforeSpawn(location, m);
        }

        public override ApplyPoisonResult ApplyPoison(Mobile from, Poison poison)
        {
            if (!Alive || IsDeadPet)
                return ApplyPoisonResult.Immune;

            if (Spells.Necromancy.EvilOmenSpell.CheckEffect(this))
                poison = PoisonImpl.IncreaseLevel(poison);

            ApplyPoisonResult result = base.ApplyPoison(from, poison);

            if (from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer)
                (PoisonTimer as PoisonImpl.PoisonTimer).From = from;

            return result;
        }

        public override bool CheckPoisonImmunity(Mobile from, Poison poison)
        {
            if (base.CheckPoisonImmunity(from, poison))
                return true;

            Poison p = this.PoisonImmune;

            #region Mondain's Legacy mod
            return (p != null && p.RealLevel >= poison.RealLevel);
            #endregion
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int Loyalty
        {
            get
            {
                return m_Loyalty;
            }
            set
            {
                m_Loyalty = Math.Min(Math.Max(value, 0), MaxLoyalty);
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public WayPoint CurrentWayPoint
        {
            get
            {
                return m_CurrentWayPoint;
            }
            set
            {
                m_CurrentWayPoint = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Point2D TargetLocation
        {
            get
            {
                return m_TargetLocation;
            }
            set
            {
                m_TargetLocation = value;
            }
        }

        public virtual Mobile ConstantFocus { get { return null; } }

        public virtual bool DisallowAllMoves
        {
            get
            {
                return false;
            }
        }

        public virtual bool InitialInnocent
        {
            get
            {
                return false;
            }
        }

        public virtual bool AlwaysMurderer
        {
            get
            {
                return false;
            }
        }

        public virtual bool AlwaysAttackable
        {
            get
            {
                return false;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public virtual int DamageMin { get { return m_DamageMin; } set { m_DamageMin = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public virtual int DamageMax { get { return m_DamageMax; } set { m_DamageMax = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public override int HitsMax
        {
            get
            {
                if (m_HitsMax > 0)
                {
                    int value = m_HitsMax + GetStatOffset(StatType.Str);

                    if (value < 1)
                        value = 1;
                    else if (value > 65000)
                        value = 65000;

                    return value;
                }

                return Str;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int HitsMaxSeed
        {
            get { return m_HitsMax; }
            set { m_HitsMax = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public override int StamMax
        {
            get
            {
                if (m_StamMax > 0)
                {
                    int value = m_StamMax + GetStatOffset(StatType.Dex);

                    if (value < 1)
                        value = 1;
                    else if (value > 65000)
                        value = 65000;

                    return value;
                }

                return Dex;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int StamMaxSeed
        {
            get { return m_StamMax; }
            set { m_StamMax = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public override int ManaMax
        {
            get
            {
                if (m_ManaMax > 0)
                {
                    int value = m_ManaMax + GetStatOffset(StatType.Int);

                    if (value < 1)
                        value = 1;
                    else if (value > 65000)
                        value = 65000;

                    return value;
                }

                return Int;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int ManaMaxSeed
        {
            get { return m_ManaMax; }
            set { m_ManaMax = value; }
        }

        public virtual bool CanOpenDoors
        {
            get
            {
                return !this.Body.IsAnimal && !this.Body.IsSea;
            }
        }

        public virtual bool CanMoveOverObstacles
        {
            get
            {
                return Core.AOS || this.Body.IsMonster;
            }
        }

        public virtual bool CanDestroyObstacles
        {
            get
            {
                // to enable breaking of furniture, 'return CanMoveOverObstacles;'
                return false;
            }
        }

        public void Unpacify()
        {
            BardEndTime = DateTime.Now;
            BardPacified = false;
        }

        private HonorContext m_ReceivedHonorContext;

        public HonorContext ReceivedHonorContext { get { return m_ReceivedHonorContext; } set { m_ReceivedHonorContext = value; } }

        public override void OnDamage(int amount, Mobile from, bool willKill)
        {
            if (BardPacified && (HitsMax - Hits) * 0.001 > Utility.RandomDouble())
                Unpacify();

            int disruptThreshold;
            //NPCs can use bandages too!
            if (!Core.AOS)
                disruptThreshold = 0;
            else if (from != null && from.Player)
                disruptThreshold = 18;
            else
                disruptThreshold = 25;

            if (amount > disruptThreshold)
            {
                BandageContext c = BandageContext.GetContext(this);

                if (c != null)
                    c.Slip();
            }

            if (Confidence.IsRegenerating(this))
                Confidence.StopRegenerating(this);

            WeightOverloading.FatigueOnDamage(this, amount);

            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null && !willKill)
                speechType.OnDamage(this, amount);

            if (m_ReceivedHonorContext != null)
                m_ReceivedHonorContext.OnTargetDamaged(from, amount);

            base.OnDamage(amount, from, willKill);
        }

        public virtual void OnDamagedBySpell(Mobile from)
        {
        }

        #region Alter[...]Damage From/To

        public virtual void AlterDamageScalarFrom(Mobile caster, ref double scalar)
        {
        }

        public virtual void AlterDamageScalarTo(Mobile target, ref double scalar)
        {
        }

        public virtual void AlterSpellDamageFrom(Mobile from, ref int damage)
        {
        }

        public virtual void AlterSpellDamageTo(Mobile to, ref int damage)
        {
        }

        public virtual void AlterMeleeDamageFrom(Mobile from, ref int damage)
        {
        }

        public virtual void AlterMeleeDamageTo(Mobile to, ref int damage)
        {
        }
        







		#endregion



        public virtual void CheckReflect(Mobile caster, ref bool reflect)
        {
        }
        // Mondain's Legacy mod
        public virtual void OnCarve(Mobile from, Corpse corpse, Item with)
        {
            int feathers = Feathers;
            int wool = Wool;
            int meat = Meat;
            int hides = Hides;
            int scales = Scales;

            if ((feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded)
            {
                from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
            }
            else
            {
                if (Core.ML && from.Race == Race.Human)
                {
                    hides = (int)Math.Ceiling(hides * 1.1);	//10% Bonus Only applies to Hides, Ore & Logs
                }

                if (corpse.Map == Map.Felucca)
                {
                    feathers *= 2;
                    wool *= 2;
                    hides *= 2;
                }

                new Blood(0x122D).MoveToWorld(corpse.Location, corpse.Map);

                if (feathers != 0)
                {
                    corpse.DropItem(new Feather(feathers));
                    from.SendLocalizedMessage(500479); // You pluck the bird. The feathers are now on the corpse.
                }

                if (wool != 0)
                {
                    corpse.DropItem(new Wool(wool));
                    from.SendLocalizedMessage(500483); // You shear it, and the wool is now on the corpse.
                }

                if (meat != 0)
                {
                    if (MeatType == MeatType.Ribs)
                        corpse.DropItem(new RawRibs(meat));
                    else if (MeatType == MeatType.Bird)
                        corpse.DropItem(new RawBird(meat));
                    else if (MeatType == MeatType.LambLeg)
                        corpse.DropItem(new RawLambLeg(meat));

                    from.SendLocalizedMessage(500467); // You carve some meat, which remains on the corpse.
                }

                #region Mondain's Legacy
                if (hides != 0 && with is ButchersWarCleaver)
                {
                    Item leather = null;

                    if (HideType == HideType.Regular)
                        leather = new Leather(hides);
                    else if (HideType == HideType.Spined)
                        leather = new SpinedLeather(hides);
                    else if (HideType == HideType.Horned)
                        leather = new HornedLeather(hides);
                    else if (HideType == HideType.Barbed)
                        leather = new BarbedLeather(hides);

                    if (leather != null)
                    {
                        if (!from.PlaceInBackpack(leather))
                        {
                            leather.MoveToWorld(from.Location, from.Map);
                            from.SendLocalizedMessage(1077182); // Your backpack is too full, and it falls to the ground.	
                        }
                        else
                            from.SendLocalizedMessage(1073555); // You skin it and place the cut-up hides in your backpack.		
                    }
                }
                #endregion
                else if (hides != 0)
                {
                    if (HideType == HideType.Regular)
                        corpse.DropItem(new Hides(hides));
                    else if (HideType == HideType.Spined)
                        corpse.DropItem(new SpinedHides(hides));
                    else if (HideType == HideType.Horned)
                        corpse.DropItem(new HornedHides(hides));
                    else if (HideType == HideType.Barbed)
                        corpse.DropItem(new BarbedHides(hides));

















                    from.SendLocalizedMessage(500471); // You skin it, and the hides are now in the corpse.
                }

                if (scales != 0)
                {
                    ScaleType sc = this.ScaleType;

                    switch (sc)
                    {
                        case ScaleType.Red: corpse.DropItem(new RedScales(scales)); break;
                        case ScaleType.Yellow: corpse.DropItem(new YellowScales(scales)); break;
                        case ScaleType.Black: corpse.DropItem(new BlackScales(scales)); break;
                        case ScaleType.Green: corpse.DropItem(new GreenScales(scales)); break;
                        case ScaleType.White: corpse.DropItem(new WhiteScales(scales)); break;
                        case ScaleType.Blue: corpse.DropItem(new BlueScales(scales)); break;
                        case ScaleType.All:
                            {
                                corpse.DropItem(new RedScales(scales));
                                corpse.DropItem(new YellowScales(scales));
                                corpse.DropItem(new BlackScales(scales));
                                corpse.DropItem(new GreenScales(scales));
                                corpse.DropItem(new WhiteScales(scales));
                                corpse.DropItem(new BlueScales(scales));
                                break;
                            }
                    }











                    from.SendMessage("You cut away some scales, but they remain on the corpse.");
                }

                corpse.Carved = true;

                if (corpse.IsCriminalAction(from))
                    from.CriminalAction(true);
            }
        }

        public const int DefaultRangePerception = 16;
        public const int OldRangePerception = 10;

        public BaseCreature(AIType ai,
            FightMode mode,
            int iRangePerception,
            int iRangeFight,
            double dActiveSpeed,
            double dPassiveSpeed)
        {
			#region FS:ATS Edits
			bool alwaysMale = false;
			Type typ = this.GetType();
			string nam = typ.Name;

			bool alwaysFemale = false;
			Type typ2 = this.GetType();
			string nam2 = typ2.Name;

			foreach ( string check in FSATS.AlwaysMale )
			{
  				if ( check == nam )
    					alwaysMale = true;
			}

			foreach ( string check2 in FSATS.AlwaysFemale )
			{
  				if ( check2 == nam2 )
    					alwaysFemale = true;
			}

			if ( alwaysMale == true )
				this.Female = false;
			else if ( alwaysFemale == true )
				this.Female = true;
			else
			{
				switch ( Utility.Random( 2 ) ) 
				{ 
         				case 0: this.Female = true; break;
					
					case 1: this.Female = false; break;
				}
			}

			m_MaxLevel = Utility.RandomMinMax( 10, 30 );
			#endregion

            if (iRangePerception == OldRangePerception)
                iRangePerception = DefaultRangePerception;

            m_Loyalty = MaxLoyalty; // Wonderfully Happy

            m_CurrentAI = ai;
            m_DefaultAI = ai;

            m_iRangePerception = iRangePerception;
            m_iRangeFight = iRangeFight;

            m_FightMode = mode;

            m_iTeam = 0;

            SpeedInfo.GetSpeeds(this, ref dActiveSpeed, ref dPassiveSpeed);

            m_dActiveSpeed = dActiveSpeed;
            m_dPassiveSpeed = dPassiveSpeed;
            m_dCurrentSpeed = dPassiveSpeed;

            m_bDebugAI = false;

            m_arSpellAttack = new List<Type>();
            m_arSpellDefense = new List<Type>();

            m_bControlled = false;
            m_ControlMaster = null;
            m_ControlTarget = null;
            m_ControlOrder = OrderType.None;

            m_bTamable = false;

            m_Owners = new List<Mobile>();

            m_NextReacquireTime = DateTime.Now + ReacquireDelay;

            ChangeAIType(AI);

            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null)
                speechType.OnConstruct(this);

            GenerateLoot(true);
        }

        public BaseCreature(Serial serial) : base(serial)
        {
            m_arSpellAttack = new List<Type>();
            m_arSpellDefense = new List<Type>();

            m_bDebugAI = false;
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)17); // version

            writer.Write((int)m_CurrentAI);
            writer.Write((int)m_DefaultAI);

            writer.Write((int)m_iRangePerception);
            writer.Write((int)m_iRangeFight);

            writer.Write((int)m_iTeam);

            writer.Write((double)m_dActiveSpeed);
            writer.Write((double)m_dPassiveSpeed);
            writer.Write((double)m_dCurrentSpeed);

            writer.Write((int)m_pHome.X);
            writer.Write((int)m_pHome.Y);
            writer.Write((int)m_pHome.Z);

            // Version 1
            writer.Write((int)m_iRangeHome);

            int i = 0;

            writer.Write((int)m_arSpellAttack.Count);
            for (i = 0; i < m_arSpellAttack.Count; i++)
            {
                writer.Write(m_arSpellAttack[i].ToString());
            }

            writer.Write((int)m_arSpellDefense.Count);
            for (i = 0; i < m_arSpellDefense.Count; i++)
            {
                writer.Write(m_arSpellDefense[i].ToString());
            }

            // Version 2
            writer.Write((int)m_FightMode);

            writer.Write((bool)m_bControlled);
            writer.Write((Mobile)m_ControlMaster);
            writer.Write((Mobile)m_ControlTarget);
            writer.Write((Point3D)m_ControlDest);
            writer.Write((int)m_ControlOrder);
            writer.Write((double)m_dMinTameSkill);
            // Removed in version 9
            //writer.Write( (double) m_dMaxTameSkill );
            writer.Write((bool)m_bTamable);
            writer.Write((bool)m_bSummoned);

            if (m_bSummoned)
                writer.WriteDeltaTime(m_SummonEnd);

            writer.Write((int)m_iControlSlots);

            // Version 3
            writer.Write((int)m_Loyalty);

            // Version 4 
            writer.Write(m_CurrentWayPoint);

            // Verison 5
            writer.Write(m_SummonMaster);

            // Version 6
            writer.Write((int)m_HitsMax);
            writer.Write((int)m_StamMax);
            writer.Write((int)m_ManaMax);
            writer.Write((int)m_DamageMin);
            writer.Write((int)m_DamageMax);

            // Version 7
            writer.Write((int)m_PhysicalResistance);
            writer.Write((int)m_PhysicalDamage);

            writer.Write((int)m_FireResistance);
            writer.Write((int)m_FireDamage);

            writer.Write((int)m_ColdResistance);
            writer.Write((int)m_ColdDamage);

            writer.Write((int)m_PoisonResistance);
            writer.Write((int)m_PoisonDamage);

            writer.Write((int)m_EnergyResistance);
            writer.Write((int)m_EnergyDamage);

            // Version 8
            writer.Write(m_Owners, true);

            // Version 10
            writer.Write((bool)m_IsDeadPet);
            writer.Write((bool)m_IsBonded);
            writer.Write((DateTime)m_BondingBegin);
            writer.Write((DateTime)m_OwnerAbandonTime);

            // Version 11
            writer.Write((bool)m_HasGeneratedLoot);

            // Version 12
            writer.Write((bool)m_Paragon);

            // Version 13
            writer.Write((bool)(m_Friends != null && m_Friends.Count > 0));

            if (m_Friends != null && m_Friends.Count > 0)
                writer.Write(m_Friends, true);

            // Version 14
            writer.Write((bool)m_RemoveIfUntamed);
            writer.Write((int)m_RemoveStep);

            #region Mondain's Legacy version 17
            writer.Write((bool)m_Allured);
            #endregion

 			// Version 17 FS:ATS EDITS
			writer.Write( (bool) m_IsMating );
			writer.Write( (int) m_ABPoints );
			writer.Write( (int) m_Exp );
			writer.Write( (int) m_NextLevel );
			writer.Write( (int) m_Level );
			writer.Write( (int) m_MaxLevel );
			writer.Write( (bool) m_AllowMating );
			writer.Write( (bool) m_Evolves );
			writer.Write( (int) m_Gen );
			writer.Write( (DateTime) m_MatingDelay );
			writer.Write( (int) m_Form1 );
			writer.Write( (int) m_Form2 );
			writer.Write( (int) m_Form3 );
			writer.Write( (int) m_Form4 );
			writer.Write( (int) m_Form5 );
			writer.Write( (int) m_Form6 );
			writer.Write( (int) m_Form7 );
			writer.Write( (int) m_Form8 );
			writer.Write( (int) m_Form9 );
			writer.Write( (int) m_Sound1 );
			writer.Write( (int) m_Sound2 );
			writer.Write( (int) m_Sound3 );
			writer.Write( (int) m_Sound4 );
			writer.Write( (int) m_Sound5 );
			writer.Write( (int) m_Sound6 );
			writer.Write( (int) m_Sound7 );
			writer.Write( (int) m_Sound8 );
			writer.Write( (int) m_Sound9 );
			writer.Write( (bool) m_UsesForm1 );
			writer.Write( (bool) m_UsesForm2 );
			writer.Write( (bool) m_UsesForm3 );
			writer.Write( (bool) m_UsesForm4 );
			writer.Write( (bool) m_UsesForm5 );
			writer.Write( (bool) m_UsesForm6 );
			writer.Write( (bool) m_UsesForm7 );
			writer.Write( (bool) m_UsesForm8 );
			writer.Write( (bool) m_UsesForm9 );
			writer.Write( (bool) m_F0 );
			writer.Write( (bool) m_F1 );
			writer.Write( (bool) m_F2 );
			writer.Write( (bool) m_F3 );
			writer.Write( (bool) m_F4 );
			writer.Write( (bool) m_F5 );
			writer.Write( (bool) m_F6 );
			writer.Write( (bool) m_F7 );
			writer.Write( (bool) m_F8 );
			writer.Write( (bool) m_F9 );
			writer.Write( (int) m_RoarAttack );
			writer.Write( (int) m_PetPoisonAttack );
			writer.Write( (int) m_FireBreathAttack );
		}

        private static double[] m_StandardActiveSpeeds = new double[]
			{
				0.175, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.8
			};

        private static double[] m_StandardPassiveSpeeds = new double[]
			{
				0.350, 0.2, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.6, 2.0
			};

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_CurrentAI = (AIType)reader.ReadInt();
            m_DefaultAI = (AIType)reader.ReadInt();

            m_iRangePerception = reader.ReadInt();
            m_iRangeFight = reader.ReadInt();

            m_iTeam = reader.ReadInt();

            m_dActiveSpeed = reader.ReadDouble();
            m_dPassiveSpeed = reader.ReadDouble();
            m_dCurrentSpeed = reader.ReadDouble();

            if (m_iRangePerception == OldRangePerception)
                m_iRangePerception = DefaultRangePerception;

            m_pHome.X = reader.ReadInt();
            m_pHome.Y = reader.ReadInt();
            m_pHome.Z = reader.ReadInt();

            if (version >= 1)
            {
                m_iRangeHome = reader.ReadInt();

                int i, iCount;

                iCount = reader.ReadInt();
                for (i = 0; i < iCount; i++)
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType(str);

                    if (type != null)
                    {
                        m_arSpellAttack.Add(type);
                    }
                }

                iCount = reader.ReadInt();
                for (i = 0; i < iCount; i++)
                {
                    string str = reader.ReadString();
                    Type type = Type.GetType(str);

                    if (type != null)
                    {
                        m_arSpellDefense.Add(type);
                    }
                }
            }
            else
            {
                m_iRangeHome = 0;
            }

            if (version >= 2)
            {
                m_FightMode = (FightMode)reader.ReadInt();

                m_bControlled = reader.ReadBool();
                m_ControlMaster = reader.ReadMobile();
                m_ControlTarget = reader.ReadMobile();
                m_ControlDest = reader.ReadPoint3D();
                m_ControlOrder = (OrderType)reader.ReadInt();

                m_dMinTameSkill = reader.ReadDouble();

                if (version < 9)
                    reader.ReadDouble();

                m_bTamable = reader.ReadBool();
                m_bSummoned = reader.ReadBool();

                if (m_bSummoned)
                {
                    m_SummonEnd = reader.ReadDeltaTime();
                    new UnsummonTimer(m_ControlMaster, this, m_SummonEnd - DateTime.Now).Start();
                }

                m_iControlSlots = reader.ReadInt();
            }
            else
            {
                m_FightMode = FightMode.Closest;

                m_bControlled = false;
                m_ControlMaster = null;
                m_ControlTarget = null;
                m_ControlOrder = OrderType.None;
            }

            if (version >= 3)
                m_Loyalty = reader.ReadInt();
            else
                m_Loyalty = MaxLoyalty; // Wonderfully Happy

            if (version >= 4)
                m_CurrentWayPoint = reader.ReadItem() as WayPoint;

            if (version >= 5)
                m_SummonMaster = reader.ReadMobile();

            if (version >= 6)
            {
                m_HitsMax = reader.ReadInt();
                m_StamMax = reader.ReadInt();
                m_ManaMax = reader.ReadInt();
                m_DamageMin = reader.ReadInt();
                m_DamageMax = reader.ReadInt();
            }

            if (version >= 7)
            {
                m_PhysicalResistance = reader.ReadInt();
                m_PhysicalDamage = reader.ReadInt();

                m_FireResistance = reader.ReadInt();
                m_FireDamage = reader.ReadInt();

                m_ColdResistance = reader.ReadInt();
                m_ColdDamage = reader.ReadInt();

                m_PoisonResistance = reader.ReadInt();
                m_PoisonDamage = reader.ReadInt();

                m_EnergyResistance = reader.ReadInt();
                m_EnergyDamage = reader.ReadInt();
            }

            if (version >= 8)
                m_Owners = reader.ReadStrongMobileList();
            else
                m_Owners = new List<Mobile>();

            if (version >= 10)
            {
                m_IsDeadPet = reader.ReadBool();
                m_IsBonded = reader.ReadBool();
                m_BondingBegin = reader.ReadDateTime();
                m_OwnerAbandonTime = reader.ReadDateTime();
            }

            if (version >= 11)
                m_HasGeneratedLoot = reader.ReadBool();
            else
                m_HasGeneratedLoot = true;

            if (version >= 12)
                m_Paragon = reader.ReadBool();
            else
                m_Paragon = false;

            if (version >= 13 && reader.ReadBool())
                m_Friends = reader.ReadStrongMobileList();
            else if (version < 13 && m_ControlOrder >= OrderType.Unfriend)
                ++m_ControlOrder;

            if (version < 16 && Loyalty != MaxLoyalty)
                Loyalty *= 10;

            double activeSpeed = m_dActiveSpeed;
            double passiveSpeed = m_dPassiveSpeed;

            SpeedInfo.GetSpeeds(this, ref activeSpeed, ref passiveSpeed);

            bool isStandardActive = false;
            for (int i = 0; !isStandardActive && i < m_StandardActiveSpeeds.Length; ++i)
                isStandardActive = (m_dActiveSpeed == m_StandardActiveSpeeds[i]);

            bool isStandardPassive = false;
            for (int i = 0; !isStandardPassive && i < m_StandardPassiveSpeeds.Length; ++i)
                isStandardPassive = (m_dPassiveSpeed == m_StandardPassiveSpeeds[i]);

            if (isStandardActive && m_dCurrentSpeed == m_dActiveSpeed)
                m_dCurrentSpeed = activeSpeed;
            else if (isStandardPassive && m_dCurrentSpeed == m_dPassiveSpeed)
                m_dCurrentSpeed = passiveSpeed;

            if (isStandardActive && !m_Paragon)
                m_dActiveSpeed = activeSpeed;

            if (isStandardPassive && !m_Paragon)
                m_dPassiveSpeed = passiveSpeed;

            if (version >= 14)
            {
                m_RemoveIfUntamed = reader.ReadBool();
                m_RemoveStep = reader.ReadInt();
            }

			#region Mondain's Legacy version 15
			if ( version >= 17 )
			{
				m_Allured = reader.ReadBool();
			#endregion

				// FSATS
				m_IsMating = reader.ReadBool();
				m_ABPoints = reader.ReadInt();
				m_Exp = reader.ReadInt();
				m_NextLevel = reader.ReadInt();
				m_Level = reader.ReadInt();
				m_MaxLevel = reader.ReadInt();
				m_AllowMating = reader.ReadBool();
				m_Evolves = reader.ReadBool();
				m_Gen = reader.ReadInt();
				m_MatingDelay = reader.ReadDateTime();
				m_Form1 = reader.ReadInt();
				m_Form2 = reader.ReadInt();
				m_Form3 = reader.ReadInt();
				m_Form4 = reader.ReadInt();
				m_Form5 = reader.ReadInt();
				m_Form6 = reader.ReadInt();
				m_Form7 = reader.ReadInt();
				m_Form8 = reader.ReadInt();
				m_Form9 = reader.ReadInt();
				m_Sound1 = reader.ReadInt();
				m_Sound2 = reader.ReadInt();
				m_Sound3 = reader.ReadInt();
				m_Sound4 = reader.ReadInt();
				m_Sound5 = reader.ReadInt();
				m_Sound6 = reader.ReadInt();
				m_Sound7 = reader.ReadInt();
				m_Sound8 = reader.ReadInt();
				m_Sound9 = reader.ReadInt();
				m_UsesForm1 = reader.ReadBool();
				m_UsesForm2 = reader.ReadBool();
				m_UsesForm3 = reader.ReadBool();
				m_UsesForm4 = reader.ReadBool();
				m_UsesForm5 = reader.ReadBool();
				m_UsesForm6 = reader.ReadBool();
				m_UsesForm7 = reader.ReadBool();
				m_UsesForm8 = reader.ReadBool();
				m_UsesForm9 = reader.ReadBool();
				m_F0 = reader.ReadBool();
				m_F1 = reader.ReadBool();
				m_F2 = reader.ReadBool();
				m_F3 = reader.ReadBool();
				m_F4 = reader.ReadBool();
				m_F5 = reader.ReadBool();
				m_F6 = reader.ReadBool();
				m_F7 = reader.ReadBool();
				m_F8 = reader.ReadBool();
				m_F9 = reader.ReadBool();
				m_RoarAttack = reader.ReadInt();
				m_PetPoisonAttack = reader.ReadInt();
				m_FireBreathAttack = reader.ReadInt();
			}

            if (version <= 14 && m_Paragon && Hue == 0x31)
            {
                Hue = Paragon.Hue; //Paragon hue fixed, should now be 0x501.
            }

            CheckStatTimers();

            ChangeAIType(m_CurrentAI);

            AddFollowers();

            if (IsAnimatedDead)
                Spells.Necromancy.AnimateDeadSpell.Register(m_SummonMaster, this);
        }

        public virtual bool IsHumanInTown()
        {
            return (Body.IsHuman && Region.IsPartOf(typeof(Regions.GuardedRegion)));
        }

        public virtual bool CheckGold(Mobile from, Item dropped)
        {
            if (dropped is Gold)
                return OnGoldGiven(from, (Gold)dropped);

            return false;
        }

        public virtual bool OnGoldGiven(Mobile from, Gold dropped)
        {
            if (CheckTeachingMatch(from))
            {
                if (Teach(m_Teaching, from, dropped.Amount, true))
                {
                    dropped.Delete();
                    return true;
                }
            }
            else if (IsHumanInTown())
            {
                Direction = GetDirectionTo(from);

                int oldSpeechHue = this.SpeechHue;

                this.SpeechHue = 0x23F;
                SayTo(from, "Thou art giving me gold?");

                if (dropped.Amount >= 400)
                    SayTo(from, "'Tis a noble gift.");
                else
                    SayTo(from, "Money is always welcome.");

                this.SpeechHue = 0x3B2;
                SayTo(from, 501548); // I thank thee.

                this.SpeechHue = oldSpeechHue;

                dropped.Delete();
                return true;
            }

            return false;
        }

        public override bool ShouldCheckStatTimers { get { return false; } }

        #region Food
        private static Type[] m_Eggs = new Type[]
			{
				typeof( FriedEggs ), typeof( Eggs )
			};

        private static Type[] m_Fish = new Type[]
			{
				typeof( FishSteak ), typeof( RawFishSteak )
			};

        private static Type[] m_GrainsAndHay = new Type[]
			{
				typeof( BreadLoaf ), typeof( FrenchBread ), typeof( SheafOfHay )
			};

        private static Type[] m_Meat = new Type[]
			{
				/* Cooked */
				typeof( Bacon ), typeof( CookedBird ), typeof( Sausage ),
				typeof( Ham ), typeof( Ribs ), typeof( LambLeg ),
				typeof( ChickenLeg ),

				/* Uncooked */
				typeof( RawBird ), typeof( RawRibs ), typeof( RawLambLeg ),
				typeof( RawChickenLeg ),

				/* Body Parts */
				typeof( Head ), typeof( LeftArm ), typeof( LeftLeg ),
				typeof( Torso ), typeof( RightArm ), typeof( RightLeg )
			};

        private static Type[] m_FruitsAndVegies = new Type[]
			{
				typeof( HoneydewMelon ), typeof( YellowGourd ), typeof( GreenGourd ),
				typeof( Banana ), typeof( Bananas ), typeof( Lemon ), typeof( Lime ),
				typeof( Dates ), typeof( Grapes ), typeof( Peach ), typeof( Pear ),
				typeof( Apple ), typeof( Watermelon ), typeof( Squash ),
				typeof( Cantaloupe ), typeof( Carrot ), typeof( Cabbage ),
				typeof( Onion ), typeof( Lettuce ), typeof( Pumpkin )
			};

        private static Type[] m_Gold = new Type[]
			{
				// white wyrms eat gold..
				typeof( Gold )
			};

        public virtual bool CheckFoodPreference(Item f)
        {
            if (CheckFoodPreference(f, FoodType.Eggs, m_Eggs))
                return true;

            if (CheckFoodPreference(f, FoodType.Fish, m_Fish))
                return true;

            if (CheckFoodPreference(f, FoodType.GrainsAndHay, m_GrainsAndHay))
                return true;

            if (CheckFoodPreference(f, FoodType.Meat, m_Meat))
                return true;

            if (CheckFoodPreference(f, FoodType.FruitsAndVegies, m_FruitsAndVegies))
                return true;

            if (CheckFoodPreference(f, FoodType.Gold, m_Gold))
                return true;

            return false;
        }

        public virtual bool CheckFoodPreference(Item fed, FoodType type, Type[] types)
        {
            if ((FavoriteFood & type) == 0)
                return false;

            Type fedType = fed.GetType();
            bool contains = false;

            for (int i = 0; !contains && i < types.Length; ++i)
                contains = (fedType == types[i]);

            return contains;
        }

        public virtual bool CheckFeed(Mobile from, Item dropped)
        {
            if (!IsDeadPet && Controlled && (ControlMaster == from || IsPetFriend(from)) && (dropped is Food || dropped is Gold || dropped is CookableFood || dropped is Head || dropped is LeftArm || dropped is LeftLeg || dropped is Torso || dropped is RightArm || dropped is RightLeg))
            {
                Item f = dropped;

                if (CheckFoodPreference(f))
                {
                    int amount = f.Amount;

                    if (amount > 0)
                    {
                        bool happier = false;

                        int stamGain;

                        if (f is Gold)
                            stamGain = amount - 50;
                        else
                            stamGain = (amount * 15) - 50;

                        if (stamGain > 0)
                            Stam += stamGain;

                        if (Core.SE)
                        {
                            if (m_Loyalty < MaxLoyalty)
                            {
                                m_Loyalty = MaxLoyalty;
                                happier = true;
                            }
                        }
                        else
                        {
                            for (int i = 0; i < amount; ++i)
                            {
                                if (m_Loyalty < MaxLoyalty && 0.5 >= Utility.RandomDouble())
                                {
                                    m_Loyalty += 10;
                                    happier = true;
                                }
                            }
                        }

                        if (happier)
                            SayTo(from, 502060); // Your pet looks happier.

                        if (Body.IsAnimal)
                            Animate(3, 5, 1, true, false, 0);
                        else if (Body.IsMonster)
                            Animate(17, 5, 1, true, false, 0);

                        if (IsBondable && !IsBonded)
                        {
                            Mobile master = m_ControlMaster;

                            if (master != null && master == from)	//So friends can't start the bonding process
                            {
                                if (m_dMinTameSkill <= 29.1 || master.Skills[SkillName.AnimalTaming].Base >= m_dMinTameSkill || OverrideBondingReqs())
                                {
                                    if (BondingBegin == DateTime.MinValue)
                                    {
                                        BondingBegin = DateTime.Now;
                                    }
                                    else if ((BondingBegin + BondingDelay) <= DateTime.Now)
                                    {
                                        IsBonded = true;
                                        BondingBegin = DateTime.MinValue;
                                        from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                                    }
                                }
                                else if (Core.ML)
                                {
                                    from.SendLocalizedMessage(1075268); // Your pet cannot form a bond with you until your animal taming ability has risen.
                                }
                            }
                        }

                        dropped.Delete();
                        return true;
                    }
                }
            }

            return false;
        }

        #endregion

        public virtual bool OverrideBondingReqs()
        {
            return false;
        }

        public virtual bool CanAngerOnTame { get { return false; } }

        #region OnAction[...]
        public virtual void OnActionWander()
        {
        }

        public virtual void OnActionCombat()
        {
        }

        public virtual void OnActionGuard()
        {
        }

        public virtual void OnActionFlee()
        {
        }

        public virtual void OnActionInteract()
        {
        }

        public virtual void OnActionBackoff()
        {
        }
        #endregion

        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (CheckFeed(from, dropped))
                return true;
            else if (CheckGold(from, dropped))
                return true;

            return base.OnDragDrop(from, dropped);
        }

        protected virtual BaseAI ForcedAI { get { return null; } }

        public void ChangeAIType(AIType NewAI)
        {
            if (m_AI != null)
                m_AI.m_Timer.Stop();

            if (ForcedAI != null)
            {
                m_AI = ForcedAI;
                return;
            }

            m_AI = null;

            switch (NewAI)
            {
                case AIType.AI_Melee:
                    m_AI = new MeleeAI(this);
                    break;
                case AIType.AI_Animal:
                    m_AI = new AnimalAI(this);
                    break;
                case AIType.AI_Berserk:
                    m_AI = new BerserkAI(this);
                    break;
                case AIType.AI_Archer:
                    m_AI = new ArcherAI(this);
                    break;
                case AIType.AI_Healer:
                    m_AI = new HealerAI(this);
                    break;
                case AIType.AI_Vendor:
                    m_AI = new VendorAI(this);
                    break;
                case AIType.AI_Mage:
                    m_AI = new MageAI(this);
                    break;
                case AIType.AI_Predator:
                    //m_AI = new PredatorAI(this);
                    m_AI = new MeleeAI(this);
                    break;
                case AIType.AI_Thief:
                    m_AI = new ThiefAI(this);
                    break;
                #region Mondain's Legacy
                case AIType.AI_NecroMage:
                    m_AI = new NecroMageAI(this);
                    break;
                #endregion
                // >>>>>>>>>> ERICA'S ORC SCOUT
                case AIType.AI_OrcScout:
                    m_AI = new OrcScoutAI(this);
                    break;
                // PAPPA SMURF's Spellbinder
                case AIType.AI_Spellbinder:
                    m_AI = new SpellbinderAI(this);
                    break;
            }
        }

        public void ChangeAIToDefault()
        {
            ChangeAIType(m_DefaultAI);
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public AIType AI
        {
            get
            {
                return m_CurrentAI;
            }
            set
            {
                m_CurrentAI = value;

                if (m_CurrentAI == AIType.AI_Use_Default)
                {
                    m_CurrentAI = m_DefaultAI;
                }

                ChangeAIType(m_CurrentAI);
            }
        }

        [CommandProperty(AccessLevel.Administrator)]
        public bool Debug
        {
            get
            {
                return m_bDebugAI;
            }
            set
            {
                m_bDebugAI = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int Team
        {
            get
            {
                return m_iTeam;
            }
            set
            {
                m_iTeam = value;

                OnTeamChange();
            }
        }

        public virtual void OnTeamChange()
        {
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile FocusMob
        {
            get
            {
                return m_FocusMob;
            }
            set
            {
                m_FocusMob = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public FightMode FightMode
        {
            get
            {
                return m_FightMode;
            }
            set
            {
                m_FightMode = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int RangePerception
        {
            get
            {
                return m_iRangePerception;
            }
            set
            {
                m_iRangePerception = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int RangeFight
        {
            get
            {
                return m_iRangeFight;
            }
            set
            {
                m_iRangeFight = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public int RangeHome
        {
            get
            {
                return m_iRangeHome;
            }
            set
            {
                m_iRangeHome = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public double ActiveSpeed
        {
            get
            {
                return m_dActiveSpeed;
            }
            set
            {
                m_dActiveSpeed = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public double PassiveSpeed
        {
            get
            {
                return m_dPassiveSpeed;
            }
            set
            {
                m_dPassiveSpeed = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public double CurrentSpeed
        {
            get
            {
                return m_dCurrentSpeed;
            }
            set
            {
                if (m_dCurrentSpeed != value)
                {
                    m_dCurrentSpeed = value;

                    if (m_AI != null)
                        m_AI.OnCurrentSpeedChanged();
                }
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Point3D Home
        {
            get
            {
                return m_pHome;
            }
            set
            {
                m_pHome = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool Controlled
        {
            get
            {
                return m_bControlled;
            }
            set
            {
                if (m_bControlled == value)
                    return;

                m_bControlled = value;
                Delta(MobileDelta.Noto);

                InvalidateProperties();
            }
        }

        public override void RevealingAction()
        {
            Spells.Sixth.InvisibilitySpell.RemoveTimer(this);

            base.RevealingAction();
        }

        public void RemoveFollowers()
        {
            if (m_ControlMaster != null)
            {
                m_ControlMaster.Followers -= ControlSlots;
                if (m_ControlMaster is PlayerMobile)
                {
                    ((PlayerMobile)m_ControlMaster).AllFollowers.Remove(this);
                    if (((PlayerMobile)m_ControlMaster).AutoStabled.Contains(this))
                        ((PlayerMobile)m_ControlMaster).AutoStabled.Remove(this);
                }
            }
            else if (m_SummonMaster != null)
            {
                m_SummonMaster.Followers -= ControlSlots;
                if (m_SummonMaster is PlayerMobile)
                {
                    ((PlayerMobile)m_SummonMaster).AllFollowers.Remove(this);
                }
            }

            if (m_ControlMaster != null && m_ControlMaster.Followers < 0)
                m_ControlMaster.Followers = 0;

            if (m_SummonMaster != null && m_SummonMaster.Followers < 0)
                m_SummonMaster.Followers = 0;
        }

        public void AddFollowers()
        {
            if (m_ControlMaster != null)
            {
                m_ControlMaster.Followers += ControlSlots;
                if (m_ControlMaster is PlayerMobile)
                {
                    ((PlayerMobile)m_ControlMaster).AllFollowers.Add(this);
                }
            }
            else if (m_SummonMaster != null)
            {
                m_SummonMaster.Followers += ControlSlots;
                if (m_SummonMaster is PlayerMobile)
                {
                    ((PlayerMobile)m_SummonMaster).AllFollowers.Add(this);
                }
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile ControlMaster
        {
            get
            {
                return m_ControlMaster;
            }
            set
            {
                if (m_ControlMaster == value)
                    return;

                RemoveFollowers();
                m_ControlMaster = value;
                AddFollowers();

                Delta(MobileDelta.Noto);
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile SummonMaster
        {
            get
            {
                return m_SummonMaster;
            }
            set
            {
                if (m_SummonMaster == value)
                    return;

                RemoveFollowers();
                m_SummonMaster = value;
                AddFollowers();

                Delta(MobileDelta.Noto);
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile ControlTarget
        {
            get
            {
                return m_ControlTarget;
            }
            set
            {
                m_ControlTarget = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Point3D ControlDest
        {
            get
            {
                return m_ControlDest;
            }
            set
            {
                m_ControlDest = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public OrderType ControlOrder
        {
            get
            {
                return m_ControlOrder;
            }
            set
            {
                m_ControlOrder = value;

                #region Mondain's Legacy
                if (m_Allured)
                {
                    if (m_ControlOrder == OrderType.Release)
                        Say(502003); // Sorry, but no.
                    else if (m_ControlOrder != OrderType.None)
                        Say(1079120); // Very well.
                }
                #endregion

                if (m_AI != null)
                    m_AI.OnCurrentOrderChanged();

                InvalidateProperties();

                if (m_ControlMaster != null)
                    m_ControlMaster.InvalidateProperties();
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool BardProvoked
        {
            get
            {
                return m_bBardProvoked;
            }
            set
            {
                m_bBardProvoked = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool BardPacified
        {
            get
            {
                return m_bBardPacified;
            }
            set
            {
                m_bBardPacified = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile BardMaster
        {
            get
            {
                return m_bBardMaster;
            }
            set
            {
                m_bBardMaster = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public Mobile BardTarget
        {
            get
            {
                return m_bBardTarget;
            }
            set
            {
                m_bBardTarget = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public DateTime BardEndTime
        {
            get
            {
                return m_timeBardEnd;
            }
            set
            {
                m_timeBardEnd = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public double MinTameSkill
        {
            get
            {
                return m_dMinTameSkill;
            }
            set
            {
                m_dMinTameSkill = value;
            }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public bool Tamable
        {
            get
            {
                return m_bTamable && !m_Paragon;
            }
            set
            {
                m_bTamable = value;
            }
        }

        [CommandProperty(AccessLevel.Administrator)]
        public bool Summoned
        {
            get
            {
                return m_bSummoned;
            }
            set
            {
                if (m_bSummoned == value)
                    return;

                m_NextReacquireTime = DateTime.Now;

                m_bSummoned = value;
                Delta(MobileDelta.Noto);

                InvalidateProperties();
            }
        }

        [CommandProperty(AccessLevel.Administrator)]
        public int ControlSlots
        {
            get
            {
                return m_iControlSlots;
            }
            set
            {
                m_iControlSlots = value;
            }
        }

        public virtual bool NoHouseRestrictions { get { return false; } }
        public virtual bool IsHouseSummonable { get { return false; } }

        #region Corpse Resources
        public virtual int Feathers { get { return 0; } }
        public virtual int Wool { get { return 0; } }

        public virtual MeatType MeatType { get { return MeatType.Ribs; } }
        public virtual int Meat { get { return 0; } }

        public virtual int Hides { get { return 0; } }
        public virtual HideType HideType { get { return HideType.Regular; } }

        public virtual int Scales { get { return 0; } }
        public virtual ScaleType ScaleType { get { return ScaleType.Red; } }
        #endregion

        public virtual bool AutoDispel { get { return false; } }
        public virtual double AutoDispelChance { get { return ((Core.SE) ? .10 : 1.0); } }

        public virtual bool IsScaryToPets { get { return false; } }
        public virtual bool IsScaredOfScaryThings { get { return true; } }

        public virtual bool CanRummageCorpses { get { return false; } }

        public virtual void OnGotMeleeAttack(Mobile attacker)
        {
            if (AutoDispel && attacker is BaseCreature && ((BaseCreature)attacker).IsDispellable && AutoDispelChance > Utility.RandomDouble())
                Dispel(attacker);
        }

        public virtual void Dispel(Mobile m)
        {
            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
            Effects.PlaySound(m, m.Map, 0x201);

            m.Delete();
        }

        public virtual bool DeleteOnRelease { get { return m_bSummoned; } }

        public virtual void OnGaveMeleeAttack(Mobile defender)
        {
            Poison p = HitPoison;

            if (m_Paragon)
                p = PoisonImpl.IncreaseLevel(p);

            if (p != null && HitPoisonChance >= Utility.RandomDouble())
                defender.ApplyPoison(this, p);

            if (AutoDispel && defender is BaseCreature && ((BaseCreature)defender).IsDispellable && AutoDispelChance > Utility.RandomDouble())
                Dispel(defender);
        }

        public override void OnAfterDelete()
        {
            if (m_AI != null)
            {
                if (m_AI.m_Timer != null)
                    m_AI.m_Timer.Stop();

                m_AI = null;
            }

            FocusMob = null;

            if (IsAnimatedDead)
                Spells.Necromancy.AnimateDeadSpell.Unregister(m_SummonMaster, this);

            base.OnAfterDelete();
        }

        public void DebugSay(string text)
        {
            if (m_bDebugAI)
                this.PublicOverheadMessage(MessageType.Regular, 41, false, text);
        }

        public void DebugSay(string format, params object[] args)
        {
            if (m_bDebugAI)
                this.PublicOverheadMessage(MessageType.Regular, 41, false, String.Format(format, args));
        }

        /* 
         * This function can be overriden.. so a "Strongest" mobile, can have a different definition depending
         * on who check for value
         * -Could add a FightMode.Prefered
         * 
         */
        public virtual double GetFightModeRanking(Mobile m, FightMode acqType, bool bPlayerOnly)
        {
            if ((bPlayerOnly && m.Player) || !bPlayerOnly)
            {
                switch (acqType)
                {
                    case FightMode.Strongest:
                        return (m.Skills[SkillName.Tactics].Value + m.Str); //returns strongest mobile

                    case FightMode.Weakest:
                        return -m.Hits; // returns weakest mobile

                    default:
                        return -GetDistanceToSqrt(m); // returns closest mobile
                }
            }
            else
            {
                return double.MinValue;
            }
        }

        // Turn, - for left, + for right
        // Basic for now, needs work
        public virtual void Turn(int iTurnSteps)
        {
            int v = (int)Direction;

            Direction = (Direction)((((v & 0x7) + iTurnSteps) & 0x7) | (v & 0x80));
        }

        public virtual void TurnInternal(int iTurnSteps)
        {
            int v = (int)Direction;

            SetDirection((Direction)((((v & 0x7) + iTurnSteps) & 0x7) | (v & 0x80)));
        }

        public bool IsHurt()
        {
            return (Hits != HitsMax);
        }

        public double GetHomeDistance()
        {
            return GetDistanceToSqrt(m_pHome);
        }

        public virtual int GetTeamSize(int iRange)
        {
            int iCount = 0;

            foreach (Mobile m in this.GetMobilesInRange(iRange))
            {
                if (m is BaseCreature)
                {
                    if (((BaseCreature)m).Team == Team)
                    {
                        if (!m.Deleted)
                        {
                            if (m != this)
                            {
                                if (CanSee(m))
                                {
                                    iCount++;
                                }
                            }
                        }
                    }
                }
            }

            return iCount;
        }

        private class TameEntry : ContextMenuEntry
        {
            private BaseCreature m_Mobile;

            public TameEntry(Mobile from, BaseCreature creature) : base(6130, 6)
            {
                m_Mobile = creature;
                Enabled = Enabled && (from.Female ? creature.AllowFemaleTamer : creature.AllowMaleTamer);
            }

            public override void OnClick()
            {
                if (!Owner.From.CheckAlive())
                    return;

                Owner.From.TargetLocked = true;
                SkillHandlers.AnimalTaming.DisableMessage = true;

                if (Owner.From.UseSkill(SkillName.AnimalTaming))
                    Owner.From.Target.Invoke(Owner.From, m_Mobile);

                SkillHandlers.AnimalTaming.DisableMessage = false;
                Owner.From.TargetLocked = false;
            }
        }

        #region Teaching
        public virtual bool CanTeach { get { return false; } }

        public virtual bool CheckTeach(SkillName skill, Mobile from)
        {
            if (!CanTeach)
                return false;

            if (skill == SkillName.Stealth && from.Skills[SkillName.Hiding].Base < ((Core.SE) ? 50.0 : 80.0))
                return false;

            if (skill == SkillName.RemoveTrap && (from.Skills[SkillName.Lockpicking].Base < 50.0 || from.Skills[SkillName.DetectHidden].Base < 50.0))
                return false;

            if (!Core.AOS && (skill == SkillName.Focus || skill == SkillName.Chivalry || skill == SkillName.Necromancy))
                return false;

            return true;
        }

        public enum TeachResult
        {
            Success,
            Failure,
            KnowsMoreThanMe,
            KnowsWhatIKnow,
            SkillNotRaisable,
            NotEnoughFreePoints
        }

        public virtual TeachResult CheckTeachSkills(SkillName skill, Mobile m, int maxPointsToLearn, ref int pointsToLearn, bool doTeach)
        {
            if (!CheckTeach(skill, m) || !m.CheckAlive())
                return TeachResult.Failure;

            Skill ourSkill = Skills[skill];
            Skill theirSkill = m.Skills[skill];

            if (ourSkill == null || theirSkill == null)
                return TeachResult.Failure;
            int baseToSet = ourSkill.BaseFixedPoint / 3;

            if (baseToSet > 420)
                baseToSet = 420;
            else if (baseToSet < 200)
                return TeachResult.Failure;

            if (baseToSet > theirSkill.CapFixedPoint)
                baseToSet = theirSkill.CapFixedPoint;

            pointsToLearn = baseToSet - theirSkill.BaseFixedPoint;

            if (maxPointsToLearn > 0 && pointsToLearn > maxPointsToLearn)
            {
                pointsToLearn = maxPointsToLearn;
                baseToSet = theirSkill.BaseFixedPoint + pointsToLearn;
            }

            if (pointsToLearn < 0)
                return TeachResult.KnowsMoreThanMe;

            if (pointsToLearn == 0)
                return TeachResult.KnowsWhatIKnow;

            if (theirSkill.Lock != SkillLock.Up)
                return TeachResult.SkillNotRaisable;

            int freePoints = m.Skills.Cap - m.Skills.Total;
            int freeablePoints = 0;

            if (freePoints < 0)
                freePoints = 0;

            for (int i = 0; (freePoints + freeablePoints) < pointsToLearn && i < m.Skills.Length; ++i)
            {
                Skill sk = m.Skills[i];

                if (sk == theirSkill || sk.Lock != SkillLock.Down)
                    continue;

                freeablePoints += sk.BaseFixedPoint;
            }

            if ((freePoints + freeablePoints) == 0)
                return TeachResult.NotEnoughFreePoints;

            if ((freePoints + freeablePoints) < pointsToLearn)
            {
                pointsToLearn = freePoints + freeablePoints;
                baseToSet = theirSkill.BaseFixedPoint + pointsToLearn;
            }

            if (doTeach)
            {
                int need = pointsToLearn - freePoints;

                for (int i = 0; need > 0 && i < m.Skills.Length; ++i)
                {
                    Skill sk = m.Skills[i];

                    if (sk == theirSkill || sk.Lock != SkillLock.Down)
                        continue;

                    if (sk.BaseFixedPoint < need)
                    {
                        need -= sk.BaseFixedPoint;
                        sk.BaseFixedPoint = 0;
                    }
                    else
                    {
                        sk.BaseFixedPoint -= need;
                        need = 0;
                    }
                }

                /* Sanity check */
                if (baseToSet > theirSkill.CapFixedPoint || (m.Skills.Total - theirSkill.BaseFixedPoint + baseToSet) > m.Skills.Cap)
                    return TeachResult.NotEnoughFreePoints;

                theirSkill.BaseFixedPoint = baseToSet;
            }

            return TeachResult.Success;
        }

        public virtual bool CheckTeachingMatch(Mobile m)
        {
            if (m_Teaching == (SkillName)(-1))
                return false;

            if (m is PlayerMobile)
                return (((PlayerMobile)m).Learning == m_Teaching);

            return true;
        }

        private SkillName m_Teaching = (SkillName)(-1);

        public virtual bool Teach(SkillName skill, Mobile m, int maxPointsToLearn, bool doTeach)
        {
            int pointsToLearn = 0;
            TeachResult res = CheckTeachSkills(skill, m, maxPointsToLearn, ref pointsToLearn, doTeach);

            switch (res)
            {
                case TeachResult.KnowsMoreThanMe:
                    {
                        Say(501508); // I cannot teach thee, for thou knowest more than I!
                        break;
                    }
                case TeachResult.KnowsWhatIKnow:
                    {
                        Say(501509); // I cannot teach thee, for thou knowest all I can teach!
                        break;
                    }
                case TeachResult.NotEnoughFreePoints:
                case TeachResult.SkillNotRaisable:
                    {
                        // Make sure this skill is marked to raise. If you are near the skill cap (700 points) you may need to lose some points in another skill first.
                        m.SendLocalizedMessage(501510, "", 0x22);
                        break;
                    }
                case TeachResult.Success:
                    {
                        if (doTeach)
                        {
                            Say(501539); // Let me show thee something of how this is done.
                            m.SendLocalizedMessage(501540); // Your skill level increases.

                            m_Teaching = (SkillName)(-1);

                            if (m is PlayerMobile)
                                ((PlayerMobile)m).Learning = (SkillName)(-1);
                        }
                        else
                        {
                            // I will teach thee all I know, if paid the amount in full.  The price is:
                            Say(1019077, AffixType.Append, String.Format(" {0}", pointsToLearn), "");
                            Say(1043108); // For less I shall teach thee less.

                            m_Teaching = skill;

                            if (m is PlayerMobile)
                                ((PlayerMobile)m).Learning = skill;
                        }

                        return true;
                    }
            }

            return false;
        }
        #endregion

        public override void AggressiveAction(Mobile aggressor, bool criminal)
        {
            base.AggressiveAction(aggressor, criminal);

            OrderType ct = m_ControlOrder;

            if (m_AI != null)
            {
                if (!Core.ML || (ct != OrderType.Follow && ct != OrderType.Stop))
                {
                    m_AI.OnAggressiveAction(aggressor);
                }
                else
                {
                    DebugSay("I'm being attacked but my master told me not to fight.");
                    Warmode = false;
                    return;
                }
            }

            StopFlee();

            ForceReacquire();

            if (!IsEnemy(aggressor))
            {
                Ethics.Player pl = Ethics.Player.Find(aggressor, true);

                if (pl != null && pl.IsShielded)
                    pl.FinishShield();
            }




            if (aggressor.ChangingCombatant && (m_bControlled || m_bSummoned) && (ct == OrderType.Come || (!Core.ML && ct == OrderType.Stay) || ct == OrderType.Stop || ct == OrderType.None || ct == OrderType.Follow))
            {
                ControlTarget = aggressor;
                ControlOrder = OrderType.Attack;
            }
            else if (Combatant == null && !m_bBardPacified)
            {
                Warmode = true;
                Combatant = aggressor;
            }
        }

        public override bool OnMoveOver(Mobile m)
        {
            if (m is BaseCreature && !((BaseCreature)m).Controlled)
                return (!Alive || !m.Alive || IsDeadBondedPet || m.IsDeadBondedPet) || (Hidden && m.AccessLevel > AccessLevel.Player);

            return base.OnMoveOver(m);
        }

        public virtual void AddCustomContextEntries(Mobile from, List<ContextMenuEntry> list)
        {
			#region FS:ATS Edits
			if ( this is BaseBioCreature || this is BioCreature || this is BioMount )
			{
			}
			else if ( from.Alive && this.Alive && this.Controlled == true && this.Summoned == false && FSATS.EnablePetLeveling == true )
			{
				bool nolevel = false;
				Type typ = this.GetType();
				string nam = typ.Name;

				foreach ( string check in FSATS.NoLevelCreatures )
				{
  					if ( check == nam )
    						nolevel = true;
				}

				if ( nolevel != true )
					list.Add( new ContextMenus.PetMenu( from, this ) );
			}
			#endregion
        }

        public virtual bool CanDrop { get { return IsBonded; } }

        public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (m_AI != null && Commandable)
                m_AI.GetContextMenuEntries(from, list);

            if (m_bTamable && !m_bControlled && from.Alive)
                list.Add(new TameEntry(from, this));

            AddCustomContextEntries(from, list);

            if (CanTeach && from.Alive)
            {
                Skills ourSkills = this.Skills;
                Skills theirSkills = from.Skills;

                for (int i = 0; i < ourSkills.Length && i < theirSkills.Length; ++i)
                {
                    Skill skill = ourSkills[i];
                    Skill theirSkill = theirSkills[i];

                    if (skill != null && theirSkill != null && skill.Base >= 60.0 && CheckTeach(skill.SkillName, from))
                    {
                        double toTeach = skill.Base / 3.0;

                        if (toTeach > 42.0)
                            toTeach = 42.0;

                        list.Add(new TeachEntry((SkillName)i, this, from, (toTeach > theirSkill.Base)));
                    }
                }
            }
        }

        public override bool HandlesOnSpeech(Mobile from)
        {
            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null && (speechType.Flags & IHSFlags.OnSpeech) != 0 && from.InRange(this, 3))
                return true;

            return (m_AI != null && m_AI.HandlesOnSpeech(from) && from.InRange(this, m_iRangePerception));
        }

        public override void OnSpeech(SpeechEventArgs e)
        {
            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null && speechType.OnSpeech(this, e.Mobile, e.Speech))
                e.Handled = true;
            else if (!e.Handled && m_AI != null && e.Mobile.InRange(this, m_iRangePerception))
                m_AI.OnSpeech(e);
        }

        public override bool IsHarmfulCriminal(Mobile target)
        {
            if ((Controlled && target == m_ControlMaster) || (Summoned && target == m_SummonMaster))
                return false;

            if (target is BaseCreature && ((BaseCreature)target).InitialInnocent && !((BaseCreature)target).Controlled)
                return false;

            if (target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Count > 0)
                return false;

            return base.IsHarmfulCriminal(target);
        }

        public override void CriminalAction(bool message)
        {
            base.CriminalAction(message);

            if (Controlled || Summoned)
            {
                if (m_ControlMaster != null && m_ControlMaster.Player)
                    m_ControlMaster.CriminalAction(false);
                else if (m_SummonMaster != null && m_SummonMaster.Player)
                    m_SummonMaster.CriminalAction(false);
            }
        }

        public override void DoHarmful(Mobile target, bool indirect)
        {
            base.DoHarmful(target, indirect);

            if (target == this || target == m_ControlMaster || target == m_SummonMaster || (!Controlled && !Summoned))
                return;

            List<AggressorInfo> list = this.Aggressors;

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

                if (ai.Attacker == target)
                    return;
            }

            list = this.Aggressed;

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

                if (ai.Defender == target)
                {
                    if (m_ControlMaster != null && m_ControlMaster.Player && m_ControlMaster.CanBeHarmful(target, false))
                        m_ControlMaster.DoHarmful(target, true);
                    else if (m_SummonMaster != null && m_SummonMaster.Player && m_SummonMaster.CanBeHarmful(target, false))
                        m_SummonMaster.DoHarmful(target, true);

                    return;
                }
            }
        }

        private static Mobile m_NoDupeGuards;

        public void ReleaseGuardDupeLock()
        {
            m_NoDupeGuards = null;
        }

        public void ReleaseGuardLock()
        {
            EndAction(typeof(GuardedRegion));
        }

        private DateTime m_IdleReleaseTime;

        public virtual bool CheckIdle()
        {
            if (Combatant != null)
                return false; // in combat.. not idling

            if (m_IdleReleaseTime > DateTime.MinValue)
            {
                // idling...

                if (DateTime.Now >= m_IdleReleaseTime)
                {
                    m_IdleReleaseTime = DateTime.MinValue;
                    return false; // idle is over
                }

                return true; // still idling
            }

            if (95 > Utility.Random(100))
                return false; // not idling, but don't want to enter idle state

            m_IdleReleaseTime = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(15, 25));

            if (Body.IsHuman)
            {
                switch (Utility.Random(2))
                {
                    case 0: Animate(5, 5, 1, true, true, 1); break;
                    case 1: Animate(6, 5, 1, true, false, 1); break;
                }
            }
            else if (Body.IsAnimal)
            {
                switch (Utility.Random(3))
                {
                    case 0: Animate(3, 3, 1, true, false, 1); break;
                    case 1: Animate(9, 5, 1, true, false, 1); break;
                    case 2: Animate(10, 5, 1, true, false, 1); break;
                }
            }
            else if (Body.IsMonster)
            {
                switch (Utility.Random(2))
                {
                    case 0: Animate(17, 5, 1, true, false, 1); break;
                    case 1: Animate(18, 5, 1, true, false, 1); break;
                }
            }

            PlaySound(GetIdleSound());
            return true; // entered idle state
        }

        protected override void OnLocationChange(Point3D oldLocation)
        {
            Map map = this.Map;

            if (PlayerRangeSensitive && m_AI != null && map != null && map.GetSector(this.Location).Active)
                m_AI.Activate();

            base.OnLocationChange(oldLocation);
        }

        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            base.OnMovement(m, oldLocation);

            if (ReacquireOnMovement || m_Paragon)
                ForceReacquire();

            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null)
                speechType.OnMovement(this, m, oldLocation);

            /* Begin notice sound */
            if ((!m.Hidden || m.AccessLevel == AccessLevel.Player) && m.Player && m_FightMode != FightMode.Aggressor && m_FightMode != FightMode.None && Combatant == null && !Controlled && !Summoned)
            {
                // If this creature defends itself but doesn't actively attack (animal) or
                // doesn't fight at all (vendor) then no notice sounds are played..
                // So, players are only notified of aggressive monsters

                // Monsters that are currently fighting are ignored

                // Controlled or summoned creatures are ignored

                if (InRange(m.Location, 18) && !InRange(oldLocation, 18))
                {
                    if (Body.IsMonster)
                        Animate(11, 5, 1, true, false, 1);

                    PlaySound(GetAngerSound());
                }
            }
            /* End notice sound */

            if (m_NoDupeGuards == m)
                return;

            if (!Body.IsHuman || Kills >= 5 || AlwaysMurderer || AlwaysAttackable || m.Kills < 5 || !m.InRange(Location, 12) || !m.Alive)
                return;

            GuardedRegion guardedRegion = (GuardedRegion)this.Region.GetRegion(typeof(GuardedRegion));

            if (guardedRegion != null)
            {
                if (!guardedRegion.IsDisabled() && guardedRegion.IsGuardCandidate(m) && BeginAction(typeof(GuardedRegion)))
                {
                    Say(1013037 + Utility.Random(16));
                    guardedRegion.CallGuards(this.Location);

                    Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(ReleaseGuardLock));

                    m_NoDupeGuards = m;
                    Timer.DelayCall(TimeSpan.Zero, new TimerCallback(ReleaseGuardDupeLock));
                }
            }
        }


        public void AddSpellAttack(Type type)
        {
            m_arSpellAttack.Add(type);
        }

        public void AddSpellDefense(Type type)
        {
            m_arSpellDefense.Add(type);
        }

        public Spell GetAttackSpellRandom()
        {
            if (m_arSpellAttack.Count > 0)
            {
                Type type = m_arSpellAttack[Utility.Random(m_arSpellAttack.Count)];

                object[] args = { this, null };
                return Activator.CreateInstance(type, args) as Spell;
            }
            else
            {
                return null;
            }
        }

        public Spell GetDefenseSpellRandom()
        {
            if (m_arSpellDefense.Count > 0)
            {
                Type type = m_arSpellDefense[Utility.Random(m_arSpellDefense.Count)];

                object[] args = { this, null };
                return Activator.CreateInstance(type, args) as Spell;
            }
            else
            {
                return null;
            }
        }

        public Spell GetSpellSpecific(Type type)
        {
            int i;

            for (i = 0; i < m_arSpellAttack.Count; i++)
            {
                if (m_arSpellAttack[i] == type)
                {
                    object[] args = { this, null };
                    return Activator.CreateInstance(type, args) as Spell;
                }
            }

            for (i = 0; i < m_arSpellDefense.Count; i++)
            {
                if (m_arSpellDefense[i] == type)
                {
                    object[] args = { this, null };
                    return Activator.CreateInstance(type, args) as Spell;
                }
            }

            return null;
        }

        #region Set[...]

        public void SetDamage(int val)
        {
            m_DamageMin = val;
            m_DamageMax = val;
        }

        public void SetDamage(int min, int max)
        {
            m_DamageMin = min;
            m_DamageMax = max;
        }

        public void SetHits(int val)
        {
            if (val < 1000 && !Core.AOS)
                val = (val * 100) / 60;

            m_HitsMax = val;
            Hits = HitsMax;
        }

        public void SetHits(int min, int max)
        {
            if (min < 1000 && !Core.AOS)
            {
                min = (min * 100) / 60;
                max = (max * 100) / 60;
            }

            m_HitsMax = Utility.RandomMinMax(min, max);
            Hits = HitsMax;
        }

        public void SetStam(int val)
        {
            m_StamMax = val;
            Stam = StamMax;
        }

        public void SetStam(int min, int max)
        {
            m_StamMax = Utility.RandomMinMax(min, max);
            Stam = StamMax;
        }

        public void SetMana(int val)
        {
            m_ManaMax = val;
            Mana = ManaMax;
        }

        public void SetMana(int min, int max)
        {
            m_ManaMax = Utility.RandomMinMax(min, max);
            Mana = ManaMax;
        }

        public void SetStr(int val)
        {
            RawStr = val;
            Hits = HitsMax;
        }

        public void SetStr(int min, int max)
        {
            RawStr = Utility.RandomMinMax(min, max);
            Hits = HitsMax;
        }

        public void SetDex(int val)
        {
            RawDex = val;
            Stam = StamMax;
        }

        public void SetDex(int min, int max)
        {
            RawDex = Utility.RandomMinMax(min, max);
            Stam = StamMax;
        }

        public void SetInt(int val)
        {
            RawInt = val;
            Mana = ManaMax;
        }

        public void SetInt(int min, int max)
        {
            RawInt = Utility.RandomMinMax(min, max);
            Mana = ManaMax;
        }

        public void SetDamageType(ResistanceType type, int min, int max)
        {
            SetDamageType(type, Utility.RandomMinMax(min, max));
        }

        public void SetDamageType(ResistanceType type, int val)
        {
            switch (type)
            {
                case ResistanceType.Physical: m_PhysicalDamage = val; break;
                case ResistanceType.Fire: m_FireDamage = val; break;
                case ResistanceType.Cold: m_ColdDamage = val; break;
                case ResistanceType.Poison: m_PoisonDamage = val; break;
                case ResistanceType.Energy: m_EnergyDamage = val; break;
            }
        }

        public void SetResistance(ResistanceType type, int min, int max)
        {
            SetResistance(type, Utility.RandomMinMax(min, max));
        }

        public void SetResistance(ResistanceType type, int val)
        {
            switch (type)
            {
                case ResistanceType.Physical: m_PhysicalResistance = val; break;
                case ResistanceType.Fire: m_FireResistance = val; break;
                case ResistanceType.Cold: m_ColdResistance = val; break;
                case ResistanceType.Poison: m_PoisonResistance = val; break;
                case ResistanceType.Energy: m_EnergyResistance = val; break;
            }

            UpdateResistances();
        }

        public void SetSkill(SkillName name, double val)
        {
            Skills[name].BaseFixedPoint = (int)(val * 10);

            if (Skills[name].Base > Skills[name].Cap)
            {
                if (Core.SE)
                    this.SkillsCap += (Skills[name].BaseFixedPoint - Skills[name].CapFixedPoint);

                Skills[name].Cap = Skills[name].Base;
            }
        }

        public void SetSkill(SkillName name, double min, double max)
        {
            int minFixed = (int)(min * 10);
            int maxFixed = (int)(max * 10);

            Skills[name].BaseFixedPoint = Utility.RandomMinMax(minFixed, maxFixed);

            if (Skills[name].Base > Skills[name].Cap)
            {
                if (Core.SE)
                    this.SkillsCap += (Skills[name].BaseFixedPoint - Skills[name].CapFixedPoint);

                Skills[name].Cap = Skills[name].Base;
            }
        }

        public void SetFameLevel(int level)
        {
            switch (level)
            {
                case 1: Fame = Utility.RandomMinMax(0, 1249); break;
                case 2: Fame = Utility.RandomMinMax(1250, 2499); break;
                case 3: Fame = Utility.RandomMinMax(2500, 4999); break;
                case 4: Fame = Utility.RandomMinMax(5000, 9999); break;
                case 5: Fame = Utility.RandomMinMax(10000, 10000); break;
            }
        }

        public void SetKarmaLevel(int level)
        {
            switch (level)
            {
                case 0: Karma = -Utility.RandomMinMax(0, 624); break;
                case 1: Karma = -Utility.RandomMinMax(625, 1249); break;
                case 2: Karma = -Utility.RandomMinMax(1250, 2499); break;
                case 3: Karma = -Utility.RandomMinMax(2500, 4999); break;
                case 4: Karma = -Utility.RandomMinMax(5000, 9999); break;
                case 5: Karma = -Utility.RandomMinMax(10000, 10000); break;
            }
        }

        #endregion

        public static void Cap(ref int val, int min, int max)
        {
            if (val < min)
                val = min;
            else if (val > max)
                val = max;
        }

        #region Pack & Loot
        public void PackPotion()
        {
            PackItem(Loot.RandomPotion());
        }

        public void PackNecroScroll(int index)
        {
            if (!Core.AOS || 0.05 <= Utility.RandomDouble())
                return;

            PackItem(Loot.Construct(Loot.NecromancyScrollTypes, index));
        }

        public void PackScroll(int minCircle, int maxCircle)
        {
            PackScroll(Utility.RandomMinMax(minCircle, maxCircle));
        }

        public void PackScroll(int circle)
        {
            int min = (circle - 1) * 8;

            PackItem(Loot.RandomScroll(min, min + 7, SpellbookType.Regular));
        }

        public void PackMagicItems(int minLevel, int maxLevel)
        {
            PackMagicItems(minLevel, maxLevel, 0.30, 0.15);
        }

        public void PackMagicItems(int minLevel, int maxLevel, double armorChance, double weaponChance)
        {
            if (!PackArmor(minLevel, maxLevel, armorChance))
                PackWeapon(minLevel, maxLevel, weaponChance);
        }

        protected bool m_Spawning;
        protected int m_KillersLuck;

        public virtual void GenerateLoot(bool spawning)
        {
            m_Spawning = spawning;

            if (!spawning)
                m_KillersLuck = LootPack.GetLuckChanceForKiller(this);

            GenerateLoot();

            if (m_Paragon)
            {
                if (Fame < 1250)
                    AddLoot(LootPack.Meager);
                else if (Fame < 2500)
                    AddLoot(LootPack.Average);
                else if (Fame < 5000)
                    AddLoot(LootPack.Rich);
                else if (Fame < 10000)
                    AddLoot(LootPack.FilthyRich);
                else
                    AddLoot(LootPack.UltraRich);
            }

            m_Spawning = false;
            m_KillersLuck = 0;
        }

        public virtual void GenerateLoot()
        {
        }

        public virtual void AddLoot(LootPack pack, int amount)
        {
            for (int i = 0; i < amount; ++i)
                AddLoot(pack);
        }

        public virtual void AddLoot(LootPack pack)
        {
            if (Summoned)
                return;

            Container backpack = Backpack;

            if (backpack == null)
            {
                backpack = new Backpack();

                backpack.Movable = false;

                AddItem(backpack);
            }

            pack.Generate(this, backpack, m_Spawning, m_KillersLuck);
        }

        public bool PackArmor(int minLevel, int maxLevel)
        {
            return PackArmor(minLevel, maxLevel, 1.0);
        }

        public bool PackArmor(int minLevel, int maxLevel, double chance)
        {
            if (chance <= Utility.RandomDouble())
                return false;

            Cap(ref minLevel, 0, 5);
            Cap(ref maxLevel, 0, 5);

            if (Core.AOS)
            {
                Item item = Loot.RandomArmorOrShieldOrJewelry();

                if (item == null)
                    return false;

                int attributeCount, min, max;
                GetRandomAOSStats(minLevel, maxLevel, out attributeCount, out min, out max);

                if (item is BaseArmor)
                    BaseRunicTool.ApplyAttributesTo((BaseArmor)item, attributeCount, min, max);
                else if (item is BaseJewel)
                    BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                PackItem(item);
            }
            else
            {
                BaseArmor armor = Loot.RandomArmorOrShield();

                if (armor == null)
                    return false;

                armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled(minLevel, maxLevel);
                armor.Durability = (ArmorDurabilityLevel)RandomMinMaxScaled(minLevel, maxLevel);

                PackItem(armor);
            }

            return true;
        }

        public static void GetRandomAOSStats(int minLevel, int maxLevel, out int attributeCount, out int min, out int max)
        {
            int v = RandomMinMaxScaled(minLevel, maxLevel);

            if (v >= 5)
            {
                attributeCount = Utility.RandomMinMax(2, 6);
                min = 20; max = 70;
            }
            else if (v == 4)
            {
                attributeCount = Utility.RandomMinMax(2, 4);
                min = 20; max = 50;
            }
            else if (v == 3)
            {
                attributeCount = Utility.RandomMinMax(2, 3);
                min = 20; max = 40;
            }
            else if (v == 2)
            {
                attributeCount = Utility.RandomMinMax(1, 2);
                min = 10; max = 30;
            }
            else
            {
                attributeCount = 1;
                min = 10; max = 20;
            }
        }

        public static int RandomMinMaxScaled(int min, int max)
        {
            if (min == max)
                return min;

            if (min > max)
            {
                int hold = min;
                min = max;
                max = hold;
            }

            /* Example:
             *    min: 1
             *    max: 5
             *  count: 5
             * 
             * total = (5*5) + (4*4) + (3*3) + (2*2) + (1*1) = 25 + 16 + 9 + 4 + 1 = 55
             * 
             * chance for min+0 : 25/55 : 45.45%
             * chance for min+1 : 16/55 : 29.09%
             * chance for min+2 :  9/55 : 16.36%
             * chance for min+3 :  4/55 :  7.27%
             * chance for min+4 :  1/55 :  1.81%
             */

            int count = max - min + 1;
            int total = 0, toAdd = count;

            for (int i = 0; i < count; ++i, --toAdd)
                total += toAdd * toAdd;

            int rand = Utility.Random(total);
            toAdd = count;

            int val = min;

            for (int i = 0; i < count; ++i, --toAdd, ++val)
            {
                rand -= toAdd * toAdd;

                if (rand < 0)
                    break;
            }

            return val;
        }

        public bool PackSlayer()
        {
            return PackSlayer(0.05);
        }

        public bool PackSlayer(double chance)
        {
            if (chance <= Utility.RandomDouble())
                return false;

            if (Utility.RandomBool())
            {
                BaseInstrument instrument = Loot.RandomInstrument();

                if (instrument != null)
                {
                    instrument.Slayer = SlayerGroup.GetLootSlayerType(GetType());
                    PackItem(instrument);
                }
            }
            else if (!Core.AOS)
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (weapon != null)
                {
                    weapon.Slayer = SlayerGroup.GetLootSlayerType(GetType());
                    PackItem(weapon);
                }
            }

            return true;
        }

        public bool PackWeapon(int minLevel, int maxLevel)
        {
            return PackWeapon(minLevel, maxLevel, 1.0);
        }

        public bool PackWeapon(int minLevel, int maxLevel, double chance)
        {
            if (chance <= Utility.RandomDouble())
                return false;

            Cap(ref minLevel, 0, 5);
            Cap(ref maxLevel, 0, 5);

            if (Core.AOS)
            {
                Item item = Loot.RandomWeaponOrJewelry();

                if (item == null)
                    return false;

                int attributeCount, min, max;
                GetRandomAOSStats(minLevel, maxLevel, out attributeCount, out min, out max);

                if (item is BaseWeapon)
                    BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, attributeCount, min, max);
                else if (item is BaseJewel)
                    BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                PackItem(item);
            }
            else
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (weapon == null)
                    return false;

                if (0.05 > Utility.RandomDouble())
                    weapon.Slayer = SlayerName.Silver;

                weapon.DamageLevel = (WeaponDamageLevel)RandomMinMaxScaled(minLevel, maxLevel);
                weapon.AccuracyLevel = (WeaponAccuracyLevel)RandomMinMaxScaled(minLevel, maxLevel);
                weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled(minLevel, maxLevel);

                PackItem(weapon);
            }

            return true;
        }

        public void PackGold(int amount)
        {
            if (amount > 0)
                PackItem(new Gold(amount));
        }


































        public void PackGold(int min, int max)
        {
            PackGold(Utility.RandomMinMax(min, max));
        }

        public void PackStatue(int min, int max)
        {
            PackStatue(Utility.RandomMinMax(min, max));
        }

        public void PackStatue(int amount)
        {
            for (int i = 0; i < amount; ++i)
                PackStatue();
        }

        public void PackStatue()
        {
            PackItem(Loot.RandomStatue());
        }

        public void PackGem()
        {
            PackGem(1);
        }

        public void PackGem(int min, int max)
        {
            PackGem(Utility.RandomMinMax(min, max));
        }

        public void PackGem(int amount)
        {
            if (amount <= 0)
                return;

            Item gem = Loot.RandomGem();

            gem.Amount = amount;

            PackItem(gem);
        }

        public void PackNecroReg(int min, int max)
        {
            PackNecroReg(Utility.RandomMinMax(min, max));
        }

        public void PackNecroReg(int amount)
        {
            for (int i = 0; i < amount; ++i)
                PackNecroReg();
        }

        public void PackNecroReg()
        {
            if (!Core.AOS)
                return;

            PackItem(Loot.RandomNecromancyReagent());
        }

        public void PackReg(int min, int max)
        {
            PackReg(Utility.RandomMinMax(min, max));
        }

        public void PackReg(int amount)
        {
            if (amount <= 0)
                return;

            Item reg = Loot.RandomReagent();

            reg.Amount = amount;

            PackItem(reg);
        }





























        public void PackItem(Item item)
        {
            if (Summoned || item == null)
            {
                if (item != null)
                    item.Delete();

                return;
            }

            Container pack = Backpack;

            if (pack == null)
            {
                pack = new Backpack();

                pack.Movable = false;

                AddItem(pack);
            }

            if (!item.Stackable || !pack.TryDropItem(this, item, false)) // try stack
                pack.DropItem(item); // failed, drop it anyway
        }
        #endregion

        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel >= AccessLevel.GameMaster && !Body.IsHuman)
            {
                Container pack = this.Backpack;

                if (pack != null)
                    pack.DisplayTo(from);
            }

            if (this.DeathAdderCharmable && from.CanBeHarmful(this, false))
            {
                DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder;

                if (da != null && !da.Deleted)
                {
                    from.SendAsciiMessage("You charm the snake.  Select a target to attack.");
                    from.Target = new DeathAdderCharmTarget(this);
                }
            }

            base.OnDoubleClick(from);
        }

        private class DeathAdderCharmTarget : Target
        {
            private BaseCreature m_Charmed;

            public DeathAdderCharmTarget(BaseCreature charmed) : base(-1, false, TargetFlags.Harmful)
            {
                m_Charmed = charmed;
            }

            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!m_Charmed.DeathAdderCharmable || m_Charmed.Combatant != null || !from.CanBeHarmful(m_Charmed, false))
                    return;

                DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder;
                if (da == null || da.Deleted)
                    return;

                Mobile targ = targeted as Mobile;
                if (targ == null || !from.CanBeHarmful(targ, false))
                    return;

                from.RevealingAction();
                from.DoHarmful(targ, true);

                m_Charmed.Combatant = targ;

                if (m_Charmed.AIObject != null)
                    m_Charmed.AIObject.Action = ActionType.Combat;
            }
        }

        public override void AddNameProperties(ObjectPropertyList list)
        {
            base.AddNameProperties(list);

            if (Core.ML)
            {
                if (DisplayWeight)
                    list.Add(TotalWeight == 1 ? 1072788 : 1072789, TotalWeight.ToString()); // Weight: ~1_WEIGHT~ stones

                if (m_ControlOrder == OrderType.Guard)
                    list.Add(1080078); // guarding
            }

            if (Summoned && !IsAnimatedDead && !IsNecroFamiliar)
                list.Add(1049646); // (summoned)
            else if (Controlled && Commandable)
            {
                if (IsBonded)	//Intentional difference (showing ONLY bonded when bonded instead of bonded & tame)
                    list.Add(1049608); // (bonded)
                else
                    list.Add(502006); // (tame)
            }
        }

		#region FS:ATS Edits
		if ( this.Tamable == true && FSATS.EnablePetBreeding == true )
		{
			bool nolevel = false;
			Type typ = this.GetType();
			string nam = typ.Name;

			foreach ( string check in FSATS.NoLevelCreatures );
			{
 				if ( check == nam )
 				nolevel = true;
			}

			if ( nolevel != true )
			{
				if ( this.Female == true )
					list.Add( 1060658, "Gender\tFemale" );
				else
					list.Add( 1060658, "Gender\tMale" );

				if ( this.Controlled == false )
					list.Add( 1060659, "Max Level\t{0}", this.MaxLevel );
			}
		}
		#endregion

        public override void OnSingleClick(Mobile from)
        {
            if (Controlled && Commandable)
            {
                int number;

                if (Summoned)
                    number = 1049646; // (summoned)
                else if (IsBonded)
                    number = 1049608; // (bonded)
                else
                    number = 502006; // (tame)

 
               PrivateOverheadMessage(MessageType.Regular, 0x3B2, number, from.NetState);
            }












            base.OnSingleClick(from);
        }


        public virtual double TreasureMapChance { get { return TreasureMap.LootChance; } }
        public virtual int TreasureMapLevel { get { return -1; } }

        public virtual bool IgnoreYoungProtection { get { return false; } }










        public override bool OnBeforeDeath()
        {
			{
				#region FS:ATS Edits
				if ( FSATS.EnablePetLeveling == true )
				{
					ArrayList toCheck = new ArrayList();
					List<DamageEntry> rights = this.DamageEntries;

					foreach ( DamageEntry entry in rights )
					{
						if ( entry.Damager is BaseCreature )
						{
							BaseCreature bc = (BaseCreature)entry.Damager;

							if ( bc.Controlled == true && bc.ControlMaster != null )
								toCheck.Add( entry.Damager );		
						}
					}

					foreach ( Mobile mob in toCheck )
					{
						if ( mob is BaseCreature )
						{
							BaseCreature bc = (BaseCreature)mob;
							PetLeveling.CheckLevel( this, bc, toCheck.Count );
						}
					}
				}
				#endregion
			}
            int treasureLevel = TreasureMapLevel;

			#region FS:ATS Edits
			if ( this is BaseBioCreature || this is BioCreature || this is BioMount )
			{
				PetLeveling.DoBioDeath( this );
			}
			else
			{
				if ( FSATS.EnablePetLeveling == true )
					PetLeveling.DoDeathCheck( this );
			}
			#endregion

            if (treasureLevel == 1 && this.Map == Map.Trammel && TreasureMap.IsInHavenIsland(this))
            {
                Mobile killer = this.LastKiller;

                if (killer is BaseCreature)
                    killer = ((BaseCreature)killer).GetMaster();

                if (killer is PlayerMobile && ((PlayerMobile)killer).Young)
                    treasureLevel = 0;
            }

            if (!Summoned && !NoKillAwards && !IsBonded && treasureLevel >= 0)
            {
                if (m_Paragon && Paragon.ChestChance > Utility.RandomDouble())
                    PackItem(new ParagonChest(this.Name, treasureLevel));
                else if ((Map == Map.Felucca || Map == Map.Trammel) && TreasureMap.LootChance >= Utility.RandomDouble())
                    PackItem(new TreasureMap(treasureLevel, Map));
            }

            if (!Summoned && !NoKillAwards && !m_HasGeneratedLoot)
            {
                m_HasGeneratedLoot = true;
                GenerateLoot(false);
            }

            if (!NoKillAwards && Region.IsPartOf("Doom"))
            {
                int bones = Engines.Quests.Doom.TheSummoningQuest.GetDaemonBonesFor(this);

                if (bones > 0)
                    PackItem(new DaemonBone(bones));
            }

            if (IsAnimatedDead)
                Effects.SendLocationEffect(Location, Map, 0x3728, 13, 1, 0x461, 4);

            InhumanSpeech speechType = this.SpeechType;

            if (speechType != null)
			{
                speechType.OnDeath(this);
			}
            if (m_ReceivedHonorContext != null)
			{
                m_ReceivedHonorContext.OnTargetKilled();
			}
            return base.OnBeforeDeath();
        }

        private bool m_NoKillAwards;

        public bool NoKillAwards
        {
            get { return m_NoKillAwards; }
            set { m_NoKillAwards = value; }
        }

        public int ComputeBonusDamage(List<DamageEntry> list, Mobile m)
        {
            int bonus = 0;

            for (int i = list.Count - 1; i >= 0; --i)
            {
                DamageEntry de = list[i];

                if (de.Damager == m || !(de.Damager is BaseCreature))
                    continue;

                BaseCreature bc = (BaseCreature)de.Damager;
                Mobile master = null;

                master = bc.GetMaster();

                if (master == m)
                    bonus += de.DamageGiven;
            }

            return bonus;
        }

        public Mobile GetMaster()
        {
            if (Controlled && ControlMaster != null)
                return ControlMaster;
            else if (Summoned && SummonMaster != null)
                return SummonMaster;

            return null;
        }

        private class FKEntry
        {
            public Mobile m_Mobile;
            public int m_Damage;

            public FKEntry(Mobile m, int damage)
            {
                m_Mobile = m;
                m_Damage = damage;
            }
        }

        public static List<DamageStore> GetLootingRights(List<DamageEntry> damageEntries, int hitsMax)
        {
            return GetLootingRights(damageEntries, hitsMax, false);
        }

        public static List<DamageStore> GetLootingRights(List<DamageEntry> damageEntries, int hitsMax, bool partyAsIndividual)
        {
            List<DamageStore> rights = new List<DamageStore>();

            for (int i = damageEntries.Count - 1; i >= 0; --i)
            {
                if (i >= damageEntries.Count)
                    continue;

                DamageEntry de = damageEntries[i];

                if (de.HasExpired)
                {
                    damageEntries.RemoveAt(i);
                    continue;
                }

                int damage = de.DamageGiven;

                List<DamageEntry> respList = de.Responsible;

                if (respList != null)
                {
                    for (int j = 0; j < respList.Count; ++j)
                    {
                        DamageEntry subEntry = respList[j];
                        Mobile master = subEntry.Damager;

                        if (master == null || master.Deleted || !master.Player)
                            continue;

                        bool needNewSubEntry = true;

                        for (int k = 0; needNewSubEntry && k < rights.Count; ++k)
                        {
                            DamageStore ds = rights[k];

                            if (ds.m_Mobile == master)
                            {
                                ds.m_Damage += subEntry.DamageGiven;
                                needNewSubEntry = false;
                            }
                        }

                        if (needNewSubEntry)
                            rights.Add(new DamageStore(master, subEntry.DamageGiven));

                        damage -= subEntry.DamageGiven;
                    }
                }

                Mobile m = de.Damager;

                if (m == null || m.Deleted || !m.Player)
                    continue;

                if (damage <= 0)
                    continue;

                bool needNewEntry = true;

                for (int j = 0; needNewEntry && j < rights.Count; ++j)
                {
                    DamageStore ds = rights[j];

                    if (ds.m_Mobile == m)
                    {
                        ds.m_Damage += damage;
                        needNewEntry = false;
                    }
                }

                if (needNewEntry)
                    rights.Add(new DamageStore(m, damage));
            }

            if (rights.Count > 0)
            {
                rights[0].m_Damage = (int)(rights[0].m_Damage * 1.25);	//This would be the first valid person attacking it.  Gets a 25% bonus.  Per 1/19/07 Five on Friday

                if (rights.Count > 1)
                    rights.Sort(); //Sort by damage

                int topDamage = rights[0].m_Damage;
                int minDamage;

                if (hitsMax >= 3000)
                    minDamage = topDamage / 16;
                else if (hitsMax >= 1000)
                    minDamage = topDamage / 8;
                else if (hitsMax >= 200)
                    minDamage = topDamage / 4;
                else
                    minDamage = topDamage / 2;

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

                    ds.m_HasRight = (ds.m_Damage >= minDamage);
                }
            }

            return rights;
        }

        #region Mondain's Legacy
        private bool m_Allured;

        [CommandProperty(AccessLevel.GameMaster)]
        public bool Allured
        {
            get { return m_Allured; }
            set { m_Allured = value; }
        }

        public virtual void OnRelease(Mobile from)
        {
            if (m_Allured)
                Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerCallback(Delete));
        }

        public void PackArcaneScroll(int max)
        {
            PackArcaneScroll(0, max);
        }

        public void PackArcaneScroll(int min, int max)
        {
            double div = -1.0 / (max - min + 1);
            int amount = 0;

            for (int i = max - min; i >= 0; i--)
            {
                if (Utility.RandomDouble() < (Math.Exp(div * i) - Math.Exp(div * (i + 1))))
                {
                    amount = i;
                    break;
                }
            }

            for (int i = 0; i < min + amount; i++)
                PackItem(Loot.Construct(Loot.ArcanistScrollTypes));
        }

        public override void OnItemLifted(Mobile from, Item item)
        {
            base.OnItemLifted(from, item);

            InvalidateProperties();
        }

        public virtual bool GivesMinorArtifact { get { return false; } }

        private static Type[] m_Artifacts = new Type[]
		{
			typeof( AegisOfGrace ), typeof( BladeDance ), 
			typeof( Bonesmasher ), typeof( FeyLeggings ),
			typeof( FleshRipper ), typeof( HelmOfSwiftness ),
			typeof( PadsOfTheCuSidhe ), typeof( RaedsGlory ),
			typeof( RighteousAnger ), typeof( RobeOfTheEclipse ),
			typeof( RobeOfTheEquinox ), typeof( SoulSeeker ),
			typeof( TalonBite ), typeof( BloodwoodSpirit ),
			typeof( TotemOfVoid ), typeof( QuiverOfRage ),
			typeof( QuiverOfElements ), typeof( BrightsightLenses ),
			typeof( Boomstick ), typeof( WildfireBow ), 
			typeof( Windsong )
		};

        public static void GiveMinorArtifact(Mobile m)
        {
            Item item = Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]) as Item;

            if (item == null)
                return;

            if (m.AddToBackpack(item))
            {
                m.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
                m.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
            }
            else if (m.BankBox != null && m.BankBox.TryDropItem(m, item, false))
            {
                m.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
                m.SendLocalizedMessage(1072224); // An item has been placed in your bank box.
            }
            else
            {
                item.MoveToWorld(m.Location, m.Map);
                m.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it.
            }
        }
        #endregion

        public virtual void OnKilledBy(Mobile mob)
        {
            if (m_Paragon && Paragon.CheckArtifactChance(mob, this))
                Paragon.GiveArtifactTo(mob);

            #region Mondain's Legacy
            if (GivesMinorArtifact && Paragon.CheckArtifactChance(mob, this))
                GiveMinorArtifact(mob);
            #endregion
        }

        public override void OnDeath(Container c)
        {
            MeerMage.StopEffect(this, false);

            if (IsBonded)
            {
                int sound = this.GetDeathSound();

                if (sound >= 0)
                    Effects.PlaySound(this, this.Map, sound);

                Warmode = false;

                Poison = null;
                Combatant = null;

                Hits = 0;
                Stam = 0;
                Mana = 0;

                IsDeadPet = true;
                ControlTarget = ControlMaster;
                ControlOrder = OrderType.Follow;

                ProcessDeltaQueue();
                SendIncomingPacket();
                SendIncomingPacket();

                List<AggressorInfo> aggressors = this.Aggressors;

                for (int i = 0; i < aggressors.Count; ++i)
                {
                    AggressorInfo info = aggressors[i];

                    if (info.Attacker.Combatant == this)
                        info.Attacker.Combatant = null;
                }

                List<AggressorInfo> aggressed = this.Aggressed;

                for (int i = 0; i < aggressed.Count; ++i)
                {
                    AggressorInfo info = aggressed[i];

                    if (info.Defender.Combatant == this)
                        info.Defender.Combatant = null;
                }

                Mobile owner = this.ControlMaster;

                if (owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange(this, 12) || !this.CanSee(owner) || !this.InLOS(owner))
                {
                    if (this.OwnerAbandonTime == DateTime.MinValue)
                        this.OwnerAbandonTime = DateTime.Now;
                }
                else
                {
                    this.OwnerAbandonTime = DateTime.MinValue;
                }

                GiftOfLifeSpell.HandleDeath(this);

                CheckStatTimers();
            }
            else
            {
                if (!Summoned && !m_NoKillAwards)
                {
                    int totalFame = Fame / 100;
                    int totalKarma = -Karma / 100;

                    List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax);

                    bool givenQuestKill = false;
                    bool givenFactionKill = false;
                    bool givenToTKill = false;

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

                        if (!ds.m_HasRight)
                            continue;

                        Titles.AwardFame(ds.m_Mobile, totalFame, true);
                        Titles.AwardKarma(ds.m_Mobile, totalKarma, true);








                        OnKilledBy(ds.m_Mobile);

                        if (!givenFactionKill)
                        {
                            givenFactionKill = true;
                            Faction.HandleDeath(this, ds.m_Mobile);
                        }

                        if (!givenToTKill)
                        {
                            givenToTKill = true;
                            TreasuresOfTokuno.HandleKill(this, ds.m_Mobile);
                            VirtueArtifactSystem.HandleKill(this, ds.m_Mobile);
                        }

                        if (givenQuestKill)
                            continue;

                        PlayerMobile pm = ds.m_Mobile as PlayerMobile;

                        if (pm != null)
                        {
                            QuestSystem qs = pm.Quest;

                            if (qs != null)
                            {
                                qs.OnKill(this, c);
                                givenQuestKill = true;
                            }

                            #region Mondain's Legacy
                            QuestHelper.CheckCreature(pm, this);
                            #endregion
                        }
                    }
                }
                base.OnDeath(c);

                if (DeleteCorpseOnDeath)
                    c.Delete();
            }
        }

        /* To save on cpu usage, RunUO creatures only reacquire creatures under the following circumstances:
         *  - 10 seconds have elapsed since the last time it tried
         *  - The creature was attacked
         *  - Some creatures, like dragons, will reacquire when they see someone move
         * 
         * This functionality appears to be implemented on OSI as well
         */

        private DateTime m_NextReacquireTime;

        public DateTime NextReacquireTime { get { return m_NextReacquireTime; } set { m_NextReacquireTime = value; } }

        public virtual TimeSpan ReacquireDelay { get { return TimeSpan.FromSeconds(10.0); } }
        public virtual bool ReacquireOnMovement { get { return false; } }

        public void ForceReacquire()
        {
            m_NextReacquireTime = DateTime.MinValue;
        }

        public override void OnDelete()
        {
            Mobile m = m_ControlMaster;
            SetControlMaster(null);
            SummonMaster = null;

            if (m_ReceivedHonorContext != null)
                m_ReceivedHonorContext.Cancel();

            base.OnDelete();

            if (m != null)
                m.InvalidateProperties();
        }

        public override bool CanBeHarmful(Mobile target, bool message, bool ignoreOurBlessedness)
        {
            if (target is BaseFactionGuard)
                return false;

            if ((target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)
            {
                if (message)
                {
                    if (target.Title == null)
                        SendMessage("{0} the vendor cannot be harmed.", target.Name);
                    else
                        SendMessage("{0} {1} cannot be harmed.", target.Name, target.Title);
                }

                return false;
            }

            return base.CanBeHarmful(target, message, ignoreOurBlessedness);
        }

        public override bool CanBeRenamedBy(Mobile from)
        {
            bool ret = base.CanBeRenamedBy(from);

            if (Controlled && from == ControlMaster && !from.Region.IsPartOf(typeof(Jail)))
                ret = true;

            return ret;
        }

        public bool SetControlMaster(Mobile m)
        {
            if (m == null)
            {
                ControlMaster = null;
                Controlled = false;
                ControlTarget = null;
                ControlOrder = OrderType.None;
                Guild = null;

                Delta(MobileDelta.Noto);
            }
            else
            {
                SpawnEntry se = this.Spawner as SpawnEntry;
                if (se != null && se.UnlinkOnTaming)
                {
                    this.Spawner.Remove(this);
                    this.Spawner = null;
                }

                if (m.Followers + ControlSlots > m.FollowersMax)
                {
                    m.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
                    return false;
                }

                CurrentWayPoint = null;//so tamed animals don't try to go back

                ControlMaster = m;
                Controlled = true;
                ControlTarget = null;
                ControlOrder = OrderType.Come;
                Guild = null;

                Delta(MobileDelta.Noto);
            }

            InvalidateProperties();

            return true;
        }

        public override void OnRegionChange(Region Old, Region New)
        {
            base.OnRegionChange(Old, New);

            if (this.Controlled)
            {
                SpawnEntry se = this.Spawner as SpawnEntry;

                if (se != null && !se.UnlinkOnTaming && (New == null || !New.AcceptsSpawnsFrom(se.Region)))
                {
                    this.Spawner.Remove(this);
                    this.Spawner = null;
                }
            }
        }

        private static bool m_Summoning;

        public static bool Summoning
        {
            get { return m_Summoning; }
            set { m_Summoning = value; }
        }

        public static bool Summon(BaseCreature creature, Mobile caster, Point3D p, int sound, TimeSpan duration)
        {
            return Summon(creature, true, caster, p, sound, duration);
        }

        public static bool Summon(BaseCreature creature, bool controlled, Mobile caster, Point3D p, int sound, TimeSpan duration)
        {
            if (caster.Followers + creature.ControlSlots > caster.FollowersMax)
            {
                caster.SendLocalizedMessage(1049645); // You have too many followers to summon that creature.
                creature.Delete();
                return false;
            }

            m_Summoning = true;

            if (controlled)
                creature.SetControlMaster(caster);

            creature.RangeHome = 10;
            creature.Summoned = true;

            creature.SummonMaster = caster;

            Container pack = creature.Backpack;

            if (pack != null)
            {
                for (int i = pack.Items.Count - 1; i >= 0; --i)
                {
                    if (i >= pack.Items.Count)
                        continue;

                    pack.Items[i].Delete();
                }
            }

            #region Mondain's Legacy
            creature.SetHits((int)Math.Floor(creature.HitsMax * (1 + ArcaneEmpowermentSpell.GetSpellBonus(caster, false) / 100.0)));
            #endregion

            new UnsummonTimer(caster, creature, duration).Start();
            creature.m_SummonEnd = DateTime.Now + duration;

            creature.MoveToWorld(p, caster.Map);

            Effects.PlaySound(p, creature.Map, sound);

            m_Summoning = false;

            return true;
        }

        private static Type[] m_MinorArtifactsMl = new Type[]
		{
			typeof( AegisOfGrace ), typeof( BladeDance ), typeof( Bonesmasher ),
			typeof( Boomstick ), typeof( FeyLeggings ), typeof( FleshRipper ),
			typeof( HelmOfSwiftness ), typeof( PadsOfTheCuSidhe ), typeof( QuiverOfRage ),
			typeof( QuiverOfElements ), typeof( RaedsGlory ), typeof( RighteousAnger ),
			typeof( RobeOfTheEclipse ), typeof( RobeOfTheEquinox ), typeof( SoulSeeker ),
			typeof( TalonBite ), typeof( WildfireBow ), typeof( Windsong ),
			// TODO: Brightsight lenses, Bloodwood spirit, Totem of the void
		};

        public static Type[] MinorArtifactsMl
        {
            get { return m_MinorArtifactsMl; }
        }

        private static bool EnableRummaging = true;

        private const double ChanceToRummage = 0.5; // 50%

        private const double MinutesToNextRummageMin = 1.0;
        private const double MinutesToNextRummageMax = 4.0;

        private const double MinutesToNextChanceMin = 0.25;
        private const double MinutesToNextChanceMax = 0.75;

        private DateTime m_NextRummageTime;

        public virtual bool CanBreath { get { return HasBreath && !Summoned; } }
        public virtual bool IsDispellable { get { return Summoned && !IsAnimatedDead; } }

        #region Mondain's Legacy

        #region Animate Dead
        public virtual bool CanAnimateDead { get { return false; } }
        public virtual double AnimateChance { get { return 0.05; } }
        public virtual int AnimateScalar { get { return 50; } }
        public virtual TimeSpan AnimateDelay { get { return TimeSpan.FromSeconds(10); } }
        public virtual BaseCreature Animates { get { return null; } }

        private DateTime m_NextAnimateDead = DateTime.Now;

        public virtual void AnimateDead()
        {
            Corpse best = null;

            foreach (Item item in Map.GetItemsInRange(Location, 12))
            {
                Corpse c = null;

                if (item is Corpse)
                    c = (Corpse)item;
                else
                    continue;

                if (c.ItemID != 0x2006 || c.Channeled || c.Owner.GetType() == typeof(PlayerMobile) || c.Owner.GetType() == null || (c.Owner != null && c.Owner.Fame < 100) || ((c.Owner != null) && (c.Owner is BaseCreature) && (((BaseCreature)c.Owner).Summoned || ((BaseCreature)c.Owner).IsBonded)))
                    continue;

                best = c;
                break;
            }

            if (best != null)
            {
                BaseCreature animated = Animates;

                if (animated != null)
                {
                    animated.Tamable = false;
                    animated.MoveToWorld(best.Location, Map);
                    Scale(animated, AnimateScalar);
                    Effects.PlaySound(best.Location, Map, 0x1FB);
                    Effects.SendLocationParticles(EffectItem.Create(best.Location, Map, EffectItem.DefaultDuration), 0x3789, 1, 40, 0x3F, 3, 9907, 0);
                }


                best.ProcessDelta();
                best.SendRemovePacket();
                best.ItemID = Utility.Random(0xECA, 9); // bone graphic
                best.Hue = 0;
                best.ProcessDelta();
            }

            m_NextAnimateDead = DateTime.Now + AnimateDelay;
        }

        public static void Scale(BaseCreature bc, int scalar)
        {
            int toScale;

            toScale = bc.RawStr;
            bc.RawStr = AOS.Scale(toScale, scalar);

            toScale = bc.HitsMaxSeed;

            if (toScale > 0)
                bc.HitsMaxSeed = AOS.Scale(toScale, scalar);

            bc.Hits = bc.Hits; // refresh hits
        }
        #endregion

        #region Area Poison
        public virtual bool CanAreaPoison { get { return false; } }
        public virtual Poison HitAreaPoison { get { return Poison.Deadly; } }
        public virtual int AreaPoisonRange { get { return 10; } }
        public virtual double AreaPosionChance { get { return 0.4; } }
        public virtual TimeSpan AreaPoisonDelay { get { return TimeSpan.FromSeconds(8); } }

        private DateTime m_NextAreaPoison = DateTime.Now;

        public virtual void AreaPoison()
        {
            List<Mobile> targets = new List<Mobile>();

            if (Map != null)
                foreach (Mobile m in GetMobilesInRange(AreaDamageRange))
                    if (this != m && SpellHelper.ValidIndirectTarget(this, m) && CanBeHarmful(m, false) && (!Core.AOS || InLOS(m)))
                    {
                        if (m is BaseCreature && ((BaseCreature)m).Controlled)
                            targets.Add(m);
                        else if (m.Player)
                            targets.Add(m);
                    }

            for (int i = 0; i < targets.Count; ++i)
            {
                Mobile m = targets[i];

                m.ApplyPoison(this, HitAreaPoison);

                Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                Effects.PlaySound(m.Location, m.Map, 0x229);
            }

            m_NextAreaPoison = DateTime.Now + AreaPoisonDelay;
        }
        #endregion

        #region Area damage
        public virtual bool CanAreaDamage { get { return false; } }
        public virtual int AreaDamageRange { get { return 10; } }
        public virtual double AreaDamageScalar { get { return 1.0; } }
        public virtual double AreaDamageChance { get { return 0.4; } }
        public virtual TimeSpan AreaDamageDelay { get { return TimeSpan.FromSeconds(8); } }

        public virtual int AreaPhysicalDamage { get { return 0; } }
        public virtual int AreaFireDamage { get { return 100; } }
        public virtual int AreaColdDamage { get { return 0; } }
        public virtual int AreaPoisonDamage { get { return 0; } }
        public virtual int AreaEnergyDamage { get { return 0; } }

        private DateTime m_NextAreaDamage = DateTime.Now;

        public virtual void AreaDamage()
        {
            List<Mobile> targets = new List<Mobile>();

            if (Map != null)
                foreach (Mobile m in GetMobilesInRange(AreaDamageRange))
                    if (this != m && SpellHelper.ValidIndirectTarget(this, m) && CanBeHarmful(m, false) && (!Core.AOS || InLOS(m)))
                    {
                        if (m is BaseCreature && ((BaseCreature)m).Controlled)
                            targets.Add(m);
                        else if (m.Player)
                            targets.Add(m);
                    }

            for (int i = 0; i < targets.Count; ++i)
            {
                Mobile m = targets[i];

                int damage;

                if (Core.AOS)
                {
                    damage = m.Hits / 2;

                    if (!m.Player)
                        damage = Math.Max(Math.Min(damage, 100), 15);

                    damage += Utility.RandomMinMax(0, 15);
                }
                else
                {
                    damage = (m.Hits * 6) / 10;

                    if (!m.Player && damage < 10)
                        damage = 10;
                    else if (damage > 75)
                        damage = 75;
                }

                damage = (int)(damage * AreaDamageScalar);

                DoHarmful(m);
                AreaDamageEffect(m);
                SpellHelper.Damage(TimeSpan.Zero, m, this, damage, AreaPhysicalDamage, AreaFireDamage, AreaColdDamage, AreaPoisonDamage, AreaEnergyDamage);
            }

            m_NextAreaDamage = DateTime.Now + AreaDamageDelay;
        }

        public virtual void AreaDamageEffect(Mobile m)
        {
            m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot); // flamestrike
            m.PlaySound(0x208);
        }
        #endregion

        #region Healing
        public virtual double MinHealDelay { get { return 2.0; } }
        public virtual double HealScalar { get { return 1.0; } }
        public virtual bool CanHeal { get { return false; } }
        public virtual bool CanHealOwner { get { return false; } }

        public double MaxHealDelay
        {
            get
            {
                if (ControlMaster != null)
                {
                    double max = ControlMaster.Hits / 10;

                    if (max > 10)
                        max = 10;
                    if (max < 1)
                        max = 1;

                    return max;
                }
                else
                    return 7;
            }
        }

        private DateTime m_NextHealTime = DateTime.Now;
        private Timer m_HealTimer = null;

        public virtual void HealStart()
        {
            if (!Alive)
                return;

            if (CanHeal && Hits != HitsMax)
            {
                RevealingAction();

                double seconds = 10 - Dex / 12;

                m_HealTimer = Timer.DelayCall(TimeSpan.FromSeconds(seconds), new TimerStateCallback(Heal_Callback), this);
            }
            else if (CanHealOwner && ControlMaster != null && ControlMaster.Hits < ControlMaster.HitsMax && InRange(ControlMaster, 2))
            {
                ControlMaster.RevealingAction();

                double seconds = 10 - Dex / 15;
                double resDelay = (ControlMaster.Alive ? 0.0 : 5.0);

                seconds += resDelay;

                ControlMaster.SendLocalizedMessage(1008078, false, Name); //  : Attempting to heal you.

                m_HealTimer = Timer.DelayCall(TimeSpan.FromSeconds(seconds), new TimerStateCallback(Heal_Callback), ControlMaster);
            }
        }

        private void Heal_Callback(object state)
        {
            if (state is Mobile)
                Heal((Mobile)state);
        }

        public virtual void Heal(Mobile patient)
        {
            if (!Alive || !patient.Alive || !InRange(patient, 2))
            {
            }
            else if (patient.Poisoned)
            {
                double healing = Skills.Healing.Value;
                double anatomy = Skills.Anatomy.Value;
                double chance = (healing - 30.0) / 50.0 - patient.Poison.Level * 0.1;

   

             if ((healing >= 60.0 && anatomy >= 60.0) && chance > Utility.RandomDouble())
                {
                    if (patient.CurePoison(this))
                    {
                        patient.SendLocalizedMessage(1010059); // You have been cured of all poisons.						
                        patient.PlaySound(0x57);

                        CheckSkill(SkillName.Healing, 0.0, 100.0);
                        CheckSkill(SkillName.Anatomy, 0.0, 100.0);
                    }
                }
            }
            else if (BleedAttack.IsBleeding(patient))
            {
                patient.SendLocalizedMessage(1060167); // The bleeding wounds have healed, you are no longer bleeding!
                BleedAttack.EndBleed(patient, true);
                patient.PlaySound(0x57);
            }
            else
            {
                double healing = Skills.Healing.Value;
                double anatomy = Skills.Anatomy.Value;
                double chance = (healing + 10.0) / 100.0;

                if (chance > Utility.RandomDouble())
                {
                    double min, max;

                    min = (anatomy / 10.0) + (healing / 6.0) + 4.0;
                    max = (anatomy / 8.0) + (healing / 3.0) + 4.0;

                    if (patient == this)
                        max += 10;

                    double toHeal = min + (Utility.RandomDouble() * (max - min));

                    toHeal *= HealScalar;

                    patient.Heal((int)toHeal);
                    patient.PlaySound(0x57);

                    CheckSkill(SkillName.Healing, 0.0, 100.0);
                    CheckSkill(SkillName.Anatomy, 0.0, 100.0);
                }
            }

            if (m_HealTimer != null)
                m_HealTimer.Stop();

            m_HealTimer = null;

            m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds(MinHealDelay + (Utility.RandomDouble() * MaxHealDelay));
        }
        #endregion

        #endregion

        public virtual void OnThink()
        {
			#region FS:ATS Edits
			if ( this.Tamable == true )
			{
				if ( this.NextLevel == 0 )
				{
					int totalstats = this.Str + this.Dex + this.Int + this.HitsMax + this.StamMax + this.ManaMax + this.PhysicalResistance + this.FireResistance + this.ColdResistance + this.EnergyResistance + this.PoisonResistance + this.DamageMin + this.DamageMax + this.VirtualArmor;
					int nextlevel = totalstats * 10;

					this.NextLevel = nextlevel;
				}

				if ( this.MaxLevel == 0 )
				{
					this.MaxLevel = Utility.RandomMinMax( 10, 30 );
				}
			}
			#endregion

            if (EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && DateTime.Now >= m_NextRummageTime)
            {
                double min, max;

                if (ChanceToRummage > Utility.RandomDouble() && Rummage())
                {
                    min = MinutesToNextRummageMin;
                    max = MinutesToNextRummageMax;
                }
                else
                {
                    min = MinutesToNextChanceMin;
                    max = MinutesToNextChanceMax;
                }

                double delay = min + (Utility.RandomDouble() * (max - min));
                m_NextRummageTime = DateTime.Now + TimeSpan.FromMinutes(delay);
            }

            if (CanBreath && DateTime.Now >= m_NextBreathTime) // tested: controled dragons do breath fire, what about summoned skeletal dragons?
            {
                Mobile target = this.Combatant;

                if (target != null && target.Alive && !target.IsDeadBondedPet && CanBeHarmful(target) && target.Map == this.Map && !IsDeadBondedPet && target.InRange(this, BreathRange) && InLOS(target) && !BardPacified)
                    BreathStart(target);

                m_NextBreathTime = DateTime.Now + TimeSpan.FromSeconds(BreathMinDelay + (Utility.RandomDouble() * BreathMaxDelay));
            }

            #region Mondain's Legacy
            if (m_HealTimer == null && DateTime.Now >= m_NextHealTime && Map != Map.Internal)
            {
                if (this is BaseMount)
                {
                    BaseMount mount = (BaseMount)this;

                    if (mount.Rider == null)
                        HealStart();
                }
                else
                    HealStart();
            }

            if (CanAreaDamage && Combatant != null && DateTime.Now >= m_NextAreaDamage && Utility.RandomDouble() < AreaDamageChance)
                AreaDamage();

            if (CanAreaPoison && Combatant != null && DateTime.Now >= m_NextAreaPoison && Utility.RandomDouble() < AreaPosionChance)
                AreaPoison();

            if (CanAnimateDead && Combatant != null && DateTime.Now >= m_NextAnimateDead && Utility.RandomDouble() < AnimateChance)
                AnimateDead();
            #endregion
        }

        public virtual bool Rummage()
        {
            Corpse toRummage = null;

            foreach (Item item in this.GetItemsInRange(2))
            {
                if (item is Corpse && item.Items.Count > 0)
                {
                    toRummage = (Corpse)item;
                    break;
                }
            }

            if (toRummage == null)
                return false;

            Container pack = this.Backpack;

            if (pack == null)
                return false;

            List<Item> items = toRummage.Items;

            bool rejected;
            LRReason reason;

            for (int i = 0; i < items.Count; ++i)
            {
                Item item = items[Utility.Random(items.Count)];

                Lift(item, item.Amount, out rejected, out reason);

                if (!rejected && Drop(this, new Point3D(-1, -1, 0)))
                {
                    // *rummages through a corpse and takes an item*
                    PublicOverheadMessage(MessageType.Emote, 0x3B2, 1008086);
                    return true;
                }
            }

            return false;
        }

        public void Pacify(Mobile master, DateTime endtime)
        {
            BardPacified = true;
            BardEndTime = endtime;
        }

        public override Mobile GetDamageMaster(Mobile damagee)
        {
            if (m_bBardProvoked && damagee == m_bBardTarget)
                return m_bBardMaster;
            else if (m_bControlled && m_ControlMaster != null)
                return m_ControlMaster;
            else if (m_bSummoned && m_SummonMaster != null)
                return m_SummonMaster;

            return base.GetDamageMaster(damagee);
        }

        public void Provoke(Mobile master, Mobile target, bool bSuccess)
        {
            BardProvoked = true;

            this.PublicOverheadMessage(MessageType.Emote, EmoteHue, false, "*looks furious*");

            if (bSuccess)
            {
                PlaySound(GetIdleSound());

                BardMaster = master;
                BardTarget = target;
                Combatant = target;
                BardEndTime = DateTime.Now + TimeSpan.FromSeconds(30.0);

                if (target is BaseCreature)
                {
                    BaseCreature t = (BaseCreature)target;

                    if (t.Unprovokable || (t.IsParagon && BaseInstrument.GetBaseDifficulty(t) >= 160.0))
                        return;

                    t.BardProvoked = true;

                    t.BardMaster = master;
                    t.BardTarget = this;
                    t.Combatant = this;
                    t.BardEndTime = DateTime.Now + TimeSpan.FromSeconds(30.0);
                }
            }
            else
            {
                PlaySound(GetAngerSound());

                BardMaster = master;
                BardTarget = target;
            }
        }

        public bool FindMyName(string str, bool bWithAll)
        {
            int i, j;

            string name = this.Name;

            if (name == null || str.Length < name.Length)
                return false;

            string[] wordsString = str.Split(' ');
            string[] wordsName = name.Split(' ');

            for (j = 0; j < wordsName.Length; j++)
            {
                string wordName = wordsName[j];

                bool bFound = false;
                for (i = 0; i < wordsString.Length; i++)
                {
                    string word = wordsString[i];

                    if (Insensitive.Equals(word, wordName))
                        bFound = true;

                    if (bWithAll && Insensitive.Equals(word, "all"))
                        return true;
                }

                if (!bFound)
                    return false;
            }

            return true;
        }

        public static void TeleportPets(Mobile master, Point3D loc, Map map)
        {
            TeleportPets(master, loc, map, false);
        }

        public static void TeleportPets(Mobile master, Point3D loc, Map map, bool onlyBonded)
        {
            List<Mobile> move = new List<Mobile>();

            foreach (Mobile m in master.GetMobilesInRange(3))
            {
                if (m is BaseCreature)
                {
                    BaseCreature pet = (BaseCreature)m;

                    if (pet.Controlled && pet.ControlMaster == master)
                    {
                        if (!onlyBonded || pet.IsBonded)
                        {
                            if (pet.ControlOrder == OrderType.Guard || pet.ControlOrder == OrderType.Follow || pet.ControlOrder == OrderType.Come)
                                move.Add(pet);
                        }
                    }
                }
            }

            foreach (Mobile m in move)
                m.MoveToWorld(loc, map);
        }

        public virtual void ResurrectPet()
        {
            if (!IsDeadPet)
                return;

            OnBeforeResurrect();

            Poison = null;

            Warmode = false;

            Hits = 10;
            Stam = StamMax;
            Mana = 0;

            ProcessDeltaQueue();

            IsDeadPet = false;

            Effects.SendPacket(Location, Map, new BondedStatus(0, this.Serial, 0));

            this.SendIncomingPacket();
            this.SendIncomingPacket();

            OnAfterResurrect();

            Mobile owner = this.ControlMaster;

            if (owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange(this, 12) || !this.CanSee(owner) || !this.InLOS(owner))
            {
                if (this.OwnerAbandonTime == DateTime.MinValue)
                    this.OwnerAbandonTime = DateTime.Now;
            }
            else
            {
                this.OwnerAbandonTime = DateTime.MinValue;
            }

            CheckStatTimers();
        }

        public override bool CanBeDamaged()
        {
            if (IsDeadPet)
                return false;

            return base.CanBeDamaged();
        }

        public virtual bool PlayerRangeSensitive { get { return (this.CurrentWayPoint == null); } }	//If they are following a waypoint, they'll continue to follow it even if players aren't around

        public override void OnSectorDeactivate()
        {
            if (PlayerRangeSensitive && m_AI != null)
                m_AI.Deactivate();

            base.OnSectorDeactivate();
        }

        public override void OnSectorActivate()
        {
            if (PlayerRangeSensitive && m_AI != null)
                m_AI.Activate();

            base.OnSectorActivate();
        }

        private bool m_RemoveIfUntamed;

        // used for deleting untamed creatures [in houses]
        private int m_RemoveStep;

        [CommandProperty(AccessLevel.GameMaster)]
        public bool RemoveIfUntamed { get { return m_RemoveIfUntamed; } set { m_RemoveIfUntamed = value; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public int RemoveStep { get { return m_RemoveStep; } set { m_RemoveStep = value; } }
    }

    public class LoyaltyTimer : Timer
    {
        private static TimeSpan InternalDelay = TimeSpan.FromMinutes(5.0);

        public static void Initialize()
        {
            new LoyaltyTimer().Start();
        }

        public LoyaltyTimer() : base(InternalDelay, InternalDelay)
        {
            m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours(1.0);
            Priority = TimerPriority.FiveSeconds;
        }

        private DateTime m_NextHourlyCheck;

        protected override void OnTick()
        {
            if (DateTime.Now >= m_NextHourlyCheck)
                m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours(1.0);
            else
                return;

            List<BaseCreature> toRelease = new List<BaseCreature>();

            // added array for wild creatures in house regions to be removed
            List<BaseCreature> toRemove = new List<BaseCreature>();

            foreach (Mobile m in World.Mobiles.Values)
            {
                if (m is BaseMount && ((BaseMount)m).Rider != null)
                {
                    ((BaseCreature)m).OwnerAbandonTime = DateTime.MinValue;
                    continue;
                }

                if (m is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)m;

                    if (c.IsDeadPet)
                    {
                        Mobile owner = c.ControlMaster;

                        if (owner == null || owner.Deleted || owner.Map != c.Map || !owner.InRange(c, 12) || !c.CanSee(owner) || !c.InLOS(owner))
                        {
                            if (c.OwnerAbandonTime == DateTime.MinValue)
                                c.OwnerAbandonTime = DateTime.Now;
                            else if ((c.OwnerAbandonTime + c.BondingAbandonDelay) <= DateTime.Now)
                                toRemove.Add(c);
                        }
                        else
                        {
                            c.OwnerAbandonTime = DateTime.MinValue;
                        }
                    }
                    else if (c.Controlled && c.Commandable)
                    {
                        c.OwnerAbandonTime = DateTime.MinValue;

                        if (c.Map != Map.Internal)
                        {
                            c.Loyalty -= (BaseCreature.MaxLoyalty / 10);

                            if (c.Loyalty < (BaseCreature.MaxLoyalty / 10))
                            {
                                c.Say(1043270, c.Name); // * ~1_NAME~ looks around desperately *
                                c.PlaySound(c.GetIdleSound());
                            }

                            if (c.Loyalty <= 0)
                                toRelease.Add(c);
                        }
                    }

                    // added lines to check if a wild creature in a house region has to be removed or not
                    if ((!c.Controlled && (c.Region.IsPartOf(typeof(HouseRegion)) && c.CanBeDamaged()) || (c.RemoveIfUntamed && c.Spawner == null)))
                    {
                        c.RemoveStep++;

                        if (c.RemoveStep >= 20)
                            toRemove.Add(c);
                    }
                    else
                    {
                        c.RemoveStep = 0;
                    }
                }
            }

            foreach (BaseCreature c in toRelease)
            {
                c.Say(1043255, c.Name); // ~1_NAME~ appears to have decided that is better off without a master!
                c.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy
                c.IsBonded = false;
                c.BondingBegin = DateTime.MinValue;
                c.OwnerAbandonTime = DateTime.MinValue;
                c.ControlTarget = null;
                //c.ControlOrder = OrderType.Release;
                c.AIObject.DoOrderRelease(); // this will prevent no release of creatures left alone with AI disabled (and consequent bug of Followers)
            }

            // added code to handle removing of wild creatures in house regions
            foreach (BaseCreature c in toRemove)
            {
                c.Delete();
            }
        }
    }
}
}
 

Pure Insanity

Sorceror
Yeah, it's not extremely easy to do. Lol.

Although for me, I found it easier to install Daat99's system then FS. So I wish you luck. =D
 

Mahmud100

Sorceror
Gump Problems

I was able to get the FS Animal added , OWLTR is up and running but have serious problems with the craft gump




seems all the selections are missing, can someone help me figure out what I am doing wrong. I have included two scripts

CraftGump.cs
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
using Server.Network;
using Server.Items;
using Server.daat99;

namespace Server.Engines.Craft
{
    public class CraftGump : Gump
    {
        private Mobile m_From;
        private CraftSystem m_CraftSystem;
        private BaseTool m_Tool;

        private CraftPage m_Page;

        private const int LabelHue = 0x480;
        private const int LabelColor = 0x7FFF;
        private const int FontColor = 0xFFFFFF;

        private enum CraftPage
        {
            None,
            PickResource,
            PickResource2
        }

        /*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
        {
        }*/

        public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool, object notice ) : this( from, craftSystem, tool, notice, CraftPage.None )
        {
        }

        private CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page ) : base( 40, 40 )
        {
            m_From = from;
            m_CraftSystem = craftSystem;
            m_Tool = tool;
            m_Page = page;

            CraftContext context = craftSystem.GetContext( from );

            from.CloseGump( typeof( CraftGump ) );
            from.CloseGump( typeof( CraftGumpItem ) );

            AddPage( 0 );

            AddBackground( 0, 0, 530, 437, 5054 );
            AddImageTiled( 10, 10, 510, 22, 2624 );
            AddImageTiled( 10, 292, 150, 45, 2624 );
            AddImageTiled( 165, 292, 355, 45, 2624 );
            AddImageTiled( 10, 342, 510, 85, 2624 );
            AddImageTiled( 10, 37, 200, 250, 2624 );
            AddImageTiled( 215, 37, 305, 250, 2624 );
            AddAlphaRegion( 10, 10, 510, 417 );

            if ( craftSystem.GumpTitleNumber > 0 )
                AddHtmlLocalized( 10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false );
            else
                AddHtml( 10, 12, 510, 20, craftSystem.GumpTitleString, false, false );

            AddHtmlLocalized( 10, 37, 200, 22, 1044010, LabelColor, false, false ); // <CENTER>CATEGORIES</CENTER>
            AddHtmlLocalized( 215, 37, 305, 22, 1044011, LabelColor, false, false ); // <CENTER>SELECTIONS</CENTER>
            AddHtmlLocalized( 10, 302, 150, 25, 1044012, LabelColor, false, false ); // <CENTER>NOTICES</CENTER>

            AddButton( 15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 50, 405, 150, 18, 1011441, LabelColor, false, false ); // EXIT

            AddButton( 270, 402, 4005, 4007, GetButtonID( 6, 2 ), GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 305, 405, 150, 18, 1044013, LabelColor, false, false ); // MAKE LAST

            // Mark option
            if ( craftSystem.MarkOption )
            {
                AddButton( 270, 362, 4005, 4007, GetButtonID( 6, 6 ), GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false ); // MARK ITEM
            }
            // ****************************************

            // Resmelt option
            if ( craftSystem.Resmelt )
            {
                AddButton( 15, 342, 4005, 4007, GetButtonID( 6, 1 ), GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 50, 345, 150, 18, 1044259, LabelColor, false, false ); // SMELT ITEM
            }
            // ****************************************

            // Repair option
            if ( craftSystem.Repair )
            {
                AddButton( 270, 342, 4005, 4007, GetButtonID( 6, 5 ), GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 305, 345, 150, 18, 1044260, LabelColor, false, false ); // REPAIR ITEM
            }
            // ****************************************

            // Enhance option
            if ( craftSystem.CanEnhance )
            {
                AddButton( 270, 382, 4005, 4007, GetButtonID( 6, 8 ), GumpButtonType.Reply, 0 );
                AddHtmlLocalized( 305, 385, 150, 18, 1061001, LabelColor, false, false ); // ENHANCE ITEM
            }
            // ****************************************

            if ( notice is int && (int)notice > 0 )
                AddHtmlLocalized( 170, 295, 350, 40, (int)notice, LabelColor, false, false );
            else if ( notice is string )
                AddHtml( 170, 295, 350, 40, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice ), false, false );

            // If the system has more than one resource
            if ( craftSystem.CraftSubRes.Init )
            {
                string nameString = craftSystem.CraftSubRes.NameString;
                int nameNumber = craftSystem.CraftSubRes.NameNumber;

                int resIndex = ( context == null ? -1 : context.LastResourceIndex );

                Type resourceType = craftSystem.CraftSubRes.ResType;

                if ( resIndex > -1 )
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes.GetAt( resIndex );

                    nameString = subResource.NameString;
                    nameNumber = subResource.NameNumber;
                    resourceType = subResource.ItemType;
                }

                int resourceCount = 0;

                if ( from.Backpack != null )
                {
                    Item[] items = from.Backpack.FindItemsByType( resourceType, true );

                    for ( int i = 0; i < items.Length; ++i )
                        resourceCount += items[i].Amount;
                }

                AddButton( 15, 362, 4005, 4007, GetButtonID( 6, 0 ), GumpButtonType.Reply, 0 );

                if ( nameNumber > 0 )
                    AddHtmlLocalized( 50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false );
                else
                    AddLabel( 50, 362, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) );
            }
            // ****************************************

            // For dragon scales
            if ( craftSystem.CraftSubRes2.Init )
            {
                string nameString = craftSystem.CraftSubRes2.NameString;
                int nameNumber = craftSystem.CraftSubRes2.NameNumber;

                int resIndex = ( context == null ? -1 : context.LastResourceIndex2 );

                Type resourceType = craftSystem.CraftSubRes.ResType;

                if ( resIndex > -1 )
                {
                    CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt( resIndex );

                    nameString = subResource.NameString;
                    nameNumber = subResource.NameNumber;
                    resourceType = subResource.ItemType;
                }

                int resourceCount = 0;

                if ( from.Backpack != null )
                {
                    Item[] items = from.Backpack.FindItemsByType( resourceType, true );

                    for ( int i = 0; i < items.Length; ++i )
                        resourceCount += items[i].Amount;
                }

                AddButton( 15, 382, 4005, 4007, GetButtonID( 6, 7 ), GumpButtonType.Reply, 0 );

                if ( nameNumber > 0 )
                    AddHtmlLocalized( 50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false );
                else
                    AddLabel( 50, 385, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) );
            }
            // ****************************************

            CreateGroupList();

            if ( page == CraftPage.PickResource )
                CreateResList( false, from );
            else if ( page == CraftPage.PickResource2 )
                CreateResList( true, from );
            else if ( context != null && context.LastGroupIndex > -1 )
                CreateItemList( context.LastGroupIndex );
        }

        public void CreateResList(bool opt, Mobile from)
        {
            CraftSubResCol res = (opt ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes);

            bool b_RecipeCraft = Daat99OWLTR.Ops[5].Setting,
                b_Blacksmithy = Daat99OWLTR.Ops[18].Setting,
                b_BowFletching = Daat99OWLTR.Ops[19].Setting,
                b_Carpentry = Daat99OWLTR.Ops[20].Setting,
                b_Masonry = Daat99OWLTR.Ops[24].Setting,
                b_Tailoring = Daat99OWLTR.Ops[25].Setting,
                b_Tinkering = Daat99OWLTR.Ops[26].Setting;
            if (b_RecipeCraft)
            {
                NewDaat99Holder dh = (NewDaat99Holder)daat99.Daat99OWLTR.TempHolders[m_From];
                int i_Lenght = 0;
                for (int i = 0; i < res.Count; ++i)
                {
                    int index = i_Lenght % 10;

                    CraftSubRes subResource = res.GetAt(i);
                    if (!dh.Resources.Contains(CraftResources.GetFromType(subResource.ItemType)) || (!b_Blacksmithy && m_CraftSystem is DefBlacksmithy)
                        || (!b_BowFletching && m_CraftSystem is DefBowFletching) || (!b_Carpentry && m_CraftSystem is DefCarpentry)
                        || (!b_Masonry && m_CraftSystem is DefMasonry) || (!b_Tailoring && m_CraftSystem is DefTailoring)
                        || (!b_Tinkering && m_CraftSystem is DefTinkering))
                    {
                        if (index == 0)
                        {
                            if (i > 0)
                                AddButton(485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);

                            AddPage((i / 10) + 1);

                            if (i > 0)
                                AddButton(455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);

                            CraftContext context = m_CraftSystem.GetContext(m_From);

                            AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
                            AddHtmlLocalized(255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false);
                        }

                        AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);

                        if (subResource.NameNumber > 0)
                            AddHtmlLocalized(255, 63 + (index * 20), 250, 18, subResource.NameNumber, LabelColor, false, false);
                        else
                            AddLabel(255, 60 + (index * 20), LabelHue, subResource.NameString);
                        i_Lenght++;
                    }
                }
            }
            else for (int i = 0; i < res.Count; ++i)
                {
                    int index = i % 10;

                    CraftSubRes subResource = res.GetAt(i);

                    if (index == 0)
                    {
                        if (i > 0)
                            AddButton(485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);

                        AddPage((i / 10) + 1);

                        if (i > 0)
                            AddButton(455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);

                        CraftContext context = m_CraftSystem.GetContext(m_From);

                        AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
                        AddHtmlLocalized(255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false);
                    }

                    AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);

                    if (subResource.NameNumber > 0)
                        AddHtmlLocalized(255, 63 + (index * 20), 250, 18, subResource.NameNumber, LabelColor, false, false);
                    else
                        AddLabel(255, 60 + (index * 20), LabelHue, subResource.NameString);
                }
        }

        public void CreateMakeLastList()
        {
            CraftContext context = m_CraftSystem.GetContext( m_From );

            if ( context == null )
                return;

            List<CraftItem> items = context.Items;

            if ( items.Count > 0 )
            {
                for ( int i = 0; i < items.Count; ++i )
                {
                    int index = i % 10;

                    CraftItem craftItem = items[i];

                    if ( index == 0 )
                    {
                        if ( i > 0 )
                        {
                            AddButton( 370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
                            AddHtmlLocalized( 405, 263, 100, 18, 1044045, LabelColor, false, false ); // NEXT PAGE
                        }

                        AddPage( (i / 10) + 1 );

                        if ( i > 0 )
                        {
                            AddButton( 220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
                            AddHtmlLocalized( 255, 263, 100, 18, 1044044, LabelColor, false, false ); // PREV PAGE
                        }
                    }

                    AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 3, i ), GumpButtonType.Reply, 0 );

                    if ( craftItem.NameNumber > 0 )
                        AddHtmlLocalized( 255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false );
                    else
                        AddLabel( 255, 60 + (index * 20), LabelHue, craftItem.NameString );

                    AddButton( 480, 60 + (index * 20), 4011, 4012, GetButtonID( 4, i ), GumpButtonType.Reply, 0 );
                }
            }
            else
            {
                // NOTE: This is not as OSI; it is an intentional difference

                AddHtmlLocalized( 230, 62, 200, 22, 1044165, LabelColor, false, false ); // You haven't made anything yet.
            }
        }

        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501) // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
            CraftGroup craftGroup = craftGroupCol.GetAt(selectedGroup);
            CraftItemCol craftItemCol = craftGroup.CraftItems;

            bool b_BankHive = Daat99OWLTR.Ops[6].Setting,
                b_Houses = Daat99OWLTR.Ops[7].Setting,
                b_Forge = Daat99OWLTR.Ops[8].Setting,
                b_Keys = Daat99OWLTR.Ops[9].Setting,
                b_RecipeCraft = Daat99OWLTR.Ops[5].Setting,
                b_Alchemy = Daat99OWLTR.Ops[17].Setting,
                b_Blacksmithy = Daat99OWLTR.Ops[18].Setting,
                b_BowFletching = Daat99OWLTR.Ops[19].Setting,
                b_Carpentry = Daat99OWLTR.Ops[20].Setting,
                b_Cooking = Daat99OWLTR.Ops[21].Setting,
                b_Glassblowing = Daat99OWLTR.Ops[22].Setting,
                b_Inscription = Daat99OWLTR.Ops[23].Setting,
                b_Masonry = Daat99OWLTR.Ops[24].Setting,
                b_Tailoring = Daat99OWLTR.Ops[25].Setting,
                b_Tinkering = Daat99OWLTR.Ops[26].Setting;
            if (b_RecipeCraft)
            {
                NewDaat99Holder dh = (NewDaat99Holder)daat99.Daat99OWLTR.TempHolders[m_From];

                int i, i_Lenght = 0;

                for (i = 0; i < craftItemCol.Count; ++i)
                {
                    int index = i_Lenght % 10;

                    CraftItem craftItem = craftItemCol.GetAt(i);

                    if (!dh.ItemTypeList.Contains(craftItem.ItemType) || (!b_Alchemy && m_CraftSystem is DefAlchemy)
                        || (!b_Blacksmithy && m_CraftSystem is DefBlacksmithy) || (!b_BowFletching && m_CraftSystem is DefBowFletching)
                        || (!b_Carpentry && m_CraftSystem is DefCarpentry) || (!b_Cooking && m_CraftSystem is DefCooking)
                        || (!b_Glassblowing && m_CraftSystem is DefGlassblowing) || (!b_Inscription && m_CraftSystem is DefInscription)
                        || (!b_Masonry && m_CraftSystem is DefMasonry) || (!b_Tailoring && m_CraftSystem is DefTailoring)
                        || (!b_Tinkering && m_CraftSystem is DefTinkering))
                    {
                        if (index == 0)
                        {
                            if (i_Lenght > 0)
                            {
                                AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i_Lenght / 10) + 1);
                                AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
                            }

                            AddPage((i_Lenght / 10) + 1);

                            if (i_Lenght > 0)
                            {
                                AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i_Lenght / 10);
                                AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
                            }
                        }

                        if (craftItem.NameString == "Bank Hive" && !b_BankHive)
                            continue;
                        else if ((craftItem.NameString == "Tool House" || craftItem.NameString == "Runic House") && !b_Houses)
                            continue;
                        else if (craftItem.NameString == "Mobile Forge" && !b_Forge)
                            continue;
                        else if ((craftItem.NameString == "Spell Casters Key" || craftItem.NameString == "Tailors Key"
                            || craftItem.NameString == "Wood Workers Key" || craftItem.NameString == "Metal Workers Key"
                            || craftItem.NameString == "Stone Workers Key" || craftItem.NameString == "Scribers Tome"
                            || craftItem.NameString == "Bards Stand" || craftItem.NameString == "Alchemist Kit")
                            && !b_Keys)
                            continue;

                        AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                        if (craftItem.NameNumber > 0)
                            AddHtmlLocalized(255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                        else
                            AddLabel(255, 60 + (index * 20), LabelHue, craftItem.NameString);

                        AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                        i_Lenght++;
                    }
                }
            }
            else for (int i = 0; i < craftItemCol.Count; ++i)
                {
                    int index = i % 10;

                    CraftItem craftItem = craftItemCol.GetAt(i);

                    if (index == 0)
                    {
                        if (i > 0)
                        {
                            AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                            AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
                        }

                        AddPage((i / 10) + 1);

                        if (i > 0)
                        {
                            AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                            AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
                        }
                    }

                    if (craftItem.NameString == "Bank Hive" && !b_BankHive)
                        continue;
                    else if ((craftItem.NameString == "Tool House" || craftItem.NameString == "Runic House") && !b_Houses)
                        continue;
                    else if (craftItem.NameString == "Mobile Forge" && !b_Forge)
                        continue;
                    else if ((craftItem.NameString == "Spell Casters Key" || craftItem.NameString == "Tailors Key"
                        || craftItem.NameString == "Wood Workers Key" || craftItem.NameString == "Metal Workers Key"
                        || craftItem.NameString == "Stone Workers Key" || craftItem.NameString == "Scribers Tome")
                        && !b_Keys)
                        continue;

                    AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                    if (craftItem.NameNumber > 0)
                        AddHtmlLocalized(255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false);
                    else
                        AddLabel(255, 60 + (index * 20), LabelHue, craftItem.NameString);

                    AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
                }
        }

        public int CreateGroupList()
        {
            CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;

            AddButton( 15, 60, 4005, 4007, GetButtonID( 6, 3 ), GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 50, 63, 150, 18, 1044014, LabelColor, false, false ); // LAST TEN

            for ( int i = 0; i < craftGroupCol.Count; i++ )
            {
                CraftGroup craftGroup = craftGroupCol.GetAt( i );

                AddButton( 15, 80 + (i * 20), 4005, 4007, GetButtonID( 0, i ), GumpButtonType.Reply, 0 );

                if ( craftGroup.NameNumber > 0 )
                    AddHtmlLocalized( 50, 83 + (i * 20), 150, 18, craftGroup.NameNumber, LabelColor, false, false );
                else
                    AddLabel( 50, 80 + (i * 20), LabelHue, craftGroup.NameString );
            }

            return craftGroupCol.Count;
        }

        public static int GetButtonID( int type, int index )
        {
            return 1 + type + (index * 7);
        }

        public void CraftItem( CraftItem item )
        {
            int num = m_CraftSystem.CanCraft( m_From, m_Tool, item.ItemType );

            if ( num > 0 )
            {
                m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, num ) );
            }
            else
            {
                Type type = null;

                CraftContext context = m_CraftSystem.GetContext( m_From );

                if ( context != null )
                {
                    CraftSubResCol res = ( item.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
                    int resIndex = ( item.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );

                    if ( resIndex >= 0 && resIndex < res.Count )
                        type = res.GetAt( resIndex ).ItemType;
                }

                m_CraftSystem.CreateItem( m_From, item.ItemType, type, m_Tool, item );
            }
        }

        public override void OnResponse( NetState sender, RelayInfo info )
        {
            if ( info.ButtonID <= 0 )
                return; // Canceled

            int buttonID = info.ButtonID - 1;
            int type = buttonID % 7;
            int index = buttonID / 7;

            CraftSystem system = m_CraftSystem;
            CraftGroupCol groups = system.CraftGroups;
            CraftContext context = system.GetContext( m_From );

            switch ( type )
            {
                case 0: // Show group
                {
                    if ( context == null )
                        break;

                    if ( index >= 0 && index < groups.Count )
                    {
                        context.LastGroupIndex = index;
                        m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
                    }

                    break;
                }
                case 1: // Create item
                {
                    if ( context == null )
                        break;

                    int groupIndex = context.LastGroupIndex;

                    if ( groupIndex >= 0 && groupIndex < groups.Count )
                    {
                        CraftGroup group = groups.GetAt( groupIndex );

                        if ( index >= 0 && index < group.CraftItems.Count )
                            CraftItem( group.CraftItems.GetAt( index ) );
                    }

                    break;
                }
                case 2: // Item details
                {
                    if ( context == null )
                        break;

                    int groupIndex = context.LastGroupIndex;

                    if ( groupIndex >= 0 && groupIndex < groups.Count )
                    {
                        CraftGroup group = groups.GetAt( groupIndex );

                        if ( index >= 0 && index < group.CraftItems.Count )
                            m_From.SendGump( new CraftGumpItem( m_From, system, group.CraftItems.GetAt( index ), m_Tool ) );
                    }

                    break;
                }
                case 3: // Create item (last 10)
                {
                    if ( context == null )
                        break;

                    List<CraftItem> lastTen = context.Items;

                    if ( index >= 0 && index < lastTen.Count )
                        CraftItem( lastTen[index] );

                    break;
                }
                case 4: // Item details (last 10)
                {
                    if ( context == null )
                        break;

                    List<CraftItem> lastTen = context.Items;

                    if ( index >= 0 && index < lastTen.Count )
                        m_From.SendGump( new CraftGumpItem( m_From, system, lastTen[index], m_Tool ) );

                    break;
                }
                case 5: // Resource selected
                {
                    if ( m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count )
                    {
                        int groupIndex = ( context == null ? -1 : context.LastGroupIndex );

                        CraftSubRes res = system.CraftSubRes.GetAt( index );

                        if ( m_From.Skills[system.MainSkill].Base < res.RequiredSkill )
                        {
                            m_From.SendGump( new CraftGump( m_From, system, m_Tool, res.Message ) );
                        }
                        else
                        {
                            if ( context != null )
                                context.LastResourceIndex = index;

                            m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
                        }
                    }
                    else if ( m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count )
                    {
                        int groupIndex = ( context == null ? -1 : context.LastGroupIndex );

                        CraftSubRes res = system.CraftSubRes2.GetAt( index );

                        if ( m_From.Skills[system.MainSkill].Base < res.RequiredSkill )
                        {
                            m_From.SendGump( new CraftGump( m_From, system, m_Tool, res.Message ) );
                        }
                        else
                        {
                            if ( context != null )
                                context.LastResourceIndex2 = index;

                            m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
                        }
                    }

                    break;
                }
                case 6: // Misc. buttons
                {
                    switch ( index )
                    {
                        case 0: // Resource selection
                        {
                            if ( system.CraftSubRes.Init )
                                m_From.SendGump( new CraftGump( m_From, system, m_Tool, null, CraftPage.PickResource ) );

                            break;
                        }
                        case 1: // Smelt item
                        {
                            if ( system.Resmelt )
                                Resmelt.Do( m_From, system, m_Tool );

                            break;
                        }
                        case 2: // Make last
                        {
                            if ( context == null )
                                break;

                            CraftItem item = context.LastMade;

                            if ( item != null )
                                CraftItem( item );
                            else
                                m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, 1044165, m_Page ) ); // You haven't made anything yet.

                            break;
                        }
                        case 3: // Last 10
                        {
                            if ( context == null )
                                break;

                            context.LastGroupIndex = 501;
                            m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );

                            break;
                        }
                        case 4: // Toggle use resource hue
                        {
                            if ( context == null )
                                break;

                            context.DoNotColor = !context.DoNotColor;

                            m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, null, m_Page ) );

                            break;
                        }
                        case 5: // Repair item
                        {
                            if ( system.Repair )
                                Repair.Do( m_From, system, m_Tool );

                            break;
                        }
                        case 6: // Toggle mark option
                        {
                            if ( context == null || !system.MarkOption )
                                break;

                            switch ( context.MarkOption )
                            {
                                case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break;
                                case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break;
                                case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break;
                            }

                            m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, null, m_Page ) );

                            break;
                        }
                        case 7: // Resource selection 2
                        {
                            if ( system.CraftSubRes2.Init )
                                m_From.SendGump( new CraftGump( m_From, system, m_Tool, null, CraftPage.PickResource2 ) );

                            break;
                        }
                        case 8: // Enhance item
                        {
                            if ( system.CanEnhance )
                                Enhance.BeginTarget( m_From, system, m_Tool );

                            break;
                        }
                    }

                    break;
                }
            }
        }
    }
}




and DefCarpentry.cs

Code:
using System;
using Server.Items;

namespace Server.Engines.Craft
{
    #region Mondain's Legacy
    public enum CarpRecipes
    {
        // stuff
        WarriorStatueSouth         = 100,
        WarriorStatueEast         = 101,
        SquirrelStatueSouth         = 102,
        SquirrelStatueEast         = 103,
        AcidProofRope             = 104,
        OrnateElvenChair         = 105,
        ArcaneBookshelfSouth        = 106,
        ArcaneBookshelfEast        = 107,
        OrnateElvenChestSouth        = 108,
        ElvenDresserSouth        = 109,
        ElvenDresserEast        = 110,
        FancyElvenArmoire        = 111,        
        ArcanistsWildStaff         = 112,
        AncientWildStaff        = 113,
        ThornedWildStaff         = 114,
        HardenedWildStaff         = 115,        
        TallElvenBedSouth         = 116,
        TallElvenBedEast         = 117,
        StoneAnvilSouth            = 118,
        StoneAnvilEast            = 119,
        OrnateElvenChestEast        = 120,
        
        // arties
        PhantomStaff             = 150,
        IronwoodCrown             = 151,
        BrambleCoat             = 152
    }
    #endregion

    public class DefCarpentry : CraftSystem
    {
        public override SkillName MainSkill
        {
            get    { return SkillName.Carpentry;    }
        }

        public override int GumpTitleNumber
        {
            get { return 1044004; } // <CENTER>CARPENTRY MENU</CENTER>
        }

        private static CraftSystem m_CraftSystem;

        public static CraftSystem CraftSystem
        {
            get
            {
                if ( m_CraftSystem == null )
                    m_CraftSystem = new DefCarpentry();

                return m_CraftSystem;
            }
        }
        
        public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }

        public override double GetChanceAtMin( CraftItem item )
        {
            return 0.5; // 50%
        }

        private DefCarpentry() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 )
        {
        }

        public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
        {
            if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
                return 1044038; // You have worn out your tool!
            else if ( !BaseTool.CheckAccessible( tool, from ) )
                return 1044263; // The tool must be on your person to use.

            return 0;
        }

        public override void PlayCraftEffect( Mobile from )
        {
            // no animation
            //if ( from.Body.Type == BodyType.Human && !from.Mounted )
            //    from.Animate( 9, 5, 1, true, false, 0 );

            from.PlaySound( 0x23D );
        }

        public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
        {
            if ( toolBroken )
                from.SendLocalizedMessage( 1044038 ); // You have worn out your tool

            if ( failed )
            {
                if ( lostMaterial )
                    return 1044043; // You failed to create the item, and some of your materials are lost.
                else
                    return 1044157; // You failed to create the item, but no materials were lost.
            }
            else
            {
                if ( quality == 0 )
                    return 502785; // You were barely able to make this item.  It's quality is below average.
                else if ( makersMark && quality == 2 )
                    return 1044156; // You create an exceptional quality item and affix your maker's mark.
                else if ( quality == 2 )
                    return 1044155; // You create an exceptional quality item.
                else                
                    return 1044154; // You create the item.
            }
        }

        public override void InitCraftList()
        {
            int index = -1;

            // Other Items
            if ( Core.Expansion == Expansion.AOS || Core.Expansion == Expansion.SE )
            {
                index =    AddCraft( typeof( Board ),                1044294, 1027127,     0.0,   0.0,    typeof( Log ), 1044466,  1, 1044465 );
                SetUseAllRes( index, true );
            }

//            AddCraft( typeof( BarrelStaves ),                1044294, 1027857,    00.0,  25.0,    typeof( Log ), 1044041,  5, 1044351 );
//            AddCraft( typeof( BarrelLid ),                    1044294, 1027608,    11.0,  36.0,    typeof( Log ), 1044041,  4, 1044351 );
            AddCraft( typeof( ShortMusicStand ),            1044294, 1044313,    78.9, 103.9,    typeof( Log ), 1044041, 15, 1044351 );
            AddCraft( typeof( TallMusicStand ),                1044294, 1044315,    81.5, 106.5,    typeof( Log ), 1044041, 20, 1044351 );
            AddCraft( typeof( Easle ),                        1044294, 1044317,    86.8, 111.8,    typeof( Log ), 1044041, 20, 1044351 );
            if( Core.SE )
            {
                index = AddCraft( typeof( RedHangingLantern ), 1044294, 1029412, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 );
                AddRes( index, typeof( BlankScroll ), 1044377, 10, 1044378 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( WhiteHangingLantern ), 1044294, 1029416, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 );
                AddRes( index, typeof( BlankScroll ), 1044377, 10, 1044378 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( ShojiScreen ), 1044294, 1029423, 80.0, 105.0, typeof( Log ), 1044041, 75, 1044351 );
                AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
                AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( BambooScreen ), 1044294, 1029428, 80.0, 105.0, typeof( Log ), 1044041, 75, 1044351 );
                AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
                AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
                SetNeededExpansion( index, Expansion.SE );
            }

            if( Core.AOS )    //Duplicate Entries to preserve ordering depending on era 
            {
                index = AddCraft( typeof( FishingPole ), 1044294, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the categor of Other during AoS
                AddSkill( index, SkillName.Tailoring, 40.0, 45.0 );
                AddRes( index, typeof( Cloth ), 1044286, 5, 1044287 );
                
                #region Mondain's Legacy
                if ( Core.ML )
                {
                    index = AddCraft( typeof( WoodenContainerEngraver ), 1044294, 1072153, 75.0, 100.0, typeof( Log ), 1044041, 4, 1044351 );
                    AddRes( index, typeof( IronIngot ), 1044036, 2, 1044037 );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( RunedSwitch ), 1044294, 1072896, 70.0, 120.0, typeof( Log ), 1044041, 2, 1044351 );
                    AddRes( index, typeof( EnchantedSwitch ), 1072893, 1, 1053098 );
                    AddRes( index, typeof( RunedPrism ), 1073465, 1, 1053098 );
                    AddRes( index, typeof( JeweledFiligree ), 1072894, 1, 1053098 );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( ArcanistStatueSouthDeed ), 1044294, 1072885, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( ArcanistStatueEastDeed ), 1044294, 1072886, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( WarriorStatueSouthDeed ), 1044294, 1072887, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    AddRecipe( index, (int) CarpRecipes.WarriorStatueSouth );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( WarriorStatueEastDeed ), 1044294, 1072888, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    AddRecipe( index, (int) CarpRecipes.WarriorStatueEast );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( SquirrelStatueSouthDeed ), 1044294, 1072884, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    AddRecipe( index, (int) CarpRecipes.SquirrelStatueSouth );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( SquirrelStatueEastDeed ), 1044294, 1073398, 0.0, 35.0, typeof( Log ), 1044041, 250, 1044351 );
                    AddRecipe( index, (int) CarpRecipes.SquirrelStatueEast );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( GiantReplicaAcorn ), 1044294, 1072889, 80.0, 105.0, typeof( Log ), 1044041, 35, 1044351 );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( MountedDreadHorn ), 1044294, 1032632, 90.0, 115.0, typeof( Log ), 1044041, 50, 1044351 );
                    AddRes( index, typeof( PristineDreadHorn ), 1032634, 1, 1053098 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( AcidProofRope ), 1044294, 1074886, 80, 130.0, typeof( GreaterStrengthPotion ), 1073466, 2, 1044253 );
                    AddRes( index, typeof( ProtectionScroll ), 1044395, 1, 1053098 );
                    AddRes( index, typeof( SwitchItem ), 1032127, 1, 1053098 );
                    AddRecipe( index, (int) CarpRecipes.AcidProofRope );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                }
                #endregion
            }



            // Furniture
            AddCraft( typeof( FootStool ),                    1044291, 1022910,    11.0,  36.0,    typeof( Log ), 1044041,  9, 1044351 );
            AddCraft( typeof( Stool ),                        1044291, 1022602,    11.0,  36.0,    typeof( Log ), 1044041,  9, 1044351 );
            AddCraft( typeof( BambooChair ),                1044291, 1044300,    21.0,  46.0,    typeof( Log ), 1044041, 13, 1044351 );
            AddCraft( typeof( WoodenChair ),                1044291, 1044301,    21.0,  46.0,    typeof( Log ), 1044041, 13, 1044351 );
            AddCraft( typeof( FancyWoodenChairCushion ),    1044291, 1044302,    42.1,  67.1,    typeof( Log ), 1044041, 15, 1044351 );
            AddCraft( typeof( WoodenChairCushion ),            1044291, 1044303,    42.1,  67.1,    typeof( Log ), 1044041, 13, 1044351 );
            AddCraft( typeof( WoodenBench ),                1044291, 1022860,    52.6,  77.6,    typeof( Log ), 1044041, 17, 1044351 );
            AddCraft( typeof( WoodenThrone ),                1044291, 1044304,    52.6,  77.6,    typeof( Log ), 1044041, 17, 1044351 );
            AddCraft( typeof( Throne ),                        1044291, 1044305,    73.6,  98.6,    typeof( Log ), 1044041, 19, 1044351 );
            AddCraft( typeof( Nightstand ),                    1044291, 1044306,    42.1,  67.1,    typeof( Log ), 1044041, 17, 1044351 );
            AddCraft( typeof( WritingTable ),                1044291, 1022890,    63.1,  88.1,    typeof( Log ), 1044041, 17, 1044351 );
            AddCraft( typeof( YewWoodTable ),                1044291, 1044307,    63.1,  88.1,    typeof( Log ), 1044041, 23, 1044351 );
            AddCraft( typeof( LargeTable ),                    1044291, 1044308,    84.2, 109.2,    typeof( Log ), 1044041, 27, 1044351 );

            if( Core.SE )
            {
                index = AddCraft( typeof( ElegantLowTable ),    1044291, 1030265,    80.0, 105.0,    typeof( Log ), 1044041, 35, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( PlainLowTable ),        1044291, 1030266,    80.0, 105.0,    typeof( Log ), 1044041, 35, 1044351 );
                SetNeededExpansion( index, Expansion.SE );
                
                #region Mondain's Legacy
                if ( Core.ML )
                {
                    index = AddCraft( typeof( OrnateElvenTableSouthDeed ), 1044291, 1072869, 85.0, 110.0, typeof( Log ), 1044041, 60, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( OrnateElvenTableEastDeed ), 1044291, 1073384, 85.0, 110.0, typeof( Log ), 1044041, 60, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( FancyElvenTableSouthDeed ), 1044291, 1073385, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( FancyElvenTableEastDeed ), 1044291, 1073386, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 );
                    ForceNonExceptional( index );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( ElvenPodium ), 1044291, 1073399, 80.0, 105.0, typeof( Log ), 1044041, 20, 1044351 );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( OrnateElvenChair ), 1044291, 1072870, 80.0, 105.0, typeof( Log ), 1044041, 30, 1044351 );
                    AddRecipe( index, (int) CarpRecipes.OrnateElvenChair );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( BigElvenChair ), 1044291, 1072872, 85.0, 110.0, typeof( Log ), 1044041, 40, 1044351 );
                    SetNeededExpansion( index, Expansion.ML );
                    
                    index = AddCraft( typeof( ElvenReadingChair ), 1044291, 1072873, 80.0, 105.0, typeof( Log ), 1044041, 30, 1044351 );
                    SetNeededExpansion( index, Expansion.ML );
                }
                #endregion
            }

            // Containers
            AddCraft( typeof( WoodenBox ),                    1044292, 1023709,    21.0,  46.0,    typeof( Log ), 1044041, 10, 1044351 );
            AddCraft( typeof( SmallCrate ),                    1044292, 1044309,    10.0,  35.0,    typeof( Log ), 1044041, 8 , 1044351 );
            AddCraft( typeof( MediumCrate ),                1044292, 1044310,    31.0,  56.0,    typeof( Log ), 1044041, 15, 1044351 );
            AddCraft( typeof( LargeCrate ),                    1044292, 1044311,    47.3,  72.3,    typeof( Log ), 1044041, 18, 1044351 );
            AddCraft( typeof( WoodenChest ),                1044292, 1023650,    73.6,  98.6,    typeof( Log ), 1044041, 20, 1044351 );
            AddCraft( typeof( EmptyBookcase ),                1044292, 1022718,    31.5,  56.5,    typeof( Log ), 1044041, 25, 1044351 );
            AddCraft( typeof( FancyArmoire ),                1044292, 1044312,    84.2, 109.2,    typeof( Log ), 1044041, 35, 1044351 );
            AddCraft( typeof( Armoire ),                    1044292, 1022643,    84.2, 109.2,    typeof( Log ), 1044041, 35, 1044351 );    

            if( Core.SE )
            {
                index = AddCraft( typeof( PlainWoodenChest ),    1044292, 1030251, 90.0, 115.0,    typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( OrnateWoodenChest ),    1044292, 1030253, 90.0, 115.0,    typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( GildedWoodenChest ),    1044292, 1030255, 90.0, 115.0,    typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( WoodenFootLocker ),    1044292, 1030257, 90.0, 115.0,    typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( FinishedWoodenChest ),1044292, 1030259, 90.0, 115.0,    typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( TallCabinet ),    1044292, 1030261, 90.0, 115.0,    typeof( Log ), 1044041, 35, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( ShortCabinet ),    1044292, 1030263, 90.0, 115.0,    typeof( Log ), 1044041, 35, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( RedArmoire ),    1044292, 1030328, 90.0, 115.0,    typeof( Log ), 1044041, 40, 1044351 );
                SetNeededExpansion( index, Expansion.SE );
                
                index = AddCraft( typeof( ElegantArmoire ),    1044292, 1030330, 90.0, 115.0,    typeof( Log ), 1044041, 40, 1044351 );
                SetNeededExpansion( index, Expansion.SE );
                
                index = AddCraft( typeof( MapleArmoire ),    1044292, 1030328, 90.0, 115.0,    typeof( Log ), 1044041, 40, 1044351 );
                SetNeededExpansion( index, Expansion.SE );
                
                index = AddCraft( typeof( CherryArmoire ),    1044292, 1030328, 90.0, 115.0,    typeof( Log ), 1044041, 40, 1044351 );
                SetNeededExpansion( index, Expansion.SE );
            }

            index = AddCraft( typeof( Keg ), 1044292, 1023711, 57.8, 82.8, typeof( BarrelStaves ), 1044288, 3, 1044253 );
            AddRes( index, typeof( BarrelHoops ), 1044289, 1, 1044253 );
            AddRes( index, typeof( BarrelLid ), 1044251, 1, 1044253 );

            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( ArcaneBookshelfSouthDeed ), 1044292, 1072871, 94.7, 119.7, typeof( Log ), 1044041, 80, 1044351 );
                AddRecipe( index, (int) CarpRecipes.ArcaneBookshelfSouth );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( ArcaneBookshelfEastDeed ), 1044292, 1073371, 94.7, 119.7, typeof( Log ), 1044041, 80, 1044351 );
                AddRecipe( index, (int) CarpRecipes.ArcaneBookshelfEast );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( OrnateElvenChestSouthDeed ), 1044292, 1072862, 94.7, 119.7, typeof( Log ), 1044041, 40, 1044351 );
                AddRecipe( index, (int) CarpRecipes.OrnateElvenChestSouth );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( OrnateElvenChestEastDeed ), 1044292, 1073383, 94.7, 119.7, typeof( Log ), 1044041, 40, 1044351 );
                AddRecipe( index, (int) CarpRecipes.OrnateElvenChestEast );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenWashBasinSouthDeed ), 1044292, 1072865, 70.0, 95.0, typeof( Log ), 1044041, 40, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenWashBasinEastDeed ), 1044292, 1073387, 70.0, 95.0, typeof( Log ), 1044041, 40, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenDresserSouthDeed ), 1044292, 1072864, 75.0, 100.0, typeof( Log ), 1044041, 45, 1044351 );
                AddRecipe( index, (int) CarpRecipes.ElvenDresserSouth );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( ElvenDresserEastDeed ), 1044292, 1073388, 75.0, 100.0, typeof( Log ), 1044041, 45, 1044351 );
                AddRecipe( index, (int) CarpRecipes.ElvenDresserEast );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( FancyElvenArmoire ), 1044292, 1072866, 80.0, 105.0, typeof( Log ), 1044041, 60, 1044351 );
                AddRecipe( index, (int) CarpRecipes.FancyElvenArmoire );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( SimpleElvenArmoire ), 1044292, 1073401, 80.0, 105.0, typeof( Log ), 1044041, 60, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( RarewoodChest ), 1044292, 1073402, 80.0, 105.0, typeof( Log ), 1044041, 30, 1044351 );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( DecorativeBox ), 1044292, 1073403, 80.0, 105.0, typeof( Log ), 1044041, 25, 1044351 );
                SetNeededExpansion( index, Expansion.ML );    
            }
            #endregion

            index = AddCraft( typeof( Keg ), 1044292, 1023711, 57.8, 82.8, typeof( BarrelStaves ), 1044288, 3, 1044253 );
            AddRes( index, typeof( BarrelHoops ), 1044289, 1, 1044253 );
            AddRes( index, typeof( BarrelLid ), 1044251, 1, 1044253 );

            

            // Weapons
            AddCraft( typeof( ShepherdsCrook ), 1044566, 1023713, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 );
            AddCraft( typeof( QuarterStaff ), 1044566, 1023721, 73.6, 98.6, typeof( Log ), 1044041, 6, 1044351 );
            AddCraft( typeof( GnarledStaff ), 1044566, 1025112, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 );

            if( Core.SE )
            {
                index = AddCraft( typeof( Bokuto ), 1044566, 1030227, 70.0, 95.0, typeof( Log ), 1044041, 6, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( Fukiya ), 1044566, 1030229, 60.0, 85.0, typeof( Log ), 1044041, 6, 1044351 );
                SetNeededExpansion( index, Expansion.SE );

                index = AddCraft( typeof( Tetsubo ), 1044566, 1030225, 85.0, 110.0, typeof( Log ), 1044041, 8, 1044351 );
                AddSkill( index, SkillName.Tinkering, 40.0, 45.0 );
                AddRes( index, typeof( IronIngot ), 1044036, 5, 1044037 );
                SetNeededExpansion( index, Expansion.SE );
            }

            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( PhantomStaff ), 1044566, 1072919, 90.0, 130.0, typeof( Log ), 1044041, 16, 1044351 );
                AddRes( index, typeof( DiseasedBark ), 1032683, 1, 1053098 );
                AddRes( index, typeof( Putrefication ), 1032678, 10, 1053098 );
                AddRes( index, typeof( Taint ), 1032679, 10, 1053098 );
                AddRecipe( index, (int) CarpRecipes.PhantomStaff );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( ArcanistsWildStaff ), 1044566, 1073549, 63.8, 113.8, typeof( Log ), 1044041, 16, 1044351 );
                AddRes( index, typeof( WhitePearl ), 1026253, 1, 1053098 );
                AddRecipe( index, (int) CarpRecipes.ArcanistsWildStaff );    
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( AncientWildStaff ), 1044566, 1073550, 63.8, 113.8, typeof( Log ), 1044041, 16, 1044351 );
                AddRes( index, typeof( PerfectEmerald ), 1026251, 1, 1053098 );
                AddRecipe( index, (int) CarpRecipes.AncientWildStaff );    
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( ThornedWildStaff ), 1044566, 1073551, 63.8, 113.8, typeof( Log ), 1044041, 16, 1044351 );
                AddRes( index, typeof( FireRuby ), 1026254, 1, 1053098 );
                AddRecipe( index, (int) CarpRecipes.ThornedWildStaff );    
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( HardenedWildStaff ), 1044566, 1073552, 63.8, 113.8, typeof( Log ), 1044041, 16, 1044351 );
                AddRes( index, typeof( Turquoise ), 1026250, 1, 1053098 );
                AddRecipe( index, (int) CarpRecipes.HardenedWildStaff );    
                SetNeededExpansion( index, Expansion.ML );    
            }
            #endregion
            
            // Armor
            AddCraft( typeof( WoodenShield ), 1062760, 1027034, 52.6, 77.6, typeof( Log ), 1044041, 9, 1044351 );
            
            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( WoodlandChest ), 1062760, 1031111, 90.0, 115.0, typeof( Log ), 1044041, 20, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 6, 1053098 );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( WoodlandArms ), 1062760, 1031116, 80.0, 105.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( WoodlandGloves ), 1062760, 1031114, 85.0, 110.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( WoodlandLegs ), 1062760, 1031115, 85.0, 110.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                SetNeededExpansion( index, Expansion.ML );    
                
                index = AddCraft( typeof( WoodlandGorget ), 1062760, 1031113, 85.0, 110.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( RavenHelm ), 1062760, 1031121, 65.0, 115.0, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                AddRes( index, typeof( Feather ), 1027123, 25, 1053098 );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( VultureHelm ), 1062760, 1031122, 63.9, 113.9, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                AddRes( index, typeof( Feather ), 1027123, 25, 1053098 );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( WingedHelm ), 1062760, 1031123, 58.4, 108.4, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( BarkFragment ), 1032687, 4, 1053098 );
                AddRes( index, typeof( Feather ), 1027123, 60, 1053098 );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( IronwoodCrown ), 1062760, 1072924, 85.0, 120.0, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( DiseasedBark ), 1032683, 1, 1053098 );
                AddRes( index, typeof( Corruption ), 1032676, 10, 1053098 );
                AddRes( index, typeof( Putrefication ), 1032678, 10, 1053098 );
                AddRecipe( index, (int) CarpRecipes.IronwoodCrown );
                ForceNonExceptional( index );            
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( BrambleCoat ), 1062760, 1072925, 85.0, 120.0, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( DiseasedBark ), 1032683, 1, 1053098 );
                AddRes( index, typeof( Taint ), 1032679, 10, 1053098 );
                AddRes( index, typeof( Scourge ), 1032677, 10, 1053098 );
                AddRecipe( index, (int) CarpRecipes.BrambleCoat );
                ForceNonExceptional( index );            
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodCrown ), 1062760, 1073481, 85.0, 120.0, typeof( Log ), 1044041, 10, 1044351 );
                AddRes( index, typeof( LardOfParoxysmus ), 1032681, 1, 1053098 );
                AddRes( index, typeof( Blight ), 1032675, 10, 1053098 );
                AddRes( index, typeof( Taint ), 1032679, 10, 1053098 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodChest ), 1062760, 1073482, 85.0, 120.0, typeof( Log ), 1044041, 20, 1044351 );
                AddRes( index, typeof( DreadHornMane ), 1032682, 1, 1053098 );
                AddRes( index, typeof( Corruption ), 1032676, 10, 1053098 );
                AddRes( index, typeof( Muculent ), 1032680, 10, 1053098 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodGorget ), 1062760, 1073483, 85.0, 120.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( DiseasedBark ), 1032683, 1, 1053098 );
                AddRes( index, typeof( Blight ), 1032675, 10, 1053098 );
                AddRes( index, typeof( Scourge ), 1032677, 10, 1053098 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodLegs ), 1062760, 1073484, 85.0, 120.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( GrizzledBones ), 1032684, 1, 1053098 );
                AddRes( index, typeof( Corruption ), 1032676, 10, 1053098 );
                AddRes( index, typeof( Putrefication ), 1072137, 10, 1053098 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodPauldrons ), 1062760, 1073485, 85.0, 120.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( EyeOfTheTravesty ), 1032685, 1, 1053098 );
                AddRes( index, typeof( Scourge ), 1032677, 10, 1053098 );
                AddRes( index, typeof( Taint ), 1032679, 10, 1053098 );
                ForceNonExceptional( index );    
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( DarkwoodGloves ), 1062760, 1073486, 85.0, 120.0, typeof( Log ), 1044041, 15, 1044351 );
                AddRes( index, typeof( CapturedEssence ), 1032686, 1, 1053098 );
                AddRes( index, typeof( Putrefication ), 1032678, 10, 1053098 );
                AddRes( index, typeof( Muculent ), 1032680, 10, 1053098 );
                ForceNonExceptional( index );            
                SetNeededExpansion( index, Expansion.ML );
            }
            #endregion

            // Instruments
            index = AddCraft( typeof( LapHarp ), 1044293, 1023762, 63.1, 88.1, typeof( Log ), 1044041, 20, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );

            index = AddCraft( typeof( Harp ), 1044293, 1023761, 78.9, 103.9, typeof( Log ), 1044041, 35, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 15, 1044287 );
            
            index = AddCraft( typeof( Drums ), 1044293, 1023740, 57.8, 82.8, typeof( Log ), 1044041, 20, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
            
            index = AddCraft( typeof( Lute ), 1044293, 1023763, 68.4, 93.4, typeof( Log ), 1044041, 25, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
            
            index = AddCraft( typeof( Tambourine ), 1044293, 1023741, 57.8, 82.8, typeof( Log ), 1044041, 15, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );

            index = AddCraft( typeof( TambourineTassel ), 1044293, 1044320, 57.8, 82.8, typeof( Log ), 1044041, 15, 1044351 );
            AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
            AddRes( index, typeof( Cloth ), 1044286, 15, 1044287 );    

            if( Core.SE )
            {
                index = AddCraft( typeof( BambooFlute ), 1044293, 1030247, 80.0, 105.0, typeof( Log ), 1044041, 15, 1044351 );
                AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
                SetNeededExpansion( index, Expansion.SE );
            }

            // Misc
            AddCraft( typeof( DartBoardSouthDeed ), 1044290, 1044325, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
            AddCraft( typeof( DartBoardEastDeed ), 1044290, 1044326, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
            
            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( ParrotPerchAddonDeed ), 1044290, 1072617, 50.0, 85.0, typeof( Log ), 1044041, 100, 1044351 );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
            
                index = AddCraft( typeof( ArcaneCircleDeed ), 1044290, 1072703, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
                AddRes( index, typeof( BlueDiamond ), 1026255, 2, 1053098 );
                AddRes( index, typeof( PerfectEmerald ), 1026251, 2, 1053098 );
                AddRes( index, typeof( FireRuby ), 1026254, 2, 1053098 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( TallElvenBedSouthDeed ), 1044290, 1072858, 94.7, 119.7, typeof( Log ), 1044041, 200, 1044351 );
                AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );            
                AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
                AddRecipe( index, (int) CarpRecipes.TallElvenBedSouth );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( TallElvenBedEastDeed ), 1044290, 1072859, 94.7, 119.7, typeof( Log ), 1044041, 200, 1044351 );
                AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
                AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
                AddRecipe( index, (int) CarpRecipes.TallElvenBedEast );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenBedSouthDeed ), 1044290, 1072860, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
                AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenBedEastDeed ), 1044290, 1072861, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
                AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenLoveseatSouthDeed ), 1044290, 1072867, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenLoveseatEastDeed ), 1044290, 1073372, 80.0, 105.0, typeof( Log ), 1044041, 50, 1044351 );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( AlchemistTableSouthDeed ), 1044290, 1074902, 85.0, 110.0, typeof( Log ), 1044041, 70, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( AlchemistTableEastDeed ), 1044290, 1074903, 85.0, 110.0, typeof( Log ), 1044041, 70, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
            }
            #endregion
            
            index = AddCraft( typeof( SmallBedSouthDeed ), 1044290, 1044321, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
            AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
            index = AddCraft( typeof( SmallBedEastDeed ), 1044290, 1044322, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
            AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
            index = AddCraft( typeof( LargeBedSouthDeed ), 1044290,1044323, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 );
            AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
            AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 );
            index = AddCraft( typeof( LargeBedEastDeed ), 1044290, 1044324, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 );
            AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
            AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 );
            AddCraft( typeof( DartBoardSouthDeed ), 1044290, 1044325, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
            AddCraft( typeof( DartBoardEastDeed ), 1044290, 1044326, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
            AddCraft( typeof( BallotBoxDeed ), 1044290, 1044327, 47.3, 72.3, typeof( Log ), 1044041, 5, 1044351 );
            index = AddCraft( typeof( PentagramDeed ), 1044290, 1044328, 100.0, 125.0, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Magery, 75.0, 80.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 40, 1044037 );
            index = AddCraft( typeof( AbbatoirDeed ), 1044290, 1044329, 100.0, 125.0, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Magery, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 40, 1044037 );

            if ( Core.AOS )
            {
                AddCraft( typeof( PlayerBBEast ), 1044290, 1062420, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 );
                AddCraft( typeof( PlayerBBSouth ), 1044290, 1062421, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 );
            }

            // Tailoring and Cooking
            index = AddCraft( typeof( Dressform ), 1044298, 1044339, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
            
            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( ElvenSpinningwheelEastDeed ), 1044298, 1073393, 75.0, 100.0, typeof( Log ), 1044041, 60, 1044351 );
                AddSkill( index, SkillName.Tailoring, 65.0, 85.0 );
                AddRes( index, typeof( Cloth ), 1044286, 40, 1044287 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenSpinningwheelSouthDeed ), 1044298, 1072878, 75.0, 100.0, typeof( Log ), 1044041, 60, 1044351 );
                AddSkill( index, SkillName.Tailoring, 65.0, 85.0 );
                AddRes( index, typeof( Cloth ), 1044286, 40, 1044287 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenStoveSouthDeed ), 1044298, 1073394, 85.0, 110.0, typeof( Log ), 1044041, 80, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
                
                index = AddCraft( typeof( ElvenStoveEastDeed ), 1044298, 1073395, 85.0, 110.0, typeof( Log ), 1044041, 80, 1044351 );
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
            }
            #endregion
            
            
            index = AddCraft( typeof( SpinningwheelEastDeed ), 1044298, 1044341, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( SpinningwheelSouthDeed ), 1044298, 1044342, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( LoomEastDeed ), 1044298, 1044343, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( LoomSouthDeed ), 1044298, 1044344, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            
            index = AddCraft( typeof( StoneOvenEastDeed ), 1044298, 1044345, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
            index = AddCraft( typeof( StoneOvenSouthDeed ), 1044298, 1044346, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
            index = AddCraft( typeof( FlourMillEastDeed ), 1044298, 1044347, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
            index = AddCraft( typeof( FlourMillSouthDeed ), 1044298, 1044348, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
            AddCraft( typeof( WaterTroughEastDeed ), 1044298, 1044349, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );
            AddCraft( typeof( WaterTroughSouthDeed ), 1044298, 1044350, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );    

            // Blacksmithy
            #region Mondain's Legacy
            if ( Core.ML )
            {
                index = AddCraft( typeof( ElvenForgeDeed ), 1044296, 1072875, 94.7, 119.7, typeof( Log ), 1044041, 200, 1044351 );    
                ForceNonExceptional( index );
                SetNeededExpansion( index, Expansion.ML );
            }
            #endregion
            
            index = AddCraft( typeof( SmallForgeDeed ), 1044296, 1044330, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
            AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 75, 1044037 );
            index = AddCraft( typeof( LargeForgeEastDeed ), 1044296, 1044331, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 );
            AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 );
            index = AddCraft( typeof( LargeForgeSouthDeed ), 1044296, 1044332, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 );
            AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 );
            index = AddCraft( typeof( AnvilEastDeed ), 1044296, 1044333, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
            AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 );
            index = AddCraft( typeof( AnvilSouthDeed ), 1044296, 1044334, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
            AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 );

            // Training
            index = AddCraft( typeof( TrainingDummyEastDeed ), 1044297, 1044335, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 );
            AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
            AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
            index = AddCraft( typeof( TrainingDummySouthDeed ), 1044297, 1044336, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 );
            AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
            AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
            index = AddCraft( typeof( PickpocketDipEastDeed ), 1044297, 1044337, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 );
            AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
            AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
            index = AddCraft( typeof( PickpocketDipSouthDeed ), 1044297, 1044338, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 );
            AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
            AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );

            // Tailoring
            index = AddCraft( typeof( Dressform ), 1044298, 1044339, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
            index = AddCraft( typeof( SpinningwheelEastDeed ), 1044298, 1044341, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( SpinningwheelSouthDeed ), 1044298, 1044342, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( LoomEastDeed ), 1044298, 1044343, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
            index = AddCraft( typeof( LoomSouthDeed ), 1044298, 1044344, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
            AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );

            // Cooking
            index = AddCraft( typeof( StoneOvenEastDeed ), 1044299, 1044345, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
            index = AddCraft( typeof( StoneOvenSouthDeed ), 1044299, 1044346, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
            index = AddCraft( typeof( FlourMillEastDeed ), 1044299, 1044347, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
            index = AddCraft( typeof( FlourMillSouthDeed ), 1044299, 1044348, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
            AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
            AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
            AddCraft( typeof( WaterTroughEastDeed ), 1044299, 1044349, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );
            AddCraft( typeof( WaterTroughSouthDeed ), 1044299, 1044350, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );

            SetSubRes(typeof(Log), "Logs");

            AddSubRes(typeof(Log), "Log", 00.0, 0);
            AddSubRes(typeof(PineLog), "Pine", 20.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(AshLog), "Ash", 30.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(MohoganyLog), "Mohogany", 40.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(YewLog), "Yew", 50.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(OakLog), "Oak", 60.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(ZircoteLog), "Zircote", 70.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(EbonyLog), "Ebony", 80.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(BambooLog), "Bamboo", 90.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(HeartwoodLog), "Heartwood", 100.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(BloodwoodLog), "Bloodwood", 110.0, "You have no idea how to work this type of lumber.");
            AddSubRes(typeof(FrostwoodLog), "Frostwood", 119.0, "You have no idea how to work this type of lumber.");
           // AddSubRes(typeof(HeartwoodLog), "Heartwood", 120.5, "You have no idea how to work this type of lumber.");
          //  AddSubRes(typeof(BloodwoodLog), "Bloodwood", 131.0, "You have no idea how to work this type of lumber.");
           // AddSubRes(typeof(FrostwoodLog), "Frostwood", 146.0, "You have no idea how to work this type of lumber.");

            MarkOption = true;
            Repair = Core.AOS;
        }
    }
}

Found problem and fixed.
 

Mahmud100

Sorceror
FS Taming Server crash

Got this crash after dropping pet deed on breeder to get mated pets back.


Server Crash Report
===================

RunUO Version 2.1, Build 3581.36459
Operating System: Microsoft Windows NT 5.2.3790 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 9/25/2010 10:32:28 PM
Mobiles: 5878
Items: 117404
Exception:
System.MissingMethodException: No parameterless constructor defined for this object.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Server.Mobiles.AnimalBreeder.OnDragDrop(Mobile from, Item dropped)
at Server.Item.DropToMobile(Mobile from, Mobile target, Point3D p)
at Server.Mobile.Drop(Mobile to, Point3D loc)
at Server.Network.PacketHandlers.DropReq6017(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

got this one solved
 
Top