koishi-plugin-ggcevo-game 1.2.73 → 1.3.0
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.d.ts +5 -0
- package/lib/index.js +134 -43
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ declare module 'koishi' {
|
|
|
41
41
|
ggcevo_careers: careers;
|
|
42
42
|
ggcevo_warehouse: warehouse;
|
|
43
43
|
ggcevo_tech: tech;
|
|
44
|
+
ggcevo_Mining: Mining;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
export interface backpack {
|
|
@@ -189,4 +190,8 @@ export interface tech {
|
|
|
189
190
|
techId: number;
|
|
190
191
|
level: number;
|
|
191
192
|
}
|
|
193
|
+
export interface Mining {
|
|
194
|
+
handle: string;
|
|
195
|
+
startTime: Date;
|
|
196
|
+
}
|
|
192
197
|
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
|
@@ -284,6 +284,12 @@ function apply(ctx, config) {
|
|
|
284
284
|
}, {
|
|
285
285
|
primary: ["handle", "techId"]
|
|
286
286
|
});
|
|
287
|
+
ctx.model.extend("ggcevo_Mining", {
|
|
288
|
+
handle: "string",
|
|
289
|
+
startTime: "timestamp"
|
|
290
|
+
}, {
|
|
291
|
+
primary: "handle"
|
|
292
|
+
});
|
|
287
293
|
const weaponConfig = {
|
|
288
294
|
// 武器配置
|
|
289
295
|
"高斯步枪": {
|
|
@@ -704,9 +710,9 @@ function apply(ctx, config) {
|
|
|
704
710
|
},
|
|
705
711
|
{
|
|
706
712
|
professionName: "情报副官",
|
|
707
|
-
effect: "",
|
|
708
|
-
requirements: "
|
|
709
|
-
Jobtransfer:
|
|
713
|
+
effect: "升级空间站科技花费的金币是原价的80%",
|
|
714
|
+
requirements: "将一个空间站科技升至3级或以上",
|
|
715
|
+
Jobtransfer: true,
|
|
710
716
|
costcoins: 3e3
|
|
711
717
|
},
|
|
712
718
|
{
|
|
@@ -742,7 +748,7 @@ function apply(ctx, config) {
|
|
|
742
748
|
{
|
|
743
749
|
professionName: "能量武器专家",
|
|
744
750
|
effect: "能量武器攻击伤害+20%,解锁MK-4激光步枪(传奇)购买权限",
|
|
745
|
-
requirements: "拥有一把3
|
|
751
|
+
requirements: "拥有一把3级或以上等级的能量武器",
|
|
746
752
|
Jobtransfer: true,
|
|
747
753
|
costcoins: 0,
|
|
748
754
|
costredcrystal: 20
|
|
@@ -774,7 +780,7 @@ function apply(ctx, config) {
|
|
|
774
780
|
{
|
|
775
781
|
professionName: "纵火狂",
|
|
776
782
|
effect: "热能武器攻击伤害+20%,解锁龙息散弹枪(传奇)购买权限",
|
|
777
|
-
requirements: "拥有一把3
|
|
783
|
+
requirements: "拥有一把3级或以上等级的热能武器",
|
|
778
784
|
Jobtransfer: true,
|
|
779
785
|
costcoins: 0,
|
|
780
786
|
costredcrystal: 20
|
|
@@ -1804,6 +1810,13 @@ function apply(ctx, config) {
|
|
|
1804
1810
|
success: totalDamage >= 300,
|
|
1805
1811
|
message: `需要累计造成300伤害(当前${totalDamage})`
|
|
1806
1812
|
};
|
|
1813
|
+
case "情报副官":
|
|
1814
|
+
const techs = await ctx2.database.get("ggcevo_tech", { handle });
|
|
1815
|
+
const hasValidTech = techs.some((t) => t.level >= 3);
|
|
1816
|
+
return {
|
|
1817
|
+
success: hasValidTech,
|
|
1818
|
+
message: hasValidTech ? "" : "需要至少一个科技等级≥3级"
|
|
1819
|
+
};
|
|
1807
1820
|
case "能量武器专家":
|
|
1808
1821
|
const hasEnergyWeapon = weapons.some((weapon) => {
|
|
1809
1822
|
const weaponConfigEntry = Object.values(weaponConfig).find((c) => c.id === weapon.weaponId);
|
|
@@ -1935,13 +1948,18 @@ function apply(ctx, config) {
|
|
|
1935
1948
|
if (currentLevel >= tech.maxLevel) return `❌ ${tech.techname}已达最高等级`;
|
|
1936
1949
|
const nextLevel = currentLevel + 1;
|
|
1937
1950
|
const levelData = tech.levels.find((l) => l.level === nextLevel);
|
|
1951
|
+
let actualCost = levelData.cost;
|
|
1952
|
+
if (careerData.career === "情报副官") {
|
|
1953
|
+
actualCost = Math.floor(actualCost * 0.8);
|
|
1954
|
+
}
|
|
1938
1955
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
1939
|
-
if (signInfo?.totalRewards <
|
|
1940
|
-
|
|
1956
|
+
if (signInfo?.totalRewards < actualCost) {
|
|
1957
|
+
const originalHint = careerData.career === "情报副官" ? `(原价${levelData.cost})` : "";
|
|
1958
|
+
return `❌ 需要 ${actualCost} 金币${originalHint},当前持有:${signInfo?.totalRewards || 0}`;
|
|
1941
1959
|
}
|
|
1942
1960
|
await ctx.database.withTransaction(async () => {
|
|
1943
1961
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
1944
|
-
totalRewards: signInfo.totalRewards -
|
|
1962
|
+
totalRewards: signInfo.totalRewards - actualCost
|
|
1945
1963
|
});
|
|
1946
1964
|
await ctx.database.upsert("ggcevo_tech", [{
|
|
1947
1965
|
handle,
|
|
@@ -1949,7 +1967,9 @@ function apply(ctx, config) {
|
|
|
1949
1967
|
level: nextLevel
|
|
1950
1968
|
}], ["handle", "techId"]);
|
|
1951
1969
|
});
|
|
1970
|
+
const costHint = careerData.career === "情报副官" ? `${actualCost}(情报副官:已享8折优惠)` : actualCost;
|
|
1952
1971
|
return `✅ ${tech.techname} 升级至 Lv.${nextLevel}
|
|
1972
|
+
💰 花费金币: ${costHint}
|
|
1953
1973
|
📝 ${levelData.description}
|
|
1954
1974
|
💼 ${levelData.careerBonus}`;
|
|
1955
1975
|
}
|
|
@@ -2007,8 +2027,10 @@ function apply(ctx, config) {
|
|
|
2007
2027
|
const newLevel = equipment.level + 1;
|
|
2008
2028
|
const damage = (weaponData.damage * (1 + 0.1 * newLevel)).toFixed(1);
|
|
2009
2029
|
let msg = `${target} 升级成功!Lv.${newLevel}`;
|
|
2010
|
-
|
|
2030
|
+
const priceInfo = actualCost === baseCost ? `
|
|
2031
|
+
💸 消耗:${actualCost}金币` : `
|
|
2011
2032
|
💸 消耗:${actualCost}金币 (原价${baseCost})`;
|
|
2033
|
+
msg += priceInfo;
|
|
2012
2034
|
let discountDetails = [];
|
|
2013
2035
|
if (weaponDiscount > 0) {
|
|
2014
2036
|
discountDetails.push(`武器系统 Lv${techLevel} 折扣:${Math.max(baseDiscount, careerDiscount)}%`);
|
|
@@ -4294,7 +4316,7 @@ ${effectMessage.join("\n")}`
|
|
|
4294
4316
|
// 修改金币显示行
|
|
4295
4317
|
`获得金币:${finalReward}${careerMessage}`,
|
|
4296
4318
|
`目标剩余HP:${Math.max(currentHP, 0)}/${maxHP}`,
|
|
4297
|
-
isDefeated ? `🎉
|
|
4319
|
+
isDefeated ? `🎉 恭喜,已成功击败 ${targetBoss.name}!` : ""
|
|
4298
4320
|
].filter((line) => line).join("\n");
|
|
4299
4321
|
await session.send(resultMessage);
|
|
4300
4322
|
if (broadcastMessage) {
|
|
@@ -4776,15 +4798,22 @@ ${effectMessage.join("\n")}`
|
|
|
4776
4798
|
`✨ 职业效果:${effectDisplay}`,
|
|
4777
4799
|
`🗓️ 就职时间:${formattedDate}`
|
|
4778
4800
|
];
|
|
4779
|
-
if (careerData.group === "
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4801
|
+
if (careerData.group === "人类联盟") {
|
|
4802
|
+
const techEntries = await ctx.database.get("ggcevo_tech", { handle });
|
|
4803
|
+
const activeTechs = techEntries.filter((entry) => entry.level > 0).map((entry) => {
|
|
4804
|
+
const techConfig = Spacestationtechnology.find((t) => t.techId === entry.techId);
|
|
4805
|
+
return techConfig ? `🛠️ ${techConfig.techname} [${entry.level}/${techConfig.maxLevel}]` : null;
|
|
4806
|
+
}).filter(Boolean);
|
|
4807
|
+
if (activeTechs.length > 0) {
|
|
4808
|
+
infoCard.push("", "〓 科技研发 〓", ...activeTechs);
|
|
4809
|
+
}
|
|
4783
4810
|
}
|
|
4811
|
+
const promptMessage = careerData.group === "辛迪加海盗" ? "💡 提示:红晶可通过主动PK获得(无论胜负)" : "💡 提示:使用「转职」命令可变更职业";
|
|
4784
4812
|
return [
|
|
4785
4813
|
"〓 职业档案 〓",
|
|
4786
4814
|
...infoCard,
|
|
4787
|
-
"
|
|
4815
|
+
"〓═════════〓\n" + promptMessage
|
|
4816
|
+
// 提示信息放在分隔线下方
|
|
4788
4817
|
].join("\n");
|
|
4789
4818
|
} catch (error) {
|
|
4790
4819
|
ctx.logger.error("查询职业信息失败:", error);
|
|
@@ -4966,7 +4995,7 @@ ${effectMessage.join("\n")}`
|
|
|
4966
4995
|
) && item.quantity > 0
|
|
4967
4996
|
);
|
|
4968
4997
|
if (!validItems.length) {
|
|
4969
|
-
message.push("
|
|
4998
|
+
message.push("你的物品仓库空空如也。");
|
|
4970
4999
|
} else {
|
|
4971
5000
|
message.push(
|
|
4972
5001
|
validItems.map((warehouseItem) => {
|
|
@@ -5029,33 +5058,6 @@ ${effectMessage.join("\n")}`
|
|
|
5029
5058
|
return "⚠️ 物品使用失败,请联系管理员";
|
|
5030
5059
|
}
|
|
5031
5060
|
});
|
|
5032
|
-
ctx.command("ggcevo/科技信息", "查看空间站科技配置").action(async ({ session }) => {
|
|
5033
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5034
|
-
if (!profile) return "❌ 您暂未绑定句柄。";
|
|
5035
|
-
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5036
|
-
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5037
|
-
if (!careerData || careerData.group !== "人类联盟") {
|
|
5038
|
-
return "🚫 该功能需要【人类联盟】阵营权限";
|
|
5039
|
-
}
|
|
5040
|
-
const techEntries = await ctx.database.get("ggcevo_tech", { handle });
|
|
5041
|
-
const techInfo = Spacestationtechnology.map((tech) => {
|
|
5042
|
-
const entry = techEntries.find((e) => e.techId === tech.techId);
|
|
5043
|
-
const currentLevel = entry?.level || 0;
|
|
5044
|
-
const levelData = tech.levels.find((l) => l.level === currentLevel);
|
|
5045
|
-
let description = "尚未解锁";
|
|
5046
|
-
let careerBonus = "无";
|
|
5047
|
-
if (levelData) {
|
|
5048
|
-
description = levelData.description;
|
|
5049
|
-
careerBonus = levelData.careerBonus;
|
|
5050
|
-
}
|
|
5051
|
-
return `🛠️ ${tech.techname} [${currentLevel}/${tech.maxLevel}]
|
|
5052
|
-
📌 效果:${description}
|
|
5053
|
-
🎖️ ${careerBonus}`;
|
|
5054
|
-
}).join("\n\n");
|
|
5055
|
-
return `🚀 空间站科技配置信息:
|
|
5056
|
-
|
|
5057
|
-
${techInfo}`;
|
|
5058
|
-
});
|
|
5059
5061
|
ctx.command("ggcevo/科技 [techName]", "查看空间站科技信息").usage("输入“科技”查看列表,或“科技 科技名称”查看详细信息").action(async ({ session }, techName) => {
|
|
5060
5062
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5061
5063
|
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
@@ -5100,6 +5102,95 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5100
5102
|
"===================="
|
|
5101
5103
|
].join("\n");
|
|
5102
5104
|
});
|
|
5105
|
+
ctx.command("ggcevo/挖矿").action(async ({ session }) => {
|
|
5106
|
+
const convertUTCtoChinaTime2 = /* @__PURE__ */ __name((utcDate) => {
|
|
5107
|
+
const chinaOffset = 8 * 60 * 60 * 1e3;
|
|
5108
|
+
return new Date(utcDate.getTime() + chinaOffset);
|
|
5109
|
+
}, "convertUTCtoChinaTime");
|
|
5110
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5111
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5112
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5113
|
+
if (await ctx.database.get("ggcevo_blacklist", { handle }).then((r) => r.length)) {
|
|
5114
|
+
return "⛔ 您已被列入黑名单";
|
|
5115
|
+
}
|
|
5116
|
+
const [career] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5117
|
+
if (!["深空矿工", "情报副官"].includes(career?.career)) {
|
|
5118
|
+
return "🚫 需要职业为深空矿工或情报副官";
|
|
5119
|
+
}
|
|
5120
|
+
const [tech] = await ctx.database.get("ggcevo_tech", { handle, techId: 1 });
|
|
5121
|
+
if (!tech || tech.level < 2) return "🚫 需要采掘系统等级≥2";
|
|
5122
|
+
const [record] = await ctx.database.get("ggcevo_Mining", { handle });
|
|
5123
|
+
const [sign] = await ctx.database.get("ggcevo_sign", { handle });
|
|
5124
|
+
if (!record) {
|
|
5125
|
+
await ctx.database.create("ggcevo_Mining", {
|
|
5126
|
+
handle,
|
|
5127
|
+
startTime: /* @__PURE__ */ new Date()
|
|
5128
|
+
// 记录当前时间为开始时间
|
|
5129
|
+
});
|
|
5130
|
+
return "⛏️ 挖矿作业已开始,至少1小时后可收获";
|
|
5131
|
+
}
|
|
5132
|
+
const chinaStart = convertUTCtoChinaTime2(record.startTime);
|
|
5133
|
+
const chinaNow = convertUTCtoChinaTime2(/* @__PURE__ */ new Date());
|
|
5134
|
+
const duration = Math.floor(
|
|
5135
|
+
(chinaNow.getTime() - chinaStart.getTime()) / 1e3 / 60
|
|
5136
|
+
);
|
|
5137
|
+
if (duration < 60) {
|
|
5138
|
+
const remaining = 60 - duration;
|
|
5139
|
+
return [
|
|
5140
|
+
"⛏️ 挖矿进行中",
|
|
5141
|
+
`🕒 开始时间:${chinaStart.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5142
|
+
`⏱️ 当前时间:${chinaNow.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5143
|
+
`⏳ 还需等待:${remaining}分钟`,
|
|
5144
|
+
`💡 提示:达到1小时可随时收获并自动开始下一轮`
|
|
5145
|
+
].join("\n");
|
|
5146
|
+
}
|
|
5147
|
+
const halfHours = Math.floor(duration / 30);
|
|
5148
|
+
let base = halfHours * 6.25;
|
|
5149
|
+
base = Math.round(base);
|
|
5150
|
+
base = Math.min(base, 300);
|
|
5151
|
+
let multiplier = 0;
|
|
5152
|
+
switch (tech.level) {
|
|
5153
|
+
case 3:
|
|
5154
|
+
multiplier = 0.1;
|
|
5155
|
+
break;
|
|
5156
|
+
// +10%
|
|
5157
|
+
case 4:
|
|
5158
|
+
multiplier = 0.3;
|
|
5159
|
+
break;
|
|
5160
|
+
// +30%
|
|
5161
|
+
case 5:
|
|
5162
|
+
multiplier = 0.5;
|
|
5163
|
+
break;
|
|
5164
|
+
}
|
|
5165
|
+
const total = Math.round(base * (1 + multiplier));
|
|
5166
|
+
await ctx.database.withTransaction(async () => {
|
|
5167
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
5168
|
+
handle,
|
|
5169
|
+
totalRewards: (sign?.totalRewards || 0) + total
|
|
5170
|
+
}], ["handle"]);
|
|
5171
|
+
await ctx.database.set("ggcevo_Mining", { handle }, {
|
|
5172
|
+
startTime: /* @__PURE__ */ new Date()
|
|
5173
|
+
// 重置为当前时间
|
|
5174
|
+
});
|
|
5175
|
+
});
|
|
5176
|
+
const formatTime = /* @__PURE__ */ __name((mins) => {
|
|
5177
|
+
const hours = Math.floor(mins / 60);
|
|
5178
|
+
const minutes = mins % 60;
|
|
5179
|
+
return `${hours}小时${minutes}分钟`;
|
|
5180
|
+
}, "formatTime");
|
|
5181
|
+
return [
|
|
5182
|
+
"⛏️ 挖矿报告",
|
|
5183
|
+
`🕒 开始时间:${chinaStart.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5184
|
+
`⏱️ 结束时间:${chinaNow.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5185
|
+
`⏳ 持续时间:${formatTime(duration)}`,
|
|
5186
|
+
...tech.level >= 3 ? (
|
|
5187
|
+
// 仅当科技等级≥3时显示加成信息
|
|
5188
|
+
[`🔧 科技加成(Lv.${tech.level}):+${multiplier * 100}%`]
|
|
5189
|
+
) : [],
|
|
5190
|
+
`💰 实际获得:${total}金币`,
|
|
5191
|
+
"💡 已自动开始下一轮挖矿"
|
|
5192
|
+
].join("\n");
|
|
5193
|
+
});
|
|
5103
5194
|
}
|
|
5104
5195
|
__name(apply, "apply");
|
|
5105
5196
|
function simpleDraw() {
|