Browse Source

Added script function hasquest.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12660 54d463be-8e91-2dee-dedb-b68131a5f0ec
Kevin 17 năm trước cách đây
mục cha
commit
2eabb3d1f7
4 tập tin đã thay đổi với 25 bổ sung0 xóa
  1. 2 0
      Changelog-Trunk.txt
  2. 9 0
      src/map/quest.c
  3. 2 0
      src/map/quest.h
  4. 12 0
      src/map/script.c

+ 2 - 0
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.

+ 9 - 0
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)
 {
 

+ 2 - 0
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

+ 12 - 0
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},
 };