koishi-plugin-ggcevo-game 0.4.1 → 0.4.2
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 +15 -11
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -580,7 +580,7 @@ ${itemDetails.join("\n")}`;
|
|
|
580
580
|
});
|
|
581
581
|
ctx.command("ggcevo/领取福利").alias("领取奖励").action(async (argv) => {
|
|
582
582
|
const session = argv.session;
|
|
583
|
-
await session.send("请在30
|
|
583
|
+
await session.send("请在30秒内输入活动名称:");
|
|
584
584
|
const name2 = await session.prompt(3e4);
|
|
585
585
|
if (!name2) {
|
|
586
586
|
return "输入超时,请重新输入指令。";
|
|
@@ -601,7 +601,7 @@ ${itemDetails.join("\n")}`;
|
|
|
601
601
|
// 新增状态条件
|
|
602
602
|
});
|
|
603
603
|
if (!activity) {
|
|
604
|
-
return "
|
|
604
|
+
return "当前活动未在进行中,请检查输入 咕咕币活动 查看正在进行中的活动。";
|
|
605
605
|
}
|
|
606
606
|
const id = activity.id;
|
|
607
607
|
const quantity = activity.quantity;
|
|
@@ -913,18 +913,22 @@ ID:${activity.id}
|
|
|
913
913
|
------------------------------`;
|
|
914
914
|
}
|
|
915
915
|
});
|
|
916
|
-
ctx.command("ggcevo
|
|
916
|
+
ctx.command("ggcevo/给予 <handle> <itemId:number> <amount:number>", "增加指定用户的物品", { authority: 3 }).action(async (_, handle, itemId, amount) => {
|
|
917
917
|
try {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
return "该用户不存在";
|
|
918
|
+
if (!handle || !itemId || !amount) {
|
|
919
|
+
return `请输入正确的指令格式`;
|
|
921
920
|
}
|
|
921
|
+
const itemIdToNameMap = Object.fromEntries(
|
|
922
|
+
Object.entries(initDefaultItems).map(([name2, item]) => [item.id, name2])
|
|
923
|
+
);
|
|
924
|
+
const itemName = itemIdToNameMap[itemId];
|
|
925
|
+
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId });
|
|
922
926
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
923
927
|
handle,
|
|
924
|
-
itemId
|
|
928
|
+
itemId,
|
|
925
929
|
quantity: (backpack?.quantity || 0) + amount
|
|
926
|
-
}]);
|
|
927
|
-
return `成功为 ${handle} 增加 ${amount}
|
|
930
|
+
}], ["handle", "itemId"]);
|
|
931
|
+
return `成功为 ${handle} 增加 ${amount} 个${itemName}!`;
|
|
928
932
|
} catch (err) {
|
|
929
933
|
console.error("数据库操作失败:", err);
|
|
930
934
|
return "操作失败,请稍后再试";
|
|
@@ -995,9 +999,9 @@ ID:${activity.id}
|
|
|
995
999
|
"小黄鸭": { quality: "t3", type: "宠物", cost: 3, quantity: 5 },
|
|
996
1000
|
"萌萌熊": { quality: "t2", type: "宠物", cost: 4, quantity: 3 },
|
|
997
1001
|
"荆棘蜥蜴": { quality: "t2", type: "宠物", cost: 4, quantity: 3 },
|
|
998
|
-
"
|
|
1002
|
+
"萌宠小狗": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
|
|
999
1003
|
"熔岩蟹": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
|
|
1000
|
-
"
|
|
1004
|
+
"尸甲虫": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
|
|
1001
1005
|
"绿毛虫": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
|
|
1002
1006
|
"妙蛙种子": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
|
|
1003
1007
|
"皮卡丘": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
|