From ac4a461a4054eb814ff3df089d9caa96a4343a3d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Dec 2014 21:09:27 +0300 Subject: Add script command getnpcclass. --- src/map/script.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/map') 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"), -- cgit v1.2.3-70-g09d2