diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 5416fbec2..84d49e1db 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4778,6 +4778,13 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data, sd->weight += w; clif->updatestatus(sd,SP_WEIGHT); + + // auto-favorite + if (data->flag.auto_favorite > 0) { + sd->status.inventory[i].favorite = 1; + clif->favorite_item(sd, i); + } + //Auto-equip if(data->flag.autoequip) pc->equipitem(sd, i, data->equip); @@ -7136,6 +7143,11 @@ static bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint clif_disp_onlyself(sd, output); } + // Share master EXP to homunculus + if (sd->hd != NULL && battle_config.hom_bonus_exp_from_master > 0) { + homun->gainexp(sd->hd, apply_percentrate((int)base_exp, battle_config.hom_bonus_exp_from_master, 100)); + } + return true; } @@ -7352,34 +7364,33 @@ static int pc_maxparameterincrease(struct map_session_data *sd, int type) */ static bool pc_statusup(struct map_session_data *sd, int type, int increase) { - int max_increase = 0, current = 0, needed_points = 0, final_value = 0; - nullpo_ret(sd); + int realIncrease = increase; // check conditions - if (type < SP_STR || type > SP_LUK || increase <= 0) { - clif->statusupack(sd, type, 0, 0); + if (type < SP_STR || type > SP_LUK || realIncrease <= 0) { + clif->statusupack(sd, type, 0, increase); return false; } // check limits - current = pc->getstat(sd, type); - max_increase = pc->maxparameterincrease(sd, type); - increase = cap_value(increase, 0, max_increase); // cap to the maximum status points available - if (increase <= 0 || current + increase > pc_maxparameter(sd)) { - clif->statusupack(sd, type, 0, 0); + int current = pc->getstat(sd, type); + int max_increase = pc->maxparameterincrease(sd, type); + realIncrease = cap_value(realIncrease, 0, max_increase); // cap to the maximum status points available + if (realIncrease <= 0 || current + realIncrease > pc_maxparameter(sd)) { + clif->statusupack(sd, type, 0, increase); return false; } // check status points - needed_points = pc->need_status_point(sd, type, increase); + int needed_points = pc->need_status_point(sd, type, realIncrease); if (needed_points < 0 || needed_points > sd->status.status_point) { // Sanity check - clif->statusupack(sd, type, 0, 0); + clif->statusupack(sd, type, 0, increase); return false; } // set new values - final_value = pc->setstat(sd, type, current + increase); + int final_value = pc->setstat(sd, type, current + realIncrease); sd->status.status_point -= needed_points; status_calc_pc(sd, SCO_NONE); |