summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-04-18 22:05:08 +0300
committerAndrei Karas <akaras@inbox.ru>2018-04-18 22:05:08 +0300
commit49a6be313f501dc0695193333e3a3e94656dc28a (patch)
treeba6038a66e209a27ad39d225391ed25cd52a9d24
parent05d32950d89bca6e874aacd9a4718b999ac9d057 (diff)
downloadhercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.gz
hercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.bz2
hercules-49a6be313f501dc0695193333e3a3e94656dc28a.tar.xz
hercules-49a6be313f501dc0695193333e3a3e94656dc28a.zip
Move job related code from pc_resetskill into separate function.
-rw-r--r--src/map/pc.c40
-rw-r--r--src/map/pc.h1
2 files changed, 27 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;
diff --git a/src/map/pc.h b/src/map/pc.h
index dca640614..77bc795d6 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -971,6 +971,7 @@ END_ZEROED_BLOCK; /* End */
int (*resetlvl) (struct map_session_data *sd,int type);
int (*resetstate) (struct map_session_data *sd);
int (*resetskill) (struct map_session_data *sd, int flag);
+ bool (*resetskill_job) (struct map_session_data *sd, int index);
int (*resetfeel) (struct map_session_data *sd);
int (*resethate) (struct map_session_data *sd);
int (*equipitem) (struct map_session_data *sd,int n,int req_pos);