A feature could be added to calculate the completion rate of achievement groups, so that it can be quickly checked which achievement completion within a group does not match the in-game one.
The original calculation code for the game is as follows (formatted):
GetAchievementGroupProgress() {
let t = 0,
e = 0;
for (const i of ModelManager_1.ModelManager.AchievementModel.GetGroupAchievements(this.xe, !1)) {
var r = i.GetFinishState();
i.GetHiddenState() && 0 === r || void 0 === i.GetMaxProgress() || (t++, 0 !== r && e++)
}
return Math.round(100 * e / t) + "%"
}
After adding the comment:
GetAchievementGroupProgress() {
// Initialize the variable totalAchievements to indicate the total number of achievements and completedAchievements to indicate the number of completed achievements.
let totalAchievements = 0, completedAchievements = 0;
// Iterate through each achievement in the achievement group
for (const achievement of ModelManager_1.ModelManager.AchievementModel.GetGroupAchievements(this.xe, false)) {
// Get the completion status of the current achievement
var finishState = achievement.GetFinishState();
// Skip this achievement if it is hidden and uncompleted, or if the maximum progress is undefined
if (achievement.GetHiddenState() && finishState === 0 || achievement.GetMaxProgress() === undefined) {
continue;
}
// Total number of statistical achievements
totalAchievements++;
// If an achievement has been completed, count the number of completed achievements
if (finishState !== 0) {
completedAchievements++;
}
}
// Calculate and return percentage of completion, rounded to the nearest whole number
return Math.round(100 * completedAchievements / totalAchievements) + "%";
}
Try to keep the calculation consistent with the in-game method so it's easier to troubleshoot.
A feature could be added to calculate the completion rate of achievement groups, so that it can be quickly checked which achievement completion within a group does not match the in-game one.
The original calculation code for the game is as follows (formatted):
After adding the comment:
Try to keep the calculation consistent with the in-game method so it's easier to troubleshoot.