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
+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);
}