koishi-plugin-ggcevo-game 1.3.54 → 1.3.56
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 +46 -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
|
});
|
|
@@ -4529,36 +4525,31 @@ ${items.join("、")}
|
|
|
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;
|
|
@@ -4663,27 +4654,15 @@ ${items.join("、")}
|
|
|
4663
4654
|
total: initiatorPK.total + 1,
|
|
4664
4655
|
wins: isWin ? initiatorPK.wins + 1 : initiatorPK.wins,
|
|
4665
4656
|
todayCount: initiatorPK.todayCount + 1,
|
|
4666
|
-
lastPK: /* @__PURE__ */ new Date()
|
|
4667
|
-
enable: initiatorPK.enable,
|
|
4668
|
-
// 包含新字段
|
|
4669
|
-
lastToggle: initiatorPK.lastToggle
|
|
4670
|
-
// 包含新字段
|
|
4657
|
+
lastPK: /* @__PURE__ */ new Date()
|
|
4671
4658
|
},
|
|
4672
4659
|
// 应战者记录(新增部分)
|
|
4673
4660
|
{
|
|
4674
4661
|
handle: targetHandle,
|
|
4675
4662
|
name: targetRankname,
|
|
4676
4663
|
total: targetPK.total + 1,
|
|
4677
|
-
wins: !isWin ? targetPK.wins + 1 : targetPK.wins
|
|
4664
|
+
wins: !isWin ? targetPK.wins + 1 : targetPK.wins
|
|
4678
4665
|
// 应战者胜利时增加
|
|
4679
|
-
todayCount: targetPK.todayCount,
|
|
4680
|
-
// 不消耗应战者次数
|
|
4681
|
-
lastPK: targetPK.lastPK,
|
|
4682
|
-
// 保留原有时间不更新
|
|
4683
|
-
enable: targetPK.enable,
|
|
4684
|
-
// 包含新字段
|
|
4685
|
-
lastToggle: targetPK.lastToggle
|
|
4686
|
-
// 包含新字段
|
|
4687
4666
|
}
|
|
4688
4667
|
]);
|
|
4689
4668
|
await ctx.database.create("ggcevo_pk_logs", {
|
|
@@ -4737,23 +4716,23 @@ ${items.join("、")}
|
|
|
4737
4716
|
`🎰 金币变动:${stealPercentage}%`
|
|
4738
4717
|
];
|
|
4739
4718
|
if (targetCareer.group === "人类联盟" && isWin) {
|
|
4740
|
-
result.push(`🛡️
|
|
4719
|
+
result.push(`🛡️ 人类联盟保护:${targetRankname} 被动应对的PK失败时仅损失1%的金币`);
|
|
4741
4720
|
}
|
|
4742
4721
|
if (computerExpertProtection) {
|
|
4743
|
-
result.push(`💻
|
|
4722
|
+
result.push(`💻 计算机专家职业加成:${targetRankname} 被动应对的PK失败时不损失金币`);
|
|
4744
4723
|
} else if (isWin) {
|
|
4745
4724
|
result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`);
|
|
4746
4725
|
} else {
|
|
4747
4726
|
result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4748
4727
|
}
|
|
4749
4728
|
if (mp3Effect) {
|
|
4750
|
-
result.push(`💿 MP3
|
|
4729
|
+
result.push(`💿 MP3播放器生效:${initiatorRankname} 主动发起的PK失败时上交的金币减少50%`);
|
|
4751
4730
|
}
|
|
4752
4731
|
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4753
|
-
result.push(`🔴
|
|
4732
|
+
result.push(`🔴 辛迪加海盗阵营加成:${initiatorRankname} 获得1枚红晶`);
|
|
4754
4733
|
}
|
|
4755
4734
|
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4756
|
-
result.push(`💰
|
|
4735
|
+
result.push(`💰 辛迪加财务经理职业加成:${initiatorRankname} 额外获得1枚红晶`);
|
|
4757
4736
|
}
|
|
4758
4737
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4759
4738
|
return result.join("\n");
|
|
@@ -4769,10 +4748,10 @@ ${items.join("、")}
|
|
|
4769
4748
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
4770
4749
|
const offset = (pageNum - 1) * 10;
|
|
4771
4750
|
const [records, total] = await Promise.all([
|
|
4772
|
-
//
|
|
4773
|
-
ctx.database.select("ggcevo_pk").
|
|
4751
|
+
// 获取当前页记录
|
|
4752
|
+
ctx.database.select("ggcevo_pk").orderBy("wins", "desc").limit(10).offset(offset).execute(),
|
|
4774
4753
|
// 获取总记录数(启用PK的用户总数)
|
|
4775
|
-
ctx.database.select("ggcevo_pk").
|
|
4754
|
+
ctx.database.select("ggcevo_pk").execute((row) => import_koishi.$.count(row.handle))
|
|
4776
4755
|
]);
|
|
4777
4756
|
const totalPages = Math.ceil(total / 10);
|
|
4778
4757
|
if (pageNum > totalPages) return `查询失败,最多有 ${totalPages} 页`;
|
|
@@ -4787,7 +4766,7 @@ ${items.join("、")}
|
|
|
4787
4766
|
].join(" | ");
|
|
4788
4767
|
}).join("\n");
|
|
4789
4768
|
return [
|
|
4790
|
-
"🏆 PK排行榜
|
|
4769
|
+
"🏆 PK排行榜 🏆",
|
|
4791
4770
|
"──────────────",
|
|
4792
4771
|
rankingText,
|
|
4793
4772
|
"──────────────",
|
|
@@ -6118,7 +6097,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6118
6097
|
infoCard.push("", "〓 科技研发 〓", ...activeTechs);
|
|
6119
6098
|
}
|
|
6120
6099
|
}
|
|
6121
|
-
const promptMessage = careerData.group === "辛迪加海盗" ? "💡
|
|
6100
|
+
const promptMessage = careerData.group === "辛迪加海盗" ? "💡 提示:红晶可通过主动发起PK获得(无论胜负)" : "💡 提示:使用「转职」指令可变更职业";
|
|
6122
6101
|
return [
|
|
6123
6102
|
`〓 职业档案 〓`,
|
|
6124
6103
|
...infoCard,
|
|
@@ -6333,7 +6312,10 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6333
6312
|
const redcrystal = careerData[0]?.redcrystal || 0;
|
|
6334
6313
|
const message = [`【${handle}的仓库】`];
|
|
6335
6314
|
message.push(`💰 金币:${totalRewards}`);
|
|
6336
|
-
if (redcrystal > 0)
|
|
6315
|
+
if (redcrystal > 0) {
|
|
6316
|
+
message.push(`🔴 红晶:${redcrystal}`);
|
|
6317
|
+
message.push("――――――――――――――");
|
|
6318
|
+
}
|
|
6337
6319
|
const validItems = items.filter(
|
|
6338
6320
|
(item) => Object.values(SyndicatedItems).some(
|
|
6339
6321
|
(specialItem) => specialItem.id === item.itemId
|
|
@@ -6350,14 +6332,12 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
6350
6332
|
const [itemName, itemData] = entry;
|
|
6351
6333
|
return [
|
|
6352
6334
|
`${itemName}`,
|
|
6353
|
-
// 移除数量显示在标题
|
|
6354
6335
|
`类型:${itemData.type} | 持有数量:${warehouseItem.quantity}`,
|
|
6355
|
-
// 从warehouse表读取实际数量
|
|
6356
6336
|
`效果:${itemData.effects}`,
|
|
6357
6337
|
`描述:${itemData.description}`,
|
|
6358
6338
|
"――――――――――――――"
|
|
6359
6339
|
].join("\n");
|
|
6360
|
-
}).join("\n
|
|
6340
|
+
}).join("\n")
|
|
6361
6341
|
);
|
|
6362
6342
|
}
|
|
6363
6343
|
return message.join("\n");
|