From 63f0f919e20d1aa1dac839318bab7d74c6e25f77 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 17 Apr 2021 19:28:50 -0400 Subject: [PATCH] Core/Misc: Replace Time.UnixTime with GameTime.GetGameTime() Port From (https://github.com/TrinityCore/TrinityCore/commit/e17e4e6f0700c7d950e1b2654c217ec8b28ae79e) --- .../Game/Achievements/AchievementManager.cs | 14 +++---- Source/Game/Achievements/CriteriaHandler.cs | 2 +- Source/Game/BattleFields/BattleField.cs | 10 ++--- Source/Game/BattleFields/Zones/WinterGrasp.cs | 2 +- Source/Game/BlackMarket/BlackMarketEntry.cs | 4 +- Source/Game/BlackMarket/BlackMarketManager.cs | 4 +- Source/Game/Calendar/CalendarManager.cs | 2 +- Source/Game/Chat/Commands/BanCommands.cs | 4 +- Source/Game/Chat/Commands/EventCommands.cs | 4 +- .../Game/Chat/Commands/GameObjectCommands.cs | 2 +- Source/Game/Chat/Commands/InstanceCommands.cs | 6 +-- Source/Game/Chat/Commands/ListCommands.cs | 4 +- Source/Game/Chat/Commands/MiscCommands.cs | 6 +-- Source/Game/Chat/Commands/NPCCommands.cs | 2 +- Source/Game/DungeonFinding/LFGManager.cs | 14 +++---- Source/Game/DungeonFinding/LFGQueue.cs | 4 +- Source/Game/Entities/Corpse.cs | 4 +- Source/Game/Entities/Creature/Creature.cs | 40 +++++++++---------- Source/Game/Entities/GameObject/GameObject.cs | 20 +++++----- Source/Game/Entities/Item/Item.cs | 6 +-- Source/Game/Entities/Pet.cs | 8 ++-- Source/Game/Entities/Player/Player.Combat.cs | 4 +- Source/Game/Entities/Player/Player.DB.cs | 10 ++--- Source/Game/Entities/Player/Player.Items.cs | 4 +- Source/Game/Entities/Player/Player.Map.cs | 2 +- Source/Game/Entities/Player/Player.PvP.cs | 6 +-- Source/Game/Entities/Player/Player.Quest.cs | 6 +-- Source/Game/Entities/Player/Player.Talents.cs | 2 +- Source/Game/Entities/Player/Player.cs | 28 ++++++------- Source/Game/Entities/Player/RestMgr.cs | 2 +- Source/Game/Entities/Unit/Unit.Pets.cs | 2 +- Source/Game/Events/GameEventManager.cs | 18 ++++----- Source/Game/Garrisons/Garrisons.cs | 6 +-- Source/Game/Globals/ObjectManager.cs | 2 +- Source/Game/Guilds/Guild.cs | 14 +++---- Source/Game/Guilds/GuildFinderManager.cs | 2 +- Source/Game/Handlers/BattleFieldHandler.cs | 2 +- Source/Game/Handlers/CalendarHandler.cs | 16 ++++---- Source/Game/Handlers/CharacterHandler.cs | 8 ++-- Source/Game/Handlers/ChatHandler.cs | 4 +- Source/Game/Handlers/DuelHandler.cs | 2 +- Source/Game/Handlers/GuildFinderHandler.cs | 8 ++-- Source/Game/Handlers/GuildHandler.cs | 2 +- Source/Game/Handlers/HotfixHandler.cs | 2 +- Source/Game/Handlers/LFGHandler.cs | 2 +- Source/Game/Handlers/LogoutHandler.cs | 2 +- Source/Game/Handlers/MailHandler.cs | 12 +++--- Source/Game/Handlers/MiscHandler.cs | 4 +- Source/Game/Handlers/MovementHandler.cs | 2 +- Source/Game/Handlers/PetHandler.cs | 2 +- Source/Game/Handlers/QueryHandler.cs | 2 +- Source/Game/Handlers/TimeHandler.cs | 2 +- Source/Game/Mails/MailDraft.cs | 2 +- .../Maps/Instances/InstanceSaveManager.cs | 10 ++--- Source/Game/Maps/Map.cs | 12 +++--- Source/Game/Maps/ObjectGridLoader.cs | 2 +- Source/Game/Networking/PacketLog.cs | 2 +- Source/Game/Networking/Packets/MailPackets.cs | 4 +- Source/Game/Networking/WorldSocket.cs | 6 +-- .../Quest/QuestObjectiveCriteriaManager.cs | 2 +- Source/Game/Scenarios/InstanceScenario.cs | 2 +- Source/Game/Server/WorldManager.cs | 26 ++++++------ Source/Game/Server/WorldSession.cs | 5 +-- Source/Game/Spells/Auras/Aura.cs | 2 +- Source/Game/SupportSystem/SupportManager.cs | 4 +- Source/Game/SupportSystem/SupportTickets.cs | 8 ++-- Source/Scripts/Spells/Items.cs | 2 +- Source/Scripts/World/NpcSpecial.cs | 4 +- 68 files changed, 217 insertions(+), 218 deletions(-) diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index e55a0bfb3..995057c13 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -279,7 +279,7 @@ namespace Game.Achievements if (!criteriaResult.IsEmpty()) { - var now = Time.UnixTime; + var now = GameTime.GetGameTime(); do { uint id = criteriaResult.Read(0); @@ -518,7 +518,7 @@ namespace Game.Achievements Log.outDebug(LogFilter.Achievement, "PlayerAchievementMgr.CompletedAchievement({0}). {1}", achievement.Id, GetOwnerInfo()); CompletedAchievementData ca = new(); - ca.Date = Time.UnixTime; + ca.Date = GameTime.GetGameTime(); ca.Changed = true; _completedAchievements[achievement.Id] = ca; @@ -687,7 +687,7 @@ namespace Game.Achievements achievementEarned.Earner = _owner.GetGUID(); achievementEarned.EarnerNativeRealm = achievementEarned.EarnerVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); achievementEarned.AchievementID = achievement.Id; - achievementEarned.Time = Time.UnixTime; + achievementEarned.Time = GameTime.GetGameTime(); if (!achievement.Flags.HasAnyFlag(AchievementFlags.TrackingFlag)) _owner.SendMessageToSetInRange(achievementEarned, WorldConfig.GetFloatValue(WorldCfg.ListenRangeSay), true); @@ -730,7 +730,7 @@ namespace Game.Achievements GuildAchievementDeleted guildAchievementDeleted = new(); guildAchievementDeleted.AchievementID = iter.Key; guildAchievementDeleted.GuildGUID = guid; - guildAchievementDeleted.TimeDeleted = Time.UnixTime; + guildAchievementDeleted.TimeDeleted = GameTime.GetGameTime(); SendPacket(guildAchievementDeleted); } @@ -787,7 +787,7 @@ namespace Game.Achievements if (!criteriaResult.IsEmpty()) { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); do { uint id = criteriaResult.Read(0); @@ -980,7 +980,7 @@ namespace Game.Achievements SendAchievementEarned(achievement); CompletedAchievementData ca = new(); - ca.Date = Time.UnixTime; + ca.Date = GameTime.GetGameTime(); ca.Changed = true; if (achievement.Flags.HasAnyFlag(AchievementFlags.ShowGuildMembers)) @@ -1055,7 +1055,7 @@ namespace Game.Achievements GuildAchievementEarned guildAchievementEarned = new(); guildAchievementEarned.AchievementID = achievement.Id; guildAchievementEarned.GuildGUID = _owner.GetGUID(); - guildAchievementEarned.TimeEarned = Time.UnixTime; + guildAchievementEarned.TimeEarned = GameTime.GetGameTime(); SendPacket(guildAchievementEarned); } diff --git a/Source/Game/Achievements/CriteriaHandler.cs b/Source/Game/Achievements/CriteriaHandler.cs index 35e03da96..3b937dd3a 100644 --- a/Source/Game/Achievements/CriteriaHandler.cs +++ b/Source/Game/Achievements/CriteriaHandler.cs @@ -605,7 +605,7 @@ namespace Game.Achievements } progress.Changed = true; - progress.Date = Time.UnixTime; // set the date to the latest update. + progress.Date = GameTime.GetGameTime(); // set the date to the latest update. progress.PlayerGUID = referencePlayer ? referencePlayer.GetGUID() : ObjectGuid.Empty; _criteriaProgress[criteria.Id] = progress; diff --git a/Source/Game/BattleFields/BattleField.cs b/Source/Game/BattleFields/BattleField.cs index d67817b91..2f799ba11 100644 --- a/Source/Game/BattleFields/BattleField.cs +++ b/Source/Game/BattleFields/BattleField.cs @@ -70,7 +70,7 @@ namespace Game.BattleFields else // No more vacant places { // todo Send a packet to announce it to player - m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10; + m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = GameTime.GetGameTime() + 10; InvitePlayerToQueue(player); } } @@ -150,7 +150,7 @@ namespace Game.BattleFields // Kick players who chose not to accept invitation to the battle if (m_uiKickDontAcceptTimer <= diff) { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); for (int team = 0; team < SharedConst.BGTeamsCount; team++) { foreach (var pair in m_InvitedPlayers[team]) @@ -247,7 +247,7 @@ namespace Game.BattleFields if (m_PlayersInWar[player.GetTeamId()].Count + m_InvitedPlayers[player.GetTeamId()].Count < m_MaxPlayer) InvitePlayerToWar(player); else // Battlefield is full of players - m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10; + m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = GameTime.GetGameTime() + 10; } } } @@ -272,7 +272,7 @@ namespace Game.BattleFields if (player.GetLevel() < m_MinLevel) { if (!m_PlayersWillBeKick[player.GetTeamId()].ContainsKey(player.GetGUID())) - m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + 10; + m_PlayersWillBeKick[player.GetTeamId()][player.GetGUID()] = GameTime.GetGameTime() + 10; return; } @@ -281,7 +281,7 @@ namespace Game.BattleFields return; m_PlayersWillBeKick[player.GetTeamId()].Remove(player.GetGUID()); - m_InvitedPlayers[player.GetTeamId()][player.GetGUID()] = Time.UnixTime + m_TimeForAcceptInvite; + m_InvitedPlayers[player.GetTeamId()][player.GetGUID()] = GameTime.GetGameTime() + m_TimeForAcceptInvite; player.GetSession().SendBfInvitePlayerToWar(GetQueueId(), m_ZoneId, m_TimeForAcceptInvite); } diff --git a/Source/Game/BattleFields/Zones/WinterGrasp.cs b/Source/Game/BattleFields/Zones/WinterGrasp.cs index 001d968d6..2942856d4 100644 --- a/Source/Game/BattleFields/Zones/WinterGrasp.cs +++ b/Source/Game/BattleFields/Zones/WinterGrasp.cs @@ -766,7 +766,7 @@ namespace Game.BattleFields packet.AddState(WGWorldStates.ShowWorldstate, IsWarTime()); for (uint i = 0; i < 2; ++i) - packet.AddState(WGConst.ClockWorldState[i], (int)(Time.UnixTime + (m_Timer / 1000))); + packet.AddState(WGConst.ClockWorldState[i], (int)(GameTime.GetGameTime() + (m_Timer / 1000))); packet.AddState(WGWorldStates.VehicleH, (int)GetData(WGData.VehicleH)); packet.AddState(WGWorldStates.MaxVehicleH, (int)GetData(WGData.MaxVehicleH)); diff --git a/Source/Game/BlackMarket/BlackMarketEntry.cs b/Source/Game/BlackMarket/BlackMarketEntry.cs index 52a2429b8..070e87593 100644 --- a/Source/Game/BlackMarket/BlackMarketEntry.cs +++ b/Source/Game/BlackMarket/BlackMarketEntry.cs @@ -98,12 +98,12 @@ namespace Game.BlackMarket public uint GetSecondsRemaining() { - return (uint)(_secondsRemaining - (Time.UnixTime - Global.BlackMarketMgr.GetLastUpdate())); + return (uint)(_secondsRemaining - (GameTime.GetGameTime() - Global.BlackMarketMgr.GetLastUpdate())); } long GetExpirationTime() { - return Time.UnixTime + GetSecondsRemaining(); + return GameTime.GetGameTime() + GetSecondsRemaining(); } public bool IsCompleted() diff --git a/Source/Game/BlackMarket/BlackMarketManager.cs b/Source/Game/BlackMarket/BlackMarketManager.cs index 791993e48..bb7f04c68 100644 --- a/Source/Game/BlackMarket/BlackMarketManager.cs +++ b/Source/Game/BlackMarket/BlackMarketManager.cs @@ -70,7 +70,7 @@ namespace Game.BlackMarket return; } - _lastUpdate = Time.UnixTime; //Set update time before loading + _lastUpdate = GameTime.GetGameTime(); //Set update time before loading SQLTransaction trans = new(); do @@ -100,7 +100,7 @@ namespace Game.BlackMarket public void Update(bool updateTime = false) { SQLTransaction trans = new(); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); foreach (var entry in _auctions.Values) { if (entry.IsCompleted() && entry.GetBidder() != 0) diff --git a/Source/Game/Calendar/CalendarManager.cs b/Source/Game/Calendar/CalendarManager.cs index 7669824f5..a3c6b4023 100644 --- a/Source/Game/Calendar/CalendarManager.cs +++ b/Source/Game/Calendar/CalendarManager.cs @@ -646,7 +646,7 @@ namespace Game public CalendarInvite() { InviteId = 1; - ResponseTime = Time.UnixTime; + ResponseTime = 0; Status = CalendarInviteStatus.Invited; Rank = CalendarModerationRank.Player; Note = ""; diff --git a/Source/Game/Chat/Commands/BanCommands.cs b/Source/Game/Chat/Commands/BanCommands.cs index 94bd56226..2013b3331 100644 --- a/Source/Game/Chat/Commands/BanCommands.cs +++ b/Source/Game/Chat/Commands/BanCommands.cs @@ -247,7 +247,7 @@ namespace Game.Chat.Commands { long unbanDate = result.Read(3); bool active = false; - if (result.Read(2) && (result.Read(1) == 0L || unbanDate >= Time.UnixTime)) + if (result.Read(2) && (result.Read(1) == 0L || unbanDate >= GameTime.GetGameTime())) active = true; bool permanent = (result.Read(1) == 0L); string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read(1), true); @@ -297,7 +297,7 @@ namespace Game.Chat.Commands { long unbanDate = result.Read(3); bool active = false; - if (result.Read(2) && (result.Read(1) == 0 || unbanDate >= Time.UnixTime)) + if (result.Read(2) && (result.Read(1) == 0 || unbanDate >= GameTime.GetGameTime())) active = true; bool permanent = (result.Read(1) == 0); string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read(1), true); diff --git a/Source/Game/Chat/Commands/EventCommands.cs b/Source/Game/Chat/Commands/EventCommands.cs index 672511d59..cce3f240e 100644 --- a/Source/Game/Chat/Commands/EventCommands.cs +++ b/Source/Game/Chat/Commands/EventCommands.cs @@ -59,8 +59,8 @@ namespace Game.Chat string endTimeStr = Time.UnixTimeToDateTime(eventData.end).ToLongDateString(); uint delay = Global.GameEventMgr.NextCheck(eventId); - long nextTime = Time.UnixTime + delay; - string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Time.UnixTimeToDateTime(Time.UnixTime + delay).ToShortTimeString() : "-"; + long nextTime = GameTime.GetGameTime() + delay; + string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Time.UnixTimeToDateTime(GameTime.GetGameTime() + delay).ToShortTimeString() : "-"; string occurenceStr = Time.secsToTimeString(eventData.occurence * Time.Minute); string lengthStr = Time.secsToTimeString(eventData.length * Time.Minute); diff --git a/Source/Game/Chat/Commands/GameObjectCommands.cs b/Source/Game/Chat/Commands/GameObjectCommands.cs index 3c18780c8..8113a1769 100644 --- a/Source/Game/Chat/Commands/GameObjectCommands.cs +++ b/Source/Game/Chat/Commands/GameObjectCommands.cs @@ -483,7 +483,7 @@ namespace Game.Chat if (target) { - int curRespawnDelay = (int)(target.GetRespawnTimeEx() - Time.UnixTime); + int curRespawnDelay = (int)(target.GetRespawnTimeEx() - GameTime.GetGameTime()); if (curRespawnDelay < 0) curRespawnDelay = 0; diff --git a/Source/Game/Chat/Commands/InstanceCommands.cs b/Source/Game/Chat/Commands/InstanceCommands.cs index 5ec98eac3..c5f895a0f 100644 --- a/Source/Game/Chat/Commands/InstanceCommands.cs +++ b/Source/Game/Chat/Commands/InstanceCommands.cs @@ -43,7 +43,7 @@ namespace Game.Chat foreach (var pair in binds) { InstanceSave save = pair.Value.save; - string timeleft = Time.GetTimeString(save.GetResetTime() - Time.UnixTime); + string timeleft = Time.GetTimeString(save.GetResetTime() - GameTime.GetGameTime()); handler.SendSysMessage(format, pair.Key, save.GetInstanceId(), pair.Value.perm ? "yes" : "no", save.GetDifficultyID(), save.CanReset() ? "yes" : "no", timeleft); counter++; } @@ -60,7 +60,7 @@ namespace Game.Chat foreach (var pair in binds) { InstanceSave save = pair.Value.save; - string timeleft = Time.GetTimeString(save.GetResetTime() - Time.UnixTime); + string timeleft = Time.GetTimeString(save.GetResetTime() - GameTime.GetGameTime()); handler.SendSysMessage(format, pair.Key, save.GetInstanceId(), pair.Value.perm ? "yes" : "no", save.GetDifficultyID(), save.CanReset() ? "yes" : "no", timeleft); counter++; } @@ -102,7 +102,7 @@ namespace Game.Chat InstanceSave save = pair.Value.save; if (pair.Key != player.GetMapId() && (MapId == 0 || MapId == pair.Key) && (diff == -1 || diff == (sbyte)save.GetDifficultyID())) { - string timeleft = Time.GetTimeString(save.GetResetTime() - Time.UnixTime); + string timeleft = Time.GetTimeString(save.GetResetTime() - GameTime.GetGameTime()); handler.SendSysMessage("unbinding map: {0} inst: {1} perm: {2} diff: {3} canReset: {4} TTR: {5}", pair.Key, save.GetInstanceId(), pair.Value.perm ? "yes" : "no", save.GetDifficultyID(), save.CanReset() ? "yes" : "no", timeleft); player.UnbindInstance(pair.Key, (Difficulty)difficulty.Id); diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs index 24f31f6fc..455a816e7 100644 --- a/Source/Game/Chat/Commands/ListCommands.cs +++ b/Source/Game/Chat/Commands/ListCommands.cs @@ -602,7 +602,7 @@ namespace Game.Chat.Commands uint gridY = ri.gridId / MapConst.MaxGrids; uint gridX = ri.gridId % MapConst.MaxGrids; - string respawnTime = ri.respawnTime > Time.UnixTime ? Time.secsToTimeString((ulong)(ri.respawnTime - Time.UnixTime), true) : stringOverdue; + string respawnTime = ri.respawnTime > GameTime.GetGameTime() ? Time.secsToTimeString((ulong)(ri.respawnTime - GameTime.GetGameTime()), true) : stringOverdue; handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? respawnTime : "inactive")}"); } @@ -625,7 +625,7 @@ namespace Game.Chat.Commands uint gridY = ri.gridId / MapConst.MaxGrids; uint gridX = ri.gridId % MapConst.MaxGrids; - string respawnTime = ri.respawnTime > Time.UnixTime ? Time.secsToTimeString((ulong)(ri.respawnTime - Time.UnixTime), true) : stringOverdue; + string respawnTime = ri.respawnTime > GameTime.GetGameTime() ? Time.secsToTimeString((ulong)(ri.respawnTime - GameTime.GetGameTime()), true) : stringOverdue; handler.SendSysMessage($"{ri.spawnId} | {ri.entry} | [{gridX},{gridY}] | {GetZoneName(ri.zoneId, handler.GetSessionDbcLocale())} ({ri.zoneId}) | {(map.IsSpawnGroupActive(data.spawnGroupData.groupId) ? respawnTime : "inactive")}"); } return true; diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 95853bb96..6f355b9f5 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -1334,7 +1334,7 @@ namespace Game.Chat if (target) { // Target is online, mute will be in effect right away. - long muteTime = Time.UnixTime + notSpeakTime * Time.Minute; + long muteTime = GameTime.GetGameTime() + notSpeakTime * Time.Minute; target.GetSession().m_muteTime = muteTime; stmt.AddValue(0, muteTime); string nameLink = handler.PlayerLink(targetName); @@ -1727,11 +1727,11 @@ namespace Game.Chat // Output III. LANG_PINFO_BANNED if ban exists and is applied if (banTime >= 0) - handler.SendSysMessage(CypherStrings.PinfoBanned, banType, banReason, banTime > 0 ? Time.secsToTimeString((ulong)(banTime - Time.UnixTime), true) : handler.GetCypherString(CypherStrings.Permanently), bannedBy); + handler.SendSysMessage(CypherStrings.PinfoBanned, banType, banReason, banTime > 0 ? Time.secsToTimeString((ulong)(banTime - GameTime.GetGameTime()), true) : handler.GetCypherString(CypherStrings.Permanently), bannedBy); // Output IV. LANG_PINFO_MUTED if mute is applied if (muteTime > 0) - handler.SendSysMessage(CypherStrings.PinfoMuted, muteReason, Time.secsToTimeString((ulong)(muteTime - Time.UnixTime), true), muteBy); + handler.SendSysMessage(CypherStrings.PinfoMuted, muteReason, Time.secsToTimeString((ulong)(muteTime - GameTime.GetGameTime()), true), muteBy); // Output V. LANG_PINFO_ACC_ACCOUNT handler.SendSysMessage(CypherStrings.PinfoAccAccount, userName, accId, security); diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index 3e5cbe544..05b4afcc0 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -131,7 +131,7 @@ namespace Game.Chat uint nativeid = target.GetNativeDisplayId(); uint Entry = target.GetEntry(); - long curRespawnDelay = target.GetRespawnCompatibilityMode() ? target.GetRespawnTimeEx() - Time.UnixTime : target.GetMap().GetCreatureRespawnTime(target.GetSpawnId()) - Time.UnixTime; + long curRespawnDelay = target.GetRespawnCompatibilityMode() ? target.GetRespawnTimeEx() - GameTime.GetGameTime() : target.GetMap().GetCreatureRespawnTime(target.GetSpawnId()) - GameTime.GetGameTime(); if (curRespawnDelay < 0) curRespawnDelay = 0; diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index 6cab2f152..8334eae17 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -255,7 +255,7 @@ namespace Game.DungeonFinding if (!IsOptionEnabled(LfgOptions.EnableDungeonFinder | LfgOptions.EnableRaidBrowser)) return; - long currTime = Time.UnixTime; + long currTime = GameTime.GetGameTime(); // Remove obsolete role checks foreach (var pairCheck in RoleChecksStore) @@ -500,14 +500,14 @@ namespace Game.DungeonFinding ticket.RequesterGuid = guid; ticket.Id = GetQueueId(gguid); ticket.Type = RideType.Lfg; - ticket.Time = (int)Time.UnixTime; + ticket.Time = GameTime.GetGameTime(); string debugNames = ""; if (grp) // Begin rolecheck { // Create new rolecheck LfgRoleCheck roleCheck = new(); - roleCheck.cancelTime = Time.UnixTime + SharedConst.LFGTimeRolecheck; + roleCheck.cancelTime = GameTime.GetGameTime() + SharedConst.LFGTimeRolecheck; roleCheck.state = LfgRoleCheckState.Initialiting; roleCheck.leader = guid; roleCheck.dungeons = dungeons; @@ -549,7 +549,7 @@ namespace Game.DungeonFinding Dictionary rolesMap = new(); rolesMap[guid] = roles; LFGQueue queue = GetQueue(guid); - queue.AddQueueData(guid, Time.UnixTime, dungeons, rolesMap); + queue.AddQueueData(guid, GameTime.GetGameTime(), dungeons, rolesMap); if (!isContinue) { @@ -723,7 +723,7 @@ namespace Game.DungeonFinding { SetState(gguid, LfgState.Queued); LFGQueue queue = GetQueue(gguid); - queue.AddQueueData(gguid, Time.UnixTime, roleCheck.dungeons, roleCheck.roles); + queue.AddQueueData(gguid, GameTime.GetGameTime(), roleCheck.dungeons, roleCheck.roles); RoleChecksStore.Remove(gguid); } else if (roleCheck.state != LfgRoleCheckState.Initialiting) @@ -978,7 +978,7 @@ namespace Game.DungeonFinding bool sendUpdate = proposal.state != LfgProposalState.Success; proposal.state = LfgProposalState.Success; - long joinTime = Time.UnixTime; + long joinTime = GameTime.GetGameTime(); LFGQueue queue = GetQueue(guid); LfgUpdateData updateData = new(LfgUpdateType.GroupFound); @@ -1129,7 +1129,7 @@ namespace Game.DungeonFinding LfgPlayerBoot boot = BootsStore[gguid]; boot.inProgress = true; - boot.cancelTime = Time.UnixTime + SharedConst.LFGTimeBoot; + boot.cancelTime = GameTime.GetGameTime() + SharedConst.LFGTimeBoot; boot.reason = reason; boot.victim = victim; diff --git a/Source/Game/DungeonFinding/LFGQueue.cs b/Source/Game/DungeonFinding/LFGQueue.cs index 81da83709..43548c465 100644 --- a/Source/Game/DungeonFinding/LFGQueue.cs +++ b/Source/Game/DungeonFinding/LFGQueue.cs @@ -522,7 +522,7 @@ namespace Game.DungeonFinding } // Create a new proposal - proposal.cancelTime = Time.UnixTime + SharedConst.LFGTimeProposal; + proposal.cancelTime = GameTime.GetGameTime() + SharedConst.LFGTimeProposal; proposal.state = LfgProposalState.Initiating; proposal.leader = ObjectGuid.Empty; proposal.dungeonId = proposalDungeons.SelectRandom(); @@ -746,7 +746,7 @@ namespace Game.DungeonFinding { public LfgQueueData() { - joinTime = Time.UnixTime; + joinTime = GameTime.GetGameTime(); tanks = SharedConst.LFGTanksNeeded; healers = SharedConst.LFGHealersNeeded; dps = SharedConst.LFGDPSNeeded; diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index e21fb6275..8ca5d39bb 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -39,7 +39,7 @@ namespace Game.Entities m_corpseData = new CorpseData(); - m_time = Time.UnixTime; + m_time = GameTime.GetGameTime(); } public override void AddToWorld() @@ -312,7 +312,7 @@ namespace Game.Entities } public long GetGhostTime() { return m_time; } - public void ResetGhostTime() { m_time = Time.UnixTime; } + public void ResetGhostTime() { m_time = GameTime.GetGameTime(); } public CorpseType GetCorpseType() { return m_type; } public CellCoord GetCellCoord() { return _cellCoord; } diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index b3e2aaf43..e2b1ab291 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -163,7 +163,7 @@ namespace Game.Entities if (m_respawnCompatibilityMode) { - m_corpseRemoveTime = Time.UnixTime; + m_corpseRemoveTime = GameTime.GetGameTime(); SetDeathState(DeathState.Dead); RemoveAllAuras(); //DestroyForNearbyPlayers(); // old UpdateObjectVisibility() @@ -177,7 +177,7 @@ namespace Game.Entities // Should get removed later, just keep "compatibility" with scripts if (setSpawnTime) - m_respawnTime = Math.Max(Time.UnixTime + respawnDelay, m_respawnTime); + m_respawnTime = Math.Max(GameTime.GetGameTime() + respawnDelay, m_respawnTime); // if corpse was removed during falling, the falling will continue and override relocation to respawn position if (IsFalling()) @@ -211,7 +211,7 @@ namespace Game.Entities if (setSpawnTime) { uint respawnDelay = m_respawnDelay; - m_respawnTime = Math.Max(Time.UnixTime + respawnDelay, m_respawnTime); + m_respawnTime = Math.Max(GameTime.GetGameTime() + respawnDelay, m_respawnTime); SaveRespawnTime(0, false); } @@ -444,7 +444,7 @@ namespace Game.Entities break; case DeathState.Dead: { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (m_respawnTime <= now) { // First check if there are any scripts that object to us respawning @@ -499,7 +499,7 @@ namespace Game.Entities } else m_groupLootTimer -= diff; } - else if (m_corpseRemoveTime <= Time.UnixTime) + else if (m_corpseRemoveTime <= GameTime.GetGameTime()) { RemoveCorpse(false); Log.outDebug(LogFilter.Unit, "Removing corpse... {0} ", GetEntry()); @@ -1025,10 +1025,10 @@ namespace Game.Entities public void StartPickPocketRefillTimer() { - _pickpocketLootRestore = Time.UnixTime + WorldConfig.GetIntValue(WorldCfg.CreaturePickpocketRefill); + _pickpocketLootRestore = GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.CreaturePickpocketRefill); } public void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; } - public bool CanGeneratePickPocketLoot() { return _pickpocketLootRestore <= Time.UnixTime; } + public bool CanGeneratePickPocketLoot() { return _pickpocketLootRestore <= GameTime.GetGameTime(); } public ObjectGuid GetLootRecipientGUID() { return m_lootRecipient; } public Player GetLootRecipient() @@ -1536,7 +1536,7 @@ namespace Game.Entities if (base.IsInvisibleDueToDespawn()) return true; - if (IsAlive() || m_corpseRemoveTime > Time.UnixTime) + if (IsAlive() || m_corpseRemoveTime > GameTime.GetGameTime()) return false; return true; @@ -1641,7 +1641,7 @@ namespace Game.Entities if (s == DeathState.JustDied) { - m_corpseRemoveTime = Time.UnixTime + m_corpseDelay; + m_corpseRemoveTime = GameTime.GetGameTime() + m_corpseDelay; uint respawnDelay = m_respawnDelay; uint scalingMode = WorldConfig.GetUIntValue(WorldCfg.RespawnDynamicMode); if (scalingMode != 0) @@ -1652,14 +1652,14 @@ namespace Game.Entities if (IsDungeonBoss() && m_respawnDelay == 0) m_respawnTime = long.MaxValue; // never respawn in this instance else - m_respawnTime = Time.UnixTime + respawnDelay + m_corpseDelay; + m_respawnTime = GameTime.GetGameTime() + respawnDelay + m_corpseDelay; } else { if (IsDungeonBoss() && m_respawnDelay == 0) m_respawnTime = long.MaxValue; // never respawn in this instance else - m_respawnTime = Time.UnixTime + respawnDelay; + m_respawnTime = GameTime.GetGameTime() + respawnDelay; } // always save boss respawn time at death to prevent crash cheating @@ -1848,7 +1848,7 @@ namespace Game.Entities uint scalingMode = WorldConfig.GetUIntValue(WorldCfg.RespawnDynamicMode); if (scalingMode != 0) GetMap().ApplyDynamicModeRespawnScaling(this, m_spawnId, ref respawnDelay, scalingMode); - m_respawnTime = Time.UnixTime + respawnDelay; + m_respawnTime = GameTime.GetGameTime() + respawnDelay; SaveRespawnTime(); } @@ -2128,7 +2128,7 @@ namespace Game.Entities return; } - long thisRespawnTime = forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime; + long thisRespawnTime = forceDelay != 0 ? GameTime.GetGameTime() + forceDelay : m_respawnTime; GetMap().SaveRespawnTime(SpawnObjectType.Creature, m_spawnId, GetEntry(), thisRespawnTime, GetMap().GetZoneId(GetPhaseShift(), GetHomePosition()), GridDefines.ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId(), saveToDb && m_creatureData != null && m_creatureData.dbData); } @@ -2326,7 +2326,7 @@ namespace Game.Entities public long GetRespawnTimeEx() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (m_respawnTime > now) return m_respawnTime; else @@ -2364,7 +2364,7 @@ namespace Game.Entities if (LootStorage.Skinning.HaveLootFor(GetCreatureTemplate().SkinLootId)) AddUnitFlag(UnitFlags.Skinnable); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); // Do not reset corpse remove time if corpse is already removed if (m_corpseRemoveTime <= now) return; @@ -2532,7 +2532,7 @@ namespace Game.Entities if (vCount == null) return vItem.maxcount; - long ptime = Time.UnixTime; + long ptime = GameTime.GetGameTime(); if (vCount.lastIncrementTime + vItem.incrtime <= ptime) { @@ -2572,7 +2572,7 @@ namespace Game.Entities return new_count; } - long ptime = Time.UnixTime; + long ptime = GameTime.GetGameTime(); if (vCount.lastIncrementTime + vItem.incrtime <= ptime) { @@ -3032,7 +3032,7 @@ namespace Game.Entities // Is the creature script objecting to us spawning? If yes, delay by a little bit (then re-check in ::Update) if (m_respawnCompatibilityMode && m_respawnTime == 0 && !Global.ScriptMgr.CanSpawn(spawnId, GetEntry(), GetCreatureData(), map)) - m_respawnTime = Time.UnixTime + RandomHelper.URand(4, 7); + m_respawnTime = GameTime.GetGameTime() + RandomHelper.URand(4, 7); if (m_respawnTime != 0) // respawn on UpdateLoadCreatureFromDB { @@ -3074,7 +3074,7 @@ namespace Game.Entities public void SetDefaultMovementType(MovementGeneratorType mgt) { DefaultMovementType = mgt; } public long GetRespawnTime() { return m_respawnTime; } - public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? Time.UnixTime + respawn : 0; } + public void SetRespawnTime(uint respawn) { m_respawnTime = respawn != 0 ? GameTime.GetGameTime() + respawn : 0; } public uint GetRespawnDelay() { return m_respawnDelay; } public void SetRespawnDelay(uint delay) { m_respawnDelay = delay; } @@ -3276,7 +3276,7 @@ namespace Game.Entities { itemId = _item; count = _count; - lastIncrementTime = Time.UnixTime; + lastIncrementTime = GameTime.GetGameTime(); } public uint itemId; public uint count; diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 44ae4b4f9..81c321a33 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -493,7 +493,7 @@ namespace Game.Entities case GameObjectTypes.FishingNode: { // fishing code (bobber ready) - if (Time.UnixTime > m_respawnTime - 5) + if (GameTime.GetGameTime() > m_respawnTime - 5) { // splash bobber (bobber ready now) Unit caster = GetOwner(); @@ -527,7 +527,7 @@ namespace Game.Entities { if (m_respawnTime > 0) // timer on { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (m_respawnTime <= now) // timer expired { ObjectGuid dbtableHighGuid = ObjectGuid.Create(HighGuid.GameObject, GetMapId(), GetEntry(), m_spawnId); @@ -820,7 +820,7 @@ namespace Game.Entities uint scalingMode = WorldConfig.GetUIntValue(WorldCfg.RespawnDynamicMode); if (scalingMode != 0) GetMap().ApplyDynamicModeRespawnScaling(this, m_spawnId, ref respawnDelay, scalingMode); - m_respawnTime = Time.UnixTime + respawnDelay; + m_respawnTime = GameTime.GetGameTime() + respawnDelay; // if option not set then object will be saved at grid unload // Otherwise just save respawn time to map object memory @@ -1038,7 +1038,7 @@ namespace Game.Entities m_respawnTime = GetMap().GetGORespawnTime(m_spawnId); // ready to respawn - if (m_respawnTime != 0 && m_respawnTime <= Time.UnixTime) + if (m_respawnTime != 0 && m_respawnTime <= GameTime.GetGameTime()) { m_respawnTime = 0; GetMap().RemoveRespawnTime(SpawnObjectType.GameObject, m_spawnId); @@ -1140,7 +1140,7 @@ namespace Game.Entities public override void SaveRespawnTime(uint forceDelay = 0, bool savetodb = true) { - if (m_goData != null && m_respawnTime > Time.UnixTime && m_spawnedByDefault) + if (m_goData != null && m_respawnTime > GameTime.GetGameTime() && m_spawnedByDefault) { if (m_respawnCompatibilityMode) { @@ -1148,7 +1148,7 @@ namespace Game.Entities return; } - long thisRespawnTime = forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime; + long thisRespawnTime = forceDelay != 0 ? GameTime.GetGameTime() + forceDelay : m_respawnTime; GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData ? savetodb : false); } } @@ -1209,7 +1209,7 @@ namespace Game.Entities { if (m_spawnedByDefault && m_respawnTime > 0) { - m_respawnTime = Time.UnixTime; + m_respawnTime = GameTime.GetGameTime(); GetMap().RemoveRespawnTime(SpawnObjectType.GameObject, m_spawnId, true); } } @@ -2709,7 +2709,7 @@ namespace Game.Entities public long GetRespawnTime() { return m_respawnTime; } public long GetRespawnTimeEx() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (m_respawnTime > now) return m_respawnTime; else @@ -2718,7 +2718,7 @@ namespace Game.Entities public void SetRespawnTime(int respawn) { - m_respawnTime = respawn > 0 ? Time.UnixTime + respawn : 0; + m_respawnTime = respawn > 0 ? GameTime.GetGameTime() + respawn : 0; m_respawnDelayTime = (uint)(respawn > 0 ? respawn : 0); } @@ -2752,7 +2752,7 @@ namespace Game.Entities void AddLootMode(LootModes lootMode) { m_LootMode |= lootMode; } void RemoveLootMode(LootModes lootMode) { m_LootMode &= ~lootMode; } void ResetLootMode() { m_LootMode = LootModes.Default; } - public void SetLootGenerationTime() { m_lootGenerationTime = (uint)Time.UnixTime; } + public void SetLootGenerationTime() { m_lootGenerationTime = (uint)GameTime.GetGameTime(); } public uint GetLootGenerationTime() { return m_lootGenerationTime; } public void AddToSkillupList(ObjectGuid PlayerGuid) { m_SkillupList.Add(PlayerGuid); } diff --git a/Source/Game/Entities/Item/Item.cs b/Source/Game/Entities/Item/Item.cs index 44fc8b2b6..913cf1b9b 100644 --- a/Source/Game/Entities/Item/Item.cs +++ b/Source/Game/Entities/Item/Item.cs @@ -42,7 +42,7 @@ namespace Game.Entities uState = ItemUpdateState.New; uQueuePos = -1; - m_lastPlayedTimeUpdate = Time.UnixTime; + m_lastPlayedTimeUpdate = GameTime.GetGameTime(); loot = new Loot(); } @@ -1356,7 +1356,7 @@ namespace Game.Entities // Get current played time uint current_playtime = m_itemData.CreatePlayedTime; // Calculate time elapsed since last played time update - long curtime = Time.UnixTime; + long curtime = GameTime.GetGameTime(); uint elapsed = (uint)(curtime - m_lastPlayedTimeUpdate); uint new_playtime = current_playtime + elapsed; // Check if the refund timer has expired yet @@ -1377,7 +1377,7 @@ namespace Game.Entities public uint GetPlayedTime() { - long curtime = Time.UnixTime; + long curtime = GameTime.GetGameTime(); uint elapsed = (uint)(curtime - m_lastPlayedTimeUpdate); return m_itemData.CreatePlayedTime + elapsed; } diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 6169617b4..074452b15 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -224,7 +224,7 @@ namespace Game.Entities break; } - SetPetNameTimestamp((uint)Time.UnixTime); // cast can't be helped here + SetPetNameTimestamp((uint)GameTime.GetGameTime()); // cast can't be helped here SetCreatorGUID(owner.GetGUID()); InitStatsForLevel(petlevel); @@ -299,7 +299,7 @@ namespace Game.Entities owner.SetMinion(this, true); map.AddToMap(ToCreature()); - uint timediff = (uint)(Time.UnixTime - result.Read(13)); + uint timediff = (uint)(GameTime.GetGameTime() - result.Read(13)); _LoadAuras(timediff); // load action bar, if data broken will fill later by default spells. @@ -453,7 +453,7 @@ namespace Game.Entities stmt.AddValue(10, curhealth); stmt.AddValue(11, curmana); stmt.AddValue(12, GenerateActionBarData()); - stmt.AddValue(13, Time.UnixTime); + stmt.AddValue(13, GameTime.GetGameTime()); stmt.AddValue(14, (uint)m_unitData.CreatedBySpell); stmt.AddValue(15, GetPetType()); stmt.AddValue(16, m_petSpecialization); @@ -534,7 +534,7 @@ namespace Game.Entities { case DeathState.Corpse: { - if (GetPetType() != PetType.Hunter || m_corpseRemoveTime <= Time.UnixTime) + if (GetPetType() != PetType.Hunter || m_corpseRemoveTime <= GameTime.GetGameTime()) { Remove(PetSaveMode.NotInSlot); //hunters' pets never get removed because of death, NEVER! return; diff --git a/Source/Game/Entities/Player/Player.Combat.cs b/Source/Game/Entities/Player/Player.Combat.cs index 7929e3d89..024cab9c3 100644 --- a/Source/Game/Entities/Player/Player.Combat.cs +++ b/Source/Game/Entities/Player/Player.Combat.cs @@ -621,7 +621,7 @@ namespace Game.Entities } else { - pvpInfo.EndTimer = Time.UnixTime; + pvpInfo.EndTimer = GameTime.GetGameTime(); SetPvP(state); } } @@ -658,7 +658,7 @@ namespace Game.Entities else // in friendly area { if (IsPvP() && !HasPlayerFlag(PlayerFlags.InPVP) && pvpInfo.EndTimer == 0) - pvpInfo.EndTimer = Time.UnixTime; // start toggle-off + pvpInfo.EndTimer = GameTime.GetGameTime(); // start toggle-off } } diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index fba76e96a..88d6e03c0 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -3012,7 +3012,7 @@ namespace Game.Entities SaveRecallPosition(); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); long logoutTime = logout_time; // since last logout (in seconds) @@ -3381,7 +3381,7 @@ namespace Game.Entities stmt.AddValue(index++, m_PlayedTimeTotal); stmt.AddValue(index++, m_PlayedTimeLevel); stmt.AddValue(index++, finiteAlways(_restMgr.GetRestBonus(RestTypes.XP))); - stmt.AddValue(index++, Time.UnixTime); + stmt.AddValue(index++, GameTime.GetGameTime()); stmt.AddValue(index++, (HasPlayerFlag(PlayerFlags.Resting) ? 1 : 0)); //save, far from tavern/city //save, but in tavern/city @@ -3521,7 +3521,7 @@ namespace Game.Entities stmt.AddValue(index++, m_PlayedTimeTotal); stmt.AddValue(index++, m_PlayedTimeLevel); stmt.AddValue(index++, finiteAlways(_restMgr.GetRestBonus(RestTypes.XP))); - stmt.AddValue(index++, Time.UnixTime); + stmt.AddValue(index++, GameTime.GetGameTime()); stmt.AddValue(index++, (HasPlayerFlag(PlayerFlags.Resting) ? 1 : 0)); //save, far from tavern/city //save, but in tavern/city @@ -3678,7 +3678,7 @@ namespace Game.Entities stmt.AddValue(3, Global.WorldMgr.GetRealmId().Index); stmt.AddValue(4, GetName()); stmt.AddValue(5, GetGUID().GetCounter()); - stmt.AddValue(6, Time.UnixTime); + stmt.AddValue(6, GameTime.GetGameTime()); loginTransaction.Append(stmt); // save pet (hunter pet level and experience and all type pets health/mana). @@ -4215,7 +4215,7 @@ namespace Game.Entities Log.outInfo(LogFilter.Player, "Player:DeleteOldChars: Deleting all characters which have been deleted {0} days before...", keepDays); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_OLD_CHARS); - stmt.AddValue(0, (uint)(Time.UnixTime - keepDays * Time.Day)); + stmt.AddValue(0, (uint)(GameTime.GetGameTime() - keepDays * Time.Day)); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 7f4b4a05a..99ebad175 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -3041,7 +3041,7 @@ namespace Game.Entities Log.outDebug(LogFilter.Player, "STORAGE: AddItemToBuyBackSlot item = {0}, slot = {1}", pItem.GetEntry(), slot); m_items[slot] = pItem; - var time = Time.UnixTime; + var time = GameTime.GetGameTime(); uint etime = (uint)(time - m_logintime + (30 * 3600)); uint eslot = slot - InventorySlots.BuyBackStart; @@ -5968,7 +5968,7 @@ namespace Game.Entities // loot was generated and respawntime has passed since then, allow to recreate loot // to avoid bugs, this rule covers spawned gameobjects only - if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.IsLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < Time.UnixTime) + if (go.IsSpawnedByDefault() && go.GetLootState() == LootState.Activated && !go.loot.IsLooted() && go.GetLootGenerationTime() + go.GetRespawnDelay() < GameTime.GetGameTime()) go.SetLootState(LootState.Ready); if (go.GetLootState() == LootState.Ready) diff --git a/Source/Game/Entities/Player/Player.Map.cs b/Source/Game/Entities/Player/Player.Map.cs index 24ec975c1..c60d3b857 100644 --- a/Source/Game/Entities/Player/Player.Map.cs +++ b/Source/Game/Entities/Player/Player.Map.cs @@ -458,7 +458,7 @@ namespace Game.Entities { InstanceInfoPkt instanceInfo = new(); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); foreach (var difficultyDic in m_boundInstances.Values) { foreach (var instanceBind in difficultyDic.Values) diff --git a/Source/Game/Entities/Player/Player.PvP.cs b/Source/Game/Entities/Player/Player.PvP.cs index 2855e3032..e320227bc 100644 --- a/Source/Game/Entities/Player/Player.PvP.cs +++ b/Source/Game/Entities/Player/Player.PvP.cs @@ -37,8 +37,8 @@ namespace Game.Entities public void UpdateHonorFields() { // called when rewarding honor and at each save - long now = Time.UnixTime; - long today = (Time.UnixTime / Time.Day) * Time.Day; + long now = GameTime.GetGameTime(); + long today = (GameTime.GetGameTime() / Time.Day) * Time.Day; if (m_lastHonorUpdateTime < today) { @@ -876,7 +876,7 @@ namespace Game.Entities { SendUpdateWorldState(3801, (uint)(wg.IsWarTime() ? 0 : 1)); uint timer = wg.IsWarTime() ? 0 : (wg.GetTimer() / 1000); // 0 - Time to next battle - SendUpdateWorldState(4354, (uint)(Time.UnixTime + timer)); + SendUpdateWorldState(4354, (uint)(GameTime.GetGameTime() + timer)); } } } diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs index 66e42ad57..7f52acecd 100644 --- a/Source/Game/Entities/Player/Player.Quest.cs +++ b/Source/Game/Entities/Player/Player.Quest.cs @@ -778,7 +778,7 @@ namespace Game.Entities AddTimedQuest(quest_id); questStatusData.Timer = limittime * Time.InMilliseconds; - qtime = (uint)(Time.UnixTime + limittime); + qtime = (uint)(GameTime.GetGameTime() + limittime); } else questStatusData.Timer = 0; @@ -3073,14 +3073,14 @@ namespace Game.Entities if (!qQuest.IsDFQuest()) { AddDynamicUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.DailyQuestsCompleted), quest_id); - m_lastDailyQuestTime = Time.UnixTime; // last daily quest time + m_lastDailyQuestTime = GameTime.GetGameTime(); // last daily quest time m_DailyQuestChanged = true; } else { m_DFQuests.Add(quest_id); - m_lastDailyQuestTime = Time.UnixTime; + m_lastDailyQuestTime = GameTime.GetGameTime(); m_DailyQuestChanged = true; } } diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index f79315f7e..d2207c4fc 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -539,7 +539,7 @@ namespace Game.Entities UpdateCriteria(CriteriaTypes.NumberOfTalentResets, 1); SetTalentResetCost(cost); - SetTalentResetTime(Time.UnixTime); + SetTalentResetTime(GameTime.GetGameTime()); } return true; diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index b61b74a09..1b4365446 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -71,7 +71,7 @@ namespace Game.Entities for (byte i = 0; i < (int)MirrorTimerType.Max; i++) m_MirrorTimer[i] = -1; - m_logintime = Time.UnixTime; + m_logintime = GameTime.GetGameTime(); m_Last_tick = m_logintime; m_timeSyncServer = GameTime.GetGameTimeMS(); @@ -99,7 +99,7 @@ namespace Game.Entities } // Honor System - m_lastHonorUpdateTime = Time.UnixTime; + m_lastHonorUpdateTime = GameTime.GetGameTime(); m_unitMovedByMe = this; m_playerMovingMe = this; @@ -241,7 +241,7 @@ namespace Game.Entities SetCreateCurrency(CurrencyTypes.JusticePoints, WorldConfig.GetUIntValue(WorldCfg.CurrencyStartJusticePoints)); // Played time - m_Last_tick = Time.UnixTime; + m_Last_tick = GameTime.GetGameTime(); m_PlayedTimeTotal = 0; m_PlayedTimeLevel = 0; @@ -324,7 +324,7 @@ namespace Game.Entities return; // undelivered mail - if (m_nextMailDelivereTime != 0 && m_nextMailDelivereTime <= Time.UnixTime) + if (m_nextMailDelivereTime != 0 && m_nextMailDelivereTime <= GameTime.GetGameTime()) { SendNewMail(); ++unReadMails; @@ -346,7 +346,7 @@ namespace Game.Entities base.Update(diff); SetCanDelayTeleport(false); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); UpdatePvPFlag(now); @@ -2041,7 +2041,7 @@ namespace Game.Entities public bool HasSummonPending() { - return m_summon_expire >= Time.UnixTime; + return m_summon_expire >= GameTime.GetGameTime(); } public void SendSummonRequestFrom(Unit summoner) @@ -2057,7 +2057,7 @@ namespace Game.Entities if (HasAura(23445)) return; - m_summon_expire = Time.UnixTime + PlayerConst.MaxPlayerSummonDelay; + m_summon_expire = GameTime.GetGameTime() + PlayerConst.MaxPlayerSummonDelay; m_summon_location = new WorldLocation(summoner); SummonRequest summonRequest = new(); @@ -2104,7 +2104,7 @@ namespace Game.Entities } // expire and auto declined - if (m_summon_expire < Time.UnixTime) + if (m_summon_expire < GameTime.GetGameTime()) return; // stop taxi flight at summon @@ -2727,7 +2727,7 @@ namespace Game.Entities { // calculate next delivery time (min. from non-delivered mails // and recalculate unReadMail - long cTime = Time.UnixTime; + long cTime = GameTime.GetGameTime(); m_nextMailDelivereTime = 0; unReadMails = 0; foreach (var mail in m_mail) @@ -2743,7 +2743,7 @@ namespace Game.Entities } public void AddNewMailDeliverTime(long deliver_time) { - if (deliver_time <= Time.UnixTime) // ready now + if (deliver_time <= GameTime.GetGameTime()) // ready now { ++unReadMails; SendNewMail(); @@ -4554,7 +4554,7 @@ namespace Game.Entities else if (!WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPve)) return 0; - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); // 0..2 full period // should be ceil(x)-1 but not floor(x) ulong count = (ulong)((now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / PlayerConst.DeathExpireStep : 0); @@ -4567,7 +4567,7 @@ namespace Game.Entities if ((pvp && !WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPvp)) || (!pvp && !WorldConfig.GetBoolValue(WorldCfg.DeathCorpseReclaimDelayPve))) return; - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (now < m_deathExpireTime) { // full and partly periods 1..3 @@ -4605,7 +4605,7 @@ namespace Game.Entities } long expected_time = corpse.GetGhostTime() + PlayerConst.copseReclaimDelay[count]; - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (now >= expected_time) return -1; @@ -4696,7 +4696,7 @@ namespace Game.Entities pet.SetPetNextLevelExperience(1000); pet.SetFullHealth(); pet.SetFullPower(PowerType.Mana); - pet.SetPetNameTimestamp((uint)Time.UnixTime); + pet.SetPetNameTimestamp((uint)GameTime.GetGameTime()); break; default: break; diff --git a/Source/Game/Entities/Player/RestMgr.cs b/Source/Game/Entities/Player/RestMgr.cs index b4ce1c80c..c6fc317f2 100644 --- a/Source/Game/Entities/Player/RestMgr.cs +++ b/Source/Game/Entities/Player/RestMgr.cs @@ -87,7 +87,7 @@ namespace Game.Entities if (oldRestMask == 0 && _restFlagMask != 0) // only set flag/time on the first rest state { - _restTime = Time.UnixTime; + _restTime = GameTime.GetGameTime(); _player.AddPlayerFlag(PlayerFlags.Resting); } diff --git a/Source/Game/Entities/Unit/Unit.Pets.cs b/Source/Game/Entities/Unit/Unit.Pets.cs index bf2710ec0..df5f672ff 100644 --- a/Source/Game/Entities/Unit/Unit.Pets.cs +++ b/Source/Game/Entities/Unit/Unit.Pets.cs @@ -430,7 +430,7 @@ namespace Game.Entities GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true); // if charmed two demons the same session, the 2nd gets the 1st one's name - SetPetNameTimestamp((uint)Time.UnixTime); // cast can't be helped + SetPetNameTimestamp((uint)GameTime.GetGameTime()); // cast can't be helped } } playerCharmer.CharmSpellInitialize(); diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 108dea80e..97d185cee 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -39,7 +39,7 @@ namespace Game default: case GameEventState.Normal: { - long currenttime = Time.UnixTime; + long currenttime = GameTime.GetGameTime(); // Get the event information return mGameEvent[entry].start < currenttime && currenttime < mGameEvent[entry].end @@ -56,7 +56,7 @@ namespace Game // if inactive world event, check the prerequisite events case GameEventState.WorldInactive: { - long currenttime = Time.UnixTime; + long currenttime = GameTime.GetGameTime(); foreach (var gameEventId in mGameEvent[entry].prerequisite_events) { if ((mGameEvent[gameEventId].state != GameEventState.WorldNextPhase && mGameEvent[gameEventId].state != GameEventState.WorldFinished) || // if prereq not in nextphase or finished state, then can't start this one @@ -72,7 +72,7 @@ namespace Game public uint NextCheck(ushort entry) { - long currenttime = Time.UnixTime; + long currenttime = GameTime.GetGameTime(); // for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly if ((mGameEvent[entry].state == GameEventState.WorldNextPhase || mGameEvent[entry].state == GameEventState.WorldFinished) && mGameEvent[entry].nextstart >= currenttime) @@ -132,13 +132,13 @@ namespace Game ApplyNewEvent(event_id); if (overwrite) { - mGameEvent[event_id].start = Time.UnixTime; + mGameEvent[event_id].start = GameTime.GetGameTime(); if (data.end <= data.start) data.end = data.start + data.length; } // When event is started, set its worldstate to current time - Global.WorldMgr.SetWorldState(event_id, Time.UnixTime); + Global.WorldMgr.SetWorldState(event_id, GameTime.GetGameTime()); return false; } else @@ -179,7 +179,7 @@ namespace Game if (overwrite && !serverwide_evt) { - data.start = Time.UnixTime - data.length * Time.Minute; + data.start = GameTime.GetGameTime() - data.length * Time.Minute; if (data.end <= data.start) data.end = data.start + data.length; } @@ -971,7 +971,7 @@ namespace Game public uint Update() // return the next event delay in ms { - long currenttime = Time.UnixTime; + long currenttime = GameTime.GetGameTime(); uint nextEventDelay = Time.Day; // 1 day uint calcDelay; List activate = new(); @@ -1526,7 +1526,7 @@ namespace Game // set the followup events' start time if (mGameEvent[event_id].nextstart == 0) { - long currenttime = Time.UnixTime; + long currenttime = GameTime.GetGameTime(); mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60; } return true; @@ -1613,7 +1613,7 @@ namespace Game bool singleDate = ((holiday.Date[0] >> 24) & 0x1F) == 31; // Events with fixed date within year have - 1 - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); for (int i = 0; i < SharedConst.MaxHolidayDates && holiday.Date[i] != 0; ++i) { uint date = holiday.Date[i]; diff --git a/Source/Game/Garrisons/Garrisons.cs b/Source/Game/Garrisons/Garrisons.cs index 8e785dbb2..f40087ecc 100644 --- a/Source/Game/Garrisons/Garrisons.cs +++ b/Source/Game/Garrisons/Garrisons.cs @@ -360,7 +360,7 @@ namespace Game.Garrisons { placeBuildingResult.BuildingInfo.GarrPlotInstanceID = garrPlotInstanceId; placeBuildingResult.BuildingInfo.GarrBuildingID = garrBuildingId; - placeBuildingResult.BuildingInfo.TimeBuilt = Time.UnixTime; + placeBuildingResult.BuildingInfo.TimeBuilt = GameTime.GetGameTime(); Plot plot = GetPlot(garrPlotInstanceId); uint oldBuildingId = 0; @@ -438,7 +438,7 @@ namespace Game.Garrisons placeBuildingResult.Result = GarrisonError.Success; placeBuildingResult.BuildingInfo.GarrPlotInstanceID = garrPlotInstanceId; placeBuildingResult.BuildingInfo.GarrBuildingID = restored; - placeBuildingResult.BuildingInfo.TimeBuilt = Time.UnixTime; + placeBuildingResult.BuildingInfo.TimeBuilt = GameTime.GetGameTime(); placeBuildingResult.BuildingInfo.Active = true; plot.SetBuildingInfo(placeBuildingResult.BuildingInfo, _owner); @@ -689,7 +689,7 @@ namespace Game.Garrisons if (PacketInfo.HasValue) { GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(PacketInfo.Value.GarrBuildingID); - if (PacketInfo.Value.TimeBuilt + building.BuildSeconds <= Time.UnixTime) + if (PacketInfo.Value.TimeBuilt + building.BuildSeconds <= GameTime.GetGameTime()) return true; } diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 34a4a8418..db7a65540 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -9091,7 +9091,7 @@ namespace Game { uint oldMSTime = Time.GetMSTime(); - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); DateTime lt = Time.UnixTimeToDateTime(curTime).ToLocalTime(); Log.outInfo(LogFilter.Server, "Returning mails current time: hour: {0}, minute: {1}, second: {2} ", lt.Hour, lt.Minute, lt.Second); diff --git a/Source/Game/Guilds/Guild.cs b/Source/Game/Guilds/Guild.cs index abacc9b4f..782f84161 100644 --- a/Source/Game/Guilds/Guild.cs +++ b/Source/Game/Guilds/Guild.cs @@ -52,7 +52,7 @@ namespace Game.Guilds m_info = ""; m_motd = "No message set."; m_bankMoney = 0; - m_createdDate = Time.UnixTime; + m_createdDate = GameTime.GetGameTime(); _CreateLogHolders(); Log.outDebug(LogFilter.Guild, "GUILD: creating guild [{0}] for leader {1} ({2})", @@ -2490,7 +2490,7 @@ namespace Game.Guilds m_level = 0; m_class = 0; m_flags = GuildMemberFlags.None; - m_logoutTime = (ulong)Time.UnixTime; + m_logoutTime = (ulong)GameTime.GetGameTime(); m_accountId = 0; m_rankId = rankId; m_achievementPoints = 0; @@ -2628,7 +2628,7 @@ namespace Game.Guilds { if (IsOnline()) return 0.0f; - return (float)((Time.UnixTime - (long)GetLogoutTime()) / (float)Time.Day); + return (float)((GameTime.GetGameTime() - (long)GetLogoutTime()) / (float)Time.Day); } // Decreases amount of slots left for today. @@ -2707,7 +2707,7 @@ namespace Game.Guilds public bool IsTrackingCriteriaId(uint criteriaId) { return m_trackedCriteriaIds.Contains(criteriaId); } public bool IsOnline() { return m_flags.HasAnyFlag(GuildMemberFlags.Online); } - public void UpdateLogoutTime() { m_logoutTime = (ulong)Time.UnixTime; } + public void UpdateLogoutTime() { m_logoutTime = (ulong)GameTime.GetGameTime(); } public bool IsRank(byte rankId) { return m_rankId == rankId; } public bool IsRankNotLower(uint rankId) { return m_rankId <= rankId; } public bool IsSamePlayer(ObjectGuid guid) { return m_guid == guid; } @@ -2751,7 +2751,7 @@ namespace Game.Guilds { m_guildId = guildId; m_guid = guid; - m_timestamp = Time.UnixTime; + m_timestamp = GameTime.GetGameTime(); } public LogEntry(ulong guildId, uint guid, long timestamp) @@ -2819,7 +2819,7 @@ namespace Game.Guilds eventEntry.PlayerGUID = playerGUID; eventEntry.OtherGUID = otherGUID; eventEntry.TransactionType = (byte)m_eventType; - eventEntry.TransactionDate = (uint)(Time.UnixTime - m_timestamp); + eventEntry.TransactionDate = (uint)(GameTime.GetGameTime() - m_timestamp); eventEntry.RankID = m_newRank; packet.Entry.Add(eventEntry); } @@ -2905,7 +2905,7 @@ namespace Game.Guilds GuildBankLogEntry bankLogEntry = new(); bankLogEntry.PlayerGUID = logGuid; - bankLogEntry.TimeOffset = (uint)(Time.UnixTime - m_timestamp); + bankLogEntry.TimeOffset = (uint)(GameTime.GetGameTime() - m_timestamp); bankLogEntry.EntryType = (sbyte)m_eventType; if (hasStack) diff --git a/Source/Game/Guilds/GuildFinderManager.cs b/Source/Game/Guilds/GuildFinderManager.cs index fd25ef74b..04fdaaffd 100644 --- a/Source/Game/Guilds/GuildFinderManager.cs +++ b/Source/Game/Guilds/GuildFinderManager.cs @@ -391,7 +391,7 @@ namespace Game.Guilds public MembershipRequest() { - _time = Time.UnixTime; + _time = GameTime.GetGameTime(); } public ObjectGuid GetGuildGuid() { return _guildId; } diff --git a/Source/Game/Handlers/BattleFieldHandler.cs b/Source/Game/Handlers/BattleFieldHandler.cs index b1e16ad8e..271db143f 100644 --- a/Source/Game/Handlers/BattleFieldHandler.cs +++ b/Source/Game/Handlers/BattleFieldHandler.cs @@ -34,7 +34,7 @@ namespace Game BFMgrEntryInvite bfMgrEntryInvite = new(); bfMgrEntryInvite.QueueID = queueId; bfMgrEntryInvite.AreaID = (int)zoneId; - bfMgrEntryInvite.ExpireTime = Time.UnixTime + acceptTime; + bfMgrEntryInvite.ExpireTime = GameTime.GetGameTime() + acceptTime; SendPacket(bfMgrEntryInvite); } diff --git a/Source/Game/Handlers/CalendarHandler.cs b/Source/Game/Handlers/CalendarHandler.cs index a45912a2f..5a70bc906 100644 --- a/Source/Game/Handlers/CalendarHandler.cs +++ b/Source/Game/Handlers/CalendarHandler.cs @@ -35,7 +35,7 @@ namespace Game { ObjectGuid guid = GetPlayer().GetGUID(); - long currTime = Time.UnixTime; + long currTime = GameTime.GetGameTime(); CalendarSendCalendar packet = new(); packet.ServerTime = currTime; @@ -123,7 +123,7 @@ namespace Game // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (calendarAddEvent.EventInfo.Time < (Time.UnixTime - 86400L)) + if (calendarAddEvent.EventInfo.Time < (GameTime.GetGameTime() - 86400L)) return; CalendarEvent calendarEvent = new(Global.CalendarMgr.GetFreeEventId(), guid, 0, (CalendarEventType)calendarAddEvent.EventInfo.EventType, calendarAddEvent.EventInfo.TextureID, @@ -172,7 +172,7 @@ namespace Game // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (calendarUpdateEvent.EventInfo.Time < (Time.UnixTime - 86400L)) + if (calendarUpdateEvent.EventInfo.Time < (GameTime.GetGameTime() - 86400L)) return; CalendarEvent calendarEvent = Global.CalendarMgr.GetEvent(calendarUpdateEvent.EventInfo.EventID); @@ -208,7 +208,7 @@ namespace Game // prevent events in the past // To Do: properly handle timezones and remove the "- time_t(86400L)" hack - if (calendarCopyEvent.Date < (Time.UnixTime - 86400L)) + if (calendarCopyEvent.Date < (GameTime.GetGameTime() - 86400L)) return; CalendarEvent oldEvent = Global.CalendarMgr.GetEvent(calendarCopyEvent.EventID); @@ -339,7 +339,7 @@ namespace Game } CalendarInviteStatus status = calendarEventSignUp.Tentative ? CalendarInviteStatus.Tentative : CalendarInviteStatus.SignedUp; - CalendarInvite invite = new(Global.CalendarMgr.GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, Time.UnixTime, status, CalendarModerationRank.Player, ""); + CalendarInvite invite = new(Global.CalendarMgr.GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, GameTime.GetGameTime(), status, CalendarModerationRank.Player, ""); Global.CalendarMgr.AddInvite(calendarEvent, invite); Global.CalendarMgr.SendCalendarClearPendingAction(guid); } @@ -366,7 +366,7 @@ namespace Game if (invite != null) { invite.Status = calendarRSVP.Status; - invite.ResponseTime = Time.UnixTime; + invite.ResponseTime = GameTime.GetGameTime(); Global.CalendarMgr.UpdateInvite(invite); Global.CalendarMgr.SendCalendarEventStatus(calendarEvent, invite); @@ -491,7 +491,7 @@ namespace Game public void SendCalendarRaidLockout(InstanceSave save, bool add) { - long currTime = Time.UnixTime; + long currTime = GameTime.GetGameTime(); if (add) { @@ -518,7 +518,7 @@ namespace Game if (save == null) return; - long currTime = Time.UnixTime; + long currTime = GameTime.GetGameTime(); CalendarRaidLockoutUpdated packet = new(); packet.DifficultyID = (uint)save.GetDifficultyID(); diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index 4e17c0810..c278ca152 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -2204,7 +2204,7 @@ namespace Game if (!result.IsEmpty()) { uint lastUndelete = result.Read(0); - uint now = (uint)Time.UnixTime; + uint now = (uint)GameTime.GetGameTime(); if (lastUndelete + maxCooldown > now) cooldown = Math.Max(0, lastUndelete + maxCooldown - now); } @@ -2231,7 +2231,7 @@ namespace Game { uint lastUndelete = result.Read(0); uint maxCooldown = WorldConfig.GetUIntValue(WorldCfg.FeatureSystemCharacterUndeleteCooldown); - if (lastUndelete != 0 && (lastUndelete + maxCooldown > Time.UnixTime)) + if (lastUndelete != 0 && (lastUndelete + maxCooldown > GameTime.GetGameTime())) { SendUndeleteCharacterResponse(CharacterUndeleteResult.Cooldown, undeleteInfo); return; @@ -2390,7 +2390,7 @@ namespace Game return; // prevent resurrect before 30-sec delay after body release not finished - if ((corpse.GetGhostTime() + GetPlayer().GetCorpseReclaimDelay(corpse.GetCorpseType() == CorpseType.ResurrectablePVP)) > Time.UnixTime) + if ((corpse.GetGhostTime() + GetPlayer().GetCorpseReclaimDelay(corpse.GetCorpseType() == CorpseType.ResurrectablePVP)) > GameTime.GetGameTime()) return; if (!corpse.IsWithinDistInMap(GetPlayer(), 39, true)) @@ -2648,7 +2648,7 @@ namespace Game stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_MAILCOUNT); stmt.AddValue(0, lowGuid); - stmt.AddValue(1, Time.UnixTime); + stmt.AddValue(1, GameTime.GetGameTime()); SetQuery(PlayerLoginQueryLoad.MailCount, stmt); stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_MAILDATE); diff --git a/Source/Game/Handlers/ChatHandler.cs b/Source/Game/Handlers/ChatHandler.cs index eb8431d90..8611f7271 100644 --- a/Source/Game/Handlers/ChatHandler.cs +++ b/Source/Game/Handlers/ChatHandler.cs @@ -168,7 +168,7 @@ namespace Game if (!CanSpeak()) { - string timeStr = Time.secsToTimeString((ulong)(m_muteTime - Time.UnixTime)); + string timeStr = Time.secsToTimeString((ulong)(m_muteTime - GameTime.GetGameTime())); SendNotification(CypherStrings.WaitBeforeSpeaking, timeStr); return; } @@ -560,7 +560,7 @@ namespace Game if (!CanSpeak()) { - string timeStr = Time.secsToTimeString((ulong)(m_muteTime - Time.UnixTime)); + string timeStr = Time.secsToTimeString((ulong)(m_muteTime - GameTime.GetGameTime())); SendNotification(CypherStrings.WaitBeforeSpeaking, timeStr); return; } diff --git a/Source/Game/Handlers/DuelHandler.cs b/Source/Game/Handlers/DuelHandler.cs index 5b21a5637..1ac0b20d3 100644 --- a/Source/Game/Handlers/DuelHandler.cs +++ b/Source/Game/Handlers/DuelHandler.cs @@ -69,7 +69,7 @@ namespace Game Log.outDebug(LogFilter.Network, "Player 1 is: {0} ({1})", player.GetGUID().ToString(), player.GetName()); Log.outDebug(LogFilter.Network, "Player 2 is: {0} ({1})", plTarget.GetGUID().ToString(), plTarget.GetName()); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); player.duel.startTimer = now; plTarget.duel.startTimer = now; diff --git a/Source/Game/Handlers/GuildFinderHandler.cs b/Source/Game/Handlers/GuildFinderHandler.cs index a6f058e87..7e0706048 100644 --- a/Source/Game/Handlers/GuildFinderHandler.cs +++ b/Source/Game/Handlers/GuildFinderHandler.cs @@ -44,7 +44,7 @@ namespace Game return; MembershipRequest request = new(GetPlayer().GetGUID(), lfGuildAddRecruit.GuildGUID, lfGuildAddRecruit.Availability, - lfGuildAddRecruit.ClassRoles, lfGuildAddRecruit.PlayStyle, lfGuildAddRecruit.Comment, Time.UnixTime); + lfGuildAddRecruit.ClassRoles, lfGuildAddRecruit.PlayStyle, lfGuildAddRecruit.Comment, GameTime.GetGameTime()); Global.GuildFinderMgr.AddMembershipRequest(lfGuildAddRecruit.GuildGUID, request); } @@ -129,8 +129,8 @@ namespace Game applicationData.ClassRoles = guildSettings.GetClassRoles(); applicationData.PlayStyle = guildSettings.GetInterests(); applicationData.Availability = guildSettings.GetAvailability(); - applicationData.SecondsSinceCreated = (uint)(Time.UnixTime - application.GetSubmitTime()); - applicationData.SecondsUntilExpiration = (uint)(application.GetExpiryTime() - Time.UnixTime); + applicationData.SecondsSinceCreated = (uint)(GameTime.GetGameTime() - application.GetSubmitTime()); + applicationData.SecondsUntilExpiration = (uint)(application.GetExpiryTime() - GameTime.GetGameTime()); applicationData.Comment = application.GetComment(); lfGuildApplications.Application.Add(applicationData); @@ -176,7 +176,7 @@ namespace Game if (!guild) return; - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); LFGuildRecruits lfGuildRecruits = new(); lfGuildRecruits.UpdateTime = now; var recruitsList = Global.GuildFinderMgr.GetAllMembershipRequestsForGuild(guild.GetGUID()); diff --git a/Source/Game/Handlers/GuildHandler.cs b/Source/Game/Handlers/GuildHandler.cs index 3318bdd26..31156d8e3 100644 --- a/Source/Game/Handlers/GuildHandler.cs +++ b/Source/Game/Handlers/GuildHandler.cs @@ -551,7 +551,7 @@ namespace Game var rewards = Global.GuildMgr.GetGuildRewards(); GuildRewardList rewardList = new(); - rewardList.Version = Time.UnixTime; + rewardList.Version = GameTime.GetGameTime(); for (int i = 0; i < rewards.Count; i++) { diff --git a/Source/Game/Handlers/HotfixHandler.cs b/Source/Game/Handlers/HotfixHandler.cs index e762865a7..048f53c74 100644 --- a/Source/Game/Handlers/HotfixHandler.cs +++ b/Source/Game/Handlers/HotfixHandler.cs @@ -52,7 +52,7 @@ namespace Game else { Log.outTrace(LogFilter.Network, "CMSG_DB_QUERY_BULK: {0} requested non-existing entry {1} in datastore: {2}", GetPlayerInfo(), record.RecordID, dbQuery.TableHash); - dbReply.Timestamp = (uint)Time.UnixTime; + dbReply.Timestamp = (uint)GameTime.GetGameTime(); } SendPacket(dbReply); diff --git a/Source/Game/Handlers/LFGHandler.cs b/Source/Game/Handlers/LFGHandler.cs index 2acdcfa6f..330842ebf 100644 --- a/Source/Game/Handlers/LFGHandler.cs +++ b/Source/Game/Handlers/LFGHandler.cs @@ -433,7 +433,7 @@ namespace Game LfgAnswer playerVote = boot.votes.LookupByKey(GetPlayer().GetGUID()); byte votesNum = 0; byte agreeNum = 0; - uint secsleft = (uint)((boot.cancelTime - Time.UnixTime) / 1000); + uint secsleft = (uint)((boot.cancelTime - GameTime.GetGameTime()) / 1000); foreach (var it in boot.votes) { if (it.Value != LfgAnswer.Pending) diff --git a/Source/Game/Handlers/LogoutHandler.cs b/Source/Game/Handlers/LogoutHandler.cs index 22e34364c..1d993c353 100644 --- a/Source/Game/Handlers/LogoutHandler.cs +++ b/Source/Game/Handlers/LogoutHandler.cs @@ -71,7 +71,7 @@ namespace Game pl.AddUnitFlag(UnitFlags.Stunned); } - SetLogoutStartTime(Time.UnixTime); + SetLogoutStartTime(GameTime.GetGameTime()); } [WorldPacketHandler(ClientOpcodes.LogoutCancel)] diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index 0c09f6867..01e7f4bad 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -378,7 +378,7 @@ namespace Game Player player = GetPlayer(); Mail m = player.GetMail(packet.MailID); - if (m == null || m.state == MailState.Deleted || m.deliver_time > Time.UnixTime || m.sender != packet.SenderGUID.GetCounter()) + if (m == null || m.state == MailState.Deleted || m.deliver_time > GameTime.GetGameTime() || m.sender != packet.SenderGUID.GetCounter()) { player.SendMailResult(packet.MailID, MailResponseType.ReturnedToSender, MailResponseResult.InternalError); return; @@ -433,7 +433,7 @@ namespace Game Player player = GetPlayer(); Mail m = player.GetMail(packet.MailID); - if (m == null || m.state == MailState.Deleted || m.deliver_time > Time.UnixTime) + if (m == null || m.state == MailState.Deleted || m.deliver_time > GameTime.GetGameTime()) { player.SendMailResult(packet.MailID, MailResponseType.ItemTaken, MailResponseResult.InternalError); return; @@ -530,7 +530,7 @@ namespace Game Player player = GetPlayer(); Mail m = player.GetMail(packet.MailID); - if ((m == null || m.state == MailState.Deleted || m.deliver_time > Time.UnixTime) || + if ((m == null || m.state == MailState.Deleted || m.deliver_time > GameTime.GetGameTime()) || (packet.Money > 0 && m.money != (ulong)packet.Money)) { player.SendMailResult(packet.MailID, MailResponseType.MoneyTaken, MailResponseResult.InternalError); @@ -572,7 +572,7 @@ namespace Game var mails = player.GetMails(); MailListResult response = new(); - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); foreach (Mail m in mails) { @@ -603,7 +603,7 @@ namespace Game Player player = GetPlayer(); Mail m = player.GetMail(packet.MailID); - if (m == null || (string.IsNullOrEmpty(m.body) && m.mailTemplateId == 0) || m.state == MailState.Deleted || m.deliver_time > Time.UnixTime) + if (m == null || (string.IsNullOrEmpty(m.body) && m.mailTemplateId == 0) || m.state == MailState.Deleted || m.deliver_time > GameTime.GetGameTime()) { player.SendMailResult(packet.MailID, MailResponseType.MadePermanent, MailResponseResult.InternalError); return; @@ -662,7 +662,7 @@ namespace Game { result.NextMailTime = 0.0f; - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); List sentSenders = new(); foreach (Mail mail in GetPlayer().GetMails()) diff --git a/Source/Game/Handlers/MiscHandler.cs b/Source/Game/Handlers/MiscHandler.cs index a5976dc02..904dd89d6 100644 --- a/Source/Game/Handlers/MiscHandler.cs +++ b/Source/Game/Handlers/MiscHandler.cs @@ -464,7 +464,7 @@ namespace Game GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP); GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().pvpInfo.IsHostile && GetPlayer().IsPvP()) - GetPlayer().pvpInfo.EndTimer = Time.UnixTime; // start toggle-off + GetPlayer().pvpInfo.EndTimer = GameTime.GetGameTime(); // start toggle-off } else { @@ -483,7 +483,7 @@ namespace Game GetPlayer().RemovePlayerFlag(PlayerFlags.InPVP); GetPlayer().AddPlayerFlag(PlayerFlags.PVPTimer); if (!GetPlayer().pvpInfo.IsHostile && GetPlayer().IsPvP()) - GetPlayer().pvpInfo.EndTimer = Time.UnixTime; // start toggle-off + GetPlayer().pvpInfo.EndTimer = GameTime.GetGameTime(); // start toggle-off } else { diff --git a/Source/Game/Handlers/MovementHandler.cs b/Source/Game/Handlers/MovementHandler.cs index c8c28e272..feeacfd7e 100644 --- a/Source/Game/Handlers/MovementHandler.cs +++ b/Source/Game/Handlers/MovementHandler.cs @@ -368,7 +368,7 @@ namespace Game long timeReset = Global.InstanceSaveMgr.GetResetTimeFor(mapEntry.Id, diff); if (timeReset != 0) { - uint timeleft = (uint)(timeReset - Time.UnixTime); + uint timeleft = (uint)(timeReset - GameTime.GetGameTime()); GetPlayer().SendInstanceResetWarning(mapEntry.Id, diff, timeleft, true); } } diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index 8d57ad2bd..6c3c84f95 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -585,7 +585,7 @@ namespace Game DB.Characters.CommitTransaction(trans); - pet.SetPetNameTimestamp((uint)Time.UnixTime); // cast can't be helped + pet.SetPetNameTimestamp((uint)GameTime.GetGameTime()); // cast can't be helped } [WorldPacketHandler(ClientOpcodes.PetAbandon)] diff --git a/Source/Game/Handlers/QueryHandler.cs b/Source/Game/Handlers/QueryHandler.cs index 16291bf9f..11190f61c 100644 --- a/Source/Game/Handlers/QueryHandler.cs +++ b/Source/Game/Handlers/QueryHandler.cs @@ -60,7 +60,7 @@ namespace Game void SendQueryTimeResponse() { QueryTimeResponse queryTimeResponse = new(); - queryTimeResponse.CurrentTime = Time.UnixTime; + queryTimeResponse.CurrentTime = GameTime.GetGameTime(); SendPacket(queryTimeResponse); } diff --git a/Source/Game/Handlers/TimeHandler.cs b/Source/Game/Handlers/TimeHandler.cs index e214bc687..41327fc76 100644 --- a/Source/Game/Handlers/TimeHandler.cs +++ b/Source/Game/Handlers/TimeHandler.cs @@ -28,7 +28,7 @@ namespace Game void HandleServerTimeOffsetRequest(ServerTimeOffsetRequest packet) { ServerTimeOffset response = new(); - response.Time = Time.UnixTime; + response.Time = GameTime.GetGameTime(); SendPacket(response); } diff --git a/Source/Game/Mails/MailDraft.cs b/Source/Game/Mails/MailDraft.cs index 9cf5d98a4..274821e9d 100644 --- a/Source/Game/Mails/MailDraft.cs +++ b/Source/Game/Mails/MailDraft.cs @@ -144,7 +144,7 @@ namespace Game.Mails uint mailId = Global.ObjectMgr.GenerateMailID(); - long deliver_time = Time.UnixTime + deliver_delay; + long deliver_time = GameTime.GetGameTime() + deliver_delay; //expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour uint expire_delay; diff --git a/Source/Game/Maps/Instances/InstanceSaveManager.cs b/Source/Game/Maps/Instances/InstanceSaveManager.cs index c5a5ec63d..0b4c32585 100644 --- a/Source/Game/Maps/Instances/InstanceSaveManager.cs +++ b/Source/Game/Maps/Instances/InstanceSaveManager.cs @@ -71,7 +71,7 @@ namespace Game.Maps resetTime = GetResetTimeFor(mapId, difficulty); else { - resetTime = Time.UnixTime + 2 * Time.Hour; + resetTime = GameTime.GetGameTime() + 2 * Time.Hour; // normally this will be removed soon after in InstanceMap.Add, prevent error ScheduleReset(true, resetTime, new InstResetEvent(0, mapId, difficulty, instanceId)); } @@ -179,7 +179,7 @@ namespace Game.Maps void LoadResetTimes() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); long today = (now / Time.Day) * Time.Day; // NOTE: Use DirectPExecute for tables that will be queried later @@ -375,12 +375,12 @@ namespace Game.Maps ScheduleReset(false, 0, new InstResetEvent(1, mapId, difficulty, 0)); ScheduleReset(false, 0, new InstResetEvent(4, mapId, difficulty, 0)); // force global reset on the instance - _ResetOrWarnAll(mapId, difficulty, false, Time.UnixTime); + _ResetOrWarnAll(mapId, difficulty, false, GameTime.GetGameTime()); } public void Update() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); while (!m_resetTimeQueue.Empty()) { @@ -489,7 +489,7 @@ namespace Game.Maps return; Log.outDebug(LogFilter.Misc, "InstanceSaveManager.ResetOrWarnAll: Processing map {0} ({1}) on difficulty {2} (warn? {3})", mapEntry.MapName[Global.WorldMgr.GetDefaultDbcLocale()], mapid, difficulty, warn); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); if (!warn) { diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 1b5737770..db843d53a 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -2393,7 +2393,7 @@ namespace Game.Maps long linkedTime = GetLinkedRespawnTime(thisGUID); if (linkedTime != 0) { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); long respawnTime; if (linkedTime == long.MaxValue) respawnTime = linkedTime; @@ -2424,7 +2424,7 @@ namespace Game.Maps { if (!Global.ScriptMgr.CanSpawn(info.spawnId, info.entry, Global.ObjectMgr.GetCreatureData(info.spawnId), this)) { // if a script blocks our respawn, schedule next check in a little bit - info.respawnTime = Time.UnixTime + RandomHelper.URand(4, 7); + info.respawnTime = GameTime.GetGameTime() + RandomHelper.URand(4, 7); return false; } } @@ -2614,7 +2614,7 @@ namespace Game.Maps void ProcessRespawns() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); while (!_respawnTimes.Empty()) { RespawnInfo next = _respawnTimes.First(); @@ -2715,7 +2715,7 @@ namespace Game.Maps } long respawnTime = GetRespawnTime(data.type, data.spawnId); - if (respawnTime != 0 && respawnTime > Time.UnixTime) + if (respawnTime != 0 && respawnTime > GameTime.GetGameTime()) { if (!force && !ignoreRespawn) continue; @@ -3351,7 +3351,7 @@ namespace Game.Maps public void RemoveOldCorpses() { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); List corpses = new(); @@ -5035,7 +5035,7 @@ namespace Game.Maps // increase current instances (hourly limit) if (!group || !group.IsLFGGroup()) - player.AddInstanceEnterTime(GetInstanceId(), Time.UnixTime); + player.AddInstanceEnterTime(GetInstanceId(), GameTime.GetGameTime()); // get or create an instance save for the map InstanceSave mapSave = Global.InstanceSaveMgr.GetInstanceSave(GetInstanceId()); diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs index e41c37437..390750468 100644 --- a/Source/Game/Maps/ObjectGridLoader.cs +++ b/Source/Game/Maps/ObjectGridLoader.cs @@ -114,7 +114,7 @@ namespace Game.Maps // If script is blocking spawn, don't spawn but queue for a re-check in a little bit if (!group.flags.HasFlag(SpawnGroupFlags.CompatibilityMode) && !Global.ScriptMgr.CanSpawn(guid, cdata.Id, cdata, map)) { - map.SaveRespawnTime(SpawnObjectType.Creature, guid, cdata.Id, Time.UnixTime + RandomHelper.URand(4, 7), map.GetZoneId(PhasingHandler.EmptyPhaseShift, cdata.spawnPoint), GridDefines.ComputeGridCoord(cdata.spawnPoint.GetPositionX(), cdata.spawnPoint.GetPositionY()).GetId(), false); + map.SaveRespawnTime(SpawnObjectType.Creature, guid, cdata.Id, GameTime.GetGameTime() + RandomHelper.URand(4, 7), map.GetZoneId(PhasingHandler.EmptyPhaseShift, cdata.spawnPoint), GridDefines.ComputeGridCoord(cdata.spawnPoint.GetPositionX(), cdata.spawnPoint.GetPositionY()).GetId(), false); obj.Dispose(); continue; } diff --git a/Source/Game/Networking/PacketLog.cs b/Source/Game/Networking/PacketLog.cs index b93e0e941..e8973dc63 100644 --- a/Source/Game/Networking/PacketLog.cs +++ b/Source/Game/Networking/PacketLog.cs @@ -42,7 +42,7 @@ public class PacketLog writer.Write(Global.WorldMgr.GetRealm().Build); writer.Write(Encoding.ASCII.GetBytes("enUS")); writer.Write(new byte[40]);//SessionKey - writer.Write((uint)Time.UnixTime); + writer.Write((uint)GameTime.GetGameTime()); writer.Write(Time.GetMSTime()); writer.Write(0); } diff --git a/Source/Game/Networking/Packets/MailPackets.cs b/Source/Game/Networking/Packets/MailPackets.cs index 6935c78f8..d3488d253 100644 --- a/Source/Game/Networking/Packets/MailPackets.cs +++ b/Source/Game/Networking/Packets/MailPackets.cs @@ -270,7 +270,7 @@ namespace Game.Networking.Packets break; } - TimeLeft = mail.deliver_time - Time.UnixTime; + TimeLeft = mail.deliver_time - GameTime.GetGameTime(); AltSenderType = (sbyte)mail.messageType; StationeryID = (int)mail.stationery; } @@ -400,7 +400,7 @@ namespace Game.Networking.Packets StationeryID = (int)mail.stationery; SentMoney = mail.money; Flags = (int)mail.checkMask; - DaysLeft = (float)(mail.expire_time - Time.UnixTime) / Time.Day; + DaysLeft = (float)(mail.expire_time - GameTime.GetGameTime()) / Time.Day; MailTemplateID = (int)mail.mailTemplateId; Subject = mail.subject; Body = mail.body; diff --git a/Source/Game/Networking/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs index 1cc954f56..ca64c0429 100644 --- a/Source/Game/Networking/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -607,7 +607,7 @@ namespace Game.Networking //! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now. if (mutetime < 0) { - mutetime = Time.UnixTime + mutetime; + mutetime = GameTime.GetGameTime() + mutetime; stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME_LOGIN); stmt.AddValue(0, mutetime); @@ -781,10 +781,10 @@ namespace Game.Networking bool HandlePing(Ping ping) { if (_LastPingTime == 0) - _LastPingTime = Time.UnixTime; // for 1st ping + _LastPingTime = GameTime.GetGameTime(); // for 1st ping else { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); long diff = now - _LastPingTime; _LastPingTime = now; diff --git a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs index 7444ef31d..247df2dc2 100644 --- a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs +++ b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs @@ -87,7 +87,7 @@ namespace Game if (!criteriaResult.IsEmpty()) { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); do { uint criteriaId = criteriaResult.Read(0); diff --git a/Source/Game/Scenarios/InstanceScenario.cs b/Source/Game/Scenarios/InstanceScenario.cs index af91b59ff..ece302b38 100644 --- a/Source/Game/Scenarios/InstanceScenario.cs +++ b/Source/Game/Scenarios/InstanceScenario.cs @@ -102,7 +102,7 @@ namespace Game.Scenarios if (!result.IsEmpty()) { SQLTransaction trans = new(); - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); List criteriaTrees = new(); do diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index 0866baeb5..38d86cf24 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -49,7 +49,7 @@ namespace Game _realm = new Realm(); _worldUpdateTime = new WorldUpdateTime(); - _warnShutdownTime = Time.UnixTime; + _warnShutdownTime = GameTime.GetGameTime(); } public Player FindPlayerInZone(uint zone) @@ -271,7 +271,7 @@ namespace Game { foreach (var disconnect in m_disconnects) { - if ((disconnect.Value - Time.UnixTime) < tolerance) + if ((disconnect.Value - GameTime.GetGameTime()) < tolerance) { if (disconnect.Key == session.GetAccountId()) return true; @@ -1858,7 +1858,7 @@ namespace Game if (!session.Update(diff, updater)) // As interval = 0 { if (!RemoveQueuedPlayer(session) && session != null && WorldConfig.GetIntValue(WorldCfg.IntervalDisconnectTolerance) != 0) - m_disconnects[session.GetAccountId()] = Time.UnixTime; + m_disconnects[session.GetAccountId()] = GameTime.GetGameTime(); RemoveQueuedPlayer(session); m_sessions.TryRemove(pair.Key, out _); @@ -1923,7 +1923,7 @@ namespace Game void InitWeeklyQuestResetTime() { long wstime = GetWorldState(WorldStates.WeeklyQuestResetTime); - long curtime = Time.UnixTime; + long curtime = GameTime.GetGameTime(); m_NextWeeklyQuestReset = wstime < curtime ? curtime : wstime; } @@ -1942,7 +1942,7 @@ namespace Game // FIX ME: client not show day start time - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); // current day reset time long curDayResetTime = Time.GetNextResetUnixTime(WorldConfig.GetIntValue(WorldCfg.DailyQuestResetTimeHour)); @@ -1960,7 +1960,7 @@ namespace Game void InitMonthlyQuestResetTime() { long wstime = GetWorldState(WorldStates.MonthlyQuestResetTime); - long curtime = Time.UnixTime; + long curtime = GameTime.GetGameTime(); m_NextMonthlyQuestReset = wstime < curtime ? curtime : wstime; } @@ -1968,10 +1968,10 @@ namespace Game { long bgtime = GetWorldState(WorldStates.BGDailyResetTime); if (bgtime == 0) - m_NextRandomBGReset = Time.UnixTime; // game time not yet init + m_NextRandomBGReset = GameTime.GetGameTime(); // game time not yet init // generate time by config - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); // current day reset time long nextDayResetTime = Time.GetNextResetUnixTime(WorldConfig.GetIntValue(WorldCfg.RandomBgResetHour)); @@ -1991,9 +1991,9 @@ namespace Game { long gtime = GetWorldState(WorldStates.GuildDailyResetTime); if (gtime == 0) - m_NextGuildReset = Time.UnixTime; // game time not yet init + m_NextGuildReset = GameTime.GetGameTime(); // game time not yet init - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); var nextDayResetTime = Time.GetNextResetUnixTime(WorldConfig.GetIntValue(WorldCfg.GuildResetHour)); if (curTime >= nextDayResetTime) @@ -2010,10 +2010,10 @@ namespace Game { long currencytime = GetWorldState(WorldStates.CurrencyResetTime); if (currencytime == 0) - m_NextCurrencyReset = Time.UnixTime; // game time not yet init + m_NextCurrencyReset = GameTime.GetGameTime(); // game time not yet init // generate time by config - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); var nextWeekResetTime = Time.GetNextResetUnixTime(WorldConfig.GetIntValue(WorldCfg.CurrencyResetDay), WorldConfig.GetIntValue(WorldCfg.CurrencyResetHour)); @@ -2107,7 +2107,7 @@ namespace Game if (session.GetPlayer() != null) session.GetPlayer().ResetMonthlyQuestStatus(); - long curTime = Time.UnixTime; + long curTime = GameTime.GetGameTime(); // current day reset time long curDayResetTime = Time.GetNextResetUnixTime(30, 1, 0); diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index cb31e6c9b..71b470ae2 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -249,7 +249,7 @@ namespace Game WorldPacket firstDelayedPacket = null; uint processedPackets = 0; - long currentTime = Time.UnixTime; + long currentTime = GameTime.GetGameTime(); WorldPacket packet; //Check for any packets they was not recived yet. @@ -332,9 +332,8 @@ namespace Game if (updater.ProcessUnsafe()) { - long currTime = Time.UnixTime; // If necessary, log the player out - if (ShouldLogOut(currTime) && m_playerLoading.IsEmpty()) + if (ShouldLogOut(currentTime) && m_playerLoading.IsEmpty()) LogoutPlayer(true); if (m_Socket[(int)ConnectionType.Realm] != null && GetPlayer() && _warden != null) diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index ff4f45e91..bed384404 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -295,7 +295,7 @@ namespace Game.Spells m_castItemId = castItem != null ? castItem.GetEntry() : castItemId; m_castItemLevel = castItemLevel; m_spellVisual = new SpellCastVisual(caster ? caster.GetCastSpellXSpellVisualId(spellproto) : spellproto.GetSpellXSpellVisualId(), 0); - m_applyTime = Time.UnixTime; + m_applyTime = GameTime.GetGameTime(); m_owner = owner; m_timeCla = 0; m_updateTargetMapInterval = 0; diff --git a/Source/Game/SupportSystem/SupportManager.cs b/Source/Game/SupportSystem/SupportManager.cs index 005b8d471..13bc42b10 100644 --- a/Source/Game/SupportSystem/SupportManager.cs +++ b/Source/Game/SupportSystem/SupportManager.cs @@ -341,7 +341,7 @@ namespace Game.SupportSystem } } - long GetAge(ulong t) { return (Time.UnixTime - (long)t) / Time.Day; } + long GetAge(ulong t) { return (GameTime.GetGameTime() - (long)t) / Time.Day; } IEnumerable> GetComplaintsByPlayerGuid(ObjectGuid playerGuid) { @@ -361,7 +361,7 @@ namespace Game.SupportSystem public void SetComplaintSystemStatus(bool status) { _complaintSystemStatus = status; } public void SetSuggestionSystemStatus(bool status) { _suggestionSystemStatus = status; } - public void UpdateLastChange() { _lastChange = (ulong)Time.UnixTime; } + public void UpdateLastChange() { _lastChange = (ulong)GameTime.GetGameTime(); } public uint GenerateBugId() { return ++_lastBugId; } public uint GenerateComplaintId() { return ++_lastComplaintId; } diff --git a/Source/Game/SupportSystem/SupportTickets.cs b/Source/Game/SupportSystem/SupportTickets.cs index 71ab89d70..2a5a00c02 100644 --- a/Source/Game/SupportSystem/SupportTickets.cs +++ b/Source/Game/SupportSystem/SupportTickets.cs @@ -39,7 +39,7 @@ namespace Game.SupportSystem public Ticket() { } public Ticket(Player player) { - _createTime = (ulong)Time.UnixTime; + _createTime = (ulong)GameTime.GetGameTime(); _playerGuid = player.GetGUID(); } @@ -184,7 +184,7 @@ namespace Game.SupportSystem public override string FormatViewMessageString(CommandHandler handler, bool detailed = false) { - var curTime = (ulong)Time.UnixTime; + var curTime = (ulong)GameTime.GetGameTime(); StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); @@ -322,7 +322,7 @@ namespace Game.SupportSystem public override string FormatViewMessageString(CommandHandler handler, bool detailed = false) { - ulong curTime = (ulong)Time.UnixTime; + ulong curTime = (ulong)GameTime.GetGameTime(); StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); @@ -428,7 +428,7 @@ namespace Game.SupportSystem public override string FormatViewMessageString(CommandHandler handler, bool detailed = false) { - ulong curTime = (ulong)Time.UnixTime; + ulong curTime = (ulong)GameTime.GetGameTime(); StringBuilder ss = new(); ss.Append(handler.GetParsedString(CypherStrings.CommandTicketlistguid, _id)); diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index fbfcb3834..89d501a30 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -2287,7 +2287,7 @@ namespace Scripts.Spells.Items { if (target.IsDead() && !target.IsPet()) { - GetCaster().SummonGameObject(ObjectIds.ImprisonedDoomguard, target, Quaternion.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f), (uint)(target.GetRespawnTime() - Time.UnixTime)); + GetCaster().SummonGameObject(ObjectIds.ImprisonedDoomguard, target, Quaternion.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f), (uint)(target.GetRespawnTime() - GameTime.GetGameTime())); target.DespawnOrUnsummon(); } } diff --git a/Source/Scripts/World/NpcSpecial.cs b/Source/Scripts/World/NpcSpecial.cs index b3bef88ce..dd77ab05f 100644 --- a/Source/Scripts/World/NpcSpecial.cs +++ b/Source/Scripts/World/NpcSpecial.cs @@ -1551,7 +1551,7 @@ namespace Scripts.World.NpcSpecial { _scheduler.Schedule(TimeSpan.FromSeconds(1), task => { - long now = Time.UnixTime; + long now = GameTime.GetGameTime(); foreach (var pair in _damageTimes.ToList()) { // If unit has not dealt damage to training dummy for 5 seconds, Remove him from combat @@ -1582,7 +1582,7 @@ namespace Scripts.World.NpcSpecial public override void DamageTaken(Unit doneBy, ref uint damage) { AddThreat(doneBy, damage); // just to create threat reference - _damageTimes[doneBy.GetGUID()] = Time.UnixTime; + _damageTimes[doneBy.GetGUID()] = GameTime.GetGameTime(); damage = 0; }