Browse Source

Merge pull request #1338 from runhey/dev

Automated PR 2026.01.01
huangrunheng 10 tháng trước cách đây
mục cha
commit
cac23c0b4f

+ 23 - 3
module/server/app.py

@@ -4,15 +4,17 @@
 from contextlib import asynccontextmanager
 
 import argparse
+from starlette import status
+from starlette.responses import JSONResponse
 from fastapi import FastAPI, Request
 from fastapi.middleware.cors import CORSMiddleware
 
 from module.logger import logger
-
 from module.server.home_router import home_app
 from module.server.script_router import script_app
-from starlette import status
-from starlette.responses import JSONResponse
+from module.server.setting import State
+from module.server.main_manager import mm
+
 
 
 @asynccontextmanager
@@ -20,6 +22,7 @@ async def lifespan(app: FastAPI):
     await on_startup()
     yield
     await on_shutdown()
+
 app = FastAPI(
     title='OAS',
     description='OAS web service',
@@ -40,7 +43,13 @@ app.include_router(script_app)
 
 
 async def on_startup():
+    """
+    app.state 的生命周期在定义app的时候就有了
+    :return:
+    """
     logger.info('OAS web service startup done')
+    if app.state.script_instances:
+        await mm.restart_processes(app.state.script_instances)
 
 
 async def on_shutdown():
@@ -78,5 +87,16 @@ def fastapi_app():
         help="Run OAS by config names on startup",
     )
     args, _ = parser.parse_known_args()
+    # ------------------------------------------------------------------------------------------------------------------
+
+    runs = None
+    if args.run:
+        runs = args.run
+    elif State.deploy_config.Run:
+        # TODO: refactor poor_yaml_read() to support list
+        tmp = State.deploy_config.Run.split(",")
+        runs = [l.strip(" ['\"]") for l in tmp if len(l)]
+    # ------------------------------------------------------------------------------------------------------------------
+    app.state.script_instances = runs
 
     return app

+ 16 - 3
module/server/main_manager.py

@@ -42,6 +42,10 @@ class MainManager(ConfigManager):
     #         self.config_cache = Config(config_name)
     #     return self.config_cache
 
+    @staticmethod
+    def config_cache(name: str) -> Config:
+        return Config(name)
+
     def add_script_file(self, file_name: str):
         # 当你添加了新的脚本文件后,需要添加缓存的列表
         if file_name in self._all_script_files:
@@ -95,7 +99,16 @@ class MainManager(ConfigManager):
                     tasks[coroutine_log_name] = asyncio.create_task(script_p.coroutine_broadcast_log(),
                                                                     name=coroutine_log_name)
 
-    @staticmethod
-    def config_cache(name: str) -> Config:
-        return Config(name)
+    async def restart_processes(self, script_instances: list[str]):
+        for instance in script_instances:
+            logger.info(f'Restart script {instance}')
+            if instance not in self.script_process:
+                try:
+                    self.script_process[instance] = ScriptProcess(instance)
+                except FileNotFoundError:
+                    logger.error(f'{instance} file not found')
+                    continue
+            await self.script_process[instance].start()
+
 
+mm = MainManager()

+ 3 - 1
module/server/script_process.py

@@ -9,7 +9,7 @@ from asyncio import QueueEmpty, CancelledError, sleep
 from enum import Enum
 
 from module.logger import logger
-
+from module.server.config_manager import ConfigManager
 from module.server.script_websocket import ScriptWSManager
 
 
@@ -24,6 +24,8 @@ class ScriptProcess(ScriptWSManager):
 
     def __init__(self, config_name: str) -> None:
         super().__init__()
+        if config_name not in ConfigManager.all_script_files():
+            raise FileNotFoundError(f'{config_name}.json not found')
         self.config_name = config_name  # config_name
         self.log_pipe_out, self.log_pipe_in = multiprocessing.Pipe(False)
         self.state_queue = multiprocessing.Queue()

+ 2 - 3
module/server/script_router.py

@@ -6,18 +6,17 @@ from fastapi import APIRouter, HTTPException
 from fastapi.responses import StreamingResponse
 from fastapi import WebSocket, WebSocketDisconnect
 from datetime import datetime
-from module.config.config import Config
 from module.config.utils import convert_to_underscore
 
 from module.logger import logger
-from module.server.main_manager import MainManager
+from module.server.main_manager import mm
 from module.server.script_process import ScriptProcess, ScriptState
 
 from tasks.Component.config_base import TimeDelta
 
 
 script_app = APIRouter()
-mm = MainManager()
+
 
 @script_app.get('/test')
 async def script_test():

+ 4 - 1
script.py

@@ -101,8 +101,11 @@ class Script:
         if self.config.script.error.save_error:
             if not os.path.exists('./log/error'):
                 os.mkdir('./log/error')
-            folder = f'./log/error/{int(time.time() * 1000)}'
+            folder_name = str(int(time.time() * 1000))
+            folder = f'./log/error/{folder_name}'
             logger.warning(f'Saving error: {folder}')
+            logger.info('保存详细错误的日志和截图到路径:')
+            logger.info(f'{str( Path.cwd() / "log" / "error" / folder_name)}')
             os.mkdir(folder)
             for data in self.device.screenshot_deque:
                 image_time = datetime.strftime(data['time'], '%Y-%m-%d_%H-%M-%S-%f')

+ 12 - 1
tasks/ActivityShikigami/script_task.py

@@ -341,9 +341,20 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
             # 战斗成功
             if self.appear_then_click(self.I_WIN, interval=2):
                 continue
+            #  出现 “魂” 和 紫蛇皮
             if self.appear(self.I_REWARD):
                 logger.info('Win battle')
-                self.ui_click_until_disappear(self.I_REWARD, interval=1.5)
+                while 1:
+                    self.screenshot()
+                    appear_reward = self.appear_then_click(self.I_REWARD)
+                    appear_reward_purple_snake_skin = self.appear(self.I_REWARD_PURPLE_SNAKE_SKIN)
+                    if not appear_reward and not appear_reward_purple_snake_skin:
+                        break
+                    if appear_reward or appear_reward_purple_snake_skin:
+                        reward_click = random.choice(
+                            [self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP])
+                        self.click(reward_click, interval=1.8)
+                        continue
                 return True
             # 已经不在战斗中了, 且奖励也识别过了, 则随机点击
             # if ok_cnt > 0 and not self.is_in_battle(False):

+ 0 - 2
tasks/AreaBoss/assets.py

@@ -61,8 +61,6 @@ class AreaBossAssets:
 	I_EXPLORE = RuleImage(roi_front=(758,122,66,77), roi_back=(339,104,836,120), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_explore.png")
 	# 地狱鬼王图标 
 	I_AREA_BOSS = RuleImage(roi_front=(639,636,65,68), roi_back=(606,619,145,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_area_boss.png")
-	# 蓝色的返回 
-	I_BACK_BLUE = RuleImage(roi_front=(51,30,51,52), roi_back=(4,1,128,110), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_back_blue.png")
 	# 右上边选中鬼王的 
 	I_FILTER = RuleImage(roi_front=(1116,33,35,31), roi_back=(1076,19,98,78), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
 	# 除悬赏外 选中第一个鬼王的 

+ 1 - 1
tasks/AreaBoss/script_task.py

@@ -84,7 +84,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         logger.info("Script back home")
         while 1:
             self.screenshot()
-            if self.appear_then_click(self.I_BACK_BLUE, threshold=0.6, interval=2):
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, threshold=0.6, interval=2):
                 continue
             if self.appear(self.I_CHECK_MAIN, threshold=0.6):
                 break

+ 4 - 2
tasks/BondlingFairyland/script_task.py

@@ -795,10 +795,12 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    config = Config('SWITCH')
+    config = Config('oas1')
     device = Device(config)
     t = ScriptTask(config, device)
-    t.run()
+    # t.run()
+    t.ui_get_current_page()
+    t.ui_goto(page_bondling_fairyland)
     # image = task.screenshot()
 
     # con = config.bondling_fairyland

+ 1 - 1
tasks/Component/Summon/summon.py

@@ -143,7 +143,7 @@ class Summon(BaseTask, SummonAssets):
             self.screenshot()
             if self.appear(self.I_BLUE_TICKET):
                 break
-            if self.appear_then_click(self.I_UI_BACK_BLUE):
+            if self.appear_then_click(self.I_UI_BACK_YELLOW):
                 continue
             if self.appear_then_click(self.I_UI_BACK_YELLOW):
                 continue

+ 0 - 1
tasks/Delegation/script_task.py

@@ -130,7 +130,6 @@ class ScriptTask(GameUi, DelegationAssets):
 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)

+ 4 - 4
tasks/Exploration/base.py

@@ -327,9 +327,9 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
         # 设置下次执行行时间
         logger.info("RealmRaid and Exploration  set_next_run !")
         next_run = datetime.now() + con_scrolls.scrolls_cd
-        self.set_next_run(task='Exploration', success=False, finish=False, target=next_run)
-        self.set_next_run(task='RealmRaid', success=False, finish=False, target=datetime.now())
-        self.set_next_run(task='MemoryScrolls', success=False, finish=False, target=datetime.now())
+        self.set_next_run(task='Exploration', success=None, finish=False, target=next_run)
+        self.set_next_run(task='RealmRaid', success=None, finish=False, target=datetime.now())
+        self.set_next_run(task='MemoryScrolls', success=None, finish=False, target=datetime.now())
         raise TaskEnd
 
     #
@@ -360,7 +360,7 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
                 continue
             if self.appear(self.I_EXPLORATION_TITLE) or self.appear(self.I_CHECK_EXPLORATION):
                 continue
-            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=3.5):
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=3.5):
                 continue
 
     def fire(self, button) -> bool:

+ 8 - 8
tasks/GameUi/assets.py

@@ -46,25 +46,25 @@ class GameUiAssets:
 	# description 
 	I_CHECK_EXPLORATION = RuleImage(roi_front=(1146,175,21,22), roi_back=(1146,175,21,22), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_exploration.png")
 	# 探索前往觉醒 
-	I_EXPLORATION_GOTO_AWAKE_ZONE = RuleImage(roi_front=(57,628,57,61), roi_back=(33,619,113,79), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_awake_zone.png")
+	I_EXPLORATION_GOTO_AWAKE_ZONE = RuleImage(roi_front=(57,628,57,42), roi_back=(33,619,113,79), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_awake_zone.png")
 	# 探索前往御魂 
 	I_EXPLORATION_GOTO_SOUL_ZONE = RuleImage(roi_front=(159,633,55,55), roi_back=(138,620,89,75), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_soul_zone.png")
 	# 探索前往结界突破 
-	I_EXPLORATION_GOTO_REALM_RAID = RuleImage(roi_front=(248,636,67,48), roi_back=(229,612,203,87), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_realm_raid.png")
+	I_EXPLORATION_GOTO_REALM_RAID = RuleImage(roi_front=(248,636,67,48), roi_back=(229,612,203,87), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_realm_raid.png")
 	# 探索前往御灵 
 	I_EXPLORATION_GOTO_GORYOU_REALM = RuleImage(roi_front=(353,639,47,45), roi_back=(346,626,178,67), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_goryou_realm.png")
 	# 探索前往式神委派 
-	I_EXPLORATION_GOTO_DELEGATION = RuleImage(roi_front=(445,638,60,50), roi_back=(445,638,180,50), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_delegation.png")
+	I_EXPLORATION_GOTO_DELEGATION = RuleImage(roi_front=(453,639,53,37), roi_back=(409,613,167,75), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_delegation.png")
 	# 探索前往秘闻 
-	I_EXPLORATION_GOTO_SECRET_ZONES = RuleImage(roi_front=(546,628,61,55), roi_back=(524,614,200,87), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_secret_zones.png")
+	I_EXPLORATION_GOTO_SECRET_ZONES = RuleImage(roi_front=(549,633,53,40), roi_back=(524,614,200,87), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_secret_zones.png")
 	# 探索前往地域鬼王 
-	I_EXPLORATION_GOTO_AREA_BOSS = RuleImage(roi_front=(640,638,51,45), roi_back=(640,638,180,45), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_area_boss.png")
+	I_EXPLORATION_GOTO_AREA_BOSS = RuleImage(roi_front=(640,638,51,45), roi_back=(640,638,180,45), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_area_boss.png")
 	# 探索前往平安奇谭 
 	I_EXPLORATION_GOTO_HEIAN_KITAN = RuleImage(roi_front=(739,643,52,44), roi_back=(739,643,180,44), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_heian_kitan.png")
 	# 探索前往六道之门 
-	I_EXPLORATION_GOTO_SIX_GATES = RuleImage(roi_front=(938,640,60,49), roi_back=(918,631,200,66), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_six_gates.png")
+	I_EXPLORATION_GOTO_SIX_GATES = RuleImage(roi_front=(938,640,60,49), roi_back=(918,631,200,66), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_six_gates.png")
 	# 探索前往契灵之境 
-	I_EXPLORATION_GOTO_BONDLING_FAIRYLAND = RuleImage(roi_front=(1037,639,56,49), roi_back=(1018,633,203,64), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_bondling_fairyland.png")
+	I_EXPLORATION_GOTO_BONDLING_FAIRYLAND = RuleImage(roi_front=(1037,635,56,44), roi_back=(918,623,218,72), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_bondling_fairyland.png")
 	# description 
 	I_BACK_BLUE = RuleImage(roi_front=(32,37,54,52), roi_back=(3,2,130,114), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_blue.png")
 	# description 
@@ -148,7 +148,7 @@ class GameUiAssets:
 	# description 
 	I_MAIN_GOTO_MALL = RuleImage(roi_front=(663,661,41,22), roi_back=(644,613,81,78), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_mall.png")
 	# description 
-	I_MAIN_GOTO_GUILD = RuleImage(roi_front=(540,611,50,54), roi_back=(540,611,50,54), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_guild.png")
+	I_MAIN_GOTO_GUILD = RuleImage(roi_front=(544,611,50,47), roi_back=(520,583,99,105), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_guild.png")
 	# description 
 	I_MAIN_GOTO_TEAM = RuleImage(roi_front=(437,625,38,48), roi_back=(366,606,192,83), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_main_goto_team.png")
 	# description 

+ 9 - 9
tasks/GameUi/page.py

@@ -60,7 +60,7 @@ page_summon.link(button=G.I_SUMMON_GOTO_MAIN, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_SUMMON, destination=page_summon)
 # 探索exploration
 page_exploration = Page(G.I_CHECK_EXPLORATION)
-page_exploration.link(button=G.I_BACK_BLUE, destination=page_main)
+page_exploration.link(button=G.I_BACK_YOLLOW, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_EXPLORATION, destination=page_exploration)
 # 町中town
 page_town = Page(G.I_CHECK_TOWN)
@@ -70,11 +70,11 @@ page_main.link(button=G.I_MAIN_GOTO_TOWN, destination=page_town)
 # ************************************* 探索部分 *****************************************#
 # 觉醒 awake zones
 page_awake_zones = Page(G.I_CHECK_AWAKE)
-page_awake_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_awake_zones.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_AWAKE_ZONE, destination=page_awake_zones)
 # 御魂 soul zones
 page_soul_zones = Page(G.I_CHECK_SOUL_ZONES)
-page_soul_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_soul_zones.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_SOUL_ZONE, destination=page_soul_zones)
 # 结界突破 realm raid
 page_realm_raid = Page(G.I_CHECK_REALM_RAID)
@@ -87,19 +87,19 @@ page_realm_raid.link(button=RyouToppaAssets.I_RYOU_TOPPA, destination=page_kekka
 page_kekkai_toppa.link(button=G.I_RYOUTOPPA_GOTO_REALMRAID, destination=page_realm_raid)
 # 御灵 goryou realm
 page_goryou_realm = Page(G.I_CHECK_GORYOU)
-page_goryou_realm.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_goryou_realm.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_GORYOU_REALM, destination=page_goryou_realm)
 # 委派 delegation
 page_delegation = Page(G.I_CHECK_DELEGATION)
-page_delegation.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_delegation.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_DELEGATION, destination=page_delegation)
 # 秘闻副本 SECRET zones
 page_secret_zones = Page(G.I_CHECK_SECRET_ZONES)
-page_secret_zones.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_secret_zones.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_SECRET_ZONES, destination=page_secret_zones)
 # 地域鬼王 area boss
 page_area_boss = Page(G.I_CHECK_AREA_BOSS)
-page_area_boss.link(button=G.I_BACK_BLUE, destination=page_exploration)
+page_area_boss.link(button=G.I_BACK_YOLLOW, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_AREA_BOSS, destination=page_area_boss)
 # 平安奇谭 heian kitan
 page_heian_kitan = Page(G.I_CHECK_HEIAN_KITAN)
@@ -125,7 +125,7 @@ page_demon_encounter.link(button=G.I_DEMON_ENCOUNTER_GOTO_TOWN, destination=page
 page_town.link(button=G.I_TOWN_GOTO_DEMON_ENCOUNTER, destination=page_demon_encounter)
 # 狩猎战 hunt
 page_hunt = Page(G.I_CHECK_HUNT)
-page_hunt.link(button=G.I_BACK_BL, destination=page_town)
+page_hunt.link(button=G.I_BACK_YOLLOW, destination=page_town)
 page_town.link(button=G.I_TOWN_GOTO_HUNT, destination=page_hunt)
 # 狩猎战麒麟 hunt_kirin
 page_hunt_kirin = Page(G.I_CHECK_HUNT_KIRIN)
@@ -168,7 +168,7 @@ from tasks.DailyTrifles.assets import DailyTriflesAssets
 # 商店 mall
 page_mall = Page(check_button=[G.I_CHECK_MALL, DailyTriflesAssets.I_ROOM_GIFT])
 page_mall.additional = [G.I_AD_CLOSE_RED, G.I_BACK_Y, G.I_DLC_CLOSE]
-page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
+page_mall.link(button=G.I_BACK_YOLLOW, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 # 阴阳寮 guild
 page_guild = Page(G.I_CHECK_GUILD)

BIN
tasks/GameUi/page/page_exploration_goto_awake_zone.png


BIN
tasks/GameUi/page/page_exploration_goto_bondling_fairyland.png


BIN
tasks/GameUi/page/page_exploration_goto_delegation.png


BIN
tasks/GameUi/page/page_exploration_goto_secret_zones.png


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

@@ -38,10 +38,10 @@
   {
     "itemName": "exploration_goto_awake_zone",
     "imageName": "page_exploration_goto_awake_zone.png",
-    "roiFront": "57,628,57,61",
+    "roiFront": "57,628,57,42",
     "roiBack": "33,619,113,79",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往觉醒"
   },
   {
@@ -59,7 +59,7 @@
     "roiFront": "248,636,67,48",
     "roiBack": "229,612,203,87",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往结界突破"
   },
   {
@@ -74,19 +74,19 @@
   {
     "itemName": "exploration_goto_delegation",
     "imageName": "page_exploration_goto_delegation.png",
-    "roiFront": "445,638,60,50",
-    "roiBack": "445,638,180,50",
+    "roiFront": "453,639,53,37",
+    "roiBack": "409,613,167,75",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往式神委派"
   },
   {
     "itemName": "exploration_goto_secret_zones",
     "imageName": "page_exploration_goto_secret_zones.png",
-    "roiFront": "546,628,61,55",
+    "roiFront": "549,633,53,40",
     "roiBack": "524,614,200,87",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.7,
     "description": "探索前往秘闻"
   },
   {
@@ -95,7 +95,7 @@
     "roiFront": "640,638,51,45",
     "roiBack": "640,638,180,45",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往地域鬼王"
   },
   {
@@ -113,16 +113,16 @@
     "roiFront": "938,640,60,49",
     "roiBack": "918,631,200,66",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往六道之门"
   },
   {
     "itemName": "exploration_goto_bondling_fairyland",
     "imageName": "page_exploration_goto_bondling_fairyland.png",
-    "roiFront": "1037,639,56,49",
-    "roiBack": "1018,633,203,64",
+    "roiFront": "1037,635,56,44",
+    "roiBack": "918,623,218,72",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "探索前往契灵之境"
   },
   {

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

@@ -47,8 +47,8 @@
   {
     "itemName": "main_goto_guild",
     "imageName": "page_main_goto_guild.png",
-    "roiFront": "540,611,50,54",
-    "roiBack": "540,611,50,54",
+    "roiFront": "544,611,50,47",
+    "roiBack": "520,583,99,105",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "description"

BIN
tasks/GameUi/page/page_main_goto_guild.png


+ 1 - 1
tasks/GoryouRealm/script_task.py

@@ -71,7 +71,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, GoryouRealmAssets):
                     break
 
 
-        self.ui_click(self.I_UI_BACK_BLUE, self.I_CHECK_EXPLORATION)
+        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_EXPLORATION)
         logger.info('Back to exploration')
         self.set_next_run(task='GoryouRealm', success=True, finish=True)
         raise TaskEnd

+ 2 - 2
tasks/KekkaiActivation/script_task.py

@@ -413,9 +413,9 @@ if __name__ == "__main__":
     from module.device.device import Device
     import cv2
 
-    c = Config('switch')
+    c = Config('oas1')
     d = Device(c)
 
     t = ScriptTask(c, d)
-    t.check_card_num()
+    t.run()
     # t.run_activation(t.config.kekkai_activation.activation_config)

+ 2 - 0
tasks/KekkaiUtilize/script_task.py

@@ -726,6 +726,8 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
                 continue
             if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1):
                 continue
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
+                continue
 
     def back_realm(self):
         # 回到寮结界

+ 1 - 1
tasks/Orochi/script_task.py

@@ -314,7 +314,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             self.screenshot()
             if not self.appear(self.I_FORM_TEAM):
                 break
-            if self.appear_then_click(self.I_BACK_BL, interval=1):
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
                 continue
 
         self.ui_current = page_soul_zones

+ 5 - 5
tasks/RichMan/assets.py

@@ -102,7 +102,7 @@ class RichManAssets:
 	# description 
 	I_FS_WHITE_CLICK = RuleImage(roi_front=(627,140,138,132), roi_back=(627,140,138,132), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/friendship_points/friendship_points_fs_white_click.png")
 	# 白蛋确认 
-	I_FS_WHITE_CHECK = RuleImage(roi_front=(589,227,100,100), roi_back=(589,227,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/friendship_points/friendship_points_fs_white_check.png")
+	I_FS_WHITE_CHECK = RuleImage(roi_front=(591,228,100,100), roi_back=(534,181,201,183), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/friendship_points/friendship_points_fs_white_check.png")
 
 
 	# Image Rule Assets
@@ -141,13 +141,13 @@ class RichManAssets:
 	# 破碎的咒符 
 	I_ME_BROKEN = RuleImage(roi_front=(398,144,143,116), roi_back=(146,116,866,475), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_broken.png")
 	# 购买检查 
-	I_ME_CHECK_BLACK = RuleImage(roi_front=(585,230,100,100), roi_back=(585,230,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_black.png")
+	I_ME_CHECK_BLACK = RuleImage(roi_front=(593,229,100,100), roi_back=(558,177,202,200), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_black.png")
 	# 购买检查 
-	I_ME_CHECK_BLUE = RuleImage(roi_front=(587,238,100,100), roi_back=(587,238,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_blue.png")
+	I_ME_CHECK_BLUE = RuleImage(roi_front=(591,220,100,100), roi_back=(541,179,206,189), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_blue.png")
 	# 购买检查 
-	I_ME_CHECK_AP = RuleImage(roi_front=(588,242,100,100), roi_back=(588,242,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_ap.png")
+	I_ME_CHECK_AP = RuleImage(roi_front=(590,231,100,100), roi_back=(539,194,189,162), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_ap.png")
 	# 购买检查 
-	I_ME_CHECK_SOULS = RuleImage(roi_front=(590,257,100,100), roi_back=(590,257,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_souls.png")
+	I_ME_CHECK_SOULS = RuleImage(roi_front=(611,225,100,100), roi_back=(507,199,272,175), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/medal/medal_me_check_souls.png")
 
 
 	# Image Rule Assets

+ 1 - 1
tasks/RichMan/mall/friendship_points.py

@@ -129,7 +129,7 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('test')
+    c = Config('oas1')
     d = Device(c)
     t = FriendshipPoints(c, d)
 

+ 2 - 2
tasks/RichMan/mall/friendship_points/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "fs_white_check",
     "imageName": "friendship_points_fs_white_check.png",
-    "roiFront": "589,227,100,100",
-    "roiBack": "589,227,100,100",
+    "roiFront": "591,228,100,100",
+    "roiBack": "534,181,201,183",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "白蛋确认"

+ 8 - 8
tasks/RichMan/mall/medal/image.json

@@ -74,8 +74,8 @@
   {
     "itemName": "me_check_black",
     "imageName": "medal_me_check_black.png",
-    "roiFront": "585,230,100,100",
-    "roiBack": "585,230,100,100",
+    "roiFront": "593,229,100,100",
+    "roiBack": "558,177,202,200",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "购买检查"
@@ -83,8 +83,8 @@
   {
     "itemName": "me_check_blue",
     "imageName": "medal_me_check_blue.png",
-    "roiFront": "587,238,100,100",
-    "roiBack": "587,238,100,100",
+    "roiFront": "591,220,100,100",
+    "roiBack": "541,179,206,189",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "购买检查"
@@ -92,8 +92,8 @@
   {
     "itemName": "me_check_ap",
     "imageName": "medal_me_check_ap.png",
-    "roiFront": "588,242,100,100",
-    "roiBack": "588,242,100,100",
+    "roiFront": "590,231,100,100",
+    "roiBack": "539,194,189,162",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "购买检查"
@@ -101,8 +101,8 @@
   {
     "itemName": "me_check_souls",
     "imageName": "medal_me_check_souls.png",
-    "roiFront": "590,257,100,100",
-    "roiBack": "590,257,100,100",
+    "roiFront": "611,225,100,100",
+    "roiBack": "507,199,272,175",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "购买检查"

+ 1 - 1
tasks/RyouToppa/assets.py

@@ -125,7 +125,7 @@ class RyouToppaAssets:
 	# 开始寮突按钮 
 	I_START_TOPPA_BUTTON = RuleImage(roi_front=(832,279,130,43), roi_back=(1,1,1055,718), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_start_toppa_button.png")
 	# 寮击破奖励 
-	I_RYOU_REWARD = RuleImage(roi_front=(134,417,241,40), roi_back=(134,417,241,40), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_reward.png")
+	I_RYOU_REWARD = RuleImage(roi_front=(134,417,241,40), roi_back=(122,390,340,84), threshold=0.65, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_reward.png")
 	# 勋章奖励标题 
 	I_GUILD_ORDERS_REWARDS = RuleImage(roi_front=(1123,31,115,56), roi_back=(1123,31,115,56), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_guild_orders_rewards.png")
 	# 攻破阴阳寮 

+ 2 - 2
tasks/RyouToppa/res/image.json

@@ -39,9 +39,9 @@
     "itemName": "ryou_reward",
     "imageName": "res_ryou_reward.png",
     "roiFront": "134,417,241,40",
-    "roiBack": "134,417,241,40",
+    "roiBack": "122,390,340,84",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.65,
     "description": "寮击破奖励"
   },
   {

+ 1 - 1
tasks/Secret/script_task.py

@@ -128,7 +128,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, SecretAssets):
                 success = self.run_general_battle(self.battle_config)
                 continue
 
-        self.ui_click(self.I_UI_BACK_BLUE, self.I_CHECK_MAIN)
+        self.ui_click(self.I_UI_BACK_YELLOW, self.I_CHECK_MAIN)
         self.ui_get_current_page()
         self.ui_goto(page_main)
         if con.secret_gold_50 or con.secret_gold_100:

+ 2 - 2
tasks/WantedQuests/script_task.py

@@ -438,7 +438,7 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
                 break
             if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
                 continue
-            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1.5):
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1.5):
                 continue
         logger.info('Secret mission finished')
 
@@ -724,7 +724,7 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
                     total = total % 10
                 if cu > total:
                     logger.warning('Current number of wanted quests is greater than total number')
-                    cu = cu % 10
+                    cu = cu // 10
                 if cu == total:
                     # 该任务已完成,一般是悬赏任务,邀请人没有做导致的
                     continue