Potential deletion of item outside of main thread issue resolved

Item.Spawner now uses CompactInfo for memory savings.
Empty accounts (No Characters) can now be set to go inactive sooner than accounts with characters.
This commit is contained in:
asayre 2011-12-31 07:50:54 +00:00
parent 6a98ff0965
commit d2f79e93ea
5 changed files with 60 additions and 21 deletions

View file

@ -19,6 +19,8 @@ namespace Server.Accounting
public static readonly TimeSpan YoungDuration = TimeSpan.FromHours( 40.0 );
public static readonly TimeSpan InactiveDuration = TimeSpan.FromDays( 180.0 );
public static readonly TimeSpan EmptyInactiveDuration = TimeSpan.FromDays( 30.0 );
private string m_Username, m_PlainPassword, m_CryptPassword, m_NewCryptPassword;
private AccessLevel m_AccessLevel;
@ -221,11 +223,19 @@ namespace Server.Accounting
}
/// <summary>
/// An account is considered inactive based upon LastLogin and InactiveDuration
/// An account is considered inactive based upon LastLogin and InactiveDuration. If the account is empty, it is based upon EmptyInactiveDuration
/// </summary>
public bool Inactive
{
get { return ( ( m_LastLogin + InactiveDuration ) <= DateTime.Now && AccessLevel == AccessLevel.Player ); }
get
{
if( this.AccessLevel != AccessLevel.Player )
return false;
TimeSpan inactiveLength = DateTime.Now - m_LastLogin;
return (inactiveLength > ((this.Count == 0) ? EmptyInactiveDuration : InactiveDuration));
}
}
/// <summary>

View file

@ -210,7 +210,7 @@ namespace Server.Commands
int[] countTable = typeTable[itemType] as int[];
if ( countTable == null )
typeTable[itemType] = countTable = new int[8];
typeTable[itemType] = countTable = new int[9];
if ( ( flags & ExpandFlag.Name ) != 0 )
++countTable[0];
@ -236,6 +236,9 @@ namespace Server.Commands
if ( ( flags & ExpandFlag.Weight ) != 0 )
++countTable[7];
if ((flags & ExpandFlag.Spawner) != 0)
++countTable[8];
itemType = itemType.BaseType;
} while ( itemType != typeof( object ) );
}
@ -253,7 +256,8 @@ namespace Server.Commands
"Blessed",
"TempFlag",
"SaveFlag",
"Weight"
"Weight",
"Spawner"
};
ArrayList list = new ArrayList( typeTable );