Browse Source

Added a new Vending Tax config
* Follow up to 8e002bc.
* Added vending_tax_min which allows for defining a custom minimum value to apply taxes to.
Thanks to @cydh's suggestion!

aleos89 7 years ago
parent
commit
3ce3bc3fed
4 changed files with 10 additions and 9 deletions
  1. 6 3
      conf/battle/items.conf
  2. 2 1
      src/map/battle.cpp
  3. 1 0
      src/map/battle.hpp
  4. 1 5
      src/map/vending.cpp

+ 6 - 3
conf/battle/items.conf

@@ -19,9 +19,12 @@ 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).
-// Officially there is no tax for anything less than 100 million zeny, but anything greater incurs a 5% tax.
-// -1 will follow official behavior, 0 will disable taxes while anything else will apply a global tax.
-vending_tax: -1
+vending_tax: 500
+
+// Minimum total of purchase until taxes are applied.
+// Officially there is no tax for anything less than 100 million zeny.
+// 0 will apply taxes to all transactions.
+vending_tax_min: 100000000
 
 
 // Show the buyer's name when successfully vended an item
 // Show the buyer's name when successfully vended an item
 buyer_name: yes
 buyer_name: yes

+ 2 - 1
src/map/battle.cpp

@@ -8276,7 +8276,8 @@ static const struct _battle_data {
 	{ "hom_rename",                         &battle_config.hom_rename,                      0,      0,      1,              },
 	{ "hom_rename",                         &battle_config.hom_rename,                      0,      0,      1,              },
 	{ "homunculus_show_growth",             &battle_config.homunculus_show_growth,          0,      0,      1,              },
 	{ "homunculus_show_growth",             &battle_config.homunculus_show_growth,          0,      0,      1,              },
 	{ "homunculus_friendly_rate",           &battle_config.homunculus_friendly_rate,        100,    0,      INT_MAX,        },
 	{ "homunculus_friendly_rate",           &battle_config.homunculus_friendly_rate,        100,    0,      INT_MAX,        },
-	{ "vending_tax",                        &battle_config.vending_tax,                     -1,    -1,      10000,          },
+	{ "vending_tax",                        &battle_config.vending_tax,                     0,      0,      10000,          },
+	{ "vending_tax_min",                    &battle_config.vending_tax_min,                 0,      0,      MAX_ZENY,       },
 	{ "day_duration",                       &battle_config.day_duration,                    0,      0,      INT_MAX,        },
 	{ "day_duration",                       &battle_config.day_duration,                    0,      0,      INT_MAX,        },
 	{ "night_duration",                     &battle_config.night_duration,                  0,      0,      INT_MAX,        },
 	{ "night_duration",                     &battle_config.night_duration,                  0,      0,      INT_MAX,        },
 	{ "mob_remove_delay",                   &battle_config.mob_remove_delay,                60000,  1000,   INT_MAX,        },
 	{ "mob_remove_delay",                   &battle_config.mob_remove_delay,                60000,  1000,   INT_MAX,        },

+ 1 - 0
src/map/battle.hpp

@@ -316,6 +316,7 @@ struct Battle_Config
 	int vending_max_value;
 	int vending_max_value;
 	int vending_over_max;
 	int vending_over_max;
 	int vending_tax;
 	int vending_tax;
+	int vending_tax_min;
 	int show_steal_in_same_party;
 	int show_steal_in_same_party;
 	int party_share_type;
 	int party_share_type;
 	int party_hp_mode;
 	int party_hp_mode;

+ 1 - 5
src/map/vending.cpp

@@ -104,12 +104,8 @@ void vending_vendinglistreq(struct map_session_data* sd, int id)
  */
  */
 static double vending_calc_tax(struct map_session_data *sd, double zeny)
 static double vending_calc_tax(struct map_session_data *sd, double zeny)
 {
 {
-	if (battle_config.vending_tax > 0) // Use custom value
+	if (battle_config.vending_tax && zeny >= battle_config.vending_tax_min)
 		zeny -= zeny * (battle_config.vending_tax / 10000.);
 		zeny -= zeny * (battle_config.vending_tax / 10000.);
-	else if (battle_config.vending_tax == -1) { // Official servers incur a 5% tax on 100+ million
-		if (zeny >= 100000000)
-			zeny -= zeny * (5 / 100.);
-	}
 
 
 	return zeny;
 	return zeny;
 }
 }