progress on -service.. no input, safe choices, etc

add Account.Inactive and Account.InactiveDuration
refactor IsEligable to IsEligible
This commit is contained in:
mark 2009-08-08 06:30:34 +00:00
parent dd3c904944
commit bff9e9abe4
9 changed files with 94 additions and 57 deletions

View file

@ -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.

View file

@ -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
{

View file

@ -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 );
}

View file

@ -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() )
{

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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>();