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
@@ -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();