summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--conf/Changelog.txt2
-rw-r--r--conf/battle/items.conf4
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/vending.c6
6 files changed, 17 insertions, 0 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 4102b3170..2053413d5 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,9 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2008/04/18
+ * Implemented config setting 'vending_over_max', to let people configure
+ the behavior of vending items over the MAX_ZENY limit [ultramage]
2008/04/15
* Use the same code for script commands getitem & getitem2 as @item to avoid
bug in bugreport:1324 (non-stackable items are stacked) [Toms]
diff --git a/conf/Changelog.txt b/conf/Changelog.txt
index 019000c43..f5b2468d2 100644
--- a/conf/Changelog.txt
+++ b/conf/Changelog.txt
@@ -1,5 +1,7 @@
Date Added
+2008/04/18
+ * Implemented config setting 'vending_over_max' [ultramage]
2008/04/02
* Rev. 12462 Uncommented restricted map entryies for WoESE maps. [L0ne_W0lf]
2008/03/07
diff --git a/conf/battle/items.conf b/conf/battle/items.conf
index 8ef1aac3e..403364231 100644
--- a/conf/battle/items.conf
+++ b/conf/battle/items.conf
@@ -24,6 +24,10 @@
// The highest value at which an item can be sold via the merchant vend skill. (in zeny)
vending_max_value: 1000000000
+// Whether to allow buying from vending chars that are at their max. zeny limit.
+// If set to yes, the rest of the zeny above the char's capacity will disappear.
+vending_over_max: yes
+
// Tax to apply to all vending transactions (eg: 10000 = 100%, 50 = 0.50%)
// When a tax is applied, the item's full price is charged to the buyer, but
// the vender will not get the whole price paid (they get 100% - this tax).
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 )
{