mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-27 02:27:12 +00:00
964c2b3e56
- 修复了透视识别错误保存选项无效的问题
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
from module.base.base import ModuleBase
|
|
from module.base.timer import Timer
|
|
from module.combat.assets import COMBAT_AUTO, COMBAT_AUTO_SWITCH
|
|
from module.logger import logger
|
|
|
|
|
|
class CombatAuto(ModuleBase):
|
|
auto_skip_timer = Timer(1)
|
|
auto_click_interval_timer = Timer(1)
|
|
auto_mode_checked = False
|
|
auto_mode_click_timer = Timer(5)
|
|
|
|
def combat_auto_reset(self):
|
|
self.auto_mode_click_timer.reset()
|
|
self.auto_skip_timer.reset()
|
|
self.auto_mode_checked = False
|
|
|
|
def handle_combat_auto(self):
|
|
if self.auto_mode_checked:
|
|
return False
|
|
if self.auto_mode_click_timer.reached():
|
|
logger.info('Combat auto check timer reached')
|
|
self.auto_mode_checked = True
|
|
return False
|
|
if not self.auto_skip_timer.reached():
|
|
return False
|
|
if not self.auto_click_interval_timer.reached():
|
|
return False
|
|
|
|
auto = self.config.COMBAT_AUTO_MODE == 'combat_auto'
|
|
if self.appear(COMBAT_AUTO, offset=(200, 200)):
|
|
if auto:
|
|
self.device.click(COMBAT_AUTO_SWITCH)
|
|
self.auto_click_interval_timer.reset()
|
|
return True
|
|
else:
|
|
if not auto:
|
|
self.device.click(COMBAT_AUTO_SWITCH)
|
|
self.auto_click_interval_timer.reset()
|
|
return True
|
|
|
|
return False
|
|
|
|
|