koishi-plugin-ggcevo-game 1.6.76 → 1.6.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +18 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -7835,7 +7835,18 @@ function apply(ctx, config) {
|
|
|
7835
7835
|
await ctx.database.set("ggcevo_sign", { handle: winner.handle }, {
|
|
7836
7836
|
totalRewards: signInfo.totalRewards + prize
|
|
7837
7837
|
});
|
|
7838
|
-
|
|
7838
|
+
const [guessRecord] = await ctx.database.get("ggcevo_guess", {
|
|
7839
|
+
handle: winner.handle,
|
|
7840
|
+
itemId: 1
|
|
7841
|
+
});
|
|
7842
|
+
const currentWins = guessRecord?.wins || 0;
|
|
7843
|
+
await ctx.database.set("ggcevo_guess", {
|
|
7844
|
+
handle: winner.handle,
|
|
7845
|
+
itemId: 1
|
|
7846
|
+
}, {
|
|
7847
|
+
wins: currentWins + 1
|
|
7848
|
+
});
|
|
7849
|
+
winMessages.push(`${winner.name}: 获得${prize}金币(第${currentWins + 1}次猜中)`);
|
|
7839
7850
|
}
|
|
7840
7851
|
}
|
|
7841
7852
|
await ctx.database.set("ggcevo_guess", {
|
|
@@ -7852,7 +7863,7 @@ function apply(ctx, config) {
|
|
|
7852
7863
|
...winMessages.length > 0 ? [
|
|
7853
7864
|
`🎉 猜中新主宰的玩家:`,
|
|
7854
7865
|
...winMessages
|
|
7855
|
-
//
|
|
7866
|
+
// 显示玩家名称、金额和猜中次数
|
|
7856
7867
|
] : []
|
|
7857
7868
|
].join("\n");
|
|
7858
7869
|
await ctx.broadcast(groupIds, broadcastMsg);
|
|
@@ -12767,9 +12778,9 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
12767
12778
|
].join("\n");
|
|
12768
12779
|
}
|
|
12769
12780
|
const parsedItemId = parseInt(itemId);
|
|
12770
|
-
if (isNaN(parsedItemId)) return
|
|
12781
|
+
if (isNaN(parsedItemId)) return '⚠️ 项目ID必须是数字\n使用"竞猜 项目ID 金额 内容"下注';
|
|
12771
12782
|
const targetItem = availableItems.find((item) => item.id === parsedItemId);
|
|
12772
|
-
if (!targetItem) return
|
|
12783
|
+
if (!targetItem) return '⚠️ 无效的项目ID或项目不可用\n使用"竞猜 项目ID 金额 内容"下注';
|
|
12773
12784
|
if (!amount && !guess) {
|
|
12774
12785
|
const [userBet] = await ctx.database.get("ggcevo_guess", {
|
|
12775
12786
|
handle,
|
|
@@ -12786,10 +12797,10 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
12786
12797
|
`您的状态: ${betInfo}`
|
|
12787
12798
|
].join("\n");
|
|
12788
12799
|
}
|
|
12789
|
-
if (!amount) return
|
|
12790
|
-
if (!guess) return
|
|
12800
|
+
if (!amount) return '⚠️ 格式错误,请使用"竞猜 项目ID 金额 内容"下注';
|
|
12801
|
+
if (!guess) return '⚠️ 格式错误,请使用"竞猜 项目ID 金额 内容"下注';
|
|
12791
12802
|
const betAmount = parseInt(amount);
|
|
12792
|
-
if (isNaN(betAmount) || betAmount < 1) return
|
|
12803
|
+
if (isNaN(betAmount) || betAmount < 1) return '⚠️ 参数错误,请使用"竞猜 项目ID 金额 内容"下注';
|
|
12793
12804
|
if (betAmount < targetItem.minBet) {
|
|
12794
12805
|
return `⚠️ 下注金额必须≥${targetItem.minBet}金币 (当前项目最低投注)`;
|
|
12795
12806
|
}
|