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

@@ -19,6 +19,7 @@
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
#include "LFG.h"
@@ -2410,3 +2411,14 @@ void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
else
slot->flags &= ~flag;
}
uint32 Group::GetDifficultyChangePreventionTime() const
{
return _difficultyChangePreventionTime > GameTime::GetGameTime().count() ? _difficultyChangePreventionTime - GameTime::GetGameTime().count() : 0;
}
void Group::SetDifficultyChangePrevention(DifficultyPreventionChangeType type)
{
_difficultyChangePreventionTime = GameTime::GetGameTime().count() + MINUTE;
_difficultyChangePreventionType = type;
}

View File

@@ -309,13 +309,9 @@ public:
bool IsLfgHeroic() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_HEROIC); }
// Difficulty Change
uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(nullptr) ? _difficultyChangePreventionTime - time(nullptr) : 0; }
uint32 GetDifficultyChangePreventionTime() const;
DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; }
void SetDifficultyChangePrevention(DifficultyPreventionChangeType type)
{
_difficultyChangePreventionTime = time(nullptr) + MINUTE;
_difficultyChangePreventionType = type;
}
void SetDifficultyChangePrevention(DifficultyPreventionChangeType type);
protected:
void _homebindIfInstance(Player* player);