player.py 961 B

123456789101112131415161718192021222324252627282930313233
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. from time import sleep
  5. from datetime import datetime, time
  6. from random import randint
  7. from module.config.config import Config
  8. from module.team_flow.task import Task
  9. class Player:
  10. def __init__(self, username: str):
  11. self.username = username
  12. self.multi_tasks: dict[str: Task] = {} # 缓存多人任务的列表
  13. def publish_data(self) -> dict:
  14. """
  15. 提取要 发布的数据
  16. :return:
  17. """
  18. result = {}
  19. for name, task in self.multi_tasks.items():
  20. item = {}
  21. if not task.team_task:
  22. continue
  23. item['next_run'] = str(task.next_run)
  24. item['role'] = str(task.role)
  25. item['limit_time'] = str(task.limit_time)
  26. item['limit_count'] = int(task.limit_count)
  27. result[name] = item
  28. return result