diff options
author | mekolat <mekolat@users.noreply.github.com> | 2017-06-03 15:34:53 -0400 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2017-06-03 21:34:53 +0200 |
commit | 19883c583e5e1471c87ae80e67f34882a7e75bc6 (patch) | |
tree | 7d7e1a7a04081ce9725f771402a88a09d859f5e6 /src | |
parent | 9d28c5187812e496b10d6fbaf62c642a69916021 (diff) | |
download | hercules-19883c583e5e1471c87ae80e67f34882a7e75bc6.tar.gz hercules-19883c583e5e1471c87ae80e67f34882a7e75bc6.tar.bz2 hercules-19883c583e5e1471c87ae80e67f34882a7e75bc6.tar.xz hercules-19883c583e5e1471c87ae80e67f34882a7e75bc6.zip |
Unify specialeffect, convert legacy scripts (#1746)
* allow to use specialeffect() on any unit, and to send to any player
* update the documentation for specialeffect()
* remove specialeffect2 from databases
* remove specialeffect2 from npcs
* remove misceffect from npcs
* convert specialeffect calls with strings to use GID
* add missing constants to specialeffect calls
* flag specialeffect2() as deprecated
* flag misceffect() as deprecated
Diffstat (limited to 'src')
-rw-r--r-- | src/map/script.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/map/script.c b/src/map/script.c index 91f1d8cc9..01bd4d9b5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14890,24 +14890,40 @@ BUILDIN(npcskilleffect) { *------------------------------------------*/ BUILDIN(specialeffect) { struct block_list *bl = NULL; - int type = script_getnum(st,2); - enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA; + int type = script_getnum(st, 2); + enum send_target target = AREA; - if (script_hasdata(st,4)) { - struct npc_data *nd = npc->name2id(script_getstr(st,4)); - if (nd != NULL) - bl = &nd->bl; + if (script_hasdata(st, 3)) { + target = script_getnum(st, 3); + } + + if (script_hasdata(st, 4)) { + if (script_isstringtype(st, 4)) { + struct npc_data *nd = npc->name2id(script_getstr(st, 4)); + if (nd != NULL) { + bl = &nd->bl; + } + } else { + bl = map->id2bl(script_getnum(st, 4)); + } } else { bl = map->id2bl(st->oid); } - if (bl == NULL) + if (bl == NULL) { return true; + } if (target == SELF) { - struct map_session_data *sd = script->rid2sd(st); - if (sd != NULL) + struct map_session_data *sd; + if (script_hasdata(st, 5)) { + sd = map->id2sd(script_getnum(st, 5)); + } else { + sd = script->rid2sd(st); + } + if (sd != NULL) { clif->specialeffect_single(bl, type, sd->fd); + } } else { clif->specialeffect(bl, type, target); } @@ -23564,7 +23580,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getskilllist,""), BUILDIN_DEF(clearitem,""), BUILDIN_DEF(classchange,"ii?"), - BUILDIN_DEF(misceffect,"i"), + BUILDIN_DEF_DEPRECATED(misceffect,"i"), BUILDIN_DEF(playbgm,"s"), BUILDIN_DEF(playbgmall,"s?????"), BUILDIN_DEF(soundeffect,"si"), @@ -23579,8 +23595,8 @@ void script_parse_builtin(void) { BUILDIN_DEF(petskillsupport,"viiii"), // [Skotlex] BUILDIN_DEF(skilleffect,"vi"), // skill effect [Celest] BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris] - BUILDIN_DEF(specialeffect,"i??"), // npc skill effect [Valaris] - BUILDIN_DEF(specialeffect2,"i??"), // skill effect on players[Valaris] + BUILDIN_DEF(specialeffect,"i???"), // npc skill effect [Valaris] + BUILDIN_DEF_DEPRECATED(specialeffect2,"i??"), // skill effect on players[Valaris] BUILDIN_DEF(nude,""), // nude command [Valaris] BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT BUILDIN_DEF(atcommand,"s"), // [MouseJstr] |