解小黑屋 现实性平衡调整

This commit is contained in:
Kohaku 2025-02-14 14:43:01 +08:00
parent 25ba03e9fb
commit fd46fbb123

View File

@ -27,18 +27,15 @@ def getMaimaiUNIXTime(mmddhhmmss, year=2025):
解析用户输入的 MMDDHHMMSS 格式的时间返回 Unix 时间戳 解析用户输入的 MMDDHHMMSS 格式的时间返回 Unix 时间戳
时间会被推后一个小时因为舞萌貌似是 UTC+9 时间会被推后一个小时因为舞萌貌似是 UTC+9
""" """
try: #date_time_str = f"{year}{mmddhhmmss}"
#date_time_str = f"{year}{mmddhhmmss}" # 舞萌需要把小时按往后推一个小时来计算,加上一个小时
# 舞萌需要把小时按往后推一个小时来计算,加上一个小时 date_time_str = f"{year}{mmddhhmmss[:4]}{int(mmddhhmmss[4:6])+1:02}{mmddhhmmss[6:]}"
date_time_str = f"{year}{mmddhhmmss[:4]}{int(mmddhhmmss[4:6])+1:02}{mmddhhmmss[6:]}" date_time_obj = datetime.strptime(date_time_str, '%Y%m%d%H%M%S')
date_time_obj = datetime.strptime(date_time_str, '%Y%m%d%H%M%S') # 将 datetime 对象转换为 Unix 时间戳
# 将 datetime 对象转换为 Unix 时间戳 unix_timestamp = int(time.mktime(date_time_obj.timetuple()))
unix_timestamp = int(time.mktime(date_time_obj.timetuple())) logger.info(f"转换出了时间戳: {unix_timestamp}")
logger.info(f"转换出了时间戳: {unix_timestamp}") return unix_timestamp
return unix_timestamp
except ValueError as e:
print(f"时间格式错误: {e}")
return None
def logOut(userId, Timestamp): def logOut(userId, Timestamp):
"""极其简单的登出实现,成功返回 True失败返回 False """极其简单的登出实现,成功返回 True失败返回 False
@ -64,7 +61,7 @@ def isCorrectTimestamp(timestamp, userId):
logger.debug(f"时间戳 {timestamp} 是否正确: {isLoggedOut}") logger.debug(f"时间戳 {timestamp} 是否正确: {isLoggedOut}")
return isLoggedOut return isLoggedOut
def findCorrectTimestamp(timestamp, userId, max_attempts=1200): def findCorrectTimestamp(timestamp, userId, max_attempts=600):
# 初始化偏移量 # 初始化偏移量
offset = 1 offset = 1
attempts = 0 attempts = 0