progress on -service.. no input, safe choices, etc
add Account.Inactive and Account.InactiveDuration refactor IsEligable to IsEligible
This commit is contained in:
parent
dd3c904944
commit
bff9e9abe4
9 changed files with 94 additions and 57 deletions
|
|
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An account is considered inactive based upon LastLogin and InactiveDuration
|
||||
/// </summary>
|
||||
public bool Inactive
|
||||
{
|
||||
get { return ( ( m_LastLogin + InactiveDuration ) <= DateTime.Now ); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total game time of this account, also considering the game time of characters
|
||||
/// that have been deleted.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -931,7 +931,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
foreach (KeyValuePair<Mobile, int> 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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ namespace Server.Mobiles
|
|||
|
||||
foreach (KeyValuePair<Mobile, int> 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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<BaseHouse> allHouses = new List<BaseHouse>();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MobileEntry>( mobiles, MobileIndexPath );
|
||||
SaveIndex<ItemEntry>( items, ItemIndexPath );
|
||||
SaveIndex<GuildEntry>( guilds, GuildIndexPath );
|
||||
}
|
||||
|
||||
SaveIndex<MobileEntry>( mobiles, MobileIndexPath );
|
||||
SaveIndex<ItemEntry>( items, ItemIndexPath );
|
||||
SaveIndex<GuildEntry>( 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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue