diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 6046c5a0ea..aa172ccdce 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -5303,14 +5303,19 @@ Used in reset NPC's (duh!) --------------------------------------- -*resetskill({}); +*resetskill({},{}); This command takes off all the skill points on the invoking character, so they only have Basic Skill blanked out (lvl 0) left, and returns the points for them to spend again. Nothing else will change but the skills. Quest skills will also reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If the 'quest_skill_learn' option is set in there, the points in the quest skills -will also count towards the total. +will also count towards the total. If is given then the player will +have any active status changes removed for any skills that they know. + +Valid SC reset flags: + 0 - Don't reset SC + 1 - Reset SC Used in reset NPC's (duh!) diff --git a/npc/custom/resetnpc.txt b/npc/custom/resetnpc.txt index aa6bc14b2d..6ecae87815 100644 --- a/npc/custom/resetnpc.txt +++ b/npc/custom/resetnpc.txt @@ -1,11 +1,5 @@ //===== rAthena Script ======================================= //= Reset NPC -//===== By: ================================================== -//= rAthena Dev Team -//===== Current Version: ===================================== -//= 1.4 -//===== Compatible With: ===================================== -//= rAthena Project //===== Description: ========================================= //= Resets skills, stats, or both. //===== Additional Comments: ================================= @@ -15,6 +9,7 @@ //= 1.3 All statuses removed upon skill reset. [Euphy] //= 1.4 Compressed Script, Added limit use option [Stolao] //= Changed set -> setarray, Improved text with F_InsertPlural +//= 1.5 Adjusted resetskill to reset related status changes [sader1992] //============================================================ prontera,150,193,4 script Reset Girl 124,{ // Skills, Stats, Both, Limit @@ -43,10 +38,8 @@ prontera,150,193,4 script Reset Girl 124,{ if(select("Let me think:That's fine") == 1) close; } set Zeny, Zeny-.@Reset[.@i-1]; - if(.@i&1){ - sc_end SC_ALL;// TODO make a sc_end current classes sc only - ResetSkill; - } + if(.@i&1) + ResetSkill 1; if(.@i&2) ResetStatus; mes "There you go!"; if(.@Reset[3]) set reset_limit,reset_limit + 1; diff --git a/src/map/pc.c b/src/map/pc.c index 4161ad485f..fe690547d8 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7288,10 +7288,11 @@ int pc_resetstate(struct map_session_data* sd) * if flag&1, perform block resync and status_calc call. * if flag&2, just count total amount of skill points used by player, do not really reset. * if flag&4, just reset the skills if the player class is a bard/dancer type (for changesex.) + * if flag&8, remove Status Change related to the learned skill *------------------------------------------*/ int pc_resetskill(struct map_session_data* sd, int flag) { - int i, skill_point=0; + int i, skill_id, skill_point=0; nullpo_ret(sd); if( flag&4 && (sd->class_&MAPID_UPPERMASK) != MAPID_BARDDANCER ) @@ -7336,6 +7337,15 @@ int pc_resetskill(struct map_session_data* sd, int flag) status_change_end(&sd->bl, SC_SPRITEMABLE, INVALID_TIMER); } + if (flag&8) { // Status Changes to remove when changing class tree. + 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. + enum sc_type sc = status_skill2sc(skill_id); + + if (sc > SC_COMMON_MAX && sd->sc.data[sc]) + status_change_end(&sd->bl, sc, INVALID_TIMER); + } + } + for( i = 1; i < MAX_SKILL; i++ ) { uint8 lv = sd->status.skill[i].lv; diff --git a/src/map/script.c b/src/map/script.c index 419c7e7e07..87e36d681c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11646,14 +11646,17 @@ BUILDIN_FUNC(resetstatus) /** * Reset player's skill - * resetskill({}); + * resetskill({},{}); **/ BUILDIN_FUNC(resetskill) { TBL_PC *sd; - if (!script_charid2sd(2,sd)) + if (!script_charid2sd(3,sd)) return SCRIPT_CMD_FAILURE; - pc_resetskill(sd,1); + if (script_hasdata(st, 2) && script_getnum(st, 2)) + pc_resetskill(sd, 1|8); + else + pc_resetskill(sd, 1); return SCRIPT_CMD_SUCCESS; }