1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-24 03:25:28 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
RedDeadDepresso
dff39db5b6 perf: momotalk 2024-01-03 23:51:36 +00:00
RedDeadDepresso
5e229d7797 chore: updated requirements.txt 2024-01-03 22:58:29 +00:00
4 changed files with 8 additions and 14 deletions

View File

@ -31,6 +31,9 @@ starlette==0.14.2
uvicorn[standard]==0.17.6 uvicorn[standard]==0.17.6
aiofiles aiofiles
# GUI
customtkinter
# For dev # For dev
# pip-tools # pip-tools
pynput pynput

View File

@ -19,6 +19,8 @@ cigam==0.0.3 # via apkutils2
click==8.1.3 # via uvicorn click==8.1.3 # via uvicorn
colorama==0.4.6 # via click, logzero, tqdm, uvicorn colorama==0.4.6 # via click, logzero, tqdm, uvicorn
coloredlogs==15.0.1 # via onnxruntime coloredlogs==15.0.1 # via onnxruntime
customtkinter==5.2.1 # via -r requirements-in.txt
darkdetect==0.8.0 # via customtkinter
decorator==5.1.1 # via retry decorator==5.1.1 # via retry
deprecated==1.2.13 # via uiautomator2 deprecated==1.2.13 # via uiautomator2
deprecation==2.1.0 # via adbutils deprecation==2.1.0 # via adbutils

View File

@ -33,7 +33,7 @@ class MomoTalk(MomoTalkUI):
return MomoTalkStatus.OPEN return MomoTalkStatus.OPEN
case MomoTalkStatus.STORY: case MomoTalkStatus.STORY:
if self.skip_story(): if self.skip_story():
return MomoTalkStatus.OPEN return MomoTalkStatus.CHAT
case MomoTalkStatus.FINISHED: case MomoTalkStatus.FINISHED:
return status return status
case _: case _:

View File

@ -33,6 +33,7 @@ class MomoTalkUI(UI):
super().__init__(config, device) super().__init__(config, device)
self.swipe_vector_range = (0.65, 0.85) self.swipe_vector_range = (0.65, 0.85)
self.list = CHAT_AREA self.list = CHAT_AREA
self.click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False): def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False):
""" """
@ -58,16 +59,6 @@ class MomoTalkUI(UI):
vector = (-vector[0], -vector[1]) vector = (-vector[0], -vector[1])
main.device.swipe_vector(vector, self.list.button) main.device.swipe_vector(vector, self.list.button)
def select_then_check(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper, similarity=0.85):
timer = Timer(5, 10).start()
while 1:
self.device.screenshot()
self.appear_then_click(dest_enter, interval=1, similarity=similarity)
if self.appear(dest_check, similarity=similarity):
return True
if timer.reached():
return False
def select_then_disappear(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper): def select_then_disappear(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
timer = Timer(5, 10).start() timer = Timer(5, 10).start()
while 1: while 1:
@ -94,10 +85,8 @@ class MomoTalkUI(UI):
def click_all(self, template, x_add=0, y_add=0): def click_all(self, template, x_add=0, y_add=0):
""" """
Find the all the locations of the template adding an offset if specified and click them. Find the all the locations of the template adding an offset if specified and click them.
TODO: filter coords that are not inside the chat area as otherwise it will close momotalk.
If after filter, no coords then swipe. If after filter, no coords then swipe.
""" """
click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
image = self.device.screenshot() image = self.device.screenshot()
result = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED) result = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED)
threshold = 0.8 threshold = 0.8
@ -109,7 +98,7 @@ class MomoTalkUI(UI):
if seen: if seen:
if y_add != 0: if y_add != 0:
seen = filter(lambda x: point_in_area(x, CHAT_AREA.area), seen) seen = filter(lambda x: point_in_area(x, CHAT_AREA.area), seen)
[click_coords(coords[0], coords[1]) for coords in seen] [self.click_coords(coords[0], coords[1]) for coords in seen]
self.swipe_page("down", self) self.swipe_page("down", self)
return True return True
return False return False