diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs
index fda7c4a37..e2fab1148 100644
--- a/Scripts/Accounting/Account.cs
+++ b/Scripts/Accounting/Account.cs
@@ -18,6 +18,8 @@ namespace Server.Accounting
{
public static readonly TimeSpan YoungDuration = TimeSpan.FromHours( 40.0 );
+ private static readonly TimeSpan InactiveDuration = TimeSpan.FromDays( 180.0 );
+
private string m_Username, m_PlainPassword, m_CryptPassword, m_NewCryptPassword;
private AccessLevel m_AccessLevel;
private int m_Flags;
@@ -218,6 +220,14 @@ namespace Server.Accounting
set { m_LastLogin = value; }
}
+ ///
+ /// An account is considered inactive based upon LastLogin and InactiveDuration
+ ///
+ public bool Inactive
+ {
+ get { return ( ( m_LastLogin + InactiveDuration ) <= DateTime.Now ); }
+ }
+
///
/// Gets the total game time of this account, also considering the game time of characters
/// that have been deleted.
diff --git a/Scripts/Commands/ConvertPlayers.cs b/Scripts/Commands/ConvertPlayers.cs
index e38efdec1..4aab1492f 100644
--- a/Scripts/Commands/ConvertPlayers.cs
+++ b/Scripts/Commands/ConvertPlayers.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
+using System.Threading;
using Server;
using Server.Items;
using Server.Mobiles;
@@ -53,9 +54,12 @@ namespace Server.Commands
NetState.ProcessDisposedQueue();
World.Save();
- Console.WriteLine( "{0} players have been converted to PlayerMobile. Please restart the server.", count );
- while ( true )
- Console.ReadLine();
+ Console.WriteLine( "{0} players have been converted to PlayerMobile. {1}.", count, Core.Service ? "The server is now restarting" : "Press any key to restart the server" );
+
+ if ( !Core.Service )
+ Console.ReadKey( true );
+
+ Core.Kill( true );
}
else
{
diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs
index 85088a39c..5959cd4d2 100644
--- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs
+++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs
@@ -931,7 +931,7 @@ namespace Server.Engines.CannedEvil
foreach (KeyValuePair kvp in m_DamageEntries)
{
- if( IsEligable( kvp.Key, artifact ) )
+ if( IsEligible( kvp.Key, artifact ) )
{
validEntries.Add( kvp.Key, kvp.Value );
totalDamage += kvp.Value;
@@ -967,7 +967,7 @@ namespace Server.Engines.CannedEvil
to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
}
- public bool IsEligable( Mobile m, Item Artifact )
+ public bool IsEligible( Mobile m, Item Artifact )
{
return m.Player && m.Alive && m.Region != null && m.Region == m_Region && m.Backpack != null && m.Backpack.CheckHold( m, Artifact, false );
}
diff --git a/Scripts/Gumps/AdminGump.cs b/Scripts/Gumps/AdminGump.cs
index 5de387f60..d8021a447 100644
--- a/Scripts/Gumps/AdminGump.cs
+++ b/Scripts/Gumps/AdminGump.cs
@@ -392,18 +392,18 @@ namespace Server.Gumps
AddButtonLabeled( 20, 150, GetButtonID( 3, 200 ), "Save" );
- if ( !Core.Service )
- {
+ /*if ( !Core.Service )
+ {*/
AddButtonLabeled( 20, 180, GetButtonID( 3, 201 ), "Shutdown (With Save)" );
AddButtonLabeled( 20, 200, GetButtonID( 3, 202 ), "Shutdown (Without Save)" );
AddButtonLabeled( 20, 230, GetButtonID( 3, 203 ), "Shutdown & Restart (With Save)" );
AddButtonLabeled( 20, 250, GetButtonID( 3, 204 ), "Shutdown & Restart (Without Save)" );
- }
+ /*}
else
{
AddLabel( 20, 215, LabelHue, "Shutdown/Restart not available." );
- }
+ }*/
AddHtml( 10, 295, 400, 20, Color( Center( "Broadcast" ), LabelColor32 ), false, false );
@@ -2353,7 +2353,7 @@ namespace Server.Gumps
{
ArrayList results = new ArrayList();
- DateTime minTime = DateTime.Now - TimeSpan.FromDays( 180.0 );
+ DateTime minTime = DateTime.Now - Account.InactiveDuration;
foreach ( Account acct in Accounts.GetAccounts() )
{
diff --git a/Scripts/Misc/CrashGuard.cs b/Scripts/Misc/CrashGuard.cs
index 54d006d46..fc7d15eef 100644
--- a/Scripts/Misc/CrashGuard.cs
+++ b/Scripts/Misc/CrashGuard.cs
@@ -31,9 +31,9 @@ namespace Server.Misc
if ( GenerateReport )
GenerateCrashReport( e );
- if ( Core.Service )
+ /*if ( Core.Service )
e.Close = true;
- else if ( RestartServer )
+ else */ if ( RestartServer )
Restart( e );
}
diff --git a/Scripts/Mobiles/Special/Harrower.cs b/Scripts/Mobiles/Special/Harrower.cs
index c8da2cc73..370902970 100644
--- a/Scripts/Mobiles/Special/Harrower.cs
+++ b/Scripts/Mobiles/Special/Harrower.cs
@@ -439,7 +439,7 @@ namespace Server.Mobiles
foreach (KeyValuePair kvp in m_DamageEntries)
{
- if( IsEligable( kvp.Key, artifact ) )
+ if( IsEligible( kvp.Key, artifact ) )
{
validEntries.Add( kvp.Key, kvp.Value );
totalDamage += kvp.Value;
@@ -475,7 +475,7 @@ namespace Server.Mobiles
to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
}
- public bool IsEligable( Mobile m, Item Artifact )
+ public bool IsEligible( Mobile m, Item Artifact )
{
return m.Player && m.Alive && m.InRange( Location, 32 ) && m.Backpack != null && m.Backpack.CheckHold( m, Artifact, false );
}
diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs
index f09a9dc7e..bc8083c2f 100644
--- a/Scripts/Multis/BaseHouse.cs
+++ b/Scripts/Multis/BaseHouse.cs
@@ -80,7 +80,7 @@ namespace Server.Multis
if ( !Core.AOS )
return DecayType.ManualRefresh;
- if ( (acct.LastLogin + TimeSpan.FromDays( 90.0 )) < DateTime.Now )
+ if ( acct.Inactive )
return DecayType.Condemned;
List allHouses = new List();
diff --git a/Server/Main.cs b/Server/Main.cs
index 95e77fe89..40dcc27e9 100644
--- a/Server/Main.cs
+++ b/Server/Main.cs
@@ -245,8 +245,12 @@ namespace Server
if ( SocketPool.Created )
SocketPool.Destroy();
- Console.WriteLine( "This exception is fatal, press return to exit" );
- Console.ReadLine();
+ if ( m_Service ) {
+ Console.WriteLine( "This exception is fatal." );
+ } else {
+ Console.WriteLine( "This exception is fatal, press return to exit" );
+ Console.ReadLine();
+ }
}
m_Closing = true;
@@ -422,7 +426,7 @@ namespace Server
Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", m_ProcessorCount, m_ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" );
int platform = (int)Environment.OSVersion.Platform;
- if ( platform == 4 || platform == 128 ) { // MS 4, MONO 128
+ if( platform == 4 || platform == 128 ) { // MS 4, MONO 128
m_Unix = true;
Console.WriteLine( "Core: Unix environment detected" );
}
@@ -434,8 +438,12 @@ namespace Server
while( !ScriptCompiler.Compile( m_Debug, m_Cache ) )
{
Console.WriteLine( "Scripts: One or more scripts failed to compile or no script files were found." );
- Console.WriteLine( " - Press return to exit, or R to try again." );
+
+ if( m_Service )
+ return;
+ Console.WriteLine( " - Press return to exit, or R to try again." );
+
if( Console.ReadKey( true ).Key != ConsoleKey.R )
return;
}
diff --git a/Server/World.cs b/Server/World.cs
index 9adce52d1..db2150a28 100644
--- a/Server/World.cs
+++ b/Server/World.cs
@@ -314,16 +314,21 @@ namespace Server {
if ( t == null ) {
Console.WriteLine( "failed" );
- Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
+
+ if ( !Core.Service ) {
+ Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
- if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
- types.Add( null );
- Console.Write( "World: Loading..." );
- continue;
+ if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
+ types.Add( null );
+ Console.Write( "World: Loading..." );
+ continue;
+ }
+
+ Console.WriteLine( "Types will not be deleted. An exception will be thrown." );
+ } else {
+ Console.WriteLine( "Error: Type '{0}' was not found.", typeName );
}
- Console.WriteLine( "Types will not be deleted. An exception will be thrown when you press return" );
-
throw new Exception( String.Format( "Bad type '{0}'", typeName ) );
}
@@ -394,16 +399,22 @@ namespace Server {
if ( t == null ) {
Console.WriteLine( "failed" );
- Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
+
+
+ if ( !Core.Service ) {
+ Console.WriteLine( "Error: Type '{0}' was not found. Delete all of those types? (y/n)", typeName );
- if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
- types.Add( null );
- Console.Write( "World: Loading..." );
- continue;
+ if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
+ types.Add( null );
+ Console.Write( "World: Loading..." );
+ continue;
+ }
+
+ Console.WriteLine( "Types will not be deleted. An exception will be thrown." );
+ } else {
+ Console.WriteLine( "Error: Type '{0}' was not found.", typeName );
}
- Console.WriteLine( "Types will not be deleted. An exception will be thrown when you press return" );
-
throw new Exception( String.Format( "Bad type '{0}'", typeName ) );
}
@@ -597,39 +608,43 @@ namespace Server {
Console.WriteLine( " - Type: {0}", failedType );
Console.WriteLine( " - Serial: {0}", failedSerial );
- Console.WriteLine( "Delete the object? (y/n)" );
+ if ( !Core.Service ) {
+ Console.WriteLine( "Delete the object? (y/n)" );
- if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
- if ( failedType != typeof( BaseGuild ) ) {
- Console.WriteLine( "Delete all objects of that type? (y/n)" );
+ if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
+ if ( failedType != typeof( BaseGuild ) ) {
+ Console.WriteLine( "Delete all objects of that type? (y/n)" );
- if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
- if ( failedMobiles ) {
- for ( int i = 0; i < mobiles.Count; ) {
- if ( mobiles[i].TypeID == failedTypeID )
- mobiles.RemoveAt( i );
- else
- ++i;
- }
- } else if ( failedItems ) {
- for ( int i = 0; i < items.Count; ) {
- if ( items[i].TypeID == failedTypeID )
- items.RemoveAt( i );
- else
- ++i;
+ if ( Console.ReadKey( true ).Key == ConsoleKey.Y ) {
+ if ( failedMobiles ) {
+ for ( int i = 0; i < mobiles.Count; ) {
+ if ( mobiles[i].TypeID == failedTypeID )
+ mobiles.RemoveAt( i );
+ else
+ ++i;
+ }
+ } else if ( failedItems ) {
+ for ( int i = 0; i < items.Count; ) {
+ if ( items[i].TypeID == failedTypeID )
+ items.RemoveAt( i );
+ else
+ ++i;
+ }
}
}
}
+
+ SaveIndex( mobiles, MobileIndexPath );
+ SaveIndex( items, ItemIndexPath );
+ SaveIndex( guilds, GuildIndexPath );
}
- SaveIndex( mobiles, MobileIndexPath );
- SaveIndex( items, ItemIndexPath );
- SaveIndex( guilds, GuildIndexPath );
+ Console.WriteLine( "After pressing return an exception will be thrown and the server will terminate." );
+ Console.ReadLine();
+ } else {
+ Console.WriteLine( "An exception will be thrown and the server will terminate." );
}
- Console.WriteLine( "After pressing return an exception will be thrown and the server will terminate" );
- Console.ReadLine();
-
throw new Exception( String.Format( "Load failed (items={0}, mobiles={1}, guilds={2}, type={3}, serial={4})", failedItems, failedMobiles, failedGuilds, failedType, failedSerial ), failed );
}