diff options
author | mekolat <mekolat@users.noreply.github.com> | 2015-05-22 13:09:14 -0400 |
---|---|---|
committer | mekolat <mekolat@users.noreply.github.com> | 2015-06-20 06:52:33 -0400 |
commit | 08809eeb1db043ac72ca8a64f74e9f5ed6a54631 (patch) | |
tree | e428ef99dff34cfce275038af64eb367a489dbed /src/map/script-fun.cpp | |
parent | ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c (diff) | |
download | tmwa-08809eeb1db043ac72ca8a64f74e9f5ed6a54631.tar.gz tmwa-08809eeb1db043ac72ca8a64f74e9f5ed6a54631.tar.bz2 tmwa-08809eeb1db043ac72ca8a64f74e9f5ed6a54631.tar.xz tmwa-08809eeb1db043ac72ca8a64f74e9f5ed6a54631.zip |
add map mask support
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r-- | src/map/script-fun.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 2b72fc4..2822550 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -2704,6 +2704,50 @@ void builtin_music(ScriptState *st) clif_change_music(sd, msg); } +static +void builtin_mapmask(ScriptState *st) +{ + dumb_ptr<npc_data> nd; + dumb_ptr<map_session_data> sd; + int map_mask = conv_num(st, &AARG(0)); + + if(st->oid) + nd = map_id_is_npc(st->oid); + if(st->rid) + sd = script_rid2sd(st); + + if(HARG(1) && sd != nullptr) + sd->bl_m->mask = map_mask; + else if(HARG(1) && nd) + nd->bl_m->mask = map_mask; + + if (sd == nullptr) + return; + clif_send_mask(sd, map_mask); +} + +static +void builtin_getmask(ScriptState *st) +{ + dumb_ptr<npc_data> nd; + dumb_ptr<map_session_data> sd; + int map_mask; + + if(st->oid) + nd = map_id_is_npc(st->oid); + if(st->rid) + sd = script_rid2sd(st); + + if(sd != nullptr) + map_mask = sd->bl_m->mask; + else if(nd) + map_mask = nd->bl_m->mask; + else + map_mask = -1; + + push_int<ScriptDataInt>(st->stack, map_mask); +} + /*========================================== * npctalk (sends message to surrounding * area) [Valaris] @@ -3188,6 +3232,8 @@ BuiltinFunction builtin_functions[] = BUILTIN(npctalk, "ss?"_s, '\0'), BUILTIN(title, "s"_s, '\0'), BUILTIN(music, "s"_s, '\0'), + BUILTIN(mapmask, "i?"_s, '\0'), + BUILTIN(getmask, ""_s, 'i'), BUILTIN(getlook, "i"_s, 'i'), BUILTIN(getsavepoint, "i"_s, '.'), BUILTIN(areatimer, "MxyxytE"_s, '\0'), |