summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 961dda9f5..b8a6912ee 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4402,8 +4402,6 @@ static int pc_insert_card(struct map_session_data *sd, int idx_card, int idx_equ
static int pc_modifybuyvalue(struct map_session_data *sd, int orig_value)
{
int skill_lv, rate1 = 0, rate2 = 0;
- if (orig_value <= 0)
- return 0;
if ((skill_lv=pc->checkskill(sd,MC_DISCOUNT)) > 0) // merchant discount
rate1 = 5+skill_lv*2-((skill_lv==10)? 1:0);
if ((skill_lv=pc->checkskill(sd,RG_COMPULSION)) > 0) // rogue discount
@@ -4412,8 +4410,9 @@ static int pc_modifybuyvalue(struct map_session_data *sd, int orig_value)
rate1 = rate2;
if (rate1 != 0)
orig_value = apply_percentrate(orig_value, 100-rate1, 100);
- if (orig_value < 1)
- orig_value = 1;
+
+ if (orig_value < battle_config.min_item_buy_price)
+ orig_value = battle_config.min_item_buy_price;
return orig_value;
}
@@ -4423,14 +4422,13 @@ static int pc_modifybuyvalue(struct map_session_data *sd, int orig_value)
static int pc_modifysellvalue(struct map_session_data *sd, int orig_value)
{
int skill_lv, rate = 0;
- if (orig_value <= 0)
- return 0;
if ((skill_lv=pc->checkskill(sd,MC_OVERCHARGE)) > 0) //OverCharge
rate = 5+skill_lv*2-((skill_lv==10)? 1:0);
if (rate != 0)
orig_value = apply_percentrate(orig_value, 100+rate, 100);
- if (orig_value < 1)
- orig_value = 1;
+
+ if (orig_value < battle_config.min_item_sell_price)
+ orig_value = battle_config.min_item_sell_price;
return orig_value;
}
@@ -4506,14 +4504,15 @@ static int pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ
sd->status.zeny -= zeny;
clif->updatestatus(sd,SP_ZENY);
- achievement->validate_zeny(sd, -zeny); // Achievements [Smokexyz/Hercules]
+ if (zeny > 0) {
+ achievement->validate_zeny(sd, -zeny); // Achievements [Smokexyz/Hercules]
+ logs->zeny(sd, type, tsd ? tsd : sd, -zeny);
- if(!tsd) tsd = sd;
- logs->zeny(sd, type, tsd, -zeny);
- if( zeny > 0 && sd->state.showzeny ) {
- char output[255];
- sprintf(output, "Removed %dz.", zeny);
- clif_disp_onlyself(sd, output);
+ if (sd->state.showzeny) {
+ char output[255];
+ sprintf(output, "Removed %dz.", zeny);
+ clif_disp_onlyself(sd, output);
+ }
}
return 0;
@@ -4644,14 +4643,15 @@ static int pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ
sd->status.zeny += zeny;
clif->updatestatus(sd,SP_ZENY);
- achievement->validate_zeny(sd, zeny); // Achievements [Smokexyz/Hercules]
+ if (zeny > 0) {
+ achievement->validate_zeny(sd, zeny); // Achievements [Smokexyz/Hercules]
+ logs->zeny(sd, type, tsd ? tsd : sd, zeny);
- if(!tsd) tsd = sd;
- logs->zeny(sd, type, tsd, zeny);
- if( zeny > 0 && sd->state.showzeny ) {
- char output[255];
- sprintf(output, "Gained %dz.", zeny);
- clif_disp_onlyself(sd, output);
+ if (sd->state.showzeny) {
+ char output[255];
+ sprintf(output, "Gained %dz.", zeny);
+ clif_disp_onlyself(sd, output);
+ }
}
return 0;
@@ -4689,7 +4689,7 @@ static int pc_search_inventory(struct map_session_data *sd, int item_id)
* 6 = ?
* 7 = stack limitation
*------------------------------------------*/
-static int pc_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type)
+static int pc_additem(struct map_session_data *sd, const struct item *item_data, int amount, e_log_pick_type log_type)
{
struct item_data *data;
int i;