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!

Pre-UO:R Moongates

panther

Sorceror
Pre-UO:R Moongates

In case anyone else is interested in pre-UO:R moongates, here's a replacement for Scripts\Misc\PublicMoongates.cs. This is designed to work only with Felucca, though adding in Trammel would be simple. Including the other facets would require more work. In addition to this script you will likely need to modify ExchantedSextant.cs in Scripts\Engines\Quests\Core\Items in order to remove references to the other facet moongates. I've included my modified script for that as well.

For those of you who may not remember, or perhaps weren't around at the time, moongates used to work based on the time of day. There was no gump - you were simply teleported to another moongate depending on the number of "steps" to the next city. How many steps taken depended on the time of day with 8 steps total in a 2 hour cycle.
 

Attachments

  • EnchantedSextant.cs
    3.6 KB · Views: 171
  • PublicMoongate.cs
    7.5 KB · Views: 207

mr_wuss

Wanderer
did you work this from memory? or did you find a site that gave specifics on the steps system, I remember these gates and it added so much to the game when they were still around.
Kudos on the release.
 

panther

Sorceror
mr_wuss said:
did you work this from memory? or did you find a site that gave specifics on the steps system, I remember these gates and it added so much to the game when they were still around.
Kudos on the release.

Thanks. No, it wasn't entirely from memory. I've a lot of pre-UO:R information saved. I rarely delete anything; good thing hard drives keep getting bigger. :)
There was a problem with my initial post - when you moved over the moongate instead of double-clicking you wouldn't go anywhere. Just a reverse logic problem in the OnMoveOver function. I've posted the corrected version.
 

panther

Sorceror
Vodras said:
Has anyone had any problems getting the OnSingleClick function of describing the destination gate? I haven't been able to get it to work. I am using version 1.0 RC0.
I have modified the script to do the description by using OnDoubleClick instead (single clicking only gave me "moongate") I had to disable the normal Double Click function of using the gate and i am left with the OnMoveOver option only, but this does work. If you are interested i will send you my modifications to the script.
I'm afraid that my script was written for a non-AoS configured server. AoS single-click descriptions are handled differently, but I think that most of the people using this script are running non-AoS servers.
 

RoninGT

Sorceror
Didnt the old moongates go by the moon phases???
God i hated them lol back and forth to brit from yew like 60 times...
when public transportation systems werent all that hehehe.
Anyway nice script. was wondering when someone would make them :)

Ronin
 

panther

Sorceror
RoninGT said:
Didnt the old moongates go by the moon phases???
God i hated them lol back and forth to brit from yew like 60 times...
when public transportation systems werent all that hehehe.
Anyway nice script. was wondering when someone would make them :)
LOL
You hated them and wanted them back? Yes, they were a bit more tedious to use, but I guess that's part of what I miss....the little stuff that made the game more challenging. You would actually learn the moongate cycle order and carry a timepiece with you!
 

RoninGT

Sorceror
Well yes i hated them but i am the gm now LOL [tele LOL and we are making a 2nd Pre AOS server here soon and want it as old school as possiable. But again its a nice piece of work bro

Thanks

Ronin
 

Warloxx

Sorceror
OK I give, I can't seem to make this work. I have done the research and added the the things, ( I think ) are needed. It compiles but I still cant get the "OnSingelClick" to work. I am running an AOS server. Here is the Scripts.

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Commands;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Targeting;
using Server.ContextMenus;


// UnrealUO - Returned to pre-UO:R behavior

namespace Server.Items
{
	public class PublicMoongate : Item
	{
		[Constructable]
		public PublicMoongate() : base( 0xF6C )
		{
			Movable = false;
			Light = LightType.Circle300;
		}

		public PublicMoongate( Serial serial ) : base( serial )
		{
		}
[COLOR="Red"]
		public override void OnSingleClick( Mobile from )
		{
			base.OnSingleClick( from );

			int mgate = 0, steptime, steps, number;
			int hours, minutes, totalMinutes;
			PMList moongates = PMList.Felucca;

			foreach ( PMEntry entry in moongates.Entries )
			{
				if ( this.Location == entry.Location )
					break;
				else
					mgate++;
			}
			if ( mgate > 7 ) // Invalid
				return;

			Clock.GetTime( from.Map, from.X, from.Y, out hours, out minutes, out totalMinutes );
			steptime = ((hours % 2) * 6) + (int)(minutes / 10);
			switch ( steptime )
			{
				case 0: steps = 0; break;
				case 1:
				case 2: steps = 1; break;
				case 3: steps = 2; break;
				case 4:
				case 5: steps = 3; break;
				case 6: steps = 4; break;
				case 7:
				case 8: steps = 5; break;
				case 9: steps = 6; break;
				case 10:
				case 11: steps = 7; break;
				default: return;
			}

			mgate += steps;
			if ( mgate > 7 )
				mgate -= 8;

			switch ( mgate )
			{
    				case 0: number = 1005390; break; // Britain	...see a road to the east and mountains in the distance to the west.
    				case 1: number = 1005389; break; // Moonglow	...see a small escarpment to the south and a large city to the North.
    				case 2: number = 1005396; break; // Magincia	...see what appears to be a small peninsula covered in lush foliage.
    				case 3: number = 1005395; break; // Skara Brae	...see a small city to the south, while a vast ocean lies in all other directions.
    				case 4: number = 1005394; break; // Trinsic	...see a large sandstone city standing on a far bank of the river to the north.
    				case 5: number = 1005393; break; // Minoc	...can just make out a road to the southwest and a river to the north.
    				case 6: number = 1005392; break; // Yew		...see deep forest on all sides.
    				case 7: number = 1005391; break; // Jhelom	...see a vast body of water to the east while to the west a city can be seen nearby.
    				default: number = 1005397; break; // The moongate is cloudy, and nothing can be made out.
			}
			LabelTo( from, number );
		}
[/COLOR]
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.Player )
				return;

			if ( from.InRange( GetWorldLocation(), 1 ) )
				UseGate( from );
			else
				from.SendLocalizedMessage( 500446 ); // That is too far away.
		}

		public override bool OnMoveOver( Mobile m )
		{
			if ( !m.Player )
				return true;
			return !UseGate( m );
		}

		public bool UseGate( Mobile m )
		{
			if ( m.Criminal )
			{
				m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
				return false;
			}
			else if ( Server.Spells.SpellHelper.CheckCombat( m ) )
			{
				m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
				return false;
			}
			else if ( m.Spell != null )
			{
				m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
				return false;
			}
			else
			{
				int mgate = 0, steptime, steps;
				int hours, minutes, totalMinutes;
				PMList moongates = PMList.Felucca;

				foreach ( PMEntry entry in moongates.Entries )
				{
					if ( this.Location == entry.Location )
						break;
					else
						mgate++;
				}
				if ( mgate > 7 ) // Invalid
					return false;

				Clock.GetTime( m.Map, m.X, m.Y, out hours, out minutes, out totalMinutes );
				steptime = ((hours % 2) * 6) + (int)(minutes / 10);
				switch ( steptime )
				{
					case 0: steps = 0; break;
					case 1:
					case 2: steps = 1; break;
					case 3: steps = 2; break;
					case 4:
					case 5: steps = 3; break;
					case 6: steps = 4; break;
					case 7:
					case 8: steps = 5; break;
					case 9: steps = 6; break;
					case 10:
					case 11: steps = 7; break;
					default: return false;
				}

				mgate += steps;
				if ( mgate > 7 )
					mgate -= 8;

				BaseCreature.TeleportPets( m, moongates.Entries[mgate].Location, m.Map );

				m.Combatant = null;
				m.Warmode = false;
				m.Hidden = false;

				m.MoveToWorld( moongates.Entries[mgate].Location, m.Map );

				Effects.PlaySound( moongates.Entries[mgate].Location, m.Map, 0x1FE );

				return true;
			}
		}

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

			writer.Write( (int) 0 ); // version
		}

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

			int version = reader.ReadInt();
		}

		public static void Initialize()
		{
			CommandSystem.Register( "MoonGen", AccessLevel.Administrator, new CommandEventHandler( MoonGen_OnCommand ) );
		}

		[Usage( "MoonGen" )]
		[Description( "Generates public moongates. Removes all old moongates." )]
		public static void MoonGen_OnCommand( CommandEventArgs e )
		{
			DeleteAll();

			int count = 0;

			count += MoonGen( PMList.Felucca );

			World.Broadcast( 0x35, true, "{0} moongates generated.", count );
		}
//-------------------------------------------------------------------------------------------------
		private static void DeleteAll()
		{
			List<Item> list = new List<Item>();

			foreach ( Item item in World.Items.Values )
			{
				if ( item is PublicMoongate )
					list.Add( item );
			}

			foreach ( Item item in list )
				item.Delete();

			if ( list.Count > 0 )
				World.Broadcast( 0x35, true, "{0} moongates removed.", list.Count );
		}
//-------------------------------------------------------------------------------------------------
		private static int MoonGen( PMList list )
		{
			foreach ( PMEntry entry in list.Entries )
			{
				Item item = new PublicMoongate();

				item.MoveToWorld( entry.Location, list.Map );
			}

			return list.Entries.Length;
		}
	}

	public class PMEntry
	{
		private Point3D m_Location;
		private int m_Number;

		public Point3D Location
		{
			get
			{
				return m_Location;
			}
		}

		public int Number
		{
			get
			{
				return m_Number;
			}
		}

		public PMEntry( Point3D loc, int number )
		{
			m_Location = loc;
			m_Number = number;
		}
	}

	public class PMList
	{
		private int m_Number, m_SelNumber;
		private Map m_Map;
		private PMEntry[] m_Entries;

		public int Number
		{
			get
			{
				return m_Number;
			}
		}

		public int SelNumber
		{
			get
			{
				return m_SelNumber;
			}
		}

		public Map Map
		{
			get
			{
				return m_Map;
			}
		}

		public PMEntry[] Entries
		{
			get
			{
				return m_Entries;
			}
		}

		public PMList( int number, int selNumber, Map map, PMEntry[] entries )
		{
			m_Number = number;
			m_SelNumber = selNumber;
			m_Map = map;
			m_Entries = entries;
		}

		public static readonly PMList Felucca =
			new PMList( 1012001, 1012013, Map.Felucca, new PMEntry[]
				{
					new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
					new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
					new PMEntry( new Point3D( 3563, 2139, 34), 1012010 ), // Magincia
					new PMEntry( new Point3D(  643, 2067, 5 ), 1012009 ), // Skara Brae
					new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
					new PMEntry( new Point3D( 2701,  692, 5 ), 1012007 ), // Minoc
					new PMEntry( new Point3D(  771,  752, 5 ), 1012006 ), // Yew
					new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
				} );

	}
}

Thanks all. BTW Im not a very good coder so please be nice ;) Lol Im more a cut and paste guy... So far.
 
Top