diff options
-rw-r--r-- | doc/script_commands.txt | 9 | ||||
-rw-r--r-- | src/map/script.c | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 26ecbdd42..b3f0b0e5c 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -8411,6 +8411,15 @@ If parameter 'HUNTING' is supplied: --------------------------------------- +*questactive(<ID>) + +Check whether the given quest is in its active state. + +Returns true if the quest is active, false otherwise (quest not started, +inactive or completed) + +--------------------------------------- + *showevent <icon>{,<mark color>} Show an emotion on top of a NPC, and optionally, diff --git a/src/map/script.c b/src/map/script.c index c88e2851f..0588d2f24 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -16373,6 +16373,23 @@ BUILDIN(checkquest) { return true; } +BUILDIN(questactive) { + struct map_session_data *sd = script->rid2sd(st); + int quest_progress = 0; + + if (sd == NULL) + return false; + + if (quest->check(sd, script_getnum(st, 2), HAVEQUEST) == Q_ACTIVE) + script_pushint(st, 1); + else + script_pushint(st, 0); + + script_pushint(st, quest_progress); + + return true; +} + BUILDIN(questprogress) { struct map_session_data *sd = script->rid2sd(st); enum quest_check_type type = HAVEQUEST; @@ -19323,6 +19340,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(completequest, "i?"), BUILDIN_DEF(checkquest, "i?"), BUILDIN_DEF(questprogress, "i?"), + BUILDIN_DEF(questactive, "i"), BUILDIN_DEF(changequest, "ii"), BUILDIN_DEF(showevent, "i?"), |