Fix: Handle game error none4302 when starting a new guild operation

This commit is contained in:
LmeSzinc 2022-02-12 17:30:08 +08:00
parent f8800d2567
commit 5f3c583c52
4 changed files with 23 additions and 6 deletions

View File

@ -68,9 +68,11 @@ class AzurLaneAutoScript:
self.config.task_call('Restart')
self.device.sleep(10)
return False
except LogisticsRefreshBugHandler as e:
except GameBugError as e:
logger.warning(e)
self.save_error_log()
logger.warning('An error has occurred in Azur Lane game client, Alas is unable to handle')
logger.warning(f'Restarting {self.config.Emulator_PackageName} to fix it')
self.config.task_call('Restart')
self.device.sleep(10)
return False

View File

@ -31,7 +31,9 @@ class GameStuckError(Exception):
pass
class LogisticsRefreshBugHandler(Exception):
class GameBugError(Exception):
# An error has occurred in Azur Lane game client. Alas is unable to handle.
# A restart should fix it.
pass

View File

@ -6,7 +6,7 @@ from module.base.filter import Filter
from module.base.timer import Timer
from module.base.utils import *
from module.combat.assets import GET_ITEMS_1
from module.exception import LogisticsRefreshBugHandler
from module.exception import GameBugError
from module.guild.assets import *
from module.guild.base import GuildBase
from module.logger import logger
@ -338,9 +338,9 @@ class GuildLogistics(GuildBase):
# Restart the game can't fix the problem.
# To fix this, you have to enter guild logistics once, then restart.
# If exchange for 5 times, this bug is considered to be triggered.
logger.warning('Triggered guild logistics refresh bug')
logger.warning('This is a bug in Azur Lane, Alas will close game and wait 600 seconds')
raise LogisticsRefreshBugHandler('Triggered guild logistics refresh bug')
logger.warning(
'Unable to do guild exchange, probably because the timer in game was bugged')
raise GameBugError('Triggered guild logistics refresh bug')
else:
confirm_timer.reset()

View File

@ -3,6 +3,7 @@ from datetime import datetime
from module.base.button import ButtonGrid
from module.base.timer import Timer
from module.base.utils import *
from module.exception import GameBugError
from module.guild.assets import *
from module.guild.base import GuildBase
from module.logger import logger
@ -20,12 +21,23 @@ class GuildOperations(GuildBase):
"""
logger.attr('Guild master/official', self.config.GuildOperation_SelectNewOperation)
confirm_timer = Timer(1.5, count=3).start()
click_count = 0
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
if click_count > 5:
# Info bar showing `none4302`.
# Probably because guild operation has been started by another guild officer already.
# Enter guild page again should fix the issue.
logger.warning(
'Unable to start/join guild operation, '
'probably because guild operation has been started by another guild officer already')
raise GameBugError('Unable to start/join guild operation')
if self._handle_guild_operations_start():
confirm_timer.reset()
continue
@ -47,6 +59,7 @@ class GuildOperations(GuildBase):
confirm_timer.reset()
continue
if self.handle_popup_confirm('JOIN_OPERATION'):
click_count += 1
confirm_timer.reset()
continue
if self.handle_popup_single('FLEET_UPDATED'):