diff options
-rw-r--r-- | doc/script_commands.txt | 8 | ||||
-rw-r--r-- | src/map/script.c | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index b8f856877..6a97bae1d 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10634,6 +10634,14 @@ returns progress on success and false on failure --------------------------------------- +*achievement_iscompleted(<ach_id>{, <account_id>}) + +Checks whether the attached player have completed all the given achievement objectives. + +returns true if yes and false if no. + +--------------------------------------- + *itempreview(<index>) Update already opened preview window with item from diff --git a/src/map/script.c b/src/map/script.c index 557550be2..3879d8efb 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -22269,6 +22269,23 @@ static BUILDIN(achievement_progress) return true; } +static BUILDIN(achievement_iscompleted) +{ + struct map_session_data *sd = script_hasdata(st, 3) ? map->id2sd(script_getnum(st, 3)) : script->rid2sd(st); + if (sd == NULL) + return false; + + int aid = script_getnum(st, 2); + const struct achievement_data *ad = achievement->get(aid); + if (ad == NULL) { + ShowError("buildin_achievement_iscompleted: Invalid Achievement %d provided.\n", aid); + return false; + } + + script_pushint(st, achievement->check_complete(sd, ad)); + return true; +} + /*========================================== * BattleGround System *------------------------------------------*/ @@ -27006,6 +27023,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(agitcheck2,""), // Achievements [Smokexyz/Hercules] BUILDIN_DEF(achievement_progress, "iiii?"), + BUILDIN_DEF(achievement_iscompleted, "i?"), // BattleGround BUILDIN_DEF(waitingroom2bg,"siiss?"), BUILDIN_DEF(waitingroom2bg_single,"isiis"), |