mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 10:59:24 +08:00
Add: cheat support for daemon
This commit is contained in:
@@ -3186,7 +3186,12 @@
|
||||
},
|
||||
"Daemon": {
|
||||
"Daemon": {
|
||||
"EnterMap": true
|
||||
"EnterMap": true,
|
||||
"FleetMode": "combat_auto"
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"EnableCheats": true,
|
||||
"EnableGGShipChanger": false
|
||||
},
|
||||
"Storage": {
|
||||
"Storage": {}
|
||||
@@ -3195,7 +3200,12 @@
|
||||
"OpsiDaemon": {
|
||||
"OpsiDaemon": {
|
||||
"RepairShip": true,
|
||||
"SelectEnemy": true
|
||||
"SelectEnemy": true,
|
||||
"FleetMode": "combat_auto"
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"EnableCheats": true,
|
||||
"EnableGGShipChanger": false
|
||||
},
|
||||
"Storage": {
|
||||
"Storage": {}
|
||||
|
||||
@@ -15974,6 +15974,24 @@
|
||||
"EnterMap": {
|
||||
"type": "checkbox",
|
||||
"value": true
|
||||
},
|
||||
"FleetMode": {
|
||||
"type": "select",
|
||||
"value": "combat_auto",
|
||||
"option": [
|
||||
"combat_auto",
|
||||
"stand_still_in_the_middle"
|
||||
]
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"EnableCheats": {
|
||||
"type": "checkbox",
|
||||
"value": true
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"Storage": {
|
||||
@@ -15994,6 +16012,24 @@
|
||||
"SelectEnemy": {
|
||||
"type": "checkbox",
|
||||
"value": true
|
||||
},
|
||||
"FleetMode": {
|
||||
"type": "select",
|
||||
"value": "combat_auto",
|
||||
"option": [
|
||||
"combat_auto",
|
||||
"stand_still_in_the_middle"
|
||||
]
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"EnableCheats": {
|
||||
"type": "checkbox",
|
||||
"value": true
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"Storage": {
|
||||
|
||||
@@ -1039,9 +1039,18 @@ OpsiHazard1Leveling:
|
||||
|
||||
Daemon:
|
||||
EnterMap: true
|
||||
FleetMode:
|
||||
value: combat_auto
|
||||
option: [ combat_auto, stand_still_in_the_middle]
|
||||
DaemonCheats:
|
||||
EnableCheats: true
|
||||
EnableGGShipChanger: false
|
||||
OpsiDaemon:
|
||||
RepairShip: true
|
||||
SelectEnemy: true
|
||||
FleetMode:
|
||||
value: combat_auto
|
||||
option: [ combat_auto, stand_still_in_the_middle]
|
||||
EventStory:
|
||||
SkipBattle:
|
||||
type: checkbox
|
||||
|
||||
@@ -484,8 +484,10 @@ Tool:
|
||||
tasks:
|
||||
Daemon:
|
||||
- Daemon
|
||||
- DaemonCheats
|
||||
OpsiDaemon:
|
||||
- OpsiDaemon
|
||||
- DaemonCheats
|
||||
EventStory:
|
||||
- EventStory
|
||||
Benchmark:
|
||||
|
||||
@@ -607,10 +607,16 @@ class GeneratedConfig:
|
||||
|
||||
# Group `Daemon`
|
||||
Daemon_EnterMap = True
|
||||
Daemon_FleetMode = 'combat_auto' # combat_auto, stand_still_in_the_middle
|
||||
|
||||
# Group `DaemonCheats`
|
||||
DaemonCheats_EnableCheats = True
|
||||
DaemonCheats_EnableGGShipChanger = False
|
||||
|
||||
# Group `OpsiDaemon`
|
||||
OpsiDaemon_RepairShip = True
|
||||
OpsiDaemon_SelectEnemy = True
|
||||
OpsiDaemon_FleetMode = 'combat_auto' # combat_auto, stand_still_in_the_middle
|
||||
|
||||
# Group `EventStory`
|
||||
EventStory_SkipBattle = False # True, False
|
||||
|
||||
@@ -3587,6 +3587,26 @@
|
||||
"EnterMap": {
|
||||
"name": "Auto Click Stage Preparation",
|
||||
"help": "Prepare your fleets before running this tool if enabled"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "Daemon.FleetMode.name",
|
||||
"help": "Daemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"_info": {
|
||||
"name": "DaemonCheats._info.name",
|
||||
"help": "DaemonCheats._info.help"
|
||||
},
|
||||
"EnableCheats": {
|
||||
"name": "DaemonCheats.EnableCheats.name",
|
||||
"help": "DaemonCheats.EnableCheats.help"
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"name": "DaemonCheats.EnableGGShipChanger.name",
|
||||
"help": "DaemonCheats.EnableGGShipChanger.help"
|
||||
}
|
||||
},
|
||||
"OpsiDaemon": {
|
||||
@@ -3601,6 +3621,12 @@
|
||||
"SelectEnemy": {
|
||||
"name": "Clear nearby enemies and resources",
|
||||
"help": "Clean nearby enemies and resources, and find new enemies or materials after cleaning, which usually clears the entire map. If some of them haven't been cleared, you need to solve them manually"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "OpsiDaemon.FleetMode.name",
|
||||
"help": "OpsiDaemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"EventStory": {
|
||||
|
||||
@@ -3587,6 +3587,26 @@
|
||||
"EnterMap": {
|
||||
"name": "Daemon.EnterMap.name",
|
||||
"help": "Daemon.EnterMap.help"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "Daemon.FleetMode.name",
|
||||
"help": "Daemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"_info": {
|
||||
"name": "DaemonCheats._info.name",
|
||||
"help": "DaemonCheats._info.help"
|
||||
},
|
||||
"EnableCheats": {
|
||||
"name": "DaemonCheats.EnableCheats.name",
|
||||
"help": "DaemonCheats.EnableCheats.help"
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"name": "DaemonCheats.EnableGGShipChanger.name",
|
||||
"help": "DaemonCheats.EnableGGShipChanger.help"
|
||||
}
|
||||
},
|
||||
"OpsiDaemon": {
|
||||
@@ -3601,6 +3621,12 @@
|
||||
"SelectEnemy": {
|
||||
"name": "OpsiDaemon.SelectEnemy.name",
|
||||
"help": "OpsiDaemon.SelectEnemy.help"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "OpsiDaemon.FleetMode.name",
|
||||
"help": "OpsiDaemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"EventStory": {
|
||||
|
||||
@@ -3587,6 +3587,26 @@
|
||||
"EnterMap": {
|
||||
"name": "自动点击进图准备",
|
||||
"help": "使用之前,需要准备好出击队伍"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "自律模式",
|
||||
"help": "",
|
||||
"combat_auto": "自律战斗",
|
||||
"stand_still_in_the_middle": "原地站桩"
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"_info": {
|
||||
"name": "作弊选项",
|
||||
"help": ""
|
||||
},
|
||||
"EnableCheats": {
|
||||
"name": "启用作弊选项",
|
||||
"help": "优先Hook,否则GG。GG改船默认不启用,以下一个选项覆盖。使用Hook时若不勾选会关闭作弊项目。"
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"name": "启用GG改船",
|
||||
"help": ""
|
||||
}
|
||||
},
|
||||
"OpsiDaemon": {
|
||||
@@ -3601,6 +3621,12 @@
|
||||
"SelectEnemy": {
|
||||
"name": "清理附近的敌人和物资",
|
||||
"help": "清理附近的敌人和物资,清理完后又会找到新的敌人或物资,这样通常能清理整个海域,如果有遗漏或者点击错误,需要手动解决"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "自律模式",
|
||||
"help": "",
|
||||
"combat_auto": "自律战斗",
|
||||
"stand_still_in_the_middle": "原地站桩"
|
||||
}
|
||||
},
|
||||
"EventStory": {
|
||||
|
||||
@@ -3587,6 +3587,26 @@
|
||||
"EnterMap": {
|
||||
"name": "自動點擊進圖準備",
|
||||
"help": "使用之前,需要準備好出擊隊伍"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "Daemon.FleetMode.name",
|
||||
"help": "Daemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"DaemonCheats": {
|
||||
"_info": {
|
||||
"name": "DaemonCheats._info.name",
|
||||
"help": "DaemonCheats._info.help"
|
||||
},
|
||||
"EnableCheats": {
|
||||
"name": "DaemonCheats.EnableCheats.name",
|
||||
"help": "DaemonCheats.EnableCheats.help"
|
||||
},
|
||||
"EnableGGShipChanger": {
|
||||
"name": "DaemonCheats.EnableGGShipChanger.name",
|
||||
"help": "DaemonCheats.EnableGGShipChanger.help"
|
||||
}
|
||||
},
|
||||
"OpsiDaemon": {
|
||||
@@ -3601,6 +3621,12 @@
|
||||
"SelectEnemy": {
|
||||
"name": "清理附近的敵人和物資",
|
||||
"help": "清理附近的敵人和物資,清理完後又會找到新的敵人或物資,這樣通常能清理整個海域,如果有遺漏或者點擊錯誤,需要手動解決"
|
||||
},
|
||||
"FleetMode": {
|
||||
"name": "OpsiDaemon.FleetMode.name",
|
||||
"help": "OpsiDaemon.FleetMode.help",
|
||||
"combat_auto": "combat_auto",
|
||||
"stand_still_in_the_middle": "stand_still_in_the_middle"
|
||||
}
|
||||
},
|
||||
"EventStory": {
|
||||
|
||||
@@ -7,6 +7,7 @@ from module.map.map_operation import FLEET_PREPARATION, MAP_PREPARATION
|
||||
|
||||
class AzurLaneDaemon(DaemonBase, CampaignBase):
|
||||
def run(self):
|
||||
self.handle_cheats()
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
|
||||
@@ -16,7 +17,7 @@ class AzurLaneDaemon(DaemonBase, CampaignBase):
|
||||
|
||||
# Combat
|
||||
if self.combat_appear():
|
||||
self.combat_preparation()
|
||||
self.combat_preparation(auto=self.config.Daemon_FleetMode)
|
||||
try:
|
||||
if self.handle_battle_status():
|
||||
self.combat_status(expected_end='no_searching')
|
||||
@@ -66,5 +67,5 @@ class AzurLaneDaemon(DaemonBase, CampaignBase):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
b = AzurLaneDaemon('alas', task='Daemon')
|
||||
b = AzurLaneDaemon('主号', task='Daemon')
|
||||
b.run()
|
||||
|
||||
@@ -1,7 +1,39 @@
|
||||
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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from module.combat.assets import EXP_INFO_C, EXP_INFO_D
|
||||
from module.combat.assets import EXP_INFO_C, EXP_INFO_D, COMBAT_AUTO_SWITCH, COMBAT_AUTO_133, COMBAT_AUTO_150
|
||||
from module.daemon.daemon_base import DaemonBase
|
||||
from module.exception import CampaignEnd
|
||||
from module.logger import logger
|
||||
@@ -17,6 +17,7 @@ class AzurLaneDaemon(DaemonBase, OSFleet, PortHandler):
|
||||
return super()._os_combat_expected_end()
|
||||
|
||||
def run(self):
|
||||
self.handle_cheats()
|
||||
self.config.merge(OSConfig())
|
||||
self.config.override(HOMO_EDGE_DETECT=False)
|
||||
while 1:
|
||||
@@ -24,11 +25,20 @@ class AzurLaneDaemon(DaemonBase, OSFleet, PortHandler):
|
||||
|
||||
# If is running a combat, do nothing.
|
||||
if self.is_combat_executing():
|
||||
continue
|
||||
self.device.screenshot()
|
||||
if (self.config.OpsiDaemon_FleetMode == 'auto_search' and
|
||||
(self.appear(COMBAT_AUTO_150, offset=(50, 50)) or
|
||||
self.appear_then_click(COMBAT_AUTO_133, offset=(50, 50))
|
||||
)
|
||||
):
|
||||
self.device.click(COMBAT_AUTO_SWITCH)
|
||||
continue
|
||||
elif self.appear_then_click(COMBAT_AUTO_SWITCH, offset=(50, 50)):
|
||||
continue
|
||||
|
||||
# Combat
|
||||
if self.combat_appear():
|
||||
self.combat_preparation()
|
||||
self.combat_preparation(auto=self.config.OpsiDaemon_FleetMode)
|
||||
try:
|
||||
if self.handle_battle_status():
|
||||
self.combat_status(expected_end='no_searching')
|
||||
|
||||
@@ -327,6 +327,11 @@ class GGHandler:
|
||||
if not self.config.is_task_enabled("GemsFarming") or deep_get(self.config.data,
|
||||
"GemsFarming.Campaign.Name").lower() not in HARDMODEMAPS:
|
||||
return 0
|
||||
self._change_ship_type()
|
||||
return True
|
||||
return False
|
||||
|
||||
def _change_ship_type(self):
|
||||
logger.hr('GG Ship Type', level=2)
|
||||
success = timeout(self.gg.set_on,
|
||||
timeout_sec=deep_get(self.config.data, "GameManager.GGHandler.Timeout"),
|
||||
@@ -336,8 +341,6 @@ class GGHandler:
|
||||
self.GGData.set_data(target='gg_type', value=True)
|
||||
|
||||
# success = self.gg.set_on('change_type')
|
||||
return True
|
||||
return False
|
||||
|
||||
def change_attribute(self):
|
||||
if not deep_get(self.config.data, "GameManager.ChangeAttribute.Enable"):
|
||||
|
||||
@@ -204,6 +204,10 @@ def luahook_crack_all(config: AzurLaneConfig, device: Device):
|
||||
logger.info("Crack all with luahook")
|
||||
do_crack_op(config, device, CrackOp.EnableAll)
|
||||
|
||||
def luahook_disable_all(config: AzurLaneConfig, device: Device):
|
||||
logger.info("Disable all luahook")
|
||||
do_crack_op(config, device, CrackOp.DisableAll)
|
||||
|
||||
|
||||
CHAPTER_CRACK_OPS = [
|
||||
CrackOp.EnableChapterFastMove,
|
||||
@@ -434,14 +438,14 @@ class CrackResource:
|
||||
def ensure(self):
|
||||
if not deep_get(self.config.data, "Hook.HookGeneral.Enable", False):
|
||||
return
|
||||
if not deep_get(self.config.data, "Hook.HookGeneral.RestartEverytime", True):
|
||||
return
|
||||
|
||||
if not self.__check_game_lib_dir():
|
||||
raise CrackerError(f"GameLibDir '{self.game_lib_dir}' is invalid")
|
||||
|
||||
self.device.app_stop()
|
||||
self.config.task_call("Restart")
|
||||
if deep_get(self.config.data, "Hook.HookGeneral.RestartEverytime", True):
|
||||
self.device.app_stop()
|
||||
self.config.task_call("Restart")
|
||||
|
||||
self.__adb_root()
|
||||
self.__ensure_crack_resource()
|
||||
if not self.first_init:
|
||||
|
||||
Reference in New Issue
Block a user