From d2c670f5c37abfe1c7cb40b601c2f2fd7b392310 Mon Sep 17 00:00:00 2001 From: Mark Sturgill Date: Sun, 6 Oct 2013 03:21:18 -0700 Subject: [PATCH] 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 --- Scripts/Accounting/AccessRestrictions.cs | 2 +- Scripts/Accounting/Account.cs | 14 +- Scripts/Accounting/AccountAttackLimiter.cs | 8 +- Scripts/Accounting/AccountComment.cs | 6 +- Scripts/Accounting/AccountHandler.cs | 6 +- Scripts/Commands/Add.cs | 4 +- Scripts/Commands/Docs.cs | 4 +- Scripts/Commands/Logging.cs | 8 +- Scripts/Commands/Profiling.cs | 6 +- Scripts/Commands/ShardTime.cs | 2 +- Scripts/Engines/CannedEvil/ChampionSpawn.cs | 10 +- Scripts/Engines/CannedEvil/StarRoomGate.cs | 4 +- Scripts/Engines/ConPVP/AcceptDuelGump.cs | 4 +- Scripts/Engines/ConPVP/DuelContext.cs | 10 +- Scripts/Engines/ConPVP/Tournament.cs | 10 +- Scripts/Engines/ConPVP/Trophy.cs | 2 +- Scripts/Engines/Ethics/Core/Player.cs | 4 +- Scripts/Engines/Factions/Core/Election.cs | 14 +- Scripts/Engines/Factions/Core/Faction.cs | 14 +- Scripts/Engines/Factions/Core/FactionItem.cs | 4 +- Scripts/Engines/Factions/Core/FactionState.cs | 14 +- Scripts/Engines/Factions/Core/Keywords.cs | 2 +- .../Engines/Factions/Core/SilverGivenEntry.cs | 4 +- Scripts/Engines/Factions/Core/Town.cs | 8 +- .../Engines/Factions/Gumps/ElectionGump.cs | 6 +- Scripts/Engines/Factions/Gumps/FinanceGump.cs | 4 +- .../Factions/Gumps/LeaveFactionGump.cs | 4 +- Scripts/Engines/Factions/Items/Sigil.cs | 10 +- .../Factions/Items/Traps/BaseFactionTrap.cs | 4 +- .../Mobiles/Guards/BaseFactionGuard.cs | 6 +- .../Factions/Mobiles/Guards/GuardAI.cs | 14 +- Scripts/Engines/Harvest/Core/HarvestBank.cs | 4 +- Scripts/Engines/Help/HelpGump.cs | 2 +- Scripts/Engines/Help/PageQueue.cs | 6 +- Scripts/Engines/Help/SpeechLog.cs | 4 +- Scripts/Engines/Help/StuckMenu.cs | 8 +- Scripts/Engines/Khaldun/PuzzleChest.cs | 4 +- Scripts/Engines/Khaldun/RaisableItem.cs | 4 +- Scripts/Engines/MLQuests/MLQuest.cs | 2 +- Scripts/Engines/MLQuests/MLQuestEntry.cs | 6 +- Scripts/Engines/MLQuests/Mobiles/SirHelper.cs | 4 +- .../MLQuests/Objectives/BaseObjective.cs | 4 +- .../MLQuests/Objectives/EscortObjective.cs | 12 +- .../MLQuests/Objectives/GainSkillObjective.cs | 4 +- .../Engines/MyRunUO/DatabaseCommandQueue.cs | 4 +- Scripts/Engines/MyRunUO/MyRunUO.cs | 12 +- Scripts/Engines/MyRunUO/MyRunUOStatus.cs | 2 +- Scripts/Engines/Pathing/MovementPath.cs | 4 +- Scripts/Engines/Pathing/PathFollower.cs | 4 +- Scripts/Engines/Plants/PlantSystem.cs | 10 +- .../Engines/Quests/Collector/Objectives.cs | 4 +- .../Engines/Quests/Core/QuestRestartInfo.cs | 2 +- Scripts/Engines/Quests/Core/QuestSystem.cs | 2 +- .../Study of the Solen Hive/Objectives.cs | 4 +- Scripts/Engines/RemoteAdmin/Network.cs | 10 +- Scripts/Engines/RemoteAdmin/Packets.cs | 4 +- .../Engines/RemoteAdmin/RemoteAdminLogging.cs | 8 +- .../Engines/Reports/Objects/Staffing/Info.cs | 4 +- .../Reports/Objects/Staffing/QueueStatus.cs | 2 +- .../Reports/Objects/Staffing/ResponseInfo.cs | 2 +- .../Reports/Objects/Staffing/StaffHistory.cs | 10 +- .../Engines/Reports/Rendering/HtmlRenderer.cs | 2 +- Scripts/Engines/Reports/Reports.cs | 6 +- Scripts/Engines/Spawner/ProximitySpawner.cs | 6 +- Scripts/Engines/Spawner/Spawner.cs | 8 +- .../Character Statue Maker/CharacterStatue.cs | 4 +- .../Engines/VeteranRewards/RewardSystem.cs | 6 +- Scripts/Engines/Virtues/Compassion.cs | 4 +- Scripts/Engines/Virtues/Honor.cs | 8 +- Scripts/Engines/Virtues/Justice.cs | 4 +- Scripts/Engines/Virtues/Sacrifice.cs | 8 +- Scripts/Engines/Virtues/Valor.cs | 4 +- Scripts/Engines/Virtues/VirtueHelper.cs | 4 +- Scripts/Gumps/AdminGump.cs | 4 +- Scripts/Gumps/BanDurationGump.cs | 2 +- Scripts/Gumps/Guilds/GuildChangeTypeGump.cs | 2 +- .../Guilds/New Guild System/OtherGuildInfo.cs | 8 +- Scripts/Gumps/HouseGumpAOS.cs | 2 +- Scripts/Gumps/ReportMurderer.cs | 4 +- Scripts/Gumps/VendorInventoryGump.cs | 2 +- .../Halloween/2006/Engines/TrickOrTreat.cs | 6 +- .../Halloween/2009/Engines/PumpkinPatch.cs | 4 +- .../Halloween/2012/Engines/PlayerZombies.cs | 6 +- .../Valentine/2011/Items/StValentinesBears.cs | 4 +- .../Valentine/2012/Items/CupidsArrow.cs | 2 +- Scripts/Items/Addons/ArcheryButteAddon.cs | 4 +- Scripts/Items/Addons/RejuvinationAnkhs.cs | 4 +- Scripts/Items/Addons/SHTeleporter.cs | 4 +- Scripts/Items/Aquarium/Aquarium.cs | 8 +- Scripts/Items/Clothing/OuterTorso.cs | 4 +- .../Items/Containers/FillableContainers.cs | 4 +- Scripts/Items/Containers/MarkContainer.cs | 4 +- Scripts/Items/Containers/TreasureMapChest.cs | 4 +- .../StealableArtifactsSpawner.cs | 6 +- Scripts/Items/Deeds/HolidayTreeDeed.cs | 2 +- Scripts/Items/Games/Mahjong/MahjongGame.cs | 12 +- Scripts/Items/Lights/BaseLight.cs | 8 +- Scripts/Items/Maps/TreasureMap.cs | 8 +- Scripts/Items/Misc/AcidSlime.cs | 4 +- Scripts/Items/Misc/BulletinBoards.cs | 6 +- Scripts/Items/Misc/Corpses/Corpse.cs | 20 +-- Scripts/Items/Misc/Corpses/DecayedCorpse.cs | 4 +- Scripts/Items/Misc/DeceitBrazier.cs | 10 +- Scripts/Items/Misc/Firebomb.cs | 4 +- Scripts/Items/Misc/Guillotine.cs | 4 +- Scripts/Items/Misc/PlayerBulletinBoards.cs | 2 +- Scripts/Items/Misc/PoolOfAcid.cs | 4 +- Scripts/Items/Misc/PowerGenerator.cs | 8 +- Scripts/Items/Misc/Teleporter.cs | 4 +- Scripts/Items/Misc/WarningItem.cs | 4 +- Scripts/Items/Skill Items/Camping/Campfire.cs | 6 +- .../BaseConflagrationPotion.cs | 8 +- .../BaseConfusionBlastPotion.cs | 6 +- Scripts/Items/Skill Items/Magical/Runebook.cs | 4 +- .../Musical Instruments/BaseInstrument.cs | 8 +- Scripts/Items/Skill Items/Ninjitsu/EggBomb.cs | 2 +- .../Items/Skill Items/Ninjitsu/SmokeBomb.cs | 2 +- .../Skill Items/Tailor Items/Misc/Scissors.cs | 2 +- .../Items/Skill Items/Thief/DisguiseKit.cs | 4 +- .../Skill Items/Thief/DisguisePersistance.cs | 2 +- Scripts/Items/Skill Items/Tinkering/Clocks.cs | 4 +- .../8th Anniversary Items/FountainOfLife.cs | 4 +- Scripts/Items/Special/Gifts/RoseOfTrinsic.cs | 4 +- .../Special/Heritage Items/IronMaiden.cs | 2 +- .../Special/House Raffle/HouseRaffleDeed.cs | 2 +- .../Special/House Raffle/HouseRaffleStone.cs | 8 +- .../Special/Solen Items/BallOfSummoning.cs | 4 +- Scripts/Items/Special/SoulStone.cs | 8 +- .../Special Scrolls/ScrollofAlacrity.cs | 4 +- .../Special Scrolls/ScrollofTranscendence.cs | 2 +- .../Veteran Rewards/AnkhOfSacrifice.cs | 6 +- .../Special/Veteran Rewards/MiningCart.cs | 8 +- .../Special/Veteran Rewards/TreeStump.cs | 8 +- Scripts/Items/Talismans/TalismanSummons.cs | 4 +- Scripts/Items/Traps/BaseTrap.cs | 8 +- .../Items/Weapons/Abilities/DoubleStrike.cs | 2 +- Scripts/Items/Weapons/BaseWeapon.cs | 6 +- Scripts/Items/Weapons/Ranged/BaseRanged.cs | 2 +- Scripts/Misc/AttackMessage.cs | 4 +- Scripts/Misc/AutoRestart.cs | 8 +- Scripts/Misc/AutoSave.cs | 2 +- Scripts/Misc/BuffIcons.cs | 4 +- Scripts/Misc/ClientVerification.cs | 2 +- Scripts/Misc/CrashGuard.cs | 4 +- Scripts/Misc/CurrentExpansion.cs | 2 +- Scripts/Misc/Guild.cs | 12 +- Scripts/Misc/HardwareInfo.cs | 2 +- Scripts/Misc/Notoriety.cs | 2 +- Scripts/Misc/Profile.cs | 2 +- Scripts/Misc/ShardPoller.cs | 4 +- Scripts/Misc/SkillCheck.cs | 20 +-- Scripts/Mobiles/AI/ArcherAI.cs | 2 +- Scripts/Mobiles/AI/BaseAI.cs | 26 ++-- Scripts/Mobiles/AI/MageAI.cs | 14 +- Scripts/Mobiles/AI/ThiefAI.cs | 4 +- Scripts/Mobiles/Animals/Cows/Cow.cs | 4 +- Scripts/Mobiles/Animals/Misc/Sheep.cs | 8 +- Scripts/Mobiles/Animals/Mounts/BaseMount.cs | 4 +- Scripts/Mobiles/BaseCreature.cs | 74 +++++------ Scripts/Mobiles/Familiars/DarkWolf.cs | 4 +- Scripts/Mobiles/Familiars/HordeMinion.cs | 6 +- Scripts/Mobiles/Familiars/ShadowWisp.cs | 4 +- Scripts/Mobiles/Guards/ArcherGuard.cs | 4 +- Scripts/Mobiles/Guards/WarriorGuard.cs | 2 +- Scripts/Mobiles/Healers/BaseHealer.cs | 4 +- Scripts/Mobiles/Monsters/AOS/Revenant.cs | 6 +- .../Monsters/Humanoid/Magic/Betrayer.cs | 6 +- .../Monsters/Humanoid/Magic/SavageShaman.cs | 4 +- .../Humanoid/Melee/KhaldunRevenant.cs | 4 +- .../Monsters/Humanoid/Melee/OrcBomber.cs | 6 +- .../Mobiles/Monsters/LBR/Jukas/JukaMage.cs | 8 +- .../Mobiles/Monsters/LBR/Meers/MeerCaptain.cs | 6 +- .../Mobiles/Monsters/LBR/Meers/MeerEternal.cs | 6 +- .../Mobiles/Monsters/LBR/Meers/MeerMage.cs | 6 +- .../Monsters/ML/Humanoid/Magic/MLDryad.cs | 12 +- .../Monsters/ML/Humanoid/Magic/Satyr.cs | 20 +-- .../Mobiles/Monsters/ML/Special/Ilhenir.cs | 2 +- .../Monsters/ML/Twisted Weald/Changeling.cs | 8 +- .../Monsters/Misc/Magic/EtherealWarrior.cs | 4 +- .../Monsters/Misc/Melee/PlagueSpawn.cs | 4 +- .../Mobiles/Monsters/Misc/Melee/SandVortex.cs | 4 +- Scripts/Mobiles/PlayerMobile.cs | 66 +++++----- Scripts/Mobiles/Townfolk/BaseEscortable.cs | 22 ++-- Scripts/Mobiles/Townfolk/TownCrier.cs | 8 +- Scripts/Mobiles/Vendors/BaseVendor.cs | 14 +- .../NPC/Guildmasters/BaseGuildmaster.cs | 8 +- .../Mobiles/Vendors/NPC/RealEstateBroker.cs | 4 +- Scripts/Mobiles/Vendors/NPC/Scribe.cs | 4 +- Scripts/Mobiles/Vendors/PlayerVendor.cs | 14 +- Scripts/Mobiles/Vendors/RentedVendor.cs | 8 +- Scripts/Mobiles/Vendors/VendorInventory.cs | 4 +- Scripts/Multis/BaseHouse.cs | 22 ++-- Scripts/Multis/Boats/BaseBoat.cs | 16 +-- Scripts/Multis/Camps/BaseCamp.cs | 2 +- Scripts/Multis/HouseSign.cs | 2 +- Scripts/Regions/HouseRegion.cs | 4 +- Scripts/Regions/Spawning/SpawnEntry.cs | 4 +- Scripts/Skills/AnimalTaming.cs | 26 ++-- Scripts/Skills/Begging.cs | 4 +- Scripts/Skills/Discordance.cs | 14 +- Scripts/Skills/Peacemaking.cs | 16 +-- Scripts/Skills/Provocation.cs | 6 +- Scripts/Skills/SpiritSpeak.cs | 2 +- Scripts/Skills/Stealing.cs | 10 +- Scripts/SpecialSystems/Engines/GiftGiving.cs | 2 +- Scripts/Spells/Base/Spell.cs | 18 +-- Scripts/Spells/Base/SpellHelper.cs | 4 +- Scripts/Spells/Chivalry/PaladinSpell.cs | 2 +- Scripts/Spells/Eighth/EnergyVortex.cs | 2 +- Scripts/Spells/Fifth/BladeSpirits.cs | 2 +- Scripts/Spells/Fifth/PoisonField.cs | 4 +- Scripts/Spells/Fourth/FireField.cs | 4 +- Scripts/Spells/Necromancy/BloodOathSpell.cs | 4 +- Scripts/Spells/Necromancy/MindRot.cs | 6 +- Scripts/Spells/Necromancy/PainSpike.cs | 2 +- Scripts/Spells/Necromancy/Strangle.cs | 6 +- Scripts/Spells/Ninjitsu/AnimalForm.cs | 2 +- Scripts/Spells/Ninjitsu/MirrorImage.cs | 2 +- Scripts/Spells/Sixth/ParalyzeField.cs | 4 +- Scripts/Spells/Spellweaving/ArcaneCircle.cs | 2 +- Scripts/Spells/Spellweaving/ArcanistSpell.cs | 2 +- .../Spellweaving/Items/TransientItem.cs | 6 +- Scripts/Spells/Third/WallOfStone.cs | 6 +- Server/AggressorInfo.cs | 4 +- Server/AssemblyInfo.cs | 2 +- Server/Item.cs | 8 +- Server/Main.cs | 22 +++- Server/Mobile.cs | 120 +++++++++--------- Server/Network/NetState.cs | 22 ++-- Server/Network/PacketHandlers.cs | 11 +- Server/Network/PacketWriter.cs | 2 +- Server/Network/Packets.cs | 4 +- Server/Persistence/DynamicSaveStrategy.cs | 2 +- Server/Persistence/ParallelSaveStrategy.cs | 3 +- Server/Persistence/StandardSaveStrategy.cs | 3 +- Server/Serialization.cs | 6 +- Server/Skills.cs | 4 +- Server/Targeting/Target.cs | 2 +- Server/TileMatrix.cs | 8 +- Server/Timer.cs | 4 +- Server/World.cs | 2 +- 241 files changed, 842 insertions(+), 831 deletions(-) diff --git a/Scripts/Accounting/AccessRestrictions.cs b/Scripts/Accounting/AccessRestrictions.cs index 71d2efb74..00ecad3b0 100644 --- a/Scripts/Accounting/AccessRestrictions.cs +++ b/Scripts/Accounting/AccessRestrictions.cs @@ -31,7 +31,7 @@ namespace Server Console.WriteLine( "Client: {0}: Past IP limit threshold", ip ); using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) ) - op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.Now ); + op.WriteLine( "{0}\tPast IP limit threshold\t{1}", ip, DateTime.UtcNow ); e.AllowConnection = false; return; diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs index 90a905879..fd3fb299b 100644 --- a/Scripts/Accounting/Account.cs +++ b/Scripts/Accounting/Account.cs @@ -177,7 +177,7 @@ namespace Server.Accounting if ( GetBanTags( out banTime, out banDuration ) ) { - if ( banDuration != TimeSpan.MaxValue && DateTime.Now >= ( banTime + banDuration ) ) + if ( banDuration != TimeSpan.MaxValue && DateTime.UtcNow >= ( banTime + banDuration ) ) { SetUnspecifiedBan( null ); // clear Banned = false; @@ -235,7 +235,7 @@ namespace Server.Accounting if( this.AccessLevel != AccessLevel.Player ) return false; - TimeSpan inactiveLength = DateTime.Now - m_LastLogin; + TimeSpan inactiveLength = DateTime.UtcNow - m_LastLogin; return (inactiveLength > ((this.Count == 0) ? EmptyInactiveDuration : InactiveDuration)); } @@ -254,7 +254,7 @@ namespace Server.Accounting PlayerMobile m = m_Mobiles[i] as PlayerMobile; if ( m != null && m.NetState != null ) - return m_TotalGameTime + ( DateTime.Now - m.SessionStart ); + return m_TotalGameTime + ( DateTime.UtcNow - m.SessionStart ); } return m_TotalGameTime; @@ -528,7 +528,7 @@ namespace Server.Accounting if ( m == null ) return; - acc.m_TotalGameTime += DateTime.Now - m.SessionStart; + acc.m_TotalGameTime += DateTime.UtcNow - m.SessionStart; } private static void EventSink_Login( LoginEventArgs e ) @@ -607,7 +607,7 @@ namespace Server.Accounting m_AccessLevel = AccessLevel.Player; - m_Created = m_LastLogin = DateTime.Now; + m_Created = m_LastLogin = DateTime.UtcNow; m_TotalGameTime = TimeSpan.Zero; m_Mobiles = new Mobile[7]; @@ -674,8 +674,8 @@ namespace Server.Accounting m_AccessLevel = (AccessLevel)Enum.Parse( typeof( AccessLevel ), Utility.GetText( node["accessLevel"], "Player" ), true ); #endif m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 ); - m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.Now ); - m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.Now ); + m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.UtcNow ); + m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.UtcNow ); m_Mobiles = LoadMobiles( node ); m_Comments = LoadComments( node ); diff --git a/Scripts/Accounting/AccountAttackLimiter.cs b/Scripts/Accounting/AccountAttackLimiter.cs index 3c264d0a0..892d032e6 100644 --- a/Scripts/Accounting/AccountAttackLimiter.cs +++ b/Scripts/Accounting/AccountAttackLimiter.cs @@ -30,7 +30,7 @@ namespace Server.Accounting if ( accessLog == null ) return true; - return ( DateTime.Now >= (accessLog.LastAccessTime + ComputeThrottle( accessLog.Counts )) ); + return ( DateTime.UtcNow >= (accessLog.LastAccessTime + ComputeThrottle( accessLog.Counts )) ); } private static List m_List = new List(); @@ -73,7 +73,7 @@ namespace Server.Accounting using ( StreamWriter op = new StreamWriter( "throttle.log", true ) ) { op.WriteLine( "{0}\t{1}\t{2}", - DateTime.Now, + DateTime.UtcNow, ns, accessLog.Counts ); @@ -125,7 +125,7 @@ namespace Server.Accounting public bool HasExpired { - get{ return ( DateTime.Now >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); } + get{ return ( DateTime.UtcNow >= ( m_LastAccessTime + TimeSpan.FromHours( 1.0 ) ) ); } } public int Counts @@ -136,7 +136,7 @@ namespace Server.Accounting public void RefreshAccessTime() { - m_LastAccessTime = DateTime.Now; + m_LastAccessTime = DateTime.UtcNow; } public InvalidAccountAccessLog( IPAddress address ) diff --git a/Scripts/Accounting/AccountComment.cs b/Scripts/Accounting/AccountComment.cs index 778e7558b..e997a2a97 100644 --- a/Scripts/Accounting/AccountComment.cs +++ b/Scripts/Accounting/AccountComment.cs @@ -23,7 +23,7 @@ namespace Server.Accounting public string Content { get{ return m_Content; } - set{ m_Content = value; m_LastModified = DateTime.Now; } + set{ m_Content = value; m_LastModified = DateTime.UtcNow; } } /// @@ -43,7 +43,7 @@ namespace Server.Accounting { m_AddedBy = addedBy; m_Content = content; - m_LastModified = DateTime.Now; + m_LastModified = DateTime.UtcNow; } /// @@ -53,7 +53,7 @@ namespace Server.Accounting public AccountComment( XmlElement node ) { m_AddedBy = Utility.GetAttribute( node, "addedBy", "empty" ); - m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.Now ); + m_LastModified = Utility.GetXMLDateTime( Utility.GetAttribute( node, "lastModified" ), DateTime.UtcNow ); m_Content = Utility.GetText( node, "" ); } diff --git a/Scripts/Accounting/AccountHandler.cs b/Scripts/Accounting/AccountHandler.cs index 76552bbe3..f130bed7e 100644 --- a/Scripts/Accounting/AccountHandler.cs +++ b/Scripts/Accounting/AccountHandler.cs @@ -197,7 +197,7 @@ namespace Server.Misc state.Send( new DeleteResult( DeleteResultType.CharBeingPlayed ) ); state.Send( new CharacterListUpdate( acct ) ); } - else if ( RestrictDeletion && DateTime.Now < (m.CreationTime + DeleteDelay) ) + else if ( RestrictDeletion && DateTime.UtcNow < (m.CreationTime + DeleteDelay) ) { state.Send( new DeleteResult( DeleteResultType.CharTooYoung ) ); state.Send( new CharacterListUpdate( acct ) ); @@ -306,7 +306,7 @@ namespace Server.Misc Console.WriteLine( "Login: {0}: Past IP limit threshold", e.State ); using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) ) - op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.Now ); + op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow ); return; } @@ -370,7 +370,7 @@ namespace Server.Misc Console.WriteLine( "Login: {0}: Past IP limit threshold", e.State ); using ( StreamWriter op = new StreamWriter( "ipLimits.log", true ) ) - op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.Now ); + op.WriteLine( "{0}\tPast IP limit threshold\t{1}", e.State, DateTime.UtcNow ); return; } diff --git a/Scripts/Commands/Add.cs b/Scripts/Commands/Add.cs index 24fdf914a..ff2cffc9f 100644 --- a/Scripts/Commands/Add.cs +++ b/Scripts/Commands/Add.cs @@ -93,12 +93,12 @@ namespace Server.Commands return; } - DateTime time = DateTime.Now; + DateTime time = DateTime.UtcNow; int built = BuildObjects( from, type, start, end, args, props, packs, outline, mapAvg ); if ( built > 0 ) - from.SendMessage( "{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.Now - time).TotalSeconds ); + from.SendMessage( "{0} object{1} generated in {2:F1} seconds.", built, built != 1 ? "s" : "", (DateTime.UtcNow - time).TotalSeconds ); else SendUsage( type, from ); } diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index 172974082..837490e17 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -28,11 +28,11 @@ namespace Server.Commands Network.NetState.FlushAll(); Network.NetState.Pause(); - DateTime startTime = DateTime.Now; + DateTime startTime = DateTime.UtcNow; bool generated = Document(); - DateTime endTime = DateTime.Now; + DateTime endTime = DateTime.UtcNow; Network.NetState.Resume(); diff --git a/Scripts/Commands/Logging.cs b/Scripts/Commands/Logging.cs index 789fed775..a68772518 100644 --- a/Scripts/Commands/Logging.cs +++ b/Scripts/Commands/Logging.cs @@ -28,12 +28,12 @@ namespace Server.Commands try { - m_Output = new StreamWriter( Path.Combine( directory, String.Format( "{0}.log", DateTime.Now.ToLongDateString() ) ), true ); + m_Output = new StreamWriter( Path.Combine( directory, String.Format( "{0}.log", DateTime.UtcNow.ToLongDateString() ) ), true ); m_Output.AutoFlush = true; m_Output.WriteLine( "##############################" ); - m_Output.WriteLine( "Log started on {0}", DateTime.Now ); + m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); m_Output.WriteLine(); } catch @@ -77,7 +77,7 @@ namespace Server.Commands try { - m_Output.WriteLine( "{0}: {1}: {2}", DateTime.Now, from.NetState, text ); + m_Output.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text ); string path = Core.BaseDirectory; @@ -91,7 +91,7 @@ namespace Server.Commands path = Path.Combine( path, String.Format( "{0}.log", name ) ); using ( StreamWriter sw = new StreamWriter( path, true ) ) - sw.WriteLine( "{0}: {1}: {2}", DateTime.Now, from.NetState, text ); + sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text ); } catch { diff --git a/Scripts/Commands/Profiling.cs b/Scripts/Commands/Profiling.cs index bfd821eda..13387f79b 100644 --- a/Scripts/Commands/Profiling.cs +++ b/Scripts/Commands/Profiling.cs @@ -29,7 +29,7 @@ namespace Server.Commands { using ( StreamWriter sw = new StreamWriter( "profiles.log", true ) ) { - sw.WriteLine( "# Dump on {0:f}", DateTime.Now ); + sw.WriteLine( "# Dump on {0:f}", DateTime.UtcNow ); sw.WriteLine( "# Core profiling for " + Core.ProfileTime ); sw.WriteLine( "# Packet send" ); @@ -169,7 +169,7 @@ namespace Server.Commands items.Sort( new CountSorter() ); mobiles.Sort( new CountSorter() ); - op.WriteLine( "# Object count table generated on {0}", DateTime.Now ); + op.WriteLine( "# Object count table generated on {0}", DateTime.UtcNow ); op.WriteLine(); op.WriteLine(); @@ -388,7 +388,7 @@ namespace Server.Commands using ( StreamWriter op = new StreamWriter( opFile ) ) { op.WriteLine( "# Profile of world {0}", type ); - op.WriteLine( "# Generated on {0}", DateTime.Now ); + op.WriteLine( "# Generated on {0}", DateTime.UtcNow ); op.WriteLine(); op.WriteLine(); diff --git a/Scripts/Commands/ShardTime.cs b/Scripts/Commands/ShardTime.cs index 8e46723f6..07c10dbac 100644 --- a/Scripts/Commands/ShardTime.cs +++ b/Scripts/Commands/ShardTime.cs @@ -13,7 +13,7 @@ namespace Server.Commands [Description( "Returns the server's local time." )] private static void Time_OnCommand( CommandEventArgs e ) { - e.Mobile.SendMessage( DateTime.Now.ToString() ); + e.Mobile.SendMessage( DateTime.UtcNow.ToString() ); } } } \ No newline at end of file diff --git a/Scripts/Engines/CannedEvil/ChampionSpawn.cs b/Scripts/Engines/CannedEvil/ChampionSpawn.cs index 04c4e0639..f259d23fc 100644 --- a/Scripts/Engines/CannedEvil/ChampionSpawn.cs +++ b/Scripts/Engines/CannedEvil/ChampionSpawn.cs @@ -381,7 +381,7 @@ namespace Server.Engines.CannedEvil if( m_RestartTimer != null ) m_RestartTimer.Stop(); - m_RestartTime = DateTime.Now + ts; + m_RestartTime = DateTime.UtcNow + ts; m_RestartTimer = new RestartTimer( this, ts ); m_RestartTimer.Start(); @@ -611,7 +611,7 @@ namespace Server.Engines.CannedEvil else if( p > 0 ) SetWhiteSkullCount( p / 20 ); - if( DateTime.Now >= m_ExpireTime ) + if( DateTime.UtcNow >= m_ExpireTime ) Expire(); Respawn(); @@ -620,7 +620,7 @@ namespace Server.Engines.CannedEvil public void AdvanceLevel() { - m_ExpireTime = DateTime.Now + m_ExpireDelay; + m_ExpireTime = DateTime.UtcNow + m_ExpireDelay; if( Level < 16 ) { @@ -822,7 +822,7 @@ namespace Server.Engines.CannedEvil SetWhiteSkullCount( 0 ); } - m_ExpireTime = DateTime.Now + m_ExpireDelay; + m_ExpireTime = DateTime.UtcNow + m_ExpireDelay; } public Point3D GetRedSkullLocation( int index ) @@ -1234,7 +1234,7 @@ namespace Server.Engines.CannedEvil if( reader.ReadBool() ) { m_RestartTime = reader.ReadDeltaTime(); - BeginRestart( m_RestartTime - DateTime.Now ); + BeginRestart( m_RestartTime - DateTime.UtcNow ); } if( version < 4 ) diff --git a/Scripts/Engines/CannedEvil/StarRoomGate.cs b/Scripts/Engines/CannedEvil/StarRoomGate.cs index fe0b57cf9..06e18ec46 100644 --- a/Scripts/Engines/CannedEvil/StarRoomGate.cs +++ b/Scripts/Engines/CannedEvil/StarRoomGate.cs @@ -32,7 +32,7 @@ namespace Server.Items if ( decays ) { m_Decays = true; - m_DecayTime = DateTime.Now + TimeSpan.FromMinutes( 2.0 ); + m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes( 2.0 ); m_Timer = new InternalTimer( this, m_DecayTime ); m_Timer.Start(); @@ -92,7 +92,7 @@ namespace Server.Items { private Item m_Item; - public InternalTimer( Item item, DateTime end ) : base( end - DateTime.Now ) + public InternalTimer( Item item, DateTime end ) : base( end - DateTime.UtcNow ) { m_Item = item; } diff --git a/Scripts/Engines/ConPVP/AcceptDuelGump.cs b/Scripts/Engines/ConPVP/AcceptDuelGump.cs index c07b2fd63..a367e38ab 100644 --- a/Scripts/Engines/ConPVP/AcceptDuelGump.cs +++ b/Scripts/Engines/ConPVP/AcceptDuelGump.cs @@ -124,13 +124,13 @@ namespace Server.Engines.ConPVP public DateTime m_Expire; public Mobile Ignored{ get{ return m_Ignored; } } - public bool Expired{ get{ return ( DateTime.Now >= m_Expire ); } } + public bool Expired{ get{ return ( DateTime.UtcNow >= m_Expire ); } } private static TimeSpan ExpireDelay = TimeSpan.FromMinutes( 15.0 ); public void Refresh() { - m_Expire = DateTime.Now + ExpireDelay; + m_Expire = DateTime.UtcNow + ExpireDelay; } public IgnoreEntry( Mobile ignored ) diff --git a/Scripts/Engines/ConPVP/DuelContext.cs b/Scripts/Engines/ConPVP/DuelContext.cs index 835036cfa..4584b16c2 100644 --- a/Scripts/Engines/ConPVP/DuelContext.cs +++ b/Scripts/Engines/ConPVP/DuelContext.cs @@ -1156,7 +1156,7 @@ namespace Server.Engines.ConPVP { AggressorInfo info = m.Aggressed[i]; - if ( info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatDelay ) + if ( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatDelay ) return true; } @@ -1164,7 +1164,7 @@ namespace Server.Engines.ConPVP { AggressorInfo info = m.Aggressors[i]; - if ( info.Attacker.Player && (DateTime.Now - info.LastCombatTime) < CombatDelay ) + if ( info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatDelay ) return true; } @@ -2050,14 +2050,14 @@ namespace Server.Engines.ConPVP m_Mobile = mob; m_Location = loc; m_Facet = facet; - m_Expire = DateTime.Now + TimeSpan.FromMinutes( 30.0 ); + m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 ); } - public bool Expired{ get{ return ( DateTime.Now >= m_Expire ); } } + public bool Expired{ get{ return ( DateTime.UtcNow >= m_Expire ); } } public void Update() { - m_Expire = DateTime.Now + TimeSpan.FromMinutes( 30.0 ); + m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 ); if ( m_Mobile.Map == Map.Internal ) { diff --git a/Scripts/Engines/ConPVP/Tournament.cs b/Scripts/Engines/ConPVP/Tournament.cs index a219f1df3..e173c3e5a 100644 --- a/Scripts/Engines/ConPVP/Tournament.cs +++ b/Scripts/Engines/ConPVP/Tournament.cs @@ -689,7 +689,7 @@ namespace Server.Engines.ConPVP fmt = "As you wish m'{0}. The tournament will begin {1}, but first you must name your team."; string timeUntil; - int minutesUntil = (int)Math.Round( ( (tourny.SignupStart + tourny.SignupPeriod) - DateTime.Now ).TotalMinutes ); + int minutesUntil = (int)Math.Round( ( (tourny.SignupStart + tourny.SignupPeriod) - DateTime.UtcNow ).TotalMinutes ); if ( minutesUntil == 0 ) timeUntil = "momentarily"; @@ -1263,7 +1263,7 @@ namespace Server.Engines.ConPVP { if ( m_Tournament.Stage == TournamentStage.Inactive ) { - m_Tournament.SignupStart = DateTime.Now; + m_Tournament.SignupStart = DateTime.UtcNow; m_Tournament.Stage = TournamentStage.Signup; m_Tournament.Participants.Clear(); m_Tournament.Pyramid.Levels.Clear(); @@ -1940,7 +1940,7 @@ namespace Server.Engines.ConPVP { if ( m_Stage == TournamentStage.Signup ) { - TimeSpan until = ( m_SignupStart + m_SignupPeriod ) - DateTime.Now; + TimeSpan until = ( m_SignupStart + m_SignupPeriod ) - DateTime.UtcNow; if ( until <= TimeSpan.Zero ) { @@ -1995,7 +1995,7 @@ namespace Server.Engines.ConPVP else { Alert( "Is this all?", "Pitiful. Signup extended." ); - m_SignupStart = DateTime.Now; + m_SignupStart = DateTime.UtcNow; } } else if ( Math.Abs( until.TotalSeconds - TimeSpan.FromMinutes( 1.0 ).TotalSeconds ) < (SliceInterval.TotalSeconds/2) ) @@ -2722,7 +2722,7 @@ namespace Server.Engines.ConPVP if ( m_Tournament.Stage == TournamentStage.Signup ) { - TimeSpan until = ( m_Tournament.SignupStart + m_Tournament.SignupPeriod ) - DateTime.Now; + TimeSpan until = ( m_Tournament.SignupStart + m_Tournament.SignupPeriod ) - DateTime.UtcNow; string text; int secs = (int) until.TotalSeconds; diff --git a/Scripts/Engines/ConPVP/Trophy.cs b/Scripts/Engines/ConPVP/Trophy.cs index b9ab66de2..28ef450ab 100644 --- a/Scripts/Engines/ConPVP/Trophy.cs +++ b/Scripts/Engines/ConPVP/Trophy.cs @@ -37,7 +37,7 @@ namespace Server.Items { m_Title = title; m_Rank = rank; - m_Date = DateTime.Now; + m_Date = DateTime.UtcNow; LootType = LootType.Blessed; diff --git a/Scripts/Engines/Ethics/Core/Player.cs b/Scripts/Engines/Ethics/Core/Player.cs index 1f73b3ce5..7d36892ea 100644 --- a/Scripts/Engines/Ethics/Core/Player.cs +++ b/Scripts/Engines/Ethics/Core/Player.cs @@ -79,7 +79,7 @@ namespace Server.Ethics if ( m_Shield == DateTime.MinValue ) return false; - if ( DateTime.Now < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) ) + if ( DateTime.UtcNow < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) ) return true; FinishShield(); @@ -89,7 +89,7 @@ namespace Server.Ethics public void BeginShield() { - m_Shield = DateTime.Now; + m_Shield = DateTime.UtcNow; } public void FinishShield() diff --git a/Scripts/Engines/Factions/Core/Election.cs b/Scripts/Engines/Factions/Core/Election.cs index 64fab6e88..c11ddf70d 100644 --- a/Scripts/Engines/Factions/Core/Election.cs +++ b/Scripts/Engines/Factions/Core/Election.cs @@ -26,7 +26,7 @@ namespace Server.Factions public List 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 ) diff --git a/Scripts/Engines/Factions/Core/Faction.cs b/Scripts/Engines/Factions/Core/Faction.cs index 02dabc076..a6cb29638 100644 --- a/Scripts/Engines/Factions/Core/Faction.cs +++ b/Scripts/Engines/Factions/Core/Faction.cs @@ -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; diff --git a/Scripts/Engines/Factions/Core/FactionItem.cs b/Scripts/Engines/Factions/Core/FactionItem.cs index bce0b1e9b..8bb9c8201 100644 --- a/Scripts/Engines/Factions/Core/FactionItem.cs +++ b/Scripts/Engines/Factions/Core/FactionItem.cs @@ -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() diff --git a/Scripts/Engines/Factions/Core/FactionState.cs b/Scripts/Engines/Factions/Core/FactionState.cs index 1fddd425a..5b485ea54 100644 --- a/Scripts/Engines/Factions/Core/FactionState.cs +++ b/Scripts/Engines/Factions/Core/FactionState.cs @@ -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 members = new List( 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 ) { diff --git a/Scripts/Engines/Factions/Core/Keywords.cs b/Scripts/Engines/Factions/Core/Keywords.cs index 16e67faa1..15011967d 100644 --- a/Scripts/Engines/Factions/Core/Keywords.cs +++ b/Scripts/Engines/Factions/Core/Keywords.cs @@ -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. diff --git a/Scripts/Engines/Factions/Core/SilverGivenEntry.cs b/Scripts/Engines/Factions/Core/SilverGivenEntry.cs index 3f05e9bf6..4e9283569 100644 --- a/Scripts/Engines/Factions/Core/SilverGivenEntry.cs +++ b/Scripts/Engines/Factions/Core/SilverGivenEntry.cs @@ -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; } } } \ No newline at end of file diff --git a/Scripts/Engines/Factions/Core/Town.cs b/Scripts/Engines/Factions/Core/Town.cs index 99f7b12c4..ed680f761 100644 --- a/Scripts/Engines/Factions/Core/Town.cs +++ b/Scripts/Engines/Factions/Core/Town.cs @@ -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 diff --git a/Scripts/Engines/Factions/Gumps/ElectionGump.cs b/Scripts/Engines/Factions/Gumps/ElectionGump.cs index 47862690c..5fb67cfb6 100644 --- a/Scripts/Engines/Factions/Gumps/ElectionGump.cs +++ b/Scripts/Engines/Factions/Gumps/ElectionGump.cs @@ -55,7 +55,7 @@ namespace Server.Factions { case ElectionState.Pending: { - TimeSpan toGo = ( election.LastStateTime + Election.PendingPeriod ) - DateTime.Now; + TimeSpan toGo = ( election.LastStateTime + Election.PendingPeriod ) - DateTime.UtcNow; int days = (int) (toGo.TotalDays + 0.5); AddHtmlLocalized( 20, 40, 380, 20, 1038034, false, false ); // A new election campaign is pending @@ -74,7 +74,7 @@ namespace Server.Factions } case ElectionState.Campaign: { - TimeSpan toGo = ( election.LastStateTime + Election.CampaignPeriod ) - DateTime.Now; + TimeSpan toGo = ( election.LastStateTime + Election.CampaignPeriod ) - DateTime.UtcNow; int days = (int) (toGo.TotalDays + 0.5); AddHtmlLocalized( 20, 40, 380, 20, 1018058, false, false ); // There is an election campaign in progress. @@ -106,7 +106,7 @@ namespace Server.Factions } case ElectionState.Election: { - TimeSpan toGo = ( election.LastStateTime + Election.VotingPeriod ) - DateTime.Now; + TimeSpan toGo = ( election.LastStateTime + Election.VotingPeriod ) - DateTime.UtcNow; int days = (int) Math.Ceiling( toGo.TotalDays ); AddHtmlLocalized( 20, 40, 380, 20, 1018060, false, false ); // There is an election vote in progress. diff --git a/Scripts/Engines/Factions/Gumps/FinanceGump.cs b/Scripts/Engines/Factions/Gumps/FinanceGump.cs index 1b43b466f..64a491fa1 100644 --- a/Scripts/Engines/Factions/Gumps/FinanceGump.cs +++ b/Scripts/Engines/Factions/Gumps/FinanceGump.cs @@ -211,7 +211,7 @@ namespace Server.Factions if ( m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady ) { - TimeSpan remaining = DateTime.Now - ( m_Town.LastTaxChange + Town.TaxChangePeriod ); + TimeSpan remaining = DateTime.UtcNow - ( m_Town.LastTaxChange + Town.TaxChangePeriod ); if ( remaining.TotalMinutes < 4 ) m_From.SendLocalizedMessage( 1042165 ); // You must wait a short while before changing prices again. @@ -229,7 +229,7 @@ namespace Server.Factions m_Town.Tax = newTax; if ( m_From.AccessLevel == AccessLevel.Player ) - m_Town.LastTaxChange = DateTime.Now; + m_Town.LastTaxChange = DateTime.UtcNow; } break; diff --git a/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs b/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs index 40bf32b93..8897ca358 100644 --- a/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs +++ b/Scripts/Engines/Factions/Gumps/LeaveFactionGump.cs @@ -46,7 +46,7 @@ namespace Server.Factions if ( pl != null ) { - pl.Leaving = DateTime.Now; + pl.Leaving = DateTime.UtcNow; if ( Faction.LeavePeriod == TimeSpan.FromDays( 3.0 ) ) m_From.SendLocalizedMessage( 1005065 ); // You will be removed from the faction in 3 days @@ -69,7 +69,7 @@ namespace Server.Factions if ( pl != null ) { - pl.Leaving = DateTime.Now; + pl.Leaving = DateTime.UtcNow; if ( Faction.LeavePeriod == TimeSpan.FromDays( 3.0 ) ) mob.SendLocalizedMessage( 1005060 ); // Your guild will quit the faction in 3 days diff --git a/Scripts/Engines/Factions/Items/Sigil.cs b/Scripts/Engines/Factions/Items/Sigil.cs index fe858af0c..2ae6ad511 100644 --- a/Scripts/Engines/Factions/Items/Sigil.cs +++ b/Scripts/Engines/Factions/Items/Sigil.cs @@ -233,7 +233,7 @@ namespace Server.Factions private void BeginCorrupting( Faction faction ) { m_Corrupting = faction; - m_CorruptionStart = DateTime.Now; + m_CorruptionStart = DateTime.UtcNow; } private void ClearCorrupting() @@ -250,7 +250,7 @@ namespace Server.Factions if ( !IsBeingCorrupted ) return TimeSpan.Zero; - TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.Now; + TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -319,7 +319,7 @@ namespace Server.Factions if ( m_Corrupted != newController ) BeginCorrupting( newController ); } - else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.Now ) + else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow ) { if ( m_Corrupted != newController ) BeginCorrupting( newController ); // grace time over, reset period @@ -334,7 +334,7 @@ namespace Server.Factions } else if ( m_GraceStart == DateTime.MinValue ) { - m_GraceStart = DateTime.Now; + m_GraceStart = DateTime.UtcNow; } m_PurificationStart = DateTime.MinValue; @@ -356,7 +356,7 @@ namespace Server.Factions m.Sigil = this; m_Corrupting = null; - m_PurificationStart = DateTime.Now; + m_PurificationStart = DateTime.UtcNow; m_CorruptionStart = DateTime.MinValue; m_Town.Capture( m_Corrupted ); diff --git a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs index 113dec2d8..7a79cfda7 100644 --- a/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs +++ b/Scripts/Engines/Factions/Items/Traps/BaseFactionTrap.cs @@ -191,7 +191,7 @@ namespace Server.Factions Visible = false; m_Faction = f; - m_TimeOfPlacement = DateTime.Now; + m_TimeOfPlacement = DateTime.UtcNow; m_Placer = m; } @@ -206,7 +206,7 @@ namespace Server.Factions if ( decayPeriod == TimeSpan.MaxValue ) return false; - if ( (m_TimeOfPlacement + decayPeriod) < DateTime.Now ) + if ( (m_TimeOfPlacement + decayPeriod) < DateTime.UtcNow ) { Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) ); return true; diff --git a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs index 288793c68..a4980cb38 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/BaseFactionGuard.cs @@ -185,14 +185,14 @@ namespace Server.Factions else if ( Town.FromRegion( this.Region ) == m_Town ) { this.Say( 1042180 ); // Your orders, sire? - m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); } } - else if ( DateTime.Now < m_OrdersEnd ) + else if ( DateTime.UtcNow < m_OrdersEnd ) { if ( m_Town != null && m_Town.IsSheriff( from ) && Town.FromRegion( this.Region ) == m_Town ) { - m_OrdersEnd = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); bool understood = true; ReactionType newType = 0; diff --git a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs index 889cfa1ef..76efea725 100644 --- a/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs +++ b/Scripts/Engines/Factions/Mobiles/Guards/GuardAI.cs @@ -94,7 +94,7 @@ namespace Server.Factions if ( entry.Chance > Utility.Random( 100 ) ) { - releaseTime = DateTime.Now + entry.Hold; + releaseTime = DateTime.UtcNow + entry.Hold; return (Spell) Activator.CreateInstance( entry.Spell, new object[]{ mob, null } ); } } @@ -143,7 +143,7 @@ namespace Server.Factions if ( m_Bandage == null ) return TimeSpan.MaxValue; - TimeSpan ts = ( m_BandageStart + m_Bandage.Timer.Delay ) - DateTime.Now; + TimeSpan ts = ( m_BandageStart + m_Bandage.Timer.Delay ) - DateTime.UtcNow; if ( ts < TimeSpan.FromSeconds( -1.0 ) ) { @@ -206,7 +206,7 @@ namespace Server.Factions return false; m_Bandage = BandageContext.BeginHeal( m_Guard, m_Guard ); - m_BandageStart = DateTime.Now; + m_BandageStart = DateTime.UtcNow; return ( m_Bandage != null ); } @@ -486,9 +486,9 @@ namespace Server.Factions Mobile dispelTarget = FindDispelTarget( true ); if ( m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue ) - m_ReleaseTarget = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); - if ( m_Guard.Target != null && DateTime.Now > m_ReleaseTarget ) + if ( m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget ) { Target targ = m_Guard.Target; @@ -584,7 +584,7 @@ namespace Server.Factions StartBandage(); } - if ( m_Mobile.Spell == null && DateTime.Now >= m_Mobile.NextSpellTime ) + if ( m_Mobile.Spell == null && Core.TickCount - m_Mobile.NextSpellTime >= 0 ) { Spell spell = null; @@ -614,7 +614,7 @@ namespace Server.Factions { if ( m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax ) spell = new GreaterHealSpell( m_Guard, null ); - else if ( (m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - DateTime.Now) > TimeSpan.FromSeconds( 2.0 )) ) + else if ( (m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - Core.TickCount) > 2000) ) spell = new HealSpell( m_Guard, null ); } else if ( m_Guard.CanBeginAction( typeof( BaseHealPotion ) ) ) diff --git a/Scripts/Engines/Harvest/Core/HarvestBank.cs b/Scripts/Engines/Harvest/Core/HarvestBank.cs index 541ce0c0f..09280cf65 100644 --- a/Scripts/Engines/Harvest/Core/HarvestBank.cs +++ b/Scripts/Engines/Harvest/Core/HarvestBank.cs @@ -49,7 +49,7 @@ namespace Server.Engines.Harvest public void CheckRespawn() { - if ( m_Current == m_Maximum || m_NextRespawn > DateTime.Now ) + if ( m_Current == m_Maximum || m_NextRespawn > DateTime.UtcNow ) return; m_Current = m_Maximum; @@ -78,7 +78,7 @@ namespace Server.Engines.Harvest if ( m_Definition.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML minutes *= .75; //25% off the time. - m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( minutes ); + m_NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes( minutes ); } else { diff --git a/Scripts/Engines/Help/HelpGump.cs b/Scripts/Engines/Help/HelpGump.cs index b48395b78..2fba14603 100644 --- a/Scripts/Engines/Help/HelpGump.cs +++ b/Scripts/Engines/Help/HelpGump.cs @@ -86,7 +86,7 @@ namespace Server.Engines.Help { AggressorInfo info = m.Aggressed[i]; - if ( DateTime.Now - info.LastCombatTime < TimeSpan.FromSeconds( 30.0 ) ) + if ( DateTime.UtcNow - info.LastCombatTime < TimeSpan.FromSeconds( 30.0 ) ) return true; } diff --git a/Scripts/Engines/Help/PageQueue.cs b/Scripts/Engines/Help/PageQueue.cs index 253dd4afa..45d36b88f 100644 --- a/Scripts/Engines/Help/PageQueue.cs +++ b/Scripts/Engines/Help/PageQueue.cs @@ -143,7 +143,7 @@ namespace Server.Engines.Help public PageEntry( Mobile sender, string message, PageType type ) { m_Sender = sender; - m_Sent = DateTime.Now; + m_Sent = DateTime.UtcNow; m_Message = Utility.FixHtml( message ); m_Type = type; m_PageLocation = sender.Location; @@ -338,7 +338,7 @@ namespace Server.Engines.Help if ( m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && !IsHandling( m ) ) m.SendMessage( "A new page has been placed in the queue." ); - if ( m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && m.LastMoveTime >= (DateTime.Now - TimeSpan.FromMinutes( 10.0 )) ) + if (m != null && m.AccessLevel >= AccessLevel.Counselor && m.AutoPageNotify && Core.TickCount - m.LastMoveTime < 600000) isStaffOnline = true; } @@ -352,7 +352,7 @@ namespace Server.Engines.Help private static void SendEmail( PageEntry entry ) { Mobile sender = entry.Sender; - DateTime time = DateTime.Now; + DateTime time = DateTime.UtcNow; MailMessage mail = new MailMessage( Email.FromAddress, Email.SpeechLogPageAddresses ); diff --git a/Scripts/Engines/Help/SpeechLog.cs b/Scripts/Engines/Help/SpeechLog.cs index 9f5ed3de8..2075045f5 100644 --- a/Scripts/Engines/Help/SpeechLog.cs +++ b/Scripts/Engines/Help/SpeechLog.cs @@ -97,7 +97,7 @@ namespace Server.Engines.Help { SpeechLogEntry entry = (SpeechLogEntry) m_Queue.Peek(); - if ( DateTime.Now - entry.Created > EntryDuration ) + if ( DateTime.UtcNow - entry.Created > EntryDuration ) m_Queue.Dequeue(); else break; @@ -142,7 +142,7 @@ namespace Server.Engines.Help { m_From = from; m_Speech = speech; - m_Created = DateTime.Now; + m_Created = DateTime.UtcNow; } } } \ No newline at end of file diff --git a/Scripts/Engines/Help/StuckMenu.cs b/Scripts/Engines/Help/StuckMenu.cs index fee2f78ce..32b07a2e3 100644 --- a/Scripts/Engines/Help/StuckMenu.cs +++ b/Scripts/Engines/Help/StuckMenu.cs @@ -219,12 +219,12 @@ namespace Server.Menus.Questions public CloseTimer( Mobile m ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) ) { m_Mobile = m; - m_End = DateTime.Now + TimeSpan.FromMinutes( 3.0 ); + m_End = DateTime.UtcNow + TimeSpan.FromMinutes( 3.0 ); } protected override void OnTick() { - if ( m_Mobile.NetState == null || DateTime.Now > m_End ) + if ( m_Mobile.NetState == null || DateTime.UtcNow > m_End ) { m_Mobile.Frozen = false; m_Mobile.CloseGump( typeof( StuckMenu ) ); @@ -250,12 +250,12 @@ namespace Server.Menus.Questions m_Mobile = mobile; m_Destination = destination; - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; } protected override void OnTick() { - if ( DateTime.Now < m_End ) + if ( DateTime.UtcNow < m_End ) { m_Mobile.Frozen = true; } diff --git a/Scripts/Engines/Khaldun/PuzzleChest.cs b/Scripts/Engines/Khaldun/PuzzleChest.cs index f5f2b8173..613758769 100644 --- a/Scripts/Engines/Khaldun/PuzzleChest.cs +++ b/Scripts/Engines/Khaldun/PuzzleChest.cs @@ -269,7 +269,7 @@ namespace Server.Items } else { - m_Guesses[m] = new PuzzleChestSolutionAndTime( DateTime.Now, solution ); + m_Guesses[m] = new PuzzleChestSolutionAndTime( DateTime.UtcNow, solution ); m.SendGump( new StatusGump( correctCylinders, correctColors ) ); @@ -672,7 +672,7 @@ namespace Server.Items List toDelete = new List(); foreach ( KeyValuePair kvp in m_Guesses ) { - if ( DateTime.Now - kvp.Value.When > CleanupTime ) + if ( DateTime.UtcNow - kvp.Value.When > CleanupTime ) toDelete.Add( kvp.Key ); } diff --git a/Scripts/Engines/Khaldun/RaisableItem.cs b/Scripts/Engines/Khaldun/RaisableItem.cs index bf1196675..3d8541be1 100644 --- a/Scripts/Engines/Khaldun/RaisableItem.cs +++ b/Scripts/Engines/Khaldun/RaisableItem.cs @@ -82,7 +82,7 @@ namespace Server.Items public RaiseTimer( RaisableItem item ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 0.5 ) ) { m_Item = item; - m_CloseTime = DateTime.Now + item.CloseDelay; + m_CloseTime = DateTime.UtcNow + item.CloseDelay; m_Up = true; Priority = TimerPriority.TenMS; @@ -112,7 +112,7 @@ namespace Server.Items m_Up = false; m_Step = 0; - TimeSpan delay = m_CloseTime - DateTime.Now; + TimeSpan delay = m_CloseTime - DateTime.UtcNow; Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( Start ) ); return; diff --git a/Scripts/Engines/MLQuests/MLQuest.cs b/Scripts/Engines/MLQuests/MLQuest.cs index 072c6aa2f..934d37dc7 100644 --- a/Scripts/Engines/MLQuests/MLQuest.cs +++ b/Scripts/Engines/MLQuests/MLQuest.cs @@ -237,7 +237,7 @@ namespace Server.Engines.MLQuests return false; } - else if ( nextAvailable > DateTime.Now ) + else if ( nextAvailable > DateTime.UtcNow ) { if ( message ) MLQuestSystem.Tell( quester, pm, 1075575 ); // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes? diff --git a/Scripts/Engines/MLQuests/MLQuestEntry.cs b/Scripts/Engines/MLQuests/MLQuestEntry.cs index 689a0cf88..e5aa24187 100644 --- a/Scripts/Engines/MLQuests/MLQuestEntry.cs +++ b/Scripts/Engines/MLQuests/MLQuestEntry.cs @@ -41,7 +41,7 @@ namespace Server.Engines.MLQuests m_QuesterType = ( quester == null ) ? null : quester.GetType(); m_Player = player; - m_Accepted = DateTime.Now; + m_Accepted = DateTime.UtcNow; m_Flags = MLQuestInstanceFlags.None; m_ObjectiveInstances = new BaseObjectiveInstance[quest.Objectives.Count]; @@ -217,7 +217,7 @@ namespace Server.Engines.MLQuests { if ( !obj.Expired ) { - if ( obj.IsTimed && obj.EndTime <= DateTime.Now ) + if ( obj.IsTimed && obj.EndTime <= DateTime.UtcNow ) { m_Player.SendLocalizedMessage( 1072258 ); // You failed to complete an objective in time! @@ -337,7 +337,7 @@ namespace Server.Engines.MLQuests ClaimReward = true; if ( m_Quest.HasRestartDelay ) - PlayerContext.SetDoneQuest( m_Quest, DateTime.Now + m_Quest.GetRestartDelay() ); + PlayerContext.SetDoneQuest( m_Quest, DateTime.UtcNow + m_Quest.GetRestartDelay() ); // This is correct for ObjectiveType.Any as well foreach ( BaseObjectiveInstance objective in m_ObjectiveInstances ) diff --git a/Scripts/Engines/MLQuests/Mobiles/SirHelper.cs b/Scripts/Engines/MLQuests/Mobiles/SirHelper.cs index c6dded1d8..eca75d07f 100644 --- a/Scripts/Engines/MLQuests/Mobiles/SirHelper.cs +++ b/Scripts/Engines/MLQuests/Mobiles/SirHelper.cs @@ -89,7 +89,7 @@ namespace Server.Engines.MLQuests.Mobiles { base.OnThink(); - if ( m_NextShout <= DateTime.Now ) + if ( m_NextShout <= DateTime.UtcNow ) { Packet shoutPacket = null; @@ -108,7 +108,7 @@ namespace Server.Engines.MLQuests.Mobiles Packet.Release( shoutPacket ); - m_NextShout = DateTime.Now + m_ShoutDelay; + m_NextShout = DateTime.UtcNow + m_ShoutDelay; } } diff --git a/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs b/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs index bd5daa8d2..567a36a54 100644 --- a/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/BaseObjective.cs @@ -62,13 +62,13 @@ namespace Server.Engines.MLQuests.Objectives m_Instance = instance; if ( obj.IsTimed ) - m_EndTime = DateTime.Now + obj.Duration; + m_EndTime = DateTime.UtcNow + obj.Duration; } public virtual void WriteToGump( Gump g, ref int y ) { if ( IsTimed ) - WriteTimeRemaining( g, ref y, ( m_EndTime > DateTime.Now ) ? ( m_EndTime - DateTime.Now ) : TimeSpan.Zero ); + WriteTimeRemaining( g, ref y, ( m_EndTime > DateTime.UtcNow ) ? ( m_EndTime - DateTime.UtcNow ) : TimeSpan.Zero ); } public static void WriteTimeRemaining( Gump g, ref int y, TimeSpan timeRemaining ) diff --git a/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs b/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs index f0777b007..99fc33e5b 100644 --- a/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/EscortObjective.cs @@ -52,11 +52,11 @@ namespace Server.Engines.MLQuests.Objectives DateTime nextEscort = pm.LastEscortTime + BaseEscortable.EscortDelay; - if ( nextEscort > DateTime.Now ) + if ( nextEscort > DateTime.UtcNow ) { if ( message ) { - int minutes = (int)Math.Ceiling( ( nextEscort - DateTime.Now ).TotalMinutes ); + int minutes = (int)Math.Ceiling( ( nextEscort - DateTime.UtcNow ).TotalMinutes ); if ( minutes == 1 ) MLQuestSystem.Tell( quester, pm, "You must rest 1 minute before we set out on this journey." ); @@ -111,7 +111,7 @@ namespace Server.Engines.MLQuests.Objectives m_Objective = objective; m_HasCompleted = false; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), new TimerCallback( CheckDestination ) ); - m_LastSeenEscorter = DateTime.Now; + m_LastSeenEscorter = DateTime.UtcNow; m_Escort = instance.Quester as BaseCreature; if ( MLQuestSystem.Debug && m_Escort == null && instance.Quester != null ) @@ -158,12 +158,12 @@ 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.Now ) + if ( m_LastSeenEscorter + BaseEscortable.AbandonDelay <= DateTime.UtcNow ) Abandon(); } else { - m_LastSeenEscorter = DateTime.Now; + m_LastSeenEscorter = DateTime.UtcNow; } } @@ -212,7 +212,7 @@ namespace Server.Engines.MLQuests.Objectives MLQuestInstance instance = Instance; PlayerMobile pm = instance.Player; - pm.LastEscortTime = DateTime.Now; + pm.LastEscortTime = DateTime.UtcNow; if ( m_Escort != null ) BeginFollow( m_Escort, pm ); diff --git a/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs b/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs index 44859d2ac..7306bf031 100644 --- a/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs +++ b/Scripts/Engines/MLQuests/Objectives/GainSkillObjective.cs @@ -155,7 +155,7 @@ namespace Server.Engines.MLQuests.Objectives PlayerMobile pm = Instance.Player; pm.AcceleratedSkill = m_Objective.Skill; - pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes( 15 ); // TODO: Is there a max duration? + pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes( 15 ); // TODO: Is there a max duration? } public override void OnQuestCancelled() @@ -165,7 +165,7 @@ namespace Server.Engines.MLQuests.Objectives PlayerMobile pm = Instance.Player; - pm.AcceleratedStart = DateTime.Now; + pm.AcceleratedStart = DateTime.UtcNow; pm.PlaySound( 0x100 ); } diff --git a/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs b/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs index 8437e9382..d45a02e3f 100644 --- a/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs +++ b/Scripts/Engines/MyRunUO/DatabaseCommandQueue.cs @@ -67,7 +67,7 @@ namespace Server.Engines.MyRunUO OdbcCommand command = null; OdbcTransaction transact = null; - DateTime start = DateTime.Now; + DateTime start = DateTime.UtcNow; bool shouldWriteException = true; @@ -118,7 +118,7 @@ namespace Server.Engines.MyRunUO try{ m_Sync.Close(); } catch{} - Console.WriteLine( m_CompletionString, (DateTime.Now - start).TotalSeconds ); + Console.WriteLine( m_CompletionString, (DateTime.UtcNow - start).TotalSeconds ); m_HasCompleted = true; return; diff --git a/Scripts/Engines/MyRunUO/MyRunUO.cs b/Scripts/Engines/MyRunUO/MyRunUO.cs index 3abcc4079..396287b11 100644 --- a/Scripts/Engines/MyRunUO/MyRunUO.cs +++ b/Scripts/Engines/MyRunUO/MyRunUO.cs @@ -125,7 +125,7 @@ namespace Server.Engines.MyRunUO m_List = new ArrayList(); m_Collecting = new List(); - m_StartTime = DateTime.Now; + m_StartTime = DateTime.UtcNow; Console.WriteLine( "MyRunUO: Updating character database" ); } @@ -135,10 +135,10 @@ namespace Server.Engines.MyRunUO try { - shouldExit = Process( DateTime.Now + TimeSpan.FromSeconds( CpuInterval * CpuPercent ) ); + shouldExit = Process( DateTime.UtcNow + TimeSpan.FromSeconds( CpuInterval * CpuPercent ) ); if ( shouldExit ) - Console.WriteLine( "MyRunUO: Database statements compiled in {0:F2} seconds", (DateTime.Now - m_StartTime).TotalSeconds ); + Console.WriteLine( "MyRunUO: Database statements compiled in {0:F2} seconds", (DateTime.UtcNow - m_StartTime).TotalSeconds ); } catch ( Exception e ) { @@ -209,7 +209,7 @@ namespace Server.Engines.MyRunUO ++m_Index; - if ( DateTime.Now >= endTime ) + if ( DateTime.UtcNow >= endTime ) break; } @@ -549,7 +549,7 @@ namespace Server.Engines.MyRunUO ++m_Index; - if ( DateTime.Now >= endTime ) + if ( DateTime.UtcNow >= endTime ) break; } @@ -625,7 +625,7 @@ namespace Server.Engines.MyRunUO ++m_Index; - if ( DateTime.Now >= endTime ) + if ( DateTime.UtcNow >= endTime ) break; } diff --git a/Scripts/Engines/MyRunUO/MyRunUOStatus.cs b/Scripts/Engines/MyRunUO/MyRunUOStatus.cs index 82d1e4f92..8becd85e6 100644 --- a/Scripts/Engines/MyRunUO/MyRunUOStatus.cs +++ b/Scripts/Engines/MyRunUO/MyRunUOStatus.cs @@ -41,7 +41,7 @@ namespace Server.Engines.MyRunUO if ( m_Command != null && !m_Command.HasCompleted ) return; - DateTime start = DateTime.Now; + DateTime start = DateTime.UtcNow; Console.WriteLine( "MyRunUO: Updating status database" ); try diff --git a/Scripts/Engines/Pathing/MovementPath.cs b/Scripts/Engines/Pathing/MovementPath.cs index 22ccdc354..950158559 100644 --- a/Scripts/Engines/Pathing/MovementPath.cs +++ b/Scripts/Engines/Pathing/MovementPath.cs @@ -37,9 +37,9 @@ namespace Server { m_OverrideAlgorithm = alg; - long start = DateTime.Now.Ticks; + long start = DateTime.UtcNow.Ticks; MovementPath path = new MovementPath( from, new Point3D( p ) ); - long end = DateTime.Now.Ticks; + long end = DateTime.UtcNow.Ticks; double len = Math.Round( (end-start) / 10000.0, 2 ); if ( !path.Success ) diff --git a/Scripts/Engines/Pathing/PathFollower.cs b/Scripts/Engines/Pathing/PathFollower.cs index c814bf331..0283e119c 100644 --- a/Scripts/Engines/Pathing/PathFollower.cs +++ b/Scripts/Engines/Pathing/PathFollower.cs @@ -87,7 +87,7 @@ namespace Server if ( m_Path == null ) repath = true; - else if ( (!m_Path.Success || goal != m_LastGoalLoc) && (m_LastPathTime + RepathDelay) <= DateTime.Now ) + else if ( (!m_Path.Success || goal != m_LastGoalLoc) && (m_LastPathTime + RepathDelay) <= DateTime.UtcNow ) repath = true; else if ( m_Path.Success && Check( m_From.Location, m_LastGoalLoc, 0 ) ) repath = true; @@ -95,7 +95,7 @@ namespace Server if ( !repath ) return false; - m_LastPathTime = DateTime.Now; + m_LastPathTime = DateTime.UtcNow; m_LastGoalLoc = goal; m_Path = new MovementPath( m_From, goal ); diff --git a/Scripts/Engines/Plants/PlantSystem.cs b/Scripts/Engines/Plants/PlantSystem.cs index 7c06adcb3..7bd902198 100644 --- a/Scripts/Engines/Plants/PlantSystem.cs +++ b/Scripts/Engines/Plants/PlantSystem.cs @@ -319,7 +319,7 @@ namespace Server.Engines.Plants m_Plant = plant; m_FertileDirt = fertileDirt; - m_NextGrowth = DateTime.Now + CheckDelay; + m_NextGrowth = DateTime.UtcNow + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; m_Hits = MaxHits; m_LeftSeeds = 8; @@ -328,7 +328,7 @@ namespace Server.Engines.Plants public void Reset( bool potions ) { - m_NextGrowth = DateTime.Now + CheckDelay; + m_NextGrowth = DateTime.UtcNow + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; Hits = MaxHits; @@ -418,7 +418,7 @@ namespace Server.Engines.Plants public static void GrowAll() { ArrayList plants = PlantItem.Plants; - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; for ( int i = plants.Count - 1; i >= 0; --i ) { @@ -444,13 +444,13 @@ namespace Server.Engines.Plants if ( !m_Plant.IsGrowable ) return; - if ( DateTime.Now < m_NextGrowth ) + if ( DateTime.UtcNow < m_NextGrowth ) { m_GrowthIndicator = PlantGrowthIndicator.Delay; return; } - m_NextGrowth = DateTime.Now + CheckDelay; + m_NextGrowth = DateTime.UtcNow + CheckDelay; if ( !m_Plant.ValidGrowthLocation ) { diff --git a/Scripts/Engines/Quests/Collector/Objectives.cs b/Scripts/Engines/Quests/Collector/Objectives.cs index 431a42948..98cba9b49 100644 --- a/Scripts/Engines/Quests/Collector/Objectives.cs +++ b/Scripts/Engines/Quests/Collector/Objectives.cs @@ -119,9 +119,9 @@ namespace Server.Engines.Quests.Collector { if ( m_Begin == DateTime.MaxValue ) { - m_Begin = DateTime.Now; + m_Begin = DateTime.UtcNow; } - else if ( DateTime.Now - m_Begin > TimeSpan.FromSeconds( 30.0 ) ) + else if ( DateTime.UtcNow - m_Begin > TimeSpan.FromSeconds( 30.0 ) ) { Complete(); } diff --git a/Scripts/Engines/Quests/Core/QuestRestartInfo.cs b/Scripts/Engines/Quests/Core/QuestRestartInfo.cs index c33cc3555..cd74467bb 100644 --- a/Scripts/Engines/Quests/Core/QuestRestartInfo.cs +++ b/Scripts/Engines/Quests/Core/QuestRestartInfo.cs @@ -22,7 +22,7 @@ namespace Server.Engines.Quests public void Reset( TimeSpan restartDelay ) { if ( restartDelay < TimeSpan.MaxValue ) - m_RestartTime = DateTime.Now + restartDelay; + m_RestartTime = DateTime.UtcNow + restartDelay; else m_RestartTime = DateTime.MaxValue; } diff --git a/Scripts/Engines/Quests/Core/QuestSystem.cs b/Scripts/Engines/Quests/Core/QuestSystem.cs index 7e5ba7d4d..2d11e3516 100644 --- a/Scripts/Engines/Quests/Core/QuestSystem.cs +++ b/Scripts/Engines/Quests/Core/QuestSystem.cs @@ -435,7 +435,7 @@ namespace Server.Engines.Quests { DateTime endTime = restartInfo.RestartTime; - if ( DateTime.Now < endTime ) + if ( DateTime.UtcNow < endTime ) { inRestartPeriod = true; return false; diff --git a/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs b/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs index ca38b955c..9c0704ef8 100644 --- a/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs +++ b/Scripts/Engines/Quests/Study of the Solen Hive/Objectives.cs @@ -57,7 +57,7 @@ namespace Server.Engines.Quests.Naturalist { if ( m_StudyState != StudyState.Inactive ) { - TimeSpan time = DateTime.Now - m_StudyBegin; + TimeSpan time = DateTime.UtcNow - m_StudyBegin; if ( time > TimeSpan.FromSeconds( 30.0 ) ) { @@ -99,7 +99,7 @@ namespace Server.Engines.Quests.Naturalist if ( nest != null ) { m_CurrentNest = nest; - m_StudyBegin = DateTime.Now; + m_StudyBegin = DateTime.UtcNow; if ( m_StudiedNests.Contains( nest ) ) { diff --git a/Scripts/Engines/RemoteAdmin/Network.cs b/Scripts/Engines/RemoteAdmin/Network.cs index 0c8d26de9..9b5b38a52 100644 --- a/Scripts/Engines/RemoteAdmin/Network.cs +++ b/Scripts/Engines/RemoteAdmin/Network.cs @@ -32,7 +32,7 @@ namespace Server.RemoteAdmin string outStr; if ( m_NewLine ) { - outStr = String.Format( "[{0}]: {1}", DateTime.Now.ToString( DateFormat ), str ); + outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), str ); m_NewLine = false; } else @@ -51,7 +51,7 @@ namespace Server.RemoteAdmin if ( m_NewLine ) { string outStr; - outStr = String.Format( "[{0}]: {1}", DateTime.Now.ToString( DateFormat ), ch ); + outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), ch ); m_ConsoleData.Append( outStr ); SendToAll( outStr ); @@ -71,7 +71,7 @@ namespace Server.RemoteAdmin { string outStr; if ( m_NewLine ) - outStr = String.Format( "[{0}]: {1}{2}", DateTime.Now.ToString( DateFormat ), line, Console.Out.NewLine ); + outStr = String.Format( "[{0}]: {1}{2}", DateTime.UtcNow.ToString( DateFormat ), line, Console.Out.NewLine ); else outStr = String.Format( "{0}{1}", line, Console.Out.NewLine ); @@ -127,7 +127,7 @@ namespace Server.RemoteAdmin } else if ( cmd == 0xFF ) { - string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Server.Misc.ServerList.ServerName, (int)(DateTime.Now - Server.Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(System.GC.GetTotalMemory( false ) / 1024), ProtocolVersion ); + string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Server.Misc.ServerList.ServerName, (int)(DateTime.UtcNow - Server.Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(System.GC.GetTotalMemory( false ) / 1024), ProtocolVersion ); state.Send( new UOGInfo( statStr ) ); state.Dispose(); } @@ -189,7 +189,7 @@ namespace Server.RemoteAdmin Console.WriteLine( "ADMIN: Access granted to '{0}' from {1}", user, state ); state.Account = a; a.LogAccess( state ); - a.LastLogin = DateTime.Now; + a.LastLogin = DateTime.UtcNow; state.Send( new Login( LoginResponse.OK ) ); TightTrimConsoleData(); diff --git a/Scripts/Engines/RemoteAdmin/Packets.cs b/Scripts/Engines/RemoteAdmin/Packets.cs index 73348465d..42e0bb415 100644 --- a/Scripts/Engines/RemoteAdmin/Packets.cs +++ b/Scripts/Engines/RemoteAdmin/Packets.cs @@ -83,7 +83,7 @@ namespace Server.RemoteAdmin m_Stream.Write( (int) World.Items.Count ); m_Stream.Write( (int) Core.ScriptItems ); - m_Stream.Write( (uint)(DateTime.Now - Clock.ServerStart).TotalSeconds ); + m_Stream.Write( (uint)(DateTime.UtcNow - Clock.ServerStart).TotalSeconds ); m_Stream.Write( (uint) GC.GetTotalMemory( false ) ); // TODO: uint not sufficient for TotalMemory (long). Fix protocol. m_Stream.WriteAsciiNull( netVer ); m_Stream.WriteAsciiNull( os ); @@ -132,7 +132,7 @@ namespace Server.RemoteAdmin m_Stream.Write( (int)NetState.Instances.Count - 1 ); // Clients m_Stream.Write( (int)World.Items.Count ); // Items m_Stream.Write( (int)World.Mobiles.Count ); // Mobiles - m_Stream.Write( (uint)(DateTime.Now - Clock.ServerStart).TotalSeconds ); // Age (seconds) + m_Stream.Write( (uint)(DateTime.UtcNow - Clock.ServerStart).TotalSeconds ); // Age (seconds) long memory = GC.GetTotalMemory( false ); m_Stream.Write( (uint)(memory >> 32) ); // Memory high bytes diff --git a/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs b/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs index ee32348f4..e8d862cf5 100644 --- a/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs +++ b/Scripts/Engines/RemoteAdmin/RemoteAdminLogging.cs @@ -34,12 +34,12 @@ namespace Server.RemoteAdmin try { - m_Output = new StreamWriter( Path.Combine( directory, String.Format( LogSubDirectory + "{0}.log", DateTime.Now.ToString( "yyyyMMdd" ) ) ), true ); + m_Output = new StreamWriter( Path.Combine( directory, String.Format( LogSubDirectory + "{0}.log", DateTime.UtcNow.ToString( "yyyyMMdd" ) ) ), true ); m_Output.AutoFlush = true; m_Output.WriteLine( "##############################" ); - m_Output.WriteLine( "Log started on {0}", DateTime.Now ); + m_Output.WriteLine( "Log started on {0}", DateTime.UtcNow ); m_Output.WriteLine(); } catch @@ -81,7 +81,7 @@ namespace Server.RemoteAdmin string accesslevel = acct == null ? "NoAccount" : acct.AccessLevel.ToString(); string statestr = state == null ? "NULLSTATE" : state.ToString(); - m_Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.Now, statestr, name, text ); + m_Output.WriteLine( "{0}: {1}: {2}: {3}", DateTime.UtcNow, statestr, name, text ); string path = Core.BaseDirectory; @@ -91,7 +91,7 @@ namespace Server.RemoteAdmin path = Path.Combine( path, String.Format( "{0}.log", name ) ); using ( StreamWriter sw = new StreamWriter( path, true ) ) - sw.WriteLine( "{0}: {1}: {2}", DateTime.Now, statestr, text ); + sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, statestr, text ); } catch { diff --git a/Scripts/Engines/Reports/Objects/Staffing/Info.cs b/Scripts/Engines/Reports/Objects/Staffing/Info.cs index a56cfa1d6..188e983f7 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/Info.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/Info.cs @@ -77,8 +77,8 @@ namespace Server.Engines.Reports { BaseInfo cmp = obj as BaseInfo; - int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.Now - m_SortRange, DateTime.Now ) - - this.GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.Now - m_SortRange, DateTime.Now ); + int v = cmp.GetPageCount( cmp is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow ) + - this.GetPageCount( this is StaffInfo ? PageResolution.Handled : PageResolution.None, DateTime.UtcNow - m_SortRange, DateTime.UtcNow ); if ( v == 0 ) v = String.Compare( this.Display, cmp.Display ); diff --git a/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs b/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs index 4c46ea7e6..b9e9e276e 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/QueueStatus.cs @@ -31,7 +31,7 @@ namespace Server.Engines.Reports public QueueStatus( int count ) { - m_TimeStamp = DateTime.Now; + m_TimeStamp = DateTime.UtcNow; m_Count = count; } diff --git a/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs b/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs index d56d50464..5851f6a88 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/ResponseInfo.cs @@ -35,7 +35,7 @@ namespace Server.Engines.Reports public ResponseInfo( string sentBy, string message ) { - m_TimeStamp = DateTime.Now; + m_TimeStamp = DateTime.UtcNow; m_SentBy = sentBy; m_Message = message; } diff --git a/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs b/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs index c9e48d508..8e548a285 100644 --- a/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs +++ b/Scripts/Engines/Reports/Objects/Staffing/StaffHistory.cs @@ -117,7 +117,7 @@ namespace Server.Engines.Reports public override void DeserializeChildren( PersistanceReader ip ) { - DateTime min = DateTime.Now - TimeSpan.FromDays( 8.0 ); + DateTime min = DateTime.UtcNow - TimeSpan.FromDays( 8.0 ); while ( ip.HasChild ) { @@ -229,7 +229,7 @@ namespace Server.Engines.Reports int[] totals = new int[24]; int[] counts = new int[24]; - DateTime max = DateTime.Now; + DateTime max = DateTime.UtcNow; DateTime min = max - TimeSpan.FromDays( 7.0 ); for ( int i = 0; i < m_QueueStats.Count; ++i ) @@ -289,7 +289,7 @@ namespace Server.Engines.Reports DateTime[] dates = new DateTime[24]; - DateTime max = DateTime.Now; + DateTime max = DateTime.UtcNow; DateTime min = max - TimeSpan.FromDays( 7.0 ); bool sentStamp = ( res == PageResolution.None ); @@ -349,7 +349,7 @@ namespace Server.Engines.Reports private Report ReportTotalPages( StaffInfo[] staff, TimeSpan ts, string title ) { - DateTime max = DateTime.Now; + DateTime max = DateTime.UtcNow; DateTime min = max - ts; Report report = new Report( title + " Staff Report", "400" ); @@ -365,7 +365,7 @@ namespace Server.Engines.Reports private PieChart[] ChartTotalPages( StaffInfo[] staff, TimeSpan ts, string title, string fname ) { - DateTime max = DateTime.Now; + DateTime max = DateTime.UtcNow; DateTime min = max - ts; PieChart staffChart = new PieChart( title + " Staff Chart", fname + "_staff", true ); diff --git a/Scripts/Engines/Reports/Rendering/HtmlRenderer.cs b/Scripts/Engines/Reports/Rendering/HtmlRenderer.cs index 7bec01f52..d604e88b5 100644 --- a/Scripts/Engines/Reports/Rendering/HtmlRenderer.cs +++ b/Scripts/Engines/Reports/Rendering/HtmlRenderer.cs @@ -55,7 +55,7 @@ namespace Server.Engines.Reports public HtmlRenderer( string outputDirectory, StaffHistory history ) : this( outputDirectory ) { - m_TimeStamp = DateTime.Now; + m_TimeStamp = DateTime.UtcNow; m_Objects = new ObjectCollection(); diff --git a/Scripts/Engines/Reports/Reports.cs b/Scripts/Engines/Reports/Reports.cs index 953c03fa3..bbc2276ef 100644 --- a/Scripts/Engines/Reports/Reports.cs +++ b/Scripts/Engines/Reports/Reports.cs @@ -27,7 +27,7 @@ namespace Server.Engines.Reports m_StaffHistory = new StaffHistory(); m_StaffHistory.Load(); - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; DateTime date = now.Date; TimeSpan timeOfDay = now.TimeOfDay; @@ -41,7 +41,7 @@ namespace Server.Engines.Reports public static void CheckRegenerate() { - if ( DateTime.Now < m_GenerateTime ) + if ( DateTime.UtcNow < m_GenerateTime ) return; Generate(); @@ -57,7 +57,7 @@ namespace Server.Engines.Reports { Snapshot ss = new Snapshot(); - ss.TimeStamp = DateTime.Now; + ss.TimeStamp = DateTime.UtcNow; FillSnapshot( ss ); diff --git a/Scripts/Engines/Spawner/ProximitySpawner.cs b/Scripts/Engines/Spawner/ProximitySpawner.cs index c7e421366..fcf2bad07 100644 --- a/Scripts/Engines/Spawner/ProximitySpawner.cs +++ b/Scripts/Engines/Spawner/ProximitySpawner.cs @@ -80,14 +80,14 @@ namespace Server.Mobiles if ( !Running ) return; - End = DateTime.Now + delay; + End = DateTime.UtcNow + delay; } public override void Respawn() { RemoveSpawned(); - End = DateTime.Now; + End = DateTime.UtcNow; } public override void Spawn() @@ -128,7 +128,7 @@ namespace Server.Mobiles if ( !Running ) return; - if ( IsEmpty && End <= DateTime.Now && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) ) + if ( IsEmpty && End <= DateTime.UtcNow && m.InRange( GetWorldLocation(), m_TriggerRange ) && m.Location != oldLocation && ValidTrigger( m ) ) { TextDefinition.SendMessageTo( m, m_SpawnMessage ); diff --git a/Scripts/Engines/Spawner/Spawner.cs b/Scripts/Engines/Spawner/Spawner.cs index 9e47d6834..6e60f2a1f 100644 --- a/Scripts/Engines/Spawner/Spawner.cs +++ b/Scripts/Engines/Spawner/Spawner.cs @@ -220,7 +220,7 @@ namespace Server.Mobiles get { if ( m_Running ) - return m_End - DateTime.Now; + return m_End - DateTime.UtcNow; else return TimeSpan.FromSeconds( 0 ); } @@ -763,7 +763,7 @@ namespace Server.Mobiles if ( !m_Running ) return; - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; if ( m_Timer != null ) m_Timer.Stop(); @@ -998,7 +998,7 @@ namespace Server.Mobiles TimeSpan ts = TimeSpan.Zero; if ( m_Running ) - ts = reader.ReadDeltaTime() - DateTime.Now; + ts = reader.ReadDeltaTime() - DateTime.UtcNow; int size = reader.ReadInt(); @@ -1083,7 +1083,7 @@ namespace Server.Mobiles using ( StreamWriter op = new StreamWriter( "badspawn.log", true ) ) { - op.WriteLine( "# Bad spawns : {0}", DateTime.Now ); + op.WriteLine( "# Bad spawns : {0}", DateTime.UtcNow ); op.WriteLine( "# Format: X Y Z F Name" ); op.WriteLine(); diff --git a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs index 589ff70fe..fbd386d3a 100644 --- a/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs +++ b/Scripts/Engines/VeteranRewards/Character Statue Maker/CharacterStatue.cs @@ -241,7 +241,7 @@ namespace Server.Mobiles public void Sculpt( Mobile by ) { m_SculptedBy = by; - m_SculptedOn = DateTime.Now; + m_SculptedOn = DateTime.UtcNow; InvalidateProperties(); } @@ -502,7 +502,7 @@ namespace Server.Mobiles if ( acct != null && from.AccessLevel == AccessLevel.Player ) { - TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.Now - acct.Created ); + TimeSpan time = TimeSpan.FromDays( RewardSystem.RewardInterval.TotalDays * 6 ) - ( DateTime.UtcNow - acct.Created ); if ( time > TimeSpan.Zero ) { diff --git a/Scripts/Engines/VeteranRewards/RewardSystem.cs b/Scripts/Engines/VeteranRewards/RewardSystem.cs index 4438eb6a0..abfbdb5fc 100644 --- a/Scripts/Engines/VeteranRewards/RewardSystem.cs +++ b/Scripts/Engines/VeteranRewards/RewardSystem.cs @@ -81,7 +81,7 @@ namespace Server.Engines.VeteranRewards return false; } - TimeSpan totalTime = (DateTime.Now - acct.Created); + TimeSpan totalTime = (DateTime.UtcNow - acct.Created); ts = ( list.Age - totalTime ); @@ -103,7 +103,7 @@ namespace Server.Engines.VeteranRewards public static int GetRewardLevel( Account acct ) { - TimeSpan totalTime = (DateTime.Now - acct.Created); + TimeSpan totalTime = (DateTime.UtcNow - acct.Created); int level = (int)(totalTime.TotalDays / RewardInterval.TotalDays); @@ -125,7 +125,7 @@ namespace Server.Engines.VeteranRewards public static bool HasHalfLevel( Account acct ) { - TimeSpan totalTime = (DateTime.Now - acct.Created); + TimeSpan totalTime = (DateTime.UtcNow - acct.Created); Double level = (totalTime.TotalDays / RewardInterval.TotalDays); diff --git a/Scripts/Engines/Virtues/Compassion.cs b/Scripts/Engines/Virtues/Compassion.cs index aadaa4897..f91ae2886 100644 --- a/Scripts/Engines/Virtues/Compassion.cs +++ b/Scripts/Engines/Virtues/Compassion.cs @@ -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 diff --git a/Scripts/Engines/Virtues/Honor.cs b/Scripts/Engines/Virtues/Honor.cs index 24a588a95..8d483e4bb 100644 --- a/Scripts/Engines/Virtues/Honor.cs +++ b/Scripts/Engines/Virtues/Honor.cs @@ -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(); } diff --git a/Scripts/Engines/Virtues/Justice.cs b/Scripts/Engines/Virtues/Justice.cs index d4e4f28ce..cf525f410 100644 --- a/Scripts/Engines/Virtues/Justice.cs +++ b/Scripts/Engines/Virtues/Justice.cs @@ -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 diff --git a/Scripts/Engines/Virtues/Sacrifice.cs b/Scripts/Engines/Virtues/Sacrifice.cs index 621f1344d..2860a86ed 100644 --- a/Scripts/Engines/Virtues/Sacrifice.cs +++ b/Scripts/Engines/Virtues/Sacrifice.cs @@ -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; diff --git a/Scripts/Engines/Virtues/Valor.cs b/Scripts/Engines/Virtues/Valor.cs index d3c0ba2f0..687ee154b 100644 --- a/Scripts/Engines/Virtues/Valor.cs +++ b/Scripts/Engines/Virtues/Valor.cs @@ -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 diff --git a/Scripts/Engines/Virtues/VirtueHelper.cs b/Scripts/Engines/Virtues/VirtueHelper.cs index 6e984b675..95cfb84c7 100644 --- a/Scripts/Engines/Virtues/VirtueHelper.cs +++ b/Scripts/Engines/Virtues/VirtueHelper.cs @@ -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 ) diff --git a/Scripts/Gumps/AdminGump.cs b/Scripts/Gumps/AdminGump.cs index 3fcb13e59..17fc78d95 100644 --- a/Scripts/Gumps/AdminGump.cs +++ b/Scripts/Gumps/AdminGump.cs @@ -251,7 +251,7 @@ namespace Server.Gumps AddLabel( 150, 270, LabelHue, Core.ScriptItems.ToString() ); AddLabel( 20, 290, LabelHue, "Uptime:" ); - AddLabel( 150, 290, LabelHue, FormatTimeSpan( DateTime.Now - Clock.ServerStart ) ); + AddLabel( 150, 290, LabelHue, FormatTimeSpan( DateTime.UtcNow - Clock.ServerStart ) ); AddLabel( 20, 310, LabelHue, "Memory:" ); AddLabel( 150, 310, LabelHue, FormatByteAmount( GC.GetTotalMemory( false ) ) ); @@ -907,7 +907,7 @@ namespace Server.Gumps } else { - TimeSpan remaining = (DateTime.Now - banTime); + TimeSpan remaining = (DateTime.UtcNow - banTime); if ( remaining < TimeSpan.Zero ) remaining = TimeSpan.Zero; diff --git a/Scripts/Gumps/BanDurationGump.cs b/Scripts/Gumps/BanDurationGump.cs index 2d93ee1b8..ba6806129 100644 --- a/Scripts/Gumps/BanDurationGump.cs +++ b/Scripts/Gumps/BanDurationGump.cs @@ -239,7 +239,7 @@ namespace Server.Gumps { Account a = (Account)m_List[i]; - a.SetBanTags( from, DateTime.Now, duration ); + a.SetBanTags( from, DateTime.UtcNow, duration ); if ( comment != null ) a.Comments.Add( new AccountComment( from.RawName, String.Format( "Duration: {0}, Comment: {1}", (( duration == TimeSpan.MaxValue )? "Infinite" : duration.ToString()), comment ) ) ); diff --git a/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs b/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs index 50acc580d..706d03ef2 100644 --- a/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs +++ b/Scripts/Gumps/Guilds/GuildChangeTypeGump.cs @@ -66,7 +66,7 @@ namespace Server.Gumps { m_Mobile.SendLocalizedMessage( 1010405 ); // You cannot change guild types while in a Faction! } - else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.Now ) + else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.UtcNow ) { m_Mobile.SendLocalizedMessage( 1011142 ); // You have already changed your guild type recently. // TODO: Clilocs 1011142-1011145 suggest a timer for pending changes diff --git a/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs b/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs index eb6904304..a75dc70cb 100644 --- a/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs +++ b/Scripts/Gumps/Guilds/New Guild System/OtherGuildInfo.cs @@ -83,8 +83,8 @@ namespace Server.Guilds TimeSpan timeRemaining = TimeSpan.Zero; - if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.Now ) - timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.Now; + if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow ) + timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow; //time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it time = String.Format( "{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining ); @@ -234,7 +234,7 @@ namespace Server.Guilds { //Accept the war guild.PendingWars.Remove( war ); - war.WarBeginning = DateTime.Now; + war.WarBeginning = DateTime.UtcNow; guild.AcceptedWars.Add( war ); if( alliance != null && alliance.IsMember( guild ) ) @@ -250,7 +250,7 @@ namespace Server.Guilds //Technically SHOULD say Your guild is now at war w/out any info, intentional diff. otherGuild.PendingWars.Remove( otherWar ); - otherWar.WarBeginning = DateTime.Now; + otherWar.WarBeginning = DateTime.UtcNow; otherGuild.AcceptedWars.Add( otherWar ); if( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) ) diff --git a/Scripts/Gumps/HouseGumpAOS.cs b/Scripts/Gumps/HouseGumpAOS.cs index 587fc58cf..bb1152a7b 100644 --- a/Scripts/Gumps/HouseGumpAOS.cs +++ b/Scripts/Gumps/HouseGumpAOS.cs @@ -1232,7 +1232,7 @@ namespace Server.Gumps { from.SendLocalizedMessage( 501389 ); // You cannot redeed a house with a guildstone inside. } - else if ( Core.ML && from.AccessLevel < AccessLevel.GameMaster && DateTime.Now <= m_House.BuiltOn.AddHours ( 1 ) ) + else if ( Core.ML && from.AccessLevel < AccessLevel.GameMaster && DateTime.UtcNow <= m_House.BuiltOn.AddHours ( 1 ) ) { from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition. } diff --git a/Scripts/Gumps/ReportMurderer.cs b/Scripts/Gumps/ReportMurderer.cs index 7b433ecb0..15e41c976 100644 --- a/Scripts/Gumps/ReportMurderer.cs +++ b/Scripts/Gumps/ReportMurderer.cs @@ -36,13 +36,13 @@ namespace Server.Gumps } } - if ( ai.Attacker.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Attacker ) ) + if ( ai.Attacker.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Attacker ) ) toGive.Add( ai.Attacker ); } foreach ( AggressorInfo ai in m.Aggressed ) { - if ( ai.Defender.Player && (DateTime.Now - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Defender ) ) + if ( ai.Defender.Player && (DateTime.UtcNow - ai.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( ai.Defender ) ) toGive.Add( ai.Defender ); } diff --git a/Scripts/Gumps/VendorInventoryGump.cs b/Scripts/Gumps/VendorInventoryGump.cs index b683b87c9..44fd1a768 100644 --- a/Scripts/Gumps/VendorInventoryGump.cs +++ b/Scripts/Gumps/VendorInventoryGump.cs @@ -36,7 +36,7 @@ namespace Server.Gumps AddLabel( 45, y, 0x481, String.Format( "{0} ({1})", inventory.ShopName, inventory.VendorName ) ); - TimeSpan expire = inventory.ExpireTime - DateTime.Now; + TimeSpan expire = inventory.ExpireTime - DateTime.UtcNow; int hours = (int) expire.TotalHours; AddLabel( 320, y, 0x481, hours.ToString() ); diff --git a/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs b/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs index a7d9f86c1..c48a3b9f3 100644 --- a/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs +++ b/Scripts/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs @@ -13,9 +13,9 @@ namespace Server.Engines.Events public static void Initialize() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; - if( DateTime.Now >= HolidaySettings.StartHalloween && DateTime.Now <= HolidaySettings.FinishHalloween ) + if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { EventSink.Speech += new SpeechEventHandler( EventSink_Speech ); } @@ -54,7 +54,7 @@ namespace Server.Engines.Events return; } - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; BaseVendor m_Begged = targ as BaseVendor; diff --git a/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs b/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs index 75a714d6f..f9dcb7c70 100644 --- a/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs +++ b/Scripts/Holiday Stuff/Halloween/2009/Engines/PumpkinPatch.cs @@ -22,9 +22,9 @@ namespace Server.Engines.Events public static void Initialize() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; - if( DateTime.Now >= HolidaySettings.StartHalloween && DateTime.Now <= HolidaySettings.FinishHalloween ) + if( DateTime.UtcNow >= HolidaySettings.StartHalloween && DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( .50 ), 0, new TimerCallback( PumpkinPatchSpawnerCallback )); } diff --git a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs index abbe0ee32..fe400d7bc 100644 --- a/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs +++ b/Scripts/Holiday Stuff/Halloween/2012/Engines/PlayerZombies.cs @@ -50,7 +50,7 @@ namespace Server.Engines.Events m_QueueDelaySeconds = 120; m_QueueClearIntervalSeconds = 1800; - DateTime today = DateTime.Now; + DateTime today = DateTime.UtcNow; TimeSpan tick = TimeSpan.FromSeconds( m_QueueDelaySeconds ); TimeSpan clear = TimeSpan.FromSeconds( m_QueueClearIntervalSeconds ); @@ -89,7 +89,7 @@ namespace Server.Engines.Events m_DeathQueue.Clear(); - if( DateTime.Now <= HolidaySettings.FinishHalloween ) + if( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { m_ClearTimer.Stop(); } @@ -99,7 +99,7 @@ namespace Server.Engines.Events { PlayerMobile player = null; - if( DateTime.Now <= HolidaySettings.FinishHalloween ) + if( DateTime.UtcNow <= HolidaySettings.FinishHalloween ) { for( int index = 0; m_DeathQueue.Count > 0 && index < m_DeathQueue.Count; index++ ) { diff --git a/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs b/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs index 6efa59b33..9b68f6db4 100644 --- a/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs +++ b/Scripts/Holiday Stuff/Valentine/2011/Items/StValentinesBears.cs @@ -67,7 +67,7 @@ namespace Server.Items public bool CanSign { - get { return ( !IsSigned || DateTime.Now <= m_EditLimit ); } + get { return ( !IsSigned || DateTime.UtcNow <= m_EditLimit ); } } public StValentinesBear( int itemid, string name ) @@ -210,7 +210,7 @@ namespace Server.Items } if ( !m_Bear.IsSigned ) - m_Bear.EditLimit = DateTime.Now + TimeSpan.FromMinutes( 10 ); + m_Bear.EditLimit = DateTime.UtcNow + TimeSpan.FromMinutes( 10 ); m_Bear.Line1 = Utility.FixHtml( line1 ); m_Bear.Line2 = Utility.FixHtml( line2 ); diff --git a/Scripts/Holiday Stuff/Valentine/2012/Items/CupidsArrow.cs b/Scripts/Holiday Stuff/Valentine/2012/Items/CupidsArrow.cs index b5e5d7ecb..08ec324f6 100644 --- a/Scripts/Holiday Stuff/Valentine/2012/Items/CupidsArrow.cs +++ b/Scripts/Holiday Stuff/Valentine/2012/Items/CupidsArrow.cs @@ -49,7 +49,7 @@ namespace Server.Items public static bool CheckSeason( Mobile from ) { - if ( DateTime.Now.Month == 2 ) + if ( DateTime.UtcNow.Month == 2 ) return true; from.SendLocalizedMessage( 1152318 ); // You may not use this item out of season. diff --git a/Scripts/Items/Addons/ArcheryButteAddon.cs b/Scripts/Items/Addons/ArcheryButteAddon.cs index dbbec34e3..09628f23e 100644 --- a/Scripts/Items/Addons/ArcheryButteAddon.cs +++ b/Scripts/Items/Addons/ArcheryButteAddon.cs @@ -142,7 +142,7 @@ namespace Server.Items return; } - if ( DateTime.Now < (m_LastUse + UseDelay) ) + if ( DateTime.UtcNow < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); @@ -189,7 +189,7 @@ namespace Server.Items return; } - m_LastUse = DateTime.Now; + m_LastUse = DateTime.UtcNow; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); diff --git a/Scripts/Items/Addons/RejuvinationAnkhs.cs b/Scripts/Items/Addons/RejuvinationAnkhs.cs index 6142e6f0b..8e7ebcc72 100644 --- a/Scripts/Items/Addons/RejuvinationAnkhs.cs +++ b/Scripts/Items/Addons/RejuvinationAnkhs.cs @@ -93,12 +93,12 @@ namespace Server.Items if ( m.Player && Utility.InRange( Location, m.Location, 3 ) && !Utility.InRange( Location, oldLocation, 3 ) ) { - if ( DateTime.Now >= m_NextMessage ) + if ( DateTime.UtcNow >= m_NextMessage ) { if ( Components.Count > 0 ) ((AddonComponent)Components[0]).SendLocalizedMessageTo( m, 1010061 ); // An overwhelming sense of peace fills you. - m_NextMessage = DateTime.Now + TimeSpan.FromSeconds( 25.0 ); + m_NextMessage = DateTime.UtcNow + TimeSpan.FromSeconds( 25.0 ); } } } diff --git a/Scripts/Items/Addons/SHTeleporter.cs b/Scripts/Items/Addons/SHTeleporter.cs index af596d317..640e84eff 100644 --- a/Scripts/Items/Addons/SHTeleporter.cs +++ b/Scripts/Items/Addons/SHTeleporter.cs @@ -143,11 +143,11 @@ namespace Server.Items { World.Broadcast( 0x35, true, "Solen hives teleporters are being generated, please wait." ); - DateTime startTime = DateTime.Now; + DateTime startTime = DateTime.UtcNow; int count = new SHTeleporterCreator().CreateSHTeleporters(); - DateTime endTime = DateTime.Now; + DateTime endTime = DateTime.UtcNow; World.Broadcast( 0x35, true, "{0} solen hives teleporters have been created. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds ); } diff --git a/Scripts/Items/Aquarium/Aquarium.cs b/Scripts/Items/Aquarium/Aquarium.cs index 1f69e1762..b27d9c699 100644 --- a/Scripts/Items/Aquarium/Aquarium.cs +++ b/Scripts/Items/Aquarium/Aquarium.cs @@ -396,7 +396,7 @@ namespace Server.Items if ( m_Timer != null ) writer.Write( m_Timer.Next ); else - writer.Write( DateTime.Now + EvaluationInterval ); + writer.Write( DateTime.UtcNow + EvaluationInterval ); // version 0 writer.Write( (int) m_LiveCreatures ); @@ -427,10 +427,10 @@ namespace Server.Items { DateTime next = reader.ReadDateTime(); - if ( next < DateTime.Now ) - next = DateTime.Now; + if ( next < DateTime.UtcNow ) + next = DateTime.UtcNow; - m_Timer = Timer.DelayCall( next - DateTime.Now, EvaluationInterval, new TimerCallback( Evaluate ) ); + m_Timer = Timer.DelayCall( next - DateTime.UtcNow, EvaluationInterval, new TimerCallback( Evaluate ) ); goto case 0; } diff --git a/Scripts/Items/Clothing/OuterTorso.cs b/Scripts/Items/Clothing/OuterTorso.cs index e08b118c3..c6f02100a 100644 --- a/Scripts/Items/Clothing/OuterTorso.cs +++ b/Scripts/Items/Clothing/OuterTorso.cs @@ -134,7 +134,7 @@ namespace Server.Items if ( m_DecayTimer != null ) m_DecayTimer.Stop(); - m_DecayTime = DateTime.Now + delay; + m_DecayTime = DateTime.UtcNow + delay; m_DecayTimer = new InternalTimer( this, delay ); m_DecayTimer.Start(); @@ -214,7 +214,7 @@ namespace Server.Items if( reader.ReadBool() ) { m_DecayTime = reader.ReadDeltaTime(); - BeginDecay( m_DecayTime - DateTime.Now ); + BeginDecay( m_DecayTime - DateTime.UtcNow ); } break; } diff --git a/Scripts/Items/Containers/FillableContainers.cs b/Scripts/Items/Containers/FillableContainers.cs index b13c80167..efc92da99 100644 --- a/Scripts/Items/Containers/FillableContainers.cs +++ b/Scripts/Items/Containers/FillableContainers.cs @@ -118,7 +118,7 @@ namespace Server.Items int mins = Utility.RandomMinMax( this.MinRespawnMinutes, this.MaxRespawnMinutes ); TimeSpan delay = TimeSpan.FromMinutes( mins ); - m_NextRespawnTime = DateTime.Now + delay; + m_NextRespawnTime = DateTime.UtcNow + delay; m_RespawnTimer = Timer.DelayCall( delay, new TimerCallback( Respawn ) ); } } @@ -257,7 +257,7 @@ namespace Server.Items { m_NextRespawnTime = reader.ReadDeltaTime(); - TimeSpan delay = m_NextRespawnTime - DateTime.Now; + TimeSpan delay = m_NextRespawnTime - DateTime.UtcNow; m_RespawnTimer = Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( Respawn ) ); } else diff --git a/Scripts/Items/Containers/MarkContainer.cs b/Scripts/Items/Containers/MarkContainer.cs index e152e0d6b..5214a1c9b 100644 --- a/Scripts/Items/Containers/MarkContainer.cs +++ b/Scripts/Items/Containers/MarkContainer.cs @@ -176,7 +176,7 @@ namespace Server.Items public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay ) { m_Container = container; - m_RelockTime = DateTime.Now + delay; + m_RelockTime = DateTime.UtcNow + delay; Start(); } @@ -257,7 +257,7 @@ namespace Server.Items m_AutoLock = reader.ReadBool(); if ( !Locked && m_AutoLock ) - m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.Now ); + m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.UtcNow ); m_TargetMap = reader.ReadMap(); m_Target = reader.ReadPoint3D(); diff --git a/Scripts/Items/Containers/TreasureMapChest.cs b/Scripts/Items/Containers/TreasureMapChest.cs index 231532a81..6d04f870f 100644 --- a/Scripts/Items/Containers/TreasureMapChest.cs +++ b/Scripts/Items/Containers/TreasureMapChest.cs @@ -57,7 +57,7 @@ namespace Server.Items { m_Owner = owner; m_Level = level; - m_DeleteTime = DateTime.Now + TimeSpan.FromHours( 3.0 ); + m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 ); m_Temporary = temporary; m_Guardians = new List(); @@ -560,7 +560,7 @@ namespace Server.Items { private Item m_Item; - public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.Now ) + public DeleteTimer( Item item, DateTime time ) : base( time - DateTime.UtcNow ) { m_Item = item; Priority = TimerPriority.OneMinute; diff --git a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs index 9a9bfc929..6bc876657 100644 --- a/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs +++ b/Scripts/Items/Decoration Artifacts/StealableArtifactsSpawner.cs @@ -265,7 +265,7 @@ namespace Server.Items if ( m_Item != null && value == null ) { int delay = Utility.RandomMinMax( this.Entry.MinDelay, this.Entry.MaxDelay ); - this.NextRespawn = DateTime.Now + TimeSpan.FromMinutes( delay ); + this.NextRespawn = DateTime.UtcNow + TimeSpan.FromMinutes( delay ); } if ( Instance != null ) @@ -287,7 +287,7 @@ namespace Server.Items set{ m_NextRespawn = value; } } - public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.Now ) + public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.UtcNow ) { } @@ -303,7 +303,7 @@ namespace Server.Items if ( this.Item != null && ( this.Item.Deleted || this.Item.Movable || this.Item.Parent != null ) ) this.Item = null; - if ( this.Item == null && DateTime.Now >= this.NextRespawn ) + if ( this.Item == null && DateTime.UtcNow >= this.NextRespawn ) { this.Item = this.Entry.CreateInstance(); } diff --git a/Scripts/Items/Deeds/HolidayTreeDeed.cs b/Scripts/Items/Deeds/HolidayTreeDeed.cs index 6104a75a4..ccb866411 100644 --- a/Scripts/Items/Deeds/HolidayTreeDeed.cs +++ b/Scripts/Items/Deeds/HolidayTreeDeed.cs @@ -51,7 +51,7 @@ namespace Server.Items return false; } - if ( DateTime.Now.Month != 12 ) + if ( DateTime.UtcNow.Month != 12 ) { from.SendLocalizedMessage( 1005700 ); // You will have to wait till next December to put your tree back up for display. return false; diff --git a/Scripts/Items/Games/Mahjong/MahjongGame.cs b/Scripts/Items/Games/Mahjong/MahjongGame.cs index c9d76c016..e057cd11d 100644 --- a/Scripts/Items/Games/Mahjong/MahjongGame.cs +++ b/Scripts/Items/Games/Mahjong/MahjongGame.cs @@ -89,7 +89,7 @@ namespace Server.Engines.Mahjong m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) ); m_Dices = new MahjongDices( this ); m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore ); - m_LastReset = DateTime.Now; + m_LastReset = DateTime.UtcNow; m_Level = SecureLevel.CoOwners; } @@ -189,10 +189,10 @@ namespace Server.Engines.Mahjong public void ResetGame( Mobile from ) { - if ( DateTime.Now - m_LastReset < TimeSpan.FromSeconds( 5.0 ) ) + if ( DateTime.UtcNow - m_LastReset < TimeSpan.FromSeconds( 5.0 ) ) return; - m_LastReset = DateTime.Now; + m_LastReset = DateTime.UtcNow; if ( from != null ) m_Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game. @@ -207,10 +207,10 @@ namespace Server.Engines.Mahjong public void ResetWalls( Mobile from ) { - if ( DateTime.Now - m_LastReset < TimeSpan.FromSeconds( 5.0 ) ) + if ( DateTime.UtcNow - m_LastReset < TimeSpan.FromSeconds( 5.0 ) ) return; - m_LastReset = DateTime.Now; + m_LastReset = DateTime.UtcNow; BuildWalls(); @@ -292,7 +292,7 @@ namespace Server.Engines.Mahjong m_ShowScores = reader.ReadBool(); m_SpectatorVision = reader.ReadBool(); - m_LastReset = DateTime.Now; + m_LastReset = DateTime.UtcNow; break; } diff --git a/Scripts/Items/Lights/BaseLight.cs b/Scripts/Items/Lights/BaseLight.cs index 342a57675..add02d156 100644 --- a/Scripts/Items/Lights/BaseLight.cs +++ b/Scripts/Items/Lights/BaseLight.cs @@ -58,7 +58,7 @@ namespace Server.Items { if ( m_Duration != TimeSpan.Zero && m_Burning ) { - return m_End - DateTime.Now; + return m_End - DateTime.UtcNow; } else return m_Duration; @@ -124,7 +124,7 @@ namespace Server.Items if ( m_BurntOut ) m_Duration = TimeSpan.Zero; else if ( m_Duration != TimeSpan.Zero ) - m_Duration = m_End - DateTime.Now; + m_Duration = m_End - DateTime.UtcNow; if ( m_Timer != null ) m_Timer.Stop(); @@ -148,7 +148,7 @@ namespace Server.Items if ( delay == TimeSpan.Zero ) return; - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; m_Timer = new InternalTimer( this, delay ); m_Timer.Start(); @@ -206,7 +206,7 @@ namespace Server.Items m_Protected = reader.ReadBool(); if ( m_Burning && m_Duration != TimeSpan.Zero ) - DoTimer( reader.ReadDeltaTime() - DateTime.Now ); + DoTimer( reader.ReadDeltaTime() - DateTime.UtcNow ); break; } diff --git a/Scripts/Items/Maps/TreasureMap.cs b/Scripts/Items/Maps/TreasureMap.cs index 8a2f5c7d8..b074248dc 100644 --- a/Scripts/Items/Maps/TreasureMap.cs +++ b/Scripts/Items/Maps/TreasureMap.cs @@ -444,10 +444,10 @@ namespace Server.Items private int m_Count; - private DateTime m_NextSkillTime; - private DateTime m_NextSpellTime; - private DateTime m_NextActionTime; - private DateTime m_LastMoveTime; + private int m_NextSkillTime; + private int m_NextSpellTime; + private int m_NextActionTime; + private int m_LastMoveTime; public DigTimer( Mobile from, TreasureMap treasureMap, Point3D location, Map map ) : base( TimeSpan.Zero, TimeSpan.FromSeconds( 1.0 ) ) { diff --git a/Scripts/Items/Misc/AcidSlime.cs b/Scripts/Items/Misc/AcidSlime.cs index 0fd456c81..35003f9ff 100644 --- a/Scripts/Items/Misc/AcidSlime.cs +++ b/Scripts/Items/Misc/AcidSlime.cs @@ -31,7 +31,7 @@ namespace Server.Items Movable = false; m_MinDamage = minDamage; m_MaxDamage = maxDamage; - m_Created = DateTime.Now; + m_Created = DateTime.UtcNow; m_Duration = duration; m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) ); } @@ -44,7 +44,7 @@ namespace Server.Items private void OnTick() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; TimeSpan age = now - m_Created; if( age > m_Duration ) { diff --git a/Scripts/Items/Misc/BulletinBoards.cs b/Scripts/Items/Misc/BulletinBoards.cs index be4cf55ea..ec92e2681 100644 --- a/Scripts/Items/Misc/BulletinBoards.cs +++ b/Scripts/Items/Misc/BulletinBoards.cs @@ -62,7 +62,7 @@ namespace Server.Items public static bool CheckTime( DateTime time, TimeSpan range ) { - return (time + range) < DateTime.Now; + return (time + range) < DateTime.UtcNow; } public static string FormatTS( TimeSpan ts ) @@ -183,7 +183,7 @@ namespace Server.Items public void PostMessage( Mobile from, BulletinMessage thread, string subject, string[] lines ) { if ( thread != null ) - thread.LastPostTime = DateTime.Now; + thread.LastPostTime = DateTime.UtcNow; AddItem( new BulletinMessage( from, thread, subject, lines ) ); } @@ -363,7 +363,7 @@ namespace Server.Items m_Poster = poster; m_Subject = subject; - m_Time = DateTime.Now; + m_Time = DateTime.UtcNow; m_LastPostTime = m_Time; m_Thread = thread; m_PostedName = m_Poster.Name; diff --git a/Scripts/Items/Misc/Corpses/Corpse.cs b/Scripts/Items/Misc/Corpses/Corpse.cs index 8d813b692..0aaa5fb06 100644 --- a/Scripts/Items/Misc/Corpses/Corpse.cs +++ b/Scripts/Items/Misc/Corpses/Corpse.cs @@ -104,7 +104,7 @@ namespace Server.Items if ( !Core.SE ) return false; - return ( DateTime.Now < (m_TimeOfDeath + InstancedCorpseTime) ); + return ( DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime) ); } } @@ -403,7 +403,7 @@ namespace Server.Items if ( m_DecayTimer != null ) m_DecayTimer.Stop(); - m_DecayTime = DateTime.Now + delay; + m_DecayTime = DateTime.UtcNow + delay; m_DecayTimer = new InternalTimer( this, delay ); m_DecayTimer.Start(); @@ -551,7 +551,7 @@ namespace Server.Items m_CorpseName = GetCorpseName( owner ); - m_TimeOfDeath = DateTime.Now; + m_TimeOfDeath = DateTime.UtcNow; m_AccessLevel = owner.AccessLevel; m_Guild = owner.Guild as Guild; @@ -578,10 +578,10 @@ namespace Server.Items { AggressorInfo info = owner.Aggressors[i]; - if ( (DateTime.Now - info.LastCombatTime) < lastTime ) + if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime ) { m_Killer = info.Attacker; - lastTime = (DateTime.Now - info.LastCombatTime); + lastTime = (DateTime.UtcNow - info.LastCombatTime); } if ( !isBaseCreature && !info.CriminalAggression ) @@ -592,10 +592,10 @@ namespace Server.Items { AggressorInfo info = owner.Aggressed[i]; - if ( (DateTime.Now - info.LastCombatTime) < lastTime ) + if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime ) { m_Killer = info.Defender; - lastTime = (DateTime.Now - info.LastCombatTime); + lastTime = (DateTime.UtcNow - info.LastCombatTime); } if ( !isBaseCreature ) @@ -739,7 +739,7 @@ namespace Server.Items } if( reader.ReadBool() ) - BeginDecay( reader.ReadDeltaTime() - DateTime.Now ); + BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow ); m_Looters = reader.ReadStrongMobileList(); m_Killer = reader.ReadMobile(); @@ -787,7 +787,7 @@ namespace Server.Items case 7: { if ( reader.ReadBool() ) - BeginDecay( reader.ReadDeltaTime() - DateTime.Now ); + BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow ); goto case 6; } @@ -831,7 +831,7 @@ namespace Server.Items case 0: { if ( version < 10 ) - m_TimeOfDeath = DateTime.Now; + m_TimeOfDeath = DateTime.UtcNow; if ( version < 7 ) BeginDecay( m_DefaultDecayTime ); diff --git a/Scripts/Items/Misc/Corpses/DecayedCorpse.cs b/Scripts/Items/Misc/Corpses/DecayedCorpse.cs index 7d3ea52ea..6d99b0e92 100644 --- a/Scripts/Items/Misc/Corpses/DecayedCorpse.cs +++ b/Scripts/Items/Misc/Corpses/DecayedCorpse.cs @@ -23,7 +23,7 @@ namespace Server.Items if ( m_DecayTimer != null ) m_DecayTimer.Stop(); - m_DecayTime = DateTime.Now + delay; + m_DecayTime = DateTime.UtcNow + delay; m_DecayTimer = new InternalTimer( this, delay ); m_DecayTimer.Start(); @@ -105,7 +105,7 @@ namespace Server.Items case 1: { if ( reader.ReadBool() ) - BeginDecay( reader.ReadDeltaTime() - DateTime.Now ); + BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow ); break; } diff --git a/Scripts/Items/Misc/DeceitBrazier.cs b/Scripts/Items/Misc/DeceitBrazier.cs index 698c2e918..678fc9611 100644 --- a/Scripts/Items/Misc/DeceitBrazier.cs +++ b/Scripts/Items/Misc/DeceitBrazier.cs @@ -91,7 +91,7 @@ namespace Server.Items { Movable = false; Light = LightType.Circle225; - m_NextSpawn = DateTime.Now; + m_NextSpawn = DateTime.UtcNow; m_NextSpawnDelay = TimeSpan.FromMinutes( 15.0 ); m_SpawnRange = 5; } @@ -122,7 +122,7 @@ namespace Server.Items m_NextSpawnDelay = reader.ReadTimeSpan(); } - m_NextSpawn = DateTime.Now; + m_NextSpawn = DateTime.UtcNow; } public virtual void HeedWarning() @@ -134,7 +134,7 @@ namespace Server.Items public override void OnMovement( Mobile m, Point3D oldLocation ) { - if( m_NextSpawn < DateTime.Now ) // means we haven't spawned anything if the next spawn is below + if( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below { if( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) ) { @@ -181,7 +181,7 @@ namespace Server.Items { try { - if( m_NextSpawn < DateTime.Now ) + if( m_NextSpawn < DateTime.UtcNow ) { Map map = this.Map; BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] ); @@ -205,7 +205,7 @@ namespace Server.Items bc.ForceReacquire(); } ); - m_NextSpawn = DateTime.Now + m_NextSpawnDelay; + m_NextSpawn = DateTime.UtcNow + m_NextSpawnDelay; } } else diff --git a/Scripts/Items/Misc/Firebomb.cs b/Scripts/Items/Misc/Firebomb.cs index 326b631a3..d3660c97d 100644 --- a/Scripts/Items/Misc/Firebomb.cs +++ b/Scripts/Items/Misc/Firebomb.cs @@ -236,7 +236,7 @@ namespace Server.Items { Movable = false; m_LitBy = litBy; - m_Expire = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_Expire = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); m_Burning = toDamage; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), new TimerCallback( OnFirebombFieldTimerTick ) ); } @@ -302,7 +302,7 @@ namespace Server.Items m_Burning.RemoveAt( i ); } - if ( DateTime.Now >= m_Expire ) + if ( DateTime.UtcNow >= m_Expire ) { m_Timer.Stop(); Delete(); diff --git a/Scripts/Items/Misc/Guillotine.cs b/Scripts/Items/Misc/Guillotine.cs index 5804e31a3..c07483a0e 100644 --- a/Scripts/Items/Misc/Guillotine.cs +++ b/Scripts/Items/Misc/Guillotine.cs @@ -23,7 +23,7 @@ namespace Server.Items { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that } - else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse ) + else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.UtcNow >= m_NextUse ) { Point3D p = this.GetWorldLocation(); @@ -41,7 +41,7 @@ namespace Server.Items Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) ); - m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); } } diff --git a/Scripts/Items/Misc/PlayerBulletinBoards.cs b/Scripts/Items/Misc/PlayerBulletinBoards.cs index abbd4f815..e65909622 100644 --- a/Scripts/Items/Misc/PlayerBulletinBoards.cs +++ b/Scripts/Items/Misc/PlayerBulletinBoards.cs @@ -251,7 +251,7 @@ namespace Server.Items if ( text.Length > 0 ) { - PlayerBBMessage message = new PlayerBBMessage( DateTime.Now, from, text ); + PlayerBBMessage message = new PlayerBBMessage( DateTime.UtcNow, from, text ); if ( m_Greeting ) { diff --git a/Scripts/Items/Misc/PoolOfAcid.cs b/Scripts/Items/Misc/PoolOfAcid.cs index 2bd3f8dab..8bc196b8d 100644 --- a/Scripts/Items/Misc/PoolOfAcid.cs +++ b/Scripts/Items/Misc/PoolOfAcid.cs @@ -32,7 +32,7 @@ namespace Server.Items m_MinDamage = minDamage; m_MaxDamage = maxDamage; - m_Created = DateTime.Now; + m_Created = DateTime.UtcNow; m_Duration = duration; m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), new TimerCallback( OnTick ) ); @@ -46,7 +46,7 @@ namespace Server.Items private void OnTick() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; TimeSpan age = now - m_Created; if( age > m_Duration ) { diff --git a/Scripts/Items/Misc/PowerGenerator.cs b/Scripts/Items/Misc/PowerGenerator.cs index 2543eab92..2b3a116ae 100644 --- a/Scripts/Items/Misc/PowerGenerator.cs +++ b/Scripts/Items/Misc/PowerGenerator.cs @@ -211,7 +211,7 @@ namespace Server.Items return; if ( m_User.Deleted || m_User.Map != Map || !m_User.InRange( this, 3 ) - || m_User.NetState == null || DateTime.Now - m_LastUse >= m_UseTimeout ) + || m_User.NetState == null || DateTime.UtcNow - m_LastUse >= m_UseTimeout ) { m_User.CloseGump( typeof( GameGump ) ); } @@ -223,7 +223,7 @@ namespace Server.Items } m_User = from; - m_LastUse = DateTime.Now; + m_LastUse = DateTime.UtcNow; from.SendGump( new GameGump( this, from, 0, false ) ); } @@ -375,7 +375,7 @@ namespace Server.Items if ( 40.0 + Utility.RandomDouble() * 80.0 < lockpicking ) { m_From.SendGump( new GameGump( m_Panel, m_From, m_Step, true ) ); - m_Panel.m_LastUse = DateTime.Now; + m_Panel.m_LastUse = DateTime.UtcNow; } else { @@ -422,7 +422,7 @@ namespace Server.Items { m_From.PlaySound( 0x1F4 ); m_From.SendGump( new GameGump( m_Panel, m_From, m_Step + 1, false ) ); - m_Panel.m_LastUse = DateTime.Now; + m_Panel.m_LastUse = DateTime.UtcNow; } } else diff --git a/Scripts/Items/Misc/Teleporter.cs b/Scripts/Items/Misc/Teleporter.cs index 241cbe035..6edc1b761 100644 --- a/Scripts/Items/Misc/Teleporter.cs +++ b/Scripts/Items/Misc/Teleporter.cs @@ -650,7 +650,7 @@ namespace Server.Items m.SendLocalizedMessage(m_ProgressNumber); if (m_ShowTimeRemaining) - m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.Now)); + m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow)); Timer.DelayCall(TimeSpan.FromSeconds(5), EndLock, m); } @@ -842,7 +842,7 @@ namespace Server.Items Mobile m = reader.ReadMobile(); DateTime end = reader.ReadDateTime(); - StartTimer(m, end - DateTime.Now); + StartTimer(m, end - DateTime.UtcNow); } } } diff --git a/Scripts/Items/Misc/WarningItem.cs b/Scripts/Items/Misc/WarningItem.cs index 35ac29311..78227fd5c 100644 --- a/Scripts/Items/Misc/WarningItem.cs +++ b/Scripts/Items/Misc/WarningItem.cs @@ -96,10 +96,10 @@ namespace Server.Items public virtual void Broadcast( Mobile triggerer ) { - if ( m_Broadcasting || (DateTime.Now < (m_LastBroadcast + m_ResetDelay)) ) + if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + m_ResetDelay)) ) return; - m_LastBroadcast = DateTime.Now; + m_LastBroadcast = DateTime.UtcNow; m_Broadcasting = true; diff --git a/Scripts/Items/Skill Items/Camping/Campfire.cs b/Scripts/Items/Skill Items/Camping/Campfire.cs index 241a8081b..2d165a1b9 100644 --- a/Scripts/Items/Skill Items/Camping/Campfire.cs +++ b/Scripts/Items/Skill Items/Camping/Campfire.cs @@ -43,7 +43,7 @@ namespace Server.Items m_Entries = new ArrayList(); - m_Created = DateTime.Now; + m_Created = DateTime.UtcNow; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), new TimerCallback( OnTick ) ); } @@ -102,7 +102,7 @@ namespace Server.Items private void OnTick() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; TimeSpan age = now - this.Created; if ( age >= TimeSpan.FromSeconds( 100.0 ) ) @@ -210,7 +210,7 @@ namespace Server.Items { m_Player = player; m_Fire = fire; - m_Start = DateTime.Now; + m_Start = DateTime.UtcNow; m_Safe = false; } } diff --git a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs index 8b7a511f7..fa7dda2df 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Conflagration Potions/BaseConflagrationPotion.cs @@ -124,8 +124,8 @@ namespace Server.Items { Timer timer = m_Delay[ m ] as Timer; - if ( timer != null && timer.Next > DateTime.Now ) - return (int) (timer.Next - DateTime.Now).TotalSeconds; + if ( timer != null && timer.Next > DateTime.UtcNow ) + return (int) (timer.Next - DateTime.UtcNow).TotalSeconds; return 0; } @@ -211,7 +211,7 @@ namespace Server.Items MoveToWorld( loc, map ); m_From = from; - m_End = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); SetDamage( min, max ); @@ -310,7 +310,7 @@ namespace Server.Items if ( m_Item.Deleted ) return; - if ( DateTime.Now > m_End ) + if ( DateTime.UtcNow > m_End ) { m_Item.Delete(); Stop(); diff --git a/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs index 06d084e63..367375f9f 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs @@ -109,7 +109,7 @@ namespace Server.Items if ( mon.Controlled || mon.Summoned ) continue; - mon.Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 5.0 ) ); // TODO check + mon.Pacify( from, DateTime.UtcNow + TimeSpan.FromSeconds( 5.0 ) ); // TODO check } } } @@ -146,8 +146,8 @@ namespace Server.Items { Timer timer = m_Delay[ m ] as Timer; - if ( timer != null && timer.Next > DateTime.Now ) - return (int) (timer.Next - DateTime.Now).TotalSeconds; + if ( timer != null && timer.Next > DateTime.UtcNow ) + return (int) (timer.Next - DateTime.UtcNow).TotalSeconds; return 0; } diff --git a/Scripts/Items/Skill Items/Magical/Runebook.cs b/Scripts/Items/Skill Items/Magical/Runebook.cs index 4f5fb4a0d..bf8b8b73f 100644 --- a/Scripts/Items/Skill Items/Magical/Runebook.cs +++ b/Scripts/Items/Skill Items/Magical/Runebook.cs @@ -337,7 +337,7 @@ namespace Server.Items return; } - if ( DateTime.Now < m_NextUse ) + if ( DateTime.UtcNow < m_NextUse ) { from.SendLocalizedMessage( 502406 ); // This book needs time to recharge. return; @@ -353,7 +353,7 @@ namespace Server.Items public virtual void OnTravel() { if ( !Core.SA ) - m_NextUse = DateTime.Now + UseDelay; + m_NextUse = DateTime.UtcNow + UseDelay; } public override void OnAfterDuped( Item newItem ) diff --git a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 1f642f850..379ad407a 100644 --- a/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Scripts/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -96,7 +96,7 @@ namespace Server.Items set { if( value != m_ReplenishesCharges && value ) - m_LastReplenished = DateTime.Now; + m_LastReplenished = DateTime.UtcNow; m_ReplenishesCharges = value; } @@ -112,12 +112,12 @@ namespace Server.Items if( !m_ReplenishesCharges || m_UsesRemaining >= InitMaxUses ) return; - if( m_LastReplenished + ChargeReplenishRate < DateTime.Now ) + if( m_LastReplenished + ChargeReplenishRate < DateTime.UtcNow ) { - TimeSpan timeDifference = DateTime.Now - m_LastReplenished; + TimeSpan timeDifference = DateTime.UtcNow - m_LastReplenished; m_UsesRemaining = Math.Min( m_UsesRemaining + (int)( timeDifference.Ticks / ChargeReplenishRate.Ticks), InitMaxUses ); //How rude of TimeSpan to not allow timespan division. - m_LastReplenished = DateTime.Now; + m_LastReplenished = DateTime.UtcNow; if( invalidate ) InvalidateProperties(); diff --git a/Scripts/Items/Skill Items/Ninjitsu/EggBomb.cs b/Scripts/Items/Skill Items/Ninjitsu/EggBomb.cs index b666e8512..99d14cda2 100644 --- a/Scripts/Items/Skill Items/Ninjitsu/EggBomb.cs +++ b/Scripts/Items/Skill Items/Ninjitsu/EggBomb.cs @@ -34,7 +34,7 @@ namespace Server.Items // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. from.SendLocalizedMessage( 1063013, "50\tNinjitsu" ); } - else if ( from.NextSkillTime > DateTime.Now ) + else if (Core.TickCount - from.NextSkillTime < 0) { // You must wait a few seconds before you can use that item. from.SendLocalizedMessage( 1070772 ); diff --git a/Scripts/Items/Skill Items/Ninjitsu/SmokeBomb.cs b/Scripts/Items/Skill Items/Ninjitsu/SmokeBomb.cs index ca44a25fa..a886459b8 100644 --- a/Scripts/Items/Skill Items/Ninjitsu/SmokeBomb.cs +++ b/Scripts/Items/Skill Items/Ninjitsu/SmokeBomb.cs @@ -28,7 +28,7 @@ namespace Server.Items // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. from.SendLocalizedMessage( 1063013, "50\tNinjitsu" ); } - else if ( from.NextSkillTime > DateTime.Now ) + else if (Core.TickCount - from.NextSkillTime < 0) { // You must wait a few seconds before you can use that item. from.SendLocalizedMessage( 1070772 ); diff --git a/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs b/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs index de8e82da1..53634a2d5 100644 --- a/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs +++ b/Scripts/Items/Skill Items/Tailor Items/Misc/Scissors.cs @@ -67,7 +67,7 @@ namespace Server.Items { from.SendLocalizedMessage( 1062845 + Utility.Random( 3 ) ); //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!" } - else if( Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && ( DateTime.Now - from.LastMoveTime ) < from.ComputeMovementSpeed( from.Direction ) ) + else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 && (Core.TickCount - from.LastMoveTime) < from.ComputeMovementSpeed(from.Direction)) { from.SendLocalizedMessage( 1063305 ); // Didn't your parents ever tell you not to run with scissors in your hand?! } diff --git a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs index 914356e93..fc6effd56 100644 --- a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs +++ b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs @@ -330,7 +330,7 @@ namespace Server.Items if ( t != null ) { - t.Delay = t.Next - DateTime.Now; + t.Delay = t.Next - DateTime.UtcNow; t.Stop(); } @@ -356,7 +356,7 @@ namespace Server.Items if ( t != null ) { - return t.Next - DateTime.Now; + return t.Next - DateTime.UtcNow; } return TimeSpan.Zero; diff --git a/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs b/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs index b5860a738..d3d5515cc 100644 --- a/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs +++ b/Scripts/Items/Skill Items/Thief/DisguisePersistance.cs @@ -47,7 +47,7 @@ namespace Server.Items Mobile m = (Mobile)entry.Key; writer.Write( m ); - writer.Write( ((Timer)entry.Value).Next - DateTime.Now ); + writer.Write( ((Timer)entry.Value).Next - DateTime.UtcNow ); writer.Write( m.NameMod ); } } diff --git a/Scripts/Items/Skill Items/Tinkering/Clocks.cs b/Scripts/Items/Skill Items/Tinkering/Clocks.cs index 143225141..2c54ff278 100644 --- a/Scripts/Items/Skill Items/Tinkering/Clocks.cs +++ b/Scripts/Items/Skill Items/Tinkering/Clocks.cs @@ -27,7 +27,7 @@ namespace Server.Items public static void Initialize() { - m_ServerStart = DateTime.Now; + m_ServerStart = DateTime.UtcNow; } [Constructable] @@ -71,7 +71,7 @@ namespace Server.Items public static void GetTime( Map map, int x, int y, out int hours, out int minutes, out int totalMinutes ) { - TimeSpan timeSpan = DateTime.Now - WorldStart; + TimeSpan timeSpan = DateTime.UtcNow - WorldStart; totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute); diff --git a/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs b/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs index f457b0027..aea0e17ce 100644 --- a/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs +++ b/Scripts/Items/Special/8th Anniversary Items/FountainOfLife.cs @@ -178,10 +178,10 @@ namespace Server.Items DateTime next = reader.ReadDateTime(); - if( next < DateTime.Now ) + if( next < DateTime.UtcNow ) m_Timer = Timer.DelayCall( TimeSpan.Zero, RechargeTime, new TimerCallback( Recharge ) ); else - m_Timer = Timer.DelayCall( next - DateTime.Now, RechargeTime, new TimerCallback( Recharge ) ); + m_Timer = Timer.DelayCall( next - DateTime.UtcNow, RechargeTime, new TimerCallback( Recharge ) ); } public void Recharge() diff --git a/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs b/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs index 58afa6859..573cf657f 100644 --- a/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs +++ b/Scripts/Items/Special/Gifts/RoseOfTrinsic.cs @@ -86,7 +86,7 @@ namespace Server.Items m_SpawnTimer = new SpawnTimer( this, delay ); m_SpawnTimer.Start(); - m_NextSpawnTime = DateTime.Now + delay; + m_NextSpawnTime = DateTime.UtcNow + delay; } private void StopSpawnTimer() @@ -158,7 +158,7 @@ namespace Server.Items m_Level = (SecureLevel) reader.ReadEncodedInt(); if ( m_Petals < 10 ) - StartSpawnTimer( m_NextSpawnTime - DateTime.Now ); + StartSpawnTimer( m_NextSpawnTime - DateTime.UtcNow ); } } diff --git a/Scripts/Items/Special/Heritage Items/IronMaiden.cs b/Scripts/Items/Special/Heritage Items/IronMaiden.cs index 7623e8c94..05a1ae982 100644 --- a/Scripts/Items/Special/Heritage Items/IronMaiden.cs +++ b/Scripts/Items/Special/Heritage Items/IronMaiden.cs @@ -20,7 +20,7 @@ namespace Server.Items public override void OnComponentUsed( AddonComponent c, Mobile from ) { - if ( from.InRange( Location, 2 ) ) + if ( from.InRange( this.GetWorldLocation(), 2 ) && from.InLOS( this.GetWorldLocation() ) ) { if ( Utility.RandomBool() ) { diff --git a/Scripts/Items/Special/House Raffle/HouseRaffleDeed.cs b/Scripts/Items/Special/House Raffle/HouseRaffleDeed.cs index f5421c479..01a3e9c6b 100644 --- a/Scripts/Items/Special/House Raffle/HouseRaffleDeed.cs +++ b/Scripts/Items/Special/House Raffle/HouseRaffleDeed.cs @@ -207,7 +207,7 @@ namespace Server.Items } else { - int daysLeft = (int)Math.Ceiling( ( deed.Stone.Started + deed.Stone.Duration + HouseRaffleStone.ExpirationTime - DateTime.Now ).TotalDays ); + int daysLeft = (int)Math.Ceiling( ( deed.Stone.Started + deed.Stone.Duration + HouseRaffleStone.ExpirationTime - DateTime.UtcNow ).TotalDays ); return String.Format( "" + diff --git a/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs b/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs index 1e918945f..788d05797 100644 --- a/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs +++ b/Scripts/Items/Special/House Raffle/HouseRaffleStone.cs @@ -42,7 +42,7 @@ namespace Server.Items else m_Address = IPAddress.None; - m_Date = DateTime.Now; + m_Date = DateTime.UtcNow; } public void Serialize( GenericWriter writer ) @@ -123,7 +123,7 @@ namespace Server.Items m_Entries.Clear(); m_Winner = null; m_Deed = null; - m_Started = DateTime.Now; + m_Started = DateTime.UtcNow; } m_State = value; @@ -194,7 +194,7 @@ namespace Server.Items if ( m_State != HouseRaffleState.Completed ) return false; - return ( m_Started + m_Duration + ExpirationTime <= DateTime.Now ); + return ( m_Started + m_Duration + ExpirationTime <= DateTime.UtcNow ); } } @@ -520,7 +520,7 @@ namespace Server.Items public void CheckEnd() { - if ( m_State != HouseRaffleState.Active || m_Started + m_Duration > DateTime.Now ) + if ( m_State != HouseRaffleState.Active || m_Started + m_Duration > DateTime.UtcNow ) return; m_State = HouseRaffleState.Completed; diff --git a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs index eeef1b454..1a9ba3725 100644 --- a/Scripts/Items/Special/Solen Items/BallOfSummoning.cs +++ b/Scripts/Items/Special/Solen Items/BallOfSummoning.cs @@ -260,7 +260,7 @@ namespace Server.Items { from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, 0x22, 3, "", "You cannot summon your pet to this location." ) ); } - else if ( Core.ML && from is PlayerMobile && DateTime.Now < ((PlayerMobile)from).LastPetBallTime.AddSeconds( 15.0 ) ) + else if ( Core.ML && from is PlayerMobile && DateTime.UtcNow < ((PlayerMobile)from).LastPetBallTime.AddSeconds( 15.0 ) ) { MessageHelper.SendLocalizedMessageTo( this, from, 1080072, 0x22 ); // You must wait a few seconds before you can summon your pet. } @@ -308,7 +308,7 @@ namespace Server.Items if ( from is PlayerMobile ) { - ((PlayerMobile)from).LastPetBallTime = DateTime.Now; + ((PlayerMobile)from).LastPetBallTime = DateTime.UtcNow; } } diff --git a/Scripts/Items/Special/SoulStone.cs b/Scripts/Items/Special/SoulStone.cs index 51198b322..4a41e5188 100644 --- a/Scripts/Items/Special/SoulStone.cs +++ b/Scripts/Items/Special/SoulStone.cs @@ -149,7 +149,7 @@ namespace Server.Items { AggressorInfo info = m.Aggressed[i]; - if ( DateTime.Now - info.LastCombatTime < time ) + if ( DateTime.UtcNow - info.LastCombatTime < time ) return true; } @@ -158,7 +158,7 @@ namespace Server.Items protected virtual bool CheckUse( Mobile from ) { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; PlayerMobile pm = from as PlayerMobile; @@ -218,7 +218,7 @@ namespace Server.Items } #region Scroll of Alacrity - if ( pm.AcceleratedStart > DateTime.Now ) + if ( pm.AcceleratedStart > DateTime.UtcNow ) { from.SendLocalizedMessage(1078115); // You may not use a soulstone while your character is under the effects of a Scroll of Alacrity. return false; @@ -595,7 +595,7 @@ namespace Server.Items #region Scroll of ALacrity PlayerMobile pm = from as PlayerMobile; - if (pm.AcceleratedStart > DateTime.Now) + if (pm.AcceleratedStart > DateTime.UtcNow) { //
Unable to Absorb Selected Skill from Soulstone
diff --git a/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs b/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs index 6af1ff219..7ac73c72b 100644 --- a/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs +++ b/Scripts/Items/Special/Special Scrolls/ScrollofAlacrity.cs @@ -94,7 +94,7 @@ namespace Server.Items #endregion #region Scroll of Alacrity - if (pm.AcceleratedStart > DateTime.Now) + if (pm.AcceleratedStart > DateTime.UtcNow) { from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll. return false; @@ -129,7 +129,7 @@ namespace Server.Items Effects.PlaySound( from.Location, from.Map, 0x1E9 ); Effects.SendTargetParticles( from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100 ); - pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes(15); + pm.AcceleratedStart = DateTime.UtcNow + TimeSpan.FromMinutes(15); Timer t = (Timer)m_Table[from]; diff --git a/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs b/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs index aa58ca8e7..4cc913ca3 100644 --- a/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs +++ b/Scripts/Items/Special/Special Scrolls/ScrollofTranscendence.cs @@ -82,7 +82,7 @@ namespace Server.Items #endregion #region Scroll of Alacrity - if (pm.AcceleratedStart > DateTime.Now) + if (pm.AcceleratedStart > DateTime.UtcNow) { from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll. return false; diff --git a/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs index b2f235b28..b7973bebd 100644 --- a/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs +++ b/Scripts/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs @@ -59,9 +59,9 @@ namespace Server.Items { m.SendLocalizedMessage( 1060197 ); // You are not dead, and thus cannot be resurrected! } - else if ( m.AnkhNextUse > DateTime.Now ) + else if ( m.AnkhNextUse > DateTime.UtcNow ) { - TimeSpan delay = m.AnkhNextUse - DateTime.Now; + TimeSpan delay = m.AnkhNextUse - DateTime.UtcNow; if ( delay.TotalMinutes > 0 ) m.SendLocalizedMessage( 1079265, Math.Round( delay.TotalMinutes ).ToString() ); // You must wait ~1_minutes~ minutes before you can use this item. @@ -142,7 +142,7 @@ namespace Server.Items if ( from is PlayerMobile ) { - ((PlayerMobile) from).AnkhNextUse = DateTime.Now + TimeSpan.FromHours( 1 ); + ((PlayerMobile) from).AnkhNextUse = DateTime.UtcNow + TimeSpan.FromHours( 1 ); } base.OnResponse( state, info ); diff --git a/Scripts/Items/Special/Veteran Rewards/MiningCart.cs b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs index c8abe2382..91a3ff935 100644 --- a/Scripts/Items/Special/Veteran Rewards/MiningCart.cs +++ b/Scripts/Items/Special/Veteran Rewards/MiningCart.cs @@ -273,7 +273,7 @@ namespace Server.Items if ( m_Timer != null ) writer.Write( (DateTime) m_Timer.Next ); else - writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) ); + writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) ); } public override void Deserialize( GenericReader reader ) @@ -294,10 +294,10 @@ namespace Server.Items DateTime next = reader.ReadDateTime(); - if ( next < DateTime.Now ) - next = DateTime.Now; + if ( next < DateTime.UtcNow ) + next = DateTime.UtcNow; - m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) ); + m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveResources ) ); break; } } diff --git a/Scripts/Items/Special/Veteran Rewards/TreeStump.cs b/Scripts/Items/Special/Veteran Rewards/TreeStump.cs index 53a114f0a..8381b5047 100644 --- a/Scripts/Items/Special/Veteran Rewards/TreeStump.cs +++ b/Scripts/Items/Special/Veteran Rewards/TreeStump.cs @@ -134,7 +134,7 @@ namespace Server.Items if ( m_Timer != null ) writer.Write( (DateTime) m_Timer.Next ); else - writer.Write( (DateTime) DateTime.Now + TimeSpan.FromDays( 1 ) ); + writer.Write( (DateTime) DateTime.UtcNow + TimeSpan.FromDays( 1 ) ); } public override void Deserialize( GenericReader reader ) @@ -148,10 +148,10 @@ namespace Server.Items DateTime next = reader.ReadDateTime(); - if ( next < DateTime.Now ) - next = DateTime.Now; + if ( next < DateTime.UtcNow ) + next = DateTime.UtcNow; - m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) ); + m_Timer = Timer.DelayCall( next - DateTime.UtcNow, TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) ); } } diff --git a/Scripts/Items/Talismans/TalismanSummons.cs b/Scripts/Items/Talismans/TalismanSummons.cs index 5b37d0def..eba8583b1 100644 --- a/Scripts/Items/Talismans/TalismanSummons.cs +++ b/Scripts/Items/Talismans/TalismanSummons.cs @@ -370,7 +370,7 @@ namespace Server.Mobiles public override void OnThink() { /* - if ( m_NextWave < DateTime.Now ) + if ( m_NextWave < DateTime.UtcNow ) AreaHeatDamage(); */ } @@ -421,7 +421,7 @@ namespace Server.Mobiles } } - m_NextWave = DateTime.Now + TimeSpan.FromSeconds( 3 ); + m_NextWave = DateTime.UtcNow + TimeSpan.FromSeconds( 3 ); } */ } diff --git a/Scripts/Items/Traps/BaseTrap.cs b/Scripts/Items/Traps/BaseTrap.cs index cfe471516..98a599d89 100644 --- a/Scripts/Items/Traps/BaseTrap.cs +++ b/Scripts/Items/Traps/BaseTrap.cs @@ -45,15 +45,15 @@ namespace Server.Items if ( m.Location == oldLocation ) return; - if ( CheckRange( m.Location, oldLocation, 0 ) && DateTime.Now >= m_NextActiveTrigger ) + if ( CheckRange( m.Location, oldLocation, 0 ) && DateTime.UtcNow >= m_NextActiveTrigger ) { - m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.Now + ResetDelay; + m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.UtcNow + ResetDelay; OnTrigger( m ); } - else if ( PassivelyTriggered && CheckRange( m.Location, oldLocation, PassiveTriggerRange ) && DateTime.Now >= m_NextPassiveTrigger ) + else if ( PassivelyTriggered && CheckRange( m.Location, oldLocation, PassiveTriggerRange ) && DateTime.UtcNow >= m_NextPassiveTrigger ) { - m_NextPassiveTrigger = DateTime.Now + PassiveTriggerDelay; + m_NextPassiveTrigger = DateTime.UtcNow + PassiveTriggerDelay; OnTrigger( m ); } diff --git a/Scripts/Items/Weapons/Abilities/DoubleStrike.cs b/Scripts/Items/Weapons/Abilities/DoubleStrike.cs index ded1ec3ff..04f4de027 100644 --- a/Scripts/Items/Weapons/Abilities/DoubleStrike.cs +++ b/Scripts/Items/Weapons/Abilities/DoubleStrike.cs @@ -49,7 +49,7 @@ namespace Server.Items { BaseWeapon.InDoubleStrike = true; attacker.RevealingAction(); - attacker.NextCombatTime = DateTime.Now + weapon.OnSwing( attacker, defender ); + attacker.NextCombatTime = Core.TickCount + weapon.OnSwing(attacker, defender).TotalMilliseconds; BaseWeapon.InDoubleStrike = false; } } diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index 6a7a36e2d..4cba6fc9a 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -636,7 +636,7 @@ namespace Server.Items m.AddStatMod( new StatMod( StatType.Int, modName + "Int", intBonus, TimeSpan.Zero ) ); } - from.NextCombatTime = DateTime.Now + GetDelay( from ); + from.NextCombatTime = Core.TickCount + (int)GetDelay( from ).TotalMilliseconds; if ( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular ) { @@ -689,7 +689,7 @@ namespace Server.Items m.RemoveStatMod( modName + "Int" ); if ( weapon != null ) - m.NextCombatTime = DateTime.Now + weapon.GetDelay( m ); + m.NextCombatTime = Core.TickCount + (int)weapon.GetDelay(m).TotalMilliseconds; if ( UseSkillMod && m_SkillMod != null ) { @@ -1018,7 +1018,7 @@ namespace Server.Items { PlayerMobile p = attacker as PlayerMobile; - canSwing = ( p == null || p.PeacedUntil <= DateTime.Now ); + canSwing = ( p == null || p.PeacedUntil <= DateTime.UtcNow ); } } diff --git a/Scripts/Items/Weapons/Ranged/BaseRanged.cs b/Scripts/Items/Weapons/Ranged/BaseRanged.cs index 565acbaf4..02ba415f3 100644 --- a/Scripts/Items/Weapons/Ranged/BaseRanged.cs +++ b/Scripts/Items/Weapons/Ranged/BaseRanged.cs @@ -52,7 +52,7 @@ namespace Server.Items WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); // Make sure we've been standing still for .25/.5/1 second depending on Era - if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) + if (Core.TickCount - attacker.LastMoveTime >= (Core.SE ? 250 : Core.AOS ? 500 : 1000) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { bool canSwing = true; diff --git a/Scripts/Misc/AttackMessage.cs b/Scripts/Misc/AttackMessage.cs index 7f0300465..5afefdec5 100644 --- a/Scripts/Misc/AttackMessage.cs +++ b/Scripts/Misc/AttackMessage.cs @@ -42,7 +42,7 @@ namespace Server.Misc { AggressorInfo info = list[i]; - if ( info.Attacker == m2 && DateTime.Now < (info.LastCombatTime + Delay) ) + if ( info.Attacker == m2 && DateTime.UtcNow < (info.LastCombatTime + Delay) ) return true; } @@ -52,7 +52,7 @@ namespace Server.Misc { AggressorInfo info = list[i]; - if ( info.Attacker == m1 && DateTime.Now < (info.LastCombatTime + Delay) ) + if ( info.Attacker == m1 && DateTime.UtcNow < (info.LastCombatTime + Delay) ) return true; } diff --git a/Scripts/Misc/AutoRestart.cs b/Scripts/Misc/AutoRestart.cs index bd9651382..1b8eb86da 100644 --- a/Scripts/Misc/AutoRestart.cs +++ b/Scripts/Misc/AutoRestart.cs @@ -40,7 +40,7 @@ namespace Server.Misc { e.Mobile.SendMessage( "You have initiated server shutdown." ); Enabled = true; - m_RestartTime = DateTime.Now; + m_RestartTime = DateTime.UtcNow; } } @@ -48,9 +48,9 @@ namespace Server.Misc { Priority = TimerPriority.FiveSeconds; - m_RestartTime = DateTime.Now.Date + RestartTime; + m_RestartTime = DateTime.UtcNow.Date + RestartTime; - if ( m_RestartTime < DateTime.Now ) + if ( m_RestartTime < DateTime.UtcNow ) m_RestartTime += TimeSpan.FromDays( 1.0 ); } @@ -69,7 +69,7 @@ namespace Server.Misc if ( m_Restarting || !Enabled ) return; - if ( DateTime.Now < m_RestartTime ) + if ( DateTime.UtcNow < m_RestartTime ) return; if ( WarningDelay > TimeSpan.Zero ) diff --git a/Scripts/Misc/AutoSave.cs b/Scripts/Misc/AutoSave.cs index 349d4ba06..895a14e18 100644 --- a/Scripts/Misc/AutoSave.cs +++ b/Scripts/Misc/AutoSave.cs @@ -173,7 +173,7 @@ namespace Server.Misc private static string GetTimeStamp() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; return String.Format( "{0}-{1}-{2} {3}-{4:D2}-{5:D2}", now.Day, diff --git a/Scripts/Misc/BuffIcons.cs b/Scripts/Misc/BuffIcons.cs index e8ae1bc83..df103dd3b 100644 --- a/Scripts/Misc/BuffIcons.cs +++ b/Scripts/Misc/BuffIcons.cs @@ -74,7 +74,7 @@ namespace Server : this( iconID, titleCliloc, secondaryCliloc ) { m_TimeLength = length; - m_TimeStart = DateTime.Now; + m_TimeStart = DateTime.UtcNow; m_Timer = Timer.DelayCall( length, new TimerCallback( delegate @@ -228,7 +228,7 @@ namespace Server public sealed class AddBuffPacket : Packet { public AddBuffPacket( Mobile m, BuffInfo info ) - : this( m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.Now) : TimeSpan.Zero ) + : this( m, info.ID, info.TitleCliloc, info.SecondaryCliloc, info.Args, (info.TimeStart != DateTime.MinValue) ? ((info.TimeStart + info.TimeLength) - DateTime.UtcNow) : TimeSpan.Zero ) { } public AddBuffPacket( Mobile mob, BuffIcon iconID, int titleCliloc, int secondaryCliloc, TextDefinition args, TimeSpan length ) diff --git a/Scripts/Misc/ClientVerification.cs b/Scripts/Misc/ClientVerification.cs index 4c02657e2..9c6d72189 100644 --- a/Scripts/Misc/ClientVerification.cs +++ b/Scripts/Misc/ClientVerification.cs @@ -129,7 +129,7 @@ namespace Server.Misc if ( state.Mobile == null || state.Mobile.AccessLevel > AccessLevel.Player ) return; - if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.Now - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency ))) + if( Required != null && version < Required && ( m_OldClientResponse == OldClientResponse.Kick ||( m_OldClientResponse == OldClientResponse.LenientKick && (DateTime.UtcNow - state.Mobile.CreationTime) > m_AgeLeniency && state.Mobile is PlayerMobile && ((PlayerMobile)state.Mobile).GameTime > m_GameTimeLeniency ))) { kickMessage = String.Format( "This server requires your client version be at least {0}.", Required ); } diff --git a/Scripts/Misc/CrashGuard.cs b/Scripts/Misc/CrashGuard.cs index 8d7ea55cf..504758d62 100644 --- a/Scripts/Misc/CrashGuard.cs +++ b/Scripts/Misc/CrashGuard.cs @@ -190,7 +190,7 @@ namespace Server.Misc op.WriteLine( "RunUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision ); op.WriteLine( "Operating System: {0}", Environment.OSVersion ); op.WriteLine( ".NET Framework: {0}", Environment.Version ); - op.WriteLine( "Time: {0}", DateTime.Now ); + op.WriteLine( "Time: {0}", DateTime.UtcNow ); try { op.WriteLine( "Mobiles: {0}", World.Mobiles.Count ); } catch {} @@ -248,7 +248,7 @@ namespace Server.Misc private static string GetTimeStamp() { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; return String.Format( "{0}-{1}-{2}-{3}-{4}-{5}", now.Day, diff --git a/Scripts/Misc/CurrentExpansion.cs b/Scripts/Misc/CurrentExpansion.cs index c7d449389..58da51c82 100644 --- a/Scripts/Misc/CurrentExpansion.cs +++ b/Scripts/Misc/CurrentExpansion.cs @@ -26,7 +26,7 @@ namespace Server if ( ObjectPropertyList.Enabled ) PacketHandlers.SingleClickProps = true; // single click for everything is overriden to check object property list - Mobile.ActionDelay = TimeSpan.FromSeconds( 1.0 ); + Mobile.ActionDelay = 1000; Mobile.AOSStatusHandler = new AOSStatusHandler( AOS.GetStatus ); } } diff --git a/Scripts/Misc/Guild.cs b/Scripts/Misc/Guild.cs index cba1a6e5b..5c183b9bf 100644 --- a/Scripts/Misc/Guild.cs +++ b/Scripts/Misc/Guild.cs @@ -531,7 +531,7 @@ namespace Server.Guilds if( w == null ) return WarStatus.Win; - if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.Now ) + if( m_WarLength != TimeSpan.Zero && (m_WarBeginning + m_WarLength) < DateTime.UtcNow ) { if( m_Kills > w.m_Kills ) return WarStatus.Win; @@ -1000,7 +1000,7 @@ namespace Server.Guilds m_Candidates = new List(); m_Accepted = new List(); - m_LastFealty = DateTime.Now; + m_LastFealty = DateTime.UtcNow; m_Name = name; m_Abbreviation = abbreviation; @@ -1196,7 +1196,7 @@ namespace Server.Guilds #region Serialization public override void Serialize( GenericWriter writer ) { - if ( this.LastFealty+TimeSpan.FromDays( 1.0 ) < DateTime.Now ) + if ( this.LastFealty+TimeSpan.FromDays( 1.0 ) < DateTime.UtcNow ) this.CalculateGuildmaster(); CheckExpiredWars(); @@ -1598,7 +1598,7 @@ namespace Server.Guilds if( NewGuildSystem ) { PlayerMobile pm = m as PlayerMobile; - if( pm == null || pm.LastOnline + InactiveTime < DateTime.Now ) + if( pm == null || pm.LastOnline + InactiveTime < DateTime.UtcNow ) return false; } @@ -1663,7 +1663,7 @@ namespace Server.Guilds GuildMessage( 1018015, true, winner.Name ); // Guild Message: Guildmaster changed to: Leader = winner; - m_LastFealty = DateTime.Now; + m_LastFealty = DateTime.UtcNow; } #endregion @@ -1769,7 +1769,7 @@ namespace Server.Guilds if ( m_Type != value ) { m_Type = value; - m_TypeLastChange = DateTime.Now; + m_TypeLastChange = DateTime.UtcNow; InvalidateMemberProperties(); } diff --git a/Scripts/Misc/HardwareInfo.cs b/Scripts/Misc/HardwareInfo.cs index 53e537d1f..f538bb480 100644 --- a/Scripts/Misc/HardwareInfo.cs +++ b/Scripts/Misc/HardwareInfo.cs @@ -178,7 +178,7 @@ namespace Server info.m_Language = pvSrc.ReadUnicodeStringLESafe( 4 ); info.m_Unknown = pvSrc.ReadStringSafe( 64 ); - info.m_TimeReceived = DateTime.Now; + info.m_TimeReceived = DateTime.UtcNow; Account acct = state.Account as Account; diff --git a/Scripts/Misc/Notoriety.cs b/Scripts/Misc/Notoriety.cs index f8d5b8697..e384f1fc5 100644 --- a/Scripts/Misc/Notoriety.cs +++ b/Scripts/Misc/Notoriety.cs @@ -296,7 +296,7 @@ namespace Server.Misc if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) ) actual = Notoriety.Murderer; - if( DateTime.Now >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) ) + if( DateTime.UtcNow >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) ) return actual; Party sourceParty = Party.Get( source ); diff --git a/Scripts/Misc/Profile.cs b/Scripts/Misc/Profile.cs index 888f43c89..2e663cd64 100644 --- a/Scripts/Misc/Profile.cs +++ b/Scripts/Misc/Profile.cs @@ -64,7 +64,7 @@ namespace Server.Misc if ( a == null ) return ""; - TimeSpan ts = DateTime.Now - a.Created; + TimeSpan ts = DateTime.UtcNow - a.Created; string v; diff --git a/Scripts/Misc/ShardPoller.cs b/Scripts/Misc/ShardPoller.cs index 0b82e7c52..18baf8b72 100644 --- a/Scripts/Misc/ShardPoller.cs +++ b/Scripts/Misc/ShardPoller.cs @@ -65,7 +65,7 @@ namespace Server.Misc try { - TimeSpan ts = (m_StartTime + m_Duration) - DateTime.Now; + TimeSpan ts = (m_StartTime + m_Duration) - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) return TimeSpan.Zero; @@ -92,7 +92,7 @@ namespace Server.Misc if ( m_Active ) { - m_StartTime = DateTime.Now; + m_StartTime = DateTime.UtcNow; m_ActivePollers.Add( this ); } else diff --git a/Scripts/Misc/SkillCheck.cs b/Scripts/Misc/SkillCheck.cs index 260c6e3f0..7dc2dba1c 100644 --- a/Scripts/Misc/SkillCheck.cs +++ b/Scripts/Misc/SkillCheck.cs @@ -228,7 +228,7 @@ namespace Server.Misc #region Scroll of Alacrity PlayerMobile pm = from as PlayerMobile; - if ( pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.Now ) + if ( pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow ) toGain *= Utility.RandomMinMax(2, 5); #endregion @@ -345,38 +345,38 @@ namespace Server.Misc case Stat.Str: { if ( from is BaseCreature && ((BaseCreature)from).Controlled ) { - if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.Now ) + if ( (from.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow ) return; } - else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.Now ) + else if( (from.LastStrGain + m_StatGainDelay) >= DateTime.UtcNow ) return; - from.LastStrGain = DateTime.Now; + from.LastStrGain = DateTime.UtcNow; break; } case Stat.Dex: { if ( from is BaseCreature && ((BaseCreature)from).Controlled ) { - if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.Now ) + if ( (from.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow ) return; } - else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.Now ) + else if( (from.LastDexGain + m_StatGainDelay) >= DateTime.UtcNow ) return; - from.LastDexGain = DateTime.Now; + from.LastDexGain = DateTime.UtcNow; break; } case Stat.Int: { if ( from is BaseCreature && ((BaseCreature)from).Controlled ) { - if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.Now ) + if ( (from.LastIntGain + m_PetStatGainDelay) >= DateTime.UtcNow ) return; } - else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.Now ) + else if( (from.LastIntGain + m_StatGainDelay) >= DateTime.UtcNow ) return; - from.LastIntGain = DateTime.Now; + from.LastIntGain = DateTime.UtcNow; break; } } diff --git a/Scripts/Mobiles/AI/ArcherAI.cs b/Scripts/Mobiles/AI/ArcherAI.cs index 849706f1c..25496dab0 100644 --- a/Scripts/Mobiles/AI/ArcherAI.cs +++ b/Scripts/Mobiles/AI/ArcherAI.cs @@ -42,7 +42,7 @@ namespace Server.Mobiles return true; } - if ( (m_Mobile.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) < DateTime.Now ) + if (Core.TickCount - m_Mobile.LastMoveTime > 1000) { if (WalkMobileRange(m_Mobile.Combatant, 1, true, m_Mobile.RangeFight, m_Mobile.Weapon.MaxRange)) { diff --git a/Scripts/Mobiles/AI/BaseAI.cs b/Scripts/Mobiles/AI/BaseAI.cs index 189a912b8..31085a84b 100644 --- a/Scripts/Mobiles/AI/BaseAI.cs +++ b/Scripts/Mobiles/AI/BaseAI.cs @@ -830,7 +830,7 @@ namespace Server.Mobiles m_Mobile.FocusMob = null; m_Mobile.Combatant = null; m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed; - m_NextStopGuard = DateTime.Now + TimeSpan.FromSeconds(10); + m_NextStopGuard = DateTime.UtcNow + TimeSpan.FromSeconds(10); m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed; break; @@ -928,7 +928,7 @@ namespace Server.Mobiles { m_Mobile.DebugSay("Praise the shepherd!"); } - else if (DateTime.Now < m_NextStopGuard) + else if (DateTime.UtcNow < m_NextStopGuard) { m_Mobile.DebugSay("I am on guard"); //m_Mobile.Turn( Utility.Random(0, 2) - 1 ); @@ -1836,7 +1836,7 @@ namespace Server.Mobiles public virtual bool DoBardPacified() { - if (DateTime.Now < m_Mobile.BardEndTime) + if (DateTime.UtcNow < m_Mobile.BardEndTime) { m_Mobile.DebugSay("I am pacified, I wait"); m_Mobile.Combatant = null; @@ -1854,7 +1854,7 @@ namespace Server.Mobiles public virtual bool DoBardProvoked() { - if (DateTime.Now >= m_Mobile.BardEndTime && (m_Mobile.BardMaster == null || m_Mobile.BardMaster.Deleted || m_Mobile.BardMaster.Map != m_Mobile.Map || m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) > m_Mobile.RangePerception)) + if (DateTime.UtcNow >= m_Mobile.BardEndTime && (m_Mobile.BardMaster == null || m_Mobile.BardMaster.Deleted || m_Mobile.BardMaster.Map != m_Mobile.Map || m_Mobile.GetDistanceToSqrt(m_Mobile.BardMaster) > m_Mobile.RangePerception)) { m_Mobile.DebugSay("I have lost my provoker"); m_Mobile.BardProvoked = false; @@ -1990,7 +1990,7 @@ namespace Server.Mobiles { using (StreamWriter op = new StreamWriter("nan_transform.txt", true)) { - op.WriteLine(String.Format("NaN in TransformMoveDelay: {0}, {1}, {2}, {3}", DateTime.Now, this.GetType().ToString(), m_Mobile == null ? "null" : m_Mobile.GetType().ToString(), m_Mobile.HitsMax)); + op.WriteLine(String.Format("NaN in TransformMoveDelay: {0}, {1}, {2}, {3}", DateTime.UtcNow, this.GetType().ToString(), m_Mobile == null ? "null" : m_Mobile.GetType().ToString(), m_Mobile.HitsMax)); } return 1.0; @@ -2009,7 +2009,7 @@ namespace Server.Mobiles public virtual bool CheckMove() { - return (DateTime.Now >= m_NextMove); + return (DateTime.UtcNow >= m_NextMove); } public virtual bool DoMove(Direction d) @@ -2040,8 +2040,8 @@ namespace Server.Mobiles m_NextMove += delay; - if (m_NextMove < DateTime.Now) - m_NextMove = DateTime.Now; + if (m_NextMove < DateTime.UtcNow) + m_NextMove = DateTime.UtcNow; m_Mobile.Pushing = false; @@ -2470,13 +2470,13 @@ namespace Server.Mobiles return false; } - if (m_Mobile.NextReacquireTime > DateTime.Now) + if (m_Mobile.NextReacquireTime > DateTime.UtcNow) { m_Mobile.FocusMob = null; return false; } - m_Mobile.NextReacquireTime = DateTime.Now + m_Mobile.ReacquireDelay; + m_Mobile.NextReacquireTime = DateTime.UtcNow + m_Mobile.ReacquireDelay; m_Mobile.DebugSay("Acquiring..."); @@ -2734,7 +2734,7 @@ namespace Server.Mobiles { m_Owner = owner; - m_Owner.m_NextDetectHidden = DateTime.Now; + m_Owner.m_NextDetectHidden = DateTime.UtcNow; Priority = TimerPriority.FiftyMS; } @@ -2802,7 +2802,7 @@ namespace Server.Mobiles } } - if (m_Owner.CanDetectHidden && DateTime.Now > m_Owner.m_NextDetectHidden) + if (m_Owner.CanDetectHidden && DateTime.UtcNow > m_Owner.m_NextDetectHidden) { m_Owner.DetectHidden(); @@ -2815,7 +2815,7 @@ namespace Server.Mobiles int min = delay * (9 / 10); // 13s at 1000 int, 33s at 400 int, 54s at <250 int int max = delay * (10 / 9); // 16s at 1000 int, 41s at 400 int, 66s at <250 int - m_Owner.m_NextDetectHidden = DateTime.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(min, max)); + m_Owner.m_NextDetectHidden = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(min, max)); } } } diff --git a/Scripts/Mobiles/AI/MageAI.cs b/Scripts/Mobiles/AI/MageAI.cs index c5829e2e9..7fee5549f 100644 --- a/Scripts/Mobiles/AI/MageAI.cs +++ b/Scripts/Mobiles/AI/MageAI.cs @@ -61,7 +61,7 @@ namespace Server.Mobiles m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; - m_NextCastTime = DateTime.Now; + m_NextCastTime = DateTime.UtcNow; } else if( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax && !m_Mobile.Meditating ) { @@ -101,7 +101,7 @@ namespace Server.Mobiles if( m_Mobile.Controlled ) { - if( DateTime.Now < m_NextHealTime ) + if( DateTime.UtcNow < m_NextHealTime ) return null; } @@ -144,7 +144,7 @@ namespace Server.Mobiles else delay = Math.Sqrt( 600 - m_Mobile.Int ); - m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds( delay ); + m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds( delay ); return spell; } @@ -664,7 +664,7 @@ namespace Server.Mobiles } } - if( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange( c, Core.ML ? 10 : 12 ) ) + if( m_Mobile.Spell == null && DateTime.UtcNow > m_NextCastTime && m_Mobile.InRange( c, Core.ML ? 10 : 12 ) ) { // We are ready to cast a spell @@ -714,7 +714,7 @@ namespace Server.Mobiles if( spell != null ) spell.Cast(); - m_NextCastTime = DateTime.Now + GetDelay( spell ); + m_NextCastTime = DateTime.UtcNow + GetDelay( spell ); } else if( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting ) { @@ -739,7 +739,7 @@ namespace Server.Mobiles { m_LastTarget = null; } - else if( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime ) + else if( m_Mobile.Spell == null && DateTime.UtcNow > m_NextCastTime ) { m_Mobile.DebugSay( "I am going to reveal my last target" ); @@ -749,7 +749,7 @@ namespace Server.Mobiles if( spell.Cast() ) m_LastTarget = null; // only do it once - m_NextCastTime = DateTime.Now + GetDelay( spell ); + m_NextCastTime = DateTime.UtcNow + GetDelay( spell ); } } diff --git a/Scripts/Mobiles/AI/ThiefAI.cs b/Scripts/Mobiles/AI/ThiefAI.cs index acd121f5d..41494881e 100644 --- a/Scripts/Mobiles/AI/ThiefAI.cs +++ b/Scripts/Mobiles/AI/ThiefAI.cs @@ -68,14 +68,14 @@ namespace Server.Mobiles if ( !Core.AOS && !m_Mobile.DisarmReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.ArmsLore].Value >= 80.0 && m_toDisarm != null ) EventSink.InvokeDisarmRequest( new DisarmRequestEventArgs( m_Mobile ) ); - if ( m_toDisarm != null && m_toDisarm.IsChildOf( combatant.Backpack ) && m_Mobile.NextSkillTime <= DateTime.Now && (m_toDisarm.LootType != LootType.Blessed && m_toDisarm.LootType != LootType.Newbied) ) + if (m_toDisarm != null && m_toDisarm.IsChildOf(combatant.Backpack) && Core.TickCount - m_Mobile.NextSkillTime >= 0 && (m_toDisarm.LootType != LootType.Blessed && m_toDisarm.LootType != LootType.Newbied)) { m_Mobile.DebugSay( "Trying to steal from combatant." ); m_Mobile.UseSkill( SkillName.Stealing ); if ( m_Mobile.Target != null ) m_Mobile.Target.Invoke( m_Mobile, m_toDisarm ); } - else if ( m_toDisarm == null && m_Mobile.NextSkillTime <= DateTime.Now ) + else if (m_toDisarm == null && Core.TickCount - m_Mobile.NextSkillTime >= 0) { Container cpack = combatant.Backpack; diff --git a/Scripts/Mobiles/Animals/Cows/Cow.cs b/Scripts/Mobiles/Animals/Cows/Cow.cs index 0fc2d3fb8..66806a013 100644 --- a/Scripts/Mobiles/Animals/Cows/Cow.cs +++ b/Scripts/Mobiles/Animals/Cows/Cow.cs @@ -93,14 +93,14 @@ namespace Server.Mobiles from.SendLocalizedMessage( 1080400 ); // You can not milk the cow from this location. if ( Controlled && ControlMaster != from ) from.SendLocalizedMessage( 1071182 ); // The cow nimbly escapes your attempts to milk it. - if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.Now ) + if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow ) from.SendLocalizedMessage( 1080198 ); // This cow can not be milked now. Please wait for some time. else { if ( m_Milk == 0 ) m_Milk = 4; - m_MilkedOn = DateTime.Now; + m_MilkedOn = DateTime.UtcNow; m_Milk--; return true; diff --git a/Scripts/Mobiles/Animals/Misc/Sheep.cs b/Scripts/Mobiles/Animals/Misc/Sheep.cs index 90a8eb55b..10cf7b261 100644 --- a/Scripts/Mobiles/Animals/Misc/Sheep.cs +++ b/Scripts/Mobiles/Animals/Misc/Sheep.cs @@ -15,12 +15,12 @@ namespace Server.Mobiles public DateTime NextWoolTime { get{ return m_NextWoolTime; } - set{ m_NextWoolTime = value; Body = ( DateTime.Now >= m_NextWoolTime ) ? 0xCF : 0xDF; } + set{ m_NextWoolTime = value; Body = ( DateTime.UtcNow >= m_NextWoolTime ) ? 0xCF : 0xDF; } } public void Carve( Mobile from, Item item ) { - if ( DateTime.Now < m_NextWoolTime ) + if ( DateTime.UtcNow < m_NextWoolTime ) { // This sheep is not yet ready to be shorn. PrivateOverheadMessage( MessageType.Regular, 0x3B2, 500449, from.NetState ); @@ -30,13 +30,13 @@ namespace Server.Mobiles from.SendLocalizedMessage( 500452 ); // You place the gathered wool into your backpack. from.AddToBackpack( new Wool( Map == Map.Felucca ? 2 : 1 ) ); - NextWoolTime = DateTime.Now + TimeSpan.FromHours( 3.0 ); // TODO: Proper time delay + NextWoolTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 ); // TODO: Proper time delay } public override void OnThink() { base.OnThink(); - Body = ( DateTime.Now >= m_NextWoolTime ) ? 0xCF : 0xDF; + Body = ( DateTime.UtcNow >= m_NextWoolTime ) ? 0xCF : 0xDF; } [Constructable] diff --git a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs index 8edaa4f55..751053bc6 100644 --- a/Scripts/Mobiles/Animals/Mounts/BaseMount.cs +++ b/Scripts/Mobiles/Animals/Mounts/BaseMount.cs @@ -299,10 +299,10 @@ namespace Server.Mobiles if( attacker == null ) attacker = m_Rider.FindMostRecentDamager( true ); - if( !(attacker == this || attacker == m_Rider || willKill || DateTime.Now < m_NextMountAbility) ) + if( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) ) { if( DoMountAbility( amount, from ) ) - m_NextMountAbility = DateTime.Now + MountAbilityDelay; + m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay; } } diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index 8c3fe2063..c4c334345 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -353,7 +353,7 @@ namespace Server.Mobiles private void CheckShout( PlayerMobile pm, Point3D oldLocation ) { - if ( m_MLNextShout > DateTime.Now || pm.Hidden || !pm.Alive ) + if ( m_MLNextShout > DateTime.UtcNow || pm.Hidden || !pm.Alive ) return; int shoutRange = ShoutRange; @@ -372,7 +372,7 @@ namespace Server.Mobiles return; Shout( pm ); - m_MLNextShout = DateTime.Now + ShoutDelay; + m_MLNextShout = DateTime.UtcNow + ShoutDelay; } public virtual void Shout( PlayerMobile pm ) @@ -465,7 +465,7 @@ namespace Server.Mobiles get { if ( m_DeleteTimer != null && m_DeleteTimer.Running ) - return m_DeleteTimer.Next - DateTime.Now; + return m_DeleteTimer.Next - DateTime.UtcNow; return TimeSpan.Zero; } @@ -679,7 +679,7 @@ namespace Server.Mobiles public virtual void BreathStallMovement() { if ( m_AI != null ) - m_AI.NextMove = DateTime.Now + TimeSpan.FromSeconds( BreathStallTime ); + m_AI.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( BreathStallTime ); } public virtual void BreathPlayAngerSound() @@ -854,7 +854,7 @@ namespace Server.Mobiles if ( m_EndFlee == DateTime.MinValue ) return false; - if ( DateTime.Now >= m_EndFlee ) + if ( DateTime.UtcNow >= m_EndFlee ) { StopFlee(); return false; @@ -865,7 +865,7 @@ namespace Server.Mobiles public virtual void BeginFlee( TimeSpan maxDuration ) { - m_EndFlee = DateTime.Now + maxDuration; + m_EndFlee = DateTime.UtcNow + maxDuration; } #endregion @@ -1404,7 +1404,7 @@ namespace Server.Mobiles public void Unpacify() { - BardEndTime = DateTime.Now; + BardEndTime = DateTime.UtcNow; BardPacified = false; } @@ -1712,7 +1712,7 @@ namespace Server.Mobiles m_Owners = new List(); - m_NextReacquireTime = DateTime.Now + ReacquireDelay; + m_NextReacquireTime = DateTime.UtcNow + ReacquireDelay; ChangeAIType(AI); @@ -1951,7 +1951,7 @@ namespace Server.Mobiles if ( m_bSummoned ) { m_SummonEnd = reader.ReadDeltaTime(); - new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.Now ).Start(); + new UnsummonTimer( m_ControlMaster, this, m_SummonEnd - DateTime.UtcNow ).Start(); } m_iControlSlots = reader.ReadInt(); @@ -2294,9 +2294,9 @@ namespace Server.Mobiles { if ( BondingBegin == DateTime.MinValue ) { - BondingBegin = DateTime.Now; + BondingBegin = DateTime.UtcNow; } - else if ( (BondingBegin + BondingDelay) <= DateTime.Now ) + else if ( (BondingBegin + BondingDelay) <= DateTime.UtcNow ) { IsBonded = true; BondingBegin = DateTime.MinValue; @@ -2871,7 +2871,7 @@ namespace Server.Mobiles if ( m_bSummoned == value ) return; - m_NextReacquireTime = DateTime.Now; + m_NextReacquireTime = DateTime.UtcNow; m_bSummoned = value; Delta( MobileDelta.Noto ); @@ -3508,7 +3508,7 @@ namespace Server.Mobiles { // idling... - if ( DateTime.Now >= m_IdleReleaseTime ) + if ( DateTime.UtcNow >= m_IdleReleaseTime ) { m_IdleReleaseTime = DateTime.MinValue; return false; // idle is over @@ -3520,7 +3520,7 @@ namespace Server.Mobiles if ( 95 > Utility.Random( 100 ) ) return false; // not idling, but don't want to enter idle state - m_IdleReleaseTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 15, 25 ) ); + m_IdleReleaseTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 15, 25 ) ); if ( Body.IsHuman ) { @@ -4823,7 +4823,7 @@ namespace Server.Mobiles if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) - this.OwnerAbandonTime = DateTime.Now; + this.OwnerAbandonTime = DateTime.UtcNow; } else { @@ -5131,7 +5131,7 @@ namespace Server.Mobiles } new UnsummonTimer( caster, creature, duration ).Start(); - creature.m_SummonEnd = DateTime.Now + duration; + creature.m_SummonEnd = DateTime.UtcNow + duration; creature.MoveToWorld( p, caster.Map ); @@ -5174,8 +5174,8 @@ namespace Server.Mobiles public virtual double HealOwnerInterval { get { return 30.0; } } public virtual bool HealOwnerFully { get { return false; } } - private DateTime m_NextHealTime = DateTime.Now; - private DateTime m_NextHealOwnerTime = DateTime.Now; + private DateTime m_NextHealTime = DateTime.UtcNow; + private DateTime m_NextHealOwnerTime = DateTime.UtcNow; private Timer m_HealTimer = null; public bool IsHealing { get { return ( m_HealTimer != null ); } } @@ -5345,7 +5345,7 @@ namespace Server.Mobiles public virtual void OnThink() { - if ( EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && DateTime.Now >= m_NextRummageTime ) + if ( EnableRummaging && CanRummageCorpses && !Summoned && !Controlled && DateTime.UtcNow >= m_NextRummageTime ) { double min, max; @@ -5361,21 +5361,21 @@ namespace Server.Mobiles } double delay = min + (Utility.RandomDouble() * (max - min)); - m_NextRummageTime = DateTime.Now + TimeSpan.FromMinutes( delay ); + m_NextRummageTime = DateTime.UtcNow + TimeSpan.FromMinutes( delay ); } - if ( CanBreath && DateTime.Now >= m_NextBreathTime ) // tested: controlled dragons do breath fire, what about summoned skeletal dragons? + if ( CanBreath && DateTime.UtcNow >= m_NextBreathTime ) // tested: controlled dragons do breath fire, what about summoned skeletal dragons? { Mobile target = this.Combatant; if( target != null && target.Alive && !target.IsDeadBondedPet && CanBeHarmful( target ) && target.Map == this.Map && !IsDeadBondedPet && target.InRange( this, BreathRange ) && InLOS( target ) && !BardPacified ) { - if( ( DateTime.Now - m_NextBreathTime ) < TimeSpan.FromSeconds( 30 ) && Utility.RandomBool() ) + if( ( DateTime.UtcNow - m_NextBreathTime ) < TimeSpan.FromSeconds( 30 ) && Utility.RandomBool() ) { BreathStart( target ); } - m_NextBreathTime = DateTime.Now + TimeSpan.FromSeconds( BreathMinDelay + ( ( Utility.RandomDouble( ) * ( BreathMaxDelay - BreathMinDelay ) ) ) ); + m_NextBreathTime = DateTime.UtcNow + TimeSpan.FromSeconds( BreathMinDelay + ( ( Utility.RandomDouble( ) * ( BreathMaxDelay - BreathMinDelay ) ) ) ); } } @@ -5383,17 +5383,17 @@ namespace Server.Mobiles { Mobile owner = this.ControlMaster; - if ( owner != null && CanHealOwner && DateTime.Now >= m_NextHealOwnerTime && CanBeBeneficial( owner, true, true ) && owner.Map == this.Map && InRange( owner, HealStartRange ) && InLOS( owner ) && owner.Hits < HealOwnerTrigger * owner.HitsMax ) + if ( owner != null && CanHealOwner && DateTime.UtcNow >= m_NextHealOwnerTime && CanBeBeneficial( owner, true, true ) && owner.Map == this.Map && InRange( owner, HealStartRange ) && InLOS( owner ) && owner.Hits < HealOwnerTrigger * owner.HitsMax ) { HealStart( owner ); - m_NextHealOwnerTime = DateTime.Now + TimeSpan.FromSeconds( HealOwnerInterval ); + m_NextHealOwnerTime = DateTime.UtcNow + TimeSpan.FromSeconds( HealOwnerInterval ); } - else if ( CanHeal && DateTime.Now >= m_NextHealTime && CanBeBeneficial( this ) && ( Hits < HealTrigger * HitsMax || Poisoned ) ) + else if ( CanHeal && DateTime.UtcNow >= m_NextHealTime && CanBeBeneficial( this ) && ( Hits < HealTrigger * HitsMax || Poisoned ) ) { HealStart( this ); - m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds( HealInterval ); + m_NextHealTime = DateTime.UtcNow + TimeSpan.FromSeconds( HealInterval ); } } @@ -5416,10 +5416,10 @@ namespace Server.Mobiles m_FailedReturnHome = 0; } - if ( HasAura && DateTime.Now >= m_NextAura ) + if ( HasAura && DateTime.UtcNow >= m_NextAura ) { AuraDamage(); - m_NextAura = DateTime.Now + AuraInterval; + m_NextAura = DateTime.UtcNow + AuraInterval; } } @@ -5501,7 +5501,7 @@ namespace Server.Mobiles BardMaster = master; BardTarget = target; Combatant = target; - BardEndTime = DateTime.Now + TimeSpan.FromSeconds( 30.0 ); + BardEndTime = DateTime.UtcNow + TimeSpan.FromSeconds( 30.0 ); if ( target is BaseCreature ) { @@ -5515,7 +5515,7 @@ namespace Server.Mobiles t.BardMaster = master; t.BardTarget = this; t.Combatant = this; - t.BardEndTime = DateTime.Now + TimeSpan.FromSeconds( 30.0 ); + t.BardEndTime = DateTime.UtcNow + TimeSpan.FromSeconds( 30.0 ); } } else @@ -5623,7 +5623,7 @@ namespace Server.Mobiles if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) - this.OwnerAbandonTime = DateTime.Now; + this.OwnerAbandonTime = DateTime.UtcNow; } else { @@ -5742,7 +5742,7 @@ namespace Server.Mobiles public LoyaltyTimer() : base( InternalDelay, InternalDelay ) { - m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours( 1.0 ); + m_NextHourlyCheck = DateTime.UtcNow + TimeSpan.FromHours( 1.0 ); Priority = TimerPriority.FiveSeconds; } @@ -5750,8 +5750,8 @@ namespace Server.Mobiles protected override void OnTick() { - if ( DateTime.Now >= m_NextHourlyCheck ) - m_NextHourlyCheck = DateTime.Now + TimeSpan.FromHours( 1.0 ); + if ( DateTime.UtcNow >= m_NextHourlyCheck ) + m_NextHourlyCheck = DateTime.UtcNow + TimeSpan.FromHours( 1.0 ); else return; @@ -5779,8 +5779,8 @@ namespace Server.Mobiles if ( !c.IsStabled && ( owner == null || owner.Deleted || owner.Map != c.Map || !owner.InRange( c, 12 ) || !c.CanSee( owner ) || !c.InLOS( owner ) ) ) { if ( c.OwnerAbandonTime == DateTime.MinValue ) - c.OwnerAbandonTime = DateTime.Now; - else if ( (c.OwnerAbandonTime + c.BondingAbandonDelay) <= DateTime.Now ) + c.OwnerAbandonTime = DateTime.UtcNow; + else if ( (c.OwnerAbandonTime + c.BondingAbandonDelay) <= DateTime.UtcNow ) toRemove.Add( c ); } else diff --git a/Scripts/Mobiles/Familiars/DarkWolf.cs b/Scripts/Mobiles/Familiars/DarkWolf.cs index b94d42596..04c07c8b6 100644 --- a/Scripts/Mobiles/Familiars/DarkWolf.cs +++ b/Scripts/Mobiles/Familiars/DarkWolf.cs @@ -47,10 +47,10 @@ namespace Server.Mobiles { base.OnThink(); - if ( DateTime.Now < m_NextRestore ) + if ( DateTime.UtcNow < m_NextRestore ) return; - m_NextRestore = DateTime.Now + TimeSpan.FromSeconds( 2.0 ); + m_NextRestore = DateTime.UtcNow + TimeSpan.FromSeconds( 2.0 ); Mobile caster = ControlMaster; diff --git a/Scripts/Mobiles/Familiars/HordeMinion.cs b/Scripts/Mobiles/Familiars/HordeMinion.cs index 9667881a5..5d03b1533 100644 --- a/Scripts/Mobiles/Familiars/HordeMinion.cs +++ b/Scripts/Mobiles/Familiars/HordeMinion.cs @@ -60,10 +60,10 @@ namespace Server.Mobiles { base.OnThink(); - if ( DateTime.Now < m_NextPickup ) + if ( DateTime.UtcNow < m_NextPickup ) return; - m_NextPickup = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 10 ) ); + m_NextPickup = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 10 ) ); Container pack = this.Backpack; @@ -90,7 +90,7 @@ namespace Server.Mobiles bool rejected; LRReason reject; - NextActionTime = DateTime.Now; + NextActionTime = Core.TickCount; Lift( item, item.Amount, out rejected, out reject ); diff --git a/Scripts/Mobiles/Familiars/ShadowWisp.cs b/Scripts/Mobiles/Familiars/ShadowWisp.cs index 8e2636b8c..6ab57bf62 100644 --- a/Scripts/Mobiles/Familiars/ShadowWisp.cs +++ b/Scripts/Mobiles/Familiars/ShadowWisp.cs @@ -47,10 +47,10 @@ namespace Server.Mobiles { base.OnThink(); - if ( DateTime.Now < m_NextFlare ) + if ( DateTime.UtcNow < m_NextFlare ) return; - m_NextFlare = DateTime.Now + TimeSpan.FromSeconds( 5.0 + (25.0 * Utility.RandomDouble()) ); + m_NextFlare = DateTime.UtcNow + TimeSpan.FromSeconds( 5.0 + (25.0 * Utility.RandomDouble()) ); this.FixedEffect( 0x37C4, 1, 12, 1109, 6 ); this.PlaySound( 0x1D3 ); diff --git a/Scripts/Mobiles/Guards/ArcherGuard.cs b/Scripts/Mobiles/Guards/ArcherGuard.cs index d6dc215dc..7d8236cde 100644 --- a/Scripts/Mobiles/Guards/ArcherGuard.cs +++ b/Scripts/Mobiles/Guards/ArcherGuard.cs @@ -74,7 +74,7 @@ namespace Server.Mobiles Skills[SkillName.MagicResist].Base = 120.0; Skills[SkillName.DetectHidden].Base = 100.0; - this.NextCombatTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 ); + this.NextCombatTime = Core.TickCount + 500; this.Focus = target; } @@ -336,7 +336,7 @@ namespace Server.Mobiles private bool TimeToSpare() { - return (m_Owner.NextCombatTime - DateTime.Now) > TimeSpan.FromSeconds( 1.0 ); + return (m_Owner.NextCombatTime - Core.TickCount) > 1000; } private bool OutOfMaxDistance( Mobile target ) diff --git a/Scripts/Mobiles/Guards/WarriorGuard.cs b/Scripts/Mobiles/Guards/WarriorGuard.cs index 5f87ac7e9..dcb3786d7 100644 --- a/Scripts/Mobiles/Guards/WarriorGuard.cs +++ b/Scripts/Mobiles/Guards/WarriorGuard.cs @@ -90,7 +90,7 @@ namespace Server.Mobiles Skills[SkillName.MagicResist].Base = 120.0; Skills[SkillName.DetectHidden].Base = 100.0; - this.NextCombatTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 ); + this.NextCombatTime = Core.TickCount + 500; this.Focus = target; } diff --git a/Scripts/Mobiles/Healers/BaseHealer.cs b/Scripts/Mobiles/Healers/BaseHealer.cs index 8e62f7b77..56d47c5a1 100644 --- a/Scripts/Mobiles/Healers/BaseHealer.cs +++ b/Scripts/Mobiles/Healers/BaseHealer.cs @@ -117,11 +117,11 @@ namespace Server.Mobiles public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( !m.Frozen && DateTime.Now >= m_NextResurrect && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && InLOS( m ) ) + if ( !m.Frozen && DateTime.UtcNow >= m_NextResurrect && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && InLOS( m ) ) { if ( !m.Alive ) { - m_NextResurrect = DateTime.Now + ResurrectDelay; + m_NextResurrect = DateTime.UtcNow + ResurrectDelay; if ( m.Map == null || !m.Map.CanFit( m.Location, 16, false, false ) ) { diff --git a/Scripts/Mobiles/Monsters/AOS/Revenant.cs b/Scripts/Mobiles/Monsters/AOS/Revenant.cs index 98b13418b..ab17e5777 100644 --- a/Scripts/Mobiles/Monsters/AOS/Revenant.cs +++ b/Scripts/Mobiles/Monsters/AOS/Revenant.cs @@ -31,7 +31,7 @@ namespace Server.Mobiles double scalar = caster.Skills[SkillName.SpiritSpeak].Value * 0.01; m_Target = target; - m_ExpireTime = DateTime.Now + duration; + m_ExpireTime = DateTime.UtcNow + duration; SetStr( 200 ); SetDex( 150 ); @@ -86,7 +86,7 @@ namespace Server.Mobiles public override void OnThink() { - if ( !m_Target.Alive || DateTime.Now > m_ExpireTime ) + if ( !m_Target.Alive || DateTime.UtcNow > m_ExpireTime ) { Kill(); return; @@ -134,7 +134,7 @@ namespace Server.Mobiles PlaySound( 0x37D ); } - if ( m_Target.Hidden && InRange( m_Target, 3 ) && DateTime.Now >= this.NextSkillTime && UseSkill( SkillName.DetectHidden ) ) + if (m_Target.Hidden && InRange(m_Target, 3) && Core.TickCount - this.NextSkillTime >= 0 && UseSkill(SkillName.DetectHidden)) { Target targ = this.Target; diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/Betrayer.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/Betrayer.cs index b4a23549c..81a2d2664 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/Betrayer.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/Betrayer.cs @@ -53,7 +53,7 @@ namespace Server.Mobiles if ( 0.02 > Utility.RandomDouble() ) PackItem( new BlackthornWelcomeBook() ); - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 30 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 30 ) ); } public override void OnDeath( Container c ) @@ -146,10 +146,10 @@ namespace Server.Mobiles { Mobile combatant = Combatant; - if ( DateTime.Now < m_NextAbilityTime || combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 3 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) ) + if ( DateTime.UtcNow < m_NextAbilityTime || combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 3 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) ) return; - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 30 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 30 ) ); if ( Utility.RandomBool() ) { diff --git a/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs b/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs index 3c0368c06..47c0394d7 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs @@ -129,7 +129,7 @@ namespace Server.Mobiles Animate( 111, 5, 1, true, false, 0 ); // Do a little dance... if ( AIObject != null ) - AIObject.NextMove = DateTime.Now + TimeSpan.FromSeconds( 1.0 ); + AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( 1.0 ); if ( list.Count >= 3 ) { @@ -140,7 +140,7 @@ namespace Server.Mobiles dancer.Animate( 111, 5, 1, true, false, 0 ); // Get down tonight... if ( dancer.AIObject != null ) - dancer.AIObject.NextMove = DateTime.Now + TimeSpan.FromSeconds( 1.0 ); + dancer.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds( 1.0 ); } Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( EndSavageDance ) ); diff --git a/Scripts/Mobiles/Monsters/Humanoid/Melee/KhaldunRevenant.cs b/Scripts/Mobiles/Monsters/Humanoid/Melee/KhaldunRevenant.cs index f8417ba72..9a2970a5a 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Melee/KhaldunRevenant.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Melee/KhaldunRevenant.cs @@ -72,7 +72,7 @@ namespace Server.Mobiles Hue = 0x41CE; m_Target = target; - m_ExpireTime = DateTime.Now + TimeSpan.FromMinutes( 10.0 ); + m_ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 10.0 ); SetStr( 401, 500 ); SetDex( 296, 315 ); @@ -129,7 +129,7 @@ namespace Server.Mobiles public override void OnThink() { - if ( !m_Target.Alive || DateTime.Now > m_ExpireTime ) + if ( !m_Target.Alive || DateTime.UtcNow > m_ExpireTime ) { Delete(); return; diff --git a/Scripts/Mobiles/Monsters/Humanoid/Melee/OrcBomber.cs b/Scripts/Mobiles/Monsters/Humanoid/Melee/OrcBomber.cs index e0ad3c987..f2fc699bc 100644 --- a/Scripts/Mobiles/Monsters/Humanoid/Melee/OrcBomber.cs +++ b/Scripts/Mobiles/Monsters/Humanoid/Melee/OrcBomber.cs @@ -102,16 +102,16 @@ namespace Server.Mobiles if ( combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 12 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) ) return; - if ( DateTime.Now >= m_NextBomb ) + if ( DateTime.UtcNow >= m_NextBomb ) { ThrowBomb( combatant ); m_Thrown++; if ( 0.75 >= Utility.RandomDouble() && (m_Thrown % 2) == 1 ) // 75% chance to quickly throw another bomb - m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 3.0 ); + m_NextBomb = DateTime.UtcNow + TimeSpan.FromSeconds( 3.0 ); else - m_NextBomb = DateTime.Now + TimeSpan.FromSeconds( 5.0 + (10.0 * Utility.RandomDouble()) ); // 5-15 seconds + m_NextBomb = DateTime.UtcNow + TimeSpan.FromSeconds( 5.0 + (10.0 * Utility.RandomDouble()) ); // 5-15 seconds } } diff --git a/Scripts/Mobiles/Monsters/LBR/Jukas/JukaMage.cs b/Scripts/Mobiles/Monsters/LBR/Jukas/JukaMage.cs index 23daccec3..caae1e9f7 100644 --- a/Scripts/Mobiles/Monsters/LBR/Jukas/JukaMage.cs +++ b/Scripts/Mobiles/Monsters/LBR/Jukas/JukaMage.cs @@ -67,7 +67,7 @@ namespace Server.Mobiles if ( Core.ML && Utility.RandomDouble() < .33 ) PackItem( Engines.Plants.Seed.RandomPeculiarSeed(4) ); - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); } public override void GenerateLoot() @@ -104,7 +104,7 @@ namespace Server.Mobiles public override void OnThink() { - if ( DateTime.Now >= m_NextAbilityTime ) + if ( DateTime.UtcNow >= m_NextAbilityTime ) { JukaLord toBuff = null; @@ -121,7 +121,7 @@ namespace Server.Mobiles { if ( CanBeBeneficial( toBuff ) && toBuff.BeginAction( typeof( JukaMage ) ) ) { - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 30, 60 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 30, 60 ) ); toBuff.Say( true, "Give me the power to destroy my enemies!" ); this.Say( true, "Fight well my lord!" ); @@ -164,7 +164,7 @@ namespace Server.Mobiles } else { - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); } } diff --git a/Scripts/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs b/Scripts/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs index 3b50d048a..03c037113 100644 --- a/Scripts/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs +++ b/Scripts/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs @@ -78,7 +78,7 @@ namespace Server.Mobiles AddItem( new Crossbow() ); PackItem( pack ); - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); } public override void GenerateLoot() @@ -117,9 +117,9 @@ namespace Server.Mobiles this.PlaySound( 0x1E9 ); } - if ( DateTime.Now >= m_NextAbilityTime ) + if ( DateTime.UtcNow >= m_NextAbilityTime ) { - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 10, 15 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 10, 15 ) ); ArrayList list = new ArrayList(); diff --git a/Scripts/Mobiles/Monsters/LBR/Meers/MeerEternal.cs b/Scripts/Mobiles/Monsters/LBR/Meers/MeerEternal.cs index e55ded024..8853d5adc 100644 --- a/Scripts/Mobiles/Monsters/LBR/Meers/MeerEternal.cs +++ b/Scripts/Mobiles/Monsters/LBR/Meers/MeerEternal.cs @@ -44,7 +44,7 @@ namespace Server.Mobiles VirtualArmor = 34; - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); } public override void GenerateLoot() @@ -174,13 +174,13 @@ namespace Server.Mobiles public override void OnThink() { - if ( DateTime.Now >= m_NextAbilityTime ) + if ( DateTime.UtcNow >= m_NextAbilityTime ) { Mobile combatant = this.Combatant; if ( combatant != null && combatant.Map == this.Map && combatant.InRange( this, 12 ) ) { - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 10, 15 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 10, 15 ) ); int ability = Utility.Random( 4 ); diff --git a/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs b/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs index abbbfac8d..2d7bd5a75 100644 --- a/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs +++ b/Scripts/Mobiles/Monsters/LBR/Meers/MeerMage.cs @@ -44,7 +44,7 @@ namespace Server.Mobiles VirtualArmor = 16; - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 2, 5 ) ); } public override void GenerateLoot() @@ -80,13 +80,13 @@ namespace Server.Mobiles public override void OnThink() { - if ( DateTime.Now >= m_NextAbilityTime ) + if ( DateTime.UtcNow >= m_NextAbilityTime ) { Mobile combatant = this.Combatant; if ( combatant != null && combatant.Map == this.Map && combatant.InRange( this, 12 ) && IsEnemy( combatant ) && !UnderEffect( combatant ) ) { - m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ); + m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) ); if( combatant is BaseCreature ) { diff --git a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/MLDryad.cs b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/MLDryad.cs index e68284621..6383cd3e9 100644 --- a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/MLDryad.cs +++ b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/MLDryad.cs @@ -75,7 +75,7 @@ namespace Server.Mobiles public void AreaPeace() { - if ( Combatant == null || Deleted || !Alive || m_NextPeace > DateTime.Now || 0.1 < Utility.RandomDouble() ) + if ( Combatant == null || Deleted || !Alive || m_NextPeace > DateTime.UtcNow || 0.1 < Utility.RandomDouble() ) return; TimeSpan duration = TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 80 ) ); @@ -86,20 +86,20 @@ namespace Server.Mobiles if ( IsValidTarget( p ) ) { - p.PeacedUntil = DateTime.Now + duration; + p.PeacedUntil = DateTime.UtcNow + duration; p.SendLocalizedMessage( 1072065 ); // You gaze upon the dryad's beauty, and forget to continue battling! p.FixedParticles( 0x376A, 1, 20, 0x7F5, EffectLayer.Waist ); p.Combatant = null; } } - m_NextPeace = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_NextPeace = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); PlaySound( 0x1D3 ); } public bool IsValidTarget( PlayerMobile m ) { - if ( m != null && m.PeacedUntil < DateTime.Now && !m.Hidden && m.AccessLevel == AccessLevel.Player && CanBeHarmful( m ) ) + if ( m != null && m.PeacedUntil < DateTime.UtcNow && !m.Hidden && m.AccessLevel == AccessLevel.Player && CanBeHarmful( m ) ) return true; return false; @@ -111,7 +111,7 @@ namespace Server.Mobiles public void AreaUndress() { - if ( Combatant == null || Deleted || !Alive || m_NextUndress > DateTime.Now || 0.005 < Utility.RandomDouble() ) + if ( Combatant == null || Deleted || !Alive || m_NextUndress > DateTime.UtcNow || 0.005 < Utility.RandomDouble() ) return; foreach ( Mobile m in GetMobilesInRange( RangePerception ) ) @@ -128,7 +128,7 @@ namespace Server.Mobiles } } - m_NextUndress = DateTime.Now + TimeSpan.FromMinutes( 1 ); + m_NextUndress = DateTime.UtcNow + TimeSpan.FromMinutes( 1 ); } public void UndressItem( Mobile m, Layer layer ) diff --git a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/Satyr.cs b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/Satyr.cs index 41ef4c82f..1e1839e41 100644 --- a/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/Satyr.cs +++ b/Scripts/Mobiles/Monsters/ML/Humanoid/Magic/Satyr.cs @@ -66,14 +66,14 @@ namespace Server.Mobiles public void Peace( Mobile target ) { - if ( target == null || Deleted || !Alive || m_NextPeace > DateTime.Now || 0.1 < Utility.RandomDouble() ) + if ( target == null || Deleted || !Alive || m_NextPeace > DateTime.UtcNow || 0.1 < Utility.RandomDouble() ) return; PlayerMobile p = target as PlayerMobile; - if ( p != null && p.PeacedUntil < DateTime.Now && !p.Hidden && CanBeHarmful( p ) ) + if ( p != null && p.PeacedUntil < DateTime.UtcNow && !p.Hidden && CanBeHarmful( p ) ) { - p.PeacedUntil = DateTime.Now + TimeSpan.FromMinutes( 1 ); + p.PeacedUntil = DateTime.UtcNow + TimeSpan.FromMinutes( 1 ); p.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling! p.FixedParticles( 0x376A, 1, 32, 0x15BD, EffectLayer.Waist ); p.Combatant = null; @@ -81,7 +81,7 @@ namespace Server.Mobiles PlaySound( 0x58D ); } - m_NextPeace = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_NextPeace = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); } #endregion @@ -91,7 +91,7 @@ namespace Server.Mobiles public void Suppress( Mobile target ) { - if ( target == null || m_Suppressed.ContainsKey( target ) || Deleted || !Alive || m_NextSuppress > DateTime.Now || 0.1 < Utility.RandomDouble() ) + if ( target == null || m_Suppressed.ContainsKey( target ) || Deleted || !Alive || m_NextSuppress > DateTime.UtcNow || 0.1 < Utility.RandomDouble() ) return; TimeSpan delay = TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 80 ) ); @@ -115,7 +115,7 @@ namespace Server.Mobiles PlaySound( 0x58C ); } - m_NextSuppress = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_NextSuppress = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); } public static void SuppressRemove( Mobile target ) @@ -159,7 +159,7 @@ namespace Server.Mobiles public void Undress( Mobile target ) { - if ( target == null || Deleted || !Alive || m_NextUndress > DateTime.Now || 0.005 < Utility.RandomDouble() ) + if ( target == null || Deleted || !Alive || m_NextUndress > DateTime.UtcNow || 0.005 < Utility.RandomDouble() ) return; if ( target.Player && target.Female && !target.Hidden && CanBeHarmful( target ) ) @@ -173,7 +173,7 @@ namespace Server.Mobiles target.SendLocalizedMessage( 1072196 ); // The satyr's music makes your blood race. Your clothing is too confining. } - m_NextUndress = DateTime.Now + TimeSpan.FromMinutes( 1 ); + m_NextUndress = DateTime.UtcNow + TimeSpan.FromMinutes( 1 ); } public void UndressItem( Mobile m, Layer layer ) @@ -190,7 +190,7 @@ namespace Server.Mobiles public void Provoke( Mobile target ) { - if ( target == null || Deleted || !Alive || m_NextProvoke > DateTime.Now || 0.05 < Utility.RandomDouble() ) + if ( target == null || Deleted || !Alive || m_NextProvoke > DateTime.UtcNow || 0.05 < Utility.RandomDouble() ) return; foreach ( Mobile m in GetMobilesInRange( RangePerception ) ) @@ -212,7 +212,7 @@ namespace Server.Mobiles } } - m_NextProvoke = DateTime.Now + TimeSpan.FromSeconds( 10 ); + m_NextProvoke = DateTime.UtcNow + TimeSpan.FromSeconds( 10 ); } #endregion diff --git a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs index 30e793dc7..84989a8c3 100644 --- a/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs +++ b/Scripts/Mobiles/Monsters/ML/Special/Ilhenir.cs @@ -256,7 +256,7 @@ namespace Server.Mobiles return m_Table[ from ] != null; } - private DateTime m_NextDrop = DateTime.Now; + private DateTime m_NextDrop = DateTime.UtcNow; public virtual void DropOoze() { diff --git a/Scripts/Mobiles/Monsters/ML/Twisted Weald/Changeling.cs b/Scripts/Mobiles/Monsters/ML/Twisted Weald/Changeling.cs index c2e5af1fa..02c7b81b1 100644 --- a/Scripts/Mobiles/Monsters/ML/Twisted Weald/Changeling.cs +++ b/Scripts/Mobiles/Monsters/ML/Twisted Weald/Changeling.cs @@ -95,7 +95,7 @@ namespace Server.Mobiles if ( value != null ) { Morph( value ); - m_LastMorph = DateTime.Now; + m_LastMorph = DateTime.UtcNow; } m_MorphedInto = value; @@ -110,10 +110,10 @@ namespace Server.Mobiles if ( Combatant != null ) { - if ( m_NextFireRing <= DateTime.Now && Utility.RandomDouble() < 0.02 ) + if ( m_NextFireRing <= DateTime.UtcNow && Utility.RandomDouble() < 0.02 ) { FireRing(); - m_NextFireRing = DateTime.Now + TimeSpan.FromMinutes( 2 ); + m_NextFireRing = DateTime.UtcNow + TimeSpan.FromMinutes( 2 ); } if ( Combatant.Player && m_MorphedInto != Combatant && Utility.RandomDouble() < 0.05 ) @@ -125,7 +125,7 @@ namespace Server.Mobiles { bool idle = base.CheckIdle(); - if ( idle && m_MorphedInto != null && DateTime.Now - m_LastMorph > TimeSpan.FromSeconds( 30 ) ) + if ( idle && m_MorphedInto != null && DateTime.UtcNow - m_LastMorph > TimeSpan.FromSeconds( 30 ) ) MorphedInto = null; return idle; diff --git a/Scripts/Mobiles/Monsters/Misc/Magic/EtherealWarrior.cs b/Scripts/Mobiles/Monsters/Misc/Magic/EtherealWarrior.cs index 8ccbfac4c..a07058528 100644 --- a/Scripts/Mobiles/Monsters/Misc/Magic/EtherealWarrior.cs +++ b/Scripts/Mobiles/Monsters/Misc/Magic/EtherealWarrior.cs @@ -61,9 +61,9 @@ namespace Server.Mobiles { if (!from.Alive && (from is PlayerMobile)) { - if (!from.Frozen && (DateTime.Now >= m_NextResurrect) && InRange(from, 4) && !InRange(oldLocation, 4) && InLOS(from)) + if (!from.Frozen && (DateTime.UtcNow >= m_NextResurrect) && InRange(from, 4) && !InRange(oldLocation, 4) && InLOS(from)) { - m_NextResurrect = DateTime.Now + ResurrectDelay; + m_NextResurrect = DateTime.UtcNow + ResurrectDelay; if (!from.Criminal && (from.Kills < 5) && (from.Karma > 0)) { if (from.Map != null && from.Map.CanFit(from.Location, 16, false, false)) diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs index 8b008246e..b0bfe0fd1 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/PlagueSpawn.cs @@ -51,7 +51,7 @@ namespace Server.Mobiles public override void OnThink() { - if ( m_Owner != null && ( DateTime.Now >= m_ExpireTime || m_Owner.Deleted || Map != m_Owner.Map || !InRange( m_Owner, 16 ) ) ) + if ( m_Owner != null && ( DateTime.UtcNow >= m_ExpireTime || m_Owner.Deleted || Map != m_Owner.Map || !InRange( m_Owner, 16 ) ) ) { PlaySound( GetIdleSound() ); Delete(); @@ -65,7 +65,7 @@ namespace Server.Mobiles public PlagueSpawn( Mobile owner ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 ) { m_Owner = owner; - m_ExpireTime = DateTime.Now + TimeSpan.FromMinutes( 1.0 ); + m_ExpireTime = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); Name = "a plague spawn"; Hue = Utility.Random( 0x11, 15 ); diff --git a/Scripts/Mobiles/Monsters/Misc/Melee/SandVortex.cs b/Scripts/Mobiles/Monsters/Misc/Melee/SandVortex.cs index 0bb27f9ab..f74aa58ca 100644 --- a/Scripts/Mobiles/Monsters/Misc/Melee/SandVortex.cs +++ b/Scripts/Mobiles/Monsters/Misc/Melee/SandVortex.cs @@ -56,10 +56,10 @@ namespace Server.Mobiles if ( combatant == null || combatant.Deleted || combatant.Map != Map || !InRange( combatant, 12 ) || !CanBeHarmful( combatant ) || !InLOS( combatant ) ) return; - if ( DateTime.Now >= m_NextAttack ) + if ( DateTime.UtcNow >= m_NextAttack ) { SandAttack( combatant ); - m_NextAttack = DateTime.Now + TimeSpan.FromSeconds( 10.0 + (10.0 * Utility.RandomDouble()) ); + m_NextAttack = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 + (10.0 * Utility.RandomDouble()) ); } } diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 790f2e9c5..30c61ab02 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -99,7 +99,7 @@ namespace Server.Mobiles public int Count { get { return m_Count; } - set { m_Count = value; m_Stamp = DateTime.Now; } + set { m_Count = value; m_Stamp = DateTime.UtcNow; } } } @@ -261,7 +261,7 @@ namespace Server.Mobiles } [CommandProperty( AccessLevel.GameMaster )] - public DateTime LastMoved + public int LastMoved { get{ return LastMoveTime; } } @@ -1132,13 +1132,13 @@ namespace Server.Mobiles if ( pm != null ) { - pm.m_SessionStart = DateTime.Now; + pm.m_SessionStart = DateTime.UtcNow; if ( pm.m_Quest != null ) pm.m_Quest.StartTimer(); pm.BedrollLogout = false; - pm.LastOnline = DateTime.Now; + pm.LastOnline = DateTime.UtcNow; } DisguiseTimers.StartTimer( e.Mobile ); @@ -1186,13 +1186,13 @@ namespace Server.Mobiles if ( pm != null ) { - pm.m_GameTime += (DateTime.Now - pm.m_SessionStart); + pm.m_GameTime += (DateTime.UtcNow - pm.m_SessionStart); if ( pm.m_Quest != null ) pm.m_Quest.StopTimer(); pm.m_SpeechLog = null; - pm.LastOnline = DateTime.Now; + pm.LastOnline = DateTime.UtcNow; } DisguiseTimers.StopTimer( from ); @@ -1447,7 +1447,7 @@ namespace Server.Mobiles } } - TimeSpan speed = ComputeMovementSpeed( d ); + int speed = ComputeMovementSpeed( d ); bool res; @@ -2778,7 +2778,7 @@ namespace Server.Mobiles Criminal = true; } - if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward ) + if ( this.Kills >= 5 && DateTime.UtcNow >= m_NextJustAward ) { Mobile m = FindMostRecentDamager( false ); @@ -2805,7 +2805,7 @@ namespace Server.Mobiles m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist ); m.PlaySound( 0x1F7 ); - m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain / 3 ); + m_NextJustAward = DateTime.UtcNow + TimeSpan.FromMinutes( pointsToGain / 3 ); } } } @@ -2891,7 +2891,7 @@ namespace Server.Mobiles { get { - TimeSpan ts = m_SavagePaintExpiration - DateTime.Now; + TimeSpan ts = m_SavagePaintExpiration - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -2900,7 +2900,7 @@ namespace Server.Mobiles } set { - m_SavagePaintExpiration = DateTime.Now + value; + m_SavagePaintExpiration = DateTime.UtcNow + value; } } @@ -2909,7 +2909,7 @@ namespace Server.Mobiles { get { - TimeSpan ts = m_NextSmithBulkOrder - DateTime.Now; + TimeSpan ts = m_NextSmithBulkOrder - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -2918,7 +2918,7 @@ namespace Server.Mobiles } set { - try{ m_NextSmithBulkOrder = DateTime.Now + value; } + try{ m_NextSmithBulkOrder = DateTime.UtcNow + value; } catch{} } } @@ -2928,7 +2928,7 @@ namespace Server.Mobiles { get { - TimeSpan ts = m_NextTailorBulkOrder - DateTime.Now; + TimeSpan ts = m_NextTailorBulkOrder - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -2937,7 +2937,7 @@ namespace Server.Mobiles } set { - try{ m_NextTailorBulkOrder = DateTime.Now + value; } + try{ m_NextTailorBulkOrder = DateTime.UtcNow + value; } catch{} } } @@ -3198,7 +3198,7 @@ namespace Server.Mobiles CountAndTimeStamp count = (CountAndTimeStamp)tbl[obj]; if ( count != null ) { - if ( count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now ) + if ( count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.UtcNow ) { count.Count = 1; return true; @@ -3517,7 +3517,7 @@ namespace Server.Mobiles ArrayList remove = new ArrayList(); foreach ( CountAndTimeStamp time in t.Values ) { - if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now ) + if ( time.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.UtcNow ) remove.Add( time ); } @@ -3682,7 +3682,7 @@ namespace Server.Mobiles get { if ( NetState != null ) - return m_GameTime + (DateTime.Now - m_SessionStart); + return m_GameTime + (DateTime.UtcNow - m_SessionStart); else return m_GameTime; } @@ -4071,13 +4071,14 @@ namespace Server.Mobiles #region Fastwalk Prevention private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled? - private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.4 ); // Fastwalk prevention will become active after 0.4 seconds + private static int FastwalkThreshold = 400; // Fastwalk prevention will become active after 0.4 seconds - private DateTime m_NextMovementTime; + private int m_NextMovementTime; + private bool m_HasMoved; public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } } - public override TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning ) + public override int ComputeMovementSpeed( Direction dir, bool checkTurning ) { if ( checkTurning && (dir & Direction.Mask) != (this.Direction & Direction.Mask) ) return Mobile.RunMount; // We are NOT actually moving (just a direction change) @@ -4106,19 +4107,20 @@ namespace Server.Mobiles if ( pm == null || !pm.UsesFastwalkPrevention ) return true; - if ( pm.m_NextMovementTime == DateTime.MinValue ) + if ( !pm.m_HasMoved ) { // has not yet moved - pm.m_NextMovementTime = DateTime.Now; + pm.m_NextMovementTime = Core.TickCount; + pm.m_HasMoved = true; return true; } - TimeSpan ts = pm.m_NextMovementTime - DateTime.Now; + int ts = pm.m_NextMovementTime - Core.TickCount; - if ( ts < TimeSpan.Zero ) + if ( ts < 0 ) { // been a while since we've last moved - pm.m_NextMovementTime = DateTime.Now; + pm.m_NextMovementTime = Core.TickCount; return true; } @@ -4352,9 +4354,9 @@ namespace Server.Mobiles if ( this.Quest != null && this.Quest.IgnoreYoungProtection( from ) ) return false; - if ( DateTime.Now - m_LastYoungMessage > TimeSpan.FromMinutes( 1.0 ) ) + if ( DateTime.UtcNow - m_LastYoungMessage > TimeSpan.FromMinutes( 1.0 ) ) { - m_LastYoungMessage = DateTime.Now; + m_LastYoungMessage = DateTime.UtcNow; SendLocalizedMessage( 1019067 ); // A monster looks at you menacingly but does not attack. You would be under attack now if not for your status as a new citizen of Britannia. } @@ -4365,9 +4367,9 @@ namespace Server.Mobiles public bool CheckYoungHealTime() { - if ( DateTime.Now - m_LastYoungHeal > TimeSpan.FromMinutes( 5.0 ) ) + if ( DateTime.UtcNow - m_LastYoungHeal > TimeSpan.FromMinutes( 5.0 ) ) { - m_LastYoungHeal = DateTime.Now; + m_LastYoungHeal = DateTime.UtcNow; return true; } @@ -4661,7 +4663,7 @@ namespace Server.Mobiles m_Values[index].Value -= value; if( before != m_Values[index].Value ) - m_Values[index].LastDecay = DateTime.Now; + m_Values[index].LastDecay = DateTime.UtcNow; } public override string ToString() @@ -4762,7 +4764,7 @@ namespace Server.Mobiles for( int i = 0; i < t.m_Values.Length; i++ ) { - if( (t.GetLastDecay( i ) + LossDelay) < DateTime.Now ) + if( (t.GetLastDecay( i ) + LossDelay) < DateTime.UtcNow ) { t.Atrophy( i, LossAmount ); } diff --git a/Scripts/Mobiles/Townfolk/BaseEscortable.cs b/Scripts/Mobiles/Townfolk/BaseEscortable.cs index d306e7e89..f47154529 100644 --- a/Scripts/Mobiles/Townfolk/BaseEscortable.cs +++ b/Scripts/Mobiles/Townfolk/BaseEscortable.cs @@ -262,19 +262,19 @@ namespace Server.Mobiles Say("I see you already have an escort."); return false; } - else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + EscortDelay) >= DateTime.Now) + else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + EscortDelay) >= DateTime.UtcNow) { - int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + EscortDelay) - DateTime.Now).TotalMinutes); + int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + EscortDelay) - DateTime.UtcNow).TotalMinutes); Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s"); return false; } else if (SetControlMaster(m)) { - m_LastSeenEscorter = DateTime.Now; + m_LastSeenEscorter = DateTime.UtcNow; if (m is PlayerMobile) - ((PlayerMobile)m).LastEscortTime = DateTime.Now; + ((PlayerMobile)m).LastEscortTime = DateTime.UtcNow; Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name); m_EscortTable[m] = this; @@ -389,7 +389,7 @@ namespace Server.Mobiles { StopFollow(); - TimeSpan lastSeenDelay = DateTime.Now - m_LastSeenEscorter; + TimeSpan lastSeenDelay = DateTime.UtcNow - m_LastSeenEscorter; if (lastSeenDelay >= AbandonDelay) { @@ -412,7 +412,7 @@ namespace Server.Mobiles if (ControlOrder != OrderType.Follow) StartFollow(master); - m_LastSeenEscorter = DateTime.Now; + m_LastSeenEscorter = DateTime.UtcNow; return master; } @@ -421,9 +421,9 @@ namespace Server.Mobiles if (m_DeleteTimer != null) m_DeleteTimer.Stop(); - m_DeleteTime = DateTime.Now + DeleteTime; + m_DeleteTime = DateTime.UtcNow + DeleteTime; - m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.Now); + m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.UtcNow); m_DeleteTimer.Start(); } @@ -473,7 +473,7 @@ namespace Server.Mobiles if (pm != null) { - if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay) + if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay) { pm.NextCompassionDay = DateTime.MinValue; pm.CompassionGains = 0; @@ -490,7 +490,7 @@ namespace Server.Mobiles else pm.SendLocalizedMessage(1053002); // You have gained in compassion. - pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 + pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0 ++pm.CompassionGains; if (pm.CompassionGains >= 5) @@ -553,7 +553,7 @@ namespace Server.Mobiles if (reader.ReadBool()) { m_DeleteTime = reader.ReadDeltaTime(); - m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.Now); + m_DeleteTimer = new DeleteTimer(this, m_DeleteTime - DateTime.UtcNow); m_DeleteTimer.Start(); } diff --git a/Scripts/Mobiles/Townfolk/TownCrier.cs b/Scripts/Mobiles/Townfolk/TownCrier.cs index f8c8ab0f7..6479d228c 100644 --- a/Scripts/Mobiles/Townfolk/TownCrier.cs +++ b/Scripts/Mobiles/Townfolk/TownCrier.cs @@ -117,7 +117,7 @@ namespace Server.Mobiles public string[] Lines{ get{ return m_Lines; } } public DateTime ExpireTime{ get{ return m_ExpireTime; } } - public bool Expired{ get{ return ( DateTime.Now >= m_ExpireTime ); } } + public bool Expired{ get{ return ( DateTime.UtcNow >= m_ExpireTime ); } } public TownCrierEntry( string[] lines, TimeSpan duration ) { @@ -128,7 +128,7 @@ namespace Server.Mobiles else if ( duration > TimeSpan.FromDays( 365.0 ) ) duration = TimeSpan.FromDays( 365.0 ); - m_ExpireTime = DateTime.Now + duration; + m_ExpireTime = DateTime.UtcNow + duration; } } @@ -233,7 +233,7 @@ namespace Server.Mobiles if ( entries != null && index < entries.Count ) { TownCrierEntry tce = entries[index]; - TimeSpan ts = tce.ExpireTime - DateTime.Now; + TimeSpan ts = tce.ExpireTime - DateTime.UtcNow; if ( ts < TimeSpan.Zero ) ts = TimeSpan.Zero; @@ -280,7 +280,7 @@ namespace Server.Mobiles { TownCrierEntry tce = (TownCrierEntry)entries[i]; - TimeSpan toExpire = tce.ExpireTime - DateTime.Now; + TimeSpan toExpire = tce.ExpireTime - DateTime.UtcNow; if ( toExpire < TimeSpan.Zero ) toExpire = TimeSpan.Zero; diff --git a/Scripts/Mobiles/Vendors/BaseVendor.cs b/Scripts/Mobiles/Vendors/BaseVendor.cs index 98c798106..7cb06abb7 100644 --- a/Scripts/Mobiles/Vendors/BaseVendor.cs +++ b/Scripts/Mobiles/Vendors/BaseVendor.cs @@ -176,7 +176,7 @@ namespace Server.Mobiles pack.Visible = false; AddItem( pack ); - m_LastRestock = DateTime.Now; + m_LastRestock = DateTime.UtcNow; } public BaseVendor( Serial serial ) @@ -228,7 +228,7 @@ namespace Server.Mobiles protected void LoadSBInfo() { - m_LastRestock = DateTime.Now; + m_LastRestock = DateTime.UtcNow; for ( int i = 0; i < m_ArmorBuyInfo.Count; ++i ) { @@ -510,7 +510,7 @@ namespace Server.Mobiles public virtual void Restock() { - m_LastRestock = DateTime.Now; + m_LastRestock = DateTime.UtcNow; IBuyItemInfo[] buyInfo = this.GetBuyInfo(); @@ -534,7 +534,7 @@ namespace Server.Mobiles return; } - if ( DateTime.Now - m_LastRestock > RestockDelay ) + if ( DateTime.UtcNow - m_LastRestock > RestockDelay ) Restock(); UpdateBuyInfo(); @@ -583,7 +583,7 @@ namespace Server.Mobiles Item item = playerItems[i]; - if ( ( item.LastMoved + InventoryDecayTime ) <= DateTime.Now ) + if ( ( item.LastMoved + InventoryDecayTime ) <= DateTime.UtcNow ) item.Delete(); } @@ -747,7 +747,7 @@ namespace Server.Mobiles { PlayerMobile pm = from as PlayerMobile; - if ( Core.ML && pm != null && pm.NextBODTurnInTime > DateTime.Now ) + if ( Core.ML && pm != null && pm.NextBODTurnInTime > DateTime.UtcNow ) { SayTo( from, 1079976 ); // You'll have to wait a few seconds while I inspect the last order. return false; @@ -788,7 +788,7 @@ namespace Server.Mobiles OnSuccessfulBulkOrderReceive( from ); if ( Core.ML && pm != null ) - pm.NextBODTurnInTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + pm.NextBODTurnInTime = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); dropped.Delete(); return true; diff --git a/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs b/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs index f4c9c3bd0..4dad18648 100644 --- a/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs +++ b/Scripts/Mobiles/Vendors/NPC/Guildmasters/BaseGuildmaster.cs @@ -75,7 +75,7 @@ namespace Server.Mobiles SayTo( from, 501047 ); // Thou art already a member of our guild. else if ( pm.NpcGuild != NpcGuild.None ) SayTo( from, 501046 ); // Thou must resign from thy other guild first. - else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now ) + else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow ) SayTo( from, 501048 ); // You are too young to join my guild... else if ( CheckCustomReqs( pm ) ) SayPriceTo( from ); @@ -88,7 +88,7 @@ namespace Server.Mobiles { SayTo( from, 501052 ); // Thou dost not belong to my guild! } - else if ( (pm.NpcGuildJoinTime + QuitAge) > DateTime.Now || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime ) + else if ( (pm.NpcGuildJoinTime + QuitAge) > DateTime.UtcNow || (pm.NpcGuildGameTime + QuitGameAge) > pm.GameTime ) { SayTo( from, 501053 ); // You just joined my guild! You must wait a week to resign. } @@ -119,7 +119,7 @@ namespace Server.Mobiles { SayTo( from, 501046 ); // Thou must resign from thy other guild first. } - else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.Now ) + else if ( pm.GameTime < JoinGameAge || (pm.CreationTime + JoinAge) > DateTime.UtcNow ) { SayTo( from, 501048 ); // You are too young to join my guild... } @@ -128,7 +128,7 @@ namespace Server.Mobiles SayWelcomeTo( from ); pm.NpcGuild = this.NpcGuild; - pm.NpcGuildJoinTime = DateTime.Now; + pm.NpcGuildJoinTime = DateTime.UtcNow; pm.NpcGuildGameTime = pm.GameTime; dropped.Delete(); diff --git a/Scripts/Mobiles/Vendors/NPC/RealEstateBroker.cs b/Scripts/Mobiles/Vendors/NPC/RealEstateBroker.cs index 53a7d3c3e..ef8a748e0 100644 --- a/Scripts/Mobiles/Vendors/NPC/RealEstateBroker.cs +++ b/Scripts/Mobiles/Vendors/NPC/RealEstateBroker.cs @@ -31,13 +31,13 @@ namespace Server.Mobiles public override void OnMovement( Mobile m, Point3D oldLocation ) { - if ( DateTime.Now > m_NextCheckPack && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && m.Player ) + if ( DateTime.UtcNow > m_NextCheckPack && InRange( m, 4 ) && !InRange( oldLocation, 4 ) && m.Player ) { Container pack = m.Backpack; if ( pack != null ) { - m_NextCheckPack = DateTime.Now + TimeSpan.FromSeconds( 2.0 ); + m_NextCheckPack = DateTime.UtcNow + TimeSpan.FromSeconds( 2.0 ); Item deed = pack.FindItemByType( typeof( HouseDeed ), false ); diff --git a/Scripts/Mobiles/Vendors/NPC/Scribe.cs b/Scripts/Mobiles/Vendors/NPC/Scribe.cs index 5872a686e..e705b519c 100644 --- a/Scripts/Mobiles/Vendors/NPC/Scribe.cs +++ b/Scripts/Mobiles/Vendors/NPC/Scribe.cs @@ -47,14 +47,14 @@ namespace Server.Mobiles { base.OnSpeech( e ); - if ( !e.Handled && m_NextShush <= DateTime.Now && InLOS( e.Mobile ) ) + if ( !e.Handled && m_NextShush <= DateTime.UtcNow && InLOS( e.Mobile ) ) { Direction = GetDirectionTo( e.Mobile ); PlaySound( Female ? 0x32F : 0x441 ); PublicOverheadMessage( Network.MessageType.Regular, 0x3B2, 1073990 ); // Shhhh! - m_NextShush = DateTime.Now + ShushDelay; + m_NextShush = DateTime.UtcNow + ShushDelay; e.Handled = true; } } diff --git a/Scripts/Mobiles/Vendors/PlayerVendor.cs b/Scripts/Mobiles/Vendors/PlayerVendor.cs index fb8c72952..82a3dfd83 100644 --- a/Scripts/Mobiles/Vendors/PlayerVendor.cs +++ b/Scripts/Mobiles/Vendors/PlayerVendor.cs @@ -325,7 +325,7 @@ namespace Server.Mobiles m_PayTimer = new PayTimer( this, delay ); m_PayTimer.Start(); - m_NextPayTime = DateTime.Now + delay; + m_NextPayTime = DateTime.UtcNow + delay; } public PlayerVendor( Serial serial ) : base( serial ) @@ -397,7 +397,7 @@ namespace Server.Mobiles string description = reader.ReadString(); - DateTime created = version < 1 ? DateTime.Now : reader.ReadDateTime(); + DateTime created = version < 1 ? DateTime.UtcNow : reader.ReadDateTime(); if ( item != null ) { @@ -423,7 +423,7 @@ namespace Server.Mobiles Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixDresswear ) ); } - m_NextPayTime = DateTime.Now + PayTimer.GetInterval(); + m_NextPayTime = DateTime.UtcNow + PayTimer.GetInterval(); if ( newVendorSystemActivated ) { @@ -435,7 +435,7 @@ namespace Server.Mobiles if ( version < 2 && RawStr == 75 && RawDex == 75 && RawInt == 75 ) InitStats( 100, 100, 25 ); - TimeSpan delay = m_NextPayTime - DateTime.Now; + TimeSpan delay = m_NextPayTime - DateTime.UtcNow; m_PayTimer = new PayTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_PayTimer.Start(); @@ -784,7 +784,7 @@ namespace Server.Mobiles private VendorItem SetVendorItem( Item item, int price, string description ) { - return SetVendorItem( item, price, description, DateTime.Now ); + return SetVendorItem( item, price, description, DateTime.UtcNow ); } private VendorItem SetVendorItem( Item item, int price, string description, DateTime created ) @@ -1109,7 +1109,7 @@ namespace Server.Mobiles { vendor.SayTo( from, 503202 ); // This item is not for sale. } - else if ( vi.Created + TimeSpan.FromMinutes( 1.0 ) > DateTime.Now ) + else if ( vi.Created + TimeSpan.FromMinutes( 1.0 ) > DateTime.UtcNow ) { from.SendMessage( "You cannot buy this item right now. Please wait one minute and try again." ); } @@ -1388,7 +1388,7 @@ namespace Server.Mobiles protected override void OnTick() { - m_Vendor.m_NextPayTime = DateTime.Now + this.Interval; + m_Vendor.m_NextPayTime = DateTime.UtcNow + this.Interval; int pay; int totalGold; diff --git a/Scripts/Mobiles/Vendors/RentedVendor.cs b/Scripts/Mobiles/Vendors/RentedVendor.cs index 0c88035b7..e00217d01 100644 --- a/Scripts/Mobiles/Vendors/RentedVendor.cs +++ b/Scripts/Mobiles/Vendors/RentedVendor.cs @@ -69,7 +69,7 @@ namespace Server.Mobiles m_RentalGold = rentalGold; - m_RentalExpireTime = DateTime.Now + duration.Duration; + m_RentalExpireTime = DateTime.UtcNow + duration.Duration; m_RentalExpireTimer = new RentalExpireTimer( this, duration.Duration ); m_RentalExpireTimer.Start(); } @@ -154,7 +154,7 @@ namespace Server.Mobiles public void ComputeRentalExpireDelay( out int days, out int hours ) { - TimeSpan delay = RentalExpireTime - DateTime.Now; + TimeSpan delay = RentalExpireTime - DateTime.UtcNow; if ( delay <= TimeSpan.Zero ) { @@ -388,7 +388,7 @@ namespace Server.Mobiles m_RentalExpireTime = reader.ReadDeltaTime(); - TimeSpan delay = m_RentalExpireTime - DateTime.Now; + TimeSpan delay = m_RentalExpireTime - DateTime.UtcNow; m_RentalExpireTimer = new RentalExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_RentalExpireTimer.Start(); } @@ -415,7 +415,7 @@ namespace Server.Mobiles m_Vendor.RentalPrice = renewalPrice; - m_Vendor.m_RentalExpireTime = DateTime.Now + m_Vendor.RentalDuration.Duration; + m_Vendor.m_RentalExpireTime = DateTime.UtcNow + m_Vendor.RentalDuration.Duration; } else { diff --git a/Scripts/Mobiles/Vendors/VendorInventory.cs b/Scripts/Mobiles/Vendors/VendorInventory.cs index 92f39cdd8..2893e5c5f 100644 --- a/Scripts/Mobiles/Vendors/VendorInventory.cs +++ b/Scripts/Mobiles/Vendors/VendorInventory.cs @@ -29,7 +29,7 @@ namespace Server.Mobiles m_Items = new List(); - m_ExpireTime = DateTime.Now + GracePeriod; + m_ExpireTime = DateTime.UtcNow + GracePeriod; m_ExpireTimer = new ExpireTimer( this, GracePeriod ); m_ExpireTimer.Start(); } @@ -131,7 +131,7 @@ namespace Server.Mobiles } else { - TimeSpan delay = m_ExpireTime - DateTime.Now; + TimeSpan delay = m_ExpireTime - DateTime.UtcNow; m_ExpireTimer = new ExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero ); m_ExpireTimer.Start(); } diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index cff6c18fb..069bfe6f2 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -47,7 +47,7 @@ namespace Server.Multis m_CurrentStage = level; if ( DynamicDecay.Decays( level ) ) - m_NextDecayStage = DateTime.Now + DynamicDecay.GetRandomDuration( level ); + m_NextDecayStage = DateTime.UtcNow + DynamicDecay.GetRandomDuration( level ); else m_NextDecayStage = DateTime.MinValue; } @@ -171,14 +171,14 @@ namespace Server.Multis if ( DynamicDecay.Enabled ) ResetDynamicDecay(); - m_LastRefreshed = DateTime.Now; + m_LastRefreshed = DateTime.UtcNow; result = DecayLevel.Ageless; } else if ( DynamicDecay.Enabled ) { DecayLevel stage = m_CurrentStage; - if ( stage == DecayLevel.Ageless || ( DynamicDecay.Decays( stage ) && m_NextDecayStage <= DateTime.Now ) ) + if ( stage == DecayLevel.Ageless || ( DynamicDecay.Decays( stage ) && m_NextDecayStage <= DateTime.UtcNow ) ) SetDynamicDecay( ++stage ); if ( stage == DecayLevel.Collapsed && ( HasRentedVendors || VendorInventories.Count > 0 ) ) @@ -205,7 +205,7 @@ namespace Server.Multis public DecayLevel GetOldDecayLevel() { - TimeSpan timeAfterRefresh = DateTime.Now - m_LastRefreshed; + TimeSpan timeAfterRefresh = DateTime.UtcNow - m_LastRefreshed; int percent = (int) ((timeAfterRefresh.Ticks * 1000) / DecayPeriod.Ticks); if ( percent >= 1000 ) // 100.0% @@ -231,7 +231,7 @@ namespace Server.Multis DecayLevel oldLevel = this.DecayLevel; - m_LastRefreshed = DateTime.Now; + m_LastRefreshed = DateTime.UtcNow; if ( DynamicDecay.Enabled ) ResetDynamicDecay(); @@ -1217,9 +1217,9 @@ namespace Server.Multis { m_AllHouses.Add( this ); - m_LastRefreshed = DateTime.Now; + m_LastRefreshed = DateTime.UtcNow; - m_BuiltOn = DateTime.Now; + m_BuiltOn = DateTime.UtcNow; m_LastTraded = DateTime.MinValue; m_Doors = new ArrayList(); @@ -1763,7 +1763,7 @@ namespace Server.Multis m_House.Friends.Clear(); m_House.CoOwners.Clear(); m_House.ChangeLocks( to ); - m_House.LastTraded = DateTime.Now; + m_House.LastTraded = DateTime.UtcNow; } } @@ -2020,7 +2020,7 @@ namespace Server.Multis Guild attackerGuild = m.Guild as Guild; Guild defenderGuild = info.Defender.Guild as Guild; - if ( info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < HouseRegion.CombatHeatDelay && (attackerGuild == null || defenderGuild == null || defenderGuild != attackerGuild && !defenderGuild.IsEnemy( attackerGuild )) ) + if ( info.Defender.Player && info.Defender.Alive && (DateTime.UtcNow - info.LastCombatTime) < HouseRegion.CombatHeatDelay && (attackerGuild == null || defenderGuild == null || defenderGuild != attackerGuild && !defenderGuild.IsEnemy( attackerGuild )) ) return true; } @@ -2506,7 +2506,7 @@ namespace Server.Multis { Item child = children[j]; - if ( child.Decays && !child.IsLockedDown && !child.IsSecure && (child.LastMoved + child.DecayTime) <= DateTime.Now ) + if ( child.Decays && !child.IsLockedDown && !child.IsSecure && (child.LastMoved + child.DecayTime) <= DateTime.UtcNow ) Timer.DelayCall( TimeSpan.Zero, new TimerCallback( child.Delete ) ); } } @@ -2728,7 +2728,7 @@ namespace Server.Multis } if ( version < 11 ) - m_LastRefreshed = DateTime.Now + TimeSpan.FromHours( 24 * Utility.RandomDouble() ); + m_LastRefreshed = DateTime.UtcNow + TimeSpan.FromHours( 24 * Utility.RandomDouble() ); if ( DynamicDecay.Enabled && !loadedDynamicDecay ) { diff --git a/Scripts/Multis/Boats/BaseBoat.cs b/Scripts/Multis/Boats/BaseBoat.cs index 1fe6ae7d2..4810ed655 100644 --- a/Scripts/Multis/Boats/BaseBoat.cs +++ b/Scripts/Multis/Boats/BaseBoat.cs @@ -114,19 +114,19 @@ namespace Server.Multis { DateTime start = TimeOfDecay - BoatDecayDelay; - if ( DateTime.Now - start < TimeSpan.FromHours( 1.0 ) ) + if ( DateTime.UtcNow - start < TimeSpan.FromHours( 1.0 ) ) return 1043010; // This structure is like new. - if ( DateTime.Now - start < TimeSpan.FromDays( 2.0 ) ) + if ( DateTime.UtcNow - start < TimeSpan.FromDays( 2.0 ) ) return 1043011; // This structure is slightly worn. - if ( DateTime.Now - start < TimeSpan.FromDays( 3.0 ) ) + if ( DateTime.UtcNow - start < TimeSpan.FromDays( 3.0 ) ) return 1043012; // This structure is somewhat worn. - if ( DateTime.Now - start < TimeSpan.FromDays( 4.0 ) ) + if ( DateTime.UtcNow - start < TimeSpan.FromDays( 4.0 ) ) return 1043013; // This structure is fairly worn. - if ( DateTime.Now - start < TimeSpan.FromDays( 5.0 ) ) + if ( DateTime.UtcNow - start < TimeSpan.FromDays( 5.0 ) ) return 1043014; // This structure is greatly worn. return 1043015; // This structure is in danger of collapsing. @@ -152,7 +152,7 @@ namespace Server.Multis public BaseBoat() : base( 0x0 ) { - m_DecayTime = DateTime.Now + BoatDecayDelay; + m_DecayTime = DateTime.UtcNow + BoatDecayDelay; m_TillerMan = new TillerMan( this ); m_Hold = new Hold( this ); @@ -465,7 +465,7 @@ namespace Server.Multis public void Refresh() { - m_DecayTime = DateTime.Now + BoatDecayDelay; + m_DecayTime = DateTime.UtcNow + BoatDecayDelay; if( m_TillerMan != null ) m_TillerMan.InvalidateProperties(); @@ -507,7 +507,7 @@ namespace Server.Multis if ( m_Decaying ) return true; - if ( !IsMoving && DateTime.Now >= m_DecayTime ) + if ( !IsMoving && DateTime.UtcNow >= m_DecayTime ) { new DecayTimer( this ).Start(); diff --git a/Scripts/Multis/Camps/BaseCamp.cs b/Scripts/Multis/Camps/BaseCamp.cs index 60afb0a42..f6814aa4e 100644 --- a/Scripts/Multis/Camps/BaseCamp.cs +++ b/Scripts/Multis/Camps/BaseCamp.cs @@ -61,7 +61,7 @@ namespace Server.Multis m_DecayTimer.Stop(); if ( setDecayTime ) - m_DecayTime = DateTime.Now + DecayDelay; + m_DecayTime = DateTime.UtcNow + DecayDelay; m_DecayTimer = Timer.DelayCall( DecayDelay, new TimerCallback( Delete ) ); } diff --git a/Scripts/Multis/HouseSign.cs b/Scripts/Multis/HouseSign.cs index 179e6fa49..9b1e3fea9 100644 --- a/Scripts/Multis/HouseSign.cs +++ b/Scripts/Multis/HouseSign.cs @@ -165,7 +165,7 @@ namespace Server.Multis if ( canClaim && !BaseHouse.HasAccountHouse( from ) ) { m_Owner.Owner = from; - m_Owner.LastTraded = DateTime.Now; + m_Owner.LastTraded = DateTime.UtcNow; } } diff --git a/Scripts/Regions/HouseRegion.cs b/Scripts/Regions/HouseRegion.cs index 1bd95854d..c1db4cb7f 100644 --- a/Scripts/Regions/HouseRegion.cs +++ b/Scripts/Regions/HouseRegion.cs @@ -216,7 +216,7 @@ namespace Server.Regions { AggressorInfo info = m.Aggressed[i]; - if ( info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay ) + if ( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) return base.GetLogoutDelay( m ); } @@ -249,7 +249,7 @@ namespace Server.Regions { from.SendLocalizedMessage( 500295 ); // you are too far away to do that. } - else if ( DateTime.Now <= m_House.BuiltOn.AddHours ( 1 ) ) + else if ( DateTime.UtcNow <= m_House.BuiltOn.AddHours ( 1 ) ) { from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition. } diff --git a/Scripts/Regions/Spawning/SpawnEntry.cs b/Scripts/Regions/Spawning/SpawnEntry.cs index 51226bae0..1b88e25bb 100644 --- a/Scripts/Regions/Spawning/SpawnEntry.cs +++ b/Scripts/Regions/Spawning/SpawnEntry.cs @@ -144,7 +144,7 @@ namespace Server.Regions { TimeSpan time = RandomTime(); m_SpawnTimer = Timer.DelayCall( time, new TimerCallback( TimerCallback ) ); - m_NextSpawn = DateTime.Now + time; + m_NextSpawn = DateTime.UtcNow + time; } } else if ( m_SpawnTimer != null ) @@ -264,7 +264,7 @@ namespace Server.Regions if ( m_SpawnTimer != null ) m_SpawnTimer.Stop(); - TimeSpan delay = m_NextSpawn - DateTime.Now; + TimeSpan delay = m_NextSpawn - DateTime.UtcNow; m_SpawnTimer = Timer.DelayCall( delay > TimeSpan.Zero ? delay : TimeSpan.Zero, new TimerCallback( TimerCallback ) ); } } diff --git a/Scripts/Skills/AnimalTaming.cs b/Scripts/Skills/AnimalTaming.cs index 6eaf9e6b3..0d02d7bf7 100644 --- a/Scripts/Skills/AnimalTaming.cs +++ b/Scripts/Skills/AnimalTaming.cs @@ -113,8 +113,8 @@ namespace Server.SkillHandlers protected override void OnTargetFinish( Mobile from ) { - if ( m_SetSkillTime ) - from.NextSkillTime = DateTime.Now; + if (m_SetSkillTime) + from.NextSkillTime = Core.TickCount; } public virtual void ResetPacify( object obj ) @@ -198,7 +198,7 @@ namespace Server.SkillHandlers } else { - creature.BardEndTime = DateTime.Now; + creature.BardEndTime = DateTime.UtcNow; } creature.BardPacified = false; @@ -252,7 +252,7 @@ namespace Server.SkillHandlers m_Creature = creature; m_MaxCount = count; m_Paralyzed = creature.Paralyzed; - m_StartTime = DateTime.Now; + m_StartTime = DateTime.UtcNow; Priority = TimerPriority.TwoFiftyMS; } @@ -266,56 +266,56 @@ namespace Server.SkillHandlers if ( !m_Tamer.InRange( m_Creature, Core.AOS ? 7 : 6 ) ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState ); // You are too far away to continue taming. Stop(); } else if ( !m_Tamer.CheckAlive() ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState ); // You are dead, and cannot continue taming. Stop(); } else if ( !m_Tamer.CanSee( m_Creature ) || !m_Tamer.InLOS( m_Creature ) || !CanPath() ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Tamer.SendLocalizedMessage( 1049654 ); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if ( !m_Creature.Tamable ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState ); // That creature cannot be tamed. Stop(); } else if ( m_Creature.Controlled ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState ); // That animal looks tame already. Stop(); } else if ( m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains( m_Tamer ) ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState ); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if ( MustBeSubdued( m_Creature ) ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState ); // You must subdue this creature before you can tame it! Stop(); } else if ( de != null && de.LastDamage > m_StartTime ) { m_BeingTamed.Remove( m_Creature ); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState ); // The animal is too angry to continue taming. Stop(); } @@ -339,7 +339,7 @@ namespace Server.SkillHandlers else { m_Tamer.RevealingAction(); - m_Tamer.NextSkillTime = DateTime.Now; + m_Tamer.NextSkillTime = Core.TickCount; m_BeingTamed.Remove( m_Creature ); if ( m_Creature.Paralyzed ) diff --git a/Scripts/Skills/Begging.cs b/Scripts/Skills/Begging.cs index 518efbc85..00517567c 100644 --- a/Scripts/Skills/Begging.cs +++ b/Scripts/Skills/Begging.cs @@ -37,7 +37,7 @@ namespace Server.SkillHandlers protected override void OnTargetFinish( Mobile from ) { if ( m_SetSkillTime ) - from.NextSkillTime = DateTime.Now; + from.NextSkillTime = Core.TickCount; } protected override void OnTarget( Mobile from, object targeted ) @@ -167,7 +167,7 @@ namespace Server.SkillHandlers m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money. } - m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_From.NextSkillTime = Core.TickCount + 10000; } } } diff --git a/Scripts/Skills/Discordance.cs b/Scripts/Skills/Discordance.cs index dfa3ea175..d7fc10f65 100644 --- a/Scripts/Skills/Discordance.cs +++ b/Scripts/Skills/Discordance.cs @@ -27,7 +27,7 @@ namespace Server.SkillHandlers from.RevealingAction(); from.SendLocalizedMessage( 1049541 ); // Choose the target for your song of discordance. from.Target = new DiscordanceTarget( from, instrument ); - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 ); + from.NextSkillTime = Core.TickCount + 6000; } private class DiscordanceInfo @@ -44,7 +44,7 @@ namespace Server.SkillHandlers { m_From = from; m_Creature = creature; - m_EndTime = DateTime.Now; + m_EndTime = DateTime.UtcNow; m_Ending = false; m_Effect = effect; m_Mods = mods; @@ -115,7 +115,7 @@ namespace Server.SkillHandlers ends = true; } - if ( ends && info.m_Ending && info.m_EndTime < DateTime.Now ) + if ( ends && info.m_Ending && info.m_EndTime < DateTime.UtcNow ) { if ( info.m_Timer != null ) info.m_Timer.Stop(); @@ -128,12 +128,12 @@ namespace Server.SkillHandlers if ( ends && !info.m_Ending ) { info.m_Ending = true; - info.m_EndTime = DateTime.Now + TimeSpan.FromSeconds( 15 ); + info.m_EndTime = DateTime.UtcNow + TimeSpan.FromSeconds( 15 ); } else if ( !ends ) { info.m_Ending = false; - info.m_EndTime = DateTime.Now; + info.m_EndTime = DateTime.UtcNow; } targ.FixedEffect( 0x376A, 1, 32 ); @@ -152,7 +152,7 @@ namespace Server.SkillHandlers protected override void OnTarget( Mobile from, object target ) { from.RevealingAction(); - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 1.0 ); + from.NextSkillTime = Core.TickCount + 1000; if ( !m_Instrument.IsChildOf( from.Backpack ) ) { @@ -248,7 +248,7 @@ namespace Server.SkillHandlers m_Instrument.ConsumeUse( from ); } - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 12.0 ); + from.NextSkillTime = Core.TickCount + 12000; } else { diff --git a/Scripts/Skills/Peacemaking.cs b/Scripts/Skills/Peacemaking.cs index d453ca483..e4cdb2ede 100644 --- a/Scripts/Skills/Peacemaking.cs +++ b/Scripts/Skills/Peacemaking.cs @@ -27,7 +27,7 @@ namespace Server.SkillHandlers from.RevealingAction(); from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm? from.Target = new InternalTarget( from, instrument ); - from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 ); + from.NextSkillTime = Core.TickCount + 21600000; } private class InternalTarget : Target @@ -43,7 +43,7 @@ namespace Server.SkillHandlers protected override void OnTargetFinish( Mobile from ) { if ( m_SetSkillTime ) - from.NextSkillTime = DateTime.Now; + from.NextSkillTime = Core.TickCount; } protected override void OnTarget( Mobile from, object targeted ) @@ -69,7 +69,7 @@ namespace Server.SkillHandlers else { m_SetSkillTime = false; - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + from.NextSkillTime = Core.TickCount + 10000; if ( targeted == from ) { @@ -89,7 +89,7 @@ namespace Server.SkillHandlers } else { - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 ); + from.NextSkillTime = Core.TickCount + 5000; m_Instrument.PlayInstrumentWell( from ); m_Instrument.ConsumeUse( from ); @@ -113,7 +113,7 @@ namespace Server.SkillHandlers m.Warmode = false; if ( m is BaseCreature && !((BaseCreature)m).BardPacified ) - ((BaseCreature)m).Pacify( from, DateTime.Now + TimeSpan.FromSeconds( 1.0 ) ); + ((BaseCreature)m).Pacify( from, DateTime.UtcNow + TimeSpan.FromSeconds( 1.0 ) ); } if ( !calmed ) @@ -147,7 +147,7 @@ namespace Server.SkillHandlers else if ( !BaseInstrument.CheckMusicianship( from ) ) { from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect. - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 ); + from.NextSkillTime = Core.TickCount + 5000; m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); } @@ -170,7 +170,7 @@ namespace Server.SkillHandlers m_Instrument.PlayInstrumentWell( from ); m_Instrument.ConsumeUse( from ); - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 ); + from.NextSkillTime = Core.TickCount + 5000; if ( targ is BaseCreature ) { BaseCreature bc = (BaseCreature)targ; @@ -187,7 +187,7 @@ namespace Server.SkillHandlers else if ( seconds < 10 ) seconds = 10; - bc.Pacify( from, DateTime.Now + TimeSpan.FromSeconds( seconds ) ); + bc.Pacify( from, DateTime.UtcNow + TimeSpan.FromSeconds( seconds ) ); } else { diff --git a/Scripts/Skills/Provocation.cs b/Scripts/Skills/Provocation.cs index 924799c09..c644a823f 100644 --- a/Scripts/Skills/Provocation.cs +++ b/Scripts/Skills/Provocation.cs @@ -110,7 +110,7 @@ namespace Server.SkillHandlers } else if ( m_Creature != creature ) { - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + from.NextSkillTime = Core.TickCount + 10000; double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( creature )) * 0.5) - 5.0; double music = from.Skills[SkillName.Musicianship].Value; @@ -122,7 +122,7 @@ namespace Server.SkillHandlers { if ( !BaseInstrument.CheckMusicianship( from ) ) { - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 ); + from.NextSkillTime = Core.TickCount + 5000; from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); @@ -134,7 +134,7 @@ namespace Server.SkillHandlers if ( !from.CheckTargetSkill( SkillName.Provocation, creature, diff-25.0, diff+25.0 ) ) { - from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 ); + from.NextSkillTime = Core.TickCount + 5000; from.SendLocalizedMessage( 501599 ); // Your music fails to incite enough anger. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); diff --git a/Scripts/Skills/SpiritSpeak.cs b/Scripts/Skills/SpiritSpeak.cs index 51db6a5f9..ed0ea71b9 100644 --- a/Scripts/Skills/SpiritSpeak.cs +++ b/Scripts/Skills/SpiritSpeak.cs @@ -112,7 +112,7 @@ namespace Server.SkillHandlers public override void OnDisturb( DisturbType type, bool message ) { - Caster.NextSkillTime = DateTime.Now; + Caster.NextSkillTime = Core.TickCount; base.OnDisturb( type, message ); } diff --git a/Scripts/Skills/Stealing.cs b/Scripts/Skills/Stealing.cs index 2d1c98c4f..3cf4e2825 100644 --- a/Scripts/Skills/Stealing.cs +++ b/Scripts/Skills/Stealing.cs @@ -150,13 +150,13 @@ namespace Server.SkillHandlers else { if ( sig.IsBeingCorrupted ) - sig.GraceStart = DateTime.Now; // begin grace period + sig.GraceStart = DateTime.UtcNow; // begin grace period m_Thief.SendLocalizedMessage( 1010586 ); // YOU STOLE THE SIGIL!!! (woah, calm down now) if ( sig.LastMonolith != null && sig.LastMonolith.Sigil != null ) { sig.LastMonolith.Sigil = null; - sig.LastStolen = DateTime.Now; + sig.LastStolen = DateTime.UtcNow; } return sig; @@ -413,7 +413,7 @@ namespace Server.SkillHandlers public Mobile Victim{ get{ return m_Victim; } } public DateTime Expires{ get{ return m_Expires; } } - public bool IsExpired{ get{ return ( DateTime.Now >= m_Expires ); } } + public bool IsExpired{ get{ return ( DateTime.UtcNow >= m_Expires ); } } public StolenItem( Item stolen, Mobile thief, Mobile victim ) { @@ -421,7 +421,7 @@ namespace Server.SkillHandlers m_Thief = thief; m_Victim = victim; - m_Expires = DateTime.Now + StealTime; + m_Expires = DateTime.UtcNow + StealTime; } private static Queue m_Queue = new Queue(); @@ -469,7 +469,7 @@ namespace Server.SkillHandlers else si.m_Victim.SendLocalizedMessage( 1010463 ); // the item that was stolen from you falls to the ground. - si.m_Expires = DateTime.Now; // such a hack + si.m_Expires = DateTime.UtcNow; // such a hack } } } diff --git a/Scripts/SpecialSystems/Engines/GiftGiving.cs b/Scripts/SpecialSystems/Engines/GiftGiving.cs index 94cbbd2a6..141bdb099 100644 --- a/Scripts/SpecialSystems/Engines/GiftGiving.cs +++ b/Scripts/SpecialSystems/Engines/GiftGiving.cs @@ -33,7 +33,7 @@ namespace Server.Misc if ( acct == null ) return; - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; for ( int i = 0; i < m_Givers.Count; ++i ) { diff --git a/Scripts/Spells/Base/Spell.cs b/Scripts/Spells/Base/Spell.cs index 63d14aa8b..7674b4e56 100644 --- a/Scripts/Spells/Base/Spell.cs +++ b/Scripts/Spells/Base/Spell.cs @@ -18,7 +18,7 @@ namespace Server.Spells private Item m_Scroll; private SpellInfo m_Info; private SpellState m_State; - private DateTime m_StartCastTime; + private int m_StartCastTime; public SpellState State{ get{ return m_State; } set{ m_State = value; } } public Mobile Caster{ get{ return m_Caster; } } @@ -27,7 +27,7 @@ namespace Server.Spells public string Mantra{ get{ return m_Info.Mantra; } } public Type[] Reagents{ get{ return m_Info.Reagents; } } public Item Scroll{ get{ return m_Scroll; } } - public DateTime StartCastTime { get { return m_StartCastTime; } } + public int StartCastTime { get { return m_StartCastTime; } } private static TimeSpan NextSpellDelay = TimeSpan.FromSeconds( 0.75 ); private static TimeSpan AnimateDelay = TimeSpan.FromSeconds( 1.5 ); @@ -429,7 +429,7 @@ namespace Server.Spells if ( Core.AOS && m_Caster.Player && type == DisturbType.Hurt ) DoHurtFizzle(); - m_Caster.NextSpellTime = DateTime.Now + GetDisturbRecovery(); + m_Caster.NextSpellTime = Core.TickCount + (int)GetDisturbRecovery().TotalMilliseconds; } else if ( m_State == SpellState.Sequencing ) { @@ -482,7 +482,7 @@ namespace Server.Spells public bool Cast() { - m_StartCastTime = DateTime.Now; + m_StartCastTime = Core.TickCount; if ( Core.AOS && m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing ) ((Spell)m_Caster.Spell).Disturb( DisturbType.NewCast ); @@ -507,11 +507,11 @@ namespace Server.Spells { m_Caster.SendLocalizedMessage( 502643 ); // You can not cast a spell while frozen. } - else if ( CheckNextSpellTime && DateTime.Now < m_Caster.NextSpellTime ) + else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0) { m_Caster.SendLocalizedMessage( 502644 ); // You have not yet recovered from casting a spell. } - else if ( m_Caster is PlayerMobile && ( (PlayerMobile) m_Caster ).PeacedUntil > DateTime.Now ) + else if ( m_Caster is PlayerMobile && ( (PlayerMobile) m_Caster ).PeacedUntil > DateTime.UtcNow ) { m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. } @@ -633,7 +633,7 @@ namespace Server.Spells if ( Core.AOS ) return TimeSpan.Zero; - double delay = 1.0 - Math.Sqrt( (DateTime.Now - m_StartCastTime).TotalSeconds / GetCastDelay().TotalSeconds ); + double delay = 1.0 - Math.Sqrt((Core.TickCount - m_StartCastTime) / 1000 / GetCastDelay().TotalSeconds); if ( delay < 0.2 ) delay = 0.2; @@ -753,7 +753,7 @@ namespace Server.Spells m_Caster.SendLocalizedMessage( 502646 ); // You cannot cast a spell while frozen. DoFizzle(); } - else if ( m_Caster is PlayerMobile && ((PlayerMobile) m_Caster).PeacedUntil > DateTime.Now ) + else if ( m_Caster is PlayerMobile && ((PlayerMobile) m_Caster).PeacedUntil > DateTime.UtcNow ) { m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed. DoFizzle(); @@ -913,7 +913,7 @@ namespace Server.Spells m_Spell.m_Caster.OnSpellCast( m_Spell ); if ( m_Spell.m_Caster.Region != null ) m_Spell.m_Caster.Region.OnSpellCast( m_Spell.m_Caster, m_Spell ); - m_Spell.m_Caster.NextSpellTime = DateTime.Now + m_Spell.GetCastRecovery();// Spell.NextSpellDelay; + m_Spell.m_Caster.NextSpellTime = Core.TickCount + (int)m_Spell.GetCastRecovery().TotalMilliseconds; // Spell.NextSpellDelay; Target originalTarget = m_Spell.m_Caster.Target; diff --git a/Scripts/Spells/Base/SpellHelper.cs b/Scripts/Spells/Base/SpellHelper.cs index 528fadbab..13979c984 100644 --- a/Scripts/Spells/Base/SpellHelper.cs +++ b/Scripts/Spells/Base/SpellHelper.cs @@ -140,7 +140,7 @@ namespace Server.Spells { AggressorInfo info = m.Aggressed[i]; - if( info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay ) + if( info.Defender.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) return true; } @@ -150,7 +150,7 @@ namespace Server.Spells { AggressorInfo info = m.Aggressors[i]; - if( info.Attacker.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay ) + if( info.Attacker.Player && (DateTime.UtcNow - info.LastCombatTime) < CombatHeatDelay ) return true; } } diff --git a/Scripts/Spells/Chivalry/PaladinSpell.cs b/Scripts/Spells/Chivalry/PaladinSpell.cs index df45c9ba6..6b896df90 100644 --- a/Scripts/Spells/Chivalry/PaladinSpell.cs +++ b/Scripts/Spells/Chivalry/PaladinSpell.cs @@ -84,7 +84,7 @@ namespace Server.Spells.Chivalry public override void DoFizzle() { Caster.PlaySound( 0x1D6 ); - Caster.NextSpellTime = DateTime.Now; + Caster.NextSpellTime = Core.TickCount; } public override void DoHurtFizzle() diff --git a/Scripts/Spells/Eighth/EnergyVortex.cs b/Scripts/Spells/Eighth/EnergyVortex.cs index 465c52802..3c18e5c39 100644 --- a/Scripts/Spells/Eighth/EnergyVortex.cs +++ b/Scripts/Spells/Eighth/EnergyVortex.cs @@ -87,7 +87,7 @@ namespace Server.Spells.Eighth { from.SendLocalizedMessage( 501943 ); // Target cannot be seen. Try again. from.Target = new InternalTarget( m_Owner ); - from.Target.BeginTimeout( from, TimeoutTime - DateTime.Now ); + from.Target.BeginTimeout( from, TimeoutTime - DateTime.UtcNow ); m_Owner = null; } diff --git a/Scripts/Spells/Fifth/BladeSpirits.cs b/Scripts/Spells/Fifth/BladeSpirits.cs index 3afdf4df6..952c45f89 100644 --- a/Scripts/Spells/Fifth/BladeSpirits.cs +++ b/Scripts/Spells/Fifth/BladeSpirits.cs @@ -94,7 +94,7 @@ namespace Server.Spells.Fifth { from.SendLocalizedMessage( 501943 ); // Target cannot be seen. Try again. from.Target = new InternalTarget( m_Owner ); - from.Target.BeginTimeout( from, TimeoutTime - DateTime.Now ); + from.Target.BeginTimeout( from, TimeoutTime - DateTime.UtcNow ); m_Owner = null; } diff --git a/Scripts/Spells/Fifth/PoisonField.cs b/Scripts/Spells/Fifth/PoisonField.cs index f868c2031..c324a53ec 100644 --- a/Scripts/Spells/Fifth/PoisonField.cs +++ b/Scripts/Spells/Fifth/PoisonField.cs @@ -105,7 +105,7 @@ namespace Server.Spells.Fifth m_Caster = caster; - m_End = DateTime.Now + duration; + m_End = DateTime.UtcNow + duration; m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( Math.Abs( val ) * 0.2 ), caster.InLOS( this ), canFit ); m_Timer.Start(); @@ -239,7 +239,7 @@ namespace Server.Spells.Fifth Effects.SendLocationParticles( EffectItem.Create( m_Item.Location, m_Item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5040 ); } } - else if ( DateTime.Now > m_Item.m_End ) + else if ( DateTime.UtcNow > m_Item.m_End ) { m_Item.Delete(); Stop(); diff --git a/Scripts/Spells/Fourth/FireField.cs b/Scripts/Spells/Fourth/FireField.cs index 804c7e3ce..387406d33 100644 --- a/Scripts/Spells/Fourth/FireField.cs +++ b/Scripts/Spells/Fourth/FireField.cs @@ -118,7 +118,7 @@ namespace Server.Spells.Fourth m_Damage = damage; - m_End = DateTime.Now + duration; + m_End = DateTime.UtcNow + duration; m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( Math.Abs( val ) * 0.2 ), caster.InLOS( this ), canFit ); m_Timer.Start(); @@ -243,7 +243,7 @@ namespace Server.Spells.Fourth Effects.SendLocationParticles( EffectItem.Create( m_Item.Location, m_Item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5029 ); } } - else if ( DateTime.Now > m_Item.m_End ) + else if ( DateTime.UtcNow > m_Item.m_End ) { m_Item.Delete(); Stop(); diff --git a/Scripts/Spells/Necromancy/BloodOathSpell.cs b/Scripts/Spells/Necromancy/BloodOathSpell.cs index 15355c10c..15b9afd40 100644 --- a/Scripts/Spells/Necromancy/BloodOathSpell.cs +++ b/Scripts/Spells/Necromancy/BloodOathSpell.cs @@ -129,14 +129,14 @@ namespace Server.Spells.Necromancy { m_Caster = caster; m_Target = target; - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; Priority = TimerPriority.TwoFiftyMS; } protected override void OnTick() { - if ( m_Caster.Deleted || m_Target.Deleted || !m_Caster.Alive || !m_Target.Alive || DateTime.Now >= m_End ) + if ( m_Caster.Deleted || m_Target.Deleted || !m_Caster.Alive || !m_Target.Alive || DateTime.UtcNow >= m_End ) { DoExpire (); } diff --git a/Scripts/Spells/Necromancy/MindRot.cs b/Scripts/Spells/Necromancy/MindRot.cs index e4793bc31..ede8cd442 100644 --- a/Scripts/Spells/Necromancy/MindRot.cs +++ b/Scripts/Spells/Necromancy/MindRot.cs @@ -144,13 +144,13 @@ namespace Server.Spells.Necromancy { m_Caster = caster; m_Target = target; - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; Priority = TimerPriority.TwoFiftyMS; } public void RenewDelay(TimeSpan delay) { - m_End = DateTime.Now + delay; + m_End = DateTime.UtcNow + delay; } public void Halt() @@ -160,7 +160,7 @@ namespace Server.Spells.Necromancy protected override void OnTick() { - if ( m_Target.Deleted || !m_Target.Alive || DateTime.Now >= m_End ) + if ( m_Target.Deleted || !m_Target.Alive || DateTime.UtcNow >= m_End ) { MindRotSpell.ClearMindRotScalar( m_Target ); Stop(); diff --git a/Scripts/Spells/Necromancy/PainSpike.cs b/Scripts/Spells/Necromancy/PainSpike.cs index 6b887c871..ee51e2b28 100644 --- a/Scripts/Spells/Necromancy/PainSpike.cs +++ b/Scripts/Spells/Necromancy/PainSpike.cs @@ -66,7 +66,7 @@ namespace Server.Spells.Necromancy { t.Delay += TimeSpan.FromSeconds( 2.0 ); - buffTime = t.Next - DateTime.Now; + buffTime = t.Next - DateTime.UtcNow; } } else diff --git a/Scripts/Spells/Necromancy/Strangle.cs b/Scripts/Spells/Necromancy/Strangle.cs index 651272990..afd6c2fec 100644 --- a/Scripts/Spells/Necromancy/Strangle.cs +++ b/Scripts/Spells/Necromancy/Strangle.cs @@ -149,7 +149,7 @@ namespace Server.Spells.Necromancy m_MaxBaseDamage = spiritLevel + 1; m_HitDelay = 5; - m_NextHit = DateTime.Now + TimeSpan.FromSeconds( m_HitDelay ); + m_NextHit = DateTime.UtcNow + TimeSpan.FromSeconds( m_HitDelay ); m_Count = (int)spiritLevel; @@ -167,7 +167,7 @@ namespace Server.Spells.Necromancy Stop(); } - if ( !m_Target.Alive || DateTime.Now < m_NextHit ) + if ( !m_Target.Alive || DateTime.UtcNow < m_NextHit ) return; --m_Count; @@ -197,7 +197,7 @@ namespace Server.Spells.Necromancy } else { - m_NextHit = DateTime.Now + TimeSpan.FromSeconds( m_HitDelay ); + m_NextHit = DateTime.UtcNow + TimeSpan.FromSeconds( m_HitDelay ); double damage = m_MinBaseDamage + (Utility.RandomDouble() * (m_MaxBaseDamage - m_MinBaseDamage)); diff --git a/Scripts/Spells/Ninjitsu/AnimalForm.cs b/Scripts/Spells/Ninjitsu/AnimalForm.cs index bf0325c03..648838318 100644 --- a/Scripts/Spells/Ninjitsu/AnimalForm.cs +++ b/Scripts/Spells/Ninjitsu/AnimalForm.cs @@ -71,7 +71,7 @@ namespace Server.Spells.Ninjitsu private bool CasterIsMoving() { - return (DateTime.Now - Caster.LastMoveTime <= Caster.ComputeMovementSpeed(Caster.Direction)); + return (Core.TickCount - Caster.LastMoveTime <= Caster.ComputeMovementSpeed(Caster.Direction)); } private bool m_WasMoving; diff --git a/Scripts/Spells/Ninjitsu/MirrorImage.cs b/Scripts/Spells/Ninjitsu/MirrorImage.cs index 34d48e635..b4cf23cf7 100644 --- a/Scripts/Spells/Ninjitsu/MirrorImage.cs +++ b/Scripts/Spells/Ninjitsu/MirrorImage.cs @@ -169,7 +169,7 @@ namespace Server.Mobiles TimeSpan duration = TimeSpan.FromSeconds( 30 + caster.Skills.Ninjitsu.Fixed / 40 ); new UnsummonTimer( caster, this, duration ).Start(); - SummonEnd = DateTime.Now + duration; + SummonEnd = DateTime.UtcNow + duration; MirrorImage.AddClone( m_Caster ); } diff --git a/Scripts/Spells/Sixth/ParalyzeField.cs b/Scripts/Spells/Sixth/ParalyzeField.cs index 5faee78c6..a079647aa 100644 --- a/Scripts/Spells/Sixth/ParalyzeField.cs +++ b/Scripts/Spells/Sixth/ParalyzeField.cs @@ -112,7 +112,7 @@ namespace Server.Spells.Sixth m_Timer = new InternalTimer( this, duration ); m_Timer.Start(); - m_End = DateTime.Now + duration; + m_End = DateTime.UtcNow + duration; } public override void OnAfterDelete() @@ -150,7 +150,7 @@ namespace Server.Spells.Sixth m_Caster = reader.ReadMobile(); m_End = reader.ReadDeltaTime(); - m_Timer = new InternalTimer( this, m_End - DateTime.Now ); + m_Timer = new InternalTimer( this, m_End - DateTime.UtcNow ); m_Timer.Start(); break; diff --git a/Scripts/Spells/Spellweaving/ArcaneCircle.cs b/Scripts/Spells/Spellweaving/ArcaneCircle.cs index 91ea51357..96c70b933 100644 --- a/Scripts/Spells/Spellweaving/ArcaneCircle.cs +++ b/Scripts/Spells/Spellweaving/ArcaneCircle.cs @@ -155,7 +155,7 @@ namespace Server.Spells.Spellweaving { to.SendLocalizedMessage( 1072828 ); // Your arcane focus is renewed. focus.LifeSpan = duration; - focus.CreationTime = DateTime.Now; + focus.CreationTime = DateTime.UtcNow; focus.StrengthBonus = strengthBonus; focus.InvalidateProperties(); focus.SendTimeRemainingMessage( to ); diff --git a/Scripts/Spells/Spellweaving/ArcanistSpell.cs b/Scripts/Spells/Spellweaving/ArcanistSpell.cs index 95b577862..249dcb985 100644 --- a/Scripts/Spells/Spellweaving/ArcanistSpell.cs +++ b/Scripts/Spells/Spellweaving/ArcanistSpell.cs @@ -114,7 +114,7 @@ namespace Server.Spells.Spellweaving public override void DoFizzle() { Caster.PlaySound( 0x1D6 ); - Caster.NextSpellTime = DateTime.Now; + Caster.NextSpellTime = Core.TickCount; } public override void DoHurtFizzle() diff --git a/Scripts/Spells/Spellweaving/Items/TransientItem.cs b/Scripts/Spells/Spellweaving/Items/TransientItem.cs index 2f2d4c0e8..d46a0529c 100644 --- a/Scripts/Spells/Spellweaving/Items/TransientItem.cs +++ b/Scripts/Spells/Spellweaving/Items/TransientItem.cs @@ -64,7 +64,7 @@ namespace Server.Items public virtual void CheckExpiry() { - if( (m_CreationTime + m_LifeSpan) < DateTime.Now ) + if( (m_CreationTime + m_LifeSpan) < DateTime.UtcNow ) Expire( RootParent as Mobile ); else InvalidateProperties(); @@ -74,7 +74,7 @@ namespace Server.Items public TransientItem( int itemID, TimeSpan lifeSpan ) : base( itemID ) { - m_CreationTime = DateTime.Now; + m_CreationTime = DateTime.UtcNow; m_LifeSpan = lifeSpan; m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 5 ), TimeSpan.FromSeconds( 5 ), new TimerCallback( CheckExpiry ) ); @@ -89,7 +89,7 @@ namespace Server.Items { base.GetProperties( list ); - TimeSpan remaining = ((m_CreationTime + m_LifeSpan) - DateTime.Now); + TimeSpan remaining = ((m_CreationTime + m_LifeSpan) - DateTime.UtcNow); list.Add( 1072517, ((int)remaining.TotalSeconds).ToString() ); // Lifespan: ~1_val~ seconds } diff --git a/Scripts/Spells/Third/WallOfStone.cs b/Scripts/Spells/Third/WallOfStone.cs index 68fb11f9f..21bdbc869 100644 --- a/Scripts/Spells/Third/WallOfStone.cs +++ b/Scripts/Spells/Third/WallOfStone.cs @@ -117,7 +117,7 @@ namespace Server.Spells.Third m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( 10.0 ) ); m_Timer.Start(); - m_End = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); + m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10.0 ); } public InternalItem( Serial serial ) : base( serial ) @@ -145,7 +145,7 @@ namespace Server.Spells.Third { m_End = reader.ReadDeltaTime(); - m_Timer = new InternalTimer( this, m_End - DateTime.Now ); + m_Timer = new InternalTimer( this, m_End - DateTime.UtcNow ); m_Timer.Start(); break; @@ -157,7 +157,7 @@ namespace Server.Spells.Third m_Timer = new InternalTimer( this, duration ); m_Timer.Start(); - m_End = DateTime.Now + duration; + m_End = DateTime.UtcNow + duration; break; } diff --git a/Server/AggressorInfo.cs b/Server/AggressorInfo.cs index 0fd7112c9..d178d6b1e 100644 --- a/Server/AggressorInfo.cs +++ b/Server/AggressorInfo.cs @@ -109,7 +109,7 @@ namespace Server if ( m_Queued ) DumpAccess(); - return ( m_Attacker.Deleted || m_Defender.Deleted || DateTime.Now >= (m_LastCombatTime + m_ExpireDelay) ); + return ( m_Attacker.Deleted || m_Defender.Deleted || DateTime.UtcNow >= (m_LastCombatTime + m_ExpireDelay) ); } } @@ -205,7 +205,7 @@ namespace Server if ( m_Queued ) DumpAccess(); - m_LastCombatTime = DateTime.Now; + m_LastCombatTime = DateTime.UtcNow; m_Reported = false; } } diff --git a/Server/AssemblyInfo.cs b/Server/AssemblyInfo.cs index 4025ae56d..734bc32b5 100644 --- a/Server/AssemblyInfo.cs +++ b/Server/AssemblyInfo.cs @@ -47,7 +47,7 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("2.3.*")] +[assembly: AssemblyVersion("2.4.*")] // // In order to sign your assembly you must specify a key to use. Refer to the diff --git a/Server/Item.cs b/Server/Item.cs index bed97b0b0..59d0e98b6 100644 --- a/Server/Item.cs +++ b/Server/Item.cs @@ -1520,7 +1520,7 @@ namespace Server public void SetLastMoved() { - m_LastMovedTime = DateTime.Now; + m_LastMovedTime = DateTime.UtcNow; } public DateTime LastMoved @@ -2073,7 +2073,7 @@ namespace Server /* begin last moved time optimization */ long ticks = m_LastMovedTime.Ticks; - long now = DateTime.Now.Ticks; + long now = DateTime.UtcNow.Ticks; TimeSpan d; @@ -2322,8 +2322,8 @@ namespace Server { int minutes = reader.ReadEncodedInt(); - try{ LastMoved = DateTime.Now - TimeSpan.FromMinutes( minutes ); } - catch{ LastMoved = DateTime.Now; } + try{ LastMoved = DateTime.UtcNow - TimeSpan.FromMinutes( minutes ); } + catch{ LastMoved = DateTime.UtcNow; } } if ( GetSaveFlag( flags, SaveFlag.Direction ) ) diff --git a/Server/Main.cs b/Server/Main.cs index 6a3874db2..504c5dabe 100644 --- a/Server/Main.cs +++ b/Server/Main.cs @@ -84,9 +84,9 @@ namespace Server m_Profiling = value; if( m_ProfileStart > DateTime.MinValue ) - m_ProfileTime += DateTime.Now - m_ProfileStart; + m_ProfileTime += DateTime.UtcNow - m_ProfileStart; - m_ProfileStart = (m_Profiling ? DateTime.Now : DateTime.MinValue); + m_ProfileStart = (m_Profiling ? DateTime.UtcNow : DateTime.MinValue); } } @@ -95,7 +95,7 @@ namespace Server get { if( m_ProfileStart > DateTime.MinValue ) - return m_ProfileTime + (DateTime.Now - m_ProfileStart); + return m_ProfileTime + (DateTime.UtcNow - m_ProfileStart); return m_ProfileTime; } @@ -112,6 +112,14 @@ namespace Server public static Thread Thread { get { return m_Thread; } } public static MultiTextWriter MultiConsoleOut { get { return m_MultiConOut; } } + public static int TickCount { + get { + if (Stopwatch.IsHighResolution) // TODO: GetTimestamp is unreliable with certain system configurations. + return (int)((double)Stopwatch.GetTimestamp() / Stopwatch.Frequency * 1000); + return Environment.TickCount; + } + } + #if Framework_4_0 public static readonly bool Is64Bit = Environment.Is64BitProcess; #else @@ -704,7 +712,7 @@ namespace Server m_FileName = file; using( StreamWriter writer = new StreamWriter( new FileStream( m_FileName, append ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.Read ) ) ) { - writer.WriteLine( ">>>Logging started on {0}.", DateTime.Now.ToString( "f" ) ); //f = Tuesday, April 10, 2001 3:51 PM + writer.WriteLine( ">>>Logging started on {0}.", DateTime.UtcNow.ToString( "f" ) ); //f = Tuesday, April 10, 2001 3:51 PM } m_NewLine = true; } @@ -715,7 +723,7 @@ namespace Server { if( m_NewLine ) { - writer.Write( DateTime.Now.ToString( DateFormat ) ); + writer.Write( DateTime.UtcNow.ToString( DateFormat ) ); m_NewLine = false; } writer.Write( ch ); @@ -728,7 +736,7 @@ namespace Server { if( m_NewLine ) { - writer.Write( DateTime.Now.ToString( DateFormat ) ); + writer.Write( DateTime.UtcNow.ToString( DateFormat ) ); m_NewLine = false; } writer.Write( str ); @@ -740,7 +748,7 @@ namespace Server using( StreamWriter writer = new StreamWriter( new FileStream( m_FileName, FileMode.Append, FileAccess.Write, FileShare.Read ) ) ) { if( m_NewLine ) - writer.Write( DateTime.Now.ToString( DateFormat ) ); + writer.Write( DateTime.UtcNow.ToString( DateFormat ) ); writer.WriteLine( line ); m_NewLine = true; } diff --git a/Server/Mobile.cs b/Server/Mobile.cs index f1574d953..a69b2b62a 100644 --- a/Server/Mobile.cs +++ b/Server/Mobile.cs @@ -55,7 +55,7 @@ namespace Server private DateTime m_Expire; public TimedSkillMod( SkillName skill, bool relative, double value, TimeSpan delay ) - : this( skill, relative, value, DateTime.Now + delay ) + : this( skill, relative, value, DateTime.UtcNow + delay ) { } @@ -67,7 +67,7 @@ namespace Server public override bool CheckCondition() { - return (DateTime.Now < m_Expire); + return (DateTime.UtcNow < m_Expire); } } @@ -326,7 +326,7 @@ namespace Server if( m_Duration == TimeSpan.Zero ) return false; - return (DateTime.Now - m_Added) >= m_Duration; + return (DateTime.UtcNow - m_Added) >= m_Duration; } public StatMod( StatType type, string name, int offset, TimeSpan duration ) @@ -335,7 +335,7 @@ namespace Server m_Name = name; m_Offset = offset; m_Duration = duration; - m_Added = DateTime.Now; + m_Added = DateTime.UtcNow; } } @@ -351,7 +351,7 @@ namespace Server public Mobile Damager { get { return m_Damager; } } public int DamageGiven { get { return m_DamageGiven; } set { m_DamageGiven = value; } } public DateTime LastDamage { get { return m_LastDamage; } set { m_LastDamage = value; } } - public bool HasExpired { get { return (DateTime.Now > (m_LastDamage + m_ExpireDelay)); } } + public bool HasExpired { get { return (DateTime.UtcNow > (m_LastDamage + m_ExpireDelay)); } } public List Responsible { get { return m_Responsible; } set { m_Responsible = value; } } private static TimeSpan m_ExpireDelay = TimeSpan.FromMinutes( 2.0 ); @@ -660,11 +660,11 @@ namespace Server private class MovementRecord { - public DateTime m_End; + public int m_End; private static Queue m_InstancePool = new Queue(); - public static MovementRecord NewInstance( DateTime end ) + public static MovementRecord NewInstance( int end ) { MovementRecord r; @@ -682,14 +682,14 @@ namespace Server return r; } - private MovementRecord( DateTime end ) + private MovementRecord( int end ) { m_End = end; } public bool Expired() { - bool v = (DateTime.Now >= m_End); + bool v = (Core.TickCount - m_End >= 0); if( v ) m_InstancePool.Enqueue( this ); @@ -744,7 +744,7 @@ namespace Server private int m_TithingPoints; private bool m_DisplayGuildTitle; private Mobile m_GuildFealty; - private DateTime m_NextSpellTime; + private int m_NextSpellTime; private DateTime[] m_StuckMenuUses; private Timer m_ExpireCombatant; private Timer m_ExpireCriminal; @@ -752,9 +752,9 @@ namespace Server private Timer m_LogoutTimer; private Timer m_CombatTimer; private Timer m_ManaTimer, m_HitsTimer, m_StamTimer; - private DateTime m_NextSkillTime; - private DateTime m_NextActionTime; - private DateTime m_NextActionMessage; + private int m_NextSkillTime; + private int m_NextActionTime; + private int m_NextActionMessage; private bool m_Paralyzed; private ParalyzedTimer m_ParaTimer; private bool m_Frozen; @@ -1366,7 +1366,7 @@ namespace Server if( m_Warmode == value ) return; - DateTime now = DateTime.Now, next = m_NextWarmodeChange; + DateTime now = DateTime.UtcNow, next = m_NextWarmodeChange; if( now > next || m_WarmodeChanges == 0 ) { @@ -1482,7 +1482,7 @@ namespace Server } } - public DateTime NextCombatTime + public int NextCombatTime { get { @@ -1586,7 +1586,7 @@ namespace Server } } - private DateTime m_LastMoveTime; + private int m_LastMoveTime; /// /// Gets or sets the number of steps this player may take when hidden before being revealed. @@ -1664,7 +1664,7 @@ namespace Server } } - public DateTime LastMoveTime + public int LastMoveTime { get { @@ -1845,7 +1845,7 @@ namespace Server return String.Format( "0x{0:X} \"{1}\"", m_Serial.Value, Name ); } - public DateTime NextActionTime + public int NextActionTime { get { @@ -1857,7 +1857,7 @@ namespace Server } } - public DateTime NextActionMessage + public int NextActionMessage { get { @@ -1869,9 +1869,9 @@ namespace Server } } - private static TimeSpan m_ActionMessageDelay = TimeSpan.FromSeconds( 0.125 ); + private static int m_ActionMessageDelay = 125; - public static TimeSpan ActionMessageDelay + public static int ActionMessageDelay { get { return m_ActionMessageDelay; } set { m_ActionMessageDelay = value; } @@ -1879,20 +1879,20 @@ namespace Server public virtual void SendSkillMessage() { - if( DateTime.Now < m_NextActionMessage ) + if (m_NextActionMessage - Core.TickCount >= 0) return; - m_NextActionMessage = DateTime.Now + m_ActionMessageDelay; + m_NextActionMessage = Core.TickCount + m_ActionMessageDelay; SendLocalizedMessage( 500118 ); // You must wait a few moments to use another skill. } public virtual void SendActionMessage() { - if( DateTime.Now < m_NextActionMessage ) + if (m_NextActionMessage - Core.TickCount >= 0) return; - m_NextActionMessage = DateTime.Now + m_ActionMessageDelay; + m_NextActionMessage = Core.TickCount + m_ActionMessageDelay; SendLocalizedMessage( 500119 ); // You must wait to perform another action. } @@ -2067,7 +2067,7 @@ namespace Server protected override void OnTick() { - if( DateTime.Now > m_Mobile.m_NextCombatTime ) + if (Core.TickCount - m_Mobile.m_NextCombatTime >= 0) { Mobile combatant = m_Mobile.Combatant; @@ -2087,7 +2087,7 @@ namespace Server { weapon.OnBeforeSwing( m_Mobile, combatant ); //OnBeforeSwing for checking in regards to being hidden and whatnot m_Mobile.RevealingAction(); - m_Mobile.m_NextCombatTime = DateTime.Now + weapon.OnSwing( m_Mobile, combatant ); + m_Mobile.m_NextCombatTime = Core.TickCount + (int)weapon.OnSwing(m_Mobile, combatant).TotalMilliseconds; } } } @@ -2157,9 +2157,9 @@ namespace Server #endregion - private DateTime m_NextCombatTime; + private int m_NextCombatTime; - public DateTime NextSkillTime + public int NextSkillTime { get { @@ -3068,17 +3068,17 @@ namespace Server } } - private static TimeSpan m_WalkFoot = TimeSpan.FromSeconds( 0.4 ); - private static TimeSpan m_RunFoot = TimeSpan.FromSeconds( 0.2 ); - private static TimeSpan m_WalkMount = TimeSpan.FromSeconds( 0.2 ); - private static TimeSpan m_RunMount = TimeSpan.FromSeconds( 0.1 ); + private static int m_WalkFoot = 400; + private static int m_RunFoot = 200; + private static int m_WalkMount = 200; + private static int m_RunMount = 100; - public static TimeSpan WalkFoot { get { return m_WalkFoot; } set { m_WalkFoot = value; } } - public static TimeSpan RunFoot { get { return m_RunFoot; } set { m_RunFoot = value; } } - public static TimeSpan WalkMount { get { return m_WalkMount; } set { m_WalkMount = value; } } - public static TimeSpan RunMount { get { return m_RunMount; } set { m_RunMount = value; } } + public static int WalkFoot { get { return m_WalkFoot; } set { m_WalkFoot = value; } } + public static int RunFoot { get { return m_RunFoot; } set { m_RunFoot = value; } } + public static int WalkMount { get { return m_WalkMount; } set { m_WalkMount = value; } } + public static int RunMount { get { return m_RunMount; } set { m_RunMount = value; } } - private DateTime m_EndQueue; + private int m_EndQueue; private static ArrayList m_MoveList = new ArrayList(); @@ -3097,7 +3097,7 @@ namespace Server if( m_MoveRecords != null && m_MoveRecords.Count > 0 ) m_MoveRecords.Clear(); - m_EndQueue = DateTime.Now; + m_EndQueue = Core.TickCount; } public virtual bool CheckMovement( Direction d, out int newZ ) @@ -3277,21 +3277,21 @@ namespace Server return false; } - TimeSpan delay = ComputeMovementSpeed( d ); + int delay = ComputeMovementSpeed( d ); - DateTime end; + int end; if( m_MoveRecords.Count > 0 ) end = m_EndQueue + delay; else - end = DateTime.Now + delay; + end = Core.TickCount + delay; m_MoveRecords.Enqueue( MovementRecord.NewInstance( end ) ); m_EndQueue = end; } - m_LastMoveTime = DateTime.Now; + m_LastMoveTime = Core.TickCount; } else { @@ -3391,19 +3391,19 @@ namespace Server { } - public TimeSpan ComputeMovementSpeed() + public int ComputeMovementSpeed() { return ComputeMovementSpeed( this.Direction, false ); } - public TimeSpan ComputeMovementSpeed( Direction dir ) + public int ComputeMovementSpeed( Direction dir ) { return ComputeMovementSpeed( dir, true ); } - public virtual TimeSpan ComputeMovementSpeed( Direction dir, bool checkTurning ) + public virtual int ComputeMovementSpeed( Direction dir, bool checkTurning ) { - TimeSpan delay; + int delay; if( Mounted ) delay = (dir & Direction.Running) != 0 ? m_RunMount : m_WalkMount; @@ -3531,7 +3531,7 @@ namespace Server { for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { - if( (DateTime.Now - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) + if( (DateTime.UtcNow - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) { return true; } @@ -4287,9 +4287,9 @@ namespace Server m.OnDoubleClick( this ); } - private static TimeSpan m_ActionDelay = TimeSpan.FromSeconds( 0.5 ); + private static int m_ActionDelay = 500; - public static TimeSpan ActionDelay + public static int ActionDelay { get { return m_ActionDelay; } set { m_ActionDelay = value; } @@ -4306,7 +4306,7 @@ namespace Server Mobile from = this; NetState state = m_NetState; - if( from.AccessLevel >= AccessLevel.GameMaster || DateTime.Now >= from.NextActionTime ) + if (from.AccessLevel >= AccessLevel.GameMaster || Core.TickCount - from.NextActionTime >= 0) { if( from.CheckAlive() ) { @@ -4428,7 +4428,7 @@ namespace Server if( liftSound != -1 ) from.Send( new PlaySound( liftSound, from ) ); - from.NextActionTime = DateTime.Now + m_ActionDelay; + from.NextActionTime = Core.TickCount + m_ActionDelay; if( fixMap != null && shouldFix ) fixMap.FixColumn( fixLoc.m_X, fixLoc.m_Y ); @@ -5144,7 +5144,7 @@ namespace Server de = new DamageEntry( from ); de.DamageGiven += amount; - de.LastDamage = DateTime.Now; + de.LastDamage = DateTime.UtcNow; m_DamageEntries.Remove( de ); m_DamageEntries.Add( de ); @@ -5175,7 +5175,7 @@ namespace Server list.Add( resp = new DamageEntry( master ) ); resp.DamageGiven += amount; - resp.LastDamage = DateTime.Now; + resp.LastDamage = DateTime.UtcNow; } return de; @@ -5419,9 +5419,9 @@ namespace Server for( int i = 0; i < m_StuckMenuUses.Length; ++i ) { - if( (DateTime.Now - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) + if( (DateTime.UtcNow - m_StuckMenuUses[i]) > TimeSpan.FromDays( 1.0 ) ) { - m_StuckMenuUses[i] = DateTime.Now; + m_StuckMenuUses[i] = DateTime.UtcNow; return; } } @@ -9888,7 +9888,7 @@ namespace Server m_Serial = serial; m_Aggressors = new List(); m_Aggressed = new List(); - m_NextSkillTime = DateTime.MinValue; + m_NextSkillTime = Core.TickCount; m_DamageEntries = new List(); Type ourType = this.GetType(); @@ -9936,8 +9936,8 @@ namespace Server m_Stabled = new List(); m_DamageEntries = new List(); - m_NextSkillTime = DateTime.MinValue; - m_CreationTime = DateTime.Now; + m_NextSkillTime = Core.TickCount; + m_CreationTime = DateTime.UtcNow; } private static Queue m_DeltaQueue = new Queue(); @@ -11335,7 +11335,7 @@ namespace Server } } - public DateTime NextSpellTime + public int NextSpellTime { get { diff --git a/Server/Network/NetState.cs b/Server/Network/NetState.cs index a9c1ed6c9..9badaef57 100644 --- a/Server/Network/NetState.cs +++ b/Server/Network/NetState.cs @@ -83,7 +83,7 @@ namespace Server.Network { public TimeSpan ConnectedFor { get { - return ( DateTime.Now - m_ConnectedOn ); + return ( DateTime.UtcNow - m_ConnectedOn ); } } @@ -567,7 +567,7 @@ namespace Server.Network { m_SendQueue = new SendQueue(); - m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 0.5 ); + m_NextCheckActivity = Core.TickCount + 30000; m_Instances.Add( this ); @@ -580,7 +580,7 @@ namespace Server.Network { m_ToString = "(error)"; } - m_ConnectedOn = DateTime.Now; + m_ConnectedOn = DateTime.UtcNow; if ( m_CreatedCallback != null ) { @@ -647,7 +647,7 @@ namespace Server.Network { Console.WriteLine( "Client: {0}: null buffer send, disconnecting...", this ); using ( StreamWriter op = new StreamWriter( "null_send.log", true ) ) { - op.WriteLine( "{0} Client: {1}: null buffer send, disconnecting...", DateTime.Now, this ); + op.WriteLine( "{0} Client: {1}: null buffer send, disconnecting...", DateTime.UtcNow, this ); op.WriteLine( new System.Diagnostics.StackTrace() ); } Dispose(); @@ -711,7 +711,7 @@ namespace Server.Network { return; } - m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 ); + m_NextCheckActivity = Core.TickCount + 90000; byte[] buffer = m_RecvBuffer; @@ -777,7 +777,7 @@ namespace Server.Network { return; } - m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 ); + m_NextCheckActivity = Core.TickCount + 90000; } public static void Pause() { @@ -867,7 +867,7 @@ namespace Server.Network { int byteCount = s.EndReceive( asyncResult ); if ( byteCount > 0 ) { - m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 ); + m_NextCheckActivity = Core.TickCount + 90000; byte[] buffer = m_RecvBuffer; @@ -910,7 +910,7 @@ namespace Server.Network { return; } - m_NextCheckActivity = DateTime.Now + TimeSpan.FromMinutes( 1.2 ); + m_NextCheckActivity = Core.TickCount + 90000; if ( m_CoalesceSleep >= 0 ) { Thread.Sleep( m_CoalesceSleep ); @@ -1023,13 +1023,13 @@ namespace Server.Network { } } - private DateTime m_NextCheckActivity; + private int m_NextCheckActivity; public bool CheckAlive() { if ( m_Socket == null ) return false; - if ( DateTime.Now < m_NextCheckActivity ) { + if (m_NextCheckActivity - Core.TickCount >= 0) { return true; } @@ -1045,7 +1045,7 @@ namespace Server.Network { try { using ( StreamWriter op = new StreamWriter( "network-errors.log", true ) ) { - op.WriteLine( "# {0}", DateTime.Now ); + op.WriteLine("# {0}", DateTime.UtcNow); op.WriteLine( ex ); diff --git a/Server/Network/PacketHandlers.cs b/Server/Network/PacketHandlers.cs index 49dc31968..665f0c277 100644 --- a/Server/Network/PacketHandlers.cs +++ b/Server/Network/PacketHandlers.cs @@ -1408,7 +1408,7 @@ namespace Server.Network { Mobile from = state.Mobile; - if ( from.AccessLevel >= AccessLevel.Counselor || DateTime.Now >= from.NextActionTime ) + if (from.AccessLevel >= AccessLevel.Counselor || Core.TickCount - from.NextActionTime >= 0) { int value = pvSrc.ReadInt32(); @@ -1436,7 +1436,7 @@ namespace Server.Network } } - from.NextActionTime = DateTime.Now + Mobile.ActionDelay; + from.NextActionTime = Core.TickCount + Mobile.ActionDelay; } else { @@ -1627,7 +1627,7 @@ namespace Server.Network if (from == null) return; - if (from.AccessLevel >= AccessLevel.Counselor || DateTime.Now >= from.NextActionTime) + if (from.AccessLevel >= AccessLevel.Counselor || Core.TickCount - from.NextActionTime >= 0) { Item bandage = World.FindItem(pvSrc.ReadInt32()); @@ -1641,7 +1641,7 @@ namespace Server.Network EventSink.InvokeBandageTargetRequest(new BandageTargetRequestEventArgs(from, bandage, target)); - from.NextActionTime = DateTime.Now + Mobile.ActionDelay; + from.NextActionTime = Core.TickCount + Mobile.ActionDelay; } else { @@ -2412,7 +2412,6 @@ namespace Server.Network } } - private static bool m_ClientVerification = true; public static bool ClientVerification @@ -2426,7 +2425,7 @@ namespace Server.Network public ClientVersion Version; public AuthIDPersistence( ClientVersion v ) { - Age = DateTime.Now; + Age = DateTime.UtcNow; Version = v; } } diff --git a/Server/Network/PacketWriter.cs b/Server/Network/PacketWriter.cs index b90353c0d..b0d1fd35c 100644 --- a/Server/Network/PacketWriter.cs +++ b/Server/Network/PacketWriter.cs @@ -76,7 +76,7 @@ namespace Server.Network { using ( StreamWriter op = new StreamWriter( "neterr.log" ) ) { - op.WriteLine( "{0}\tInstance pool contains writer", DateTime.Now ); + op.WriteLine("{0}\tInstance pool contains writer", DateTime.UtcNow); } } catch diff --git a/Server/Network/Packets.cs b/Server/Network/Packets.cs index 957788b3b..34077c641 100644 --- a/Server/Network/Packets.cs +++ b/Server/Network/Packets.cs @@ -2731,7 +2731,7 @@ namespace Server.Network { public CurrentTime() : base( 0x5B, 4 ) { - DateTime now = DateTime.Now; + DateTime now = DateTime.UtcNow; m_Stream.Write( (byte) now.Hour ); m_Stream.Write( (byte) now.Minute ); @@ -4590,7 +4590,7 @@ namespace Server.Network Console.WriteLine( "Warning: Compression buffer overflowed on packet 0x{0:X2} ('{1}') (length={2})", m_PacketID, GetType().Name, length ); using ( StreamWriter op = new StreamWriter( "compression_overflow.log", true ) ) { - op.WriteLine( "{0} Warning: Compression buffer overflowed on packet 0x{1:X2} ('{2}') (length={3})", DateTime.Now, m_PacketID, GetType().Name, length ); + op.WriteLine("{0} Warning: Compression buffer overflowed on packet 0x{1:X2} ('{2}') (length={3})", DateTime.UtcNow, m_PacketID, GetType().Name, length); op.WriteLine( new System.Diagnostics.StackTrace() ); } } diff --git a/Server/Persistence/DynamicSaveStrategy.cs b/Server/Persistence/DynamicSaveStrategy.cs index 1031ebd75..a67c7b21c 100644 --- a/Server/Persistence/DynamicSaveStrategy.cs +++ b/Server/Persistence/DynamicSaveStrategy.cs @@ -134,7 +134,7 @@ namespace Server writer.QueueForIndex(item, size); - if (item.Decays && item.Parent == null && item.Map != Map.Internal && DateTime.Now > (item.LastMoved + item.DecayTime)) + if (item.Decays && item.Parent == null && item.Map != Map.Internal && DateTime.UtcNow > (item.LastMoved + item.DecayTime)) { _decayBag.Add(item); } diff --git a/Server/Persistence/ParallelSaveStrategy.cs b/Server/Persistence/ParallelSaveStrategy.cs index 11b1c25be..07b8f4c35 100644 --- a/Server/Persistence/ParallelSaveStrategy.cs +++ b/Server/Persistence/ParallelSaveStrategy.cs @@ -198,7 +198,8 @@ namespace Server { metrics.OnItemSaved( length ); } - if ( item.Decays && item.Parent == null && item.Map != Map.Internal && DateTime.Now > ( item.LastMoved + item.DecayTime ) ) { + if (item.Decays && item.Parent == null && item.Map != Map.Internal && DateTime.UtcNow > (item.LastMoved + item.DecayTime)) + { _decayQueue.Enqueue( item ); } } diff --git a/Server/Persistence/StandardSaveStrategy.cs b/Server/Persistence/StandardSaveStrategy.cs index 3da337299..eaf33e2f7 100644 --- a/Server/Persistence/StandardSaveStrategy.cs +++ b/Server/Persistence/StandardSaveStrategy.cs @@ -134,7 +134,8 @@ namespace Server { idx.Write( ( int ) items.Count ); foreach ( Item item in items.Values ) { - if ( item.Decays && item.Parent == null && item.Map != Map.Internal && ( item.LastMoved + item.DecayTime ) <= DateTime.Now ) { + if (item.Decays && item.Parent == null && item.Map != Map.Internal && (item.LastMoved + item.DecayTime) <= DateTime.UtcNow) + { _decayQueue.Enqueue( item ); } diff --git a/Server/Serialization.cs b/Server/Serialization.cs index ea8955309..ddba58568 100644 --- a/Server/Serialization.cs +++ b/Server/Serialization.cs @@ -379,7 +379,7 @@ namespace Server public override void WriteDeltaTime( DateTime value ) { long ticks = value.Ticks; - long now = DateTime.Now.Ticks; + long now = DateTime.UtcNow.Ticks; TimeSpan d; @@ -980,7 +980,7 @@ namespace Server public override DateTime ReadDeltaTime() { long ticks = m_File.ReadInt64(); - long now = DateTime.Now.Ticks; + long now = DateTime.UtcNow.Ticks; if( ticks > 0 && (ticks+now) < 0 ) return DateTime.MaxValue; @@ -1549,7 +1549,7 @@ namespace Server public override void WriteDeltaTime( DateTime value ) { long ticks = value.Ticks; - long now = DateTime.Now.Ticks; + long now = DateTime.UtcNow.Ticks; TimeSpan d; diff --git a/Server/Skills.cs b/Server/Skills.cs index 38703f944..1da5c4881 100644 --- a/Server/Skills.cs +++ b/Server/Skills.cs @@ -942,11 +942,11 @@ namespace Server if ( info.Callback != null ) { - if ( from.NextSkillTime <= DateTime.Now && from.Spell == null ) + if (Core.TickCount - from.NextSkillTime >= 0 && from.Spell == null) { from.DisruptiveAction(); - from.NextSkillTime = DateTime.Now + info.Callback( from ); + from.NextSkillTime = Core.TickCount + (int)(info.Callback(from)).TotalMilliseconds; return true; } diff --git a/Server/Targeting/Target.cs b/Server/Targeting/Target.cs index 0310ae8b1..31ffe1732 100644 --- a/Server/Targeting/Target.cs +++ b/Server/Targeting/Target.cs @@ -73,7 +73,7 @@ namespace Server.Targeting public void BeginTimeout( Mobile from, TimeSpan delay ) { - m_TimeoutTime = DateTime.Now + delay; + m_TimeoutTime = DateTime.UtcNow + delay; if ( m_TimeoutTimer != null ) m_TimeoutTimer.Stop(); diff --git a/Server/TileMatrix.cs b/Server/TileMatrix.cs index a2a0da0dd..1fe95840a 100644 --- a/Server/TileMatrix.cs +++ b/Server/TileMatrix.cs @@ -461,10 +461,10 @@ namespace Server } catch ( EndOfStreamException ) { - if ( DateTime.Now >= m_NextStaticWarning ) + if ( DateTime.UtcNow >= m_NextStaticWarning ) { Console.WriteLine( "Warning: Static EOS for {0} ({1}, {2})", m_Owner, x, y ); - m_NextStaticWarning = DateTime.Now + TimeSpan.FromMinutes( 1.0 ); + m_NextStaticWarning = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); } return m_EmptyStaticBlock; @@ -506,10 +506,10 @@ namespace Server } catch { - if ( DateTime.Now >= m_NextLandWarning ) + if ( DateTime.UtcNow >= m_NextLandWarning ) { Console.WriteLine( "Warning: Land EOS for {0} ({1}, {2})", m_Owner, x, y ); - m_NextLandWarning = DateTime.Now + TimeSpan.FromMinutes( 1.0 ); + m_NextLandWarning = DateTime.UtcNow + TimeSpan.FromMinutes( 1.0 ); } return m_InvalidLandBlock; diff --git a/Server/Timer.cs b/Server/Timer.cs index dacfcd871..4862d382a 100644 --- a/Server/Timer.cs +++ b/Server/Timer.cs @@ -283,7 +283,7 @@ namespace Server if ( tce.m_IsAdd ) { - timer.m_Next = DateTime.Now + timer.m_Delay; + timer.m_Next = DateTime.UtcNow + timer.m_Delay; timer.m_Index = 0; } @@ -318,7 +318,7 @@ namespace Server for ( i = 0; i < m_Timers.Length; i++) { - now = DateTime.Now; + now = DateTime.UtcNow; if ( now < m_NextPriorities[i] ) break; diff --git a/Server/World.cs b/Server/World.cs index d7f8d4cae..9ffafe3d6 100644 --- a/Server/World.cs +++ b/Server/World.cs @@ -1089,7 +1089,7 @@ namespace Server { try { using ( StreamWriter op = new StreamWriter( "world-save-errors.log", true ) ) { - op.WriteLine( "{0}\t{1}", DateTime.Now, message ); + op.WriteLine( "{0}\t{1}", DateTime.UtcNow, message ); op.WriteLine( new StackTrace( 2 ).ToString() ); op.WriteLine(); }