diff options
author | Asheraf <acheraf1998@gmail.com> | 2020-01-15 16:28:45 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-02-09 20:52:57 +0100 |
commit | 8695b790286586ae5e664bd1ef51fcb9debcc7c1 (patch) | |
tree | 8e385fad6dca0da543dc3e3607072d4d92d7dd87 /src | |
parent | 89408e2401a3019c8cb1de0dab9f7e754c4dbfb4 (diff) | |
download | hercules-8695b790286586ae5e664bd1ef51fcb9debcc7c1.tar.gz hercules-8695b790286586ae5e664bd1ef51fcb9debcc7c1.tar.bz2 hercules-8695b790286586ae5e664bd1ef51fcb9debcc7c1.tar.xz hercules-8695b790286586ae5e664bd1ef51fcb9debcc7c1.zip |
Add script command achievement_iscompleted to check for achievement status
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 18 |
1 files changed, 18 insertions, 0 deletions
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"), |