diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/quest.c | 9 | ||||
-rw-r--r-- | src/map/quest.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 12 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/map/quest.c b/src/map/quest.c index b822b67ca..057c46d7c 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -185,6 +185,15 @@ int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const c } +bool quest_has_quest(TBL_PC * sd, int quest_id) +{ + int i; + + ARR_FIND(0, MAX_QUEST, i, sd->quest_log[i].quest_id == quest_id); + + return (i != MAX_QUEST); +} + int quest_update_status(TBL_PC * sd, int quest_id, bool status) { diff --git a/src/map/quest.h b/src/map/quest.h index 269c58bee..c8fa98246 100644 --- a/src/map/quest.h +++ b/src/map/quest.h @@ -17,4 +17,6 @@ int quest_delete_ack(int char_id, int quest_id, int success); int quest_update_objective(TBL_PC * sd, int quest_id, int objective_num, const char * name, int count); int quest_update_status(TBL_PC * sd, int quest_id, bool status); +bool quest_has_quest(TBL_PC * sd, int quest_id); + #endif diff --git a/src/map/script.c b/src/map/script.c index 316bf113a..4f2bcd1b0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -13161,6 +13161,17 @@ BUILDIN_FUNC(setquestobjective) return 0; } +BUILDIN_FUNC(hasquest) +{ + + TBL_PC * sd = script_rid2sd(st); + int qid = script_getnum(st, 2); + + script_pushint(st, quest_has_quest(sd, qid)?1:0); + + return 0; +} + BUILDIN_FUNC(setqueststatus) { @@ -13521,5 +13532,6 @@ struct script_function buildin_func[] = { BUILDIN_DEF(deletequest, "i"), BUILDIN_DEF(setquestobjective, "iisi"), BUILDIN_DEF(setqueststatus, "ii"), + BUILDIN_DEF(hasquest, "i"), {NULL,NULL,NULL}, }; |