Added script bonuses in order to support official AddReceiveItem_Equip n
* `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. Signed-off-by: Cydh Ramdh <cydh@pservero.com>
This commit is contained in:
parent
9d730f3ba9
commit
29379c3ea5
@ -411,6 +411,9 @@ bonus bBreakArmorRate,n; Adds a n/100% chance to break enemy's armor while att
|
||||
|
||||
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
|
||||
|
||||
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_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_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 {
|
||||
|
@ -2527,14 +2527,29 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
|
||||
(int)(md->level - sd->status.base_level) >= 20)
|
||||
drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris]
|
||||
|
||||
// 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%.
|
||||
drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*(sd->sc.data[SC_ITEMBOOST]->val1)/100.),0,9000));
|
||||
if (sd) {
|
||||
int drop_rate_ = 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];
|
||||
}
|
||||
|
||||
// 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_ = (int)(0.5 + drop_rate * drop_rate_ / 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));
|
||||
}
|
||||
#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%
|
||||
}
|
||||
#endif
|
||||
#ifdef RENEWAL_DROP
|
||||
if( drop_modifier != 100 ) {
|
||||
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)
|
||||
sd->ignore_mdef_by_race2[type2] += val;
|
||||
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:
|
||||
if (running_npc_stat_calc_event) {
|
||||
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];
|
||||
int magic_addrace2[RC2_MAX];
|
||||
int ignore_mdef_by_race2[RC2_MAX];
|
||||
int dropaddrace[RC_MAX];
|
||||
int dropaddclass[CLASS_MAX];
|
||||
// zeroed arrays end here.
|
||||
|
||||
// zeroed structures start here
|
||||
|
@ -660,6 +660,8 @@
|
||||
script_set_constant("bCriticalLong",SP_CRITICAL_RANGEATK,false);
|
||||
script_set_constant("bMagicAddRace2", SP_MAGIC_ADDRACE2, 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 */
|
||||
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_def_by_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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user