script_task.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. from cached_property import cached_property
  5. from tasks.GameUi.game_ui import GameUi
  6. from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
  7. from module.logger import logger
  8. from module.exception import TaskEnd
  9. from time import sleep
  10. from datetime import time, datetime, timedelta
  11. from tasks.Sougenbi.assets import SougenbiAssets
  12. from tasks.Sougenbi.config import SougenbiConfig, SougenbiClass
  13. from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
  14. from tasks.GameUi.game_ui import GameUi
  15. from tasks.GameUi.page import page_main, page_six_gates
  16. from tasks.SixRealms.moon_sea.moon_sea import MoonSea
  17. from module.logger import logger
  18. class ScriptTask(GameUi, SwitchSoul, MoonSea):
  19. @property
  20. def _config(self):
  21. return self.config.model.six_realms
  22. def run(self):
  23. if self._config.switch_soul_config.enable:
  24. self.ui_get_current_page()
  25. self.ui_goto(page_shikigami_records)
  26. self.run_switch_soul(self._config.switch_soul_config.switch_group_team)
  27. if self._config.switch_soul_config.enable_switch_by_name:
  28. self.ui_get_current_page()
  29. self.ui_goto(page_shikigami_records)
  30. self.run_switch_soul_by_name(
  31. self._config.switch_soul_config.group_name,
  32. self._config.switch_soul_config.team_name
  33. )
  34. self.ui_get_current_page()
  35. self.ui_goto(page_six_gates)
  36. self.run_moon_sea()
  37. # 退出六道
  38. while 1:
  39. self.screenshot()
  40. if self.appear(self.I_CHECK_EXPLORATION) or self.appear(self.I_CHECK_MAIN):
  41. break
  42. if self.appear_then_click(self.I_BACK_EXIT, interval=2):
  43. continue
  44. self.set_next_run('SixRealms', success=True, finish=True)
  45. raise TaskEnd
  46. def run_moon_sea(self):
  47. self._run_moon_sea()
  48. self.ui_click(self.I_BACK_EXIT, self.I_CHECK_SIX_GATES)
  49. if __name__ == '__main__':
  50. from module.config.config import Config
  51. from module.device.device import Device
  52. c = Config('oas1')
  53. d = Device(c)
  54. t = ScriptTask(c, d)
  55. t.screenshot()
  56. t.run()