diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-04-18 22:05:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-04-18 22:05:08 +0300 |
commit | 49a6be313f501dc0695193333e3a3e94656dc28a (patch) | |
tree | ba6038a66e209a27ad39d225391ed25cd52a9d24 /src/map/pc.c | |
parent | 05d32950d89bca6e874aacd9a4718b999ac9d057 (diff) | |
download | hercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.gz hercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.bz2 hercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.xz hercules-49a6be313f501dc0695193333e3a3e94656dc28a.zip |
Move job related code from pc_resetskill into separate function.
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 09040e816..f4f2b5044 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7639,7 +7639,6 @@ int pc_resetskill(struct map_session_data* sd, int flag) } for (i = 1; i < MAX_SKILL_DB; i++) { - uint16 skill_id = 0; int lv = sd->status.skill[i].lv; if (lv < 1) continue; @@ -7648,19 +7647,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills. continue; - skill_id = skill->dbs->db[i].nameid; - - // Don't reset trick dead if not a novice/baby - if (skill_id == NV_TRICKDEAD && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { - sd->status.skill[i].lv = 0; - sd->status.skill[i].flag = 0; - continue; - } - - // do not reset basic skill - if (skill_id == NV_BASIC && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) - continue; - if (skill_id == SU_BASIC_SKILL && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) + if (pc->resetskill_job(sd, i)) continue; if( sd->status.skill[i].flag == SKILL_FLAG_PERM_GRANTED ) @@ -7715,6 +7702,30 @@ int pc_resetskill(struct map_session_data* sd, int flag) return skill_point; } +bool pc_resetskill_job(struct map_session_data* sd, int index) +{ + uint16 skill_id; + + nullpo_retr(false, sd); + Assert_retr(false, index >= 0 && index < MAX_SKILL_DB); + + skill_id = skill->dbs->db[index].nameid; + + // Don't reset trick dead if not a novice/baby + if (skill_id == NV_TRICKDEAD && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) { + sd->status.skill[index].lv = 0; + sd->status.skill[index].flag = 0; + return true; + } + + // do not reset basic skill + if (skill_id == NV_BASIC && (sd->job & MAPID_UPPERMASK) != MAPID_NOVICE) + return true; + if (skill_id == SU_BASIC_SKILL && (sd->job & MAPID_BASEMASK) != MAPID_SUMMONER) + return true; + return false; +} + /*========================================== * /resetfeel [Komurka] *------------------------------------------*/ @@ -12334,6 +12345,7 @@ void pc_defaults(void) { pc->resetlvl = pc_resetlvl; pc->resetstate = pc_resetstate; pc->resetskill = pc_resetskill; + pc->resetskill_job = pc_resetskill_job; pc->resetfeel = pc_resetfeel; pc->resethate = pc_resethate; pc->equipitem = pc_equipitem; |