Fix: Misspelling & Line-end spaces

This commit is contained in:
hgjazhgj 2022-06-25 20:04:45 +08:00
parent 5bae649009
commit e779fd7e64
37 changed files with 79 additions and 83 deletions

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 2},

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
90 90 90 90 90 90 90 10 05 90 90
90 90 90 90 90 25 20 15 90 90 90
90 90 90 40 35 30 90 90 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},

View File

@ -22,7 +22,6 @@ MAP.weight_data = """
20 20 20 10 10 20 20 35
50 90 90 60 60 90 90 90
90 90 90 70 80 90 90 90
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3},

View File

@ -14,7 +14,6 @@ MAP.map_data = '''
++ ++ ++ -- -- -- -- ++ --
MB -- ME ME -- ++ -- ME --
-- ME -- -- SP ++ -- -- --
'''
MAP.weight_data = '''
10 10 10 10 10 10 10 10 10

View File

@ -48,7 +48,7 @@ class OSChapter:
if not isinstance(index, int) or index >= 200:
continue
name = chapter['name']
name = name.replace('é', 'e') # OCR can't recognise letter "é"
name = name.replace('é', 'e') # OCR can't recognize letter "é"
out[index] = name
# Zone 40000 is zone 154

2
gui.py
View File

@ -14,7 +14,7 @@ def func(ev: threading.Event):
if sys.platform.startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
State.researt_event = ev
State.restart_event = ev
parser = argparse.ArgumentParser(description="Alas web service")
parser.add_argument(

View File

@ -18,13 +18,13 @@ OCR_BUILD_SUBMIT_WW_COUNT = Digit(BUILD_SUBMIT_WW_COUNT, letter=(255, 247, 247),
class RewardGacha(GachaUI, GeneralShop, Retirement):
build_cube_count = 0
def gacha_prep(self, target, skip_first_scrrenshot=True):
def gacha_prep(self, target, skip_first_screenshot=True):
"""
Initiate preparation to submit build orders.
Args:
target (int): Number of build orders to submit
skip_first_scrrenshot (bool):
skip_first_screenshot (bool):
Returns:
bool: True if prep complete otherwise False.
@ -51,8 +51,8 @@ class RewardGacha(GachaUI, GeneralShop, Retirement):
ocr_submit = None
index_offset = (60, 20)
while 1:
if skip_first_scrrenshot:
skip_first_scrrenshot = False
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()

View File

@ -55,7 +55,7 @@ class AmbushHandler(Combat):
logger.attr('Ambush_evade', 'failed')
self.combat(expected_end='no_searching', fleet_index=self.fleet_show_index)
else:
logger.warning('Unrecognised info when ambush evade.')
logger.warning('Unrecognized info when ambush evade.')
self.ensure_no_info_bar()
if self.combat_appear():
self.combat(fleet_index=self.fleet_show_index)

View File

@ -207,7 +207,7 @@ class InfoHandler(ModuleBase):
"""
Story
"""
story_popup_timout = Timer(10, count=20)
story_popup_timeout = Timer(10, count=20)
map_has_clear_mode = False # Will be override in fast_forward.py
# Area to detect the options, should include at least 3 options.
@ -255,14 +255,14 @@ class InfoHandler(ModuleBase):
return buttons
def story_skip(self, drop=None):
if self.story_popup_timout.started() and not self.story_popup_timout.reached():
if self.story_popup_timeout.started() and not self.story_popup_timeout.reached():
if self.handle_popup_confirm('STORY_SKIP'):
self.story_popup_timout = Timer(10)
self.story_popup_timeout = Timer(10)
self.interval_reset(STORY_SKIP)
self.interval_reset(STORY_LETTERS_ONLY)
return True
if self.appear(STORY_LETTER_BLACK) and self.appear_then_click(STORY_LETTERS_ONLY, offset=(20, 20), interval=2):
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
if self._story_option_timer.reached() and self.appear(STORY_SKIP, offset=(20, 20), interval=0):
options = self._story_option_buttons()
@ -279,7 +279,7 @@ class InfoHandler(ModuleBase):
select = options[0]
self.device.click(select)
self._story_option_timer.reset()
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
self.interval_reset(STORY_SKIP)
self.interval_reset(STORY_LETTERS_ONLY)
self._story_option_record = 0
@ -292,10 +292,10 @@ class InfoHandler(ModuleBase):
if drop:
drop.handle_add(self, before=2)
self.device.click(STORY_SKIP)
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
if self.appear_then_click(GAME_TIPS, offset=(20, 20), interval=2):
self.story_popup_timout.reset()
self.story_popup_timeout.reset()
return True
return False

View File

@ -61,7 +61,7 @@ class MeowfficerEnhance(MeowfficerBase):
Scan for meowfficers that can be fed
according to the MEOWFFICER_FEED_GRID (4x3)
into target meowfficer for enhancement
Ensure through green check mark apperance
Ensure through green check mark appearance
after click
Pages:

View File

@ -147,7 +147,7 @@ class AlOcr(CnOcr):
"""
:param img: image array with type mx.nd.NDArray or np.ndarray,
with shape [height, width] or [height, width, channel].
channel shoule be 1 (gray image) or 3 (color image).
channel should be 1 (gray image) or 3 (color image).
:return: np.ndarray, with shape (1, height, width)
"""

View File

@ -526,7 +526,7 @@ class OSFleet(OSCamera, Combat, Fleet, OSAsh):
logger.info('Fleet left boss, boss found')
break
# Re-enter boss accidently
# Re-enter boss accidentally
if self.combat_appear():
self.ui_back(check_button=self.is_in_map)

View File

@ -26,7 +26,7 @@ class FleetSelector:
def get(self):
"""
Returns:
int: Index of current fleet, 1 to 4. return 0 if unrecognised.
int: Index of current fleet, 1 to 4. return 0 if unrecognized.
"""
for index, button in enumerate([FLEET_1, FLEET_2, FLEET_3, FLEET_4]):
if self.main.appear(button, offset=(20, 20)):

View File

@ -23,7 +23,7 @@ CARD_RARITY_COLORS = {
class Retirement(Enhancement):
_unable_to_enhance = False
_have_keeped_cv = True
_have_kept_cv = True
def _retirement_choose(self, amount=10, target_rarity=('N',)):
"""
@ -92,7 +92,7 @@ class Retirement(Enhancement):
self.device.click(SHIP_CONFIRM)
continue
if self.appear(SHIP_CONFIRM_2, offset=(30, 30), interval=2):
if self.config.RETIRE_KEEP_COMMON_CV and not self._have_keeped_cv:
if self.config.RETIRE_KEEP_COMMON_CV and not self._have_kept_cv:
self.keep_one_common_cv()
self.device.click(SHIP_CONFIRM_2)
self.interval_clear(GET_ITEMS_1)
@ -154,7 +154,7 @@ class Retirement(Enhancement):
total = 0
if self.config.RETIRE_KEEP_COMMON_CV:
self._have_keeped_cv = False
self._have_kept_cv = False
while 1:
self.handle_info_bar()
@ -217,7 +217,7 @@ class Retirement(Enhancement):
total = 0
if self.config.RETIRE_KEEP_COMMON_CV:
self._have_keeped_cv = False
self._have_kept_cv = False
while amount:
selected = self._retirement_choose(
@ -364,15 +364,15 @@ class Retirement(Enhancement):
Button:
"""
if self.config.GemsFarming_CommonCV == 'any':
for commen_cv_name in ['BOGUE', 'HERMES', 'LANGLEY', 'RANGER']:
template = globals()[f'TEMPLATE_{commen_cv_name}']
for common_cv_name in ['BOGUE', 'HERMES', 'LANGLEY', 'RANGER']:
template = globals()[f'TEMPLATE_{common_cv_name}']
sim, button = template.match_result(
resize(self.device.image, size=(1189, 669)))
if sim > self.config.COMMON_CV_THRESHOLD:
return Button(button=tuple(_ * 155 // 144 for _ in button.button), area=button.area,
color=button.color,
name=f'TEMPLATE_{commen_cv_name}_RETIRE')
name=f'TEMPLATE_{common_cv_name}_RETIRE')
return None
else:
@ -392,4 +392,4 @@ class Retirement(Enhancement):
button = self.retirement_get_common_rarity_cv()
if button is not None:
self._retire_select_one(button, skip_first_screenshot=False)
self._have_keeped_cv = True
self._have_kept_cv = True

View File

@ -113,7 +113,7 @@ class ShopBase(ModuleBase):
Custom steps for variant shop
if needed to ensure shop has
loaded completely
ShopMedal for example will initally
ShopMedal for example will initially
display default items at default prices
Args:

View File

@ -141,7 +141,7 @@ class ShopClerk(ShopBase, Retirement):
click_timer.reset()
# Scan for plus/minus locations; searching within
# offset will update the click posiion automatically
# offset will update the click position automatically
self.device.screenshot()
if self.appear(SELECT_MINUS, offset=select_offset) and self.appear(SELECT_PLUS, offset=select_offset):
break

View File

@ -373,7 +373,7 @@ class AlasGUI(Frame):
self.task_handler.add(switch_scheduler.g(), 1, True)
self.task_handler.add(switch_log_scroll.g(), 1, True)
self.task_handler.add(self.alas_update_overiew_task, 10, True)
self.task_handler.add(self.alas_update_overview_task, 10, True)
self.task_handler.add(log.put_log(self.alas), 0.25, True)
def _alas_thread_wait_config_change(self) -> None:
@ -457,7 +457,7 @@ class AlasGUI(Frame):
invalid.clear()
break
def alas_update_overiew_task(self) -> None:
def alas_update_overview_task(self) -> None:
if not self.visible:
return
self.alas_config.load()
@ -628,10 +628,10 @@ class AlasGUI(Frame):
# ).style(f'--menu-Raise--')
def _force_restart():
if State.researt_event is not None:
if State.restart_event is not None:
toast("Alas will restart in 3 seconds", duration=0, color="error")
clearup()
State.researt_event.set()
State.restart_event.set()
else:
toast("Reload not enabled", color="error")
@ -651,7 +651,7 @@ class AlasGUI(Frame):
self.init_menu(name="Update")
self.set_title(t("Gui.MenuDevelop.Update"))
if State.researt_event is None:
if State.restart_event is None:
put_warning(t("Gui.Update.DisabledWarn"))
put_row(
@ -995,7 +995,7 @@ class AlasGUI(Frame):
status={
True: [
lambda: self.__setattr__("visible", True),
lambda: self.alas_update_overiew_task()
lambda: self.alas_update_overview_task()
if self.page == "Overview"
else 0,
lambda: self.task_handler._task.__setattr__("delay", 15),

View File

@ -16,7 +16,7 @@ class State:
deploy_config = DeployConfig()
config_updater = ConfigUpdater()
researt_event: threading.Event = None
restart_event: threading.Event = None
manager: SyncManager = None
electron: bool = False
theme: str = "default"

View File

@ -117,7 +117,7 @@ class Updater(DeployConfig, GitManager, PipManager):
sha1, _, _, message = self.get_commit(f"..{source}/{self.Branch}")
if sha1:
logger.info(f"New update avaliable")
logger.info(f"New update available")
logger.info(f"{sha1[:8]} - {message}")
return True
else:
@ -191,7 +191,7 @@ class Updater(DeployConfig, GitManager, PipManager):
)
return 0
logger.info(f"Update {sha[:8]} avaliable")
logger.info(f"Update {sha[:8]} available")
return 1
def check_update(self):
@ -258,7 +258,7 @@ class Updater(DeployConfig, GitManager, PipManager):
logger.info("All alas stopped, start updating")
if self.update():
if State.researt_event is not None:
if State.restart_event is not None:
self.state = "reload"
with open("./config/reloadalas", mode="w") as f:
f.writelines(names)
@ -281,7 +281,7 @@ class Updater(DeployConfig, GitManager, PipManager):
# with open("./config/reloadflag", mode="w"):
# # app ended here and uvicorn will restart whole app
# pass
State.researt_event.set()
State.restart_event.set()
timer = threading.Timer(delay, trigger)
timer.start()
@ -300,7 +300,7 @@ class Updater(DeployConfig, GitManager, PipManager):
th._task.delay = get_next_time(self.schedule_time)
yield
continue
if State.researt_event is None:
if State.restart_event is None:
yield
continue
if not self.run_update():