diff options
author | Asheraf <acheraf1998@gmail.com> | 2019-05-26 08:19:59 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-02-09 20:52:57 +0100 |
commit | 89408e2401a3019c8cb1de0dab9f7e754c4dbfb4 (patch) | |
tree | 7f3c791463c85c2fa255832315951837b420b4b4 /src | |
parent | 28ae3af5455447a379320a83a32658e6e2c154b3 (diff) | |
download | hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.gz hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.bz2 hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.tar.xz hercules-89408e2401a3019c8cb1de0dab9f7e754c4dbfb4.zip |
Add new script commands cloakonnpc/cloakoffnpc
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index 1d5919d3b..557550be2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12489,6 +12489,56 @@ static BUILDIN(hideonnpc) npc->enable(str,4); return true; } +/*========================================== + *------------------------------------------*/ +static BUILDIN(cloakonnpc) +{ + struct npc_data *nd = npc->name2id(script_getstr(st, 2)); + if (nd == NULL) { + ShowError("buildin_cloakonnpc: invalid npc name '%s'.\n", script_getstr(st, 2)); + return false; + } + + if (script_hasdata(st, 3)) { + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + if (sd == NULL) + return false; + + uint32 val = nd->option; + nd->option |= OPTION_CLOAK; + clif->changeoption_target(&nd->bl, &sd->bl, SELF); + nd->option = val; + } else { + nd->option |= OPTION_CLOAK; + clif->changeoption(&nd->bl); + } + return true; +} +/*========================================== + *------------------------------------------*/ +static BUILDIN(cloakoffnpc) +{ + struct npc_data *nd = npc->name2id(script_getstr(st, 2)); + if (nd == NULL) { + ShowError("buildin_cloakoffnpc: invalid npc name '%s'.\n", script_getstr(st, 2)); + return false; + } + + if (script_hasdata(st, 3)) { + struct map_session_data *sd = map->id2sd(script_getnum(st, 3)); + if (sd == NULL) + return false; + + uint32 val = nd->option; + nd->option &= ~OPTION_CLOAK; + clif->changeoption_target(&nd->bl, &sd->bl, SELF); + nd->option = val; + } else { + nd->option &= ~OPTION_CLOAK; + clif->changeoption(&nd->bl); + } + return true; +} /* Starts a status effect on the target unit or on the attached player. * @@ -26672,6 +26722,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(disablenpc,"s"), BUILDIN_DEF(hideoffnpc,"s"), BUILDIN_DEF(hideonnpc,"s"), + BUILDIN_DEF(cloakonnpc,"s?"), + BUILDIN_DEF(cloakoffnpc,"s?"), BUILDIN_DEF(sc_start,"iii???"), BUILDIN_DEF2(sc_start,"sc_start2","iiii???"), BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"), |