Skip to content

Commit db7b503

Browse files
support init bgi_config. still need to check ScriptGroup index
1 parent 300f097 commit db7b503

4 files changed

Lines changed: 203 additions & 1 deletion

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"TaskEnabledList": {
3+
"领取邮件": true,
4+
"领取尘歌壶奖励": true,
5+
"自动幽境危战": true,
6+
"自动秘境": true,
7+
"领取每日奖励": true,
8+
"千星": true,
9+
"周常": true
10+
},
11+
"CraftingBenchCountry": "枫丹",
12+
"AdventurersGuildCountry": "枫丹",
13+
"PartyName": "太阳轰鸣",
14+
"DomainName": "山风的荆冕",
15+
"WeeklyDomainEnabled": false,
16+
"DailyRewardPartyName": "",
17+
"MinResinToKeep": 0,
18+
"SundayEverySelectedValue": "0",
19+
"SundayWeeklySelectedValue": "0",
20+
"SereniteaPotTpType": "地图传送",
21+
"SecretTreasureObjects": [
22+
"每天重复",
23+
"须臾树脂"
24+
],
25+
"LeyLineOneDragonMode": false,
26+
"LeyLineRunMonday": true,
27+
"LeyLineRunTuesday": true,
28+
"LeyLineRunWednesday": true,
29+
"LeyLineRunThursday": true,
30+
"LeyLineRunFriday": true,
31+
"LeyLineRunSaturday": true,
32+
"LeyLineRunSunday": true,
33+
"LeyLineMondayType": "",
34+
"LeyLineMondayCountry": "",
35+
"LeyLineTuesdayType": "",
36+
"LeyLineTuesdayCountry": "",
37+
"LeyLineWednesdayType": "",
38+
"LeyLineWednesdayCountry": "",
39+
"LeyLineThursdayType": "",
40+
"LeyLineThursdayCountry": "",
41+
"LeyLineFridayType": "",
42+
"LeyLineFridayCountry": "",
43+
"LeyLineSaturdayType": "",
44+
"LeyLineSaturdayCountry": "",
45+
"LeyLineSundayType": "",
46+
"LeyLineSundayCountry": "",
47+
"LeyLineRunCount": 0,
48+
"LeyLineResinExhaustionMode": false,
49+
"LeyLineOpenModeCountMin": false,
50+
"CompletionAction": "关闭游戏和软件"
51+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"index": 4,
3+
"name": "周常",
4+
"config": {
5+
"pathingConfig": {
6+
"enabled": true,
7+
"autoPickEnabled": true,
8+
"partyName": "",
9+
"isVisitStatueBeforeSwitchParty": false,
10+
"mainAvatarIndex": "",
11+
"guardianAvatarIndex": "",
12+
"guardianElementalSkillSecondInterval": "",
13+
"guardianElementalSkillLongPress": false,
14+
"onlyInTeleportRecover": false,
15+
"jsScriptUseEnabled": true,
16+
"soloTaskUseFightEnabled": true,
17+
"skipDuring": "",
18+
"useGadgetIntervalMs": 0,
19+
"autoSkipEnabled": true,
20+
"autoRunEnabled": true,
21+
"autoEatEnabled": false,
22+
"autoEatConfig": {
23+
"enabled": false,
24+
"showNotification": true,
25+
"checkInterval": 150,
26+
"eatInterval": 1000,
27+
"testFoodName": null,
28+
"defaultAtkBoostingDishName": "炸萝卜丸子",
29+
"defaultAdventurersDishName": null,
30+
"defaultDefBoostingDishName": null
31+
},
32+
"hideOnRepeat": false,
33+
"taskCycleConfig": {
34+
"enable": false,
35+
"boundaryTime": 0,
36+
"isBoundaryTimeBasedOnServerTime": false,
37+
"cycle": 1,
38+
"index": 1
39+
},
40+
"taskCompletionSkipRuleConfig": {
41+
"enable": false,
42+
"skipPolicy": "GroupPhysicalPathSkipPolicy",
43+
"boundaryTime": 4,
44+
"isBoundaryTimeBasedOnServerTime": false,
45+
"lastRunGapSeconds": -1,
46+
"referencePoint": "EndTime"
47+
},
48+
"preExecutionPriorityConfig": {
49+
"enabled": false,
50+
"groupNames": "",
51+
"maxRetryCount": 1
52+
},
53+
"autoFightEnabled": true,
54+
"autoFightConfig": {
55+
"strategyName": "根据队伍自动选择",
56+
"teamNames": "",
57+
"fightFinishDetectEnabled": true,
58+
"actionSchedulerByCd": "",
59+
"onlyPickEliteDropsMode": "Closed",
60+
"finishDetectConfig": {
61+
"battleEndProgressBarColor": "",
62+
"battleEndProgressBarColorTolerance": "",
63+
"fastCheckEnabled": false,
64+
"rotateFindEnemyEnabled": false,
65+
"fastCheckParams": "",
66+
"checkEndDelay": "0.4;钟离,1.4;",
67+
"beforeDetectDelay": "0.4",
68+
"rotaryFactor": 12,
69+
"isFirstCheck": false,
70+
"checkBeforeBurst": false
71+
},
72+
"pickDropsAfterFightEnabled": false,
73+
"pickDropsAfterFightSeconds": 15,
74+
"battleThresholdForLoot": null,
75+
"kazuhaPickupEnabled": true,
76+
"qinDoublePickUp": false,
77+
"guardianAvatar": "",
78+
"guardianCombatSkip": false,
79+
"skipModel": false,
80+
"guardianAvatarHold": false,
81+
"burstEnabled": false,
82+
"kazuhaPartyName": "",
83+
"swimmingEnabled": true,
84+
"expBasedPickupEnabled": false,
85+
"timeout": 120
86+
}
87+
},
88+
"shellConfig": {
89+
"disable": false,
90+
"timeout": 60,
91+
"noWindow": true,
92+
"output": true
93+
},
94+
"enableShellConfig": false
95+
},
96+
"projects": [
97+
{
98+
"name": "全自动周一",
99+
"folderName": "AutoMonday",
100+
"jsScriptSettingsObject": {
101+
"Material": "薄荷",
102+
"chargingMethod": "法器角色充能",
103+
"food": "提瓦特煎蛋",
104+
"cookCount": "20",
105+
"mineral": "锻造水晶块",
106+
"ifCheck": true,
107+
"ifAkf": true,
108+
"TEAMname": "永冻",
109+
"ifCooking": true,
110+
"ifduanZao": true,
111+
"ifShouling": false,
112+
"ifPink": true,
113+
"ifBlue": true,
114+
"BossPartyName": "太阳轰鸣"
115+
},
116+
"index": 1,
117+
"type": "Javascript",
118+
"status": "Enabled",
119+
"schedule": "Daily",
120+
"runNum": 1,
121+
"allowJsNotification": true,
122+
"allowJsHTTPHash": ""
123+
}
124+
]
125+
}

‎src/config/bgi.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def copy_BGI_User():
2626
user_dir = get_BGI_user_dir()
2727
assert user_dir, "未找到BetterGI用户目录"
2828
print(f"[BetterGI] 复制BetterGI配置到: {user_dir}")
29-
shutil.copytree(get_our_bgi_user_dir(), user_dir, dirs_exist_ok=True)
29+
shutil.copytree(get_our_bgi_user_dir(), user_dir, dirs_exist_ok=True,
30+
ignore=shutil.ignore_patterns("OneDragon"))
3031

3132
if __name__ == "__main__":
3233
copy_BGI_User()

‎src/config/set_config.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
3. 拼接根目录 + 相对路径 = config 文件绝对路径
1212
"""
1313

14+
import os
15+
import json
16+
1417
from src.subscript_utils import load_config, save_config
18+
from src.utils import get_our_bgi_user_dir
1519

1620

1721
# ============================================================
@@ -123,6 +127,27 @@ class GenshinConfig(ScriptConfig):
123127
def __init__(self):
124128
self.display_name = "原神"
125129
self._task_key = "DomainName"
130+
self._init_config()
131+
132+
def _init_config(self):
133+
config = self._load()
134+
template_path = os.path.join(get_our_bgi_user_dir(), "OneDragon", "一条龙.json")
135+
assert os.path.exists(template_path), f"[set_config][{self.display_name}] 未找到模板文件: {template_path}"
136+
with open(template_path, 'r', encoding='utf-8') as f:
137+
template = json.load(f)
138+
139+
changed = False
140+
for key, val in template.items():
141+
if key == "PartyName":
142+
# PartyName 可以与模板不同,但不能为空
143+
assert key in config, f"[set_config][{self.display_name}] config 中缺少字段: {key}"
144+
elif key not in config or config[key] != val:
145+
config[key] = val
146+
changed = True
147+
148+
if changed:
149+
print(f"[set_config][{self.display_name}] init config")
150+
self._save(config)
126151

127152

128153
# ---- 终末地 Arknights: Endfield ----

0 commit comments

Comments
 (0)