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 01-22-2005, 03:42 AM   #1 (permalink)
 
Join Date: Jan 2005
Age: 24
Posts: 174
Send a message via MSN to aleon
Thumbs up Heres A Save Compiable Post For Runuo 1.0

well heres something that i complied with runuo 1.0

first create SaveGump.cs in the gump file which contain these codes:

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

namespace Server.Gumps
	{
	public class SaveGump : Gump
		{
		public SaveGump() : base( 200, 200 )
			{
			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;
			this.AddPage(0);
			this.AddBackground(223, 157, 293, 156, 9200);
			this.AddImage(232, 166, 7013);
			this.AddImage(300, 166, 7012);
			this.AddImage(368, 166, 7009);
			this.AddImage(436, 166, 7037);
			this.AddImage(232, 234, 7053);
			this.AddImage(300, 234, 7059);
			this.AddImage(436, 234, 7040);
			this.AddImage(368, 234, 7024);
			this.AddLabel(297, 158, 1173, @"Shard Name");
			this.AddLabel(305, 177, 1287, @"The Shard Is Being Saved");
			this.AddImage(413, 218, 5582);
			this.AddImage(236, 200, 103);
			this.AddLabel(258, 204, 1454, @"Due to the large");
			this.AddLabel(259, 220, 1454, @"amount of world");
			this.AddLabel(252, 238, 1454, @"data. This process");
			this.AddLabel(264, 255, 1454, @"may take up to");
			this.AddLabel(260, 274, 1454, @"several seconds");
			this.AddImage(451, 268, 1209);
			this.AddImage(461, 260, 1209);
			this.AddImage(468, 236, 1209);
			this.AddImage(468, 249, 1209);
			this.AddImage(437, 272, 1209);
			this.AddImage(425, 269, 1209);
			this.AddImage(406, 250, 1209);
			this.AddImage(450, 213, 1209);
			this.AddImage(413, 262, 1209);
			this.AddImage(461, 223, 1209);
			this.AddImage(411, 223, 1209);
			this.AddImage(405, 235, 1209);
			this.AddImage(422, 214, 1209);
			this.AddImage(436, 212, 1209);
			this.AddLabel(386, 294, 1169, @"www.xxx.com");
		}
	}
}
Then; change the auto save file with this:
Code:
using System;
using System.Reflection; 
using System.Collections; 
using System.IO;
using Server;
using Server.Network; 
using Server.Items; 
using Server.Mobiles; 
using Server.Misc; 
using Server.Accounting; 
using Server.Gumps;

namespace Server.Misc
{
	public class AutoSave : Timer
	{
		private static TimeSpan m_Delay = TimeSpan.FromMinutes( 45.0 );
		private static TimeSpan m_Warning = TimeSpan.Zero;
		//private static TimeSpan m_Warning = TimeSpan.FromSeconds( 45.0 );

		public static void Initialize()
		{
			new AutoSave().Start();
			Commands.Register( "SetSaves", AccessLevel.Administrator, new CommandEventHandler( SetSaves_OnCommand ) );
		}

		private static bool m_SavesEnabled = true;

		public static bool SavesEnabled
		{
			get{ return m_SavesEnabled; }
			set{ m_SavesEnabled = value; }
		}

		[Usage( "SetSaves <true | false>" )]
		[Description( "Enables or disables automatic shard saving." )]
		public static void SetSaves_OnCommand( CommandEventArgs e )
		{
			if ( e.Length == 1 )
			{
				m_SavesEnabled = e.GetBoolean( 0 );
				e.Mobile.SendMessage( "Saves have been {0}.", m_SavesEnabled ? "enabled" : "disabled" );
			}
			else
			{
				e.Mobile.SendMessage( "Format: SetSaves <true | false>" );
			}
		}

		public AutoSave() : base( m_Delay - m_Warning, m_Delay )
		{
			Priority = TimerPriority.OneMinute;
		}

		protected override void OnTick()
		{
			if ( !m_SavesEnabled || AutoRestart.Restarting )
				return;

			if ( m_Warning == TimeSpan.Zero )
			{
				Save();
			}
			else
			{
				int s = (int)m_Warning.TotalSeconds;
				int m = s / 60;
				s %= 60;

				if ( m > 0 && s > 0 )
					World.Broadcast( 0x35, true, "The world will save in {0} minute{1} and {2} second{3}.", m, m != 1 ? "s" : "", s, s != 1 ? "s" : "" );
				else if ( m > 0 )
					World.Broadcast( 0x35, true, "The world will save in {0} minute{1}.", m, m != 1 ? "s" : "" );
				else
					World.Broadcast( 0x35, true, "The world will save in {0} second{1}.", s, s != 1 ? "s" : "" );

				Timer.DelayCall( m_Warning, new TimerCallback( Save ) );
			}
		}

		public static void Save()
		{
			ArrayList mobs = new ArrayList( World.Mobiles.Values ); 

			if ( AutoRestart.Restarting )
				return;

			try{ Backup(); }
			catch{}

			foreach ( Mobile m in mobs ) 
			{
				m.SendGump ( new SaveGump() );
			}
			World.Save(false);
			foreach ( Mobile m in mobs ) 
			{
				m.CloseGump( typeof(SaveGump) );
			}

		}

		private static string[] m_Backups = new string[]
			{
				"Third Backup",
				"Second Backup",
				"Most Recent"
			};

		private static void Backup()
		{
			if ( m_Backups.Length == 0 )
				return;

			string root = Path.Combine( Core.BaseDirectory, "Backups\\Automatic" );

			if ( !Directory.Exists( root ) )
				Directory.CreateDirectory( root );

			string[] existing = Directory.GetDirectories( root );

			for ( int i = 0; i < m_Backups.Length; ++i )
			{
				DirectoryInfo dir = Match( existing, m_Backups[i] );

				if ( dir == null )
					continue;

				if ( i > 0 )
				{
					string timeStamp = FindTimeStamp( dir.Name );

					if ( timeStamp != null )
					{
						try{ dir.MoveTo( FormatDirectory( root, m_Backups[i - 1], timeStamp ) ); }
						catch{}
					}
				}
				else
				{
					try{ dir.Delete( true ); }
					catch{}
				}
			}

			string saves = Path.Combine( Core.BaseDirectory, "Saves" );

			if ( Directory.Exists( saves ) )
				Directory.Move( saves, FormatDirectory( root, m_Backups[m_Backups.Length - 1], GetTimeStamp() ) );
		}

		private static DirectoryInfo Match( string[] paths, string match )
		{
			for ( int i = 0; i < paths.Length; ++i )
			{
				DirectoryInfo info = new DirectoryInfo( paths[i] );

				if ( info.Name.StartsWith( match ) )
					return info;
			}

			return null;
		}

		private static string FormatDirectory( string root, string name, string timeStamp )
		{
			return Path.Combine( root, String.Format( "{0} ({1})", name, timeStamp ) );
		}

		private static string FindTimeStamp( string input )
		{
			int start = input.IndexOf( '(' );

			if ( start >= 0 )
			{
				int end = input.IndexOf( ')', ++start );

				if ( end >= start )
					return input.Substring( start, end-start );
			}

			return null;
		}

		private static string GetTimeStamp()
		{
			DateTime now = DateTime.Now;

			return String.Format( "{0}-{1}-{2} {3}-{4:D2}-{5:D2}",
					now.Day,
					now.Month,
					now.Year,
					now.Hour,
					now.Minute,
					now.Second
				);
		}
	}
}
Well i changed alot of it but not the creator of it thanks runuo team for Runuo 1.0 Final
aleon is offline  
Old 01-22-2005, 03:50 AM   #2 (permalink)
P3'c Orion Aviator
 
Join Date: Sep 2004
Age: 30
Posts: 1,272
Default

Might want to edit out the name of your shard and website.. Just a suggestion before someone complains, and they will. But good work
-Jamie
sirens song is offline  
Old 01-22-2005, 03:57 AM   #3 (permalink)
 
Join Date: Jan 2005
Age: 24
Posts: 174
Send a message via MSN to aleon
Default

yeah your write sory i forgot to clean my shards name
aleon is offline  
Old 01-22-2005, 03:57 AM   #4 (permalink)
 
Join Date: Jan 2005
Age: 24
Posts: 174
Send a message via MSN to aleon
Default

also one factor is that i forgot that because i didnt sleep for 28 hours... waiting runo1.0
aleon is offline  
Old 01-22-2005, 03:59 AM   #5 (permalink)
RunUO Project Manager
 
Ryan's Avatar
 
Join Date: Jul 2004
Location: Harrison, OH
Age: 30
Posts: 3,627
Default

Put the code Code tags [ - code - ]
__________________
Ryan McAdams
RunUO Team - Project Manager

Ryan is offline  
Old 01-22-2005, 04:00 AM   #6 (permalink)
 
Join Date: Jan 2005
Age: 24
Posts: 174
Send a message via MSN to aleon
Default

rrr Ryan im a newbie you see what's that.. ok i'll handle it.
aleon is offline  
 

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