Core/Misc: Replace Time.UnixTime with GameTime.GetGameTime()

Port From (https://github.com/TrinityCore/TrinityCore/commit/e17e4e6f0700c7d950e1b2654c217ec8b28ae79e)
This commit is contained in:
hondacrx
2021-04-17 19:28:50 -04:00
parent 95889fa53c
commit 63f0f919e2
68 changed files with 217 additions and 218 deletions
@@ -279,7 +279,7 @@ namespace Game.Achievements
if (!criteriaResult.IsEmpty())
{
var now = Time.UnixTime;
var now = GameTime.GetGameTime();
do
{
uint id = criteriaResult.Read<uint>(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<uint>(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);
}
+1 -1
View File
@@ -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;
+5 -5
View File
@@ -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);
}
@@ -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));
+2 -2
View File
@@ -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()
@@ -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)
+1 -1
View File
@@ -646,7 +646,7 @@ namespace Game
public CalendarInvite()
{
InviteId = 1;
ResponseTime = Time.UnixTime;
ResponseTime = 0;
Status = CalendarInviteStatus.Invited;
Rank = CalendarModerationRank.Player;
Note = "";
+2 -2
View File
@@ -247,7 +247,7 @@ namespace Game.Chat.Commands
{
long unbanDate = result.Read<long>(3);
bool active = false;
if (result.Read<bool>(2) && (result.Read<long>(1) == 0L || unbanDate >= Time.UnixTime))
if (result.Read<bool>(2) && (result.Read<long>(1) == 0L || unbanDate >= GameTime.GetGameTime()))
active = true;
bool permanent = (result.Read<long>(1) == 0L);
string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read<ulong>(1), true);
@@ -297,7 +297,7 @@ namespace Game.Chat.Commands
{
long unbanDate = result.Read<uint>(3);
bool active = false;
if (result.Read<bool>(2) && (result.Read<ulong>(1) == 0 || unbanDate >= Time.UnixTime))
if (result.Read<bool>(2) && (result.Read<ulong>(1) == 0 || unbanDate >= GameTime.GetGameTime()))
active = true;
bool permanent = (result.Read<ulong>(1) == 0);
string banTime = permanent ? handler.GetCypherString(CypherStrings.BaninfoInfinite) : Time.secsToTimeString(result.Read<ulong>(1), true);
+2 -2
View File
@@ -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);
@@ -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;
@@ -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);
+2 -2
View File
@@ -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;
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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;
+7 -7
View File
@@ -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<ObjectGuid, LfgRoles> 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;
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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; }
+20 -20
View File
@@ -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;
+10 -10
View File
@@ -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); }
+3 -3
View File
@@ -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;
}
+4 -4
View File
@@ -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<uint>(13));
uint timediff = (uint)(GameTime.GetGameTime() - result.Read<uint>(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;
+2 -2
View File
@@ -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
}
}
+5 -5
View File
@@ -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())
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+3 -3
View File
@@ -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));
}
}
}
+3 -3
View File
@@ -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;
}
}
@@ -539,7 +539,7 @@ namespace Game.Entities
UpdateCriteria(CriteriaTypes.NumberOfTalentResets, 1);
SetTalentResetCost(cost);
SetTalentResetTime(Time.UnixTime);
SetTalentResetTime(GameTime.GetGameTime());
}
return true;
+14 -14
View File
@@ -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;
+1 -1
View File
@@ -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);
}
+1 -1
View File
@@ -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();
+9 -9
View File
@@ -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<ushort> 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];
+3 -3
View File
@@ -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;
}
+1 -1
View File
@@ -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);
+7 -7
View File
@@ -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)
+1 -1
View File
@@ -391,7 +391,7 @@ namespace Game.Guilds
public MembershipRequest()
{
_time = Time.UnixTime;
_time = GameTime.GetGameTime();
}
public ObjectGuid GetGuildGuid() { return _guildId; }
+1 -1
View File
@@ -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);
}
+8 -8
View File
@@ -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();
+4 -4
View File
@@ -2204,7 +2204,7 @@ namespace Game
if (!result.IsEmpty())
{
uint lastUndelete = result.Read<uint>(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<uint>(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);
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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());
+1 -1
View File
@@ -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++)
{
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -71,7 +71,7 @@ namespace Game
pl.AddUnitFlag(UnitFlags.Stunned);
}
SetLogoutStartTime(Time.UnixTime);
SetLogoutStartTime(GameTime.GetGameTime());
}
[WorldPacketHandler(ClientOpcodes.LogoutCancel)]
+6 -6
View File
@@ -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<ulong> sentSenders = new();
foreach (Mail mail in GetPlayer().GetMails())
+2 -2
View File
@@ -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
{
+1 -1
View File
@@ -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);
}
}
+1 -1
View File
@@ -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)]
+1 -1
View File
@@ -60,7 +60,7 @@ namespace Game
void SendQueryTimeResponse()
{
QueryTimeResponse queryTimeResponse = new();
queryTimeResponse.CurrentTime = Time.UnixTime;
queryTimeResponse.CurrentTime = GameTime.GetGameTime();
SendPacket(queryTimeResponse);
}
+1 -1
View File
@@ -28,7 +28,7 @@ namespace Game
void HandleServerTimeOffsetRequest(ServerTimeOffsetRequest packet)
{
ServerTimeOffset response = new();
response.Time = Time.UnixTime;
response.Time = GameTime.GetGameTime();
SendPacket(response);
}
+1 -1
View File
@@ -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;
@@ -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)
{
+6 -6
View File
@@ -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<ObjectGuid> 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());
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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);
}
@@ -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;
+3 -3
View File
@@ -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;
@@ -87,7 +87,7 @@ namespace Game
if (!criteriaResult.IsEmpty())
{
long now = Time.UnixTime;
long now = GameTime.GetGameTime();
do
{
uint criteriaId = criteriaResult.Read<uint>(0);
+1 -1
View File
@@ -102,7 +102,7 @@ namespace Game.Scenarios
if (!result.IsEmpty())
{
SQLTransaction trans = new();
long now = Time.UnixTime;
long now = GameTime.GetGameTime();
List<CriteriaTree> criteriaTrees = new();
do
+13 -13
View File
@@ -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);
+2 -3
View File
@@ -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)
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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<KeyValuePair<uint, ComplaintTicket>> 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; }
+4 -4
View File
@@ -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));
+1 -1
View File
@@ -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();
}
}
+2 -2
View File
@@ -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;
}