StarRailCopilot/module/handler/fast_forward.py
LmeSzinc 95d84d11ac Add: 增加周回模式开关, 增加阵容锁定开关
- 增加了开关控制的函数
2020-04-09 21:22:01 +08:00

40 lines
1.4 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')
status = 'on' if self.config.ENABLE_MAP_FLEET_LOCK else 'off'
changed = fleet_lock.set(status=status, main=self)
return changed