summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-02-15 19:59:29 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-15 19:59:29 +0300
commitacbc58373605b52514763e6f041ce6a7e1e2dca7 (patch)
treebc5f9f9f82991d7a323cf60f4ed3c79750996b8a /src/emap
parentc40fe9a082500a23bf38d5ad93751cb794a37fed (diff)
downloadevol-hercules-acbc58373605b52514763e6f041ce6a7e1e2dca7.tar.gz
evol-hercules-acbc58373605b52514763e6f041ce6a7e1e2dca7.tar.bz2
evol-hercules-acbc58373605b52514763e6f041ce6a7e1e2dca7.tar.xz
evol-hercules-acbc58373605b52514763e6f041ce6a7e1e2dca7.zip
Add script command for check is id belong to existing instance.
New script command: isinstance id
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c8
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 3806aee..85d9bc5 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -194,6 +194,7 @@ HPExport void plugin_init (void)
addScriptCommand("getitemoptionvaluebyindex", "ii", getItemOptionValueByIndex);
addScriptCommand("getitemoptionparambyindex", "ii", getItemOptionParamByIndex);
addScriptCommand("setitemoptionbyindex", "iii*", setItemOptionByIndex);
+ addScriptCommand("isinstance", "i", isInstance);
do_init_langs();
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index ed6c6c1..520f16f 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -13,6 +13,7 @@
#include "common/timer.h"
#include "map/chat.h"
#include "map/chrif.h"
+#include "map/instance.h"
#include "map/npc.h"
#include "map/pc.h"
#include "map/script.h"
@@ -2246,3 +2247,10 @@ BUILDIN(setItemOptionByIndex)
return true;
}
+
+BUILDIN(isInstance)
+{
+ const int instance_id = script_getnum(st, 2);
+ script_pushint(st, instance->valid(instance_id) ? 1 : 0);
+ return true;
+}
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index 91b02b3..176feb0 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -93,5 +93,6 @@ BUILDIN(getItemOptionIdByIndex);
BUILDIN(getItemOptionValueByIndex);
BUILDIN(getItemOptionParamByIndex);
BUILDIN(setItemOptionByIndex);
+BUILDIN(isInstance);
#endif // EVOL_MAP_SCRIPT_BUILDINS