Add bag full mailbox mailing flow

This commit is contained in:
王鹏
2026-05-07 08:33:10 +08:00
parent a9e162f00e
commit 2ee9f9d10d
7 changed files with 807 additions and 3 deletions

View File

@@ -305,6 +305,7 @@ class GameLoopWorker(QThread):
waypoints_path=None,
prepare_route_path=None,
vendor_path=None,
mailbox_route_path=None,
record_filename=None,
record_min_distance=None,
attack_loop_path=None,
@@ -342,6 +343,7 @@ class GameLoopWorker(QThread):
self.waypoints_path = waypoints_path
self.prepare_route_path = prepare_route_path
self.vendor_path = vendor_path
self.mailbox_route_path = mailbox_route_path
self.record_filename = record_filename or 'waypoints'
self.record_min_distance = record_min_distance
self.attack_loop_path = attack_loop_path or None
@@ -422,6 +424,7 @@ class GameLoopWorker(QThread):
turn_error_key=self.turn_error_key,
turn_error_hold_sec=self.turn_error_hold_sec,
distance_interact_pause_sec=self.distance_interact_pause_sec,
mailbox_route_path=self.mailbox_route_path,
)
self.bot_move._on_hearthstone_stop = self.stop_signal.emit
except ImportError as e:
@@ -723,6 +726,8 @@ class WoWMultiKeyGUI(QMainWindow):
self.waypoints_combo.setMinimumWidth(200)
self.vendor_combo = QComboBox()
self.vendor_combo.setMinimumWidth(200)
self.mailbox_route_combo = QComboBox()
self.mailbox_route_combo.setMinimumWidth(200)
self.patrol_attack_loop_combo = QComboBox()
self.patrol_attack_loop_combo.setMinimumWidth(200)
self.prepare_route_combo = QComboBox()
@@ -733,6 +738,7 @@ class WoWMultiKeyGUI(QMainWindow):
patrol_layout.addRow("准备路线 JSON:", self.prepare_route_combo)
patrol_layout.addRow("巡逻点 JSON:", self.waypoints_combo)
patrol_layout.addRow("修理商 JSON:", self.vendor_combo)
patrol_layout.addRow("邮箱路线 JSON:", self.mailbox_route_combo)
self.resurrection_route_a_combo = QComboBox()
self.resurrection_route_a_combo.setMinimumWidth(200)
self.resurrection_route_b_combo = QComboBox()
@@ -1110,6 +1116,30 @@ class WoWMultiKeyGUI(QMainWindow):
self.gs_hearthstone_key.setText("b")
self.gs_bag_full_hearthstone = QCheckBox("包满时用炉石回城并停止")
self.gs_bag_full_hearthstone.setChecked(False)
self.gs_enable_bag_full_mail = QCheckBox("包满炉石后跑邮箱并邮寄")
self.gs_enable_bag_full_mail.setChecked(False)
self.gs_mailbox_interact_key = QLineEdit()
self.gs_mailbox_interact_key.setPlaceholderText("如 8")
self.gs_mailbox_interact_key.setMaxLength(16)
self.gs_mailbox_interact_key.setText("8")
self.gs_mail_recipient_key = QLineEdit()
self.gs_mail_recipient_key.setPlaceholderText("如 f7")
self.gs_mail_recipient_key.setMaxLength(16)
self.gs_mail_recipient_key.setText("")
self.gs_mail_send_key = QLineEdit()
self.gs_mail_send_key.setPlaceholderText("如 f8")
self.gs_mail_send_key.setMaxLength(16)
self.gs_mail_send_key.setText("f8")
self.gs_mailbox_open_wait = QDoubleSpinBox()
self.gs_mailbox_open_wait.setRange(0.1, 30.0)
self.gs_mailbox_open_wait.setSingleStep(0.1)
self.gs_mailbox_open_wait.setValue(2.0)
self.gs_mailbox_open_wait.setSuffix("")
self.gs_mail_send_wait = QDoubleSpinBox()
self.gs_mail_send_wait.setRange(0.0, 600.0)
self.gs_mail_send_wait.setSingleStep(1.0)
self.gs_mail_send_wait.setValue(60.0)
self.gs_mail_send_wait.setSuffix("")
self.gs_enable_mount = QCheckBox("启用上马")
self.gs_enable_mount.setChecked(True)
self.gs_mount_key = QLineEdit()
@@ -1175,7 +1205,18 @@ class WoWMultiKeyGUI(QMainWindow):
game_grid.addWidget(self.gs_use_hardware_input, 8, 0, 1, 2)
game_grid.addWidget(QLabel("复活按键:"), 6, 2)
game_grid.addWidget(self.gs_resurrect_key, 6, 3)
game_grid.addWidget(self.gs_bag_full_hearthstone, 9, 1)
game_grid.addWidget(self.gs_bag_full_hearthstone, 9, 0, 1, 2)
game_grid.addWidget(self.gs_enable_bag_full_mail, 9, 2, 1, 2)
game_grid.addWidget(QLabel("邮箱交互键:"), 10, 0)
game_grid.addWidget(self.gs_mailbox_interact_key, 10, 1)
game_grid.addWidget(QLabel("收信人按键:"), 10, 2)
game_grid.addWidget(self.gs_mail_recipient_key, 10, 3)
game_grid.addWidget(QLabel("邮寄宏按键:"), 11, 0)
game_grid.addWidget(self.gs_mail_send_key, 11, 1)
game_grid.addWidget(QLabel("邮箱打开等待:"), 11, 2)
game_grid.addWidget(self.gs_mailbox_open_wait, 11, 3)
game_grid.addWidget(QLabel("邮寄后等待:"), 12, 0)
game_grid.addWidget(self.gs_mail_send_wait, 12, 1)
params_layout.addWidget(game_group)
@@ -1211,10 +1252,17 @@ class WoWMultiKeyGUI(QMainWindow):
self.gs_scan_height.setValue(cfg.get('scan_region_height', 15))
self.gs_offset_left.setValue(cfg.get('offset_left', 20))
self.gs_offset_top.setValue(cfg.get('offset_top', 45))
self.gs_enable_mount.setChecked(bool(cfg.get('enable_mount', True)))
self.gs_mount_key.setText(str(cfg.get('mount_key', 'x') or 'x'))
self.gs_mount_hold.setValue(float(cfg.get('mount_hold_sec', 1.6)))
self.gs_hearthstone_key.setText(str(cfg.get('hearthstone_key', 'b') or 'b'))
self.gs_bag_full_hearthstone.setChecked(bool(cfg.get('bag_full_hearthstone', False)))
self.gs_enable_bag_full_mail.setChecked(bool(cfg.get('enable_bag_full_mail', False)))
self.gs_mailbox_interact_key.setText(str(cfg.get('mailbox_interact_key', '8') or '8'))
self.gs_mail_recipient_key.setText(str(cfg.get('mail_recipient_key', '') or ''))
self.gs_mail_send_key.setText(str(cfg.get('mail_send_key', 'f8') or 'f8'))
self.gs_mailbox_open_wait.setValue(float(cfg.get('mailbox_open_wait_sec', 2.0)))
self.gs_mail_send_wait.setValue(float(cfg.get('mail_send_wait_sec', 60.0)))
self.gs_mount_retry.setValue(float(cfg.get('mount_retry_after_sec', 2.0)))
self.gs_release_spirit_key.setText(str(cfg.get('release_spirit_key', '9') or '9'))
self.gs_resurrect_key.setText(str(cfg.get('resurrect_key', '0') or '0'))
@@ -1254,11 +1302,18 @@ class WoWMultiKeyGUI(QMainWindow):
cfg['scan_region_height'] = self.gs_scan_height.value()
cfg['offset_left'] = self.gs_offset_left.value()
cfg['offset_top'] = self.gs_offset_top.value()
cfg['enable_mount'] = self.gs_enable_mount.isChecked()
cfg['mount_key'] = (self.gs_mount_key.text().strip() or 'x')
cfg['mount_hold_sec'] = float(self.gs_mount_hold.value())
cfg['mount_retry_after_sec'] = float(self.gs_mount_retry.value())
cfg['hearthstone_key'] = (self.gs_hearthstone_key.text().strip() or 'b')
cfg['bag_full_hearthstone'] = self.gs_bag_full_hearthstone.isChecked()
cfg['enable_bag_full_mail'] = self.gs_enable_bag_full_mail.isChecked()
cfg['mailbox_interact_key'] = self.gs_mailbox_interact_key.text().strip() or '8'
cfg['mail_recipient_key'] = self.gs_mail_recipient_key.text().strip()
cfg['mail_send_key'] = self.gs_mail_send_key.text().strip() or 'f8'
cfg['mailbox_open_wait_sec'] = float(self.gs_mailbox_open_wait.value())
cfg['mail_send_wait_sec'] = float(self.gs_mail_send_wait.value())
cfg['release_spirit_key'] = (self.gs_release_spirit_key.text().strip() or '9')
cfg['resurrect_key'] = (self.gs_resurrect_key.text().strip() or '0')
path = save_layout_config(cfg)
@@ -1471,6 +1526,16 @@ class WoWMultiKeyGUI(QMainWindow):
]
if hasattr(self, "repair_vendor_combo"):
combos_with_default.append((self.repair_vendor_combo, 'vendor.json'))
if hasattr(self, "mailbox_route_combo"):
self.mailbox_route_combo.blockSignals(True)
self.mailbox_route_combo.clear()
self.mailbox_route_combo.addItem("-- 置空(不跑邮箱路线) --", "")
for name, path in items:
self.mailbox_route_combo.addItem(name, path)
idx = self.mailbox_route_combo.findData(os.path.join(get_recorder_dir(), 'mailbox.json'))
if idx >= 0:
self.mailbox_route_combo.setCurrentIndex(idx)
self.mailbox_route_combo.blockSignals(False)
for combo, default_name in combos_with_default:
combo.blockSignals(True)
combo.clear()
@@ -1635,6 +1700,7 @@ class WoWMultiKeyGUI(QMainWindow):
waypoints_path = None
prepare_route_path = None
vendor_path = None
mailbox_route_path = None
flight_json_path = None
resurrection_route_a_path = None
resurrection_route_b_path = None
@@ -1642,6 +1708,7 @@ class WoWMultiKeyGUI(QMainWindow):
prep = self.prepare_route_combo.currentData() or ""
wp = self.waypoints_combo.currentData() or ""
vp = self.vendor_combo.currentData() or ""
mp = self.mailbox_route_combo.currentData() or ""
route_a = self.resurrection_route_a_combo.currentData() or ""
route_b = self.resurrection_route_b_combo.currentData() or ""
if not wp:
@@ -1659,6 +1726,13 @@ class WoWMultiKeyGUI(QMainWindow):
if prep and not os.path.exists(prep):
QMessageBox.warning(self, "提示", f"准备路线文件不存在: {prep}")
return
if self.gs_enable_bag_full_mail.isChecked():
if not mp:
QMessageBox.warning(self, "提示", "已启用包满邮寄,请选择邮箱路线 JSON 文件")
return
if not os.path.exists(mp):
QMessageBox.warning(self, "提示", f"邮箱路线文件不存在: {mp}")
return
if route_a and not os.path.exists(route_a):
QMessageBox.warning(self, "提示", f"复活路线 A 文件不存在: {route_a}")
return
@@ -1668,6 +1742,7 @@ class WoWMultiKeyGUI(QMainWindow):
waypoints_path = wp
prepare_route_path = prep or None
vendor_path = vp
mailbox_route_path = mp or None
resurrection_route_a_path = route_a or None
resurrection_route_b_path = route_b or None
attack_loop_path = None
@@ -1753,6 +1828,7 @@ class WoWMultiKeyGUI(QMainWindow):
self.game_worker = GameLoopWorker(
mode, waypoints_path=waypoints_path, prepare_route_path=prepare_route_path, vendor_path=vendor_path,
mailbox_route_path=mailbox_route_path,
attack_loop_path=attack_loop_path,
skinning_wait_sec=skinning_wait_sec,
food_key=food_key,