Updated script command resetskill options

* Added a new option to remove status changes from any learned skills.
* Adjusted the custom Reset NPC to make use of this behavior.
Thanks to @sader1992!
This commit is contained in:
aleos89
2017-08-24 10:56:41 -04:00
parent c9ce29c00e
commit f93680b9be
4 changed files with 27 additions and 16 deletions

View File

@@ -5303,14 +5303,19 @@ Used in reset NPC's (duh!)
---------------------------------------
*resetskill({<char_id>});
*resetskill({<SC reset>},{<char_id>});
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 <SC reset> 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!)

View File

@@ -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;

View File

@@ -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;

View File

@@ -11646,14 +11646,17 @@ BUILDIN_FUNC(resetstatus)
/**
* Reset player's skill
* resetskill({<char_id>});
* resetskill({<SC reset>},{<char_id>});
**/
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;
}