瀏覽代碼

Cleaned up player specific drop rate calculations

Removed the src check for the new bonuses.
Lemongrass3110 8 年之前
父節點
當前提交
e7882351d8
共有 1 個文件被更改,包括 21 次插入18 次删除
  1. 21 18
      src/map/mob.c

+ 21 - 18
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);