From b3bed3c6c764cae9706be429ea0222cad38e2e43 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 28 Nov 2014 12:55:55 +0300 Subject: add map mask and script functions for manipulate with it. New script functions: setmapmask - set new map mask. addmapmask - add new map mask to current mask. removemapmask - remove new mask from current mask. getmapmask - return current map mask. --- src/map/script.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index ca6907c..93ca052 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -20,6 +20,8 @@ #include "map/script.h" #include "map/clif.h" #include "map/lang.h" +#include "map/mapd.h" +#include "map/mapdext.h" #include "map/scriptdefines.h" #include "map/send.h" #include "map/session.h" @@ -431,3 +433,66 @@ BUILDIN(miscEffect) clif->specialeffect(bl, type, AREA); return true; } + +BUILDIN(setMapMask) +{ + const char *const mapName = script_getstr(st, 2); + if (!mapName) + return true; + const int m = map->mapname2mapid(mapName); + if (m < 0) + return false; + getMapData(m); + + const int val = script_getnum(st, 3); + mapData->mask = val; + return true; +} + +BUILDIN(getMapMask) +{ + const char *const mapName = script_getstr(st, 2); + if (!mapName) + { + script_pushint(st, 0); + return true; + } + const int m = map->mapname2mapid(mapName); + if (m < 0) + { + script_pushint(st, 0); + return false; + } + getMapDataReturn(m, 0); + script_pushint(st, mapData->mask); + return true; +} + +BUILDIN(addMapMask) +{ + const char *const mapName = script_getstr(st, 2); + if (!mapName) + return true; + const int m = map->mapname2mapid(mapName); + if (m < 0) + return false; + getMapData(m); + const int val = script_getnum(st, 3); + mapData->mask |= val; + return true; +} + +BUILDIN(removeMapMask) +{ + const char *const mapName = script_getstr(st, 2); + if (!mapName) + return true; + const int m = map->mapname2mapid(mapName); + if (m < 0) + return false; + getMapData(m); + const int val = script_getnum(st, 3); + mapData->mask |= val; + mapData->mask ^= val; + return true; +} -- cgit v1.2.3-60-g2f50