mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Ensure that all actions are compared to fixed point in time (ie. world update start)
This commit is contained in:
@@ -35,6 +35,7 @@ at_brewfest
|
||||
at_area_52_entrance
|
||||
EndContentData */
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Player.h"
|
||||
@@ -314,7 +315,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
|
||||
{
|
||||
uint32 triggerId = trigger->id;
|
||||
// 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)
|
||||
@@ -331,7 +332,7 @@ class AreaTrigger_at_brewfest : public AreaTriggerScript
|
||||
break;
|
||||
}
|
||||
|
||||
_triggerTimes[triggerId] = sWorld->GetGameTime();
|
||||
_triggerTimes[triggerId] = GameTime::GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -371,7 +372,7 @@ class AreaTrigger_at_area_52_entrance : public AreaTriggerScript
|
||||
return false;
|
||||
|
||||
uint32 triggerId = trigger->id;
|
||||
if (sWorld->GetGameTime() - _triggerTimes[trigger->id] < SUMMON_COOLDOWN)
|
||||
if (GameTime::GetGameTime() - _triggerTimes[trigger->id] < SUMMON_COOLDOWN)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
@@ -400,7 +401,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->id] = sWorld->GetGameTime();
|
||||
_triggerTimes[trigger->id] = GameTime::GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Pet.h"
|
||||
@@ -103,7 +104,7 @@ class DuelResetScript : public PlayerScript
|
||||
// remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold
|
||||
player->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
|
||||
{
|
||||
SpellHistory::Clock::time_point now = SpellHistory::Clock::now();
|
||||
SpellHistory::Clock::time_point now = GameTime::GetGameTimeSystemPoint();
|
||||
uint32 cooldownDuration = itr->second.CooldownEnd > now ? std::chrono::duration_cast<std::chrono::milliseconds>(itr->second.CooldownEnd - now).count() : 0;
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first);
|
||||
return spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS
|
||||
|
||||
@@ -53,6 +53,7 @@ EndContentData */
|
||||
#include "Player.h"
|
||||
#include "WorldSession.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
/*######
|
||||
## go_cat_figurine
|
||||
@@ -1573,7 +1574,7 @@ public:
|
||||
{
|
||||
if (eventId == GAME_EVENT_HOURLY_BELLS && start)
|
||||
{
|
||||
time_t time = sWorld->GetGameTime();
|
||||
time_t time = GameTime::GetGameTime();
|
||||
tm localTm;
|
||||
localtime_r(&time, &localTm);
|
||||
uint8 _rings = (localTm.tm_hour - 1) % 12 + 1;
|
||||
|
||||
Reference in New Issue
Block a user