runhey 3 лет назад
Родитель
Сommit
65b869a382

+ 1 - 1
module/config/config_manual.py

@@ -10,7 +10,7 @@ class ConfigManual:
     SCHEDULER_PRIORITY = """
         Restart
         >KekkaiUtilize > KekkaiActivation > DemonEncounter
-        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa > DailyTrifles > Exploration
+        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > Tako > RealmRaid > RyouToppa > DailyTrifles > Exploration
         > Hunt 
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami > WantedQuests

+ 2 - 1
module/config/config_menu.py

@@ -21,7 +21,8 @@ class ConfigMenu:
         self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea']
         # 日常的任务
         self.menu["Daily Task"] = ['DailyTrifles', 'AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian',
-                                   'TalismanPass', 'DemonEncounter', 'Pets', 'SoulsTidy', 'Delegation', 'WantedQuests']
+                                   'TalismanPass', 'DemonEncounter', 'Pets', 'SoulsTidy', 'Delegation', 'WantedQuests',
+                                   'Tako']
         # 很肝的任务
         self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland', 'EvoZone', 'GoryouRealm', 'Exploration']
         # 阴阳寮

+ 2 - 0
module/config/config_model.py

@@ -30,6 +30,7 @@ from tasks.Pets.config import Pets
 from tasks.SoulsTidy.config import SoulsTidy
 from tasks.Delegation.config import Delegation
 from tasks.WantedQuests.config import WantedQuests
+from tasks.Tako.config import Tako
 # ----------------------------------------------------------------------------------------------------------------------
 from tasks.Orochi.config import Orochi
 from tasks.OrochiMoans.config import OrochiMoans
@@ -82,6 +83,7 @@ class ConfigModel(ConfigBase):
     delegation: Delegation = Field(default_factory=Delegation)
     exploration: Exploration = Field(default_factory=Exploration)
     wanted_quests: WantedQuests = Field(default_factory=WantedQuests)
+    tako: Tako = Field(default_factory=Tako)
 
     # 这些是刷御魂的
     orochi: Orochi = Field(default_factory=Orochi)

BIN
module/config/i18n/zh_CN.qm


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

@@ -729,5 +729,6 @@ Refresh:直接刷新,如果刷新操作进入CD,将标记为失败并退
 	<message><source>before_end_help</source><translation>默认'00:00:00'表示不使用这个功能,不可取负值,建议最后一小时才执行悬赏'01:00:00'</translation></message>
 	<message><source>Time Of Mystery</source><translation>强制设定出现神秘商店当天的执行时间</translation></message>
 	<message><source>time_of_mystery_help</source><translation>限定[00:00:01-23:30:00],这将使你无视掉调度器的Interval。保持默认'00:00:00'表示不使用</translation></message>
+	<message><source>TakoConfig</source><translation>石距加成</translation></message>
 </context>
 </TS>

+ 1 - 1
tasks/Component/GeneralRoom/assets.py

@@ -13,7 +13,7 @@ class GeneralRoomAssets:
 	# List Rule Assets
 	# description 
 	L_TEAM_LIST = RuleList(folder="./tasks/Component/GeneralRoom", direction="vertical", mode="ocr", roi_back=(26,106,360,549), size=(216, 61), 
-					 array=["全部", "探索(困难)", "觉醒业火轮", "觉醒风转符", "觉醒火灵鲤", "觉醒天雷鼓", "御魂", "日轮之陨", "永生之海", "妖气封印", "经验妖怪", "金币妖怪", "年兽", "石距", "愤怒的石距", "结界突破", "真·八岐大蛇", "对弈社", "斗町", "连携召唤", "契灵之境"])
+					 array=["全部", "探索(困难)", "觉醒业火轮", "觉醒风转符", "觉醒火灵鲤", "觉醒天雷鼓", "御魂", "日轮之陨", "永生之海", "妖气封印", "经验妖怪", "金币妖怪", "年兽", "石距", "愤怒的石距", "喷怒的石距", "结界突破", "真·八岐大蛇", "对弈社", "斗町", "连携召唤", "契灵之境"])
 
 
 	# Ocr Rule Assets

+ 2 - 1
tasks/Component/GeneralRoom/general_room.py

@@ -123,7 +123,8 @@ class GeneralRoom(BaseTask, GeneralRoomAssets):
         pos = self.list_find(self.L_TEAM_LIST, name)
         if not pos:
             return False
-
+        if name == '愤怒的石距' or name == '喷怒的石距':
+            name = '价悠的石距'
         self.O_GR_ZONES_NAME.keyword = name
         click_timer = Timer(1.1)
         click_timer.start()

+ 4 - 0
tasks/Component/GeneralRoom/list.json

@@ -65,6 +65,10 @@
       "itemName": "愤怒的石距",
       "roiFront": "143,230,214,60"
     },
+    {
+      "itemName": "喷怒的石距",
+      "roiFront": "143,230,214,60"
+    },
     {
       "itemName": "结界突破",
       "roiFront": "147,230,215,63"

+ 12 - 0
tasks/Tako/assets.py

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

+ 23 - 0
tasks/Tako/config.py

@@ -0,0 +1,23 @@
+# 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
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
+
+class TakoConfig(BaseModel):
+    enable: bool = Field(default=False)
+    buff_gold_50_click: bool = Field(default=False)
+    buff_gold_100_click: bool = Field(default=False)
+    buff_exp_50_click: bool = Field(default=False)
+    buff_exp_100_click: bool = Field(default=False)
+
+
+class Tako(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    tako_config: TakoConfig = Field(default_factory=TakoConfig)
+    switch_soul: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 141 - 0
tasks/Tako/script_task.py

@@ -0,0 +1,141 @@
+# 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 module.logger import logger
+from module.exception import TaskEnd
+from module.base.timer import Timer
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main, page_team, page_shikigami_records
+from tasks.Component.GeneralBattle.general_battle import GeneralBattle
+from tasks.Component.GeneralRoom.general_room import GeneralRoom
+from tasks.Component.GeneralInvite.general_invite import GeneralInvite
+from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
+
+
+class ScriptTask(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, SwitchSoul):
+
+    def run(self):
+        conf = self.config.tako
+        if conf.switch_soul.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(conf.switch_soul.switch_group_team)
+
+        if conf.switch_soul.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(conf.switch_soul.group_name,
+                                         conf.switch_soul.team_name)
+        # 加成
+        conf_buff = conf.tako_config
+        if conf_buff.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            self.open_buff()
+            if conf_buff.buff_gold_50_click:
+                self.gold_50()
+            if conf_buff.buff_gold_100_click:
+                self.gold_100()
+            if conf_buff.buff_exp_50_click:
+                self.exp_50()
+            if conf_buff.buff_exp_100_click:
+                self.exp_100()
+            self.close_buff()
+
+        # 进入
+        self.ui_get_current_page()
+        self.ui_goto(page_team)
+        if 5 <= self.start_time.weekday() <= 6:
+            # 周末
+            self.check_zones('喷怒的石距')
+        else:
+            self.check_zones('石距')
+        if not self.create_room():
+            self.exit_task()
+        self.ensure_public()
+        self.create_ensure()
+        # 进入到了房间里面
+        wait_timer = Timer(60)
+        wait_timer.start()
+        while 1:
+            self.screenshot()
+
+            if not self.is_in_room():
+                continue
+            if wait_timer.reached():
+                logger.warning('Wait for too long, exit')
+                self.exit_room()
+                break
+            if not self.appear(self.I_ADD_1):
+                # 有人进来了,可以进行挑战
+                logger.info('There is someone in the room and start the challenge')
+                self.click_fire()
+                self.run_general_battle()
+                break
+        self.exit_task()
+
+    def exit_task(self):
+        """
+        退出任务
+        :return:
+        """
+        conf_buff = self.config.tako.tako_config
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+        if conf_buff.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            self.open_buff()
+            if conf_buff.buff_gold_50_click:
+                self.gold_50(False)
+            if conf_buff.buff_gold_100_click:
+                self.gold_100(False)
+            if conf_buff.buff_exp_50_click:
+                self.exp_50(False)
+            if conf_buff.buff_exp_100_click:
+                self.exp_100(False)
+            self.close_buff()
+
+        self.set_next_run(task='Tako', success=True, finish=False)
+        raise TaskEnd('Tako')
+
+    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(self.I_WIN) or self.appear(self.I_REWARD):
+                logger.info('Win battle')
+                self.ui_click_until_disappear(self.I_WIN)
+                while 1:
+                    self.screenshot()
+                    if self.appear(self.I_CHECK_MAIN) or self.appear(self.I_CHECK_TEAM):
+                        break
+                    if self.click(self.C_REWARD_2, interval=2):
+                        continue
+                return True
+
+            if self.appear(self.I_FALSE):
+                logger.warning('False battle')
+                self.ui_click_until_disappear(self.I_FALSE)
+                return False
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+    t.screenshot()
+
+    t.run()
+
+
+