post_diagnotor.py 775 B

123456789101112131415161718192021222324
  1. import numpy as np
  2. from enum import Enum
  3. from module.logger import logger
  4. from module.exception import *
  5. from module.atom.image import RuleImage
  6. from tasks.GlobalGame.assets import GlobalGameAssets
  7. from tasks.SoulsTidy.assets import SoulsTidyAssets
  8. class AnalyzeType(str, Enum):
  9. NONE = "none"
  10. SoulOverflow = "soul_overflow"
  11. class PostDiagnotor(GlobalGameAssets, SoulsTidyAssets):
  12. def handle(self, e: Exception, command: str, image: np.ndarray) -> AnalyzeType:
  13. if self.I_ST_SOUL_OVERFLOW.match(image) and \
  14. (self.I_UI_CONFIRM_SAMLL.match(image) or self.I_UI_GOTIT_SMALL.match(image)):
  15. logger.warning(f"Detect soul overflow, command: {command}")
  16. return AnalyzeType.SoulOverflow
  17. return AnalyzeType.NONE