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
|
|
@ -32,11 +32,11 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if ( (pm.LastCompassionLoss + LossDelay) < DateTime.Now )
|
||||
if ( (pm.LastCompassionLoss + LossDelay) < DateTime.UtcNow )
|
||||
{
|
||||
VirtueHelper.Atrophy( from, VirtueName.Compassion, LossAmount );
|
||||
//OSI has no cliloc message for losing compassion. Weird.
|
||||
pm.LastCompassionLoss = DateTime.Now;
|
||||
pm.LastCompassionLoss = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
TimeSpan waitTime = DateTime.Now - pm.LastHonorUse;
|
||||
TimeSpan waitTime = DateTime.UtcNow - pm.LastHonorUse;
|
||||
if ( waitTime < UseDelay )
|
||||
{
|
||||
TimeSpan remainingTime = UseDelay - waitTime;
|
||||
|
|
@ -113,7 +113,7 @@ namespace Server
|
|||
Timer.DelayCall( TimeSpan.FromSeconds( duration ),
|
||||
delegate() {
|
||||
pm.HonorActive = false;
|
||||
pm.LastHonorUse = DateTime.Now;
|
||||
pm.LastHonorUse = DateTime.UtcNow;
|
||||
pm.SendLocalizedMessage( 1063236 ); // You no longer embrace your honor
|
||||
} );
|
||||
}
|
||||
|
|
@ -231,11 +231,11 @@ namespace Server
|
|||
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
source.m_hontime = (DateTime.Now + TimeSpan.FromMinutes( 40 ));
|
||||
source.m_hontime = (DateTime.UtcNow + TimeSpan.FromMinutes( 40 ));
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromMinutes( 40 ),
|
||||
delegate() {
|
||||
if (source.m_hontime < DateTime.Now && source.SentHonorContext != null)
|
||||
if (source.m_hontime < DateTime.UtcNow && source.SentHonorContext != null)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,12 +174,12 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if ( (pm.LastJusticeLoss + LossDelay) < DateTime.Now )
|
||||
if ( (pm.LastJusticeLoss + LossDelay) < DateTime.UtcNow )
|
||||
{
|
||||
if ( VirtueHelper.Atrophy( from, VirtueName.Justice, LossAmount ) )
|
||||
from.SendLocalizedMessage( 1049373 ); // You have lost some Justice.
|
||||
|
||||
pm.LastJusticeLoss = DateTime.Now;
|
||||
pm.LastJusticeLoss = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.Now )
|
||||
if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.UtcNow )
|
||||
{
|
||||
if ( VirtueHelper.Atrophy( from, VirtueName.Sacrifice, LossAmount ) )
|
||||
from.SendLocalizedMessage( 1052041 ); // You have lost some Sacrifice.
|
||||
|
|
@ -48,7 +48,7 @@ namespace Server
|
|||
VirtueLevel level = VirtueHelper.GetLevel( from, VirtueName.Sacrifice );
|
||||
|
||||
pm.AvailableResurrects = (int)level;
|
||||
pm.LastSacrificeLoss = DateTime.Now;
|
||||
pm.LastSacrificeLoss = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
@ -124,7 +124,7 @@ namespace Server
|
|||
{
|
||||
from.SendLocalizedMessage( 1052017 ); // You do not have enough fame to sacrifice.
|
||||
}
|
||||
else if ( DateTime.Now < (pm.LastSacrificeGain + GainDelay) )
|
||||
else if ( DateTime.UtcNow < (pm.LastSacrificeGain + GainDelay) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1052016 ); // You must wait approximately one day before sacrificing again.
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ namespace Server
|
|||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( targ.Delete ) );
|
||||
|
||||
pm.LastSacrificeGain = DateTime.Now;
|
||||
pm.LastSacrificeGain = DateTime.UtcNow;
|
||||
|
||||
bool gainedPath = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if( (pm.LastValorLoss + LossDelay) < DateTime.Now )
|
||||
if( (pm.LastValorLoss + LossDelay) < DateTime.UtcNow )
|
||||
{
|
||||
if( VirtueHelper.Atrophy( from, VirtueName.Valor, LossAmount ) )
|
||||
from.SendLocalizedMessage( 1054040 ); // You have lost some Valor.
|
||||
|
||||
pm.LastValorLoss = DateTime.Now;
|
||||
pm.LastValorLoss = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace Server
|
|||
{
|
||||
if ( virtue == VirtueName.Compassion )
|
||||
{
|
||||
if ( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay )
|
||||
if ( pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay )
|
||||
{
|
||||
pm.NextCompassionDay = DateTime.MinValue;
|
||||
pm.CompassionGains = 0;
|
||||
|
|
@ -145,7 +145,7 @@ namespace Server
|
|||
|
||||
if ( virtue == VirtueName.Compassion )
|
||||
{
|
||||
pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 );
|
||||
pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays( 1.0 );
|
||||
++pm.CompassionGains;
|
||||
|
||||
if ( pm.CompassionGains >= 5 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue