Have hidden achievements actually be hidden.
Also hidden_name and hidden_hint are no longer attributes of [achievement].
This commit is contained in:
parent
0a0263e54f
commit
7825de6a71
6 changed files with 21 additions and 66 deletions
|
@ -1,42 +1,5 @@
|
|||
#textdomain wesnoth
|
||||
|
||||
# NOTE: due to achievements being loaded separately from the rest of the WML, this macro is not available for general use.
|
||||
#define ACHIEVEMENT ID NAME DESC
|
||||
#arg HIDDEN
|
||||
no#endarg
|
||||
|
||||
#arg HIDDEN_NAME
|
||||
_"???"#endarg
|
||||
|
||||
#arg HIDDEN_HINT
|
||||
#endarg
|
||||
|
||||
#arg NAME_COMPLETE
|
||||
#endarg
|
||||
|
||||
#arg DESC_COMPLETE
|
||||
#endarg
|
||||
|
||||
#arg ICON
|
||||
data/core/images/icons/potion_red_small.png#endarg
|
||||
|
||||
#arg ICON_COMPLETE
|
||||
data/core/images/icons/potion_green_small.png#endarg
|
||||
|
||||
[achievement]
|
||||
id={ID}
|
||||
name={NAME}
|
||||
name_completed={NAME_COMPLETE}
|
||||
description={DESC}
|
||||
description_completed={DESC_COMPLETE}
|
||||
icon={ICON}
|
||||
icon_completed={ICON_COMPLETE}
|
||||
hidden={HIDDEN}
|
||||
hidden_name={HIDDEN_NAME}
|
||||
hidden_hint={HIDDEN_HINT}
|
||||
[/achievement]
|
||||
#enddef
|
||||
|
||||
# some distros (ie: Debian) put campaigns in separate independent packages, so they aren't all guaranteed to exist even though they're part of mainline
|
||||
#ifhave campaigns/tutorial
|
||||
{campaigns/tutorial/achievements.cfg}
|
||||
|
|
|
@ -2,5 +2,11 @@
|
|||
[achievement_group]
|
||||
display_name=_"Descent into Darkness"
|
||||
content_for=descent_into_darkness
|
||||
{ACHIEVEMENT "did_rat_eater" _"Rat Eater" _"Have a Ghoul eat way too many rats during Descent into Darkness's A Haunting in Winter." HIDDEN=yes HIDDEN_HINT=_"Eat some rats!"}
|
||||
[achievement]
|
||||
id = "did_rat_eater"
|
||||
name = _"Rat Eater"
|
||||
description = _"Have a Ghoul eat way too many rats during Descent into Darkness's A Haunting in Winter."
|
||||
icon="data/core/images/icons/potion_red_small.png"
|
||||
hidden = yes
|
||||
[/achievement]
|
||||
[/achievement_group]
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
{REQUIRED_KEY icon string}
|
||||
{SIMPLE_KEY icon_completed string}
|
||||
{SIMPLE_KEY hidden bool}
|
||||
{SIMPLE_KEY hidden_name t_string}
|
||||
{SIMPLE_KEY hidden_hint t_string}
|
||||
{SIMPLE_KEY max_progress int}
|
||||
[/tag]
|
||||
[/tag]
|
||||
|
|
|
@ -43,10 +43,6 @@ struct achievement
|
|||
std::string icon_completed_;
|
||||
/** Whether to show the achievement's actual name and description on the UI before it's been completed. */
|
||||
bool hidden_;
|
||||
/** The hint to display in place of the description if the achievement is hidden and uncompleted */
|
||||
t_string hidden_name_;
|
||||
/** The hint to display in place of the description if the achievement is hidden and uncompleted */
|
||||
t_string hidden_hint_;
|
||||
/** Whether the achievement has been completed. */
|
||||
bool achieved_;
|
||||
/** When the achievement's current progress matches or equals this value, then it should be marked as completed */
|
||||
|
@ -63,8 +59,6 @@ struct achievement
|
|||
, icon_(cfg["icon"].str()+"~GS()")
|
||||
, icon_completed_(cfg["icon_completed"].str())
|
||||
, hidden_(cfg["hidden"].to_bool())
|
||||
, hidden_name_(cfg["hidden_name"].t_str())
|
||||
, hidden_hint_(cfg["hidden_hint"].t_str())
|
||||
, achieved_(achieved)
|
||||
, max_progress_(cfg["max_progress"].to_int(0))
|
||||
, current_progress_(progress)
|
||||
|
|
|
@ -61,19 +61,19 @@ void achievements_dialog::pre_show(window& win)
|
|||
int achieved_count = 0;
|
||||
|
||||
for(const auto& ach : list.achievements_) {
|
||||
widget_data row;
|
||||
widget_item item;
|
||||
|
||||
if(ach.achieved_) {
|
||||
achieved_count++;
|
||||
} else if(ach.hidden_ && !ach.achieved_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
widget_data row;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = !ach.achieved_ ? ach.icon_ : ach.icon_completed_;
|
||||
row.emplace("icon", item);
|
||||
|
||||
if(ach.hidden_ && !ach.achieved_) {
|
||||
item["label"] = ach.hidden_name_;
|
||||
} else if(!ach.achieved_) {
|
||||
if(!ach.achieved_) {
|
||||
std::string name = ach.name_;
|
||||
if(ach.max_progress_ != 0 && ach.current_progress_ != -1) {
|
||||
name += " ("+std::to_string(ach.current_progress_)+"/"+std::to_string(ach.max_progress_)+")";
|
||||
|
@ -84,9 +84,7 @@ void achievements_dialog::pre_show(window& win)
|
|||
}
|
||||
row.emplace("name", item);
|
||||
|
||||
if(ach.hidden_ && !ach.achieved_) {
|
||||
item["label"] = ach.hidden_hint_;
|
||||
} else if(!ach.achieved_) {
|
||||
if(!ach.achieved_) {
|
||||
item["label"] = ach.description_;
|
||||
} else {
|
||||
item["label"] = "<span color='green'>"+ach.description_completed_+"</span>";
|
||||
|
@ -127,28 +125,26 @@ void achievements_dialog::set_achievements_content()
|
|||
|
||||
achievement_group list = game_config_manager::get()->get_achievements().at(selected_index_);
|
||||
for(const auto& ach : list.achievements_) {
|
||||
widget_data row;
|
||||
widget_item item;
|
||||
|
||||
if(ach.achieved_) {
|
||||
achieved_count++;
|
||||
} else if(ach.hidden_ && !ach.achieved_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
widget_data row;
|
||||
widget_item item;
|
||||
|
||||
item["label"] = !ach.achieved_ ? ach.icon_ : ach.icon_completed_;
|
||||
row.emplace("icon", item);
|
||||
|
||||
if(ach.hidden_ && !ach.achieved_) {
|
||||
item["label"] = ach.hidden_name_;
|
||||
} else if(!ach.achieved_) {
|
||||
if(!ach.achieved_) {
|
||||
item["label"] = ach.name_;
|
||||
} else {
|
||||
item["label"] = "<span color='green'>"+ach.name_completed_+"</span>";
|
||||
}
|
||||
row.emplace("name", item);
|
||||
|
||||
if(ach.hidden_ && !ach.achieved_) {
|
||||
item["label"] = ach.hidden_hint_;
|
||||
} else if(!ach.achieved_) {
|
||||
if(!ach.achieved_) {
|
||||
item["label"] = ach.description_;
|
||||
} else {
|
||||
item["label"] = "<span color='green'>"+ach.description_completed_+"</span>";
|
||||
|
|
|
@ -3142,8 +3142,6 @@ int game_lua_kernel::intf_get_achievement(lua_State *L)
|
|||
cfg["icon"] = achieve.icon_;
|
||||
cfg["icon_completed"] = achieve.icon_completed_;
|
||||
cfg["hidden"] = achieve.hidden_;
|
||||
cfg["hidden_name"] = achieve.hidden_name_;
|
||||
cfg["hidden_hint"] = achieve.hidden_hint_;
|
||||
cfg["achieved"] = achieve.achieved_;
|
||||
cfg["max_progress"] = achieve.max_progress_;
|
||||
cfg["current_progress"] = achieve.current_progress_;
|
||||
|
|
Loading…
Add table
Reference in a new issue