Go Back   RunUO - Ultima Online Emulation > RunUO > Server Support on Windows

Server Support on Windows Get (and give) support on general questions related to the RunUO server itself.

Reply
 
Thread Tools Display Modes
Old 07-21-2005, 05:56 PM   #1 (permalink)
Forum Novice
 
Join Date: Jun 2005
Age: 39
Posts: 114
Default Test Center and Set Skills

Is there a way to keep test center and N0T have players be able to set their skills.. Ie. "set magery 120". I would like to keep it so it fills new player bankboxes but not be able to set their skills.
Newbiepdo is offline   Reply With Quote
Old 07-21-2005, 06:16 PM   #2 (permalink)
Forum Expert
 
Greystar's Avatar
 
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
Default

Quote:
Originally Posted by Newbiepdo
Is there a way to keep test center and N0T have players be able to set their skills.. Ie. "set magery 120". I would like to keep it so it fills new player bankboxes but not be able to set their skills.
editing the scripts was the only way I was able to accomplish this. I just added an AccessLevel Check to the ability to verbally set your skills/stats.
__________________
Quote:
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Killable Guards (GS Version)
Just a Simple Staff Tool
You can leave me messages.
Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else."
Greystar is offline   Reply With Quote
Old 07-21-2005, 08:08 PM   #3 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by Newbiepdo
Is there a way to keep test center and N0T have players be able to set their skills.. Ie. "set magery 120". I would like to keep it so it fills new player bankboxes but not be able to set their skills.
Delete the class file for the "set" command, simple ant it?
Phantom is offline   Reply With Quote
Old 07-21-2005, 08:36 PM   #4 (permalink)
Forum Novice
 
Join Date: Jun 2005
Age: 39
Posts: 114
Default

Quote:
Originally Posted by Phantom
Delete the class file for the "set" command, simple ant it?
Wheres the Class File for "Set" command. And will that affect staff from using "[set "??

Greystars Idea sounds like a good one too, I just wanna explore both options on my test server before i decide which to go with. Thanks to both of you!
Newbiepdo is offline   Reply With Quote
Old 07-21-2005, 08:39 PM   #5 (permalink)
Forum Expert
 
Greystar's Avatar
 
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
Default

if you decide to go my route you can edit the TestCenter.cs file its located in the test center folder in the Scripts/Misc/Test Center/

being the only file in there its hard to miss. Adding an accesslevel check to the set command wouldnt be that difficult. So if thats the method you want to take post in this thread and I'll tell you what might work.

Code:
		private static void EventSink_Speech( SpeechEventArgs args )
		{
			if ( !args.Handled )
			{
				Mobile from = args.Mobile;

				if( Insensitive.StartsWith( args.Speech, "set" ) && from.AccessLevel > AccessLevel.Player )
				{
					string[] split = args.Speech.Split( ' ' );

					if ( split.Length == 3 )
					{
						try
						{
							string name = split[1];
							double value = Convert.ToDouble( split[2] );

							if ( Insensitive.Equals( name, "str" ) )
								ChangeStrength( from, (int)value );
							else if ( Insensitive.Equals( name, "dex" ) )
								ChangeDexterity( from, (int)value );
							else if ( Insensitive.Equals( name, "int" ) )
								ChangeIntelligence( from, (int)value );
							else
								ChangeSkill( from, name, value );
						}
						catch
						{
						}
					}
				}
				else if( Insensitive.Equals( args.Speech, "help" ) )
				{
					args.Mobile.SendGump( new TCHelpGump() );

					args.Handled = true;
				}
			}
		}
I just decided to go ahead and post the changes to make it so that if your accesslevel was greater then accesslevel.player it would work. although note that I did move where the Mobile from = args.Mobile; was defined.
__________________
Quote:
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Killable Guards (GS Version)
Just a Simple Staff Tool
You can leave me messages.
Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else."
Greystar is offline   Reply With Quote
Old 07-21-2005, 08:52 PM   #6 (permalink)
Forum Novice
 
Join Date: Jun 2005
Age: 39
Posts: 114
Default Thats is Simple!

Quote:
Originally Posted by Greystar
if you decide to go my route you can edit the TestCenter.cs file its located in the test center folder in the Scripts/Misc/Test Center/

being the only file in there its hard to miss. Adding an accesslevel check to the set command wouldnt be that difficult. So if thats the method you want to take post in this thread and I'll tell you what might work.

Code:
		private static void EventSink_Speech( SpeechEventArgs args )
		{
			if ( !args.Handled )
			{
				Mobile from = args.Mobile;

				if( Insensitive.StartsWith( args.Speech, "set" ) && from.AccessLevel > AccessLevel.Player )
				{
					string[] split = args.Speech.Split( ' ' );

					if ( split.Length == 3 )
					{
						try
						{
							string name = split[1];
							double value = Convert.ToDouble( split[2] );

							if ( Insensitive.Equals( name, "str" ) )
								ChangeStrength( from, (int)value );
							else if ( Insensitive.Equals( name, "dex" ) )
								ChangeDexterity( from, (int)value );
							else if ( Insensitive.Equals( name, "int" ) )
								ChangeIntelligence( from, (int)value );
							else
								ChangeSkill( from, name, value );
						}
						catch
						{
						}
					}
				}
				else if( Insensitive.Equals( args.Speech, "help" ) )
				{
					args.Mobile.SendGump( new TCHelpGump() );

					args.Handled = true;
				}
			}
		}
I just decided to go ahead and post the changes to make it so that if your accesslevel was greater then accesslevel.player it would work. although note that I did move where the Mobile from = args.Mobile; was defined.
Thanks Greystar, This way definetely Is simple. Thank you for showing and explaining how it works. +karma 4 u
Newbiepdo is offline   Reply With Quote
Old 07-21-2005, 08:57 PM   #7 (permalink)
Forum Expert
 
Greystar's Avatar
 
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
Default

we all do what we can and I figured since I did this aready once before myself when I was testing things I figured if someone wants to have test center active but not allow players to change there stats/skills I might as well share what I knew. now if it doesnt work straight out of the box, then I'll help fix the errors I may cause.
__________________
Quote:
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Killable Guards (GS Version)
Just a Simple Staff Tool
You can leave me messages.
Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else."
Greystar is offline   Reply With Quote
Old 01-28-2007, 11:49 AM   #8 (permalink)
Forum Newbie
 
Darkwell's Avatar
 
Join Date: Nov 2006
Age: 20
Posts: 9
Default [resurrect Test Center and Set Skills :~

i tried add "&& from.AccessLevel > AccessLevel.Player )" in the test center but the players cannot change your stats and skills
someone can help me?

~sorry, bad english
Darkwell is offline   Reply With Quote
Old 01-28-2007, 11:53 AM   #9 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 45
Posts: 6,283
Default

If you want players to be able to change their own stats and use staff commands (I HIGHLY recommend NOT doing this), remove the accesslevel checks completely.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 01-28-2007, 12:05 PM   #10 (permalink)
Forum Newbie
 
Darkwell's Avatar
 
Join Date: Nov 2006
Age: 20
Posts: 9
Default

testcenter.cs:
Code:
private static void EventSink_Speech( SpeechEventArgs args )
		{
			if ( !args.Handled )
			{
                         Mobile from = args.Mobile;

				 if( Insensitive.StartsWith( args.Speech, "set" )&& from.AccessLevel > AccessLevel.Player )
				 {
					string[] split = args.Speech.Split( ' ' );

					if ( split.Length == 3 )
					{
						try
						{
							string name = split[1];
							double value = Convert.ToDouble( split[2] );

							if ( Insensitive.Equals( name, "str" ) )
								ChangeStrength( from, (int)value );
							else if ( Insensitive.Equals( name, "dex" ) )
								ChangeDexterity( from, (int)value );
							else if ( Insensitive.Equals( name, "int" ) )
								ChangeIntelligence( from, (int)value );
							else
								ChangeSkill( from, name, value );
						}
						catch
						{
						}
					}
				}
				else if( Insensitive.Equals( args.Speech, "help" ) )
				{
					args.Mobile.SendGump( new TCHelpGump() );

					args.Handled = true;
				}
			}
		}

		private static void ChangeStrength( Mobile from, int value )
		{
		if ( value < 10 || value > 125 )
			{
				from.SendLocalizedMessage( 1005628 ); // Stats range between 10 and 125.
			}
			else
			{
				if ( (value + from.RawDex + from.RawInt) > from.StatCap )
				{
					from.SendLocalizedMessage( 1005629 ); // You can not exceed the stat cap.  Try setting another stat lower first.
				}
				else
				{
					from.RawStr = value;
					from.SendLocalizedMessage( 1005630 ); // Your stats have been adjusted.
				}
			}
		}

		private static void ChangeDexterity( Mobile from, int value )
		{
			if ( value < 10 || value > 125 )
			{
				from.SendLocalizedMessage( 1005628 ); // Stats range between 10 and 125.
			}
			else
			{
				if ( (from.RawStr + value + from.RawInt) > from.StatCap )
				{
					from.SendLocalizedMessage( 1005629 ); // You can not exceed the stat cap.  Try setting another stat lower first.
				}
				else
				{
					from.RawDex = value;
					from.SendLocalizedMessage( 1005630 ); // Your stats have been adjusted.
				}
			}
		}

		private static void ChangeIntelligence( Mobile from, int value )
		{
			if ( value < 10 || value > 125 )
			{
				from.SendLocalizedMessage( 1005628 ); // Stats range between 10 and 125.
			}
			else
			{
				if ( (from.RawStr + from.RawDex + value) > from.StatCap )
				{
					from.SendLocalizedMessage( 1005629 ); // You can not exceed the stat cap.  Try setting another stat lower first.
				}
				else
				{
					from.RawInt = value;
					from.SendLocalizedMessage( 1005630 ); // Your stats have been adjusted.
				}
			}
		}

		private static void ChangeSkill( Mobile from, string name, double value )
		{
			SkillName index;

			try
			{
				index = (SkillName)Enum.Parse( typeof( SkillName ), name, true );
			}
			catch
			{
				from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
				return;
			}

			if ( ( !Core.SE && (int)index > 51 ) || ( !Core.AOS && (int)index > 48 ) )
			{
				from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
				return;
			}

			Skill skill = from.Skills[index];

			if ( skill != null )
			{
				if ( value < 0 || value > skill.Cap )
				{
					from.SendMessage( String.Format( "Your skill in {0} is capped at {1:F1}.", skill.Info.Name, skill.Cap ) );
				}
				else
				{
					int newFixedPoint = (int)(value * 10.0);
					int oldFixedPoint = skill.BaseFixedPoint;

					if ( ((skill.Owner.Total - oldFixedPoint) + newFixedPoint) > skill.Owner.Cap )
					{
						from.SendMessage( "You can not exceed the skill cap.  Try setting another skill lower first." );
					}
					else
					{
						skill.BaseFixedPoint = newFixedPoint;
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
			}
		}

with this (in red) functioning they they couldn't exceed caps, right?this is what i want

~sorry for my english
Darkwell is offline   Reply With Quote
Old 01-28-2007, 12:08 PM   #11 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 45
Posts: 6,283
Default

If you want them to be able to exceed the statcap, you will have to change the statcap. However, there is a bug in RC1 that causes the ObeyCap to not work, but this has been fixed in the SVN version.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 01-28-2007, 01:45 PM   #12 (permalink)
Forum Newbie
 
Darkwell's Avatar
 
Join Date: Nov 2006
Age: 20
Posts: 9
Default

Ok, I must have expressed myself badly. I don’t want the players to have the staff’s commands (changing the acesslevels). What I want is to allow the players to do adjustments is their stats and skills, but respecting the skillcap and the statcap, using commands such [ChangeStrenght, [ChangeIntelligence, [ChangeDexterity and [Changeskill.
can you help me?

~bad english, sry
Darkwell is offline   Reply With Quote
Old 01-28-2007, 02:16 PM   #13 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 45
Posts: 6,283
Default

Well, if those commands are already built in, your method that checks the accesslevel that you posted will not allow players to do that as the access level has to be higher than player (from.AccessLevel > AccessLevel.Player). Try this instead:

Code:
from.AccessLevel >= AccessLevel.Player
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 01-28-2007, 03:12 PM   #14 (permalink)
Forum Newbie
 
Darkwell's Avatar
 
Join Date: Nov 2006
Age: 20
Posts: 9
Default

Thank you Malaperth =D +karma
Darkwell is offline   Reply With Quote
Old 01-29-2007, 09:43 AM   #15 (permalink)
Forum Expert
 
Join Date: Mar 2005
Location: Berlin, Germany
Age: 27
Posts: 1,136
Send a message via ICQ to Sotho Tal Ker Send a message via MSN to Sotho Tal Ker
Default

If he does ">=" then he could remove the check aswell.. because it will be always true, as Player is usually the lowest AccessLevel.
Sotho Tal Ker 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