summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-04-05 19:12:18 +0000
committerAndrei Karas <akaras@inbox.ru>2019-04-05 19:12:18 +0000
commit5ad15527869c9ca9d374d9463a74093b536e96bc (patch)
treeaf9ad782b1fd1fc970525120eb6169e21a8e14ec
parentd9711288beba1ed7320f30252f1a1a2035da4023 (diff)
parentf170e1cbb556b491a7ba7a74a26d19ab174752f0 (diff)
downloadevol-hercules-5ad15527869c9ca9d374d9463a74093b536e96bc.tar.gz
evol-hercules-5ad15527869c9ca9d374d9463a74093b536e96bc.tar.bz2
evol-hercules-5ad15527869c9ca9d374d9463a74093b536e96bc.tar.xz
evol-hercules-5ad15527869c9ca9d374d9463a74093b536e96bc.zip
Merge branch 'jesusalva/sendmapmask' into 'master's20190408
Implement sendMapMask() which sends a custom map mask only to a specified user. See merge request evol/evol-hercules!12
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script_buildins.c26
-rw-r--r--src/emap/script_buildins.h1
3 files changed, 28 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c
index 31656ef..d8a6d12 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -153,6 +153,7 @@ HPExport void plugin_init (void)
addScriptCommand("npcwalkto", "ii", npcWalkTo);
addScriptCommand("rif", "is*", rif);
addScriptCommand("setmapmask", "si", setMapMask);
+ addScriptCommand("sendmapmask", "i*", sendMapMask);
addScriptCommand("addmapmask", "si", addMapMask);
addScriptCommand("removemapmask", "si", removeMapMask);
addScriptCommand("getmapmask", "s", getMapMask);
diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c
index e1c9123..93e9388 100644
--- a/src/emap/script_buildins.c
+++ b/src/emap/script_buildins.c
@@ -730,6 +730,32 @@ BUILDIN(setMapMask)
return true;
}
+// sendMapMask(mask{, "player name"})
+BUILDIN(sendMapMask)
+{
+ const int val = script_getnum(st, 2);
+
+ struct map_session_data *sd = NULL;
+ if (script_hasdata(st, 3) && script_isstringtype(st, 3))
+ {
+ sd = script->nick2sd(st, script_getstr(st, 3));
+ }
+ else
+ {
+ sd = script->rid2sd(st);
+ }
+
+ if (sd == NULL)
+ {
+ ShowWarning("player not attached\n");
+ script->reportsrc(st);
+ return false;
+ }
+
+ send_mapmask(sd->fd, val);
+ return true;
+}
+
BUILDIN(getMapMask)
{
const char *const mapName = script_getstr(st, 2);
diff --git a/src/emap/script_buildins.h b/src/emap/script_buildins.h
index a72a035..fab271e 100644
--- a/src/emap/script_buildins.h
+++ b/src/emap/script_buildins.h
@@ -29,6 +29,7 @@ BUILDIN(setq);
BUILDIN(setNpcDir);
BUILDIN(rif);
BUILDIN(setMapMask);
+BUILDIN(sendMapMask);
BUILDIN(getMapMask);
BUILDIN(addMapMask);
BUILDIN(removeMapMask);