first commit
This commit is contained in:
38
death_manager.py
Normal file
38
death_manager.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import time
|
||||
import math
|
||||
import pyautogui
|
||||
|
||||
|
||||
class DeathManager:
|
||||
def __init__(self, patrol_system):
|
||||
self.corpse_pos = None
|
||||
self.patrol_system = patrol_system
|
||||
self.is_running_to_corpse = False
|
||||
|
||||
def on_death(self, state):
|
||||
"""1. 死亡瞬间调用:从 player_position 获取坐标并记录"""
|
||||
self.corpse_pos = (state['x'], state['y'])
|
||||
self.is_running_to_corpse = True
|
||||
print(f">>> [系统] 记录死亡坐标: {self.corpse_pos},准备释放灵魂...")
|
||||
pyautogui.press('9') # 绑定宏: /run RepopMe()
|
||||
time.sleep(5) # 等待加载界面
|
||||
|
||||
def run_to_corpse(self, state):
|
||||
"""2. 跑尸寻路逻辑:坐标与朝向从 player_position 获取"""
|
||||
if not self.corpse_pos:
|
||||
return
|
||||
|
||||
is_arrived = self.patrol_system.navigate_to_point(state, self.corpse_pos)
|
||||
# 如果距离尸体很近(0.005 约等于 10-20 码)
|
||||
if is_arrived:
|
||||
print(">>> 已到达尸体附近,尝试复活...")
|
||||
pyautogui.press('0') # 绑定宏: /run RetrieveCorpse()
|
||||
time.sleep(5)
|
||||
self.is_running_to_corpse = False
|
||||
self.corpse_pos = None
|
||||
return
|
||||
|
||||
def handle_resurrection_popup(self):
|
||||
"""处理复活确认框"""
|
||||
# 配合 Lua 插件自动点击,或者 Python 模拟按键
|
||||
pydirectinput.press('enter')
|
||||
Reference in New Issue
Block a user