From ab60cf06afb586b106991b4b9848dd9c107ddec2 Mon Sep 17 00:00:00 2001 From: Kevin Date: Sat, 26 Apr 2008 23:11:15 +0000 Subject: Added script function hasquest. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12660 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/quest.c | 9 +++++++++ src/map/quest.h | 2 ++ src/map/script.c | 12 ++++++++++++ 3 files changed, 23 insertions(+) (limited to 'src/map') 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}, }; -- cgit v1.2.3-70-g09d2