Fix: Unable to override null arguments

This commit is contained in:
SarContDeli 2022-11-05 09:45:24 +08:00
parent ad61593350
commit d73336af5a
5 changed files with 32 additions and 20 deletions

View File

@ -41,11 +41,11 @@
"ServerUpdate": "04:00"
},
"MaaFight": {
"Stage": "last",
"CustomStage": null,
"Medicine": null,
"Stone": null,
"Times": null,
"Stage": "custom",
"CustomStage": "Annihilation",
"Medicine": 0,
"Stone": 0,
"Times": 5,
"Drops": null,
"DrGrandet": false
}
@ -81,9 +81,9 @@
"MaaFight": {
"Stage": "last",
"CustomStage": null,
"Medicine": null,
"Stone": null,
"Times": null,
"Medicine": 0,
"Stone": 0,
"Times": 0,
"Drops": null,
"DrGrandet": false
}

View File

@ -155,7 +155,9 @@ class ConfigGenerator:
# But allow `Interval` to be different
old_value = old.get('value', None) if isinstance(old, dict) else old
value = old.get('value', None) if isinstance(value, dict) else value
if type(value) != type(old_value) and path[2] not in ['SuccessInterval', 'FailureInterval']:
if type(value) != type(old_value) \
and old_value is not None \
and path[2] not in ['SuccessInterval', 'FailureInterval']:
print(
f'`{value}` ({type(value)}) and `{".".join(path)}` ({type(old_value)}) are in different types')
return False

View File

@ -137,7 +137,7 @@
"MaaFight": {
"Stage": {
"type": "select",
"value": "last",
"value": "custom",
"option": [
"last",
"1-7",
@ -154,23 +154,28 @@
"PR-D-1",
"PR-D-2",
"custom"
]
],
"display": "hide"
},
"CustomStage": {
"type": "input",
"value": null
"value": "Annihilation",
"display": "hide"
},
"Medicine": {
"type": "input",
"value": null
"value": 0,
"display": "hide"
},
"Stone": {
"type": "input",
"value": null
"value": 0,
"display": "hide"
},
"Times": {
"type": "input",
"value": null
"value": 5,
"display": "hide"
},
"Drops": {
"type": "textarea",
@ -324,15 +329,18 @@
},
"Medicine": {
"type": "input",
"value": null
"value": 0,
"display": "hide"
},
"Stone": {
"type": "input",
"value": null
"value": 0,
"display": "hide"
},
"Times": {
"type": "input",
"value": null
"value": 0,
"display": "hide"
},
"Drops": {
"type": "textarea",

View File

@ -21,7 +21,8 @@ MaaAnnihilation:
Scheduler:
SuccessInterval: 480
MaaFight:
Stage: Annihilation
Stage: custom
CustomStage: Annihilation
Medicine: 0
Stone: 0
Times: 5

View File

@ -111,7 +111,8 @@ class AssistantHandler:
"""
if m in [
self.Message.AllTasksCompleted,
self.Message.TaskChainError
self.Message.TaskChainError,
self.Message.TaskChainStopped
]:
self.signal = m