0
0
mirror of https://github.com/ok-oldking/ok-wuthering-waves.git synced 2025-06-05 08:25:28 +00:00

优化跳过剧情

This commit is contained in:
firedcto@gmail.com 2024-09-29 13:55:42 +08:00
parent fc74321d23
commit 094cf6c1fc
3 changed files with 30 additions and 28 deletions

View File

@ -431,32 +431,6 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck):
return self.check_in_multiplayer() return self.check_in_multiplayer()
return self._in_multiplayer return self._in_multiplayer
def in_team(self):
if self.in_multiplayer():
return False, -1, -1
c1 = self.find_one('char_1_text',
threshold=0.75)
c2 = self.find_one('char_2_text',
threshold=0.75)
c3 = self.find_one('char_3_text',
threshold=0.75)
arr = [c1, c2, c3]
# logger.debug(f'in_team check {arr} time: {(time.time() - start):.3f}s')
current = -1
exist_count = 0
for i in range(len(arr)):
if arr[i] is None:
if current == -1:
current = i
else:
exist_count += 1
if exist_count == 2 or exist_count == 1:
return True, current, exist_count + 1
else:
return False, -1, exist_count + 1
# Function to check if a component forms a ring
def mouse_reset(self): def mouse_reset(self):
# # logger.debug("mouse_reset") # # logger.debug("mouse_reset")
# try: # try:

View File

@ -1,7 +1,7 @@
import re
import time import time
from datetime import datetime, timedelta
import re
from datetime import datetime, timedelta
from ok.config.ConfigOption import ConfigOption from ok.config.ConfigOption import ConfigOption
from ok.feature.FindFeature import FindFeature from ok.feature.FindFeature import FindFeature
from ok.logging.Logger import get_logger from ok.logging.Logger import get_logger
@ -258,6 +258,32 @@ class BaseWWTask(BaseTask, FindFeature, OCR):
return self.in_team()[ return self.in_team()[
0] # and self.find_one(f'gray_book_button', threshold=0.7, canny_lower=50, canny_higher=150) 0] # and self.find_one(f'gray_book_button', threshold=0.7, canny_lower=50, canny_higher=150)
def in_team(self):
if self.in_multiplayer():
return False, -1, -1
c1 = self.find_one('char_1_text',
threshold=0.75)
c2 = self.find_one('char_2_text',
threshold=0.75)
c3 = self.find_one('char_3_text',
threshold=0.75)
arr = [c1, c2, c3]
# logger.debug(f'in_team check {arr} time: {(time.time() - start):.3f}s')
current = -1
exist_count = 0
for i in range(len(arr)):
if arr[i] is None:
if current == -1:
current = i
else:
exist_count += 1
if exist_count == 2 or exist_count == 1:
return True, current, exist_count + 1
else:
return False, -1, exist_count + 1
# Function to check if a component forms a ring
def handle_monthly_card(self): def handle_monthly_card(self):
monthly_card = self.find_one('monthly_card', threshold=0.8) monthly_card = self.find_one('monthly_card', threshold=0.8)
# self.screenshot('monthly_card1') # self.screenshot('monthly_card1')

View File

@ -38,6 +38,8 @@ class AutoDialogTask(TriggerTask, BaseWWTask, FindFeature, OCR):
if skip_button := self.find_one('skip_quest_confirm', threshold=0.8): if skip_button := self.find_one('skip_quest_confirm', threshold=0.8):
self.click(skip_button) self.click(skip_button)
return True return True
if self.in_team_and_world():
return True
def trigger(self): def trigger(self):
skip = self.ocr(0.03, 0.03, 0.11, 0.10, target_height=540, match=re.compile(r'SKIP', re.IGNORECASE), skip = self.ocr(0.03, 0.03, 0.11, 0.10, target_height=540, match=re.compile(r'SKIP', re.IGNORECASE),