Browse Source

Added a config for banking state check (#7646)

Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Jittapan Pluemsumran 2 năm trước cách đây
mục cha
commit
b4f740ce18
4 tập tin đã thay đổi với 9 bổ sung2 xóa
  1. 5 0
      conf/battle/feature.conf
  2. 1 0
      src/map/battle.cpp
  3. 1 0
      src/map/battle.hpp
  4. 2 2
      src/map/pc.cpp

+ 5 - 0
conf/battle/feature.conf

@@ -33,6 +33,11 @@ feature.warp_suggestions: off
 // Requires: 2013-07-24aRagexe or later
 feature.banking: on
 
+// Should Banking strictly checks the UI state on zeny deposit and withdrawal? (Note 1)
+// Note: Disabled by default because existing official clients do not report the banking UI state to the server.
+// But this config could be useful in case of clients that actually report the UI state or custom clients.
+feature.banking_state_enforce: no
+
 // Autotrade persistency (Note 1)
 // Should vendors that used @autotrade be restored after a restart?
 feature.autotrade: on

+ 1 - 0
src/map/battle.cpp

@@ -10457,6 +10457,7 @@ static const struct _battle_data {
 	{ "mob_respawn_time",                   &battle_config.mob_respawn_time,                1000,   1000,   INT_MAX,        },
 
 	{ "feature.stylist",                    &battle_config.feature_stylist,                 1,      0,      1,              },
+	{ "feature.banking_state_enforce",      &battle_config.feature_banking_state_enforce,   0,      0,      1,              },
 
 #include <custom/battle_config_init.inc>
 };

+ 1 - 0
src/map/battle.hpp

@@ -729,6 +729,7 @@ struct Battle_Config
 	int mob_respawn_time;
 
 	int feature_stylist;
+	int feature_banking_state_enforce;
 
 #include <custom/battle_config_struct.inc>
 };

+ 2 - 2
src/map/pc.cpp

@@ -14524,7 +14524,7 @@ void pc_expire_check(map_session_data *sd) {
 * @param money Amount of money to deposit
 **/
 enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(map_session_data *sd, int money) {
-	if (!sd->state.banking) {
+	if (battle_config.feature_banking_state_enforce && !sd->state.banking) {
 		return BDA_ERROR;
 	}
 
@@ -14551,7 +14551,7 @@ enum e_BANKING_DEPOSIT_ACK pc_bank_deposit(map_session_data *sd, int money) {
 * @param money Amount of money that will be withdrawn
 **/
 enum e_BANKING_WITHDRAW_ACK pc_bank_withdraw(map_session_data *sd, int money) {
-	if (!sd->state.banking) {
+	if (battle_config.feature_banking_state_enforce && !sd->state.banking) {
 		return BWA_UNKNOWN_ERROR;
 	}