当前位置: 首页 > news >正文

state

state

from datetime import datetime, timezone
import logging 
logger = logging.getLogger(__name__)class AutoRunTask:def __init__(self):self.map_name = "" self.counting_succeed = Trueself.total_round = 0self.finished_round = 0self.succeed_round = 0#read only, set when task startself.startedAt = datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")self.completedAt = Noneclass GlobalState:def __init__(self):self.current_account = Noneself.fish_target_area_start_x = 0self.fish_target_area_end_x = 0self.fish_cusor_start_x_time = Noneself.fish_cusor_speed = 0self.current_task = Noneself.task_history = []def start_run_task(self, map_name, total_round, counting_succeed=True):task = AutoRunTask()task.map_name = map_nametask.total_round = total_roundtask.counting_succeed = counting_succeedif self.current_task is not None:self.task_history.append(self.current_task)self.current_task = tasklogger.critical(f'Starting [{self.current_account}],total:{total_round},isfinish:{counting_succeed}')#   def refresh_run_task(self, succeed):
#       if self.current_task is None:
#           logger.warning("No current task to refresh")
#           return True
#        
#       logger.error(f'[{self.current_account}],round:{self.current_task.finished_round},success:{self.current_task.succeed_round},total:{self.current_task.total_round}')
#
#       self.current_task.finished_round += 1
#       if succeed:
#           self.current_task.succeed_round += 1
#
#       if self.current_task.finished_round >= self.current_task.total_round:
#           if self.current_task.counting_succeed:
#               if self.current_task.succeed_round < self.current_task.total_round:
#                   self.current_task.completedAt = datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
#                   logger.critical(f'Autorun task completed for account:{self.current_account}, total rounds: {self.current_task.total_round}, successful rounds: {self.current_task.succeed_round}')
#           else:
#               self.current_task.completedAt = datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")
#               logger.critical(f'Autorun task completed for account:{self.current_account}, total rounds: {self.current_task.total_round}, successful rounds: {self.current_task.succeed_round}')
#               return True
#
#       return Falsedef refresh_run_task(self, succeed):if self.current_task is None:logger.warning("No current task to refresh")return Truetask = self.current_taskif task.completedAt is not None:return Truetask.finished_round += 1if succeed:task.succeed_round += 1logger.info(f'[{self.current_account}],'f'round:{task.finished_round},'f'success:{task.succeed_round},'f'total:{task.total_round}')rounds_finished = task.finished_round >= task.total_roundall_succeeded = task.succeed_round >= task.total_roundis_completed = rounds_finished and (all_succeeded if task.counting_succeed else True)if is_completed:task.completedAt = datetime.now(timezone.utc).isoformat(timespec="milliseconds").replace("+00:00", "Z")logger.critical(f'Autorun task completed for account:{self.current_account}, 'f'total rounds: {task.total_round}, 'f'successful rounds: {task.succeed_round}')return is_completed    def check_run_task(self):if self.current_task is None:logger.error("No current task to check")return Falselogger.error(f'[{self.current_account}],round:{self.current_task.finished_round},success:{self.current_task.succeed_round},total:{self.current_task.total_round}')global_state = GlobalState()

 

http://www.jsqmd.com/news/720060/

相关文章:

  • 解锁 RuoYi-Vue-Pro 隐藏功能:手把手教你启用并配置完整的工作流(BPM)模块
  • 5个技巧让你的ThinkPad风扇控制更智能更安静
  • 采购必看:2026高温压力变送器十大品牌综合实力排名,选型必备干货 - 仪表人叶工
  • 如何高效下载B站8K超清视频:哔哩下载姬实用技巧指南
  • 2026年全国沥青筑路设备采购指南:源头厂家对比、避坑秘诀与官方直达渠道 - 企业名录优选推荐
  • 小白也能懂!大模型工具调用能力从何而来?收藏学习路径!
  • 社区团购对账程序,订单,货款,分红上链,团长与用户对账透明,无猫腻。
  • 2026年全国沥青加温设备、乳化沥青生产设备与筑路设备源头厂家完全指南 - 企业名录优选推荐
  • 2026年全国沥青筑路设备采购指南:德州霖垚与山东五大源头厂家深度横评 - 企业名录优选推荐
  • 友达代理P215HAN02.0液晶屏21.5寸LCD显示屏选型
  • 2026越南专线物流全解析:合规、时效与防护的核心标准 - 奔跑123
  • 第48篇:AI模型压缩与加速技术——让模型在移动端“飞”起来(原理解析)
  • 终极指南:3分钟解锁Axure RP中文界面,让原型设计效率翻倍
  • Mem Reduct终极多语言配置指南:简单3步让内存管理工具说你的语言
  • FastAPI 后台任务:BackgroundTasks 的使用场景与注意事项
  • 热门的无纸记录仪哪家好?深度测评十大无纸记录仪品牌 - 仪表人小余
  • AI驱动的黄金需求价值重估模型:价格弹性放大下的1930亿美元新高解析
  • MDX-M3-Viewer:浏览器里直接玩转魔兽争霸和星际争霸3D模型的魔法宝典
  • 从Win95到Win11:那些被遗忘和新增的Windows快捷键,一部键盘操作进化史
  • 【仅限前500名R开发者】:Tidyverse 2.0专属`.Rprofile`性能启动模板(含profvis诊断脚本)
  • 2026年德州沥青筑路设备全矩阵方案对标:从加温罐到撒布车的源头厂家深度评测 - 企业名录优选推荐
  • 实测!微信小程序security.mediaCheckAsync图片检测到底要等多久?附完整云函数+消息推送配置
  • BetterRenderDragon:重塑Minecraft基岩版渲染体验的终极方案
  • nli-MiniLM2-L6-H768零样本分类实战:Python爬虫数据智能标注
  • RH850 中断处理详解
  • 从手动操作到智能革命:pycatia如何实现CATIA设计流程的3大突破
  • 无纸记录仪十大厂家排行榜:技术革新与市场格局深度解析 - 仪表人小余
  • AI出图:如何高效满足日常多维度视觉需求
  • Win11Debloat:Windows 11终极去广告与隐私保护工具完整指南
  • CSMA/CA(载波侦听多路访问/冲突避免)