Browse Source

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://svn.code.sf.net/p/rathena/svn/trunk@12614 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage 17 years ago
parent
commit
b7b80e5c97
6 changed files with 17 additions and 0 deletions
  1. 3 0
      Changelog-Trunk.txt
  2. 2 0
      conf/Changelog.txt
  3. 4 0
      conf/battle/items.conf
  4. 1 0
      src/map/battle.c
  5. 1 0
      src/map/battle.h
  6. 6 0
      src/map/vending.c

+ 3 - 0
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.
 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.
 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
 2008/04/15
 	* Use the same code for script commands getitem & getitem2 as @item to avoid
 	* Use the same code for script commands getitem & getitem2 as @item to avoid
 	  bug in bugreport:1324 (non-stackable items are stacked) [Toms]
 	  bug in bugreport:1324 (non-stackable items are stacked) [Toms]

+ 2 - 0
conf/Changelog.txt

@@ -1,5 +1,7 @@
 Date	Added
 Date	Added
 
 
+2008/04/18
+	* Implemented config setting 'vending_over_max' [ultramage]
 2008/04/02
 2008/04/02
 	* Rev. 12462 Uncommented restricted map entryies for WoESE maps. [L0ne_W0lf]
 	* Rev. 12462 Uncommented restricted map entryies for WoESE maps. [L0ne_W0lf]
 2008/03/07
 2008/03/07

+ 4 - 0
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)
 // The highest value at which an item can be sold via the merchant vend skill. (in zeny)
 vending_max_value: 1000000000
 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%)
 // 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
 // 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).
 // the vender will not get the whole price paid (they get 100% - this tax).

+ 1 - 0
src/map/battle.c

@@ -3503,6 +3503,7 @@ static const struct _battle_data {
 	{ "mob_warp",                           &battle_config.mob_warp,                        0,      0,      1|2|4,          },
 	{ "mob_warp",                           &battle_config.mob_warp,                        0,      0,      1|2|4,          },
 	{ "dead_branch_active",                 &battle_config.dead_branch_active,              1,      0,      1,              },
 	{ "dead_branch_active",                 &battle_config.dead_branch_active,              1,      0,      1,              },
 	{ "vending_max_value",                  &battle_config.vending_max_value,               10000000, 1,    MAX_ZENY,       },
 	{ "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,              },
 	{ "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,              },
 	{ "party_hp_mode",                      &battle_config.party_hp_mode,                   0,      0,      1,              },
 	{ "show_party_share_picker",            &battle_config.party_show_share_picker,         0,      0,      1,              },
 	{ "show_party_share_picker",            &battle_config.party_show_share_picker,         0,      0,      1,              },

+ 1 - 0
src/map/battle.h

@@ -268,6 +268,7 @@ extern struct Battle_Config
 	int mob_warp;
 	int mob_warp;
 	int dead_branch_active;
 	int dead_branch_active;
 	int vending_max_value;
 	int vending_max_value;
+	int vending_over_max;
 	int vending_tax;
 	int vending_tax;
 	int show_steal_in_same_party;
 	int show_steal_in_same_party;
 	int party_share_type;
 	int party_share_type;

+ 6 - 0
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
 			clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
 			return;
 			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;
 		w += itemdb_weight(vsd->status.cart[idx].nameid) * amount;
 		if( w + sd->weight > sd->max_weight )
 		if( w + sd->weight > sd->max_weight )
 		{
 		{