summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-18 08:12:55 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-18 08:12:55 +0000
commit1e5d5e21e151957e7ebbd1fde2942b522a11418e (patch)
tree22f3808ff1b103a38402496dc2841790e29bd1ae /src/map
parent1ab4f1bc8045feef435858fadb27dd2e2ce111b4 (diff)
downloadhercules-1e5d5e21e151957e7ebbd1fde2942b522a11418e.tar.gz
hercules-1e5d5e21e151957e7ebbd1fde2942b522a11418e.tar.bz2
hercules-1e5d5e21e151957e7ebbd1fde2942b522a11418e.tar.xz
hercules-1e5d5e21e151957e7ebbd1fde2942b522a11418e.zip
Implemented config setting 'vending_over_max', to let people configure the behavior of vending items over the MAX_ZENY limit.
Default/official setting is 'yes', which makes players lose zeny that they cannot hold. Adjust as needed. This re-adds the behavior from before r11344 (see topic:180568). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12614 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/vending.c6
3 files changed, 8 insertions, 0 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 7bf119459..19ccf23f5 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3503,6 +3503,7 @@ static const struct _battle_data {
{ "mob_warp", &battle_config.mob_warp, 0, 0, 1|2|4, },
{ "dead_branch_active", &battle_config.dead_branch_active, 1, 0, 1, },
{ "vending_max_value", &battle_config.vending_max_value, 10000000, 1, MAX_ZENY, },
+ { "vending_over_max", &battle_config.vending_over_max, 1, 0, 1, },
{ "show_steal_in_same_party", &battle_config.show_steal_in_same_party, 0, 0, 1, },
{ "party_hp_mode", &battle_config.party_hp_mode, 0, 0, 1, },
{ "show_party_share_picker", &battle_config.party_show_share_picker, 0, 0, 1, },
diff --git a/src/map/battle.h b/src/map/battle.h
index c6c2eb2e9..06fe16723 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -268,6 +268,7 @@ extern struct Battle_Config
int mob_warp;
int dead_branch_active;
int vending_max_value;
+ int vending_over_max;
int vending_tax;
int show_steal_in_same_party;
int party_share_type;
diff --git a/src/map/vending.c b/src/map/vending.c
index 098bfa28f..935971b16 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -105,6 +105,12 @@ void vending_purchasereq(struct map_session_data* sd, int id, const uint8* data,
clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
return;
}
+ if( z + (double)vsd->status.zeny > (double)MAX_ZENY && !battle_config.vending_over_max )
+ {
+ clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow
+ return;
+
+ }
w += itemdb_weight(vsd->status.cart[idx].nameid) * amount;
if( w + sd->weight > sd->max_weight )
{