Ver Fonte

Merge pull request #268 from runhey/dev

Dev
huangrunheng há 2 anos atrás
pai
commit
517d234084

BIN
bin/droidcast/DroidCast-debug-1.2.0.apk


BIN
bin/droidcast/DroidCastS-release-1.1.5.apk


BIN
bin/droidcast/DroidCast_raw-release-1.0.apk


+ 2 - 4
module/config/config_manual.py

@@ -30,10 +30,8 @@ class ConfigManual:
 
 
     # 'DroidCast', 'DroidCast_raw'
     # 'DroidCast', 'DroidCast_raw'
     DROIDCAST_VERSION = 'DroidCast'
     DROIDCAST_VERSION = 'DroidCast'
-    DROIDCAST_FILEPATH_LOCAL = './bin/droidcast/DroidCast-debug-1.2.0.apk'
-    DROIDCAST_FILEPATH_REMOTE = '/data/local/tmp/DroidCast.apk'
-    DROIDCAST_RAW_FILEPATH_LOCAL = './bin/droidcast/DroidCastS-release-1.1.5.apk'
-    DROIDCAST_RAW_FILEPATH_REMOTE = '/data/local/tmp/DroidCastS.apk'
+    DROIDCAST_FILEPATH_LOCAL = './bin/droidcast/DroidCast_raw-release-1.0.apk'
+    DROIDCAST_FILEPATH_REMOTE = '/data/local/tmp/DroidCast_raw.apk'
 
 
     MINITOUCH_FILEPATH_REMOTE = '/data/local/tmp/minitouch'
     MINITOUCH_FILEPATH_REMOTE = '/data/local/tmp/minitouch'
 
 

+ 86 - 87
module/device/method/droidcast.py

@@ -91,7 +91,7 @@ def retry(func):
 class DroidCast(Uiautomator2):
 class DroidCast(Uiautomator2):
     """
     """
     DroidCast, another screenshot method, https://github.com/rayworks/DroidCast
     DroidCast, another screenshot method, https://github.com/rayworks/DroidCast
-    DroidCast_raw, a modified version of DroidCast sending raw bitmap https://github.com/Torther/DroidCastS
+    DroidCast_raw, a modified version of DroidCast sending raw bitmap and png, https://github.com/Torther/DroidCastS
     """
     """
 
 
     _droidcast_port: int = 0
     _droidcast_port: int = 0
@@ -105,24 +105,16 @@ class DroidCast(Uiautomator2):
         self._droidcast_port = self.adb_forward('tcp:53516')
         self._droidcast_port = self.adb_forward('tcp:53516')
         return session
         return session
 
 
-    def droidcast_url(self, url='/screenshot?format=png'):
-        """
-        Check APIs from source code:
-        https://github.com/rayworks/DroidCast/blob/master/app/src/main/java/com/rayworks/droidcast/Main.java
-
-        Available APIs:
-        - /screenshot
-            To get JPG screenshots.
-        - /screenshot?format=png
-            To get PNG screenshots.
-        - /screenshot?format=webp
-            To get WEBP screenshots.
-        - /src
-            Websocket to get JPG screenshots.
-
-        Note that /screenshot?format=jpg is unavailable.
-        """
-    
+    """
+    Check APIs from source code:
+    https://github.com/Torther/DroidCast_raw/blob/DroidCast_raw/app/src/main/java/ink/mol/droidcast_raw/KtMain.kt
+    Available APIs:
+    - /screenshot
+        To get a RGB565 bitmap
+    - /preview
+        To get PNG screenshots.
+    """
+    def droidcast_url(self, url='/preview'):
         if self.is_mumu_over_version_356:
         if self.is_mumu_over_version_356:
             w, h = self.droidcast_width, self.droidcast_height
             w, h = self.droidcast_width, self.droidcast_height
             if self.orientation == 0:
             if self.orientation == 0:
@@ -132,7 +124,6 @@ class DroidCast(Uiautomator2):
             else:
             else:
                 # logger.warning('DroidCast receives invalid device orientation')
                 # logger.warning('DroidCast receives invalid device orientation')
                 pass
                 pass
-
         return f'http://127.0.0.1:{self._droidcast_port}{url}'
         return f'http://127.0.0.1:{self._droidcast_port}{url}'
 
 
     def droidcast_raw_url(self, url='/screenshot'):
     def droidcast_raw_url(self, url='/screenshot'):
@@ -145,12 +136,11 @@ class DroidCast(Uiautomator2):
             else:
             else:
                 # logger.warning('DroidCast receives invalid device orientation')
                 # logger.warning('DroidCast receives invalid device orientation')
                 pass
                 pass
-
         return f'http://127.0.0.1:{self._droidcast_port}{url}'
         return f'http://127.0.0.1:{self._droidcast_port}{url}'
 
 
-    @Config.when(DROIDCAST_VERSION='DroidCast')
+
     def droidcast_init(self):
     def droidcast_init(self):
-        logger.hr('Droidcast init')
+        logger.hr('DroidCast init')
         self.droidcast_stop()
         self.droidcast_stop()
         self._droidcast_update_resolution()
         self._droidcast_update_resolution()
 
 
@@ -158,21 +148,29 @@ class DroidCast(Uiautomator2):
         self.adb_push(self.config.DROIDCAST_FILEPATH_LOCAL, self.config.DROIDCAST_FILEPATH_REMOTE)
         self.adb_push(self.config.DROIDCAST_FILEPATH_LOCAL, self.config.DROIDCAST_FILEPATH_REMOTE)
 
 
         logger.info('Starting DroidCast apk')
         logger.info('Starting DroidCast apk')
-        # CLASSPATH=/data/local/tmp/DroidCast.apk app_process / com.rayworks.droidcast.Main > /dev/null
+        # DroidCast_raw-release-1.0.apk
+        # CLASSPATH=/data/local/tmp/DroidCast_raw.apk app_process / ink.mol.droidcast_raw.Main > /dev/null
+        # adb shell CLASSPATH=/data/local/tmp/DroidCast_raw.apk app_process / ink.mol.droidcast_raw.Main
         resp = self.u2_shell_background([
         resp = self.u2_shell_background([
-            'CLASSPATH=/data/local/tmp/DroidCast.apk',
+            'CLASSPATH=/data/local/tmp/DroidCast_raw.apk',
             'app_process',
             'app_process',
             '/',
             '/',
-            'com.rayworks.droidcast.Main',
+            'ink.mol.droidcast_raw.Main',
             '>',
             '>',
             '/dev/null'
             '/dev/null'
         ])
         ])
         logger.info(resp)
         logger.info(resp)
-
         del_cached_property(self, 'droidcast_session')
         del_cached_property(self, 'droidcast_session')
         _ = self.droidcast_session
         _ = self.droidcast_session
-        logger.attr('DroidCast', self.droidcast_url())
-        self.droidcast_wait_startup()
+
+        if self.config.DROIDCAST_VERSION == 'DroidCast':
+            logger.attr('DroidCast', self.droidcast_url())
+            self.droidcast_wait_startup()
+        elif self.config.DROIDCAST_VERSION == 'DroidCast_raw':
+            logger.attr('DroidCast_raw', self.droidcast_raw_url())
+            self.droidcast_wait_startup()
+        else:
+            logger.error(f'Unknown DROIDCAST_VERSION: {self.config.DROIDCAST_VERSION}')
 
 
     def _droidcast_update_resolution(self):
     def _droidcast_update_resolution(self):
         if self.is_mumu_over_version_356:
         if self.is_mumu_over_version_356:
@@ -184,32 +182,6 @@ class DroidCast(Uiautomator2):
             self.droidcast_width, self.droidcast_height = w, h
             self.droidcast_width, self.droidcast_height = w, h
             logger.info(f'Droicast resolution: {(w, h)}')
             logger.info(f'Droicast resolution: {(w, h)}')
 
 
-    @Config.when(DROIDCAST_VERSION='DroidCast_raw')
-    def droidcast_init(self):
-        logger.hr('Droidcast init')
-        self.resolution_check_uiautomator2()
-        self.droidcast_stop()
-
-        logger.info('Pushing DroidCast apk')
-        self.adb_push(self.config.DROIDCAST_RAW_FILEPATH_LOCAL, self.config.DROIDCAST_RAW_FILEPATH_REMOTE)
-
-        logger.info('Starting DroidCast apk')
-        # DroidCastS-release-1.1.5.apk
-        # CLASSPATH=/data/local/tmp/DroidCastS-release-1.1.5.apk app_process / com.torther.droidcasts.Main > /dev/null
-        resp = self.u2_shell_background([
-            'CLASSPATH=/data/local/tmp/DroidCastS.apk',
-            'app_process',
-            '/',
-            'com.torther.droidcasts.Main',
-            '>',
-            '/dev/null'
-        ])
-        logger.info(resp)
-
-        del_cached_property(self, 'droidcast_session')
-        _ = self.droidcast_session
-        logger.attr('DroidCast', self.droidcast_url())
-        self.droidcast_wait_startup()
 
 
     @retry
     @retry
     def screenshot_droidcast(self):
     def screenshot_droidcast(self):
@@ -219,7 +191,11 @@ class DroidCast(Uiautomator2):
             if not self.droidcast_width or not self.droidcast_height:
             if not self.droidcast_width or not self.droidcast_height:
                 self._droidcast_update_resolution()
                 self._droidcast_update_resolution()
 
 
-        image = self.droidcast_session.get(self.droidcast_url(), timeout=3).content
+        resp = self.droidcast_session.get(self.droidcast_url(), timeout=3)
+
+        if resp.status_code == 404:
+            raise DroidCastVersionIncompatible('DroidCast server does not have /preview')
+        image = resp.content
         image = np.frombuffer(image, np.uint8)
         image = np.frombuffer(image, np.uint8)
         if image is None:
         if image is None:
             raise ImageTruncated('Empty image after reading from buffer')
             raise ImageTruncated('Empty image after reading from buffer')
@@ -251,12 +227,24 @@ class DroidCast(Uiautomator2):
             if self.droidcast_height and self.droidcast_width:
             if self.droidcast_height and self.droidcast_width:
                 shape = (self.droidcast_height, self.droidcast_width)
                 shape = (self.droidcast_height, self.droidcast_width)
 
 
+        rotate = self.is_mumu_over_version_356 and self.orientation == 1
+
         image = self.droidcast_session.get(self.droidcast_raw_url(), timeout=3).content
         image = self.droidcast_session.get(self.droidcast_raw_url(), timeout=3).content
         # DroidCast_raw returns a RGB565 bitmap
         # DroidCast_raw returns a RGB565 bitmap
 
 
         try:
         try:
-            arr = np.frombuffer(image, dtype=np.uint16).reshape(shape)
+            arr = np.frombuffer(image, dtype=np.uint16)
+            if rotate:
+                arr = arr.reshape(shape)
+                # arr = cv2.rotate(arr, cv2.ROTATE_90_CLOCKWISE)
+                # A little bit faster?
+                arr = cv2.transpose(arr)
+                cv2.flip(arr, 1, dst=arr)
+            else:
+                arr = arr.reshape(shape)
         except ValueError as e:
         except ValueError as e:
+            if len(image) < 500:
+                logger.warning(f'Unexpected screenshot: {image}')
             # Try to load as `DroidCast`
             # Try to load as `DroidCast`
             image = np.frombuffer(image, np.uint8)
             image = np.frombuffer(image, np.uint8)
             if image is not None:
             if image is not None:
@@ -267,32 +255,39 @@ class DroidCast(Uiautomator2):
             # ValueError: cannot reshape array of size 0 into shape (720,1280)
             # ValueError: cannot reshape array of size 0 into shape (720,1280)
             raise ImageTruncated(str(e))
             raise ImageTruncated(str(e))
 
 
-        # Convert RGB565 to RGB888
-        # https://blog.csdn.net/happy08god/article/details/10516871
-
-        # r = (arr & 0b1111100000000000) >> (11 - 3)
-        # g = (arr & 0b0000011111100000) >> (5 - 2)
-        # b = (arr & 0b0000000000011111) << 3
-        # r |= (r & 0b11100000) >> 5
-        # g |= (g & 0b11000000) >> 6
-        # b |= (b & 0b11100000) >> 5
-        # r = r.astype(np.uint8)
-        # g = g.astype(np.uint8)
-        # b = b.astype(np.uint8)
-        # image = cv2.merge([r, g, b])
-
-        # The same as the code above but costs about 5ms instead of 10ms.
-        r = cv2.multiply(arr & 0b1111100000000000, 0.00390625).astype(np.uint8)
-        g = cv2.multiply(arr & 0b0000011111100000, 0.125).astype(np.uint8)
-        b = cv2.multiply(arr & 0b0000000000011111, 8).astype(np.uint8)
-        r = cv2.add(r, cv2.multiply(r, 0.03125))
-        g = cv2.add(g, cv2.multiply(g, 0.015625))
-        b = cv2.add(b, cv2.multiply(b, 0.03125))
-        image = cv2.merge([r, g, b])
+            # Convert RGB565 to RGB888
+            # https://blog.csdn.net/happy08god/article/details/10516871
+
+            # r = (arr & 0b1111100000000000) >> (11 - 3)
+            # g = (arr & 0b0000011111100000) >> (5 - 2)
+            # b = (arr & 0b0000000000011111) << 3
+            # r |= (r & 0b11100000) >> 5
+            # g |= (g & 0b11000000) >> 6
+            # b |= (b & 0b11100000) >> 5
+            # r = r.astype(np.uint8)
+            # g = g.astype(np.uint8)
+            # b = b.astype(np.uint8)
+            # image = cv2.merge([r, g, b])
+
+            # The same as the code above but costs about 3~4ms instead of 10ms.
+            # Note that cv2.convertScaleAbs is 5x fast as cv2.multiply, cv2.add is 8x fast as cv2.convertScaleAbs
+            # Note that cv2.convertScaleAbs includes rounding
+        r = cv2.bitwise_and(arr, 0b1111100000000000)
+        r = cv2.convertScaleAbs(r, alpha=0.00390625)
+        m = cv2.convertScaleAbs(r, alpha=0.03125)
+        cv2.add(r, m, dst=r)
+
+        g = cv2.bitwise_and(arr, 0b0000011111100000)
+        g = cv2.convertScaleAbs(g, alpha=0.125)
+        m = cv2.convertScaleAbs(g, alpha=0.015625, dst=m)
+        cv2.add(g, m, dst=g)
+
+        b = cv2.bitwise_and(arr, 0b0000000000011111)
+        b = cv2.convertScaleAbs(b, alpha=8)
+        m = cv2.convertScaleAbs(b, alpha=0.03125, dst=m)
+        cv2.add(b, m, dst=b)
 
 
-        if self.is_mumu_over_version_356:
-            if self.orientation == 1:
-                image = cv2.rotate(image, cv2.ROTATE_90_CLOCKWISE)
+        image = cv2.merge([r, g, b])
 
 
         return image
         return image
 
 
@@ -320,13 +315,13 @@ class DroidCast(Uiautomator2):
 
 
     def droidcast_uninstall(self):
     def droidcast_uninstall(self):
         """
         """
-        Stop all DroidCast processes and remove DroidCast APK.
-        DroidCast has't been installed but a JAVA class call, uninstall is a file delete.
+        Stop DroidCast processes and remove DroidCast APK.
+        DroidCast hasn't been installed but a JAVA class call, uninstall is a file delete.
         """
         """
         self.droidcast_stop()
         self.droidcast_stop()
         logger.info('Removing DroidCast')
         logger.info('Removing DroidCast')
         self.adb_shell(["rm", self.config.DROIDCAST_FILEPATH_REMOTE])
         self.adb_shell(["rm", self.config.DROIDCAST_FILEPATH_REMOTE])
-        self.adb_shell(["rm", self.config.DROIDCAST_RAW_FILEPATH_REMOTE])
+
 
 
     def _iter_droidcast_proc(self) -> t.Iterable[ProcessInfo]:
     def _iter_droidcast_proc(self) -> t.Iterable[ProcessInfo]:
         """
         """
@@ -338,17 +333,21 @@ class DroidCast(Uiautomator2):
                 yield proc
                 yield proc
             if 'com.torther.droidcasts.Main' in proc.cmdline:
             if 'com.torther.droidcasts.Main' in proc.cmdline:
                 yield proc
                 yield proc
+            if 'ink.mol.droidcast_raw.Main' in proc.cmdline:
+                yield proc
 
 
     def droidcast_stop(self):
     def droidcast_stop(self):
         """
         """
-        Stop all DroidCast processes.
+        Stop DroidCast processes.
         """
         """
         logger.info('Stopping DroidCast')
         logger.info('Stopping DroidCast')
         for proc in self._iter_droidcast_proc():
         for proc in self._iter_droidcast_proc():
             logger.info(f'Kill pid={proc.pid}')
             logger.info(f'Kill pid={proc.pid}')
             self.adb_shell(['kill', '-s', 9, proc.pid])
             self.adb_shell(['kill', '-s', 9, proc.pid])
 
 
+
+
 if __name__ == '__main__':
 if __name__ == '__main__':
     dc = DroidCast(config='oas1')
     dc = DroidCast(config='oas1')
-    cv2.imshow("iiii", dc.screenshot_droidcast())
+    cv2.imshow("iiii", dc.screenshot_droidcast_raw())
     cv2.waitKey(0)
     cv2.waitKey(0)

+ 0 - 2
tasks/Component/GeneralRoom/assets.py

@@ -37,8 +37,6 @@ class GeneralRoomAssets:
 	# description 
 	# description 
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	# description 
 	# description 
-	I_GR_MATCHING_NEW = RuleImage(roi_front=(62,571,42,121), roi_back=(62,571,42,121), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png")
-	# description 
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 	# 自动匹配 
 	# 自动匹配 
 	I_GR_AUTO_MATCH = RuleImage(roi_front=(697,598,181,63), roi_back=(697,598,181,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_auto_match.png")
 	I_GR_AUTO_MATCH = RuleImage(roi_front=(697,598,181,63), roi_back=(697,598,181,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_auto_match.png")

+ 2 - 2
tasks/Component/GeneralRoom/general_room.py

@@ -105,11 +105,11 @@ class GeneralRoom(BaseTask, GeneralRoomAssets):
         在组队界面 退出组队的界面, 返回到庭院或者是你一开始进入的入口
         在组队界面 退出组队的界面, 返回到庭院或者是你一开始进入的入口
         :return:
         :return:
         """
         """
-        if self.appear(self.I_GR_MATCHING_NEW):
+        if self.appear(self.I_CHECK_TEAM):
             logger.info('Exit team ui')
             logger.info('Exit team ui')
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
-                if not self.appear(self.I_GR_MATCHING_NEW):
+                if not self.appear(self.I_CHECK_TEAM):
                     return True
                     return True
                 if self.appear_then_click(self.I_GR_BACK_YELLOW, interval=0.5):
                 if self.appear_then_click(self.I_GR_BACK_YELLOW, interval=0.5):
                     continue
                     continue

BIN
tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png


+ 0 - 9
tasks/Component/GeneralRoom/gr/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
-  {
-    "itemName": "gr_matching_new",
-    "imageName": "gr_gr_matching_new.png",
-    "roiFront": "62,571,42,121",
-    "roiBack": "62,571,42,121",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "gr_back_yellow",
     "itemName": "gr_back_yellow",
     "imageName": "gr_gr_back_yellow.png",
     "imageName": "gr_gr_back_yellow.png",

+ 2 - 1
tasks/DailyTrifles/script_task.py

@@ -108,5 +108,6 @@ if __name__ == '__main__':
     d = Device(c)
     d = Device(c)
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)
 
 
-    t.run_one_summon()
+    # t.run_one_summon()
+    t.run_store_sign()
 
 

+ 0 - 2
tasks/EvoZone/assets.py

@@ -23,8 +23,6 @@ class EvoZoneAssets:
 	I_EVOZONE_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/EvoZone/o/o_evozone_fire.png")
 	I_EVOZONE_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/EvoZone/o/o_evozone_fire.png")
 	# 式神录 
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_shi_records.png")
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_shi_records.png")
-	# description 
-	I_EVOZONE_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_evozone_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_pet_present.png")
 	# 风麒麟进入 
 	# 风麒麟进入 

+ 0 - 9
tasks/EvoZone/o/image.json

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "式神录"
     "description": "式神录"
   },
   },
-  {
-    "itemName": "evozone_matching",
-    "imageName": "o_evozone_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "o_pet_present.png",
     "imageName": "o_pet_present.png",

BIN
tasks/EvoZone/o/o_evozone_matching.png


+ 1 - 1
tasks/EvoZone/script_task.py

@@ -138,7 +138,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_EVOZONE_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue

+ 1 - 1
tasks/Exploration/script_task.py

@@ -258,7 +258,7 @@ if __name__ == "__main__":
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
 
 
-    config = Config('oas2')
+    config = Config('oas1')
     device = Device(config)
     device = Device(config)
     t = ScriptTask(config, device)
     t = ScriptTask(config, device)
     t.config.exploration.exploration_config.exploration_level = '第二十八章'
     t.config.exploration.exploration_config.exploration_level = '第二十八章'

+ 0 - 2
tasks/FallenSun/assets.py

@@ -21,8 +21,6 @@ class FallenSunAssets:
 	I_FALLEN_SUN_UNLOCK = RuleImage(roi_front=(557,560,31,38), roi_back=(557,560,31,38), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_unlock.png")
 	I_FALLEN_SUN_UNLOCK = RuleImage(roi_front=(557,560,31,38), roi_back=(557,560,31,38), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_unlock.png")
 	# description 
 	# description 
 	I_FALLEN_SUN_LOCK = RuleImage(roi_front=(557,561,31,37), roi_back=(557,561,31,37), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_lock.png")
 	I_FALLEN_SUN_LOCK = RuleImage(roi_front=(557,561,31,37), roi_back=(557,561,31,37), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_lock.png")
-	# description 
-	I_FALLEN_SUN_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_pet_present.png")
 
 

BIN
tasks/FallenSun/f/f_fallen_sun_matching.png


+ 0 - 9
tasks/FallenSun/f/image.json

@@ -44,15 +44,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
-  {
-    "itemName": "fallen_sun_matching",
-    "imageName": "f_fallen_sun_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "f_pet_present.png",
     "imageName": "f_pet_present.png",

+ 1 - 1
tasks/FallenSun/script_task.py

@@ -114,7 +114,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_FALLEN_SUN_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue

+ 1 - 1
tasks/GameUi/assets.py

@@ -155,7 +155,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_CHECK_GUILD = RuleImage(roi_front=(1072,630,49,46), roi_back=(1072,630,49,46), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_guild.png")
 	I_CHECK_GUILD = RuleImage(roi_front=(1072,630,49,46), roi_back=(1072,630,49,46), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_guild.png")
 	# description 
 	# description 
-	I_CHECK_TEAM = RuleImage(roi_front=(53,570,41,119), roi_back=(53,570,41,119), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_team.png")
+	I_CHECK_TEAM = RuleImage(roi_front=(32,585,82,90), roi_back=(32,585,82,90), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_team.png")
 	# description 
 	# description 
 	I_CHECK_COLLECTION = RuleImage(roi_front=(471,618,100,100), roi_back=(471,618,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
 	I_CHECK_COLLECTION = RuleImage(roi_front=(471,618,100,100), roi_back=(471,618,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
 	# description 
 	# description 

+ 1 - 1
tasks/GameUi/page.py

@@ -143,7 +143,7 @@ page_daily.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
 page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
 # 商店 mall
 # 商店 mall
 page_mall = Page(G.I_CHECK_MALL)
 page_mall = Page(G.I_CHECK_MALL)
-page_mall.additional = [G.I_AD_CLOSE_RED]
+page_mall.additional = [G.I_AD_CLOSE_RED, G.I_BACK_Y]
 page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
 page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 # 阴阳寮 guild
 # 阴阳寮 guild

BIN
tasks/GameUi/page/page_check_team.png


+ 2 - 2
tasks/GameUi/page/page_img_3.json

@@ -128,8 +128,8 @@
   {
   {
     "itemName": "check_team",
     "itemName": "check_team",
     "imageName": "page_check_team.png",
     "imageName": "page_check_team.png",
-    "roiFront": "53,570,41,119",
-    "roiBack": "53,570,41,119",
+    "roiFront": "32,585,82,90",
+    "roiBack": "32,585,82,90",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 2 - 0
tasks/KekkaiUtilize/assets.py

@@ -122,5 +122,7 @@ class KekkaiUtilizeAssets:
 	# Swipe Rule Assets
 	# Swipe Rule Assets
 	# 向下滑动 
 	# 向下滑动 
 	S_U_UP = RuleSwipe(roi_front=(235,419,50,21), roi_back=(225,177,72,21), mode="default", name="u_up")
 	S_U_UP = RuleSwipe(roi_front=(235,419,50,21), roi_back=(225,177,72,21), mode="default", name="u_up")
+	# 滑动到底部 
+	S_U_END = RuleSwipe(roi_front=(175,179,26,26), roi_back=(164,518,49,102), mode="default", name="u_end")
 
 
 
 

+ 11 - 2
tasks/KekkaiUtilize/script_task.py

@@ -26,8 +26,8 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_guild)
         self.ui_goto(page_guild)
         # 收体力或者资金
         # 收体力或者资金
-        # 进入寮主页会有一个动画,等一等
-        time.sleep(1)
+        # 进入寮主页会有一个动画,等一等,让小纸人跑一会儿
+        time.sleep(3)
         self.check_guild_ap_or_assets(ap_enable=con.guild_ap_enable, assets_enable=con.guild_assets_enable)
         self.check_guild_ap_or_assets(ap_enable=con.guild_ap_enable, assets_enable=con.guild_assets_enable)
         # 进入寮结界
         # 进入寮结界
         self.goto_realm()
         self.goto_realm()
@@ -297,6 +297,8 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
                 timer_click.reset()
                 timer_click.reset()
                 x, y = check_image.coord()
                 x, y = check_image.coord()
                 self.device.click(x=x, y=y, control_name=check_image.name)
                 self.device.click(x=x, y=y, control_name=check_image.name)
+        if friend == SelectFriendList.DIFFERENT_SERVER:
+            time.sleep(1)
         time.sleep(0.5)
         time.sleep(0.5)
 
 
     @cached_property
     @cached_property
@@ -374,6 +376,13 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
 
 
         logger.hr('Start utilize')
         logger.hr('Start utilize')
         self.switch_friend_list(friend)
         self.switch_friend_list(friend)
+        self.swipe(self.S_U_END, interval=3)
+        if friend == SelectFriendList.SAME_SERVER:
+            self.switch_friend_list(SelectFriendList.DIFFERENT_SERVER)
+            self.switch_friend_list(SelectFriendList.SAME_SERVER)
+        else:
+            self.switch_friend_list(SelectFriendList.SAME_SERVER)
+            self.switch_friend_list(SelectFriendList.DIFFERENT_SERVER)
         card_best = None
         card_best = None
         swipe_count = 0
         swipe_count = 0
         while 1:
         while 1:

+ 8 - 1
tasks/KekkaiUtilize/utilize/swipe.json

@@ -5,5 +5,12 @@
     "roiBack": "225,177,72,21",
     "roiBack": "225,177,72,21",
     "mode": "default",
     "mode": "default",
     "description": "向下滑动"
     "description": "向下滑动"
+  },
+  {
+    "itemName": "u_end",
+    "roiFront": "175,179,26,26",
+    "roiBack": "164,518,49,102",
+    "mode": "default",
+    "description": "滑动到底部"
   }
   }
-]
+]

+ 0 - 2
tasks/Orochi/assets.py

@@ -23,8 +23,6 @@ class OrochiAssets:
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_orochi_fire.png")
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_orochi_fire.png")
 	# 式神录 
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
-	# description 
-	I_OROCHI_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_pet_present.png")
 
 

+ 0 - 9
tasks/Orochi/o/image.json

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "式神录"
     "description": "式神录"
   },
   },
-  {
-    "itemName": "orochi_matching",
-    "imageName": "o_orochi_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "o_pet_present.png",
     "imageName": "o_pet_present.png",

BIN
tasks/Orochi/o/o_orochi_matching.png


+ 2 - 2
tasks/Orochi/script_task.py

@@ -134,7 +134,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_OROCHI_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue
@@ -332,7 +332,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             logger.info('Create team')
             logger.info('Create team')
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
-                if self.appear(self.I_OROCHI_MATCHING):
+                if self.appear(self.I_CHECK_TEAM):
                     break
                     break
                 if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                     continue
                     continue