1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-15 16:57:20 +08:00

Opt: Set tasks enabled by default and use auto search by default

This commit is contained in:
LmeSzinc
2022-04-19 00:59:14 +08:00
parent 618fa52bcb
commit dc0268269d
6 changed files with 122 additions and 48 deletions

View File

@@ -268,7 +268,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "checkbox",
@@ -1792,7 +1792,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "checkbox",
@@ -2148,7 +2148,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "checkbox",
@@ -2574,7 +2574,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "disable",
@@ -2989,7 +2989,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "disable",
@@ -3394,7 +3394,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "checkbox",
@@ -4117,7 +4117,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4156,7 +4156,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4213,7 +4213,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4287,7 +4287,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4330,7 +4330,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4395,7 +4395,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4464,7 +4464,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4851,7 +4851,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4880,7 +4880,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4915,7 +4915,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -4950,7 +4950,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",
@@ -5668,7 +5668,7 @@
},
"UseAutoSearch": {
"type": "checkbox",
"value": false
"value": true
},
"Use2xBook": {
"type": "checkbox",
@@ -6011,7 +6011,7 @@
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false
"value": true
},
"NextRun": {
"type": "input",

View File

@@ -74,7 +74,7 @@ Campaign:
option: [normal, hard]
UseClearMode: true
UseFleetLock: true
UseAutoSearch: false
UseAutoSearch: true
Use2xBook: false
AmbushEvade: true
StopCondition:

View File

@@ -0,0 +1,56 @@
# --------------------
# Define default values
# --------------------
# ==================== Alas ====================
# ==================== Farm ====================
# ==================== Event ====================
# ==================== Reward ====================
Commission:
Scheduler:
Enable: true
Tactical:
Scheduler:
Enable: true
Research:
Scheduler:
Enable: true
Dorm:
Scheduler:
Enable: true
Meowfficer:
Scheduler:
Enable: true
Guild:
Scheduler:
Enable: true
Reward:
Scheduler:
Enable: true
# ==================== DailyReward ====================
DataKey:
Scheduler:
Enable: true
SupplyPack:
Scheduler:
Enable: true
BattlePass:
Scheduler:
Enable: true
MetaReward:
Scheduler:
Enable: true
# ==================== DailyMission ====================
# ==================== Opsi ====================
OpsiAshAssist:
Scheduler:
Enable: true

View File

@@ -64,7 +64,7 @@ class GeneratedConfig:
Campaign_Mode = 'normal' # normal, hard
Campaign_UseClearMode = True
Campaign_UseFleetLock = True
Campaign_UseAutoSearch = False
Campaign_UseAutoSearch = True
Campaign_Use2xBook = False
Campaign_AmbushEvade = True

View File

@@ -96,6 +96,15 @@ class ConfigGenerator:
"""
return read_file(filepath_argument('task'))
@cached_property
def default(self):
"""
<task>:
<group>:
<argument>: value
"""
return read_file(filepath_argument('default'))
@cached_property
def override(self):
"""
@@ -122,6 +131,7 @@ class ConfigGenerator:
task.yaml ---+
argument.yaml ---+-----> args.json
override.yaml ---+
default.yaml ---+
"""
# Construct args
@@ -133,29 +143,37 @@ class ConfigGenerator:
continue
deep_set(data, keys=[task, group], value=deepcopy(self.argument[group]))
# Override non-modifiable arguments
for path, value in deep_iter(self.override, depth=3):
def check_override(path, value):
# Check existence
old = deep_get(data, keys=path, default=None)
if old is None:
logger.warning(f'`{".".join(path)}` is not a existing argument')
continue
return False
# Check type
# But allow `Interval` to be different
old_value = old.get('value', None) if isinstance(old, dict) else old
if type(value) != type(old_value) and path[2] not in ['SuccessInterval', 'FailureInterval']:
logger.warning(
f'`{value}` ({type(value)}) and `{".".join(path)}` ({type(old_value)}) are in different types')
continue
return False
# Check option
if isinstance(old, dict) and 'option' in old:
if value not in old['option']:
logger.warning(f'`{value}` is not an option of argument `{".".join(path)}`')
continue
deep_set(data, keys=path + ['value'], value=value)
deep_set(data, keys=path + ['type'], value='disable')
return False
return True
# Set defaults
for p, v in deep_iter(self.default, depth=3):
if not check_override(p, v):
continue
deep_set(data, keys=p + ['value'], value=v)
# Override non-modifiable arguments
for p, v in deep_iter(self.override, depth=3):
if not check_override(p, v):
continue
deep_set(data, keys=p + ['value'], value=v)
deep_set(data, keys=p + ['type'], value='disable')
# Set command
for task in self.task.keys():
if deep_get(data, keys=f'{task}.Scheduler.Command'):