From a4cb7d5eddeb4a47803284d52be37461e118e44d Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 13 Aug 2025 18:16:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8A=AB=E6=8A=BD=E6=B0=B420%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/point_trade/main.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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)}" )