diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/map/script.c b/src/map/script.c index 5d2f35047..a1886d043 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -13895,15 +13895,26 @@ BUILDIN(undisguise) * Transform a bl to another class, * @type unused *------------------------------------------*/ -BUILDIN(classchange) { - int class, type; - struct block_list *bl=map->id2bl(st->oid); +BUILDIN(classchange) +{ + int class, type, target; + struct block_list *bl = map->id2bl(st->oid); - if(bl==NULL) return true; + if (bl == NULL) + return true; - class = script_getnum(st,2); - type=script_getnum(st,3); - clif->class_change(bl, class, type); + class = script_getnum(st, 2); + type = script_getnum(st, 3); + target = script_hasdata(st, 4) ? script_getnum(st, 4) : 0; + + if (target > 0) { + struct map_session_data *sd = script->charid2sd(st, target); + if (sd != NULL) { + clif->class_change(bl, class, type, sd); + } + } else { + clif->class_change(bl, class, type, NULL); + } return true; } @@ -21146,7 +21157,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getcartinventorylist,""), BUILDIN_DEF(getskilllist,""), BUILDIN_DEF(clearitem,""), - BUILDIN_DEF(classchange,"ii"), + BUILDIN_DEF(classchange,"ii?"), BUILDIN_DEF(misceffect,"i"), BUILDIN_DEF(playbgm,"s"), BUILDIN_DEF(playbgmall,"s?????"), |