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!

Town Crates

Voran

Wanderer
Change:
Code:
public override void GetContextMenuEntries( Mobile from, ArrayList list )
		{
			base.GetContextMenuEntries( from, list );

			if ( from.AccessLevel>=AccessLevel.Seer )
			{
				list.Add( new ChestSpawnEntry( this, from ) ); 
			}
		}
To
Code:
public override void GetContextMenuEntries( Mobile from, ArrayList list )
		{
			base.GetContextMenuEntries( from, list );

			if ( from.AccessLevel>=AccessLevel.GameMaster)
			{
				list.Add( new ChestSpawnEntry( this, from ) ); 
			}
		}
 
H

hudel

Guest
It seems I have a problem with the relocking of this chest. It relocks after a defined period of time but the trap will not be reset. Do I something wrong or is this a bug? :confused:
 

enigma_admin

Wanderer
hudel said:
hmm,... I have the same problem. Can't modify the Stealing.cs. It seems i'm to stupid. Can someone post a modified stealing.cs please....

Simple answer: YES!
 

Attachments

  • Stealing.cs
    8.6 KB · Views: 75

Voran

Wanderer
hudel said:
It seems I have a problem with the relocking of this chest. It relocks after a defined period of time but the trap will not be reset. Do I something wrong or is this a bug? :confused:
They automaticly retrap with a randpm trap set on mine - are you using the posted Trappable Containers? It's possible that, if you're not, is selecting a non-existant trap.
 
:cool: I was looking for something like this I'm working on a daily rares system for my shard and this helps. I just got one courious problem. When I pick the lock on the boxes and set off the trap to see the items inside and try to steal them, it tells me "you can not steal that" I even tried gold coins and got the same message. and a sword and stuff. I thought maybe that it was the facit I was on so I went to fel and got the same thing. Any help on this?

Also I was wondering, Is there any way to make the containers not require stealing? Like for example the barrels in sshame on the OSI shards that (up intill very recently) spawned Bone containers. or the black smith shop barrels in bucsden (tram and fel) and the barrels that spawn Whips in the ranger huts near Skara Brae.

If I need to post any certain File I will jsut let me know what you need to see if I got something wrong in it. I had a little troubble editing the staling.cs so heres my version altho Im not getting any errors and every thing Seems to be ok except for the fact that I can't steal from the boxes :)
Code:
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Items;
using Server.Network;

namespace Server.SkillHandlers
{
	public class Stealing
	{
		public static void Initialize()
		{
			SkillInfo.Table[33].Callback = new SkillUseCallback( OnUse );
		}

		public static readonly bool ClassicMode = false;
		public static readonly bool SuspendOnMurder = false;

		public static bool IsInGuild( Mobile m )
		{
			return ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild );
		}

		public static bool IsInnocentTo( Mobile from, Mobile to )
		{
			return ( Notoriety.Compute( from, (Mobile)to ) == Notoriety.Innocent );
		}

		private class StealingTarget : Target
		{
			private Mobile m_Thief;

			public StealingTarget( Mobile thief ) : base ( 1, false, TargetFlags.None )
			{
				m_Thief = thief;

				AllowNonlocal = true;
			}

			private Item TryStealItem( Item toSteal, ref bool caught )
			{
				Item stolen = null;

				object root = toSteal.RootParent;

				if ( !IsEmptyHanded( m_Thief ) )
				{
					m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
				}
				else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) )
				{
					m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players.
				}
				else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 )
				{
					m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild.
				}
				else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable )
				{
					m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers.
				}
				else if ( root is PlayerVendor )
				{
					m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors.
				}
				else if ( !m_Thief.CanSee( toSteal ) )
				{
					m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen.
				}
				else if ( toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) )
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}
				else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
				{
					m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
				}
				else if ( toSteal.Parent is Mobile )
				{
					m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped.
				}
				else if ( root == m_Thief )
				{
					m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed.
				}
				else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player )
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}
				else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) )
				{
				}
				else
				{
					double w = toSteal.Weight + toSteal.TotalWeight;

					if ( w > 10 )
					{
						m_Thief.SendMessage( "That is too heavy to steal." );
					}
					else
					{
						if ( toSteal.Stackable && toSteal.Amount > 1 )
						{
							int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

							if ( maxAmount < 1 )
								maxAmount = 1;
							else if ( maxAmount > toSteal.Amount )
								maxAmount = toSteal.Amount;

							int amount = Utility.RandomMinMax( 1, maxAmount );

							if ( amount >= toSteal.Amount )
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
									stolen = toSteal;
							}
							else
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
								{
									stolen = toSteal.Dupe( amount );
									toSteal.Amount -= amount;
								}
							}
						}
						else
						{
							int iw = (int)Math.Ceiling( w );
							iw *= 10;

							if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
								stolen = toSteal;
						}

						if ( stolen != null )
							m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
						else
							m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.

						caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
					}
					if (toSteal.Parent is TownCrate)
					{
					double wa = toSteal.Weight + toSteal.TotalWeight;

					if ( wa > 10 )
					{
						m_Thief.SendMessage( "That is too heavy to steal." );
					}
					else
					{
						if ( toSteal.Stackable && toSteal.Amount > 1 )
						{
							int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) );

							if ( amount >= toSteal.Amount )
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
									stolen = toSteal;
							}
							else
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
								{
									stolen = toSteal.Dupe( amount );
									toSteal.Amount -= amount;
								}
							}
						}
						else
						{
							int iw = (int)Math.Ceiling( w );
							iw *= 10;

							if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
								stolen = toSteal;
						}

						if ( stolen != null )
						{
							stolen.Movable=true;
							m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
						}
						else
							m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.

						caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
				  }
			   }
				}

				return stolen;
			}

			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

				Item stolen = null;
				object root = null;
				bool caught = false;

				if ( target is Item )
				{
					root = ((Item)target).RootParent;
					stolen = TryStealItem( (Item)target, ref caught );
				} 
				else if ( target is Mobile )
				{
					Container pack = ((Mobile)target).Backpack;

					if ( pack != null && pack.Items.Count > 0 )
					{
						int randomIndex = Utility.Random( pack.Items.Count );

						root = target;
						stolen = TryStealItem( (Item) pack.Items[randomIndex], ref caught );
					}
				} 
				else 
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}

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

				if ( caught )
				{
					if ( root == null )
					{
						m_Thief.CriminalAction( false );
					}
					else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) )
					{
						m_Thief.CriminalAction( false );
					}
					else if ( root is Mobile )
					{
						Mobile mobRoot = (Mobile)root;

						if ( !IsInGuild( mobRoot ) && IsInnocentTo( m_Thief, mobRoot ) )
							m_Thief.CriminalAction( false );

						string message = String.Format( "You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name );

						foreach ( NetState ns in m_Thief.GetClientsInRange( 8 ) )
						{
							if ( ns != m_Thief.NetState )
								ns.Mobile.SendMessage( message );
						}
					}
				}
				else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) )
				{
					m_Thief.CriminalAction( false );
				}

				if ( root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( (Mobile)root ) )
				{
					PlayerMobile pm = (PlayerMobile)m_Thief;

					pm.PermaFlags.Add( (Mobile)root );
					pm.Delta( MobileDelta.Noto );
				}
			}
		}

		public static bool IsEmptyHanded( Mobile from )
		{
			if ( from.FindItemOnLayer( Layer.OneHanded ) != null )
				return false;

			if ( from.FindItemOnLayer( Layer.TwoHanded ) != null )
				return false;

			return true;
		}

		public static TimeSpan OnUse( Mobile m )
		{
			if ( !IsEmptyHanded( m ) )
			{
				m.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
			}
			else
			{
				m.Target = new Stealing.StealingTarget( m );
				m.RevealingAction();

				m.SendLocalizedMessage( 502698 ); // Which item do you want to steal?
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
	}
}
 

Roseanne

Wanderer
Question plz :)

I love the town crate. I would also like items to be on a regular spawner for stealing (so they spawn on pedistals). The problem I'm running in to is the item spawns on the pedistal np, you can steal them np but when it goes in to your backpack it is not movable - unlike the town crate, they automatically become movable true.

I'm seriously green at scripting and freely admit I am learning by using any and all the stuff I find in these forums. Comparing like scripts, modifying them to see what happens, etc. I'm having a blast learning how it's all done. So thanks to one & all for all your great stuff!

Anyway, what I was wondering is in order to do what I want to do, would I have to:
1. make a special "stealing spawner device" (similar to the town crate) or
2. is there something I should be doing to the individual item.cs that would say if stolen set movable true. If it's this option, would you give me a "sample" of how to add this in to an item.cs file
 

Voran

Wanderer
Metallic: I'll look into adding that option. You can set these to unlocked if you want them to be bone containers or barrels.
Roseanne: The spawning device would be best. I'm not sure how you'd do it, though.
 

Edge386

Wanderer
Great script, I love it. I was wondering about one particular thing though, So far, I've never figured out how to set spawners up so they can spawn stacks of items with an amount range, or stacks of items at all. I want a crate to spawn a gold stack ranging from 500 to 2000 gold coins, instead of 500 to 2000 single coins. Is there something I am missing to do this, or is it just not currently supported?
 

Edge386

Wanderer
Im a complete moron at the moment when it comes to scripting, im really trying to get the hang of it, but currently I couldn't script a friggin gump to appear at new character creation, so i would be the last person to modify this script :rolleyes:
 

Gandy897

Wanderer
I recently tried to do this on my test server to see if it works.. I am using the Doom Rares customized stealing script and when i add the code i get the following errors:

Scripts: Compiling C# scripts...failed (5 errors, 0 warnings)
- Error: Scripts\Custom\FS Doom Rare System\Stealing.cs: CS1519: (line 811, col
umn 16) Invalid token 'return' in class, struct, or interface member declaration

- Error: Scripts\Custom\FS Doom Rare System\Stealing.cs: CS1519: (line 811, col
umn 29) Invalid token ';' in class, struct, or interface member declaration
- Error: Scripts\Custom\FS Doom Rare System\Stealing.cs: CS0116: (line 814, col
umn 12) A namespace does not directly contain members such as fields or methods
- Error: Scripts\Custom\FS Doom Rare System\Stealing.cs: CS1518: (line 836, col
umn 76) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom\FS Doom Rare System\Stealing.cs: CS1022: (line 838, col
umn 16) 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.


The following is the cutom stealing script im using with added code that V says to place .. I have it commented out .. perhaps someone could have a look and see what the issue is :)

PHP:
using System;
using Server; 
using Server.Mobiles; 
using Server.Targeting; 
using Server.Items; 
using Server.Network; 

namespace Server.SkillHandlers 
{ 
   	public class Stealing 
   	{ 
      		public static void Initialize() 
      		{ 
         		SkillInfo.Table[33].Callback = new SkillUseCallback( OnUse ); 
      		} 

      		public static readonly bool ClassicMode = false; 
      		public static readonly bool SuspendOnMurder = false; 

     	 	public static bool IsInGuild( Mobile m ) 
      		{ 
         		return ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild ); 
      		} 

      		public static bool IsInnocentTo( Mobile from, Mobile to ) 
      		{ 
         		return ( Notoriety.Compute( from, (Mobile)to ) == Notoriety.Innocent ); 
      		} 

      		private class StealingTarget : Target 
      		{ 
         		private Mobile m_Thief; 

         		public StealingTarget( Mobile thief ) : base ( 1, false, TargetFlags.None ) 
         		{ 
            			m_Thief = thief; 

            			AllowNonlocal = true; 
         		} 

         		private Item TryStealItem( Item toSteal, ref bool caught ) 
         		{ 
				Item stolen = null; 

            			object root = toSteal.RootParent;

   	    			BaseRare rarezor = toSteal as BaseRare;

    	    			BaseRareCont rarezorcont = toSteal as BaseRareCont;

    	    			TitansHammerRare rarezorweap = toSteal as TitansHammerRare;
    	    			ZyronicClawRare rarezorweap2 = toSteal as ZyronicClawRare;
    	    			BladeOfTheRighteousRare rarezorweap3 = toSteal as BladeOfTheRighteousRare;

    	    			InquisitorsResolutionRare rarezorarm = toSteal as InquisitorsResolutionRare;

            			if( rarezorarm !=null && rarezorarm.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorarm.Movable=true; 
                        				rarezorarm.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap3 !=null && rarezorweap3.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap3.Movable=true; 
                        				rarezorweap3.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap2 !=null && rarezorweap2.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap2.Movable=true; 
                        				rarezorweap2.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap !=null && rarezorweap.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap.Movable=true; 
                        				rarezorweap.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}
  
            			else if( rarezor !=null && rarezor.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezor.Movable=true; 
                        				rarezor.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorcont !=null && rarezorcont.m_Stealable==true ) 
            			{ 

                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 


                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorcont.Movable=true; 
                        				rarezorcont.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}
   
             			}

            			else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players. 
            			} 
            			else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild. 
            			} 
            			else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers. 
            			} 
            			else if ( root is PlayerVendor ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors. 
            			} 
            			else if ( !m_Thief.CanSee( toSteal ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen. 
            			} 
            			else if ( !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 
            			else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. 
            			} 
            			else if ( toSteal.Parent is Mobile ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped. 
            			} 
            			else if ( root == m_Thief ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed. 
            			} 
            			else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 
            			else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) ) 
            			{ 
            			} 
            			else 
            			{ 
               				double w = toSteal.Weight + toSteal.TotalWeight; 

               				if ( w > 10 ) 
               				{ 
                  				m_Thief.SendMessage( "That is too heavy to steal." ); 
               				} 
               				else 
               				{ 
                  				if ( toSteal.Stackable && toSteal.Amount > 1 ) 
                  				{ 
                     					int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) ); 

                     					if ( amount >= toSteal.Amount ) 
                     					{ 
                        					int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount ); 
                        					pileWeight *= 10; 

                        					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) 
                           						stolen = toSteal; 
                     					} 
                     					else 
                     					{ 
                        					int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount ); 
                        					pileWeight *= 10; 

                        					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) 
                        					{ 
                           						stolen = toSteal.Dupe( amount ); 
                          	 					toSteal.Amount -= amount; 
                        					} 
                     					} 
                  				} 
                  				else 
                  				{ 
                     					int iw = (int)Math.Ceiling( w ); 
                     					iw *= 10; 

                     					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) 
                        					stolen = toSteal; 
                  				} 
                  				if ( stolen != null ) 
                     					m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item. 
                  				else 
                     					m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item. 

                  					caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          

                                           
				//		m_Thief.SendMessage( "That is too heavy to steal." );
				//	}
				//	else
				//	{
				//		if ( toSteal.Stackable && toSteal.Amount > 1 )
				//		{
				//			int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) );
                                //
				//			if ( amount >= toSteal.Amount )
				//			{
				//				int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
				//				pileWeight *= 10;
                                //
                                //
				//				if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
				//					stolen = toSteal;
				//			}
				//			else
				//			{
				//				int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
				//				pileWeight *= 10;
                                //
				//				if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
				//				{
				//					stolen = toSteal.Dupe( amount );
				//					toSteal.Amount -= amount;
				//				}
				//			}
				//		}
				//		else
				//		{
				//			int iw = (int)Math.Ceiling( w );
				//			iw *= 10;
                                //
				//			if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
				//				stolen = toSteal;
				//		}
                                //
				//		if ( stolen != null )
				//		{
				//			stolen.Movable=true;
				//			m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
				//		}
				//		else
				//			m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
                                //
				//		caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
				//	}
				//	}
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          

               				}
            			} 

            			return stolen;
         		}

         		protected override void OnTarget( Mobile from, object target )
         		{ 
           	 		from.RevealingAction(); 

            			Item stolen = null; 
            			object root = null; 
            			bool caught = false; 

            			if ( target is Item ) 
            			{ 
               				root = ((Item)target).RootParent; 
               				stolen = TryStealItem( (Item)target, ref caught ); 
            			} 
            			else if ( target is Mobile ) 
            			{ 
               				Container pack = ((Mobile)target).Backpack; 

               				if ( pack != null && pack.Items.Count > 0 ) 
               				{ 
                  				int randomIndex = Utility.Random( pack.Items.Count ); 

                  				root = target; 
                  				stolen = TryStealItem( (Item) pack.Items[randomIndex], ref caught ); 
               				} 
            			} 
            			else 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 

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

            			if ( caught ) 
            			{ 
              	 			if ( root == null ) 
               				{ 
                  				m_Thief.CriminalAction( false ); 
               				} 
               				else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) ) 
               				{ 
                  				m_Thief.CriminalAction( false ); 
               				} 
               				else if ( root is Mobile ) 
               				{ 
                  				Mobile mobRoot = (Mobile)root; 

                  				if ( !IsInGuild( mobRoot ) && IsInnocentTo( m_Thief, mobRoot ) ) 
                     					m_Thief.CriminalAction( false ); 

                  				string message = String.Format( "You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name ); 

                  				foreach ( NetState ns in m_Thief.GetClientsInRange( 8 ) ) 
                  				{ 
                     					if ( ns != m_Thief.NetState ) 
                        					ns.Mobile.SendMessage( message ); 
                  				} 
               				} 
            			} 
            			else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) ) 
            			{ 
               				m_Thief.CriminalAction( false ); 
            			} 

            			if ( root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( (Mobile)root ) ) 
            			{ 
               				PlayerMobile pm = (PlayerMobile)m_Thief; 

               				pm.PermaFlags.Add( (Mobile)root ); 
               				pm.Delta( MobileDelta.Noto ); 
            			} 
         		} 
      		} 

      		public static TimeSpan OnUse( Mobile m ) 
      		{ 
         		m.Target = new Stealing.StealingTarget( m ); 
         		m.RevealingAction(); 

         		m.SendLocalizedMessage( 502698 ); // Which item do you want to steal? 

         		return TimeSpan.FromSeconds( 10.0 ); 
      		} 
	} 
}
 

Gandy897

Wanderer
Actually with a little bit of moving this and that .. I think I got it to work :) so hopefully all is well

Cross your fingers for me :)
 

Gandy897

Wanderer
another little problem

Ok I managed to get these town crates in place.. the server doesnt crash anymore lol .. however .. when i use smurf it to add items to spawn in the crate it creates items that are not stealable. and if i place the item spawner in the crate and spawn things.. it creates items that dont need to be stolen but can simply be taken right out.. so what am i doing wrong lol .. ? i havent the foggiest idea hahaha.
anyone have any ideas ?
 

crabby654

Wanderer
im not to sure what you mean by make sure it isnt set to unlocked. I still cant steal them, Unlocked is set to False and under that Locked is set to true.

and can we set it so you can pick up the items?
 

Voran

Wanderer
Ah, when you said you couldn't steal them, I figured you meant you could pick them up.
No, the itemspawner is designed to spawn items you can pick up, the crates are for pilfering.
Post your stealing.cs, there's a bug in yours if you can't nick items in towncrates.
 

crabby654

Wanderer
Code:
using System;
using Server;
using Server.Mobiles;
using Server.Targeting;
using Server.Items;
using Server.Network;

namespace Server.SkillHandlers
{
	public class Stealing
	{
		public static void Initialize()
		{
			SkillInfo.Table[33].Callback = new SkillUseCallback( OnUse );
		}

		public static readonly bool ClassicMode = false;
		public static readonly bool SuspendOnMurder = false;

		public static bool IsInGuild( Mobile m )
		{
			return ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild );
		}

		public static bool IsInnocentTo( Mobile from, Mobile to )
		{
			return ( Notoriety.Compute( from, (Mobile)to ) == Notoriety.Innocent );
		}

		private class StealingTarget : Target
		{
			private Mobile m_Thief;

			public StealingTarget( Mobile thief ) : base ( 1, false, TargetFlags.None )
			{
				m_Thief = thief;

				AllowNonlocal = true;
			}

			private Item TryStealItem( Item toSteal, ref bool caught )
			{
				Item stolen = null;

				object root = toSteal.RootParent;

				if ( !IsEmptyHanded( m_Thief ) )
				{
					m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
				}
				else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) )
				{
					m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players.
				}
				else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 )
				{
					m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild.
				}
				else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable )
				{
					m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers.
				}
				else if ( root is PlayerVendor )
				{
					m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors.
				}
				else if ( !m_Thief.CanSee( toSteal ) )
				{
					m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen.
				}
				else if ( toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) )
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}
				else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
				{
					m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
				}
				else if ( toSteal.Parent is Mobile )
				{
					m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped.
				}
				else if ( root == m_Thief )
				{
					m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed.
				}
				else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player )
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}
				else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) )
				{
				}
				else
				{
					double w = toSteal.Weight + toSteal.TotalWeight;

					if ( w > 10 )
					{
						m_Thief.SendMessage( "That is too heavy to steal." );
					}
					else
					{
						if ( toSteal.Stackable && toSteal.Amount > 1 )
						{
							int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

							if ( maxAmount < 1 )
								maxAmount = 1;
							else if ( maxAmount > toSteal.Amount )
								maxAmount = toSteal.Amount;

							int amount = Utility.RandomMinMax( 1, maxAmount );

							if ( amount >= toSteal.Amount )
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
									stolen = toSteal;
							}
							else
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
								{
									stolen = toSteal.Dupe( amount );
									toSteal.Amount -= amount;
								}
							}
						}
						else
						{
							int iw = (int)Math.Ceiling( w );
							iw *= 10;

							if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
								stolen = toSteal;
						}

						if ( stolen != null )
							m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
						else
							m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.

						caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
					}
//Mod. Start
				if (toSteal.Parent is TownCrate)
					{
					double wa = toSteal.Weight + toSteal.TotalWeight;

					if ( wa > 10 )
					{
						m_Thief.SendMessage( "That is too heavy to steal." );
					}
					else
					{
						if ( toSteal.Stackable && toSteal.Amount > 1 )
						{
							int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) );

							if ( amount >= toSteal.Amount )
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
									stolen = toSteal;
							}
							else
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
								{
									stolen = toSteal.Dupe( amount );
									toSteal.Amount -= amount;
								}
							}
						}
						else
						{
							int iw = (int)Math.Ceiling( w );
							iw *= 10;

							if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
								stolen = toSteal;
						}

						if ( stolen != null )
						{
							stolen.Movable=true;
							m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
						}
						else
							m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.

						caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
					}
					}
//Mod. End

				}

				return stolen;
			}

			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

				Item stolen = null;
				object root = null;
				bool caught = false;

				if ( target is Item )
				{
					root = ((Item)target).RootParent;
					stolen = TryStealItem( (Item)target, ref caught );
				} 
				else if ( target is Mobile )
				{
					Container pack = ((Mobile)target).Backpack;

					if ( pack != null && pack.Items.Count > 0 )
					{
						int randomIndex = Utility.Random( pack.Items.Count );

						root = target;
						stolen = TryStealItem( (Item) pack.Items[randomIndex], ref caught );
					}
				} 
				else 
				{
					m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
				}

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

				if ( caught )
				{
					if ( root == null )
					{
						m_Thief.CriminalAction( false );
					}
					else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) )
					{
						m_Thief.CriminalAction( false );
					}
					else if ( root is Mobile )
					{
						Mobile mobRoot = (Mobile)root;

						if ( !IsInGuild( mobRoot ) && IsInnocentTo( m_Thief, mobRoot ) )
							m_Thief.CriminalAction( false );

						string message = String.Format( "You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name );

						foreach ( NetState ns in m_Thief.GetClientsInRange( 8 ) )
						{
							if ( ns != m_Thief.NetState )
								ns.Mobile.SendMessage( message );
						}
					}
				}
				else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) )
				{
					m_Thief.CriminalAction( false );
				}

				if ( root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( (Mobile)root ) )
				{
					PlayerMobile pm = (PlayerMobile)m_Thief;

					pm.PermaFlags.Add( (Mobile)root );
					pm.Delta( MobileDelta.Noto );
				}
			}
		}

		public static bool IsEmptyHanded( Mobile from )
		{
			if ( from.FindItemOnLayer( Layer.OneHanded ) != null )
				return false;

			if ( from.FindItemOnLayer( Layer.TwoHanded ) != null )
				return false;

			return true;
		}

		public static TimeSpan OnUse( Mobile m )
		{
			if ( !IsEmptyHanded( m ) )
			{
				m.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
			}
			else
			{
				m.Target = new Stealing.StealingTarget( m );
				m.RevealingAction();

				m.SendLocalizedMessage( 502698 ); // Which item do you want to steal?
			}

			return TimeSpan.FromSeconds( 10.0 );
		}
	}
}
 

Voran

Wanderer
Ah, that's be the reason - the town crate pilfering's in the wrong place. I'm updating the first post with the stealing.cs
 

Gandy897

Wanderer
Un Stealable

OK, my stealing script is non distro and im still having a few problems. Other then not being able to steal the items from the containers its working fine :) lol
Ill post it perhaps someone can take a look and tell me where I'm going wrong ??

PHP:
using System;
using Server; 
using Server.Mobiles; 
using Server.Targeting; 
using Server.Items; 
using Server.Network; 

namespace Server.SkillHandlers 
{ 
   	public class Stealing 
   	{ 
      		public static void Initialize() 
      		{ 
         		SkillInfo.Table[33].Callback = new SkillUseCallback( OnUse ); 
      		} 

      		public static readonly bool ClassicMode = false; 
      		public static readonly bool SuspendOnMurder = false; 

     	 	public static bool IsInGuild( Mobile m ) 
      		{ 
         		return ( m is PlayerMobile && ((PlayerMobile)m).NpcGuild == NpcGuild.ThievesGuild ); 
      		} 

      		public static bool IsInnocentTo( Mobile from, Mobile to ) 
      		{ 
         		return ( Notoriety.Compute( from, (Mobile)to ) == Notoriety.Innocent ); 
      		} 

      		private class StealingTarget : Target 
      		{ 
         		private Mobile m_Thief; 

         		public StealingTarget( Mobile thief ) : base ( 1, false, TargetFlags.None ) 
         		{ 
            			m_Thief = thief; 

            			AllowNonlocal = true; 
         		} 

         		private Item TryStealItem( Item toSteal, ref bool caught ) 
         		{ 
				Item stolen = null; 

            			object root = toSteal.RootParent;

   	    			BaseRare rarezor = toSteal as BaseRare;

    	    			BaseRareCont rarezorcont = toSteal as BaseRareCont;

    	    			TitansHammerRare rarezorweap = toSteal as TitansHammerRare;
    	    			ZyronicClawRare rarezorweap2 = toSteal as ZyronicClawRare;
    	    			BladeOfTheRighteousRare rarezorweap3 = toSteal as BladeOfTheRighteousRare;

    	    			InquisitorsResolutionRare rarezorarm = toSteal as InquisitorsResolutionRare;

            			if( rarezorarm !=null && rarezorarm.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorarm.Movable=true; 
                        					rarezorarm.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorarm.Movable=true; 
                        				rarezorarm.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap3 !=null && rarezorweap3.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap3.Movable=true; 
                        					rarezorweap3.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap3.Movable=true; 
                        				rarezorweap3.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap2 !=null && rarezorweap2.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap2.Movable=true; 
                        					rarezorweap2.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap2.Movable=true; 
                        				rarezorweap2.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorweap !=null && rarezorweap.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorweap.Movable=true; 
                        					rarezorweap.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorweap.Movable=true; 
                        				rarezorweap.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}
  
            			else if( rarezor !=null && rarezor.m_Stealable==true ) 
            			{  
                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 

                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezor.Movable=true; 
                        					rarezor.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezor.Movable=true; 
                        				rarezor.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}

	    			}

            			else if( rarezorcont !=null && rarezorcont.m_Stealable==true ) 
            			{ 

                			if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                			{ 


                				if ( m_Thief.Skills[SkillName.Stealing].Value > 99.9 && m_Thief.Skills[SkillName.Stealing].Value < 105.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 35 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 104.9 && m_Thief.Skills[SkillName.Stealing].Value < 110.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 55 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break; 
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 109.9 && m_Thief.Skills[SkillName.Stealing].Value < 115.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 65 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal; 
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 114.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.0 ) 
                				{ 

							if( Utility.Random( 100 ) < 85 ) 
							switch ( Utility.Random( 1 )) 
							{ 
								case 0:
                 						rarezorcont.Movable=true; 
                        					rarezorcont.m_Stealable=false; 
                        					stolen = toSteal;
								break;
							}
							else
							{
							}

                				}
                				if ( m_Thief.Skills[SkillName.Stealing].Value > 119.9 && m_Thief.Skills[SkillName.Stealing].Value < 120.1 ) 
                				{
                 					rarezorcont.Movable=true; 
                        				rarezorcont.m_Stealable=false; 
                        				stolen = toSteal;

                				}
					}
					else
					{
						m_Thief.SendMessage( 1103, "You must have 100.0 or more to steal that item." );
					}


                			if ( stolen != null )
					{ 
                				m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
					} 
                			else
					{ 
                				m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
					}
   
             			}

            			else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players. 
            			} 
            			else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild. 
            			} 
            			else if ( root is BaseVendor && ((BaseVendor)root).IsInvulnerable ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005598 ); // You can't steal from shopkeepers. 
            			} 
            			else if ( root is PlayerVendor ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502709 ); // You can't steal from vendors. 
            			} 
            			else if ( !m_Thief.CanSee( toSteal ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen. 
            			} 
            			else if ( !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 
            			else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it. 
            			} 
            			else if ( toSteal.Parent is Mobile ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped. 
            			} 
            			else if ( root == m_Thief ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed. 
            			} 
            			else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player ) 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 
            			else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) ) 
            			{ 
            			} 
            			else 
            			{ 
               				double w = toSteal.Weight + toSteal.TotalWeight; 

               				if ( w > 10 ) 
               				{ 
                  				m_Thief.SendMessage( "That is too heavy to steal." ); 
               				} 
               				else 
               				{ 
                  				if ( toSteal.Stackable && toSteal.Amount > 1 ) 
                  				{ 
                     					int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) ); 

                     					if ( amount >= toSteal.Amount ) 
                     					{ 
                        					int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount ); 
                        					pileWeight *= 10; 

                        					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) 
                           						stolen = toSteal; 
                     					} 
                     					else 
                     					{ 
                        					int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount ); 
                        					pileWeight *= 10; 

                        					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) ) 
                        					{ 
                           						stolen = toSteal.Dupe( amount ); 
                          	 					toSteal.Amount -= amount; 
                        					} 
                     					} 
                  				} 
                  				else 
                  				{ 
                     					int iw = (int)Math.Ceiling( w ); 
                     					iw *= 10; 

                     					if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) ) 
                        					stolen = toSteal; 
                  				} 
                  				if ( stolen != null ) 
                     					m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item. 
                  				else
                     					m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item. 

                  					caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
                                                          
                                             }
                                                          

                                                          
                         //mod begin

			               	 if (toSteal.Parent is TownCrate)
					{
					double wa = toSteal.Weight + toSteal.TotalWeight;

					if ( wa > 10 )
					{
						m_Thief.SendMessage( "That is too heavy to steal." );
					}
					else
					{
						if ( toSteal.Stackable && toSteal.Amount > 1 )
						{
							int amount = Utility.Random( 1, (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight) );

							if ( amount >= toSteal.Amount )
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
									stolen = toSteal;
							}
							else
							{
								int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
								pileWeight *= 10;

								if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
								{
									stolen = toSteal.Dupe( amount );
									toSteal.Amount -= amount;
								}
							}
						}
						else
						{
							int iw = (int)Math.Ceiling( w );
							iw *= 10;

							if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
								stolen = toSteal;
						}

						if ( stolen != null )
						{
							stolen.Movable=true;
							m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
						}
						else
							m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.

						caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
					}
					}

                                                          
                          //end mod
                                                          
                                                          
                                                          

                                                          
                                                          
                                                          
                                                          
                                                          
                                                          
                                                          


            			} 

            			return stolen;
         		}

         		protected override void OnTarget( Mobile from, object target )
         		{ 
           	 		from.RevealingAction(); 

            			Item stolen = null; 
            			object root = null; 
            			bool caught = false; 

            			if ( target is Item ) 
            			{ 
               				root = ((Item)target).RootParent; 
               				stolen = TryStealItem( (Item)target, ref caught ); 
            			} 
            			else if ( target is Mobile ) 
            			{ 
               				Container pack = ((Mobile)target).Backpack; 

               				if ( pack != null && pack.Items.Count > 0 ) 
               				{ 
                  				int randomIndex = Utility.Random( pack.Items.Count ); 

                  				root = target; 
                  				stolen = TryStealItem( (Item) pack.Items[randomIndex], ref caught ); 
               				} 
            			} 
            			else 
            			{ 
               				m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that! 
            			} 

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

            			if ( caught ) 
            			{ 
              	 			if ( root == null ) 
               				{ 
                  				m_Thief.CriminalAction( false ); 
               				} 
               				else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) ) 
               				{ 
                  				m_Thief.CriminalAction( false ); 
               				} 
               				else if ( root is Mobile ) 
               				{ 
                  				Mobile mobRoot = (Mobile)root; 

                  				if ( !IsInGuild( mobRoot ) && IsInnocentTo( m_Thief, mobRoot ) ) 
                     					m_Thief.CriminalAction( false ); 

                  				string message = String.Format( "You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name ); 

                  				foreach ( NetState ns in m_Thief.GetClientsInRange( 8 ) ) 
                  				{ 
                     					if ( ns != m_Thief.NetState ) 
                        					ns.Mobile.SendMessage( message ); 
                  				} 
               				} 
            			} 
            			else if ( root is Corpse && ((Corpse)root).IsCriminalAction( m_Thief ) ) 
            			{ 
               				m_Thief.CriminalAction( false ); 
            			} 

            			if ( root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( (Mobile)root ) ) 
            			{ 
               				PlayerMobile pm = (PlayerMobile)m_Thief; 

               				pm.PermaFlags.Add( (Mobile)root ); 
               				pm.Delta( MobileDelta.Noto ); 
            			} 
         		} 
      		} 

      		public static TimeSpan OnUse( Mobile m ) 
      		{ 
         		m.Target = new Stealing.StealingTarget( m ); 
         		m.RevealingAction(); 

         		m.SendLocalizedMessage( 502698 ); // Which item do you want to steal? 

         		return TimeSpan.FromSeconds( 10.0 ); 
      		} 
	} 
}

also note that Im using wa and not w cause if i use w it says that variable is already in use elsewhere , but with wa it seems to work as far as loading up at least
 

Sasha_S

Wanderer
U should OoO share it

Voran U should post the Stealing.cs u did for me since i was to slow to figure it out hehe cause It works OMG good 0 errors n items are total stealable! :p :p ur a god!!! :p :p :eek:
 
Top