Add: Auto choose latest event of server

This commit is contained in:
LmeSzinc 2020-06-03 23:27:04 +08:00
parent 87127c882a
commit db82f022a9
2 changed files with 14 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import shutil
from gooey import Gooey, GooeyParser from gooey import Gooey, GooeyParser
import module.config.server as server
from alas import AzurLaneAutoScript from alas import AzurLaneAutoScript
from module.config.dictionary import dic_chi_to_eng, dic_eng_to_chi from module.config.dictionary import dic_chi_to_eng, dic_eng_to_chi
from module.logger import logger, pyw_name from module.logger import logger, pyw_name
@ -81,7 +82,10 @@ def main(ini_name=''):
config = update_config_from_template(config, file=config_file) config = update_config_from_template(config, file=config_file)
event_folder = [dic_eng_to_chi.get(f, f) for f in os.listdir('./campaign') if f.startswith('event_')][::-1] event_folder = [f for f in os.listdir('./campaign') if f.startswith('event_') and f.split('_')[-1] == server.server]
event_latest = sorted([f for f in event_folder], reverse=True)[0]
event_folder = [dic_eng_to_chi.get(f, f) for f in event_folder][::-1]
event_latest = dic_eng_to_chi.get(event_latest, event_latest)
saved_config = {} saved_config = {}
for opt, option in config.items(): for opt, option in config.items():
@ -316,7 +320,7 @@ def main(ini_name=''):
# ==========每日活动图三倍PT========== # ==========每日活动图三倍PT==========
event_ab_parser = subs.add_parser('每日活动图三倍PT') event_ab_parser = subs.add_parser('每日活动图三倍PT')
event_name = event_ab_parser.add_argument_group('选择活动', '') event_name = event_ab_parser.add_argument_group('选择活动', '')
event_name.add_argument('--活动名称ab', default=default('--活动名称ab'), choices=event_folder, help='例如 event_20200326_cn') event_name.add_argument('--活动名称ab', default=event_latest, choices=event_folder, help='例如 event_20200326_cn')
# ==========主线图========== # ==========主线图==========
main_parser = subs.add_parser('主线图') main_parser = subs.add_parser('主线图')
@ -339,7 +343,7 @@ def main(ini_name=''):
event.add_argument('--sp地图', default=default('--sp地图'), event.add_argument('--sp地图', default=default('--sp地图'),
choices=['sp1', 'sp2', 'sp3'], choices=['sp1', 'sp2', 'sp3'],
help='例如 sp3') help='例如 sp3')
event.add_argument('--活动名称', default=default('--活动名称'), choices=event_folder, help='例如 event_20200312_cn') event.add_argument('--活动名称', default=event_latest, choices=event_folder, help='例如 event_20200312_cn')
# ==========半自动========== # ==========半自动==========
semi_parser = subs.add_parser('半自动辅助点击') semi_parser = subs.add_parser('半自动辅助点击')

View File

@ -5,6 +5,7 @@ import shutil
from gooey import Gooey, GooeyParser from gooey import Gooey, GooeyParser
import module.config.server as server
from alas import AzurLaneAutoScript from alas import AzurLaneAutoScript
from module.config.dictionary import dic_true_eng_to_eng, dic_eng_to_true_eng from module.config.dictionary import dic_true_eng_to_eng, dic_eng_to_true_eng
from module.logger import logger, pyw_name from module.logger import logger, pyw_name
@ -79,7 +80,10 @@ def main(ini_name=''):
config = update_config_from_template(config, file=config_file) config = update_config_from_template(config, file=config_file)
event_folder = [dic_eng_to_true_eng.get(f, f) for f in os.listdir('./campaign') if f.startswith('event_')][::-1] event_folder = [f for f in os.listdir('./campaign') if f.startswith('event_') and f.split('_')[-1] == server.server]
event_latest = sorted([f for f in event_folder], reverse=True)[0]
event_folder = [dic_eng_to_true_eng.get(f, f) for f in event_folder][::-1]
event_latest = dic_eng_to_true_eng.get(event_latest, event_latest)
saved_config = {} saved_config = {}
for opt, option in config.items(): for opt, option in config.items():
@ -314,7 +318,7 @@ def main(ini_name=''):
# ==========event_daily_ab========== # ==========event_daily_ab==========
event_ab_parser = subs.add_parser('event_daily_bonus') event_ab_parser = subs.add_parser('event_daily_bonus')
event_name = event_ab_parser.add_argument_group('Choose an event', 'bonus for first clear each day') event_name = event_ab_parser.add_argument_group('Choose an event', 'bonus for first clear each day')
event_name.add_argument('--event_name_ab', default=default('--event_name_ab'), choices=event_folder, help='There a dropdown menu with many options') event_name.add_argument('--event_name_ab', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# event_name.add_argument('--enable_hard_bonus', default=default('--enable_hard_bonus'), choices=['yes', 'no'], help='Will enable Daily bonus for Event hard maps') # Trying implement all event maps # event_name.add_argument('--enable_hard_bonus', default=default('--enable_hard_bonus'), choices=['yes', 'no'], help='Will enable Daily bonus for Event hard maps') # Trying implement all event maps
# ==========main========== # ==========main==========
@ -337,7 +341,7 @@ def main(ini_name=''):
event.add_argument('--sp_stage', default=default('--sp_stage'), event.add_argument('--sp_stage', default=default('--sp_stage'),
choices=['sp1', 'sp2', 'sp3'], choices=['sp1', 'sp2', 'sp3'],
help='E.g sp3') help='E.g sp3')
event.add_argument('--event_name', default=default('--event_name'), choices=event_folder, help='There a dropdown menu with many options') event.add_argument('--event_name', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# ==========半自动========== # ==========半自动==========
semi_parser = subs.add_parser('semi_auto') semi_parser = subs.add_parser('semi_auto')