Skip to content

Commit 7d46071

Browse files
committed
Upd: island_season_task task_grid
(cherry picked from commit 7377fd5)
1 parent 9bcc791 commit 7d46071

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

8.3 KB
Loading
-4.33 KB
Binary file not shown.

module/island/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
ISLAND_SEASON_TASK_SCROLL_AREA = Button(area={'cn': (1236, 171, 1237, 604), 'en': (1236, 171, 1237, 604), 'jp': (1236, 171, 1237, 604), 'tw': (1236, 171, 1237, 604)}, color={'cn': (186, 192, 191), 'en': (186, 192, 191), 'jp': (186, 192, 191), 'tw': (186, 192, 191)}, button={'cn': (1236, 171, 1237, 604), 'en': (1236, 171, 1237, 604), 'jp': (1236, 171, 1237, 604), 'tw': (1236, 171, 1237, 604)}, file={'cn': './assets/cn/island/ISLAND_SEASON_TASK_SCROLL_AREA.png', 'en': './assets/cn/island/ISLAND_SEASON_TASK_SCROLL_AREA.png', 'jp': './assets/cn/island/ISLAND_SEASON_TASK_SCROLL_AREA.png', 'tw': './assets/cn/island/ISLAND_SEASON_TASK_SCROLL_AREA.png'})
88
ISLAND_TECHNOLOGY_TAB1 = Button(area={'cn': (20, 575, 109, 644), 'en': (20, 575, 109, 644), 'jp': (20, 575, 109, 644), 'tw': (20, 575, 109, 644)}, color={'cn': (76, 109, 130), 'en': (76, 109, 130), 'jp': (76, 109, 130), 'tw': (76, 109, 130)}, button={'cn': (20, 575, 109, 644), 'en': (20, 575, 109, 644), 'jp': (20, 575, 109, 644), 'tw': (20, 575, 109, 644)}, file={'cn': './assets/cn/island/ISLAND_TECHNOLOGY_TAB1.png', 'en': './assets/cn/island/ISLAND_TECHNOLOGY_TAB1.png', 'jp': './assets/cn/island/ISLAND_TECHNOLOGY_TAB1.png', 'tw': './assets/cn/island/ISLAND_TECHNOLOGY_TAB1.png'})
9-
TEMPLATE_ISLAND_SEASON_TASK_ICON = Template(file={'cn': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_ICON.png', 'en': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_ICON.png', 'jp': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_ICON.png', 'tw': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_ICON.png'})
9+
TEMPLATE_ISLAND_SEASON_REWARD = Template(file={'cn': './assets/cn/island/TEMPLATE_ISLAND_SEASON_REWARD.png', 'en': './assets/cn/island/TEMPLATE_ISLAND_SEASON_REWARD.png', 'jp': './assets/cn/island/TEMPLATE_ISLAND_SEASON_REWARD.png', 'tw': './assets/cn/island/TEMPLATE_ISLAND_SEASON_REWARD.png'})
1010
TEMPLATE_ISLAND_SEASON_TASK_OBTAINED = Template(file={'cn': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_OBTAINED.png', 'en': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_OBTAINED.png', 'jp': './assets/jp/island/TEMPLATE_ISLAND_SEASON_TASK_OBTAINED.png', 'tw': './assets/cn/island/TEMPLATE_ISLAND_SEASON_TASK_OBTAINED.png'})

module/island/season_task.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,28 @@
2323
TASK_COUNTER_OCR = DigitCounter([], letter=(128, 128, 128), name='TASK_COUNTER_OCR')
2424

2525
class IslandSeasonTaskHandler(IslandUI):
26-
def _get_bars(self):
26+
def _get_icons(self):
2727
"""
2828
Returns:
29-
np.array: [[x1, y1], [x2, y2]], location of the bar icon upper left corner.
29+
np.array: [[x1, y1], [x2, y2]], location of the expbook icon upper left corner.
3030
"""
31-
area = (43, 178, 875, 478)
31+
area = (43, 298, 875, 604)
3232
image = self.image_crop(area, copy=True)
33-
bars = TEMPLATE_ISLAND_SEASON_TASK_ICON.match_multi(image, threshold=5)
33+
bars = TEMPLATE_ISLAND_SEASON_REWARD.match_multi(image, threshold=5)
3434
bars = Points([(0., b.area[1]) for b in bars]).group(threshold=5)
3535
logger.attr('bars_icon', len(bars))
3636
return bars
3737

38-
def wait_until_bar_appear(self, skip_first_screenshot=False):
38+
def wait_until_icon_appear(self, skip_first_screenshot=False):
3939
"""
4040
After entering season task page,
4141
tasks are not loaded that fast,
4242
wait until any bar icon appears.
4343
"""
4444
confirm_timer = Timer(1.5, count=3).start()
4545
for _ in self.loop(skip_first=skip_first_screenshot):
46-
bars = self._get_bars()
47-
if len(bars):
46+
icons = self._get_icons()
47+
if len(icons):
4848
if confirm_timer.reached():
4949
return
5050
else:
@@ -54,35 +54,35 @@ def wait_until_bar_appear(self, skip_first_screenshot=False):
5454

5555
@cached_property
5656
def task_grid(self):
57-
return self.task_bar_grid()
57+
return self.task_icon_grid()
5858

59-
def task_bar_grid(self):
59+
def task_icon_grid(self):
6060
"""
6161
Returns:
6262
ButtonGrid:
6363
"""
64-
bars = self._get_bars()
65-
count = len(bars)
64+
icons = self._get_icons()
65+
count = len(icons)
6666
if count == 0:
6767
logger.warning('Unable to find bar icon, assume task list is at top')
6868
origin_y = 178
6969
delta_y = 229
7070
row = 2
7171
elif count == 1:
72-
y_list = bars[:, 1]
73-
# -16 to adjust the bar position to grid position
74-
origin_y = y_list[0] - 16 + 178
72+
y_list = icons[:, 1]
73+
# -18 to adjust the icon position to grid position
74+
origin_y = y_list[0] - 18 + 178
7575
delta_y = 229
7676
row = 1
7777
elif count == 2:
78-
y_list = bars[:, 1]
79-
origin_y = min(y_list) - 16 + 178
78+
y_list = icons[:, 1]
79+
origin_y = min(y_list) - 18 + 178
8080
delta_y = abs(y_list[1] - y_list[0])
8181
row = 2
8282
else:
83-
logger.warning(f'Too many bars found ({count}), assume max rows')
84-
y_list = bars[:, 1]
85-
origin_y = min(y_list) - 16 + 178
83+
logger.warning(f'Too many icons found ({count}), assume max rows')
84+
y_list = icons[:, 1]
85+
origin_y = min(y_list) - 18 + 178
8686
delta_y = abs(y_list[1] - y_list[0])
8787
row = 2
8888
task_grid = ButtonGrid(
@@ -152,7 +152,7 @@ def scan_all(self):
152152
recipe_id: (item_id, current, total)
153153
}
154154
"""
155-
self.wait_until_bar_appear()
155+
self.wait_until_icon_appear()
156156
logger.hr('Scanning seasonal tasks')
157157
ISLAND_SEASON_TASK_SCROLL.set_top(main=self)
158158
unfinished_tasks = {}

0 commit comments

Comments
 (0)