|
@@ -44,7 +44,7 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
self.banquet_day_2 = self.get_key_from_value(WEEKDAYDICT, self.run_time.day_2.value)
|
|
self.banquet_day_2 = self.get_key_from_value(WEEKDAYDICT, self.run_time.day_2.value)
|
|
|
self.banquet_day_2_start_time = self.run_time.run_time_2
|
|
self.banquet_day_2_start_time = self.run_time.run_time_2
|
|
|
if not self.check_runtime():
|
|
if not self.check_runtime():
|
|
|
- # 如果不是宴会日则设置下次运行时间
|
|
|
|
|
|
|
+ # 超过10点则设置下次运行时间
|
|
|
self.plan_next_run()
|
|
self.plan_next_run()
|
|
|
raise TaskEnd
|
|
raise TaskEnd
|
|
|
|
|
|
|
@@ -67,6 +67,7 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
raise TaskEnd
|
|
raise TaskEnd
|
|
|
|
|
|
|
|
last_check_time = 0 # 记录上次实际检测时间
|
|
last_check_time = 0 # 记录上次实际检测时间
|
|
|
|
|
+ last_log_time = 0 # 记录上次日志输出时间
|
|
|
last_flag_status = False # 记录上次真实检测结果
|
|
last_flag_status = False # 记录上次真实检测结果
|
|
|
|
|
|
|
|
while True:
|
|
while True:
|
|
@@ -79,13 +80,19 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
last_flag_status = actual_status
|
|
last_flag_status = actual_status
|
|
|
last_check_time = current_time
|
|
last_check_time = current_time
|
|
|
logger.debug(f"Actual detection at {current_time}, status: {actual_status}")
|
|
logger.debug(f"Actual detection at {current_time}, status: {actual_status}")
|
|
|
|
|
+
|
|
|
|
|
+ # 重置日志计时器
|
|
|
|
|
+ last_log_time = current_time
|
|
|
else:
|
|
else:
|
|
|
# 未达间隔时沿用上次结果
|
|
# 未达间隔时沿用上次结果
|
|
|
logger.debug(f"Using cached status: {last_flag_status}")
|
|
logger.debug(f"Using cached status: {last_flag_status}")
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
# 条件2: 状态判断逻辑
|
|
# 条件2: 状态判断逻辑
|
|
|
if last_flag_status:
|
|
if last_flag_status:
|
|
|
- logger.info("Banquet ongoing, waiting...")
|
|
|
|
|
|
|
+ if current_time - last_log_time >= 10:
|
|
|
|
|
+ logger.info("Banquet ongoing, waiting...")
|
|
|
|
|
+ last_log_time = current_time
|
|
|
else:
|
|
else:
|
|
|
logger.info("Guild banquet end")
|
|
logger.info("Guild banquet end")
|
|
|
break # 退出循环
|
|
break # 退出循环
|
|
@@ -97,7 +104,7 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
logger.info('Guild banquet timeout')
|
|
logger.info('Guild banquet timeout')
|
|
|
break
|
|
break
|
|
|
wait_count += 1
|
|
wait_count += 1
|
|
|
- logger.warning('Banquet ongoing, waiting...')
|
|
|
|
|
|
|
+ logger.info(f'Banquet ongoing, waiting... (Count: {wait_count})')
|
|
|
self.device.stuck_record_clear()
|
|
self.device.stuck_record_clear()
|
|
|
self.device.stuck_record_add('BATTLE_STATUS_S')
|
|
self.device.stuck_record_add('BATTLE_STATUS_S')
|
|
|
self.device.stuck_record_clear()
|
|
self.device.stuck_record_clear()
|
|
@@ -109,16 +116,11 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
|
|
|
|
|
def check_runtime(self) -> bool:
|
|
def check_runtime(self) -> bool:
|
|
|
"""
|
|
"""
|
|
|
- 检查日期和时间, 是否是宴会日
|
|
|
|
|
|
|
+ 检查时间, 一般寮不会晚上10点再开吧。。。。。
|
|
|
"""
|
|
"""
|
|
|
- now = datetime.now()
|
|
|
|
|
- day_of_week = now.weekday()
|
|
|
|
|
- # 判断当前日期是否是寮宴会日
|
|
|
|
|
- if day_of_week in [self.banquet_day_1, self.banquet_day_2]:
|
|
|
|
|
- return True
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
# 如果当日时间超过22点,说明配置时间可能出错,设置下次失败运行时间
|
|
# 如果当日时间超过22点,说明配置时间可能出错,设置下次失败运行时间
|
|
|
- if datetime.now().hour < 22:
|
|
|
|
|
|
|
+ if datetime.now().hour >= 22:
|
|
|
self.set_next_run(task="GuildBanquet", success=False)
|
|
self.set_next_run(task="GuildBanquet", success=False)
|
|
|
logger.error("Guild banquet time config error, set next run fail")
|
|
logger.error("Guild banquet time config error, set next run fail")
|
|
|
return False
|
|
return False
|
|
@@ -159,7 +161,7 @@ class ScriptTask(GameUi, GuildBanquetAssets):
|
|
|
if today == self.banquet_day_1:
|
|
if today == self.banquet_day_1:
|
|
|
self.run_time.run_time_1 = next_time
|
|
self.run_time.run_time_1 = next_time
|
|
|
elif today == self.banquet_day_2:
|
|
elif today == self.banquet_day_2:
|
|
|
- self.run_time.run_time_1 = next_time
|
|
|
|
|
|
|
+ self.run_time.run_time_2 = next_time
|
|
|
elif today < self.banquet_day_1:
|
|
elif today < self.banquet_day_1:
|
|
|
self.run_time.day_1 = self.get_weekday_enum(WEEKDAYDICT.get(today))
|
|
self.run_time.day_1 = self.get_weekday_enum(WEEKDAYDICT.get(today))
|
|
|
self.run_time.run_time_1 = next_time
|
|
self.run_time.run_time_1 = next_time
|