fix(core): Caches DateTime.NowUtc (#548)
- [X] Caches DateTime.NowUtc on the game loop (not other threads) - [X] Replaces all locations where it makes sense - [X] Adds Min/Max for `IComparable` (TimeSpan, DateTimes, etc) Closes #261
This commit is contained in:
parent
5de6edbeb8
commit
6c4308bce6
208 changed files with 660 additions and 793 deletions
|
|
@ -301,7 +301,7 @@ namespace Server.Engines.CannedEvil
|
|||
{
|
||||
m_RestartTimer?.Stop();
|
||||
|
||||
RestartTime = DateTime.UtcNow + ts;
|
||||
RestartTime = Core.Now + ts;
|
||||
|
||||
m_RestartTimer = new RestartTimer(this, ts);
|
||||
m_RestartTimer.Start();
|
||||
|
|
@ -564,7 +564,7 @@ namespace Server.Engines.CannedEvil
|
|||
SetWhiteSkullCount(p / 20);
|
||||
}
|
||||
|
||||
if (DateTime.UtcNow >= ExpireTime)
|
||||
if (Core.Now >= ExpireTime)
|
||||
{
|
||||
Expire();
|
||||
}
|
||||
|
|
@ -575,7 +575,7 @@ namespace Server.Engines.CannedEvil
|
|||
|
||||
public void AdvanceLevel()
|
||||
{
|
||||
ExpireTime = DateTime.UtcNow + ExpireDelay;
|
||||
ExpireTime = Core.Now + ExpireDelay;
|
||||
|
||||
if (Level < 16)
|
||||
{
|
||||
|
|
@ -811,7 +811,7 @@ namespace Server.Engines.CannedEvil
|
|||
SetWhiteSkullCount(0);
|
||||
}
|
||||
|
||||
ExpireTime = DateTime.UtcNow + ExpireDelay;
|
||||
ExpireTime = Core.Now + ExpireDelay;
|
||||
}
|
||||
|
||||
public Point3D GetRedSkullLocation(int index)
|
||||
|
|
@ -1293,7 +1293,7 @@ namespace Server.Engines.CannedEvil
|
|||
if (reader.ReadBool())
|
||||
{
|
||||
RestartTime = reader.ReadDeltaTime();
|
||||
BeginRestart(RestartTime - DateTime.UtcNow);
|
||||
BeginRestart(RestartTime - Core.Now);
|
||||
}
|
||||
|
||||
if (version < 4)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server.Items
|
|||
if (decays)
|
||||
{
|
||||
m_Decays = true;
|
||||
m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes(2.0);
|
||||
m_DecayTime = Core.Now + TimeSpan.FromMinutes(2.0);
|
||||
|
||||
m_Timer = new InternalTimer(this, m_DecayTime);
|
||||
m_Timer.Start();
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Items
|
|||
{
|
||||
private readonly Item m_Item;
|
||||
|
||||
public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow) => m_Item = item;
|
||||
public InternalTimer(Item item, DateTime end) : base(end - Core.Now) => m_Item = item;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,12 +310,9 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
public Mobile Ignored => m_Ignored;
|
||||
public bool Expired => DateTime.UtcNow >= m_Expire;
|
||||
public bool Expired => Core.Now >= m_Expire;
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
m_Expire = DateTime.UtcNow + ExpireDelay;
|
||||
}
|
||||
public void Refresh() => m_Expire = Core.Now + ExpireDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1298,7 +1298,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
foreach (var info in m.Aggressed)
|
||||
{
|
||||
if (info.Defender.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay)
|
||||
if (info.Defender.Player && Core.Now - info.LastCombatTime < CombatDelay)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1306,7 +1306,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
foreach (var info in m.Aggressors)
|
||||
{
|
||||
if (info.Attacker.Player && DateTime.UtcNow - info.LastCombatTime < CombatDelay)
|
||||
if (info.Attacker.Player && Core.Now - info.LastCombatTime < CombatDelay)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2601,7 +2601,7 @@ namespace Server.Engines.ConPVP
|
|||
Mobile = mob;
|
||||
Location = loc;
|
||||
Facet = facet;
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes(30.0);
|
||||
m_Expire = Core.Now + TimeSpan.FromMinutes(30.0);
|
||||
}
|
||||
|
||||
public Mobile Mobile { get; }
|
||||
|
|
@ -2610,7 +2610,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Map Facet { get; private set; }
|
||||
|
||||
public bool Expired => DateTime.UtcNow >= m_Expire;
|
||||
public bool Expired => Core.Now >= m_Expire;
|
||||
|
||||
public void Return()
|
||||
{
|
||||
|
|
@ -2633,7 +2633,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Update()
|
||||
{
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes(30.0);
|
||||
m_Expire = Core.Now + TimeSpan.FromMinutes(30.0);
|
||||
|
||||
if (Mobile.Map == Map.Internal)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
m_Returner = from;
|
||||
m_ReturnTime = DateTime.UtcNow;
|
||||
m_ReturnTime = Core.Now;
|
||||
|
||||
SendHome();
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ namespace Server.Engines.ConPVP
|
|||
public void DropTo(Mobile mob, Mobile killer)
|
||||
{
|
||||
m_Fragger = killer;
|
||||
m_FragTime = DateTime.UtcNow;
|
||||
m_FragTime = Core.Now;
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
|
|
@ -464,7 +464,7 @@ namespace Server.Engines.ConPVP
|
|||
var teamFlag = useTeam.Flag;
|
||||
|
||||
if (teamFlag.m_Fragger != null &&
|
||||
DateTime.UtcNow < teamFlag.m_FragTime + TimeSpan.FromSeconds(5.0) &&
|
||||
Core.Now < teamFlag.m_FragTime + TimeSpan.FromSeconds(5.0) &&
|
||||
m_TeamInfo.Game.GetTeamInfo(teamFlag.m_Fragger) == useTeam)
|
||||
{
|
||||
var assistInfo = useTeam[teamFlag.m_Fragger];
|
||||
|
|
@ -476,7 +476,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
if (teamFlag.m_Returner != null &&
|
||||
DateTime.UtcNow < teamFlag.m_ReturnTime + TimeSpan.FromSeconds(5.0))
|
||||
Core.Now < teamFlag.m_ReturnTime + TimeSpan.FromSeconds(5.0))
|
||||
{
|
||||
var assistInfo = useTeam[teamFlag.m_Returner];
|
||||
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string timeUntil;
|
||||
var minutesUntil = (int)Math.Round(
|
||||
(tourney.SignupStart + tourney.SignupPeriod - DateTime.UtcNow)
|
||||
(tourney.SignupStart + tourney.SignupPeriod - Core.Now)
|
||||
.TotalMinutes
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (m_Tournament.Stage == TournamentStage.Signup)
|
||||
{
|
||||
var until = m_Tournament.SignupStart + m_Tournament.SignupPeriod - DateTime.UtcNow;
|
||||
var until = m_Tournament.SignupStart + m_Tournament.SignupPeriod - Core.Now;
|
||||
string text;
|
||||
var secs = (int)until.TotalSeconds;
|
||||
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (CurrentStage == TournamentStage.Signup)
|
||||
{
|
||||
var until = SignupStart + SignupPeriod - DateTime.UtcNow;
|
||||
var until = SignupStart + SignupPeriod - Core.Now;
|
||||
|
||||
if (until <= TimeSpan.Zero)
|
||||
{
|
||||
|
|
@ -741,7 +741,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
{
|
||||
/*Alert( "Is this all?", "Pitiful. Signup extended." );
|
||||
m_SignupStart = DateTime.UtcNow;*/
|
||||
m_SignupStart = Core.Now;*/
|
||||
|
||||
Alert("Is this all?", "Pitiful. Tournament cancelled.");
|
||||
CurrentStage = TournamentStage.Inactive;
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (m_Tournament.Stage == TournamentStage.Inactive)
|
||||
{
|
||||
m_Tournament.SignupStart = DateTime.UtcNow;
|
||||
m_Tournament.SignupStart = Core.Now;
|
||||
m_Tournament.Stage = TournamentStage.Signup;
|
||||
m_Tournament.Participants.Clear();
|
||||
m_Tournament.Pyramid.Levels.Clear();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Items
|
|||
{
|
||||
Title = title;
|
||||
m_Rank = rank;
|
||||
Date = DateTime.UtcNow;
|
||||
Date = Core.Now;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace Server.Ethics
|
|||
return false;
|
||||
}
|
||||
|
||||
if (DateTime.UtcNow < m_Shield + TimeSpan.FromHours(1.0))
|
||||
if (Core.Now < m_Shield + TimeSpan.FromHours(1.0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -119,15 +119,9 @@ namespace Server.Ethics
|
|||
return pl;
|
||||
}
|
||||
|
||||
public void BeginShield()
|
||||
{
|
||||
m_Shield = DateTime.UtcNow;
|
||||
}
|
||||
public void BeginShield() => m_Shield = Core.Now;
|
||||
|
||||
public void FinishShield()
|
||||
{
|
||||
m_Shield = DateTime.MinValue;
|
||||
}
|
||||
public void FinishShield() => m_Shield = DateTime.MinValue;
|
||||
|
||||
public void CheckAttach()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.Events
|
|||
|
||||
public void ScheduleEvent(IEvent e, int hour, int min, TimeSpan interval)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var now = Core.Now;
|
||||
var firstRun = new DateTime(now.Year, now.Month, now.Day, hour, min, 0);
|
||||
|
||||
while (now > firstRun)
|
||||
|
|
@ -85,7 +85,7 @@ namespace Server.Engines.Events
|
|||
{
|
||||
foreach (var entry in _schedule)
|
||||
{
|
||||
if (entry.NextOccurrence <= DateTime.UtcNow)
|
||||
if (entry.NextOccurrence <= Core.Now)
|
||||
{
|
||||
entry.Occur();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Factions
|
|||
set
|
||||
{
|
||||
CurrentState = value;
|
||||
LastStateTime = DateTime.UtcNow;
|
||||
LastStateTime = Core.Now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,12 +89,7 @@ namespace Server.Factions
|
|||
_ => PendingPeriod
|
||||
};
|
||||
|
||||
var until = LastStateTime + period - DateTime.UtcNow;
|
||||
|
||||
if (until < TimeSpan.Zero)
|
||||
{
|
||||
until = TimeSpan.Zero;
|
||||
}
|
||||
var until = Utility.Max(LastStateTime + period - Core.Now, TimeSpan.Zero);
|
||||
|
||||
return until;
|
||||
}
|
||||
|
|
@ -108,7 +103,7 @@ namespace Server.Factions
|
|||
_ => PendingPeriod
|
||||
};
|
||||
|
||||
LastStateTime = DateTime.UtcNow - period + value;
|
||||
LastStateTime = Core.Now - period + value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +285,7 @@ namespace Server.Factions
|
|||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
if (LastStateTime + PendingPeriod > DateTime.UtcNow)
|
||||
if (LastStateTime + PendingPeriod > Core.Now)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
@ -304,7 +299,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
if (LastStateTime + CampaignPeriod > DateTime.UtcNow)
|
||||
if (LastStateTime + CampaignPeriod > Core.Now)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
@ -346,7 +341,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if (LastStateTime + VotingPeriod > DateTime.UtcNow)
|
||||
if (LastStateTime + VotingPeriod > Core.Now)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
@ -413,7 +408,7 @@ namespace Server.Factions
|
|||
Address = IPAddress.None;
|
||||
}
|
||||
|
||||
Time = DateTime.UtcNow;
|
||||
Time = Core.Now;
|
||||
}
|
||||
|
||||
public Voter(IGenericReader reader, Mobile candidate)
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ namespace Server.Factions
|
|||
}
|
||||
else
|
||||
{
|
||||
recvState.LastHonorTime = DateTime.UtcNow;
|
||||
recvState.LastHonorTime = Core.Now;
|
||||
giveState.KillPoints -= 5;
|
||||
recvState.KillPoints += 4;
|
||||
|
||||
|
|
@ -604,7 +604,7 @@ namespace Server.Factions
|
|||
return false;
|
||||
}
|
||||
|
||||
if (pl.Leaving + LeavePeriod >= DateTime.UtcNow)
|
||||
if (pl.Leaving + LeavePeriod >= Core.Now)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -911,13 +911,13 @@ namespace Server.Factions
|
|||
var sigil = sigils[i];
|
||||
|
||||
if (!sigil.IsBeingCorrupted && sigil.GraceStart != DateTime.MinValue &&
|
||||
sigil.GraceStart + Sigil.CorruptionGrace < DateTime.UtcNow)
|
||||
sigil.GraceStart + Sigil.CorruptionGrace < Core.Now)
|
||||
{
|
||||
if (sigil.LastMonolith is StrongholdMonolith &&
|
||||
(sigil.Corrupted == null || sigil.LastMonolith.Faction != sigil.Corrupted))
|
||||
{
|
||||
sigil.Corrupting = sigil.LastMonolith.Faction;
|
||||
sigil.CorruptionStart = DateTime.UtcNow;
|
||||
sigil.CorruptionStart = Core.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -930,21 +930,21 @@ namespace Server.Factions
|
|||
|
||||
if (sigil.LastMonolith?.Sigil == null)
|
||||
{
|
||||
if (sigil.LastStolen + Sigil.ReturnPeriod < DateTime.UtcNow)
|
||||
if (sigil.LastStolen + Sigil.ReturnPeriod < Core.Now)
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sigil.IsBeingCorrupted && sigil.CorruptionStart + Sigil.CorruptionPeriod < DateTime.UtcNow)
|
||||
if (sigil.IsBeingCorrupted && sigil.CorruptionStart + Sigil.CorruptionPeriod < Core.Now)
|
||||
{
|
||||
sigil.Corrupted = sigil.Corrupting;
|
||||
sigil.Corrupting = null;
|
||||
sigil.CorruptionStart = DateTime.MinValue;
|
||||
sigil.GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if (sigil.IsPurifying && sigil.PurificationStart + Sigil.PurificationPeriod < DateTime.UtcNow)
|
||||
else if (sigil.IsPurifying && sigil.PurificationStart + Sigil.PurificationPeriod < Core.Now)
|
||||
{
|
||||
sigil.PurificationStart = DateTime.MinValue;
|
||||
sigil.Corrupted = null;
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ namespace Server.Factions
|
|||
return true;
|
||||
}
|
||||
|
||||
return Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration;
|
||||
return Expiration != DateTime.MinValue && Core.Now >= Expiration;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartExpiration()
|
||||
{
|
||||
Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
Expiration = Core.Now + ExpirationPeriod;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Server.Factions
|
|||
|
||||
if (version < 5)
|
||||
{
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = Core.Now;
|
||||
}
|
||||
|
||||
if (version < 4)
|
||||
|
|
@ -161,7 +161,7 @@ namespace Server.Factions
|
|||
{
|
||||
for (var i = 0; i < m_LastBroadcasts.Length; ++i)
|
||||
{
|
||||
if (DateTime.UtcNow >= m_LastBroadcasts[i] + BroadcastPeriod)
|
||||
if (Core.Now >= m_LastBroadcasts[i] + BroadcastPeriod)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= LastAtrophy + TimeSpan.FromHours(47.0);
|
||||
public bool IsAtrophyReady => Core.Now >= LastAtrophy + TimeSpan.FromHours(47.0);
|
||||
|
||||
public List<FactionItem> FactionItems { get; set; }
|
||||
|
||||
|
|
@ -217,13 +217,13 @@ namespace Server.Factions
|
|||
|
||||
public int CheckAtrophy()
|
||||
{
|
||||
if (DateTime.UtcNow < LastAtrophy + TimeSpan.FromHours(47.0))
|
||||
if (Core.Now < LastAtrophy + TimeSpan.FromHours(47.0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var distrib = 0;
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = Core.Now;
|
||||
|
||||
var members = new List<PlayerState>(Members);
|
||||
|
||||
|
|
@ -252,9 +252,9 @@ namespace Server.Factions
|
|||
{
|
||||
for (var i = 0; i < m_LastBroadcasts.Length; ++i)
|
||||
{
|
||||
if (DateTime.UtcNow >= m_LastBroadcasts[i] + BroadcastPeriod)
|
||||
if (Core.Now >= m_LastBroadcasts[i] + BroadcastPeriod)
|
||||
{
|
||||
m_LastBroadcasts[i] = DateTime.UtcNow;
|
||||
m_LastBroadcasts[i] = Core.Now;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Server.Factions
|
|||
break;
|
||||
}
|
||||
|
||||
var remaining = pl.Leaving + Faction.LeavePeriod - DateTime.UtcNow;
|
||||
var remaining = pl.Leaving + Faction.LeavePeriod - Core.Now;
|
||||
|
||||
if (remaining.TotalDays >= 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ namespace Server.Factions
|
|||
public SilverGivenEntry(Mobile givenTo)
|
||||
{
|
||||
GivenTo = givenTo;
|
||||
TimeOfGift = DateTime.UtcNow;
|
||||
TimeOfGift = Core.Now;
|
||||
}
|
||||
|
||||
public Mobile GivenTo { get; }
|
||||
|
||||
public DateTime TimeOfGift { get; }
|
||||
|
||||
public bool IsExpired => TimeOfGift + ExpirePeriod < DateTime.UtcNow;
|
||||
public bool IsExpired => TimeOfGift + ExpirePeriod < Core.Now;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace Server.Factions
|
|||
set => m_State.LastTaxChange = value;
|
||||
}
|
||||
|
||||
public bool TaxChangeReady => m_State.LastTaxChange + TaxChangePeriod < DateTime.UtcNow;
|
||||
public bool TaxChangeReady => m_State.LastTaxChange + TaxChangePeriod < Core.Now;
|
||||
|
||||
public int FinanceUpkeep
|
||||
{
|
||||
|
|
@ -236,7 +236,7 @@ namespace Server.Factions
|
|||
|
||||
public void CheckIncome()
|
||||
{
|
||||
if (LastIncome + IncomePeriod > DateTime.UtcNow || Owner == null)
|
||||
if (LastIncome + IncomePeriod > Core.Now || Owner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ namespace Server.Factions
|
|||
|
||||
public void ProcessIncome()
|
||||
{
|
||||
LastIncome = DateTime.UtcNow;
|
||||
LastIncome = Core.Now;
|
||||
|
||||
var flow = NetCashFlow;
|
||||
|
||||
|
|
@ -454,7 +454,7 @@ namespace Server.Factions
|
|||
|
||||
if (m_State.Owner == null) // going from unowned to owned
|
||||
{
|
||||
LastIncome = DateTime.UtcNow;
|
||||
LastIncome = Core.Now;
|
||||
f.Silver += SilverCaptureBonus;
|
||||
}
|
||||
else if (f == null) // going from owned to unowned
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server.Factions
|
|||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
var toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
|
||||
var toGo = election.LastStateTime + Election.PendingPeriod - Core.Now;
|
||||
var days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
|
||||
|
|
@ -47,7 +47,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
var toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
|
||||
var toGo = election.LastStateTime + Election.CampaignPeriod - Core.Now;
|
||||
var days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
|
||||
|
|
@ -81,7 +81,7 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
var toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
|
||||
var toGo = election.LastStateTime + Election.VotingPeriod - Core.Now;
|
||||
var days = (int)Math.Ceiling(toGo.TotalDays);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018060); // There is an election vote in progress.
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ namespace Server.Factions
|
|||
|
||||
if (m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady)
|
||||
{
|
||||
var remaining = DateTime.UtcNow - (m_Town.LastTaxChange + Town.TaxChangePeriod);
|
||||
var remaining = Core.Now - (m_Town.LastTaxChange + Town.TaxChangePeriod);
|
||||
|
||||
if (remaining.TotalMinutes < 4)
|
||||
{
|
||||
|
|
@ -243,7 +243,7 @@ namespace Server.Factions
|
|||
|
||||
if (m_From.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
m_Town.LastTaxChange = DateTime.UtcNow;
|
||||
m_Town.LastTaxChange = Core.Now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Server.Factions
|
|||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Leaving = DateTime.UtcNow;
|
||||
pl.Leaving = Core.Now;
|
||||
|
||||
if (TimeSpan.FromDays(3.0) == Faction.LeavePeriod)
|
||||
{
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Factions
|
|||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Leaving = DateTime.UtcNow;
|
||||
pl.Leaving = Core.Now;
|
||||
|
||||
if (TimeSpan.FromDays(3.0) == Faction.LeavePeriod)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Server
|
|||
try
|
||||
{
|
||||
using var op = new StreamWriter("faction-power-items.log", true);
|
||||
op.WriteLine("{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, killer, victim, obj);
|
||||
op.WriteLine("{0}\t{1}\t{2}\t{3}", Core.Now, killer, victim, obj);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,25 +101,10 @@ namespace Server.Factions
|
|||
public bool IsCorrupting => m_Corrupting != null && m_Corrupting != m_Corrupted;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan TimeUntilCorruption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsBeingCorrupted)
|
||||
{
|
||||
return TimeSpan.Zero;
|
||||
}
|
||||
|
||||
var ts = CorruptionStart + CorruptionPeriod - DateTime.UtcNow;
|
||||
|
||||
if (ts < TimeSpan.Zero)
|
||||
{
|
||||
ts = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
return ts;
|
||||
}
|
||||
}
|
||||
public TimeSpan TimeUntilCorruption =>
|
||||
!IsBeingCorrupted ?
|
||||
TimeSpan.Zero :
|
||||
Utility.Max(CorruptionStart + CorruptionPeriod - Core.Now, TimeSpan.Zero);
|
||||
|
||||
public static List<Sigil> Sigils { get; } = new();
|
||||
|
||||
|
|
@ -263,7 +248,7 @@ namespace Server.Factions
|
|||
private void BeginCorrupting(Faction faction)
|
||||
{
|
||||
m_Corrupting = faction;
|
||||
CorruptionStart = DateTime.UtcNow;
|
||||
CorruptionStart = Core.Now;
|
||||
}
|
||||
|
||||
private void ClearCorrupting()
|
||||
|
|
@ -340,7 +325,7 @@ namespace Server.Factions
|
|||
BeginCorrupting(newController);
|
||||
}
|
||||
}
|
||||
else if (GraceStart > DateTime.MinValue && GraceStart + CorruptionGrace < DateTime.UtcNow)
|
||||
else if (GraceStart > DateTime.MinValue && GraceStart + CorruptionGrace < Core.Now)
|
||||
{
|
||||
if (m_Corrupted != newController)
|
||||
{
|
||||
|
|
@ -359,7 +344,7 @@ namespace Server.Factions
|
|||
}
|
||||
else if (GraceStart == DateTime.MinValue)
|
||||
{
|
||||
GraceStart = DateTime.UtcNow;
|
||||
GraceStart = Core.Now;
|
||||
}
|
||||
|
||||
PurificationStart = DateTime.MinValue;
|
||||
|
|
@ -381,7 +366,7 @@ namespace Server.Factions
|
|||
tm.Sigil = this;
|
||||
|
||||
m_Corrupting = null;
|
||||
PurificationStart = DateTime.UtcNow;
|
||||
PurificationStart = Core.Now;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
|
||||
m_Town.Capture(m_Corrupted);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Factions
|
|||
Visible = false;
|
||||
|
||||
Faction = f;
|
||||
TimeOfPlacement = DateTime.UtcNow;
|
||||
TimeOfPlacement = Core.Now;
|
||||
Placer = m;
|
||||
}
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ namespace Server.Factions
|
|||
return false;
|
||||
}
|
||||
|
||||
if (TimeOfPlacement + decayPeriod < DateTime.UtcNow)
|
||||
if (TimeOfPlacement + decayPeriod < Core.Now)
|
||||
{
|
||||
Timer.DelayCall(Delete);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -225,17 +225,17 @@ namespace Server.Factions
|
|||
else if (Town.FromRegion(Region) == m_Town)
|
||||
{
|
||||
Say(1042180); // Your orders, sire?
|
||||
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
|
||||
m_OrdersEnd = Core.Now + TimeSpan.FromSeconds(10.0);
|
||||
}
|
||||
}
|
||||
else if (DateTime.UtcNow < m_OrdersEnd)
|
||||
else if (Core.Now < m_OrdersEnd)
|
||||
{
|
||||
if (m_Town?.IsSheriff(from) != true || Town.FromRegion(Region) != m_Town)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
|
||||
m_OrdersEnd = Core.Now + TimeSpan.FromSeconds(10.0);
|
||||
|
||||
var understood = true;
|
||||
ReactionType newType = 0;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace Server.Factions
|
|||
|
||||
if (entry.Chance > Utility.Random(100))
|
||||
{
|
||||
releaseTime = DateTime.UtcNow + entry.Hold;
|
||||
releaseTime = Core.Now + entry.Hold;
|
||||
return entry.Spell.CreateInstance<Spell>(mob, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ namespace Server.Factions
|
|||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
var ts = m_BandageStart + m_Bandage.Timer.Delay - DateTime.UtcNow;
|
||||
var ts = m_BandageStart + m_Bandage.Timer.Delay - Core.Now;
|
||||
|
||||
if (ts < TimeSpan.FromSeconds(-1.0))
|
||||
{
|
||||
|
|
@ -141,12 +141,7 @@ namespace Server.Factions
|
|||
return TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
if (ts < TimeSpan.Zero)
|
||||
{
|
||||
ts = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
return ts;
|
||||
return Utility.Max(ts, TimeSpan.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +182,7 @@ namespace Server.Factions
|
|||
}
|
||||
|
||||
m_Bandage = BandageContext.BeginHeal(m_Guard, m_Guard);
|
||||
m_BandageStart = DateTime.UtcNow;
|
||||
m_BandageStart = Core.Now;
|
||||
return m_Bandage != null;
|
||||
}
|
||||
|
||||
|
|
@ -487,10 +482,10 @@ namespace Server.Factions
|
|||
|
||||
if (m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue)
|
||||
{
|
||||
m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
|
||||
m_ReleaseTarget = Core.Now + TimeSpan.FromSeconds(10.0);
|
||||
}
|
||||
|
||||
if (m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget)
|
||||
if (m_Guard.Target != null && Core.Now > m_ReleaseTarget)
|
||||
{
|
||||
var targ = m_Guard.Target;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Server.Engines.Harvest
|
|||
|
||||
public void CheckRespawn()
|
||||
{
|
||||
if (m_Current == m_Maximum || m_NextRespawn > DateTime.UtcNow)
|
||||
if (m_Current == m_Maximum || m_NextRespawn > Core.Now)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.Harvest
|
|||
minutes *= .75; // 25% off the time.
|
||||
}
|
||||
|
||||
m_NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes(minutes);
|
||||
m_NextRespawn = Core.Now + TimeSpan.FromMinutes(minutes);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ namespace Server.Engines.Help
|
|||
{
|
||||
var info = m.Aggressed[i];
|
||||
|
||||
if (DateTime.UtcNow - info.LastCombatTime < TimeSpan.FromSeconds(30.0))
|
||||
if (Core.Now - info.LastCombatTime < TimeSpan.FromSeconds(30.0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Engines.Help
|
|||
public PageEntry(Mobile sender, string message, PageType type)
|
||||
{
|
||||
Sender = sender;
|
||||
Sent = DateTime.UtcNow;
|
||||
Sent = Core.Now;
|
||||
Message = Utility.FixHtml(message);
|
||||
Type = type;
|
||||
PageLocation = sender.Location;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Engines.Help
|
|||
{
|
||||
var entry = m_Queue.Peek();
|
||||
|
||||
if (DateTime.UtcNow - entry.Created > EntryDuration)
|
||||
if (Core.Now - entry.Created > EntryDuration)
|
||||
{
|
||||
m_Queue.Dequeue();
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ namespace Server.Engines.Help
|
|||
{
|
||||
From = from;
|
||||
Speech = speech;
|
||||
Created = DateTime.UtcNow;
|
||||
Created = Core.Now;
|
||||
}
|
||||
|
||||
public Mobile From { get; }
|
||||
|
|
|
|||
|
|
@ -241,12 +241,12 @@ namespace Server.Menus.Questions
|
|||
public CloseTimer(Mobile m) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_End = DateTime.UtcNow + TimeSpan.FromMinutes(3.0);
|
||||
m_End = Core.Now + TimeSpan.FromMinutes(3.0);
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Mobile.NetState == null || DateTime.UtcNow > m_End)
|
||||
if (m_Mobile.NetState == null || Core.Now > m_End)
|
||||
{
|
||||
m_Mobile.Frozen = false;
|
||||
m_Mobile.CloseGump<StuckMenu>();
|
||||
|
|
@ -275,12 +275,12 @@ namespace Server.Menus.Questions
|
|||
|
||||
m_Mobile = mobile;
|
||||
m_Destination = destination;
|
||||
m_End = DateTime.UtcNow + delay;
|
||||
m_End = Core.Now + delay;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (DateTime.UtcNow < m_End)
|
||||
if (Core.Now < m_End)
|
||||
{
|
||||
m_Mobile.Frozen = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
m_Guesses[m] = new PuzzleChestSolutionAndTime(DateTime.UtcNow, solution);
|
||||
m_Guesses[m] = new PuzzleChestSolutionAndTime(Core.Now, solution);
|
||||
|
||||
m.SendGump(new StatusGump(correctCylinders, correctColors));
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ namespace Server.Items
|
|||
|
||||
foreach (var kvp in m_Guesses)
|
||||
{
|
||||
if (DateTime.UtcNow - kvp.Value.When > CleanupTime)
|
||||
if (Core.Now - kvp.Value.When > CleanupTime)
|
||||
{
|
||||
toDelete.Add(kvp.Key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Server.Items
|
|||
public RaiseTimer(RaisableItem item) : base(TimeSpan.Zero, TimeSpan.FromSeconds(0.5))
|
||||
{
|
||||
m_Item = item;
|
||||
m_CloseTime = DateTime.UtcNow + item.CloseDelay;
|
||||
m_CloseTime = Core.Now + item.CloseDelay;
|
||||
m_Up = true;
|
||||
|
||||
Priority = TimerPriority.TenMS;
|
||||
|
|
@ -153,7 +153,7 @@ namespace Server.Items
|
|||
m_Up = false;
|
||||
m_Step = 0;
|
||||
|
||||
var delay = m_CloseTime - DateTime.UtcNow;
|
||||
var delay = m_CloseTime - Core.Now;
|
||||
DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Start);
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ namespace Server.Engines.MLQuests
|
|||
return false;
|
||||
}
|
||||
|
||||
if (nextAvailable > DateTime.UtcNow)
|
||||
if (nextAvailable > Core.Now)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Engines.MLQuests
|
|||
QuesterType = quester?.GetType();
|
||||
Player = player;
|
||||
|
||||
Accepted = DateTime.UtcNow;
|
||||
Accepted = Core.Now;
|
||||
m_Flags = MLQuestInstanceFlags.None;
|
||||
|
||||
Objectives = new BaseObjectiveInstance[quest.Objectives.Count];
|
||||
|
|
@ -204,7 +204,7 @@ namespace Server.Engines.MLQuests
|
|||
{
|
||||
if (!obj.Expired)
|
||||
{
|
||||
if (obj.IsTimed && obj.EndTime <= DateTime.UtcNow)
|
||||
if (obj.IsTimed && obj.EndTime <= Core.Now)
|
||||
{
|
||||
Player.SendLocalizedMessage(1072258); // You failed to complete an objective in time!
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
if (Quest.HasRestartDelay)
|
||||
{
|
||||
PlayerContext.SetDoneQuest(Quest, DateTime.UtcNow + Quest.GetRestartDelay());
|
||||
PlayerContext.SetDoneQuest(Quest, Core.Now + Quest.GetRestartDelay());
|
||||
}
|
||||
|
||||
// This is correct for ObjectiveType.Any as well
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
{
|
||||
base.OnThink();
|
||||
|
||||
if (m_NextShout > DateTime.UtcNow)
|
||||
if (m_NextShout > Core.Now)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
m_NextShout = DateTime.UtcNow + m_ShoutDelay;
|
||||
m_NextShout = Core.Now + m_ShoutDelay;
|
||||
}
|
||||
|
||||
private void EndLock(Mobile m)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
if (obj.IsTimed)
|
||||
{
|
||||
EndTime = DateTime.UtcNow + obj.Duration;
|
||||
EndTime = Core.Now + obj.Duration;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
{
|
||||
if (IsTimed)
|
||||
{
|
||||
WriteTimeRemaining(g, ref y, EndTime > DateTime.UtcNow ? EndTime - DateTime.UtcNow : TimeSpan.Zero);
|
||||
WriteTimeRemaining(g, ref y, Utility.Max(EndTime - Core.Now, TimeSpan.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
var nextEscort = pm.LastEscortTime + BaseEscortable.EscortDelay;
|
||||
|
||||
if (nextEscort > DateTime.UtcNow)
|
||||
if (nextEscort > Core.Now)
|
||||
{
|
||||
if (message)
|
||||
{
|
||||
var minutes = (int)Math.Ceiling((nextEscort - DateTime.UtcNow).TotalMinutes);
|
||||
var minutes = (int)Math.Ceiling((nextEscort - Core.Now).TotalMinutes);
|
||||
|
||||
if (minutes == 1)
|
||||
{
|
||||
|
|
@ -106,7 +106,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
m_Objective = objective;
|
||||
HasCompleted = false;
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5), CheckDestination);
|
||||
m_LastSeenEscorter = DateTime.UtcNow;
|
||||
m_LastSeenEscorter = Core.Now;
|
||||
m_Escort = instance.Quester as BaseCreature;
|
||||
|
||||
if (MLQuestSystem.Debug && m_Escort == null && instance.Quester != null)
|
||||
|
|
@ -170,14 +170,14 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
}
|
||||
else if (pm.Map != m_Escort.Map || !pm.InRange(m_Escort, 30)) // TODO: verify range
|
||||
{
|
||||
if (m_LastSeenEscorter + BaseEscortable.AbandonDelay <= DateTime.UtcNow)
|
||||
if (m_LastSeenEscorter + BaseEscortable.AbandonDelay <= Core.Now)
|
||||
{
|
||||
Abandon();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LastSeenEscorter = DateTime.UtcNow;
|
||||
m_LastSeenEscorter = Core.Now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
var instance = Instance;
|
||||
var pm = instance.Player;
|
||||
|
||||
pm.LastEscortTime = DateTime.UtcNow;
|
||||
pm.LastEscortTime = Core.Now;
|
||||
|
||||
if (m_Escort != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
var pm = Instance.Player;
|
||||
|
||||
pm.AcceleratedSkill = Objective.Skill;
|
||||
pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15); // TODO: Is there a max duration?
|
||||
pm.AcceleratedStart = Core.Now + TimeSpan.FromMinutes(15); // TODO: Is there a max duration?
|
||||
}
|
||||
|
||||
public override void OnQuestCancelled()
|
||||
|
|
@ -145,7 +145,7 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
var pm = Instance.Player;
|
||||
|
||||
pm.AcceleratedStart = DateTime.UtcNow;
|
||||
pm.AcceleratedStart = Core.Now;
|
||||
pm.PlaySound(0x100);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@ namespace Server
|
|||
|
||||
var goal = GetGoalLocation();
|
||||
|
||||
if (m_Path != null && (m_Path.Success && goal == m_LastGoalLoc || m_LastPathTime + RepathDelay > DateTime.Now) &&
|
||||
if (m_Path != null && (m_Path.Success && goal == m_LastGoalLoc || m_LastPathTime + RepathDelay > Core.Now) &&
|
||||
!(m_Path.Success && Check(m_From.Location, m_LastGoalLoc, 0)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_LastPathTime = DateTime.UtcNow;
|
||||
m_LastPathTime = Core.Now;
|
||||
m_LastGoalLoc = goal;
|
||||
|
||||
m_Path = new MovementPath(m_From, goal);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Server.Engines.Plants
|
|||
Plant = plant;
|
||||
FertileDirt = fertileDirt;
|
||||
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
NextGrowth = Core.Now + CheckDelay;
|
||||
GrowthIndicator = PlantGrowthIndicator.None;
|
||||
m_Hits = MaxHits;
|
||||
m_LeftSeeds = 8;
|
||||
|
|
@ -290,7 +290,7 @@ namespace Server.Engines.Plants
|
|||
|
||||
public void Reset(bool potions)
|
||||
{
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
NextGrowth = Core.Now + CheckDelay;
|
||||
GrowthIndicator = PlantGrowthIndicator.None;
|
||||
|
||||
Hits = MaxHits;
|
||||
|
|
@ -387,7 +387,7 @@ namespace Server.Engines.Plants
|
|||
public static void GrowAll()
|
||||
{
|
||||
var plants = PlantItem.Plants;
|
||||
var now = DateTime.UtcNow;
|
||||
var now = Core.Now;
|
||||
|
||||
for (var i = plants.Count - 1; i >= 0; --i)
|
||||
{
|
||||
|
|
@ -417,13 +417,15 @@ namespace Server.Engines.Plants
|
|||
return;
|
||||
}
|
||||
|
||||
if (DateTime.UtcNow < NextGrowth)
|
||||
var now = Core.Now;
|
||||
|
||||
if (now < NextGrowth)
|
||||
{
|
||||
GrowthIndicator = PlantGrowthIndicator.Delay;
|
||||
return;
|
||||
}
|
||||
|
||||
NextGrowth = DateTime.UtcNow + CheckDelay;
|
||||
NextGrowth = now + CheckDelay;
|
||||
|
||||
if (!Plant.ValidGrowthLocation)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ namespace Server.Engines.Quests.Collector
|
|||
{
|
||||
if (m_Begin == DateTime.MaxValue)
|
||||
{
|
||||
m_Begin = DateTime.UtcNow;
|
||||
m_Begin = Core.Now;
|
||||
}
|
||||
else if (DateTime.UtcNow - m_Begin > TimeSpan.FromSeconds(30.0))
|
||||
else if (Core.Now - m_Begin > TimeSpan.FromSeconds(30.0))
|
||||
{
|
||||
Complete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
if (restartDelay < TimeSpan.MaxValue)
|
||||
{
|
||||
RestartTime = DateTime.UtcNow + restartDelay;
|
||||
RestartTime = Core.Now + restartDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
var endTime = restartInfo.RestartTime;
|
||||
|
||||
if (DateTime.UtcNow < endTime)
|
||||
if (Core.Now < endTime)
|
||||
{
|
||||
inRestartPeriod = true;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Engines.Quests.Naturalist
|
|||
{
|
||||
if (m_StudyState != StudyState.Inactive)
|
||||
{
|
||||
var time = DateTime.UtcNow - m_StudyBegin;
|
||||
var time = Core.Now - m_StudyBegin;
|
||||
|
||||
if (time > TimeSpan.FromSeconds(30.0))
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.Quests.Naturalist
|
|||
if (nest != null)
|
||||
{
|
||||
m_CurrentNest = nest;
|
||||
m_StudyBegin = DateTime.UtcNow;
|
||||
m_StudyBegin = Core.Now;
|
||||
|
||||
if (m_StudiedNests.Contains(nest))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ namespace Server.Engines.Spawners
|
|||
[CommandProperty(AccessLevel.Developer)]
|
||||
public TimeSpan NextSpawn
|
||||
{
|
||||
get => m_Running && m_Timer?.Running == true ? End - DateTime.UtcNow : TimeSpan.FromSeconds(0);
|
||||
get => m_Running && m_Timer?.Running == true ? End - Core.Now : TimeSpan.FromSeconds(0);
|
||||
set
|
||||
{
|
||||
Start();
|
||||
|
|
@ -748,7 +748,7 @@ namespace Server.Engines.Spawners
|
|||
return;
|
||||
}
|
||||
|
||||
End = DateTime.UtcNow + delay;
|
||||
End = Core.Now + delay;
|
||||
|
||||
if (m_Timer == null)
|
||||
{
|
||||
|
|
@ -1005,7 +1005,7 @@ namespace Server.Engines.Spawners
|
|||
|
||||
if (m_Running)
|
||||
{
|
||||
ts = reader.ReadDeltaTime() - DateTime.UtcNow;
|
||||
ts = reader.ReadDeltaTime() - Core.Now;
|
||||
}
|
||||
|
||||
if (version < 7)
|
||||
|
|
|
|||
|
|
@ -93,14 +93,14 @@ namespace Server.Engines.Spawners
|
|||
return;
|
||||
}
|
||||
|
||||
End = DateTime.UtcNow + delay;
|
||||
End = Core.Now + delay;
|
||||
}
|
||||
|
||||
public override void Respawn()
|
||||
{
|
||||
RemoveSpawns();
|
||||
|
||||
End = DateTime.UtcNow;
|
||||
End = Core.Now;
|
||||
}
|
||||
|
||||
public virtual bool ValidTrigger(Mobile m)
|
||||
|
|
@ -120,7 +120,7 @@ namespace Server.Engines.Spawners
|
|||
return;
|
||||
}
|
||||
|
||||
if (IsEmpty && End <= DateTime.UtcNow && m.InRange(GetWorldLocation(), TriggerRange) &&
|
||||
if (IsEmpty && End <= Core.Now && m.InRange(GetWorldLocation(), TriggerRange) &&
|
||||
m.Location != oldLocation && ValidTrigger(m))
|
||||
{
|
||||
TextDefinition.SendMessageTo(m, SpawnMessage);
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ namespace Server.Mobiles
|
|||
public void Sculpt(Mobile by)
|
||||
{
|
||||
m_SculptedBy = by;
|
||||
SculptedOn = DateTime.UtcNow;
|
||||
SculptedOn = Core.Now;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
|
@ -516,7 +516,7 @@ namespace Server.Mobiles
|
|||
if (from.Account is Account acct && from.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
var time = TimeSpan.FromDays(RewardSystem.RewardInterval.TotalDays * 6) -
|
||||
(DateTime.UtcNow - acct.Created);
|
||||
(Core.Now - acct.Created);
|
||||
|
||||
if (time > TimeSpan.Zero)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,16 +83,9 @@ namespace Server.Engines.VeteranRewards
|
|||
return false;
|
||||
}
|
||||
|
||||
var totalTime = DateTime.UtcNow - acct.Created;
|
||||
ts = list.Age - (Core.Now - acct.Created);
|
||||
|
||||
ts = list.Age - totalTime;
|
||||
|
||||
if (ts <= TimeSpan.Zero)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ts <= TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public static int GetRewardLevel(Mobile mob)
|
||||
|
|
@ -107,7 +100,7 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static int GetRewardLevel(Account acct)
|
||||
{
|
||||
var totalTime = DateTime.UtcNow - acct.Created;
|
||||
var totalTime = Core.Now - acct.Created;
|
||||
|
||||
return Math.Max((int)(totalTime.TotalDays / RewardInterval.TotalDays), 0);
|
||||
}
|
||||
|
|
@ -124,7 +117,7 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
public static bool HasHalfLevel(Account acct)
|
||||
{
|
||||
var totalTime = DateTime.UtcNow - acct.Created;
|
||||
var totalTime = Core.Now - acct.Created;
|
||||
|
||||
var level = totalTime.TotalDays / RewardInterval.TotalDays;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if (pm.LastCompassionLoss + LossDelay < DateTime.UtcNow)
|
||||
if (pm.LastCompassionLoss + LossDelay < Core.Now)
|
||||
{
|
||||
VirtueHelper.Atrophy(from, VirtueName.Compassion, LossAmount);
|
||||
// OSI has no cliloc message for losing compassion. Weird.
|
||||
pm.LastCompassionLoss = DateTime.UtcNow;
|
||||
pm.LastCompassionLoss = Core.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
var waitTime = DateTime.UtcNow - pm.LastHonorUse;
|
||||
var waitTime = Core.Now - pm.LastHonorUse;
|
||||
if (waitTime < UseDelay)
|
||||
{
|
||||
var remainingTime = UseDelay - waitTime;
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server
|
|||
() =>
|
||||
{
|
||||
pm.HonorActive = false;
|
||||
pm.LastHonorUse = DateTime.UtcNow;
|
||||
pm.LastHonorUse = Core.Now;
|
||||
pm.SendLocalizedMessage(1063236); // You no longer embrace your honor
|
||||
}
|
||||
);
|
||||
|
|
@ -225,13 +225,13 @@ namespace Server
|
|||
|
||||
m_Timer = new InternalTimer(this);
|
||||
m_Timer.Start();
|
||||
source.m_hontime = DateTime.UtcNow + TimeSpan.FromMinutes(40);
|
||||
source.m_hontime = Core.Now + TimeSpan.FromMinutes(40);
|
||||
|
||||
Timer.DelayCall(
|
||||
TimeSpan.FromMinutes(40),
|
||||
() =>
|
||||
{
|
||||
if (source.m_hontime < DateTime.UtcNow && source.SentHonorContext != null)
|
||||
if (source.m_hontime < Core.Now && source.SentHonorContext != null)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,14 +199,14 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if (pm.LastJusticeLoss + LossDelay < DateTime.UtcNow)
|
||||
if (pm.LastJusticeLoss + LossDelay < Core.Now)
|
||||
{
|
||||
if (VirtueHelper.Atrophy(from, VirtueName.Justice, LossAmount))
|
||||
{
|
||||
from.SendLocalizedMessage(1049373); // You have lost some Justice.
|
||||
}
|
||||
|
||||
pm.LastJusticeLoss = DateTime.UtcNow;
|
||||
pm.LastJusticeLoss = Core.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if (pm.LastSacrificeLoss + LossDelay < DateTime.UtcNow)
|
||||
if (pm.LastSacrificeLoss + LossDelay < Core.Now)
|
||||
{
|
||||
if (VirtueHelper.Atrophy(from, VirtueName.Sacrifice, LossAmount))
|
||||
{
|
||||
|
|
@ -55,7 +55,7 @@ namespace Server
|
|||
var level = VirtueHelper.GetLevel(from, VirtueName.Sacrifice);
|
||||
|
||||
pm.AvailableResurrects = (int)level;
|
||||
pm.LastSacrificeLoss = DateTime.UtcNow;
|
||||
pm.LastSacrificeLoss = Core.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
@ -136,7 +136,7 @@ namespace Server
|
|||
{
|
||||
from.SendLocalizedMessage(1052017); // You do not have enough fame to sacrifice.
|
||||
}
|
||||
else if (DateTime.UtcNow < pm.LastSacrificeGain + GainDelay)
|
||||
else if (Core.Now < pm.LastSacrificeGain + GainDelay)
|
||||
{
|
||||
from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ namespace Server
|
|||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), targ.Delete);
|
||||
|
||||
pm.LastSacrificeGain = DateTime.UtcNow;
|
||||
pm.LastSacrificeGain = Core.Now;
|
||||
|
||||
var gainedPath = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
if (pm.LastValorLoss + LossDelay < DateTime.UtcNow)
|
||||
if (pm.LastValorLoss + LossDelay < Core.Now)
|
||||
{
|
||||
if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount))
|
||||
{
|
||||
from.SendLocalizedMessage(1054040); // You have lost some Valor.
|
||||
}
|
||||
|
||||
pm.LastValorLoss = DateTime.UtcNow;
|
||||
pm.LastValorLoss = Core.Now;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Server
|
|||
{
|
||||
if (virtue == VirtueName.Compassion)
|
||||
{
|
||||
if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
|
||||
if (pm.CompassionGains > 0 && Core.Now > pm.NextCompassionDay)
|
||||
{
|
||||
pm.NextCompassionDay = DateTime.MinValue;
|
||||
pm.CompassionGains = 0;
|
||||
|
|
@ -142,7 +142,7 @@ namespace Server
|
|||
|
||||
if (virtue == VirtueName.Compassion)
|
||||
{
|
||||
pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0);
|
||||
pm.NextCompassionDay = Core.Now + TimeSpan.FromDays(1.0);
|
||||
++pm.CompassionGains;
|
||||
|
||||
if (pm.CompassionGains >= 5)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue