script_task.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. from tasks.base_task import BaseTask
  5. from tasks.Component.GeneralBattle.general_battle import GeneralBattle
  6. from tasks.Component.GeneralInvite.general_invite import GeneralInvite
  7. from tasks.Component.GeneralBuff.general_buff import GeneralBuff
  8. from tasks.Component.GeneralRoom.general_room import GeneralRoom
  9. from tasks.GameUi.game_ui import GameUi
  10. from tasks.Orochi.assets import OrochiAssets
  11. from tasks.Orochi.config import Orochi, UserStatus
  12. from module.logger import logger
  13. class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, OrochiAssets):
  14. def run(self) -> bool:
  15. config: Orochi = self.config.orochi
  16. if config.orochi_config.soul_buff_enable:
  17. self.open_buff()
  18. self.soul(is_open=True)
  19. self.close_buff()
  20. match config.orochi_config.user_status:
  21. case UserStatus.LEADER: self.run_leader()
  22. case UserStatus.MEMBER: self.run_member()
  23. case UserStatus.ALONE: self.run_alone()
  24. case UserStatus.WILD: self.run_wild()
  25. case _: logger.error('Unknown user status')
  26. def check_layer(self, layer: str) -> bool:
  27. """
  28. 检查挑战的层数, 并选中挑战的层
  29. :return:
  30. """
  31. pos = self.list_find(self.L_LAYER_LIST, layer)
  32. if pos:
  33. self.device.click(x=pos[0], y=pos[1])
  34. return True
  35. def run_leader(self):
  36. pass
  37. def run_member(self):
  38. pass
  39. def run_alone(self):
  40. pass
  41. def run_wild(self):
  42. logger.error('Wild mode is not implemented')
  43. pass
  44. if __name__ == '__main__':
  45. from module.config.config import Config
  46. from module.device.device import Device
  47. c = Config('oas1')
  48. d = Device(c)
  49. t = ScriptTask(c, d)
  50. t.check_layer('陆')