This repository has been archived by the owner on May 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
azurlane-auto.py
98 lines (85 loc) · 3.18 KB
/
azurlane-auto.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import argparse
from modules.combat import CombatModule
from modules.commission import CommissionModule
from modules.mission import MissionModule
from util.adb import Adb
from util.config import Config
from util.logger import Logger
from util.stats import Stats
class ALAuto(object):
modules = {
'commissions': None,
'combat': None,
'missions': None
}
def __init__(self, config):
"""Initializes the primary azurlane-auto instance with the passed in
Config instance; creates the Stats instance and resets scheduled sleep
timers.
Args:
config (Config): azurlane-auto Config instance
"""
self.config = config
self.stats = Stats(config)
if self.config.commissions['enabled']:
self.modules['commissions'] = CommissionModule(
self.config, self.stats)
if self.config.combat['enabled']:
self.modules['combat'] = CombatModule(self.config, self.stats)
if self.config.missions['enabled']:
self.modules['missions'] = MissionModule(self.config, self.stats)
self.print_stats_check = True
def run_combat_cycle(self):
"""Method to run the combat cycle.
"""
if self.modules['combat']:
if self.modules['combat'].combat_logic_wrapper():
self.print_stats_check = True
def run_commission_cycle(self):
"""Method to run the expedition cycle.
"""
if self.modules['commissions']:
if self.modules['commissions'].commissions_logic_wrapper():
self.print_stats_check = True
def run_mission_cycle(self):
"""Method to run the mission cycle
"""
if self.modules['missions']:
if self.modules['missions'].mission_logic_wrapper():
self.print_stats_check = True
def print_cycle_stats(self):
"""Method to print the cycle stats"
"""
if self.print_stats_check:
self.stats.print_stats()
self.print_stats_check = False
def run_test(self):
pass
# coords = Utils.find_all('combat_enemy_fleet', 0.88)
# Logger.log_msg(coords)
# exit()
# check run-time args
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config',
metavar=('CONFIG_FILE'),
help='Use the specified configuration file instead ' +
'of the default config.ini')
parser.add_argument('-d', '--debug', nargs=2,
metavar=('IMAGE_FILE', 'SIMILARITY'),
help='Finds the specified image on the screen at ' +
'the specified similarity')
parser.add_argument('--copyright',)
args = parser.parse_args()
# check args, and if none provided, load default config
if args and args.config:
config = Config(args.config)
else:
config = Config('config.ini')
script = ALAuto(config)
Adb.init()
while True:
script.run_test()
script.run_commission_cycle()
script.run_combat_cycle()
script.run_mission_cycle()
script.print_cycle_stats()