Compare commits
2 Commits
e5f91e0c0a
...
55b4dc9748
| Author | SHA1 | Date | |
|---|---|---|---|
| 55b4dc9748 | |||
| e6a3b79733 |
|
Before Width: | Height: | Size: 10 KiB |
BIN
assets/jp/base/page/EVENT_CHECK.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
assets/jp/base/page/WORK_GO_TO_EVENT.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/jp/base/popup/LEVEL_UP.BUTTON.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
assets/jp/base/popup/LOCATION_LEVEL_UP.BUTTON.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
assets/jp/base/popup/LOCATION_LEVEL_UP.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/base/popup/QUIT.BUTTON.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
assets/jp/base/popup/QUIT.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
assets/jp/login/OCR_YEAR.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
assets/jp/mission/CHECK_COMMISSIONS.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/jp/mission/CHECK_CR.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/jp/mission/CHECK_MISSION_SWEEP.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
assets/jp/mission/CHECK_XP.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
assets/jp/mission/EVENT_INDEX.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
assets/jp/mission/EVENT_ITEM.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
assets/jp/mission/EVENT_LIST.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
BIN
assets/jp/mission/EVENT_STARS.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
assets/jp/mission/HARD_OFF.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/mission/HARD_ON.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
assets/jp/mission/LEFT.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/jp/mission/NORMAL_OFF.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
assets/jp/mission/NORMAL_ON.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
assets/jp/mission/OCR_AREA.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
assets/jp/mission/QUEST_OFF.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/jp/mission/QUEST_ON.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
assets/jp/mission/RIGHT.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
assets/jp/mission/SELECT_CR.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/jp/mission/SELECT_XP.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/jp/momotalk/BEGIN_STORY.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/jp/momotalk/CHATTING.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/jp/momotalk/CHAT_AREA.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
assets/jp/momotalk/CONFIRM_SKIP.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/jp/momotalk/CONFIRM_SORT.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/jp/momotalk/FIRST_UNREAD.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/jp/momotalk/MENU.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
assets/jp/momotalk/NOTIFICATION_BADGE.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
assets/jp/momotalk/REPLY.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
assets/jp/momotalk/SELECT_STUDENT.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/jp/momotalk/SKIP.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/jp/momotalk/SORT_ASCENDING.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/jp/momotalk/SORT_DESCENDING.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
assets/jp/momotalk/STORY.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/jp/momotalk/SWITCH_MESSAGE.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
assets/jp/momotalk/SWITCH_MESSAGE_CHECK.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
assets/jp/momotalk/SWITCH_STUDENT.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
assets/jp/momotalk/SWITCH_STUDENT_CHECK.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/momotalk/UNREAD.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
assets/jp/momotalk/UNREAD_OFF.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/momotalk/UNREAD_ON.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/schedule/CONFIRM.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/jp/schedule/FIRST_ITEM.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
assets/jp/schedule/LOCATIONS.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
assets/jp/schedule/LOCATIONS_POPUP.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/jp/schedule/OCR_TICKET.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 312 KiB After Width: | Height: | Size: 313 KiB |
BIN
assets/jp/schedule/START_LESSON.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/jp/shop/CONFIRM_PURCHASE.BUTTON.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/jp/shop/CONFIRM_PURCHASE.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
assets/jp/shop/CONFIRM_REFRESH.BUTTON.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/jp/shop/CONFIRM_REFRESH.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
assets/jp/shop/ITEM_LIST.png
Normal file
|
After Width: | Height: | Size: 270 KiB |
BIN
assets/jp/shop/NORMAL_OFF.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
assets/jp/shop/NORMAL_ON.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
assets/jp/shop/OCR_REFRESH.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
assets/jp/shop/PURCHASE.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
assets/jp/shop/REFRESH.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
assets/jp/shop/TC_OFF.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/jp/shop/TC_ON.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
assets/jp/task/COMPLETE.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
@ -159,7 +159,13 @@ CRAFTING_CHECK = ButtonWrapper(
|
||||
)
|
||||
EVENT_CHECK = ButtonWrapper(
|
||||
name='EVENT_CHECK',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/base/page/EVENT_CHECK.png',
|
||||
area=(107, 11, 210, 37),
|
||||
search=(87, 0, 230, 57),
|
||||
color=(204, 211, 218),
|
||||
button=(107, 11, 210, 37),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/base/page/EVENT_CHECK.png',
|
||||
area=(102, 6, 187, 40),
|
||||
@ -629,7 +635,13 @@ WORK_GO_TO_COMMISSIONS = ButtonWrapper(
|
||||
)
|
||||
WORK_GO_TO_EVENT = ButtonWrapper(
|
||||
name='WORK_GO_TO_EVENT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/base/page/WORK_GO_TO_EVENT.png',
|
||||
area=(63, 131, 142, 205),
|
||||
search=(43, 111, 162, 225),
|
||||
color=(122, 127, 129),
|
||||
button=(63, 131, 142, 205),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/base/page/WORK_GO_TO_EVENT.png',
|
||||
area=(67, 131, 142, 201),
|
||||
|
||||
@ -179,7 +179,13 @@ ITEM_EXPIRED = ButtonWrapper(
|
||||
)
|
||||
LEVEL_UP = ButtonWrapper(
|
||||
name='LEVEL_UP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/base/popup/LEVEL_UP.png',
|
||||
area=(722, 210, 746, 238),
|
||||
search=(702, 190, 766, 258),
|
||||
color=(184, 202, 219),
|
||||
button=(571, 559, 713, 601),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/base/popup/LEVEL_UP.png',
|
||||
area=(722, 210, 746, 238),
|
||||
@ -197,7 +203,13 @@ LEVEL_UP = ButtonWrapper(
|
||||
)
|
||||
LOCATION_LEVEL_UP = ButtonWrapper(
|
||||
name='LOCATION_LEVEL_UP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/base/popup/LOCATION_LEVEL_UP.png',
|
||||
area=(430, 141, 463, 180),
|
||||
search=(410, 121, 483, 200),
|
||||
color=(177, 194, 207),
|
||||
button=(577, 616, 707, 647),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/base/popup/LOCATION_LEVEL_UP.png',
|
||||
area=(430, 141, 463, 180),
|
||||
@ -263,7 +275,13 @@ NETWORK_RECONNECT_OK = ButtonWrapper(
|
||||
)
|
||||
QUIT = ButtonWrapper(
|
||||
name='QUIT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/base/popup/QUIT.png',
|
||||
area=(497, 313, 779, 353),
|
||||
search=(477, 293, 799, 373),
|
||||
color=(210, 210, 210),
|
||||
button=(442, 487, 592, 521),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/base/popup/QUIT.png',
|
||||
area=(587, 309, 688, 357),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from module.base.base import ModuleBase
|
||||
from module.base.timer import Timer
|
||||
from tasks.base.assets.assets_base_popup import *
|
||||
from tasks.base.assets.assets_base_page import LOADING_CHECK
|
||||
from tasks.base.assets.assets_base_popup import *
|
||||
|
||||
|
||||
class PopupHandler(ModuleBase):
|
||||
@ -111,16 +111,15 @@ class PopupHandler(ModuleBase):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def handle_level_up(self, interval=5) -> bool:
|
||||
if self.appear_then_click(LEVEL_UP, interval=interval):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def handle_quit(self, interval=5) -> bool:
|
||||
if self.appear_then_click(QUIT, interval=interval):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@ -5,10 +5,10 @@ from module.base.utils import get_color
|
||||
from module.exception import GameNotRunningError, GamePageUnknownError, RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Ocr, Digit
|
||||
from tasks.base.assets.assets_base_page import BACK
|
||||
from tasks.base.main_page import MainPage
|
||||
from tasks.base.page import Page, page_main
|
||||
from tasks.login.assets.assets_login import LOGIN_LOADING, OCR_YEAR
|
||||
from tasks.base.assets.assets_base_page import BACK
|
||||
|
||||
|
||||
class UI(MainPage):
|
||||
@ -24,7 +24,7 @@ class UI(MainPage):
|
||||
def appear_trademark_year(self):
|
||||
ocr_year = Digit(OCR_YEAR).ocr_single_line(self.device.image)
|
||||
return ocr_year == 2021
|
||||
|
||||
|
||||
def ui_page_appear(self, page):
|
||||
"""
|
||||
Args:
|
||||
@ -132,7 +132,7 @@ class UI(MainPage):
|
||||
self.interval_clear(list(Page.iter_check_buttons()))
|
||||
|
||||
# loading_timer = Timer(0.5)
|
||||
back_timer = Timer(15,15)
|
||||
back_timer = Timer(15, 15)
|
||||
logger.hr(f"UI goto {destination}")
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
@ -190,7 +190,6 @@ class UI(MainPage):
|
||||
self.device.back()
|
||||
logger.info("Unknown page, try to back")
|
||||
back_timer.reset()
|
||||
|
||||
|
||||
# Reset connection
|
||||
Page.clear_connection()
|
||||
@ -388,11 +387,11 @@ class UI(MainPage):
|
||||
return True
|
||||
# disabled because will exit the game if quit appears
|
||||
|
||||
#if self.handle_ap_exceed():
|
||||
# if self.handle_ap_exceed():
|
||||
# return True
|
||||
#if self.handle_insufficient_inventory():
|
||||
# if self.handle_insufficient_inventory():
|
||||
# return True
|
||||
#if self.handle_item_expired():
|
||||
# if self.handle_item_expired():
|
||||
# return True
|
||||
|
||||
return False
|
||||
@ -458,4 +457,4 @@ class UI(MainPage):
|
||||
logger.error("Failed to close popup")
|
||||
raise RequestHumanTakeover
|
||||
while not wait.reached():
|
||||
pass
|
||||
pass
|
||||
|
||||
@ -53,7 +53,13 @@ LOGIN_LOADING = ButtonWrapper(
|
||||
)
|
||||
OCR_YEAR = ButtonWrapper(
|
||||
name='OCR_YEAR',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/login/OCR_YEAR.png',
|
||||
area=(377, 689, 414, 701),
|
||||
search=(357, 669, 434, 720),
|
||||
color=(160, 157, 158),
|
||||
button=(377, 689, 414, 701),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/login/OCR_YEAR.png',
|
||||
area=(377, 689, 414, 701),
|
||||
@ -72,13 +78,7 @@ OCR_YEAR = ButtonWrapper(
|
||||
SURVEY = ButtonWrapper(
|
||||
name='SURVEY',
|
||||
jp=None,
|
||||
en=Button(
|
||||
file='./assets/en/login/SURVEY.png',
|
||||
area=(946, 269, 994, 307),
|
||||
search=(926, 249, 1014, 327),
|
||||
color=(211, 223, 166),
|
||||
button=(1199, 6, 1264, 75),
|
||||
),
|
||||
en=None,
|
||||
zht=Button(
|
||||
file='./assets/zht/login/SURVEY.png',
|
||||
area=(946, 269, 994, 307),
|
||||
|
||||
@ -18,6 +18,7 @@ class Login(UI):
|
||||
GameTooManyClickError:
|
||||
GameNotRunningError:
|
||||
"""
|
||||
|
||||
def _page_main_twice_confirm():
|
||||
if self.ui_page_appear(page_main):
|
||||
timer = Timer(1).start()
|
||||
|
||||
@ -5,7 +5,13 @@ from module.base.button import Button, ButtonWrapper
|
||||
|
||||
CHECK_COMMISSIONS = ButtonWrapper(
|
||||
name='CHECK_COMMISSIONS',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/CHECK_COMMISSIONS.png',
|
||||
area=(654, 93, 881, 128),
|
||||
search=(634, 73, 901, 148),
|
||||
color=(108, 129, 151),
|
||||
button=(654, 93, 881, 128),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/CHECK_COMMISSIONS.png',
|
||||
area=(646, 78, 909, 135),
|
||||
@ -23,7 +29,13 @@ CHECK_COMMISSIONS = ButtonWrapper(
|
||||
)
|
||||
CHECK_CR = ButtonWrapper(
|
||||
name='CHECK_CR',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/CHECK_CR.png',
|
||||
area=(108, 147, 313, 180),
|
||||
search=(88, 127, 333, 200),
|
||||
color=(195, 201, 205),
|
||||
button=(108, 147, 313, 180),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/CHECK_CR.png',
|
||||
area=(97, 137, 340, 191),
|
||||
@ -41,7 +53,13 @@ CHECK_CR = ButtonWrapper(
|
||||
)
|
||||
CHECK_MISSION_SWEEP = ButtonWrapper(
|
||||
name='CHECK_MISSION_SWEEP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/CHECK_MISSION_SWEEP.png',
|
||||
area=(637, 188, 722, 213),
|
||||
search=(617, 168, 742, 233),
|
||||
color=(169, 180, 193),
|
||||
button=(637, 188, 722, 213),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/CHECK_MISSION_SWEEP.png',
|
||||
area=(654, 184, 703, 209),
|
||||
@ -59,7 +77,13 @@ CHECK_MISSION_SWEEP = ButtonWrapper(
|
||||
)
|
||||
CHECK_XP = ButtonWrapper(
|
||||
name='CHECK_XP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/CHECK_XP.png',
|
||||
area=(106, 147, 225, 180),
|
||||
search=(86, 127, 245, 200),
|
||||
color=(167, 172, 176),
|
||||
button=(106, 147, 225, 180),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/CHECK_XP.png',
|
||||
area=(94, 135, 325, 194),
|
||||
@ -77,7 +101,13 @@ CHECK_XP = ButtonWrapper(
|
||||
)
|
||||
EVENT_INDEX = ButtonWrapper(
|
||||
name='EVENT_INDEX',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/EVENT_INDEX.png',
|
||||
area=(704, 135, 761, 694),
|
||||
search=(684, 115, 781, 714),
|
||||
color=(189, 197, 195),
|
||||
button=(704, 135, 761, 694),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/EVENT_INDEX.png',
|
||||
area=(704, 135, 761, 694),
|
||||
@ -95,7 +125,13 @@ EVENT_INDEX = ButtonWrapper(
|
||||
)
|
||||
EVENT_ITEM = ButtonWrapper(
|
||||
name='EVENT_ITEM',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/EVENT_ITEM.png',
|
||||
area=(691, 136, 1198, 232),
|
||||
search=(671, 116, 1218, 252),
|
||||
color=(201, 219, 224),
|
||||
button=(691, 136, 1198, 232),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/EVENT_ITEM.png',
|
||||
area=(691, 136, 1198, 232),
|
||||
@ -113,7 +149,13 @@ EVENT_ITEM = ButtonWrapper(
|
||||
)
|
||||
EVENT_LIST = ButtonWrapper(
|
||||
name='EVENT_LIST',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/EVENT_LIST.png',
|
||||
area=(695, 137, 1196, 688),
|
||||
search=(675, 117, 1216, 708),
|
||||
color=(171, 185, 190),
|
||||
button=(695, 137, 1196, 688),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/EVENT_LIST.png',
|
||||
area=(695, 137, 1196, 688),
|
||||
@ -131,7 +173,13 @@ EVENT_LIST = ButtonWrapper(
|
||||
)
|
||||
EVENT_STARS = ButtonWrapper(
|
||||
name='EVENT_STARS',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/EVENT_STARS.png',
|
||||
area=(704, 186, 761, 218),
|
||||
search=(684, 166, 781, 238),
|
||||
color=(228, 223, 194),
|
||||
button=(704, 186, 761, 218),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/EVENT_STARS.png',
|
||||
area=(704, 186, 761, 218),
|
||||
@ -149,7 +197,13 @@ EVENT_STARS = ButtonWrapper(
|
||||
)
|
||||
HARD_OFF = ButtonWrapper(
|
||||
name='HARD_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/HARD_OFF.png',
|
||||
area=(1034, 144, 1095, 172),
|
||||
search=(1014, 124, 1115, 192),
|
||||
color=(204, 211, 218),
|
||||
button=(1034, 144, 1095, 172),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/HARD_OFF.png',
|
||||
area=(947, 132, 1193, 182),
|
||||
@ -167,7 +221,13 @@ HARD_OFF = ButtonWrapper(
|
||||
)
|
||||
HARD_ON = ButtonWrapper(
|
||||
name='HARD_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/HARD_ON.png',
|
||||
area=(1032, 143, 1095, 172),
|
||||
search=(1012, 123, 1115, 192),
|
||||
color=(211, 104, 54),
|
||||
button=(1032, 143, 1095, 172),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/HARD_ON.png',
|
||||
area=(940, 133, 1189, 186),
|
||||
@ -185,7 +245,13 @@ HARD_ON = ButtonWrapper(
|
||||
)
|
||||
LEFT = ButtonWrapper(
|
||||
name='LEFT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/LEFT.png',
|
||||
area=(0, 301, 89, 408),
|
||||
search=(0, 281, 109, 428),
|
||||
color=(193, 224, 241),
|
||||
button=(0, 301, 89, 408),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/LEFT.png',
|
||||
area=(0, 301, 89, 408),
|
||||
@ -203,7 +269,13 @@ LEFT = ButtonWrapper(
|
||||
)
|
||||
NORMAL_OFF = ButtonWrapper(
|
||||
name='NORMAL_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/NORMAL_OFF.png',
|
||||
area=(759, 146, 847, 171),
|
||||
search=(739, 126, 867, 191),
|
||||
color=(197, 205, 214),
|
||||
button=(759, 146, 847, 171),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/NORMAL_OFF.png',
|
||||
area=(682, 135, 927, 182),
|
||||
@ -221,7 +293,13 @@ NORMAL_OFF = ButtonWrapper(
|
||||
)
|
||||
NORMAL_ON = ButtonWrapper(
|
||||
name='NORMAL_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/NORMAL_ON.png',
|
||||
area=(759, 145, 845, 172),
|
||||
search=(739, 125, 865, 192),
|
||||
color=(107, 115, 72),
|
||||
button=(759, 145, 845, 172),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/NORMAL_ON.png',
|
||||
area=(682, 137, 924, 185),
|
||||
@ -239,7 +317,13 @@ NORMAL_ON = ButtonWrapper(
|
||||
)
|
||||
OCR_AREA = ButtonWrapper(
|
||||
name='OCR_AREA',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/OCR_AREA.png',
|
||||
area=(111, 178, 174, 212),
|
||||
search=(91, 158, 194, 232),
|
||||
color=(218, 222, 227),
|
||||
button=(111, 178, 174, 212),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/OCR_AREA.png',
|
||||
area=(108, 176, 176, 219),
|
||||
@ -257,7 +341,13 @@ OCR_AREA = ButtonWrapper(
|
||||
)
|
||||
QUEST_OFF = ButtonWrapper(
|
||||
name='QUEST_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/QUEST_OFF.png',
|
||||
area=(903, 80, 989, 115),
|
||||
search=(883, 60, 1009, 135),
|
||||
color=(212, 217, 221),
|
||||
button=(903, 80, 989, 115),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/QUEST_OFF.png',
|
||||
area=(859, 69, 1025, 125),
|
||||
@ -275,7 +365,13 @@ QUEST_OFF = ButtonWrapper(
|
||||
)
|
||||
QUEST_ON = ButtonWrapper(
|
||||
name='QUEST_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/QUEST_ON.png',
|
||||
area=(903, 82, 987, 113),
|
||||
search=(883, 62, 1007, 133),
|
||||
color=(84, 93, 69),
|
||||
button=(903, 82, 987, 113),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/QUEST_ON.png',
|
||||
area=(861, 71, 1025, 124),
|
||||
@ -293,7 +389,13 @@ QUEST_ON = ButtonWrapper(
|
||||
)
|
||||
RIGHT = ButtonWrapper(
|
||||
name='RIGHT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/RIGHT.png',
|
||||
area=(1202, 311, 1280, 412),
|
||||
search=(1182, 291, 1280, 432),
|
||||
color=(193, 223, 241),
|
||||
button=(1202, 311, 1280, 412),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/RIGHT.png',
|
||||
area=(1202, 311, 1280, 412),
|
||||
@ -311,7 +413,13 @@ RIGHT = ButtonWrapper(
|
||||
)
|
||||
SELECT_CR = ButtonWrapper(
|
||||
name='SELECT_CR',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/SELECT_CR.png',
|
||||
area=(1009, 271, 1226, 312),
|
||||
search=(989, 251, 1246, 332),
|
||||
color=(207, 213, 221),
|
||||
button=(1009, 271, 1226, 312),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/SELECT_CR.png',
|
||||
area=(1004, 267, 1237, 321),
|
||||
@ -329,7 +437,13 @@ SELECT_CR = ButtonWrapper(
|
||||
)
|
||||
SELECT_XP = ButtonWrapper(
|
||||
name='SELECT_XP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/mission/SELECT_XP.png',
|
||||
area=(1095, 166, 1224, 205),
|
||||
search=(1075, 146, 1244, 225),
|
||||
color=(175, 185, 198),
|
||||
button=(1095, 166, 1224, 205),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/mission/SELECT_XP.png',
|
||||
area=(1016, 165, 1227, 211),
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
from enum import Enum
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from tasks.mission.ui import MissionUI, CommissionsUI, SWITCH_QUEST
|
||||
from tasks.stage.ap import AP
|
||||
from tasks.cafe.cafe import Cafe
|
||||
from tasks.circle.circle import Circle
|
||||
from tasks.task.task import Task
|
||||
from tasks.mail.mail import Mail
|
||||
from tasks.item.data_update import DataUpdate
|
||||
import json
|
||||
import math
|
||||
from filelock import FileLock
|
||||
from datetime import datetime, timedelta
|
||||
from enum import Enum
|
||||
|
||||
from filelock import FileLock
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from tasks.cafe.cafe import Cafe
|
||||
from tasks.circle.circle import Circle
|
||||
from tasks.item.data_update import DataUpdate
|
||||
from tasks.mail.mail import Mail
|
||||
from tasks.mission.ui import MissionUI, CommissionsUI, SWITCH_QUEST
|
||||
from tasks.task.task import Task
|
||||
|
||||
|
||||
class MissionStatus(Enum):
|
||||
AP = 0 # Calculate AP and decide to terminate Mission module or not
|
||||
NAVIGATE = 1 # Navigate to the stage page for example the commissions page or mission page
|
||||
SELECT = 2 # Select the stage mode for example hard or normal in mission
|
||||
ENTER = 3 # Search and for the stage in the stage list and enter
|
||||
SWEEP = 4 # Sweep the stage
|
||||
RECHARGE = 5 # Recharge AP from other taks if they are enabled
|
||||
FINISH = -1 # Inidicate termination of Mission module
|
||||
AP = 0 # Calculate AP and decide to terminate Mission module or not
|
||||
NAVIGATE = 1 # Navigate to the stage page for example the commissions page or mission page
|
||||
SELECT = 2 # Select the stage mode for example hard or normal in mission
|
||||
ENTER = 3 # Search and for the stage in the stage list and enter
|
||||
SWEEP = 4 # Sweep the stage
|
||||
RECHARGE = 5 # Recharge AP from other taks if they are enabled
|
||||
FINISH = -1 # Inidicate termination of Mission module
|
||||
|
||||
|
||||
class Mission(MissionUI, CommissionsUI):
|
||||
@ -84,7 +84,7 @@ class Mission(MissionUI, CommissionsUI):
|
||||
logger.error("Failed to read configuration file")
|
||||
finally:
|
||||
return queue
|
||||
|
||||
|
||||
def check_reset_daily(self):
|
||||
# Check if it's time to reset the queue
|
||||
if self.reset_daily:
|
||||
@ -110,13 +110,13 @@ class Mission(MissionUI, CommissionsUI):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@property
|
||||
def valid_task(self) -> list:
|
||||
task = self.mission_info
|
||||
if not task:
|
||||
logger.warning('Mission enabled but no task set')
|
||||
#self.error_handler()
|
||||
# self.error_handler()
|
||||
return task
|
||||
|
||||
@property
|
||||
@ -131,12 +131,12 @@ class Mission(MissionUI, CommissionsUI):
|
||||
def current_count(self):
|
||||
if self.current_mode == "H" and self.task[0][2] > 3:
|
||||
return 3
|
||||
return self.task[0][2]
|
||||
return self.task[0][2]
|
||||
|
||||
@current_count.setter
|
||||
def current_count(self, value):
|
||||
self.task[0][2] = value
|
||||
|
||||
|
||||
def select(self) -> bool:
|
||||
"""
|
||||
A wrapper method to select the current_mode
|
||||
@ -154,7 +154,7 @@ class Mission(MissionUI, CommissionsUI):
|
||||
else:
|
||||
logger.error("Uknown mode")
|
||||
return False
|
||||
|
||||
|
||||
def get_realistic_count(self) -> int:
|
||||
"""
|
||||
Calculate the possible number of sweeps based on the current AP
|
||||
@ -196,11 +196,12 @@ class Mission(MissionUI, CommissionsUI):
|
||||
Check if AP related modules such as cafe, circle, task, mail are enabled and run them if they are.
|
||||
task_call only works after the current task is finished so is not suitable.
|
||||
"""
|
||||
cafe_reward = self.config.cross_get(["Cafe", "Scheduler", "Enable"]) and self.config.cross_get(["Cafe", "Cafe", "Reward"])
|
||||
cafe_reward = self.config.cross_get(["Cafe", "Scheduler", "Enable"]) and self.config.cross_get(
|
||||
["Cafe", "Cafe", "Reward"])
|
||||
circle = self.config.cross_get(["Circle", "Scheduler", "Enable"])
|
||||
task = self.config.cross_get(["Task", "Scheduler", "Enable"])
|
||||
mail = self.config.cross_get(["Mail", "Scheduler", "Enable"])
|
||||
ap_tasks = [(cafe_reward,Cafe), (circle, Circle), (task, Task), (mail, Mail)]
|
||||
ap_tasks = [(cafe_reward, Cafe), (circle, Circle), (task, Task), (mail, Mail)]
|
||||
modules = [x[1] for x in ap_tasks if x[0]]
|
||||
if not modules:
|
||||
logger.info("Recharge AP was enabled but no AP related modules were enabled")
|
||||
@ -208,7 +209,7 @@ class Mission(MissionUI, CommissionsUI):
|
||||
for module in modules:
|
||||
module(config=self.config, device=self.device).run()
|
||||
return True
|
||||
|
||||
|
||||
def handle_mission(self, status):
|
||||
match status:
|
||||
case MissionStatus.AP:
|
||||
@ -216,13 +217,13 @@ class Mission(MissionUI, CommissionsUI):
|
||||
return MissionStatus.FINISH
|
||||
self.realistic_count = self.get_realistic_count()
|
||||
if self.realistic_count == 0 and self.recharge_AP:
|
||||
self.recharge_AP = False
|
||||
return MissionStatus.RECHARGE
|
||||
self.recharge_AP = False
|
||||
return MissionStatus.RECHARGE
|
||||
elif self.realistic_count == 0 and not self.recharge_AP:
|
||||
return MissionStatus.FINISH
|
||||
else:
|
||||
return MissionStatus.NAVIGATE
|
||||
case MissionStatus.NAVIGATE:
|
||||
case MissionStatus.NAVIGATE:
|
||||
self.navigate(self.previous_mode, self.current_mode)
|
||||
return MissionStatus.SELECT
|
||||
case MissionStatus.SELECT:
|
||||
@ -241,7 +242,7 @@ class Mission(MissionUI, CommissionsUI):
|
||||
self.update_task()
|
||||
else:
|
||||
self.update_task(failure=True)
|
||||
return MissionStatus.AP
|
||||
return MissionStatus.AP
|
||||
case MissionStatus.RECHARGE:
|
||||
if self.recharge():
|
||||
DataUpdate(config=self.config, device=self.device).run()
|
||||
@ -261,10 +262,10 @@ class Mission(MissionUI, CommissionsUI):
|
||||
if self.task:
|
||||
action_timer = Timer(0.5, 1)
|
||||
status = MissionStatus.AP
|
||||
|
||||
|
||||
"""Update the dashboard to accurately calculate AP"""
|
||||
DataUpdate(config=self.config, device=self.device).run()
|
||||
|
||||
|
||||
while 1:
|
||||
self.device.screenshot()
|
||||
|
||||
@ -277,7 +278,6 @@ class Mission(MissionUI, CommissionsUI):
|
||||
|
||||
if status == MissionStatus.FINISH:
|
||||
break
|
||||
|
||||
|
||||
# delay mission to 7 hours if there are still stages in the queue
|
||||
self.config.task_delay(minute=420) if self.task else self.config.task_delay(server_update=True)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from module.ui.switch import Switch
|
||||
from module.ocr.ocr import Digit
|
||||
from module.ui.switch import Switch
|
||||
from tasks.base.assets.assets_base_page import BACK, MISSION_CHECK, EVENT_CHECK, WORK_GO_TO_EVENT
|
||||
from tasks.base.page import page_mission, page_commissions, page_work #,page_event
|
||||
from tasks.base.page import page_mission, page_commissions, page_work # ,page_event
|
||||
from tasks.base.ui import UI
|
||||
from tasks.mission.assets.assets_mission import *
|
||||
from tasks.stage.ap import AP
|
||||
@ -13,7 +13,7 @@ from tasks.stage.sweep import StageSweep
|
||||
SHARED_LIST = StageList('SharedList')
|
||||
EVENT_LIST = StageList('EventList', EVENT_LIST, EVENT_INDEX, EVENT_ITEM, button_stars=EVENT_STARS)
|
||||
SHARED_SWEEP = StageSweep('MissionSweep', 99)
|
||||
SHARED_SWEEP.set_button(button_check=CHECK_MISSION_SWEEP) # Check sweep is different for mission, event
|
||||
SHARED_SWEEP.set_button(button_check=CHECK_MISSION_SWEEP) # Check sweep is different for mission, event
|
||||
COMMISSIONS_SWEEP = StageSweep('CommissionsSweep', 99)
|
||||
|
||||
SWITCH_NORMAL = Switch("Normal_switch")
|
||||
@ -25,8 +25,8 @@ SWITCH_HARD.add_state("on", HARD_ON)
|
||||
SWITCH_HARD.add_state("off", HARD_OFF)
|
||||
|
||||
SWITCH_QUEST = Switch("QUEST_switch")
|
||||
SWITCH_QUEST.add_state("on",QUEST_ON)
|
||||
SWITCH_QUEST.add_state("off",QUEST_OFF)
|
||||
SWITCH_QUEST.add_state("on", QUEST_ON)
|
||||
SWITCH_QUEST.add_state("off", QUEST_OFF)
|
||||
|
||||
"""
|
||||
A dictionary that maps the mode to a tuple where
|
||||
@ -38,7 +38,7 @@ MODE_TO_PAGE = {
|
||||
"H": (MISSION_CHECK, page_mission),
|
||||
"XP": (CHECK_XP, page_commissions),
|
||||
"CR": (CHECK_CR, page_commissions),
|
||||
"E" : (EVENT_CHECK, None) #page_event
|
||||
"E": (EVENT_CHECK, None) # page_event
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ class MissionUI(UI, AP):
|
||||
if self.select_area(area) and self.select_mode(switch):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def select_area(self, num):
|
||||
""""
|
||||
May require further error handling for these cases.
|
||||
@ -67,9 +67,9 @@ class MissionUI(UI, AP):
|
||||
if current_area == num:
|
||||
return True
|
||||
elif current_area > num:
|
||||
[self.click_with_interval(LEFT, interval=1) for x in range(abs(current_area-num))]
|
||||
[self.click_with_interval(LEFT, interval=1) for x in range(abs(current_area - num))]
|
||||
elif current_area < num:
|
||||
[self.click_with_interval(RIGHT, interval=1) for x in range(abs(current_area-num))]
|
||||
[self.click_with_interval(RIGHT, interval=1) for x in range(abs(current_area - num))]
|
||||
except:
|
||||
tries += 1
|
||||
if tries > 3:
|
||||
@ -107,12 +107,12 @@ class MissionUI(UI, AP):
|
||||
For example, "N" and "H" are in Mission so we call go_back.
|
||||
If different, ui_ensure is called for example, "N" and "IR".
|
||||
"""
|
||||
if prev==next or (prev in ["N", "H"] and next in ["N", "H"]):
|
||||
if prev == next or (prev in ["N", "H"] and next in ["N", "H"]):
|
||||
self.go_back(MODE_TO_PAGE[next][0])
|
||||
elif prev in ["XP", "CR"] and next in ["XP", "CR"]:
|
||||
self.go_back(CHECK_COMMISSIONS)
|
||||
else:
|
||||
self.goto_event() if next == "E" else self.ui_ensure(MODE_TO_PAGE[next][1])
|
||||
self.goto_event() if next == "E" else self.ui_ensure(MODE_TO_PAGE[next][1])
|
||||
|
||||
def go_back(self, check):
|
||||
while 1:
|
||||
@ -132,12 +132,14 @@ class MissionUI(UI, AP):
|
||||
if self.appear(EVENT_CHECK):
|
||||
break
|
||||
self.appear_then_click(WORK_GO_TO_EVENT)
|
||||
self.device.swipe((40,160), (260, 40))
|
||||
self.device.swipe((40, 160), (260, 40))
|
||||
while not timer.reached_and_reset():
|
||||
pass
|
||||
|
||||
|
||||
class CommissionsUI(UI, AP):
|
||||
"""Works the same way as select_bounty"""
|
||||
|
||||
def select_commission(self, mode):
|
||||
if mode == "CR":
|
||||
dest_enter, dest_check = SELECT_CR, CHECK_CR
|
||||
|
||||
@ -5,7 +5,13 @@ from module.base.button import Button, ButtonWrapper
|
||||
|
||||
BEGIN_STORY = ButtonWrapper(
|
||||
name='BEGIN_STORY',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/BEGIN_STORY.png',
|
||||
area=(729, 533, 1110, 600),
|
||||
search=(709, 513, 1130, 620),
|
||||
color=(112, 210, 244),
|
||||
button=(729, 533, 1110, 600),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/BEGIN_STORY.png',
|
||||
area=(796, 540, 1059, 591),
|
||||
@ -23,7 +29,13 @@ BEGIN_STORY = ButtonWrapper(
|
||||
)
|
||||
CHATTING = ButtonWrapper(
|
||||
name='CHATTING',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/CHATTING.png',
|
||||
area=(776, 520, 817, 545),
|
||||
search=(756, 500, 837, 565),
|
||||
color=(89, 103, 121),
|
||||
button=(776, 520, 817, 545),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/CHATTING.png',
|
||||
area=(774, 563, 821, 585),
|
||||
@ -41,7 +53,13 @@ CHATTING = ButtonWrapper(
|
||||
)
|
||||
CHAT_AREA = ButtonWrapper(
|
||||
name='CHAT_AREA',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/CHAT_AREA.png',
|
||||
area=(686, 153, 1146, 626),
|
||||
search=(666, 133, 1166, 646),
|
||||
color=(190, 186, 195),
|
||||
button=(686, 153, 1146, 626),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/CHAT_AREA.png',
|
||||
area=(760, 149, 1149, 628),
|
||||
@ -59,7 +77,13 @@ CHAT_AREA = ButtonWrapper(
|
||||
)
|
||||
CONFIRM_SKIP = ButtonWrapper(
|
||||
name='CONFIRM_SKIP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/CONFIRM_SKIP.png',
|
||||
area=(664, 491, 871, 554),
|
||||
search=(644, 471, 891, 574),
|
||||
color=(113, 214, 249),
|
||||
button=(664, 491, 871, 554),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/CONFIRM_SKIP.png',
|
||||
area=(674, 486, 871, 555),
|
||||
@ -77,7 +101,13 @@ CONFIRM_SKIP = ButtonWrapper(
|
||||
)
|
||||
CONFIRM_SORT = ButtonWrapper(
|
||||
name='CONFIRM_SORT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/CONFIRM_SORT.png',
|
||||
area=(243, 403, 656, 440),
|
||||
search=(223, 383, 676, 460),
|
||||
color=(252, 253, 253),
|
||||
button=(243, 403, 656, 440),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/CONFIRM_SORT.png',
|
||||
area=(239, 407, 657, 439),
|
||||
@ -95,7 +125,13 @@ CONFIRM_SORT = ButtonWrapper(
|
||||
)
|
||||
FIRST_UNREAD = ButtonWrapper(
|
||||
name='FIRST_UNREAD',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/FIRST_UNREAD.png',
|
||||
area=(635, 244, 660, 272),
|
||||
search=(615, 224, 680, 292),
|
||||
color=(251, 85, 43),
|
||||
button=(635, 244, 660, 272),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/FIRST_UNREAD.png',
|
||||
area=(636, 239, 661, 265),
|
||||
@ -113,7 +149,13 @@ FIRST_UNREAD = ButtonWrapper(
|
||||
)
|
||||
MENU = ButtonWrapper(
|
||||
name='MENU',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/MENU.png',
|
||||
area=(1159, 28, 1249, 55),
|
||||
search=(1139, 8, 1269, 75),
|
||||
color=(184, 192, 201),
|
||||
button=(1159, 28, 1249, 55),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/MENU.png',
|
||||
area=(1156, 15, 1251, 63),
|
||||
@ -131,7 +173,13 @@ MENU = ButtonWrapper(
|
||||
)
|
||||
NOTIFICATION_BADGE = ButtonWrapper(
|
||||
name='NOTIFICATION_BADGE',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/NOTIFICATION_BADGE.png',
|
||||
area=(163, 107, 196, 129),
|
||||
search=(143, 87, 216, 149),
|
||||
color=(240, 110, 65),
|
||||
button=(163, 107, 196, 129),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/NOTIFICATION_BADGE.png',
|
||||
area=(171, 109, 200, 128),
|
||||
@ -149,7 +197,13 @@ NOTIFICATION_BADGE = ButtonWrapper(
|
||||
)
|
||||
REPLY = ButtonWrapper(
|
||||
name='REPLY',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/REPLY.png',
|
||||
area=(792, 509, 868, 530),
|
||||
search=(772, 489, 888, 550),
|
||||
color=(172, 184, 193),
|
||||
button=(792, 509, 868, 530),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/REPLY.png',
|
||||
area=(791, 431, 855, 462),
|
||||
@ -167,7 +221,13 @@ REPLY = ButtonWrapper(
|
||||
)
|
||||
SELECT_STUDENT = ButtonWrapper(
|
||||
name='SELECT_STUDENT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SELECT_STUDENT.png',
|
||||
area=(801, 374, 1023, 399),
|
||||
search=(781, 354, 1043, 419),
|
||||
color=(226, 227, 228),
|
||||
button=(801, 374, 1023, 399),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SELECT_STUDENT.png',
|
||||
area=(839, 369, 998, 403),
|
||||
@ -185,7 +245,13 @@ SELECT_STUDENT = ButtonWrapper(
|
||||
)
|
||||
SKIP = ButtonWrapper(
|
||||
name='SKIP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SKIP.png',
|
||||
area=(1188, 96, 1233, 142),
|
||||
search=(1168, 76, 1253, 162),
|
||||
color=(87, 107, 130),
|
||||
button=(1188, 96, 1233, 142),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SKIP.png',
|
||||
area=(1192, 103, 1229, 141),
|
||||
@ -203,7 +269,13 @@ SKIP = ButtonWrapper(
|
||||
)
|
||||
SORT_ASCENDING = ButtonWrapper(
|
||||
name='SORT_ASCENDING',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SORT_ASCENDING.png',
|
||||
area=(633, 166, 646, 186),
|
||||
search=(613, 146, 666, 206),
|
||||
color=(205, 216, 224),
|
||||
button=(633, 166, 646, 186),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SORT_ASCENDING.png',
|
||||
area=(631, 166, 648, 188),
|
||||
@ -221,7 +293,13 @@ SORT_ASCENDING = ButtonWrapper(
|
||||
)
|
||||
SORT_DESCENDING = ButtonWrapper(
|
||||
name='SORT_DESCENDING',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SORT_DESCENDING.png',
|
||||
area=(633, 168, 646, 187),
|
||||
search=(613, 148, 666, 207),
|
||||
color=(202, 212, 221),
|
||||
button=(633, 168, 646, 187),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SORT_DESCENDING.png',
|
||||
area=(631, 166, 648, 189),
|
||||
@ -239,7 +317,13 @@ SORT_DESCENDING = ButtonWrapper(
|
||||
)
|
||||
STORY = ButtonWrapper(
|
||||
name='STORY',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/STORY.png',
|
||||
area=(792, 531, 887, 553),
|
||||
search=(772, 511, 907, 573),
|
||||
color=(218, 206, 212),
|
||||
button=(792, 531, 887, 553),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/STORY.png',
|
||||
area=(790, 529, 979, 557),
|
||||
@ -257,7 +341,13 @@ STORY = ButtonWrapper(
|
||||
)
|
||||
SWITCH_MESSAGE = ButtonWrapper(
|
||||
name='SWITCH_MESSAGE',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SWITCH_MESSAGE.png',
|
||||
area=(150, 271, 193, 297),
|
||||
search=(130, 251, 213, 317),
|
||||
color=(194, 198, 206),
|
||||
button=(150, 271, 193, 297),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SWITCH_MESSAGE.png',
|
||||
area=(147, 271, 194, 297),
|
||||
@ -275,7 +365,13 @@ SWITCH_MESSAGE = ButtonWrapper(
|
||||
)
|
||||
SWITCH_MESSAGE_CHECK = ButtonWrapper(
|
||||
name='SWITCH_MESSAGE_CHECK',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SWITCH_MESSAGE_CHECK.png',
|
||||
area=(231, 167, 379, 190),
|
||||
search=(211, 147, 399, 210),
|
||||
color=(197, 201, 202),
|
||||
button=(231, 167, 379, 190),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SWITCH_MESSAGE_CHECK.png',
|
||||
area=(228, 165, 391, 194),
|
||||
@ -293,7 +389,13 @@ SWITCH_MESSAGE_CHECK = ButtonWrapper(
|
||||
)
|
||||
SWITCH_STUDENT = ButtonWrapper(
|
||||
name='SWITCH_STUDENT',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SWITCH_STUDENT.png',
|
||||
area=(151, 168, 193, 213),
|
||||
search=(131, 148, 213, 233),
|
||||
color=(169, 176, 188),
|
||||
button=(151, 168, 193, 213),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SWITCH_STUDENT.png',
|
||||
area=(148, 167, 194, 217),
|
||||
@ -311,7 +413,13 @@ SWITCH_STUDENT = ButtonWrapper(
|
||||
)
|
||||
SWITCH_STUDENT_CHECK = ButtonWrapper(
|
||||
name='SWITCH_STUDENT_CHECK',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/SWITCH_STUDENT_CHECK.png',
|
||||
area=(232, 168, 275, 190),
|
||||
search=(212, 148, 295, 210),
|
||||
color=(169, 174, 176),
|
||||
button=(232, 168, 275, 190),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/SWITCH_STUDENT_CHECK.png',
|
||||
area=(229, 166, 320, 192),
|
||||
@ -329,7 +437,13 @@ SWITCH_STUDENT_CHECK = ButtonWrapper(
|
||||
)
|
||||
UNREAD = ButtonWrapper(
|
||||
name='UNREAD',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/UNREAD.png',
|
||||
area=(454, 158, 570, 194),
|
||||
search=(434, 138, 590, 214),
|
||||
color=(242, 243, 243),
|
||||
button=(454, 158, 570, 194),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/UNREAD.png',
|
||||
area=(454, 160, 568, 193),
|
||||
@ -347,7 +461,13 @@ UNREAD = ButtonWrapper(
|
||||
)
|
||||
UNREAD_OFF = ButtonWrapper(
|
||||
name='UNREAD_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/UNREAD_OFF.png',
|
||||
area=(458, 273, 655, 314),
|
||||
search=(438, 253, 675, 334),
|
||||
color=(252, 252, 252),
|
||||
button=(458, 273, 655, 314),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/UNREAD_OFF.png',
|
||||
area=(456, 273, 658, 316),
|
||||
@ -365,7 +485,13 @@ UNREAD_OFF = ButtonWrapper(
|
||||
)
|
||||
UNREAD_ON = ButtonWrapper(
|
||||
name='UNREAD_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/momotalk/UNREAD_ON.png',
|
||||
area=(463, 274, 653, 314),
|
||||
search=(443, 254, 673, 334),
|
||||
color=(245, 118, 143),
|
||||
button=(463, 274, 653, 314),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/momotalk/UNREAD_ON.png',
|
||||
area=(456, 272, 658, 314),
|
||||
|
||||
@ -2,9 +2,9 @@ from enum import Enum
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from tasks.tactical_challenge.assets.assets_tactical_challenge import *
|
||||
from tasks.momotalk.ui import MomoTalkUI
|
||||
|
||||
|
||||
class MomoTalkStatus(Enum):
|
||||
OPEN = 0
|
||||
SORT = 1
|
||||
@ -13,6 +13,7 @@ class MomoTalkStatus(Enum):
|
||||
STORY = 4
|
||||
FINISHED = -1
|
||||
|
||||
|
||||
class MomoTalk(MomoTalkUI):
|
||||
def handle_momotalk(self, status):
|
||||
match status:
|
||||
@ -26,16 +27,16 @@ class MomoTalk(MomoTalkUI):
|
||||
case MomoTalkStatus.CHECK:
|
||||
if self.check_first_student():
|
||||
return MomoTalkStatus.CHAT
|
||||
return MomoTalkStatus.FINISHED
|
||||
return MomoTalkStatus.FINISHED
|
||||
case MomoTalkStatus.CHAT:
|
||||
if self.chat():
|
||||
return MomoTalkStatus.STORY
|
||||
return MomoTalkStatus.OPEN
|
||||
case MomoTalkStatus.STORY:
|
||||
if self.skip_story():
|
||||
return MomoTalkStatus.CHAT
|
||||
return MomoTalkStatus.CHAT
|
||||
case MomoTalkStatus.FINISHED:
|
||||
return status
|
||||
return status
|
||||
case _:
|
||||
logger.warning(f'Invalid status: {status}')
|
||||
return status
|
||||
@ -58,4 +59,3 @@ class MomoTalk(MomoTalkUI):
|
||||
break
|
||||
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ REPLY_TEMPLATE = REPLY.matched_button.image
|
||||
STORY_TEMPLATE = STORY.matched_button.image
|
||||
CHATTING_TEMPLATE = CHATTING.matched_button.image
|
||||
|
||||
|
||||
class MomoTalkUI(UI):
|
||||
def __init__(self, config, device):
|
||||
super().__init__(config, device)
|
||||
@ -81,7 +82,7 @@ class MomoTalkUI(UI):
|
||||
switch.set(state, main=self)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def click_all(self, template, x_add=0, y_add=0):
|
||||
"""
|
||||
Find the all the locations of the template adding an offset if specified and click them.
|
||||
@ -116,7 +117,7 @@ class MomoTalkUI(UI):
|
||||
return True
|
||||
logger.warning("No students available for interaction")
|
||||
return False
|
||||
|
||||
|
||||
def sort_messages(self):
|
||||
"""
|
||||
Switch from newest to unread and sort the messages in descending order
|
||||
@ -140,7 +141,7 @@ class MomoTalkUI(UI):
|
||||
return True
|
||||
logger.warning("No students available for interaction")
|
||||
return False
|
||||
|
||||
|
||||
def chat(self):
|
||||
"""
|
||||
Waits for the chat area to be stable and then
|
||||
@ -164,8 +165,8 @@ class MomoTalkUI(UI):
|
||||
timer.reset()
|
||||
elif timer.reached():
|
||||
logger.info("No new message detected")
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def skip_story(self):
|
||||
"""
|
||||
Skip story by executing a series of steps. Returns True if the confirm skip
|
||||
@ -184,5 +185,3 @@ class MomoTalkUI(UI):
|
||||
while not timer.reached_and_reset():
|
||||
pass
|
||||
break
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,13 @@ from module.base.button import Button, ButtonWrapper
|
||||
|
||||
CONFIRM = ButtonWrapper(
|
||||
name='CONFIRM',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/CONFIRM.png',
|
||||
area=(532, 524, 742, 591),
|
||||
search=(512, 504, 762, 611),
|
||||
color=(114, 214, 249),
|
||||
button=(532, 524, 742, 591),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/CONFIRM.png',
|
||||
area=(532, 528, 748, 589),
|
||||
@ -23,7 +29,13 @@ CONFIRM = ButtonWrapper(
|
||||
)
|
||||
FIRST_ITEM = ButtonWrapper(
|
||||
name='FIRST_ITEM',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/FIRST_ITEM.png',
|
||||
area=(751, 137, 1133, 236),
|
||||
search=(731, 117, 1153, 256),
|
||||
color=(199, 210, 222),
|
||||
button=(751, 137, 1133, 236),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/FIRST_ITEM.png',
|
||||
area=(727, 137, 1103, 239),
|
||||
@ -41,7 +53,13 @@ FIRST_ITEM = ButtonWrapper(
|
||||
)
|
||||
LOCATIONS = ButtonWrapper(
|
||||
name='LOCATIONS',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/LOCATIONS.png',
|
||||
area=(1085, 637, 1249, 693),
|
||||
search=(1065, 617, 1269, 713),
|
||||
color=(107, 201, 237),
|
||||
button=(1085, 637, 1249, 693),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/LOCATIONS.png',
|
||||
area=(1075, 638, 1256, 693),
|
||||
@ -59,7 +77,13 @@ LOCATIONS = ButtonWrapper(
|
||||
)
|
||||
LOCATIONS_POPUP = ButtonWrapper(
|
||||
name='LOCATIONS_POPUP',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/LOCATIONS_POPUP.png',
|
||||
area=(489, 99, 792, 135),
|
||||
search=(469, 79, 812, 155),
|
||||
color=(202, 209, 216),
|
||||
button=(489, 99, 792, 135),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/LOCATIONS_POPUP.png',
|
||||
area=(534, 101, 750, 135),
|
||||
@ -77,7 +101,13 @@ LOCATIONS_POPUP = ButtonWrapper(
|
||||
)
|
||||
OCR_TICKET = ButtonWrapper(
|
||||
name='OCR_TICKET',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/OCR_TICKET.png',
|
||||
area=(187, 86, 235, 114),
|
||||
search=(167, 66, 255, 134),
|
||||
color=(220, 230, 232),
|
||||
button=(187, 86, 235, 114),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/OCR_TICKET.png',
|
||||
area=(220, 79, 266, 121),
|
||||
@ -97,10 +127,10 @@ SCROLL = ButtonWrapper(
|
||||
name='SCROLL',
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/SCROLL.png',
|
||||
area=(742, 136, 1101, 671),
|
||||
search=(722, 116, 1121, 691),
|
||||
color=(198, 214, 210),
|
||||
button=(742, 136, 1101, 671),
|
||||
area=(749, 140, 1130, 669),
|
||||
search=(729, 120, 1150, 689),
|
||||
color=(197, 215, 212),
|
||||
button=(749, 140, 1130, 669),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/SCROLL.png',
|
||||
@ -119,7 +149,13 @@ SCROLL = ButtonWrapper(
|
||||
)
|
||||
START_LESSON = ButtonWrapper(
|
||||
name='START_LESSON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/schedule/START_LESSON.png',
|
||||
area=(513, 534, 770, 568),
|
||||
search=(493, 514, 790, 588),
|
||||
color=(101, 187, 220),
|
||||
button=(513, 534, 770, 568),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/schedule/START_LESSON.png',
|
||||
area=(506, 523, 773, 585),
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
import re
|
||||
from enum import Flag
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from tasks.base.assets.assets_base_page import BACK
|
||||
from tasks.base.assets.assets_base_page import SCHEDULE_CHECK
|
||||
from tasks.base.page import page_schedule
|
||||
from tasks.schedule.ui import ScheduleUI
|
||||
from tasks.base.assets.assets_base_page import SCHEDULE_CHECK
|
||||
|
||||
import re
|
||||
|
||||
class ScheduleStatus(Flag):
|
||||
OCR = 0
|
||||
@ -18,7 +18,7 @@ class ScheduleStatus(Flag):
|
||||
FINISH = 4
|
||||
|
||||
|
||||
class Schedule(ScheduleUI):
|
||||
class Schedule(ScheduleUI):
|
||||
@property
|
||||
def schedule_info(self):
|
||||
info = []
|
||||
@ -28,7 +28,8 @@ class Schedule(ScheduleUI):
|
||||
|
||||
for choice in choices:
|
||||
location, classrooms = schedule_config[choice]["Location"], schedule_config[choice]["Classrooms"]
|
||||
if location == "None" or not classrooms or (isinstance(classrooms, str) and classrooms.replace(" ", "") == ""):
|
||||
if location == "None" or not classrooms or (
|
||||
isinstance(classrooms, str) and classrooms.replace(" ", "") == ""):
|
||||
continue
|
||||
elif isinstance(classrooms, int):
|
||||
classrooms_list = [str(classrooms)]
|
||||
@ -39,7 +40,7 @@ class Schedule(ScheduleUI):
|
||||
classrooms_list = []
|
||||
# tried to convert to set to remove duplicates but doesn't maintain order
|
||||
[classrooms_list.append(x) for x in classrooms if x not in classrooms_list]
|
||||
|
||||
|
||||
if self.valid_classroom(classrooms_list):
|
||||
info.append([location, classrooms_list])
|
||||
else:
|
||||
@ -57,7 +58,7 @@ class Schedule(ScheduleUI):
|
||||
if not 1 <= int(classroom) <= 9:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@property
|
||||
def valid_task(self) -> list:
|
||||
task = self.schedule_info
|
||||
@ -131,4 +132,4 @@ class Schedule(ScheduleUI):
|
||||
if status == ScheduleStatus.FINISH:
|
||||
break
|
||||
|
||||
self.config.task_delay(server_update=True)
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
@ -3,8 +3,8 @@ Original Author: sanmusen214(https://github.com/sanmusen214)
|
||||
Adapted from https://github.com/sanmusen214/BAAH/blob/1.2/modules/AllTask/SubTask/ScrollSelect.py
|
||||
"""
|
||||
|
||||
from module.logger import logger
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
|
||||
|
||||
class ScrollSelect:
|
||||
@ -30,7 +30,9 @@ class ScrollSelect:
|
||||
finalclick: bool
|
||||
Whether to click on clickx and the last row after the sliding ends
|
||||
"""
|
||||
def __init__(self, window_button, first_item_button, expected_button, clickx, swipeoffsetx=-100, finalclick=True) -> None:
|
||||
|
||||
def __init__(self, window_button, first_item_button, expected_button, clickx, swipeoffsetx=-100,
|
||||
finalclick=True) -> None:
|
||||
# TODO: Actually, only concerned about the height of one element, completely displaying the Y of the first button, completely displaying the Y of the bottom button, the number of complete elements that the window can contain, the height of the last element in the window, and the left offset and response distance.
|
||||
self.window_starty = window_button.area[1]
|
||||
self.window_endy = window_button.area[3]
|
||||
@ -54,8 +56,9 @@ class ScrollSelect:
|
||||
main.device.swipe((x1, y1), (x1, y1 - (distance + responsey)), duration=2)
|
||||
else:
|
||||
# Effective swipe distance for the Chinese server is 60
|
||||
main.device.swipe((x1, y1), (x1, int(y1 - (distance + responsey - 4 * (1 + distance / 100)))), duration=1 + distance / 100)
|
||||
|
||||
main.device.swipe((x1, y1), (x1, int(y1 - (distance + responsey - 4 * (1 + distance / 100)))),
|
||||
duration=1 + distance / 100)
|
||||
|
||||
def select_location(self, main, target_index) -> None:
|
||||
click_coords = main.device.click_methods.get(main.config.Emulator_ControlMethod, main.device.click_adb)
|
||||
logger.info("Scroll and select the {}-th level".format(target_index + 1))
|
||||
@ -75,9 +78,9 @@ class ScrollSelect:
|
||||
# Center point of the target element
|
||||
target_center_y = start_center_y + self.itemheight * target_index
|
||||
self.run_until(main,
|
||||
lambda: click_coords(self.clickx, target_center_y),
|
||||
lambda: main.appear(self.expected_button),
|
||||
)
|
||||
lambda: click_coords(self.clickx, target_center_y),
|
||||
lambda: main.appear(self.expected_button),
|
||||
)
|
||||
else:
|
||||
# Start scrolling from the gap in the middle of the levels
|
||||
scroll_start_from_y = self.window_endy - self.itemheight // 2
|
||||
@ -86,7 +89,8 @@ class ScrollSelect:
|
||||
scrolltotal_distance = (target_index - itemcount) * self.itemheight + hiddenlastitemheight
|
||||
logger.info("Height hidden by the last element: %d" % hiddenlastitemheight)
|
||||
# First, slide up the hidden part, add a little distance to let the system recognize it as a swipe event
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, hiddenlastitemheight, self.responsey)
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, hiddenlastitemheight,
|
||||
self.responsey)
|
||||
logger.info(f"Swipe distance: {hiddenlastitemheight}")
|
||||
# Update scrolltotal_distance
|
||||
scrolltotal_distance -= hiddenlastitemheight
|
||||
@ -97,18 +101,20 @@ class ScrollSelect:
|
||||
else:
|
||||
scroll_distance = (itemcount - 1) * self.itemheight
|
||||
while scroll_distance <= scrolltotal_distance:
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, scroll_distance, self.responsey)
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, scroll_distance,
|
||||
self.responsey)
|
||||
scrolltotal_distance -= scroll_distance
|
||||
if scrolltotal_distance > 5:
|
||||
# Last slide
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, scrolltotal_distance, self.responsey)
|
||||
self.compute_swipe(main, self.clickx + self.swipeoffsetx, scroll_start_from_y, scrolltotal_distance,
|
||||
self.responsey)
|
||||
if self.finalclick:
|
||||
# Click on the last row
|
||||
self.run_until(main,
|
||||
lambda: click_coords(self.clickx, self.window_endy - self.itemheight // 2),
|
||||
lambda: main.appear(self.expected_button)
|
||||
)
|
||||
|
||||
lambda: click_coords(self.clickx, self.window_endy - self.itemheight // 2),
|
||||
lambda: main.appear(self.expected_button)
|
||||
)
|
||||
|
||||
def run_until(self, main, func1, func2, times=6, sleeptime=1.5) -> bool:
|
||||
"""
|
||||
Repeat the execution of func1 up to a maximum of times or until func2 evaluates to True.
|
||||
@ -146,4 +152,3 @@ class ScrollSelect:
|
||||
timer = Timer(0.5).start()
|
||||
while not timer.reached_and_reset():
|
||||
pass
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
from module.base.timer import Timer
|
||||
import numpy as np
|
||||
|
||||
from module.base.decorator import Config
|
||||
from module.base.timer import Timer
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import DigitCounter
|
||||
from tasks.base.ui import UI
|
||||
from tasks.base.assets.assets_base_page import SCHEDULE_CHECK
|
||||
from tasks.base.ui import UI
|
||||
from tasks.schedule.assets.assets_schedule import *
|
||||
from tasks.schedule.scroll_select import ScrollSelect
|
||||
import numpy as np
|
||||
|
||||
SCROLL_SELECT = ScrollSelect(window_button=SCROLL, first_item_button=FIRST_ITEM, expected_button=LOCATIONS, clickx=1116)
|
||||
xs = np.linspace(299, 995, 3, dtype=int)
|
||||
ys = np.linspace(268, 573, 3, dtype=int)
|
||||
|
||||
|
||||
class ScheduleUI(UI):
|
||||
@Config.when(Emulator_GameLanguage='jp')
|
||||
def set_clickx(self):
|
||||
@ -20,7 +22,7 @@ class ScheduleUI(UI):
|
||||
@Config.when(Emulator_GameLanguage=None)
|
||||
def set_clickx(self):
|
||||
pass
|
||||
|
||||
|
||||
def select_then_check(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
|
||||
timer = Timer(8, 10).start()
|
||||
while 1:
|
||||
@ -30,10 +32,10 @@ class ScheduleUI(UI):
|
||||
timer.reset()
|
||||
if self.appear(dest_check):
|
||||
return True
|
||||
|
||||
|
||||
if timer.reached():
|
||||
return False
|
||||
|
||||
|
||||
def click_then_check(self, coords, dest_check: ButtonWrapper):
|
||||
click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
|
||||
timer = Timer(3, 2).start()
|
||||
@ -47,14 +49,14 @@ class ScheduleUI(UI):
|
||||
pass
|
||||
if timer.reached():
|
||||
return False
|
||||
|
||||
|
||||
def enter_location(self, location):
|
||||
SCROLL_SELECT.select_location(self, location)
|
||||
if not self.appear(LOCATIONS):
|
||||
logger.error("Unable to navigate to page for location {}".format(location + 1))
|
||||
return False
|
||||
return self.select_then_check(LOCATIONS, LOCATIONS_POPUP)
|
||||
|
||||
|
||||
def select_classrooms(self, ticket, classrooms):
|
||||
for classroom in classrooms:
|
||||
if ticket == 0:
|
||||
@ -86,5 +88,5 @@ class ScheduleUI(UI):
|
||||
logger.warning('Invalid ticket')
|
||||
return False
|
||||
logger.attr('ScheduleTicket', ticket)
|
||||
#self.config.stored.BountyTicket.set(ticket)
|
||||
# self.config.stored.BountyTicket.set(ticket)
|
||||
return ticket
|
||||
|
||||
@ -5,7 +5,13 @@ from module.base.button import Button, ButtonWrapper
|
||||
|
||||
CONFIRM_PURCHASE = ButtonWrapper(
|
||||
name='CONFIRM_PURCHASE',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/CONFIRM_PURCHASE.png',
|
||||
area=(465, 231, 809, 307),
|
||||
search=(445, 211, 829, 327),
|
||||
color=(213, 214, 215),
|
||||
button=(670, 458, 865, 516),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/CONFIRM_PURCHASE.png',
|
||||
area=(467, 231, 807, 309),
|
||||
@ -23,7 +29,13 @@ CONFIRM_PURCHASE = ButtonWrapper(
|
||||
)
|
||||
CONFIRM_REFRESH = ButtonWrapper(
|
||||
name='CONFIRM_REFRESH',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/CONFIRM_REFRESH.png',
|
||||
area=(451, 271, 825, 304),
|
||||
search=(431, 251, 845, 324),
|
||||
color=(200, 201, 202),
|
||||
button=(677, 430, 861, 498),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/CONFIRM_REFRESH.png',
|
||||
area=(474, 271, 806, 306),
|
||||
@ -41,7 +53,13 @@ CONFIRM_REFRESH = ButtonWrapper(
|
||||
)
|
||||
ITEM_LIST = ButtonWrapper(
|
||||
name='ITEM_LIST',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/ITEM_LIST.png',
|
||||
area=(622, 126, 1241, 612),
|
||||
search=(602, 106, 1261, 632),
|
||||
color=(194, 207, 215),
|
||||
button=(622, 126, 1241, 612),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/ITEM_LIST.png',
|
||||
area=(625, 127, 1244, 610),
|
||||
@ -59,7 +77,13 @@ ITEM_LIST = ButtonWrapper(
|
||||
)
|
||||
NORMAL_OFF = ButtonWrapper(
|
||||
name='NORMAL_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/NORMAL_OFF.png',
|
||||
area=(6, 109, 206, 167),
|
||||
search=(0, 89, 226, 187),
|
||||
color=(240, 241, 240),
|
||||
button=(6, 109, 206, 167),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/NORMAL_OFF.png',
|
||||
area=(4, 111, 213, 167),
|
||||
@ -77,7 +101,13 @@ NORMAL_OFF = ButtonWrapper(
|
||||
)
|
||||
NORMAL_ON = ButtonWrapper(
|
||||
name='NORMAL_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/NORMAL_ON.png',
|
||||
area=(9, 114, 205, 164),
|
||||
search=(0, 94, 225, 184),
|
||||
color=(71, 88, 91),
|
||||
button=(9, 114, 205, 164),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/NORMAL_ON.png',
|
||||
area=(4, 109, 212, 170),
|
||||
@ -95,7 +125,13 @@ NORMAL_ON = ButtonWrapper(
|
||||
)
|
||||
OCR_REFRESH = ButtonWrapper(
|
||||
name='OCR_REFRESH',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/OCR_REFRESH.png',
|
||||
area=(674, 308, 717, 332),
|
||||
search=(654, 288, 737, 352),
|
||||
color=(211, 212, 213),
|
||||
button=(674, 308, 717, 332),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/OCR_REFRESH.png',
|
||||
area=(712, 302, 762, 344),
|
||||
@ -113,7 +149,13 @@ OCR_REFRESH = ButtonWrapper(
|
||||
)
|
||||
PURCHASE = ButtonWrapper(
|
||||
name='PURCHASE',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/PURCHASE.png',
|
||||
area=(1106, 637, 1223, 685),
|
||||
search=(1086, 617, 1243, 705),
|
||||
color=(235, 217, 68),
|
||||
button=(1106, 637, 1223, 685),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/PURCHASE.png',
|
||||
area=(1102, 640, 1227, 684),
|
||||
@ -131,7 +173,13 @@ PURCHASE = ButtonWrapper(
|
||||
)
|
||||
REFRESH = ButtonWrapper(
|
||||
name='REFRESH',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/REFRESH.png',
|
||||
area=(1096, 641, 1223, 683),
|
||||
search=(1076, 621, 1243, 703),
|
||||
color=(233, 235, 238),
|
||||
button=(1096, 641, 1223, 683),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/REFRESH.png',
|
||||
area=(1098, 643, 1223, 682),
|
||||
@ -149,7 +197,13 @@ REFRESH = ButtonWrapper(
|
||||
)
|
||||
TC_OFF = ButtonWrapper(
|
||||
name='TC_OFF',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/TC_OFF.png',
|
||||
area=(9, 499, 199, 553),
|
||||
search=(0, 479, 219, 573),
|
||||
color=(230, 234, 237),
|
||||
button=(9, 499, 199, 553),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/TC_OFF.png',
|
||||
area=(2, 503, 209, 558),
|
||||
@ -167,7 +221,13 @@ TC_OFF = ButtonWrapper(
|
||||
)
|
||||
TC_ON = ButtonWrapper(
|
||||
name='TC_ON',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/shop/TC_ON.png',
|
||||
area=(9, 502, 199, 550),
|
||||
search=(0, 482, 219, 570),
|
||||
color=(77, 95, 94),
|
||||
button=(9, 502, 199, 550),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/shop/TC_ON.png',
|
||||
area=(3, 493, 208, 548),
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
from enum import Flag
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from module.ui.switch import Switch
|
||||
from tasks.base.assets.assets_base_page import BACK
|
||||
@ -18,6 +17,7 @@ class ShopStatus(Flag):
|
||||
END = 4
|
||||
FINISH = -1
|
||||
|
||||
|
||||
class Shop(ShopUI):
|
||||
@property
|
||||
def shop_info(self):
|
||||
@ -58,7 +58,7 @@ class Shop(ShopUI):
|
||||
@property
|
||||
def current_purchase_count(self):
|
||||
return self.task[0][1]
|
||||
|
||||
|
||||
@property
|
||||
def current_item_list(self):
|
||||
return self.task[0][2]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.base.base import ModuleBase
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import area_size
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import DigitCounter
|
||||
@ -16,13 +16,14 @@ ITEM_POSITIONS = {
|
||||
17: (650, 460), 18: (805, 460), 19: (960, 460), 20: (1110, 460),
|
||||
}
|
||||
|
||||
|
||||
class ShopUI(UI):
|
||||
def __init__(self, config, device):
|
||||
super().__init__(config, device)
|
||||
|
||||
self.click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
|
||||
self.swipe_vector_range = (0.85, 0.9)
|
||||
self.swipe_flags = {8:False, 16: False}
|
||||
self.swipe_flags = {8: False, 16: False}
|
||||
self.list = ITEM_LIST
|
||||
|
||||
def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False):
|
||||
@ -71,7 +72,7 @@ class ShopUI(UI):
|
||||
shop_switch.set('on', main=self)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def select_items(self, item_list):
|
||||
"""
|
||||
Select items in the item list checking if swipe is required each time.
|
||||
@ -89,7 +90,7 @@ class ShopUI(UI):
|
||||
)
|
||||
while not timer.reached_and_reset():
|
||||
pass
|
||||
self.click_coords(*ITEM_POSITIONS[item])
|
||||
self.click_coords(*ITEM_POSITIONS[item])
|
||||
|
||||
def should_swipe(self, item):
|
||||
"""
|
||||
@ -104,12 +105,13 @@ class ShopUI(UI):
|
||||
self.swipe_flags[16] = True
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def reset_swipe_flags(self):
|
||||
self.swipe_flags[8], self.swipe_flags[16] = False, False
|
||||
|
||||
def make_purchase(self):
|
||||
if self.match_color(PURCHASE) and self.select_then_check(PURCHASE, CONFIRM_PURCHASE) and self.appear_then_click(CONFIRM_PURCHASE):
|
||||
if self.match_color(PURCHASE) and self.select_then_check(PURCHASE, CONFIRM_PURCHASE) and self.appear_then_click(
|
||||
CONFIRM_PURCHASE):
|
||||
return True
|
||||
logger.warning("No items were selected. Unable to purchase.")
|
||||
return False
|
||||
@ -125,7 +127,7 @@ class ShopUI(UI):
|
||||
logger.info("Refreshed the shop")
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_refresh_count(self):
|
||||
if not self.select_then_check(REFRESH, CONFIRM_REFRESH):
|
||||
logger.warning('OCR failed due to invalid page')
|
||||
@ -135,4 +137,3 @@ class ShopUI(UI):
|
||||
logger.warning('Invalid count')
|
||||
return False
|
||||
return count
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class TacticalChallenge(TacticalChallengeUI):
|
||||
if not select:
|
||||
return random.choice(self.select_players)
|
||||
else:
|
||||
return self.select_players[select-1]
|
||||
return self.select_players[select - 1]
|
||||
|
||||
def _handle_challenge(self, status):
|
||||
match status:
|
||||
|
||||
@ -101,7 +101,13 @@ CLAIM_ALL = ButtonWrapper(
|
||||
)
|
||||
COMPLETE = ButtonWrapper(
|
||||
name='COMPLETE',
|
||||
jp=None,
|
||||
jp=Button(
|
||||
file='./assets/jp/task/COMPLETE.png',
|
||||
area=(933, 644, 1016, 697),
|
||||
search=(913, 624, 1036, 717),
|
||||
color=(127, 131, 135),
|
||||
button=(933, 644, 1016, 697),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/task/COMPLETE.png',
|
||||
area=(921, 643, 1026, 692),
|
||||
|
||||