Skip to content

Commit

Permalink
map buy 增加不配置选项
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Apr 24, 2024
1 parent c6af65b commit ddc4c2f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
18 changes: 10 additions & 8 deletions app/setting_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,19 @@ def __initCard(self):
self.tr("上次运行锄大地的时间"),
"fight_timestamp"
)
self.fightAllowMapBuyCard = SwitchSettingCard1(
FIF.BUS,
self.fightAllowMapBuyCard = ComboBoxSettingCard2(
"fight_allow_map_buy",
FIF.GLOBE,
self.tr('购买代币与过期邮包'),
"",
"fight_allow_map_buy"
'',
texts={"不配置": "不配置", "启用": True, "停用": False}
)
self.fightAllowSnackBuyCard = SwitchSettingCard1(
FIF.BUS,
self.fightAllowSnackBuyCard = ComboBoxSettingCard2(
"fight_allow_snack_buy",
FIF.GLOBE,
self.tr('购买秘技零食并合成零食'),
"",
"fight_allow_snack_buy"
'',
texts={"不配置": "不配置", "启用": True, "停用": False}
)
self.fightMainMapCard = ComboBoxSettingCard2(
"fight_main_map",
Expand Down
4 changes: 2 additions & 2 deletions assets/config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ fight_team_enable: false # 是否在锄大地时自动切换队伍。true 开启
fight_team_number: "6" # 自动切换到的队伍编号。
fight_requirements: false # 是否已安装锄大地依赖。true 表示已安装,false 表示未安装或需要重新安装。
fight_timestamp: 0 # 上次运行锄大地的时间戳,用于记录和控制运行频率。
fight_allow_map_buy: false # 购买代币与过期邮包
fight_allow_snack_buy: false # 购买秘技零食并合成零食
fight_allow_map_buy: 不配置 # 购买代币与过期邮包
fight_allow_snack_buy: 不配置 # 购买秘技零食并合成零食
fight_main_map: "0" # 优先星球 {"空间站": "1", "雅利洛": "2", "仙舟": "3", "匹诺康尼": "4"}, "不配置": "0"

# 模拟宇宙配置
Expand Down
9 changes: 6 additions & 3 deletions module/config/fhoe_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ def auto_config():
else:
with open(os.path.join(cfg.fight_path, "config.json"), 'r', encoding='utf-8') as f:
config = json.load(f)
if config['allow_map_buy'] != cfg.fight_allow_map_buy or config['allow_snack_buy'] != cfg.fight_allow_snack_buy or ("0" != cfg.fight_main_map and config['main_map'] != cfg.fight_main_map):
config['allow_map_buy'] = cfg.fight_allow_map_buy
config['allow_snack_buy'] = cfg.fight_allow_snack_buy

if ("不配置" != cfg.fight_allow_map_buy and config['allow_map_buy'] != cfg.fight_allow_map_buy) or ("不配置" != cfg.fight_allow_snack_buy and config['allow_snack_buy'] != cfg.fight_allow_snack_buy) or ("0" != cfg.fight_main_map and config['main_map'] != cfg.fight_main_map):
if cfg.fight_allow_map_buy != "不配置":
config['allow_map_buy'] = cfg.fight_allow_map_buy
if cfg.fight_allow_snack_buy != "不配置":
config['allow_snack_buy'] = cfg.fight_allow_snack_buy
if cfg.fight_main_map != "0":
config['main_map'] = cfg.fight_main_map
with open(os.path.join(cfg.fight_path, "config.json"), 'w', encoding='utf-8') as f:
Expand Down

0 comments on commit ddc4c2f

Please sign in to comment.