diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-06 21:09:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-16 22:44:14 +0300 |
commit | ac4a461a4054eb814ff3df089d9caa96a4343a3d (patch) | |
tree | a4da624c7ed58bb4eccbcc926a6492a41c0e3e01 /src/map | |
parent | b681deae9fdee3a219ddf43b76a553c57733f237 (diff) | |
download | hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.gz hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.bz2 hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.tar.xz hercules-ac4a461a4054eb814ff3df089d9caa96a4343a3d.zip |
Add script command getnpcclass.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/script.c | 30 |
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"), |