Implement Core.TickCount
Convert movement, actions (lift/use), combat, and spells to use Core.TickCount and avoid DateTime caveats (performance, system time dependency, etc) Refactor DateTime.Now to DateTime.UtcNow Add LOS check for Iron Maiden addon
This commit is contained in:
parent
f99eefb288
commit
d2c670f5c3
241 changed files with 842 additions and 831 deletions
|
|
@ -26,7 +26,7 @@ namespace Server.Factions
|
|||
|
||||
public List<Candidate> Candidates { get { return m_Candidates; } }
|
||||
|
||||
public ElectionState State{ get{ return m_State; } set{ m_State = value; m_LastStateTime = DateTime.Now; } }
|
||||
public ElectionState State{ get{ return m_State; } set{ m_State = value; m_LastStateTime = DateTime.UtcNow; } }
|
||||
public DateTime LastStateTime{ get{ return m_LastStateTime; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -47,7 +47,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
TimeSpan until = (m_LastStateTime + period) - DateTime.Now;
|
||||
TimeSpan until = (m_LastStateTime + period) - DateTime.UtcNow;
|
||||
|
||||
if ( until < TimeSpan.Zero )
|
||||
until = TimeSpan.Zero;
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
m_LastStateTime = DateTime.Now - period + value;
|
||||
m_LastStateTime = DateTime.UtcNow - period + value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ namespace Server.Factions
|
|||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
if ( (m_LastStateTime + PendingPeriod) > DateTime.Now )
|
||||
if ( (m_LastStateTime + PendingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
|
||||
|
|
@ -292,7 +292,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
if ( (m_LastStateTime + CampaignPeriod) > DateTime.Now )
|
||||
if ( (m_LastStateTime + CampaignPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
if ( m_Candidates.Count == 0 )
|
||||
|
|
@ -332,7 +332,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if ( (m_LastStateTime + VotingPeriod) > DateTime.Now )
|
||||
if ( (m_LastStateTime + VotingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
|
||||
|
|
@ -445,7 +445,7 @@ namespace Server.Factions
|
|||
else
|
||||
m_Address = IPAddress.None;
|
||||
|
||||
m_Time = DateTime.Now;
|
||||
m_Time = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public Voter( GenericReader reader, Mobile candidate )
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace Server.Factions
|
|||
}
|
||||
else
|
||||
{
|
||||
recvState.LastHonorTime = DateTime.Now;
|
||||
recvState.LastHonorTime = DateTime.UtcNow;
|
||||
giveState.KillPoints -= 5;
|
||||
recvState.KillPoints += 4;
|
||||
|
||||
|
|
@ -552,7 +552,7 @@ namespace Server.Factions
|
|||
if ( pl == null || !pl.IsLeaving )
|
||||
return false;
|
||||
|
||||
if ( (pl.Leaving + LeavePeriod) >= DateTime.Now )
|
||||
if ( (pl.Leaving + LeavePeriod) >= DateTime.UtcNow )
|
||||
return false;
|
||||
|
||||
mob.SendLocalizedMessage( 1005163 ); // You have now quit your faction
|
||||
|
|
@ -833,12 +833,12 @@ namespace Server.Factions
|
|||
{
|
||||
Sigil sigil = sigils[i];
|
||||
|
||||
if ( !sigil.IsBeingCorrupted && sigil.GraceStart != DateTime.MinValue && (sigil.GraceStart + Sigil.CorruptionGrace) < DateTime.Now )
|
||||
if ( !sigil.IsBeingCorrupted && sigil.GraceStart != DateTime.MinValue && (sigil.GraceStart + Sigil.CorruptionGrace) < DateTime.UtcNow )
|
||||
{
|
||||
if ( sigil.LastMonolith is StrongholdMonolith && ( sigil.Corrupted == null || sigil.LastMonolith.Faction != sigil.Corrupted ))
|
||||
{
|
||||
sigil.Corrupting = sigil.LastMonolith.Faction;
|
||||
sigil.CorruptionStart = DateTime.Now;
|
||||
sigil.CorruptionStart = DateTime.UtcNow;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -851,19 +851,19 @@ namespace Server.Factions
|
|||
|
||||
if ( sigil.LastMonolith == null || sigil.LastMonolith.Sigil == null )
|
||||
{
|
||||
if ( (sigil.LastStolen + Sigil.ReturnPeriod) < DateTime.Now )
|
||||
if ( (sigil.LastStolen + Sigil.ReturnPeriod) < DateTime.UtcNow )
|
||||
sigil.ReturnHome();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( sigil.IsBeingCorrupted && (sigil.CorruptionStart + Sigil.CorruptionPeriod) < DateTime.Now )
|
||||
if ( sigil.IsBeingCorrupted && (sigil.CorruptionStart + Sigil.CorruptionPeriod) < DateTime.UtcNow )
|
||||
{
|
||||
sigil.Corrupted = sigil.Corrupting;
|
||||
sigil.Corrupting = null;
|
||||
sigil.CorruptionStart = DateTime.MinValue;
|
||||
sigil.GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if ( sigil.IsPurifying && (sigil.PurificationStart + Sigil.PurificationPeriod) < DateTime.Now )
|
||||
else if ( sigil.IsPurifying && (sigil.PurificationStart + Sigil.PurificationPeriod) < DateTime.UtcNow )
|
||||
{
|
||||
sigil.PurificationStart = DateTime.MinValue;
|
||||
sigil.Corrupted = null;
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ namespace Server.Factions
|
|||
if ( m_Item == null || m_Item.Deleted )
|
||||
return true;
|
||||
|
||||
return ( m_Expiration != DateTime.MinValue && DateTime.Now >= m_Expiration );
|
||||
return ( m_Expiration != DateTime.MinValue && DateTime.UtcNow >= m_Expiration );
|
||||
}
|
||||
}
|
||||
|
||||
public void StartExpiration()
|
||||
{
|
||||
m_Expiration = DateTime.Now + ExpirationPeriod;
|
||||
m_Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server.Factions
|
|||
{
|
||||
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
|
||||
{
|
||||
if ( DateTime.Now >= (m_LastBroadcasts[i] + BroadcastPeriod) )
|
||||
if ( DateTime.UtcNow >= (m_LastBroadcasts[i] + BroadcastPeriod) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -36,15 +36,15 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsAtrophyReady{ get{ return DateTime.Now >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 )); } }
|
||||
public bool IsAtrophyReady{ get{ return DateTime.UtcNow >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 )); } }
|
||||
|
||||
public int CheckAtrophy()
|
||||
{
|
||||
if ( DateTime.Now < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
if ( DateTime.UtcNow < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
return 0;
|
||||
|
||||
int distrib = 0;
|
||||
m_LastAtrophy = DateTime.Now;
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
List<PlayerState> members = new List<PlayerState>( m_Members );
|
||||
|
||||
|
|
@ -72,9 +72,9 @@ namespace Server.Factions
|
|||
{
|
||||
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
|
||||
{
|
||||
if ( DateTime.Now >= (m_LastBroadcasts[i] + BroadcastPeriod) )
|
||||
if ( DateTime.UtcNow >= (m_LastBroadcasts[i] + BroadcastPeriod) )
|
||||
{
|
||||
m_LastBroadcasts[i] = DateTime.Now;
|
||||
m_LastBroadcasts[i] = DateTime.UtcNow;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ namespace Server.Factions
|
|||
m_Commander = reader.ReadMobile();
|
||||
|
||||
if ( version < 5 )
|
||||
m_LastAtrophy = DateTime.Now;
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
if ( version < 4 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace Server.Factions
|
|||
if ( Faction.CheckLeaveTimer( from ) )
|
||||
break;
|
||||
|
||||
TimeSpan remaining = ( pl.Leaving + Faction.LeavePeriod ) - DateTime.Now;
|
||||
TimeSpan remaining = ( pl.Leaving + Faction.LeavePeriod ) - DateTime.UtcNow;
|
||||
|
||||
if( remaining.TotalDays >= 1 )
|
||||
from.SendLocalizedMessage( 1042743, remaining.TotalDays.ToString( "N0" ) ) ;// Your term of service will come to an end in ~1_DAYS~ days.
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ namespace Server.Factions
|
|||
public Mobile GivenTo{ get{ return m_GivenTo; } }
|
||||
public DateTime TimeOfGift{ get{ return m_TimeOfGift; } }
|
||||
|
||||
public bool IsExpired{ get{ return ( m_TimeOfGift + ExpirePeriod ) < DateTime.Now; } }
|
||||
public bool IsExpired{ get{ return ( m_TimeOfGift + ExpirePeriod ) < DateTime.UtcNow; } }
|
||||
|
||||
public SilverGivenEntry( Mobile givenTo )
|
||||
{
|
||||
m_GivenTo = givenTo;
|
||||
m_TimeOfGift = DateTime.Now;
|
||||
m_TimeOfGift = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ namespace Server.Factions
|
|||
|
||||
public bool TaxChangeReady
|
||||
{
|
||||
get{ return ( m_State.LastTaxChange + TaxChangePeriod ) < DateTime.Now; }
|
||||
get{ return ( m_State.LastTaxChange + TaxChangePeriod ) < DateTime.UtcNow; }
|
||||
}
|
||||
|
||||
public static Town FromRegion( Region reg )
|
||||
|
|
@ -224,7 +224,7 @@ namespace Server.Factions
|
|||
|
||||
public void CheckIncome()
|
||||
{
|
||||
if ( (LastIncome + IncomePeriod) > DateTime.Now || Owner == null )
|
||||
if ( (LastIncome + IncomePeriod) > DateTime.UtcNow || Owner == null )
|
||||
return;
|
||||
|
||||
ProcessIncome();
|
||||
|
|
@ -232,7 +232,7 @@ namespace Server.Factions
|
|||
|
||||
public void ProcessIncome()
|
||||
{
|
||||
LastIncome = DateTime.Now;
|
||||
LastIncome = DateTime.UtcNow;
|
||||
|
||||
int flow = NetCashFlow;
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ namespace Server.Factions
|
|||
|
||||
if ( m_State.Owner == null ) // going from unowned to owned
|
||||
{
|
||||
LastIncome = DateTime.Now;
|
||||
LastIncome = DateTime.UtcNow;
|
||||
f.Silver += SilverCaptureBonus;
|
||||
}
|
||||
else if ( f == null ) // going from owned to unowned
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue