summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-12-02 20:42:22 +0100
committerHaru <haru@dotalux.com>2016-12-03 15:38:57 +0100
commit8a9e589446058b33972aff2c054f8c300b3fd1b7 (patch)
tree8e33ef34efc82403409265f6332c32aae801b6a6 /src
parent0f5fdca8945ec3afd5ba2e67a9d414f1ef5565c3 (diff)
downloadhercules-8a9e589446058b33972aff2c054f8c300b3fd1b7.tar.gz
hercules-8a9e589446058b33972aff2c054f8c300b3fd1b7.tar.bz2
hercules-8a9e589446058b33972aff2c054f8c300b3fd1b7.tar.xz
hercules-8a9e589446058b33972aff2c054f8c300b3fd1b7.zip
Change the argument to pc->famerank() to a rank type (instead of job mapid)
For consistency with `pc->addfame()`, the argument to pc->famerank() is now an enum fame_list_type. The function was renamed to `pc->fame_rank()` to avoid silently compiling old non-compliant code. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c48
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c5
-rw-r--r--src/map/status.c9
4 files changed, 42 insertions, 22 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 531cc555a..894880608 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -430,30 +430,41 @@ void pc_addfame(struct map_session_data *sd, int ranktype, int count)
chrif->updatefamelist(sd);
}
-// Check whether a player ID is in the fame rankers' list of its job, returns his/her position if so, 0 else
-int pc_famerank(int char_id, uint32 job)
+/**
+ * Returns a character's rank in the specified fame list.
+ *
+ * @param char_id The character ID.
+ * @param ranktype The rank list type (@see enum fame_list_type).
+ * @return The rank position (1-based index)
+ * @retval 0 if the character isn't in the specified list.
+ */
+int pc_fame_rank(int char_id, int ranktype)
{
int i;
- switch (job & MAPID_UPPERMASK) {
- case MAPID_BLACKSMITH: // Blacksmith
+ switch (ranktype) {
+ case RANKTYPE_BLACKSMITH:
for (i = 0; i < MAX_FAME_LIST; i++) {
if (pc->smith_fame_list[i].id == char_id)
return i + 1;
}
break;
- case MAPID_ALCHEMIST: // Alchemist
+ case RANKTYPE_ALCHEMIST:
for (i = 0; i < MAX_FAME_LIST; i++) {
if (pc->chemist_fame_list[i].id == char_id)
return i + 1;
}
break;
- case MAPID_TAEKWON: // Taekwon
+ case RANKTYPE_TAEKWON:
for (i = 0; i < MAX_FAME_LIST; i++) {
if (pc->taekwon_fame_list[i].id == char_id)
return i + 1;
}
break;
+ case RANKTYPE_PK: // Not implemented
+ FALLTHROUGH
+ default:
+ Assert_ret(0);
}
return 0;
@@ -1656,8 +1667,10 @@ int pc_calc_skilltree(struct map_session_data *sd)
} while(flag);
//
- if (classidx > 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && pc->famerank(sd->status.char_id, MAPID_TAEKWON)) {
- /* Taekwon Ranger Bonus Skill Tree
+ if (classidx > 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON
+ && sd->status.base_level >= 90 && sd->status.skill_point == 0
+ && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) {
+ /* Taekwon Ranker Bonus Skill Tree
============================================
- Grant All Taekwon Tree, but only as Bonus Skills in case they drop from ranking.
- (c > 0) to avoid grant Novice Skill Tree in case of Skill Reset (need more logic)
@@ -5108,9 +5121,8 @@ int pc_useitem(struct map_session_data *sd,int n) {
}
}
- if(sd->status.inventory[n].card[0]==CARD0_CREATE &&
- pc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST))
- {
+ if (sd->status.inventory[n].card[0] == CARD0_CREATE
+ && pc->fame_rank(MakeDWord(sd->status.inventory[n].card[2], sd->status.inventory[n].card[3]), RANKTYPE_ALCHEMIST) > 0) {
script->potion_flag = 2; // Famous player's potions have 50% more efficiency
if (sd->sc.data[SC_SOULLINK] && sd->sc.data[SC_SOULLINK]->val2 == SL_ROGUE)
script->potion_flag = 3; //Even more effective potions.
@@ -7182,7 +7194,8 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
sd->status.skill_point--;
if( !skill->dbs->db[index].inf )
status_calc_pc(sd,SCO_NONE); // Only recalculate for passive skills.
- else if (sd->status.skill_point == 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ else if (sd->status.skill_point == 0 && (sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON
+ && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0)
pc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
else
pc->check_skilltree(sd, skill_id); // Check if a new skill can Lvlup
@@ -7429,7 +7442,7 @@ int pc_resetskill(struct map_session_data* sd, int flag)
/**
* It has been confirmed on official server that when you reset skills with a ranked tweakwon your skills are not reset (because you have all of them anyway)
**/
- if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON))
return 0;
if( pc->checkskill(sd, SG_DEVIL) && !pc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex]
@@ -8611,7 +8624,12 @@ int pc_jobchange(struct map_session_data *sd, int class, int upper)
}
sd->status.class = class;
- fame_flag = pc->famerank(sd->status.char_id, sd->job);
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_BLACKSMITH)
+ fame_flag = pc->fame_rank(sd->status.char_id, RANKTYPE_BLACKSMITH);
+ else if ((sd->job & MAPID_UPPERMASK) == MAPID_ALCHEMIST)
+ fame_flag = pc->fame_rank(sd->status.char_id, RANKTYPE_ALCHEMIST);
+ else if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON)
+ fame_flag = pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON);
sd->job = (uint16)job;
sd->status.job_level=1;
sd->status.job_exp=0;
@@ -12112,7 +12130,7 @@ void pc_defaults(void) {
pc->addspiritball = pc_addspiritball;
pc->delspiritball = pc_delspiritball;
pc->addfame = pc_addfame;
- pc->famerank = pc_famerank;
+ pc->fame_rank = pc_fame_rank;
pc->set_hate_mob = pc_set_hate_mob;
pc->getmaxspiritball = pc_getmaxspiritball;
diff --git a/src/map/pc.h b/src/map/pc.h
index f73a015ca..5c9bec9f6 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1004,7 +1004,7 @@ END_ZEROED_BLOCK; /* End */
int (*delspiritball) (struct map_session_data *sd,int count,int type);
int (*getmaxspiritball) (struct map_session_data *sd, int min);
void (*addfame) (struct map_session_data *sd, int ranktype, int count);
- int (*famerank) (int char_id, uint32 job);
+ int (*fame_rank) (int char_id, int ranktype);
int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl);
int (*readdb) (void);
diff --git a/src/map/skill.c b/src/map/skill.c
index 41135920f..51a8a28e7 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2430,7 +2430,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr
case TK_STORMKICK:
case TK_DOWNKICK:
case TK_COUNTER:
- if (pc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time.
+ if (pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0) { //Extend combo time.
sce->val1 = skill_id; //Update combo-skill
sce->val3 = skill_id;
if( sce->timer != INVALID_TIMER )
@@ -13758,7 +13758,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
status_change_end(&sd->bl, SC_COMBOATTACK, INVALID_TIMER);
return 0;
}
- if(sc->data[SC_COMBOATTACK]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) )) {
+ if (sc->data[SC_COMBOATTACK]->val1 != skill_id
+ && !(sd != NULL && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0)) {
//Cancel combo wait.
unit->cancel_combo(&sd->bl);
return 0;
diff --git a/src/map/status.c b/src/map/status.c
index fe412dce7..c0ce1ac38 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2276,7 +2276,7 @@ unsigned int status_get_base_maxsp(const struct map_session_data *sd, const stru
val += val * 25 / 100;
else if ((sd->job & JOBL_BABY) != 0)
val = val * 70 / 100;
- if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON) > 0)
val *= 3; //Triple max SP for top ranking Taekwons over level 90.
val += val * st->int_ / 100;
@@ -2303,7 +2303,7 @@ unsigned int status_get_base_maxhp(const struct map_session_data *sd, const stru
else if ((sd->job & JOBL_BABY) != 0)
val = val * 70 / 100; //Baby classes get a 30% hp penalty
- if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON))
+ if ((sd->job & MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->fame_rank(sd->status.char_id, RANKTYPE_TAEKWON))
val *= 3; //Triple max HP for top ranking Taekwons over level 90.
val += val * st->vit / 100; // +1% per each point of VIT
@@ -2510,8 +2510,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
if (sd->status.inventory[index].card[0]==CARD0_FORGE) {
// Forged weapon
wd->star += (sd->status.inventory[index].card[1]>>8);
- if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg
- if(pc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH))
+ if (wd->star >= 15)
+ wd->star = 40; // 3 Star Crumbs now give +40 dmg
+ if (pc->fame_rank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]), RANKTYPE_BLACKSMITH) > 0)
wd->star += 10;
if (!wa->ele) //Do not overwrite element from previous bonuses.