Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 04-27-2006, 11:31 PM   #1 (permalink)
Forum Novice
 
marvin3634's Avatar
 
Join Date: Feb 2006
Location: oklahoma
Age: 29
Posts: 110
Send a message via ICQ to marvin3634 Send a message via Yahoo to marvin3634
Default Jail notification

Simple idea send me "admin / Gm " A notification when someone is jailed.
__________________
If at first you don't succede , Destroy all the evidence that you tried. ;)
marvin3634 is offline   Reply With Quote
Old 04-28-2006, 08:27 AM   #2 (permalink)
Forum Expert
 
Join Date: Oct 2002
Posts: 1,125
Default

Code:
foreach ( Mobile m in World.Mobiles.Values )
{
      if ( m.AccessLevel >= AccessLevel.GameMaster )
            m.SendMessage( "Player \"{0}\" has entered jail.", from.Name ); 
}
in the jail region OnEnter function.
Aenima is offline   Reply With Quote
Old 05-05-2006, 12:45 PM   #3 (permalink)
Forum Expert
 
Sunshine's Avatar
 
Join Date: Mar 2005
Location: Hopefully not near you
Posts: 2,232
Default

Ohh thanks alot ..love that ...will help us know who might be a habitual crimminal ,
__________________
All people have the right to be stupid but some abuse the privilege.
Sunshine is offline   Reply With Quote
Old 05-06-2006, 07:39 AM   #4 (permalink)
Forum Expert
 
Join Date: Sep 2005
Location: UK
Age: 29
Posts: 781
Default

hi there i wanted to add this my my jail system. i use. but i cant find OnEnter.
thanks for any help.

Code:
#region AuthorHeader
//
//	Jail version 1.5, by Xanthos
//
//  Based on original code and concept by Sirens Song
//  (ie, Matron de Winter) 2004 and Grim Reaper.  Thanks to
//	Thundar for his ideas and testing.
//
#endregion AuthorHeader
using System;
using System.IO;
using System.Text;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using System.Collections;

namespace Xanthos.SpeechCop
{
	public class Jail
	{
		// Configurable options
		public static AccessLevel kJailImmuneLevel = AccessLevel.Administrator;
		public static bool kJailWordsEnabled = true;
		public static int kRockAmount = 100;
		public static string kWhatToMine = "rock";	// Change this to mine your jail tiles. Find tile name with admin command [get name 
		public static int kHammerDifficulty = 65;	// precent chance of getting no jail rock on a mining attempt 
		public static Point3D JailLocation = new Point3D( 1715, 1064, 0 );
		public static Point3D FreeLocation = new Point3D( 3770, 1308, 0 );
		public static Map JailMap = Map.Trammel;
		public static Map FreeMap = Map.Felucca;

		public static string kJailRockName = "Jail Rock";	// These should not be changed
		private static string kJailWordFile = "Data/jailwords.txt";

		private static ArrayList m_JailWords = new ArrayList();

		public static void Initialize()
		{
			try
			{
				using ( StreamReader sr = new StreamReader( kJailWordFile ) ) 
				{
					String line;
					while (( line = sr.ReadLine() ) != null ) 
					{
						m_JailWords.Add( line );
					}
				}
			}
			catch ( Exception e )
			{
				World.Broadcast( 0, true, "Jail: error reading jail words file.");
				World.Broadcast( 0, true, e.Message );
			}

			Server.Commands.Register( "Jail", AccessLevel.GameMaster, new CommandEventHandler( Jail_OnCommand ) );
			Server.Commands.Register( "UnJail", AccessLevel.GameMaster, new CommandEventHandler( UnJail_OnCommand ) );
			Server.Commands.Register( "AddJailWord", AccessLevel.GameMaster, new CommandEventHandler( AddJailWord_OnCommand ) );
			Server.Commands.Register( "DeleteJailWord", AccessLevel.GameMaster, new CommandEventHandler( DeleteJailWord_OnCommand ) );
			Server.Commands.Register( "ListJailWords", AccessLevel.GameMaster, new CommandEventHandler( ListJailWords_OnCommand ) );
			EventSink.Speech += new SpeechEventHandler( EventSink_Speech );
		}

		//
		// Call this from your chat system command handler to have public 
		// chat monitored.
		// For instance, to add monitoring to Knives chat 2.0
		// Search for:
		// string text = Filter( e.Mobile, e.ArgString );
		// and insert this line directly after it:
		// Xanthos.SpeechCop.Jail.CheckChatSpeech( e.Mobile, text );	// <- Added Jail speech checking this line only
		//
		public static void CheckChatSpeech( Mobile mobile, string speech )
		{
			PlayerMobile player = mobile as PlayerMobile;

			if ( kJailWordsEnabled && null != player && CheckSpeech( speech ) )
				JailThem( player );
		}

		//
		// This handler monitors local speech for use of the above words.
		//
		public static void EventSink_Speech( SpeechEventArgs args )
		{
			PlayerMobile player = args.Mobile as PlayerMobile;

			if ( kJailWordsEnabled && null != player && CheckSpeech( args.Speech ) )
					JailThem( player );
		}

		[Usage( "Jail" )]
		[Description( "Jails a targeted Player." )]
		private static void Jail_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new JailTarget();
			e.Mobile.SendMessage( "Whom do you wish to Jail?" );
		}

		[Usage( "UnJail" )]
		[Description( "UnJails a targeted Player." )]
		private static void UnJail_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new UnJailTarget();
			e.Mobile.SendMessage( "Whom do you wish to release from jail?" );
		}

		[Usage( "AddJailWord" )]
		[Description( "Adds a word to the bad words list." )]
		private static void AddJailWord_OnCommand( CommandEventArgs e )
		{
			string[] args = e.Arguments;

			if ( args.Length > 0 )
			{
				m_JailWords.Add( args[ 0 ] );
				WriteJailWordsList( e.Mobile );
			}
		}

		[Usage( "DeleteJailWord" )]
		[Description( "Deletes a word from the bad words list." )]
		private static void DeleteJailWord_OnCommand( CommandEventArgs e )
		{
			string[] args = e.Arguments;

			if ( args.Length > 0 )
			{
				m_JailWords.Remove( args[ 0 ] );
				WriteJailWordsList( e.Mobile );
			}
		}

		[Usage( "ListJailWords" )]
		[Description( "Displays the bad words list." )]
		private static void ListJailWords_OnCommand( CommandEventArgs e )
		{
			for ( int i = 0; i < m_JailWords.Count; i++ )
				e.Mobile.SendMessage( ((string)m_JailWords[ i ]) );
		}

		private static void WriteJailWordsList( Mobile from )
		{
			try
			{
				using ( StreamWriter sw = new StreamWriter( kJailWordFile ) ) 
				{
					for ( int i = 0; i < m_JailWords.Count; i++ )
						sw.WriteLine( ((string)m_JailWords[ i ]) );
				}
				from.SendMessage( "Jail word list written to disk." );
			}
			catch ( Exception e )
			{
				from.SendMessage( "Exception raised writing bad words file" );
				from.SendMessage( e.Message );
			}
		}

		private static bool CheckSpeech( string speech )
		{
			ArrayList saidWords = toarray( Mytolower( speech ));

			foreach ( string bad in m_JailWords )
			{
				foreach ( string said in saidWords )
				{
					if ( said == bad )
						return true;
				}
			}
			return false;
		}

		private class JailTarget : Target
		{
			public JailTarget() : base( -1, true, TargetFlags.None ) {}

			protected override void OnTarget( Mobile from, object targ )
			{
				PlayerMobile player = targ as PlayerMobile;

				if ( null == player )
					from.SendMessage( "You can only Jail Players." );
				else
					JailThem ( player );
			}
		}

		public static void JailThem( PlayerMobile player )
		{
			if ( null == player || player.AccessLevel >= kJailImmuneLevel )
				return;

			foreach ( Item item in player.Items )
			{
				if ( item is JailHammer )	// Jailed while jailed gets them another load of rock to mine
				{
					if ( 0 > ( ((JailHammer)item).RockAmount += Jail.kRockAmount ) )	// handle integer overflow
						((JailHammer)item).RockAmount *= -1;

					player.SendMessage( "Your remaining sentence has been increased - get back to work!" );
					player.MoveToWorld( JailLocation, JailMap );
					return;
				}
			}

			// If mounted, dismount them and stable mount
			if ( player.Mounted )
			{
				if ( player.Mount is EtherealMount )
				{
					EtherealMount pet = player.Mount as EtherealMount;
					pet.Internalize();
					pet.Rider = null;
				}
				else if ( player.Mount is BaseMount )
				{
					BaseMount pet = player.Mount as BaseMount;
					pet.Rider = null;
					Jail.StablePet( player, pet );
				}
			}

			// Stable all other pets
			foreach ( Mobile mobile in World.Mobiles.Values )
			{
				if ( mobile is BaseCreature )
				{
					BaseCreature bc = mobile as BaseCreature;

					if ( null != bc && (bc.Controled && bc.ControlMaster == player) || (bc.Summoned && bc.SummonMaster == player) )
						Jail.StablePet( player, bc );
				}
			}

			// Move all items to a bag and move that to the bank
			Container backpack = player.Backpack;
			Backpack bag = new Backpack(); bag.Hue = 2665;
			ArrayList equipedItems = new ArrayList( player.Items );

			foreach ( Item item in equipedItems )
			{
				if ( item.Layer == Layer.Bank || item.Layer == Layer.Backpack || item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || item is DeathShroud )
					continue;
				bag.DropItem( item );
			}

			ArrayList backpackItems = new ArrayList( backpack.Items );
			foreach ( Item item in backpackItems )
			{
				if ( item is JailRock )
					item.Delete();
				else if ( item.Movable )	// Non movable pack items must remain (i.e. skill balls)
					bag.DropItem( item );
			}

			// Remember their access level and make them a player
			JailHammer hammer = new JailHammer();
			hammer.PlayerAccessLevel = player.AccessLevel;
			player.AccessLevel = AccessLevel.Player;

			// Bank the bag of belongings, give them a hammer and welcome them
			player.BankBox.DropItem( bag );
			player.AddItem( hammer );
			player.MoveToWorld( JailLocation, JailMap );
			Item robe = new Robe(); robe.Hue = 2665;
			player.AddItem( robe );
			player.SendMessage( "You have been JAILED!" ); 
		}

		public static void StablePet( PlayerMobile player, BaseCreature pet )
		{
			if ( null == player || null == pet )
				return;

			pet.Internalize();
			pet.ControlTarget = null;
			pet.ControlOrder = OrderType.Stay;
			pet.SetControlMaster( null );
			pet.SummonMaster = null;
			pet.IsStabled = true;
			player.Stabled.Add( pet );
			player.SendMessage( "Your pet has been stabled" );
		}

		private class UnJailTarget : Target
		{
			public UnJailTarget() : base( -1, true, TargetFlags.None ) {}

			protected override void OnTarget( Mobile from, object targ )
			{
				PlayerMobile player = targ as PlayerMobile;

				if ( null == player )
					from.SendMessage( "You may only unjail players." );
				else
				{
					from.SendMessage( "You free the player." );
					FreeThem( player );
				}
			}
		}

		public static void FreeThem( PlayerMobile player )
		{
			if ( null == player )
				return;

			// Take away any JailRock
			// No need to recurse containers since all their items were removed when jailed
			RemoveRockFromList( new ArrayList( player.Items ) ); 
			RemoveRockFromList( new ArrayList( player.Backpack.Items ) ); 

			// Restore their access level
			JailHammer hammer = player.FindItemOnLayer( Layer.OneHanded ) as JailHammer;

			if ( null != hammer )
			{
				player.AccessLevel = hammer.PlayerAccessLevel;
				hammer.Delete();
			}

			player.MoveToWorld( FreeLocation, FreeMap );
			player.SendMessage( "You have been released from Jail!" );
		}

		private static void RemoveRockFromList( ArrayList list )
		{
			if ( null == list )
				return;

			foreach ( Item item in list )
			{
				if ( item is JailRock )	// Be sure no jail rock leaves the jail.
					item.Delete();
			}
		}

		private static string Mytolower( string str )
		{
			string s1 = "";
			int strlen = str.Length;
			for ( int i = 0; i < strlen; i++ )
			{
				char ch = str[i];
				if (ch >= 'A' && ch <= 'Z')
				{
					int ucode = (int)ch;
					ucode += 32;
					s1 += (char)ucode;
				}
				else
				{
					s1 += ch;
				}
			}
			return s1;
		}

		private static ArrayList toarray( string str )
		{
			ArrayList retarray = new ArrayList();
			string s1 = "";
			int strlen = str.Length;
			for ( int i = 0; i < strlen; i++ )
			{
				char ch = str[i];
				if (ch >= 'a' && ch <= 'z')
				{
					s1 += ch;
				}
				else
				{
					if ( s1 != "" )
					{
						retarray.Add( s1 );
						s1 = "";
					}
				}
			}

			if ( s1 != "" )
				retarray.Add( s1 );

			return retarray;
		}
	}
}
__________________
*+ MW Admin Naturescorpse +*
WonderlandADnc is offline   Reply With Quote
Old 05-06-2006, 08:56 AM   #5 (permalink)
Forum Expert
 
Join Date: Dec 2005
Posts: 537
Default

What you have there is the script to jail someone not the jail region, which he/she ment.

Anyhow you can just put the piece of code under the following method:
public static void JailThem( PlayerMobile player )


find the following part:

Code:
Item robe = new Robe(); robe.Hue = 2665;
			player.AddItem( robe );
			player.SendMessage( "You have been JAILED!" );
and add the following part:
Code:
foreach ( Mobile m in World.Mobiles.Values )
{
      if ( m.AccessLevel >= AccessLevel.GameMaster )
            m.SendMessage( "Player \"{0}\" has entered jail.", player.Name ); 
}
		}
so it will look like this:
Code:
Item robe = new Robe(); robe.Hue = 2665;
			player.AddItem( robe );
			player.SendMessage( "You have been JAILED!" );

foreach ( Mobile m in World.Mobiles.Values )
{
      if ( m.AccessLevel >= AccessLevel.GameMaster )
            m.SendMessage( "Player \"{0}\" has entered jail.", player.Name ); 
}
		}
b0b01 is offline   Reply With Quote
Old 05-06-2006, 09:07 AM   #6 (permalink)
Forum Expert
 
Join Date: Sep 2005
Location: UK
Age: 29
Posts: 781
Default

lol. thanks. i was trying somthing like that. thanks again.
__________________
*+ MW Admin Naturescorpse +*
WonderlandADnc is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5