Merge pull request #1437 from rathena/bonus/add_drop_rate
Added script bonuses to add player's drop rate Thanks to @cydh
This commit is contained in:
commit
fa8296e3c2
@ -411,6 +411,9 @@ bonus bBreakArmorRate,n; Adds a n/100% chance to break enemy's armor while att
|
|||||||
|
|
||||||
Monster drops
|
Monster drops
|
||||||
-------------
|
-------------
|
||||||
|
bonus2 bDropAddRace,r,x; Adds x% to player's drop rate when killing a monster with race r.
|
||||||
|
bonus2 bDropAddClass,c,x; Adds x% to player's drop rate when killing a monster with race c.
|
||||||
|
|
||||||
bonus3 bAddMonsterIdDropItem,iid,mid,n; Adds a n/100% chance of dropping item iid when killing monster mid
|
bonus3 bAddMonsterIdDropItem,iid,mid,n; Adds a n/100% chance of dropping item iid when killing monster mid
|
||||||
|
|
||||||
bonus2 bAddMonsterDropItem,iid,n; Adds a n/100% chance for item iid to be dropped when killing a monster
|
bonus2 bAddMonsterDropItem,iid,n; Adds a n/100% chance for item iid to be dropped when killing a monster
|
||||||
|
@ -468,7 +468,7 @@ enum _sp {
|
|||||||
SP_ADD_CLASS_DROP_ITEMGROUP, SP_ADDMAXWEIGHT, SP_ADD_ITEMGROUP_HEAL_RATE, // 2071-2073
|
SP_ADD_CLASS_DROP_ITEMGROUP, SP_ADDMAXWEIGHT, SP_ADD_ITEMGROUP_HEAL_RATE, // 2071-2073
|
||||||
SP_HP_VANISH_RACE_RATE, SP_SP_VANISH_RACE_RATE, SP_ABSORB_DMG_MAXHP, SP_SUB_SKILL, SP_SUBDEF_ELE, // 2074-2078
|
SP_HP_VANISH_RACE_RATE, SP_SP_VANISH_RACE_RATE, SP_ABSORB_DMG_MAXHP, SP_SUB_SKILL, SP_SUBDEF_ELE, // 2074-2078
|
||||||
SP_STATE_NORECOVER_RACE, SP_CRITICAL_RANGEATK, SP_MAGIC_ADDRACE2, SP_IGNORE_MDEF_RACE2_RATE, // 2079-2082
|
SP_STATE_NORECOVER_RACE, SP_CRITICAL_RANGEATK, SP_MAGIC_ADDRACE2, SP_IGNORE_MDEF_RACE2_RATE, // 2079-2082
|
||||||
SP_WEAPON_ATK_RATE, SP_WEAPON_MATK_RATE, // 2083-2084
|
SP_WEAPON_ATK_RATE, SP_WEAPON_MATK_RATE, SP_DROP_ADDRACE, SP_DROP_ADDCLASS, // 2083-2086
|
||||||
};
|
};
|
||||||
|
|
||||||
enum _look {
|
enum _look {
|
||||||
|
@ -2523,18 +2523,36 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
|||||||
if (battle_config.drops_by_luk2)
|
if (battle_config.drops_by_luk2)
|
||||||
drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.);
|
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)
|
// Player specific drop rate adjustments
|
||||||
drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris]
|
if( sd ){
|
||||||
|
int drop_rate_bonus = 0;
|
||||||
|
|
||||||
|
// 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
|
// Increase drop rate if user has SC_ITEMBOOST
|
||||||
if (sd && sd->sc.data[SC_ITEMBOOST]) // now rig the drop rate to never be over 90% unless it is originally >90%.
|
if (&sd->sc && sd->sc.data[SC_ITEMBOOST])
|
||||||
drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(sd->sc.data[SC_ITEMBOOST]->val1)/100.),0,9000));
|
drop_rate_bonus += sd->sc.data[SC_ITEMBOOST]->val1;
|
||||||
|
|
||||||
|
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_bonus, 0, 9000));
|
||||||
|
|
||||||
|
#ifdef VIP_ENABLE
|
||||||
// Increase item drop rate for VIP.
|
// Increase item drop rate for VIP.
|
||||||
if (battle_config.vip_drop_increase && (sd && pc_isvip(sd))) {
|
if (battle_config.vip_drop_increase && pc_isvip(sd)) {
|
||||||
drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100);
|
drop_rate += (int)(0.5 + (drop_rate * battle_config.vip_drop_increase) / 100);
|
||||||
drop_rate = min(drop_rate,10000); //cap it to 100%
|
drop_rate = min(drop_rate,10000); //cap it to 100%
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef RENEWAL_DROP
|
#ifdef RENEWAL_DROP
|
||||||
if( drop_modifier != 100 ) {
|
if( drop_modifier != 100 ) {
|
||||||
drop_rate = apply_rate(drop_rate, drop_modifier);
|
drop_rate = apply_rate(drop_rate, drop_modifier);
|
||||||
|
10
src/map/pc.c
10
src/map/pc.c
@ -3696,6 +3696,16 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
|
|||||||
if (sd->state.lr_flag != 2)
|
if (sd->state.lr_flag != 2)
|
||||||
sd->ignore_mdef_by_race2[type2] += val;
|
sd->ignore_mdef_by_race2[type2] += val;
|
||||||
break;
|
break;
|
||||||
|
case SP_DROP_ADDRACE: // bonus2 bDropAddRace,r,x;
|
||||||
|
PC_BONUS_CHK_RACE(type2, SP_DROP_ADDRACE);
|
||||||
|
if (sd->state.lr_flag != 2)
|
||||||
|
sd->dropaddrace[type2] += val;
|
||||||
|
break;
|
||||||
|
case SP_DROP_ADDCLASS: // bonus2 bDropAddClass,c,x;
|
||||||
|
PC_BONUS_CHK_CLASS(type2, SP_DROP_ADDCLASS);
|
||||||
|
if (sd->state.lr_flag != 2)
|
||||||
|
sd->dropaddclass[type2] += val;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (running_npc_stat_calc_event) {
|
if (running_npc_stat_calc_event) {
|
||||||
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in OnPCStatCalcEvent!\n", type, type2, val);
|
ShowWarning("pc_bonus2: unknown bonus type %d %d %d in OnPCStatCalcEvent!\n", type, type2, val);
|
||||||
|
@ -368,6 +368,8 @@ struct map_session_data {
|
|||||||
short sp_gain_race[RC_MAX];
|
short sp_gain_race[RC_MAX];
|
||||||
int magic_addrace2[RC2_MAX];
|
int magic_addrace2[RC2_MAX];
|
||||||
int ignore_mdef_by_race2[RC2_MAX];
|
int ignore_mdef_by_race2[RC2_MAX];
|
||||||
|
int dropaddrace[RC_MAX];
|
||||||
|
int dropaddclass[CLASS_MAX];
|
||||||
// zeroed arrays end here.
|
// zeroed arrays end here.
|
||||||
|
|
||||||
// zeroed structures start here
|
// zeroed structures start here
|
||||||
|
@ -660,6 +660,8 @@
|
|||||||
script_set_constant("bCriticalLong",SP_CRITICAL_RANGEATK,false);
|
script_set_constant("bCriticalLong",SP_CRITICAL_RANGEATK,false);
|
||||||
script_set_constant("bMagicAddRace2", SP_MAGIC_ADDRACE2, false);
|
script_set_constant("bMagicAddRace2", SP_MAGIC_ADDRACE2, false);
|
||||||
script_set_constant("bIgnoreMdefRace2Rate", SP_IGNORE_MDEF_RACE2_RATE, false);
|
script_set_constant("bIgnoreMdefRace2Rate", SP_IGNORE_MDEF_RACE2_RATE, false);
|
||||||
|
script_set_constant("bDropAddRace", SP_DROP_ADDRACE, false);
|
||||||
|
script_set_constant("bDropAddClass", SP_DROP_ADDCLASS, false);
|
||||||
|
|
||||||
/* equip positions */
|
/* equip positions */
|
||||||
export_constant(EQI_HEAD_TOP);
|
export_constant(EQI_HEAD_TOP);
|
||||||
|
@ -3123,6 +3123,8 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
|
|||||||
+ sizeof(sd->ignore_mdef_by_class)
|
+ sizeof(sd->ignore_mdef_by_class)
|
||||||
+ sizeof(sd->ignore_def_by_race)
|
+ sizeof(sd->ignore_def_by_race)
|
||||||
+ sizeof(sd->sp_gain_race)
|
+ sizeof(sd->sp_gain_race)
|
||||||
|
+ sizeof(sd->dropaddrace)
|
||||||
|
+ sizeof(sd->dropaddclass)
|
||||||
);
|
);
|
||||||
|
|
||||||
memset (&sd->right_weapon.overrefine, 0, sizeof(sd->right_weapon) - sizeof(sd->right_weapon.atkmods));
|
memset (&sd->right_weapon.overrefine, 0, sizeof(sd->right_weapon) - sizeof(sd->right_weapon.atkmods));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user