summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-06 21:09:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-16 22:44:14 +0300
commitac4a461a4054eb814ff3df089d9caa96a4343a3d (patch)
treea4da624c7ed58bb4eccbcc926a6492a41c0e3e01 /src
parentb681deae9fdee3a219ddf43b76a553c57733f237 (diff)
downloadhercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.gz
hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.bz2
hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.xz
hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.zip
Add script command getnpcclass.
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 5d9220297..84179a64e 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13388,6 +13388,35 @@ BUILDIN(setnpcdir)
return true;
}
+// return npc class [4144]
+BUILDIN(getnpcclass)
+{
+ struct npc_data *nd = 0;
+
+ if (script_hasdata(st, 2))
+ {
+ nd = npc->name2id (script_getstr(st, 2));
+ }
+ if (!nd && !st->oid)
+ {
+ script_pushint(st, -1);
+ return false;
+ }
+
+ if (!nd)
+ nd = (struct npc_data *) map->id2bl(st->oid);
+
+ if (!nd)
+ {
+ script_pushint(st, -1);
+ return false;
+ }
+
+ script_pushint(st, (int)nd->class_);
+
+ return true;
+}
+
/*==========================================
* getlook char info. getlook(arg)
@@ -19458,6 +19487,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(setnpcdistance,"i"), // [4144]
BUILDIN_DEF(getnpcdir,"?"), // [4144]
BUILDIN_DEF(setnpcdir,"*"), // [4144]
+ BUILDIN_DEF(getnpcclass,"?"), // [4144]
BUILDIN_DEF(getmapxy,"rrri?"), //by Lorky [Lupus]
BUILDIN_DEF(checkoption1,"i"),
BUILDIN_DEF(checkoption2,"i"),