From 0ffaf29b233d4c9ff128c4f553e4815664e1897e Mon Sep 17 00:00:00 2001 From: ZYX Date: Thu, 4 Jul 2024 02:47:30 +0800 Subject: [PATCH] - --- actions/character.csv | 4 ++-- diver.py | 45 ++++++++++++++++++++++--------------------- utils/diver/ocr.py | 2 +- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/actions/character.csv b/actions/character.csv index 9adf8aa..ab233d0 100644 --- a/actions/character.csv +++ b/actions/character.csv @@ -110,8 +110,8 @@ dot,,,1 花火,,,5 花火,,,3 花火,"同谐,量子",,1 -符玄,,,5 -符玄,"存护,量子",湮灭回归不等式,3 +符玄,,"回归不等式,不等式,归不等式",5 +符玄,"存护,量子",,3 符玄,,,1 银狼,,,5 银狼,,,3 diff --git a/diver.py b/diver.py index 7a54377..ead4ffa 100644 --- a/diver.py +++ b/diver.py @@ -28,7 +28,7 @@ from collections import defaultdict # 鐗堟湰鍙 -version = "v7.11" +version = "v7.13" class DivergentUniverse(UniverseUtils): @@ -457,10 +457,6 @@ def event(self): start = self.now_event == event_id[1] self.now_event = event_id[1] print('event_id:', event_id) - if self.debug and event_id[0] == -1: - print(self.ts.res) - while 1: - time.sleep(1) if '浜嬩欢' not in self.merge_text(self.ts.find_with_box([92, 195, 54, 88])): return @@ -472,6 +468,10 @@ def event(self): self.click((self.tx, self.ty)) # 浜嬩欢閫夋嫨鐣岄潰 elif self.check("star", 0.1828, 0.5000, mask="mask_event", threshold=0.965): + if self.debug and event_id[0] == -1: + print(self.ts.res) + while 1: + time.sleep(1) tx, ty = self.tx, self.ty self.ts.forward(self.screen) clicked = 0 @@ -585,23 +585,24 @@ def align_event(self, key, deep=0): if abs(event_text - 950) > 40: self.press(key,0.2) event_text_after = self.find_event_text() - if event_text_after == 0: - return - sub = event_text - event_text_after - if key == 'a': - sub = -sub - print('sub:', sub) - if sub < 60: - sub = 100 - if sub < 200: - sub = int((event_text_after - 950) / min(150, sub)) - sub = min(5, max(-5, int(sub))) - for _ in range(sub): - self.press('d',0.2) - time.sleep(0.1) - for _ in range(-sub): - self.press('a',0.2) - time.sleep(0.1) + if event_text_after: + sub = event_text - event_text_after + if key == 'a': + sub = -sub + print('sub:', sub) + if sub < 60: + sub = 100 + if sub < 200: + sub = int((event_text_after - 950) / min(150, sub)) + sub = min(5, max(-5, int(sub))) + for _ in range(sub): + self.press('d',0.2) + time.sleep(0.1) + for _ in range(-sub): + self.press('a',0.2) + time.sleep(0.1) + else: + self.press('a' if key == 'd' else 'd', 0.2) self.forward_until(['浜嬩欢','濂栧姳','閬亣','浜ゆ槗'], timeout=2.5, moving=0) else: if deep < 3: diff --git a/utils/diver/ocr.py b/utils/diver/ocr.py index 6de9a3c..771d4f4 100644 --- a/utils/diver/ocr.py +++ b/utils/diver/ocr.py @@ -123,7 +123,7 @@ def find_with_box(self, box=None, redundancy=10, forward=0, mode=0): if box[3]==540 or box[3] == 350 and self.father.debug: tm = str(int(time.time()*100)%1000000) cv.imwrite('img/'+tm+'.jpg',self.father.screen[box[2]:box[3],box[0]:box[1]]) - cv.imwrite('img/'+tm+'w.jpg',self.filter_non_white(self.father.screen[box[2]:box[3],box[0]:box[1]])) + cv.imwrite('img/'+tm+'w.jpg',self.filter_non_white(self.father.screen[box[2]:box[3],box[0]:box[1]], mode=mode)) ans = [] for res in self.res: if box is None: