Fixes to Achievement points count/mastery
Two minor updates to improve the Achievement Manager's handling of a player's completion rate. One, UnlockStatus and the unlock map now track achievement category, such that TallyScore does not count unofficial achievements in counts/points. Two, the determinations for mastery/completion are now improved to check (1) that the achievement triggering this is CORE (not UNOFFICIAL) and (2) that it has not already been unlocked at this level on the site, which should be sufficient to determine that the unlocking of this particular achievement completes/masters the game.
This commit is contained in:
parent
a0f555648c
commit
e5b73fec08
|
@ -359,11 +359,11 @@ void AchievementManager::ActivateDeactivateAchievements()
|
||||||
bool encore = Config::Get(Config::RA_ENCORE_ENABLED);
|
bool encore = Config::Get(Config::RA_ENCORE_ENABLED);
|
||||||
for (u32 ix = 0; ix < m_game_data.num_achievements; ix++)
|
for (u32 ix = 0; ix < m_game_data.num_achievements; ix++)
|
||||||
{
|
{
|
||||||
u32 points = (m_game_data.achievements[ix].category == RC_ACHIEVEMENT_CATEGORY_UNOFFICIAL) ?
|
auto iter =
|
||||||
0 :
|
m_unlock_map.insert({m_game_data.achievements[ix].id,
|
||||||
m_game_data.achievements[ix].points;
|
UnlockStatus{.game_data_index = ix,
|
||||||
auto iter = m_unlock_map.insert(
|
.points = m_game_data.achievements[ix].points,
|
||||||
{m_game_data.achievements[ix].id, UnlockStatus{.game_data_index = ix, .points = points}});
|
.category = m_game_data.achievements[ix].category}});
|
||||||
ActivateDeactivateAchievement(iter.first->first, enabled, unofficial, encore);
|
ActivateDeactivateAchievement(iter.first->first, enabled, unofficial, encore);
|
||||||
}
|
}
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Achievements (de)activated.");
|
INFO_LOG_FMT(ACHIEVEMENTS, "Achievements (de)activated.");
|
||||||
|
@ -800,6 +800,8 @@ AchievementManager::PointSpread AchievementManager::TallyScore() const
|
||||||
return spread;
|
return spread;
|
||||||
for (const auto& entry : m_unlock_map)
|
for (const auto& entry : m_unlock_map)
|
||||||
{
|
{
|
||||||
|
if (entry.second.category != RC_ACHIEVEMENT_CATEGORY_CORE)
|
||||||
|
continue;
|
||||||
u32 points = entry.second.points;
|
u32 points = entry.second.points;
|
||||||
spread.total_count++;
|
spread.total_count++;
|
||||||
spread.total_points += points;
|
spread.total_points += points;
|
||||||
|
@ -1460,22 +1462,27 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_
|
||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ?
|
(Config::Get(Config::RA_BADGES_ENABLED)) ?
|
||||||
DecodeBadgeToOSDIcon(it->second.unlocked_badge.badge) :
|
DecodeBadgeToOSDIcon(it->second.unlocked_badge.badge) :
|
||||||
nullptr);
|
nullptr);
|
||||||
PointSpread spread = TallyScore();
|
if (m_game_data.achievements[game_data_index].category == RC_ACHIEVEMENT_CATEGORY_CORE)
|
||||||
if (spread.hard_points == spread.total_points)
|
|
||||||
{
|
{
|
||||||
OSD::AddMessage(
|
PointSpread spread = TallyScore();
|
||||||
fmt::format("Congratulations! {} has mastered {}", m_display_name, m_game_data.title),
|
if (spread.hard_points == spread.total_points &&
|
||||||
OSD::Duration::VERY_LONG, OSD::Color::YELLOW,
|
it->second.remote_unlock_status != UnlockStatus::UnlockType::HARDCORE)
|
||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
{
|
||||||
nullptr);
|
OSD::AddMessage(
|
||||||
}
|
fmt::format("Congratulations! {} has mastered {}", m_display_name, m_game_data.title),
|
||||||
else if (spread.hard_points + spread.soft_points == spread.total_points)
|
OSD::Duration::VERY_LONG, OSD::Color::YELLOW,
|
||||||
{
|
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
||||||
OSD::AddMessage(
|
nullptr);
|
||||||
fmt::format("Congratulations! {} has completed {}", m_display_name, m_game_data.title),
|
}
|
||||||
OSD::Duration::VERY_LONG, OSD::Color::CYAN,
|
else if (spread.hard_points + spread.soft_points == spread.total_points &&
|
||||||
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
it->second.remote_unlock_status == UnlockStatus::UnlockType::LOCKED)
|
||||||
nullptr);
|
{
|
||||||
|
OSD::AddMessage(
|
||||||
|
fmt::format("Congratulations! {} has completed {}", m_display_name, m_game_data.title),
|
||||||
|
OSD::Duration::VERY_LONG, OSD::Color::CYAN,
|
||||||
|
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(m_game_badge.badge) :
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ActivateDeactivateAchievement(event_id, Config::Get(Config::RA_ACHIEVEMENTS_ENABLED),
|
ActivateDeactivateAchievement(event_id, Config::Get(Config::RA_ACHIEVEMENTS_ENABLED),
|
||||||
Config::Get(Config::RA_UNOFFICIAL_ENABLED),
|
Config::Get(Config::RA_UNOFFICIAL_ENABLED),
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
u32 points = 0;
|
u32 points = 0;
|
||||||
BadgeStatus locked_badge;
|
BadgeStatus locked_badge;
|
||||||
BadgeStatus unlocked_badge;
|
BadgeStatus unlocked_badge;
|
||||||
|
u32 category = RC_ACHIEVEMENT_CATEGORY_CORE;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::string_view GRAY = "transparent";
|
static constexpr std::string_view GRAY = "transparent";
|
||||||
|
|
Loading…
Reference in New Issue