koishi-plugin-ggcevo-game 1.3.55 → 1.3.57
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 +53 -66
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -491,7 +491,7 @@ function apply(ctx, config) {
|
|
|
491
491
|
description: "一个小型辛迪加机器人,可以破坏电子银行账户",
|
|
492
492
|
price: 0,
|
|
493
493
|
redCrystalCost: 60,
|
|
494
|
-
effects: "
|
|
494
|
+
effects: "此物品存放于仓库自动生效(阵营必须为辛迪加海盗)。每日签到金币奖励+50%,每拥有100金币,增加1%(至多增加100%)"
|
|
495
495
|
},
|
|
496
496
|
"脉冲手雷": {
|
|
497
497
|
id: 4,
|
|
@@ -507,7 +507,7 @@ function apply(ctx, config) {
|
|
|
507
507
|
description: "这是一款未来派音乐设备",
|
|
508
508
|
price: 0,
|
|
509
509
|
redCrystalCost: 10,
|
|
510
|
-
effects: "
|
|
510
|
+
effects: "此物品存放于仓库自动生效(阵营必须为辛迪加海盗)。主动发起的PK对战结果为失败时上交给对方的金币-50%"
|
|
511
511
|
}
|
|
512
512
|
};
|
|
513
513
|
const modConfig = {
|
|
@@ -991,7 +991,7 @@ function apply(ctx, config) {
|
|
|
991
991
|
},
|
|
992
992
|
{
|
|
993
993
|
professionName: "辛迪加财务经理",
|
|
994
|
-
effect: "每日签到能额外获得红晶;
|
|
994
|
+
effect: "每日签到能额外获得红晶; 主动发起的PK对战结果为胜利时,额外奖励1红晶",
|
|
995
995
|
requirements: "当月累计签到14天及以上",
|
|
996
996
|
Jobtransfer: true,
|
|
997
997
|
costcoins: 0,
|
|
@@ -999,7 +999,7 @@ function apply(ctx, config) {
|
|
|
999
999
|
},
|
|
1000
1000
|
{
|
|
1001
1001
|
professionName: "计算机专家",
|
|
1002
|
-
effect: "黑市订购设备工具类物品享有50%折扣;
|
|
1002
|
+
effect: "黑市订购设备工具类物品享有50%折扣; 被动应对的PK对战结果为失败时,不会损失金币",
|
|
1003
1003
|
requirements: "仓库中拥有一个黑市订购的设备工具类物品",
|
|
1004
1004
|
Jobtransfer: true,
|
|
1005
1005
|
costcoins: 0,
|
|
@@ -2845,7 +2845,7 @@ function apply(ctx, config) {
|
|
|
2845
2845
|
if (itemConfig2.id === 3 || itemConfig2.id === 5) {
|
|
2846
2846
|
return {
|
|
2847
2847
|
success: false,
|
|
2848
|
-
message:
|
|
2848
|
+
message: `此物品无法使用。`
|
|
2849
2849
|
};
|
|
2850
2850
|
}
|
|
2851
2851
|
if (itemConfig2.id === 4) {
|
|
@@ -4489,14 +4489,10 @@ ${items.join("、")}
|
|
|
4489
4489
|
const initiatorHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4490
4490
|
const targetHandle = `${targetprofile.regionId}-S2-${targetprofile.realmId}-${targetprofile.profileId}`;
|
|
4491
4491
|
if (initiatorHandle === targetHandle) return "抱歉,您不能挑战自己。";
|
|
4492
|
-
const [initiatorData, targetData] = await Promise.all([
|
|
4493
|
-
ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
|
|
4494
|
-
ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
|
|
4495
|
-
]);
|
|
4496
4492
|
const initiatorPower = await calculateTotalPower(initiatorHandle);
|
|
4497
4493
|
const targetPower = await calculateTotalPower(targetHandle);
|
|
4498
|
-
const initiatorRankname =
|
|
4499
|
-
const targetRankname =
|
|
4494
|
+
const initiatorRankname = session.username;
|
|
4495
|
+
const targetRankname = targetUsername.nick || targetUsername.name;
|
|
4500
4496
|
const [initiatorCareer] = await ctx.database.get("ggcevo_careers", {
|
|
4501
4497
|
handle: initiatorHandle
|
|
4502
4498
|
});
|
|
@@ -4513,65 +4509,60 @@ ${items.join("、")}
|
|
|
4513
4509
|
if (targetCareer.group === "人类联盟") {
|
|
4514
4510
|
let joinDate;
|
|
4515
4511
|
if (typeof targetCareer.date === "string") {
|
|
4516
|
-
joinDate =
|
|
4512
|
+
joinDate = new Date(targetCareer.date);
|
|
4517
4513
|
} else if (typeof targetCareer.date === "number") {
|
|
4518
|
-
joinDate =
|
|
4514
|
+
joinDate = new Date(targetCareer.date);
|
|
4519
4515
|
} else {
|
|
4520
|
-
joinDate =
|
|
4516
|
+
joinDate = targetCareer.date;
|
|
4521
4517
|
}
|
|
4522
4518
|
if (isNaN(joinDate.getTime())) {
|
|
4523
4519
|
return "❌ 对方阵营加入阵营日期无效";
|
|
4524
4520
|
}
|
|
4525
|
-
const now2 =
|
|
4521
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
4526
4522
|
const timeDiff = now2.getTime() - joinDate.getTime();
|
|
4527
4523
|
const diffInDays = Math.floor(timeDiff / (1e3 * 60 * 60 * 24));
|
|
4528
4524
|
if (diffInDays < 30) {
|
|
4529
4525
|
return `🛡️ 该玩家是人类联盟成员,尚在30天保护期内(剩余${30 - diffInDays}天),无法挑战`;
|
|
4530
4526
|
}
|
|
4531
4527
|
}
|
|
4532
|
-
let initiatorPK
|
|
4533
|
-
|
|
4534
|
-
name: initiatorRankname,
|
|
4535
|
-
total: 0,
|
|
4536
|
-
wins: 0,
|
|
4537
|
-
todayCount: 0,
|
|
4538
|
-
lastPK: /* @__PURE__ */ new Date(0),
|
|
4539
|
-
// 明确初始化 lastPK
|
|
4540
|
-
enable: false,
|
|
4541
|
-
// 新增默认值
|
|
4542
|
-
lastToggle: /* @__PURE__ */ new Date(0)
|
|
4543
|
-
// 新增默认值
|
|
4544
|
-
};
|
|
4545
|
-
let targetPK = {
|
|
4546
|
-
handle: targetHandle,
|
|
4547
|
-
name: targetRankname,
|
|
4548
|
-
total: 0,
|
|
4549
|
-
wins: 0,
|
|
4550
|
-
todayCount: 0,
|
|
4551
|
-
lastPK: /* @__PURE__ */ new Date(0),
|
|
4552
|
-
enable: false,
|
|
4553
|
-
// 新增默认值
|
|
4554
|
-
lastToggle: /* @__PURE__ */ new Date(0)
|
|
4555
|
-
// 新增默认值
|
|
4556
|
-
};
|
|
4528
|
+
let initiatorPK;
|
|
4529
|
+
let targetPK;
|
|
4557
4530
|
await ctx.database.withTransaction(async () => {
|
|
4558
4531
|
const [dbInitiator] = await ctx.database.get("ggcevo_pk", { handle: initiatorHandle });
|
|
4559
|
-
if (dbInitiator) Object.assign(initiatorPK, dbInitiator);
|
|
4560
4532
|
const [dbTarget] = await ctx.database.get("ggcevo_pk", { handle: targetHandle });
|
|
4561
|
-
|
|
4533
|
+
initiatorPK = Object.assign({
|
|
4534
|
+
handle: initiatorHandle,
|
|
4535
|
+
name: initiatorRankname,
|
|
4536
|
+
total: 0,
|
|
4537
|
+
wins: 0,
|
|
4538
|
+
todayCount: 0,
|
|
4539
|
+
lastPK: /* @__PURE__ */ new Date(0),
|
|
4540
|
+
enable: false,
|
|
4541
|
+
lastToggle: /* @__PURE__ */ new Date(0)
|
|
4542
|
+
}, dbInitiator || {});
|
|
4543
|
+
targetPK = Object.assign({
|
|
4544
|
+
handle: targetHandle,
|
|
4545
|
+
name: targetRankname,
|
|
4546
|
+
total: 0,
|
|
4547
|
+
wins: 0,
|
|
4548
|
+
todayCount: 0,
|
|
4549
|
+
lastPK: /* @__PURE__ */ new Date(0),
|
|
4550
|
+
enable: false,
|
|
4551
|
+
lastToggle: /* @__PURE__ */ new Date(0)
|
|
4552
|
+
}, dbTarget || {});
|
|
4562
4553
|
});
|
|
4563
4554
|
if (initiatorCareer.group === "人类联盟" && !initiatorPK.enable) {
|
|
4564
4555
|
let joinDate;
|
|
4565
|
-
if (typeof initiatorCareer.date === "string") joinDate =
|
|
4566
|
-
else if (typeof initiatorCareer.date === "number") joinDate =
|
|
4567
|
-
else joinDate =
|
|
4556
|
+
if (typeof initiatorCareer.date === "string") joinDate = new Date(initiatorCareer.date);
|
|
4557
|
+
else if (typeof initiatorCareer.date === "number") joinDate = new Date(initiatorCareer.date);
|
|
4558
|
+
else joinDate = initiatorCareer.date;
|
|
4568
4559
|
if (!isNaN(joinDate.getTime())) {
|
|
4569
|
-
const now2 =
|
|
4560
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
4570
4561
|
const timeDiff = now2.getTime() - joinDate.getTime();
|
|
4571
4562
|
const remainingDays = 30 - Math.floor(timeDiff / (1e3 * 60 * 60 * 24));
|
|
4572
4563
|
if (remainingDays > 0) {
|
|
4573
4564
|
await session.send(`⚠️ 您的人类联盟保护期剩余 ${remainingDays} 天,发起PK将永久失去保护期!请确认是否继续?
|
|
4574
|
-
回复"是"继续PK,或"
|
|
4565
|
+
回复"是"继续PK,或"否"退出`);
|
|
4575
4566
|
const confirm = await session.prompt(3e4);
|
|
4576
4567
|
if (confirm !== "是") return "已取消PK操作,保护期仍有效";
|
|
4577
4568
|
}
|
|
@@ -4670,12 +4661,8 @@ ${items.join("、")}
|
|
|
4670
4661
|
handle: targetHandle,
|
|
4671
4662
|
name: targetRankname,
|
|
4672
4663
|
total: targetPK.total + 1,
|
|
4673
|
-
wins: !isWin ? targetPK.wins + 1 : targetPK.wins
|
|
4664
|
+
wins: !isWin ? targetPK.wins + 1 : targetPK.wins
|
|
4674
4665
|
// 应战者胜利时增加
|
|
4675
|
-
todayCount: targetPK.todayCount,
|
|
4676
|
-
// 不消耗应战者次数
|
|
4677
|
-
lastPK: targetPK.lastPK
|
|
4678
|
-
// 保留原有时间不更新
|
|
4679
4666
|
}
|
|
4680
4667
|
]);
|
|
4681
4668
|
await ctx.database.create("ggcevo_pk_logs", {
|
|
@@ -4729,23 +4716,23 @@ ${items.join("、")}
|
|
|
4729
4716
|
`🎰 金币变动:${stealPercentage}%`
|
|
4730
4717
|
];
|
|
4731
4718
|
if (targetCareer.group === "人类联盟" && isWin) {
|
|
4732
|
-
result.push(`🛡️
|
|
4719
|
+
result.push(`🛡️ 人类联盟保护:${targetRankname} 被动应对的PK失败时仅损失1%的金币`);
|
|
4733
4720
|
}
|
|
4734
4721
|
if (computerExpertProtection) {
|
|
4735
|
-
result.push(`💻
|
|
4722
|
+
result.push(`💻 计算机专家职业加成:${targetRankname} 被动应对的PK失败时不损失金币`);
|
|
4736
4723
|
} else if (isWin) {
|
|
4737
4724
|
result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`);
|
|
4738
4725
|
} else {
|
|
4739
4726
|
result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4740
4727
|
}
|
|
4741
4728
|
if (mp3Effect) {
|
|
4742
|
-
result.push(`💿 MP3
|
|
4729
|
+
result.push(`💿 MP3播放器生效:${initiatorRankname} 主动发起的PK失败时上交的金币减少50%`);
|
|
4743
4730
|
}
|
|
4744
4731
|
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4745
|
-
result.push(`🔴
|
|
4732
|
+
result.push(`🔴 辛迪加海盗阵营加成:${initiatorRankname} 获得1枚红晶`);
|
|
4746
4733
|
}
|
|
4747
4734
|
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4748
|
-
result.push(`💰
|
|
4735
|
+
result.push(`💰 辛迪加财务经理职业加成:${initiatorRankname} 额外获得1枚红晶`);
|
|
4749
4736
|
}
|
|
4750
4737
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4751
4738
|
return result.join("\n");
|
|
@@ -6088,7 +6075,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6088
6075
|
const config2 = careerData.group === "辛迪加海盗" ? syndicatePirateConfig : spaceStationCrewConfig;
|
|
6089
6076
|
const profession = config2.find((p) => p.professionName === careerData.career);
|
|
6090
6077
|
const effectDisplay = profession?.effect || "暂无特殊效果";
|
|
6091
|
-
const joinDate =
|
|
6078
|
+
const joinDate = new Date(careerData.date);
|
|
6092
6079
|
const formattedDate = `${joinDate.getFullYear()}年${joinDate.getMonth() + 1}月${joinDate.getDate()}日`;
|
|
6093
6080
|
const powerValue = await calculateTotalPower(handle);
|
|
6094
6081
|
const infoCard = [
|
|
@@ -6110,7 +6097,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6110
6097
|
infoCard.push("", "〓 科技研发 〓", ...activeTechs);
|
|
6111
6098
|
}
|
|
6112
6099
|
}
|
|
6113
|
-
const promptMessage = careerData.group === "辛迪加海盗" ? "💡
|
|
6100
|
+
const promptMessage = careerData.group === "辛迪加海盗" ? "💡 提示:红晶可通过主动发起PK获得(无论胜负)" : "💡 提示:使用「转职」指令可变更职业";
|
|
6114
6101
|
return [
|
|
6115
6102
|
`〓 职业档案 〓`,
|
|
6116
6103
|
...infoCard,
|
|
@@ -6325,7 +6312,10 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6325
6312
|
const redcrystal = careerData[0]?.redcrystal || 0;
|
|
6326
6313
|
const message = [`【${handle}的仓库】`];
|
|
6327
6314
|
message.push(`💰 金币:${totalRewards}`);
|
|
6328
|
-
if (redcrystal > 0)
|
|
6315
|
+
if (redcrystal > 0) {
|
|
6316
|
+
message.push(`🔴 红晶:${redcrystal}`);
|
|
6317
|
+
message.push("――――――――――――――");
|
|
6318
|
+
}
|
|
6329
6319
|
const validItems = items.filter(
|
|
6330
6320
|
(item) => Object.values(SyndicatedItems).some(
|
|
6331
6321
|
(specialItem) => specialItem.id === item.itemId
|
|
@@ -6342,14 +6332,12 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6342
6332
|
const [itemName, itemData] = entry;
|
|
6343
6333
|
return [
|
|
6344
6334
|
`${itemName}`,
|
|
6345
|
-
// 移除数量显示在标题
|
|
6346
6335
|
`类型:${itemData.type} | 持有数量:${warehouseItem.quantity}`,
|
|
6347
|
-
// 从warehouse表读取实际数量
|
|
6348
6336
|
`效果:${itemData.effects}`,
|
|
6349
6337
|
`描述:${itemData.description}`,
|
|
6350
6338
|
"――――――――――――――"
|
|
6351
6339
|
].join("\n");
|
|
6352
|
-
}).join("\n
|
|
6340
|
+
}).join("\n")
|
|
6353
6341
|
);
|
|
6354
6342
|
}
|
|
6355
6343
|
return message.join("\n");
|
|
@@ -6476,10 +6464,9 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
6476
6464
|
return "⛏️ 首次挖矿作业已开始,请至少等待1小时后才可收获。\n提示:基础收益为每半小时6枚金币";
|
|
6477
6465
|
}
|
|
6478
6466
|
const nowtime = /* @__PURE__ */ new Date();
|
|
6479
|
-
const chinaStart =
|
|
6480
|
-
const chinaNow = convertUTCtoChinaTime(nowtime);
|
|
6467
|
+
const chinaStart = record.startTime;
|
|
6481
6468
|
const duration = Math.floor(
|
|
6482
|
-
(
|
|
6469
|
+
(nowtime.getTime() - chinaStart.getTime()) / 1e3 / 60
|
|
6483
6470
|
);
|
|
6484
6471
|
if (duration < 60) {
|
|
6485
6472
|
const remaining = 60 - duration;
|