Add patrol prepare route support

This commit is contained in:
王鹏
2026-04-29 23:15:10 +08:00
parent 12ce30d2df
commit a9e162f00e
3 changed files with 90 additions and 12 deletions

View File

@@ -303,6 +303,7 @@ class GameLoopWorker(QThread):
self,
mode,
waypoints_path=None,
prepare_route_path=None,
vendor_path=None,
record_filename=None,
record_min_distance=None,
@@ -339,6 +340,7 @@ class GameLoopWorker(QThread):
self.flight_bot = None
self.recorder = None
self.waypoints_path = waypoints_path
self.prepare_route_path = prepare_route_path
self.vendor_path = vendor_path
self.record_filename = record_filename or 'waypoints'
self.record_min_distance = record_min_distance
@@ -403,6 +405,7 @@ class GameLoopWorker(QThread):
from auto_bot_move import AutoBotMove, load_waypoints
self.bot_move = AutoBotMove(
waypoints_path=self.waypoints_path,
prepare_route_path=self.prepare_route_path,
vendor_path=self.vendor_path,
attack_loop_path=self.attack_loop_path,
skinning_wait_sec=self.skinning_wait_sec,
@@ -722,15 +725,19 @@ class WoWMultiKeyGUI(QMainWindow):
self.vendor_combo.setMinimumWidth(200)
self.patrol_attack_loop_combo = QComboBox()
self.patrol_attack_loop_combo.setMinimumWidth(200)
self.prepare_route_combo = QComboBox()
self.prepare_route_combo.setMinimumWidth(200)
self._refresh_recorder_combos()
refresh_btn = QPushButton("🔄 刷新列表")
refresh_btn.clicked.connect(self._refresh_recorder_combos)
patrol_layout.addRow("准备路线 JSON:", self.prepare_route_combo)
patrol_layout.addRow("巡逻点 JSON:", self.waypoints_combo)
patrol_layout.addRow("修理商 JSON:", self.vendor_combo)
self.resurrection_route_a_combo = QComboBox()
self.resurrection_route_a_combo.setMinimumWidth(200)
self.resurrection_route_b_combo = QComboBox()
self.resurrection_route_b_combo.setMinimumWidth(200)
self._refresh_recorder_combos()
patrol_layout.addRow("复活路线 A JSON:", self.resurrection_route_a_combo)
patrol_layout.addRow("复活路线 B JSON:", self.resurrection_route_b_combo)
patrol_layout.addRow("攻击循环:", self.patrol_attack_loop_combo)
@@ -1477,12 +1484,17 @@ class WoWMultiKeyGUI(QMainWindow):
combo.setCurrentIndex(1)
combo.blockSignals(False)
# 复活路线下拉(无默认值,可置空)
for combo_name in ("resurrection_route_a_combo", "resurrection_route_b_combo"):
for combo_name in (
"prepare_route_combo",
"resurrection_route_a_combo",
"resurrection_route_b_combo",
):
if hasattr(self, combo_name):
combo = getattr(self, combo_name)
combo.blockSignals(True)
combo.clear()
combo.addItem("-- 置空(直接跑尸体) --", "")
empty_text = "-- 置空(直接巡逻) --" if combo_name == "prepare_route_combo" else "-- 置空(直接跑尸体) --"
combo.addItem(empty_text, "")
for name, path in items:
combo.addItem(name, path)
combo.blockSignals(False)
@@ -1621,11 +1633,13 @@ class WoWMultiKeyGUI(QMainWindow):
QMessageBox.warning(self, "提示", "请先选择模式(状态监控 / 巡逻打怪 / 自动打怪 / 任务跟随 / 飞行模式 / 回城修理)")
return
waypoints_path = None
prepare_route_path = None
vendor_path = None
flight_json_path = None
resurrection_route_a_path = None
resurrection_route_b_path = None
if mode == 'patrol':
prep = self.prepare_route_combo.currentData() or ""
wp = self.waypoints_combo.currentData() or ""
vp = self.vendor_combo.currentData() or ""
route_a = self.resurrection_route_a_combo.currentData() or ""
@@ -1642,6 +1656,9 @@ class WoWMultiKeyGUI(QMainWindow):
if not os.path.exists(vp):
QMessageBox.warning(self, "提示", f"修理商文件不存在: {vp}")
return
if prep and not os.path.exists(prep):
QMessageBox.warning(self, "提示", f"准备路线文件不存在: {prep}")
return
if route_a and not os.path.exists(route_a):
QMessageBox.warning(self, "提示", f"复活路线 A 文件不存在: {route_a}")
return
@@ -1649,6 +1666,7 @@ class WoWMultiKeyGUI(QMainWindow):
QMessageBox.warning(self, "提示", f"复活路线 B 文件不存在: {route_b}")
return
waypoints_path = wp
prepare_route_path = prep or None
vendor_path = vp
resurrection_route_a_path = route_a or None
resurrection_route_b_path = route_b or None
@@ -1734,7 +1752,7 @@ class WoWMultiKeyGUI(QMainWindow):
use_hardware_input = self.gs_use_hardware_input.isChecked()
self.game_worker = GameLoopWorker(
mode, waypoints_path=waypoints_path, vendor_path=vendor_path,
mode, waypoints_path=waypoints_path, prepare_route_path=prepare_route_path, vendor_path=vendor_path,
attack_loop_path=attack_loop_path,
skinning_wait_sec=skinning_wait_sec,
food_key=food_key,