koishi-plugin-ggcevo-game 1.3.48 → 1.3.50
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 +113 -31
- 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,16 +4570,20 @@ ${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);
|
|
4535
|
-
const
|
|
4584
|
+
const randInt = Math.floor(Math.random() * 1e4);
|
|
4585
|
+
const winRateInt = Math.floor(winRate * 100);
|
|
4586
|
+
const isWin = randInt < winRateInt;
|
|
4536
4587
|
let stealPercentage = getRandomInt(1, 5);
|
|
4537
4588
|
let goldTransfer = Math.floor(
|
|
4538
4589
|
(isWin ? targetGold : initiatorGold) * stealPercentage / 100
|
|
@@ -4543,8 +4594,10 @@ ${items.join("、")}
|
|
|
4543
4594
|
mp3Effect = true;
|
|
4544
4595
|
goldTransfer = reducedGold;
|
|
4545
4596
|
}
|
|
4546
|
-
|
|
4547
|
-
|
|
4597
|
+
let computerExpertProtection = false;
|
|
4598
|
+
if (isWin && targetCareer?.career === "计算机专家") {
|
|
4599
|
+
computerExpertProtection = true;
|
|
4600
|
+
goldTransfer = 0;
|
|
4548
4601
|
}
|
|
4549
4602
|
await ctx.database.withTransaction(async () => {
|
|
4550
4603
|
await ctx.database.upsert("ggcevo_pk", [
|
|
@@ -4583,38 +4636,67 @@ ${items.join("、")}
|
|
|
4583
4636
|
target_handle: targetHandle,
|
|
4584
4637
|
date: /* @__PURE__ */ new Date()
|
|
4585
4638
|
});
|
|
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 });
|
|
4639
|
+
let extraRedCrystal = 0;
|
|
4640
|
+
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4641
|
+
extraRedCrystal = 1;
|
|
4592
4642
|
}
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4643
|
+
let redcrystalAdd = 0;
|
|
4644
|
+
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4645
|
+
redcrystalAdd += 1;
|
|
4646
|
+
}
|
|
4647
|
+
redcrystalAdd += extraRedCrystal;
|
|
4648
|
+
if (redcrystalAdd > 0) {
|
|
4597
4649
|
await ctx.database.upsert("ggcevo_careers", [{
|
|
4598
4650
|
handle: initiatorHandle,
|
|
4599
|
-
redcrystal: (
|
|
4651
|
+
redcrystal: (initiatorCareer?.redcrystal || 0) + redcrystalAdd
|
|
4600
4652
|
}], ["handle"]);
|
|
4601
4653
|
}
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4654
|
+
if (computerExpertProtection) {
|
|
4655
|
+
} else {
|
|
4656
|
+
if (isWin) {
|
|
4657
|
+
await ctx.database.set("ggcevo_sign", targetHandle, {
|
|
4658
|
+
totalRewards: targetGold - goldTransfer
|
|
4659
|
+
});
|
|
4660
|
+
await ctx.database.set("ggcevo_sign", initiatorHandle, {
|
|
4661
|
+
totalRewards: initiatorGold + goldTransfer
|
|
4662
|
+
});
|
|
4663
|
+
} else {
|
|
4664
|
+
await ctx.database.set("ggcevo_sign", initiatorHandle, {
|
|
4665
|
+
totalRewards: initiatorGold - goldTransfer
|
|
4666
|
+
});
|
|
4667
|
+
await ctx.database.set("ggcevo_sign", targetHandle, {
|
|
4668
|
+
totalRewards: targetGold + goldTransfer
|
|
4669
|
+
});
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4605
4672
|
});
|
|
4606
4673
|
const result = [
|
|
4607
4674
|
`⚔️【对战结果】${isWin ? "胜利" : "失败"}${mp3Effect ? " (MP3减免)" : ""}`,
|
|
4608
4675
|
`🏅 挑战者:${initiatorRankname}(战斗力 ${initiatorPower})`,
|
|
4676
|
+
` 👨💼 职业:${initiatorCareer?.career || "无"}`,
|
|
4677
|
+
// 显示职业
|
|
4609
4678
|
`🛡️ 应战者:${targetRankname}(战斗力 ${targetPower})`,
|
|
4610
|
-
|
|
4679
|
+
` 👨💼 职业:${targetCareer?.career || "无"}`,
|
|
4680
|
+
// 显示职业
|
|
4681
|
+
`📊 胜率预测:${winRate.toFixed(1)}%`,
|
|
4611
4682
|
`🎰 金币变动:${stealPercentage}%`
|
|
4612
4683
|
];
|
|
4613
|
-
|
|
4684
|
+
if (computerExpertProtection) {
|
|
4685
|
+
result.push(`💻 计算机专家职业加成:被动PK失败不损失金币`);
|
|
4686
|
+
} else if (isWin) {
|
|
4687
|
+
result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`);
|
|
4688
|
+
} else {
|
|
4689
|
+
result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4690
|
+
}
|
|
4614
4691
|
if (mp3Effect) {
|
|
4615
|
-
result.push(`💿 MP3
|
|
4692
|
+
result.push(`💿 MP3播放器生效:失败上交的金币减少50%`);
|
|
4693
|
+
}
|
|
4694
|
+
if (initiatorCareer?.group === "辛迪加海盗") {
|
|
4695
|
+
result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`);
|
|
4696
|
+
}
|
|
4697
|
+
if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
|
|
4698
|
+
result.push(`💰 辛迪加财务经理职业加成:胜利额外获得1枚红晶`);
|
|
4616
4699
|
}
|
|
4617
|
-
initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`) : "";
|
|
4618
4700
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4619
4701
|
return result.join("\n");
|
|
4620
4702
|
} catch (error) {
|
|
@@ -4968,7 +5050,7 @@ ${validTypes.join("、")}`;
|
|
|
4968
5050
|
].join("\n");
|
|
4969
5051
|
}));
|
|
4970
5052
|
return [
|
|
4971
|
-
`🛡️ ${handle}
|
|
5053
|
+
`🛡️ ${handle}的武器仓库`,
|
|
4972
5054
|
'使用"装备 武器名称"来装备武器',
|
|
4973
5055
|
"⚡表示当前装备武器",
|
|
4974
5056
|
"──────────────",
|
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.50",
|
|
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": {
|