Revert "feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)" (#1471)

This reverts commit 51b8773528.
This commit is contained in:
Nefertumm
2019-02-15 15:14:49 -03:00
committed by GitHub
parent 23e7ae6a2f
commit c15206fc15
108 changed files with 509 additions and 933 deletions

View File

@@ -6,7 +6,6 @@
#include <G3D/Quat.h>
#include "GameObjectAI.h"
#include "GameTime.h"
#include "BattlegroundAV.h"
#include "CellImpl.h"
#include "CreatureAISelector.h"
@@ -377,9 +376,9 @@ void GameObject::Update(uint32 diff)
GameObjectTemplate const* goInfo = GetGOInfo();
// Bombs
if (goInfo->trap.type == 2)
m_cooldownTime = GameTime::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
m_cooldownTime = World::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
else if (GetOwner())
m_cooldownTime = GameTime::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
m_cooldownTime = World::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
m_lootState = GO_READY;
break;
@@ -387,7 +386,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE:
{
// fishing code (bobber ready)
if (GameTime::GetGameTime() > m_respawnTime - FISHING_BOBBER_READY_TIME)
if (time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME)
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
@@ -411,7 +410,7 @@ void GameObject::Update(uint32 diff)
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
{
if (GameTime::GetGameTimeMS() < m_cooldownTime)
if (World::GetGameTimeMS() < m_cooldownTime)
return;
GameObjectTemplate const* info = GetGOInfo();
if (info->summoningRitual.animSpell)
@@ -485,7 +484,7 @@ void GameObject::Update(uint32 diff)
{
if (m_respawnTime > 0) // timer on
{
time_t now = GameTime::GetGameTime();
time_t now = time(NULL);
if (m_respawnTime <= now) // timer expired
{
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
@@ -561,7 +560,7 @@ void GameObject::Update(uint32 diff)
GameObjectTemplate const* goInfo = GetGOInfo();
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
{
if (GameTime::GetGameTimeMS() < m_cooldownTime)
if (World::GetGameTimeMS() < m_cooldownTime)
break;
// Type 2 - Bomb (will go away after casting it's spell)
@@ -621,7 +620,7 @@ void GameObject::Update(uint32 diff)
if (goInfo->trap.spellId)
CastSpell(target, goInfo->trap.spellId);
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
if (goInfo->trap.type == 1)
SetLootState(GO_JUST_DEACTIVATED);
@@ -653,11 +652,11 @@ void GameObject::Update(uint32 diff)
{
case GAMEOBJECT_TYPE_DOOR:
case GAMEOBJECT_TYPE_BUTTON:
if (GetGOInfo()->GetAutoCloseTime() && GameTime::GetGameTimeMS() >= m_cooldownTime)
if (GetGOInfo()->GetAutoCloseTime() && World::GetGameTimeMS() >= m_cooldownTime)
ResetDoorOrButton();
break;
case GAMEOBJECT_TYPE_GOOBER:
if (GameTime::GetGameTimeMS() >= m_cooldownTime)
if (World::GetGameTimeMS() >= m_cooldownTime)
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
@@ -729,7 +728,7 @@ void GameObject::Update(uint32 diff)
return;
}
m_respawnTime = GameTime::GetGameTime() + m_respawnDelayTime;
m_respawnTime = time(NULL) + m_respawnDelayTime;
// if option not set then object will be saved at grid unload
if (GetMap()->IsDungeon())
@@ -942,7 +941,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid);
// ready to respawn
if (m_respawnTime && m_respawnTime <= GameTime::GetGameTime())
if (m_respawnTime && m_respawnTime <= time(NULL))
{
m_respawnTime = 0;
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
@@ -1026,7 +1025,7 @@ Unit* GameObject::GetOwner() const
void GameObject::SaveRespawnTime()
{
if (m_goData && m_goData->dbData && m_respawnTime > GameTime::GetGameTime() && m_spawnedByDefault)
if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime);
}
@@ -1081,26 +1080,11 @@ bool GameObject::IsInvisibleDueToDespawn() const
return false;
}
time_t GameObject::GetRespawnTimeEx() const
{
time_t now = GameTime::GetGameTime();
if (m_respawnTime > now)
return m_respawnTime;
else
return now;
}
void GameObject::SetRespawnTime(int32 respawn)
{
m_respawnTime = respawn > 0 ? GameTime::GetGameTime() + respawn : 0;
m_respawnDelayTime = respawn > 0 ? respawn : 0;
}
void GameObject::Respawn()
{
if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = GameTime::GetGameTime();
m_respawnTime = time(NULL);
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
}
}
@@ -1228,7 +1212,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
SwitchDoorOrButton(true, alternative);
SetLootState(GO_ACTIVATED, user);
m_cooldownTime = GameTime::GetGameTimeMS()+time_to_restore;
m_cooldownTime = World::GetGameTimeMS()+time_to_restore;
}
void GameObject::SetGoArtKit(uint8 kit)
@@ -1295,10 +1279,10 @@ void GameObject::Use(Unit* user)
// If cooldown data present in template
if (uint32 cooldown = GetGOInfo()->GetCooldown())
{
if (GameTime::GetGameTimeMS() < m_cooldownTime)
if (World::GetGameTimeMS() < m_cooldownTime)
return;
m_cooldownTime = GameTime::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
m_cooldownTime = World::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
}
switch (GetGoType())
@@ -1332,7 +1316,7 @@ void GameObject::Use(Unit* user)
if (goInfo->trap.spellId)
CastSpell(user, goInfo->trap.spellId);
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
if (goInfo->trap.type == 1) // Deactivate after trigger
SetLootState(GO_JUST_DEACTIVATED);
@@ -1485,7 +1469,7 @@ void GameObject::Use(Unit* user)
if (info->goober.customAnim)
SendCustomAnim(GetGoAnimProgress());
m_cooldownTime = GameTime::GetGameTimeMS()+info->GetAutoCloseTime();
m_cooldownTime = World::GetGameTimeMS()+info->GetAutoCloseTime();
// cast this spell later if provided
spellId = info->goober.spellId;
@@ -1659,7 +1643,7 @@ void GameObject::Use(Unit* user)
if (!info->summoningRitual.animSpell)
m_cooldownTime = 0;
else // channel ready, maintain this
m_cooldownTime = GameTime::GetGameTimeMS()+5*IN_MILLISECONDS;
m_cooldownTime = World::GetGameTimeMS()+5*IN_MILLISECONDS;
}
return;
@@ -2212,11 +2196,6 @@ void GameObject::SetLootState(LootState state, Unit* unit)
}*/
}
void GameObject::SetLootGenerationTime()
{
m_lootGenerationTime = GameTime::GetGameTime();
}
void GameObject::SetGoState(GOState state)
{
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);