mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Fix: Obtain position & closed (#464)
* Fix: Obtain position & closed * Add: find may_obtain to locate obtain_1 * Fix: stupid bug
This commit is contained in:
parent
2e05ff729c
commit
384c4302a2
BIN
assets/cn/combat/obtain/MAY_OBTAIN.SEARCH.png
Normal file
BIN
assets/cn/combat/obtain/MAY_OBTAIN.SEARCH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
assets/cn/combat/obtain/MAY_OBTAIN.png
Normal file
BIN
assets/cn/combat/obtain/MAY_OBTAIN.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
assets/en/combat/obtain/MAY_OBTAIN.SEARCH.png
Normal file
BIN
assets/en/combat/obtain/MAY_OBTAIN.SEARCH.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
assets/en/combat/obtain/MAY_OBTAIN.png
Normal file
BIN
assets/en/combat/obtain/MAY_OBTAIN.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
@ -33,6 +33,23 @@ ITEM_NAME = ButtonWrapper(
|
||||
button=(495, 187, 855, 211),
|
||||
),
|
||||
)
|
||||
MAY_OBTAIN = ButtonWrapper(
|
||||
name='MAY_OBTAIN',
|
||||
cn=Button(
|
||||
file='./assets/cn/combat/obtain/MAY_OBTAIN.png',
|
||||
area=(813, 379, 893, 397),
|
||||
search=(812, 373, 895, 468),
|
||||
color=(63, 71, 87),
|
||||
button=(813, 379, 893, 397),
|
||||
),
|
||||
en=Button(
|
||||
file='./assets/en/combat/obtain/MAY_OBTAIN.png',
|
||||
area=(813, 379, 922, 397),
|
||||
search=(813, 373, 923, 468),
|
||||
color=(53, 61, 78),
|
||||
button=(813, 379, 922, 397),
|
||||
),
|
||||
)
|
||||
OBTAIN_1 = ButtonWrapper(
|
||||
name='OBTAIN_1',
|
||||
share=Button(
|
||||
|
@ -5,7 +5,7 @@ from module.exception import ScriptError
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Digit
|
||||
from tasks.combat.assets.assets_combat_obtain import *
|
||||
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE, WAVE_MINUS, WAVE_PLUS
|
||||
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
||||
from tasks.dungeon.keywords import DungeonList
|
||||
from tasks.planner.keywords import ITEM_CLASSES
|
||||
from tasks.planner.model import ObtainedAmmount, PlannerMixin
|
||||
@ -87,10 +87,8 @@ class CombatObtain(PlannerMixin):
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if not self.appear(ITEM_CLOSE) and self.appear(COMBAT_PREPARE):
|
||||
if self.image_color_count(WAVE_MINUS, color=(246, 246, 246), threshold=221, count=100) \
|
||||
or self.image_color_count(WAVE_PLUS, color=(246, 246, 246), threshold=221, count=100):
|
||||
break
|
||||
if not self.appear(ITEM_CLOSE) and self.appear(COMBAT_PREPARE) and self.appear(MAY_OBTAIN):
|
||||
break
|
||||
if self.appear_then_click(ITEM_CLOSE, interval=2):
|
||||
continue
|
||||
|
||||
@ -187,6 +185,9 @@ class CombatObtain(PlannerMixin):
|
||||
index = 1
|
||||
prev = None
|
||||
items = []
|
||||
|
||||
self._find_may_obtain()
|
||||
|
||||
for _ in range(5):
|
||||
entry = self._obtain_get_entry(dungeon, index=index, prev=prev)
|
||||
if entry is None:
|
||||
@ -243,6 +244,17 @@ class CombatObtain(PlannerMixin):
|
||||
self.obtain_frequent_check = True
|
||||
return False
|
||||
|
||||
def _find_may_obtain(self, skip_first_screenshot=True):
|
||||
logger.info('Find may obtain')
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
if MAY_OBTAIN.match_template(self.device.image):
|
||||
OBTAIN_1.load_offset(MAY_OBTAIN)
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
self = CombatObtain('src')
|
||||
|
Loading…
Reference in New Issue
Block a user