summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-23 19:12:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-23 19:12:10 +0300
commitbf50409735647a80a7145def628822d5235ea753 (patch)
tree8c3a7007dacc1b40b5d09e7948597132d72e11c8
parentdb2c1615ba8b2a679b81eec2c93d9d68e2c5edf8 (diff)
downloadevol-hercules-bf50409735647a80a7145def628822d5235ea753.tar.gz
evol-hercules-bf50409735647a80a7145def628822d5235ea753.tar.bz2
evol-hercules-bf50409735647a80a7145def628822d5235ea753.tar.xz
evol-hercules-bf50409735647a80a7145def628822d5235ea753.zip
Impliment rif script command.
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/script.c27
-rw-r--r--src/map/script.h1
3 files changed, 29 insertions, 1 deletions
diff --git a/src/map/init.c b/src/map/init.c
index 901c964..bc64e32 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -74,7 +74,7 @@ HPExport void plugin_init (void)
addScriptCommand("setq", "ii", setq);
addScriptCommand("getnpcdir", "*", getNpcDir);
addScriptCommand("setnpcdir", "*", setNpcDir);
- addScriptCommand("rif", "is*", dummyStr);
+ addScriptCommand("rif", "is*", rif);
addScriptCommand("countitemcolor", "*", dummyInt);
addScriptCommandDeprecated("getclientversion", "", getClientVersion);
// must be replaced to misceffect
diff --git a/src/map/script.c b/src/map/script.c
index cca62c7..2bc9422 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -355,3 +355,30 @@ BUILDIN(setNpcDir)
return true;
}
+
+BUILDIN(rif)
+{
+ char *str = 0;
+ if (script_getnum(st, 2))
+ {
+ str = script_getstr(st, 3);
+ if (str)
+ script_pushstr(st, aStrdup(str));
+ else
+ script_pushconststr(st, (unsigned char *)"");
+ }
+ else if (script_hasdata(st, 4))
+ {
+ str = script_getstr(st, 4);
+ if (str)
+ script_pushstr(st, aStrdup(str));
+ else
+ script_pushconststr(st, (unsigned char *)"");
+ }
+ else
+ {
+ script_pushconststr(st, (unsigned char *)"");
+ }
+
+ return true;
+}
diff --git a/src/map/script.h b/src/map/script.h
index b9b13db..6fbabc0 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -20,5 +20,6 @@ BUILDIN(getq);
BUILDIN(setq);
BUILDIN(getNpcDir);
BUILDIN(setNpcDir);
+BUILDIN(rif);
#endif // EVOL_MAP_SCRIPT