Only hide secret achievements

This commit is contained in:
fed 2023-09-12 19:34:09 +02:00
parent bf55e67abc
commit faccec00f6
No known key found for this signature in database
GPG Key ID: 1D2C630F04722996
5 changed files with 23 additions and 4 deletions

View File

@ -54,7 +54,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
},
{
"Faded",
500
1000
}
})
end
@ -300,7 +300,11 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
if (locked) then
btnbg:animateToState("locked")
image:animateToState("locked")
desc:setText("")
if (achievements.issecret(i)) then
title:setText(Engine.ToUpperCase(Engine.Localize("ACHIEVEMENT_HIDDEN")))
desc:setText(Engine.Localize("ACHIEVEMENT_HIDDEN_DESC"))
end
end
addelement(achievementcontainer)

View File

@ -128,6 +128,8 @@
"LUA_MENU_ACHIEVEMENTS_DESC": "View achievements.",
"LUA_MENU_UNKNOWN_ACHIEVEMENT": "???",
"ACHIEVEMENT_HIDDEN": "Secret achievement",
"ACHIEVEMENT_HIDDEN_DESC": "Keep playing to unlock it",
"ACHIEVEMENT_EARNED": "Achievement Unlocked!",
"ACHIEVEMENT_NAME_0": "Is That All You Got?",
"ACHIEVEMENT_DETAIL_0": "Earn all available trophies for Call of Duty®: Modern Warfare® 2 Campaign Remastered.",

View File

@ -70,13 +70,13 @@ namespace achievements
achievement_t(ACHIEVEMENT_40, "NIGHT_MUSEUM", ACHIEVEMENT_RARITY_1),
achievement_t(ACHIEVEMENT_41, "STUDENT_MASTER", ACHIEVEMENT_RARITY_1),
achievement_t(ACHIEVEMENT_42, "REAL_GUN_GAME", ACHIEVEMENT_RARITY_1),
achievement_t(ACHIEVEMENT_43, "PRECOGNITIVE_PARANOIA", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_43, "PRECOGNITIVE_PARANOIA", ACHIEVEMENT_RARITY_0, true),
achievement_t(ACHIEVEMENT_44, "IMMORTAL", ACHIEVEMENT_RARITY_2),
achievement_t(ACHIEVEMENT_45, "SILENT_SKIES", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_46, "CLAYMORE", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_47, "BIRD_HUNTER", ACHIEVEMENT_RARITY_1),
achievement_t(ACHIEVEMENT_48, "HOT_POTATO", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_49, "CLOWN_IN_TRAINING", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_49, "CLOWN_IN_TRAINING", ACHIEVEMENT_RARITY_0, true),
achievement_t(ACHIEVEMENT_50, "HEADBANGER", ACHIEVEMENT_RARITY_0),
achievement_t(ACHIEVEMENT_51, "BRAINS", ACHIEVEMENT_RARITY_2),
achievement_t(ACHIEVEMENT_52, "RAMIREZ", ACHIEVEMENT_RARITY_2),
@ -378,6 +378,16 @@ namespace achievements
return achievements[id].rarity;
}
bool is_secret(int id)
{
if (id >= ACHIEVEMENT_TOTAL_COUNT)
{
return false;
}
return achievements[id].secret;
}
class component final : public component_interface
{
public:

View File

@ -75,6 +75,7 @@ namespace achievements
achievement_id id;
std::string_view code;
achievement_rarity rarity;
bool secret{};
};
struct achievement_file_t
@ -93,4 +94,5 @@ namespace achievements
std::string get_details(int id);
std::optional<std::string> get_background(int id);
int get_rarity(int id);
bool is_secret(int id);
}

View File

@ -694,6 +694,7 @@ namespace ui_scripting
achievements_table["getname"] = achievements::get_name;
achievements_table["getdetails"] = achievements::get_details;
achievements_table["getbackground"] = achievements::get_background;
achievements_table["issecret"] = achievements::is_secret;
achievements_table["count"] = achievements::get_count;
achievements_table["table"] = []()