1
0
mirror of https://github.com/0O0o0oOoO00/Alas.git synced 2026-05-15 06:29:26 +08:00
Files
Alas/module/daemon/daemon_base.py
2025-05-21 03:30:02 +08:00

40 lines
1.8 KiB
Python

from module.base.base import ModuleBase
from module.gg_handler.gg_handler import GGHandler
from module.luahook.crack import luahook_disable_all, luahook_crack_all, CrackResource
from module.config.deep import deep_get
import inflection
class DaemonBase(ModuleBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.device.disable_stuck_detection()
def handle_cheats(self):
CrackResource(self.config, self.device).ensure()
GGH = GGHandler(config=self.config, device=self.device)
GGH.check_config()
for _ in range(2):
try:
if not self.device.app_is_running():
GGH.restart()
_task = 'GemsFarming' if self.config.DaemonCheats_EnableGGShipChanger else 'Event'
_task = _task if self.config.DaemonCheats_EnableCheats else 'Commission'
GGH.check_then_set_gg_status(inflection.underscore(_task))
_gg_data = GGH.GGData.get_data()
if _gg_data['gg_enable']:
gg_auto = self.config.DaemonCheats_EnableCheats if deep_get(d=self.config.data,
keys='GameManager.GGHandler.AutoRestartGG',
default=False) else False
if gg_auto:
if not _gg_data['gg_type'] and self.config.DaemonCheats_EnableGGShipChanger:
GGH._change_ship_type()
GGH.gg.exit()
if self.config.DaemonCheats_EnableCheats:
luahook_crack_all(self.config, self.device)
else:
luahook_disable_all(self.config, self.device)
except Exception as e:
pass