Skip to content

Commit

Permalink
Added item bonus2 bDropAddRace.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKeiKun committed Apr 27, 2021
1 parent f2b7460 commit 935f4c2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions db/constants.conf
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ constants_db: {
bMagicSubDefEle: 2064
bStateNoRecoverRace: 2065
bSubSkill: 2066
bDropAddRace: 2067

comment__: "Equip index"
/* reference to script.c::script_defaults():equip[] array used for easy-conversion */
Expand Down
1 change: 1 addition & 0 deletions doc/item_bonus.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ bonus bAddMonsterDropChainItem,`ic`; | Able to get Item of chain `ic` when
bonus2 bAddMonsterDropChainItem,`ic`,`r`; | Able to get item of chain `ic` when you kill a monster of race `r`
bonus2 bGetZenyNum,`x`,`n`; | When killing a monster, there is a `n`% chance of gaining 1~x zeny (only the highest among all is applied).
bonus2 bAddGetZenyNum,`x`,`n`; | When killing a monster, there is a `n`% chance of gaining 1~x zeny (Stackable) <br/> x: <br/> < 0: Max Zeny gain is `(-x*monster_level)`
bonus2 bDropAddRace,`r`,`n`; | Increase item drop rate by `n`/100% when you kill a monster of race `r`

Misc effects | Description
:------------------------------------- | :-------------------------
Expand Down
1 change: 1 addition & 0 deletions src/map/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ enum status_point_types { //we better clean up this enum and change it name [Hem
SP_MAGIC_SUB_DEF_ELE = 2064,
SP_STATE_NO_RECOVER_RACE = 2065,
SP_SUB_SKILL = 2066,
SP_ADD_DROP_RACE = 2067,

#ifndef SP_LAST_KNOWN
SP_LAST_KNOWN
Expand Down
18 changes: 14 additions & 4 deletions src/map/mob.c
Original file line number Diff line number Diff line change
Expand Up @@ -2710,10 +2710,20 @@ static int mob_dead(struct mob_data *md, struct block_list *src, int type)
drop_rate = (int)(drop_rate*1.25); // pk_mode increase drops if 20 level difference [Valaris]

// Increase drop rate if user has SC_CASH_RECEIVEITEM
if (sd && sd->sc.data[SC_CASH_RECEIVEITEM]) // 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_CASH_RECEIVEITEM]->val1) / 100.), 0, 9000));
if (sd && sd->sc.data[SC_OVERLAPEXPUP])
drop_rate = max(drop_rate, cap_value((int)(0.5 + drop_rate * (sd->sc.data[SC_OVERLAPEXPUP]->val2) / 100.), 0, 9000));
if (sd) {
temp = 0;

if (src)
temp += sd->dropaddrace[md->status.race] + (is_boss(src) ? sd->dropaddrace[RC_BOSS] : sd->dropaddrace[RC_NONBOSS]);

if (sd->sc.data[SC_CASH_RECEIVEITEM]) // now rig the drop rate to never be over 90% unless it is originally >90%.
temp += sd->sc.data[SC_CASH_RECEIVEITEM]->val1;

if (sd->sc.data[SC_OVERLAPEXPUP])
temp += sd->sc.data[SC_OVERLAPEXPUP]->val2;

drop_rate = max(drop_rate, cap_value((int)(0.5 + drop_rate * temp / 100.), 0, 9000));
}
#ifdef RENEWAL_DROP
if( drop_modifier != 100 ) {
drop_rate = drop_rate * drop_modifier / 100;
Expand Down
13 changes: 13 additions & 0 deletions src/map/pc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3854,6 +3854,19 @@ static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val)
sd->subskill[i].val = val;
}
break;
case SP_ADD_DROP_RACE:
{
uint32 race_mask = map->race_id2mask(type2);
if (race_mask == RCMASK_NONE) {
ShowWarning("pc_bonus2: SP_ADD_DROP_RACE: Invalid Race (%d)\n", type2);
break;
}
if (sd->state.lr_flag == 2)
break;
BONUS_FOREACH_RCARRAY_FROMMASK(i, race_mask)
sd->dropaddrace[i] += val;
}
break;
default:
ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val);
Assert_report(0);
Expand Down
1 change: 1 addition & 0 deletions src/map/pc.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st
#ifdef RENEWAL
int race_tolerance[RC_MAX];
#endif
int dropaddrace[RC_MAX];
struct s_autospell autospell[15], autospell2[15], autospell3[15];
struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
struct s_addeffectonskill addeff3[MAX_PC_BONUS];
Expand Down

0 comments on commit 935f4c2

Please sign in to comment.