From 82a8e2804bbcd75db6053d5e36236ba33833ec60 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 29 Sep 2015 13:51:19 +0300 Subject: Add script command checknpccell. It works same like checkcell, but for current npc. --- src/emap/script.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/emap/script.c') diff --git a/src/emap/script.c b/src/emap/script.c index 33f5d60..d2069eb 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -1723,3 +1723,31 @@ BUILDIN(chatJoin) chat->join(sd, chatId, password); return true; } + +/// Retrieves the value of the specified flag of the specified cell. +/// +/// checknpccell("",,,) -> +/// +/// @see cell_chk* constants in const.txt for the types +BUILDIN(checkNpcCell) +{ + int16 m = map->mapname2mapid(script_getstr(st, 2)); + int16 x = script_getnum(st, 3); + int16 y = script_getnum(st, 4); + cell_chk type = (cell_chk)script_getnum(st, 5); + + if (m == -1) + { + ShowWarning("checknpccell: Attempted to run on unexsitent map '%s', type %d, x/y %d,%d\n", script_getstr(st, 2), type, x, y); + return true; + } + + TBL_NPC *nd = map->id2nd(st->oid); + struct block_list *bl = NULL; + if (nd) + bl = &nd->bl; + + script_pushint(st, map->getcell(m, bl, x, y, type)); + + return true; +} -- cgit v1.2.3-70-g09d2