StarRailCopilot/module/handler/fast_forward.py
LmeSzinc 0c5bded2c7 Fix: 增加连续点击一个按钮时, 停止运行的功能
- 增加靠边缘修正相机位置时的log
- 修复了频繁报Enemy searching timeout的问题
- 修复周回模式下, 已经进图时, 会按有伏击运行的问题
2020-04-10 18:39:47 +08:00

42 lines
1.5 KiB
Python

from module.base.base import ModuleBase
from module.base.switch import Switch
from module.handler.assets import *
from module.logger import logger
fast_forward = Switch('Fast_Forward')
fast_forward.add_status('on', check_button=FAST_FORWARD_ON)
fast_forward.add_status('off', check_button=FAST_FORWARD_OFF)
fleet_lock = Switch('Fleet_Lock')
fleet_lock.add_status('on', check_button=FLEET_LOCKED)
fleet_lock.add_status('off', check_button=FLEET_UNLOCKED)
class FastForwardHandler(ModuleBase):
def handle_fast_forward(self):
if not fast_forward.appear(main=self):
self.config.ENABLE_FAST_FORWARD = False
self.config.MAP_HAS_AMBUSH = True
logger.info('No fast forward mode.')
return False
if self.config.ENABLE_FAST_FORWARD:
self.config.MAP_HAS_AMBUSH = False
status = 'on'
else:
# When disable fast forward, MAP_HAS_AMBUSH depends on map settings.
# self.config.MAP_HAS_AMBUSH = True
status = 'off'
changed = fast_forward.set(status=status, main=self)
return changed
def handle_map_fleet_lock(self):
if not fleet_lock.appear(main=self):
logger.info('No fleet lock option.')
return False
logger.info('fleet_lock')
self.config.MAP_HAS_AMBUSH = False
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
changed = fleet_lock.set(status=status, main=self)
return changed