添加打劫保释功能
- 打劫失败后自动关押24小时 - 其他人可以使用"保释 @用户"命令花费30积分保释 - 在押期间无法进行打劫 - 保释后立即释放 - 所有记录都会保存在数据库中
This commit is contained in:
@@ -444,6 +444,15 @@ class PointTradePlugin(MessagePluginInterface):
|
|||||||
wcf.send_text("❌打劫功能仅在群聊中可用!", sender, "")
|
wcf.send_text("❌打劫功能仅在群聊中可用!", sender, "")
|
||||||
return True, "非群聊环境"
|
return True, "非群聊环境"
|
||||||
|
|
||||||
|
# 检查是否在押
|
||||||
|
prison_status = self.points_db.check_prison_status(sender, roomid)
|
||||||
|
if prison_status:
|
||||||
|
remaining_time = prison_status['end_time'] - datetime.now()
|
||||||
|
hours = int(remaining_time.total_seconds() / 3600)
|
||||||
|
minutes = int((remaining_time.total_seconds() % 3600) / 60)
|
||||||
|
wcf.send_text(f"❌你正在服刑!\n剩余时间: {hours}小时{minutes}分钟\n可请求他人花费30积分保释。", roomid, sender)
|
||||||
|
return True, "在押状态"
|
||||||
|
|
||||||
# 检查冷却时间
|
# 检查冷却时间
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
if sender in self.rob_cooldown_records:
|
if sender in self.rob_cooldown_records:
|
||||||
@@ -555,14 +564,6 @@ class PointTradePlugin(MessagePluginInterface):
|
|||||||
wcf.send_text(f"❌打劫过程中出现问题:{result.get('error', '未知错误')}", roomid, sender)
|
wcf.send_text(f"❌打劫过程中出现问题:{result.get('error', '未知错误')}", roomid, sender)
|
||||||
return True, "打劫失败"
|
return True, "打劫失败"
|
||||||
else:
|
else:
|
||||||
# 检查是否在押
|
|
||||||
prison_status = self.points_db.check_prison_status(sender, roomid)
|
|
||||||
if prison_status:
|
|
||||||
remaining_time = prison_status['end_time'] - datetime.now()
|
|
||||||
hours = int(remaining_time.total_seconds() / 3600)
|
|
||||||
minutes = int((remaining_time.total_seconds() % 3600) / 60)
|
|
||||||
wcf.send_text(f"❌你正在服刑!\n剩余时间: {hours}小时{minutes}分钟\n可请求他人花费30积分保释。", roomid, sender)
|
|
||||||
return True, "在押状态"
|
|
||||||
|
|
||||||
# 打劫失败处理
|
# 打劫失败处理
|
||||||
penalty_amount = int(robber_total * self.rob_penalty_percent)
|
penalty_amount = int(robber_total * self.rob_penalty_percent)
|
||||||
|
|||||||
Reference in New Issue
Block a user