summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-28 16:03:23 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-28 16:03:23 +0300
commiteb2a8c8519ad566e2b2dfae18d11acc8478a85fc (patch)
tree29c8c07e6f8c41957c88ff7a62db286f93b9593c /src/map/script.c
parent905642f167858017e1fa1582f6253da3c9a8ff97 (diff)
downloadplugin-eb2a8c8519ad566e2b2dfae18d11acc8478a85fc.tar.gz
plugin-eb2a8c8519ad566e2b2dfae18d11acc8478a85fc.tar.bz2
plugin-eb2a8c8519ad566e2b2dfae18d11acc8478a85fc.tar.xz
plugin-eb2a8c8519ad566e2b2dfae18d11acc8478a85fc.zip
Add script command "getnpcclass".
Format: getnpcclass ([NAME])
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 676d598..8b8cbfe 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -506,3 +506,31 @@ BUILDIN(removeMapMask)
send_mapmask_brodcast(m, mapData->mask);
return true;
}
+
+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;
+}