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

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -26,6 +26,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Player.h"
#include "GameTime.h"
#include "SpellMgr.h"
// Ours
@@ -382,7 +383,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
{
uint32 triggerId = trigger->entry;
// Second trigger happened too early after first, skip for now
if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
if (GameTime::GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
return false;
switch (triggerId)
@@ -399,7 +400,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
break;
}
_triggerTimes[triggerId] = sWorld->GetGameTime();
_triggerTimes[triggerId] = GameTime::GetGameTime();
return false;
}
@@ -439,7 +440,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
return false;
uint32 triggerId = trigger->entry;
if (sWorld->GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
if (GameTime::GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
return false;
switch (triggerId)
@@ -468,7 +469,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000);
player->AddAura(SPELL_A52_NEURALYZER, player);
_triggerTimes[trigger->entry] = sWorld->GetGameTime();
_triggerTimes[trigger->entry] = GameTime::GetGameTime();
return false;
}

View File

@@ -36,6 +36,7 @@ EndContentData */
#include "GameObjectAI.h"
#include "Spell.h"
#include "Player.h"
#include "GameTime.h"
#include "WorldSession.h"
// Ours
@@ -836,7 +837,7 @@ class go_inconspicuous_landmark : public GameObjectScript
public:
go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark")
{
_lastUsedTime = time(NULL);
_lastUsedTime = GameTime::GetGameTime();
}
bool OnGossipHello(Player* player, GameObject* /*go*/)
@@ -844,10 +845,10 @@ class go_inconspicuous_landmark : public GameObjectScript
if (player->HasItemCount(ITEM_CUERGOS_KEY))
return true;
if (_lastUsedTime > time(NULL))
if (_lastUsedTime > GameTime::GetGameTime())
return true;
_lastUsedTime = time(NULL) + MINUTE;
_lastUsedTime = GameTime::GetGameTime() + MINUTE;
player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true);
return true;
}

View File

@@ -33,6 +33,7 @@ EndContentData */
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "World.h"
#include "GameTime.h"
#include "CreatureTextMgr.h"
#include "PassiveAI.h"
#include "GameEventMgr.h"
@@ -108,7 +109,7 @@ public:
{
case EVENT_CLEARWATER_ANNOUNCE:
{
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm strdate;
ACE_OS::localtime_r(&curtime, &strdate);
@@ -253,7 +254,7 @@ public:
{
case EVENT_RIGGLE_ANNOUNCE:
{
time_t curtime = time(NULL);
time_t curtime = GameTime::GetGameTime();
tm strdate;
ACE_OS::localtime_r(&curtime, &strdate);
if (!startWarning && strdate.tm_hour == 14 && strdate.tm_min == 0)