koishi-plugin-ggcevo-game 1.4.39 → 1.4.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/database.d.ts +43 -43
- package/lib/index.js +53 -53
- package/lib/utils.d.ts +1 -1
- package/package.json +1 -1
package/lib/database.d.ts
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
declare module 'koishi' {
|
|
2
2
|
interface Tables {
|
|
3
|
-
ggcevo_backpack:
|
|
4
|
-
ggcevo_sign:
|
|
5
|
-
ggcevo_records:
|
|
6
|
-
ggcevo_welfare:
|
|
7
|
-
ggcevo_activity:
|
|
8
|
-
ggcevo_rank:
|
|
9
|
-
|
|
10
|
-
ggcevo_exchange:
|
|
11
|
-
ggcevo_adminbenefit:
|
|
12
|
-
ggcevo_blacklist:
|
|
13
|
-
ggcevo_pk:
|
|
14
|
-
ggcevo_pk_logs:
|
|
15
|
-
|
|
16
|
-
ggcevo_boss:
|
|
17
|
-
ggcevo_boss_damage:
|
|
18
|
-
|
|
19
|
-
ggcevo_careers:
|
|
20
|
-
ggcevo_warehouse:
|
|
21
|
-
ggcevo_tech:
|
|
22
|
-
ggcevo_Mining:
|
|
23
|
-
ggcevo_task:
|
|
24
|
-
|
|
3
|
+
ggcevo_backpack: Backpack;
|
|
4
|
+
ggcevo_sign: SignRecord;
|
|
5
|
+
ggcevo_records: GachaRecord;
|
|
6
|
+
ggcevo_welfare: WelfareClaim;
|
|
7
|
+
ggcevo_activity: ActivityInfo;
|
|
8
|
+
ggcevo_rank: RankRecord;
|
|
9
|
+
ggcevo_punishment: PunishmentRecord;
|
|
10
|
+
ggcevo_exchange: ExchangeLog;
|
|
11
|
+
ggcevo_adminbenefit: AdminBenefit;
|
|
12
|
+
ggcevo_blacklist: Blacklist;
|
|
13
|
+
ggcevo_pk: PKProfile;
|
|
14
|
+
ggcevo_pk_logs: PKLogs;
|
|
15
|
+
ggcevo_weapons: WeaponInventory;
|
|
16
|
+
ggcevo_boss: BossInfo;
|
|
17
|
+
ggcevo_boss_damage: BossDamage;
|
|
18
|
+
ggcevo_wish: WishRecord;
|
|
19
|
+
ggcevo_careers: CareerInfo;
|
|
20
|
+
ggcevo_warehouse: Warehouse;
|
|
21
|
+
ggcevo_tech: TechProgress;
|
|
22
|
+
ggcevo_Mining: MiningRecord;
|
|
23
|
+
ggcevo_task: TaskProgress;
|
|
24
|
+
ggcevo_permissions: Permissions;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
export interface
|
|
27
|
+
export interface Backpack {
|
|
28
28
|
handle: string;
|
|
29
29
|
itemId: number;
|
|
30
30
|
quantity: number;
|
|
31
31
|
}
|
|
32
|
-
export interface
|
|
32
|
+
export interface SignRecord {
|
|
33
33
|
handle: string;
|
|
34
34
|
lastSign: Date;
|
|
35
35
|
monthlyDays: number;
|
|
36
36
|
totalRewards: number;
|
|
37
37
|
}
|
|
38
|
-
export interface
|
|
38
|
+
export interface GachaRecord {
|
|
39
39
|
handle: string;
|
|
40
40
|
totalPulls: number;
|
|
41
41
|
pityCounter: number;
|
|
42
42
|
fullPityCount: number;
|
|
43
43
|
hiddenawards: number;
|
|
44
44
|
}
|
|
45
|
-
export interface
|
|
45
|
+
export interface WelfareClaim {
|
|
46
46
|
handle: string;
|
|
47
47
|
activity: number;
|
|
48
48
|
lastdate: Date;
|
|
49
49
|
}
|
|
50
|
-
export interface
|
|
50
|
+
export interface ActivityInfo {
|
|
51
51
|
id: number;
|
|
52
52
|
name: string;
|
|
53
53
|
description: string;
|
|
@@ -58,7 +58,7 @@ export interface Activity {
|
|
|
58
58
|
creator: string;
|
|
59
59
|
status: '未开始' | '进行中' | '已结束';
|
|
60
60
|
}
|
|
61
|
-
export interface
|
|
61
|
+
export interface RankRecord {
|
|
62
62
|
handle: string;
|
|
63
63
|
name: string;
|
|
64
64
|
rank: number;
|
|
@@ -67,7 +67,7 @@ export interface rank {
|
|
|
67
67
|
rankseason: string;
|
|
68
68
|
Blacklist: boolean;
|
|
69
69
|
}
|
|
70
|
-
export interface
|
|
70
|
+
export interface PunishmentRecord {
|
|
71
71
|
id: number;
|
|
72
72
|
name: string;
|
|
73
73
|
handle: string;
|
|
@@ -78,7 +78,7 @@ export interface Punishment {
|
|
|
78
78
|
date: string;
|
|
79
79
|
comment?: string;
|
|
80
80
|
}
|
|
81
|
-
export interface
|
|
81
|
+
export interface ExchangeLog {
|
|
82
82
|
userId: string;
|
|
83
83
|
handle: string;
|
|
84
84
|
item: string;
|
|
@@ -87,17 +87,17 @@ export interface exchange {
|
|
|
87
87
|
GlobalLimit: boolean;
|
|
88
88
|
season: string;
|
|
89
89
|
}
|
|
90
|
-
export interface
|
|
90
|
+
export interface AdminBenefit {
|
|
91
91
|
userId: string;
|
|
92
92
|
handle: string;
|
|
93
93
|
signmonth: number;
|
|
94
94
|
lastSign: Date;
|
|
95
95
|
}
|
|
96
|
-
export interface
|
|
96
|
+
export interface Blacklist {
|
|
97
97
|
handle: string;
|
|
98
98
|
createdAt: Date;
|
|
99
99
|
}
|
|
100
|
-
export interface
|
|
100
|
+
export interface PKProfile {
|
|
101
101
|
handle: string;
|
|
102
102
|
name: string;
|
|
103
103
|
total: number;
|
|
@@ -107,13 +107,13 @@ export interface PKRecord {
|
|
|
107
107
|
enable: boolean;
|
|
108
108
|
lastToggle: Date;
|
|
109
109
|
}
|
|
110
|
-
export interface
|
|
110
|
+
export interface PKLogs {
|
|
111
111
|
id: number;
|
|
112
112
|
initiator_handle: string;
|
|
113
113
|
target_handle: string;
|
|
114
114
|
date: Date;
|
|
115
115
|
}
|
|
116
|
-
export interface
|
|
116
|
+
export interface WeaponInventory {
|
|
117
117
|
handle: string;
|
|
118
118
|
weaponId: number;
|
|
119
119
|
level: number;
|
|
@@ -121,7 +121,7 @@ export interface equipment {
|
|
|
121
121
|
installedMods: string[];
|
|
122
122
|
equipped: boolean;
|
|
123
123
|
}
|
|
124
|
-
export interface
|
|
124
|
+
export interface BossInfo {
|
|
125
125
|
name: string;
|
|
126
126
|
groupId: number;
|
|
127
127
|
type: string;
|
|
@@ -137,7 +137,7 @@ export interface Boss {
|
|
|
137
137
|
isActive: boolean;
|
|
138
138
|
respawnTime: Date;
|
|
139
139
|
}
|
|
140
|
-
export interface
|
|
140
|
+
export interface BossDamage {
|
|
141
141
|
handle: string;
|
|
142
142
|
playerName: string;
|
|
143
143
|
totalDamage: number;
|
|
@@ -153,35 +153,35 @@ export interface WishRecord {
|
|
|
153
153
|
endTime: Date;
|
|
154
154
|
isused: boolean;
|
|
155
155
|
}
|
|
156
|
-
export interface
|
|
156
|
+
export interface CareerInfo {
|
|
157
157
|
handle: string;
|
|
158
158
|
group: string;
|
|
159
159
|
career: string;
|
|
160
160
|
redcrystal: number;
|
|
161
161
|
date: Date;
|
|
162
162
|
}
|
|
163
|
-
export interface
|
|
163
|
+
export interface Warehouse {
|
|
164
164
|
handle: string;
|
|
165
165
|
itemId: number;
|
|
166
166
|
quantity: number;
|
|
167
167
|
}
|
|
168
|
-
export interface
|
|
168
|
+
export interface TechProgress {
|
|
169
169
|
handle: string;
|
|
170
170
|
techId: number;
|
|
171
171
|
level: number;
|
|
172
172
|
}
|
|
173
|
-
export interface
|
|
173
|
+
export interface MiningRecord {
|
|
174
174
|
handle: string;
|
|
175
175
|
startTime: Date;
|
|
176
176
|
totalMined: number;
|
|
177
177
|
}
|
|
178
|
-
export interface
|
|
178
|
+
export interface TaskProgress {
|
|
179
179
|
handle: string;
|
|
180
180
|
taskId: number;
|
|
181
181
|
progress: number;
|
|
182
182
|
Completions: number;
|
|
183
183
|
}
|
|
184
|
-
export interface
|
|
184
|
+
export interface Permissions {
|
|
185
185
|
handle: string;
|
|
186
186
|
legendarypermissions: number;
|
|
187
187
|
explosiondoorauthority: number;
|
package/lib/index.js
CHANGED
|
@@ -697,7 +697,7 @@ async function checkTransferRequirements(ctx, handle, profession) {
|
|
|
697
697
|
const damageRecords = await ctx.database.get("ggcevo_boss_damage", { handle });
|
|
698
698
|
const totalAttack = damageRecords.reduce((sum, r) => sum + r.attackCount, 0);
|
|
699
699
|
const totalDamage = damageRecords.reduce((sum, r) => sum + r.totalDamage, 0);
|
|
700
|
-
const weapons = await ctx.database.get("
|
|
700
|
+
const weapons = await ctx.database.get("ggcevo_weapons", {
|
|
701
701
|
handle,
|
|
702
702
|
level: { $gte: 3 }
|
|
703
703
|
});
|
|
@@ -1442,7 +1442,7 @@ var passiveConfig = {
|
|
|
1442
1442
|
},
|
|
1443
1443
|
"复苏": {
|
|
1444
1444
|
type: "生存强化(生命/能量回复)",
|
|
1445
|
-
description: "免疫致命伤害,回复
|
|
1445
|
+
description: "免疫致命伤害,回复60%最大生命与100%能量值,并获得「灵能构造炉」技能(生效后移除)"
|
|
1446
1446
|
},
|
|
1447
1447
|
"光影之刃": {
|
|
1448
1448
|
type: "状态叠加(层数叠加)",
|
|
@@ -1576,7 +1576,7 @@ async function calculateTotalDamage(ctx, session, config, equippedWeapon, target
|
|
|
1576
1576
|
}
|
|
1577
1577
|
__name(calculateTotalDamage, "calculateTotalDamage");
|
|
1578
1578
|
async function checkCritRhythm(ctx, handle) {
|
|
1579
|
-
const [record] = await ctx.database.get("
|
|
1579
|
+
const [record] = await ctx.database.get("ggcevo_wish", {
|
|
1580
1580
|
handle,
|
|
1581
1581
|
wishname: "暴击韵律",
|
|
1582
1582
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -1680,7 +1680,7 @@ __name(calculateCareerAdditive, "calculateCareerAdditive");
|
|
|
1680
1680
|
async function calculateWishAdditive(ctx, handle, weapon) {
|
|
1681
1681
|
let value = 0;
|
|
1682
1682
|
const messages = [];
|
|
1683
|
-
const [sovereign] = await ctx.database.get("
|
|
1683
|
+
const [sovereign] = await ctx.database.get("ggcevo_wish", {
|
|
1684
1684
|
handle,
|
|
1685
1685
|
wishname: "王权增幅",
|
|
1686
1686
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -1690,7 +1690,7 @@ async function calculateWishAdditive(ctx, handle, weapon) {
|
|
|
1690
1690
|
value += 0.1;
|
|
1691
1691
|
messages.push("👑 王权增幅祈愿:攻击伤害+10%");
|
|
1692
1692
|
}
|
|
1693
|
-
const [lament] = await ctx.database.get("
|
|
1693
|
+
const [lament] = await ctx.database.get("ggcevo_wish", {
|
|
1694
1694
|
handle,
|
|
1695
1695
|
wishname: "悲鸣之锋",
|
|
1696
1696
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -1701,7 +1701,7 @@ async function calculateWishAdditive(ctx, handle, weapon) {
|
|
|
1701
1701
|
value += levelBonus;
|
|
1702
1702
|
messages.push(`🗡️ 悲鸣之锋祈愿:攻击伤害+${Math.round(levelBonus * 100)}%`);
|
|
1703
1703
|
}
|
|
1704
|
-
const [critRhythm] = await ctx.database.get("
|
|
1704
|
+
const [critRhythm] = await ctx.database.get("ggcevo_wish", {
|
|
1705
1705
|
handle,
|
|
1706
1706
|
wishname: "暴击韵律",
|
|
1707
1707
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -1930,7 +1930,7 @@ async function calculateTotalPower(ctx, config, handle) {
|
|
|
1930
1930
|
else if (["警卫员下士", "警卫长", "武器中士"].includes(career)) total += 3500;
|
|
1931
1931
|
else if (["能量武器专家", "枪手", "猩红杀手", "纵火狂"].includes(career)) total += 4e3;
|
|
1932
1932
|
}
|
|
1933
|
-
const weapons = await ctx.database.get("
|
|
1933
|
+
const weapons = await ctx.database.get("ggcevo_weapons", { handle });
|
|
1934
1934
|
for (const { weaponId, level, installedMods } of weapons) {
|
|
1935
1935
|
const weapon = weaponConfigById[weaponId];
|
|
1936
1936
|
if (!weapon) continue;
|
|
@@ -2123,9 +2123,9 @@ async function handleTechUpgrade(ctx, handle, target) {
|
|
|
2123
2123
|
level: nextLevel
|
|
2124
2124
|
}], ["handle", "techId"]);
|
|
2125
2125
|
if (permissionGrantInfo) {
|
|
2126
|
-
const [permissionRecord] = await ctx.database.get("
|
|
2126
|
+
const [permissionRecord] = await ctx.database.get("ggcevo_permissions", { handle });
|
|
2127
2127
|
const currentValue = permissionRecord?.[permissionGrantInfo.field] || 0;
|
|
2128
|
-
await ctx.database.upsert("
|
|
2128
|
+
await ctx.database.upsert("ggcevo_permissions", [{
|
|
2129
2129
|
handle,
|
|
2130
2130
|
[permissionGrantInfo.field]: currentValue + permissionGrantInfo.amount
|
|
2131
2131
|
}], ["handle"]);
|
|
@@ -2141,7 +2141,7 @@ async function handleTechUpgrade(ctx, handle, target) {
|
|
|
2141
2141
|
const costInfo = discountApplied ? `💸 花费金币:${actualCost} (原价${originalCost})` : `💸 花费金币:${actualCost}`;
|
|
2142
2142
|
let permissionMessage = [];
|
|
2143
2143
|
if (permissionGrantInfo) {
|
|
2144
|
-
const [permissionRecord] = await ctx.database.get("
|
|
2144
|
+
const [permissionRecord] = await ctx.database.get("ggcevo_permissions", { handle });
|
|
2145
2145
|
const newValue = permissionRecord?.[permissionGrantInfo.field] || permissionGrantInfo.amount;
|
|
2146
2146
|
permissionMessage.push(
|
|
2147
2147
|
permissionGrantInfo.message
|
|
@@ -2161,7 +2161,7 @@ async function handleTechUpgrade(ctx, handle, target) {
|
|
|
2161
2161
|
__name(handleTechUpgrade, "handleTechUpgrade");
|
|
2162
2162
|
async function handleWeaponUpgrade(ctx, handle, target) {
|
|
2163
2163
|
const weaponData = weaponConfig[target];
|
|
2164
|
-
const [equipment] = await ctx.database.get("
|
|
2164
|
+
const [equipment] = await ctx.database.get("ggcevo_weapons", {
|
|
2165
2165
|
handle,
|
|
2166
2166
|
weaponId: weaponData.id
|
|
2167
2167
|
});
|
|
@@ -2216,7 +2216,7 @@ async function handleWeaponUpgrade(ctx, handle, target) {
|
|
|
2216
2216
|
totalRewards: signInfo.totalRewards - actualCost
|
|
2217
2217
|
});
|
|
2218
2218
|
await ctx.database.set(
|
|
2219
|
-
"
|
|
2219
|
+
"ggcevo_weapons",
|
|
2220
2220
|
{ handle, weaponId: weaponData.id },
|
|
2221
2221
|
{
|
|
2222
2222
|
level: newLevel,
|
|
@@ -2225,7 +2225,7 @@ async function handleWeaponUpgrade(ctx, handle, target) {
|
|
|
2225
2225
|
);
|
|
2226
2226
|
if (activeWish) {
|
|
2227
2227
|
await ctx.database.set(
|
|
2228
|
-
"
|
|
2228
|
+
"ggcevo_wish",
|
|
2229
2229
|
{ id: activeWish.id },
|
|
2230
2230
|
{ isused: true }
|
|
2231
2231
|
);
|
|
@@ -2250,7 +2250,7 @@ async function handleWeaponUpgrade(ctx, handle, target) {
|
|
|
2250
2250
|
}
|
|
2251
2251
|
__name(handleWeaponUpgrade, "handleWeaponUpgrade");
|
|
2252
2252
|
async function checkFoxBlessing(ctx, handle) {
|
|
2253
|
-
return ctx.database.get("
|
|
2253
|
+
return ctx.database.get("ggcevo_wish", {
|
|
2254
2254
|
handle,
|
|
2255
2255
|
wishname: "灵狐升运",
|
|
2256
2256
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -3560,7 +3560,7 @@ var BattleEffectProcessor = {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
const maxHP = getMaxHPByName(targetBoss.name);
|
|
3562
3562
|
const maxEnergy = getMaxEnergyByName(targetBoss.name);
|
|
3563
|
-
const healAmount = Math.round(maxHP * 0.
|
|
3563
|
+
const healAmount = Math.round(maxHP * 0.6);
|
|
3564
3564
|
const energyGain = maxEnergy;
|
|
3565
3565
|
const targetUpdates = {
|
|
3566
3566
|
name: targetBoss.name,
|
|
@@ -4241,7 +4241,7 @@ async function handleBossDefeatRewards(ctx, targetBoss) {
|
|
|
4241
4241
|
return { rewardMessages };
|
|
4242
4242
|
}
|
|
4243
4243
|
const handles = damageRecords.map((r) => r.handle);
|
|
4244
|
-
const doubleWishRecords = await ctx.database.get("
|
|
4244
|
+
const doubleWishRecords = await ctx.database.get("ggcevo_wish", {
|
|
4245
4245
|
handle: { $in: handles },
|
|
4246
4246
|
wishname: "精灵双倍",
|
|
4247
4247
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -4344,7 +4344,7 @@ async function handleBossDefeatRewards(ctx, targetBoss) {
|
|
|
4344
4344
|
}], ["handle", "itemId"]);
|
|
4345
4345
|
}
|
|
4346
4346
|
if (doubleWishIds.length > 0) {
|
|
4347
|
-
await ctx.database.set("
|
|
4347
|
+
await ctx.database.set("ggcevo_wish", { id: { $in: doubleWishIds } }, {
|
|
4348
4348
|
isused: true
|
|
4349
4349
|
// 将使用过的双倍祈愿标记为已使用
|
|
4350
4350
|
});
|
|
@@ -4701,7 +4701,7 @@ async function handleIgnoreReductionEffects(ctx, handle, weaponName, targetBoss)
|
|
|
4701
4701
|
const handlePiercingMod = /* @__PURE__ */ __name(async () => {
|
|
4702
4702
|
const weaponConfigData = weaponConfig[weaponName];
|
|
4703
4703
|
if (!weaponConfigData) return;
|
|
4704
|
-
const [equippedWeapon] = await ctx.database.get("
|
|
4704
|
+
const [equippedWeapon] = await ctx.database.get("ggcevo_weapons", {
|
|
4705
4705
|
weaponId: weaponConfigData.id,
|
|
4706
4706
|
handle,
|
|
4707
4707
|
equipped: true
|
|
@@ -4839,7 +4839,7 @@ function apply(ctx, config) {
|
|
|
4839
4839
|
}, {
|
|
4840
4840
|
primary: "handle"
|
|
4841
4841
|
});
|
|
4842
|
-
ctx.model.extend("
|
|
4842
|
+
ctx.model.extend("ggcevo_punishment", {
|
|
4843
4843
|
id: "unsigned",
|
|
4844
4844
|
// 自增序号
|
|
4845
4845
|
name: "string",
|
|
@@ -4916,7 +4916,7 @@ function apply(ctx, config) {
|
|
|
4916
4916
|
primary: "id",
|
|
4917
4917
|
autoInc: true
|
|
4918
4918
|
});
|
|
4919
|
-
ctx.model.extend("
|
|
4919
|
+
ctx.model.extend("ggcevo_weapons", {
|
|
4920
4920
|
handle: "string",
|
|
4921
4921
|
weaponId: "unsigned",
|
|
4922
4922
|
level: "unsigned",
|
|
@@ -4954,7 +4954,7 @@ function apply(ctx, config) {
|
|
|
4954
4954
|
}, {
|
|
4955
4955
|
primary: "handle"
|
|
4956
4956
|
});
|
|
4957
|
-
ctx.model.extend("
|
|
4957
|
+
ctx.model.extend("ggcevo_wish", {
|
|
4958
4958
|
id: "unsigned",
|
|
4959
4959
|
handle: "string",
|
|
4960
4960
|
wishname: "string",
|
|
@@ -5003,7 +5003,7 @@ function apply(ctx, config) {
|
|
|
5003
5003
|
}, {
|
|
5004
5004
|
primary: ["handle", "taskId"]
|
|
5005
5005
|
});
|
|
5006
|
-
ctx.model.extend("
|
|
5006
|
+
ctx.model.extend("ggcevo_permissions", {
|
|
5007
5007
|
handle: "string",
|
|
5008
5008
|
legendarypermissions: "unsigned",
|
|
5009
5009
|
explosiondoorauthority: "unsigned"
|
|
@@ -5134,7 +5134,7 @@ function apply(ctx, config) {
|
|
|
5134
5134
|
// 保留名称用于后续展示
|
|
5135
5135
|
}))
|
|
5136
5136
|
);
|
|
5137
|
-
const punishmentRecords = await ctx.database.select("
|
|
5137
|
+
const punishmentRecords = await ctx.database.select("ggcevo_punishment").where({
|
|
5138
5138
|
$and: [
|
|
5139
5139
|
{ handle: { $in: allPlayers.map((p) => p.handle) } },
|
|
5140
5140
|
{ id: { $gte: 1889 } },
|
|
@@ -5409,7 +5409,7 @@ ${itemDetails.join("\n")}`;
|
|
|
5409
5409
|
messages.push(`💎 CRED-17生效:+${totalBonusPercent}%金币`);
|
|
5410
5410
|
}
|
|
5411
5411
|
}
|
|
5412
|
-
const [meowEffect] = await ctx.database.get("
|
|
5412
|
+
const [meowEffect] = await ctx.database.get("ggcevo_wish", {
|
|
5413
5413
|
handle,
|
|
5414
5414
|
wishname: "喵喵财源",
|
|
5415
5415
|
startTime: { $lte: now },
|
|
@@ -6006,8 +6006,8 @@ ${ticketMessage}${effectMessage}`;
|
|
|
6006
6006
|
handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
6007
6007
|
}
|
|
6008
6008
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
6009
|
-
const totalPages = await ctx.database.select("
|
|
6010
|
-
const records = await ctx.database.select("
|
|
6009
|
+
const totalPages = await ctx.database.select("ggcevo_punishment").where({ handle }).execute((row) => import_koishi.$.count(row.id));
|
|
6010
|
+
const records = await ctx.database.select("ggcevo_punishment").where({ handle }).orderBy("id", "desc").limit(1).offset(pageNum - 1).execute();
|
|
6011
6011
|
if (!records.length) {
|
|
6012
6012
|
return pageNum === 1 ? `【${handle}】暂无违规记录` : `【${handle}】第 ${pageNum} 条记录不存在`;
|
|
6013
6013
|
}
|
|
@@ -6683,7 +6683,7 @@ ${items.join("、")}
|
|
|
6683
6683
|
if (careerData?.career === "武器中士") {
|
|
6684
6684
|
discountDetails.push(`▸ 🎖️ 武器中士职业:50%折扣`);
|
|
6685
6685
|
}
|
|
6686
|
-
const activeWish = await ctx.database.get("
|
|
6686
|
+
const activeWish = await ctx.database.get("ggcevo_wish", {
|
|
6687
6687
|
handle,
|
|
6688
6688
|
wishname: "蚱蜢优购",
|
|
6689
6689
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -6815,14 +6815,14 @@ ${validTypes.join("、")}`;
|
|
|
6815
6815
|
const isWeapon = ["能量武器", "热能武器", "实弹武器", "传奇武器"].includes(config2.category);
|
|
6816
6816
|
const isLegendaryWeapon = config2.category === "传奇武器";
|
|
6817
6817
|
if (isWeapon) {
|
|
6818
|
-
const existingWeapon = await ctx.database.get("
|
|
6818
|
+
const existingWeapon = await ctx.database.get("ggcevo_weapons", {
|
|
6819
6819
|
handle,
|
|
6820
6820
|
weaponId: config2.id
|
|
6821
6821
|
});
|
|
6822
6822
|
if (existingWeapon.length > 0) return `❌ 您已经拥有${item},无法重复购买`;
|
|
6823
6823
|
}
|
|
6824
6824
|
if (isLegendaryWeapon) {
|
|
6825
|
-
const [permissions] = await ctx.database.get("
|
|
6825
|
+
const [permissions] = await ctx.database.get("ggcevo_permissions", { handle });
|
|
6826
6826
|
if (!permissions || permissions.legendarypermissions <= 0) {
|
|
6827
6827
|
return '❌ 购买传奇武器需要"传奇武器购买权限",您当前没有购买权限。';
|
|
6828
6828
|
}
|
|
@@ -6850,7 +6850,7 @@ ${validTypes.join("、")}`;
|
|
|
6850
6850
|
discountDetails.push(`🎖️ 武器中士职业:${specialistDiscount}%折扣`);
|
|
6851
6851
|
}
|
|
6852
6852
|
if (!isLegendaryWeapon && isWeapon) {
|
|
6853
|
-
activeWish = await ctx.database.get("
|
|
6853
|
+
activeWish = await ctx.database.get("ggcevo_wish", {
|
|
6854
6854
|
handle,
|
|
6855
6855
|
wishname: "蚱蜢优购",
|
|
6856
6856
|
startTime: { $lte: /* @__PURE__ */ new Date() },
|
|
@@ -6882,32 +6882,32 @@ ${validTypes.join("、")}`;
|
|
|
6882
6882
|
totalRewards: signInfo.totalRewards - actualPrice
|
|
6883
6883
|
});
|
|
6884
6884
|
if (activeWish) {
|
|
6885
|
-
await ctx.database.set("
|
|
6885
|
+
await ctx.database.set("ggcevo_wish", { id: activeWish.id }, {
|
|
6886
6886
|
isused: true
|
|
6887
6887
|
});
|
|
6888
6888
|
}
|
|
6889
6889
|
if (isLegendaryWeapon) {
|
|
6890
|
-
const [permissionRecord] = await ctx.database.get("
|
|
6890
|
+
const [permissionRecord] = await ctx.database.get("ggcevo_permissions", { handle });
|
|
6891
6891
|
if (!permissionRecord || permissionRecord.legendarypermissions <= 0) {
|
|
6892
6892
|
throw new Error("传奇武器购买权限不足");
|
|
6893
6893
|
}
|
|
6894
6894
|
const remaining = permissionRecord.legendarypermissions - 1;
|
|
6895
|
-
await ctx.database.set("
|
|
6895
|
+
await ctx.database.set("ggcevo_permissions", { handle }, {
|
|
6896
6896
|
legendarypermissions: remaining
|
|
6897
6897
|
});
|
|
6898
6898
|
}
|
|
6899
6899
|
if (isWeapon) {
|
|
6900
|
-
await ctx.database.upsert("
|
|
6900
|
+
await ctx.database.upsert("ggcevo_weapons", [{
|
|
6901
6901
|
handle,
|
|
6902
6902
|
weaponId: config2.id,
|
|
6903
6903
|
level: 0,
|
|
6904
6904
|
modificationSlots: 1,
|
|
6905
6905
|
equipped: false
|
|
6906
6906
|
}], ["handle", "weaponId"]);
|
|
6907
|
-
const equippedCount = await ctx.database.select("
|
|
6907
|
+
const equippedCount = await ctx.database.select("ggcevo_weapons").where({ handle, equipped: true }).execute((row) => import_koishi.$.count(row.weaponId));
|
|
6908
6908
|
if (equippedCount === 0) {
|
|
6909
6909
|
await ctx.database.set(
|
|
6910
|
-
"
|
|
6910
|
+
"ggcevo_weapons",
|
|
6911
6911
|
{ handle, weaponId: config2.id },
|
|
6912
6912
|
{ equipped: true }
|
|
6913
6913
|
);
|
|
@@ -6936,7 +6936,7 @@ ${validTypes.join("、")}`;
|
|
|
6936
6936
|
message += `花费 ${actualPrice} 金币`;
|
|
6937
6937
|
}
|
|
6938
6938
|
if (isLegendaryWeapon) {
|
|
6939
|
-
const [permissions] = await ctx.database.get("
|
|
6939
|
+
const [permissions] = await ctx.database.get("ggcevo_permissions", { handle });
|
|
6940
6940
|
message += `
|
|
6941
6941
|
扣除 1 次传奇武器购买权限,剩余次数:${permissions?.legendarypermissions || 0}`;
|
|
6942
6942
|
}
|
|
@@ -6956,7 +6956,7 @@ ${validTypes.join("、")}`;
|
|
|
6956
6956
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
6957
6957
|
if (!profile) return "🔒 需要先绑定游戏句柄。";
|
|
6958
6958
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
6959
|
-
const weapons = await ctx.database.get("
|
|
6959
|
+
const weapons = await ctx.database.get("ggcevo_weapons", {
|
|
6960
6960
|
handle
|
|
6961
6961
|
});
|
|
6962
6962
|
const weaponDetails = await Promise.all(weapons.map(async (w) => {
|
|
@@ -6995,14 +6995,14 @@ ${validTypes.join("、")}`;
|
|
|
6995
6995
|
if (!weapon) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
6996
6996
|
if (!weaponConfig[weapon]) return "武器名称错误,请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
6997
6997
|
const config2 = weaponConfig[weapon];
|
|
6998
|
-
const [owned] = await ctx.database.get("
|
|
6998
|
+
const [owned] = await ctx.database.get("ggcevo_weapons", {
|
|
6999
6999
|
handle,
|
|
7000
7000
|
weaponId: config2.id
|
|
7001
7001
|
});
|
|
7002
7002
|
if (!owned) return "您尚未获得该武器。";
|
|
7003
7003
|
await ctx.database.withTransaction(async () => {
|
|
7004
7004
|
await ctx.database.set(
|
|
7005
|
-
"
|
|
7005
|
+
"ggcevo_weapons",
|
|
7006
7006
|
{
|
|
7007
7007
|
handle,
|
|
7008
7008
|
weaponId: { $ne: config2.id }
|
|
@@ -7010,7 +7010,7 @@ ${validTypes.join("、")}`;
|
|
|
7010
7010
|
},
|
|
7011
7011
|
{ equipped: false }
|
|
7012
7012
|
);
|
|
7013
|
-
await ctx.database.upsert("
|
|
7013
|
+
await ctx.database.upsert("ggcevo_weapons", [{
|
|
7014
7014
|
handle,
|
|
7015
7015
|
weaponId: config2.id,
|
|
7016
7016
|
equipped: true
|
|
@@ -7054,7 +7054,7 @@ ${validTypes.join("、")}`;
|
|
|
7054
7054
|
return `❌ 无效武器名称。可选武器:${validWeapons.join("、")}`;
|
|
7055
7055
|
}
|
|
7056
7056
|
const weaponId = weaponConfig[weapon].id;
|
|
7057
|
-
const [equipment] = await ctx.database.get("
|
|
7057
|
+
const [equipment] = await ctx.database.get("ggcevo_weapons", {
|
|
7058
7058
|
handle,
|
|
7059
7059
|
weaponId
|
|
7060
7060
|
// 使用已验证的weaponId
|
|
@@ -7097,7 +7097,7 @@ ${validTypes.join("、")}`;
|
|
|
7097
7097
|
return `改装需要 ${actualCost} 金币,当前持有:${signInfo?.totalRewards || 0}`;
|
|
7098
7098
|
}
|
|
7099
7099
|
await ctx.database.set(
|
|
7100
|
-
"
|
|
7100
|
+
"ggcevo_weapons",
|
|
7101
7101
|
{ handle, weaponId: weaponConfig[weapon].id },
|
|
7102
7102
|
{ installedMods: [...equipment.installedMods, mod] }
|
|
7103
7103
|
);
|
|
@@ -7182,7 +7182,7 @@ ${validTypes.join("、")}`;
|
|
|
7182
7182
|
if (!modInfo) return "❌ 请输入“拆卸 武器名称 模块名称”\n注意:通用模块返还80%金币,专属模块返还50%金币";
|
|
7183
7183
|
const refundRate = modInfo.isExclusive ? 0.5 : 0.8;
|
|
7184
7184
|
const refundType = modInfo.isExclusive ? "专属模块返还50%" : "通用模块返还80%";
|
|
7185
|
-
const [equipment] = await ctx.database.get("
|
|
7185
|
+
const [equipment] = await ctx.database.get("ggcevo_weapons", {
|
|
7186
7186
|
handle,
|
|
7187
7187
|
weaponId
|
|
7188
7188
|
});
|
|
@@ -7193,7 +7193,7 @@ ${validTypes.join("、")}`;
|
|
|
7193
7193
|
const refund = Math.floor(modInfo.cost * refundRate);
|
|
7194
7194
|
const newMods = equipment.installedMods.filter((m) => m !== mod);
|
|
7195
7195
|
await ctx.database.set(
|
|
7196
|
-
"
|
|
7196
|
+
"ggcevo_weapons",
|
|
7197
7197
|
{ handle, weaponId },
|
|
7198
7198
|
{ installedMods: newMods }
|
|
7199
7199
|
);
|
|
@@ -7243,7 +7243,7 @@ ${validTypes.join("、")}`;
|
|
|
7243
7243
|
}
|
|
7244
7244
|
}
|
|
7245
7245
|
}
|
|
7246
|
-
const [equippedWeapon] = await ctx.database.get("
|
|
7246
|
+
const [equippedWeapon] = await ctx.database.get("ggcevo_weapons", { handle, equipped: true });
|
|
7247
7247
|
if (!equippedWeapon) return '请先输入"装备 武器名称"后再攻击。';
|
|
7248
7248
|
const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
|
|
7249
7249
|
const [weaponName, weaponData] = weaponConfigEntry;
|
|
@@ -7355,7 +7355,7 @@ ${validTypes.join("、")}`;
|
|
|
7355
7355
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
7356
7356
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
7357
7357
|
if (existingEntries.length > 0) return "⛔ 您已被列入黑名单。";
|
|
7358
|
-
const [equippedWeapon] = await ctx.database.get("
|
|
7358
|
+
const [equippedWeapon] = await ctx.database.get("ggcevo_weapons", {
|
|
7359
7359
|
handle,
|
|
7360
7360
|
equipped: true
|
|
7361
7361
|
});
|
|
@@ -7544,7 +7544,7 @@ ${validTypes.join("、")}`;
|
|
|
7544
7544
|
const [sign] = await ctx.database.get("ggcevo_sign", { handle });
|
|
7545
7545
|
if (!sign || sign.totalRewards < 50) return "需要50金币进行祈愿,您的金币不足。";
|
|
7546
7546
|
const now = /* @__PURE__ */ new Date();
|
|
7547
|
-
const [latestWish] = await ctx.database.get("
|
|
7547
|
+
const [latestWish] = await ctx.database.get("ggcevo_wish", { handle }, {
|
|
7548
7548
|
sort: { endTime: "desc" },
|
|
7549
7549
|
limit: 1
|
|
7550
7550
|
});
|
|
@@ -7592,7 +7592,7 @@ ${validTypes.join("、")}`;
|
|
|
7592
7592
|
await ctx.database.set("ggcevo_sign", { handle }, { totalRewards: newGold });
|
|
7593
7593
|
const startTime = /* @__PURE__ */ new Date();
|
|
7594
7594
|
const endTime = new Date(startTime.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
7595
|
-
await ctx.database.create("
|
|
7595
|
+
await ctx.database.create("ggcevo_wish", {
|
|
7596
7596
|
handle,
|
|
7597
7597
|
wishname: effect.name,
|
|
7598
7598
|
startTime,
|
|
@@ -8060,7 +8060,7 @@ ${validTypes.join("、")}`;
|
|
|
8060
8060
|
return `❌ 红晶不足!需要:${finalCost}${discountMessage} 当前拥有红晶:${careerData.redcrystal}`;
|
|
8061
8061
|
}
|
|
8062
8062
|
if (isWeapon) {
|
|
8063
|
-
const existing = await ctx.database.get("
|
|
8063
|
+
const existing = await ctx.database.get("ggcevo_weapons", {
|
|
8064
8064
|
handle,
|
|
8065
8065
|
weaponId: itemConfig2.id
|
|
8066
8066
|
});
|
|
@@ -8072,7 +8072,7 @@ ${validTypes.join("、")}`;
|
|
|
8072
8072
|
redcrystal: careerData.redcrystal - finalCost
|
|
8073
8073
|
});
|
|
8074
8074
|
if (isWeapon) {
|
|
8075
|
-
await ctx.database.create("
|
|
8075
|
+
await ctx.database.create("ggcevo_weapons", {
|
|
8076
8076
|
handle,
|
|
8077
8077
|
weaponId: itemConfig2.id,
|
|
8078
8078
|
level: 0,
|
|
@@ -8080,10 +8080,10 @@ ${validTypes.join("、")}`;
|
|
|
8080
8080
|
installedMods: [],
|
|
8081
8081
|
equipped: false
|
|
8082
8082
|
});
|
|
8083
|
-
const equippedCount = await ctx.database.select("
|
|
8083
|
+
const equippedCount = await ctx.database.select("ggcevo_weapons").where({ handle, equipped: true }).execute((row) => import_koishi.$.count(row.weaponId));
|
|
8084
8084
|
if (equippedCount === 0) {
|
|
8085
8085
|
await ctx.database.set(
|
|
8086
|
-
"
|
|
8086
|
+
"ggcevo_weapons",
|
|
8087
8087
|
{ handle, weaponId: itemConfig2.id },
|
|
8088
8088
|
{ equipped: true }
|
|
8089
8089
|
);
|
package/lib/utils.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function isSameHalfDay(a: Date, b: Date): boolean;
|
|
|
10
10
|
export declare function convertUTCtoChinaTime(input: Date | string | number): Date;
|
|
11
11
|
export declare function formatDate(d: Date): string;
|
|
12
12
|
export declare function createHpBar(current: number, max: number): string;
|
|
13
|
-
export declare function activateNextBossGroup(ctx: Context, currentBossId?: number | null): Promise<import("./database").
|
|
13
|
+
export declare function activateNextBossGroup(ctx: Context, currentBossId?: number | null): Promise<import("./database").BossInfo>;
|
|
14
14
|
export declare function calculateTotalPower(ctx: Context, config: Config, handle: string): Promise<number>;
|
|
15
15
|
export declare function applyItemEffect(ctx: Context, session: any, handle: string, itemConfig: any, target?: string): Promise<{
|
|
16
16
|
success: boolean;
|