Эх сурвалжийг харах

feat(component): add switch soul

runhey 3 жил өмнө
parent
commit
4416228cc2
32 өөрчлөгдсөн 416 нэмэгдсэн , 27 устгасан
  1. 1 1
      config/template.json
  2. 2 0
      module/config/config_menu.py
  3. 12 0
      tasks/BondlingFairyland/assets.py
  4. 2 5
      tasks/Component/GeneralInvite/general_invite.py
  5. 62 0
      tasks/Component/SwitchSoul/assets.py
  6. 44 0
      tasks/Component/SwitchSoul/ss/click.json
  7. 137 0
      tasks/Component/SwitchSoul/ss/image.json
  8. BIN
      tasks/Component/SwitchSoul/ss/ss_record_soul_back.png
  9. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_1.png
  10. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_2.png
  11. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_3.png
  12. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_4.png
  13. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_5.png
  14. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_6.png
  15. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_group_7.png
  16. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_check_in.png
  17. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png
  18. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png
  19. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png
  20. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png
  21. BIN
      tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png
  22. BIN
      tasks/Component/SwitchSoul/ss/ss_soul_preset.png
  23. 131 0
      tasks/Component/SwitchSoul/switch_soul.py
  24. 3 0
      tasks/Component/SwitchSoul/switch_soul_config.py
  25. BIN
      tasks/GameUi/page/page_check_exploration.png
  26. 2 2
      tasks/GameUi/page/page_img.json
  27. 3 3
      tasks/GlobalGame/assets.py
  28. BIN
      tasks/GlobalGame/gg/gg_accept.png
  29. BIN
      tasks/GlobalGame/gg/gg_g_accept.png
  30. BIN
      tasks/GlobalGame/gg/gg_g_reject.png
  31. 8 8
      tasks/GlobalGame/gg/image.json
  32. 9 8
      tasks/base_task.py

+ 1 - 1
config/template.json

@@ -103,7 +103,7 @@
     "scheduler": {
     "scheduler": {
       "enable": false,
       "enable": false,
       "next_run": "2023-01-01 00:00:00",
       "next_run": "2023-01-01 00:00:00",
-      "priority": 5,
+      "priority": 6,
       "success_interval": "01 00:00:00",
       "success_interval": "01 00:00:00",
       "failure_interval": "01 00:00:00",
       "failure_interval": "01 00:00:00",
       "server_update": "09:00:00"
       "server_update": "09:00:00"

+ 2 - 0
module/config/config_menu.py

@@ -22,6 +22,8 @@ class ConfigMenu:
         self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid']
         self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid']
         # 活动的任务
         # 活动的任务
         self.menu["Activity Task"] = ['ActivityShikigami']
         self.menu["Activity Task"] = ['ActivityShikigami']
+        # 很肝的任务
+        self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
 
 
         # 开发工具
         # 开发工具
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']

+ 12 - 0
tasks/BondlingFairyland/assets.py

@@ -0,0 +1,12 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by module/dev_tools/assets_extract.py.
+# Don't modify it manually.
+class BondlingFairylandAssets: 
+	pass
+

+ 2 - 5
tasks/Component/GeneralInvite/general_invite.py

@@ -39,15 +39,12 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
     timer_emoji = None  # 等待期间如果没有操作的话,可能会导致长时间无响应报错
     timer_emoji = None  # 等待期间如果没有操作的话,可能会导致长时间无响应报错
 
 
     """
     """
-    这个类就三个api
-    1. run_invite
-    2. invite_again
-    3. accept_invite
+
     """
     """
 
 
     def run_invite(self, config: InviteConfig, is_first: bool = False) -> bool:
     def run_invite(self, config: InviteConfig, is_first: bool = False) -> bool:
         """
         """
-        队长!!身份。。。在组件界面邀请好友( 如果开启is_first) 等待队员进入开启挑战
+        队长!!身份。。。在组队界面邀请好友( 如果开启is_first) 等待队员进入开启挑战
         请注意,返回的时候成功时是进入战斗了!!!
         请注意,返回的时候成功时是进入战斗了!!!
         如果是失败,那就是没有队友进入,然后会退出房间的界面
         如果是失败,那就是没有队友进入,然后会退出房间的界面
         :param config:
         :param config:

+ 62 - 0
tasks/Component/SwitchSoul/assets.py

@@ -0,0 +1,62 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by module/dev_tools/assets_extract.py.
+# Don't modify it manually.
+class SwitchSoulAssets: 
+
+
+	# Click Rule Assets
+	# description 
+	C_SOU_GROUP_1 = RuleClick(roi_front=(1086,85,158,67), roi_back=(1086,85,158,67), name="sou_group_1")
+	# description 
+	C_SOU_GROUP_2 = RuleClick(roi_front=(1087,155,162,62), roi_back=(1087,155,162,62), name="sou_group_2")
+	# description 
+	C_SOU_GROUP_3 = RuleClick(roi_front=(1088,226,154,61), roi_back=(1088,226,154,61), name="sou_group_3")
+	# description 
+	C_SOU_GROUP_4 = RuleClick(roi_front=(1087,297,157,59), roi_back=(1087,297,157,59), name="sou_group_4")
+	# description 
+	C_SOU_GROUP_5 = RuleClick(roi_front=(1087,365,154,62), roi_back=(1087,365,154,62), name="sou_group_5")
+	# description 
+	C_SOU_GROUP_6 = RuleClick(roi_front=(1088,437,156,57), roi_back=(1088,437,156,57), name="sou_group_6")
+	# description 
+	C_SOU_GROUP_7 = RuleClick(roi_front=(1090,505,156,62), roi_back=(1090,505,156,62), name="sou_group_7")
+
+
+	# Image Rule Assets
+	# 退出式神录 
+	I_RECORD_SOUL_BACK = RuleImage(roi_front=(19,9,51,44), roi_back=(19,9,51,44), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_record_soul_back.png")
+	# 预设 
+	I_SOUL_PRESET = RuleImage(roi_front=(332,70,90,51), roi_back=(332,70,90,51), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_soul_preset.png")
+	# description 
+	I_SOU_SWITCH_1 = RuleImage(roi_front=(971,148,37,35), roi_back=(971,148,37,35), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png")
+	# description 
+	I_SOU_SWITCH_2 = RuleImage(roi_front=(978,304,27,29), roi_back=(978,304,27,29), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png")
+	# description 
+	I_SOU_SWITCH_3 = RuleImage(roi_front=(973,454,26,26), roi_back=(973,454,26,26), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png")
+	# description 
+	I_SOU_SWITCH_4 = RuleImage(roi_front=(971,600,37,26), roi_back=(971,600,37,26), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png")
+	# description 
+	I_SOU_SWITCH_SURE = RuleImage(roi_front=(668,401,180,61), roi_back=(668,401,180,61), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png")
+	# 用于判断是否在式神录里面 
+	I_SOU_CHECK_IN = RuleImage(roi_front=(269,69,50,49), roi_back=(269,69,50,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_in.png")
+	# description 
+	I_SOU_CHECK_GROUP_1 = RuleImage(roi_front=(1086,91,22,57), roi_back=(1086,91,22,57), threshold=0.9, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_1.png")
+	# description 
+	I_SOU_CHECK_GROUP_2 = RuleImage(roi_front=(1086,163,25,57), roi_back=(1086,163,25,57), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_2.png")
+	# description 
+	I_SOU_CHECK_GROUP_3 = RuleImage(roi_front=(1085,234,22,49), roi_back=(1085,234,22,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_3.png")
+	# description 
+	I_SOU_CHECK_GROUP_4 = RuleImage(roi_front=(1086,303,21,56), roi_back=(1086,303,21,56), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_4.png")
+	# description 
+	I_SOU_CHECK_GROUP_5 = RuleImage(roi_front=(1088,370,21,53), roi_back=(1088,370,21,53), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_5.png")
+	# description 
+	I_SOU_CHECK_GROUP_6 = RuleImage(roi_front=(1085,443,23,54), roi_back=(1085,443,23,54), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_6.png")
+	# description 
+	I_SOU_CHECK_GROUP_7 = RuleImage(roi_front=(1088,512,21,54), roi_back=(1088,512,21,54), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_check_group_7.png")
+
+

+ 44 - 0
tasks/Component/SwitchSoul/ss/click.json

@@ -0,0 +1,44 @@
+[
+  {
+    "itemName": "sou_group_1",
+    "roiFront": "1086,85,158,67",
+    "roiBack": "1086,85,158,67",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_2",
+    "roiFront": "1087,155,162,62",
+    "roiBack": "1087,155,162,62",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_3",
+    "roiFront": "1088,226,154,61",
+    "roiBack": "1088,226,154,61",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_4",
+    "roiFront": "1087,297,157,59",
+    "roiBack": "1087,297,157,59",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_5",
+    "roiFront": "1087,365,154,62",
+    "roiBack": "1087,365,154,62",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_6",
+    "roiFront": "1088,437,156,57",
+    "roiBack": "1088,437,156,57",
+    "description": "description"
+  },
+  {
+    "itemName": "sou_group_7",
+    "roiFront": "1090,505,156,62",
+    "roiBack": "1090,505,156,62",
+    "description": "description"
+  }
+]

+ 137 - 0
tasks/Component/SwitchSoul/ss/image.json

@@ -0,0 +1,137 @@
+[
+  {
+    "itemName": "record_soul_back",
+    "imageName": "ss_record_soul_back.png",
+    "roiFront": "19,9,51,44",
+    "roiBack": "19,9,51,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "退出式神录"
+  },
+  {
+    "itemName": "soul_preset",
+    "imageName": "ss_soul_preset.png",
+    "roiFront": "332,70,90,51",
+    "roiBack": "332,70,90,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "预设"
+  },
+  {
+    "itemName": "sou_switch_1",
+    "imageName": "ss_sou_switch_1.png",
+    "roiFront": "971,148,37,35",
+    "roiBack": "971,148,37,35",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_2",
+    "imageName": "ss_sou_switch_2.png",
+    "roiFront": "978,304,27,29",
+    "roiBack": "978,304,27,29",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_3",
+    "imageName": "ss_sou_switch_3.png",
+    "roiFront": "973,454,26,26",
+    "roiBack": "973,454,26,26",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_4",
+    "imageName": "ss_sou_switch_4.png",
+    "roiFront": "971,600,37,26",
+    "roiBack": "971,600,37,26",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_switch_sure",
+    "imageName": "ss_sou_switch_sure.png",
+    "roiFront": "668,401,180,61",
+    "roiBack": "668,401,180,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_in",
+    "imageName": "ss_sou_check_in.png",
+    "roiFront": "269,69,50,49",
+    "roiBack": "269,69,50,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "用于判断是否在式神录里面"
+  },
+  {
+    "itemName": "sou_check_group_1",
+    "imageName": "ss_sou_check_group_1.png",
+    "roiFront": "1086,91,22,57",
+    "roiBack": "1086,91,22,57",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_2",
+    "imageName": "ss_sou_check_group_2.png",
+    "roiFront": "1086,163,25,57",
+    "roiBack": "1086,163,25,57",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_3",
+    "imageName": "ss_sou_check_group_3.png",
+    "roiFront": "1085,234,22,49",
+    "roiBack": "1085,234,22,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_4",
+    "imageName": "ss_sou_check_group_4.png",
+    "roiFront": "1086,303,21,56",
+    "roiBack": "1086,303,21,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_5",
+    "imageName": "ss_sou_check_group_5.png",
+    "roiFront": "1088,370,21,53",
+    "roiBack": "1088,370,21,53",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_6",
+    "imageName": "ss_sou_check_group_6.png",
+    "roiFront": "1085,443,23,54",
+    "roiBack": "1085,443,23,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "sou_check_group_7",
+    "imageName": "ss_sou_check_group_7.png",
+    "roiFront": "1088,512,21,54",
+    "roiBack": "1088,512,21,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

BIN
tasks/Component/SwitchSoul/ss/ss_record_soul_back.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_1.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_2.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_3.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_4.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_5.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_6.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_group_7.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_check_in.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_1.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_2.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_3.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_4.png


BIN
tasks/Component/SwitchSoul/ss/ss_sou_switch_sure.png


BIN
tasks/Component/SwitchSoul/ss/ss_soul_preset.png


+ 131 - 0
tasks/Component/SwitchSoul/switch_soul.py

@@ -0,0 +1,131 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from time import sleep
+from module.base.timer import Timer
+from tasks.base_task import BaseTask
+from tasks.Component.GeneralInvite.assets import GeneralInviteAssets
+from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode
+from tasks.Component.SwitchSoul.assets import SwitchSoulAssets
+from module.logger import logger
+
+
+class SwitchSoul(BaseTask, SwitchSoulAssets):
+
+    def run_switch_soul(self, target: tuple or list[tuple]):
+        """
+        保证在式神录的界面
+        :return:
+        """
+        self.click_preset()
+        self.switch_souls(target)
+
+    def click_preset(self) -> None:
+        """
+        点击预设
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_SOU_SWITCH_1):
+                break
+            if self.appear(self.I_SOU_SWITCH_2):
+                break
+            if self.appear(self.I_SOU_SWITCH_3):
+                break
+            if self.appear(self.I_SOU_SWITCH_4):
+                break
+            if self.appear_then_click(self.I_SOUL_PRESET, interval=1):
+                continue
+        logger.info('Click preset in switch soul')
+
+    def switch_soul_one(self, group: int, team: int) -> None:
+        """
+        设置一个队伍的预设御魂
+        :param group: 只能是[1-7]
+        :param team: 只能是[1-4]
+        :return:
+        """
+
+        def get_group_assets(group: int) -> tuple:
+            match = {
+                1: tuple([self.C_SOU_GROUP_1, self.I_SOU_CHECK_GROUP_1]),
+                2: tuple([self.C_SOU_GROUP_2, self.I_SOU_CHECK_GROUP_2]),
+                3: tuple([self.C_SOU_GROUP_3, self.I_SOU_CHECK_GROUP_3]),
+                4: tuple([self.C_SOU_GROUP_4, self.I_SOU_CHECK_GROUP_4]),
+                5: tuple([self.C_SOU_GROUP_5, self.I_SOU_CHECK_GROUP_5]),
+                6: tuple([self.C_SOU_GROUP_6, self.I_SOU_CHECK_GROUP_6]),
+                7: tuple([self.C_SOU_GROUP_7, self.I_SOU_CHECK_GROUP_7]),
+            }
+            return match[group]
+
+        def get_team_asset(team: int):
+            match = {
+                1: self.I_SOU_SWITCH_1,
+                2: self.I_SOU_SWITCH_2,
+                3: self.I_SOU_SWITCH_3,
+                4: self.I_SOU_SWITCH_4,
+            }
+            return match[team]
+
+        if group < 1 or group > 7:
+            raise ValueError('Switch soul_one group must be in [1-7]')
+        if team < 1 or team > 4:
+            raise ValueError('Switch soul_one team must be in [1-4]')
+        target_click, target_check = get_group_assets(group)
+        while 1:
+            self.screenshot()
+            if self.appear(target_check):
+                break
+            if self.appear_then_click(target_click, interval=1):
+                continue
+        # 点击队伍
+        target_team = get_team_asset(team)
+        for i in range(3):
+            sleep(0.8)
+            self.screenshot()
+            if self.appear_then_click(self.I_SOU_SWITCH_SURE, interval=1):
+                continue
+            if not self.appear_then_click(target_team, interval=1):
+                logger.warning(f'Click team {team} failed in group {group}')
+        logger.info(f'Switch soul_one group {group} team {team}')
+
+
+    def switch_souls(self, target: tuple or list[tuple]) -> None:
+        """
+        切换御魂
+        :param target: [(1, 1), (2, 2), (3, 3), (4, 4)]  或者是单独的一个元组(4, 4) 第一个是组, 第二个是队伍
+        :return:
+        """
+        if isinstance(target, tuple):
+            target = [target]
+        for group, team in target:
+            group = int(group)
+            team = int(team)
+            self.switch_soul_one(group, team)
+
+    def exit_shikigami_records(self) -> None:
+        """
+        退出式神录的界面
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_SOU_CHECK_IN):
+                break
+            if self.appear_then_click(self.I_RECORD_SOUL_BACK, interval=1):
+                continue
+        logger.info('Exit shikigami records')
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    s = SwitchSoul(c, d)
+
+    s.click_preset()
+    s.switch_soul_one(7, 2)

+ 3 - 0
tasks/Component/SwitchSoul/switch_soul_config.py

@@ -0,0 +1,3 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey

BIN
tasks/GameUi/page/page_check_exploration.png


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

@@ -20,8 +20,8 @@
   {
   {
     "itemName": "check_exploration",
     "itemName": "check_exploration",
     "imageName": "page_check_exploration.png",
     "imageName": "page_check_exploration.png",
-    "roiFront": "1130,120,61,55",
-    "roiBack": "1130,120,61,55",
+    "roiFront": "1146,175,21,22",
+    "roiBack": "1146,175,21,22",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 3 - 3
tasks/GlobalGame/assets.py

@@ -12,11 +12,11 @@ class GlobalGameAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# description 
 	# description 
-	I_ACCEPT = RuleImage(roi_front=(825,395,56,46), roi_back=(825,395,56,46), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_accept.png")
+	I_G_ACCEPT = RuleImage(roi_front=(830,407,56,46), roi_back=(798,369,117,110), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_accept.png")
 	# description 
 	# description 
-	I_REJECT = RuleImage(roi_front=(825,493,53,51), roi_back=(825,493,53,51), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_reject.png")
+	I_G_REJECT = RuleImage(roi_front=(832,508,53,51), roi_back=(808,480,108,101), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_reject.png")
 	# 勾玉 
 	# 勾玉 
-	I_JADE = RuleImage(roi_front=(661,466,43,46), roi_back=(661,466,43,46), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_jade.png")
+	I_G_JADE = RuleImage(roi_front=(661,466,43,46), roi_back=(661,466,43,46), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_jade.png")
 	# 网络异常 
 	# 网络异常 
 	I_NETWORK_ABNORMAL = RuleImage(roi_front=(583,330,221,67), roi_back=(583,330,221,67), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_network_abnormal.png")
 	I_NETWORK_ABNORMAL = RuleImage(roi_front=(583,330,221,67), roi_back=(583,330,221,67), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_network_abnormal.png")
 	# 已端口游戏服务器,需要重新连接,这种情况一般是断开很久了 
 	# 已端口游戏服务器,需要重新连接,这种情况一般是断开很久了 

BIN
tasks/GlobalGame/gg/gg_accept.png


BIN
tasks/GlobalGame/gg/gg_g_accept.png


BIN
tasks/GlobalGame/gg/gg_g_reject.png


+ 8 - 8
tasks/GlobalGame/gg/image.json

@@ -1,25 +1,25 @@
 [
 [
   {
   {
-    "itemName": "accept",
-    "imageName": "gg_accept.png",
-    "roiFront": "830,403,56,46",
+    "itemName": "g_accept",
+    "imageName": "gg_g_accept.png",
+    "roiFront": "830,407,56,46",
     "roiBack": "798,369,117,110",
     "roiBack": "798,369,117,110",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
   {
   {
-    "itemName": "reject",
-    "imageName": "gg_reject.png",
-    "roiFront": "830,504,53,51",
+    "itemName": "g_reject",
+    "imageName": "gg_g_reject.png",
+    "roiFront": "832,508,53,51",
     "roiBack": "808,480,108,101",
     "roiBack": "808,480,108,101",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
   {
   {
-    "itemName": "jade",
-    "imageName": "gg_jade.png",
+    "itemName": "g_jade",
+    "imageName": "gg_g_jade.png",
     "roiFront": "661,466,43,46",
     "roiFront": "661,466,43,46",
     "roiBack": "661,466,43,46",
     "roiBack": "661,466,43,46",
     "method": "Template matching",
     "method": "Template matching",

+ 9 - 8
tasks/base_task.py

@@ -51,6 +51,7 @@ class BaseTask(GlobalGameAssets):
         if self.config.global_game.emergency.invitation_detect_interval:
         if self.config.global_game.emergency.invitation_detect_interval:
             self.interval_time = self.config.global_game.emergency.invitation_detect_interval
             self.interval_time = self.config.global_game.emergency.invitation_detect_interval
             self.friend_timer = Timer(self.interval_time)
             self.friend_timer = Timer(self.interval_time)
+            self.friend_timer.start()
 
 
         # 战斗次数相关
         # 战斗次数相关
         self.current_count = 0  # 战斗次数
         self.current_count = 0  # 战斗次数
@@ -64,31 +65,31 @@ class BaseTask(GlobalGameAssets):
         # 判断勾协
         # 判断勾协
         if self.friend_timer and self.friend_timer.reached():
         if self.friend_timer and self.friend_timer.reached():
             self.friend_timer.reset()
             self.friend_timer.reset()
-            invite = self.appear(self.I_ACCEPT)
+            invite = self.appear(self.I_G_ACCEPT)
             # 如果是全部接受
             # 如果是全部接受
             if invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ACCEPT:
             if invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ACCEPT:
                 # 如果是接受邀请
                 # 如果是接受邀请
                 logger.info(f"Accept friend invitation")
                 logger.info(f"Accept friend invitation")
                 while 1:
                 while 1:
-                    if self.appear_then_click(self.I_ACCEPT, interval=1):
+                    if self.appear_then_click(self.I_G_ACCEPT, interval=1):
                         continue
                         continue
-                    if not self.appear(self.I_ACCEPT):
+                    if not self.appear(self.I_G_ACCEPT):
                         break
                         break
             # 如果是全部拒绝
             # 如果是全部拒绝
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.REJECT:
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.REJECT:
                 logger.info(f"Reject friend invitation")
                 logger.info(f"Reject friend invitation")
                 while 1:
                 while 1:
-                    if self.appear_then_click(self.I_REJECT, interval=1):
+                    if self.appear_then_click(self.I_G_REJECT, interval=1):
                         continue
                         continue
-                    if not self.appear(self.I_REJECT):
+                    if not self.appear(self.I_G_REJECT):
                         break
                         break
             # 最后一个是仅仅接受勾协
             # 最后一个是仅仅接受勾协
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ONLY_JADE:
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ONLY_JADE:
                 logger.info(f"Accept jade invitation")
                 logger.info(f"Accept jade invitation")
                 while 1:
                 while 1:
-                    if self.appear_then_click(self.I_ACCEPT, interval=1):
+                    if self.appear_then_click(self.I_G_ACCEPT, interval=1):
                         continue
                         continue
-                    if not self.appear(self.I_ACCEPT):
+                    if not self.appear(self.I_G_ACCEPT):
                         break
                         break
             # 判断网络异常
             # 判断网络异常
             if self.appear(self.I_NETWORK_ABNORMAL):
             if self.appear(self.I_NETWORK_ABNORMAL):
@@ -414,7 +415,7 @@ class BaseTask(GlobalGameAssets):
         """
         """
         设置下次运行时间  当然这个也是可以重写的
         设置下次运行时间  当然这个也是可以重写的
         :param target: 可以自定义的下次运行时间
         :param target: 可以自定义的下次运行时间
-        :param server: delay to nearest Scheduler.ServerUpdate
+        :param server: True
         :param success: 判断是成功的还是失败的时间间隔
         :param success: 判断是成功的还是失败的时间间隔
         :param task: 任务名称,大驼峰的
         :param task: 任务名称,大驼峰的
         :param finish: 是完成任务后的时间为基准还是开始任务的时间为基准
         :param finish: 是完成任务后的时间为基准还是开始任务的时间为基准