koishi-plugin-ggcevo-game 1.5.29 → 1.5.31
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/database.d.ts +0 -1
- package/lib/index.js +57 -66
- package/package.json +1 -1
package/lib/database.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -7251,7 +7251,6 @@ function apply(ctx, config) {
|
|
|
7251
7251
|
ctx.model.extend("ggcevo_spaceship", {
|
|
7252
7252
|
handle: "string",
|
|
7253
7253
|
id: "unsigned",
|
|
7254
|
-
status: "string",
|
|
7255
7254
|
createTime: "timestamp"
|
|
7256
7255
|
}, {
|
|
7257
7256
|
primary: "handle"
|
|
@@ -10960,23 +10959,23 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
10960
10959
|
}
|
|
10961
10960
|
let halfHours = Math.floor(duration / 30);
|
|
10962
10961
|
let base = halfHours * 4;
|
|
10963
|
-
const maxHalfHours = career
|
|
10962
|
+
const maxHalfHours = career?.group === "人类联盟" && techLevel === 5 ? 96 : 48;
|
|
10964
10963
|
halfHours = Math.min(halfHours, maxHalfHours);
|
|
10965
10964
|
base = Math.min(base, maxHalfHours * 4);
|
|
10966
10965
|
let techBonusRate = 0;
|
|
10967
10966
|
let careerBonusRate = 0;
|
|
10968
10967
|
let shipBonusRate = 0;
|
|
10969
10968
|
let minerBonusRate = 0;
|
|
10970
|
-
if (career
|
|
10969
|
+
if (career?.group === "人类联盟") {
|
|
10971
10970
|
const baseTechRates = [0, 0.1, 0.2, 0.3, 0.4, 0.5];
|
|
10972
10971
|
techBonusRate = baseTechRates[Math.min(techLevel, 5)];
|
|
10973
10972
|
const techCareers = ["深空矿工", "情报副官"];
|
|
10974
|
-
if (techCareers.includes(career
|
|
10973
|
+
if (techCareers.includes(career?.career)) {
|
|
10975
10974
|
const careerBonusRates = [0, 0.1, 0.2, 0.3, 0.4, 0.5];
|
|
10976
10975
|
careerBonusRate = careerBonusRates[Math.min(techLevel, 5)];
|
|
10977
10976
|
}
|
|
10978
10977
|
}
|
|
10979
|
-
if (career
|
|
10978
|
+
if (career?.career === "深空矿工") {
|
|
10980
10979
|
minerBonusRate = 0.5;
|
|
10981
10980
|
}
|
|
10982
10981
|
let shipName = "";
|
|
@@ -11049,7 +11048,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11049
11048
|
if (hasMinerBonus) {
|
|
11050
11049
|
reportLines.push(`▸ ⛏️ 深空矿工专业加成:+${(minerBonusRate * 100).toFixed(0)}%金币`);
|
|
11051
11050
|
}
|
|
11052
|
-
if (techLevel === 5 && career
|
|
11051
|
+
if (techLevel === 5 && career?.group === "人类联盟") {
|
|
11053
11052
|
reportLines.push(`▸ ⏱️ 单次挖矿时间上限增加至48小时`);
|
|
11054
11053
|
}
|
|
11055
11054
|
}
|
|
@@ -11141,7 +11140,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11141
11140
|
const baseTotal = taskConfig.price * completableTimes;
|
|
11142
11141
|
let baseBonus = 0;
|
|
11143
11142
|
if (techLevel > 0) {
|
|
11144
|
-
baseBonus = careerData?.group === "人类联盟" && ["舰长", "情报副官"].includes(careerData?.career) ? [0, 20, 40, 60,
|
|
11143
|
+
baseBonus = careerData?.group === "人类联盟" && ["舰长", "情报副官"].includes(careerData?.career) ? [0, 20, 40, 60, 80, 100][techLevel] : [0, 10, 20, 30, 40, 50][techLevel];
|
|
11145
11144
|
}
|
|
11146
11145
|
const captainBonus = careerData?.group === "人类联盟" && careerData.career === "舰长" ? 50 : 0;
|
|
11147
11146
|
const totalBonus = baseBonus + captainBonus;
|
|
@@ -11420,10 +11419,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11420
11419
|
return "⛔ 您已被列入黑名单。";
|
|
11421
11420
|
}
|
|
11422
11421
|
const [career] = await ctx.database.get("ggcevo_careers", { handle });
|
|
11423
|
-
const
|
|
11424
|
-
if (!allowedGroups.includes(career.group)) {
|
|
11425
|
-
}
|
|
11426
|
-
const careerName = career.career;
|
|
11422
|
+
const careerName = career?.career;
|
|
11427
11423
|
const careerCoinBonus = careerName === "总工程师" ? 50 : 0;
|
|
11428
11424
|
const [shipRecord] = await ctx.database.get("ggcevo_spaceship", { handle });
|
|
11429
11425
|
let shipBonus = 0;
|
|
@@ -11458,7 +11454,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11458
11454
|
const techLevel = techReactor?.level || 0;
|
|
11459
11455
|
let techBonusRate = 0;
|
|
11460
11456
|
let careerBonusRate = 0;
|
|
11461
|
-
if (career
|
|
11457
|
+
if (career?.group === "人类联盟" && techLevel > 0) {
|
|
11462
11458
|
const baseRates = [0, 0.1, 0.2, 0.3, 0.4, 0.5];
|
|
11463
11459
|
techBonusRate = baseRates[techLevel];
|
|
11464
11460
|
const specialCareers = ["总工程师", "情报副官"];
|
|
@@ -11481,8 +11477,8 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11481
11477
|
const returnsIncrement = (record.returns || 0) + 1;
|
|
11482
11478
|
const galaxyData2 = galaxy[record.galaxy];
|
|
11483
11479
|
let successRate = galaxyData2.success;
|
|
11484
|
-
if (career
|
|
11485
|
-
else if (career
|
|
11480
|
+
if (career?.group === "人类联盟" && record.galaxy === "联盟星系") successRate += 0.1;
|
|
11481
|
+
else if (career?.group === "辛迪加海盗" && record.galaxy === "辛迪加星系") successRate += 0.1;
|
|
11486
11482
|
if (stealthShipEffectAdded) successRate += 0.2;
|
|
11487
11483
|
successRate = Math.min(successRate, 1);
|
|
11488
11484
|
let baseCoinReward = Math.floor(Math.random() * 51) + 50;
|
|
@@ -11579,53 +11575,53 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11579
11575
|
const actualPlunderRate = basePlunderRate + plunderRateBonus / 100;
|
|
11580
11576
|
const canPlunder = Math.random() < actualPlunderRate;
|
|
11581
11577
|
if (canPlunder) {
|
|
11582
|
-
|
|
11578
|
+
const explorers = await ctx.database.get("ggcevo_explore", {
|
|
11583
11579
|
galaxy: galaxyName,
|
|
11584
11580
|
status: "探索中",
|
|
11585
|
-
handle: { $ne: handle }
|
|
11586
|
-
plunderbonus: { $gte: 0 }
|
|
11581
|
+
handle: { $ne: handle }
|
|
11587
11582
|
});
|
|
11588
|
-
if (
|
|
11589
|
-
const
|
|
11590
|
-
|
|
11591
|
-
|
|
11592
|
-
|
|
11593
|
-
|
|
11594
|
-
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
|
|
11604
|
-
|
|
11605
|
-
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11583
|
+
if (explorers.length > 0) {
|
|
11584
|
+
const shipHandles = explorers.map((e) => e.handle);
|
|
11585
|
+
const ships = await ctx.database.get("ggcevo_spaceship", {
|
|
11586
|
+
handle: { $in: shipHandles }
|
|
11587
|
+
});
|
|
11588
|
+
const shipMap = new Map(ships.map((ship) => [ship.handle, ship.id]));
|
|
11589
|
+
const plunderTargets = explorers.filter((explorer) => {
|
|
11590
|
+
const shipId = shipMap.get(explorer.handle);
|
|
11591
|
+
return shipId !== 2;
|
|
11592
|
+
});
|
|
11593
|
+
if (plunderTargets.length > 0) {
|
|
11594
|
+
const target = plunderTargets[Math.floor(Math.random() * plunderTargets.length)];
|
|
11595
|
+
await session.send(`❗ 您在探索过程中发现了【${target.name}】的飞船,是否掠夺?(30秒内输入"是"来进行掠夺)`);
|
|
11596
|
+
const response = await session.prompt(3e4);
|
|
11597
|
+
if (response === "是") {
|
|
11598
|
+
let baseSuccessRate = 0.5;
|
|
11599
|
+
if (isBehemoth) baseSuccessRate += 0.3;
|
|
11600
|
+
if (shipRecord?.id === 3) baseSuccessRate += 0.1;
|
|
11601
|
+
const success = Math.random() < baseSuccessRate;
|
|
11602
|
+
let playerBonus, targetBonus;
|
|
11603
|
+
if (success) {
|
|
11604
|
+
playerBonus = 20;
|
|
11605
|
+
targetBonus = -20;
|
|
11606
|
+
} else {
|
|
11607
|
+
playerBonus = -20;
|
|
11608
|
+
targetBonus = 20;
|
|
11609
|
+
}
|
|
11610
|
+
await ctx.database.upsert("ggcevo_explore", [{
|
|
11611
|
+
handle,
|
|
11612
|
+
name: name2,
|
|
11613
|
+
startTime: /* @__PURE__ */ new Date(),
|
|
11614
|
+
galaxy: galaxyName,
|
|
11615
|
+
returns: record?.returns || 0,
|
|
11616
|
+
plunderbonus: playerBonus,
|
|
11617
|
+
status: "探索中"
|
|
11618
|
+
}], ["handle"]);
|
|
11619
|
+
const [targetRecord] = await ctx.database.get("ggcevo_explore", { handle: target.handle });
|
|
11620
|
+
await ctx.database.set("ggcevo_explore", { handle: target.handle }, {
|
|
11621
|
+
plunderbonus: (targetRecord.plunderbonus || 0) + targetBonus
|
|
11622
|
+
});
|
|
11623
|
+
return success ? `✅ 掠夺成功!您获得${playerBonus}%金币加成,${target.name}的金币收益被降低了20%。` : `❌ 掠夺失败!您的金币收益被降低20%,${target.name}获得了20%的金币收益加成。`;
|
|
11614
11624
|
}
|
|
11615
|
-
await ctx.database.upsert("ggcevo_explore", [{
|
|
11616
|
-
handle,
|
|
11617
|
-
name: name2,
|
|
11618
|
-
startTime: /* @__PURE__ */ new Date(),
|
|
11619
|
-
galaxy: galaxyName,
|
|
11620
|
-
returns: record?.returns || 0,
|
|
11621
|
-
plunderbonus: playerBonus,
|
|
11622
|
-
status: "探索中"
|
|
11623
|
-
}], ["handle"]);
|
|
11624
|
-
const [targetRecord] = await ctx.database.get("ggcevo_explore", { handle: target.handle });
|
|
11625
|
-
await ctx.database.set("ggcevo_explore", { handle: target.handle }, {
|
|
11626
|
-
plunderbonus: (targetRecord.plunderbonus || 0) + targetBonus
|
|
11627
|
-
});
|
|
11628
|
-
return success ? `✅ 掠夺成功!您获得${playerBonus}%金币加成,${target.name}的金币收益被降低了20%。` : `❌ 掠夺失败!您的金币收益被降低20%,${target.name}获得了20%的金币收益加成。`;
|
|
11629
11625
|
}
|
|
11630
11626
|
}
|
|
11631
11627
|
}
|
|
@@ -11640,8 +11636,8 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11640
11636
|
}], ["handle"]);
|
|
11641
11637
|
const galaxyData = galaxy[galaxyName];
|
|
11642
11638
|
let estimatedRate = galaxyData.success;
|
|
11643
|
-
if (career
|
|
11644
|
-
if (career
|
|
11639
|
+
if (career?.group === "人类联盟" && galaxyName === "联盟星系") estimatedRate += 0.1;
|
|
11640
|
+
if (career?.group === "辛迪加海盗" && galaxyName === "辛迪加星系") estimatedRate += 0.1;
|
|
11645
11641
|
if (isStealthShip) estimatedRate += 0.2;
|
|
11646
11642
|
estimatedRate = Math.min(estimatedRate, 1) * 100;
|
|
11647
11643
|
return [
|
|
@@ -11700,10 +11696,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11700
11696
|
`🔭 探索加成:+${ship.explorebonus}%金币`,
|
|
11701
11697
|
`⛏️ 挖矿加成:+${ship.miningbonus}%金币`,
|
|
11702
11698
|
`💡 特殊效果:${ship.effect || "无"}`,
|
|
11703
|
-
|
|
11704
|
-
`📅 获得时间:${shipRecord.createTime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
11705
|
-
`🔋 状态:${shipRecord.status}`,
|
|
11706
|
-
`💰 当前金币余额:${coins}`
|
|
11699
|
+
`📅 获得时间:${shipRecord.createTime.toLocaleString("zh-CN", { hour12: false })}`
|
|
11707
11700
|
].join("\n");
|
|
11708
11701
|
});
|
|
11709
11702
|
ctx.command("ggcevo/购买飞船 [shipName]").action(async ({ session }, shipName) => {
|
|
@@ -11756,8 +11749,6 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11756
11749
|
await ctx.database.create("ggcevo_spaceship", {
|
|
11757
11750
|
handle,
|
|
11758
11751
|
id: ship.id,
|
|
11759
|
-
status: "空闲",
|
|
11760
|
-
// 设置初始状态
|
|
11761
11752
|
createTime: now
|
|
11762
11753
|
});
|
|
11763
11754
|
}
|
|
@@ -11807,7 +11798,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
11807
11798
|
if (career.career === "指挥官") {
|
|
11808
11799
|
upgradeCost = Math.floor(upgradeCost * 0.5);
|
|
11809
11800
|
discountNotice = `
|
|
11810
|
-
✨ 指挥官职业生效!实际消耗: ${upgradeCost} (
|
|
11801
|
+
✨ 指挥官职业生效!实际消耗: ${upgradeCost} (原价:${upgradeConfig.upgradeCostBase})`;
|
|
11811
11802
|
}
|
|
11812
11803
|
if (career.redcrystal < upgradeCost) {
|
|
11813
11804
|
return `🚫 红晶不足!升级需要${upgradeCost}红晶,您当前有${career.redcrystal}红晶`;
|