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 --- Changelog-Trunk.txt | 2 ++ src/map/quest.c | 9 +++++++++ src/map/quest.h | 2 ++ src/map/script.c | 12 ++++++++++++ 4 files changed, 25 insertions(+) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index a8dfe0af2..2dfd49ea9 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2008/04/26 + * Added script function hasquest. [Kevin] + * Fixed OnGuildBreak. [Kevin] * Cleaned up auth system after change back to map server request. - Created function set_char_charselect to get rid of some of the "special case" variables. - Removed code that involved the char server sending auth data at char select. 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-60-g2f50