Explorar el Código

perf: Delete Useless code

ryland hace 2 años
padre
commit
c3b7c386dc

+ 1 - 1
dev_tools/assets_extract.py

@@ -417,4 +417,4 @@ class AllAssetsExtractor:
 
 
 if __name__ == "__main__":
-    AllAssetsExtractor.work(r"D:\Tools\OnmyojiAutoScript\tasks\MyOrochi")
+    AllAssetsExtractor()

+ 2 - 2
module/config/config_manual.py

@@ -11,8 +11,8 @@ class ConfigManual:
         Restart
         > KekkaiUtilize > KekkaiActivation > DemonEncounter
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > Tako > RealmRaid > RyouToppa > DailyTrifles > Exploration
-        > Hunt > DevRyouToppa > DevExploration
-        > MyOrochi > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
+        > Hunt 
+        > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami > WantedQuests
         > BondlingFairyland > EvoZone > GoryouRealm
         > TrueOrochi > RichMan

+ 2 - 2
module/config/config_menu.py

@@ -19,7 +19,7 @@ class ConfigMenu:
         # 脚本设置
         self.menu['Script'] = ['Script', 'Restart', 'GlobalGame']
         # 刷御魂
-        self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea', 'MyOrochi']
+        self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea']
         # 日常的任务
         self.menu["Daily Task"] = ['DailyTrifles', 'AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian',
                                    'TalismanPass', 'DemonEncounter', 'Pets', 'SoulsTidy', 'Delegation', 'WantedQuests',
@@ -29,7 +29,7 @@ class ConfigMenu:
                                                 'DevExploration']
         # 阴阳寮
         self.menu["Guild"] = ['KekkaiUtilize', 'KekkaiActivation', 'RealmRaid', 'RyouToppa', 'CollectiveMissions',
-                              'Hunt', 'DevRyouToppa']
+                              'Hunt']
         # 每周任务
         self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan', 'Secret', 'WeeklyTrifles', 'MysteryShop', 'Duel']
         # 活动的任务

+ 0 - 6
module/config/config_model.py

@@ -16,9 +16,6 @@ from module.logger import logger
 from tasks.Component.config_base import ConfigBase, TimeDelta
 from tasks.Exploration.config import Exploration
 from tasks.RyouToppa.config import RyouToppa
-from tasks.DevRyouToppa.config import DevRyouToppa
-from tasks.DevExploration.config import DevExploration
-from tasks.MyOrochi.config import MyOrochi
 from tasks.Script.config import Script
 from tasks.Restart.config import Restart
 from tasks.GlobalGame.config import GlobalGame
@@ -80,8 +77,6 @@ class ConfigModel(ConfigBase):
     nian: Nian = Field(default_factory=Nian)
     realm_raid: RealmRaid = Field(default_factory=RealmRaid)
     ryou_toppa: RyouToppa = Field(default_factory=RyouToppa)
-    dev_ryou_toppa: DevRyouToppa = Field(default_factory=DevRyouToppa)
-    my_orochi: MyOrochi = Field(default_factory=MyOrochi)
     kekkai_utilize: KekkaiUtilize = Field(default_factory=KekkaiUtilize)
     kekkai_activation: KekkaiActivation = Field(default_factory=KekkaiActivation)
     demon_encounter: DemonEncounter = Field(default_factory=DemonEncounter)
@@ -91,7 +86,6 @@ class ConfigModel(ConfigBase):
     souls_tidy: SoulsTidy = Field(default_factory=SoulsTidy)
     delegation: Delegation = Field(default_factory=Delegation)
     exploration: Exploration = Field(default_factory=Exploration)
-    dev_exploration: DevExploration = Field(default_factory=DevExploration)
     wanted_quests: WantedQuests = Field(default_factory=WantedQuests)
     tako: Tako = Field(default_factory=Tako)
 

+ 0 - 57
tasks/DevExploration/assets.py

@@ -1,57 +0,0 @@
-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 DevExplorationAssets: 
-
-
-	# Click Rule Assets
-	# 添加点击区域 
-	C_ADD_AREA = RuleClick(roi_front=(1039,204,100,100), roi_back=(1039,204,100,100), name="add_area")
-	# 重新邀请 
-	C_RE_INVITE = RuleClick(roi_front=(711,410,86,46), roi_back=(711,410,86,46), name="re_invite")
-
-
-	# Image Rule Assets
-	# 第二十八章节 
-	I_CHAPTER = RuleImage(roi_front=(1086,559,131,76), roi_back=(1086,559,131,76), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_chapter.png")
-	# 微笑标识 
-	I_SMILE = RuleImage(roi_front=(25,539,55,53), roi_back=(25,539,55,53), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_smile.png")
-	# 添加图案 
-	I_ADD_IMAGE = RuleImage(roi_front=(1040,203,100,100), roi_back=(1040,203,100,100), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_add_image.png")
-	# 挑战按钮 
-	I_START = RuleImage(roi_front=(1180,610,74,68), roi_back=(1180,610,74,68), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_start.png")
-	# 确认 
-	I_SURE = RuleImage(roi_front=(725,413,69,41), roi_back=(725,413,69,41), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_sure.png")
-	# 接受邀请 
-	I_ACCEPT = RuleImage(roi_front=(111,229,63,55), roi_back=(111,229,63,55), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_accept.png")
-	# 退出探索 
-	I_EXIT_TANSUO = RuleImage(roi_front=(17,35,70,56), roi_back=(17,35,70,56), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_exit_tansuo.png")
-	# 退出标识 
-	I_EXIT_SIGN = RuleImage(roi_front=(10,123,87,162), roi_back=(10,123,87,162), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_exit_sign.png")
-	# exit_sign_2 
-	I_EXIT_SIGN_2 = RuleImage(roi_front=(11,148,94,321), roi_back=(11,148,94,321), threshold=0.8, method="Template matching", file="./tasks/DevExploration/res/res_exit_sign_2.png")
-
-
-	# Ocr Rule Assets
-	# 组队按钮 
-	O_TEAM_BUTTON = RuleOcr(roi=(608,516,86,46), area=(608,516,86,46), mode="Full", method="Default", keyword="组队", name="team_button")
-	# 创建房间按钮 
-	O_CREATE_BUTTON = RuleOcr(roi=(593,491,93,49), area=(593,491,93,49), mode="Full", method="Default", keyword="创建", name="create_button")
-	# 需要邀请的好友名称 
-	O_FRIEND = RuleOcr(roi=(352,180,579,320), area=(352,180,579,320), mode="Full", method="Default", keyword="", name="friend")
-	# 邀请 
-	O_INVITE = RuleOcr(roi=(732,553,84,45), area=(732,553,84,45), mode="Full", method="Default", keyword="邀请", name="invite")
-	# 确认 
-	O_QUEREN = RuleOcr(roi=(729,384,90,40), area=(729,384,90,40), mode="Full", method="Default", keyword="确认", name="queren")
-	# 确定 
-	O_QUEDING = RuleOcr(roi=(709,399,87,69), area=(709,399,87,69), mode="Full", method="Default", keyword="确定", name="queding")
-	# Ocr-description 
-	O_QUEREN_2 = RuleOcr(roi=(732,385,82,40), area=(732,385,82,40), mode="Full", method="Default", keyword="确认", name="queren_2")
-
-

+ 0 - 22
tasks/DevExploration/config.py

@@ -1,22 +0,0 @@
-from pydantic import BaseModel, Field
-from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
-from tasks.Component.config_base import ConfigBase
-from tasks.Component.config_scheduler import Scheduler
-from enum import Enum
-
-
-class ExplorationMode(str, Enum):
-    CAPTAIN = '队长'
-    MEMBER = '队员'
-
-
-class ExplorationConfig(BaseModel):
-    mode: ExplorationMode = Field(title='探索模式', default=ExplorationMode.CAPTAIN,
-                                  description='默认是队长模式')
-    friend: str = Field(default='', description='friend_name_help')
-
-
-class DevExploration(ConfigBase):
-    scheduler: Scheduler = Field(default_factory=Scheduler)
-    exploration_config: ExplorationConfig = Field(default_factory=ExplorationConfig)
-    general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)

+ 0 - 14
tasks/DevExploration/res/click.json

@@ -1,14 +0,0 @@
-[
-  {
-    "itemName": "add_area",
-    "roiFront": "1039,204,100,100",
-    "roiBack": "1039,204,100,100",
-    "description": "添加点击区域"
-  },
-  {
-    "itemName": "re_invite",
-    "roiFront": "711,410,86,46",
-    "roiBack": "711,410,86,46",
-    "description": "重新邀请"
-  }
-]

+ 0 - 83
tasks/DevExploration/res/image.json

@@ -1,83 +0,0 @@
-[
-  {
-    "itemName": "chapter",
-    "imageName": "res_chapter.png",
-    "roiFront": "1086,559,131,76",
-    "roiBack": "1086,559,131,76",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "第二十八章节"
-  },
-  {
-    "itemName": "smile",
-    "imageName": "res_smile.png",
-    "roiFront": "25,539,55,53",
-    "roiBack": "25,539,55,53",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "微笑标识"
-  },
-  {
-    "itemName": "add_image",
-    "imageName": "res_add_image.png",
-    "roiFront": "1040,203,100,100",
-    "roiBack": "1040,203,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "添加图案"
-  },
-  {
-    "itemName": "start",
-    "imageName": "res_start.png",
-    "roiFront": "1180,610,74,68",
-    "roiBack": "1180,610,74,68",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "挑战按钮"
-  },
-  {
-    "itemName": "sure",
-    "imageName": "res_sure.png",
-    "roiFront": "725,413,69,41",
-    "roiBack": "725,413,69,41",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "确认"
-  },
-  {
-    "itemName": "accept",
-    "imageName": "res_accept.png",
-    "roiFront": "111,229,63,55",
-    "roiBack": "111,229,63,55",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "接受邀请"
-  },
-  {
-    "itemName": "exit_tansuo",
-    "imageName": "res_exit_tansuo.png",
-    "roiFront": "17,35,70,56",
-    "roiBack": "17,35,70,56",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "退出探索"
-  },
-  {
-    "itemName": "exit_sign",
-    "imageName": "res_exit_sign.png",
-    "roiFront": "10,123,87,162",
-    "roiBack": "10,123,87,162",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "退出标识"
-  },
-  {
-    "itemName": "exit_sign_2",
-    "imageName": "res_exit_sign_2.png",
-    "roiFront": "11,148,94,321",
-    "roiBack": "11,148,94,321",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "exit_sign_2"
-  }
-]

+ 0 - 65
tasks/DevExploration/res/ocr.json

@@ -1,65 +0,0 @@
-[
-  {
-    "itemName": "team_button",
-    "roiFront": "608,516,86,46",
-    "roiBack": "608,516,86,46",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "组队",
-    "description": "组队按钮"
-  },
-  {
-    "itemName": "create_button",
-    "roiFront": "593,491,93,49",
-    "roiBack": "593,491,93,49",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "创建",
-    "description": "创建房间按钮"
-  },
-  {
-    "itemName": "friend",
-    "roiFront": "352,180,579,320",
-    "roiBack": "352,180,579,320",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "",
-    "description": "需要邀请的好友名称"
-  },
-  {
-    "itemName": "invite",
-    "roiFront": "732,553,84,45",
-    "roiBack": "732,553,84,45",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "邀请",
-    "description": "邀请"
-  },
-  {
-    "itemName": "queren",
-    "roiFront": "729,384,90,40",
-    "roiBack": "729,384,90,40",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "确认",
-    "description": "确认"
-  },
-  {
-    "itemName": "queding",
-    "roiFront": "709,399,87,69",
-    "roiBack": "709,399,87,69",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "确定",
-    "description": "确定"
-  },
-  {
-    "itemName": "queren_2",
-    "roiFront": "732,385,82,40",
-    "roiBack": "732,385,82,40",
-    "mode": "Full",
-    "method": "Default",
-    "keyword": "确认",
-    "description": "Ocr-description"
-  }
-]

BIN
tasks/DevExploration/res/res_accept.png


BIN
tasks/DevExploration/res/res_add_image.png


BIN
tasks/DevExploration/res/res_chapter.png


BIN
tasks/DevExploration/res/res_exit_sign.png


BIN
tasks/DevExploration/res/res_exit_sign_2.png


BIN
tasks/DevExploration/res/res_exit_tansuo.png


BIN
tasks/DevExploration/res/res_smile.png


BIN
tasks/DevExploration/res/res_start.png


BIN
tasks/DevExploration/res/res_sure.png


+ 0 - 154
tasks/DevExploration/script_task.py

@@ -1,154 +0,0 @@
-# This Python file uses the following encoding: utf-8
-
-import time
-from module.exception import TaskEnd
-from tasks.Component.GeneralBattle.general_battle import GeneralBattle
-from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_exploration
-from tasks.DevExploration.assets import DevExplorationAssets
-from module.logger import logger
-from tasks.Secret.assets import SecretAssets
-from tasks.DevExploration.config import ExplorationMode
-
-
-class ScriptTask(GeneralBattle, GameUi, DevExplorationAssets):
-
-    def run(self):
-        options = self.config.dev_exploration
-        if options.exploration_config.mode == ExplorationMode.CAPTAIN:
-            return self._run_captain()
-        elif options.exploration_config.mode == ExplorationMode.MEMBER:
-            return self._run_member()
-        else:
-            logger.exception("Invalid mode, please choice [captain] or [member]")
-        self._run_member()
-
-    def _run_captain(self):
-        options = self.config.dev_exploration
-        self.ui_get_current_page()
-        self.ui_goto(page_exploration)
-
-        while True:
-            self.screenshot()
-            if self.ocr_appear(self.O_TEAM_BUTTON):
-                break
-            if self.appear_then_click(self.I_CHAPTER, interval=2):
-                continue
-
-        while True:
-            self.screenshot()
-            if self.ocr_appear(self.O_CREATE_BUTTON):
-                break
-            if self.ocr_appear_click(self.O_TEAM_BUTTON, interval=2):
-                continue
-
-        while True:
-            self.screenshot()
-            if self.appear(self.I_SMILE):
-                break
-            if self.ocr_appear_click(self.O_CREATE_BUTTON, interval=2):
-                continue
-
-        while True:
-            self.screenshot()
-            if self.ocr_appear(self.O_INVITE):
-                break
-            if self.click(self.C_ADD_AREA, interval=2):
-                continue
-
-        friend_name = options.exploration_config.friend
-        logger.info("准备邀请队员:%s" % friend_name)
-        self.O_FRIEND.keyword = friend_name
-
-        time.sleep(2)
-        self.screenshot()
-        if not self.ocr_appear_click(self.O_FRIEND):
-            logger.error("无法找到队员:%s" % friend_name)
-            raise TaskEnd
-
-        time.sleep(2)
-        self.screenshot()
-        self.ocr_appear_click(self.O_INVITE)
-        self.wait_until_disappear(self.I_ADD_IMAGE)
-
-        # 进入探索
-        self.appear_then_click(self.I_START)
-        time.sleep(3)
-
-        while True:
-            self.screenshot()
-            if self.in_fight():
-                logger.info("检测到进入战斗")
-                self.battle_wait(random_click_swipt_enable=False)
-            if self.in_room():
-                self.wait_until_disappear(self.I_ADD_IMAGE)
-                self.appear_then_click(self.I_START)
-            if self.ocr_appear_click(self.O_QUEREN):
-                pass
-            if self.ocr_appear_click(self.O_QUEDING):
-                pass
-            time.sleep(0.2)
-
-    def _run_member(self):
-        count = 0
-        while True:
-            self.screenshot()
-            if self.appear_then_click(self.I_ACCEPT):
-                time.sleep(2)
-            if self.in_fight():
-                count += 1
-                logger.info("检测到进入战斗 %s" % str(count))
-                self.battle_wait(random_click_swipt_enable=False)
-            if self.appear(self.I_EXIT_SIGN) or self.appear(self.I_EXIT_SIGN_2):
-                self.appear_then_click(self.I_EXIT_TANSUO)
-            if self.ocr_appear_click(self.O_QUEREN_2):
-                pass
-            time.sleep(0.2)
-
-    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-        # 重写
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.device.click_record_clear()
-        # 战斗过程 随机点击和滑动 防封
-        logger.info("Start battle process")
-        while 1:
-            self.screenshot()
-            if self.appear(SecretAssets.I_SE_BATTLE_WIN):
-                logger.info('Win battle')
-                self.ui_click_until_disappear(SecretAssets.I_SE_BATTLE_WIN)
-                return True
-            if self.appear_then_click(self.I_WIN, interval=1):
-                continue
-            if self.appear(self.I_REWARD):
-                logger.info('Win battle')
-                self.ui_click_until_disappear(self.I_REWARD)
-                return True
-
-            if self.appear(self.I_FALSE):
-                logger.warning('False battle')
-                self.ui_click_until_disappear(self.I_FALSE)
-                return False
-
-    def in_fight(self):
-        self.screenshot()
-        if self.appear(self.I_EXIT):
-            return True
-        else:
-            return False
-
-    def in_room(self):
-        self.screenshot()
-        if self.appear(self.I_SMILE):
-            return True
-        else:
-            return False
-
-
-if __name__ == '__main__':
-    from module.config.config import Config
-    from module.device.device import Device
-
-    config = Config('oas2')
-    device = Device(config)
-    t = ScriptTask(config, device)
-    t.run()

+ 0 - 36
tasks/MyOrochi/assets.py

@@ -1,36 +0,0 @@
-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 MyOrochiAssets: 
-
-
-	# Click Rule Assets
-	# 结束时的安全点击区域 
-	C_SAFE_AREA_1 = RuleClick(roi_front=(32,173,194,390), roi_back=(32,173,194,390), name="safe_area_1")
-	# 结束时的安全点击区域2 
-	C_SAFE_AREA_2 = RuleClick(roi_front=(1082,187,170,429), roi_back=(1082,187,170,429), name="safe_area_2")
-
-
-	# Image Rule Assets
-	# 第二个坑位标识 
-	I_SECOND_PIT_POSITION = RuleImage(roi_front=(597,204,100,100), roi_back=(597,204,100,100), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_second_pit_position.png")
-	# 调整按钮 
-	I_FIRE_SIGN = RuleImage(roi_front=(1169,603,98,81), roi_back=(1169,603,98,81), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_fire_sign.png")
-	# 御魂金币
-	I_ORICHI_GLOD = RuleImage(roi_front=(820,182,80,61), roi_back=(0,0,1279,719), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_orichi_glod.png")
-	# 魂字标识 
-	I_ORICHI_END = RuleImage(roi_front=(574,495,123,102), roi_back=(574,495,123,102), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_orichi_end.png")
-	# 太鼓标识 
-	I_GU = RuleImage(roi_front=(432,88,100,100), roi_back=(432,88,100,100), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_gu.png")
-	# 房间标识 
-	I_IN_ROOM = RuleImage(roi_front=(15,524,77,79), roi_back=(15,524,77,79), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_in_room.png")
-	# 判断是否进入战斗 
-	I_IN_FIGHT = RuleImage(roi_front=(87,17,41,34), roi_back=(87,17,41,34), threshold=0.8, method="Template matching", file="./tasks/MyOrochi/res/res_in_fight.png")
-
-

+ 0 - 20
tasks/MyOrochi/config.py

@@ -1,20 +0,0 @@
-from pydantic import BaseModel, Field
-from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
-from tasks.Component.config_base import ConfigBase
-from tasks.Component.config_scheduler import Scheduler
-from enum import Enum
-
-
-class RoleMode(str, Enum):
-    CAPTAIN = '队长'
-    MEMBER = '队员'
-
-
-class MyOrochiConfig(BaseModel):
-    mode: RoleMode = Field(title='角色模式', default=RoleMode.CAPTAIN, description='默认是队长模式')
-
-
-class MyOrochi(ConfigBase):
-    scheduler: Scheduler = Field(default_factory=Scheduler)
-    orochi_config: MyOrochiConfig = Field(default_factory=MyOrochiConfig)
-    general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)

+ 0 - 14
tasks/MyOrochi/res/click.json

@@ -1,14 +0,0 @@
-[
-  {
-    "itemName": "safe_area_1",
-    "roiFront": "32,173,194,390",
-    "roiBack": "32,173,194,390",
-    "description": "结束时的安全点击区域"
-  },
-  {
-    "itemName": "safe_area_2",
-    "roiFront": "1082,187,170,429",
-    "roiBack": "1082,187,170,429",
-    "description": "结束时的安全点击区域2"
-  }
-]

+ 0 - 65
tasks/MyOrochi/res/image.json

@@ -1,65 +0,0 @@
-[
-  {
-    "itemName": "second_pit_position",
-    "imageName": "res_second_pit_position.png",
-    "roiFront": "597,204,100,100",
-    "roiBack": "597,204,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "第二个坑位标识"
-  },
-  {
-    "itemName": "fire_sign",
-    "imageName": "res_fire_sign.png",
-    "roiFront": "1169,603,98,81",
-    "roiBack": "1169,603,98,81",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "调整按钮"
-  },
-  {
-    "itemName": "orichi_glod",
-    "imageName": "res_orichi_glod.png",
-    "roiFront": "820,182,80,61",
-    "roiBack": "0,0,1279,719",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "御魂金币"
-  },
-  {
-    "itemName": "orichi_end",
-    "imageName": "res_orichi_end.png",
-    "roiFront": "574,495,123,102",
-    "roiBack": "574,495,123,102",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "魂字标识"
-  },
-  {
-    "itemName": "gu",
-    "imageName": "res_gu.png",
-    "roiFront": "432,88,100,100",
-    "roiBack": "432,88,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "太鼓标识"
-  },
-  {
-    "itemName": "in_room",
-    "imageName": "res_in_room.png",
-    "roiFront": "15,524,77,79",
-    "roiBack": "15,524,77,79",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "房间标识"
-  },
-  {
-    "itemName": "in_fight",
-    "imageName": "res_in_fight.png",
-    "roiFront": "87,17,41,34",
-    "roiBack": "87,17,41,34",
-    "method": "Template matching",
-    "threshold": 0.9,
-    "description": "判断是否进入战斗"
-  }
-]

BIN
tasks/MyOrochi/res/res_fire_sign.png


BIN
tasks/MyOrochi/res/res_gu.png


BIN
tasks/MyOrochi/res/res_in_fight.png


BIN
tasks/MyOrochi/res/res_in_room.png


BIN
tasks/MyOrochi/res/res_orichi_end.png


BIN
tasks/MyOrochi/res/res_orichi_glod.png


BIN
tasks/MyOrochi/res/res_second_pit_position.png


+ 0 - 107
tasks/MyOrochi/script_task.py

@@ -1,107 +0,0 @@
-# This Python file uses the following encoding: utf-8
-import time
-
-import random
-from tasks.Component.GeneralBattle.general_battle import GeneralBattle
-from tasks.GameUi.game_ui import GameUi
-from tasks.DevExploration.assets import DevExplorationAssets
-from tasks.MyOrochi.assets import MyOrochiAssets
-from module.logger import logger
-from tasks.MyOrochi.config import RoleMode
-
-safe_click = (MyOrochiAssets.C_SAFE_AREA_1, MyOrochiAssets.C_SAFE_AREA_2)
-
-
-def random_delay(min_value: float = 1.0, max_value: float = 2.0, decimal: int = 1):
-    """
-    生成一个指定范围内的随机小数
-    """
-    random_float_in_range = random.uniform(min_value, max_value)
-    return (round(random_float_in_range, decimal))
-
-
-class ScriptTask(GeneralBattle, GameUi, DevExplorationAssets):
-
-    def run(self):
-        options = self.config.my_orochi
-        if options.orochi_config.mode == RoleMode.CAPTAIN:
-            logger.info("Run Role: %s" % str(options.orochi_config.mode))
-            return self._run_captain()
-        elif options.orochi_config.mode == RoleMode.MEMBER:
-            logger.info("Run Role: %s" % str(options.orochi_config.mode))
-            return self._run_member()
-        else:
-            logger.exception("Invalid mode, please choice [captain] or [member]")
-
-    def _run_captain(self):
-        count = 1
-        while True:
-            self.screenshot()
-            if self.in_room():
-                self.wait_until_disappear(MyOrochiAssets.I_SECOND_PIT_POSITION)
-                # time.sleep(random_delay(0.3, 1, decimal=2))
-                self.ui_click_until_disappear(MyOrochiAssets.I_FIRE_SIGN)
-            if self.in_fight():
-                logger.hr('检测到进入战斗: %s' % str(count), level=1)
-                self._run_battle()
-                count += 1
-            time.sleep(0.2)
-
-    def _run_member(self):
-        count = 1
-        while True:
-            self.screenshot()
-            if self.in_fight():
-                logger.hr('检测到进入战斗: %s' % str(count), level=1)
-                self._run_battle()
-                count += 1
-            time.sleep(0.2)
-
-    def _run_battle(self):
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.device.click_record_clear()
-        while True:
-            self.screenshot()
-            if self.appear(MyOrochiAssets.I_GU):
-                for i in range(random.randint(2, 4)):
-                    self.click(random.choice(safe_click))
-                    time.sleep(random_delay(0.08, 0.2, decimal=2))
-            if self.appear(MyOrochiAssets.I_ORICHI_END):
-                interval = random_delay(0.1, 0.2, decimal=2)
-                self.ui_click_u_disappear(click=random.choice(safe_click),
-                                          stop=MyOrochiAssets.I_ORICHI_END, interval=interval)
-                return True
-            if self.appear(MyOrochiAssets.I_ORICHI_GLOD):
-                interval = random_delay(0.12, 0.25, decimal=2)
-                self.ui_click_u_disappear(click=random.choice(safe_click),
-                                          stop=MyOrochiAssets.I_ORICHI_GLOD, interval=interval)
-                return True
-            if self.appear(self.I_FALSE):
-                logger.warning('False battle')
-                self.ui_click_until_disappear(self.I_FALSE)
-                return False
-            time.sleep(0.2)
-
-    def in_fight(self):
-        self.screenshot()
-        if self.appear(self.I_EXIT):
-            return True
-        else:
-            return False
-
-    def in_room(self):
-        self.screenshot()
-        if self.appear(MyOrochiAssets.I_IN_ROOM):
-            return True
-        else:
-            return False
-
-
-if __name__ == '__main__':
-    from module.config.config import Config
-    from module.device.device import Device
-
-    config = Config('oas2')
-    device = Device(config)
-    t = ScriptTask(config, device)
-    t.run()

+ 1 - 19
tasks/base_task.py

@@ -496,6 +496,7 @@ class BaseTask(GlobalGameAssets):
         循环的一个操作,直到出现stop
         :param click:
         :param stop:
+        :parm interval
         :return:
         """
         while 1:
@@ -509,25 +510,6 @@ class BaseTask(GlobalGameAssets):
             elif isinstance(click, RuleOcr) and self.ocr_appear_click(click, interval=interval):
                 continue
 
-    def ui_click_u_disappear(self, click, stop, interval=1):
-        """
-        循环的一个操作,直到 stop 消失
-        :param click:
-        :param stop:
-        :param interval:
-        :return:
-        """
-        while 1:
-            self.screenshot()
-            if not self.appear(stop):
-                break
-            if isinstance(click, RuleImage) and self.appear_then_click(click, interval=interval):
-                continue
-            if isinstance(click, RuleClick) and self.click(click, interval=interval):
-                continue
-            elif isinstance(click, RuleOcr) and self.ocr_appear_click(click, interval=interval):
-                continue
-
     def ui_click_until_disappear(self, click):
         """
         点击一个按钮直到消失