Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Release Archive

Custom Script Release Archive This is a pre-script database archive of what our users had released.

 
 
Thread Tools Display Modes
Old 05-21-2005, 12:11 AM   #1 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default Public Gates

Taken this system down since it has had no complaints from the people that are using the ACC. Go there and use that.
This system has been integrated to ACC. If anyone is interested in testing, please follow this link and download and install the package. You can then delete this system (all locations will update to the new system) You will have to do [GenGates to generate the gates again.


I've gotten tired of all the requests to edit the PublicMoongate script in the support forum, so I decided to make something that can be modified in game. This system is to be used with or without the normal PublicMoongates. I've hard coded in the default locations that are distro. You can chose to use these or not.

Custom Public Gates

Description:
Custom gate system that allows a GM to add new locations on-the-fly. Allows the following settings:
  • Categories:
    • Name - The name of the category.
    • Generate - Whether or not to generate gates for this category.
    • Staff Only - Whether or not this category is for staff only.
    • Reds - If Reds (murderers) can see this category.
  • Locations:
    • Name - The name of the location.
    • X, Y, Z - The location.
    • Hue - Hue of the gate that will be generated.
    • Generate, Staff Only, Reds - Same as the categories.

Installation:
Simply extract the zip to your favorite Customs directory and load the server up.

Instructions:
Commands:
  • [InitPublicGates (true/false) - Brings a target up that lets you select the location of the Control Stone, which is only an item for memory of the entries. With true, you will get the distro locations generated. With false, you will get an empty system. If you do [InitPublicGates again, it will bring you to the Control Stone.
  • [DisablePublicGates - Only way to turn the system off. Will remove the Control Stone and all Public Gates.
  • [GenGates - Generates a Public Gate for all entries marked with "Generate".
  • [RemGates - Removes all Public Gates. *New*Also will now only delete gates that are in the World. (Not in packs/containers/etc)
If you are a GM or higher, when you use a gate, you will see extra buttons. Add/Edit for both Category and Location windows. Clicking on Add will allow you to add a new Category/Location. Clicking on Edit will allow you to edit the selected Category/Location. Enter in the required information and hit Apply and it will add/edit the selection. If you remove all categories, but not disable the system, you will always have an "Empty System" category, which keeps the system from crashing. This category is Staff Only, so players will get an empty gump.
If you want to remove a category/location, simply hit 'Edit' and erase the name and hit 'Apply'. This will remove entry. If the entry is a category, it will also remove all locations in that category.
*NEW* There is a new button that allows you to add the current gate to the system. Select the category you want to add it in and hit the button (top-left of right panel) and it will add an 'Un-named Gate'. You can then go in and edit the things you want. This was added to make it easier to add gate locations.

Credits:
Arya - For the wonderful Auction System that I used some code from.

Change Log:
Closed - Only supporting ACC version now. Check Sigi or top of thread.
1.0.3a - (Hopefully) fixed a bug where players using Razor could access the Add/Edit gump and change things. - PGGump.cs, PGAddEditGump.cs
1.0.3 - Added "Add Current Gate" button to main gump. See above for info. - PGGump.cs, PGControl.cs
1.0.2a - Fixed the deleting of entries when editing categories. - PGAddEditGump.cs
1.0.2 - Gates now display the page that your current location is in when you use them. - PGGump.cs, PublicGate.cs
1.0.1b - Fixed a couple default Locations - PGControl.cs (quickfix on post 29)
1.0.1a - Fixed a crash when selecting Edit Location without selecting a Location. - PGGump.cs
1.0.1 - Added the regular checks for range/crim/factions that PublicMoongate uses. Also added the pet teleporting feature in. Thanks Demonic Seed for pointing them out. - Replace all files.
1.0.0 - Base.

I've done some testing, but there always can be things I miss, so please post back any crashes/errors/changes you might have. Suggestions are always welcome.
(Search Purposes - Custom Public Moongate PublicMoongate)

Last edited by A_Li_N; 03-25-2006 at 06:28 AM.
A_Li_N is offline  
Old 05-21-2005, 12:19 AM   #2 (permalink)
Account Terminated
 
Join Date: Apr 2004
Location: Titusville PA
Age: 26
Posts: 975
Default

Say I wanted to use this as a staff only gate Can I just remove the standard gate locations and set up staff locations?
evil lord kirby is offline  
Old 05-21-2005, 12:28 AM   #3 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

You don't have to remove anything. If you just do [InitPublicGates false, you will get an empty system, which you can add to.
A_Li_N is offline  
Old 05-21-2005, 06:04 AM   #4 (permalink)
Forum Expert
 
Greystar's Avatar
 
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
Default

Huh, thanks for releasing this. I recently had edited my moongates to allow murderers to go where ever they like, but now I can set those back to the old scripts remove all existing gates and go with yours so that if I want to change something later I can without haveing to restart. Thats what Im trying to make happen with GuardedRegions and allowing reds or restricting reds from having guards called on them... its till in testing though.
__________________
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  
Old 05-21-2005, 06:43 PM   #5 (permalink)
Newbie
 
endwolf's Avatar
 
Join Date: Jul 2004
Location: Louisiana
Age: 39
Posts: 74
Thumbs up Sweet

Another Handy one...thx!!!
Im using this one
endwolf is offline  
Old 05-21-2005, 07:11 PM   #6 (permalink)
Master of the Internet
 
bzk90's Avatar
 
Join Date: Jun 2003
Location: Nevada
Age: 18
Posts: 6,630
Send a message via AIM to bzk90 Send a message via MSN to bzk90 Send a message via Yahoo to bzk90
Default

very nice indeed
bzk90 is offline  
Old 05-26-2005, 12:17 PM   #7 (permalink)
 
Join Date: Dec 2003
Location: UK
Age: 24
Posts: 78
Default

woohoo no more messin with that dam infernal script just as i got the hang of it as well lol ty dude for this cracking script
DemonicSeed is offline  
Old 05-26-2005, 08:19 PM   #8 (permalink)
 
Join Date: Dec 2003
Location: UK
Age: 24
Posts: 78
Default mmmm found a slight problem

this isnt really that big a deal but a player can run throught the gate keep the gump open run off then from in the middle of knowhere can select location and then hit go and is back in town.
DemonicSeed is offline  
Old 05-26-2005, 08:20 PM   #9 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

Thanks, I'll fix that in a bit.
A_Li_N is offline  
Old 05-26-2005, 09:00 PM   #10 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

Updated...
Thanks Demonic Seed for pointing them out.
A_Li_N is offline  
Old 05-26-2005, 09:08 PM   #11 (permalink)
 
Join Date: Dec 2003
Location: UK
Age: 24
Posts: 78
Default

lol i dont mean to be cheaky but do i need to replace all the old version or is it just one script. nay mind i take a gander inside see what different. hehehe
DemonicSeed is offline  
Old 05-26-2005, 09:11 PM   #12 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

3 or 4 files changed, one sec...both Gumps and the PublicGate I think are all that were changed...
A_Li_N is offline  
Old 05-26-2005, 10:09 PM   #13 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Maybe im doing something wrong, but whenever i walk in a moongate then the gump pops up i click, felucca then edit and this is what happens.



RunUO Version 1.0.0, Build 36918
Operating System: Microsoft Windows NT 5.1.2600.0
.NET Framework: 1.1.4322.573
Time: 5/26/2005 8:14:49 PM
Mobiles: 13269
Items: 91561
Clients:
- Count: 1
+ 127.0.0.1: (account = drake) (mobile = 0x92F 'Drake')

Exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at Server.PG.PGAddEditGump..ctor(Conditions conditions, Int32 curC, Int32 curL, PublicGate gate)
at Server.PG.PGGump.OnResponse(NetState state, RelayInfo info)
at Server.Network.PacketHandlers.DisplayGumpResponse( NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)


any idea whats going on?

Thanks.
Darke456 is offline  
Old 05-26-2005, 10:19 PM   #14 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

IDK, try running your server in debug mode, causing the crash, posting the crashlog from that, as well as your PGAddEditGump.cs and PGGump.cs in code tags.

I just loaded my server, initiated the public gates with [initpublicgates true, so it made the default locations. Went into a gate and hit Feluca and hit Edit, both on the category and locations. No crash here.
A_Li_N is offline  
Old 05-26-2005, 10:40 PM   #15 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Quote:
Originally Posted by A_Li_N
IDK, try running your server in debug mode, causing the crash, posting the crashlog from that, as well as your PGAddEditGump.cs and PGGump.cs in code tags.
Ok how do i run it in debug mode? sorry but i never have done that before, and one more how do i post in code tags?

sorry for the stupid questions.

thanks.
Darke456 is offline  
Old 05-26-2005, 10:45 PM   #16 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

Debug - Create a shortcut to your server.exe. Right click on the shortcut, hit Properties. In the Target field, you have "<Path>\RunUO\Server.exe" (with quotes) At the end, outside of the quotes, put -debug and hit apply and run the shortcut.

For code tags, you do [code] CODE GOES HERE [/code]
A_Li_N is offline  
Old 05-27-2005, 02:06 AM   #17 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Hope this is what your wanting.


RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...done (0 errors, 0 warnings)
Scripts: Compiling VB.net scripts...no files found.
Scripts: Verifying...done (2074 items, 513 mobiles)
World: Loading...done (90302 items, 13231 mobiles) (40.0 seconds)
Reports: Loading...done
Regions: Loading...done
Address: 127.0.0.1:2593
Client: 127.0.0.1: Connected. [1 Online]
Login: 127.0.0.1: Valid credentials for 'drake'
Login: 127.0.0.1: Account 'drake' at character list
Error:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negativ
e and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at Server.PG.PGAddEditGump..ctor(Conditions conditions, Int32 curC, Int32 cur
L, PublicGate gate) in c:\Documents and Settings\Main\My Documents\RunUO-1.0.0\R
unUO 1.0\Scripts\Custom Scripts\A_Li_N's Public Gates 1.0.0\Gumps\PGAddEditGump.
cs:line 40
at Server.PG.PGGump.OnResponse(NetState state, RelayInfo info) in c:\Document
s and Settings\Main\My Documents\RunUO-1.0.0\RunUO 1.0\Scripts\Custom Scripts\A_
Li_N's Public Gates 1.0.0\Gumps\PGGump.cs:line 288
at Server.Network.PacketHandlers.DisplayGumpResponse( NetState state, PacketRe
ader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
Crash: Backing up...done
Crash: Generating report...done
Crash: Restarting...

PGAddEditGump.cs

Code:
 
using System;
using Server;
using Server.Gumps;
using Server.Network;

namespace Server.PG
{
	[Flags]
	public enum	Conditions
	{
		None      = 0x00000000,
		Adding    = 0x00000001,
		Category  = 0x00000002,
	}

	public class PGAddEditGump : Gump
	{
		private Conditions m_Conditions;
		private int        m_CurCat;
		private int        m_CurLoc;
		private PGCategory m_Cat;
		private PGLocation m_Loc;
		private PublicGate m_Gate;

		private bool GetFlag( Conditions flag ) { return( (m_Conditions & flag) != 0 ); }

		public PGAddEditGump( Conditions conditions, int curC, int curL, PublicGate gate ) : base( 0, 0 )
		{
			if( !PGSystem.Running )
				return;

			m_Conditions = conditions;
			m_CurCat     = curC;
			m_CurLoc     = curL;
			m_Gate       = gate;

			if( !GetFlag( Conditions.Category ) || (GetFlag( Conditions.Category ) && !GetFlag( Conditions.Adding )) )
				m_Cat = (PGCategory)PGSystem.Entries[curC];
			if( m_Cat != null && (!GetFlag( Conditions.Category ) && !GetFlag( Conditions.Adding )) )
				m_Loc = (PGLocation)m_Cat.Locations[curL];


			string Name = "";
			if( !GetFlag( Conditions.Adding ) )
			{
				if( GetFlag( Conditions.Category ) )
					Name = m_Cat.Name;
				else
					Name = m_Loc.Name;
			}

			Point3D Loc = new Point3D( 0, 0, 0 );
			Map Map = Map.Trammel;
			bool Gen, Staff, Reds;
			Gen = Staff = Reds = false;
			int Hue = 0;

			if( GetFlag( Conditions.Category ) && !GetFlag( Conditions.Adding ) )
			{
				Gen = m_Cat.GetFlag( EntryFlag.Generate );
				Staff = m_Cat.GetFlag( EntryFlag.StaffOnly );
				Reds = m_Cat.GetFlag( EntryFlag.Reds );
			}

			if( !GetFlag( Conditions.Category ) && !GetFlag( Conditions.Adding ) )
			{
				Loc = m_Loc.Location;
				Map = m_Loc.Map;
				Gen = m_Loc.GetFlag( EntryFlag.Generate );
				Staff = m_Loc.GetFlag( EntryFlag.StaffOnly );
				Reds = m_Loc.GetFlag( EntryFlag.Reds );
				Hue = m_Loc.Hue;
			}

			Closable   = true;
			Disposable = true;
			Dragable   = true;
			Resizable  = false;


			AddPage(0);

			AddBackground( 530, 100, 230, 410, 2600 );
			AddLabel( 602, 120, 0, string.Format("{0} {1}", (GetFlag(Conditions.Adding) ? "Add" : "Edit"), (GetFlag(Conditions.Category) ? "Category" : "Location")) );

			AddLabel( 625, 145, 0, "Name :" );
			AddImage( 555, 170, 2446 );
			AddTextEntry( 565, 170, 160, 20, 0, 2, Name );

			if( !GetFlag(Conditions.Category) )
			{

				AddLabel( 570, 210, 0, "X Coordinate :" );
				AddImage( 670, 208, 2443 );
				AddTextEntry( 674, 210, 55, 20, 0, 3, Loc.X.ToString() );

				AddLabel( 570, 235, 0, "Y Coordinate :" );
				AddImage( 670, 233, 2443 );
				AddTextEntry( 674, 235, 55, 20, 0, 4, Loc.Y.ToString() );

				AddLabel( 570, 260, 0, "Z Coordinate :" );
				AddImage( 670, 258, 2443 );
				AddTextEntry( 674, 260, 55, 20, 0, 5, Loc.Z.ToString() );

				AddLabel( 605, 285, 0, "Hue :" );
				AddImage( 650, 283, 2443 );
				AddTextEntry( 654, 285, 55, 20, 0, 14, Hue.ToString() );

				AddLabel( 585, 315, 0, "Trammel" );
				AddRadio( 555, 315, 208, 209, (Map == Map.Trammel ? true : false), 6 );

				AddLabel( 585, 340, 0, "Felucca" );
				AddRadio( 555, 340, 208, 209, (Map == Map.Felucca ? true : false), 7 );

				AddLabel( 685, 315, 0, "Malas" );
				AddRadio( 655, 315, 208, 209, (Map == Map.Malas ? true : false), 8 );

				AddLabel( 685, 345, 0, "Ilshenar" );
				AddRadio( 655, 340, 208, 209, (Map == Map.Ilshenar ? true : false), 9 );

				AddLabel( 585, 365, 0, "Tokuno" );
				AddRadio( 555, 370, 208, 209, (Map == Map.Tokuno ? true : false), 10 );
			}

			AddLabel( 585, 395, 0, "Generate?" );
			AddCheck( 555, 395, 210, 211, Gen, 11 );

			AddLabel( 585, 420, 0, "Staff Only?" );
			AddCheck( 555, 420, 210, 211, Staff, 12 );

			AddLabel( 585, 445, 0, "Reds?" );
			AddCheck( 555, 445, 210, 211, Reds, 13 );

			AddButton( 700, 450, 1417, 1417, 1, GumpButtonType.Reply, 0 );
			AddLabel( 728, 481, 69, "Apply" );
		}

		private EntryFlag Flags;
		private void SetFlag( EntryFlag flag, bool value )
		{
			if( value )
				Flags |= flag;
			else Flags &= ~flag;
		}

		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;
			int BID = info.ButtonID;
			if( BID == 0 )
				return;

			SetFlag( EntryFlag.Generate, info.IsSwitched( 11 ) );
			SetFlag( EntryFlag.StaffOnly, info.IsSwitched( 12 ) );
			SetFlag( EntryFlag.Reds, info.IsSwitched( 13 ) );

			Map Map = null;
			for( int i = 0; i < info.Switches.Length; i++ )
			{
				int m = info.Switches[i];
				switch( m )
				{
					case 6:  Map = Map.Trammel;  break;
					case 7:  Map = Map.Felucca;  break;
					case 8:  Map = Map.Malas;    break;
					case 9:  Map = Map.Ilshenar; break;
					case 10: Map = Map.Tokuno;   break;
				}
			}


			TextRelay NR = info.GetTextEntry( 2 );
			TextRelay XR = info.GetTextEntry( 3 );
			TextRelay YR = info.GetTextEntry( 4 );
			TextRelay ZR = info.GetTextEntry( 5 );
			TextRelay HR = info.GetTextEntry( 14 );
			string NS = (NR == null ? null : NR.Text.Trim());
			string XS = (XR == null ? null : XR.Text.Trim());
			string YS = (YR == null ? null : YR.Text.Trim());
			string ZS = (ZR == null ? null : ZR.Text.Trim());
			string HS = (HR == null ? null : HR.Text.Trim());

			if( BID == 1 )
			{
				if( GetFlag( Conditions.Category ) )
				{
					if( GetFlag( Conditions.Adding ) )
					{
						if( NS == null || NS.Length == 0 )
						{
							from.SendMessage( "Please enter a name for this Category." );
							from.CloseGump( typeof( PGAddEditGump ) );
							from.SendGump( new PGAddEditGump( m_Conditions, m_CurCat, m_CurLoc, m_Gate ) );
							return;
						}

						PGSystem.Entries.Add( new PGCategory( NS, Flags ) );
					}

					else
					{
						if( NS == null || NS.Length == 0 )
						{
							from.SendMessage( "Removed the Category." );
							PGSystem.Entries.RemoveAt( m_CurCat );
							m_CurCat = 0;
						}

						else
						{
							from.SendMessage( "Changed the Category." );
							PGSystem.Entries[m_CurCat] = new PGCategory( NS, Flags );
						}
					}
				}

				else
				{
					if( NS == null || NS.Length == 0 ||
						XS == null || XS.Length == 0 ||
						YS == null || YS.Length == 0 ||
						ZS == null || ZS.Length == 0 ||
						HS == null || HS.Length == 0 )
					{
						if( GetFlag( Conditions.Adding ) )
						{
							from.SendMessage( "Please fill in each field." );
							from.CloseGump( typeof( PGAddEditGump ) );
							from.SendGump( new PGAddEditGump( m_Conditions, m_CurCat, m_CurLoc, m_Gate ) );
							return;
						}

						from.SendMessage( "Removed the Location." );
						((PGCategory)PGSystem.Entries[m_CurCat]).Locations.RemoveAt( m_CurLoc );
					}

					else if( Map == null )
					{
						from.SendMessage( "Please select a Map." );
						from.CloseGump( typeof( PGAddEditGump ) );
						from.SendGump( new PGAddEditGump( m_Conditions, m_CurCat, m_CurLoc, m_Gate ) );
						return;
					}

					else
					{
						int x, y, z, h = 0;
						Point3D Loc;
						int Hue;
						try
						{
							x = Int32.Parse( XS );
							y = Int32.Parse( YS );
							z = Int32.Parse( ZS );
							h = Int32.Parse( HS );
							Loc = new Point3D( x, y, z );
							Hue = h;
						}
						catch
						{
							from.SendMessage( "Please enter an integer in each of the info fields. (X, Y, Z, H)" );
							from.CloseGump( typeof( PGAddEditGump ) );
							from.SendGump( new PGAddEditGump( m_Conditions, m_CurCat, m_CurLoc, m_Gate ) );
							return;
						}

						PGLocation PGL = new PGLocation( NS, Flags, Loc, Map, Hue );
						if( PGL == null )
						{
							from.SendMessage( "Bad Location information, can't add!" );
							from.CloseGump( typeof( PGAddEditGump ) );
							from.SendGump( new PGAddEditGump( m_Conditions, m_CurCat, m_CurLoc, m_Gate ) );
							return;
						}

						if( GetFlag( Conditions.Adding ) )
						{
							from.SendMessage( "Added the Location." );
							((PGCategory)PGSystem.Entries[m_CurCat]).Locations.Add( PGL );
						}
						else
						{
							from.SendMessage( "Changed the Location." );
							((PGCategory)PGSystem.Entries[m_CurCat]).Locations[m_CurLoc] = PGL;
						}
					}
				}

				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, m_CurCat, m_Gate ) );
			}
		}
	}
}
PGGump.cs
Code:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;

namespace Server.PG
{
	public class PGGump : Gump
	{
		private Mobile     m_From;
		private int        m_Page;
		private PublicGate m_Gate;

		private EntryFlag EFlags;
		private void SetFlag( EntryFlag flag, bool value )
		{
			if( value )
				EFlags |= flag;
			else EFlags &= ~flag;
		}

		public PGGump( Mobile from, int Page, PublicGate gate ) : base( 0, 0 )
		{
			if( !PGSystem.Running )
				return;

			if( PGSystem.Entries == null || PGSystem.Entries.Count == 0 )
			{
				SetFlag( EntryFlag.StaffOnly, true );
				SetFlag( EntryFlag.Generate, false );
				PGSystem.Entries.Add( new PGCategory( "Empty System", EFlags ) );
			}

			m_From = from;
			m_Page = Page;
			m_Gate = gate;

			Closable = true;
			Disposable = true;
			Dragable = true;
			Resizable = false;

			AddPage(0);

			#region Categories
			int Cats = CountCats();

			int CStart = (250 - ((Cats / 2) * 25));
			if( CStart < 0 )
				CStart = 0;

			AddBackground( 0, CStart, 230, 100+Cats*25, 2600 );
			AddHtml( 0, CStart+15, 230, 20, "<BASEFONT SIZE=7><CENTER>Public Moongate</CENTER></BASEFONT>", false, false );

			int CurC = 0;
			for( int i = 0; i < PGSystem.Entries.Count; i++ )
			{
				PGCategory PGC = (PGCategory)PGSystem.Entries[i];
				if( PGC != null )
				{
					if( (PGC.GetFlag( EntryFlag.StaffOnly ) && from.AccessLevel > AccessLevel.Player) ||
						(!PGC.GetFlag( EntryFlag.StaffOnly ) && ((!PGC.GetFlag( EntryFlag.Reds ) && from.Kills < 5) || PGC.GetFlag( EntryFlag.Reds ))) ||
						(from.AccessLevel > AccessLevel.Player) )
					{
						AddButton( 20, CStart+53+CurC*25, (Page == i ? 209 : 208), (Page == i ? 208 : 209), 100+i, GumpButtonType.Reply, 0);
						AddLabel( 50, CStart+53+CurC*25, (Page == i ? 69 : 0), PGC.Name );
						CurC++;
					}
				}
			}

			if( from.AccessLevel >= AccessLevel.GameMaster )
			{
				AddLabel( 75, CStart+65+Cats*25, 0, "Add" );
				AddButton( 50, CStart+65+Cats*25, 208, 209, 2, GumpButtonType.Reply, 0 );
				AddLabel( 125, CStart+65+Cats*25, 0, "Edit" );
				AddButton( 160, CStart+65+Cats*25, 208, 209, 3, GumpButtonType.Reply, 0 );
			}
			#endregion //Categories

			#region Locations
			int Locs = CountLocs();

			int LStart = (250 - ((Locs / 2) * 25));
			if( LStart < 20 )
				LStart = 20;

			AddBackground( 230, LStart, 300, 100+Locs*25, 2600 );

			int CurL = 0;
			PGCategory PGCL = (PGCategory)PGSystem.Entries[m_Page];
			if( PGCL != null && PGCL.Locations != null )
			{
				for( int i = 0; i < PGCL.Locations.Count; i++ )
				{
					PGLocation PGL = (PGLocation)PGCL.Locations[i];
					if( PGL != null )
					{
						if( (PGL.GetFlag( EntryFlag.StaffOnly ) && from.AccessLevel > AccessLevel.Player) ||
							(!PGL.GetFlag( EntryFlag.StaffOnly ) && ((!PGL.GetFlag( EntryFlag.Reds ) && from.Kills < 5) || PGL.GetFlag( EntryFlag.Reds ))) ||
							(from.AccessLevel > AccessLevel.Player) )
						{
							AddRadio( 250, LStart+53+CurL*25, 208, 209, false, 200+i );
							AddLabel( 280, LStart+53+CurL*25, 0, PGL.Name );
							CurL++;
						}
					}
				}
			}

			AddButton( 465, LStart-20, 1417, 1417, 1, GumpButtonType.Reply, 0);
			AddHtml( 485, LStart+10, 40, 40, "<BODY><BASEFONT SIZE=7 COLOR=#33AA33><CENTER><I><B>GO</B></I></CENTER></BASEFONT></BODY>", false, false);

			if( from.AccessLevel >= AccessLevel.GameMaster )
			{
				AddLabel( 305, LStart+65+Locs*25, 0, "Add" );
				AddButton( 280, LStart+65+Locs*25, 208, 209, 4, GumpButtonType.Reply, 0 );
				AddLabel( 430, LStart+65+Locs*25, 0, "Edit" );
				AddButton( 460, LStart+65+Locs*25, 208, 209, 5, GumpButtonType.Reply, 0);
			}
			#endregion //Locations
		}

		private int CountCats()
		{
			int count = 0;
			foreach( PGCategory PGC in PGSystem.Entries )
			{
				if( (PGC.GetFlag( EntryFlag.StaffOnly ) && m_From.AccessLevel > AccessLevel.Player) ||
					(!PGC.GetFlag( EntryFlag.StaffOnly ) && ((!PGC.GetFlag( EntryFlag.Reds ) && m_From.Kills < 5) || PGC.GetFlag( EntryFlag.Reds ))) ||
					(m_From.AccessLevel > AccessLevel.Player) )
					count++;
			}
			return count;
		}

		private int CountLocs()
		{
			int count = 0;
			PGCategory PGC = (PGCategory)PGSystem.Entries[m_Page];
			if( PGC != null && PGC.Locations != null )
			{
				foreach( PGLocation PGL in PGC.Locations )
				{
					if( (PGL.GetFlag( EntryFlag.StaffOnly ) && m_From.AccessLevel > AccessLevel.Player) ||
						(!PGL.GetFlag( EntryFlag.StaffOnly ) && ((!PGL.GetFlag( EntryFlag.Reds ) && m_From.Kills < 5) || PGL.GetFlag( EntryFlag.Reds ))) ||
						(m_From.AccessLevel > AccessLevel.Player) )
						count++;
				}
			}
			return count;
		}

		private Conditions Flags;
		private void SetFlag( Conditions flag, bool value )
		{
			if( value )
				Flags |= flag;
			else Flags &= ~flag;
		}

		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile from = state.Mobile;
			int BID = info.ButtonID;
			int Loc = -1;

			if( !PGSystem.Running )
				return;

			if( m_From.Deleted || m_Gate.Deleted || m_From.Map == null )
				return;

			if( info.Switches.Length > 0 )
				Loc = info.Switches[0];

			Loc -= 200;

			if( BID == 0 )
			{
				from.SendMessage( "You chose not to go anywhere." );
				return;
			}

			if( BID == 1 )
			{
				if( Loc <= -1 )
				{
					from.SendMessage( "You must select a location!" );
					return;
				}

				PGCategory PGC = (PGCategory)PGSystem.Entries[m_Page];
				if( PGC == null )
					return;

				PGLocation PGL = (PGLocation)PGC.Locations[Loc];
				if( PGL == null )
					return;

				if ( !from.InRange( m_Gate.GetWorldLocation(), 1 ) || from.Map != m_Gate.Map )
				{
					from.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
				}
				else if ( Factions.Sigil.ExistsOn( from ) && PGL.Map != Factions.Faction.Facet )
				{
					from.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
				}
				else if ( from.Criminal )
				{
					from.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
				}
				else if ( Server.Spells.SpellHelper.CheckCombat( from ) )
				{
					from.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
				}
				else if ( from.Spell != null )
				{
					from.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
				}
				else if ( from.Map == PGL.Map && from.InRange( PGL.Location, 1 ) )
				{
					from.SendLocalizedMessage( 1019003 ); // You are already there.
				}
				else
				{
					BaseCreature.TeleportPets( from, PGL.Location, PGL.Map );

					from.Combatant = null;
					from.Warmode = false;
					from.Hidden = true;

					from.MoveToWorld( PGL.Location, PGL.Map );

					Effects.PlaySound( PGL.Location, PGL.Map, 0x1FE );
					from.SendMessage( "You have been teleported to: " + PGL.Name );
				}
			}

			else if( BID >= 100 )
			{
				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, BID-100, m_Gate ) );
			}

			else if( BID == 2 )
			{
				SetFlag( Conditions.Adding, true );
				SetFlag( Conditions.Category, true );

				from.CloseGump( typeof( PGAddEditGump ) );
				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, m_Page, m_Gate ) );
				from.SendGump( new PGAddEditGump( Flags, m_Page, -1, m_Gate ) );
			}

			else if( BID == 3 )
			{
				SetFlag( Conditions.Adding, false );
				SetFlag( Conditions.Category, true );

				from.CloseGump( typeof( PGAddEditGump ) );
				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, m_Page, m_Gate ) );
				from.SendGump( new PGAddEditGump( Flags, m_Page, -1, m_Gate ) );
			}

			else if( BID == 4 )
			{
				SetFlag( Conditions.Adding, true );
				SetFlag( Conditions.Category, false );

				from.CloseGump( typeof( PGAddEditGump ) );
				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, m_Page, m_Gate ) );
				from.SendGump( new PGAddEditGump( Flags, m_Page, Loc, m_Gate ) );
			}

			else if( BID == 5 )
			{
				SetFlag( Conditions.Adding, false );
				SetFlag( Conditions.Category, false );

				from.CloseGump( typeof( PGAddEditGump ) );
				from.CloseGump( typeof( PGGump ) );
				from.SendGump( new PGGump( from, m_Page, m_Gate ) );
				from.SendGump( new PGAddEditGump( Flags, m_Page, Loc, m_Gate ) );
			}

			else
			{
				from.SendMessage( "Undefined button pressed: {0}", BID );
			}
		}
	}
}
Thanks.
Darke456 is offline  
Old 05-27-2005, 03:11 AM   #18 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

That's exactly what I needed, thanks. And it's fixed and updated. Only file changed is PGGump.cs.
A_Li_N is offline  
Old 05-27-2005, 05:13 AM   #19 (permalink)
 
Join Date: Dec 2003
Location: UK
Age: 24
Posts: 78
Default Yay

just woke up seen another update installed it all and it has turned out well. have a pat on the back
DemonicSeed is offline  
Old 05-27-2005, 03:22 PM   #20 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Thanks that works , only one more question, how do i get it to work with a gate i place somewhere else, i place it and the original gump comes up but not the one that comes up for your system, any ideas?
Darke456 is offline  
Old 05-27-2005, 03:34 PM   #21 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

Quote:
Originally Posted by Darke456
Thanks that works , only one more question, how do i get it to work with a gate i place somewhere else, i place it and the original gump comes up but not the one that comes up for your system, any ideas?
You mean after you initpublicgates, set your locations and want to just make a random gate? Just do [add publicgate and it'll read from the system.
A_Li_N is offline  
Old 05-27-2005, 03:52 PM   #22 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Quote:
Originally Posted by A_Li_N
You mean after you initpublicgates, set your locations and want to just make a random gate? Just do [add publicgate and it'll read from the system.
I must be blind because i cant find that command anywhere in the first post, but it works thanks again.
Darke456 is offline  
Old 05-27-2005, 04:22 PM   #23 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

The [add publicgate? I figured since it's a built in command with RunUO ([add) I didn't need to mention it. If you want to add a publicgate that is not listed in the system, you would just add a publicgate, just like publicmoongates. The system automatically makes the ones in the system, but if you want more, you would [add publicmoongate.
A_Li_N is offline  
Old 05-28-2005, 01:57 AM   #24 (permalink)
 
Join Date: Feb 2005
Posts: 37
Default

Quote:
Originally Posted by A_Li_N
The [add publicgate? I figured since it's a built in command with RunUO ([add) I didn't need to mention it. If you want to add a publicgate that is not listed in the system, you would just add a publicgate, just like publicmoongates. The system automatically makes the ones in the system, but if you want more, you would [add publicmoongate.
hmm i did try add publicmoongate i dont think it works with your system,
i dont know ill have to try again, anyway works great now, at least i wont have to mess with the other scripts now, Thanks again
Darke456 is offline  
Old 05-28-2005, 02:01 AM   #25 (permalink)
Forum Expert
 
A_Li_N's Avatar
 
Join Date: Apr 2004
Location: Another state of mind
Age: 27
Posts: 2,875
Default

[add is a built in command to RunUO...it allows you to add the items. If you want to add one of my gates, you would type [add publicgate
A_Li_N is offline