Skip to content

Commit e788235

Browse files
Cleaned up player specific drop rate calculations
Removed the src check for the new bonuses.
1 parent 29379c3 commit e788235

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

src/map/mob.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,33 +2523,36 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
25232523
if (battle_config.drops_by_luk2)
25242524
drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.);
25252525
}
2526-
if (sd && battle_config.pk_mode &&
2527-
(int)(md->level - sd->status.base_level) >= 20)
2528-
drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris]
25292526

2530-
if (sd) {
2531-
int drop_rate_ = 0;
2527+
// Player specific drop rate adjustments
2528+
if( sd ){
2529+
int drop_rate_bonus = 0;
25322530

2533-
if (src) {
2534-
drop_rate_ += sd->dropaddclass[md->status.class_] + sd->dropaddclass[CLASS_ALL];
2535-
drop_rate_ += sd->dropaddrace[md->status.race] + sd->dropaddrace[RC_ALL];
2536-
}
2531+
// pk_mode increase drops if 20 level difference [Valaris]
2532+
if( battle_config.pk_mode && (int)(md->level - sd->status.base_level) >= 20 )
2533+
drop_rate = (int)(drop_rate*1.25);
2534+
2535+
// Add class and race specific bonuses
2536+
drop_rate_bonus += sd->dropaddclass[md->status.class_] + sd->dropaddclass[CLASS_ALL];
2537+
drop_rate_bonus += sd->dropaddrace[md->status.race] + sd->dropaddrace[RC_ALL];
25372538

25382539
// Increase drop rate if user has SC_ITEMBOOST
25392540
if (&sd->sc && sd->sc.data[SC_ITEMBOOST])
2540-
drop_rate_ += sd->sc.data[SC_ITEMBOOST]->val1;
2541+
drop_rate_bonus += sd->sc.data[SC_ITEMBOOST]->val1;
25412542

2542-
drop_rate_ = (int)(0.5 + drop_rate * drop_rate_ / 100.);
2543+
drop_rate_bonus = (int)(0.5 + drop_rate * drop_rate_bonus / 100.);
25432544
// Now rig the drop rate to never be over 90% unless it is originally >90%.
2544-
drop_rate = i32max(drop_rate, cap_value(drop_rate_, 0, 9000));
2545-
}
2545+
drop_rate = i32max(drop_rate, cap_value(drop_rate_bonus, 0, 9000));
2546+
25462547
#ifdef VIP_ENABLE
2547-
// Increase item drop rate for VIP.
2548-
if (battle_config.vip_drop_increase && (sd && pc_isvip(sd))) {
2549-
drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100);
2550-
drop_rate = min(drop_rate,10000); //cap it to 100%
2551-
}
2548+
// Increase item drop rate for VIP.
2549+
if (battle_config.vip_drop_increase && pc_isvip(sd)) {
2550+
drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100);
2551+
drop_rate = min(drop_rate,10000); //cap it to 100%
2552+
}
25522553
#endif
2554+
}
2555+
25532556
#ifdef RENEWAL_DROP
25542557
if( drop_modifier != 100 ) {
25552558
drop_rate = apply_rate(drop_rate, drop_modifier);

0 commit comments

Comments
 (0)