From e7882351d87187f7e97c82361e9b6ec414a2dfaf Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sat, 23 Jul 2016 18:43:09 +0200 Subject: [PATCH] Cleaned up player specific drop rate calculations Removed the src check for the new bonuses. --- src/map/mob.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/map/mob.c b/src/map/mob.c index c628b3a55b..a8324294e3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2523,33 +2523,36 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (battle_config.drops_by_luk2) drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.); } - if (sd && battle_config.pk_mode && - (int)(md->level - sd->status.base_level) >= 20) - drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris] - if (sd) { - int drop_rate_ = 0; + // Player specific drop rate adjustments + if( sd ){ + int drop_rate_bonus = 0; - if (src) { - drop_rate_ += sd->dropaddclass[md->status.class_] + sd->dropaddclass[CLASS_ALL]; - drop_rate_ += sd->dropaddrace[md->status.race] + sd->dropaddrace[RC_ALL]; - } + // pk_mode increase drops if 20 level difference [Valaris] + if( battle_config.pk_mode && (int)(md->level - sd->status.base_level) >= 20 ) + drop_rate = (int)(drop_rate*1.25); + + // Add class and race specific bonuses + drop_rate_bonus += sd->dropaddclass[md->status.class_] + sd->dropaddclass[CLASS_ALL]; + drop_rate_bonus += sd->dropaddrace[md->status.race] + sd->dropaddrace[RC_ALL]; // Increase drop rate if user has SC_ITEMBOOST if (&sd->sc && sd->sc.data[SC_ITEMBOOST]) - drop_rate_ += sd->sc.data[SC_ITEMBOOST]->val1; + drop_rate_bonus += sd->sc.data[SC_ITEMBOOST]->val1; - drop_rate_ = (int)(0.5 + drop_rate * drop_rate_ / 100.); + drop_rate_bonus = (int)(0.5 + drop_rate * drop_rate_bonus / 100.); // Now rig the drop rate to never be over 90% unless it is originally >90%. - drop_rate = i32max(drop_rate, cap_value(drop_rate_, 0, 9000)); - } + drop_rate = i32max(drop_rate, cap_value(drop_rate_bonus, 0, 9000)); + #ifdef VIP_ENABLE - // Increase item drop rate for VIP. - if (battle_config.vip_drop_increase && (sd && pc_isvip(sd))) { - drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100); - drop_rate = min(drop_rate,10000); //cap it to 100% - } + // Increase item drop rate for VIP. + if (battle_config.vip_drop_increase && pc_isvip(sd)) { + drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100); + drop_rate = min(drop_rate,10000); //cap it to 100% + } #endif + } + #ifdef RENEWAL_DROP if( drop_modifier != 100 ) { drop_rate = apply_rate(drop_rate, drop_modifier);