koishi-plugin-ggcevo-game 1.3.48 → 1.3.49
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 +110 -30
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -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,11 +999,11 @@ 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,
|
|
1006
|
-
costredcrystal:
|
|
1006
|
+
costredcrystal: 30
|
|
1007
1007
|
},
|
|
1008
1008
|
{
|
|
1009
1009
|
professionName: "指挥官",
|
|
@@ -3057,7 +3057,48 @@ ${discountDetails.join("\n▸ ")}`;
|
|
|
3057
3057
|
}
|
|
3058
3058
|
async function calculateTotalPower(handle, baseRank) {
|
|
3059
3059
|
const weapons = await ctx.database.get("ggcevo_equipment", { handle });
|
|
3060
|
+
const careers = await ctx.database.get("ggcevo_careers", { handle });
|
|
3061
|
+
const career = careers.length ? careers[0].career : null;
|
|
3060
3062
|
let total = baseRank;
|
|
3063
|
+
if (career) {
|
|
3064
|
+
if (career === "联盟新兵") {
|
|
3065
|
+
total += 1e3;
|
|
3066
|
+
} else if (career === "辛迪加炮灰新兵") {
|
|
3067
|
+
total += 2e3;
|
|
3068
|
+
} else if ([
|
|
3069
|
+
"深空矿工",
|
|
3070
|
+
"医疗专家",
|
|
3071
|
+
"情报副官",
|
|
3072
|
+
"总工程师",
|
|
3073
|
+
"舰长",
|
|
3074
|
+
"机械化专家"
|
|
3075
|
+
].includes(career)) {
|
|
3076
|
+
total += 2500;
|
|
3077
|
+
} else if ([
|
|
3078
|
+
"清洁工",
|
|
3079
|
+
"辛迪加财务经理",
|
|
3080
|
+
"计算机专家",
|
|
3081
|
+
"指挥官",
|
|
3082
|
+
"装甲兵",
|
|
3083
|
+
"破坏者",
|
|
3084
|
+
"征募官"
|
|
3085
|
+
].includes(career)) {
|
|
3086
|
+
total += 3e3;
|
|
3087
|
+
} else if ([
|
|
3088
|
+
"警卫员下士",
|
|
3089
|
+
"警卫长",
|
|
3090
|
+
"武器中士"
|
|
3091
|
+
].includes(career)) {
|
|
3092
|
+
total += 3500;
|
|
3093
|
+
} else if ([
|
|
3094
|
+
"能量武器专家",
|
|
3095
|
+
"枪手",
|
|
3096
|
+
"猩红杀手",
|
|
3097
|
+
"纵火狂"
|
|
3098
|
+
].includes(career)) {
|
|
3099
|
+
total += 4e3;
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3061
3102
|
for (const { weaponId, level, installedMods } of weapons) {
|
|
3062
3103
|
const weapon = weaponConfigById[weaponId];
|
|
3063
3104
|
if (!weapon) continue;
|
|
@@ -4478,6 +4519,12 @@ ${items.join("、")}
|
|
|
4478
4519
|
const [dbTarget] = await ctx.database.get("ggcevo_pk", { handle: targetHandle });
|
|
4479
4520
|
if (dbTarget) Object.assign(targetPK, dbTarget);
|
|
4480
4521
|
});
|
|
4522
|
+
const [initiatorCareer] = await ctx.database.get("ggcevo_careers", {
|
|
4523
|
+
handle: initiatorHandle
|
|
4524
|
+
});
|
|
4525
|
+
const [targetCareer] = await ctx.database.get("ggcevo_careers", {
|
|
4526
|
+
handle: targetHandle
|
|
4527
|
+
});
|
|
4481
4528
|
if (!initiatorPK.enable) {
|
|
4482
4529
|
return "您已关闭PK功能,无法发起挑战。";
|
|
4483
4530
|
}
|
|
@@ -4523,12 +4570,14 @@ ${items.join("、")}
|
|
|
4523
4570
|
if (initiatorGold < 100) return "发起者需要至少100金币才能发起挑战。";
|
|
4524
4571
|
if (targetGold < 100) return "对方金币不足100,无法应战。";
|
|
4525
4572
|
let hasMP3 = false;
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4573
|
+
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4574
|
+
const [mp3Item] = await ctx.database.get("ggcevo_warehouse", {
|
|
4575
|
+
handle: initiatorHandle,
|
|
4576
|
+
itemId: 5
|
|
4577
|
+
// MP3播放器ID
|
|
4578
|
+
});
|
|
4579
|
+
hasMP3 = mp3Item && mp3Item.quantity > 0;
|
|
4580
|
+
}
|
|
4532
4581
|
const powerDiff = initiatorPower - targetPower;
|
|
4533
4582
|
let winRate = 50 + powerDiff / 50 * 0.1;
|
|
4534
4583
|
winRate = Math.min(Math.max(winRate, 5), 95);
|
|
@@ -4543,8 +4592,10 @@ ${items.join("、")}
|
|
|
4543
4592
|
mp3Effect = true;
|
|
4544
4593
|
goldTransfer = reducedGold;
|
|
4545
4594
|
}
|
|
4546
|
-
|
|
4547
|
-
|
|
4595
|
+
let computerExpertProtection = false;
|
|
4596
|
+
if (isWin && targetCareer?.career === "计算机专家") {
|
|
4597
|
+
computerExpertProtection = true;
|
|
4598
|
+
goldTransfer = 0;
|
|
4548
4599
|
}
|
|
4549
4600
|
await ctx.database.withTransaction(async () => {
|
|
4550
4601
|
await ctx.database.upsert("ggcevo_pk", [
|
|
@@ -4583,38 +4634,67 @@ ${items.join("、")}
|
|
|
4583
4634
|
target_handle: targetHandle,
|
|
4584
4635
|
date: /* @__PURE__ */ new Date()
|
|
4585
4636
|
});
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
} else {
|
|
4590
|
-
await ctx.database.set("ggcevo_sign", initiatorHandle, { totalRewards: initiatorGold - goldTransfer });
|
|
4591
|
-
await ctx.database.set("ggcevo_sign", targetHandle, { totalRewards: targetGold + goldTransfer });
|
|
4637
|
+
let extraRedCrystal = 0;
|
|
4638
|
+
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4639
|
+
extraRedCrystal = 1;
|
|
4592
4640
|
}
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4641
|
+
let redcrystalAdd = 0;
|
|
4642
|
+
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4643
|
+
redcrystalAdd += 1;
|
|
4644
|
+
}
|
|
4645
|
+
redcrystalAdd += extraRedCrystal;
|
|
4646
|
+
if (redcrystalAdd > 0) {
|
|
4597
4647
|
await ctx.database.upsert("ggcevo_careers", [{
|
|
4598
4648
|
handle: initiatorHandle,
|
|
4599
|
-
redcrystal: (
|
|
4649
|
+
redcrystal: (initiatorCareer?.redcrystal || 0) + redcrystalAdd
|
|
4600
4650
|
}], ["handle"]);
|
|
4601
4651
|
}
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4652
|
+
if (computerExpertProtection) {
|
|
4653
|
+
} else {
|
|
4654
|
+
if (isWin) {
|
|
4655
|
+
await ctx.database.set("ggcevo_sign", targetHandle, {
|
|
4656
|
+
totalRewards: targetGold - goldTransfer
|
|
4657
|
+
});
|
|
4658
|
+
await ctx.database.set("ggcevo_sign", initiatorHandle, {
|
|
4659
|
+
totalRewards: initiatorGold + goldTransfer
|
|
4660
|
+
});
|
|
4661
|
+
} else {
|
|
4662
|
+
await ctx.database.set("ggcevo_sign", initiatorHandle, {
|
|
4663
|
+
totalRewards: initiatorGold - goldTransfer
|
|
4664
|
+
});
|
|
4665
|
+
await ctx.database.set("ggcevo_sign", targetHandle, {
|
|
4666
|
+
totalRewards: targetGold + goldTransfer
|
|
4667
|
+
});
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4605
4670
|
});
|
|
4606
4671
|
const result = [
|
|
4607
4672
|
`⚔️【对战结果】${isWin ? "胜利" : "失败"}${mp3Effect ? " (MP3减免)" : ""}`,
|
|
4608
4673
|
`🏅 挑战者:${initiatorRankname}(战斗力 ${initiatorPower})`,
|
|
4674
|
+
` 👨💼 职业:${initiatorCareer?.career || "无"}`,
|
|
4675
|
+
// 显示职业
|
|
4609
4676
|
`🛡️ 应战者:${targetRankname}(战斗力 ${targetPower})`,
|
|
4610
|
-
|
|
4677
|
+
` 👨💼 职业:${targetCareer?.career || "无"}`,
|
|
4678
|
+
// 显示职业
|
|
4679
|
+
`📊 胜率预测:${winRate.toFixed(1)}%`,
|
|
4611
4680
|
`🎰 金币变动:${stealPercentage}%`
|
|
4612
4681
|
];
|
|
4613
|
-
|
|
4682
|
+
if (computerExpertProtection) {
|
|
4683
|
+
result.push(`💻 计算机专家职业加成:被动PK失败不损失金币`);
|
|
4684
|
+
} else if (isWin) {
|
|
4685
|
+
result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`);
|
|
4686
|
+
} else {
|
|
4687
|
+
result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4688
|
+
}
|
|
4614
4689
|
if (mp3Effect) {
|
|
4615
|
-
result.push(`💿 MP3
|
|
4690
|
+
result.push(`💿 MP3播放器生效:失败上交的金币减少50%`);
|
|
4691
|
+
}
|
|
4692
|
+
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4693
|
+
result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`);
|
|
4694
|
+
}
|
|
4695
|
+
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4696
|
+
result.push(`💰 辛迪加财务经理职业加成:胜利额外获得1枚红晶`);
|
|
4616
4697
|
}
|
|
4617
|
-
initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`) : "";
|
|
4618
4698
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4619
4699
|
return result.join("\n");
|
|
4620
4700
|
} catch (error) {
|
|
@@ -4968,7 +5048,7 @@ ${validTypes.join("、")}`;
|
|
|
4968
5048
|
].join("\n");
|
|
4969
5049
|
}));
|
|
4970
5050
|
return [
|
|
4971
|
-
`🛡️ ${handle}
|
|
5051
|
+
`🛡️ ${handle}的武器仓库`,
|
|
4972
5052
|
'使用"装备 武器名称"来装备武器',
|
|
4973
5053
|
"⚡表示当前装备武器",
|
|
4974
5054
|
"──────────────",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-ggcevo-game",
|
|
3
3
|
"description": "《星际争霸2》咕咕虫-evolved地图的专属游戏助手插件,集成天梯排行、抽奖系统、签到福利、兑换商城等丰富功能。",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.49",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@koishijs/plugin-proxy-agent": "^0.3.3",
|
|
21
21
|
"koishi": "^4.18.7",
|
|
22
|
-
"koishi-plugin-sc2arcade-search": "^1.1.
|
|
22
|
+
"koishi-plugin-sc2arcade-search": "^1.1.18"
|
|
23
23
|
},
|
|
24
24
|
"koishi": {
|
|
25
25
|
"service": {
|