Просмотр исходного кода

Merge pull request #60 from runhey/dev

Dev
huangrunheng 3 лет назад
Родитель
Сommit
8747635e12
100 измененных файлов с 2041 добавлено и 107 удалено
  1. 2 2
      module/config/config_manual.py
  2. 2 2
      module/config/config_menu.py
  3. 4 0
      module/config/config_model.py
  4. BIN
      module/config/i18n/zh_CN.qm
  5. 72 0
      module/config/i18n/zh_CN.ts
  6. 6 1
      module/ocr/sub_ocr.py
  7. BIN
      tasks/ActivityShikigami/as/as_ap.png
  8. BIN
      tasks/ActivityShikigami/as/as_ap_activity.png
  9. BIN
      tasks/ActivityShikigami/as/as_battle.png
  10. BIN
      tasks/ActivityShikigami/as/as_fire.png
  11. BIN
      tasks/ActivityShikigami/as/as_lock.png
  12. BIN
      tasks/ActivityShikigami/as/as_shi.png
  13. BIN
      tasks/ActivityShikigami/as/as_switch.png
  14. BIN
      tasks/ActivityShikigami/as/as_unlock.png
  15. 17 17
      tasks/ActivityShikigami/as/image.json
  16. 4 4
      tasks/ActivityShikigami/as/ocr.json
  17. 11 11
      tasks/ActivityShikigami/assets.py
  18. 29 8
      tasks/ActivityShikigami/script_task.py
  19. 1 1
      tasks/AreaBoss/script_task.py
  20. 2 0
      tasks/BondlingFairyland/battle.py
  21. 22 2
      tasks/Component/BaseActivity/config_activity.py
  22. 33 0
      tasks/Component/Buy/assets.py
  23. 155 0
      tasks/Component/Buy/buy.py
  24. BIN
      tasks/Component/Buy/buy/buy_buy_add.png
  25. BIN
      tasks/Component/Buy/buy/buy_buy_plus.png
  26. BIN
      tasks/Component/Buy/buy/buy_buy_sub.png
  27. 14 0
      tasks/Component/Buy/buy/click.json
  28. 29 0
      tasks/Component/Buy/buy/image.json
  29. 11 0
      tasks/Component/Buy/buy/ocr.json
  30. 24 3
      tasks/Component/GeneralBattle/general_battle.py
  31. 33 48
      tasks/Component/GeneralInvite/general_invite.py
  32. BIN
      tasks/Component/GeneralInvite/gi/gi_fire.png
  33. 39 0
      tasks/Component/Summon/assets.py
  34. 38 0
      tasks/Component/Summon/sm/image.json
  35. 11 0
      tasks/Component/Summon/sm/ocr.json
  36. BIN
      tasks/Component/Summon/sm/sm_blue_ticket.png
  37. BIN
      tasks/Component/Summon/sm/sm_low_ticket.png
  38. BIN
      tasks/Component/Summon/sm/sm_one_ticket.png
  39. BIN
      tasks/Component/Summon/sm/sm_sm_confirm.png
  40. 30 0
      tasks/Component/Summon/sm/swipe.json
  41. 77 0
      tasks/Component/Summon/summon.py
  42. 6 0
      tasks/Component/SwitchSoul/switch_soul.py
  43. 30 0
      tasks/DailyTrifles/assets.py
  44. 21 0
      tasks/DailyTrifles/config.py
  45. 29 0
      tasks/DailyTrifles/love/image.json
  46. BIN
      tasks/DailyTrifles/love/love_l_collect.png
  47. BIN
      tasks/DailyTrifles/love/love_l_friends.png
  48. BIN
      tasks/DailyTrifles/love/love_l_love.png
  49. 105 0
      tasks/DailyTrifles/script_task.py
  50. 29 0
      tasks/DailyTrifles/store/image.json
  51. BIN
      tasks/DailyTrifles/store/store_gift_recommend.png
  52. BIN
      tasks/DailyTrifles/store/store_gift_sign.png
  53. BIN
      tasks/DailyTrifles/store/store_room_gift.png
  54. BIN
      tasks/GameUi/additional/additional_ad_close_red.png
  55. 11 0
      tasks/GameUi/additional/mall.json
  56. 10 1
      tasks/GameUi/assets.py
  57. 2 2
      tasks/GameUi/game_ui.py
  58. 5 1
      tasks/GameUi/page.py
  59. BIN
      tasks/GameUi/page/page_check_mall.png
  60. BIN
      tasks/GameUi/page/page_check_travel.png
  61. 2 2
      tasks/GameUi/page/page_img_3.json
  62. 18 0
      tasks/GameUi/page/page_img_supplement.json
  63. BIN
      tasks/GameUi/page/page_main_goto_travel.png
  64. 1 1
      tasks/GlobalGame/config_emergency.py
  65. 0 1
      tasks/Orochi/script_task.py
  66. 2 0
      tasks/Restart/assets.py
  67. 4 0
      tasks/Restart/login.py
  68. 9 0
      tasks/Restart/login/image.json
  69. BIN
      tasks/Restart/login/login_login_load_down.png
  70. 199 0
      tasks/RichMan/assets.py
  71. 111 0
      tasks/RichMan/config.py
  72. 120 0
      tasks/RichMan/guild.py
  73. BIN
      tasks/RichMan/guild/guild_guild_blue.png
  74. BIN
      tasks/RichMan/guild/guild_guild_check_scrap.png
  75. BIN
      tasks/RichMan/guild/guild_guild_close_red.png
  76. BIN
      tasks/RichMan/guild/guild_guild_scrap.png
  77. BIN
      tasks/RichMan/guild/guild_guild_shrine.png
  78. BIN
      tasks/RichMan/guild/guild_guild_skin.png
  79. BIN
      tasks/RichMan/guild/guild_guild_store.png
  80. 65 0
      tasks/RichMan/guild/image.json
  81. 38 0
      tasks/RichMan/guild/ocr.json
  82. 9 0
      tasks/RichMan/guild/swipe.json
  83. 29 0
      tasks/RichMan/mall/bondlings.py
  84. 28 0
      tasks/RichMan/mall/charisma.py
  85. 62 0
      tasks/RichMan/mall/consignment.py
  86. BIN
      tasks/RichMan/mall/consignment/consignment_con_enter.png
  87. BIN
      tasks/RichMan/mall/consignment/consignment_con_enter_check.png
  88. BIN
      tasks/RichMan/mall/consignment/consignment_con_ticket.png
  89. 29 0
      tasks/RichMan/mall/consignment/image.json
  90. 11 0
      tasks/RichMan/mall/consignment/ocr.json
  91. 28 0
      tasks/RichMan/mall/friendship_points.py
  92. 31 0
      tasks/RichMan/mall/honor.py
  93. 3 0
      tasks/RichMan/mall/mall.py
  94. 28 0
      tasks/RichMan/mall/medal.py
  95. 125 0
      tasks/RichMan/mall/navbar.py
  96. 83 0
      tasks/RichMan/mall/navbar/image_bottom.json
  97. 92 0
      tasks/RichMan/mall/navbar/image_side.json
  98. BIN
      tasks/RichMan/mall/navbar/navbar_mall_bondlings_check.png
  99. BIN
      tasks/RichMan/mall/navbar/navbar_mall_bondlings_sure.png
  100. BIN
      tasks/RichMan/mall/navbar/navbar_mall_consignment.png

+ 2 - 2
module/config/config_manual.py

@@ -10,11 +10,11 @@ class ConfigManual:
     SCHEDULER_PRIORITY = """
     SCHEDULER_PRIORITY = """
         Restart
         Restart
         >KekkaiUtilize > KekkaiActivation > DemonEncounter
         >KekkaiUtilize > KekkaiActivation > DemonEncounter
-        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa
+        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa > DailyTrifles
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami
         > ActivityShikigami
         > BondlingFairyland
         > BondlingFairyland
-        > TrueOrochi
+        > TrueOrochi > RichMan
         """
         """
 
 
     DEVICE_OVER_HTTP = False
     DEVICE_OVER_HTTP = False

+ 2 - 2
module/config/config_menu.py

@@ -21,13 +21,13 @@ class ConfigMenu:
         self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea']
         self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea']
         # 日常的任务
         # 日常的任务
         self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid', 'RyouToppa',
         self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid', 'RyouToppa',
-                                   'KekkaiUtilize', 'KekkaiActivation', 'DemonEncounter']
+                                   'KekkaiUtilize', 'KekkaiActivation', 'DemonEncounter', 'DailyTrifles']
         # 活动的任务
         # 活动的任务
         self.menu["Activity Task"] = ['ActivityShikigami']
         self.menu["Activity Task"] = ['ActivityShikigami']
         # 很肝的任务
         # 很肝的任务
         self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
         self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
         # 每周任务
         # 每周任务
-        self.menu["Weekly Task"] = ['TrueOrochi']
+        self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan']
         # 开发工具
         # 开发工具
         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']
 
 

+ 4 - 0
module/config/config_model.py

@@ -23,6 +23,7 @@ from tasks.Nian.config import Nian
 from tasks.KekkaiUtilize.config import KekkaiUtilize
 from tasks.KekkaiUtilize.config import KekkaiUtilize
 from tasks.KekkaiActivation.config import KekkaiActivation
 from tasks.KekkaiActivation.config import KekkaiActivation
 from tasks.DemonEncounter.config import DemonEncounter
 from tasks.DemonEncounter.config import DemonEncounter
+from tasks.DailyTrifles.config import DailyTrifles
 # ----------------------------------------------------------------------------------------------------------------------
 # ----------------------------------------------------------------------------------------------------------------------
 from tasks.Orochi.config import Orochi
 from tasks.Orochi.config import Orochi
 from tasks.OrochiMoans.config import OrochiMoans
 from tasks.OrochiMoans.config import OrochiMoans
@@ -41,6 +42,7 @@ from tasks.BondlingFairyland.config import BondlingFairyland
 
 
 # 每周任务---------------------------------------------------------------------------------------------------------------
 # 每周任务---------------------------------------------------------------------------------------------------------------
 from tasks.TrueOrochi.config import TrueOrochi
 from tasks.TrueOrochi.config import TrueOrochi
+from tasks.RichMan.config import RichMan
 # ----------------------------------------------------------------------------------------------------------------------
 # ----------------------------------------------------------------------------------------------------------------------
 
 
 class ConfigModel(ConfigBase):
 class ConfigModel(ConfigBase):
@@ -59,6 +61,7 @@ class ConfigModel(ConfigBase):
     kekkai_utilize: KekkaiUtilize = Field(default_factory=KekkaiUtilize)
     kekkai_utilize: KekkaiUtilize = Field(default_factory=KekkaiUtilize)
     kekkai_activation: KekkaiActivation = Field(default_factory=KekkaiActivation)
     kekkai_activation: KekkaiActivation = Field(default_factory=KekkaiActivation)
     demon_encounter: DemonEncounter = Field(default_factory=DemonEncounter)
     demon_encounter: DemonEncounter = Field(default_factory=DemonEncounter)
+    daily_trifles: DailyTrifles = Field(default_factory=DailyTrifles)
 
 
     # 这些是刷御魂的
     # 这些是刷御魂的
     orochi: Orochi = Field(default_factory=Orochi)
     orochi: Orochi = Field(default_factory=Orochi)
@@ -75,6 +78,7 @@ class ConfigModel(ConfigBase):
 
 
     # 这些是每周任务
     # 这些是每周任务
     true_orochi: TrueOrochi = Field(default_factory=TrueOrochi)
     true_orochi: TrueOrochi = Field(default_factory=TrueOrochi)
+    rich_man: RichMan = Field(default_factory=RichMan)
 
 
     # @validator('script')
     # @validator('script')
     # def script_validator(cls, v):
     # def script_validator(cls, v):

BIN
module/config/i18n/zh_CN.qm


+ 72 - 0
module/config/i18n/zh_CN.ts

@@ -537,4 +537,76 @@ Refresh:直接刷新,如果刷新操作进入CD,将标记为失败并退
 	<message><source>three_refresh_help</source><translation>挑战进度到三,领取奖励后就刷新,如果刷新操作进入CD,将标记为失败并退出</translation></message>
 	<message><source>three_refresh_help</source><translation>挑战进度到三,领取奖励后就刷新,如果刷新操作进入CD,将标记为失败并退出</translation></message>
 	<message><source>number_base_help</source><translation>旨在检查突破卷数量,如果当前的数量没有大于等于这个值,将标记为成功并退出</translation></message>
 	<message><source>number_base_help</source><translation>旨在检查突破卷数量,如果当前的数量没有大于等于这个值,将标记为成功并退出</translation></message>
 </context>	
 </context>	
+<context>
+    <name>Args</name>
+	<message><source>SougenbiConfig</source><translation>业原火</translation></message>	
+	<message><source>SougenbiClass</source><translation>挑战类型</translation></message>	
+</context>	
+<context>
+    <name>Args</name>
+	<message><source>DailyTriflesConfig</source><translation>琐事</translation></message>	
+	<message><source>One Summon</source><translation>每日召唤</translation></message>	
+	<message><source>Guild Wish</source><translation>寮祈愿(还不知道可以写什么)</translation></message>	
+	<message><source>Friend Love</source><translation>友情点</translation></message>	
+	<message><source>Store Sign</source><translation>商店签到</translation></message>	
+	<message><source>store_sign_help</source><translation>就那个签到50次得黑蛋的</translation></message>	
+</context>	
+<context>
+    <name>Args</name>
+	<message><source>ThousandThings</source><translation>千物宝箱</translation></message>	
+	<message><source>Mystery Amulet</source><translation>神秘咒符</translation></message>
+	<message><source>Black Daruma Fragment</source><translation>御行达摩碎片</translation></message>	
+	<message><source>AP</source><translation>体力</translation></message>
+	<message><source>ap_help</source><translation>默认买两次不够就不买</translation></message>
+	<message><source>Consignment</source><translation>寄售屋</translation></message>
+	<message><source>Buy Sale Ticket</source><translation>兑换一百张寄售券</translation></message>
+	<message><source>buy_sale_ticket_help</source><translation>等凑够了再去换</translation></message>
+	<message><source>Scales</source><translation>御魂礼盒</translation></message>
+	<message><source>Orochi Scales</source><translation>朴素御魂</translation></message>
+	<message><source>orochi_scales_help</source><translation>可选[0~40]</translation></message>
+	<message><source>Demon Souls</source><translation>首领御魂</translation></message>
+	<message><source>demon_souls_help</source><translation>可选[0~50]</translation></message>
+	<message><source>DemonClass</source><translation>首领御魂类型</translation></message>
+	<message><source>demon_class_help</source><translation>不支持多个首领</translation></message>
+	<message><source>Demon Position</source><translation>首领御魂号位</translation></message>
+	<message><source>demon_position_help</source><translation>不支持多号位</translation></message>
+	<message><source>Picture Book Scrap</source><translation>海汐御魂</translation></message>
+	<message><source>picture_book_scrap_help</source><translation>可选[0~30]</translation></message>
+	<message><source>Picture Book Rule</source><translation>选择御魂优先级</translation></message>
+	<message><source>picture_book_rule_help</source><translation>使用auto即可</translation></message>
+	<message><source>SpecialRoom</source><translation>[杂货铺]特殊购买</translation></message>
+	<message><source>Totem Pass</source><translation>御灵券(40张)</translation></message>
+	<message><source>Low Bondling Discs</source><translation>百物式盘</translation></message>
+	<message><source>low_bondling_discs_special</source><translation>契灵低级盘,可选[0~100]</translation></message>
+	<message><source>Medium Bondling Discs</source><translation>千咒式盘</translation></message>
+	<message><source>medium_bondling_discs_special</source><translation>契灵中级盘,可选[0~100]</translation></message>
+	<message><source>mystery_amulet_help_honor</source><translation>默认买两个</translation></message>
+	<message><source>black_daruma_scrap_help_honor</source><translation>默认买两个</translation></message>
+	<message><source>HonorRoom</source><translation>[杂货铺]荣誉购买</translation></message>
+	<message><source>FriendshipPoints</source><translation>[杂货铺]友情点购买</translation></message>
+	<message><source>White Daruma</source><translation>奉为达摩</translation></message>
+	<message><source>Red Daruma</source><translation>招福达摩</translation></message>
+	<message><source>Broken Amulet</source><translation>破碎的咒符</translation></message>
+	<message><source>MedalRoom</source><translation>[杂货铺]勋章购买</translation></message>
+	<message><source>AP 100</source><translation>体力100</translation></message>
+	<message><source>Random Soul</source><translation>随机御魂</translation></message>
+	<message><source>Challenge Pass</source><translation>挑战券</translation></message>
+	<message><source>challenge_pass_help</source><translation>可选[0~10]</translation></message>
+	<message><source>Charisma</source><translation>[杂货铺]魅力值购买</translation></message>
+	<message><source>Shrine</source><translation>神龛</translation></message>
+	<message><source>White Daruma Five</source><translation>五星奉为达摩</translation></message>
+	<message><source>White Daruma Four</source><translation>四星奉为达摩</translation></message>
+	<message><source>Bondlings</source><translation>契忆商店</translation></message>
+	<message><source>random_soul_help</source><translation>可选[0~100]</translation></message>
+	<message><source>Bondling Stone</source><translation>鸣契石</translation></message>
+	<message><source>bondling_stone_help</source><translation>可选[0~10]</translation></message>
+	<message><source>high_bondling_discs_help</source><translation>可选[0~50]</translation></message>
+	<message><source>High Bondling Discs</source><translation>万象式盘</translation></message>
+	<message><source>medium_bondling_discs_help</source><translation>可选[0~20]</translation></message>
+	<message><source>GuildStore</source><translation>{寮]功勋商店</translation></message>
+	<message><source>Skin Ticket</source><translation>皮肤券</translation></message>
+	<message><source>skin_ticket_help</source><translation>可选[0~5]</translation></message>
+	<message><source>Black Daruma Scrap</source><translation>御行达摩碎片</translation></message>
+	<message><source>Black Daruma</source><translation>御行达摩</translation></message>
+</context>	
 </TS>
 </TS>

+ 6 - 1
module/ocr/sub_ocr.py

@@ -97,6 +97,8 @@ class Digit(Single):
         result = super().after_process(result)
         result = super().after_process(result)
         result = result.replace('I', '1').replace('D', '0').replace('S', '5')
         result = result.replace('I', '1').replace('D', '0').replace('S', '5')
         result = result.replace('B', '8')
         result = result.replace('B', '8')
+        result = [char for char in result if char.isdigit()]
+        result = ''.join(result)
 
 
         prev = result
         prev = result
         result = int(result) if result else 0
         result = int(result) if result else 0
@@ -131,7 +133,10 @@ class DigitCounter(Single):
         if result:
         if result:
             result = [int(s) for s in result.groups()]
             result = [int(s) for s in result.groups()]
             current, total = int(result[0]), int(result[1])
             current, total = int(result[0]), int(result[1])
-            current = min(current, total)
+            # 不知道为什么加了这一句,妈的
+            # current = min(current, total)
+            if current > total:
+                logger.warning(f'[{cls.name}]: Current {current} is greater than total {total}')
             return current, total - current, total
             return current, total - current, total
         else:
         else:
             logger.warning(f'Unexpected ocr result: {result}')
             logger.warning(f'Unexpected ocr result: {result}')

BIN
tasks/ActivityShikigami/as/as_ap.png


BIN
tasks/ActivityShikigami/as/as_ap_activity.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_lock.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_switch.png


BIN
tasks/ActivityShikigami/as/as_unlock.png


+ 17 - 17
tasks/ActivityShikigami/as/image.json

@@ -2,8 +2,8 @@
   {
   {
     "itemName": "shi",
     "itemName": "shi",
     "imageName": "as_shi.png",
     "imageName": "as_shi.png",
-    "roiFront": "455,346,29,53",
-    "roiBack": "122,333,1029,76",
+    "roiFront": "135,146,64,53",
+    "roiBack": "80,132,1029,76",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.7,
     "threshold": 0.7,
     "description": "进入活动"
     "description": "进入活动"
@@ -20,11 +20,11 @@
   {
   {
     "itemName": "battle",
     "itemName": "battle",
     "imageName": "as_battle.png",
     "imageName": "as_battle.png",
-    "roiFront": "1037,330,52,57",
-    "roiBack": "1037,330,52,57",
+    "roiFront": "568,171,52,177",
+    "roiBack": "568,171,52,177",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
-    "description": "description"
+    "description": "进入爬塔"
   },
   },
   {
   {
     "itemName": "drum",
     "itemName": "drum",
@@ -38,8 +38,8 @@
   {
   {
     "itemName": "lock",
     "itemName": "lock",
     "imageName": "as_lock.png",
     "imageName": "as_lock.png",
-    "roiFront": "794,653,30,32",
-    "roiBack": "794,653,30,32",
+    "roiFront": "806,642,30,32",
+    "roiBack": "806,642,30,32",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "上锁图标"
     "description": "上锁图标"
@@ -47,8 +47,8 @@
   {
   {
     "itemName": "unlock",
     "itemName": "unlock",
     "imageName": "as_unlock.png",
     "imageName": "as_unlock.png",
-    "roiFront": "796,653,27,35",
-    "roiBack": "796,653,27,35",
+    "roiFront": "807,640,27,35",
+    "roiBack": "807,640,27,35",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "还未上锁图片"
     "description": "还未上锁图片"
@@ -56,8 +56,8 @@
   {
   {
     "itemName": "fire",
     "itemName": "fire",
     "imageName": "as_fire.png",
     "imageName": "as_fire.png",
-    "roiFront": "1140,585,75,73",
-    "roiBack": "1140,585,75,73",
+    "roiFront": "1123,563,106,116",
+    "roiBack": "1123,563,106,116",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "点击战斗"
     "description": "点击战斗"
@@ -65,8 +65,8 @@
   {
   {
     "itemName": "ap",
     "itemName": "ap",
     "imageName": "as_ap.png",
     "imageName": "as_ap.png",
-    "roiFront": "1126,510,27,37",
-    "roiBack": "1126,510,27,37",
+    "roiFront": "1116,498,27,37",
+    "roiBack": "1116,498,27,37",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "体力按钮"
     "description": "体力按钮"
@@ -74,8 +74,8 @@
   {
   {
     "itemName": "ap_activity",
     "itemName": "ap_activity",
     "imageName": "as_ap_activity.png",
     "imageName": "as_ap_activity.png",
-    "roiFront": "1125,516,27,27",
-    "roiBack": "1125,516,27,27",
+    "roiFront": "1109,502,27,27",
+    "roiBack": "1109,502,27,27",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "活动体力"
     "description": "活动体力"
@@ -83,8 +83,8 @@
   {
   {
     "itemName": "switch",
     "itemName": "switch",
     "imageName": "as_switch.png",
     "imageName": "as_switch.png",
-    "roiFront": "1207,514,33,30",
-    "roiBack": "1207,514,33,30",
+    "roiFront": "1207,505,33,30",
+    "roiBack": "1207,505,33,30",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "切换按键"
     "description": "切换按键"

+ 4 - 4
tasks/ActivityShikigami/as/ocr.json

@@ -1,8 +1,8 @@
 [
 [
   {
   {
     "itemName": "remain_ap",
     "itemName": "remain_ap",
-    "roiFront": "1180,678,82,30",
-    "roiBack": "1180,678,86,30",
+    "roiFront": "1120,671,90,30",
+    "roiBack": "1120,671,90,30",
     "mode": "DigitCounter",
     "mode": "DigitCounter",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",
@@ -10,8 +10,8 @@
   },
   },
   {
   {
     "itemName": "remain_ap_activity",
     "itemName": "remain_ap_activity",
-    "roiFront": "722,23,87,34",
-    "roiBack": "722,23,96,34",
+    "roiFront": "884,20,106,34",
+    "roiBack": "884,20,106,34",
     "mode": "DigitCounter",
     "mode": "DigitCounter",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",

+ 11 - 11
tasks/ActivityShikigami/assets.py

@@ -12,25 +12,25 @@ class ActivityShikigamiAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 进入活动 
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(455,346,29,53), roi_back=(122,333,1029,76), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(135,146,64,53), roi_back=(80,132,1029,76), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
 	# 左上角返回 
 	I_BACK_GREEN = RuleImage(roi_front=(23,18,49,49), roi_back=(23,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	I_BACK_GREEN = RuleImage(roi_front=(23,18,49,49), roi_back=(23,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
-	# description 
-	I_BATTLE = RuleImage(roi_front=(1037,330,52,57), roi_back=(1037,330,52,57), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	# 进入爬塔 
+	I_BATTLE = RuleImage(roi_front=(568,171,52,177), roi_back=(568,171,52,177), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(902,379,41,43), roi_back=(902,379,41,43), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	I_DRUM = RuleImage(roi_front=(902,379,41,43), roi_back=(902,379,41,43), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
 	# 上锁图标 
-	I_LOCK = RuleImage(roi_front=(794,653,30,32), roi_back=(794,653,30,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
+	I_LOCK = RuleImage(roi_front=(806,642,30,32), roi_back=(806,642,30,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
 	# 还未上锁图片 
-	I_UNLOCK = RuleImage(roi_front=(796,653,27,35), roi_back=(796,653,27,35), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
+	I_UNLOCK = RuleImage(roi_front=(807,640,27,35), roi_back=(807,640,27,35), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
 	# 点击战斗 
-	I_FIRE = RuleImage(roi_front=(1140,585,75,73), roi_back=(1140,585,75,73), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
+	I_FIRE = RuleImage(roi_front=(1123,563,106,116), roi_back=(1123,563,106,116), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
 	# 体力按钮 
-	I_AP = RuleImage(roi_front=(1126,510,27,37), roi_back=(1126,510,27,37), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
+	I_AP = RuleImage(roi_front=(1116,498,27,37), roi_back=(1116,498,27,37), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
 	# 活动体力 
-	I_AP_ACTIVITY = RuleImage(roi_front=(1125,516,27,27), roi_back=(1125,516,27,27), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
+	I_AP_ACTIVITY = RuleImage(roi_front=(1109,502,27,27), roi_back=(1109,502,27,27), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
 	# 切换按键 
 	# 切换按键 
-	I_SWITCH = RuleImage(roi_front=(1207,514,33,30), roi_back=(1207,514,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
+	I_SWITCH = RuleImage(roi_front=(1207,505,33,30), roi_back=(1207,505,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
 	# 购买活动的体力 
 	# 购买活动的体力 
 	I_BUY_JADE = RuleImage(roi_front=(836,619,38,42), roi_back=(789,614,143,52), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
 	I_BUY_JADE = RuleImage(roi_front=(836,619,38,42), roi_back=(789,614,143,52), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
 	# 增加到最大 
 	# 增加到最大 
@@ -41,9 +41,9 @@ class ActivityShikigamiAssets:
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets
 	# 体力的数量检测 
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(1180,678,82,30), area=(1180,678,86,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1120,671,90,30), area=(1120,671,90,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	# 活动体力的剩余检测 
-	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(722,23,87,34), area=(722,23,96,34), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
+	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(884,20,106,34), area=(884,20,106,34), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 
 

+ 29 - 8
tasks/ActivityShikigami/script_task.py

@@ -1,8 +1,7 @@
 # This Python file uses the following encoding: utf-8
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # @author runhey
 # github https://github.com/runhey
 # github https://github.com/runhey
-from datetime import datetime, timedelta
-import time
+from datetime import datetime, timedelta, time
 
 
 from tasks.base_task import BaseTask
 from tasks.base_task import BaseTask
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
@@ -20,12 +19,14 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
 
 
         config = self.config.activity_shikigami
         config = self.config.activity_shikigami
         self.limit_time: timedelta = config.general_climb.limit_time
         self.limit_time: timedelta = config.general_climb.limit_time
+        if isinstance(self.limit_time, time):
+            self.limit_time = timedelta(hours=self.limit_time.hour, minutes=self.limit_time.minute,
+                                        seconds=self.limit_time.second)
         self.limit_count = config.general_climb.limit_count
         self.limit_count = config.general_climb.limit_count
 
 
         self.home_main()
         self.home_main()
 
 
         # 设定是否锁定阵容
         # 设定是否锁定阵容
-        self.wait_until_appear(self.I_BACK_GREEN)
         if config.general_battle.lock_team_enable:
         if config.general_battle.lock_team_enable:
             logger.info("Lock team")
             logger.info("Lock team")
             while 1:
             while 1:
@@ -100,14 +101,15 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
         logger.hr("Enter Shikigami", 2)
         logger.hr("Enter Shikigami", 2)
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
+            if self.appear(self.I_FIRE):
+                break
             if self.appear_then_click(self.I_SHI, interval=1):
             if self.appear_then_click(self.I_SHI, interval=1):
                 continue
                 continue
             if self.appear_then_click(self.I_DRUM, interval=1):
             if self.appear_then_click(self.I_DRUM, interval=1):
                 continue
                 continue
             if self.appear_then_click(self.I_BATTLE, interval=1):
             if self.appear_then_click(self.I_BATTLE, interval=1):
                 continue
                 continue
-            if self.appear(self.I_FIRE):
-                break
+
 
 
 
 
     def main_home(self) -> bool:
     def main_home(self) -> bool:
@@ -118,10 +120,13 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
         logger.hr("Exit Shikigami", 2)
         logger.hr("Exit Shikigami", 2)
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear_then_click(self.I_BACK_GREEN, interval=1):
-                continue
             if self.appear(self.I_SHI):
             if self.appear(self.I_SHI):
                 break
                 break
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
+                continue
+            if self.appear_then_click(self.I_BACK_GREEN, interval=1):
+                continue
+
 
 
     def check_ap_remain(self, current_ap: ApMode) -> bool:
     def check_ap_remain(self, current_ap: ApMode) -> bool:
         """
         """
@@ -139,8 +144,12 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
         elif current_ap == ApMode.AP_GAME:
         elif current_ap == ApMode.AP_GAME:
             cu, res, total = self.O_REMAIN_AP.ocr(image=self.device.image)
             cu, res, total = self.O_REMAIN_AP.ocr(image=self.device.image)
             if cu == total and cu + res == total:
             if cu == total and cu + res == total:
-                logger.warning("Game ap not enough")
+                if cu > total:
+                    logger.warning(f'Game ap {cu} more than total {total}')
+                    return True
+                logger.warning(f'Game ap not enough: {cu}')
                 return False
                 return False
+
             return True
             return True
 
 
     def switch(self, current_ap: ApMode) -> None:
     def switch(self, current_ap: ApMode) -> None:
@@ -165,3 +174,15 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
                     break
                     break
                 if self.appear(self.I_AP_ACTIVITY, interval=1):
                 if self.appear(self.I_AP_ACTIVITY, interval=1):
                     self.appear_then_click(self.I_SWITCH, interval=2)
                     self.appear_then_click(self.I_SWITCH, interval=2)
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    from memory_profiler import profile
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+
+    t.run()

+ 1 - 1
tasks/AreaBoss/script_task.py

@@ -171,7 +171,7 @@ class ScriptTask(GeneralBattle, GameUi, AreaBossAssets):
 
 
         # 退出
         # 退出
         self.go_back()
         self.go_back()
-        self.set_next_run(task='AreaBoss', success=True)
+        self.set_next_run(task='AreaBoss', success=True, finish=False)
 
 
         # 以抛出异常的形式结束
         # 以抛出异常的形式结束
         raise TaskEnd
         raise TaskEnd

+ 2 - 0
tasks/BondlingFairyland/battle.py

@@ -50,6 +50,8 @@ class BondlingBattle(GeneralBattle, BondlingFairylandAssets):
         :return: 如果捕获成功返回True,否则返回False
         :return: 如果捕获成功返回True,否则返回False
         """
         """
         self.device.stuck_record_add('BATTLE_STATUS_S')
         self.device.stuck_record_add('BATTLE_STATUS_S')
+        self.device.click_record_clear()
+        # 有时候 只会点击 获得奖励和开始战斗
         # 战斗过程 随机点击和滑动 防封
         # 战斗过程 随机点击和滑动 防封
         logger.info("Start battle process")
         logger.info("Start battle process")
         win: bool = False
         win: bool = False

+ 22 - 2
tasks/Component/BaseActivity/config_activity.py

@@ -2,9 +2,11 @@
 # @author runhey
 # @author runhey
 # github https://github.com/runhey
 # github https://github.com/runhey
 from datetime import time, timedelta
 from datetime import time, timedelta
-from pydantic import BaseModel, Field
+from pydantic import BaseModel, Field, validator
 from enum import Enum
 from enum import Enum
 
 
+from module.logger import logger
+
 from tasks.Component.config_base import ConfigBase, TimeDelta
 from tasks.Component.config_base import ConfigBase, TimeDelta
 
 
 class ApMode(str, Enum):
 class ApMode(str, Enum):
@@ -14,7 +16,7 @@ class ApMode(str, Enum):
 
 
 class GeneralClimb(ConfigBase):
 class GeneralClimb(ConfigBase):
     # 限制执行的时间
     # 限制执行的时间
-    limit_time: TimeDelta = Field(default=TimeDelta(hours=1), description='limit_time_help')
+    limit_time: time = Field(default=time(minute=30), description='limit_time_help')
     # 限制执行的次数
     # 限制执行的次数
     limit_count: int = Field(default=50, description='limit_count_help')
     limit_count: int = Field(default=50, description='limit_count_help')
     # 每日使用体力挑战的最大次数,默认是300
     # 每日使用体力挑战的最大次数,默认是300
@@ -27,4 +29,22 @@ class GeneralClimb(ConfigBase):
     # 在我的设计理念中:活动体力>游戏体力。所以不提供从300挂满然后才到挂活动币
     # 在我的设计理念中:活动体力>游戏体力。所以不提供从300挂满然后才到挂活动币
     activity_toggle: bool = Field(default=False, description='activity_toggle_help')
     activity_toggle: bool = Field(default=False, description='activity_toggle_help')
 
 
+    @validator('limit_time', pre=True, always=True)
+    def parse_limit_time(cls, value):
+        if isinstance(value, str):
+            if value.isdigit():
+                try:
+                    value = int(value)
+                except ValueError:
+                    logger.warning('Invalid limit_time value. Expected format: seconds')
+                    return time(hour=0, minute=30, second=0)
+                delta = timedelta(seconds=value)
+                return time(hour=delta.seconds // 3600, minute=delta.seconds // 60 % 60, second=delta.seconds % 60)
+            else:
+                try:
+                    return time.fromisoformat(value)
+                except ValueError:
+                    logger.warning('Invalid limit_time value. Expected format: HH:MM:SS')
+                    return time(hour=0, minute=30, second=0)
+        return value
 
 

+ 33 - 0
tasks/Component/Buy/assets.py

@@ -0,0 +1,33 @@
+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 ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class BuyAssets: 
+
+
+	# Click Rule Assets
+	# description 
+	C_BUY_ONE = RuleClick(roi_front=(553,435,174,61), roi_back=(553,435,174,61), name="buy_one")
+	# description 
+	C_BUY_MORE = RuleClick(roi_front=(551,510,174,60), roi_back=(551,510,174,60), name="buy_more")
+
+
+	# Image Rule Assets
+	# 拉满 
+	I_BUY_PLUS = RuleImage(roi_front=(762,410,50,58), roi_back=(762,410,50,58), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_plus.png")
+	# 加一个 
+	I_BUY_ADD = RuleImage(roi_front=(686,411,51,54), roi_back=(686,411,51,54), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_add.png")
+	# 减 
+	I_BUY_SUB = RuleImage(roi_front=(471,416,50,48), roi_back=(471,416,50,48), threshold=0.8, method="Template matching", file="./tasks/Component/Buy/buy/buy_buy_sub.png")
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_BUY_NUMBER = RuleOcr(roi=(578,416,52,46), area=(578,416,52,46), mode="Digit", method="Default", keyword="", name="buy_number")
+
+

+ 155 - 0
tasks/Component/Buy/buy.py

@@ -0,0 +1,155 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from typing import Union
+
+from module.atom.image import RuleImage
+from module.atom.ocr import RuleOcr
+from module.atom.click import RuleClick
+from module.logger import logger
+
+from tasks.base_task import BaseTask
+from tasks.Component.Buy.assets import BuyAssets
+
+class Buy(BaseTask, BuyAssets):
+
+    def buy_one(self, start_click: Union[RuleImage, RuleOcr, RuleClick],
+                check_image: RuleImage):
+        """
+        购买一个物品
+        :param check_image: 购买确认时候的图片
+        :param start_click: 开始点击
+        :return:
+        """
+        while 1:
+            self.screenshot()
+
+            if self.appear(check_image):
+                break
+
+            if isinstance(start_click, RuleImage):
+                if self.appear_then_click(start_click, interval=1):
+                    continue
+            elif isinstance(start_click, RuleOcr):
+                if self.ocr_appear_click(start_click, interval=1):
+                    continue
+            elif isinstance(start_click, RuleClick):
+                if self.click(start_click, interval=1):
+                    continue
+        while 1:
+            self.screenshot()
+
+            if self.ui_reward_appear_click():
+                while 1:
+                    self.screenshot()
+                    # 等待动画结束
+                    if not self.appear(self.I_UI_REWARD, threshold=1):
+                        logger.info('Get reward success')
+                        break
+                    # 一直点击
+                    if self.ui_reward_appear_click():
+                        continue
+                break
+
+            if self.click(self.C_BUY_ONE, interval=2):
+                continue
+
+        return True
+
+
+    def buy_more(self, start_click: Union[RuleImage, RuleOcr, RuleClick],
+                 number: int = None):
+        """
+        购买多个物品
+        :param start_click:
+        :param number: 不指定就是拉满
+        :return:
+        """
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_BUY_PLUS):
+                break
+
+            if isinstance(start_click, RuleImage):
+                if self.appear_then_click(start_click, interval=1):
+                    continue
+            elif isinstance(start_click, RuleOcr):
+                if self.ocr_appear_click(start_click, interval=1):
+                    continue
+            elif isinstance(start_click, RuleClick):
+                if self.click(start_click, interval=1):
+                    continue
+        # 设置购买的数量
+        if number is None:
+            self.appear_then_click(self.I_BUY_PLUS, interval=0.4)
+            time.sleep(0.5)
+            self.appear_then_click(self.I_BUY_PLUS, interval=0.4)
+        else:
+            # 四次截图数字都一样,就可以退出了
+            number_record = []
+            while 1:
+                self.screenshot()
+                current = self.O_BUY_NUMBER.ocr(self.device.image)
+                if current >= number:
+                    break
+                number_record.append(current)
+                if len(number_record) >= 4:
+                    if number_record[0] == number_record[1] == number_record[2] == number_record[3]:
+                        break
+                    number_record.pop(0)
+
+                if self.appear_then_click(self.I_BUY_ADD, interval=0.6):
+                    continue
+        # 购买确认
+        while 1:
+            self.screenshot()
+
+            if self.ui_reward_appear_click():
+                while 1:
+                    self.screenshot()
+                    # 等待动画结束
+                    if not self.appear(self.I_UI_REWARD, threshold=1):
+                        logger.info('Get reward success')
+                        break
+                    # 一直点击
+                    if self.ui_reward_appear_click():
+                        continue
+                break
+
+            if self.click(self.C_BUY_MORE, interval=2):
+                continue
+
+    def buy_check_money(self, target: RuleOcr, minimum: int):
+        """
+        检查钱是否足够
+        :param target:
+        :param minimum:
+        :return:
+        """
+        self.screenshot()
+        if not isinstance(target, RuleOcr):
+            logger.error('Target is not RuleOcr')
+            return False
+        current = target.ocr(self.device.image)
+        if not isinstance(current, int):
+            logger.warning('OCR current money failed')
+            return False
+        if current >= minimum:
+            logger.info('Money is enough')
+            return True
+        logger.info('Money is not enough')
+        return False
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Buy(c, d)
+

BIN
tasks/Component/Buy/buy/buy_buy_add.png


BIN
tasks/Component/Buy/buy/buy_buy_plus.png


BIN
tasks/Component/Buy/buy/buy_buy_sub.png


+ 14 - 0
tasks/Component/Buy/buy/click.json

@@ -0,0 +1,14 @@
+[
+  {
+    "itemName": "buy_one",
+    "roiFront": "553,435,174,61",
+    "roiBack": "553,435,174,61",
+    "description": "description"
+  },
+  {
+    "itemName": "buy_more",
+    "roiFront": "551,510,174,60",
+    "roiBack": "551,510,174,60",
+    "description": "description"
+  }
+]

+ 29 - 0
tasks/Component/Buy/buy/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "buy_plus",
+    "imageName": "buy_buy_plus.png",
+    "roiFront": "762,410,50,58",
+    "roiBack": "762,410,50,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "拉满"
+  },
+  {
+    "itemName": "buy_add",
+    "imageName": "buy_buy_add.png",
+    "roiFront": "686,411,51,54",
+    "roiBack": "686,411,51,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "加一个"
+  },
+  {
+    "itemName": "buy_sub",
+    "imageName": "buy_buy_sub.png",
+    "roiFront": "471,416,50,48",
+    "roiBack": "471,416,50,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "减"
+  }
+]

+ 11 - 0
tasks/Component/Buy/buy/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "buy_number",
+    "roiFront": "578,416,52,46",
+    "roiBack": "578,416,52,46",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  }
+]

+ 24 - 3
tasks/Component/GeneralBattle/general_battle.py

@@ -401,9 +401,30 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
 
 
         return self.battle_wait(config.random_click_swipt_enable)
         return self.battle_wait(config.random_click_swipt_enable)
 
 
-
-
-
+    def check_lock(self, enable: bool, lock_image, unlock_image):
+        """
+        检测是否锁定队伍,
+        :param enable:
+        :param lock_image:
+        :param unlock_image:
+        :return:
+        """
+        if enable:
+            logger.info("Lock team")
+            while 1:
+                self.screenshot()
+                if self.appear(lock_image):
+                    break
+                if self.appear_then_click(unlock_image, interval=1):
+                    continue
+        else:
+            logger.info("Unlock team")
+            while 1:
+                self.screenshot()
+                if self.appear(unlock_image):
+                    break
+                if self.appear_then_click(lock_image, interval=1):
+                    continue
 
 
 
 
 
 

+ 33 - 48
tasks/Component/GeneralInvite/general_invite.py

@@ -62,7 +62,8 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             self.ensure_room_type(config.invite_number)
             self.ensure_room_type(config.invite_number)
             self.invite_friends(config)
             self.invite_friends(config)
         else:
         else:
-            self.timer_invite = None
+            self.timer_invite = Timer(30)
+            self.timer_invite.start()
             self.timer_emoji = Timer(20)
             self.timer_emoji = Timer(20)
             self.timer_emoji.start()
             self.timer_emoji.start()
         wait_second = config.wait_time.second + config.wait_time.minute * 60
         wait_second = config.wait_time.second + config.wait_time.minute * 60
@@ -74,82 +75,58 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
                 logger.warning('Wait timeout')
                 logger.warning('Wait timeout')
                 return False
                 return False
             if self.timer_invite and self.timer_invite.reached():
             if self.timer_invite and self.timer_invite.reached():
-                logger.info('Invitation is triggered every 20s')
-                self.timer_invite.reset()
+                if is_first:
+                    logger.info('Invitation is triggered every 20s')
+                    self.timer_invite.reset()
+                else:
+                    logger.info('Wait for 30s and invite again')
+                    self.timer_invite = None
                 self.invite_friends(config)
                 self.invite_friends(config)
-
             if self.appear(self.I_MATCHING):
             if self.appear(self.I_MATCHING):
                 logger.warning('Timeout, now is no room')
                 logger.warning('Timeout, now is no room')
                 return False
                 return False
 
 
+            if not self.is_in_room():
+                continue
+
             if self.timer_emoji and self.timer_emoji.reached():
             if self.timer_emoji and self.timer_emoji.reached():
                 self.timer_emoji.reset()
                 self.timer_emoji.reset()
                 self.appear_then_click(self.I_GI_EMOJI_1)
                 self.appear_then_click(self.I_GI_EMOJI_1)
                 self.appear_then_click(self.I_GI_EMOJI_2)
                 self.appear_then_click(self.I_GI_EMOJI_2)
 
 
 
 
+            fire = False  # 是否开启挑战
             # 如果这个房间最多只容纳两个人(意思是只可以邀请一个人),且已经邀请一个人了,那就开启挑战
             # 如果这个房间最多只容纳两个人(意思是只可以邀请一个人),且已经邀请一个人了,那就开启挑战
             if self.room_type == RoomType.NORMAL_2 and not self.appear(self.I_ADD_2):
             if self.room_type == RoomType.NORMAL_2 and not self.appear(self.I_ADD_2):
                 logger.info('Start challenge and this room can only invite one friend')
                 logger.info('Start challenge and this room can only invite one friend')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE):
-                        break
-                    if self.appear_then_click(self.I_FIRE, interval=1):
-                        continue
-                return True
+                fire = True
             # 如果这个房间最多容纳三个人(意思是可以邀请两个人),且设定邀请一个就开启挑战,那就开启挑战
             # 如果这个房间最多容纳三个人(意思是可以邀请两个人),且设定邀请一个就开启挑战,那就开启挑战
             elif self.room_type == RoomType.NORMAL_3 and config.invite_number == InviteNumber.ONE and not self.appear(self.I_ADD_1):
             elif self.room_type == RoomType.NORMAL_3 and config.invite_number == InviteNumber.ONE and not self.appear(self.I_ADD_1):
                 logger.info('Start challenge and user only invite one friend')
                 logger.info('Start challenge and user only invite one friend')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE):
-                        break
-                    if self.appear_then_click(self.I_FIRE, interval=1):
-                        continue
-                return True
+                fire = True
             # 如果这个房间最多容纳三个人(意思是可以邀请两个人),且设定邀请两个就开启挑战,那就开启挑战
             # 如果这个房间最多容纳三个人(意思是可以邀请两个人),且设定邀请两个就开启挑战,那就开启挑战
             elif self.room_type == RoomType.NORMAL_3 \
             elif self.room_type == RoomType.NORMAL_3 \
                     and config.invite_number == InviteNumber.TWO and not self.appear(self.I_ADD_2):
                     and config.invite_number == InviteNumber.TWO and not self.appear(self.I_ADD_2):
                 logger.info('Start challenge and user invite two friends')
                 logger.info('Start challenge and user invite two friends')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE):
-                        break
-                    if self.appear_then_click(self.I_FIRE, interval=1):
-                        continue
-                return True
+                fire = True
             # 如果这个房间是五人的,且设定邀请一个就开启挑战,那就开启挑战
             # 如果这个房间是五人的,且设定邀请一个就开启挑战,那就开启挑战
             elif self.room_type == RoomType.NORMAL_5 \
             elif self.room_type == RoomType.NORMAL_5 \
                     and config.invite_number == InviteNumber.ONE and not self.appear(self.I_ADD_5_1):
                     and config.invite_number == InviteNumber.ONE and not self.appear(self.I_ADD_5_1):
                 logger.info('Start challenge and user only invite one friend')
                 logger.info('Start challenge and user only invite one friend')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE):
-                        break
-                    if self.appear_then_click(self.I_FIRE, interval=1):
-                        continue
-                return True
+                fire = True
             # 如果这个房间是五人的,且设定邀请两个就开启挑战,那就开启挑战
             # 如果这个房间是五人的,且设定邀请两个就开启挑战,那就开启挑战
             elif self.room_type == RoomType.NORMAL_5 \
             elif self.room_type == RoomType.NORMAL_5 \
                     and config.invite_number == InviteNumber.TWO and not self.appear(self.I_ADD_5_2):
                     and config.invite_number == InviteNumber.TWO and not self.appear(self.I_ADD_5_2):
                 logger.info('Start challenge and user invite two friends')
                 logger.info('Start challenge and user invite two friends')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE):
-                        break
-                    if self.appear_then_click(self.I_FIRE, interval=1):
-                        continue
-                return True
+                fire = True
             # 如果是永生之海
             # 如果是永生之海
             elif self.room_type == RoomType.ETERNITY_SEA and not self.appear(self.I_ADD_SEA):
             elif self.room_type == RoomType.ETERNITY_SEA and not self.appear(self.I_ADD_SEA):
                 logger.info('Start challenge and this is lock sea')
                 logger.info('Start challenge and this is lock sea')
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_FIRE_SEA):
-                        break
-                    if self.appear_then_click(self.I_FIRE_SEA, interval=1):
-                        continue
+                fire = True
+
+            # 点击挑战
+            if fire:
+                self.click_fire()
                 return True
                 return True
 
 
     def ensure_enter(self) -> bool:
     def ensure_enter(self) -> bool:
@@ -183,8 +160,8 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             return True
             return True
         if self.appear(self.I_GI_EMOJI_2):
         if self.appear(self.I_GI_EMOJI_2):
             return True
             return True
-        if self.appear(self.I_MATCHING):
-            return False
+        # if self.appear(self.I_MATCHING):
+        #     return False
         return False
         return False
 
 
     def exit_room(self) -> bool:
     def exit_room(self) -> bool:
@@ -207,6 +184,13 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
                 continue
                 continue
         return True
         return True
 
 
+    def click_fire(self):
+        while 1:
+            self.screenshot()
+            if not self.is_in_room(False):
+                break
+            if self.appear_then_click(self.I_FIRE, interval=1, threshold=0.7):
+                continue
 
 
     @cached_property
     @cached_property
     def room_type(self) -> RoomType:
     def room_type(self) -> RoomType:
@@ -647,5 +631,6 @@ if __name__ == '__main__':
 
 
     # t.run_invite(c.orochi.invite_config, is_first=True)
     # t.run_invite(c.orochi.invite_config, is_first=True)
     t.screenshot()
     t.screenshot()
-    print(t.detect_select('我是真的天秀'))
+    print(t.appear(t.I_FIRE, threshold=0.8))
+
 
 

BIN
tasks/Component/GeneralInvite/gi/gi_fire.png


+ 39 - 0
tasks/Component/Summon/assets.py

@@ -0,0 +1,39 @@
+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 ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class SummonAssets: 
+
+
+	# Image Rule Assets
+	# 点击蓝票 
+	I_BLUE_TICKET = RuleImage(roi_front=(533,594,65,76), roi_back=(533,594,65,76), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_blue_ticket.png")
+	# 点击厕所票 
+	I_LOW_TICKET = RuleImage(roi_front=(403,600,63,65), roi_back=(403,600,63,65), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_low_ticket.png")
+	# 单抽 
+	I_ONE_TICKET = RuleImage(roi_front=(396,599,76,76), roi_back=(396,599,76,76), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_one_ticket.png")
+	# description 
+	I_SM_CONFIRM = RuleImage(roi_front=(419,617,174,61), roi_back=(419,617,174,61), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_sm_confirm.png")
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_ONE_TICKET = RuleOcr(roi=(514,682,100,32), area=(514,682,100,32), mode="Single", method="Default", keyword="", name="one_ticket")
+
+
+	# Swipe Rule Assets
+	# description 
+	S_RANDOM_SWIPE_1 = RuleSwipe(roi_front=(459,136,369,100), roi_back=(456,448,400,100), mode="default", name="random_swipe_1")
+	# description 
+	S_RANDOM_SWIPE_2 = RuleSwipe(roi_front=(433,451,447,100), roi_back=(411,122,479,100), mode="default", name="random_swipe_2")
+	# description 
+	S_RANDOM_SWIPE_3 = RuleSwipe(roi_front=(401,123,100,440), roi_back=(762,122,100,434), mode="default", name="random_swipe_3")
+	# description 
+	S_RANDOM_SWIPE_4 = RuleSwipe(roi_front=(777,128,100,412), roi_back=(431,120,100,444), mode="default", name="random_swipe_4")
+
+

+ 38 - 0
tasks/Component/Summon/sm/image.json

@@ -0,0 +1,38 @@
+[
+  {
+    "itemName": "blue_ticket",
+    "imageName": "sm_blue_ticket.png",
+    "roiFront": "533,594,65,76",
+    "roiBack": "533,594,65,76",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击蓝票"
+  },
+  {
+    "itemName": "low_ticket",
+    "imageName": "sm_low_ticket.png",
+    "roiFront": "403,600,63,65",
+    "roiBack": "403,600,63,65",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击厕所票"
+  },
+  {
+    "itemName": "one_ticket",
+    "imageName": "sm_one_ticket.png",
+    "roiFront": "396,599,76,76",
+    "roiBack": "396,599,76,76",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "单抽"
+  },
+  {
+    "itemName": "sm_confirm",
+    "imageName": "sm_sm_confirm.png",
+    "roiFront": "419,617,174,61",
+    "roiBack": "419,617,174,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

+ 11 - 0
tasks/Component/Summon/sm/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "one_ticket",
+    "roiFront": "514,682,100,32",
+    "roiBack": "514,682,100,32",
+    "mode": "Single",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  }
+]

BIN
tasks/Component/Summon/sm/sm_blue_ticket.png


BIN
tasks/Component/Summon/sm/sm_low_ticket.png


BIN
tasks/Component/Summon/sm/sm_one_ticket.png


BIN
tasks/Component/Summon/sm/sm_sm_confirm.png


+ 30 - 0
tasks/Component/Summon/sm/swipe.json

@@ -0,0 +1,30 @@
+[
+  {
+    "itemName": "random_swipe_1",
+    "roiFront": "459,136,369,100",
+    "roiBack": "456,448,400,100",
+    "mode": "default",
+    "description": "description"
+  },
+  {
+    "itemName": "random_swipe_2",
+    "roiFront": "433,451,447,100",
+    "roiBack": "411,122,479,100",
+    "mode": "default",
+    "description": "description"
+  },
+  {
+    "itemName": "random_swipe_3",
+    "roiFront": "401,123,100,440",
+    "roiBack": "762,122,100,434",
+    "mode": "default",
+    "description": "description"
+  },
+  {
+    "itemName": "random_swipe_4",
+    "roiFront": "777,128,100,412",
+    "roiBack": "431,120,100,444",
+    "mode": "default",
+    "description": "description"
+  }
+]

+ 77 - 0
tasks/Component/Summon/summon.py

@@ -0,0 +1,77 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+import random
+
+from tasks.Component.Summon.assets import SummonAssets
+from tasks.base_task import BaseTask
+from module.logger import logger
+
+
+class Summon(BaseTask, SummonAssets):
+
+
+    def summon(self):
+        """
+        召唤, 就是随机画一个, 划线
+        :return:
+        """
+        self.screenshot()
+        random_swipe = random.randint(0, 3)
+        target_swipe = None
+        match random_swipe:
+            case 0: target_swipe = self.S_RANDOM_SWIPE_1
+            case 1: target_swipe = self.S_RANDOM_SWIPE_2
+            case 2: target_swipe = self.S_RANDOM_SWIPE_3
+            case 3: target_swipe = self.S_RANDOM_SWIPE_4
+            case _: target_swipe = self.S_RANDOM_SWIPE_1
+        self.swipe(target_swipe, interval=0.5)
+
+
+
+    def summon_one(self):
+        """
+        确保在召唤界面,每日召唤一次
+        召唤结束后回到 召唤主界面
+        :return:
+        """
+        logger.info('Summon one')
+        self.wait_until_appear(self.I_BLUE_TICKET)
+        ticket_info = self.O_ONE_TICKET.ocr(self.device.image)
+        if '1' not in ticket_info:
+            logger.warning('There is no any one blue ticket')
+            return
+        while 1:
+            self.screenshot()
+
+            if self.appear_then_click(self.I_ONE_TICKET):
+                break
+            if self.appear_then_click(self.I_BLUE_TICKET, interval=1):
+                continue
+        time.sleep(1)
+        self.summon()
+        self.wait_until_appear(self.I_SM_CONFIRM)
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_SM_CONFIRM):
+                break
+            if self.appear_then_click(self.I_SM_CONFIRM):
+                continue
+
+
+    def back_summon_main(self):
+        """
+        返回召唤主界面
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_BLUE_TICKET):
+                break
+            if self.appear_then_click(self.I_UI_BACK_BLUE):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_YELLOW):
+                continue
+

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

@@ -23,6 +23,12 @@ class SwitchSoul(BaseTask, SwitchSoulAssets):
         保证在式神录的界面
         保证在式神录的界面
         :return:
         :return:
         """
         """
+        if isinstance(target, str):
+            try:
+                target = switch_parser(target)
+            except ValueError:
+                logger.error('Switch soul config error')
+                return
         self.click_preset()
         self.click_preset()
         self.switch_souls(target)
         self.switch_souls(target)
 
 

+ 30 - 0
tasks/DailyTrifles/assets.py

@@ -0,0 +1,30 @@
+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 ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class DailyTriflesAssets: 
+
+
+	# Image Rule Assets
+	# description 
+	I_L_FRIENDS = RuleImage(roi_front=(67,625,70,72), roi_back=(67,625,70,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_friends.png")
+	# description 
+	I_L_LOVE = RuleImage(roi_front=(123,625,67,72), roi_back=(123,625,67,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_love.png")
+	# 一键收取 
+	I_L_COLLECT = RuleImage(roi_front=(47,537,129,56), roi_back=(47,537,129,56), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/love_l_collect.png")
+
+
+	# Image Rule Assets
+	# 礼包屋 
+	I_ROOM_GIFT = RuleImage(roi_front=(1143,636,69,64), roi_back=(1143,636,69,64), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/store/store_room_gift.png")
+	# description 
+	I_GIFT_RECOMMEND = RuleImage(roi_front=(1186,98,53,64), roi_back=(1172,83,83,214), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/store/store_gift_recommend.png")
+	# 免费一抽 
+	I_GIFT_SIGN = RuleImage(roi_front=(201,207,100,143), roi_back=(201,207,100,143), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/store/store_gift_sign.png")
+
+

+ 21 - 0
tasks/DailyTrifles/config.py

@@ -0,0 +1,21 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from datetime import timedelta
+from pydantic import BaseModel, Field
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase
+
+
+class DailyTriflesConfig(BaseModel):
+    one_summon: bool = Field(title='One Summon', default=False)
+    guild_wish: bool = Field(title='Guild Wish', default=False)
+    friend_love: bool = Field(title='Friend Love', default=False)
+    store_sign: bool = Field(title='Store Sign', default=False, description='store_sign_help')
+
+
+class DailyTrifles(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    trifles_config: DailyTriflesConfig = Field(default_factory=DailyTriflesConfig)
+

+ 29 - 0
tasks/DailyTrifles/love/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "l_friends",
+    "imageName": "love_l_friends.png",
+    "roiFront": "67,625,70,72",
+    "roiBack": "67,625,70,72",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "description"
+  },
+  {
+    "itemName": "l_love",
+    "imageName": "love_l_love.png",
+    "roiFront": "123,625,67,72",
+    "roiBack": "123,625,67,72",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "description"
+  },
+  {
+    "itemName": "l_collect",
+    "imageName": "love_l_collect.png",
+    "roiFront": "47,537,129,56",
+    "roiBack": "47,537,129,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "一键收取"
+  }
+]

BIN
tasks/DailyTrifles/love/love_l_collect.png


BIN
tasks/DailyTrifles/love/love_l_friends.png


BIN
tasks/DailyTrifles/love/love_l_love.png


+ 105 - 0
tasks/DailyTrifles/script_task.py

@@ -0,0 +1,105 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from time import sleep
+from datetime import time, datetime, timedelta
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main, page_summon, page_guild, page_mall, page_friends
+from tasks.DailyTrifles.config import DailyTriflesConfig
+from tasks.DailyTrifles.assets import DailyTriflesAssets
+from tasks.Component.Summon.summon import Summon
+
+
+from module.logger import logger
+from module.exception import TaskEnd
+
+
+
+class ScriptTask(GameUi, Summon, DailyTriflesAssets):
+
+    def run(self):
+        con = self.config.daily_trifles.trifles_config
+        if con.one_summon:
+            self.run_one_summon()
+        if con.guild_wish:
+            pass
+        if con.friend_love:
+            self.run_friend_love()
+        if con.store_sign:
+            self.run_store_sign()
+        raise TaskEnd('DailyTrifles')
+
+    def run_one_summon(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_summon)
+        self.summon_one()
+        self.back_summon_main()
+
+    def run_guild_wish(self):
+        pass
+
+    def run_friend_love(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_friends)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_L_LOVE):
+                break
+            if self.appear_then_click(self.I_L_FRIENDS, interval=1):
+                continue
+        logger.info('Friend love')
+        sleep(0.5)
+        self.screenshot()
+        if not self.appear(self.I_L_COLLECT):
+            logger.warning('There is no any love')
+            self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)
+            return
+        if self.ui_get_reward(self.I_L_COLLECT):
+            logger.info('Get reward of friend love')
+
+        self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)
+
+    def run_store_sign(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_mall)
+
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GIFT_RECOMMEND):
+                break
+            if self.appear_then_click(self.I_ROOM_GIFT, interval=1):
+                continue
+        self.screenshot()
+        self.appear_then_click(self.I_GIFT_RECOMMEND, interval=1)
+        logger.info('Enter store sign')
+        sleep(1)  # 等个动画
+        self.screenshot()
+        if not self.appear(self.I_GIFT_SIGN):
+            logger.warning('There is no gift sign')
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            return
+
+        if self.ui_get_reward(self.I_GIFT_SIGN):
+            logger.info('Get reward of gift sign')
+
+        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_MALL)
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    from memory_profiler import profile
+
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+
+    t.run_friend_love()
+

+ 29 - 0
tasks/DailyTrifles/store/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "room_gift",
+    "imageName": "store_room_gift.png",
+    "roiFront": "1143,636,69,64",
+    "roiBack": "1143,636,69,64",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "礼包屋"
+  },
+  {
+    "itemName": "gift_recommend",
+    "imageName": "store_gift_recommend.png",
+    "roiFront": "1186,98,53,64",
+    "roiBack": "1172,83,83,214",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "gift_sign",
+    "imageName": "store_gift_sign.png",
+    "roiFront": "201,207,100,143",
+    "roiBack": "201,207,100,143",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "免费一抽"
+  }
+]

BIN
tasks/DailyTrifles/store/store_gift_recommend.png


BIN
tasks/DailyTrifles/store/store_gift_sign.png


BIN
tasks/DailyTrifles/store/store_room_gift.png


BIN
tasks/GameUi/additional/additional_ad_close_red.png


+ 11 - 0
tasks/GameUi/additional/mall.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "ad_close_red",
+    "imageName": "additional_ad_close_red.png",
+    "roiFront": "994,128,33,36",
+    "roiBack": "994,128,33,36",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "商店弹窗红色关闭"
+  }
+]

+ 10 - 1
tasks/GameUi/assets.py

@@ -10,6 +10,11 @@ from module.atom.list import RuleList
 class GameUiAssets: 
 class GameUiAssets: 
 
 
 
 
+	# Image Rule Assets
+	# 商店弹窗红色关闭 
+	I_AD_CLOSE_RED = RuleImage(roi_front=(994,128,33,36), roi_back=(994,128,33,36), threshold=0.8, method="Template matching", file="./tasks/GameUi/additional/additional_ad_close_red.png")
+
+
 	# Image Rule Assets
 	# Image Rule Assets
 	# description 
 	# description 
 	I_AD_DISAPPEAR = RuleImage(roi_front=(412,405,37,40), roi_back=(412,405,37,40), threshold=0.9, method="Template matching", file="./tasks/GameUi/additional/additional_ad_disappear.png")
 	I_AD_DISAPPEAR = RuleImage(roi_front=(412,405,37,40), roi_back=(412,405,37,40), threshold=0.9, method="Template matching", file="./tasks/GameUi/additional/additional_ad_disappear.png")
@@ -131,7 +136,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_CHECK_DAILY = RuleImage(roi_front=(28,510,69,87), roi_back=(28,510,69,87), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_daily.png")
 	I_CHECK_DAILY = RuleImage(roi_front=(28,510,69,87), roi_back=(28,510,69,87), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_daily.png")
 	# description 
 	# description 
-	I_CHECK_MALL = RuleImage(roi_front=(7,503,100,100), roi_back=(7,503,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
+	I_CHECK_MALL = RuleImage(roi_front=(239,502,100,100), roi_back=(239,502,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
 	# 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 
@@ -159,6 +164,10 @@ class GameUiAssets:
 	I_CHECK_SUMMON = RuleImage(roi_front=(581,594,68,66), roi_back=(316,528,594,174), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_summon.png")
 	I_CHECK_SUMMON = RuleImage(roi_front=(581,594,68,66), roi_back=(316,528,594,174), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_summon.png")
 	# 就是一个红叉 
 	# 就是一个红叉 
 	I_REALM_RAID_GOTO_EXPLORATION = RuleImage(roi_front=(1192,107,36,43), roi_back=(1192,107,36,43), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_realm_raid_goto_exploration.png")
 	I_REALM_RAID_GOTO_EXPLORATION = RuleImage(roi_front=(1192,107,36,43), roi_back=(1192,107,36,43), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_realm_raid_goto_exploration.png")
+	# description 
+	I_MAIN_GOTO_TRAVEL = RuleImage(roi_front=(202,619,64,61), roi_back=(202,619,64,61), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_travel.png")
+	# 珍旅居 
+	I_CHECK_TRAVEL = RuleImage(roi_front=(1134,583,78,77), roi_back=(1134,583,78,77), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_travel.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 2 - 2
tasks/GameUi/game_ui.py

@@ -26,8 +26,8 @@ class GameUi(BaseTask, GameUiAssets):
                 # 庭院里面的
                 # 庭院里面的
                 page_shikigami_records, page_onmyodo, page_friends, page_daily, page_mall, page_guild, page_team, page_collection
                 page_shikigami_records, page_onmyodo, page_friends, page_daily, page_mall, page_guild, page_team, page_collection
                 ]
                 ]
-    ui_close = [GameUiAssets.I_BACK_BLUE, GameUiAssets.I_BACK_YOLLOW, GameUiAssets.I_BACK_Y, GameUiAssets.I_BACK_MALL,
-                GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY, GameUiAssets.I_BACK_BL,
+    ui_close = [GameUiAssets.I_BACK_BLUE, GameUiAssets.I_BACK_Y, GameUiAssets.I_BACK_MALL,
+                GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY,
                 GameUiAssets.I_BONDLING_GOTO_EXPLORATION, GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION, GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, GameUiAssets.I_SUMMON_GOTO_MAIN
                 GameUiAssets.I_BONDLING_GOTO_EXPLORATION, GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION, GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, GameUiAssets.I_SUMMON_GOTO_MAIN
                 ]
                 ]
     def home_explore(self) -> bool:
     def home_explore(self) -> bool:

+ 5 - 1
tasks/GameUi/page.py

@@ -137,6 +137,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.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
@@ -151,7 +152,10 @@ page_main.link(button=G.I_MAIN_GOTO_TEAM, destination=page_team)
 page_collection = Page(G.I_CHECK_COLLECTION)
 page_collection = Page(G.I_CHECK_COLLECTION)
 page_collection.link(button=G.I_BACK_Y, destination=page_main)
 page_collection.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_COLLECTION, destination=page_collection)
 page_main.link(button=G.I_MAIN_GOTO_COLLECTION, destination=page_collection)
-
+# 珍旅居
+page_travel = Page(G.I_CHECK_TRAVEL)
+page_travel.link(button=G.I_BACK_Y, destination=page_main)
+page_main.link(button=G.I_MAIN_GOTO_TRAVEL, destination=page_travel)
 
 
 
 
 
 

BIN
tasks/GameUi/page/page_check_mall.png


BIN
tasks/GameUi/page/page_check_travel.png


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

@@ -110,8 +110,8 @@
   {
   {
     "itemName": "check_mall",
     "itemName": "check_mall",
     "imageName": "page_check_mall.png",
     "imageName": "page_check_mall.png",
-    "roiFront": "7,503,100,100",
-    "roiBack": "7,503,100,100",
+    "roiFront": "239,502,100,100",
+    "roiBack": "239,502,100,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 18 - 0
tasks/GameUi/page/page_img_supplement.json

@@ -34,5 +34,23 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "就是一个红叉"
     "description": "就是一个红叉"
+  },
+  {
+    "itemName": "main_goto_travel",
+    "imageName": "page_main_goto_travel.png",
+    "roiFront": "202,619,64,61",
+    "roiBack": "202,619,64,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "check_travel",
+    "imageName": "page_check_travel.png",
+    "roiFront": "1134,583,78,77",
+    "roiBack": "1134,583,78,77",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "珍旅居"
   }
   }
 ]
 ]

BIN
tasks/GameUi/page/page_main_goto_travel.png


+ 1 - 1
tasks/GlobalGame/config_emergency.py

@@ -23,7 +23,7 @@ class WhenNetworkError(str, Enum):
 # 也可以是左边的邀请什么的
 # 也可以是左边的邀请什么的
 class Emergency(BaseModel):
 class Emergency(BaseModel):
     friend_invitation: FriendInvitation = Field(default=FriendInvitation.ACCEPT,description='friend_invitation_help')
     friend_invitation: FriendInvitation = Field(default=FriendInvitation.ACCEPT,description='friend_invitation_help')
-    invitation_detect_interval: int = Field(default=10, description='invitation_detect_interval_help')
+    invitation_detect_interval: int = Field(default=5, description='invitation_detect_interval_help')
     when_network_abnormal: WhenNetworkAbnormal = Field(default=WhenNetworkAbnormal.WAIT_10S, description='when_network_abnormal_help')
     when_network_abnormal: WhenNetworkAbnormal = Field(default=WhenNetworkAbnormal.WAIT_10S, description='when_network_abnormal_help')
     when_network_error: WhenNetworkError = Field(default=WhenNetworkError.RESTART, description='when_network_error_help')
     when_network_error: WhenNetworkError = Field(default=WhenNetworkError.RESTART, description='when_network_error_help')
     home_client_clear: bool = Field(default=True, description='home_client_clear_help')
     home_client_clear: bool = Field(default=True, description='home_client_clear_help')

+ 0 - 1
tasks/Orochi/script_task.py

@@ -4,7 +4,6 @@
 from time import sleep
 from time import sleep
 from datetime import time, datetime, timedelta
 from datetime import time, datetime, timedelta
 
 
-from tasks.base_task import BaseTask
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff

+ 2 - 0
tasks/Restart/assets.py

@@ -52,6 +52,8 @@ class RestartAssets:
 	I_WATCH_VIDEO_CANCEL = RuleImage(roi_front=(466,396,130,61), roi_back=(466,396,130,61), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_watch_video_cancel.png")
 	I_WATCH_VIDEO_CANCEL = RuleImage(roi_front=(466,396,130,61), roi_back=(466,396,130,61), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_watch_video_cancel.png")
 	# 指定角色进入游戏,默认第一个 
 	# 指定角色进入游戏,默认第一个 
 	I_LOGIN_SPECIFIC_SERVE = RuleImage(roi_front=(24,33,52,47), roi_back=(24,33,52,47), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_specific_serve.png")
 	I_LOGIN_SPECIFIC_SERVE = RuleImage(roi_front=(24,33,52,47), roi_back=(24,33,52,47), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_specific_serve.png")
+	# 下载插画 
+	I_LOGIN_LOAD_DOWN = RuleImage(roi_front=(711,450,153,58), roi_back=(711,450,153,58), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_load_down.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

+ 4 - 0
tasks/Restart/login.py

@@ -57,6 +57,10 @@ class LoginHandler(BaseTask, RestartAssets):
             # 跳过观看视频
             # 跳过观看视频
             # if self.ocr_appear_click(self.O_LOGIN_SKIP_1, interval=1):
             # if self.ocr_appear_click(self.O_LOGIN_SKIP_1, interval=1):
             #     continue
             #     continue
+            # 下载插画
+            if self.appear_then_click(self.I_LOGIN_LOAD_DOWN, interval=1):
+                logger.info('Download inbetweening')
+                continue
             # 不观看视频
             # 不观看视频
             if self.appear_then_click(self.I_WATCH_VIDEO_CANCEL, interval=0.6):
             if self.appear_then_click(self.I_WATCH_VIDEO_CANCEL, interval=0.6):
                 logger.info('Close video')
                 logger.info('Close video')

+ 9 - 0
tasks/Restart/login/image.json

@@ -61,5 +61,14 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "指定角色进入游戏,默认第一个"
     "description": "指定角色进入游戏,默认第一个"
+  },
+  {
+    "itemName": "login_load_down",
+    "imageName": "login_login_load_down.png",
+    "roiFront": "711,450,153,58",
+    "roiBack": "711,450,153,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "下载插画"
   }
   }
 ]
 ]

BIN
tasks/Restart/login/login_login_load_down.png


+ 199 - 0
tasks/RichMan/assets.py

@@ -0,0 +1,199 @@
+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 ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class RichManAssets: 
+
+
+	# Image Rule Assets
+	# 神社 
+	I_GUILD_SHRINE = RuleImage(roi_front=(869,623,64,62), roi_back=(869,623,64,62), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_shrine.png")
+	# 功勋商店 
+	I_GUILD_STORE = RuleImage(roi_front=(651,420,212,161), roi_back=(651,420,212,161), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_store.png")
+	# description 
+	I_GUILD_CLOSE_RED = RuleImage(roi_front=(1029,120,53,57), roi_back=(1029,120,53,57), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_close_red.png")
+	# 蓝票 
+	I_GUILD_BLUE = RuleImage(roi_front=(793,179,74,80), roi_back=(793,179,74,80), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_blue.png")
+	# 黑蛋碎片 
+	I_GUILD_SCRAP = RuleImage(roi_front=(570,442,71,68), roi_back=(570,442,71,68), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_scrap.png")
+	# 皮肤券 
+	I_GUILD_SKIN = RuleImage(roi_front=(795,436,71,74), roi_back=(795,436,71,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_skin.png")
+	# 购买检查 
+	I_GUILD_CHECK_SCRAP = RuleImage(roi_front=(454,240,90,88), roi_back=(454,240,90,88), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_check_scrap.png")
+
+
+	# Ocr Rule Assets
+	# 总的功勋 
+	O_GUILD_TOTAL = RuleOcr(roi=(1151,6,100,42), area=(1151,6,100,42), mode="Digit", method="Default", keyword="", name="guild_total")
+	# Ocr-description 
+	O_GUILD_NUMBER_BLUE = RuleOcr(roi=(888,269,25,33), area=(888,269,25,33), mode="Digit", method="Default", keyword="", name="guild_number_blue")
+	# Ocr-description 
+	O_GUILD_NUMBER_BLACK = RuleOcr(roi=(663,520,22,31), area=(663,520,22,31), mode="Digit", method="Default", keyword="", name="guild_number_black")
+	# Ocr-description 
+	O_GUILD_NUMBER_SKIN = RuleOcr(roi=(889,519,21,35), area=(889,519,21,35), mode="Digit", method="Default", keyword="", name="guild_number_skin")
+
+
+	# Swipe Rule Assets
+	# description 
+	S_GUILD_STORE = RuleSwipe(roi_front=(807,460,46,35), roi_back=(720,214,90,34), mode="default", name="guild_store")
+
+
+	# Image Rule Assets
+	# 进入寄售屋 
+	I_CON_ENTER_CHECK = RuleImage(roi_front=(660,485,393,100), roi_back=(660,485,393,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/consignment/consignment_con_enter_check.png")
+	# 兑换 
+	I_CON_ENTER = RuleImage(roi_front=(1176,304,68,74), roi_back=(1176,304,68,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/consignment/consignment_con_enter.png")
+	# 寄售券 
+	I_CON_TICKET = RuleImage(roi_front=(700,194,100,100), roi_back=(700,194,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/consignment/consignment_con_ticket.png")
+
+
+	# Ocr Rule Assets
+	# 寄售券可以购买的数量 
+	O_CON_NUMBER = RuleOcr(roi=(813,140,34,38), area=(813,140,34,38), mode="Digit", method="Default", keyword="", name="con_number")
+
+
+	# Image Rule Assets
+	# 寄售屋 
+	I_MALL_CONSIGNMENT = RuleImage(roi_front=(192,629,63,72), roi_back=(192,629,63,72), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_consignment.png")
+	# 寄售屋 
+	I_MALL_CONSIGNMENT_CHECK = RuleImage(roi_front=(171,83,100,49), roi_back=(171,83,100,49), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_consignment_check.png")
+	# 密卷屋 
+	I_MALL_SCCALES = RuleImage(roi_front=(433,635,100,64), roi_back=(433,635,100,64), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales.png")
+	# 密卷屋 
+	I_MALL_SCCALES_CHECK = RuleImage(roi_front=(409,253,100,100), roi_back=(409,253,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales_check.png")
+	# description 
+	I_MALL_SCALES_SURE = RuleImage(roi_front=(1195,100,62,85), roi_back=(1195,100,62,85), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_scales_sure.png")
+	# 契灵商店 
+	I_MALL_BONDLINGS_SURE = RuleImage(roi_front=(1194,421,69,74), roi_back=(1194,421,69,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_bondlings_sure.png")
+	# 契灵商店 
+	I_MALL_BONDLINGS_CHECK = RuleImage(roi_front=(646,421,191,37), roi_back=(646,421,191,37), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_bondlings_check.png")
+	# 杂货铺 
+	I_MALL_SUNDRY = RuleImage(roi_front=(854,623,74,61), roi_back=(854,623,74,61), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sundry.png")
+	# 杂货铺 
+	I_MALL_SUNDRY_CHECK = RuleImage(roi_front=(1169,95,72,440), roi_back=(1169,95,72,440), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sundry_check.png")
+
+
+	# Image Rule Assets
+	# 特殊 
+	I_SIDE_SURE_SPECIAL = RuleImage(roi_front=(1172,91,70,74), roi_back=(1172,91,70,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_special.png")
+	# 特殊 
+	I_SIDE_CHECK_SPECIAL = RuleImage(roi_front=(102,7,42,42), roi_back=(102,7,42,42), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_special.png")
+	# 荣誉 
+	I_SIDE_SUER_HONOR = RuleImage(roi_front=(1171,185,72,74), roi_back=(1171,185,72,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_suer_honor.png")
+	# 荣誉 
+	I_SIDE_CHECK_HONOR = RuleImage(roi_front=(694,12,41,42), roi_back=(694,12,41,42), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_honor.png")
+	# 友情点 
+	I_SIDE_SURE_FRIENDS = RuleImage(roi_front=(1174,279,68,70), roi_back=(1174,279,68,70), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_friends.png")
+	# 友情点 
+	I_SIDE_CHECK_FRIENDS = RuleImage(roi_front=(890,8,39,43), roi_back=(890,8,39,43), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_friends.png")
+	# 勋章 
+	I_SIDE_SURE_MEDAL = RuleImage(roi_front=(1175,370,72,73), roi_back=(1175,370,72,73), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_medal.png")
+	# 勋章 
+	I_SIDE_CHECK_MEDAL = RuleImage(roi_front=(889,11,40,44), roi_back=(889,11,40,44), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_medal.png")
+	# 魅力值 
+	I_SIDE_SURE_CHARISMA = RuleImage(roi_front=(1175,464,72,74), roi_back=(1175,464,72,74), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_charisma.png")
+	# 魅力值 
+	I_SIDE_CHECK_CHARISMA = RuleImage(roi_front=(886,4,48,46), roi_back=(886,4,48,46), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_charisma.png")
+
+
+	# Ocr Rule Assets
+	# 左数第一个 
+	O_MALL_RESOURCE_1 = RuleOcr(roi=(144,7,100,43), area=(144,7,100,43), mode="Digit", method="Default", keyword="", name="mall_resource_1")
+	# 左数第二个 
+	O_MALL_RESOURCE_2 = RuleOcr(roi=(326,8,124,39), area=(326,8,124,39), mode="Digit", method="Default", keyword="", name="mall_resource_2")
+	# 左数第二个 
+	O_MALL_RESOURCE_3 = RuleOcr(roi=(533,9,107,38), area=(533,9,107,38), mode="Digit", method="Default", keyword="", name="mall_resource_3")
+	# 左数第二个 
+	O_MALL_RESOURCE_4 = RuleOcr(roi=(739,8,100,39), area=(739,8,100,39), mode="Digit", method="Default", keyword="", name="mall_resource_4")
+	# 左数第二个 
+	O_MALL_RESOURCE_5 = RuleOcr(roi=(935,11,100,37), area=(935,11,100,37), mode="Digit", method="Default", keyword="", name="mall_resource_5")
+	# 左数第二个 
+	O_MALL_RESOURCE_6 = RuleOcr(roi=(1129,6,100,41), area=(1129,6,100,41), mode="Digit", method="Default", keyword="", name="mall_resource_6")
+
+
+	# Click Rule Assets
+	# description 
+	C_C_SHRINE = RuleClick(roi_front=(1098,261,56,100), roi_back=(1098,261,56,100), name="c_shrine")
+
+
+	# Image Rule Assets
+	# 下期预览 
+	I_S_NEXT_PERIOD = RuleImage(roi_front=(1083,574,90,86), roi_back=(1083,574,90,86), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_next_period.png")
+	# description 
+	I_S_WHITE_FIVE = RuleImage(roi_front=(769,143,77,85), roi_back=(769,143,77,85), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_white_five.png")
+	# description 
+	I_S_WHITE_FOUR = RuleImage(roi_front=(951,144,73,82), roi_back=(951,144,73,82), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_white_four.png")
+	# 黑蛋 
+	I_S_BLACK = RuleImage(roi_front=(588,143,78,83), roi_back=(588,143,78,83), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_black.png")
+	# description 
+	I_S_BUY_BLACK = RuleImage(roi_front=(777,508,173,60), roi_back=(777,508,173,60), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_buy_black.png")
+	# description 
+	I_S_BUY_WHITE_FIVE = RuleImage(roi_front=(778,512,177,56), roi_back=(778,512,177,56), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_buy_white_five.png")
+	# description 
+	I_S_BUY_WHITE_FOUR = RuleImage(roi_front=(779,507,173,64), roi_back=(779,507,173,64), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_buy_white_four.png")
+	# description 
+	I_S_CONFIRM_WHITE_FIVE = RuleImage(roi_front=(554,438,174,61), roi_back=(554,438,174,61), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_confirm_white_five.png")
+	# description 
+	I_S_CONFIRM_WHITE_FOUR = RuleImage(roi_front=(552,509,176,62), roi_back=(552,509,176,62), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_confirm_white_four.png")
+	# description 
+	I_S_CONFIRM_BLACK = RuleImage(roi_front=(552,439,180,62), roi_back=(552,439,180,62), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_confirm_black.png")
+	# description 
+	I_S_BUY_UP = RuleImage(roi_front=(762,412,56,54), roi_back=(762,412,56,54), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_buy_up.png")
+	# description 
+	I_S_CHECK_BLACK = RuleImage(roi_front=(811,225,108,178), roi_back=(811,225,108,178), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_black.png")
+	# description 
+	I_S_CHECK_WHITE_FIVE = RuleImage(roi_front=(810,222,109,182), roi_back=(810,222,109,182), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_five.png")
+	# description 
+	I_S_CHECK_WHITE_FOUR = RuleImage(roi_front=(808,222,113,181), roi_back=(808,222,113,181), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_four.png")
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_S_TOTAL = RuleOcr(roi=(1134,11,112,36), area=(1134,11,112,36), mode="Digit", method="Default", keyword="", name="s_total")
+	# 已兑换 
+	O_S_BLACK = RuleOcr(roi=(582,179,84,48), area=(582,179,84,48), mode="Single", method="Default", keyword="", name="s_black")
+	# Ocr-description 
+	O_S_WHITE_FIVE = RuleOcr(roi=(774,174,69,44), area=(774,174,69,44), mode="Single", method="Default", keyword="", name="s_white_five")
+	# Ocr-description 
+	O_S_WHITE_FOUR = RuleOcr(roi=(952,168,74,60), area=(952,168,74,60), mode="Single", method="Default", keyword="", name="s_white_four")
+	# 买两个四星蛋 
+	O_S_FOUR_NUMBER = RuleOcr(roi=(581,414,46,45), area=(581,414,46,45), mode="Digit", method="Default", keyword="2", name="s_four_number")
+
+
+	# Image Rule Assets
+	# 千物宝库 
+	I_TT_ENTER = RuleImage(roi_front=(1140,585,73,76), roi_back=(1140,585,73,76), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_enter.png")
+	# 确认进入 
+	I_TT_CHECK = RuleImage(roi_front=(141,61,228,67), roi_back=(141,61,228,67), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_check.png")
+	# description 
+	I_TT_BLACK = RuleImage(roi_front=(710,176,91,90), roi_back=(453,171,589,109), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_black.png")
+	# description 
+	I_TT_TICKET_BULE = RuleImage(roi_front=(484,176,85,91), roi_back=(475,170,562,110), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_ticket_bule.png")
+	# description 
+	I_TT_AP = RuleImage(roi_front=(938,177,88,87), roi_back=(467,167,581,123), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_ap.png")
+	# 提高 
+	I_TT_BUY_UP = RuleImage(roi_front=(761,411,59,57), roi_back=(761,411,59,57), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_buy_up.png")
+	# description 
+	I_TT_BUY_CONFIRM = RuleImage(roi_front=(584,512,53,53), roi_back=(553,508,169,60), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_buy_confirm.png")
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_TT_TOTOL = RuleOcr(roi=(1121,10,116,35), area=(1121,10,116,35), mode="Digit", method="Default", keyword="", name="tt_totol")
+	# Ocr-description 
+	O_TT_BLUE_TICKET = RuleOcr(roi=(509,307,531,92), area=(509,307,531,92), mode="Full", method="Default", keyword="2000", name="tt_blue_ticket")
+	# Ocr-description 
+	O_TT_BLACK = RuleOcr(roi=(498,313,528,89), area=(498,313,528,89), mode="Full", method="Default", keyword="350", name="tt_black")
+	# Ocr-description 
+	O_TT_AP = RuleOcr(roi=(502,311,535,91), area=(502,311,535,91), mode="Full", method="Default", keyword="300", name="tt_ap")
+	# Ocr-description 
+	O_TT_BUY = RuleOcr(roi=(602,509,104,61), area=(602,509,104,61), mode="Full", method="Default", keyword="", name="tt_buy")
+	# Ocr-description 
+	O_TT_NUMBER = RuleOcr(roi=(576,415,58,49), area=(576,415,58,49), mode="Digit", method="Default", keyword="", name="tt_number")
+
+

+ 111 - 0
tasks/RichMan/config.py

@@ -0,0 +1,111 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from datetime import timedelta
+from pydantic import BaseModel, Field
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase
+from tasks.Utils.config_enum import DemonClass
+
+
+class ThousandThings(BaseModel):
+    # 千物宝箱
+    enable: bool = Field(title='Enable', default=False)
+    mystery_amulet: bool = Field(title='Mystery Amulet', default=False)
+    black_daruma_fragment: bool = Field(title='Black Daruma Fragment', default=False)
+    ap: bool = Field(title='AP', default=False, description='ap_help')
+
+class Consignment(BaseModel):
+    # 寄售屋
+    enable: bool = Field(title='Enable', default=False)
+    buy_sale_ticket: bool = Field(title='Buy Sale Ticket', default=False, description='buy_sale_ticket_help')
+
+class Scales(BaseModel):
+    # 密卷屋 蛇皮
+    enable: bool = Field(title='Enable', default=False)
+    orochi_scales: int = Field(title='Orochi Scales', default=40, description='orochi_scales_help')
+    demon_souls: int = Field(title='Demon Souls', default=50, description='demon_souls_help')
+    demon_class: DemonClass = Field(title='DemonClass', default=DemonClass.TSUCHIGUMO, description='demon_class_help')
+    demon_position: int = Field(title='Demon Position', default=1, description='demon_position_help')
+    picture_book_scrap: int = Field(title='Picture Book Scrap', default=30, description='picture_book_scrap_help')
+    picture_book_rule: str = Field(title='Picture Book Rule', default='auto', description='picture_book_rule_help')
+
+
+class SpecialRoom(BaseModel):
+    # 杂货铺 特殊购买
+    enable: bool = Field(title='Enable', default=False)
+    totem_pass: bool = Field(title='Totem Pass', default=False)
+    medium_bondling_discs: int = Field(title='Medium Bondling Discs', default=0, description='medium_bondling_discs_special')
+    low_bondling_discs: int = Field(title='Low Bondling Discs', default=0, description='low_bondling_discs_special')
+
+class HonorRoom(BaseModel):
+    # 杂货铺 荣誉购买
+    enable: bool = Field(title='Enable', default=False)
+    mystery_amulet: bool = Field(title='Mystery Amulet', default=False, description='mystery_amulet_help_honor')
+    black_daruma_scrap: bool = Field(title='Black Daruma Scrap', default=False, description='black_daruma_scrap_help_honor')
+
+class FriendshipPoints(BaseModel):
+    # 杂货铺 友情点
+    enable: bool = Field(title='Enable', default=False)
+    white_daruma: bool = Field(title='White Daruma', default=False)
+    red_daruma: int = Field(title='Red Daruma', default=0)
+    broken_amulet: int = Field(title='Broken Amulet', default=0)
+
+class MedalRoom(BaseModel):
+    # 杂货铺 勋章购买
+    enable: bool = Field(title='Enable', default=False)
+    black_daruma: bool = Field(title='Black Daruma', default=False)
+    mystery_amulet: bool = Field(title='Mystery Amulet', default=False)
+    ap_100: bool = Field(title='AP 100', default=False)
+    random_soul: bool = Field(title='Random Soul', default=False)
+    white_daruma: bool = Field(title='White Daruma', default=False)
+    challenge_pass: int = Field(title='Challenge Pass', default=0, description='challenge_pass_help')
+    red_daruma: int = Field(title='Red Daruma', default=0)
+    broken_amulet: int = Field(title='Broken Amulet', default=0)
+
+class Charisma(BaseModel):
+    # 杂货铺 魅力购买
+    enable: bool = Field(title='Enable', default=False)
+    black_daruma_scrap: bool = Field(title='Black Daruma Scrap', default=False)
+    mystery_amulet: bool = Field(title='Mystery Amulet', default=False)
+
+class Shrine(BaseModel):
+    # 神社 神龛
+    enable: bool = Field(title='Enable', default=False)
+    black_daruma: bool = Field(title='Black Daruma', default=False)
+    white_daruma_five: bool = Field(title='White Daruma Five', default=False)
+    white_daruma_four: bool = Field(title='White Daruma Four', default=False)
+
+class Bondlings(BaseModel):
+    # 契灵商店 契忆
+    enable: bool = Field(title='Enable', default=False)
+    random_soul: int = Field(title='Random Soul', default=0, description='random_soul_help')
+    bondling_stone: int = Field(title='Bondling Stone', default=0, description='bondling_stone_help')
+    high_bondling_discs: int = Field(title='High Bondling Discs', default=0, description='high_bondling_discs_help')
+    medium_bondling_discs: int = Field(title='Medium Bondling Discs', default=0, description='medium_bondling_discs_help')
+
+class GuildStore(BaseModel):
+    # 寮商店
+    enable: bool = Field(title='Enable', default=False)
+    mystery_amulet: bool = Field(title='Mystery Amulet', default=False)
+    black_daruma_scrap: bool = Field(title='Black Daruma Scrap', default=False)
+    skin_ticket: int = Field(title='Skin Ticket', default=0, description='skin_ticket_help')
+
+
+
+
+class RichMan(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    special_room: SpecialRoom = Field(default_factory=SpecialRoom)
+    honor_room: HonorRoom = Field(default_factory=HonorRoom)
+    friendship_points: FriendshipPoints = Field(default_factory=FriendshipPoints)
+    medal_room: MedalRoom = Field(default_factory=MedalRoom)
+    charisma: Charisma = Field(default_factory=Charisma)
+
+    thousand_things: ThousandThings = Field(default_factory=ThousandThings)
+    consignment: Consignment = Field(default_factory=Consignment)
+    scales: Scales = Field(default_factory=Scales)
+    bondlings: Bondlings = Field(default_factory=Bondlings)
+    shrine: Shrine = Field(default_factory=Shrine)
+    guild_store: GuildStore = Field(default_factory=GuildStore)

+ 120 - 0
tasks/RichMan/guild.py

@@ -0,0 +1,120 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import GuildStore
+
+class Guild(GameUi, Buy, RichManAssets):
+
+    def execute_guild(self, con: GuildStore=None):
+        logger.hr('Start guild', 1)
+        self.ui_get_current_page()
+        self.ui_goto(page_guild)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GUILD_CLOSE_RED):
+                break
+            if self.appear_then_click(self.I_GUILD_SHRINE, interval=0.8):
+                continue
+            if self.appear_then_click(self.I_GUILD_STORE, interval=1.1):
+                continue
+        logger.info('Enter guild store success')
+        time.sleep(0.5)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GUILD_SCRAP):
+                break
+            if self.swipe(self.S_GUILD_STORE, interval=1.5):
+                time.sleep(2)
+                continue
+
+        # 开始购买
+        if con.mystery_amulet:
+            self._guild_mystery_amulet()
+        if con.black_daruma_scrap:
+            self._guild_black_daruma_scrap()
+        if con.skin_ticket:
+            self._guild_skin_ticket(con.skin_ticket)
+
+        # 回去
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GUILD_SHRINE):
+                break
+            if self.appear_then_click(self.I_GUILD_CLOSE_RED, interval=1):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
+                continue
+
+    def _guild_mystery_amulet(self):
+        logger.hr('Guild mystery amulet', 2)
+        self.screenshot()
+        if not self.buy_check_money(self.O_GUILD_TOTAL, 240):
+            return False
+        number = self.O_GUILD_NUMBER_BLUE.ocr(self.device.image)
+        if not isinstance(number, int):
+            logger.warning('OCR number failed')
+            return False
+        if number == 0:
+            logger.warning('No mystery amulet can buy')
+            return False
+        self.buy_more(self.I_GUILD_BLUE, number)
+        time.sleep(0.5)
+        return True
+
+    def _guild_black_daruma_scrap(self):
+        logger.hr('Guild black daruma scrap', 2)
+        self.screenshot()
+        if not self.buy_check_money(self.O_GUILD_TOTAL, 200):
+            return False
+        number = self.O_GUILD_NUMBER_BLACK.ocr(self.device.image)
+        if not isinstance(number, int):
+            logger.warning('OCR number failed')
+            return False
+        if number == 0:
+            logger.warning('No black daruma can buy')
+            return False
+        self.buy_one(self.I_GUILD_SCRAP, self.I_GUILD_CHECK_SCRAP)
+        time.sleep(0.5)
+        return True
+
+    def _guild_skin_ticket(self, num: int=0):
+        logger.hr('Guild skin ticket', 2)
+        if num == 0:
+            logger.warning('No buy skin ticket')
+            return False
+        self.screenshot()
+        if not self.buy_check_money(self.O_GUILD_TOTAL, 50):
+            return False
+        number = self.O_GUILD_NUMBER_SKIN.ocr(self.device.image)
+        if not isinstance(number, int):
+            logger.warning('OCR number failed')
+            return False
+        if number == 0:
+            logger.warning('No skin ticket can buy')
+            return False
+        self.buy_more(self.I_GUILD_SKIN, number)
+        time.sleep(0.5)
+        return True
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Guild(c, d)
+
+    t._guild_skin_ticket(5)
+
+
+

BIN
tasks/RichMan/guild/guild_guild_blue.png


BIN
tasks/RichMan/guild/guild_guild_check_scrap.png


BIN
tasks/RichMan/guild/guild_guild_close_red.png


BIN
tasks/RichMan/guild/guild_guild_scrap.png


BIN
tasks/RichMan/guild/guild_guild_shrine.png


BIN
tasks/RichMan/guild/guild_guild_skin.png


BIN
tasks/RichMan/guild/guild_guild_store.png


+ 65 - 0
tasks/RichMan/guild/image.json

@@ -0,0 +1,65 @@
+[
+  {
+    "itemName": "guild_shrine",
+    "imageName": "guild_guild_shrine.png",
+    "roiFront": "869,623,64,62",
+    "roiBack": "869,623,64,62",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "神社"
+  },
+  {
+    "itemName": "guild_store",
+    "imageName": "guild_guild_store.png",
+    "roiFront": "651,420,212,161",
+    "roiBack": "651,420,212,161",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "功勋商店"
+  },
+  {
+    "itemName": "guild_close_red",
+    "imageName": "guild_guild_close_red.png",
+    "roiFront": "1029,120,53,57",
+    "roiBack": "1029,120,53,57",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "guild_blue",
+    "imageName": "guild_guild_blue.png",
+    "roiFront": "793,179,74,80",
+    "roiBack": "793,179,74,80",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "蓝票"
+  },
+  {
+    "itemName": "guild_scrap",
+    "imageName": "guild_guild_scrap.png",
+    "roiFront": "570,442,71,68",
+    "roiBack": "570,442,71,68",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "黑蛋碎片"
+  },
+  {
+    "itemName": "guild_skin",
+    "imageName": "guild_guild_skin.png",
+    "roiFront": "795,436,71,74",
+    "roiBack": "795,436,71,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "皮肤券"
+  },
+  {
+    "itemName": "guild_check_scrap",
+    "imageName": "guild_guild_check_scrap.png",
+    "roiFront": "454,240,90,88",
+    "roiBack": "454,240,90,88",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "购买检查"
+  }
+]

+ 38 - 0
tasks/RichMan/guild/ocr.json

@@ -0,0 +1,38 @@
+[
+  {
+    "itemName": "guild_total",
+    "roiFront": "1151,6,100,42",
+    "roiBack": "1151,6,100,42",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "总的功勋"
+  },
+  {
+    "itemName": "guild_number_blue",
+    "roiFront": "888,269,25,33",
+    "roiBack": "888,269,25,33",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  },
+  {
+    "itemName": "guild_number_black",
+    "roiFront": "663,520,22,31",
+    "roiBack": "663,520,22,31",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  },
+  {
+    "itemName": "guild_number_skin",
+    "roiFront": "889,519,21,35",
+    "roiBack": "889,519,21,35",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  }
+]

+ 9 - 0
tasks/RichMan/guild/swipe.json

@@ -0,0 +1,9 @@
+[
+  {
+    "itemName": "guild_store",
+    "roiFront": "807,460,46,35",
+    "roiBack": "720,214,90,34",
+    "mode": "default",
+    "description": "description"
+  }
+]

+ 29 - 0
tasks/RichMan/mall/bondlings.py

@@ -0,0 +1,29 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import Bondlings as BondlingsConfig
+
+
+class Bondlings(GameUi, Buy, RichManAssets):
+
+    def execute_bondlings(self, con: BondlingsConfig = None):
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Bondlings(c, d)
+
+

+ 28 - 0
tasks/RichMan/mall/charisma.py

@@ -0,0 +1,28 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import Charisma as CharismaConfig
+
+
+class Charisma(GameUi, Buy, RichManAssets):
+
+    def execute_charisma(self, con: CharismaConfig = None):
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Charisma(c, d)
+

+ 62 - 0
tasks/RichMan/mall/consignment.py

@@ -0,0 +1,62 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.Component.Buy.buy import Buy
+# from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.mall.navbar import MallNavbar
+from tasks.RichMan.config import Consignment as ConsignmentStore
+
+
+class Consignment(MallNavbar, Buy):
+
+    def execute_consignment(self, con: ConsignmentStore=None):
+        """
+        必须要求这个是第一个执行的对于 商店来说
+        :param con:
+        :return:
+        """
+        if not con:
+            con = self.config.rich_man.consignment
+        if not con.enable:
+            logger.info('Consignment is not enable')
+            return
+        if not con.buy_sale_ticket:
+            logger.info('Consignment buy_sale_ticket is not enable')
+            return
+        self._enter_consignment()
+        self.ui_click(self.I_CON_ENTER, self.I_CON_ENTER_CHECK)
+        time.sleep(0.5)
+        self.screenshot()
+        if not self.mall_check_money(3, 100):
+            logger.warning('Consignment money is not enough')
+            return
+        remain_number = self.O_CON_NUMBER.ocr(self.device.image)
+        if remain_number == 0:
+            logger.warning('Consignment number is 0')
+            return
+        if remain_number == 10:
+            self.buy_more(self.I_CON_TICKET)
+        else:
+            self.buy_one(self.I_CON_TICKET, remain_number)
+        logger.info('Consignment buy_sale_ticket is success')
+
+
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Consignment(c, d)
+
+    t.execute_consignment()
+
+

BIN
tasks/RichMan/mall/consignment/consignment_con_enter.png


BIN
tasks/RichMan/mall/consignment/consignment_con_enter_check.png


BIN
tasks/RichMan/mall/consignment/consignment_con_ticket.png


+ 29 - 0
tasks/RichMan/mall/consignment/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "con_enter_check",
+    "imageName": "consignment_con_enter_check.png",
+    "roiFront": "660,485,393,100",
+    "roiBack": "660,485,393,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入寄售屋"
+  },
+  {
+    "itemName": "con_enter",
+    "imageName": "consignment_con_enter.png",
+    "roiFront": "1176,304,68,74",
+    "roiBack": "1176,304,68,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "兑换"
+  },
+  {
+    "itemName": "con_ticket",
+    "imageName": "consignment_con_ticket.png",
+    "roiFront": "700,194,100,100",
+    "roiBack": "700,194,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寄售券"
+  }
+]

+ 11 - 0
tasks/RichMan/mall/consignment/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "con_number",
+    "roiFront": "813,140,34,38",
+    "roiBack": "813,140,34,38",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "寄售券可以购买的数量"
+  }
+]

+ 28 - 0
tasks/RichMan/mall/friendship_points.py

@@ -0,0 +1,28 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import FriendshipPoints as FriendshipPointsConfig
+
+
+class FriendshipPoints(GameUi, Buy, RichManAssets):
+
+    def execute_friendship(self, con: FriendshipPointsConfig = None):
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = FriendshipPoints(c, d)
+

+ 31 - 0
tasks/RichMan/mall/honor.py

@@ -0,0 +1,31 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import HonorRoom
+
+
+class Honor(GameUi, Buy, RichManAssets):
+
+    def execute_honor(self, con: HonorRoom = None):
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Honor(c, d)
+
+
+
+

+ 3 - 0
tasks/RichMan/mall/mall.py

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

+ 28 - 0
tasks/RichMan/mall/medal.py

@@ -0,0 +1,28 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+from tasks.RichMan.config import MedalRoom
+
+
+class Medal(GameUi, Buy, RichManAssets):
+
+    def execute_medal(self, con: MedalRoom = None):
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = Medal(c, d)
+

+ 125 - 0
tasks/RichMan/mall/navbar.py

@@ -0,0 +1,125 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import time
+
+from module.logger import logger
+
+from tasks.GameUi.page import page_main, page_guild
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.Buy.buy import Buy
+from tasks.RichMan.assets import RichManAssets
+
+
+
+class MallNavbar(GameUi, RichManAssets):
+
+    def _enter_consignment(self):
+        """
+        进入寄售屋
+        :return:
+        """
+        self.ui_click(self.I_MALL_CONSIGNMENT, self.I_MALL_CONSIGNMENT_CHECK)
+
+    def _enter_scales(self):
+        """
+        进入密卷屋 蛇皮
+        :return:
+        """
+        self.ui_click(self.I_MALL_SCCALES, self.I_MALL_SCCALES_CHECK)
+
+    def _enter_bondlings(self):
+        """
+        进入契灵
+        :return:
+        """
+        self._enter_scales()
+        self.ui_click(self.I_MALL_BONDLINGS_SURE, self.I_MALL_BONDLINGS_CHECK)
+
+    def _enter_sundry(self):
+        """
+        进入杂货铺
+        :return:
+        """
+        self.ui_click(self.I_MALL_SUNDRY, self.I_MALL_SUNDRY_CHECK)
+
+    def _enter_special(self):
+        """
+        进入特殊
+        :return:
+        """
+        self._enter_sundry()
+        self.ui_click(self.I_SIDE_SURE_SPECIAL, self.I_SIDE_CHECK_SPECIAL)
+
+    def _enter_honor(self):
+        """
+        进入荣誉 屋
+        :return:
+        """
+        self._enter_sundry()
+        self.ui_click(self.I_SIDE_SUER_HONOR, self.I_SIDE_CHECK_HONOR)
+
+    def _enter_friendship(self):
+        """
+        友情点
+        :return:
+        """
+        self._enter_sundry()
+        self.ui_click(self.I_SIDE_SURE_FRIENDS, self.I_SIDE_CHECK_FRIENDS)
+
+    def _enter_medal(self):
+        """
+        勋章
+        :return:
+        """
+        self._enter_sundry()
+        self.ui_click(self.I_SIDE_SURE_MEDAL, self.I_SIDE_CHECK_MEDAL)
+
+    def _enter_charisma(self):
+        """
+        魅力
+        :return:
+        """
+        self._enter_sundry()
+        self.ui_click(self.I_SIDE_SURE_CHARISMA, self.I_SIDE_CHECK_CHARISMA)
+
+    def back_mall(self):
+        """
+        返回商城
+        :return:
+        """
+        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_MALL)
+
+    def mall_resource(self, index: int) -> int:
+        """
+        获取商城资源,
+        :param index: 从左开始数
+        :return:
+        """
+        match = {
+            1: self.O_MALL_RESOURCE_1,
+            2: self.O_MALL_RESOURCE_2,
+            3: self.O_MALL_RESOURCE_3,
+            4: self.O_MALL_RESOURCE_4,
+            5: self.O_MALL_RESOURCE_5,
+            6: self.O_MALL_RESOURCE_6,
+        }
+        self.screenshot()
+        result = match[index].ocr(self.device.image)
+        if not isinstance(result, int):
+            logger.warning(f'Get mall resource {index} error, result: {result}')
+        if result == 0:
+            logger.warning(f'Get mall resource {index} error, result: {result}')
+        return result
+
+    def mall_check_money(self, index: int, least: int) -> bool:
+        return self.mall_resource(index) >= least
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = MallNavbar(c, d)
+

+ 83 - 0
tasks/RichMan/mall/navbar/image_bottom.json

@@ -0,0 +1,83 @@
+[
+  {
+    "itemName": "mall_consignment",
+    "imageName": "navbar_mall_consignment.png",
+    "roiFront": "192,629,63,72",
+    "roiBack": "192,629,63,72",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寄售屋"
+  },
+  {
+    "itemName": "mall_consignment_check",
+    "imageName": "navbar_mall_consignment_check.png",
+    "roiFront": "171,83,100,49",
+    "roiBack": "171,83,100,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寄售屋"
+  },
+  {
+    "itemName": "mall_sccales",
+    "imageName": "navbar_mall_sccales.png",
+    "roiFront": "433,635,100,64",
+    "roiBack": "433,635,100,64",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "密卷屋"
+  },
+  {
+    "itemName": "mall_sccales_check",
+    "imageName": "navbar_mall_sccales_check.png",
+    "roiFront": "409,253,100,100",
+    "roiBack": "409,253,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "密卷屋"
+  },
+  {
+    "itemName": "mall_scales_sure",
+    "imageName": "navbar_mall_scales_sure.png",
+    "roiFront": "1195,100,62,85",
+    "roiBack": "1195,100,62,85",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "mall_bondlings_sure",
+    "imageName": "navbar_mall_bondlings_sure.png",
+    "roiFront": "1194,421,69,74",
+    "roiBack": "1194,421,69,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "契灵商店"
+  },
+  {
+    "itemName": "mall_bondlings_check",
+    "imageName": "navbar_mall_bondlings_check.png",
+    "roiFront": "646,421,191,37",
+    "roiBack": "646,421,191,37",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "契灵商店"
+  },
+  {
+    "itemName": "mall_sundry",
+    "imageName": "navbar_mall_sundry.png",
+    "roiFront": "854,623,74,61",
+    "roiBack": "854,623,74,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "杂货铺"
+  },
+  {
+    "itemName": "mall_sundry_check",
+    "imageName": "navbar_mall_sundry_check.png",
+    "roiFront": "1169,95,72,440",
+    "roiBack": "1169,95,72,440",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "杂货铺"
+  }
+]

+ 92 - 0
tasks/RichMan/mall/navbar/image_side.json

@@ -0,0 +1,92 @@
+[
+  {
+    "itemName": "side_sure_special",
+    "imageName": "navbar_side_sure_special.png",
+    "roiFront": "1172,91,70,74",
+    "roiBack": "1172,91,70,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "特殊"
+  },
+  {
+    "itemName": "side_check_special",
+    "imageName": "navbar_side_check_special.png",
+    "roiFront": "102,7,42,42",
+    "roiBack": "102,7,42,42",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "特殊"
+  },
+  {
+    "itemName": "side_suer_honor",
+    "imageName": "navbar_side_suer_honor.png",
+    "roiFront": "1171,185,72,74",
+    "roiBack": "1171,185,72,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "荣誉"
+  },
+  {
+    "itemName": "side_check_honor",
+    "imageName": "navbar_side_check_honor.png",
+    "roiFront": "694,12,41,42",
+    "roiBack": "694,12,41,42",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "荣誉"
+  },
+  {
+    "itemName": "side_sure_friends",
+    "imageName": "navbar_side_sure_friends.png",
+    "roiFront": "1174,279,68,70",
+    "roiBack": "1174,279,68,70",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "友情点"
+  },
+  {
+    "itemName": "side_check_friends",
+    "imageName": "navbar_side_check_friends.png",
+    "roiFront": "890,8,39,43",
+    "roiBack": "890,8,39,43",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "友情点"
+  },
+  {
+    "itemName": "side_sure_medal",
+    "imageName": "navbar_side_sure_medal.png",
+    "roiFront": "1175,370,72,73",
+    "roiBack": "1175,370,72,73",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "勋章"
+  },
+  {
+    "itemName": "side_check_medal",
+    "imageName": "navbar_side_check_medal.png",
+    "roiFront": "889,11,40,44",
+    "roiBack": "889,11,40,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "勋章"
+  },
+  {
+    "itemName": "side_sure_charisma",
+    "imageName": "navbar_side_sure_charisma.png",
+    "roiFront": "1175,464,72,74",
+    "roiBack": "1175,464,72,74",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "魅力值"
+  },
+  {
+    "itemName": "side_check_charisma",
+    "imageName": "navbar_side_check_charisma.png",
+    "roiFront": "886,4,48,46",
+    "roiBack": "886,4,48,46",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "魅力值"
+  }
+]

BIN
tasks/RichMan/mall/navbar/navbar_mall_bondlings_check.png


BIN
tasks/RichMan/mall/navbar/navbar_mall_bondlings_sure.png


BIN
tasks/RichMan/mall/navbar/navbar_mall_consignment.png


Некоторые файлы не были показаны из-за большого количества измененных файлов