add 包满回城

This commit is contained in:
王鹏
2026-04-10 14:36:04 +08:00
parent 8c1460a582
commit afc0e05924
10 changed files with 53 additions and 1 deletions

View File

@@ -17,6 +17,9 @@ class LogisticsManager:
self.bag_full = False
self.is_returning = False
self.route_file = route_file or VENDOR_FILE
self.bag_full_hearthstone = False # 包满时用炉石回城而非走路修理
self.hearthstone_key = "b" # 炉石按键
self.hearthstone_cast_sec = 10.0 # 炉石施法等待秒数
def check_logistics(self, state):
"""
@@ -31,6 +34,15 @@ class LogisticsManager:
else:
self.is_returning = False
def use_hearthstone_and_stop(self):
"""按炉石按键并等待施法完成,返回 True 表示已执行(调用方应随后结束循环)。"""
print(f">>> [后勤] 包满,使用炉石({self.hearthstone_key})回城,等待 {self.hearthstone_cast_sec:.0f}s...")
pydirectinput.press(self.hearthstone_key)
time.sleep(self.hearthstone_cast_sec)
print(">>> [后勤] 炉石施法完成,停止所有动作。")
self.is_returning = False
return True
def return_home(self):
"""执行回城动作"""
# 1. 停止当前巡逻