koishi-plugin-ggcevo-game 1.2.65 → 1.2.67
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 +6 -0
- package/lib/index.js +307 -32
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare module 'koishi' {
|
|
|
40
40
|
ggcevo_boss_damage: BossDamageRecord;
|
|
41
41
|
ggcevo_Wish_Record: WishRecord;
|
|
42
42
|
ggcevo_careers: careers;
|
|
43
|
+
ggcevo_warehouse: warehouse;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
export interface backpack {
|
|
@@ -178,4 +179,9 @@ export interface careers {
|
|
|
178
179
|
redcrystal: number;
|
|
179
180
|
date: Date;
|
|
180
181
|
}
|
|
182
|
+
export interface warehouse {
|
|
183
|
+
handle: string;
|
|
184
|
+
itemId: number;
|
|
185
|
+
quantity: number;
|
|
186
|
+
}
|
|
181
187
|
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
|
@@ -271,6 +271,28 @@ function apply(ctx, config) {
|
|
|
271
271
|
}, {
|
|
272
272
|
primary: "handle"
|
|
273
273
|
});
|
|
274
|
+
ctx.model.extend("ggcevo_warehouse", {
|
|
275
|
+
handle: "string",
|
|
276
|
+
itemId: "unsigned",
|
|
277
|
+
quantity: "unsigned"
|
|
278
|
+
}, {
|
|
279
|
+
primary: ["handle", "itemId"]
|
|
280
|
+
});
|
|
281
|
+
const SyndicatedItems = {
|
|
282
|
+
"E-2能量炸弹": {
|
|
283
|
+
id: 1e3,
|
|
284
|
+
type: "爆破物",
|
|
285
|
+
description: "一种小型的机械装置,用于吸收空间站能量并进行爆破",
|
|
286
|
+
redCrystalCost: 30,
|
|
287
|
+
effects: "仅当主宰为“空间站感染虫”时使用,对“空间站哨枪塔”造成其当前血量值的伤害",
|
|
288
|
+
// 确保结构兼容性
|
|
289
|
+
price: 0,
|
|
290
|
+
damage: 0,
|
|
291
|
+
// 若需要可补充伤害值
|
|
292
|
+
tagEffects: {}
|
|
293
|
+
// 若无属性加成则留空
|
|
294
|
+
}
|
|
295
|
+
};
|
|
274
296
|
const weaponConfig = {
|
|
275
297
|
// 武器配置
|
|
276
298
|
"高斯步枪": {
|
|
@@ -279,10 +301,12 @@ function apply(ctx, config) {
|
|
|
279
301
|
damage: 10,
|
|
280
302
|
description: "标准配置武器,中距离作战利器",
|
|
281
303
|
price: 100,
|
|
304
|
+
redCrystalCost: 2,
|
|
282
305
|
tagEffects: {
|
|
283
306
|
"轻甲": 1.5
|
|
284
307
|
// 对轻甲目标造成150%伤害
|
|
285
|
-
}
|
|
308
|
+
},
|
|
309
|
+
effects: ""
|
|
286
310
|
},
|
|
287
311
|
"激光步枪": {
|
|
288
312
|
id: 2,
|
|
@@ -290,11 +314,13 @@ function apply(ctx, config) {
|
|
|
290
314
|
damage: 23,
|
|
291
315
|
description: "先进激光武器,远距离精准打击",
|
|
292
316
|
price: 300,
|
|
317
|
+
redCrystalCost: 5,
|
|
293
318
|
tagEffects: {
|
|
294
319
|
"重甲": 1.5,
|
|
295
320
|
// 对重甲目标造成150%伤害
|
|
296
321
|
"护盾": 0.5
|
|
297
|
-
}
|
|
322
|
+
},
|
|
323
|
+
effects: ""
|
|
298
324
|
},
|
|
299
325
|
"焚烧枪": {
|
|
300
326
|
id: 3,
|
|
@@ -302,11 +328,13 @@ function apply(ctx, config) {
|
|
|
302
328
|
damage: 20,
|
|
303
329
|
description: "基于热能的强大武器,烧烬一切",
|
|
304
330
|
price: 450,
|
|
331
|
+
redCrystalCost: 5,
|
|
305
332
|
tagEffects: {
|
|
306
333
|
"惧热": 2,
|
|
307
334
|
"生物": 1.5,
|
|
308
335
|
"护盾": 0.5
|
|
309
|
-
}
|
|
336
|
+
},
|
|
337
|
+
effects: ""
|
|
310
338
|
},
|
|
311
339
|
"碎骨步枪": {
|
|
312
340
|
id: 4,
|
|
@@ -314,11 +342,13 @@ function apply(ctx, config) {
|
|
|
314
342
|
damage: 28,
|
|
315
343
|
description: "由激光步枪改良而来,高效的对重甲武器",
|
|
316
344
|
price: 850,
|
|
345
|
+
redCrystalCost: 15,
|
|
317
346
|
tagEffects: {
|
|
318
347
|
"重甲": 2,
|
|
319
348
|
"机械": 0.5,
|
|
320
349
|
"护盾": 0.2
|
|
321
|
-
}
|
|
350
|
+
},
|
|
351
|
+
effects: ""
|
|
322
352
|
},
|
|
323
353
|
"等离子切割机": {
|
|
324
354
|
id: 5,
|
|
@@ -326,11 +356,13 @@ function apply(ctx, config) {
|
|
|
326
356
|
damage: 12,
|
|
327
357
|
description: "一种改造后的采矿切割机,有效对抗重甲目标",
|
|
328
358
|
price: 150,
|
|
359
|
+
redCrystalCost: 2,
|
|
329
360
|
tagEffects: {
|
|
330
361
|
"重甲": 1.5,
|
|
331
362
|
"建筑": 1.5,
|
|
332
363
|
"机械": 1.2
|
|
333
|
-
}
|
|
364
|
+
},
|
|
365
|
+
effects: ""
|
|
334
366
|
},
|
|
335
367
|
"突击霰弹枪": {
|
|
336
368
|
id: 6,
|
|
@@ -338,10 +370,12 @@ function apply(ctx, config) {
|
|
|
338
370
|
damage: 28,
|
|
339
371
|
description: "近距离攻击武器,专为遭遇战设计使用",
|
|
340
372
|
price: 325,
|
|
373
|
+
redCrystalCost: 5,
|
|
341
374
|
tagEffects: {
|
|
342
375
|
"轻甲": 1.5,
|
|
343
376
|
"重甲": 0.8
|
|
344
|
-
}
|
|
377
|
+
},
|
|
378
|
+
effects: ""
|
|
345
379
|
},
|
|
346
380
|
"侦查步枪": {
|
|
347
381
|
id: 7,
|
|
@@ -349,11 +383,13 @@ function apply(ctx, config) {
|
|
|
349
383
|
damage: 60,
|
|
350
384
|
description: "用于隐秘射击的最佳武器,但是无法穿透护甲",
|
|
351
385
|
price: 550,
|
|
386
|
+
redCrystalCost: 10,
|
|
352
387
|
tagEffects: {
|
|
353
388
|
"护盾": 0.5,
|
|
354
389
|
"轻甲": 0.5,
|
|
355
390
|
"重甲": 0.2
|
|
356
|
-
}
|
|
391
|
+
},
|
|
392
|
+
effects: ""
|
|
357
393
|
},
|
|
358
394
|
"零度之下": {
|
|
359
395
|
id: 8,
|
|
@@ -361,10 +397,12 @@ function apply(ctx, config) {
|
|
|
361
397
|
damage: 30,
|
|
362
398
|
description: "喷射稳定的液氮恒流,对长时间接触者造成致命的损伤",
|
|
363
399
|
price: 775,
|
|
400
|
+
redCrystalCost: 10,
|
|
364
401
|
tagEffects: {
|
|
365
402
|
"惧寒": 2,
|
|
366
403
|
"灵能": 1.5
|
|
367
|
-
}
|
|
404
|
+
},
|
|
405
|
+
effects: ""
|
|
368
406
|
},
|
|
369
407
|
"弧焊枪": {
|
|
370
408
|
id: 9,
|
|
@@ -372,11 +410,14 @@ function apply(ctx, config) {
|
|
|
372
410
|
damage: 25,
|
|
373
411
|
description: "一种经过改造的电动工具,可对近距离的目标放出高压电",
|
|
374
412
|
price: 750,
|
|
413
|
+
redCrystalCost: 10,
|
|
375
414
|
tagEffects: {
|
|
376
415
|
"建筑": 2,
|
|
377
416
|
"机械": 1.5
|
|
378
|
-
}
|
|
379
|
-
|
|
417
|
+
},
|
|
418
|
+
effects: ""
|
|
419
|
+
},
|
|
420
|
+
...SyndicatedItems
|
|
380
421
|
};
|
|
381
422
|
const modConfig = {
|
|
382
423
|
"动能增幅": {
|
|
@@ -524,11 +565,11 @@ function apply(ctx, config) {
|
|
|
524
565
|
},
|
|
525
566
|
"岗哨机枪": {
|
|
526
567
|
effect: 0,
|
|
527
|
-
description: "自己的职责为“保护感染虫”,受到10
|
|
568
|
+
description: "自己的职责为“保护感染虫”,受到10次攻击后,为存活的机械感染虫和主宰回复10%的最大生命值(可重复触发)"
|
|
528
569
|
},
|
|
529
570
|
"结构装甲": {
|
|
530
571
|
effect: 0,
|
|
531
|
-
description: "拥有结构装甲,受到的伤害-20
|
|
572
|
+
description: "拥有结构装甲,受到的伤害-20%; 若伤害来源于热能武器,则受到的伤害-40%"
|
|
532
573
|
}
|
|
533
574
|
};
|
|
534
575
|
const bossPool = [
|
|
@@ -657,7 +698,7 @@ function apply(ctx, config) {
|
|
|
657
698
|
},
|
|
658
699
|
{
|
|
659
700
|
professionName: "武器中士",
|
|
660
|
-
effect: "攻击伤害+
|
|
701
|
+
effect: "攻击伤害+15%",
|
|
661
702
|
requirements: "当期伤害榜造成300点伤害",
|
|
662
703
|
Jobtransfer: true,
|
|
663
704
|
costcoins: 2e3
|
|
@@ -708,8 +749,8 @@ function apply(ctx, config) {
|
|
|
708
749
|
const syndicatePirateConfig = [
|
|
709
750
|
{
|
|
710
751
|
professionName: "能量武器专家",
|
|
711
|
-
effect: "能量武器攻击伤害+
|
|
712
|
-
requirements: "拥有一把武器等级为3
|
|
752
|
+
effect: "能量武器攻击伤害+20%,解锁MK-4激光步枪(传奇)购买权限",
|
|
753
|
+
requirements: "拥有一把武器等级为3级以上的能量武器",
|
|
713
754
|
Jobtransfer: true,
|
|
714
755
|
costcoins: 0,
|
|
715
756
|
costredcrystal: 20
|
|
@@ -749,7 +790,7 @@ function apply(ctx, config) {
|
|
|
749
790
|
{
|
|
750
791
|
professionName: "辛迪加财务经理",
|
|
751
792
|
effect: "每日签到能额外获得红晶",
|
|
752
|
-
requirements: "当月累计签到
|
|
793
|
+
requirements: "当月累计签到21天",
|
|
753
794
|
Jobtransfer: true,
|
|
754
795
|
costcoins: 0,
|
|
755
796
|
costredcrystal: 40
|
|
@@ -872,13 +913,13 @@ function apply(ctx, config) {
|
|
|
872
913
|
multiplier = 1.05;
|
|
873
914
|
message = "⚔️ 职业加成:警卫长(攻击伤害+5%)";
|
|
874
915
|
} else if (career === "武器中士") {
|
|
875
|
-
multiplier = 1.
|
|
876
|
-
message = "⚔️ 职业加成:武器中士(攻击伤害+
|
|
916
|
+
multiplier = 1.15;
|
|
917
|
+
message = "⚔️ 职业加成:武器中士(攻击伤害+15%)";
|
|
877
918
|
}
|
|
878
919
|
if (faction === "辛迪加海盗" && career === "能量武器专家") {
|
|
879
|
-
if (weaponType === "
|
|
880
|
-
multiplier *= 1.
|
|
881
|
-
message = "⚡ 职业加成:能量武器专家(能量武器伤害+
|
|
920
|
+
if (weaponType === "能量武器") {
|
|
921
|
+
multiplier *= 1.2;
|
|
922
|
+
message = "⚡ 职业加成:能量武器专家(能量武器伤害+20%)";
|
|
882
923
|
} else {
|
|
883
924
|
message = "⚠️ 能量武器专家:未装备能量武器,加成未生效";
|
|
884
925
|
}
|
|
@@ -1709,14 +1750,36 @@ function apply(ctx, config) {
|
|
|
1709
1750
|
};
|
|
1710
1751
|
case "辛迪加财务经理":
|
|
1711
1752
|
return {
|
|
1712
|
-
success: signData?.monthlyDays >=
|
|
1713
|
-
message: `需要当月累计签到
|
|
1753
|
+
success: signData?.monthlyDays >= 21,
|
|
1754
|
+
message: `需要当月累计签到21天(当前${signData?.monthlyDays || 0}天)`
|
|
1714
1755
|
};
|
|
1715
1756
|
default:
|
|
1716
1757
|
return { success: false, message: "未知职业要求" };
|
|
1717
1758
|
}
|
|
1718
1759
|
}
|
|
1719
1760
|
__name(checkTransferRequirements, "checkTransferRequirements");
|
|
1761
|
+
async function applyItemEffect(handle, itemId) {
|
|
1762
|
+
const itemConfig2 = Object.values(weaponConfig).find((v) => v.id === itemId);
|
|
1763
|
+
if (!itemConfig2) return "该物品未配置效果";
|
|
1764
|
+
if (itemId === 1e3) {
|
|
1765
|
+
const [SentryTower] = await ctx.database.get("ggcevo_boss", { name: "空间站哨枪塔", isActive: true });
|
|
1766
|
+
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
1767
|
+
await ctx.database.set(
|
|
1768
|
+
"ggcevo_boss",
|
|
1769
|
+
{ name: "空间站哨枪塔" },
|
|
1770
|
+
{
|
|
1771
|
+
isActive: false,
|
|
1772
|
+
HP: 0
|
|
1773
|
+
}
|
|
1774
|
+
);
|
|
1775
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
1776
|
+
handle,
|
|
1777
|
+
totalRewards: (record?.totalRewards || 0) + SentryTower.HP
|
|
1778
|
+
}], ["handle"]);
|
|
1779
|
+
return `您使用了E-2能量炸弹,直接摧毁了“空间站哨枪塔”,并且获得了${SentryTower.HP}金币。`;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
__name(applyItemEffect, "applyItemEffect");
|
|
1720
1783
|
ctx.command("ggcevo/抽奖").action(async (argv) => {
|
|
1721
1784
|
const session = argv.session;
|
|
1722
1785
|
let winCount = 0;
|
|
@@ -3003,7 +3066,6 @@ ${achievementList.join("\n")}`;
|
|
|
3003
3066
|
"📅 签到记录:",
|
|
3004
3067
|
`最后签到:${chinaTime}`,
|
|
3005
3068
|
`本月累计:${sign.monthlyDays} 天`,
|
|
3006
|
-
`拥有金币:${sign.totalRewards} 枚`,
|
|
3007
3069
|
"──────────────"
|
|
3008
3070
|
);
|
|
3009
3071
|
}
|
|
@@ -3379,7 +3441,7 @@ ${achievementList.join("\n")}`;
|
|
|
3379
3441
|
})}`;
|
|
3380
3442
|
});
|
|
3381
3443
|
ctx.command("ggcevo/武器库 [type]").usage("输入“武器库”查看类型,或“武器库 类型”查看详细武器信息").action(async (_, type) => {
|
|
3382
|
-
const typeStats = Object.values(weaponConfig).reduce((stats, weapon) => {
|
|
3444
|
+
const typeStats = Object.values(weaponConfig).filter((weapon) => weapon.price !== 0).reduce((stats, weapon) => {
|
|
3383
3445
|
stats[weapon.type] = (stats[weapon.type] || 0) + 1;
|
|
3384
3446
|
return stats;
|
|
3385
3447
|
}, {});
|
|
@@ -3388,16 +3450,16 @@ ${achievementList.join("\n")}`;
|
|
|
3388
3450
|
"🏪 咕咕武器库分类 🏪",
|
|
3389
3451
|
'使用 "武器库 类型名称" 查看详细列表',
|
|
3390
3452
|
"====================",
|
|
3391
|
-
...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`)
|
|
3453
|
+
...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
|
|
3454
|
+
"===================="
|
|
3392
3455
|
].join("\n");
|
|
3393
3456
|
}
|
|
3394
3457
|
const validTypes = Object.keys(typeStats);
|
|
3395
|
-
|
|
3396
|
-
if (!normalizedType) {
|
|
3458
|
+
if (!validTypes.includes(type)) {
|
|
3397
3459
|
return `无效武器类型,可用类型:
|
|
3398
3460
|
${validTypes.join("、")}`;
|
|
3399
3461
|
}
|
|
3400
|
-
const items = Object.entries(weaponConfig).filter(([_2, config2]) => config2.type ===
|
|
3462
|
+
const items = Object.entries(weaponConfig).filter(([_2, config2]) => config2.type === type && config2.price !== 0).map(([name2, config2]) => {
|
|
3401
3463
|
const tagEffectsDesc = config2.tagEffects ? Object.entries(config2.tagEffects).map(([tag, multiplier]) => `▸ 对${tag}目标造成${(multiplier * 100).toFixed(0)}%伤害`).join("\n") : "▸ 无特殊加成效果";
|
|
3402
3464
|
return [
|
|
3403
3465
|
`【${name2}】`,
|
|
@@ -3410,10 +3472,11 @@ ${validTypes.join("、")}`;
|
|
|
3410
3472
|
].join("\n");
|
|
3411
3473
|
});
|
|
3412
3474
|
return [
|
|
3413
|
-
`🏪 咕咕武器库 - ${
|
|
3475
|
+
`🏪 咕咕武器库 - ${type} 🏪`,
|
|
3414
3476
|
"使用“购买武器 武器名称”命令进行购买",
|
|
3415
3477
|
"====================",
|
|
3416
|
-
...items
|
|
3478
|
+
...items,
|
|
3479
|
+
items.length === 0 ? "⚠️ 该分类下暂无可用武器" : ""
|
|
3417
3480
|
].join("\n\n");
|
|
3418
3481
|
});
|
|
3419
3482
|
ctx.command("ggcevo/购买武器 <weapon>").action(async ({ session }, weapon) => {
|
|
@@ -3428,6 +3491,10 @@ ${validTypes.join("、")}`;
|
|
|
3428
3491
|
if (!weapon) return "如果您想购买武器,请输入“购买武器 武器名称”。";
|
|
3429
3492
|
if (!weaponConfig[weapon]) return "无效的武器名称,请重新输入。";
|
|
3430
3493
|
const config2 = weaponConfig[weapon];
|
|
3494
|
+
const allowedTypes = ["能量武器", "热能武器", "实弹武器"];
|
|
3495
|
+
if (!allowedTypes.includes(config2.type)) {
|
|
3496
|
+
return `❌ 无法购买该类型武器,仅支持:${allowedTypes.join("、")}`;
|
|
3497
|
+
}
|
|
3431
3498
|
const existingWeapons = await ctx.database.get("ggcevo_equipment", {
|
|
3432
3499
|
handle,
|
|
3433
3500
|
weaponId: config2.id
|
|
@@ -3484,7 +3551,7 @@ ${validTypes.join("、")}`;
|
|
|
3484
3551
|
}
|
|
3485
3552
|
if (equippedCount === 0) {
|
|
3486
3553
|
message += `
|
|
3487
|
-
|
|
3554
|
+
已自动为您装备当前武器!`;
|
|
3488
3555
|
}
|
|
3489
3556
|
return message + "\n输入“武器仓库”查看你拥有的武器。";
|
|
3490
3557
|
});
|
|
@@ -4073,6 +4140,10 @@ ${validTypes.join("、")}`;
|
|
|
4073
4140
|
if (!profile) return "您暂未绑定句柄。";
|
|
4074
4141
|
const { regionId, realmId, profileId } = profile;
|
|
4075
4142
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
4143
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4144
|
+
if (existingEntries.length > 0) {
|
|
4145
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
4146
|
+
}
|
|
4076
4147
|
await session.send(`请输入你要使用多少张兑换券来兑换金币?(请在30秒内回复数字,回复“0”为取消兑换)
|
|
4077
4148
|
注意:1张兑换券=2000金币`);
|
|
4078
4149
|
const exchangeInput = await session.prompt(3e4);
|
|
@@ -4108,6 +4179,10 @@ ${validTypes.join("、")}`;
|
|
|
4108
4179
|
if (!profile) return "您暂未绑定句柄。";
|
|
4109
4180
|
const { regionId, realmId, profileId } = profile;
|
|
4110
4181
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
4182
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4183
|
+
if (existingEntries.length > 0) {
|
|
4184
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
4185
|
+
}
|
|
4111
4186
|
const validFactions = ["人类联盟", "辛迪加海盗"];
|
|
4112
4187
|
if (!faction) return `请输入“加入 阵营名称”加入对应阵营
|
|
4113
4188
|
有效阵营:${validFactions.join(" / ")}`;
|
|
@@ -4172,6 +4247,10 @@ ${validTypes.join("、")}`;
|
|
|
4172
4247
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4173
4248
|
if (!profile) return "您暂未绑定句柄。";
|
|
4174
4249
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4250
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4251
|
+
if (existingEntries.length > 0) {
|
|
4252
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
4253
|
+
}
|
|
4175
4254
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4176
4255
|
if (!careerData) return "请先加入阵营后使用转职功能。";
|
|
4177
4256
|
let config2, factionTips;
|
|
@@ -4284,6 +4363,202 @@ ${validTypes.join("、")}`;
|
|
|
4284
4363
|
return "获取职业信息失败,请稍后重试";
|
|
4285
4364
|
}
|
|
4286
4365
|
});
|
|
4366
|
+
ctx.command("ggcevo/黑市 [type]", "辛迪加海盗专属黑市").usage("输入“黑市”查看类型,或“黑市 类型”查看详细").action(async ({ session }, type) => {
|
|
4367
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4368
|
+
if (!profile) return "⚠️ 需要先绑定游戏句柄";
|
|
4369
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4370
|
+
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4371
|
+
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
4372
|
+
return "🚫 该功能需要【辛迪加海盗】阵营权限";
|
|
4373
|
+
}
|
|
4374
|
+
const typeStats = Object.values(weaponConfig).reduce((stats, weapon) => {
|
|
4375
|
+
stats[weapon.type] = (stats[weapon.type] || 0) + 1;
|
|
4376
|
+
return stats;
|
|
4377
|
+
}, {});
|
|
4378
|
+
if (!type) {
|
|
4379
|
+
return [
|
|
4380
|
+
"🏴☠️ 辛迪加黑市 🏴☠️",
|
|
4381
|
+
'使用 "黑市 类型名称" 查看详细信息',
|
|
4382
|
+
"====================",
|
|
4383
|
+
...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
|
|
4384
|
+
"===================="
|
|
4385
|
+
].join("\n");
|
|
4386
|
+
}
|
|
4387
|
+
const normalizedType = Object.keys(typeStats).find((t) => t === type);
|
|
4388
|
+
if (!normalizedType) return `无效类型,可用:${Object.keys(typeStats).join("、")}`;
|
|
4389
|
+
const items = Object.entries(weaponConfig).filter(([_, config2]) => config2.type === normalizedType).map(([name2, config2]) => {
|
|
4390
|
+
const infoBlocks = [
|
|
4391
|
+
`【${name2}】`,
|
|
4392
|
+
`类型:${config2.type}`,
|
|
4393
|
+
// 选择性显示伤害值
|
|
4394
|
+
...config2.damage !== 0 ? [`基础伤害:${config2.damage}`] : [],
|
|
4395
|
+
`订购价:${config2.redCrystalCost}红晶`
|
|
4396
|
+
];
|
|
4397
|
+
if (Object.keys(config2.tagEffects).length > 0) {
|
|
4398
|
+
const tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, mul]) => `▸ 对${tag}目标造成${(mul * 100).toFixed(0)}%伤害`).join("\n");
|
|
4399
|
+
infoBlocks.push("特性:", tagEffectsDesc);
|
|
4400
|
+
}
|
|
4401
|
+
if (config2.effects && config2.effects.trim()) {
|
|
4402
|
+
infoBlocks.push(`效果:${config2.effects}`);
|
|
4403
|
+
}
|
|
4404
|
+
infoBlocks.push(
|
|
4405
|
+
config2.description,
|
|
4406
|
+
"──────────────"
|
|
4407
|
+
);
|
|
4408
|
+
return infoBlocks.join("\n");
|
|
4409
|
+
});
|
|
4410
|
+
return [
|
|
4411
|
+
`🏴☠️ 辛迪加黑市 - ${normalizedType} 🏴☠️`,
|
|
4412
|
+
"使用“订购 名称”进行购买(仅消耗红晶)",
|
|
4413
|
+
"====================",
|
|
4414
|
+
...items
|
|
4415
|
+
].join("\n\n");
|
|
4416
|
+
});
|
|
4417
|
+
ctx.command("ggcevo/订购 <item>").action(async ({ session }, item) => {
|
|
4418
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4419
|
+
if (!profile) return "⚠️ 需要先绑定游戏句柄";
|
|
4420
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4421
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4422
|
+
if (existingEntries.length > 0) {
|
|
4423
|
+
return "❌ 拒绝访问,您已被列入黑名单";
|
|
4424
|
+
}
|
|
4425
|
+
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4426
|
+
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
4427
|
+
return "🚫 需要辛迪加海盗阵营权限";
|
|
4428
|
+
}
|
|
4429
|
+
if (!item) return "请输入要订购的物品名称";
|
|
4430
|
+
const config2 = weaponConfig[item];
|
|
4431
|
+
if (!config2?.redCrystalCost) return "❌ 无效物品名称或该物品不可订购";
|
|
4432
|
+
const weaponTypes = ["能量武器", "实弹武器", "热能武器"];
|
|
4433
|
+
const isWeapon = weaponTypes.includes(config2.type);
|
|
4434
|
+
if (isWeapon) {
|
|
4435
|
+
const existing = await ctx.database.get("ggcevo_equipment", {
|
|
4436
|
+
handle,
|
|
4437
|
+
weaponId: config2.id
|
|
4438
|
+
});
|
|
4439
|
+
if (existing.length) return "⚠️ 该武器已在仓库中";
|
|
4440
|
+
}
|
|
4441
|
+
const requiredRed = config2.redCrystalCost;
|
|
4442
|
+
if ((careerData.redcrystal || 0) < requiredRed) {
|
|
4443
|
+
return `❌ 红晶不足!需要:${requiredRed} 当前:${careerData.redcrystal}`;
|
|
4444
|
+
}
|
|
4445
|
+
await ctx.database.withTransaction(async () => {
|
|
4446
|
+
await ctx.database.set("ggcevo_careers", { handle }, {
|
|
4447
|
+
redcrystal: careerData.redcrystal - requiredRed
|
|
4448
|
+
});
|
|
4449
|
+
if (isWeapon) {
|
|
4450
|
+
await ctx.database.upsert("ggcevo_equipment", [{
|
|
4451
|
+
handle,
|
|
4452
|
+
weaponId: config2.id,
|
|
4453
|
+
level: 0,
|
|
4454
|
+
modificationSlots: 1,
|
|
4455
|
+
equipped: false
|
|
4456
|
+
}], ["handle", "weaponId"]);
|
|
4457
|
+
const equippedCount = await ctx.database.select("ggcevo_equipment").where({ handle, equipped: true }).execute((row) => import_koishi.$.count(row.weaponId));
|
|
4458
|
+
if (equippedCount === 0) {
|
|
4459
|
+
await ctx.database.set(
|
|
4460
|
+
"ggcevo_equipment",
|
|
4461
|
+
{ handle, weaponId: config2.id },
|
|
4462
|
+
{ equipped: true }
|
|
4463
|
+
);
|
|
4464
|
+
}
|
|
4465
|
+
} else {
|
|
4466
|
+
const existingItems = await ctx.database.get("ggcevo_warehouse", {
|
|
4467
|
+
handle,
|
|
4468
|
+
itemId: config2.id
|
|
4469
|
+
});
|
|
4470
|
+
await ctx.database.upsert("ggcevo_warehouse", [{
|
|
4471
|
+
handle,
|
|
4472
|
+
itemId: config2.id,
|
|
4473
|
+
quantity: (existingItems[0]?.quantity || 0) + 1
|
|
4474
|
+
}], ["handle", "itemId"]);
|
|
4475
|
+
}
|
|
4476
|
+
});
|
|
4477
|
+
if (isWeapon) {
|
|
4478
|
+
const equippedCount = await ctx.database.select("ggcevo_equipment").where({ handle, equipped: true }).execute((row) => import_koishi.$.count(row.weaponId));
|
|
4479
|
+
let message = `✅ 成功订购【${item}】!消耗 ${requiredRed}红晶`;
|
|
4480
|
+
if (equippedCount === 0) {
|
|
4481
|
+
message += "\n已自动装备该武器!";
|
|
4482
|
+
}
|
|
4483
|
+
return message + '\n输入"武器仓库"查看已有装备';
|
|
4484
|
+
} else {
|
|
4485
|
+
const [warehouseData] = await ctx.database.get("ggcevo_warehouse", {
|
|
4486
|
+
handle,
|
|
4487
|
+
itemId: config2.id
|
|
4488
|
+
});
|
|
4489
|
+
return `✅ 成功订购【${item}】x1!消耗 ${requiredRed}红晶
|
|
4490
|
+
当前库存:${warehouseData.quantity}件
|
|
4491
|
+
输入"仓库"查看所有物品`;
|
|
4492
|
+
}
|
|
4493
|
+
});
|
|
4494
|
+
ctx.command("ggcevo/仓库").action(async (argv) => {
|
|
4495
|
+
const session = argv.session;
|
|
4496
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4497
|
+
if (!profile) return "您暂未绑定句柄。";
|
|
4498
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4499
|
+
const [items, signData, careerData] = await Promise.all([
|
|
4500
|
+
ctx.database.get("ggcevo_warehouse", { handle }),
|
|
4501
|
+
ctx.database.get("ggcevo_sign", { handle }),
|
|
4502
|
+
ctx.database.get("ggcevo_careers", { handle })
|
|
4503
|
+
]);
|
|
4504
|
+
const totalRewards = signData[0]?.totalRewards || 0;
|
|
4505
|
+
const redcrystal = careerData[0]?.redcrystal || 0;
|
|
4506
|
+
const message = [`【${handle}的仓库】`];
|
|
4507
|
+
message.push(`💰 金币:${totalRewards}`);
|
|
4508
|
+
if (redcrystal > 0) message.push(`🔴 红晶:${redcrystal}`);
|
|
4509
|
+
const validItems = items.filter((item) => item.quantity > 0);
|
|
4510
|
+
if (!validItems.length) {
|
|
4511
|
+
message.push("你的仓库空空如也。");
|
|
4512
|
+
} else {
|
|
4513
|
+
message.push(
|
|
4514
|
+
validItems.map((warehouseItem) => {
|
|
4515
|
+
const entry = Object.entries(weaponConfig).find(
|
|
4516
|
+
([, item]) => item.id === warehouseItem.itemId
|
|
4517
|
+
);
|
|
4518
|
+
if (!entry) return `未知物品 x ${warehouseItem.quantity}:数据异常,请联系管理员`;
|
|
4519
|
+
const [itemName, itemData] = entry;
|
|
4520
|
+
let info = `${itemName} x ${warehouseItem.quantity} | 类型:${itemData.type || "未分类"}`;
|
|
4521
|
+
if (itemData.effects?.trim()) info += `
|
|
4522
|
+
功能:${itemData.effects}`;
|
|
4523
|
+
return info;
|
|
4524
|
+
}).join("\n\n")
|
|
4525
|
+
);
|
|
4526
|
+
}
|
|
4527
|
+
return message.join("\n");
|
|
4528
|
+
});
|
|
4529
|
+
ctx.command("ggcevo/使用 [itemName]").action(async (argv, itemName) => {
|
|
4530
|
+
const session = argv.session;
|
|
4531
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4532
|
+
if (!profile) return "您暂未绑定句柄。";
|
|
4533
|
+
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
4534
|
+
try {
|
|
4535
|
+
const items = await ctx.database.get("ggcevo_warehouse", { handle });
|
|
4536
|
+
const targetItem = items.find((warehouseItem) => {
|
|
4537
|
+
const entry = Object.entries(weaponConfig).find(
|
|
4538
|
+
([, config2]) => config2.id === warehouseItem.itemId
|
|
4539
|
+
);
|
|
4540
|
+
if (!entry) return false;
|
|
4541
|
+
const [itemKey] = entry;
|
|
4542
|
+
return itemKey.toLowerCase() === itemName?.toLowerCase();
|
|
4543
|
+
});
|
|
4544
|
+
if (!targetItem) return `仓库中不存在 ${itemName} 或物品名称错误`;
|
|
4545
|
+
if (targetItem.quantity < 1) return `${itemName} 数量不足`;
|
|
4546
|
+
if (targetItem.itemId === 1e3) {
|
|
4547
|
+
const [SentryTower] = await ctx.database.get("ggcevo_boss", { name: "空间站哨枪塔", isActive: true });
|
|
4548
|
+
if (!SentryTower) return "当前没有“空间站哨枪塔”,无法使用E-2能量炸弹。";
|
|
4549
|
+
}
|
|
4550
|
+
await ctx.database.set("ggcevo_warehouse", { handle, itemId: targetItem.itemId }, {
|
|
4551
|
+
quantity: Math.max(targetItem.quantity - 1, 0)
|
|
4552
|
+
});
|
|
4553
|
+
const effectResult = await applyItemEffect(handle, targetItem.itemId);
|
|
4554
|
+
return `使用成功!消耗 ${itemName} ×1
|
|
4555
|
+
剩余数量:${targetItem.quantity - 1}
|
|
4556
|
+
${effectResult}`;
|
|
4557
|
+
} catch (error) {
|
|
4558
|
+
ctx.logger("GGCEVO").error(error);
|
|
4559
|
+
return "物品使用失败,请稍后重试";
|
|
4560
|
+
}
|
|
4561
|
+
});
|
|
4287
4562
|
}
|
|
4288
4563
|
__name(apply, "apply");
|
|
4289
4564
|
function simpleDraw() {
|