Skip to content

Commit b0499d7

Browse files
committed
feat(maa): 适配 MAA v6.3.0-beta.1 公测版本
1 parent c9732e0 commit b0499d7

File tree

19 files changed

+648
-497
lines changed

19 files changed

+648
-497
lines changed

app/core/config.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979

8080
class AppConfig(GlobalConfig):
81-
VERSION = "v5.0.3"
81+
VERSION = "v5.0.4-beta.1"
8282

8383
def __init__(self) -> None:
8484
super().__init__()
@@ -144,7 +144,7 @@ async def check_data(self) -> None:
144144
db = sqlite3.connect(self.database_path)
145145
cur = db.cursor()
146146
cur.execute("CREATE TABLE version(v text)")
147-
cur.execute("INSERT INTO version VALUES(?)", ("v1.10",))
147+
cur.execute("INSERT INTO version VALUES(?)", ("v1.11",))
148148
db.commit()
149149
cur.close()
150150
db.close()
@@ -155,7 +155,7 @@ async def check_data(self) -> None:
155155
cur.execute("SELECT * FROM version WHERE True")
156156
version = cur.fetchall()
157157

158-
if version[0][0] != "v1.10":
158+
if version[0][0] != "v1.11":
159159
logger.info(
160160
"数据文件版本更新开始",
161161
)
@@ -422,6 +422,30 @@ async def check_data(self) -> None:
422422
cur.execute("DELETE FROM version WHERE v = ?", ("v1.9",))
423423
cur.execute("INSERT INTO version VALUES(?)", ("v1.10",))
424424
db.commit()
425+
# v1.10-->v1.11
426+
if version[0][0] == "v1.10" or if_streaming:
427+
logger.info(
428+
"数据文件版本更新: v1.10-->v1.11",
429+
)
430+
if_streaming = True
431+
432+
if (Path.cwd() / "config/ScriptConfig.json").exists():
433+
data = (Path.cwd() / "config/ScriptConfig.json").read_text(
434+
encoding="utf-8"
435+
)
436+
data.replace("IfWakeUp", "IfStartUp")
437+
data.replace("IfAutoRoguelike", "IfRoguelike")
438+
data.replace("IfBase", "IfInfrast")
439+
data.replace("IfCombat", "IfFight")
440+
data.replace("IfMission", "IfAward")
441+
data.replace("IfRecruiting", "IfRecruit")
442+
(Path.cwd() / "config/ScriptConfig.json").write_text(
443+
data, encoding="utf-8"
444+
)
445+
446+
cur.execute("DELETE FROM version WHERE v = ?", ("v1.10",))
447+
cur.execute("INSERT INTO version VALUES(?)", ("v1.11",))
448+
db.commit()
425449

426450
cur.close()
427451
db.close()
@@ -1807,26 +1831,16 @@ async def save_maa_log(self, log_path: Path, logs: list, maa_result: str) -> boo
18071831
# 查找所有Fight任务的开始和结束位置
18081832
fight_tasks = []
18091833
for i, line in enumerate(logs):
1810-
if (
1811-
"开始任务: Fight" in line
1812-
or "开始任务: 刷理智" in line
1813-
or "开始任务: 理智作战" in line
1814-
):
1834+
if "开始任务: Fight" in line or "开始任务: 理智作战" in line:
18151835
# 查找对应的任务结束位置
18161836
end_index = -1
18171837
for j in range(i + 1, len(logs)):
1818-
if (
1819-
"完成任务: Fight" in logs[j]
1820-
or "完成任务: 刷理智" in logs[j]
1821-
or "完成任务: 理智作战" in logs[j]
1822-
):
1838+
if "完成任务: Fight" in logs[j] or "完成任务: 理智作战" in logs[j]:
18231839
end_index = j
18241840
break
18251841
# 如果遇到新的Fight任务开始, 则当前任务没有正常结束
18261842
if j < len(logs) and (
1827-
"开始任务: Fight" in logs[j]
1828-
or "开始任务: 刷理智" in logs[j]
1829-
or "开始任务: 理智作战" in logs[j]
1843+
"开始任务: Fight" in logs[j] or "开始任务: 理智作战" in logs[j]
18301844
):
18311845
break
18321846

app/models/config.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -315,23 +315,21 @@ def __init__(self) -> None:
315315
)
316316

317317
## Task ------------------------------------------------------------
318-
## 是否 自动唤醒
319-
self.Task_IfWakeUp = ConfigItem("Task", "IfWakeUp", True, BoolValidator())
320-
## 是否公招
321-
self.Task_IfRecruiting = ConfigItem(
322-
"Task", "IfRecruiting", True, BoolValidator()
323-
)
324-
## 是否基建
325-
self.Task_IfBase = ConfigItem("Task", "IfBase", True, BoolValidator())
326-
## 是否刷图
327-
self.Task_IfCombat = ConfigItem("Task", "IfCombat", True, BoolValidator())
328-
## 是否商店
318+
## 是否自动唤醒
319+
self.Task_IfStartUp = ConfigItem("Task", "IfStartUp", True, BoolValidator())
320+
## 是否理智作战
321+
self.Task_IfFight = ConfigItem("Task", "IfFight", True, BoolValidator())
322+
## 是否基建换班
323+
self.Task_IfInfrast = ConfigItem("Task", "IfInfrast", True, BoolValidator())
324+
## 是否公开招募
325+
self.Task_IfRecruit = ConfigItem("Task", "IfRecruit", True, BoolValidator())
326+
## 是否信用收支
329327
self.Task_IfMall = ConfigItem("Task", "IfMall", True, BoolValidator())
330-
## 是否任务
331-
self.Task_IfMission = ConfigItem("Task", "IfMission", True, BoolValidator())
328+
## 是否领取奖励
329+
self.Task_IfAward = ConfigItem("Task", "IfAward", True, BoolValidator())
332330
## 是否自动肉鸽
333-
self.Task_IfAutoRoguelike = ConfigItem(
334-
"Task", "IfAutoRoguelike", False, BoolValidator()
331+
self.Task_IfRoguelike = ConfigItem(
332+
"Task", "IfRoguelike", False, BoolValidator()
335333
)
336334
## 是否生息演算
337335
self.Task_IfReclamation = ConfigItem(

app/models/schema.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ class MaaUserConfig_Data(BaseModel):
333333

334334

335335
class MaaUserConfig_Task(BaseModel):
336-
IfWakeUp: Optional[bool] = Field(default=None, description="开始唤醒")
337-
IfRecruiting: Optional[bool] = Field(default=None, description="自动公招")
338-
IfBase: Optional[bool] = Field(default=None, description="基建换班")
339-
IfCombat: Optional[bool] = Field(default=None, description="理智作战")
336+
IfStartUp: Optional[bool] = Field(default=None, description="开始唤醒")
337+
IfRecruit: Optional[bool] = Field(default=None, description="自动公招")
338+
IfInfrast: Optional[bool] = Field(default=None, description="基建换班")
339+
IfFight: Optional[bool] = Field(default=None, description="理智作战")
340340
IfMall: Optional[bool] = Field(default=None, description="信用收支")
341-
IfMission: Optional[bool] = Field(default=None, description="领取奖励")
342-
IfAutoRoguelike: Optional[bool] = Field(default=None, description="自动肉鸽")
341+
IfAward: Optional[bool] = Field(default=None, description="领取奖励")
342+
IfRoguelike: Optional[bool] = Field(default=None, description="自动肉鸽")
343343
IfReclamation: Optional[bool] = Field(default=None, description="生息演算")
344344

345345

0 commit comments

Comments
 (0)