diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-26 19:24:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-26 19:24:41 +0300 |
commit | 01f62062d6058550b3f38e79d79080390b170d11 (patch) | |
tree | 9e9c2426f852820d4b5427e4d2e29269c3e4b72d /src/emap/script_buildins.c | |
parent | 57c278053e43fbce8d2bdf285b5c381f653e2751 (diff) | |
download | evol-hercules-01f62062d6058550b3f38e79d79080390b170d11.tar.gz evol-hercules-01f62062d6058550b3f38e79d79080390b170d11.tar.bz2 evol-hercules-01f62062d6058550b3f38e79d79080390b170d11.tar.xz evol-hercules-01f62062d6058550b3f38e79d79080390b170d11.zip |
Add/extend functions for manipulate quest variables and time.
See evol script docs.
Diffstat (limited to 'src/emap/script_buildins.c')
-rw-r--r-- | src/emap/script_buildins.c | 72 |
1 files changed, 70 insertions, 2 deletions
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; |