diff --git a/plugins/point_trade/main.py b/plugins/point_trade/main.py index 77e84ac..2d393d9 100644 --- a/plugins/point_trade/main.py +++ b/plugins/point_trade/main.py @@ -634,13 +634,26 @@ class PointTradePlugin(MessagePluginInterface): # 确保至少抢到1点积分 rob_amount = max(1, rob_amount) - # 执行积分转移 + # 计算抽水金额(20%) + tax_amount = int(rob_amount * 0.2) + # 确保至少抽水1点积分 + tax_amount = max(1, tax_amount) + # 实际获得的积分 + actual_rob_amount = rob_amount - tax_amount + + # 执行积分转移(从目标到打劫者) success, result = self.points_db.transfer_points( target_wxid, robber_wxid, roomid, - rob_amount, f"被{robber_name}打劫" + actual_rob_amount, f"被{robber_name}打劫" ) - if success: + # 执行抽水(从目标到SYSTEM) + tax_success, tax_result = self.points_db.transfer_points( + target_wxid, "SYSTEM", roomid, + tax_amount, f"打劫抽水" + ) + + if success and tax_success: # 获取转账后的积分信息 from_user = result.get("from_user", {}) to_user = result.get("to_user", {}) @@ -649,6 +662,7 @@ class PointTradePlugin(MessagePluginInterface): output = ( f"🔫 打劫成功!\n" f"👤{robber_name} 成功打劫了 👤{target_name} {rob_amount} 积分!\n" + f"💰 实际获得: {actual_rob_amount} 积分 | 系统抽水: {tax_amount} 积分(20%)\n" f"👤{robber_name} 当前积分: {to_user.get('total_points', 0)}\n" f"👤{target_name} 当前积分: {from_user.get('total_points', 0)}" )