Upd: BOOKS_GRID and fix skill exp detection

This commit is contained in:
LmeSzinc 2022-04-09 14:17:05 +08:00
parent 47eb50789e
commit df6e93854d
6 changed files with 13 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -4,7 +4,7 @@ from module.base.template import Template
# This file was automatically generated by dev_tools/button_extract.py.
# Don't modify it manually.
OCR_SKILL_EXP = Button(area={'cn': (859, 189, 950, 207), 'en': (859, 189, 950, 207), 'jp': (859, 189, 950, 207), 'tw': (859, 189, 950, 207)}, color={'cn': (77, 90, 79), 'en': (77, 90, 79), 'jp': (77, 90, 79), 'tw': (77, 90, 79)}, button={'cn': (859, 189, 950, 207), 'en': (859, 189, 950, 207), 'jp': (859, 189, 950, 207), 'tw': (859, 189, 950, 207)}, file={'cn': './assets/cn/tactical/OCR_SKILL_EXP.png', 'en': './assets/en/tactical/OCR_SKILL_EXP.png', 'jp': './assets/jp/tactical/OCR_SKILL_EXP.png', 'tw': './assets/tw/tactical/OCR_SKILL_EXP.png'})
OCR_SKILL_EXP = Button(area={'cn': (821, 191, 951, 209), 'en': (821, 191, 951, 209), 'jp': (821, 191, 951, 209), 'tw': (821, 191, 951, 209)}, color={'cn': (76, 85, 83), 'en': (76, 85, 83), 'jp': (76, 85, 83), 'tw': (76, 85, 83)}, button={'cn': (821, 191, 951, 209), 'en': (821, 191, 951, 209), 'jp': (821, 191, 951, 209), 'tw': (821, 191, 951, 209)}, file={'cn': './assets/cn/tactical/OCR_SKILL_EXP.png', 'en': './assets/en/tactical/OCR_SKILL_EXP.png', 'jp': './assets/jp/tactical/OCR_SKILL_EXP.png', 'tw': './assets/tw/tactical/OCR_SKILL_EXP.png'})
REWARD_2 = Button(area={'cn': (383, 404, 503, 444), 'en': (385, 407, 500, 437), 'jp': (383, 404, 503, 444), 'tw': (383, 404, 503, 444)}, color={'cn': (233, 165, 67), 'en': (236, 174, 86), 'jp': (228, 161, 61), 'tw': (233, 165, 67)}, button={'cn': (383, 404, 503, 444), 'en': (385, 407, 500, 437), 'jp': (383, 404, 503, 444), 'tw': (383, 404, 503, 444)}, file={'cn': './assets/cn/tactical/REWARD_2.png', 'en': './assets/en/tactical/REWARD_2.png', 'jp': './assets/jp/tactical/REWARD_2.png', 'tw': './assets/tw/tactical/REWARD_2.png'})
TACTICAL_CLASS_CANCEL = Button(area={'cn': (818, 591, 990, 647), 'en': (827, 596, 977, 641), 'jp': (817, 590, 991, 648), 'tw': (816, 589, 992, 649)}, color={'cn': (153, 154, 154), 'en': (159, 159, 161), 'jp': (157, 157, 158), 'tw': (154, 154, 156)}, button={'cn': (818, 591, 990, 647), 'en': (827, 596, 977, 641), 'jp': (817, 590, 991, 648), 'tw': (816, 589, 992, 649)}, file={'cn': './assets/cn/tactical/TACTICAL_CLASS_CANCEL.png', 'en': './assets/en/tactical/TACTICAL_CLASS_CANCEL.png', 'jp': './assets/jp/tactical/TACTICAL_CLASS_CANCEL.png', 'tw': './assets/tw/tactical/TACTICAL_CLASS_CANCEL.png'})
TACTICAL_CLASS_START = Button(area={'cn': (1024, 590, 1197, 648), 'en': (1040, 597, 1190, 642), 'jp': (1024, 590, 1197, 647), 'tw': (1022, 588, 1198, 648)}, color={'cn': (96, 139, 194), 'en': (85, 132, 190), 'jp': (92, 136, 190), 'tw': (98, 139, 191)}, button={'cn': (1024, 590, 1197, 648), 'en': (1040, 597, 1190, 642), 'jp': (1024, 590, 1197, 647), 'tw': (1022, 588, 1198, 648)}, file={'cn': './assets/cn/tactical/TACTICAL_CLASS_START.png', 'en': './assets/en/tactical/TACTICAL_CLASS_START.png', 'jp': './assets/jp/tactical/TACTICAL_CLASS_START.png', 'tw': './assets/tw/tactical/TACTICAL_CLASS_START.png'})

View File

@ -19,15 +19,26 @@ from module.ui.ui import UI, page_tactical, page_reward
class SkillExp(DigitCounter):
def pre_process(self, image):
# Image is like `NEXT:1900/5800`, 1900 is green and others are in white
# Convert to gray scale
r, g, b = cv2.split(image)
image = cv2.max(cv2.max(r, g), b)
try:
# Get the start pixel of letter `N` and shift to the end of `:`
starter = np.where(np.mean(image, axis=0) > 150)[0][0] + 42
except IndexError:
logger.warning('Unable to strip SKILL_EXP, skip')
starter = 0
# Crop `1900/5800`
image = image[:, starter:]
return 255 - image
SKILL_EXP = SkillExp(buttons=OCR_SKILL_EXP)
BOOKS_GRID = ButtonGrid(origin=(239, 288), delta=(140, 120), button_shape=(98, 98), grid_shape=(6, 2))
BOOKS_GRID = ButtonGrid(origin=(213, 292), delta=(147, 117), button_shape=(98, 98), grid_shape=(6, 2))
BOOK_FILTER = Filter(
regex=re.compile(
'(same)?'