summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/init.c6
-rw-r--r--src/emap/script_buildins.c72
-rw-r--r--src/emap/script_buildins.h3
3 files changed, 78 insertions, 3 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index d7b3415..948e10c 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -130,7 +130,11 @@ HPExport void plugin_init (void)
addScriptCommand("getcraftslotamount", "ii", getCraftSlotAmount);
addScriptCommand("validatecraft", "i", validateCraft);
addScriptCommand("getq", "i", getq);
- addScriptCommand("setq", "ii", setq);
+ addScriptCommand("getq1", "i", getq);
+ addScriptCommand("getq2", "i", getq2);
+ addScriptCommand("getq3", "i", getq3);
+ addScriptCommand("getqtime", "i", getqTime);
+ addScriptCommand("setq", "ii*", setq);
addScriptCommand("setnpcdir", "*", setNpcDir);
addScriptCommand("npcsit", "*", npcSit);
addScriptCommand("npcstand", "*", npcStand);
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index 1acae6b..2a152df 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -540,7 +540,6 @@ BUILDIN(setq)
getSD();
int quest_id = script_getnum(st, 2);
- int quest_value = script_getnum(st, 3);
if (quest->check(sd, quest_id, HAVEQUEST) < 0)
quest->add(sd, quest_id);
@@ -552,7 +551,13 @@ BUILDIN(setq)
return false;
}
- sd->quest_log[i].count[0] = quest_value;
+ sd->quest_log[i].count[0] = script_getnum(st, 3);
+ if (script_hasdata(st, 4))
+ sd->quest_log[i].count[1] = script_getnum(st, 4);
+ if (script_hasdata(st, 5))
+ sd->quest_log[i].count[2] = script_getnum(st, 5);
+ if (script_hasdata(st, 6))
+ sd->quest_log[i].time = script_getnum(st, 6);
sd->save_quest = true;
if (map->save_settings & 64)
chrif->save(sd,0);
@@ -582,6 +587,69 @@ BUILDIN(getq)
return true;
}
+BUILDIN(getq2)
+{
+ int i;
+ getSDReturn(0);
+
+ int quest_id = script_getnum(st, 2);
+ if (quest->check(sd, quest_id, HAVEQUEST) < 0)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
+ if (i == sd->num_quests)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ script_pushint(st, sd->quest_log[i].count[1]);
+ return true;
+}
+
+BUILDIN(getq3)
+{
+ int i;
+ getSDReturn(0);
+
+ int quest_id = script_getnum(st, 2);
+ if (quest->check(sd, quest_id, HAVEQUEST) < 0)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
+ if (i == sd->num_quests)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ script_pushint(st, sd->quest_log[i].count[2]);
+ return true;
+}
+
+BUILDIN(getqTime)
+{
+ int i;
+ getSDReturn(0);
+
+ int quest_id = script_getnum(st, 2);
+ if (quest->check(sd, quest_id, HAVEQUEST) < 0)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ ARR_FIND(0, sd->num_quests, i, sd->quest_log[i].quest_id == quest_id);
+ if (i == sd->num_quests)
+ {
+ script_pushint(st, 0);
+ return true;
+ }
+ script_pushint(st, sd->quest_log[i].time);
+ return true;
+}
+
BUILDIN(setNpcDir)
{
int newdir;
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 07c42b6..7291709 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -22,6 +22,9 @@ BUILDIN(requestItemIndex);
BUILDIN(requestItemsIndex);
BUILDIN(requestCraft);
BUILDIN(getq);
+BUILDIN(getq2);
+BUILDIN(getq3);
+BUILDIN(getqTime);
BUILDIN(setq);
BUILDIN(setNpcDir);
BUILDIN(rif);