summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-10-21 20:37:28 +0200
committerGitHub <noreply@github.com>2018-10-21 20:37:28 +0200
commitbfea70b8f5b7e9fe266f08a4944f5b637da90ad2 (patch)
tree8aa1279ecabfe2ce0229ee01837e2a08030dd2af /src/map
parentbaeb7a1742b0fd7ac5d3a4cecd90f74d461895fe (diff)
parentd2c21b1e412a7a2f3c965a3335ea78a992e7b873 (diff)
downloadhercules-bfea70b8f5b7e9fe266f08a4944f5b637da90ad2.tar.gz
hercules-bfea70b8f5b7e9fe266f08a4944f5b637da90ad2.tar.bz2
hercules-bfea70b8f5b7e9fe266f08a4944f5b637da90ad2.tar.xz
hercules-bfea70b8f5b7e9fe266f08a4944f5b637da90ad2.zip
Merge pull request #2208 from dastgirp/issue/2177
Changes the item price to 1 if it is 0
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h3
-rw-r--r--src/map/pc.c14
3 files changed, 11 insertions, 8 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index fceb30be1..9d4c416b0 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7371,6 +7371,8 @@ static const struct battle_data {
{ "storage_use_item", &battle_config.storage_use_item, 0, 0, 1, },
{ "features/enable_attendance_system", &battle_config.feature_enable_attendance_system,1, 0, 1, },
{ "features/feature_attendance_endtime",&battle_config.feature_attendance_endtime, 1, 0, 99999999, },
+ { "min_item_buy_price", &battle_config.min_item_buy_price, 1, 0, INT_MAX, },
+ { "min_item_sell_price", &battle_config.min_item_sell_price, 0, 0, INT_MAX, },
};
static bool battle_set_value_sub(int index, int value)
diff --git a/src/map/battle.h b/src/map/battle.h
index 9f5207e95..4472c0c52 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -570,6 +570,9 @@ struct Battle_Config {
int feature_enable_attendance_system;
int feature_attendance_endtime;
+
+ int min_item_buy_price;
+ int min_item_sell_price;
};
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/pc.c b/src/map/pc.c
index 56f42690d..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;
}