costume_test_realm.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. from module.logger import logger
  5. from module.base.timer import Timer
  6. from tasks.KekkaiActivation.script_task import ScriptTask as KekkaiActivationScriptTask
  7. from tasks.Component.Costume.config import RealmType
  8. class ScriptTask(KekkaiActivationScriptTask):
  9. def run(self):
  10. images_count = [[self.I_SHI_GROWN, 0], # 式神育成
  11. [self.I_SHI_CARD, 0], # 结界卡
  12. [self.I_SHI_DEFENSE, 0], # 结界防守
  13. [self.I_REALM_SHIN, 0], # 结界皮肤
  14. # 下面是测试的时候不一定有的, 但是这三个运行一段时间后应该会有
  15. [self.I_CARD_EXP, 0], # 收取经验(没有满的图)
  16. [self.I_BOX_AP, 0], # 收取体力(没有满的图)
  17. [self.I_BOX_EXP, 0], # 收取盒子经验(没有满)
  18. # 下面两个才是很难有
  19. [self.I_BOX_EXP_MAX, 0], # 收取盒子经验(经验满)
  20. [self.I_UTILIZE_EXP, 0], # 收取寄养别人的经验
  21. ]
  22. logger.hr('Costume Test Start')
  23. timer = Timer(5)
  24. timer.start()
  25. while 1:
  26. self.screenshot()
  27. logger.info('Detecting images...')
  28. for i in images_count:
  29. if self.appear(i[0]):
  30. i[1] += 1
  31. # logger.info('Find image %s %d times' % (i[0], i[1]))
  32. if timer.reached():
  33. # 五秒测试结束
  34. logger.info('Five seconds test over')
  35. break
  36. print('--------------------------------------------------------')
  37. print('%-20s %s' % ('Image', 'Count'))
  38. for i in images_count:
  39. print('%-20s %3d times' % (i[0], i[1]))
  40. logger.info('Test Done')
  41. def set_costume(self, costume: RealmType=RealmType.COSTUME_REALM_DEFAULT):
  42. self.config.model.global_game.costume_config.costume_realm_type = costume
  43. self.check_costume()
  44. logger.info('Set costume to %s' % self.config.model.global_game.costume_config.costume_realm_type)
  45. if __name__ == '__main__':
  46. from module.config.config import Config
  47. from module.device.device import Device
  48. c = Config('oas1')
  49. d = Device(c)
  50. t = ScriptTask(c, d)
  51. t.set_costume(RealmType.COSTUME_REALM_DEFAULT)
  52. t.run()