Core/AchievementMgr: fix integer underflow neglecting already completed realm firsts

Closes #19334

(cherry picked from commit 9cfa7c752e1d61b02acb852d2fd304a80d10b60a)
This commit is contained in:
ariel- authored and funjoker committed 2022-01-28 22:32:59 +01:00
1 parent 8aa53f2df7
commit 35b5eaed8f
1 file changed
+4 -1
@@ -3332,6 +3332,9 @@ bool AchievementGlobalMgr::IsRealmCompleted(AchievementEntry const* achievement)
if (itr->second == std::chrono::system_clock::time_point::min())
return false;
if (itr->second == std::chrono::system_clock::time_point::max())
return true;
// Allow completing the realm first kill for entire minute 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
@@ -3567,7 +3570,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
continue;
}
else if (achievement->Flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL | ACHIEVEMENT_FLAG_REALM_FIRST_GUILD))
_allCompletedAchievements[achievementId] = std::chrono::system_clock::time_point::max();;
_allCompletedAchievements[achievementId] = std::chrono::system_clock::time_point::max();
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %lu realm first completed achievements in %u ms.", (unsigned long)_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));