From 1b68303f7458cb3a5a8af8298dea7b55b7bda9b8 Mon Sep 17 00:00:00 2001 From: sader fawall Date: Sun, 17 Dec 2017 17:29:30 +0200 Subject: [PATCH] Update sc_end_class (#2673) * Adjusted script command sc_end_class to accept an optional job ID. Thanks to @sader1992! --- doc/script_commands.txt | 16 ++++++++++++++-- src/map/script.cpp | 19 +++++++++++++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index e76a19cbbb..402597e61f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5350,7 +5350,7 @@ Used in reset NPC's (duh!) *sc_start2 ,,,{,,{,}}; *sc_start4 ,,,,,{,,{,}}; *sc_end {,}; -*sc_end_class {}; +*sc_end_class {{,}}; These commands will bestow a status effect on a character. @@ -5389,7 +5389,7 @@ and theirs val1, val2, val3, and val4 usage in source. perform a complete removal of all statuses (although permanent ones will re-apply). 'sc_end_class' works like 'sc_end' but will remove all status effects from any learned -skill on the invoking character. +skill on the invoking character. If is provided it will end the effect for that job. Examples: // This will poison the invoking character for 10 minutes at 50% chance. @@ -5407,6 +5407,18 @@ Examples: // This will end the Freezing status for the invoking character. sc_end SC_FREEZE; + + // This will end the effect of any learned skill for the invoking character. + sc_end_class; + + // This will end the effect of any learned skill for the character with the 150000. + // val1: + sc_end_class(150000); + + // This will end the effect of any Arch Bishop skill for the invoking character. + // val1: + // val2: of Arch Bishop + sc_end_class(getcharid(0),Job_Arch_Bishop); Note: to use SC_NOCHAT you should alter Manner set Manner, -5; // Will mute a user for 5 minutes diff --git a/src/map/script.cpp b/src/map/script.cpp index 5bc5fc67bc..9cb4c57b8c 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -11325,18 +11325,29 @@ BUILDIN_FUNC(sc_end) /** * Ends all status effects from any learned skill on the attached player. - * sc_end_class {}; + * if was given it will end the effect of that class for the attached player + * sc_end_class {{,}}; */ BUILDIN_FUNC(sc_end_class) { struct map_session_data *sd; uint16 skill_id; - int i; + int class_; if (!script_charid2sd(2, sd)) return SCRIPT_CMD_FAILURE; - for (i = 0; i < MAX_SKILL_TREE && (skill_id = skill_tree[pc_class2idx(sd->status.class_)][i].skill_id) > 0; i++) { // Remove status specific to your current tree skills. + if (script_hasdata(st, 3)) + class_ = script_getnum(st, 3); + else + class_ = sd->status.class_; + + if (!pcdb_checkid(class_)) { + ShowError("buildin_sc_end_class: Invalid job ID '%d' given.\n", script_getnum(st, 3)); + return SCRIPT_CMD_FAILURE; + } + + for (int i = 0; i < MAX_SKILL_TREE && (skill_id = skill_tree[pc_class2idx(class_)][i].skill_id) > 0; i++) { enum sc_type sc = status_skill2sc(skill_id); if (sc > SC_COMMON_MAX && sd->sc.data[sc]) @@ -23882,7 +23893,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF2(sc_start,"sc_start2","iiii???"), BUILDIN_DEF2(sc_start,"sc_start4","iiiiii???"), BUILDIN_DEF(sc_end,"i?"), - BUILDIN_DEF(sc_end_class,"?"), + BUILDIN_DEF(sc_end_class,"??"), BUILDIN_DEF(getstatus, "i??"), BUILDIN_DEF(getscrate,"ii?"), BUILDIN_DEF(debugmes,"s"),