فهرست منبع

fix(orochi): the logic of alone battle

runhey 3 سال پیش
والد
کامیت
a6740cea0e

BIN
module/config/i18n/zh_CN.qm


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

@@ -510,4 +510,13 @@ mode_3策略是刷到五个契灵后开始结契,选择高级、中级盘来
 基于先来后到(FIFO)的调度:是会按照下次执行时间进行排序,靠前的先执行
 基于优先级(Priority)的调度:高优先级先于低优先级执行,同优先级按照先来后到顺序</translation></message>	
 </context>	
+<context>
+    <name>Args</name>
+	<message><source>SwitchSoulConfig</source><translation>执行任务前切换御魂</translation></message>	
+	<message><source>Switch Group Team</source><translation>御魂装配分组设置</translation></message>
+	<message><source>switch_group_team_help</source><translation>初始值是不合适的,你需要根据自己的情况设置
+"1,2"表示第一个预设组,第二个队伍
+请使用英文输入法下的逗号
+预设组支持[1-7], 预设队伍支持[1-4]</translation></message>	
+</context>	
 </TS>

+ 3 - 0
module/notify/notify.py

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

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

@@ -1,3 +1,13 @@
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # github https://github.com/runhey
+from pydantic import BaseModel, Field
+from enum import Enum
+from datetime import datetime, time
+
+
+
+class SwitchSoulConfig(BaseModel):
+    enable: bool = Field(default=False)
+    switch_group_team: str = Field(default='-1,-1', description='switch_group_team_help')
+

+ 2 - 2
tasks/Orochi/assets.py

@@ -16,11 +16,11 @@ class OrochiAssets:
 	# 组队 
 	I_FORM_TEAM = RuleImage(roi_front=(937,591,100,100), roi_back=(937,591,100,100), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_form_team.png")
 	# description 
-	I_OROCHI_LOCK = RuleImage(roi_front=(558,562,31,33), roi_back=(558,562,31,33), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_lock.png")
+	I_OROCHI_LOCK = RuleImage(roi_front=(558,562,31,33), roi_back=(558,562,31,33), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_lock.png")
 	# description 
 	I_OROCHI_UNLOCK = RuleImage(roi_front=(560,564,26,29), roi_back=(560,564,26,29), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_unlock.png")
 	# 点击挑战 
-	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_fire.png")
+	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_orochi_fire.png")
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	# description 

+ 2 - 2
tasks/Orochi/o/image.json

@@ -19,7 +19,7 @@
   },
   {
     "itemName": "orochi_lock",
-    "imageName": "o_lock.png",
+    "imageName": "o_orochi_lock.png",
     "roiFront": "558,562,31,33",
     "roiBack": "558,562,31,33",
     "method": "Template matching",
@@ -37,7 +37,7 @@
   },
   {
     "itemName": "orochi_fire",
-    "imageName": "o_fire.png",
+    "imageName": "o_orochi_fire.png",
     "roiFront": "1095,577,131,124",
     "roiBack": "1095,577,131,124",
     "method": "Template matching",

BIN
tasks/Orochi/o/o_matching.png


+ 0 - 0
tasks/Orochi/o/o_fire.png → tasks/Orochi/o/o_orochi_fire.png


+ 0 - 0
tasks/Orochi/o/o_lock.png → tasks/Orochi/o/o_orochi_lock.png


+ 0 - 0
tasks/Orochi/o/o_unlock.png → tasks/Orochi/o/o_orochi_unlock.png


+ 10 - 3
tasks/Orochi/script_task.py

@@ -256,7 +256,14 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         self.check_layer(layer)
         self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
 
+        def is_in_orochi(screenshot=False) -> bool:
+            if screenshot:
+                self.screenshot()
+            return self.appear(self.I_OROCHI_FIRE)
+
         while 1:
+            self.screenshot()
+
             if self.current_count >= self.limit_count:
                 logger.info('Orochi count limit out')
                 break
@@ -264,12 +271,12 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                 logger.info('Orochi time limit out')
                 break
 
+            if not is_in_orochi():
+                continue
+
             # 点击挑战
             while 1:
                 self.screenshot()
-                if not self.appear(self.I_OROCHI_FIRE):
-                    continue
-
                 if self.appear_then_click(self.I_OROCHI_FIRE, interval=1):
                     pass
 

+ 2 - 0
tasks/RealmRaid/config.py

@@ -7,6 +7,7 @@ from enum import Enum
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.Component.config_base import ConfigBase
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 class RaidMode(str, Enum):
     NORMAL = 'retreat_four_attack_nine'
@@ -26,6 +27,7 @@ class RealmRaid(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     raid_config: RaidConfig = Field(default_factory=RaidConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)