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

fix(GoryouRealm): 移除副本的星期限制和日期检查逻辑

副本已支持全天开放,不再需要按星期几切换式神或周一退出。
yuyuyuyuyu 6 месяцев назад
Родитель
Сommit
0b40417048
1 измененных файлов с 9 добавлено и 41 удалено
  1. 9 41
      tasks/GoryouRealm/script_task.py

+ 9 - 41
tasks/GoryouRealm/script_task.py

@@ -1,19 +1,16 @@
 # 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 random import randint
-
-from module.logger import logger
+from datetime import datetime, timedelta
 from module.exception import TaskEnd
-
+from module.logger import logger
+from random import choice
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_main, page_shikigami_records, page_goryou_realm
-from tasks.GoryouRealm.config import GoryouClass
+from tasks.GameUi.page import page_shikigami_records, page_goryou_realm
 from tasks.GoryouRealm.assets import GoryouRealmAssets
+from tasks.GoryouRealm.config import GoryouClass
 
 
 class ScriptTask(GeneralBattle, GameUi, SwitchSoul, GoryouRealmAssets):
@@ -36,12 +33,15 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, GoryouRealmAssets):
             GoryouClass.Dark_Black_Panther: self.C_GR_C_3,
             GoryouClass.Dark_Peacock: self.C_GR_C_4,
         }
+        goryou_class = con.goryou_config.goryou_class
+        if goryou_class == GoryouClass.RANDOM:
+            goryou_class = choice(list(match_click.keys()))
         while 1:
             self.screenshot()
             if self.appear(self.I_GR_FIRE):
                 logger.info('Enter GoryouRealm')
                 break
-            if self.click(match_click[self.check_date(con.goryou_config.goryou_class)], interval=1):
+            if self.click(match_click[goryou_class], interval=1):
                 continue
         self.check_lock(con.general_battle_config.lock_team_enable, self.I_GR_LOCK, self.I_GR_UNLOCK)
 
@@ -77,38 +77,6 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, GoryouRealmAssets):
         raise TaskEnd
 
 
-    def check_date(self, goryou_class: GoryouClass = GoryouClass.RANDOM) -> GoryouClass:
-        day_of_week = self.start_time.weekday()
-        if day_of_week == 0:
-            # 周一不开放,退出
-            logger.warning('Today is Monday and GoryouRealm is not open')
-            self.set_next_run(task='GoryouRealm', success=False, finish=True)
-            raise TaskEnd('GoryouRealm')
-
-        match_day = {
-            GoryouClass.RANDOM: [1, 2, 3, 4, 5, 6],
-            GoryouClass.Dark_Divine_Dragon: [1, 5, 6],
-            GoryouClass.Dark_Hakuzousu: [2, 5, 6],
-            GoryouClass.Dark_Black_Panther: [3, 5, 6],
-            GoryouClass.Dark_Peacock: [4, 5, 6],
-        }
-        match_class = {
-            1: GoryouClass.Dark_Divine_Dragon,
-            2: GoryouClass.Dark_Hakuzousu,
-            3: GoryouClass.Dark_Black_Panther,
-            4: GoryouClass.Dark_Peacock,
-        }
-        if goryou_class == GoryouClass.RANDOM:
-            random_num = randint(1, 4)
-            goryou_class = match_class[random_num]
-        if day_of_week not in match_day[goryou_class]:
-            logger.warning(f'Today is {day_of_week} that do not support {goryou_class.name}')
-            logger.info(f'OAS will run {match_class[day_of_week].name} instead')
-            goryou_class = match_class[day_of_week]
-
-
-        return goryou_class
-
 
 
 if __name__ == '__main__':