summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 07:12:45 +0000
committerKevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 07:12:45 +0000
commit3e2be49541f4f9e464fb7cac1c4bd6eff4df5572 (patch)
treefbda0c2978ef30de8362c56d2a352a06791d2bce /src/map/script.c
parentc6670cae6548eb6792b13f00ea6d8299c2c825fc (diff)
downloadhercules-3e2be49541f4f9e464fb7cac1c4bd6eff4df5572.tar.gz
hercules-3e2be49541f4f9e464fb7cac1c4bd6eff4df5572.tar.bz2
hercules-3e2be49541f4f9e464fb7cac1c4bd6eff4df5572.tar.xz
hercules-3e2be49541f4f9e464fb7cac1c4bd6eff4df5572.zip
Finished most of the quest log code, still bits here and there but it's usable now.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12558 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 4cfde66f9..f5c1339cd 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -43,6 +43,7 @@
#include "pet.h"
#include "mail.h"
#include "script.h"
+#include "quest.h"
#include <stdio.h>
#include <stdlib.h>
@@ -13044,6 +13045,78 @@ BUILDIN_FUNC(setcell)
return 0;
}
+/******************
+Questlog script commands
+*******************/
+
+BUILDIN_FUNC(getquest)
+{
+
+ TBL_PC * sd = script_rid2sd(st);
+ struct quest qd;
+ int i, count = 0;
+ char * temp;
+
+ memset(&qd, 0, sizeof(struct quest));
+
+ qd.quest_id = script_getnum(st, 2);
+ qd.time = script_getnum(st, 3);
+ qd.state = Q_ACTIVE;
+
+ for(i=0; i<(script_lastdata(st)-3) && (i/2) < MAX_QUEST_OBJECTIVES; i+=2)
+ {
+ temp = (char*)script_getstr(st, i+4);
+ memcpy(&qd.objectives[i/2].name, temp, NAME_LENGTH);
+ temp = NULL;
+ qd.objectives[i/2].count = script_getnum(st, i+5);
+ count++;
+ }
+
+ qd.num_objectives = count;
+
+ quest_add(sd, &qd);
+
+ return 0;
+
+}
+
+BUILDIN_FUNC(deletequest)
+{
+
+ TBL_PC * sd = script_rid2sd(st);
+ int qid = script_getnum(st, 2);
+
+ quest_delete(sd, qid);
+ return 0;
+
+}
+
+BUILDIN_FUNC(setquestobjective)
+{
+
+ TBL_PC * sd = script_rid2sd(st);
+ int qid = script_getnum(st, 2);
+ int num = script_getnum(st, 3);
+ const char * str = script_getstr(st, 4);
+ int count = script_getnum(st, 5);
+
+ quest_update_objective(sd, qid, num, str, count);
+
+ return 0;
+}
+
+BUILDIN_FUNC(setqueststatus)
+{
+
+ TBL_PC * sd = script_rid2sd(st);
+ int qid = script_getnum(st, 2);
+ bool active = script_getnum(st, 3)?true:false;
+
+ quest_update_status(sd, qid, active);
+
+ return 0;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
@@ -13388,5 +13461,9 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(openauction,""),
BUILDIN_DEF(checkcell,"siii"),
BUILDIN_DEF(setcell,"siiiiii"),
+ BUILDIN_DEF(getquest, "ii*"),
+ BUILDIN_DEF(deletequest, "i"),
+ BUILDIN_DEF(setquestobjective, "iisi"),
+ BUILDIN_DEF(setqueststatus, "ii"),
{NULL,NULL,NULL},
};