koishi-plugin-ggcevo-game 1.2.29 → 1.2.30
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 +1 -0
- package/lib/index.js +116 -19
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -125,6 +125,7 @@ function apply(ctx, config) {
|
|
|
125
125
|
// 胜场
|
|
126
126
|
matches: "unsigned",
|
|
127
127
|
// 比赛次数
|
|
128
|
+
rankseason: "string",
|
|
128
129
|
Blacklist: {
|
|
129
130
|
type: "boolean",
|
|
130
131
|
initial: false
|
|
@@ -601,7 +602,12 @@ function apply(ctx, config) {
|
|
|
601
602
|
"🥈先行者赛季亚军勋章": { id: 102, type: "勋章", description: "" },
|
|
602
603
|
"🥉先行者赛季季军勋章": { id: 103, type: "勋章", description: "" },
|
|
603
604
|
"🏅先行者赛季前十勋章": { id: 104, type: "勋章", description: "" },
|
|
604
|
-
"🎖先行者赛季前二十勋章": { id: 105, type: "勋章", description: "" }
|
|
605
|
+
"🎖先行者赛季前二十勋章": { id: 105, type: "勋章", description: "" },
|
|
606
|
+
"🥇S1赛季冠军勋章": { id: 106, type: "勋章", description: "" },
|
|
607
|
+
"🥈S1赛季亚军勋章": { id: 107, type: "勋章", description: "" },
|
|
608
|
+
"🥉S1赛季季军勋章": { id: 108, type: "勋章", description: "" },
|
|
609
|
+
"🏅S1赛季前十勋章": { id: 109, type: "勋章", description: "" },
|
|
610
|
+
"🎖S1赛季前二十勋章": { id: 110, type: "勋章", description: "" }
|
|
605
611
|
};
|
|
606
612
|
const itemConfig = {
|
|
607
613
|
"拾荒者": { quality: "t3", type: "皮肤", cost: 3, isLimited: false },
|
|
@@ -1307,7 +1313,8 @@ ${itemDetails.join("\n")}`;
|
|
|
1307
1313
|
name: record.profile.name,
|
|
1308
1314
|
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
1309
1315
|
wins: (ggcrank?.wins || 0) + (record.decision === "win" ? 1 : 0),
|
|
1310
|
-
matches: (ggcrank?.matches || 0) + 1
|
|
1316
|
+
matches: (ggcrank?.matches || 0) + 1,
|
|
1317
|
+
rankseason: config.rankseason
|
|
1311
1318
|
}]);
|
|
1312
1319
|
}
|
|
1313
1320
|
nextCursor = response.page?.next || null;
|
|
@@ -1367,7 +1374,8 @@ ${itemDetails.join("\n")}`;
|
|
|
1367
1374
|
name: record.profile.name,
|
|
1368
1375
|
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
1369
1376
|
wins: (ggcrank?.wins || 0) + (record.decision === "win" ? 1 : 0),
|
|
1370
|
-
matches: (ggcrank?.matches || 0) + 1
|
|
1377
|
+
matches: (ggcrank?.matches || 0) + 1,
|
|
1378
|
+
rankseason: config.rankseason
|
|
1371
1379
|
}]);
|
|
1372
1380
|
}
|
|
1373
1381
|
nextCursor = response.page?.next || null;
|
|
@@ -1378,7 +1386,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1378
1386
|
lastdate: new Date(currentMaxDate.toISOString())
|
|
1379
1387
|
});
|
|
1380
1388
|
}
|
|
1381
|
-
return "✅
|
|
1389
|
+
return "✅ 胜点榜数据手动同步成功!";
|
|
1382
1390
|
} catch (err) {
|
|
1383
1391
|
console.error("错误:", err);
|
|
1384
1392
|
return "服务器繁忙,请稍后尝试。";
|
|
@@ -1389,8 +1397,8 @@ ${itemDetails.join("\n")}`;
|
|
|
1389
1397
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
1390
1398
|
const offset = (pageNum - 1) * 10;
|
|
1391
1399
|
const [records, total] = await Promise.all([
|
|
1392
|
-
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
1393
|
-
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).execute((row) => import_koishi.$.count(row.handle))
|
|
1400
|
+
ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
1401
|
+
ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).execute((row) => import_koishi.$.count(row.handle))
|
|
1394
1402
|
]);
|
|
1395
1403
|
const totalPages = Math.ceil(total / 10);
|
|
1396
1404
|
if (pageNum > totalPages) return `最多有 ${totalPages} 页`;
|
|
@@ -1406,7 +1414,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1406
1414
|
(item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 胜率: ${item.matches === 0 ? "0.00%" : (item.wins / item.matches * 100).toFixed(2) + "%"}`
|
|
1407
1415
|
).join("\n");
|
|
1408
1416
|
return [
|
|
1409
|
-
`🏆 咕咕胜点榜 ${config.rankseason}
|
|
1417
|
+
`🏆 咕咕胜点榜 ${config.rankseason}赛季`,
|
|
1410
1418
|
`数据最新同步时间: ${lastdate.toLocaleString("zh-CN", {
|
|
1411
1419
|
timeZone: "Asia/Shanghai",
|
|
1412
1420
|
year: "numeric",
|
|
@@ -1423,6 +1431,95 @@ ${itemDetails.join("\n")}`;
|
|
|
1423
1431
|
pageNum < totalPages ? `输入“胜点榜 ${pageNum + 1}”查看下一页` : "已是最后一页"
|
|
1424
1432
|
].join("\n");
|
|
1425
1433
|
});
|
|
1434
|
+
ctx.command("ggcevo/赛季结算", "进行赛季结算并发放奖励", { authority: 3 }).action(async ({ session }) => {
|
|
1435
|
+
await session.send(`确定要进行赛季结算吗?(请在30秒内回复“是”确认)`);
|
|
1436
|
+
const confirm = await session.prompt(3e4);
|
|
1437
|
+
if (confirm !== "是") return "已取消操作。";
|
|
1438
|
+
const currentSeason = config.rankseason;
|
|
1439
|
+
const requiredMedals = {
|
|
1440
|
+
champion: `🥇${currentSeason}赛季冠军勋章`,
|
|
1441
|
+
runnerUp: `🥈${currentSeason}赛季亚军勋章`,
|
|
1442
|
+
thirdPlace: `🥉${currentSeason}赛季季军勋章`,
|
|
1443
|
+
top10: `🏅${currentSeason}赛季前十勋章`,
|
|
1444
|
+
top20: `🎖${currentSeason}赛季前二十勋章`
|
|
1445
|
+
};
|
|
1446
|
+
const missing = Object.values(requiredMedals).filter((name2) => !initDefaultItems[name2]);
|
|
1447
|
+
if (missing.length > 0) return `缺少勋章配置:${missing.join(",")}`;
|
|
1448
|
+
const rankedPlayers = await ctx.database.get("ggcevo_rank", {
|
|
1449
|
+
Blacklist: false,
|
|
1450
|
+
rankseason: currentSeason
|
|
1451
|
+
}, {
|
|
1452
|
+
sort: { rank: "desc" },
|
|
1453
|
+
limit: 20
|
|
1454
|
+
});
|
|
1455
|
+
for (const [index, player] of rankedPlayers.entries()) {
|
|
1456
|
+
const { coins, gold } = getRewardByRank(index + 1);
|
|
1457
|
+
const [backpack] = await ctx.database.get("ggcevo_backpack", {
|
|
1458
|
+
handle: player.handle,
|
|
1459
|
+
itemId: 1
|
|
1460
|
+
});
|
|
1461
|
+
await ctx.database.upsert("ggcevo_backpack", [{
|
|
1462
|
+
handle: player.handle,
|
|
1463
|
+
itemId: 1,
|
|
1464
|
+
quantity: (backpack?.quantity || 0) + coins
|
|
1465
|
+
}], ["handle", "itemId"]);
|
|
1466
|
+
const [signData] = await ctx.database.get("ggcevo_sign", { handle: player.handle });
|
|
1467
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
1468
|
+
handle: player.handle,
|
|
1469
|
+
totalRewards: (signData?.totalRewards || 0) + gold
|
|
1470
|
+
}], ["handle"]);
|
|
1471
|
+
const medalType = getMedalType(index + 1);
|
|
1472
|
+
const medalName = requiredMedals[medalType];
|
|
1473
|
+
const medalId = initDefaultItems[medalName].id;
|
|
1474
|
+
const [medalData] = await ctx.database.get("ggcevo_backpack", {
|
|
1475
|
+
handle: player.handle,
|
|
1476
|
+
itemId: medalId
|
|
1477
|
+
});
|
|
1478
|
+
await ctx.database.upsert("ggcevo_backpack", [{
|
|
1479
|
+
handle: player.handle,
|
|
1480
|
+
itemId: medalId,
|
|
1481
|
+
quantity: (medalData?.quantity || 0) + 1
|
|
1482
|
+
}], ["handle", "itemId"]);
|
|
1483
|
+
}
|
|
1484
|
+
const otherPlayers = await ctx.database.get("ggcevo_rank", {
|
|
1485
|
+
Blacklist: false,
|
|
1486
|
+
rankseason: currentSeason,
|
|
1487
|
+
handle: { $nin: rankedPlayers.map((p) => p.handle) },
|
|
1488
|
+
rank: { $ne: 0 }
|
|
1489
|
+
});
|
|
1490
|
+
for (const player of otherPlayers) {
|
|
1491
|
+
const gold = player.rank > 0 ? 250 : 100;
|
|
1492
|
+
const [signData] = await ctx.database.get("ggcevo_sign", { handle: player.handle });
|
|
1493
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
1494
|
+
handle: player.handle,
|
|
1495
|
+
totalRewards: (signData?.totalRewards || 0) + gold
|
|
1496
|
+
}], ["handle"]);
|
|
1497
|
+
}
|
|
1498
|
+
return `${currentSeason}赛季胜点榜结算完成!前${rankedPlayers.length}名发放赛季奖励,${otherPlayers.length}人获得赛季参与奖。`;
|
|
1499
|
+
function getRewardByRank(rank) {
|
|
1500
|
+
return [
|
|
1501
|
+
{ coins: 100, gold: 2e3 },
|
|
1502
|
+
// 第1名
|
|
1503
|
+
{ coins: 90, gold: 1500 },
|
|
1504
|
+
// 第2名
|
|
1505
|
+
{ coins: 80, gold: 1e3 },
|
|
1506
|
+
// 第3名
|
|
1507
|
+
...Array(7).fill({ coins: 60, gold: 750 }),
|
|
1508
|
+
//4-10
|
|
1509
|
+
...Array(10).fill({ coins: 40, gold: 500 })
|
|
1510
|
+
//11-20
|
|
1511
|
+
][rank - 1] || { coins: 0, gold: 0 };
|
|
1512
|
+
}
|
|
1513
|
+
__name(getRewardByRank, "getRewardByRank");
|
|
1514
|
+
function getMedalType(rank) {
|
|
1515
|
+
if (rank === 1) return "champion";
|
|
1516
|
+
if (rank === 2) return "runnerUp";
|
|
1517
|
+
if (rank === 3) return "thirdPlace";
|
|
1518
|
+
if (rank <= 10) return "top10";
|
|
1519
|
+
return "top20";
|
|
1520
|
+
}
|
|
1521
|
+
__name(getMedalType, "getMedalType");
|
|
1522
|
+
});
|
|
1426
1523
|
ctx.command("ggcevo/排名 [player]", "查询个人排名").alias("rank").usage("输入“排名”查看自己的排名信息").action(async (argv, player) => {
|
|
1427
1524
|
const session = argv.session;
|
|
1428
1525
|
if (!player) {
|
|
@@ -1443,7 +1540,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1443
1540
|
) + 1;
|
|
1444
1541
|
const isSafe = await checkSensitiveWord(user.name);
|
|
1445
1542
|
const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
|
|
1446
|
-
return `🎮 您的咕咕胜点榜排名信息
|
|
1543
|
+
return `🎮 您的咕咕胜点榜排名信息
|
|
1447
1544
|
------------------------------
|
|
1448
1545
|
昵称:${displayName}
|
|
1449
1546
|
句柄:${user.handle}
|
|
@@ -1476,7 +1573,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1476
1573
|
) + 1;
|
|
1477
1574
|
const isSafe = await checkSensitiveWord(user.name);
|
|
1478
1575
|
const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
|
|
1479
|
-
return `🎮 对方的咕咕胜点榜排名信息
|
|
1576
|
+
return `🎮 对方的咕咕胜点榜排名信息
|
|
1480
1577
|
------------------------------
|
|
1481
1578
|
昵称:${displayName}
|
|
1482
1579
|
句柄:${user.handle}
|
|
@@ -2177,7 +2274,7 @@ ${achievementList.join("\n")}`;
|
|
|
2177
2274
|
const action = currentState ? "关闭" : "开启";
|
|
2178
2275
|
await session.send(`您当前的PK状态为【${currentState ? "开启" : "关闭"}】,确认要${action}吗?(请在30秒内回复“是”确认)`);
|
|
2179
2276
|
const confirm = await session.prompt(3e4);
|
|
2180
|
-
if (confirm !== "是") return "
|
|
2277
|
+
if (confirm !== "是") return "已取消操作。";
|
|
2181
2278
|
await ctx.database.upsert("ggcevo_pk", [{
|
|
2182
2279
|
handle,
|
|
2183
2280
|
enable: !currentState,
|
|
@@ -2348,7 +2445,7 @@ ${validTypes.join("、")}`;
|
|
|
2348
2445
|
});
|
|
2349
2446
|
return `已成功装备 ${weapon}!`;
|
|
2350
2447
|
});
|
|
2351
|
-
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器").action(async ({ session }, weapon) => {
|
|
2448
|
+
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级").action(async ({ session }, weapon) => {
|
|
2352
2449
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2353
2450
|
if (!profile) return "您暂未绑定句柄。";
|
|
2354
2451
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
@@ -2357,7 +2454,7 @@ ${validTypes.join("、")}`;
|
|
|
2357
2454
|
handle,
|
|
2358
2455
|
weaponId: weaponConfig[weapon]?.id
|
|
2359
2456
|
});
|
|
2360
|
-
if (!weapon) return "
|
|
2457
|
+
if (!weapon) return "请输入“升级 武器名称”来升级你想要的武器。";
|
|
2361
2458
|
if (!equipment) return "尚未获得该武器。";
|
|
2362
2459
|
if (equipment.level >= 6) return "该武器已达最大升级等级。";
|
|
2363
2460
|
const activeWish = await ctx.database.get("ggcevo_Wish_Record", {
|
|
@@ -2404,7 +2501,7 @@ ${validTypes.join("、")}`;
|
|
|
2404
2501
|
return `${message}
|
|
2405
2502
|
当前等级:${newLevel},伤害:${baseDamage},可用改装槽:${slots}个。`;
|
|
2406
2503
|
});
|
|
2407
|
-
ctx.command("ggcevo/改装 <weapon> [mod]", "安装武器模块").alias("改装武器").action(async ({ session }, weapon, mod) => {
|
|
2504
|
+
ctx.command("ggcevo/改装 <weapon> [mod]", "安装武器模块").alias("改装武器", "改造", "改造武器").action(async ({ session }, weapon, mod) => {
|
|
2408
2505
|
const isValidWeapon = weapon && weaponConfig[weapon]?.id !== void 0;
|
|
2409
2506
|
const generateModList = /* @__PURE__ */ __name(() => {
|
|
2410
2507
|
if (!isValidWeapon) {
|
|
@@ -2422,7 +2519,7 @@ ${validTypes.join("、")}`;
|
|
|
2422
2519
|
if (!mod || !modConfig[mod]) {
|
|
2423
2520
|
return [
|
|
2424
2521
|
isValidWeapon ? `🛠️ ${weapon} 专属模块 🛠️` : "🛠️ 通用武器模块 🛠️",
|
|
2425
|
-
isValidWeapon ? `使用「改装 ${weapon}
|
|
2522
|
+
isValidWeapon ? `使用「改装 ${weapon} 模块名称」安装专属模块` : weapon ? "※ 无效武器名称,请使用「改装 武器名称 模块名称」安装模块" : "※ 输入「改装 武器名称」查询专属模块\n※ 安装模块:「改装 武器名称 模块名称」",
|
|
2426
2523
|
"====================",
|
|
2427
2524
|
generateModList()
|
|
2428
2525
|
].join("\n\n");
|
|
@@ -2608,11 +2705,11 @@ ${validTypes.join("、")}`;
|
|
|
2608
2705
|
const key = record.handle;
|
|
2609
2706
|
rewardMap.set(key, {
|
|
2610
2707
|
guguCoins: (rewardMap.get(key)?.guguCoins || 0) + 5,
|
|
2611
|
-
gold: (rewardMap.get(key)?.gold || 0) +
|
|
2708
|
+
gold: (rewardMap.get(key)?.gold || 0) + 250,
|
|
2612
2709
|
playerName: record.playerName
|
|
2613
2710
|
});
|
|
2614
2711
|
});
|
|
2615
|
-
rewardMessages.push(`其他参与者各获得: 5 咕咕币 +
|
|
2712
|
+
rewardMessages.push(`其他参与者各获得: 5 咕咕币 + 250 金币`);
|
|
2616
2713
|
}
|
|
2617
2714
|
const doubleRewardPlayers = /* @__PURE__ */ new Map();
|
|
2618
2715
|
for (const record of damageRecords) {
|
|
@@ -2838,7 +2935,7 @@ ${validTypes.join("、")}`;
|
|
|
2838
2935
|
}
|
|
2839
2936
|
return result.join("\n");
|
|
2840
2937
|
});
|
|
2841
|
-
ctx.command("ggcevo/祈愿").action(async (argv) => {
|
|
2938
|
+
ctx.command("ggcevo/祈愿").alias("祈福", "祈祷").action(async (argv) => {
|
|
2842
2939
|
const session = argv.session;
|
|
2843
2940
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2844
2941
|
if (!profile) return "您暂未绑定句柄。";
|
|
@@ -2868,8 +2965,8 @@ ${validTypes.join("、")}`;
|
|
|
2868
2965
|
hour: "2-digit",
|
|
2869
2966
|
minute: "2-digit"
|
|
2870
2967
|
});
|
|
2871
|
-
return
|
|
2872
|
-
|
|
2968
|
+
return `🕒 祈愿冷却中,下次可祈愿时间:${endTime2}
|
|
2969
|
+
当前祈愿效果:【${currentEffect.name}】${currentEffect.effect}`;
|
|
2873
2970
|
}
|
|
2874
2971
|
let newGold = sign.totalRewards - 50;
|
|
2875
2972
|
const isRare = Math.random() < 0.05;
|