feat(Core/Time): Implement saparated manager for game time (#8630)

This commit is contained in:
Kargatum
2022-01-24 17:55:00 +07:00
committed by GitHub
parent 12da792a90
commit 8b7df23f06
129 changed files with 1147 additions and 817 deletions

View File

@@ -34,6 +34,7 @@ at_brewfest
at_area_52_entrance
EndContentData */
#include "GameTime.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -384,7 +385,7 @@ public:
{
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().count() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
return false;
switch (triggerId)
@@ -401,7 +402,7 @@ public:
break;
}
_triggerTimes[triggerId] = sWorld->GetGameTime();
_triggerTimes[triggerId] = GameTime::GetGameTime().count();
return false;
}
@@ -441,7 +442,7 @@ public:
return false;
uint32 triggerId = trigger->entry;
if (sWorld->GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
if (GameTime::GetGameTime().count() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
return false;
switch (triggerId)
@@ -470,7 +471,7 @@ public:
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().count();
return false;
}

View File

@@ -43,6 +43,7 @@ EndContentData */
#include "CellImpl.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -1414,7 +1415,7 @@ class go_inconspicuous_landmark : public GameObjectScript
public:
go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark")
{
_lastUsedTime = time(nullptr);
_lastUsedTime = GameTime::GetGameTime().count();
}
bool OnGossipHello(Player* player, GameObject* /*go*/) override
@@ -1422,10 +1423,10 @@ public:
if (player->HasItemCount(ITEM_CUERGOS_KEY))
return true;
if (_lastUsedTime > time(nullptr))
if (_lastUsedTime > GameTime::GetGameTime().count())
return true;
_lastUsedTime = time(nullptr) + MINUTE;
_lastUsedTime = GameTime::GetGameTime().count() + MINUTE;
player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true);
return true;
}

View File

@@ -17,6 +17,7 @@
#include "npc_stave_of_ancients.h"
#include "CreatureGroups.h"
#include "GameTime.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -602,7 +603,7 @@ public:
if (Precious()->isDead())
{
// Make it so that Precious respawns after Simone
uint32 respawnTime = me->GetRespawnTime() - time(nullptr);
uint32 respawnTime = me->GetRespawnTime() - GameTime::GetGameTime().count();
Precious()->SetRespawnTime(respawnTime);
return;
}

View File

@@ -42,6 +42,7 @@ EndContentData */
#include "CreatureTextMgr.h"
#include "DBCStructure.h"
#include "GameEventMgr.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "ObjectMgr.h"
#include "PassiveAI.h"