koishi-plugin-ggcevo-game 1.3.23 → 1.3.24
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 +0 -6
- package/lib/index.js +360 -462
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -41,8 +41,8 @@ var Config = import_koishi.Schema.intersect([
|
|
|
41
41
|
}).description("赛季配置"),
|
|
42
42
|
// 核心功能开关组
|
|
43
43
|
import_koishi.Schema.object({
|
|
44
|
-
signrequire: import_koishi.Schema.boolean().description("游戏对局签到要求").default(
|
|
45
|
-
autorank: import_koishi.Schema.boolean().description("自动同步天梯数据").default(
|
|
44
|
+
signrequire: import_koishi.Schema.boolean().description("游戏对局签到要求").default(false),
|
|
45
|
+
autorank: import_koishi.Schema.boolean().description("自动同步天梯数据").default(false)
|
|
46
46
|
}).description("功能开关"),
|
|
47
47
|
// 对战系统配置组
|
|
48
48
|
import_koishi.Schema.object({
|
|
@@ -184,13 +184,6 @@ function apply(ctx, config) {
|
|
|
184
184
|
}, {
|
|
185
185
|
primary: "handle"
|
|
186
186
|
});
|
|
187
|
-
ctx.model.extend("ggcevo_achievements", {
|
|
188
|
-
handle: "string",
|
|
189
|
-
achievementname: "string",
|
|
190
|
-
gaintime: "timestamp"
|
|
191
|
-
}, {
|
|
192
|
-
primary: ["handle", "achievementname"]
|
|
193
|
-
});
|
|
194
187
|
ctx.model.extend("ggcevo_pk", {
|
|
195
188
|
handle: "string",
|
|
196
189
|
name: "string",
|
|
@@ -520,11 +513,11 @@ function apply(ctx, config) {
|
|
|
520
513
|
},
|
|
521
514
|
{
|
|
522
515
|
name: "精灵双倍",
|
|
523
|
-
effect: "
|
|
516
|
+
effect: "下一次击败首领时可获得双倍的金币和咕咕币奖励"
|
|
524
517
|
},
|
|
525
518
|
{
|
|
526
519
|
name: "喵喵财源",
|
|
527
|
-
effect: "
|
|
520
|
+
effect: "签到获得双倍的金币和咕咕币"
|
|
528
521
|
},
|
|
529
522
|
{
|
|
530
523
|
name: "暴击韵律",
|
|
@@ -1678,12 +1671,15 @@ function apply(ctx, config) {
|
|
|
1678
1671
|
const messages = [];
|
|
1679
1672
|
const hasRadiation = targetBoss.skills.includes("辐射");
|
|
1680
1673
|
const currentLayers = targetBoss.Vulnerability || 0;
|
|
1681
|
-
const
|
|
1674
|
+
const skillUpdates = [];
|
|
1682
1675
|
const newLayers = hasRadiation ? Math.min(currentLayers + 1, 100) : 1;
|
|
1683
1676
|
let layerMsg;
|
|
1684
|
-
0;
|
|
1685
1677
|
if (!hasRadiation) {
|
|
1686
1678
|
layerMsg = `☢️ ${targetBoss.name} 获得【辐射】效果`;
|
|
1679
|
+
skillUpdates.push({
|
|
1680
|
+
name: targetBoss.name,
|
|
1681
|
+
add: ["辐射"]
|
|
1682
|
+
});
|
|
1687
1683
|
} else if (newLayers === currentLayers) {
|
|
1688
1684
|
layerMsg = `☢️ 辐射层数已达上限(100层)`;
|
|
1689
1685
|
} else {
|
|
@@ -1693,13 +1689,11 @@ function apply(ctx, config) {
|
|
|
1693
1689
|
"ggcevo_boss",
|
|
1694
1690
|
{ name: targetBoss.name },
|
|
1695
1691
|
{
|
|
1696
|
-
skills: Array.from(new Set(newSkills)),
|
|
1697
|
-
// 显式类型断言
|
|
1698
1692
|
Vulnerability: newLayers
|
|
1699
1693
|
}
|
|
1700
1694
|
);
|
|
1701
1695
|
messages.push(layerMsg);
|
|
1702
|
-
return { messages };
|
|
1696
|
+
return { messages, skillUpdates };
|
|
1703
1697
|
}, "handleGammaRadiation"),
|
|
1704
1698
|
// 伽马枪辐射计算(返回增伤系数)
|
|
1705
1699
|
calculateRadiationDamage: /* @__PURE__ */ __name((targetBoss) => {
|
|
@@ -1812,6 +1806,7 @@ function apply(ctx, config) {
|
|
|
1812
1806
|
const gammaRadResult = await this.handleGammaRadiation(ctx2, targetBoss, weaponName);
|
|
1813
1807
|
if (gammaRadResult) {
|
|
1814
1808
|
messages.push(...gammaRadResult.messages);
|
|
1809
|
+
skillUpdates.push(...gammaRadResult.skillUpdates);
|
|
1815
1810
|
}
|
|
1816
1811
|
return {
|
|
1817
1812
|
currentHP,
|
|
@@ -1820,40 +1815,71 @@ function apply(ctx, config) {
|
|
|
1820
1815
|
initialDamage: finalDamage
|
|
1821
1816
|
};
|
|
1822
1817
|
}, "handlePassives"),
|
|
1823
|
-
//
|
|
1818
|
+
// 应用技能更新到数据库(优化合并同名boss的更新)
|
|
1824
1819
|
applySkillUpdates: /* @__PURE__ */ __name(async (ctx2, skillUpdates) => {
|
|
1825
|
-
const
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1820
|
+
const mergedUpdates = skillUpdates.reduce((acc, update) => {
|
|
1821
|
+
const existing = acc.find((u) => u.name === update.name);
|
|
1822
|
+
if (existing) {
|
|
1823
|
+
if (update.remove) {
|
|
1824
|
+
existing.remove = [.../* @__PURE__ */ new Set([...existing.remove, ...update.remove])];
|
|
1825
|
+
}
|
|
1826
|
+
if (update.add) {
|
|
1827
|
+
existing.add = [.../* @__PURE__ */ new Set([...existing.add, ...update.add])];
|
|
1828
|
+
}
|
|
1829
|
+
} else {
|
|
1830
|
+
acc.push({
|
|
1831
|
+
name: update.name,
|
|
1832
|
+
remove: [...new Set(update.remove || [])],
|
|
1833
|
+
add: [...new Set(update.add || [])]
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
return acc;
|
|
1837
|
+
}, []);
|
|
1838
|
+
const updates = mergedUpdates.map(async (update) => {
|
|
1839
|
+
const [boss] = await ctx2.database.get("ggcevo_boss", { name: update.name });
|
|
1840
|
+
if (!boss) return;
|
|
1841
|
+
let newSkills = [...boss.skills];
|
|
1842
|
+
if (update.remove?.length) {
|
|
1843
|
+
newSkills = newSkills.filter((s) => !update.remove.includes(s));
|
|
1844
|
+
}
|
|
1845
|
+
if (update.add?.length) {
|
|
1846
|
+
newSkills = [...newSkills, ...update.add];
|
|
1847
|
+
newSkills = [...new Set(newSkills)];
|
|
1848
|
+
}
|
|
1832
1849
|
return ctx2.database.set(
|
|
1833
1850
|
"ggcevo_boss",
|
|
1834
1851
|
{ name: update.name },
|
|
1835
|
-
{ skills:
|
|
1836
|
-
// 去重
|
|
1852
|
+
{ skills: newSkills }
|
|
1837
1853
|
);
|
|
1838
1854
|
});
|
|
1839
1855
|
await Promise.all(updates);
|
|
1840
1856
|
}, "applySkillUpdates")
|
|
1841
1857
|
};
|
|
1842
|
-
async function handleBossDefeatRewards(ctx2, targetBoss
|
|
1858
|
+
async function handleBossDefeatRewards(ctx2, targetBoss) {
|
|
1843
1859
|
const damageRecords = await ctx2.database.select("ggcevo_boss_damage").where({
|
|
1844
1860
|
bossGroupId: targetBoss.groupId,
|
|
1845
1861
|
totalDamage: { $gt: 0 }
|
|
1846
1862
|
}).orderBy("totalDamage", "desc").execute();
|
|
1847
1863
|
const rewardMessages = [];
|
|
1848
1864
|
const rewardMap = /* @__PURE__ */ new Map();
|
|
1849
|
-
const updatePromises = [];
|
|
1850
1865
|
const handles = damageRecords.map((r) => r.handle);
|
|
1851
|
-
const pirateCleaners = await
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1866
|
+
const [pirateCleaners, doubleWishRecords] = await Promise.all([
|
|
1867
|
+
ctx2.database.get("ggcevo_careers", {
|
|
1868
|
+
handle: { $in: handles },
|
|
1869
|
+
group: "辛迪加海盗",
|
|
1870
|
+
career: "清洁工"
|
|
1871
|
+
}),
|
|
1872
|
+
// 获取双倍祈愿信息
|
|
1873
|
+
ctx2.database.get("ggcevo_Wish_Record", {
|
|
1874
|
+
handle: { $in: handles },
|
|
1875
|
+
wishname: "精灵双倍",
|
|
1876
|
+
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
1877
|
+
endTime: { $gte: /* @__PURE__ */ new Date() },
|
|
1878
|
+
isused: false
|
|
1879
|
+
})
|
|
1880
|
+
]);
|
|
1856
1881
|
const cleanerHandles = new Set(pirateCleaners.map((c) => c.handle));
|
|
1882
|
+
const doubleWishHandles = new Set(doubleWishRecords.map((r) => r.handle));
|
|
1857
1883
|
if (damageRecords.length > 0) {
|
|
1858
1884
|
const top20 = damageRecords.slice(0, 20);
|
|
1859
1885
|
top20.forEach((record, index) => {
|
|
@@ -1877,6 +1903,10 @@ function apply(ctx, config) {
|
|
|
1877
1903
|
gold = 1e3;
|
|
1878
1904
|
break;
|
|
1879
1905
|
}
|
|
1906
|
+
if (doubleWishHandles.has(record.handle)) {
|
|
1907
|
+
guguCoins *= 2;
|
|
1908
|
+
gold *= 2;
|
|
1909
|
+
}
|
|
1880
1910
|
let redCrystal = 0;
|
|
1881
1911
|
if (cleanerHandles.has(record.handle)) {
|
|
1882
1912
|
switch (true) {
|
|
@@ -1912,18 +1942,22 @@ function apply(ctx, config) {
|
|
|
1912
1942
|
const others = damageRecords.slice(20);
|
|
1913
1943
|
if (others.length > 0) {
|
|
1914
1944
|
others.forEach((record) => {
|
|
1945
|
+
let guguCoins = 3;
|
|
1946
|
+
let gold = 200;
|
|
1947
|
+
if (doubleWishHandles.has(record.handle)) {
|
|
1948
|
+
guguCoins *= 2;
|
|
1949
|
+
gold *= 2;
|
|
1950
|
+
}
|
|
1915
1951
|
const baseReward = {
|
|
1916
|
-
guguCoins
|
|
1917
|
-
gold
|
|
1952
|
+
guguCoins,
|
|
1953
|
+
gold,
|
|
1918
1954
|
redCrystal: cleanerHandles.has(record.handle) ? 3 : 0,
|
|
1919
1955
|
playerName: record.playerName
|
|
1920
1956
|
};
|
|
1921
1957
|
rewardMap.set(record.handle, baseReward);
|
|
1922
1958
|
});
|
|
1923
|
-
rewardMessages.push(`其他参与者各获得: 3 咕咕币 + 200 金币` + (cleanerHandles.size > 0 ? " (清洁工额外+3红晶)" : ""));
|
|
1959
|
+
rewardMessages.push(`其他参与者各获得: 3 咕咕币 + 200 金币` + (cleanerHandles.size > 0 ? " (清洁工额外+3红晶)" : "") + (doubleWishHandles.size > 0 ? " (精灵双倍祈愿玩家奖励翻倍)" : ""));
|
|
1924
1960
|
}
|
|
1925
|
-
const doubleRewardPlayers = await handleDoubleRewards(ctx2, damageRecords, rewardMap);
|
|
1926
|
-
await applyDoubleRewards(ctx2, doubleRewardPlayers, rewardMap, rewardMessages);
|
|
1927
1961
|
await ctx2.database.withTransaction(async () => {
|
|
1928
1962
|
for (const [handle, reward] of rewardMap) {
|
|
1929
1963
|
const [signData] = await ctx2.database.get("ggcevo_sign", { handle });
|
|
@@ -1953,58 +1987,6 @@ function apply(ctx, config) {
|
|
|
1953
1987
|
return { rewardMessages };
|
|
1954
1988
|
}
|
|
1955
1989
|
__name(handleBossDefeatRewards, "handleBossDefeatRewards");
|
|
1956
|
-
async function handleDoubleRewards(ctx2, damageRecords, rewardMap) {
|
|
1957
|
-
const doubleRewardPlayers = /* @__PURE__ */ new Map();
|
|
1958
|
-
for (const record of damageRecords) {
|
|
1959
|
-
const [elfEffect] = await ctx2.database.get("ggcevo_Wish_Record", {
|
|
1960
|
-
handle: record.handle,
|
|
1961
|
-
wishname: "精灵双倍",
|
|
1962
|
-
isused: false,
|
|
1963
|
-
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
1964
|
-
endTime: { $gte: /* @__PURE__ */ new Date() }
|
|
1965
|
-
});
|
|
1966
|
-
if (elfEffect) {
|
|
1967
|
-
doubleRewardPlayers.set(record.handle, {
|
|
1968
|
-
effect: elfEffect,
|
|
1969
|
-
originalReward: {
|
|
1970
|
-
guguCoins: rewardMap.get(record.handle)?.guguCoins || 0,
|
|
1971
|
-
gold: rewardMap.get(record.handle)?.gold || 0
|
|
1972
|
-
}
|
|
1973
|
-
});
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
return doubleRewardPlayers;
|
|
1977
|
-
}
|
|
1978
|
-
__name(handleDoubleRewards, "handleDoubleRewards");
|
|
1979
|
-
async function applyDoubleRewards(ctx2, doubleRewardPlayers, rewardMap, rewardMessages) {
|
|
1980
|
-
if (doubleRewardPlayers.size > 0) {
|
|
1981
|
-
await ctx2.database.withTransaction(async () => {
|
|
1982
|
-
for (const [handle, data] of doubleRewardPlayers) {
|
|
1983
|
-
const reward = rewardMap.get(handle);
|
|
1984
|
-
reward.guguCoins = data.originalReward.guguCoins * 2;
|
|
1985
|
-
reward.gold = data.originalReward.gold * 2;
|
|
1986
|
-
await ctx2.database.set(
|
|
1987
|
-
"ggcevo_Wish_Record",
|
|
1988
|
-
{ id: data.effect.id },
|
|
1989
|
-
{ isused: true }
|
|
1990
|
-
);
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
|
-
rewardMessages.forEach((msg, index) => {
|
|
1994
|
-
const match = msg.match(/(\d+\.) (.+?) 获得奖励/);
|
|
1995
|
-
if (match) {
|
|
1996
|
-
const playerName = match[2];
|
|
1997
|
-
const targetHandle = [...rewardMap.keys()].find(
|
|
1998
|
-
(key) => rewardMap.get(key).playerName === playerName
|
|
1999
|
-
);
|
|
2000
|
-
if (targetHandle && doubleRewardPlayers.has(targetHandle)) {
|
|
2001
|
-
rewardMessages[index] = `${match[1]} ${playerName} 🧚 获得双倍奖励: ${rewardMap.get(targetHandle).guguCoins} 咕咕币 + ${rewardMap.get(targetHandle).gold} 金币(精灵双倍祈愿生效)`;
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
__name(applyDoubleRewards, "applyDoubleRewards");
|
|
2008
1990
|
async function checkTransferRequirements(ctx2, handle, profession) {
|
|
2009
1991
|
const [mainBoss] = await ctx2.database.get("ggcevo_boss", {
|
|
2010
1992
|
type: "主宰",
|
|
@@ -2131,18 +2113,18 @@ function apply(ctx, config) {
|
|
|
2131
2113
|
handle,
|
|
2132
2114
|
totalRewards: (signRecords[0]?.totalRewards || 0) + damageValue
|
|
2133
2115
|
}], ["handle"]);
|
|
2134
|
-
const damageRecords = await ctx.database.get("ggcevo_boss_damage", { handle });
|
|
2116
|
+
const [damageRecords] = await ctx.database.get("ggcevo_boss_damage", { handle });
|
|
2135
2117
|
await ctx.database.upsert("ggcevo_boss_damage", [{
|
|
2136
2118
|
handle,
|
|
2137
2119
|
playerName: session.username,
|
|
2138
|
-
totalDamage: (damageRecords
|
|
2139
|
-
attackCount: damageRecords
|
|
2120
|
+
totalDamage: (damageRecords?.totalDamage || 0) + damageValue,
|
|
2121
|
+
attackCount: damageRecords?.attackCount || 0,
|
|
2140
2122
|
bossGroupId: 4
|
|
2141
2123
|
}], ["handle"]);
|
|
2142
2124
|
});
|
|
2143
2125
|
return {
|
|
2144
2126
|
success: true,
|
|
2145
|
-
message:
|
|
2127
|
+
message: `成功引爆 ${itemName},造成 ${damageValue} 点伤害,获得等额金币`
|
|
2146
2128
|
};
|
|
2147
2129
|
}
|
|
2148
2130
|
if (itemConfig2.id === 2) {
|
|
@@ -2206,7 +2188,7 @@ function apply(ctx, config) {
|
|
|
2206
2188
|
}
|
|
2207
2189
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2208
2190
|
if (signInfo?.totalRewards < actualCost) {
|
|
2209
|
-
const originalHint = careerData.career === "情报副官" ?
|
|
2191
|
+
const originalHint = careerData.career === "情报副官" ? `(原价${levelData.cost})` : "";
|
|
2210
2192
|
return `❌ 需要 ${actualCost} 金币${originalHint},当前持有:${signInfo?.totalRewards || 0}`;
|
|
2211
2193
|
}
|
|
2212
2194
|
await ctx.database.withTransaction(async () => {
|
|
@@ -2219,9 +2201,11 @@ function apply(ctx, config) {
|
|
|
2219
2201
|
level: nextLevel
|
|
2220
2202
|
}], ["handle", "techId"]);
|
|
2221
2203
|
});
|
|
2222
|
-
const
|
|
2204
|
+
const costLine = careerData.career === "情报副官" ? `💰 花费金币: ${actualCost}(原价${levelData.cost})` : `💰 花费金币: ${actualCost}`;
|
|
2205
|
+
const discountHint = careerData.career === "情报副官" ? `📉 情报副官职业加成:20%折扣
|
|
2206
|
+
` : "";
|
|
2223
2207
|
return `✅ ${tech.techname} 升级至 Lv.${nextLevel}
|
|
2224
|
-
|
|
2208
|
+
${discountHint}${costLine}
|
|
2225
2209
|
📝 ${levelData.description}
|
|
2226
2210
|
💼 ${levelData.careerBonus}`;
|
|
2227
2211
|
}
|
|
@@ -2232,36 +2216,42 @@ function apply(ctx, config) {
|
|
|
2232
2216
|
handle,
|
|
2233
2217
|
weaponId: weaponData.id
|
|
2234
2218
|
});
|
|
2235
|
-
if (!equipment) return "❌
|
|
2236
|
-
if (equipment.level >= 6) return "❌
|
|
2219
|
+
if (!equipment) return "❌ 您尚未获得该武器";
|
|
2220
|
+
if (equipment.level >= 6) return "❌ 该武器已达最高等级";
|
|
2237
2221
|
const BASE_COST = [1050, 1450, 1850, 2250, 2650, 3050];
|
|
2238
2222
|
const baseCost = BASE_COST[equipment.level];
|
|
2239
2223
|
const weaponTechConfig = Spacestationtechnology.find((t) => t.techId === 2);
|
|
2240
2224
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
2241
|
-
let
|
|
2242
|
-
let
|
|
2243
|
-
|
|
2244
|
-
let baseDiscount;
|
|
2245
|
-
let careerDiscount;
|
|
2225
|
+
let techLevel = 0;
|
|
2226
|
+
let totalDiscount = 0;
|
|
2227
|
+
const discountDetails = [];
|
|
2246
2228
|
if (careerData?.group === "人类联盟") {
|
|
2247
2229
|
const [weaponTech] = await ctx.database.get("ggcevo_tech", { handle, techId: 2 }).catch(() => [{ level: 0 }]);
|
|
2248
2230
|
techLevel = Math.min(Math.max(weaponTech?.level || 0, 0), 5);
|
|
2249
2231
|
const isCareerMatch = weaponTechConfig?.careerNames.includes(careerData?.career);
|
|
2250
2232
|
const BASE_DISCOUNTS = [5, 10, 15, 20, 25];
|
|
2251
2233
|
const CAREER_DISCOUNTS = [10, 20, 30, 40, 50];
|
|
2252
|
-
baseDiscount = techLevel > 0 ? BASE_DISCOUNTS[techLevel - 1] : 0;
|
|
2253
|
-
careerDiscount = isCareerMatch && techLevel > 0 ? CAREER_DISCOUNTS[techLevel - 1] : 0;
|
|
2254
|
-
weaponDiscount = Math.max(baseDiscount, careerDiscount)
|
|
2255
|
-
|
|
2234
|
+
const baseDiscount = techLevel > 0 ? BASE_DISCOUNTS[techLevel - 1] : 0;
|
|
2235
|
+
const careerDiscount = isCareerMatch && techLevel > 0 ? CAREER_DISCOUNTS[techLevel - 1] : 0;
|
|
2236
|
+
const weaponDiscount = Math.max(baseDiscount, careerDiscount);
|
|
2237
|
+
if (weaponDiscount > 0) {
|
|
2238
|
+
totalDiscount += weaponDiscount;
|
|
2239
|
+
discountDetails.push(
|
|
2240
|
+
`武器系统 Lv${techLevel}${isCareerMatch ? "(科技职业加成)" : ""}:${weaponDiscount}%)`
|
|
2241
|
+
);
|
|
2242
|
+
}
|
|
2256
2243
|
}
|
|
2257
2244
|
const activeWish = await checkFoxBlessing(handle);
|
|
2258
2245
|
if (activeWish) {
|
|
2259
|
-
|
|
2246
|
+
totalDiscount += 20;
|
|
2247
|
+
discountDetails.push("灵狐升运祈愿生效:20%");
|
|
2260
2248
|
}
|
|
2249
|
+
totalDiscount = Math.min(totalDiscount, 100);
|
|
2250
|
+
const discountedCost = baseCost * (100 - totalDiscount) / 100;
|
|
2261
2251
|
const actualCost = Math.floor(discountedCost);
|
|
2262
2252
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2263
2253
|
if (signInfo?.totalRewards < actualCost) {
|
|
2264
|
-
return `❌ 需要 ${actualCost}
|
|
2254
|
+
return `❌ 需要 ${actualCost} 金币(原价${baseCost}),当前持有:${signInfo?.totalRewards || 0}`;
|
|
2265
2255
|
}
|
|
2266
2256
|
await ctx.database.withTransaction(async () => {
|
|
2267
2257
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
@@ -2286,20 +2276,14 @@ function apply(ctx, config) {
|
|
|
2286
2276
|
const newLevel = equipment.level + 1;
|
|
2287
2277
|
const damage = (weaponData.damage * (1 + 0.1 * newLevel)).toFixed(1);
|
|
2288
2278
|
let msg = `${target} 升级成功!Lv.${newLevel}`;
|
|
2289
|
-
const priceInfo =
|
|
2290
|
-
💸 消耗:${actualCost}
|
|
2291
|
-
💸 消耗:${actualCost}
|
|
2279
|
+
const priceInfo = totalDiscount > 0 ? `
|
|
2280
|
+
💸 消耗:${actualCost}金币 (原价${baseCost})` : `
|
|
2281
|
+
💸 消耗:${actualCost}金币`;
|
|
2292
2282
|
msg += priceInfo;
|
|
2293
|
-
let discountDetails = [];
|
|
2294
|
-
if (weaponDiscount > 0) {
|
|
2295
|
-
discountDetails.push(`${Math.round(weaponDiscount * 100)}% (武器系统 Lv${techLevel})`);
|
|
2296
|
-
}
|
|
2297
|
-
if (activeWish) {
|
|
2298
|
-
discountDetails.push("20% (灵狐升运祈愿生效)");
|
|
2299
|
-
}
|
|
2300
2283
|
if (discountDetails.length > 0) {
|
|
2301
2284
|
msg += `
|
|
2302
|
-
🔧
|
|
2285
|
+
🔧 折扣:
|
|
2286
|
+
${discountDetails.join("\n▸ ")}`;
|
|
2303
2287
|
}
|
|
2304
2288
|
msg += `
|
|
2305
2289
|
💥 伤害:${damage}`;
|
|
@@ -2338,14 +2322,11 @@ function apply(ctx, config) {
|
|
|
2338
2322
|
const level = `${index}→${index + 1}`;
|
|
2339
2323
|
let finalPrice = baseCost;
|
|
2340
2324
|
if (hasTechDiscount || hasFoxDiscount) {
|
|
2341
|
-
let
|
|
2342
|
-
if (hasTechDiscount)
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
discounted *= 0.8;
|
|
2347
|
-
}
|
|
2348
|
-
finalPrice = Math.floor(discounted);
|
|
2325
|
+
let totalDiscount = 0;
|
|
2326
|
+
if (hasTechDiscount) totalDiscount += techDiscountRate;
|
|
2327
|
+
if (hasFoxDiscount) totalDiscount += foxDiscount;
|
|
2328
|
+
totalDiscount = Math.min(totalDiscount, 100);
|
|
2329
|
+
finalPrice = Math.floor(baseCost * (1 - totalDiscount / 100));
|
|
2349
2330
|
}
|
|
2350
2331
|
const showOriginal = finalPrice < baseCost;
|
|
2351
2332
|
return [
|
|
@@ -2358,7 +2339,7 @@ function apply(ctx, config) {
|
|
|
2358
2339
|
discountNotice.push(`🔧 武器系统 Lv${techLevel} (${techDiscountRate}% 折扣)`);
|
|
2359
2340
|
}
|
|
2360
2341
|
if (hasFoxDiscount) {
|
|
2361
|
-
discountNotice.push("🦊
|
|
2342
|
+
discountNotice.push("🦊 灵狐升运祈愿 (20% 折扣)");
|
|
2362
2343
|
}
|
|
2363
2344
|
if (!hasTechDiscount && !hasFoxDiscount) {
|
|
2364
2345
|
discountNotice.push("💡 提示:加入人类联盟并升级武器系统可获得折扣");
|
|
@@ -2396,21 +2377,18 @@ function apply(ctx, config) {
|
|
|
2396
2377
|
let hiddenWinCount = 0;
|
|
2397
2378
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2398
2379
|
if (!profile) {
|
|
2399
|
-
return "🔒
|
|
2380
|
+
return "🔒 需要先绑定游戏句柄";
|
|
2400
2381
|
}
|
|
2401
2382
|
const { regionId, realmId, profileId } = profile;
|
|
2402
2383
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2403
2384
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2404
2385
|
if (existingEntries.length > 0) {
|
|
2405
|
-
return
|
|
2386
|
+
return `⛔ 您已被列入黑名单`;
|
|
2406
2387
|
}
|
|
2407
2388
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
2408
|
-
|
|
2409
|
-
return "您还没有签到。";
|
|
2410
|
-
}
|
|
2411
|
-
const quantity = backpack.quantity;
|
|
2389
|
+
const quantity = backpack?.quantity;
|
|
2412
2390
|
if (quantity < 1) {
|
|
2413
|
-
return "
|
|
2391
|
+
return "您背包中的咕咕币不足";
|
|
2414
2392
|
}
|
|
2415
2393
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
2416
2394
|
handle,
|
|
@@ -2435,20 +2413,17 @@ function apply(ctx, config) {
|
|
|
2435
2413
|
const session = argv.session;
|
|
2436
2414
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2437
2415
|
if (!profile) {
|
|
2438
|
-
return "🔒
|
|
2416
|
+
return "🔒 需要先绑定游戏句柄";
|
|
2439
2417
|
}
|
|
2440
2418
|
const { regionId, realmId, profileId } = profile;
|
|
2441
2419
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2442
2420
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2443
2421
|
if (existingEntries.length > 0) {
|
|
2444
|
-
return
|
|
2422
|
+
return `⛔ 您已被列入黑名单`;
|
|
2445
2423
|
}
|
|
2446
2424
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
2447
|
-
if (
|
|
2448
|
-
return "
|
|
2449
|
-
}
|
|
2450
|
-
if (backpack.quantity < 1) {
|
|
2451
|
-
return "您的咕咕币不足。";
|
|
2425
|
+
if (backpack?.quantity < 1) {
|
|
2426
|
+
return "您背包中的咕咕币不足";
|
|
2452
2427
|
}
|
|
2453
2428
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
2454
2429
|
handle,
|
|
@@ -2468,20 +2443,17 @@ function apply(ctx, config) {
|
|
|
2468
2443
|
let hiddenWinCount = 0;
|
|
2469
2444
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2470
2445
|
if (!profile) {
|
|
2471
|
-
return "🔒
|
|
2446
|
+
return "🔒 需要先绑定游戏句柄";
|
|
2472
2447
|
}
|
|
2473
2448
|
const { regionId, realmId, profileId } = profile;
|
|
2474
2449
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2475
2450
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2476
2451
|
if (existingEntries.length > 0) {
|
|
2477
|
-
return
|
|
2452
|
+
return `⛔ 您已被列入黑名单`;
|
|
2478
2453
|
}
|
|
2479
2454
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
2480
|
-
if (
|
|
2481
|
-
return "
|
|
2482
|
-
}
|
|
2483
|
-
if (backpack.quantity < 10) {
|
|
2484
|
-
return "您的咕咕币不足。";
|
|
2455
|
+
if (backpack?.quantity < 10) {
|
|
2456
|
+
return "您背包中的咕咕币不足";
|
|
2485
2457
|
}
|
|
2486
2458
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
2487
2459
|
handle,
|
|
@@ -2497,35 +2469,19 @@ function apply(ctx, config) {
|
|
|
2497
2469
|
const [record] = await ctx.database.get("ggcevo_records", { handle });
|
|
2498
2470
|
return [
|
|
2499
2471
|
"十连抽结果:",
|
|
2500
|
-
...results.map((r) => r ? "
|
|
2472
|
+
...results.map((r) => r ? "🎉 获得兑换券" : "❌ 未中奖"),
|
|
2501
2473
|
`保底进度:${record.pityCounter}/90`,
|
|
2502
2474
|
...hiddenWinCount > 0 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 ${hiddenWinCount} 张兑换券和 ${hiddenWinCount} 枚扭蛋币!`] : []
|
|
2503
2475
|
].join("\n");
|
|
2504
2476
|
});
|
|
2505
|
-
ctx.command("ggcevo/抽奖记录").action(async (argv) => {
|
|
2506
|
-
const session = argv.session;
|
|
2507
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2508
|
-
if (!profile) {
|
|
2509
|
-
return "🔒 需要先绑定游戏句柄。";
|
|
2510
|
-
}
|
|
2511
|
-
const { regionId, realmId, profileId } = profile;
|
|
2512
|
-
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2513
|
-
const [record] = await ctx.database.get("ggcevo_records", { handle });
|
|
2514
|
-
return record ? [
|
|
2515
|
-
`总抽数:${record.totalPulls}`,
|
|
2516
|
-
`下次保底剩余:${90 - record.pityCounter}抽`,
|
|
2517
|
-
`已保底次数:${record.fullPityCount}`,
|
|
2518
|
-
...record.hiddenawards ? [`抽中隐藏奖励次数:${record.hiddenawards}`] : []
|
|
2519
|
-
].join("\n") : "您还没有进行过抽奖";
|
|
2520
|
-
});
|
|
2521
2477
|
ctx.command("ggcevo/背包").action(async (argv) => {
|
|
2522
2478
|
const session = argv.session;
|
|
2523
2479
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2524
|
-
if (!profile) return "🔒
|
|
2480
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2525
2481
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2526
2482
|
const items = await ctx.database.get("ggcevo_backpack", { handle });
|
|
2527
2483
|
const validItems = items.filter((item) => item.quantity > 0);
|
|
2528
|
-
if (!validItems.length) return "
|
|
2484
|
+
if (!validItems.length) return "您的背包空空如也。";
|
|
2529
2485
|
const itemDetails = validItems.map((userItem) => {
|
|
2530
2486
|
const entry = Object.entries(initDefaultItems).find(
|
|
2531
2487
|
([, item]) => item.id === userItem.itemId
|
|
@@ -2542,11 +2498,11 @@ ${itemDetails.join("\n")}`;
|
|
|
2542
2498
|
const session = argv.session;
|
|
2543
2499
|
let latestTime;
|
|
2544
2500
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2545
|
-
if (!profile) return "🔒
|
|
2501
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2546
2502
|
const { regionId, realmId, profileId } = profile;
|
|
2547
2503
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2548
2504
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2549
|
-
if (existingEntries.length > 0) return "
|
|
2505
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
2550
2506
|
const now = /* @__PURE__ */ new Date();
|
|
2551
2507
|
const currentChinaTime = convertUTCtoChinaTime(now);
|
|
2552
2508
|
if (config.signrequire) {
|
|
@@ -2564,7 +2520,7 @@ ${itemDetails.join("\n")}`;
|
|
|
2564
2520
|
} else {
|
|
2565
2521
|
latestTime = currentChinaTime;
|
|
2566
2522
|
}
|
|
2567
|
-
if (!latestTime) return "
|
|
2523
|
+
if (!latestTime) return "请游玩过“咕咕虫-evolved”后签到。";
|
|
2568
2524
|
const targetDateChina = new Date(latestTime);
|
|
2569
2525
|
targetDateChina.setUTCDate(targetDateChina.getUTCDate() + 1);
|
|
2570
2526
|
if (!isSameDate(latestTime, currentChinaTime) && !isSameDate(targetDateChina, currentChinaTime)) {
|
|
@@ -2587,15 +2543,10 @@ ${itemDetails.join("\n")}`;
|
|
|
2587
2543
|
monthlyDays = record.monthlyDays + 1;
|
|
2588
2544
|
}
|
|
2589
2545
|
}
|
|
2590
|
-
const
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
startTime: { $lte: now },
|
|
2594
|
-
endTime: { $gte: now },
|
|
2595
|
-
isused: false
|
|
2596
|
-
});
|
|
2546
|
+
const messages = [];
|
|
2547
|
+
let totalBonus = 0;
|
|
2548
|
+
let basePoints;
|
|
2597
2549
|
let tickets = 3;
|
|
2598
|
-
let points = getRandomInt(20, 40);
|
|
2599
2550
|
if (monthlyDays === 7) {
|
|
2600
2551
|
tickets = 4;
|
|
2601
2552
|
} else if (monthlyDays === 14) {
|
|
@@ -2605,62 +2556,61 @@ ${itemDetails.join("\n")}`;
|
|
|
2605
2556
|
} else if (monthlyDays === 28) {
|
|
2606
2557
|
tickets = 7;
|
|
2607
2558
|
}
|
|
2608
|
-
if (monthlyDays
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
points = getRandomInt(80, 100);
|
|
2614
|
-
} else if (monthlyDays >= 28) {
|
|
2615
|
-
points = getRandomInt(100, 200);
|
|
2616
|
-
}
|
|
2617
|
-
let redCrystal = 0;
|
|
2618
|
-
let effectMessage = "";
|
|
2619
|
-
let bonusMessage = "";
|
|
2620
|
-
let careerCrystalMessage = "";
|
|
2621
|
-
let cred17Message = "";
|
|
2622
|
-
let allianceBonusMessage = "";
|
|
2559
|
+
if (monthlyDays < 7) basePoints = getRandomInt(20, 40);
|
|
2560
|
+
else if (monthlyDays < 14) basePoints = getRandomInt(40, 60);
|
|
2561
|
+
else if (monthlyDays < 21) basePoints = getRandomInt(60, 80);
|
|
2562
|
+
else if (monthlyDays < 28) basePoints = getRandomInt(80, 100);
|
|
2563
|
+
else basePoints = getRandomInt(100, 200);
|
|
2623
2564
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
2624
2565
|
if (careerData?.group === "人类联盟") {
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
let miningBonus = 0;
|
|
2630
|
-
let miningMessage = "";
|
|
2631
|
-
const BASE_BONUS = [5, 10, 15, 20, 25];
|
|
2632
|
-
const CAREER_BONUS = [10, 20, 30, 40, 50];
|
|
2566
|
+
totalBonus += 0.2;
|
|
2567
|
+
messages.push("🏛️ 人类联盟阵营加成:金币+20%");
|
|
2568
|
+
const [userMiningTech] = await ctx.database.get("ggcevo_tech", { handle, techId: 1 }).catch(() => [{ level: 0 }]);
|
|
2569
|
+
const techLevel = Math.min(userMiningTech?.level || 0, 5);
|
|
2633
2570
|
const miningTechConfig = Spacestationtechnology.find((t) => t.techId === 1);
|
|
2634
2571
|
if (miningTechConfig) {
|
|
2635
|
-
const
|
|
2636
|
-
|
|
2637
|
-
techId: 1
|
|
2638
|
-
}).catch(() => [{ level: 0 }]);
|
|
2639
|
-
const techLevel = Math.min(Math.max(userMiningTech?.level || 0, 0), 5);
|
|
2640
|
-
const baseBonus = techLevel > 0 ? BASE_BONUS[techLevel - 1] : 0;
|
|
2572
|
+
const BASE_BONUS = [5, 10, 15, 20, 25];
|
|
2573
|
+
const baseTechBonus = techLevel > 0 ? BASE_BONUS[techLevel - 1] : 0;
|
|
2641
2574
|
let careerTechBonus = 0;
|
|
2642
|
-
if (careerData
|
|
2575
|
+
if (careerData.career && miningTechConfig.careerNames.includes(careerData.career)) {
|
|
2576
|
+
const CAREER_BONUS = [10, 20, 30, 40, 50];
|
|
2643
2577
|
careerTechBonus = techLevel > 0 ? CAREER_BONUS[techLevel - 1] : 0;
|
|
2644
2578
|
}
|
|
2645
|
-
|
|
2646
|
-
if (
|
|
2647
|
-
|
|
2648
|
-
|
|
2579
|
+
const finalBonus = Math.max(baseTechBonus, careerTechBonus);
|
|
2580
|
+
if (finalBonus > 0) {
|
|
2581
|
+
totalBonus += finalBonus / 100;
|
|
2582
|
+
messages.push(`⚙️ 采掘系统 Lv${techLevel} 加成:金币+${finalBonus}%`);
|
|
2649
2583
|
}
|
|
2650
2584
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
minerBonus = 50;
|
|
2655
|
-
minerMessage = `
|
|
2656
|
-
⛏️ 深空矿工职业加成:金币+50%`;
|
|
2585
|
+
if (careerData.career === "深空矿工") {
|
|
2586
|
+
totalBonus += 0.5;
|
|
2587
|
+
messages.push("⛏️ 深空矿工职业加成:金币+50%");
|
|
2657
2588
|
}
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2589
|
+
}
|
|
2590
|
+
if (careerData?.group === "辛迪加海盗") {
|
|
2591
|
+
const [cred17Item] = await ctx.database.get("ggcevo_warehouse", { handle, itemId: 3 });
|
|
2592
|
+
if (cred17Item?.quantity >= 1) {
|
|
2593
|
+
const currentGold = record?.totalRewards || 0;
|
|
2594
|
+
const additional = Math.min(Math.floor(currentGold / 100), 100);
|
|
2595
|
+
const credBonus = 0.5 + additional / 100;
|
|
2596
|
+
totalBonus += credBonus;
|
|
2597
|
+
messages.push(`💎 CRED-17生效:金币+50% 额外+${additional}%`);
|
|
2661
2598
|
}
|
|
2662
|
-
bonusMessage = miningMessage + minerMessage;
|
|
2663
2599
|
}
|
|
2600
|
+
const [meowEffect] = await ctx.database.get("ggcevo_Wish_Record", {
|
|
2601
|
+
handle,
|
|
2602
|
+
wishname: "喵喵财源",
|
|
2603
|
+
startTime: { $lte: now },
|
|
2604
|
+
endTime: { $gte: now },
|
|
2605
|
+
isused: false
|
|
2606
|
+
});
|
|
2607
|
+
if (meowEffect) {
|
|
2608
|
+
tickets *= 2;
|
|
2609
|
+
totalBonus += 1;
|
|
2610
|
+
messages.push("🐾 喵喵财源祈愿生效:咕咕币×2,金币+100%");
|
|
2611
|
+
}
|
|
2612
|
+
const finalPoints = Math.round(basePoints * (1 + totalBonus));
|
|
2613
|
+
let redCrystal = 0;
|
|
2664
2614
|
if (careerData?.group === "辛迪加海盗" && careerData.career === "辛迪加财务经理") {
|
|
2665
2615
|
if (monthlyDays < 7) {
|
|
2666
2616
|
redCrystal = 1;
|
|
@@ -2673,32 +2623,14 @@ ${itemDetails.join("\n")}`;
|
|
|
2673
2623
|
} else {
|
|
2674
2624
|
redCrystal = 5;
|
|
2675
2625
|
}
|
|
2676
|
-
|
|
2677
|
-
⚓ 辛迪加财务经理职业加成:获得 ${redCrystal} 红晶`;
|
|
2678
|
-
}
|
|
2679
|
-
if (careerData?.group === "辛迪加海盗") {
|
|
2680
|
-
const [cred17Item] = await ctx.database.get("ggcevo_warehouse", { handle, itemId: 3 });
|
|
2681
|
-
if (cred17Item?.quantity >= 1) {
|
|
2682
|
-
const currentGold = record?.totalRewards || 0;
|
|
2683
|
-
const additionalBonus = Math.min(Math.floor(currentGold / 100), 100);
|
|
2684
|
-
const totalBonus = 0.5 + additionalBonus * 0.01;
|
|
2685
|
-
points = Math.round(points * (1 + totalBonus));
|
|
2686
|
-
cred17Message = `
|
|
2687
|
-
💎 CRED-17生效:签到奖励+50%,当前金币${currentGold}(+${additionalBonus}%),总计加成+${(totalBonus * 100).toFixed(0)}%`;
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
if (meowEffect) {
|
|
2691
|
-
tickets *= 2;
|
|
2692
|
-
points *= 2;
|
|
2693
|
-
effectMessage = "\n🐾 喵喵财源祈愿生效,获得双倍奖励(金币和咕咕币)!";
|
|
2626
|
+
messages.push(`⚓ 辛迪加财务经理职业加成:获得${redCrystal}枚红晶`);
|
|
2694
2627
|
}
|
|
2695
|
-
effectMessage += cred17Message;
|
|
2696
2628
|
await ctx.database.withTransaction(async () => {
|
|
2697
2629
|
await ctx.database.upsert("ggcevo_sign", [{
|
|
2698
2630
|
handle,
|
|
2699
2631
|
lastSign: now,
|
|
2700
2632
|
monthlyDays,
|
|
2701
|
-
totalRewards: (record?.totalRewards || 0) +
|
|
2633
|
+
totalRewards: (record?.totalRewards || 0) + finalPoints
|
|
2702
2634
|
}]);
|
|
2703
2635
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
2704
2636
|
handle,
|
|
@@ -2712,9 +2644,15 @@ ${itemDetails.join("\n")}`;
|
|
|
2712
2644
|
}], ["handle"]);
|
|
2713
2645
|
}
|
|
2714
2646
|
});
|
|
2647
|
+
let effectMessage = "";
|
|
2648
|
+
if (messages.length > 0) {
|
|
2649
|
+
effectMessage = `
|
|
2650
|
+
⚡ 加成效果:
|
|
2651
|
+
▸ ${messages.join("\n▸ ")}`;
|
|
2652
|
+
}
|
|
2715
2653
|
return `签到成功!本月累计签到${monthlyDays}天,获得:
|
|
2716
|
-
💰 金币 x ${
|
|
2717
|
-
🪙 咕咕币 x ${tickets}
|
|
2654
|
+
💰 金币 x ${finalPoints}(基础值 ${basePoints})
|
|
2655
|
+
🪙 咕咕币 x ${tickets}${effectMessage}`;
|
|
2718
2656
|
} catch (error) {
|
|
2719
2657
|
console.error("签到命令时发生错误:", error);
|
|
2720
2658
|
return "服务器繁忙,请稍后尝试。";
|
|
@@ -2724,13 +2662,13 @@ ${itemDetails.join("\n")}`;
|
|
|
2724
2662
|
try {
|
|
2725
2663
|
const session = argv.session;
|
|
2726
2664
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2727
|
-
if (!profile) return "🔒
|
|
2665
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2728
2666
|
const { regionId, realmId, profileId } = profile;
|
|
2729
2667
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2730
2668
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2731
|
-
if (existingEntries.length > 0) return "
|
|
2669
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
2732
2670
|
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2733
|
-
if (!record) return "
|
|
2671
|
+
if (!record) return "暂未查询到您的签到记录";
|
|
2734
2672
|
const lastSignChina = convertUTCtoChinaTime(record.lastSign);
|
|
2735
2673
|
const targetDateChina = new Date(lastSignChina);
|
|
2736
2674
|
const nowChina = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
|
|
@@ -2739,7 +2677,7 @@ ${itemDetails.join("\n")}`;
|
|
|
2739
2677
|
const yesterday = new Date(targetDateChina).getUTCDate() - 1;
|
|
2740
2678
|
if (targetDateChina.getUTCFullYear() !== currentYear || targetDateChina.getUTCMonth() !== currentMonth || // 必须当月
|
|
2741
2679
|
record.monthlyDays > yesterday) {
|
|
2742
|
-
return "
|
|
2680
|
+
return "暂时没有可补签的日期";
|
|
2743
2681
|
}
|
|
2744
2682
|
const costPoints = 100;
|
|
2745
2683
|
if (record.totalRewards < costPoints) {
|
|
@@ -2776,46 +2714,16 @@ ${itemDetails.join("\n")}`;
|
|
|
2776
2714
|
return "补签失败,请稍后重试。";
|
|
2777
2715
|
}
|
|
2778
2716
|
});
|
|
2779
|
-
ctx.command("ggcevo/签到记录").action(async (argv) => {
|
|
2780
|
-
const session = argv.session;
|
|
2781
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2782
|
-
if (!profile) return "🔒 需要先绑定游戏句柄。";
|
|
2783
|
-
const { regionId, realmId, profileId } = profile;
|
|
2784
|
-
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2785
|
-
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2786
|
-
if (!record) return "您还没有签到。";
|
|
2787
|
-
const chinaTime = record.lastSign.toLocaleString("zh-CN", {
|
|
2788
|
-
timeZone: "Asia/Shanghai",
|
|
2789
|
-
year: "numeric",
|
|
2790
|
-
month: "2-digit",
|
|
2791
|
-
day: "2-digit",
|
|
2792
|
-
hour: "2-digit",
|
|
2793
|
-
minute: "2-digit",
|
|
2794
|
-
second: "2-digit",
|
|
2795
|
-
hour12: false
|
|
2796
|
-
});
|
|
2797
|
-
return [
|
|
2798
|
-
`您的句柄:${handle}`,
|
|
2799
|
-
`📅 最后签到时间:${chinaTime}`,
|
|
2800
|
-
`🔥 累计签到:${record.monthlyDays}天`,
|
|
2801
|
-
`💰 拥有金币:${record.totalRewards}枚金币`
|
|
2802
|
-
].join("\n");
|
|
2803
|
-
});
|
|
2804
2717
|
ctx.guild().command("ggcevo/每月津贴").action(async (argv) => {
|
|
2805
2718
|
const session = argv.session;
|
|
2806
2719
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2807
|
-
if (!profile) return "🔒
|
|
2720
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2808
2721
|
const { regionId, realmId, profileId } = profile;
|
|
2809
2722
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
2810
|
-
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2811
|
-
if (existingEntries.length > 0) {
|
|
2812
|
-
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2813
|
-
}
|
|
2814
2723
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
2815
|
-
if (!backpack) return "您还没有签到。";
|
|
2816
2724
|
const memberInfo = await session.event?.member?.roles;
|
|
2817
2725
|
if (memberInfo?.includes("member")) {
|
|
2818
|
-
return "❌
|
|
2726
|
+
return "❌ 仅限管理员和群主领取每月津贴";
|
|
2819
2727
|
}
|
|
2820
2728
|
const now = /* @__PURE__ */ new Date();
|
|
2821
2729
|
const chinatime = convertUTCtoChinaTime(now);
|
|
@@ -2842,26 +2750,26 @@ ${itemDetails.join("\n")}`;
|
|
|
2842
2750
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
2843
2751
|
handle,
|
|
2844
2752
|
itemId: 1,
|
|
2845
|
-
quantity: (backpack
|
|
2753
|
+
quantity: (backpack?.quantity || 0) + 50
|
|
2846
2754
|
}]);
|
|
2847
2755
|
return `[管理专属] 成功领取本月津贴,获得了50枚咕咕币!`;
|
|
2848
2756
|
});
|
|
2849
2757
|
ctx.command("ggcevo/领取 [name]").action(async (argv, name2) => {
|
|
2850
2758
|
const session = argv.session;
|
|
2759
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2760
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2761
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2762
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2763
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
2851
2764
|
if (!name2) {
|
|
2852
|
-
await session.send("请在30
|
|
2765
|
+
await session.send("请在30秒内输入活动名称:");
|
|
2853
2766
|
name2 = await session.prompt(3e4);
|
|
2854
|
-
if (!name2) return "
|
|
2767
|
+
if (!name2) return "已取消操作,请重新输入。";
|
|
2855
2768
|
}
|
|
2856
2769
|
const itemIdToName = {};
|
|
2857
2770
|
for (const [name3, item] of Object.entries(initDefaultItems)) {
|
|
2858
2771
|
itemIdToName[item.id] = name3;
|
|
2859
2772
|
}
|
|
2860
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2861
|
-
if (!profile) return "🔒 需要先绑定游戏句柄。";
|
|
2862
|
-
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2863
|
-
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2864
|
-
if (existingEntries.length > 0) return "❌ 拒绝访问,您已被列入黑名单。";
|
|
2865
2773
|
const [activity] = await ctx.database.get("ggcevo_activity", {
|
|
2866
2774
|
name: name2,
|
|
2867
2775
|
status: "进行中"
|
|
@@ -2931,7 +2839,9 @@ ${itemDetails.join("\n")}`;
|
|
|
2931
2839
|
});
|
|
2932
2840
|
return `活动【${activityName}】创建成功!奖励内容:${itemName} x${quantity}。`;
|
|
2933
2841
|
});
|
|
2934
|
-
ctx.command("ggcevo/活动列表").action(async () => {
|
|
2842
|
+
ctx.command("ggcevo/活动列表").action(async ({ session }) => {
|
|
2843
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2844
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
2935
2845
|
const activities = await ctx.database.get(
|
|
2936
2846
|
"ggcevo_activity",
|
|
2937
2847
|
{ status: "进行中" },
|
|
@@ -2946,7 +2856,7 @@ ${itemDetails.join("\n")}`;
|
|
|
2946
2856
|
`活动时间:${formatDate(a.startTime)} - ${formatDate(a.endTime)}`,
|
|
2947
2857
|
`活动描述:${a.description}`,
|
|
2948
2858
|
`活动奖励:${a.quantity} ${itemMap.get(a.itemId) || "未知物品"}`,
|
|
2949
|
-
"━".repeat(
|
|
2859
|
+
"━".repeat(14)
|
|
2950
2860
|
].join("\n")),
|
|
2951
2861
|
"请输入「领取 活动名称」领取奖励"
|
|
2952
2862
|
].join("\n") : "当前没有进行中的活动。";
|
|
@@ -3095,7 +3005,9 @@ ${itemDetails.join("\n")}`;
|
|
|
3095
3005
|
return "服务器繁忙,请稍后尝试。";
|
|
3096
3006
|
}
|
|
3097
3007
|
});
|
|
3098
|
-
ctx.command("ggcevo/胜点榜 [page]").usage("输入 胜点榜 [页码] 查看对应页的排行榜,每页10条").action(async (
|
|
3008
|
+
ctx.command("ggcevo/胜点榜 [page]").usage("输入 胜点榜 [页码] 查看对应页的排行榜,每页10条").action(async ({ session }, page) => {
|
|
3009
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3010
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3099
3011
|
const pageNum = parseInt(page) || 1;
|
|
3100
3012
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
3101
3013
|
const offset = (pageNum - 1) * 10;
|
|
@@ -3104,7 +3016,7 @@ ${itemDetails.join("\n")}`;
|
|
|
3104
3016
|
ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).execute((row) => import_koishi.$.count(row.handle))
|
|
3105
3017
|
]);
|
|
3106
3018
|
const totalPages = Math.ceil(total / 10);
|
|
3107
|
-
if (pageNum > totalPages) return
|
|
3019
|
+
if (pageNum > totalPages) return `查询失败,最多有 ${totalPages} 页`;
|
|
3108
3020
|
const processedRecords = await Promise.all(
|
|
3109
3021
|
records.map(async (item) => ({
|
|
3110
3022
|
...item,
|
|
@@ -3259,7 +3171,7 @@ ${itemDetails.join("\n")}`;
|
|
|
3259
3171
|
if (!player) {
|
|
3260
3172
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3261
3173
|
if (!profile) {
|
|
3262
|
-
return "🔒
|
|
3174
|
+
return "🔒 需要先绑定游戏句柄";
|
|
3263
3175
|
}
|
|
3264
3176
|
const { regionId, realmId, profileId } = profile;
|
|
3265
3177
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
@@ -3287,7 +3199,7 @@ ${itemDetails.join("\n")}`;
|
|
|
3287
3199
|
} else {
|
|
3288
3200
|
const parsedUser = import_koishi.h.parse(player)[0];
|
|
3289
3201
|
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) {
|
|
3290
|
-
return "
|
|
3202
|
+
return "参数错误,请输入“排名 @玩家”";
|
|
3291
3203
|
}
|
|
3292
3204
|
const targetUserId = parsedUser.attrs.id;
|
|
3293
3205
|
let targetUsername = parsedUser.attrs.name || targetUserId;
|
|
@@ -3323,7 +3235,7 @@ ${itemDetails.join("\n")}`;
|
|
|
3323
3235
|
ctx.command("ggcevo/给予 <handle> <itemName:string> <amount:number>", "增加用户物品/金币", { authority: 3 }).action(async (_, handle, itemName, amount) => {
|
|
3324
3236
|
try {
|
|
3325
3237
|
if (!handle || !itemName || amount <= 0) {
|
|
3326
|
-
return "参数格式错误,正确格式:给予
|
|
3238
|
+
return "参数格式错误,正确格式:给予 句柄 物品名称 数量";
|
|
3327
3239
|
}
|
|
3328
3240
|
const parsedAmount = Math.floor(amount);
|
|
3329
3241
|
if (itemName === "金币") {
|
|
@@ -3368,19 +3280,19 @@ ${itemDetails.join("\n")}`;
|
|
|
3368
3280
|
return "操作失败:" + (err instanceof Error ? err.message : "数据库异常");
|
|
3369
3281
|
}
|
|
3370
3282
|
});
|
|
3371
|
-
ctx.command("ggcevo/违规记录 [user]", "违规记录查询").usage("输入 违规记录 [
|
|
3283
|
+
ctx.command("ggcevo/违规记录 [user]", "违规记录查询").usage("输入 违规记录 [@玩家] -p 页码 查看处罚记录,每页1条").option("p", "-p <page:number> 指定页码").action(async (argv) => {
|
|
3372
3284
|
const session = argv.session;
|
|
3373
3285
|
const pageNum = argv.options.p ? argv.options.p : 1;
|
|
3374
3286
|
const user = argv.args[0];
|
|
3375
3287
|
let handle;
|
|
3376
3288
|
if (!user) {
|
|
3377
3289
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3378
|
-
if (!profile) return "🔒
|
|
3290
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3379
3291
|
handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
3380
3292
|
} else {
|
|
3381
3293
|
const parsedUser = import_koishi.h.parse(user)[0];
|
|
3382
3294
|
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) {
|
|
3383
|
-
return "
|
|
3295
|
+
return "参数错误,请输入“违规记录 @玩家”";
|
|
3384
3296
|
}
|
|
3385
3297
|
const targetUserId = parsedUser.attrs.id;
|
|
3386
3298
|
let targetUsername = parsedUser.attrs.name || targetUserId;
|
|
@@ -3418,17 +3330,17 @@ ${itemDetails.join("\n")}`;
|
|
|
3418
3330
|
"------------------------------",
|
|
3419
3331
|
recordText,
|
|
3420
3332
|
"------------------------------",
|
|
3421
|
-
pageNum < totalPages ? `输入 违规记录 (
|
|
3333
|
+
pageNum < totalPages ? `输入 违规记录 (@玩家) -p ${pageNum + 1} 查看下一条` : "已是最后一页"
|
|
3422
3334
|
].join("\n");
|
|
3423
3335
|
});
|
|
3424
3336
|
ctx.command("ggcevo/兑换", "兑换物品").action(async ({ session }) => {
|
|
3425
3337
|
try {
|
|
3426
3338
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3427
|
-
if (!profile) return "🔒
|
|
3339
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3428
3340
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
3429
3341
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
3430
3342
|
if (existingEntries.length > 0) {
|
|
3431
|
-
return
|
|
3343
|
+
return `⛔ 您已被列入黑名单`;
|
|
3432
3344
|
}
|
|
3433
3345
|
const currentSeason = config.rankseason;
|
|
3434
3346
|
const qualityGroups = {};
|
|
@@ -3472,7 +3384,7 @@ ${items.join("、")}
|
|
|
3472
3384
|
}
|
|
3473
3385
|
await session.send(message);
|
|
3474
3386
|
const name2 = await session.prompt(3e4);
|
|
3475
|
-
if (!name2) return "
|
|
3387
|
+
if (!name2) return "已取消操作,请重新输入。";
|
|
3476
3388
|
const configname = itemConfig[name2];
|
|
3477
3389
|
if (!configname) return "无效的物品名称,请重新输入。";
|
|
3478
3390
|
const userRecords = await ctx.database.get("ggcevo_exchange", { handle, item: name2 });
|
|
@@ -3511,7 +3423,7 @@ ${items.join("、")}
|
|
|
3511
3423
|
if (!coupon || coupon.quantity < cost) {
|
|
3512
3424
|
const requireMsg = petItems.has(name2) ? `需要1个${configname.quality}级宠物扭蛋 或${configname.cost}张兑奖券` : `需要${configname.cost}张兑奖券`;
|
|
3513
3425
|
return `${requireMsg}
|
|
3514
|
-
|
|
3426
|
+
您当前持有:${coupon?.quantity || 0}个${couponName}`;
|
|
3515
3427
|
}
|
|
3516
3428
|
const isGlobal = configname.isLimited || config.ignoreGlobalLimit === false;
|
|
3517
3429
|
await ctx.database.withTransaction(async () => {
|
|
@@ -3532,38 +3444,19 @@ ${items.join("、")}
|
|
|
3532
3444
|
season: currentSeason
|
|
3533
3445
|
});
|
|
3534
3446
|
});
|
|
3535
|
-
return
|
|
3447
|
+
return `🎉 恭喜!您使用 ${cost} 个 ${couponName} 兑换了 【${name2}】`;
|
|
3536
3448
|
} catch (error) {
|
|
3537
3449
|
console.error("兑换失败:", error);
|
|
3538
3450
|
return "兑换失败";
|
|
3539
3451
|
}
|
|
3540
3452
|
});
|
|
3541
|
-
ctx.command("ggcevo/兑换记录").action(async ({ session }) => {
|
|
3542
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3543
|
-
if (!profile) return "🔒 需要先绑定游戏句柄。";
|
|
3544
|
-
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
3545
|
-
const exchanges = await ctx.database.get("ggcevo_exchange", { handle });
|
|
3546
|
-
if (!exchanges.length) return "您暂无兑换记录";
|
|
3547
|
-
const output = exchanges.map((e) => {
|
|
3548
|
-
const date = new Date(e.date);
|
|
3549
|
-
const cnTime = date.toLocaleString("zh-CN", {
|
|
3550
|
-
timeZone: "Asia/Shanghai",
|
|
3551
|
-
year: "numeric",
|
|
3552
|
-
month: "2-digit",
|
|
3553
|
-
day: "2-digit"
|
|
3554
|
-
});
|
|
3555
|
-
return `${e.type}: ${e.item} | 时间: ${cnTime}`;
|
|
3556
|
-
}).join("\n");
|
|
3557
|
-
return `${handle} 的兑换记录:
|
|
3558
|
-
${output}`;
|
|
3559
|
-
});
|
|
3560
3453
|
ctx.command("ggcevo/兑换扭蛋币").action(async ({ session }) => {
|
|
3561
3454
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3562
|
-
if (!profile) return "🔒
|
|
3455
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3563
3456
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
3564
3457
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
3565
3458
|
if (existingEntries.length > 0) {
|
|
3566
|
-
return
|
|
3459
|
+
return `⛔ 您已被列入黑名单`;
|
|
3567
3460
|
}
|
|
3568
3461
|
await session.send(`您确定要使用3张兑换券换取一枚扭蛋币吗?(请在30秒内回复“是”确认)`);
|
|
3569
3462
|
const confirm = await session.prompt(3e4);
|
|
@@ -3571,7 +3464,7 @@ ${output}`;
|
|
|
3571
3464
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
3572
3465
|
const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
|
|
3573
3466
|
if (!coupon || coupon.quantity < 3) {
|
|
3574
|
-
return `兑换扭蛋币需要3
|
|
3467
|
+
return `兑换扭蛋币需要3张兑奖券,您当前持有:${coupon?.quantity || 0}`;
|
|
3575
3468
|
}
|
|
3576
3469
|
await ctx.database.set(
|
|
3577
3470
|
"ggcevo_backpack",
|
|
@@ -3583,23 +3476,23 @@ ${output}`;
|
|
|
3583
3476
|
itemId: 3,
|
|
3584
3477
|
quantity: (backpack?.quantity || 0) + 1
|
|
3585
3478
|
}]);
|
|
3586
|
-
return
|
|
3479
|
+
return `🎉恭喜!您使用 3 张兑奖券兑换了 1 枚扭蛋币`;
|
|
3587
3480
|
});
|
|
3588
3481
|
ctx.command("ggcevo/扭蛋").action(async (argv) => {
|
|
3589
3482
|
const session = argv.session;
|
|
3590
3483
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3591
3484
|
if (!profile) {
|
|
3592
|
-
return "🔒
|
|
3485
|
+
return "🔒 需要先绑定游戏句柄";
|
|
3593
3486
|
}
|
|
3594
3487
|
const { regionId, realmId, profileId } = profile;
|
|
3595
3488
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
3596
3489
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
3597
3490
|
if (existingEntries.length > 0) {
|
|
3598
|
-
return
|
|
3491
|
+
return `⛔ 您已被列入黑名单`;
|
|
3599
3492
|
}
|
|
3600
3493
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
3601
3494
|
if (!backpack || backpack.quantity < 1) {
|
|
3602
|
-
return
|
|
3495
|
+
return `当前扭蛋币不足,您拥有:${backpack?.quantity || 0}枚`;
|
|
3603
3496
|
}
|
|
3604
3497
|
const awardName = PetCapsuleToy();
|
|
3605
3498
|
const awardItem = Object.entries(initDefaultItems).find(
|
|
@@ -3621,16 +3514,18 @@ ${output}`;
|
|
|
3621
3514
|
itemId: itemData.id,
|
|
3622
3515
|
quantity: currentQuantity + 1
|
|
3623
3516
|
}]);
|
|
3624
|
-
return `🎉
|
|
3517
|
+
return `🎉 恭喜!您获得了 ${itemName}`;
|
|
3625
3518
|
});
|
|
3626
|
-
ctx.command("ggcevo/拉黑", "添加用户到黑名单").action(async (argv) => {
|
|
3519
|
+
ctx.command("ggcevo/拉黑 [handle]", "添加用户到黑名单").action(async (argv, handle) => {
|
|
3627
3520
|
const session = argv.session;
|
|
3628
3521
|
if (!ctx.config.admins.includes(session.userId)) {
|
|
3629
3522
|
return "⚠️ 没有操作权限。";
|
|
3630
3523
|
}
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3524
|
+
if (!handle) {
|
|
3525
|
+
await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
|
|
3526
|
+
handle = await session.prompt(3e4);
|
|
3527
|
+
if (!handle) return "已取消操作,请重新输入。";
|
|
3528
|
+
}
|
|
3634
3529
|
try {
|
|
3635
3530
|
const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
|
|
3636
3531
|
if (!handleRegex.test(handle)) {
|
|
@@ -3644,20 +3539,22 @@ ${output}`;
|
|
|
3644
3539
|
handle,
|
|
3645
3540
|
createdAt: /* @__PURE__ */ new Date()
|
|
3646
3541
|
});
|
|
3647
|
-
return `✅
|
|
3542
|
+
return `✅ 操作成功,用户${handle}被列入黑名单。`;
|
|
3648
3543
|
} catch (error) {
|
|
3649
3544
|
console.error("黑名单操作失败:", error);
|
|
3650
3545
|
return "操作失败,请稍后重试。错误详情已记录";
|
|
3651
3546
|
}
|
|
3652
3547
|
});
|
|
3653
|
-
ctx.command("ggcevo/标记", "标记用户到胜点榜黑名单").action(async (argv) => {
|
|
3548
|
+
ctx.command("ggcevo/标记 [handle]", "标记用户到胜点榜黑名单").action(async (argv, handle) => {
|
|
3654
3549
|
const session = argv.session;
|
|
3655
3550
|
if (!ctx.config.admins.includes(session.userId)) {
|
|
3656
3551
|
return "⚠️ 没有操作权限。";
|
|
3657
3552
|
}
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3553
|
+
if (!handle) {
|
|
3554
|
+
await session.send("请在30秒内输入需要标记的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
|
|
3555
|
+
handle = await session.prompt(3e4);
|
|
3556
|
+
if (!handle) return "已取消操作,请重新输入。";
|
|
3557
|
+
}
|
|
3661
3558
|
try {
|
|
3662
3559
|
const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
|
|
3663
3560
|
if (!handleRegex.test(handle)) {
|
|
@@ -3665,48 +3562,24 @@ ${output}`;
|
|
|
3665
3562
|
}
|
|
3666
3563
|
const existingEntries = await ctx.database.get("ggcevo_rank", { handle, Blacklist: true, rankseason: config.rankseason });
|
|
3667
3564
|
if (existingEntries.length > 0) {
|
|
3668
|
-
return `${handle}
|
|
3565
|
+
return `${handle}已在当前赛季胜点榜上被标记。`;
|
|
3669
3566
|
}
|
|
3670
3567
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
3671
3568
|
handle,
|
|
3672
3569
|
Blacklist: true,
|
|
3673
3570
|
rankseason: config.rankseason
|
|
3674
3571
|
}]);
|
|
3675
|
-
return `✅
|
|
3572
|
+
return `✅ 操作成功,用户${handle}在当前赛季胜点榜上被标记。`;
|
|
3676
3573
|
} catch (error) {
|
|
3677
3574
|
console.error("黑名单操作失败:", error);
|
|
3678
3575
|
return "操作失败,请稍后重试。错误详情已记录";
|
|
3679
3576
|
}
|
|
3680
3577
|
});
|
|
3681
|
-
ctx.command("ggcevo/成就").action(async ({ session }) => {
|
|
3682
|
-
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3683
|
-
if (!profile) {
|
|
3684
|
-
return "🔒 需要先绑定游戏句柄。";
|
|
3685
|
-
}
|
|
3686
|
-
const { regionId, realmId, profileId } = profile;
|
|
3687
|
-
const achievements = await ctx.database.get("ggcevo_achievements", {
|
|
3688
|
-
handle: `${regionId}-S2-${realmId}-${profileId}`
|
|
3689
|
-
});
|
|
3690
|
-
if (!achievements.length) {
|
|
3691
|
-
return "你还没有获得任何成就。";
|
|
3692
|
-
}
|
|
3693
|
-
const achievementList = achievements.map((achievement) => {
|
|
3694
|
-
const date = new Date(achievement.gaintime);
|
|
3695
|
-
return `${achievement.achievementname} (获得于 ${date.toLocaleDateString("zh-CN", {
|
|
3696
|
-
timeZone: "Asia/Shanghai",
|
|
3697
|
-
year: "numeric",
|
|
3698
|
-
month: "2-digit",
|
|
3699
|
-
day: "2-digit"
|
|
3700
|
-
})})`;
|
|
3701
|
-
});
|
|
3702
|
-
return `${regionId}-S2-${realmId}-${profileId} 已获得的成就:
|
|
3703
|
-
${achievementList.join("\n")}`;
|
|
3704
|
-
});
|
|
3705
3578
|
ctx.command("ggcevo/个人信息").action(async (argv) => {
|
|
3706
3579
|
const session = argv.session;
|
|
3707
3580
|
const output = [];
|
|
3708
3581
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3709
|
-
if (!profile) return "🔒
|
|
3582
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3710
3583
|
const { regionId, realmId, profileId } = profile;
|
|
3711
3584
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
3712
3585
|
output.push(`🎮 游戏句柄:${handle}
|
|
@@ -3733,10 +3606,10 @@ ${achievementList.join("\n")}`;
|
|
|
3733
3606
|
if (lottery) {
|
|
3734
3607
|
output.push(
|
|
3735
3608
|
"🎉 抽奖统计:",
|
|
3736
|
-
|
|
3609
|
+
`总计抽奖:${lottery.totalPulls} 次`,
|
|
3737
3610
|
`距离保底剩余:${90 - lottery.pityCounter} 抽`,
|
|
3738
|
-
|
|
3739
|
-
...lottery.hiddenawards ? [
|
|
3611
|
+
`触发保底:${lottery.fullPityCount} 次`,
|
|
3612
|
+
...lottery.hiddenawards ? [`隐藏奖励:${lottery.hiddenawards} 次`] : [],
|
|
3740
3613
|
"──────────────"
|
|
3741
3614
|
);
|
|
3742
3615
|
}
|
|
@@ -3838,16 +3711,16 @@ ${achievementList.join("\n")}`;
|
|
|
3838
3711
|
ctx.command("ggcevo/pk [user]", "发起玩家对战").alias("挑战").action(async (argv, user) => {
|
|
3839
3712
|
try {
|
|
3840
3713
|
const session = argv.session;
|
|
3841
|
-
if (!user) return "请输入“pk @指定pk玩家”。";
|
|
3842
3714
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3843
|
-
if (!profile) return "🔒
|
|
3715
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
3844
3716
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
3845
3717
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
3846
3718
|
if (existingEntries.length > 0) {
|
|
3847
|
-
return
|
|
3719
|
+
return `⛔ 您已被列入黑名单`;
|
|
3848
3720
|
}
|
|
3721
|
+
if (!user) return "请输入“pk @玩家”。";
|
|
3849
3722
|
const parsedUser = import_koishi.h.parse(user)[0];
|
|
3850
|
-
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) return "参数格式错误,请输入“pk
|
|
3723
|
+
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) return "参数格式错误,请输入“pk @玩家”。";
|
|
3851
3724
|
const targetUserId = parsedUser.attrs.id;
|
|
3852
3725
|
const targetUsername = await session.bot.getGuildMember(session.guildId, targetUserId);
|
|
3853
3726
|
const [targetprofile] = await ctx.database.get("sc2arcade_player", { userId: targetUserId });
|
|
@@ -4016,7 +3889,7 @@ ${achievementList.join("\n")}`;
|
|
|
4016
3889
|
`🎰 金币变动:${stealPercentage}%`
|
|
4017
3890
|
];
|
|
4018
3891
|
isWin ? result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`) : result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
4019
|
-
initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴
|
|
3892
|
+
initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`) : "";
|
|
4020
3893
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
4021
3894
|
return result.join("\n");
|
|
4022
3895
|
} catch (error) {
|
|
@@ -4024,7 +3897,9 @@ ${achievementList.join("\n")}`;
|
|
|
4024
3897
|
return "对战功能暂时不可用,请稍后重试";
|
|
4025
3898
|
}
|
|
4026
3899
|
});
|
|
4027
|
-
ctx.command("ggcevo/pk榜 [page]", "查看玩家PK排行榜").usage("输入 pk榜 [页码] 查看对应页的排行榜,每页10条").action(async (
|
|
3900
|
+
ctx.command("ggcevo/pk榜 [page]", "查看玩家PK排行榜").usage("输入 pk榜 [页码] 查看对应页的排行榜,每页10条").action(async ({ session }, page) => {
|
|
3901
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
3902
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4028
3903
|
const pageNum = parseInt(page) || 1;
|
|
4029
3904
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
4030
3905
|
const offset = (pageNum - 1) * 10;
|
|
@@ -4035,7 +3910,7 @@ ${achievementList.join("\n")}`;
|
|
|
4035
3910
|
ctx.database.select("ggcevo_pk").where({ enable: true }).execute((row) => import_koishi.$.count(row.handle))
|
|
4036
3911
|
]);
|
|
4037
3912
|
const totalPages = Math.ceil(total / 10);
|
|
4038
|
-
if (pageNum > totalPages) return
|
|
3913
|
+
if (pageNum > totalPages) return `查询失败,最多有 ${totalPages} 页`;
|
|
4039
3914
|
if (!records.length) return "暂无PK记录";
|
|
4040
3915
|
const rankingText = records.map((record, index) => {
|
|
4041
3916
|
const winRate = record.total > 0 ? `${(record.wins / record.total * 100).toFixed(1)}%` : "N/A";
|
|
@@ -4057,7 +3932,7 @@ ${achievementList.join("\n")}`;
|
|
|
4057
3932
|
});
|
|
4058
3933
|
ctx.command("ggcevo/切换pk", "切换玩家对战状态").alias("切换pk状态").action(async ({ session }) => {
|
|
4059
3934
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4060
|
-
if (!profile) return "🔒
|
|
3935
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4061
3936
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4062
3937
|
const [pkRecord] = await ctx.database.get("ggcevo_pk", { handle }) || [null];
|
|
4063
3938
|
const currentState = pkRecord?.enable ?? true;
|
|
@@ -4077,12 +3952,12 @@ ${achievementList.join("\n")}`;
|
|
|
4077
3952
|
const now = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
|
|
4078
3953
|
const lastToggleTime = convertUTCtoChinaTime(lastToggle);
|
|
4079
3954
|
const diffDays = Math.floor((now.getTime() - lastToggleTime.getTime()) / (1e3 * 3600 * 24));
|
|
3955
|
+
const [careers] = await ctx.database.get("ggcevo_careers", { handle });
|
|
3956
|
+
if (careers?.group === "辛迪加海盗") return "您已经加入了辛迪加海盗阵营,无法切换PK状态!";
|
|
4080
3957
|
if (diffDays < 3 && lastToggleTime.getTime() !== 0) {
|
|
4081
3958
|
const remaining = 3 - diffDays;
|
|
4082
3959
|
return `状态切换冷却中,${remaining}天后再试(下次可切换时间:${new Date(lastToggle.getTime() + 3 * 864e5).toLocaleDateString("zh-CN")})。`;
|
|
4083
3960
|
}
|
|
4084
|
-
const [careers] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4085
|
-
if (careers?.group === "辛迪加海盗") return "您已经加入了辛迪加海盗阵营,无法切换PK状态!";
|
|
4086
3961
|
const action = currentState ? "关闭" : "开启";
|
|
4087
3962
|
await session.send(`您当前的PK状态为【${currentState ? "开启" : "关闭"}】,确认要${action}吗?(请在30秒内回复“是”确认)`);
|
|
4088
3963
|
const confirm = await session.prompt(3e4);
|
|
@@ -4115,7 +3990,24 @@ ${achievementList.join("\n")}`;
|
|
|
4115
3990
|
const CAREER_DISCOUNTS = [0, 0, 10, 15, 20];
|
|
4116
3991
|
const baseDiscount = techLevel > 0 ? BASE_DISCOUNTS[techLevel - 1] : 0;
|
|
4117
3992
|
const careerDiscount = isCareerMatch ? CAREER_DISCOUNTS[techLevel - 1] : 0;
|
|
4118
|
-
const
|
|
3993
|
+
const techDiscount = Math.max(baseDiscount, careerDiscount);
|
|
3994
|
+
const activeWish = await ctx.database.get("ggcevo_Wish_Record", {
|
|
3995
|
+
handle,
|
|
3996
|
+
wishname: "蚱蜢优购",
|
|
3997
|
+
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
3998
|
+
endTime: { $gte: /* @__PURE__ */ new Date() },
|
|
3999
|
+
isused: false
|
|
4000
|
+
}).then((records) => records[0]);
|
|
4001
|
+
const grasshopperDiscount = activeWish ? 20 : 0;
|
|
4002
|
+
let totalDiscount = techDiscount + grasshopperDiscount;
|
|
4003
|
+
totalDiscount = Math.min(totalDiscount, 100);
|
|
4004
|
+
const discountDetails = [];
|
|
4005
|
+
if (techDiscount > 0) {
|
|
4006
|
+
discountDetails.push(`武器系统 Lv${techLevel}:${techDiscount}%`);
|
|
4007
|
+
}
|
|
4008
|
+
if (grasshopperDiscount > 0) {
|
|
4009
|
+
discountDetails.push(`蚱蜢优购祈愿:${grasshopperDiscount}%`);
|
|
4010
|
+
}
|
|
4119
4011
|
const typeStats = Object.values(weaponConfig).filter((weapon) => weapon.price !== 0).reduce((stats, weapon) => {
|
|
4120
4012
|
stats[weapon.type] = (stats[weapon.type] || 0) + 1;
|
|
4121
4013
|
return stats;
|
|
@@ -4127,8 +4019,9 @@ ${achievementList.join("\n")}`;
|
|
|
4127
4019
|
"====================",
|
|
4128
4020
|
...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
|
|
4129
4021
|
"====================",
|
|
4130
|
-
|
|
4131
|
-
🔧
|
|
4022
|
+
totalDiscount > 0 && `
|
|
4023
|
+
🔧 当前购买折扣:
|
|
4024
|
+
${discountDetails.length ? ` ${discountDetails.join(" \n ")}` : ""}`
|
|
4132
4025
|
].filter(Boolean).join("\n");
|
|
4133
4026
|
}
|
|
4134
4027
|
if (!Object.keys(typeStats).includes(type)) {
|
|
@@ -4136,13 +4029,13 @@ ${achievementList.join("\n")}`;
|
|
|
4136
4029
|
${Object.keys(typeStats).join("、")}`;
|
|
4137
4030
|
}
|
|
4138
4031
|
const items = Object.entries(weaponConfig).filter(([_, config2]) => config2.type === type && config2.price !== 0).map(([name2, config2]) => {
|
|
4139
|
-
const actualPrice = Math.floor(config2.price * (
|
|
4032
|
+
const actualPrice = Math.floor(config2.price * (100 - totalDiscount) / 100);
|
|
4140
4033
|
const tagEffectsDesc = config2.tagEffects ? Object.entries(config2.tagEffects).map(([tag, multiplier]) => `▸ 对${tag}目标造成${(multiplier * 100).toFixed(0)}%伤害`).join("\n") : "▸ 无特殊加成效果";
|
|
4141
4034
|
return [
|
|
4142
4035
|
`【${name2}】`,
|
|
4143
4036
|
`类型:${config2.type}`,
|
|
4144
4037
|
`基础伤害:${config2.damage}`,
|
|
4145
|
-
`价格:${actualPrice}金币${
|
|
4038
|
+
`价格:${actualPrice}金币${totalDiscount > 0 ? ` (原价${config2.price})` : ""}`,
|
|
4146
4039
|
"特性:",
|
|
4147
4040
|
tagEffectsDesc,
|
|
4148
4041
|
`描述:${config2.description}`
|
|
@@ -4151,7 +4044,8 @@ ${Object.keys(typeStats).join("、")}`;
|
|
|
4151
4044
|
return [
|
|
4152
4045
|
`🏪 咕咕武器库 - ${type} 🏪`,
|
|
4153
4046
|
"使用“购买 武器名称”指令进行购买",
|
|
4154
|
-
|
|
4047
|
+
totalDiscount > 0 && `🔧 当前购买折扣:
|
|
4048
|
+
${discountDetails.length ? ` ${discountDetails.join(" \n ")}` : ""}`,
|
|
4155
4049
|
"====================",
|
|
4156
4050
|
...items,
|
|
4157
4051
|
items.length === 0 ? "⚠️ 该分类下暂无可用武器" : ""
|
|
@@ -4199,10 +4093,10 @@ ${validTypes.join("、")}`;
|
|
|
4199
4093
|
});
|
|
4200
4094
|
ctx.command("ggcevo/购买 <item>").action(async ({ session }, item) => {
|
|
4201
4095
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4202
|
-
if (!profile) return "🔒
|
|
4096
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4203
4097
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4204
4098
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4205
|
-
if (existingEntries.length > 0) return "
|
|
4099
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
4206
4100
|
const allItems = { ...weaponConfig, ...SyndicatedItems };
|
|
4207
4101
|
if (!item) return "请输入“购买 物品名称”来购买所需物品。";
|
|
4208
4102
|
const config2 = allItems[item];
|
|
@@ -4219,8 +4113,8 @@ ${validTypes.join("、")}`;
|
|
|
4219
4113
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
4220
4114
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4221
4115
|
const [weaponTech] = await ctx.database.get("ggcevo_tech", { handle, techId: 2 });
|
|
4222
|
-
let discountDetails = [];
|
|
4223
4116
|
let totalDiscount = 0;
|
|
4117
|
+
let discountDetails = [];
|
|
4224
4118
|
if (isWeapon && careerData?.group === "人类联盟") {
|
|
4225
4119
|
const techDiscountTable = {
|
|
4226
4120
|
3: [0, 10],
|
|
@@ -4235,7 +4129,7 @@ ${validTypes.join("、")}`;
|
|
|
4235
4129
|
if (techDiscount > 0) {
|
|
4236
4130
|
totalDiscount += techDiscount;
|
|
4237
4131
|
discountDetails.push(
|
|
4238
|
-
`武器系统 Lv${techLevel}${isQualifiedCareer ? "(职业加成)" : ""}
|
|
4132
|
+
`武器系统 Lv${techLevel}${isQualifiedCareer ? "(职业加成)" : ""}:${techDiscount}%折扣`
|
|
4239
4133
|
);
|
|
4240
4134
|
}
|
|
4241
4135
|
}
|
|
@@ -4249,8 +4143,9 @@ ${validTypes.join("、")}`;
|
|
|
4249
4143
|
}).then((records) => records[0]) : null;
|
|
4250
4144
|
if (activeWish) {
|
|
4251
4145
|
const wishDiscount = 20;
|
|
4252
|
-
totalDiscount
|
|
4253
|
-
discountDetails.push(
|
|
4146
|
+
totalDiscount += wishDiscount;
|
|
4147
|
+
discountDetails.push(`蚱蜢优购祈愿生效:${wishDiscount}%折扣`);
|
|
4148
|
+
totalDiscount = Math.min(totalDiscount, 100);
|
|
4254
4149
|
}
|
|
4255
4150
|
let actualPrice = config2.price;
|
|
4256
4151
|
if (totalDiscount > 0) {
|
|
@@ -4260,7 +4155,7 @@ ${validTypes.join("、")}`;
|
|
|
4260
4155
|
if ((signInfo?.totalRewards || 0) < actualPrice) {
|
|
4261
4156
|
let priceInfo = `需要 ${actualPrice} 金币`;
|
|
4262
4157
|
if (discountDetails.length > 0) {
|
|
4263
|
-
priceInfo +=
|
|
4158
|
+
priceInfo += `(原价 ${config2.price})`;
|
|
4264
4159
|
}
|
|
4265
4160
|
return `❌ 金币不足,${priceInfo}`;
|
|
4266
4161
|
}
|
|
@@ -4325,7 +4220,7 @@ ${validTypes.join("、")}`;
|
|
|
4325
4220
|
});
|
|
4326
4221
|
ctx.command("ggcevo/武器仓库").action(async ({ session }) => {
|
|
4327
4222
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4328
|
-
if (!profile) return "🔒
|
|
4223
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4329
4224
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4330
4225
|
const weapons = await ctx.database.get("ggcevo_equipment", {
|
|
4331
4226
|
handle
|
|
@@ -4345,7 +4240,7 @@ ${validTypes.join("、")}`;
|
|
|
4345
4240
|
].join("\n");
|
|
4346
4241
|
}));
|
|
4347
4242
|
return [
|
|
4348
|
-
`🛡️ ${handle}
|
|
4243
|
+
`🛡️ ${handle}拥有的武器`,
|
|
4349
4244
|
'使用"装备 武器名称"来装备武器',
|
|
4350
4245
|
"⚡表示当前装备武器",
|
|
4351
4246
|
"──────────────",
|
|
@@ -4357,20 +4252,20 @@ ${validTypes.join("、")}`;
|
|
|
4357
4252
|
});
|
|
4358
4253
|
ctx.command("ggcevo/装备 <weapon>").action(async ({ session }, weapon) => {
|
|
4359
4254
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4360
|
-
if (!profile) return "🔒
|
|
4361
|
-
if (!weapon) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
4362
|
-
if (!weaponConfig[weapon]) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
4363
|
-
const config2 = weaponConfig[weapon];
|
|
4255
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4364
4256
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4365
4257
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4366
4258
|
if (existingEntries.length > 0) {
|
|
4367
|
-
return
|
|
4259
|
+
return `⛔ 您已被列入黑名单`;
|
|
4368
4260
|
}
|
|
4261
|
+
if (!weapon) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
4262
|
+
if (!weaponConfig[weapon]) return "武器名称错误,请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
4263
|
+
const config2 = weaponConfig[weapon];
|
|
4369
4264
|
const [owned] = await ctx.database.get("ggcevo_equipment", {
|
|
4370
4265
|
handle,
|
|
4371
4266
|
weaponId: config2.id
|
|
4372
4267
|
});
|
|
4373
|
-
if (!owned) return "
|
|
4268
|
+
if (!owned) return "您尚未获得该武器。";
|
|
4374
4269
|
await ctx.database.withTransaction(async () => {
|
|
4375
4270
|
await ctx.database.set(
|
|
4376
4271
|
"ggcevo_equipment",
|
|
@@ -4391,10 +4286,10 @@ ${validTypes.join("、")}`;
|
|
|
4391
4286
|
});
|
|
4392
4287
|
ctx.command("ggcevo/升级 <target>", "升级武器或科技").action(async ({ session }, target) => {
|
|
4393
4288
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4394
|
-
if (!profile) return "🔒
|
|
4289
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4395
4290
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4396
4291
|
if ((await ctx.database.get("ggcevo_blacklist", { handle })).length) {
|
|
4397
|
-
return "
|
|
4292
|
+
return "⛔ 您已被列入黑名单";
|
|
4398
4293
|
}
|
|
4399
4294
|
if (!target) {
|
|
4400
4295
|
return generateUpgradePriceList(handle);
|
|
@@ -4412,10 +4307,10 @@ ${validTypes.join("、")}`;
|
|
|
4412
4307
|
});
|
|
4413
4308
|
ctx.command("ggcevo/改装 <weapon> [mod]", "安装武器模块").action(async ({ session }, weapon, mod) => {
|
|
4414
4309
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4415
|
-
if (!profile) return "🔒
|
|
4310
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4416
4311
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4417
4312
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4418
|
-
if (existingEntries.length > 0) return "
|
|
4313
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
4419
4314
|
const isValidWeapon = weapon && weaponConfig[weapon]?.id !== void 0;
|
|
4420
4315
|
const processModInstallation = /* @__PURE__ */ __name(async () => {
|
|
4421
4316
|
const modInfo = modConfig[mod];
|
|
@@ -4424,7 +4319,7 @@ ${validTypes.join("、")}`;
|
|
|
4424
4319
|
handle,
|
|
4425
4320
|
weaponId: weaponConfig[weapon].id
|
|
4426
4321
|
});
|
|
4427
|
-
if (!equipment) return "
|
|
4322
|
+
if (!equipment) return "您尚未获得该武器。";
|
|
4428
4323
|
if (modInfo.isExclusive) {
|
|
4429
4324
|
if (modInfo.exclusiveTo !== weapon) return `❌ 该模块只能安装在${modInfo.exclusiveTo}上。`;
|
|
4430
4325
|
const hasExclusive = equipment.installedMods.some((m) => modConfig[m]?.isExclusive);
|
|
@@ -4467,7 +4362,7 @@ ${validTypes.join("、")}`;
|
|
|
4467
4362
|
return [
|
|
4468
4363
|
`✅ ${weapon} 成功安装 ${mod}!`,
|
|
4469
4364
|
discountMsg,
|
|
4470
|
-
`花费金币:${actualCost}`,
|
|
4365
|
+
`花费金币:${actualCost}${discountRate > 0 ? `(原价${modInfo.cost})` : ""}`,
|
|
4471
4366
|
`改装槽:${equipment.installedMods.length + 1}/${equipment.modificationSlots}`
|
|
4472
4367
|
].join("\n");
|
|
4473
4368
|
}, "processModInstallation");
|
|
@@ -4527,10 +4422,10 @@ ${validTypes.join("、")}`;
|
|
|
4527
4422
|
const session = argv.session;
|
|
4528
4423
|
let broadcastMessage = null;
|
|
4529
4424
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4530
|
-
if (!profile) return "🔒
|
|
4425
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4531
4426
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4532
4427
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4533
|
-
if (existingEntries.length > 0) return "
|
|
4428
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
4534
4429
|
const getActiveBossNames = /* @__PURE__ */ __name(async () => {
|
|
4535
4430
|
const activeBosses2 = await ctx.database.get("ggcevo_boss", { isActive: true });
|
|
4536
4431
|
return activeBosses2.map((b) => b.name).join(",");
|
|
@@ -4569,7 +4464,7 @@ ${validTypes.join("、")}`;
|
|
|
4569
4464
|
const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
|
|
4570
4465
|
const [weaponName, weaponData] = weaponConfigEntry;
|
|
4571
4466
|
if (!weaponData.isantiair && targetBoss.groupId === 5) {
|
|
4572
|
-
return "
|
|
4467
|
+
return "您当前装备的武器无法攻击空中目标!";
|
|
4573
4468
|
}
|
|
4574
4469
|
const activeBosses = await ctx.database.get("ggcevo_boss", { isActive: true });
|
|
4575
4470
|
if (!activeBosses.length) return "当前没有存活的异形,请等待下一轮刷新。";
|
|
@@ -4630,7 +4525,7 @@ ${validTypes.join("、")}`;
|
|
|
4630
4525
|
{ name: targetBoss.name },
|
|
4631
4526
|
{ respawnTime }
|
|
4632
4527
|
);
|
|
4633
|
-
const { rewardMessages } = await handleBossDefeatRewards(ctx, targetBoss
|
|
4528
|
+
const { rewardMessages } = await handleBossDefeatRewards(ctx, targetBoss);
|
|
4634
4529
|
await ctx.database.remove("ggcevo_boss_damage", {
|
|
4635
4530
|
bossGroupId: targetBoss.groupId
|
|
4636
4531
|
});
|
|
@@ -4752,10 +4647,10 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4752
4647
|
const parseList = /* @__PURE__ */ __name((str) => str ? str.split(",").map((s) => s.trim()).filter(Boolean) : [], "parseList");
|
|
4753
4648
|
const tags = parseList(options.tags);
|
|
4754
4649
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4755
|
-
if (!profile) return "🔒
|
|
4650
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4756
4651
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4757
4652
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4758
|
-
if (existingEntries.length > 0) return "
|
|
4653
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
4759
4654
|
const [equippedWeapon] = await ctx.database.get("ggcevo_equipment", {
|
|
4760
4655
|
handle,
|
|
4761
4656
|
equipped: true
|
|
@@ -4792,7 +4687,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4792
4687
|
// 这里添加符号
|
|
4793
4688
|
] : [],
|
|
4794
4689
|
`📊 理论伤害值:${damage}${hasCrit ? " (✨ 触发暴击)" : ""}`,
|
|
4795
|
-
"💡 提示:使用 -t 重甲,生物…… 添加测试标签"
|
|
4690
|
+
"💡 提示:使用 -t 重甲,生物……(标签之间用英文逗号分隔) 添加测试标签"
|
|
4796
4691
|
].filter((line) => line).join("\n");
|
|
4797
4692
|
});
|
|
4798
4693
|
ctx.command("ggcevo/伤害榜 [page]", "查看当前主宰伤害排名").usage("输入 伤害榜 [页码] 查看对应页的排行榜,每页10条").action(async (_, page) => {
|
|
@@ -4810,7 +4705,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4810
4705
|
ctx.database.select("ggcevo_boss_damage").where({ bossGroupId: mainBoss.groupId }).execute((row) => import_koishi.$.count(row.handle))
|
|
4811
4706
|
]);
|
|
4812
4707
|
const totalPages = Math.ceil(total / 10);
|
|
4813
|
-
if (pageNum > totalPages) return
|
|
4708
|
+
if (pageNum > totalPages) return `查询失败,最多有 ${totalPages} 页`;
|
|
4814
4709
|
if (!records.length) return "暂无伤害记录";
|
|
4815
4710
|
const rankingText = records.map(
|
|
4816
4711
|
(record, index) => `${offset + index + 1}. ${record.playerName || "未知玩家"} | 总伤害: ${record.totalDamage} | 攻击次数: ${record.attackCount}`
|
|
@@ -4858,7 +4753,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4858
4753
|
}
|
|
4859
4754
|
return result.join("\n");
|
|
4860
4755
|
});
|
|
4861
|
-
ctx.command("ggcevo/初始化异形 <groupid:number>", "初始化指定主宰组", { authority: 3 }).action(async (_, groupid) => {
|
|
4756
|
+
ctx.command("ggcevo/初始化异形 <groupid:number>", "初始化指定主宰组", { authority: 3 }).alias("初始化yx").action(async (_, groupid) => {
|
|
4862
4757
|
if (!groupid) groupid = 1;
|
|
4863
4758
|
const bossConfig = bossPool.find((g) => g.main.id === groupid);
|
|
4864
4759
|
if (!bossConfig) {
|
|
@@ -4892,11 +4787,11 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4892
4787
|
ctx.command("ggcevo/祈愿").action(async (argv) => {
|
|
4893
4788
|
const session = argv.session;
|
|
4894
4789
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4895
|
-
if (!profile) return "🔒
|
|
4790
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4896
4791
|
const { regionId, realmId, profileId } = profile;
|
|
4897
4792
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
4898
4793
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4899
|
-
if (existingEntries.length > 0) return "
|
|
4794
|
+
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单";
|
|
4900
4795
|
const [sign] = await ctx.database.get("ggcevo_sign", { handle });
|
|
4901
4796
|
if (!sign || sign.totalRewards < 50) return "需要50金币进行祈愿,您的金币不足。";
|
|
4902
4797
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -4967,19 +4862,19 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
4967
4862
|
return `✨ 祈愿成功!花费50枚金币获得【${effect.name}】效果:${effect.effect}
|
|
4968
4863
|
⏳ 效果持续至 ${formattedEndTime}`;
|
|
4969
4864
|
});
|
|
4970
|
-
ctx.command("
|
|
4865
|
+
ctx.command("ggcevo/兑换金币", "使用兑换券兑换金币").action(async ({ session }) => {
|
|
4971
4866
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4972
|
-
if (!profile) return "🔒
|
|
4867
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
4973
4868
|
const { regionId, realmId, profileId } = profile;
|
|
4974
4869
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
4975
4870
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4976
4871
|
if (existingEntries.length > 0) {
|
|
4977
|
-
return
|
|
4872
|
+
return `⛔ 您已被列入黑名单`;
|
|
4978
4873
|
}
|
|
4979
4874
|
await session.send(`请输入你要使用多少张兑换券来兑换金币?(请在30秒内回复数字,回复“0”为取消兑换)
|
|
4980
4875
|
注意:1张兑换券=2000金币`);
|
|
4981
4876
|
const exchangeInput = await session.prompt(3e4);
|
|
4982
|
-
if (!exchangeInput) return "
|
|
4877
|
+
if (!exchangeInput) return "已取消操作,请重新输入。";
|
|
4983
4878
|
const exchangeCount = parseInt(exchangeInput, 10);
|
|
4984
4879
|
if (isNaN(exchangeCount)) return "请输入有效的数字!";
|
|
4985
4880
|
if (exchangeCount < 0) return "兑换数量不能为负数!";
|
|
@@ -5006,13 +4901,13 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5006
4901
|
});
|
|
5007
4902
|
return `成功使用${exchangeCount}张兑换券,获得${goldAmount}枚金币!`;
|
|
5008
4903
|
});
|
|
5009
|
-
ctx.command("
|
|
4904
|
+
ctx.command("ggcevo/兑换红晶", "使用金币兑换红晶").action(async ({ session }) => {
|
|
5010
4905
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5011
|
-
if (!profile) return "🔒
|
|
4906
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5012
4907
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5013
4908
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
5014
4909
|
if (existingEntries.length > 0) {
|
|
5015
|
-
return
|
|
4910
|
+
return `⛔ 您已被列入黑名单`;
|
|
5016
4911
|
}
|
|
5017
4912
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5018
4913
|
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
@@ -5021,7 +4916,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5021
4916
|
await session.send(`请输入你想要兑换多少红晶?(请在30秒内回复数字,回复“0”为取消兑换)
|
|
5022
4917
|
注意:每块红晶需要950金币。`);
|
|
5023
4918
|
const exchangeInput = await session.prompt(3e4);
|
|
5024
|
-
if (!exchangeInput) return "
|
|
4919
|
+
if (!exchangeInput) return "已取消操作,请重新输入。";
|
|
5025
4920
|
const exchangeCount = parseInt(exchangeInput, 10);
|
|
5026
4921
|
if (isNaN(exchangeCount)) return "请输入有效的数字!";
|
|
5027
4922
|
if (exchangeCount < 0) return "兑换数量不能为负数!";
|
|
@@ -5048,12 +4943,12 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5048
4943
|
});
|
|
5049
4944
|
ctx.command("ggcevo/加入 <faction>", "加入阵营").alias("加入阵营").action(async ({ session }, faction) => {
|
|
5050
4945
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5051
|
-
if (!profile) return "🔒
|
|
4946
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5052
4947
|
const { regionId, realmId, profileId } = profile;
|
|
5053
4948
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
5054
4949
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
5055
4950
|
if (existingEntries.length > 0) {
|
|
5056
|
-
return
|
|
4951
|
+
return `⛔ 您已被列入黑名单`;
|
|
5057
4952
|
}
|
|
5058
4953
|
const validFactions = ["人类联盟", "辛迪加海盗"];
|
|
5059
4954
|
if (!faction) return `请输入“加入 阵营名称”加入对应阵营
|
|
@@ -5089,7 +4984,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5089
4984
|
} else if (faction === "辛迪加海盗") {
|
|
5090
4985
|
const [pkData] = await ctx.database.get("ggcevo_pk", { handle });
|
|
5091
4986
|
if (userCoins < 2e3) {
|
|
5092
|
-
return
|
|
4987
|
+
return `加入辛迪加海盗需要缴纳2000金币并且永久开启PK功能,你当前拥有${userCoins}金币`;
|
|
5093
4988
|
}
|
|
5094
4989
|
if (pkData && !pkData?.enable) {
|
|
5095
4990
|
return "当前PK功能未开启,无法加入辛迪加海盗。";
|
|
@@ -5117,11 +5012,11 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5117
5012
|
});
|
|
5118
5013
|
ctx.command("ggcevo/转职 [profession]", "转职系统").action(async ({ session }, profession) => {
|
|
5119
5014
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5120
|
-
if (!profile) return "🔒
|
|
5015
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5121
5016
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5122
5017
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
5123
5018
|
if (existingEntries.length > 0) {
|
|
5124
|
-
return
|
|
5019
|
+
return `⛔ 您已被列入黑名单`;
|
|
5125
5020
|
}
|
|
5126
5021
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5127
5022
|
if (!careerData) return "请先加入阵营后使用转职功能。";
|
|
@@ -5169,7 +5064,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5169
5064
|
try {
|
|
5170
5065
|
if (careerData.group === "人类联盟") {
|
|
5171
5066
|
if (userCoins < targetProfession.costcoins) {
|
|
5172
|
-
return `转职需要 ${targetProfession.costcoins}
|
|
5067
|
+
return `转职需要 ${targetProfession.costcoins} 金币,您当前拥有 ${userCoins}`;
|
|
5173
5068
|
}
|
|
5174
5069
|
await ctx.database.upsert("ggcevo_sign", [{
|
|
5175
5070
|
handle,
|
|
@@ -5177,7 +5072,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5177
5072
|
}], ["handle"]);
|
|
5178
5073
|
} else if (careerData.group === "辛迪加海盗") {
|
|
5179
5074
|
if (userRedCrystal < (targetProfession.costredcrystal || 0)) {
|
|
5180
|
-
return `需要红晶 ${targetProfession.costredcrystal}
|
|
5075
|
+
return `需要红晶 ${targetProfession.costredcrystal},您当前拥有 ${userRedCrystal}`;
|
|
5181
5076
|
}
|
|
5182
5077
|
await Promise.all([
|
|
5183
5078
|
ctx.database.upsert("ggcevo_careers", [{
|
|
@@ -5202,7 +5097,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5202
5097
|
const [profile] = await ctx.database.get("sc2arcade_player", {
|
|
5203
5098
|
userId: session.userId
|
|
5204
5099
|
});
|
|
5205
|
-
if (!profile) return "🔒
|
|
5100
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5206
5101
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5207
5102
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5208
5103
|
if (!careerData) return "您尚未加入任何阵营。";
|
|
@@ -5241,7 +5136,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5241
5136
|
});
|
|
5242
5137
|
ctx.command("ggcevo/黑市 [type]", "辛迪加海盗专属黑市").usage("输入“黑市”查看类型,或“黑市 类型”查看详细").action(async ({ session }, type) => {
|
|
5243
5138
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5244
|
-
if (!profile) return "🔒
|
|
5139
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5245
5140
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5246
5141
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5247
5142
|
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
@@ -5303,23 +5198,23 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5303
5198
|
];
|
|
5304
5199
|
return [
|
|
5305
5200
|
`🏴☠️ 辛迪加黑市 - ${normalizedType} 🏴☠️`,
|
|
5306
|
-
"使用“订购
|
|
5201
|
+
"使用“订购 物品名称”进行购买(仅消耗红晶)",
|
|
5307
5202
|
"====================",
|
|
5308
5203
|
...items
|
|
5309
5204
|
].join("\n\n");
|
|
5310
5205
|
});
|
|
5311
5206
|
ctx.command("ggcevo/订购 <item>").action(async ({ session }, item) => {
|
|
5312
5207
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5313
|
-
if (!profile) return "🔒
|
|
5208
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5314
5209
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5315
5210
|
if (await ctx.database.get("ggcevo_blacklist", { handle }).then((r) => r.length)) {
|
|
5316
|
-
return "
|
|
5211
|
+
return "⛔ 您已被列入黑名单";
|
|
5317
5212
|
}
|
|
5318
5213
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5319
5214
|
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
5320
5215
|
return "🚫 该功能需要【辛迪加海盗】阵营权限";
|
|
5321
5216
|
}
|
|
5322
|
-
if (!item) return "请输入“订购
|
|
5217
|
+
if (!item) return "请输入“订购 物品名称”向辛迪加总部订购物品。";
|
|
5323
5218
|
const isWeapon = Object.prototype.hasOwnProperty.call(weaponConfig, item);
|
|
5324
5219
|
const isSyndicatedItem = Object.prototype.hasOwnProperty.call(SyndicatedItems, item);
|
|
5325
5220
|
if (!isWeapon && !isSyndicatedItem) return "❌ 无效物品名称";
|
|
@@ -5396,7 +5291,7 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5396
5291
|
ctx.command("ggcevo/仓库").action(async (argv) => {
|
|
5397
5292
|
const session = argv.session;
|
|
5398
5293
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5399
|
-
if (!profile) return "🔒
|
|
5294
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5400
5295
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5401
5296
|
const [items, signData, careerData] = await Promise.all([
|
|
5402
5297
|
ctx.database.get("ggcevo_warehouse", { handle }),
|
|
@@ -5439,12 +5334,13 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5439
5334
|
ctx.command("ggcevo/使用 [itemName] [target]").action(async (argv, itemName, target) => {
|
|
5440
5335
|
const session = argv.session;
|
|
5441
5336
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5442
|
-
if (!profile) return "🔒
|
|
5337
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5443
5338
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5444
5339
|
if (await ctx.database.get("ggcevo_blacklist", { handle }).then((r) => r.length)) {
|
|
5445
5340
|
return "⛔ 您已被列入黑名单";
|
|
5446
5341
|
}
|
|
5447
5342
|
try {
|
|
5343
|
+
if (!itemName) return "请输入“使用 物品名称 (可选目标)”使用仓库中的物品。";
|
|
5448
5344
|
const warehouseItems = await ctx.database.get("ggcevo_warehouse", { handle });
|
|
5449
5345
|
const targetItem = warehouseItems.find((item) => {
|
|
5450
5346
|
const entry = Object.entries(SyndicatedItems).find(
|
|
@@ -5479,13 +5375,14 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5479
5375
|
});
|
|
5480
5376
|
ctx.command("ggcevo/科技 [techName]", "查看空间站科技信息").usage("输入“科技”查看列表,或“科技 科技名称”查看详细信息").action(async ({ session }, techName) => {
|
|
5481
5377
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5482
|
-
if (!profile) return "🔒
|
|
5378
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5483
5379
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5484
5380
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
5485
5381
|
if (!careerData || careerData.group !== "人类联盟") {
|
|
5486
5382
|
return "🚫 该功能需要【人类联盟】阵营权限";
|
|
5487
5383
|
}
|
|
5488
5384
|
const romanNumerals = { 1: "I", 2: "II", 3: "III", 4: "IV", 5: "V" };
|
|
5385
|
+
const isIntelligenceOfficer = careerData?.career === "情报副官";
|
|
5489
5386
|
if (!techName) {
|
|
5490
5387
|
const techList = Spacestationtechnology.map(
|
|
5491
5388
|
(tech2) => `▸ ${tech2.techname} (最大等级 ${romanNumerals[tech2.maxLevel]})`
|
|
@@ -5495,8 +5392,10 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5495
5392
|
'使用 "科技 科技名称" 查看详细信息',
|
|
5496
5393
|
"====================",
|
|
5497
5394
|
...techList,
|
|
5498
|
-
"===================="
|
|
5499
|
-
|
|
5395
|
+
"====================",
|
|
5396
|
+
isIntelligenceOfficer && "※ 情报副官享受20%升级折扣"
|
|
5397
|
+
// 新增折扣提示
|
|
5398
|
+
].filter(Boolean).join("\n");
|
|
5500
5399
|
}
|
|
5501
5400
|
const tech = Spacestationtechnology.find(
|
|
5502
5401
|
(t) => t.techname === techName
|
|
@@ -5504,9 +5403,13 @@ ${passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
|
|
|
5504
5403
|
if (!tech) return `❌ 无效科技名称,可用科技:
|
|
5505
5404
|
${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
5506
5405
|
const techDetails = tech.levels.map((level) => {
|
|
5406
|
+
const originalCost = level.cost;
|
|
5407
|
+
const discountedCost = isIntelligenceOfficer ? Math.floor(originalCost * 0.8) : originalCost;
|
|
5408
|
+
const costDesc = isIntelligenceOfficer ? `▸ 升级花费:${discountedCost}金币 (原价${originalCost})` : `▸ 升级花费:${originalCost}金币`;
|
|
5507
5409
|
return [
|
|
5508
5410
|
`✦ 等级 ${romanNumerals[level.level]}`,
|
|
5509
|
-
|
|
5411
|
+
costDesc,
|
|
5412
|
+
// 修改后的价格显示
|
|
5510
5413
|
`▸ 基础效果:${level.description}`,
|
|
5511
5414
|
`💼 ${level.careerBonus}`,
|
|
5512
5415
|
"------------------"
|
|
@@ -5518,16 +5421,14 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5518
5421
|
'使用 "升级 科技名称" 进行升级',
|
|
5519
5422
|
"====================",
|
|
5520
5423
|
...techDetails,
|
|
5521
|
-
"===================="
|
|
5522
|
-
|
|
5424
|
+
"====================",
|
|
5425
|
+
isIntelligenceOfficer && "※ 情报副官享受20%升级折扣"
|
|
5426
|
+
// 新增折扣提示
|
|
5427
|
+
].filter(Boolean).join("\n");
|
|
5523
5428
|
});
|
|
5524
5429
|
ctx.command("ggcevo/挖矿").action(async ({ session }) => {
|
|
5525
|
-
const convertUTCtoChinaTime2 = /* @__PURE__ */ __name((utcDate) => {
|
|
5526
|
-
const chinaOffset = 8 * 60 * 60 * 1e3;
|
|
5527
|
-
return new Date(utcDate.getTime() + chinaOffset);
|
|
5528
|
-
}, "convertUTCtoChinaTime");
|
|
5529
5430
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
5530
|
-
if (!profile) return "🔒
|
|
5431
|
+
if (!profile) return "🔒 需要先绑定游戏句柄";
|
|
5531
5432
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
5532
5433
|
if (await ctx.database.get("ggcevo_blacklist", { handle }).then((r) => r.length)) {
|
|
5533
5434
|
return "⛔ 您已被列入黑名单";
|
|
@@ -5552,8 +5453,8 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5552
5453
|
return "⛏️ 挖矿作业已开始,至少1小时后可收获。";
|
|
5553
5454
|
}
|
|
5554
5455
|
const nowtime = /* @__PURE__ */ new Date();
|
|
5555
|
-
const chinaStart =
|
|
5556
|
-
const chinaNow =
|
|
5456
|
+
const chinaStart = convertUTCtoChinaTime(record.startTime);
|
|
5457
|
+
const chinaNow = convertUTCtoChinaTime(nowtime);
|
|
5557
5458
|
const duration = Math.floor(
|
|
5558
5459
|
(chinaNow.getTime() - chinaStart.getTime()) / 1e3 / 60
|
|
5559
5460
|
);
|
|
@@ -5564,7 +5465,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5564
5465
|
`🕒 开始时间:${record.startTime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5565
5466
|
`⏱️ 当前时间:${nowtime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5566
5467
|
`⏳ 还需等待:${remaining}分钟`,
|
|
5567
|
-
`💡
|
|
5468
|
+
`💡 提示:挖矿1小时后可随时收获并自动开始下一轮`
|
|
5568
5469
|
].join("\n");
|
|
5569
5470
|
}
|
|
5570
5471
|
const halfHours = Math.floor(duration / 30);
|
|
@@ -5602,11 +5503,8 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
|
|
|
5602
5503
|
`🕒 开始时间:${record.startTime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5603
5504
|
`⏱️ 结束时间:${nowtime.toLocaleString("zh-CN", { hour12: false })}`,
|
|
5604
5505
|
`⏳ 持续时间:${formatTime(duration)}`,
|
|
5605
|
-
...tech.level >= 4 ? (
|
|
5606
|
-
// 仅当科技等级≥3时显示加成信息
|
|
5607
|
-
[`🔧 科技加成(Lv.${tech.level}):+${multiplier * 100}%`]
|
|
5608
|
-
) : [],
|
|
5609
5506
|
`💰 实际获得:${total}金币`,
|
|
5507
|
+
...tech.level >= 4 ? [`🔧 挖矿系统 Lv.${tech.level}:金币+${multiplier * 100}%`] : [],
|
|
5610
5508
|
"💡 已自动开始下一轮挖矿"
|
|
5611
5509
|
].join("\n");
|
|
5612
5510
|
});
|