From 28d7577356c78a625e2d2016068053325f5337e4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Nov 2014 17:17:36 +0300 Subject: Impliment script command getnpcdir. --- src/map/script.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index a2f0f8a..ba75561 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -295,3 +295,31 @@ BUILDIN(getq) script_pushint(st, sd->quest_log[i].count[0]); return true; } + +BUILDIN(getNpcDir) +{ + 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 true; + } + + if (!nd) + nd = (struct npc_data *) map->id2bl (st->oid); + + if (!nd) + { + script_pushint(st, -1); + return true; + } + + script_pushint(st, (int)nd->dir); + + return true; +} -- cgit v1.2.3-60-g2f50