Enhancement: Event 3x bonus moved to Daily

- Now Event_daily_bonus was moved to Daily function
This commit is contained in:
whoamikyo 2020-06-21 18:14:16 -03:00
parent 7fee1898d1
commit e676f0e1b0
7 changed files with 53 additions and 29 deletions

23
alas.py
View File

@ -5,12 +5,11 @@ from datetime import datetime
from module.config.config import AzurLaneConfig
from module.logger import logger, pyw_name, log_file
from module.update import Update
from module.device.device import Device
class AzurLaneAutoScript(Update):
class AzurLaneAutoScript:
def __init__(self, ini_name=''):
if not ini_name:
ini_name = pyw_name
@ -53,20 +52,21 @@ class AzurLaneAutoScript(Update):
print(f'{key} = {value}')
logger.hr('Settings saved')
# self.update_check()
self.update_check()
self.config.config_check()
# def update_check(self):
# from module.update import Update
# ad = Update(self.config)
# if self.config.UPDATE_CHECK:
# ad.get_latest_commit()
def update_check(self):
from module.update import Update
ad = Update(self.config)
if self.config.UPDATE_CHECK:
ad.get_local_commit()
def reward(self):
for key, value in self.config.config['Reward'].items():
print(f'{key} = {value}')
logger.hr('Reward Settings saved')
self.update_check()
self.reward_when_finished()
def emulator(self):
@ -74,7 +74,7 @@ class AzurLaneAutoScript(Update):
print(f'{key} = {value}')
logger.hr('Emulator saved')
# self.update_check()
self.update_check()
from module.handler.login import LoginHandler
az = LoginHandler(self.config, device=self.device)
if az.app_ensure_start():
@ -109,6 +109,11 @@ class AzurLaneAutoScript(Update):
az.run()
az.record_save()
if self.config.ENABLE_EVENT_NAME_AB:
from module.event.campaign_ab import CampaignAB
az = CampaignAB(self.config, device=self.device)
az.run_event_daily()
if self.config.ENABLE_EXERCISE:
from module.exercise.exercise import Exercise
az = Exercise(self.config, device=self.device)

View File

@ -108,6 +108,8 @@ github_token =
enable_daily_mission = yes
enable_hard_campaign = yes
enable_exercise = yes
enable_event_ab = yes
event_name_ab = event_20200326_cn
daily_mission_1 = daily_gun
daily_mission_2 = index_1
daily_mission_4 = index_1
@ -136,10 +138,6 @@ event_stage = d3
sp_stage = sp3
event_name = event_20200326_cn
[Event_daily_ab]
event_name_ab = event_20200326_cn
command = event_daily_ab
[Semi_auto]
command = semi_auto
enable_semi_map_preparation = no

View File

@ -323,10 +323,13 @@ def main(ini_name=''):
exercise.add_argument('--演习低血量确认时长', default=default('--演习低血量确认时长'), help='HP低于阈值后, 过一定时长才会撤退\n推荐 1.0 ~ 3.0')
exercise.add_argument('--演习快速换装', default=default('--演习快速换装'), help='打之前换装备, 打完后卸装备, 不需要就填0\n逗号分割, 例如 3, 1, 0, 1, 1, 0')
# ==========每日活动图三倍PT==========
event_ab_parser = subs.add_parser('每日活动图三倍PT')
event_name = event_ab_parser.add_argument_group('选择活动', '')
event_name.add_argument('--活动名称ab', default=event_latest, choices=event_folder, help='例如 event_20200326_cn')
event_bonus = daily_parser.add_argument_group('Event Daily Bonus', 'bonus for first clear each day')
event_bonus.add_argument('--event_name_ab', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# # ==========每日活动图三倍PT==========
# event_ab_parser = subs.add_parser('每日活动图三倍PT')
# event_name = event_ab_parser.add_argument_group('选择活动', '')
# event_name.add_argument('--活动名称ab', default=event_latest, choices=event_folder, help='例如 event_20200326_cn')
# ==========主线图==========
main_parser = subs.add_parser('主线图')

View File

@ -297,6 +297,7 @@ def main(ini_name=''):
daily.add_argument('--enable_daily_mission', default=default('--enable_daily_mission'), help='If there are records on the day, skip', choices=['yes', 'no'])
daily.add_argument('--enable_hard_campaign', default=default('--enable_hard_campaign'), help='If there are records on the day, skip', choices=['yes', 'no'])
daily.add_argument('--enable_exercise', default=default('--enable_exercise'), help='If there is a record after refreshing, skip', choices=['yes', 'no'])
daily.add_argument('--enable_event_ab', default=default('--enable_event_ab'), help='If there is a record after refreshing, skip', choices=['yes', 'no'])
# 每日设置
daily_task = daily_parser.add_argument_group('Daily settings', 'Does not support submarine daily')
@ -322,10 +323,13 @@ def main(ini_name=''):
exercise.add_argument('--exercise_low_hp_confirm', default=default('--exercise_low_hp_confirm'), help='After HP is below the threshold, it will retreat after a certain period of time \nRecommended 1.0 ~ 3.0')
exercise.add_argument('--exercise_equipment', default=default('--exercise_equipment'), help='Change equipment before playing, unload equipment after playing, do not need to fill in 0 \ncomma, such as 3, 1, 0, 1, 1, 0')
event_bonus = daily_parser.add_argument_group('Event Daily Bonus', 'bonus for first clear each day')
event_bonus.add_argument('--event_name_ab', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# ==========event_daily_ab==========
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.add_argument('--event_name_ab', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# 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.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
# ==========main==========

View File

@ -4,7 +4,7 @@ import os
import shutil
from gooey import Gooey, GooeyParser
import module.config.server as server
from alas import AzurLaneAutoScript
from module.config.dictionary import dic_true_eng_to_eng, dic_eng_to_true_eng
from module.logger import logger, pyw_name
@ -79,7 +79,10 @@ def main(ini_name=''):
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 = {}
for opt, option in config.items():
@ -291,6 +294,7 @@ def main(ini_name=''):
daily.add_argument('--enable_daily_mission', default=default('--enable_daily_mission'), help='If there are records on the day, skip', choices=['yes', 'no'])
daily.add_argument('--enable_hard_campaign', default=default('--enable_hard_campaign'), help='If there are records on the day, skip', choices=['yes', 'no'])
daily.add_argument('--enable_exercise', default=default('--enable_exercise'), help='If there is a record after refreshing, skip', choices=['yes', 'no'])
daily.add_argument('--enable_event_ab', default=default('--enable_event_ab'), help='If there is a record after refreshing, skip', choices=['yes', 'no'])
# 每日设置
daily_task = daily_parser.add_argument_group('Daily settings', 'Does not support submarine daily')
@ -316,10 +320,13 @@ def main(ini_name=''):
exercise.add_argument('--exercise_low_hp_confirm', default=default('--exercise_low_hp_confirm'), help='After HP is below the threshold, it will retreat after a certain period of time \nRecommended 1.0 ~ 3.0')
exercise.add_argument('--exercise_equipment', default=default('--exercise_equipment'), help='Change equipment before playing, unload equipment after playing, do not need to fill in 0 \ncomma, such as 3, 1, 0, 1, 1, 0')
# ==========event_daily_ab==========
event_ab_parser = subs.add_parser('event_daily_ab')
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_bonus = daily_parser.add_argument_group('Event Daily Bonus', 'bonus for first clear each day')
event_bonus.add_argument('--event_name_ab', default=event_latest, choices=event_folder, help='There a dropdown menu with many options')
# # ==========event_daily_ab==========
# event_ab_parser = subs.add_parser('event_daily_ab')
# 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')
# ==========main==========
main_parser = subs.add_parser('main')

View File

@ -24,7 +24,7 @@ class AzurLaneConfig:
UPDATE_CHECK = True
UPDATE_PROXY = ''
GITHUB_TOKEN = 'dd49b498d12c4f0908a91ccc8d54396352fc4740'
GITHUB_TOKEN = ''
SERVER = server.server
logger.attr('Server', SERVER)
@ -134,6 +134,7 @@ class AzurLaneConfig:
EVENT_NAME = ''
CAMPAIGN_EVENT = ''
EVENT_NAME_AB = ''
ENABLE_EVENT_NAME_AB = True
"""
module.combat.emotion
@ -521,6 +522,10 @@ class AzurLaneConfig:
self.LOW_HP_THRESHOLD = float(option['exercise_hp_threshold'])
self.LOW_HP_CONFIRM_WAIT = float(option['exercise_low_hp_confirm'])
self.EXERCISE_FLEET_EQUIPMENT = to_list(option['exercise_equipment'])
# Event bonus
# option = config['Event_daily_ab']
self.ENABLE_EVENT_NAME_AB = to_bool(option['enable_event_ab'])
self.EVENT_NAME_AB = option['event_name_ab']
# Event
option = config['Event']
@ -531,8 +536,8 @@ class AzurLaneConfig:
self.CAMPAIGN_EVENT = option['event_stage']
# Event_daily_ab
option = config['Event_daily_ab']
self.EVENT_NAME_AB = option['event_name_ab']
# option = config['Event_daily_ab']
# self.EVENT_NAME_AB = option['event_name_ab']
# Semi_auto
option = config['Semi_auto']

View File

@ -38,6 +38,7 @@ dic_true_eng_to_eng = {
'c12-4_leveling': 'c124_leveling',
# Argument
'enable_event_ab': 'enable_event_ab',
'github_token': 'github_token',
'update_proxy': 'update_proxy',
'enable_update_check': 'enable_update_check',
@ -232,6 +233,7 @@ dic_chi_to_eng = {
'12-4打大型练级': 'c124_leveling',
# Argument
'enable_event_ab': 'enable_event_ab',
'github_token': 'github_token',
'update_proxy': 'update_proxy',
'启用更新检查': 'enable_update_check',