mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 01:23:47 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -276,10 +277,10 @@ public:
|
||||
if (id == 1337)
|
||||
{
|
||||
if (lastShatterMSTime)
|
||||
if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000)
|
||||
if (getMSTimeDiff(lastShatterMSTime, GameTime::GetGameTimeMS().count()) <= 5000)
|
||||
bShattered = true;
|
||||
|
||||
lastShatterMSTime = World::GetGameTimeMS();
|
||||
lastShatterMSTime = GameTime::GetGameTimeMS().count();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "MapMgr.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
@@ -455,7 +456,7 @@ public:
|
||||
case EVENT_SPAWN_FLAMES_INITIAL:
|
||||
{
|
||||
if (changeAllowedFlameSpreadTime)
|
||||
allowedFlameSpreadTime = time(nullptr);
|
||||
allowedFlameSpreadTime = GameTime::GetGameTime().count();
|
||||
|
||||
std::vector<Player*> pg;
|
||||
Map::PlayerList const& pl = me->GetMap()->GetPlayers();
|
||||
@@ -2204,7 +2205,7 @@ public:
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS().count();
|
||||
lastOrientation = -1.0f;
|
||||
return true;
|
||||
}
|
||||
@@ -2215,14 +2216,14 @@ public:
|
||||
{
|
||||
if (c->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS());
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, GameTime::GetGameTimeMS().count());
|
||||
if (lastOrientation == -1.0f)
|
||||
{
|
||||
lastOrientation = (c->ToCreature()->AI()->GetData(0) * 2 * M_PI) / 100.0f;
|
||||
diff = 0;
|
||||
}
|
||||
float new_o = Position::NormalizeOrientation(lastOrientation - (M_PI / 60) * (diff / 250.0f));
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS().count();
|
||||
lastOrientation = new_o;
|
||||
c->SetFacingTo(new_o);
|
||||
|
||||
@@ -2283,7 +2284,7 @@ public:
|
||||
{
|
||||
npc_ulduar_flames_initialAI(Creature* pCreature) : NullCreatureAI(pCreature)
|
||||
{
|
||||
CreateTime = time(nullptr);
|
||||
CreateTime = GameTime::GetGameTime().count();
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750);
|
||||
if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) )
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -1013,10 +1014,10 @@ public:
|
||||
}
|
||||
else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/)
|
||||
{
|
||||
if (time(nullptr) > (m_conspeedatoryAttempt + DAY))
|
||||
if (GameTime::GetGameTime().count() > (m_conspeedatoryAttempt + DAY))
|
||||
{
|
||||
DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/);
|
||||
m_conspeedatoryAttempt = time(nullptr);
|
||||
m_conspeedatoryAttempt = GameTime::GetGameTime().count();
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user