feat(Core/Achievements): Add configurable realm first kill time window (#24920)

This commit is contained in:
Kevin Gross
2026-03-08 09:32:56 -03:00
committed by GitHub
parent fbbf960229
commit 04fbeec3c2
4 changed files with 31 additions and 2 deletions
@@ -28,6 +28,7 @@
#include "DBCEnums.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "Duration.h"
#include "GameEventMgr.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
@@ -2592,11 +2593,18 @@ bool AchievementGlobalMgr::IsRealmCompleted(AchievementEntry const* achievement)
if (itr->second == SystemTimePoint::max())
return true;
// Allow completing the realm first kill for entire minute after first person did it
// Allow completing the realm first kill for configurable time window after first person did it
// it may allow more than one group to achieve it (highly unlikely)
// but apparently this is how blizz handles it as well
if (achievement->flags & ACHIEVEMENT_FLAG_REALM_FIRST_KILL)
return (GameTime::GetSystemTime() - itr->second) > 1min;
{
Seconds windowSeconds = Seconds(sWorld->getIntConfig(CONFIG_ACHIEVEMENT_REALM_FIRST_KILL_WINDOW));
if (windowSeconds == 0s)
return true;
return (GameTime::GetSystemTime() - itr->second) > windowSeconds;
}
sScriptMgr->SetRealmCompleted(achievement);