summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-04-18 22:05:08 +0300
committerAndrei Karas <akaras@inbox.ru>2018-04-23 07:33:45 +0300
commit31400d054ec5744e43deb4a6928f496d92f01c34 (patch)
treecb95b0f9122c3af297da883067949dd1ee454b40 /src/map
parent4cce05e9d2f1731aba08d10a9ef5a7b887a9f6af (diff)
downloadhercules-31400d054ec5744e43deb4a6928f496d92f01c34.tar.gz
hercules-31400d054ec5744e43deb4a6928f496d92f01c34.tar.bz2
hercules-31400d054ec5744e43deb4a6928f496d92f01c34.tar.xz
hercules-31400d054ec5744e43deb4a6928f496d92f01c34.zip
Move job related code from pc_resetskill into separate function.
Diffstat (limited to 'src/map')
-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);