Skip to content

Commit

Permalink
Merge pull request #718 from LmeSzinc/master
Browse files Browse the repository at this point in the history
[pull] master from LmeSzinc:master
  • Loading branch information
pull[bot] authored Feb 18, 2025
2 parents 95d65fd + aa12f86 commit 81fe004
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
Binary file added assets/cn/ui/CHANNEL_CHECK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions campaign/event_20240815_cn/campaign_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from module.combat.assets import GET_ITEMS_1
from module.exception import CampaignNameError
from module.logger import logger
from module.ui.page import page_event


class CampaignBase(CampaignBase_):
Expand Down Expand Up @@ -82,3 +83,9 @@ def handle_campaign_ui_additional(self):
self.ensure_no_stage_entrance()
return True
return super().handle_campaign_ui_additional()

def handle_exp_info(self):
# Random background hits EXP_INFO_B
if self.ui_page_appear(page_event):
return False
return super().handle_exp_info()
2 changes: 1 addition & 1 deletion deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ COPY requirements.txt /tmp/requirements.txt

# Initial download of UiAutomator2 is slow outside of China using appetizer mirror, switch to GitHub
RUN apt update \
&& apt install -y git adb libgomp1 \
&& apt install -y git adb libgomp1 openssh-client \
&& git config --global --add safe.directory '*' \
&& pip install -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt \
Expand Down
2 changes: 1 addition & 1 deletion deploy/docker/Dockerfile.cn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib\
deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" \
> /etc/apt/sources.list \
&& apt update \
&& apt install -y git adb libgomp1 \
&& apt install -y git adb libgomp1 openssh-client \
&& git config --global --add safe.directory '*' \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone \
Expand Down
22 changes: 17 additions & 5 deletions module/os/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import inflection

from module.base.timer import Timer
from module.combat_ui.assets import PAUSE
from module.config.utils import get_os_reset_remain
from module.exception import CampaignEnd, GameTooManyClickError, MapWalkError, RequestHumanTakeover, ScriptError
from module.exercise.assets import QUIT_RECONFIRM
Expand Down Expand Up @@ -540,6 +539,7 @@ def interrupt_auto_search(self, skip_first_screenshot=True):
logger.info('Interrupting auto search')
is_loading = False
pause_interval = Timer(0.5, count=1)
in_main_timer = Timer(3, count=6)
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
Expand All @@ -552,24 +552,31 @@ def interrupt_auto_search(self, skip_first_screenshot=True):
self.config.task_stop()

if self.appear_then_click(AUTO_SEARCH_REWARD, offset=(50, 50), interval=3):
self.interval_clear(GOTO_MAIN)
in_main_timer.reset()
continue
if pause_interval.reached():
pause = self.is_combat_executing()
if pause:
self.device.click(pause)
self.interval_reset(MAINTENANCE_ANNOUNCE)
is_loading = False
pause_interval.reset()
in_main_timer.reset()
continue
if self.handle_combat_quit():
self.interval_reset(MAINTENANCE_ANNOUNCE)
pause_interval.reset()
in_main_timer.reset()
continue
if self.appear_then_click(QUIT_RECONFIRM, offset=True, interval=5):
self.interval_reset(MAINTENANCE_ANNOUNCE)
pause_interval.reset()
in_main_timer.reset()
continue

if self.appear_then_click(GOTO_MAIN, offset=(20, 20), interval=3):
in_main_timer.reset()
continue
if self.ui_additional():
continue
Expand All @@ -579,13 +586,18 @@ def interrupt_auto_search(self, skip_first_screenshot=True):
if not is_loading:
if self.is_combat_loading():
is_loading = True
in_main_timer.clear()
continue
if self.handle_battle_status():
continue
if self.handle_exp_info():
continue
# Random background from page_main may trigger EXP_INFO_*, don't check them
if in_main_timer.reached():
logger.info('handle_exp_info')
if self.handle_battle_status():
continue
if self.handle_exp_info():
continue
elif self.is_combat_executing():
is_loading = False
in_main_timer.clear()
continue

def os_auto_search_run(self, drop=None, strategic=False):
Expand Down
1 change: 1 addition & 0 deletions module/ui/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
CAMPAIGN_MENU_GOTO_OS = Button(area={'cn': (355, 439, 501, 506), 'en': (374, 449, 503, 483), 'jp': (383, 442, 508, 507), 'tw': (355, 436, 503, 507)}, color={'cn': (103, 106, 113), 'en': (112, 115, 124), 'jp': (68, 72, 82), 'tw': (101, 104, 112)}, button={'cn': (543, 345, 967, 552), 'en': (543, 345, 967, 552), 'jp': (543, 345, 967, 552), 'tw': (543, 345, 967, 552)}, file={'cn': './assets/cn/ui/CAMPAIGN_MENU_GOTO_OS.png', 'en': './assets/en/ui/CAMPAIGN_MENU_GOTO_OS.png', 'jp': './assets/jp/ui/CAMPAIGN_MENU_GOTO_OS.png', 'tw': './assets/tw/ui/CAMPAIGN_MENU_GOTO_OS.png'})
CAMPAIGN_MENU_GOTO_WAR_ARCHIVES = Button(area={'cn': (210, 586, 310, 638), 'en': (222, 590, 308, 634), 'jp': (196, 591, 307, 632), 'tw': (211, 584, 311, 638)}, color={'cn': (62, 65, 66), 'en': (53, 55, 54), 'jp': (78, 80, 81), 'tw': (64, 67, 69)}, button={'cn': (210, 586, 310, 638), 'en': (222, 590, 308, 634), 'jp': (196, 591, 307, 632), 'tw': (211, 584, 311, 638)}, file={'cn': './assets/cn/ui/CAMPAIGN_MENU_GOTO_WAR_ARCHIVES.png', 'en': './assets/en/ui/CAMPAIGN_MENU_GOTO_WAR_ARCHIVES.png', 'jp': './assets/jp/ui/CAMPAIGN_MENU_GOTO_WAR_ARCHIVES.png', 'tw': './assets/tw/ui/CAMPAIGN_MENU_GOTO_WAR_ARCHIVES.png'})
CAMPAIGN_MENU_NO_EVENT = Button(area={'cn': (681, 204, 831, 233), 'en': (616, 206, 897, 233), 'jp': (575, 209, 940, 235), 'tw': (681, 204, 831, 233)}, color={'cn': (65, 75, 84), 'en': (57, 67, 77), 'jp': (49, 60, 70), 'tw': (65, 75, 84)}, button={'cn': (681, 204, 831, 233), 'en': (616, 206, 897, 233), 'jp': (575, 209, 940, 235), 'tw': (681, 204, 831, 233)}, file={'cn': './assets/cn/ui/CAMPAIGN_MENU_NO_EVENT.png', 'en': './assets/en/ui/CAMPAIGN_MENU_NO_EVENT.png', 'jp': './assets/jp/ui/CAMPAIGN_MENU_NO_EVENT.png', 'tw': './assets/cn/ui/CAMPAIGN_MENU_NO_EVENT.png'})
CHANNEL_CHECK = Button(area={'cn': (785, 661, 824, 699), 'en': (785, 661, 824, 699), 'jp': (785, 661, 824, 699), 'tw': (785, 661, 824, 699)}, color={'cn': (88, 90, 89), 'en': (88, 90, 89), 'jp': (88, 90, 89), 'tw': (88, 90, 89)}, button={'cn': (785, 661, 824, 699), 'en': (785, 661, 824, 699), 'jp': (785, 661, 824, 699), 'tw': (785, 661, 824, 699)}, file={'cn': './assets/cn/ui/CHANNEL_CHECK.png', 'en': './assets/cn/ui/CHANNEL_CHECK.png', 'jp': './assets/cn/ui/CHANNEL_CHECK.png', 'tw': './assets/cn/ui/CHANNEL_CHECK.png'})
COALITION_CHECK = Button(area={'cn': (118, 14, 227, 39), 'en': (118, 16, 221, 36), 'jp': (118, 14, 227, 39), 'tw': (118, 14, 227, 39)}, color={'cn': (145, 161, 200), 'en': (116, 130, 168), 'jp': (150, 166, 204), 'tw': (152, 168, 206)}, button={'cn': (118, 14, 227, 39), 'en': (118, 16, 221, 36), 'jp': (118, 14, 227, 39), 'tw': (118, 14, 227, 39)}, file={'cn': './assets/cn/ui/COALITION_CHECK.png', 'en': './assets/en/ui/COALITION_CHECK.png', 'jp': './assets/jp/ui/COALITION_CHECK.png', 'tw': './assets/tw/ui/COALITION_CHECK.png'})
COMMISSION_CHECK = Button(area={'cn': (122, 16, 175, 39), 'en': (120, 14, 301, 41), 'jp': (121, 14, 176, 39), 'tw': (121, 14, 176, 41)}, color={'cn': (157, 173, 210), 'en': (98, 112, 150), 'jp': (159, 175, 211), 'tw': (141, 155, 193)}, button={'cn': (122, 16, 175, 39), 'en': (120, 14, 301, 41), 'jp': (121, 14, 176, 39), 'tw': (121, 14, 176, 41)}, file={'cn': './assets/cn/ui/COMMISSION_CHECK.png', 'en': './assets/en/ui/COMMISSION_CHECK.png', 'jp': './assets/jp/ui/COMMISSION_CHECK.png', 'tw': './assets/tw/ui/COMMISSION_CHECK.png'})
DAILY_CHECK = Button(area={'cn': (23, 656, 67, 698), 'en': (23, 656, 67, 698), 'jp': (23, 656, 67, 698), 'tw': (23, 656, 67, 698)}, color={'cn': (84, 139, 210), 'en': (84, 139, 210), 'jp': (84, 139, 210), 'tw': (84, 139, 210)}, button={'cn': (23, 656, 67, 698), 'en': (23, 656, 67, 698), 'jp': (23, 656, 67, 698), 'tw': (23, 656, 67, 698)}, file={'cn': './assets/cn/ui/DAILY_CHECK.png', 'en': './assets/en/ui/DAILY_CHECK.png', 'jp': './assets/jp/ui/DAILY_CHECK.png', 'tw': './assets/tw/ui/DAILY_CHECK.png'})
Expand Down
6 changes: 6 additions & 0 deletions module/ui/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ def link(self, button, destination):
# Mail enter varies from different UI
page_main_white.link(button=MAIL_ENTER_WHITE, destination=page_mail)

# World channel
# Both old and new UI have CHANNEL_CHECK
# Click somewhere left to leave
page_channel = Page(CHANNEL_CHECK)
page_channel.link(button=CAMPAIGN_MENU_GOTO_CAMPAIGN, destination=page_main)

# RPG event (raid_20240328)
page_rpg_stage = Page(RPG_GOTO_STORY)
page_rpg_story = Page(RPG_GOTO_STAGE)
Expand Down

0 comments on commit 81fe004

Please sign in to comment.