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

View File

@@ -34,6 +34,7 @@
# CHARACTER DELETE
# CHARACTER CREATION
# CHARACTER
# ACHIEVEMENT
# SKILL
# STATS
# REPUTATION
@@ -2225,6 +2226,22 @@ SpellQueue.Window = 400
#
###################################################################################################
###################################################################################################
# ACHIEVEMENT
#
# Achievement.RealmFirstKillWindow
# Description: Time window (in seconds) for realm first kill achievements after the first
# completion. This setting controls whether multiple groups can earn the
# realm first kill achievement within a short time window.
# Default: 60 - (Allow additional groups to complete within 60 seconds/1 minute)
# 0 - (Strict mode, only the first group/player gets the achievement)
# 1+ - (Extended window, allow N seconds for additional completions)
Achievement.RealmFirstKillWindow = 60
#
###################################################################################################
###################################################################################################
# SKILL
#

View File

@@ -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);

View File

@@ -674,4 +674,7 @@ void WorldConfig::BuildConfigCache()
SetConfigValue<uint32>(CONFIG_SCOURGEINVASION_COUNTER_THIRD, "ScourgeInvasion.CounterThird", 150);
SetConfigValue<std::string>(CONFIG_NEW_CHAR_STRING, "PlayerStart.String", "");
// Achievement
SetConfigValue<uint32>(CONFIG_ACHIEVEMENT_REALM_FIRST_KILL_WINDOW, "Achievement.RealmFirstKillWindow", 60);
}

View File

@@ -489,6 +489,7 @@ enum ServerConfigs
RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER,
CONFIG_NEW_CHAR_STRING,
CONFIG_VALIDATE_SKILL_LEARNED_BY_SPELLS,
CONFIG_ACHIEVEMENT_REALM_FIRST_KILL_WINDOW,
MAX_NUM_SERVER_CONFIGS
};