@opfr/services 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +820 -772
- package/dist/index.umd.js +1 -1
- package/dist/services/AbstractCachedService.d.ts +10 -3
- package/dist/services/AbstractCachedService.d.ts.map +1 -1
- package/dist/services/entities/helper.d.ts +1 -2
- package/dist/services/entities/helper.d.ts.map +1 -1
- package/dist/services/entities/process/findMany.d.ts +2 -2
- package/dist/services/entities/process/findMany.d.ts.map +1 -1
- package/dist/services/entities/service.d.ts +2 -2
- package/dist/services/entities/service.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/invitations/helper.d.ts +2 -7
- package/dist/services/invitations/helper.d.ts.map +1 -1
- package/dist/services/ornaments/process/findMany.d.ts +2 -2
- package/dist/services/ornaments/process/findMany.d.ts.map +1 -1
- package/dist/services/ornaments/service.d.ts +2 -2
- package/dist/services/ornaments/service.d.ts.map +1 -1
- package/dist/services/panoplies/process/findMany.d.ts +3 -3
- package/dist/services/panoplies/process/findMany.d.ts.map +1 -1
- package/dist/services/panoplies/service.d.ts +2 -2
- package/dist/services/panoplies/service.d.ts.map +1 -1
- package/dist/services/recipe/process/findMany.d.ts +2 -2
- package/dist/services/recipe/process/findMany.d.ts.map +1 -1
- package/dist/services/recipe/service.d.ts +2 -2
- package/dist/services/recipe/service.d.ts.map +1 -1
- package/dist/services/reminder/process/findMany.d.ts +2 -2
- package/dist/services/reminder/process/findMany.d.ts.map +1 -1
- package/dist/services/reminder/service.d.ts +2 -2
- package/dist/services/reminder/service.d.ts.map +1 -1
- package/dist/services/settings/definition/schema.d.ts.map +1 -1
- package/dist/services/settings/types.d.ts +4 -0
- package/dist/services/settings/types.d.ts.map +1 -1
- package/dist/services/user/helper.d.ts +0 -3
- package/dist/services/user/helper.d.ts.map +1 -1
- package/dist/services/user/process/findMany.d.ts +2 -2
- package/dist/services/user/process/findMany.d.ts.map +1 -1
- package/dist/services/user/process/findOne.d.ts +2 -1
- package/dist/services/user/process/findOne.d.ts.map +1 -1
- package/dist/services/user/process/updateOne.d.ts.map +1 -1
- package/dist/services/user/service.d.ts +3 -2
- package/dist/services/user/service.d.ts.map +1 -1
- package/dist/services/user-cooldown/constants.d.ts +1 -1
- package/dist/services/user-cooldown/constants.d.ts.map +1 -1
- package/dist/services/user-inventory/helper.d.ts +1 -1
- package/dist/services/user-inventory/helper.d.ts.map +1 -1
- package/dist/services/user-meta/helper.d.ts +1 -7
- package/dist/services/user-meta/helper.d.ts.map +1 -1
- package/dist/services/user-quest/helper.d.ts +1 -0
- package/dist/services/user-quest/helper.d.ts.map +1 -1
- package/dist/services/user-rank/definition/model.d.ts +4 -0
- package/dist/services/user-rank/definition/model.d.ts.map +1 -0
- package/dist/services/user-rank/definition/schema.d.ts +13 -0
- package/dist/services/user-rank/definition/schema.d.ts.map +1 -0
- package/dist/services/user-rank/helper.d.ts +10 -0
- package/dist/services/user-rank/helper.d.ts.map +1 -0
- package/dist/services/user-rank/index.d.ts +3 -0
- package/dist/services/user-rank/index.d.ts.map +1 -0
- package/dist/services/user-rank/process/create.d.ts +4 -0
- package/dist/services/user-rank/process/create.d.ts.map +1 -0
- package/dist/services/user-rank/process/findOne.d.ts +5 -0
- package/dist/services/user-rank/process/findOne.d.ts.map +1 -0
- package/dist/services/user-rank/process/updateOne.d.ts +5 -0
- package/dist/services/user-rank/process/updateOne.d.ts.map +1 -0
- package/dist/services/user-rank/service.d.ts +14 -0
- package/dist/services/user-rank/service.d.ts.map +1 -0
- package/dist/services/user-rank/types.d.ts +10 -0
- package/dist/services/user-rank/types.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/services/bet/definition/model.d.ts +0 -5
- package/dist/services/bet/definition/model.d.ts.map +0 -1
- package/dist/services/bet/definition/schema.d.ts +0 -15
- package/dist/services/bet/definition/schema.d.ts.map +0 -1
- package/dist/services/bet/index.d.ts +0 -5
- package/dist/services/bet/index.d.ts.map +0 -1
- package/dist/services/bet/process/create.d.ts +0 -3
- package/dist/services/bet/process/create.d.ts.map +0 -1
- package/dist/services/bet/process/findOne.d.ts +0 -9
- package/dist/services/bet/process/findOne.d.ts.map +0 -1
- package/dist/services/bet/process/updateOne.d.ts +0 -4
- package/dist/services/bet/process/updateOne.d.ts.map +0 -1
- package/dist/services/bet/types.d.ts +0 -22
- package/dist/services/bet/types.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { Schema as u, models as l, model as p, connect as
|
|
2
|
-
import { randomBetween as
|
|
3
|
-
import
|
|
4
|
-
import { CREW_DEFAULT_DISINTEGRATION as
|
|
5
|
-
import * as
|
|
6
|
-
const
|
|
1
|
+
import { Schema as u, models as l, model as p, connect as ot, Types as dt } from "mongoose";
|
|
2
|
+
import { randomBetween as X, hasExpire as Q, sameDay as me, yesterday as N, capitalizeAllWords as lt, filterNullAndUndefined as F, pickFrom as pt, shuffle as Te, recordToArray as C, arrayToRecord as Be, mergeObjects as j, exclude as _, groupBy as yt, sortBy as Re, seededRandom as ft, range as mt } from "@opfr/utils-lang";
|
|
3
|
+
import ht from "node-cache";
|
|
4
|
+
import { CREW_DEFAULT_DISINTEGRATION as xe, CREW_DEFAULT_MEMBER_LIMIT as wt, QuestStatus as D, CREW_DEFAULT_XP_PERCENT as gt, DEFAULT_FACTION as St, GAME_TYPES as bt, RANK_IDS_WITHOUT_BASIC as Ce, EQUIPMENT_SLOT as qe, EFFECT_KEYS as $t, CHARACTERISTICS as Et, getComputedCharacteristicValue as Ut, getCurrentLevel as It, HP_PER_VITALITY as Dt, DEFAULT_MAX_HP as Ot, transformToDBBuff as Tt, SHOP_DEFAULT_AVAILABLE_ENTITY_AMOUNT as Rt } from "@opfr/definitions";
|
|
5
|
+
import * as he from "events";
|
|
6
|
+
const W = "___ALL_ENTITIES___";
|
|
7
7
|
class f {
|
|
8
8
|
cache;
|
|
9
9
|
constructor(e) {
|
|
10
|
-
this.cache = new
|
|
10
|
+
this.cache = new ht({
|
|
11
11
|
stdTTL: e,
|
|
12
12
|
checkperiod: e * 0.2,
|
|
13
13
|
useClones: !1
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
async get(e) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
20
|
-
const
|
|
21
|
-
return
|
|
16
|
+
async get(e, t) {
|
|
17
|
+
const r = this.normalizeKey(e), a = this.cache.get(r);
|
|
18
|
+
if (a)
|
|
19
|
+
return a;
|
|
20
|
+
const s = await this.fetchFromDb(e, t ?? {});
|
|
21
|
+
return s && this.cache.set(r, s), s;
|
|
22
22
|
}
|
|
23
23
|
async update(e, t, r) {
|
|
24
24
|
const a = await this.updateInDb(e, t, r);
|
|
25
25
|
if (a) {
|
|
26
26
|
const s = this.getKey(a);
|
|
27
|
-
this.cache.del(
|
|
27
|
+
this.cache.del(W), this.cache.set(this.normalizeKey(s), a);
|
|
28
28
|
}
|
|
29
29
|
return a;
|
|
30
30
|
}
|
|
31
31
|
invalidate(e) {
|
|
32
|
-
this.cache.del(
|
|
32
|
+
this.cache.del(W), e && this.cache.del(this.normalizeKey(e));
|
|
33
33
|
}
|
|
34
34
|
clearAll() {
|
|
35
35
|
this.cache.flushAll();
|
|
@@ -37,26 +37,26 @@ class f {
|
|
|
37
37
|
}
|
|
38
38
|
class b extends f {
|
|
39
39
|
async getAll() {
|
|
40
|
-
const e = this.cache.get(
|
|
40
|
+
const e = this.cache.get(W);
|
|
41
41
|
if (e)
|
|
42
42
|
return e;
|
|
43
|
-
const t = await this.fetchManyFromDb({});
|
|
44
|
-
return this.cache.set(
|
|
43
|
+
const t = await this.fetchManyFromDb({}, {});
|
|
44
|
+
return this.cache.set(W, t), t.forEach((r) => {
|
|
45
45
|
this.cache.set(this.normalizeKey(this.getKey(r)), r);
|
|
46
46
|
}), t;
|
|
47
47
|
}
|
|
48
|
-
async getMany(e) {
|
|
49
|
-
const
|
|
50
|
-
return
|
|
51
|
-
this.cache.set(this.normalizeKey(this.getKey(
|
|
52
|
-
}),
|
|
48
|
+
async getMany(e, t = {}) {
|
|
49
|
+
const r = await this.fetchManyFromDb(e, t);
|
|
50
|
+
return r.forEach((a) => {
|
|
51
|
+
this.cache.set(this.normalizeKey(this.getKey(a)), a);
|
|
52
|
+
}), r;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
55
|
+
const ke = new he.EventEmitter(), m = (n, e, t) => {
|
|
56
|
+
ke.emit(n, e, t);
|
|
57
|
+
}, Js = (n) => {
|
|
58
58
|
for (const [e, t] of Object.entries(n))
|
|
59
|
-
|
|
59
|
+
ke.on(e, (r, a) => {
|
|
60
60
|
t(r, a);
|
|
61
61
|
});
|
|
62
62
|
}, h = {
|
|
@@ -79,36 +79,36 @@ const xe = new me.EventEmitter(), m = (n, e, t) => {
|
|
|
79
79
|
USER_STATS_FLAGS: "middleware/quest/USER_STATS_FLAGS",
|
|
80
80
|
USER_STATS_FREQUENCY: "middleware/quest/USER_STATS_FREQUENCY",
|
|
81
81
|
USER_STATS_INVENTORY: "middleware/quest/USER_STATS_INVENTORY"
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
},
|
|
82
|
+
}, _e = new he.EventEmitter(), we = (n, e, t) => {
|
|
83
|
+
_e.emit(n, e, t);
|
|
84
|
+
}, Zs = (n) => {
|
|
85
85
|
for (const [e, t] of Object.entries(n))
|
|
86
|
-
|
|
86
|
+
_e.on(e, (r, a) => {
|
|
87
87
|
t(r, a);
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, ge = {
|
|
90
90
|
USER_INVENTORY: "middleware/raid/USER_INVENTORY",
|
|
91
91
|
USER_QUEST: "middleware/raid/USER_QUEST",
|
|
92
92
|
USER_RAID: "middleware/raid/USER_RAID"
|
|
93
|
-
},
|
|
93
|
+
}, Ne = new u(
|
|
94
94
|
{
|
|
95
95
|
createdBy: u.Types.ObjectId,
|
|
96
96
|
name: String,
|
|
97
97
|
description: String,
|
|
98
98
|
channelId: String,
|
|
99
|
-
memberLimit: { type: Number, default:
|
|
100
|
-
disintegration: { type: Number, default:
|
|
99
|
+
memberLimit: { type: Number, default: wt },
|
|
100
|
+
disintegration: { type: Number, default: xe },
|
|
101
101
|
faction: String
|
|
102
102
|
},
|
|
103
103
|
{ timestamps: !0, minimize: !1 }
|
|
104
104
|
);
|
|
105
|
-
|
|
105
|
+
Ne.post("findOneAndUpdate", async function(n) {
|
|
106
106
|
m(h.CREW, n._id, n);
|
|
107
107
|
});
|
|
108
|
-
const
|
|
108
|
+
const G = l?.Crew || p("Crew", Ne);
|
|
109
109
|
class Ct extends f {
|
|
110
110
|
async getCrewRank(e) {
|
|
111
|
-
return (await
|
|
111
|
+
return (await G.aggregate([
|
|
112
112
|
{
|
|
113
113
|
$lookup: {
|
|
114
114
|
from: "crewmetas",
|
|
@@ -134,7 +134,7 @@ class Ct extends f {
|
|
|
134
134
|
]))[0];
|
|
135
135
|
}
|
|
136
136
|
getCrewRanking() {
|
|
137
|
-
return
|
|
137
|
+
return G.aggregate([
|
|
138
138
|
{
|
|
139
139
|
$lookup: {
|
|
140
140
|
from: "crewmetas",
|
|
@@ -179,7 +179,7 @@ class Ct extends f {
|
|
|
179
179
|
$set: {
|
|
180
180
|
disintegration: {
|
|
181
181
|
$max: [
|
|
182
|
-
{ $add: ["$disintegration", -1 *
|
|
182
|
+
{ $add: ["$disintegration", -1 * X(a, s)] },
|
|
183
183
|
0
|
|
184
184
|
]
|
|
185
185
|
}
|
|
@@ -188,10 +188,10 @@ class Ct extends f {
|
|
|
188
188
|
]);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
const
|
|
192
|
-
const e = await
|
|
191
|
+
const vt = async (n) => {
|
|
192
|
+
const e = await G.findById(n).lean();
|
|
193
193
|
return e || null;
|
|
194
|
-
},
|
|
194
|
+
}, At = (n, e) => G.findOneAndUpdate({ _id: n }, e, {
|
|
195
195
|
returnDocument: "after"
|
|
196
196
|
}).lean();
|
|
197
197
|
class Mt extends Ct {
|
|
@@ -205,23 +205,23 @@ class Mt extends Ct {
|
|
|
205
205
|
return e;
|
|
206
206
|
}
|
|
207
207
|
fetchFromDb(e) {
|
|
208
|
-
return
|
|
208
|
+
return vt(e);
|
|
209
209
|
}
|
|
210
210
|
updateInDb(e, t) {
|
|
211
|
-
return
|
|
211
|
+
return At(e, t);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
class
|
|
214
|
+
const Bt = new Mt();
|
|
215
|
+
class xt extends f {
|
|
216
216
|
async hasXpBuff(e) {
|
|
217
217
|
const t = await this.get(e);
|
|
218
|
-
if (!
|
|
218
|
+
if (!Q(t.buffs.xp.expireAt))
|
|
219
219
|
return t.buffs.xp;
|
|
220
220
|
}
|
|
221
221
|
async calcXp(e, t) {
|
|
222
|
-
const r = await
|
|
222
|
+
const r = await Bt.get(e);
|
|
223
223
|
return r ? Math.ceil(
|
|
224
|
-
t * (r.disintegration /
|
|
224
|
+
t * (r.disintegration / xe) * ((await this.hasXpBuff(e))?.boost ?? 1)
|
|
225
225
|
) : 0;
|
|
226
226
|
}
|
|
227
227
|
async addXp(e, t) {
|
|
@@ -272,7 +272,7 @@ class Bt extends f {
|
|
|
272
272
|
]);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
const y = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }),
|
|
275
|
+
const y = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }), Fe = new u({
|
|
276
276
|
crew: {
|
|
277
277
|
type: u.Types.ObjectId,
|
|
278
278
|
required: !0,
|
|
@@ -288,25 +288,25 @@ const y = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }), Ne = new
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
|
-
|
|
291
|
+
Fe.post("findOneAndUpdate", async function(n) {
|
|
292
292
|
m(
|
|
293
293
|
h.CREW_META,
|
|
294
294
|
n.crew._id,
|
|
295
295
|
n
|
|
296
296
|
);
|
|
297
297
|
});
|
|
298
|
-
const
|
|
298
|
+
const Se = l?.CrewMeta || p("CrewMeta", Fe), qt = async (n) => await Se.create({
|
|
299
299
|
crew: n
|
|
300
300
|
});
|
|
301
|
-
async function
|
|
302
|
-
const e = await
|
|
303
|
-
return e || y(await
|
|
301
|
+
async function kt(n) {
|
|
302
|
+
const e = await Se.findOne({ crew: n }).lean();
|
|
303
|
+
return e || y(await qt(n));
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const _t = (n, e) => Se.findOneAndUpdate({ crew: n }, e, {
|
|
306
306
|
returnDocument: "after",
|
|
307
307
|
upsert: !0
|
|
308
308
|
}).lean();
|
|
309
|
-
class
|
|
309
|
+
class Nt extends xt {
|
|
310
310
|
constructor() {
|
|
311
311
|
super(300);
|
|
312
312
|
}
|
|
@@ -317,14 +317,14 @@ class kt extends Bt {
|
|
|
317
317
|
return e;
|
|
318
318
|
}
|
|
319
319
|
fetchFromDb(e) {
|
|
320
|
-
return
|
|
320
|
+
return kt(e);
|
|
321
321
|
}
|
|
322
322
|
updateInDb(e, t) {
|
|
323
|
-
return
|
|
323
|
+
return _t(e, t);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
const
|
|
327
|
-
class
|
|
326
|
+
const ve = new Nt();
|
|
327
|
+
class Ft extends f {
|
|
328
328
|
async unlockBadge(e, t, r) {
|
|
329
329
|
t.isProgressive ? await this.update(e, {
|
|
330
330
|
$addToSet: { unlockedBadges: `${t.id}_${r}` }
|
|
@@ -333,7 +333,7 @@ class Nt extends f {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
const
|
|
336
|
+
const je = new u({
|
|
337
337
|
crew: {
|
|
338
338
|
type: u.Types.ObjectId,
|
|
339
339
|
required: !0,
|
|
@@ -342,25 +342,25 @@ const Fe = new u({
|
|
|
342
342
|
},
|
|
343
343
|
unlockedBadges: { type: [String], default: [] }
|
|
344
344
|
});
|
|
345
|
-
|
|
345
|
+
je.post("findOneAndUpdate", async function(n) {
|
|
346
346
|
m(
|
|
347
347
|
h.CREW_ORNAMENTS,
|
|
348
348
|
n.crew._id,
|
|
349
349
|
n
|
|
350
350
|
);
|
|
351
351
|
});
|
|
352
|
-
const
|
|
352
|
+
const be = l?.CrewOrnaments || p("CrewOrnaments", je), jt = (n) => be.create({
|
|
353
353
|
crew: n
|
|
354
354
|
});
|
|
355
|
-
async function
|
|
356
|
-
const e = await
|
|
357
|
-
return e || y(await
|
|
355
|
+
async function zt(n) {
|
|
356
|
+
const e = await be.findOne({ crew: n }).lean();
|
|
357
|
+
return e || y(await jt(n));
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const Kt = (n, e) => be.findOneAndUpdate({ crew: n }, e, {
|
|
360
360
|
upsert: !0,
|
|
361
361
|
returnDocument: "after"
|
|
362
362
|
}).lean();
|
|
363
|
-
class
|
|
363
|
+
class Pt extends Ft {
|
|
364
364
|
constructor() {
|
|
365
365
|
super(300);
|
|
366
366
|
}
|
|
@@ -371,14 +371,14 @@ class Kt extends Nt {
|
|
|
371
371
|
return e;
|
|
372
372
|
}
|
|
373
373
|
fetchFromDb(e) {
|
|
374
|
-
return
|
|
374
|
+
return zt(e);
|
|
375
375
|
}
|
|
376
376
|
updateInDb(e, t) {
|
|
377
|
-
return
|
|
377
|
+
return Kt(e, t);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
const
|
|
381
|
-
class
|
|
380
|
+
const ei = new Pt();
|
|
381
|
+
class Ht extends b {
|
|
382
382
|
async getStatus(e, t) {
|
|
383
383
|
return (await this.get({ crew: e, questId: t })).status;
|
|
384
384
|
}
|
|
@@ -387,7 +387,7 @@ class Pt extends b {
|
|
|
387
387
|
}
|
|
388
388
|
async isStreaking(e, t) {
|
|
389
389
|
const { lastCompletionDate: r } = await this.get({ crew: e, questId: t });
|
|
390
|
-
return !!r &&
|
|
390
|
+
return !!r && me(N(), r);
|
|
391
391
|
}
|
|
392
392
|
async completeQuest(e) {
|
|
393
393
|
return this.update(
|
|
@@ -396,7 +396,7 @@ class Pt extends b {
|
|
|
396
396
|
{
|
|
397
397
|
$set: {
|
|
398
398
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
399
|
-
status:
|
|
399
|
+
status: D.COMPLETED
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
],
|
|
@@ -404,7 +404,7 @@ class Pt extends b {
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const ze = new u(
|
|
408
408
|
{
|
|
409
409
|
crew: {
|
|
410
410
|
type: u.Types.ObjectId,
|
|
@@ -417,37 +417,37 @@ const je = new u(
|
|
|
417
417
|
required: !0,
|
|
418
418
|
index: !0
|
|
419
419
|
},
|
|
420
|
-
status: { type: String, default:
|
|
420
|
+
status: { type: String, default: D.IN_PROGRESS, index: !0 },
|
|
421
421
|
lastCompletionDate: Date
|
|
422
422
|
},
|
|
423
423
|
{ minimize: !1 }
|
|
424
424
|
);
|
|
425
|
-
|
|
425
|
+
ze.post("findOneAndUpdate", function(n) {
|
|
426
426
|
m(
|
|
427
427
|
h.CREW_QUEST,
|
|
428
428
|
n.crew._id,
|
|
429
429
|
n
|
|
430
430
|
);
|
|
431
431
|
});
|
|
432
|
-
const
|
|
433
|
-
function
|
|
434
|
-
return
|
|
432
|
+
const V = l?.CrewQuest || p("CrewQuest", ze);
|
|
433
|
+
function Lt(n) {
|
|
434
|
+
return V.find(n).lean();
|
|
435
435
|
}
|
|
436
|
-
const
|
|
436
|
+
const Qt = async (n) => await V.create({
|
|
437
437
|
...n
|
|
438
438
|
});
|
|
439
|
-
async function
|
|
440
|
-
const e = await
|
|
441
|
-
return e || y(await
|
|
439
|
+
async function Wt(n) {
|
|
440
|
+
const e = await V.findOne(n).lean();
|
|
441
|
+
return e || y(await Qt(n));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
443
|
+
function Gt(n, e, t) {
|
|
444
|
+
return V.findOneAndUpdate(n, e, {
|
|
445
445
|
upsert: !0,
|
|
446
446
|
...t,
|
|
447
447
|
returnDocument: "after"
|
|
448
448
|
}).lean();
|
|
449
449
|
}
|
|
450
|
-
class
|
|
450
|
+
class Yt extends Ht {
|
|
451
451
|
constructor() {
|
|
452
452
|
super(300);
|
|
453
453
|
}
|
|
@@ -461,17 +461,17 @@ class Gt extends Pt {
|
|
|
461
461
|
return { crew: e, questId: t };
|
|
462
462
|
}
|
|
463
463
|
fetchFromDb(e) {
|
|
464
|
-
return
|
|
464
|
+
return Wt(e);
|
|
465
465
|
}
|
|
466
466
|
fetchManyFromDb(e) {
|
|
467
|
-
return
|
|
467
|
+
return Lt(e);
|
|
468
468
|
}
|
|
469
469
|
updateInDb(e, t, r) {
|
|
470
|
-
return
|
|
470
|
+
return Gt(e, t, r);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
const
|
|
474
|
-
class
|
|
473
|
+
const ti = new Yt();
|
|
474
|
+
class Xt extends f {
|
|
475
475
|
async setActualVoiceMembers(e, t) {
|
|
476
476
|
await this.update(e, {
|
|
477
477
|
$set: {
|
|
@@ -488,7 +488,7 @@ class Yt extends f {
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
const
|
|
491
|
+
const Ke = new u({
|
|
492
492
|
crew: {
|
|
493
493
|
type: u.Types.ObjectId,
|
|
494
494
|
required: !0,
|
|
@@ -501,28 +501,28 @@ const ze = new u({
|
|
|
501
501
|
connectedAt: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
|
-
|
|
504
|
+
Ke.post("findOneAndUpdate", function(n) {
|
|
505
505
|
m(
|
|
506
506
|
h.CREW_STATS_ENGAGEMENT,
|
|
507
507
|
n.crew._id,
|
|
508
508
|
n
|
|
509
509
|
);
|
|
510
510
|
});
|
|
511
|
-
const
|
|
511
|
+
const $e = l?.CrewStatsEngagement || p(
|
|
512
512
|
"CrewStatsEngagement",
|
|
513
|
-
|
|
514
|
-
),
|
|
513
|
+
Ke
|
|
514
|
+
), Vt = (n) => $e.create({
|
|
515
515
|
crew: n
|
|
516
516
|
});
|
|
517
|
-
async function
|
|
518
|
-
const e = await
|
|
519
|
-
return e || y(await
|
|
517
|
+
async function Jt(n) {
|
|
518
|
+
const e = await $e.findOne({ crew: n }).lean();
|
|
519
|
+
return e || y(await Vt(n));
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const Zt = (n, e) => $e.findOneAndUpdate({ crew: n }, e, {
|
|
522
522
|
upsert: !0,
|
|
523
523
|
returnDocument: "after"
|
|
524
524
|
}).lean();
|
|
525
|
-
class
|
|
525
|
+
class en extends Xt {
|
|
526
526
|
constructor() {
|
|
527
527
|
super(300);
|
|
528
528
|
}
|
|
@@ -535,16 +535,16 @@ class Zt extends Yt {
|
|
|
535
535
|
return e;
|
|
536
536
|
}
|
|
537
537
|
fetchFromDb(e) {
|
|
538
|
-
return
|
|
538
|
+
return Jt(e);
|
|
539
539
|
}
|
|
540
540
|
updateInDb(e, t) {
|
|
541
|
-
return
|
|
541
|
+
return Zt(e, t);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
const
|
|
545
|
-
class
|
|
544
|
+
const ni = new en();
|
|
545
|
+
class tn extends f {
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const Pe = new u({
|
|
548
548
|
crew: {
|
|
549
549
|
type: u.Types.ObjectId,
|
|
550
550
|
required: !0,
|
|
@@ -553,28 +553,28 @@ const Ke = new u({
|
|
|
553
553
|
},
|
|
554
554
|
streak80Percent: { type: Number, default: 0 }
|
|
555
555
|
});
|
|
556
|
-
|
|
556
|
+
Pe.post("findOneAndUpdate", function(n) {
|
|
557
557
|
m(
|
|
558
558
|
h.CREW_STATS_FREQUENCY,
|
|
559
559
|
n.crew._id,
|
|
560
560
|
n
|
|
561
561
|
);
|
|
562
562
|
});
|
|
563
|
-
const
|
|
563
|
+
const Ee = l?.CrewStatsFrequency || p(
|
|
564
564
|
"CrewStatsFrequency",
|
|
565
|
-
|
|
566
|
-
),
|
|
565
|
+
Pe
|
|
566
|
+
), nn = (n) => Ee.create({
|
|
567
567
|
crew: n
|
|
568
568
|
});
|
|
569
|
-
async function
|
|
570
|
-
const e = await
|
|
571
|
-
return e || y(await
|
|
569
|
+
async function rn(n) {
|
|
570
|
+
const e = await Ee.findOne({ crew: n }).lean();
|
|
571
|
+
return e || y(await nn(n));
|
|
572
572
|
}
|
|
573
|
-
const
|
|
573
|
+
const an = (n, e) => Ee.findOneAndUpdate({ crew: n }, e, {
|
|
574
574
|
upsert: !0,
|
|
575
575
|
returnDocument: "after"
|
|
576
576
|
}).lean();
|
|
577
|
-
class
|
|
577
|
+
class sn extends tn {
|
|
578
578
|
constructor() {
|
|
579
579
|
super(300);
|
|
580
580
|
}
|
|
@@ -585,13 +585,13 @@ class an extends en {
|
|
|
585
585
|
return e;
|
|
586
586
|
}
|
|
587
587
|
fetchFromDb(e) {
|
|
588
|
-
return
|
|
588
|
+
return rn(e);
|
|
589
589
|
}
|
|
590
590
|
updateInDb(e, t) {
|
|
591
|
-
return
|
|
591
|
+
return an(e, t);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
const
|
|
594
|
+
const ri = new sn(), He = new u(
|
|
595
595
|
{
|
|
596
596
|
user: {
|
|
597
597
|
type: u.Types.ObjectId,
|
|
@@ -604,15 +604,15 @@ const Xs = new an(), Pe = new u(
|
|
|
604
604
|
required: !0,
|
|
605
605
|
index: !0
|
|
606
606
|
},
|
|
607
|
-
status: { type: String, default:
|
|
607
|
+
status: { type: String, default: D.IN_PROGRESS, index: 1 },
|
|
608
608
|
lastCompletionDate: Date,
|
|
609
609
|
streak: Number
|
|
610
610
|
},
|
|
611
611
|
{ minimize: !1 }
|
|
612
612
|
);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
He.post("findOneAndUpdate", function(n) {
|
|
614
|
+
we(
|
|
615
|
+
ge.USER_QUEST,
|
|
616
616
|
n.user._id,
|
|
617
617
|
n
|
|
618
618
|
), m(
|
|
@@ -621,7 +621,7 @@ Pe.post("findOneAndUpdate", function(n) {
|
|
|
621
621
|
n
|
|
622
622
|
);
|
|
623
623
|
});
|
|
624
|
-
const
|
|
624
|
+
const x = l?.UserQuest || p("UserQuest", He), un = new u({
|
|
625
625
|
user: {
|
|
626
626
|
type: u.Types.ObjectId,
|
|
627
627
|
required: !0,
|
|
@@ -636,12 +636,12 @@ const B = l?.UserQuest || p("UserQuest", Pe), sn = new u({
|
|
|
636
636
|
commands: {
|
|
637
637
|
work: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
638
638
|
dice: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
639
|
+
doubleOrQuit: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
640
|
+
priceIsRight: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
641
|
+
blackJack: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
642
642
|
rps: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
643
643
|
}
|
|
644
|
-
}),
|
|
644
|
+
}), J = l?.UserCooldown || p("UserCooldown", un), Le = new u(
|
|
645
645
|
{
|
|
646
646
|
user: {
|
|
647
647
|
type: u.Types.ObjectId,
|
|
@@ -656,18 +656,18 @@ const B = l?.UserQuest || p("UserQuest", Pe), sn = new u({
|
|
|
656
656
|
index: !0
|
|
657
657
|
},
|
|
658
658
|
permission: { type: String, default: "member", required: !0 },
|
|
659
|
-
percent: { type: Number, default:
|
|
659
|
+
percent: { type: Number, default: gt }
|
|
660
660
|
},
|
|
661
661
|
{ minimize: !1 }
|
|
662
662
|
);
|
|
663
|
-
|
|
663
|
+
Le.post("findOneAndUpdate", function(n) {
|
|
664
664
|
m(
|
|
665
665
|
h.USER_CREW,
|
|
666
666
|
n.user._id,
|
|
667
667
|
n
|
|
668
668
|
);
|
|
669
669
|
});
|
|
670
|
-
const
|
|
670
|
+
const q = l?.UserCrew || p("UserCrew", Le), cn = new u({
|
|
671
671
|
user: {
|
|
672
672
|
type: u.Types.ObjectId,
|
|
673
673
|
required: !0,
|
|
@@ -683,7 +683,7 @@ const _ = l?.UserCrew || p("UserCrew", He), un = new u({
|
|
|
683
683
|
},
|
|
684
684
|
previousCompletedQuest: { type: [String], default: [] },
|
|
685
685
|
previousMessageSent: { type: Number, default: 0 }
|
|
686
|
-
}),
|
|
686
|
+
}), Z = l?.UserDailyReport || p("UserDailyReport", cn), on = new u({
|
|
687
687
|
user: {
|
|
688
688
|
type: u.Types.ObjectId,
|
|
689
689
|
required: !0,
|
|
@@ -691,7 +691,7 @@ const _ = l?.UserCrew || p("UserCrew", He), un = new u({
|
|
|
691
691
|
ref: "User"
|
|
692
692
|
},
|
|
693
693
|
encyclopedia: { type: [String], default: [] }
|
|
694
|
-
}),
|
|
694
|
+
}), ee = l?.UserEncyclopedia || p("UserEncyclopedia", on), dn = new u({
|
|
695
695
|
user: {
|
|
696
696
|
type: u.Types.ObjectId,
|
|
697
697
|
required: !0,
|
|
@@ -708,7 +708,7 @@ const _ = l?.UserCrew || p("UserCrew", He), un = new u({
|
|
|
708
708
|
},
|
|
709
709
|
default: null
|
|
710
710
|
}
|
|
711
|
-
}),
|
|
711
|
+
}), te = l?.UserGames || p("UserGames", dn), Qe = new u(
|
|
712
712
|
{
|
|
713
713
|
user: {
|
|
714
714
|
type: u.Types.ObjectId,
|
|
@@ -730,9 +730,9 @@ const _ = l?.UserCrew || p("UserCrew", He), un = new u({
|
|
|
730
730
|
},
|
|
731
731
|
{ minimize: !1 }
|
|
732
732
|
);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
733
|
+
Qe.post("findOneAndUpdate", function(n) {
|
|
734
|
+
we(
|
|
735
|
+
ge.USER_INVENTORY,
|
|
736
736
|
n.user._id,
|
|
737
737
|
n
|
|
738
738
|
), m(
|
|
@@ -741,14 +741,14 @@ Le.post("findOneAndUpdate", function(n) {
|
|
|
741
741
|
n
|
|
742
742
|
);
|
|
743
743
|
});
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
},
|
|
744
|
+
const ne = l?.UserInventory || p("UserInventory", Qe), ln = new he.EventEmitter(), pn = (n, e) => {
|
|
745
|
+
ln.emit(n, e);
|
|
746
|
+
}, R = {
|
|
747
747
|
multiplier: { type: Number, default: 0 },
|
|
748
748
|
origin: String,
|
|
749
749
|
expireAt: { type: Date, default: null },
|
|
750
750
|
startAt: { type: Date, default: null }
|
|
751
|
-
},
|
|
751
|
+
}, We = new u({
|
|
752
752
|
user: {
|
|
753
753
|
type: u.Types.ObjectId,
|
|
754
754
|
required: !0,
|
|
@@ -771,33 +771,33 @@ const te = l?.UserInventory || p("UserInventory", Le), dn = new me.EventEmitter(
|
|
|
771
771
|
buffs: {
|
|
772
772
|
cooldown: {
|
|
773
773
|
casino: {
|
|
774
|
-
type: [
|
|
774
|
+
type: [R],
|
|
775
775
|
default: []
|
|
776
776
|
},
|
|
777
777
|
work: {
|
|
778
|
-
type: [
|
|
778
|
+
type: [R],
|
|
779
779
|
default: []
|
|
780
780
|
}
|
|
781
781
|
},
|
|
782
782
|
berry: {
|
|
783
783
|
work: {
|
|
784
|
-
type: [
|
|
784
|
+
type: [R],
|
|
785
785
|
default: []
|
|
786
786
|
},
|
|
787
787
|
global: {
|
|
788
|
-
type: [
|
|
788
|
+
type: [R],
|
|
789
789
|
default: []
|
|
790
790
|
}
|
|
791
791
|
},
|
|
792
792
|
drop: {
|
|
793
793
|
work: {
|
|
794
|
-
type: [
|
|
794
|
+
type: [R],
|
|
795
795
|
default: []
|
|
796
796
|
}
|
|
797
797
|
},
|
|
798
798
|
xp: {
|
|
799
799
|
global: {
|
|
800
|
-
type: [
|
|
800
|
+
type: [R],
|
|
801
801
|
default: []
|
|
802
802
|
}
|
|
803
803
|
}
|
|
@@ -825,14 +825,14 @@ const te = l?.UserInventory || p("UserInventory", Le), dn = new me.EventEmitter(
|
|
|
825
825
|
wisdom: { type: Number, default: 0 }
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
|
|
828
|
+
We.post("findOneAndUpdate", async function(n) {
|
|
829
829
|
m(
|
|
830
830
|
h.USER_META,
|
|
831
831
|
n.user._id,
|
|
832
832
|
n
|
|
833
|
-
), n.hp <= 0 &&
|
|
833
|
+
), n.hp <= 0 && pn("death", n.user._id);
|
|
834
834
|
});
|
|
835
|
-
const
|
|
835
|
+
const T = l?.UserMeta || p("UserMeta", We), Ge = new u({
|
|
836
836
|
user: {
|
|
837
837
|
type: u.Types.ObjectId,
|
|
838
838
|
required: !0,
|
|
@@ -849,14 +849,14 @@ const O = l?.UserMeta || p("UserMeta", Qe), We = new u({
|
|
|
849
849
|
unlockedBags: { type: [String], default: ["default"] },
|
|
850
850
|
selectedBag: { type: String, default: "default" }
|
|
851
851
|
});
|
|
852
|
-
|
|
852
|
+
Ge.post("findOneAndUpdate", function(n) {
|
|
853
853
|
m(
|
|
854
854
|
h.USER_ORNAMENT,
|
|
855
855
|
n.user._id,
|
|
856
856
|
n
|
|
857
857
|
);
|
|
858
858
|
});
|
|
859
|
-
const
|
|
859
|
+
const re = l?.UserOrnament || p("UserOrnament", Ge), Ye = new u(
|
|
860
860
|
{
|
|
861
861
|
user: {
|
|
862
862
|
type: u.Types.ObjectId,
|
|
@@ -880,14 +880,14 @@ const ne = l?.UserOrnament || p("UserOrnament", We), Ge = new u(
|
|
|
880
880
|
},
|
|
881
881
|
{ minimize: !1 }
|
|
882
882
|
);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
883
|
+
Ye.post("findOneAndUpdate", function(n) {
|
|
884
|
+
we(
|
|
885
|
+
ge.USER_RAID,
|
|
886
886
|
n.user._id,
|
|
887
887
|
n
|
|
888
888
|
);
|
|
889
889
|
});
|
|
890
|
-
const
|
|
890
|
+
const ae = l?.UserRaid || p("UserRaid", Ye), yn = new u({
|
|
891
891
|
user: {
|
|
892
892
|
type: u.Types.ObjectId,
|
|
893
893
|
required: !0,
|
|
@@ -913,7 +913,7 @@ const re = l?.UserRaid || p("UserRaid", Ge), pn = new u({
|
|
|
913
913
|
rps: { type: Boolean, default: !1 }
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
}),
|
|
916
|
+
}), z = l?.UserSettings || p("UserSettings", yn), fn = new u(
|
|
917
917
|
{
|
|
918
918
|
user: {
|
|
919
919
|
type: u.Types.ObjectId,
|
|
@@ -925,7 +925,7 @@ const re = l?.UserRaid || p("UserRaid", Ge), pn = new u({
|
|
|
925
925
|
limit: { type: u.Types.Mixed, default: {} }
|
|
926
926
|
},
|
|
927
927
|
{ minimize: !1 }
|
|
928
|
-
),
|
|
928
|
+
), se = l?.UserShop || p("UserShop", fn), Xe = new u({
|
|
929
929
|
user: {
|
|
930
930
|
type: u.Types.ObjectId,
|
|
931
931
|
required: !0,
|
|
@@ -960,14 +960,14 @@ const re = l?.UserRaid || p("UserRaid", Ge), pn = new u({
|
|
|
960
960
|
guessInOneTryCount: { type: Number, default: 0 }
|
|
961
961
|
}
|
|
962
962
|
});
|
|
963
|
-
|
|
963
|
+
Xe.post("findOneAndUpdate", function(n) {
|
|
964
964
|
m(
|
|
965
965
|
h.USER_STATS_CASINO,
|
|
966
966
|
n.user._id,
|
|
967
967
|
n
|
|
968
968
|
);
|
|
969
969
|
});
|
|
970
|
-
const
|
|
970
|
+
const A = l?.UserStatsCasino || p("UserStatsCasino", Xe), Ve = new u({
|
|
971
971
|
user: {
|
|
972
972
|
type: u.Types.ObjectId,
|
|
973
973
|
required: !0,
|
|
@@ -979,14 +979,14 @@ const v = l?.UserStatsCasino || p("UserStatsCasino", Ye), Xe = new u({
|
|
|
979
979
|
timeCrewBeyond10PercentXp: { type: Number, default: 0 },
|
|
980
980
|
timeCrewAbove90PercentXp: { type: Number, default: 0 }
|
|
981
981
|
});
|
|
982
|
-
|
|
982
|
+
Ve.post("findOneAndUpdate", function(n) {
|
|
983
983
|
m(
|
|
984
984
|
h.USER_STATS_CREW,
|
|
985
985
|
n.user._id,
|
|
986
986
|
n
|
|
987
987
|
);
|
|
988
988
|
});
|
|
989
|
-
const
|
|
989
|
+
const ie = l?.UserStatsCrew || p("UserStatsCrew", Ve), Je = new u({
|
|
990
990
|
user: {
|
|
991
991
|
type: u.Types.ObjectId,
|
|
992
992
|
required: !0,
|
|
@@ -997,14 +997,14 @@ const se = l?.UserStatsCrew || p("UserStatsCrew", Xe), Ve = new u({
|
|
|
997
997
|
raidFinishedCount: { type: Number, default: 0 },
|
|
998
998
|
totalSpentInShop: { type: Number, default: 0 }
|
|
999
999
|
});
|
|
1000
|
-
|
|
1000
|
+
Je.post("findOneAndUpdate", function(n) {
|
|
1001
1001
|
m(
|
|
1002
1002
|
h.USER_STATS_ECONOMY,
|
|
1003
1003
|
n.user._id,
|
|
1004
1004
|
n
|
|
1005
1005
|
);
|
|
1006
1006
|
});
|
|
1007
|
-
const
|
|
1007
|
+
const ue = l?.UserStatsEconomy || p("UserStatsEconomy", Je), Ze = new u({
|
|
1008
1008
|
user: {
|
|
1009
1009
|
type: u.Types.ObjectId,
|
|
1010
1010
|
required: !0,
|
|
@@ -1016,17 +1016,17 @@ const ie = l?.UserStatsEconomy || p("UserStatsEconomy", Ve), Je = new u({
|
|
|
1016
1016
|
randomMessageClaimed: { type: Number, default: 0 },
|
|
1017
1017
|
writeDifferentChatIds: { type: [String], default: [] }
|
|
1018
1018
|
});
|
|
1019
|
-
|
|
1019
|
+
Ze.post("findOneAndUpdate", function(n) {
|
|
1020
1020
|
m(
|
|
1021
1021
|
h.USER_STATS_ENGAGEMENT,
|
|
1022
1022
|
n.user._id,
|
|
1023
1023
|
n
|
|
1024
1024
|
);
|
|
1025
1025
|
});
|
|
1026
|
-
const
|
|
1026
|
+
const ce = l?.UserStatsEngagement || p(
|
|
1027
1027
|
"UserStatsEngagement",
|
|
1028
|
-
|
|
1029
|
-
),
|
|
1028
|
+
Ze
|
|
1029
|
+
), et = new u({
|
|
1030
1030
|
user: {
|
|
1031
1031
|
type: u.Types.ObjectId,
|
|
1032
1032
|
required: !0,
|
|
@@ -1045,14 +1045,14 @@ const ue = l?.UserStatsEngagement || p(
|
|
|
1045
1045
|
loseEverything: { type: Boolean, default: !1 }
|
|
1046
1046
|
}
|
|
1047
1047
|
});
|
|
1048
|
-
|
|
1048
|
+
et.post("findOneAndUpdate", function(n) {
|
|
1049
1049
|
m(
|
|
1050
1050
|
h.USER_STATS_FLAGS,
|
|
1051
1051
|
n.user._id,
|
|
1052
1052
|
n
|
|
1053
1053
|
);
|
|
1054
1054
|
});
|
|
1055
|
-
const
|
|
1055
|
+
const oe = l?.UserStatsFlags || p("UserStatsFlags", et), tt = new u({
|
|
1056
1056
|
user: {
|
|
1057
1057
|
type: u.Types.ObjectId,
|
|
1058
1058
|
required: !0,
|
|
@@ -1064,7 +1064,7 @@ const ce = l?.UserStatsFlags || p("UserStatsFlags", Ze), et = new u({
|
|
|
1064
1064
|
lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date() }
|
|
1065
1065
|
}
|
|
1066
1066
|
});
|
|
1067
|
-
|
|
1067
|
+
tt.post("findOneAndUpdate", function(n) {
|
|
1068
1068
|
m(
|
|
1069
1069
|
h.USER_STATS_FREQUENCY,
|
|
1070
1070
|
n.user._id,
|
|
@@ -1073,8 +1073,8 @@ et.post("findOneAndUpdate", function(n) {
|
|
|
1073
1073
|
});
|
|
1074
1074
|
const M = l?.UserStatsFrequency || p(
|
|
1075
1075
|
"UserStatsFrequency",
|
|
1076
|
-
|
|
1077
|
-
),
|
|
1076
|
+
tt
|
|
1077
|
+
), nt = new u({
|
|
1078
1078
|
user: {
|
|
1079
1079
|
type: u.Types.ObjectId,
|
|
1080
1080
|
required: !0,
|
|
@@ -1101,32 +1101,32 @@ const M = l?.UserStatsFrequency || p(
|
|
|
1101
1101
|
totalCrafted: { type: Number, default: 0 }
|
|
1102
1102
|
}
|
|
1103
1103
|
});
|
|
1104
|
-
|
|
1104
|
+
nt.post("findOneAndUpdate", function(n) {
|
|
1105
1105
|
m(
|
|
1106
1106
|
h.USER_STATS_INVENTORY,
|
|
1107
1107
|
n.user._id,
|
|
1108
1108
|
n
|
|
1109
1109
|
);
|
|
1110
1110
|
});
|
|
1111
|
-
const
|
|
1111
|
+
const B = l?.UserStatsInventory || p(
|
|
1112
1112
|
"UserStatsInventory",
|
|
1113
|
-
|
|
1114
|
-
),
|
|
1113
|
+
nt
|
|
1114
|
+
), Ue = new u({
|
|
1115
1115
|
discordId: { type: String, required: !0, unique: !0 },
|
|
1116
1116
|
birthday: { type: Date, default: null, index: 1 },
|
|
1117
|
-
faction: { type: String, default:
|
|
1117
|
+
faction: { type: String, default: St, index: 1 },
|
|
1118
1118
|
canChangeFaction: { type: Boolean, default: !1 },
|
|
1119
1119
|
canChooseFaction: { type: Boolean, default: !1 }
|
|
1120
1120
|
});
|
|
1121
|
-
|
|
1121
|
+
Ue.post("findOneAndUpdate", function(n) {
|
|
1122
1122
|
m(h.USER, n._id, n);
|
|
1123
1123
|
});
|
|
1124
|
-
|
|
1124
|
+
Ue.post("deleteOne", async function() {
|
|
1125
1125
|
const n = this.getQuery()._id;
|
|
1126
|
-
await
|
|
1126
|
+
await J.deleteOne({ user: n }), await q.deleteOne({ user: n }), await Z.deleteOne({ user: n }), await ee.deleteOne({ user: n }), await te.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await T.deleteOne({ user: n }), await re.deleteOne({ user: n }), await x.deleteMany({ user: n }), await ae.deleteOne({ user: n }), await z.deleteOne({ user: n }), await se.deleteOne({ user: n }), await A.deleteOne({ user: n }), await ie.deleteOne({ user: n }), await ue.deleteOne({ user: n }), await ce.deleteOne({ user: n }), await oe.deleteOne({ user: n }), await M.deleteOne({ user: n }), await B.deleteOne({ user: n });
|
|
1127
1127
|
});
|
|
1128
|
-
const $ = l?.User || p("User",
|
|
1129
|
-
class
|
|
1128
|
+
const $ = l?.User || p("User", Ue);
|
|
1129
|
+
class mn extends b {
|
|
1130
1130
|
getByObjectId(e) {
|
|
1131
1131
|
return this.update({ _id: e }, {});
|
|
1132
1132
|
}
|
|
@@ -1182,34 +1182,6 @@ class fn extends b {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
]);
|
|
1184
1184
|
}
|
|
1185
|
-
async getFactionRank(e) {
|
|
1186
|
-
const t = await this.get(e);
|
|
1187
|
-
return (await $.aggregate([
|
|
1188
|
-
{
|
|
1189
|
-
$lookup: {
|
|
1190
|
-
from: "usermetas",
|
|
1191
|
-
localField: "_id",
|
|
1192
|
-
foreignField: "user",
|
|
1193
|
-
as: "meta"
|
|
1194
|
-
}
|
|
1195
|
-
},
|
|
1196
|
-
{ $unwind: "$meta" },
|
|
1197
|
-
{ $match: { faction: t.faction } },
|
|
1198
|
-
{
|
|
1199
|
-
$setWindowFields: {
|
|
1200
|
-
sortBy: { "meta.xp.amount": -1 },
|
|
1201
|
-
output: { rank: { $rank: {} } }
|
|
1202
|
-
}
|
|
1203
|
-
},
|
|
1204
|
-
{ $match: { _id: t._id } },
|
|
1205
|
-
{
|
|
1206
|
-
$project: {
|
|
1207
|
-
_id: 0,
|
|
1208
|
-
rank: 1
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
]))[0];
|
|
1212
|
-
}
|
|
1213
1185
|
getFactionRanking(e) {
|
|
1214
1186
|
return $.aggregate([
|
|
1215
1187
|
{ $match: { faction: e } },
|
|
@@ -1278,10 +1250,10 @@ class fn extends b {
|
|
|
1278
1250
|
]);
|
|
1279
1251
|
}
|
|
1280
1252
|
getQuestRanking() {
|
|
1281
|
-
return
|
|
1253
|
+
return x.aggregate([
|
|
1282
1254
|
{
|
|
1283
1255
|
$match: {
|
|
1284
|
-
status:
|
|
1256
|
+
status: D.COMPLETED
|
|
1285
1257
|
}
|
|
1286
1258
|
},
|
|
1287
1259
|
{
|
|
@@ -1352,18 +1324,18 @@ class fn extends b {
|
|
|
1352
1324
|
await this.update({ discordId: e }, { $set: { faction: t } });
|
|
1353
1325
|
}
|
|
1354
1326
|
}
|
|
1355
|
-
const
|
|
1327
|
+
const hn = (n, e) => $.find(n, {}, e).lean(), wn = (n) => $.create({
|
|
1356
1328
|
discordId: n
|
|
1357
1329
|
});
|
|
1358
|
-
async function
|
|
1359
|
-
const
|
|
1360
|
-
return e
|
|
1330
|
+
async function gn(n, { upsert: e = !0, ...t }) {
|
|
1331
|
+
const r = await $.findOne({ discordId: n }, {}, t).lean();
|
|
1332
|
+
return !r && e ? y(await wn(n)) : r;
|
|
1361
1333
|
}
|
|
1362
|
-
const
|
|
1334
|
+
const Sn = (n, e) => $.findOneAndUpdate(n, e, {
|
|
1363
1335
|
upsert: !0,
|
|
1364
1336
|
returnDocument: "after"
|
|
1365
|
-
});
|
|
1366
|
-
class
|
|
1337
|
+
}).lean();
|
|
1338
|
+
class bn extends mn {
|
|
1367
1339
|
constructor() {
|
|
1368
1340
|
super(3600);
|
|
1369
1341
|
}
|
|
@@ -1373,24 +1345,17 @@ class Sn extends fn {
|
|
|
1373
1345
|
getKey({ discordId: e }) {
|
|
1374
1346
|
return e;
|
|
1375
1347
|
}
|
|
1376
|
-
fetchFromDb(e) {
|
|
1377
|
-
return
|
|
1348
|
+
fetchFromDb(e, t) {
|
|
1349
|
+
return gn(e, t);
|
|
1378
1350
|
}
|
|
1379
|
-
fetchManyFromDb(e) {
|
|
1380
|
-
return
|
|
1351
|
+
fetchManyFromDb(e, t) {
|
|
1352
|
+
return hn(e, t);
|
|
1381
1353
|
}
|
|
1382
1354
|
updateInDb(e, t) {
|
|
1383
|
-
return
|
|
1355
|
+
return Sn(e, t);
|
|
1384
1356
|
}
|
|
1385
1357
|
}
|
|
1386
|
-
const
|
|
1387
|
-
"work",
|
|
1388
|
-
"rps",
|
|
1389
|
-
"blackjack",
|
|
1390
|
-
"guess",
|
|
1391
|
-
"qod",
|
|
1392
|
-
"dice"
|
|
1393
|
-
], $n = new u(
|
|
1358
|
+
const $n = new bn(), ai = ["work", ...bt], En = new u(
|
|
1394
1359
|
{
|
|
1395
1360
|
user: {
|
|
1396
1361
|
type: u.Types.ObjectId,
|
|
@@ -1402,12 +1367,12 @@ const bn = new Sn(), Vs = [
|
|
|
1402
1367
|
type: { type: String, required: !0 }
|
|
1403
1368
|
},
|
|
1404
1369
|
{ minimize: !1 }
|
|
1405
|
-
),
|
|
1406
|
-
await
|
|
1370
|
+
), K = l?.Reminder || p("Reminder", En), Un = async (n) => {
|
|
1371
|
+
await K.deleteMany(n);
|
|
1407
1372
|
}, In = async (n, e) => {
|
|
1408
|
-
await
|
|
1373
|
+
await K.deleteOne({ user: n, type: e });
|
|
1409
1374
|
};
|
|
1410
|
-
class
|
|
1375
|
+
class Dn extends b {
|
|
1411
1376
|
getAllPassedReminder() {
|
|
1412
1377
|
return this.getMany({ date: { $lte: /* @__PURE__ */ new Date() } });
|
|
1413
1378
|
}
|
|
@@ -1430,25 +1395,25 @@ class Un extends b {
|
|
|
1430
1395
|
}
|
|
1431
1396
|
async deleteSelectedReminders(e) {
|
|
1432
1397
|
const t = await this.getMany({ _id: { $in: e } });
|
|
1433
|
-
await
|
|
1398
|
+
await Un({ _id: { $in: e } }), t.forEach((r) => {
|
|
1434
1399
|
this.invalidate({ user: r.user, type: r.type });
|
|
1435
1400
|
});
|
|
1436
1401
|
}
|
|
1437
1402
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return
|
|
1403
|
+
function On(n, e) {
|
|
1404
|
+
return K.find(n, {}, e).lean();
|
|
1440
1405
|
}
|
|
1441
1406
|
async function Tn(n) {
|
|
1442
|
-
const e = await
|
|
1407
|
+
const e = await K.findOne(n).lean();
|
|
1443
1408
|
return e || null;
|
|
1444
1409
|
}
|
|
1445
|
-
async function
|
|
1446
|
-
return
|
|
1410
|
+
async function Rn(n, e, t) {
|
|
1411
|
+
return K.findOneAndUpdate(n, e, {
|
|
1447
1412
|
...t,
|
|
1448
1413
|
returnDocument: "after"
|
|
1449
1414
|
}).lean();
|
|
1450
1415
|
}
|
|
1451
|
-
class Cn extends
|
|
1416
|
+
class Cn extends Dn {
|
|
1452
1417
|
constructor() {
|
|
1453
1418
|
super(300);
|
|
1454
1419
|
}
|
|
@@ -1465,14 +1430,14 @@ class Cn extends Un {
|
|
|
1465
1430
|
return Tn(e);
|
|
1466
1431
|
}
|
|
1467
1432
|
fetchManyFromDb(e, t) {
|
|
1468
|
-
return
|
|
1433
|
+
return On(e, t);
|
|
1469
1434
|
}
|
|
1470
1435
|
updateInDb(e, t, r = { upsert: !1 }) {
|
|
1471
|
-
return
|
|
1436
|
+
return Rn(e, t, r);
|
|
1472
1437
|
}
|
|
1473
1438
|
}
|
|
1474
|
-
const
|
|
1475
|
-
class
|
|
1439
|
+
const L = new Cn();
|
|
1440
|
+
class vn extends b {
|
|
1476
1441
|
async isOrnamentIds(e, t = () => !0) {
|
|
1477
1442
|
const a = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
|
|
1478
1443
|
return e.every((s) => a.includes(s));
|
|
@@ -1511,7 +1476,7 @@ class Rn extends b {
|
|
|
1511
1476
|
return (await this.getAll()).filter(this.isShopTitle);
|
|
1512
1477
|
}
|
|
1513
1478
|
formatBackgroundId(e) {
|
|
1514
|
-
return e.ornamentId === "background_default" ? "par défaut" : `"${
|
|
1479
|
+
return e.ornamentId === "background_default" ? "par défaut" : `"${lt(e.ornamentId.split("_").join(" "))}"`;
|
|
1515
1480
|
}
|
|
1516
1481
|
pickOrnament(e) {
|
|
1517
1482
|
const t = Math.random();
|
|
@@ -1527,7 +1492,7 @@ class Rn extends b {
|
|
|
1527
1492
|
continue;
|
|
1528
1493
|
}
|
|
1529
1494
|
if (i.length !== 0)
|
|
1530
|
-
return i[
|
|
1495
|
+
return i[X(0, i.length)];
|
|
1531
1496
|
}
|
|
1532
1497
|
throw Error("pickOrnament - All ods array were empty");
|
|
1533
1498
|
}
|
|
@@ -1536,15 +1501,15 @@ class Rn extends b {
|
|
|
1536
1501
|
throw new RangeError(
|
|
1537
1502
|
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
1538
1503
|
);
|
|
1539
|
-
return
|
|
1504
|
+
return F(
|
|
1540
1505
|
t.map((r, a) => {
|
|
1541
1506
|
const s = Ce[a], i = e[s];
|
|
1542
|
-
return Math.random() > r || !i || !i.length ? null :
|
|
1507
|
+
return Math.random() > r || !i || !i.length ? null : pt(i);
|
|
1543
1508
|
})
|
|
1544
1509
|
);
|
|
1545
1510
|
}
|
|
1546
1511
|
}
|
|
1547
|
-
const
|
|
1512
|
+
const An = new u(
|
|
1548
1513
|
{
|
|
1549
1514
|
ornamentId: { unique: !0, index: 1, required: !0, type: String },
|
|
1550
1515
|
type: { required: !0, type: String },
|
|
@@ -1558,26 +1523,26 @@ const vn = new u(
|
|
|
1558
1523
|
strength: Number
|
|
1559
1524
|
},
|
|
1560
1525
|
{ minimize: !1 }
|
|
1561
|
-
), Ie = l?.Ornaments || p("Ornaments",
|
|
1562
|
-
async function
|
|
1526
|
+
), Ie = l?.Ornaments || p("Ornaments", An), Mn = async (n, e) => Ie.find(n, {}, e).lean();
|
|
1527
|
+
async function Bn(n) {
|
|
1563
1528
|
const e = await Ie.findOne({ ornamentId: n }).lean();
|
|
1564
1529
|
return e || null;
|
|
1565
1530
|
}
|
|
1566
|
-
const
|
|
1531
|
+
const xn = (n, e) => Ie.findOneAndUpdate(n, e, {
|
|
1567
1532
|
returnDocument: "after"
|
|
1568
1533
|
}).lean();
|
|
1569
|
-
class
|
|
1534
|
+
class qn extends vn {
|
|
1570
1535
|
constructor() {
|
|
1571
1536
|
super(3600);
|
|
1572
1537
|
}
|
|
1573
1538
|
updateInDb(e, t) {
|
|
1574
|
-
return
|
|
1539
|
+
return xn(e, t);
|
|
1575
1540
|
}
|
|
1576
1541
|
fetchFromDb(e) {
|
|
1577
|
-
return
|
|
1542
|
+
return Bn(e);
|
|
1578
1543
|
}
|
|
1579
|
-
fetchManyFromDb(e) {
|
|
1580
|
-
return Mn(e);
|
|
1544
|
+
fetchManyFromDb(e, t) {
|
|
1545
|
+
return Mn(e, t);
|
|
1581
1546
|
}
|
|
1582
1547
|
getKey(e) {
|
|
1583
1548
|
return e.ornamentId;
|
|
@@ -1586,7 +1551,7 @@ class _n extends Rn {
|
|
|
1586
1551
|
return e;
|
|
1587
1552
|
}
|
|
1588
1553
|
}
|
|
1589
|
-
const g = new
|
|
1554
|
+
const g = new qn(), kn = new u(
|
|
1590
1555
|
{
|
|
1591
1556
|
panoplyId: { unique: !0, index: 1, required: !0, type: String },
|
|
1592
1557
|
name: { required: !0, type: String },
|
|
@@ -1600,21 +1565,21 @@ const g = new _n(), xn = new u(
|
|
|
1600
1565
|
halfBonus: u.Types.Mixed
|
|
1601
1566
|
},
|
|
1602
1567
|
{ minimize: !1 }
|
|
1603
|
-
),
|
|
1604
|
-
async function
|
|
1605
|
-
const e = await
|
|
1568
|
+
), P = l?.Panoplies || p("Panoplies", kn), _n = (n, e) => P.find(n, {}, e).lean(), Nn = async (n, e) => P.find(n, {}, e).populate("equipments");
|
|
1569
|
+
async function Fn(n) {
|
|
1570
|
+
const e = await P.findOne({ panoplyId: n }).lean();
|
|
1606
1571
|
return e || null;
|
|
1607
1572
|
}
|
|
1608
|
-
const
|
|
1609
|
-
class
|
|
1573
|
+
const jn = async (n) => P.findOne(n).populate("equipments");
|
|
1574
|
+
class zn extends b {
|
|
1610
1575
|
getAllPopulated() {
|
|
1611
|
-
return
|
|
1576
|
+
return Nn({}, {});
|
|
1612
1577
|
}
|
|
1613
1578
|
getPopulated(e) {
|
|
1614
|
-
return
|
|
1579
|
+
return jn({ panoplyId: e });
|
|
1615
1580
|
}
|
|
1616
1581
|
hasPanoply(e, t) {
|
|
1617
|
-
const r =
|
|
1582
|
+
const r = F(Object.values(e)), a = t.equipments.filter(
|
|
1618
1583
|
(s) => r.find((i) => i.entityId === s.entityId)
|
|
1619
1584
|
).length;
|
|
1620
1585
|
if (a === t.equipments.length)
|
|
@@ -1625,7 +1590,7 @@ class jn extends b {
|
|
|
1625
1590
|
async getPanoplyBonus(e) {
|
|
1626
1591
|
const t = [], r = await this.getAllPopulated();
|
|
1627
1592
|
for (const a of r) {
|
|
1628
|
-
const s =
|
|
1593
|
+
const s = F(Object.values(e)), i = a.equipments.filter(
|
|
1629
1594
|
(o) => s.find(({ entityId: c }) => c === o.entityId)
|
|
1630
1595
|
);
|
|
1631
1596
|
i.length === a.equipments.length ? t.push([a, "full"]) : i.length >= a.equipments.length / 2 ? t.push([a, "half"]) : i.length >= 1 && t.push([a, null]);
|
|
@@ -1633,10 +1598,10 @@ class jn extends b {
|
|
|
1633
1598
|
return t;
|
|
1634
1599
|
}
|
|
1635
1600
|
}
|
|
1636
|
-
const
|
|
1601
|
+
const Kn = async (n, e) => P.findOneAndUpdate(n, e, {
|
|
1637
1602
|
returnDocument: "after"
|
|
1638
1603
|
}).lean();
|
|
1639
|
-
class
|
|
1604
|
+
class Pn extends zn {
|
|
1640
1605
|
constructor() {
|
|
1641
1606
|
super(3600);
|
|
1642
1607
|
}
|
|
@@ -1647,17 +1612,17 @@ class Kn extends jn {
|
|
|
1647
1612
|
return e;
|
|
1648
1613
|
}
|
|
1649
1614
|
updateInDb(e, t) {
|
|
1650
|
-
return
|
|
1615
|
+
return Kn(e, t);
|
|
1651
1616
|
}
|
|
1652
1617
|
fetchFromDb(e) {
|
|
1653
|
-
return
|
|
1618
|
+
return Fn(e);
|
|
1654
1619
|
}
|
|
1655
|
-
fetchManyFromDb(e
|
|
1656
|
-
return
|
|
1620
|
+
fetchManyFromDb(e, t) {
|
|
1621
|
+
return _n(e, t);
|
|
1657
1622
|
}
|
|
1658
1623
|
}
|
|
1659
|
-
const
|
|
1660
|
-
class
|
|
1624
|
+
const U = new Pn();
|
|
1625
|
+
class Hn extends b {
|
|
1661
1626
|
isEntity(e) {
|
|
1662
1627
|
return !!e && "entityId" in e;
|
|
1663
1628
|
}
|
|
@@ -1695,14 +1660,14 @@ class Pn extends b {
|
|
|
1695
1660
|
}
|
|
1696
1661
|
async recordToEntityTuple(e) {
|
|
1697
1662
|
const t = await this.getAll();
|
|
1698
|
-
return
|
|
1663
|
+
return C(e).reduce((r, [a, s]) => {
|
|
1699
1664
|
const i = t.find(({ entityId: o }) => o === a);
|
|
1700
1665
|
return i && r.push([i, s]), r;
|
|
1701
1666
|
}, []);
|
|
1702
1667
|
}
|
|
1703
1668
|
async getAllEntitiesLimit() {
|
|
1704
1669
|
const e = await this.getAll();
|
|
1705
|
-
return
|
|
1670
|
+
return Be(
|
|
1706
1671
|
e.map((t) => [t.entityId, t.shop?.limit ?? 0])
|
|
1707
1672
|
);
|
|
1708
1673
|
}
|
|
@@ -1726,18 +1691,18 @@ class Pn extends b {
|
|
|
1726
1691
|
intelligence: 0,
|
|
1727
1692
|
wisdom: 0
|
|
1728
1693
|
};
|
|
1729
|
-
const r = await
|
|
1730
|
-
for (const a of
|
|
1694
|
+
const r = await U.getAllPopulated();
|
|
1695
|
+
for (const a of qe) {
|
|
1731
1696
|
const s = e[a];
|
|
1732
|
-
s && (t =
|
|
1697
|
+
s && (t = j(
|
|
1733
1698
|
t,
|
|
1734
1699
|
(await this.fromDBToEquipableEquipment(s)).characteristics,
|
|
1735
1700
|
(i, o) => i + o
|
|
1736
1701
|
));
|
|
1737
1702
|
}
|
|
1738
1703
|
for (const a of r) {
|
|
1739
|
-
const s =
|
|
1740
|
-
s && !("target" in s) && (t =
|
|
1704
|
+
const s = U.hasPanoply(e, a);
|
|
1705
|
+
s && !("target" in s) && (t = j(
|
|
1741
1706
|
t,
|
|
1742
1707
|
s,
|
|
1743
1708
|
(i, o) => i + o
|
|
@@ -1748,14 +1713,14 @@ class Pn extends b {
|
|
|
1748
1713
|
getSomeItems(e, t) {
|
|
1749
1714
|
const r = [];
|
|
1750
1715
|
for (; r.length < e; ) {
|
|
1751
|
-
const a =
|
|
1716
|
+
const a = _(t, r, (s) => s.entityId);
|
|
1752
1717
|
r.push(
|
|
1753
1718
|
g.pickOrnament(
|
|
1754
|
-
|
|
1719
|
+
yt(a, (s) => s.shop?.odd ?? 0)
|
|
1755
1720
|
)
|
|
1756
1721
|
);
|
|
1757
1722
|
}
|
|
1758
|
-
return
|
|
1723
|
+
return Re(r, (a) => a.shop?.price ?? 0);
|
|
1759
1724
|
}
|
|
1760
1725
|
filterCraftEntities(e) {
|
|
1761
1726
|
return e.filter((t) => t.usage?.craft);
|
|
@@ -1811,12 +1776,9 @@ class Pn extends b {
|
|
|
1811
1776
|
isSameEquipment(e, t) {
|
|
1812
1777
|
return e.entityId === t.entityId && e.seed === t.seed;
|
|
1813
1778
|
}
|
|
1814
|
-
getEquipmentSlotType(e) {
|
|
1815
|
-
return St[e];
|
|
1816
|
-
}
|
|
1817
1779
|
seedEquipment(e, t) {
|
|
1818
|
-
const r =
|
|
1819
|
-
|
|
1780
|
+
const r = ft(t), a = Re(
|
|
1781
|
+
C(e.characteristics),
|
|
1820
1782
|
([s]) => s
|
|
1821
1783
|
);
|
|
1822
1784
|
return {
|
|
@@ -1825,7 +1787,7 @@ class Pn extends b {
|
|
|
1825
1787
|
characteristics: Object.fromEntries(
|
|
1826
1788
|
a.map(([s, i]) => [
|
|
1827
1789
|
s,
|
|
1828
|
-
Array.isArray(i) ?
|
|
1790
|
+
Array.isArray(i) ? X(i[0], i[1] + 1, r) : i
|
|
1829
1791
|
])
|
|
1830
1792
|
)
|
|
1831
1793
|
};
|
|
@@ -1839,17 +1801,17 @@ class Pn extends b {
|
|
|
1839
1801
|
return Object.values(e.characteristics).reduce((r, a) => r + a, 0) + e.level;
|
|
1840
1802
|
}
|
|
1841
1803
|
}
|
|
1842
|
-
const
|
|
1804
|
+
const Ln = new u(
|
|
1843
1805
|
{
|
|
1844
1806
|
type: {
|
|
1845
1807
|
type: String,
|
|
1846
|
-
enum:
|
|
1808
|
+
enum: $t,
|
|
1847
1809
|
required: !0
|
|
1848
1810
|
},
|
|
1849
1811
|
params: { type: u.Types.Mixed }
|
|
1850
1812
|
},
|
|
1851
1813
|
{ _id: !1 }
|
|
1852
|
-
),
|
|
1814
|
+
), Qn = new u(
|
|
1853
1815
|
{
|
|
1854
1816
|
entityId: { unique: !0, required: !0, type: String },
|
|
1855
1817
|
type: { required: !0, type: String },
|
|
@@ -1871,7 +1833,7 @@ const Hn = new u(
|
|
|
1871
1833
|
image: { required: !0, type: String },
|
|
1872
1834
|
emojis: { required: !0, type: String },
|
|
1873
1835
|
category: { required: !0, type: String },
|
|
1874
|
-
effects: { type: [
|
|
1836
|
+
effects: { type: [Ln], default: [] },
|
|
1875
1837
|
rankId: String,
|
|
1876
1838
|
usage: {
|
|
1877
1839
|
_id: !1,
|
|
@@ -1932,31 +1894,31 @@ const Hn = new u(
|
|
|
1932
1894
|
panoply: String
|
|
1933
1895
|
},
|
|
1934
1896
|
{ minimize: !1 }
|
|
1935
|
-
),
|
|
1897
|
+
), de = l?.Entities || p("Entities", Qn), Wn = async (n) => await de.create({
|
|
1936
1898
|
...n
|
|
1937
|
-
}),
|
|
1938
|
-
async function
|
|
1939
|
-
const e = await
|
|
1899
|
+
}), Gn = async (n, e) => de.find(n, {}, e).lean();
|
|
1900
|
+
async function Yn(n) {
|
|
1901
|
+
const e = await de.findOne({ entityId: n }).lean();
|
|
1940
1902
|
return e || null;
|
|
1941
1903
|
}
|
|
1942
|
-
const
|
|
1904
|
+
const Xn = (n, e) => de.findOneAndUpdate(n, e, {
|
|
1943
1905
|
returnDocument: "after"
|
|
1944
1906
|
}).lean();
|
|
1945
|
-
class
|
|
1907
|
+
class Vn extends Hn {
|
|
1946
1908
|
constructor() {
|
|
1947
1909
|
super(3600);
|
|
1948
1910
|
}
|
|
1949
1911
|
createInDb(e) {
|
|
1950
|
-
return
|
|
1912
|
+
return Wn(e);
|
|
1951
1913
|
}
|
|
1952
1914
|
updateInDb(e, t) {
|
|
1953
|
-
return
|
|
1915
|
+
return Xn(e, t);
|
|
1954
1916
|
}
|
|
1955
1917
|
fetchFromDb(e) {
|
|
1956
|
-
return
|
|
1918
|
+
return Yn(e);
|
|
1957
1919
|
}
|
|
1958
|
-
fetchManyFromDb(e) {
|
|
1959
|
-
return
|
|
1920
|
+
fetchManyFromDb(e, t) {
|
|
1921
|
+
return Gn(e, t);
|
|
1960
1922
|
}
|
|
1961
1923
|
normalizeKey(e) {
|
|
1962
1924
|
return e;
|
|
@@ -1965,14 +1927,14 @@ class Xn extends Pn {
|
|
|
1965
1927
|
return e.entityId;
|
|
1966
1928
|
}
|
|
1967
1929
|
}
|
|
1968
|
-
const d = new
|
|
1930
|
+
const d = new Vn(), Jn = (n, e, t) => q.create({
|
|
1969
1931
|
user: n,
|
|
1970
1932
|
crew: e,
|
|
1971
1933
|
permission: t
|
|
1972
|
-
}),
|
|
1973
|
-
await
|
|
1934
|
+
}), Zn = async (n) => {
|
|
1935
|
+
await q.deleteOne({ user: n });
|
|
1974
1936
|
};
|
|
1975
|
-
class
|
|
1937
|
+
class er extends b {
|
|
1976
1938
|
async updatePercent(e, t) {
|
|
1977
1939
|
await this.update(e, {
|
|
1978
1940
|
$set: {
|
|
@@ -1988,10 +1950,10 @@ class Zn extends b {
|
|
|
1988
1950
|
});
|
|
1989
1951
|
}
|
|
1990
1952
|
async addUserToCrew(e, t, r) {
|
|
1991
|
-
await
|
|
1953
|
+
await Jn(e, t, r), this.invalidate(t);
|
|
1992
1954
|
}
|
|
1993
1955
|
async removeUserFromCrew(e, t) {
|
|
1994
|
-
await
|
|
1956
|
+
await Zn(e), this.invalidate(e), this.invalidate(t);
|
|
1995
1957
|
}
|
|
1996
1958
|
async getAllUserIdsFromCrew(e) {
|
|
1997
1959
|
const t = e.toString(), r = this.cache.get(t);
|
|
@@ -2001,8 +1963,8 @@ class Zn extends b {
|
|
|
2001
1963
|
return this.cache.set(t, a), a.map(({ user: s }) => s);
|
|
2002
1964
|
}
|
|
2003
1965
|
}
|
|
2004
|
-
const
|
|
2005
|
-
class
|
|
1966
|
+
const tr = (n) => q.find(n).lean(), nr = (n) => q.findOne({ user: n }).lean(), rr = (n, e) => q.findOneAndUpdate({ user: n }, e, { returnDocument: "after" }).lean();
|
|
1967
|
+
class ar extends er {
|
|
2006
1968
|
constructor() {
|
|
2007
1969
|
super(300);
|
|
2008
1970
|
}
|
|
@@ -2013,17 +1975,17 @@ class rr extends Zn {
|
|
|
2013
1975
|
return e;
|
|
2014
1976
|
}
|
|
2015
1977
|
fetchFromDb(e) {
|
|
2016
|
-
return
|
|
1978
|
+
return nr(e);
|
|
2017
1979
|
}
|
|
2018
1980
|
fetchManyFromDb(e) {
|
|
2019
|
-
return
|
|
1981
|
+
return tr(e);
|
|
2020
1982
|
}
|
|
2021
1983
|
updateInDb(e, t) {
|
|
2022
|
-
return
|
|
1984
|
+
return rr(e, t);
|
|
2023
1985
|
}
|
|
2024
1986
|
}
|
|
2025
|
-
const
|
|
2026
|
-
class
|
|
1987
|
+
const sr = new ar();
|
|
1988
|
+
class ir extends f {
|
|
2027
1989
|
hasAlreadyFoundEntity(e, t) {
|
|
2028
1990
|
return e.encyclopedia.includes(t);
|
|
2029
1991
|
}
|
|
@@ -2033,23 +1995,23 @@ class sr extends f {
|
|
|
2033
1995
|
});
|
|
2034
1996
|
}
|
|
2035
1997
|
}
|
|
2036
|
-
const
|
|
1998
|
+
const ur = async (n) => await ee.create({
|
|
2037
1999
|
user: n
|
|
2038
2000
|
});
|
|
2039
|
-
async function
|
|
2040
|
-
const e = await
|
|
2041
|
-
return e || y(await
|
|
2001
|
+
async function cr(n) {
|
|
2002
|
+
const e = await ee.findOne({ user: n }).lean();
|
|
2003
|
+
return e || y(await ur(n));
|
|
2042
2004
|
}
|
|
2043
|
-
const
|
|
2005
|
+
const or = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
|
|
2044
2006
|
upsert: !0,
|
|
2045
2007
|
returnDocument: "after"
|
|
2046
2008
|
}).lean();
|
|
2047
|
-
class
|
|
2009
|
+
class dr extends ir {
|
|
2048
2010
|
constructor() {
|
|
2049
2011
|
super(300);
|
|
2050
2012
|
}
|
|
2051
2013
|
fetchFromDb(e) {
|
|
2052
|
-
return
|
|
2014
|
+
return cr(e);
|
|
2053
2015
|
}
|
|
2054
2016
|
getKey({ user: e }) {
|
|
2055
2017
|
return e;
|
|
@@ -2058,13 +2020,13 @@ class or extends sr {
|
|
|
2058
2020
|
return e.toString();
|
|
2059
2021
|
}
|
|
2060
2022
|
updateInDb(e, t) {
|
|
2061
|
-
return
|
|
2023
|
+
return or(e, t);
|
|
2062
2024
|
}
|
|
2063
2025
|
}
|
|
2064
|
-
const
|
|
2065
|
-
class
|
|
2026
|
+
const fe = new dr();
|
|
2027
|
+
class lr extends f {
|
|
2066
2028
|
getPanoplyEffectiveBonus(e, t) {
|
|
2067
|
-
const r =
|
|
2029
|
+
const r = F(
|
|
2068
2030
|
Object.values(e.equippedItems)
|
|
2069
2031
|
), a = t.equipments.filter(
|
|
2070
2032
|
(s) => r.find((i) => i.entityId === s.entityId)
|
|
@@ -2083,13 +2045,13 @@ class dr extends f {
|
|
|
2083
2045
|
intelligence: 0,
|
|
2084
2046
|
wisdom: 0
|
|
2085
2047
|
};
|
|
2086
|
-
const r = await
|
|
2087
|
-
for (const a of
|
|
2048
|
+
const r = await U.getAllPopulated();
|
|
2049
|
+
for (const a of qe) {
|
|
2088
2050
|
const s = e.equippedItems?.[a];
|
|
2089
2051
|
if (!s)
|
|
2090
2052
|
continue;
|
|
2091
2053
|
const i = await d.fromDBToEquipableEquipment(s);
|
|
2092
|
-
t =
|
|
2054
|
+
t = j(
|
|
2093
2055
|
t,
|
|
2094
2056
|
i.characteristics,
|
|
2095
2057
|
(o, c) => o + c
|
|
@@ -2097,7 +2059,7 @@ class dr extends f {
|
|
|
2097
2059
|
}
|
|
2098
2060
|
for (const a of r) {
|
|
2099
2061
|
const s = this.getPanoplyEffectiveBonus(e, a);
|
|
2100
|
-
s && !("target" in s) && (t =
|
|
2062
|
+
s && !("target" in s) && (t = j(
|
|
2101
2063
|
t,
|
|
2102
2064
|
s,
|
|
2103
2065
|
(i, o) => i + o
|
|
@@ -2107,7 +2069,7 @@ class dr extends f {
|
|
|
2107
2069
|
}
|
|
2108
2070
|
async hasInventoryRequirements(e, t) {
|
|
2109
2071
|
const r = await this.get(e);
|
|
2110
|
-
return
|
|
2072
|
+
return C(t).reduce(
|
|
2111
2073
|
(a, [s, i]) => a && (r.itemList[s] ?? 0) >= (i ?? 0),
|
|
2112
2074
|
!0
|
|
2113
2075
|
);
|
|
@@ -2119,7 +2081,7 @@ class dr extends f {
|
|
|
2119
2081
|
return (await this.get(e)).itemList;
|
|
2120
2082
|
}
|
|
2121
2083
|
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
2122
|
-
const r = await this.get(e), s = (await
|
|
2084
|
+
const r = await this.get(e), s = (await U.getPanoplyBonus(
|
|
2123
2085
|
r.equippedItems
|
|
2124
2086
|
)).find(
|
|
2125
2087
|
([i, o]) => i.panoplyId === "herbalist" && o !== null
|
|
@@ -2133,14 +2095,14 @@ class dr extends f {
|
|
|
2133
2095
|
})) : t;
|
|
2134
2096
|
}
|
|
2135
2097
|
async calcMinStreakForWorkLoot(e) {
|
|
2136
|
-
const t = await this.get(e), r = (await
|
|
2098
|
+
const t = await this.get(e), r = (await U.getPanoplyBonus(t.equippedItems)).find(
|
|
2137
2099
|
([a, s]) => a.panoplyId === "marine" && s !== null
|
|
2138
2100
|
);
|
|
2139
2101
|
return r && r[1] === "full" ? 10 : r && r[1] === "half" ? 20 : 1 / 0;
|
|
2140
2102
|
}
|
|
2141
2103
|
async hasRevolutionaryBuff(e) {
|
|
2142
2104
|
const t = await this.get(e);
|
|
2143
|
-
return (await
|
|
2105
|
+
return (await U.getPanoplyBonus(t.equippedItems)).find(
|
|
2144
2106
|
([a, s]) => a.panoplyId === "revolutionary" && s !== null
|
|
2145
2107
|
)?.[1] ?? null;
|
|
2146
2108
|
}
|
|
@@ -2150,16 +2112,16 @@ class dr extends f {
|
|
|
2150
2112
|
async addItem(e, t, r) {
|
|
2151
2113
|
await this.update(e, {
|
|
2152
2114
|
$inc: { [`itemList.${t}`]: r }
|
|
2153
|
-
}), await
|
|
2115
|
+
}), await fe.addEntities(e, [t]);
|
|
2154
2116
|
}
|
|
2155
2117
|
async addItems(e, t) {
|
|
2156
2118
|
await this.update(e, {
|
|
2157
2119
|
$inc: Object.fromEntries(
|
|
2158
2120
|
Object.entries(t).filter(([, r]) => (r ?? 0) > 0).map(([r, a]) => [`itemList.${r}`, a])
|
|
2159
2121
|
)
|
|
2160
|
-
}), await
|
|
2122
|
+
}), await fe.addEntities(
|
|
2161
2123
|
e,
|
|
2162
|
-
|
|
2124
|
+
C(t).filter(([, r]) => r > 0).map(([r]) => r)
|
|
2163
2125
|
);
|
|
2164
2126
|
}
|
|
2165
2127
|
async removeItem(e, t, r) {
|
|
@@ -2189,7 +2151,7 @@ class dr extends f {
|
|
|
2189
2151
|
async addEquipments(e, t) {
|
|
2190
2152
|
await this.update(e, {
|
|
2191
2153
|
$push: { equipmentList: { $each: t } }
|
|
2192
|
-
}), await
|
|
2154
|
+
}), await fe.addEntities(
|
|
2193
2155
|
e,
|
|
2194
2156
|
t.map((r) => r.entityId)
|
|
2195
2157
|
);
|
|
@@ -2208,23 +2170,23 @@ class dr extends f {
|
|
|
2208
2170
|
r?.equipmentSave[t] && await this.equip(e, r.equipmentSave[t]);
|
|
2209
2171
|
}
|
|
2210
2172
|
async equip(e, t) {
|
|
2211
|
-
const r = await
|
|
2212
|
-
|
|
2173
|
+
const r = await I.getMaxHp(e), a = Object.fromEntries(
|
|
2174
|
+
C(t).map(([s, i]) => [
|
|
2213
2175
|
`equippedItems.${s}`,
|
|
2214
2176
|
i
|
|
2215
2177
|
])
|
|
2216
2178
|
);
|
|
2217
2179
|
await this.update(e, {
|
|
2218
2180
|
$set: a
|
|
2219
|
-
}), await
|
|
2181
|
+
}), await I.updateHp(e, r);
|
|
2220
2182
|
}
|
|
2221
2183
|
async unequip(e, t) {
|
|
2222
|
-
const r = await
|
|
2184
|
+
const r = await I.getMaxHp(e);
|
|
2223
2185
|
await this.update(e, {
|
|
2224
2186
|
$set: {
|
|
2225
2187
|
[`equippedItems.${t}`]: null
|
|
2226
2188
|
}
|
|
2227
|
-
}), await
|
|
2189
|
+
}), await I.updateHp(e, r);
|
|
2228
2190
|
}
|
|
2229
2191
|
async craftItem(e, t, r, a) {
|
|
2230
2192
|
for (const { entityId: o, size: c } of t.entities)
|
|
@@ -2238,30 +2200,30 @@ class dr extends f {
|
|
|
2238
2200
|
await d.isEntityId(i, d.isItem) && await this.addItem(e, i, a * o);
|
|
2239
2201
|
await this.removeItem(e, "tools", 1);
|
|
2240
2202
|
}
|
|
2241
|
-
async enchantItem(e, t, r, a) {
|
|
2242
|
-
await this.removeItem(e, t,
|
|
2203
|
+
async enchantItem(e, t, r, a, s) {
|
|
2204
|
+
await this.removeItem(e, t, s * 4), await this.removeItem(e, a, s), await this.addItem(e, r, s);
|
|
2243
2205
|
}
|
|
2244
2206
|
async unlockRecipe(e, t) {
|
|
2245
2207
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
2246
2208
|
}
|
|
2247
2209
|
}
|
|
2248
|
-
const
|
|
2210
|
+
const pr = (n) => ne.create({
|
|
2249
2211
|
user: n
|
|
2250
2212
|
});
|
|
2251
|
-
async function
|
|
2252
|
-
const e = await
|
|
2253
|
-
return e || y(await
|
|
2213
|
+
async function yr(n) {
|
|
2214
|
+
const e = await ne.findOne({ user: n }).lean();
|
|
2215
|
+
return e || y(await pr(n));
|
|
2254
2216
|
}
|
|
2255
|
-
const
|
|
2217
|
+
const fr = (n, e) => ne.findOneAndUpdate({ user: n }, e, {
|
|
2256
2218
|
upsert: !0,
|
|
2257
2219
|
returnDocument: "after"
|
|
2258
2220
|
}).lean();
|
|
2259
|
-
class
|
|
2221
|
+
class mr extends lr {
|
|
2260
2222
|
constructor() {
|
|
2261
2223
|
super(300);
|
|
2262
2224
|
}
|
|
2263
2225
|
fetchFromDb(e) {
|
|
2264
|
-
return
|
|
2226
|
+
return yr(e);
|
|
2265
2227
|
}
|
|
2266
2228
|
normalizeKey(e) {
|
|
2267
2229
|
return e.toString();
|
|
@@ -2270,19 +2232,17 @@ class fr extends dr {
|
|
|
2270
2232
|
return e;
|
|
2271
2233
|
}
|
|
2272
2234
|
updateInDb(e, t) {
|
|
2273
|
-
return
|
|
2235
|
+
return fr(e, t);
|
|
2274
2236
|
}
|
|
2275
2237
|
}
|
|
2276
|
-
const w = new
|
|
2277
|
-
class
|
|
2278
|
-
getTotalCharacteristics({
|
|
2279
|
-
characteristics: e
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
r,
|
|
2285
|
-
Et(e[r]) + t[r]
|
|
2238
|
+
const w = new mr();
|
|
2239
|
+
class hr extends b {
|
|
2240
|
+
async getTotalCharacteristics(e) {
|
|
2241
|
+
const { characteristics: t, scrolls: r } = await this.get(e);
|
|
2242
|
+
return Be(
|
|
2243
|
+
Et.map((a) => [
|
|
2244
|
+
a,
|
|
2245
|
+
Ut(t[a]) + r[a]
|
|
2286
2246
|
])
|
|
2287
2247
|
);
|
|
2288
2248
|
}
|
|
@@ -2334,7 +2294,7 @@ class mr extends b {
|
|
|
2334
2294
|
t.booster ? 0.25 : 0
|
|
2335
2295
|
);
|
|
2336
2296
|
return a + s + t.buffs.xp.global.reduce(
|
|
2337
|
-
(i, { expireAt: o, startAt: c, multiplier: S }) => c && c > /* @__PURE__ */ new Date() || o &&
|
|
2297
|
+
(i, { expireAt: o, startAt: c, multiplier: S }) => c && c > /* @__PURE__ */ new Date() || o && Q(o) ? i : i + S,
|
|
2338
2298
|
0
|
|
2339
2299
|
);
|
|
2340
2300
|
}
|
|
@@ -2356,82 +2316,49 @@ class mr extends b {
|
|
|
2356
2316
|
}
|
|
2357
2317
|
async calcBuffMultiplier(e, t, r) {
|
|
2358
2318
|
return (await this.get(e)).buffs[t][r].reduce(
|
|
2359
|
-
(i, { expireAt: o, startAt: c, multiplier: S }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !
|
|
2319
|
+
(i, { expireAt: o, startAt: c, multiplier: S }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !Q(o)) ? S : 0),
|
|
2360
2320
|
1
|
|
2361
2321
|
);
|
|
2362
2322
|
}
|
|
2363
2323
|
async getMaxHp(e) {
|
|
2364
|
-
const t = await
|
|
2365
|
-
|
|
2324
|
+
const t = await w.get(e), { vitality: r } = await this.getTotalCharacteristics(e), a = await w.getUserEquipmentsCharacteristics(
|
|
2325
|
+
t
|
|
2366
2326
|
);
|
|
2367
|
-
return (
|
|
2327
|
+
return (r + a.vitality) * Dt + Ot;
|
|
2368
2328
|
}
|
|
2369
2329
|
async getHpRatio(e) {
|
|
2370
2330
|
const t = await this.get(e), r = await this.getMaxHp(e);
|
|
2371
2331
|
return Math.min(t.hp / r, 1);
|
|
2372
2332
|
}
|
|
2373
2333
|
async hasCharacteristicRequirement(e, t) {
|
|
2374
|
-
const r = await
|
|
2375
|
-
|
|
2376
|
-
),
|
|
2377
|
-
this.getTotalCharacteristics(
|
|
2378
|
-
|
|
2379
|
-
(
|
|
2334
|
+
const r = await w.get(e), a = await w.getUserEquipmentsCharacteristics(
|
|
2335
|
+
r
|
|
2336
|
+
), s = j(
|
|
2337
|
+
await this.getTotalCharacteristics(e),
|
|
2338
|
+
a,
|
|
2339
|
+
(i, o) => i + o
|
|
2380
2340
|
);
|
|
2381
2341
|
if ("sum" in t) {
|
|
2382
|
-
let
|
|
2383
|
-
for (const
|
|
2384
|
-
|
|
2385
|
-
return
|
|
2342
|
+
let i = 0;
|
|
2343
|
+
for (const o of t.characteristics)
|
|
2344
|
+
i += s[o] ?? 0;
|
|
2345
|
+
return i >= t.sum;
|
|
2386
2346
|
} else {
|
|
2387
|
-
for (const
|
|
2347
|
+
for (const i of Object.keys(
|
|
2388
2348
|
t
|
|
2389
2349
|
))
|
|
2390
|
-
if (i
|
|
2350
|
+
if (s[i] < (t[i] ?? 0))
|
|
2391
2351
|
return !1;
|
|
2392
2352
|
return !0;
|
|
2393
2353
|
}
|
|
2394
2354
|
}
|
|
2395
|
-
async getGlobalRank(e) {
|
|
2396
|
-
return (await O.aggregate([
|
|
2397
|
-
{
|
|
2398
|
-
$setWindowFields: {
|
|
2399
|
-
sortBy: { "xp.amount": -1 },
|
|
2400
|
-
output: {
|
|
2401
|
-
rank: { $rank: {} }
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
},
|
|
2405
|
-
{ $match: { user: e } },
|
|
2406
|
-
{ $project: { rank: 1 } }
|
|
2407
|
-
]))[0];
|
|
2408
|
-
}
|
|
2409
|
-
async getBerryRank(e) {
|
|
2410
|
-
return (await O.aggregate([
|
|
2411
|
-
{
|
|
2412
|
-
$setWindowFields: {
|
|
2413
|
-
sortBy: { berry: -1 },
|
|
2414
|
-
output: {
|
|
2415
|
-
rank: { $rank: {} }
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
},
|
|
2419
|
-
{ $match: { user: e } },
|
|
2420
|
-
{ $project: { rank: 1 } }
|
|
2421
|
-
]))[0];
|
|
2422
|
-
}
|
|
2423
2355
|
async hasMalusBuff(e) {
|
|
2424
|
-
const t = await this.get(e)
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
...t.buffs.drop.work
|
|
2431
|
-
];
|
|
2432
|
-
for (const { multiplier: a, startAt: s, expireAt: i } of r)
|
|
2433
|
-
if (a < 0 && (!i || !L(i)) && (s ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2434
|
-
return !0;
|
|
2356
|
+
const t = await this.get(e);
|
|
2357
|
+
for (const r of Object.values(t.buffs))
|
|
2358
|
+
for (const a of Object.values(r))
|
|
2359
|
+
for (const { multiplier: s, startAt: i, expireAt: o } of a)
|
|
2360
|
+
if (s < 0 && (!o || !Q(o)) && (i ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2361
|
+
return !0;
|
|
2435
2362
|
return !1;
|
|
2436
2363
|
}
|
|
2437
2364
|
/*
|
|
@@ -2581,15 +2508,15 @@ class mr extends b {
|
|
|
2581
2508
|
});
|
|
2582
2509
|
}
|
|
2583
2510
|
async updatePanoplyBuff(e, t, r, a) {
|
|
2584
|
-
const s = await d.fromDBToEquipableEquipment(t), i =
|
|
2585
|
-
(
|
|
2511
|
+
const s = await d.fromDBToEquipableEquipment(t), i = F(Object.values(r)), c = (await U.getAllPopulated()).find(
|
|
2512
|
+
(O) => O.panoplyId === s.panoply
|
|
2586
2513
|
);
|
|
2587
2514
|
if (!c)
|
|
2588
2515
|
return;
|
|
2589
2516
|
const S = c.equipments.filter(
|
|
2590
|
-
(
|
|
2591
|
-
).length,
|
|
2592
|
-
c.halfBonus && "target" in c.halfBonus && await this.removeBuff(e, c.halfBonus), c.fullBonus && "target" in c.fullBonus && await this.removeBuff(e, c.fullBonus),
|
|
2517
|
+
(O) => (i.find((H) => O.entityId === H.entityId) || !a && s.entityId === O.entityId) && (a ? s.entityId !== O.entityId : !0)
|
|
2518
|
+
).length, k = S === c.equipments.length ? c.fullBonus : S >= c.equipments.length / 2 ? c.halfBonus : void 0;
|
|
2519
|
+
c.halfBonus && "target" in c.halfBonus && await this.removeBuff(e, c.halfBonus), c.fullBonus && "target" in c.fullBonus && await this.removeBuff(e, c.fullBonus), k && "target" in k && await this.updateBuff(e, k);
|
|
2593
2520
|
}
|
|
2594
2521
|
async gainHp(e, t) {
|
|
2595
2522
|
const r = await this.get(e), s = await this.getMaxHp(e) - r.hp;
|
|
@@ -2692,34 +2619,34 @@ class mr extends b {
|
|
|
2692
2619
|
});
|
|
2693
2620
|
}
|
|
2694
2621
|
async updateUserXp(e, t) {
|
|
2695
|
-
const r = await
|
|
2622
|
+
const r = await sr.get(e), a = r?.percent ?? 0, s = await this.calcXp(
|
|
2696
2623
|
e,
|
|
2697
2624
|
t,
|
|
2698
2625
|
(1 - a) * await this.getHpRatio(e)
|
|
2699
2626
|
);
|
|
2700
2627
|
let i = 0;
|
|
2701
|
-
return await this.addXp(e, s), r && (i = await
|
|
2628
|
+
return await this.addXp(e, s), r && (i = await ve.calcXp(
|
|
2702
2629
|
r.crew,
|
|
2703
2630
|
t * a
|
|
2704
|
-
), await
|
|
2631
|
+
), await ve.addXp(r.crew, i)), { userXp: s, crewXp: i };
|
|
2705
2632
|
}
|
|
2706
2633
|
async updateUserBerry(e, t, r) {
|
|
2707
2634
|
const a = await this.calcBerry(e, t, r);
|
|
2708
2635
|
return await this.addBerry(e, a), a;
|
|
2709
2636
|
}
|
|
2710
2637
|
}
|
|
2711
|
-
const
|
|
2638
|
+
const wr = (n) => T.find(n).lean(), gr = async (n) => await T.create({
|
|
2712
2639
|
user: n
|
|
2713
2640
|
});
|
|
2714
|
-
async function
|
|
2715
|
-
const e = await
|
|
2716
|
-
return e || y(await
|
|
2641
|
+
async function Sr(n) {
|
|
2642
|
+
const e = await T.findOne({ user: n }).lean();
|
|
2643
|
+
return e || y(await gr(n));
|
|
2717
2644
|
}
|
|
2718
|
-
const
|
|
2645
|
+
const br = (n, e) => T.findOneAndUpdate({ user: n }, e, {
|
|
2719
2646
|
returnDocument: "after",
|
|
2720
2647
|
upsert: !0
|
|
2721
2648
|
}).lean();
|
|
2722
|
-
class
|
|
2649
|
+
class $r extends hr {
|
|
2723
2650
|
constructor() {
|
|
2724
2651
|
super(300);
|
|
2725
2652
|
}
|
|
@@ -2730,17 +2657,17 @@ class br extends mr {
|
|
|
2730
2657
|
return e;
|
|
2731
2658
|
}
|
|
2732
2659
|
fetchFromDb(e) {
|
|
2733
|
-
return
|
|
2660
|
+
return Sr(e);
|
|
2734
2661
|
}
|
|
2735
2662
|
fetchManyFromDb(e) {
|
|
2736
|
-
return
|
|
2663
|
+
return wr(e);
|
|
2737
2664
|
}
|
|
2738
2665
|
updateInDb(e, t) {
|
|
2739
|
-
return
|
|
2666
|
+
return br(e, t);
|
|
2740
2667
|
}
|
|
2741
2668
|
}
|
|
2742
|
-
const
|
|
2743
|
-
class
|
|
2669
|
+
const I = new $r();
|
|
2670
|
+
class Er extends b {
|
|
2744
2671
|
async updateSendDailyQuest(e, t) {
|
|
2745
2672
|
await this.update(e, { $set: { sendDailyQuest: t } });
|
|
2746
2673
|
}
|
|
@@ -2759,18 +2686,18 @@ class $r extends b {
|
|
|
2759
2686
|
});
|
|
2760
2687
|
}
|
|
2761
2688
|
}
|
|
2762
|
-
const
|
|
2689
|
+
const Ur = (n) => z.find(n).lean(), Ir = async (n) => await z.create({
|
|
2763
2690
|
user: n
|
|
2764
2691
|
});
|
|
2765
|
-
async function
|
|
2766
|
-
const e = await
|
|
2692
|
+
async function Dr(n) {
|
|
2693
|
+
const e = await z.findOne({ user: n }).lean();
|
|
2767
2694
|
return e || y(await Ir(n));
|
|
2768
2695
|
}
|
|
2769
|
-
const
|
|
2696
|
+
const Or = (n, e) => z.findOneAndUpdate({ user: n }, e, {
|
|
2770
2697
|
returnDocument: "after",
|
|
2771
2698
|
upsert: !0
|
|
2772
2699
|
}).lean();
|
|
2773
|
-
class Tr extends
|
|
2700
|
+
class Tr extends Er {
|
|
2774
2701
|
constructor() {
|
|
2775
2702
|
super(3600);
|
|
2776
2703
|
}
|
|
@@ -2781,17 +2708,17 @@ class Tr extends $r {
|
|
|
2781
2708
|
return e.user;
|
|
2782
2709
|
}
|
|
2783
2710
|
fetchFromDb(e) {
|
|
2784
|
-
return
|
|
2711
|
+
return Dr(e);
|
|
2785
2712
|
}
|
|
2786
2713
|
fetchManyFromDb(e) {
|
|
2787
|
-
return
|
|
2714
|
+
return Ur(e);
|
|
2788
2715
|
}
|
|
2789
2716
|
updateInDb(e, t) {
|
|
2790
|
-
return
|
|
2717
|
+
return Or(e, t);
|
|
2791
2718
|
}
|
|
2792
2719
|
}
|
|
2793
|
-
const
|
|
2794
|
-
class
|
|
2720
|
+
const Ae = new Tr();
|
|
2721
|
+
class Rr extends f {
|
|
2795
2722
|
async getCommandCooldown(e, t) {
|
|
2796
2723
|
return (await this.get(e)).commands[t];
|
|
2797
2724
|
}
|
|
@@ -2816,21 +2743,21 @@ class Or extends f {
|
|
|
2816
2743
|
}
|
|
2817
2744
|
}
|
|
2818
2745
|
}
|
|
2819
|
-
]), await
|
|
2746
|
+
]), await L.updateReminderDate(
|
|
2820
2747
|
e,
|
|
2821
2748
|
"raid/special",
|
|
2822
2749
|
-1 * t * 3600 * 1e3
|
|
2823
|
-
), await
|
|
2750
|
+
), await L.updateReminderDate(
|
|
2824
2751
|
e,
|
|
2825
2752
|
"raid/classic",
|
|
2826
2753
|
-1 * t * 3600 * 1e3
|
|
2827
2754
|
);
|
|
2828
2755
|
}
|
|
2829
2756
|
async startRaidCooldown(e, t, r) {
|
|
2830
|
-
const { reminder: a } = await
|
|
2757
|
+
const { reminder: a } = await Ae.get(e);
|
|
2831
2758
|
await this.update(e, {
|
|
2832
2759
|
$set: { [`raid.${t}`]: new Date(Date.now() + r) }
|
|
2833
|
-
}), a.raid[t] && await
|
|
2760
|
+
}), a.raid[t] && await L.addReminder(
|
|
2834
2761
|
e,
|
|
2835
2762
|
`raid/${t}`,
|
|
2836
2763
|
new Date(Date.now() + r)
|
|
@@ -2841,33 +2768,33 @@ class Or extends f {
|
|
|
2841
2768
|
$set: {
|
|
2842
2769
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
2843
2770
|
}
|
|
2844
|
-
}), await
|
|
2771
|
+
}), await I.gainHp(e, 1);
|
|
2845
2772
|
}
|
|
2846
2773
|
async useCommand(e, t, r) {
|
|
2847
|
-
const { reminder: a } = await
|
|
2774
|
+
const { reminder: a } = await Ae.get(e);
|
|
2848
2775
|
await this.update(e, {
|
|
2849
2776
|
$set: {
|
|
2850
2777
|
[`commands.${t}`]: new Date(Date.now() + r)
|
|
2851
2778
|
}
|
|
2852
|
-
}), a.commands[t] && await
|
|
2779
|
+
}), a.commands[t] && await L.addReminder(
|
|
2853
2780
|
e,
|
|
2854
2781
|
`commands/${t}`,
|
|
2855
2782
|
new Date(Date.now() + r)
|
|
2856
2783
|
);
|
|
2857
2784
|
}
|
|
2858
2785
|
}
|
|
2859
|
-
const Cr = async (n) => await
|
|
2786
|
+
const Cr = async (n) => await J.create({
|
|
2860
2787
|
user: n
|
|
2861
2788
|
});
|
|
2862
|
-
async function
|
|
2863
|
-
const e = await
|
|
2789
|
+
async function vr(n) {
|
|
2790
|
+
const e = await J.findOne({ user: n }).lean();
|
|
2864
2791
|
return e || y(await Cr(n));
|
|
2865
2792
|
}
|
|
2866
|
-
const
|
|
2793
|
+
const Ar = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
2867
2794
|
returnDocument: "after",
|
|
2868
2795
|
upsert: !0
|
|
2869
2796
|
}).lean();
|
|
2870
|
-
class Mr extends
|
|
2797
|
+
class Mr extends Rr {
|
|
2871
2798
|
constructor() {
|
|
2872
2799
|
super(300);
|
|
2873
2800
|
}
|
|
@@ -2878,14 +2805,14 @@ class Mr extends Or {
|
|
|
2878
2805
|
return e.user;
|
|
2879
2806
|
}
|
|
2880
2807
|
fetchFromDb(e) {
|
|
2881
|
-
return
|
|
2808
|
+
return vr(e);
|
|
2882
2809
|
}
|
|
2883
2810
|
updateInDb(e, t) {
|
|
2884
|
-
return
|
|
2811
|
+
return Ar(e, t);
|
|
2885
2812
|
}
|
|
2886
2813
|
}
|
|
2887
|
-
const
|
|
2888
|
-
class
|
|
2814
|
+
const Br = new Mr();
|
|
2815
|
+
class xr extends f {
|
|
2889
2816
|
async unlockTitle(e, t) {
|
|
2890
2817
|
await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2891
2818
|
}
|
|
@@ -2954,18 +2881,18 @@ class Br extends f {
|
|
|
2954
2881
|
});
|
|
2955
2882
|
}
|
|
2956
2883
|
}
|
|
2957
|
-
const
|
|
2884
|
+
const qr = async (n) => await re.create({
|
|
2958
2885
|
user: n
|
|
2959
2886
|
});
|
|
2960
|
-
async function
|
|
2961
|
-
const e = await
|
|
2962
|
-
return e || y(await
|
|
2887
|
+
async function kr(n) {
|
|
2888
|
+
const e = await re.findOne({ user: n }).lean();
|
|
2889
|
+
return e || y(await qr(n));
|
|
2963
2890
|
}
|
|
2964
|
-
const
|
|
2891
|
+
const _r = async (n, e) => re.findOneAndUpdate({ user: n }, e, {
|
|
2965
2892
|
upsert: !0,
|
|
2966
2893
|
returnDocument: "after"
|
|
2967
2894
|
}).lean();
|
|
2968
|
-
class
|
|
2895
|
+
class Nr extends xr {
|
|
2969
2896
|
constructor() {
|
|
2970
2897
|
super(300);
|
|
2971
2898
|
}
|
|
@@ -2976,14 +2903,14 @@ class kr extends Br {
|
|
|
2976
2903
|
return e;
|
|
2977
2904
|
}
|
|
2978
2905
|
fetchFromDb(e) {
|
|
2979
|
-
return
|
|
2906
|
+
return kr(e);
|
|
2980
2907
|
}
|
|
2981
2908
|
updateInDb(e, t) {
|
|
2982
|
-
return
|
|
2909
|
+
return _r(e, t);
|
|
2983
2910
|
}
|
|
2984
2911
|
}
|
|
2985
|
-
const
|
|
2986
|
-
class
|
|
2912
|
+
const Y = new Nr();
|
|
2913
|
+
class Fr extends b {
|
|
2987
2914
|
async getStatus(e, t) {
|
|
2988
2915
|
return (await this.get({ user: e, questId: t })).status;
|
|
2989
2916
|
}
|
|
@@ -2992,14 +2919,17 @@ class Nr extends b {
|
|
|
2992
2919
|
}
|
|
2993
2920
|
async isStreaking(e, t) {
|
|
2994
2921
|
const { lastCompletionDate: r } = await this.get({ user: e, questId: t });
|
|
2995
|
-
return !!r &&
|
|
2922
|
+
return !!r && me(N(), r);
|
|
2996
2923
|
}
|
|
2997
2924
|
async getStreakMultiplier(e, t) {
|
|
2998
2925
|
const r = await this.get({ user: e, questId: t });
|
|
2999
2926
|
return await this.isStreaking(e, t) ? 1 + Math.min(2, (r.streak ?? 0) / 10) : 1;
|
|
3000
2927
|
}
|
|
2928
|
+
async getCompletedCount(e) {
|
|
2929
|
+
return (await this.getMany({ user: e, status: D.COMPLETED })).length;
|
|
2930
|
+
}
|
|
3001
2931
|
async completeQuest(e, t = !1) {
|
|
3002
|
-
const r =
|
|
2932
|
+
const r = N();
|
|
3003
2933
|
r.setHours(0, 0, 0, 0);
|
|
3004
2934
|
const a = /* @__PURE__ */ new Date();
|
|
3005
2935
|
return a.setHours(0, 0, 0, 0), this.update(
|
|
@@ -3022,7 +2952,7 @@ class Nr extends b {
|
|
|
3022
2952
|
}
|
|
3023
2953
|
} : {},
|
|
3024
2954
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
3025
|
-
status:
|
|
2955
|
+
status: D.COMPLETED
|
|
3026
2956
|
}
|
|
3027
2957
|
}
|
|
3028
2958
|
],
|
|
@@ -3030,24 +2960,24 @@ class Nr extends b {
|
|
|
3030
2960
|
);
|
|
3031
2961
|
}
|
|
3032
2962
|
}
|
|
3033
|
-
function
|
|
3034
|
-
return
|
|
2963
|
+
function jr(n) {
|
|
2964
|
+
return x.find(n).lean();
|
|
3035
2965
|
}
|
|
3036
|
-
const
|
|
2966
|
+
const zr = async (n) => await x.create({
|
|
3037
2967
|
...n
|
|
3038
2968
|
});
|
|
3039
|
-
async function
|
|
3040
|
-
const e = await
|
|
3041
|
-
return e || y(await
|
|
2969
|
+
async function Kr(n) {
|
|
2970
|
+
const e = await x.findOne(n).lean();
|
|
2971
|
+
return e || y(await zr(n));
|
|
3042
2972
|
}
|
|
3043
|
-
function
|
|
3044
|
-
return
|
|
2973
|
+
function Pr(n, e, t) {
|
|
2974
|
+
return x.findOneAndUpdate(n, e, {
|
|
3045
2975
|
upsert: !0,
|
|
3046
2976
|
...t,
|
|
3047
2977
|
returnDocument: "after"
|
|
3048
2978
|
}).lean();
|
|
3049
2979
|
}
|
|
3050
|
-
class
|
|
2980
|
+
class Hr extends Fr {
|
|
3051
2981
|
constructor() {
|
|
3052
2982
|
super(3600);
|
|
3053
2983
|
}
|
|
@@ -3061,21 +2991,21 @@ class Pr extends Nr {
|
|
|
3061
2991
|
return { user: e, questId: t };
|
|
3062
2992
|
}
|
|
3063
2993
|
fetchFromDb(e) {
|
|
3064
|
-
return
|
|
2994
|
+
return Kr(e);
|
|
3065
2995
|
}
|
|
3066
2996
|
fetchManyFromDb(e) {
|
|
3067
|
-
return
|
|
2997
|
+
return jr(e);
|
|
3068
2998
|
}
|
|
3069
2999
|
updateInDb(e, t, r) {
|
|
3070
|
-
return
|
|
3000
|
+
return Pr(e, t, r);
|
|
3071
3001
|
}
|
|
3072
3002
|
}
|
|
3073
|
-
const Me = new
|
|
3074
|
-
class
|
|
3003
|
+
const Me = new Hr();
|
|
3004
|
+
class Lr extends f {
|
|
3075
3005
|
async updateDailyReport(e) {
|
|
3076
|
-
const t = await
|
|
3006
|
+
const t = await I.get(e), r = await Y.get(e), a = await Me.getMany({
|
|
3077
3007
|
user: e,
|
|
3078
|
-
status:
|
|
3008
|
+
status: D.COMPLETED
|
|
3079
3009
|
});
|
|
3080
3010
|
await this.update(e, {
|
|
3081
3011
|
$set: {
|
|
@@ -3101,30 +3031,30 @@ class Hr extends f {
|
|
|
3101
3031
|
} = t;
|
|
3102
3032
|
if (s <= 0)
|
|
3103
3033
|
return;
|
|
3104
|
-
const o = await
|
|
3034
|
+
const o = await I.get(e), c = await Me.getMany({
|
|
3105
3035
|
user: e,
|
|
3106
|
-
status:
|
|
3107
|
-
}), S = await
|
|
3036
|
+
status: D.COMPLETED
|
|
3037
|
+
}), S = await Y.get(e), { berry: k, xp: O } = o, { voice: H, amount: at } = O, { unlockedBadges: st, unlockedBackgrounds: it, unlockedTitles: ut } = S;
|
|
3108
3038
|
return {
|
|
3109
|
-
berry:
|
|
3110
|
-
xp:
|
|
3039
|
+
berry: k - i,
|
|
3040
|
+
xp: at - s,
|
|
3111
3041
|
// TODO
|
|
3112
3042
|
// message: user.questMeta.messageSent - previousMessageSent,
|
|
3113
|
-
voice:
|
|
3114
|
-
quest:
|
|
3115
|
-
c.map(({ questId:
|
|
3043
|
+
voice: me(H.lastConnection, N()) ? H.minutesInVoiceToday : 0,
|
|
3044
|
+
quest: _(
|
|
3045
|
+
c.map(({ questId: ct }) => ct),
|
|
3116
3046
|
a
|
|
3117
3047
|
),
|
|
3118
|
-
badge:
|
|
3119
|
-
title:
|
|
3120
|
-
background:
|
|
3121
|
-
|
|
3048
|
+
badge: _(st, r.unlockedBadges),
|
|
3049
|
+
title: _(ut, r.unlockedTitles),
|
|
3050
|
+
background: _(
|
|
3051
|
+
it,
|
|
3122
3052
|
r.unlockedBackgrounds
|
|
3123
3053
|
)
|
|
3124
3054
|
};
|
|
3125
3055
|
}
|
|
3126
3056
|
async getAllDailyReportsToSend() {
|
|
3127
|
-
const e = await
|
|
3057
|
+
const e = await $n.getMany({
|
|
3128
3058
|
"settings.sendDailyReport": !0,
|
|
3129
3059
|
faction: { $ne: "citizen" }
|
|
3130
3060
|
});
|
|
@@ -3137,18 +3067,18 @@ class Hr extends f {
|
|
|
3137
3067
|
);
|
|
3138
3068
|
}
|
|
3139
3069
|
}
|
|
3140
|
-
const
|
|
3070
|
+
const Qr = (n) => Z.create({
|
|
3141
3071
|
user: n
|
|
3142
3072
|
});
|
|
3143
|
-
async function
|
|
3144
|
-
const e = await
|
|
3145
|
-
return e || y(await
|
|
3073
|
+
async function Wr(n) {
|
|
3074
|
+
const e = await Z.findOne({ user: n }).lean();
|
|
3075
|
+
return e || y(await Qr(n));
|
|
3146
3076
|
}
|
|
3147
|
-
const
|
|
3077
|
+
const Gr = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
|
|
3148
3078
|
upsert: !0,
|
|
3149
3079
|
returnDocument: "after"
|
|
3150
3080
|
}).lean();
|
|
3151
|
-
class
|
|
3081
|
+
class Yr extends Lr {
|
|
3152
3082
|
constructor() {
|
|
3153
3083
|
super(60);
|
|
3154
3084
|
}
|
|
@@ -3159,14 +3089,14 @@ class Gr extends Hr {
|
|
|
3159
3089
|
return e.user;
|
|
3160
3090
|
}
|
|
3161
3091
|
fetchFromDb(e) {
|
|
3162
|
-
return
|
|
3092
|
+
return Wr(e);
|
|
3163
3093
|
}
|
|
3164
3094
|
updateInDb(e, t) {
|
|
3165
|
-
return
|
|
3095
|
+
return Gr(e, t);
|
|
3166
3096
|
}
|
|
3167
3097
|
}
|
|
3168
|
-
const
|
|
3169
|
-
class
|
|
3098
|
+
const si = new Yr();
|
|
3099
|
+
class Xr extends f {
|
|
3170
3100
|
async setGuessGame(e, t, r, a) {
|
|
3171
3101
|
await this.update(e, {
|
|
3172
3102
|
$set: {
|
|
@@ -3197,18 +3127,18 @@ class Yr extends f {
|
|
|
3197
3127
|
});
|
|
3198
3128
|
}
|
|
3199
3129
|
}
|
|
3200
|
-
const
|
|
3130
|
+
const Vr = async (n) => await te.create({
|
|
3201
3131
|
user: n
|
|
3202
3132
|
});
|
|
3203
|
-
async function
|
|
3204
|
-
const e = await
|
|
3205
|
-
return e || y(await
|
|
3133
|
+
async function Jr(n) {
|
|
3134
|
+
const e = await te.findOne({ user: n }).lean();
|
|
3135
|
+
return e || y(await Vr(n));
|
|
3206
3136
|
}
|
|
3207
|
-
const
|
|
3137
|
+
const Zr = (n, e) => te.findOneAndUpdate({ user: n }, e, {
|
|
3208
3138
|
upsert: !0,
|
|
3209
3139
|
returnDocument: "after"
|
|
3210
3140
|
}).lean();
|
|
3211
|
-
class
|
|
3141
|
+
class ea extends Xr {
|
|
3212
3142
|
constructor() {
|
|
3213
3143
|
super(300);
|
|
3214
3144
|
}
|
|
@@ -3219,14 +3149,14 @@ class Zr extends Yr {
|
|
|
3219
3149
|
return e;
|
|
3220
3150
|
}
|
|
3221
3151
|
fetchFromDb(e) {
|
|
3222
|
-
return
|
|
3152
|
+
return Jr(e);
|
|
3223
3153
|
}
|
|
3224
3154
|
updateInDb(e, t) {
|
|
3225
|
-
return
|
|
3155
|
+
return Zr(e, t);
|
|
3226
3156
|
}
|
|
3227
3157
|
}
|
|
3228
|
-
const
|
|
3229
|
-
class
|
|
3158
|
+
const ii = new ea();
|
|
3159
|
+
class ta extends f {
|
|
3230
3160
|
async hasUnlockedRaid(e, t) {
|
|
3231
3161
|
return (await this.get(e)).unlocked?.[t];
|
|
3232
3162
|
}
|
|
@@ -3260,7 +3190,7 @@ class ea extends f {
|
|
|
3260
3190
|
rewards: {}
|
|
3261
3191
|
}
|
|
3262
3192
|
}
|
|
3263
|
-
}), await
|
|
3193
|
+
}), await Br.startRaidCooldown(e, a, s), i;
|
|
3264
3194
|
}
|
|
3265
3195
|
async resetRaid(e) {
|
|
3266
3196
|
await this.update(e, {
|
|
@@ -3293,7 +3223,7 @@ class ea extends f {
|
|
|
3293
3223
|
async addRewardsToRaid(e, t) {
|
|
3294
3224
|
await this.update(e, {
|
|
3295
3225
|
$inc: Object.fromEntries(
|
|
3296
|
-
|
|
3226
|
+
C(t).filter(([r]) => r !== "title" && r !== "condition").map(([r, a]) => [`currentRaid.rewards.${r}`, a])
|
|
3297
3227
|
),
|
|
3298
3228
|
...t.title ? { $set: { "currentRaid.rewards.title": t.title } } : {}
|
|
3299
3229
|
});
|
|
@@ -3306,16 +3236,16 @@ class ea extends f {
|
|
|
3306
3236
|
});
|
|
3307
3237
|
}
|
|
3308
3238
|
}
|
|
3309
|
-
const
|
|
3239
|
+
const na = (n) => ae.create({
|
|
3310
3240
|
user: n
|
|
3311
|
-
}),
|
|
3312
|
-
const e = await
|
|
3313
|
-
return e || y(await
|
|
3314
|
-
},
|
|
3241
|
+
}), ra = async (n) => {
|
|
3242
|
+
const e = await ae.findOne({ user: n }).lean();
|
|
3243
|
+
return e || y(await na(n));
|
|
3244
|
+
}, aa = (n, e) => ae.findOneAndUpdate({ user: n }, e, {
|
|
3315
3245
|
upsert: !0,
|
|
3316
3246
|
returnDocument: "after"
|
|
3317
3247
|
});
|
|
3318
|
-
class
|
|
3248
|
+
class sa extends ta {
|
|
3319
3249
|
constructor() {
|
|
3320
3250
|
super(3600);
|
|
3321
3251
|
}
|
|
@@ -3326,14 +3256,126 @@ class aa extends ea {
|
|
|
3326
3256
|
return e;
|
|
3327
3257
|
}
|
|
3328
3258
|
fetchFromDb(e) {
|
|
3329
|
-
return
|
|
3259
|
+
return ra(e);
|
|
3330
3260
|
}
|
|
3331
3261
|
updateInDb(e, t) {
|
|
3332
|
-
return
|
|
3262
|
+
return aa(e, t);
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
const ui = new sa(), ia = new u({
|
|
3266
|
+
user: {
|
|
3267
|
+
type: u.Types.ObjectId,
|
|
3268
|
+
required: !0,
|
|
3269
|
+
unique: !0,
|
|
3270
|
+
ref: "User"
|
|
3271
|
+
},
|
|
3272
|
+
xp: { type: Number, default: 0 },
|
|
3273
|
+
berry: { type: Number, default: 0 },
|
|
3274
|
+
faction: { type: Number, default: 0 }
|
|
3275
|
+
}), v = l?.UserRank || p("UserRank", ia);
|
|
3276
|
+
class ua extends f {
|
|
3277
|
+
async computeAllXpRanks() {
|
|
3278
|
+
const t = (await T.aggregate([
|
|
3279
|
+
{
|
|
3280
|
+
$setWindowFields: {
|
|
3281
|
+
sortBy: { "xp.amount": -1 },
|
|
3282
|
+
output: { xpRank: { $rank: {} } }
|
|
3283
|
+
}
|
|
3284
|
+
},
|
|
3285
|
+
{ $project: { user: 1, xpRank: 1 } }
|
|
3286
|
+
])).map(({ user: r, xpRank: a }) => ({
|
|
3287
|
+
updateOne: {
|
|
3288
|
+
filter: { user: r },
|
|
3289
|
+
update: { $set: { xp: a } },
|
|
3290
|
+
upsert: !0
|
|
3291
|
+
}
|
|
3292
|
+
}));
|
|
3293
|
+
t.length > 0 && await v.bulkWrite(t), this.clearAll();
|
|
3294
|
+
}
|
|
3295
|
+
async computeAllBerryRanks() {
|
|
3296
|
+
const t = (await T.aggregate([
|
|
3297
|
+
{
|
|
3298
|
+
$setWindowFields: {
|
|
3299
|
+
sortBy: { berry: -1 },
|
|
3300
|
+
output: { berryRank: { $rank: {} } }
|
|
3301
|
+
}
|
|
3302
|
+
},
|
|
3303
|
+
{ $project: { user: 1, berryRank: 1 } }
|
|
3304
|
+
])).map(({ user: r, berryRank: a }) => ({
|
|
3305
|
+
updateOne: {
|
|
3306
|
+
filter: { user: r },
|
|
3307
|
+
update: { $set: { berry: a } },
|
|
3308
|
+
upsert: !0
|
|
3309
|
+
}
|
|
3310
|
+
}));
|
|
3311
|
+
t.length > 0 && await v.bulkWrite(t), this.clearAll();
|
|
3312
|
+
}
|
|
3313
|
+
async computeAllFactionRanks() {
|
|
3314
|
+
const t = (await $.aggregate([
|
|
3315
|
+
{
|
|
3316
|
+
$lookup: {
|
|
3317
|
+
from: "usermetas",
|
|
3318
|
+
localField: "_id",
|
|
3319
|
+
foreignField: "user",
|
|
3320
|
+
as: "meta"
|
|
3321
|
+
}
|
|
3322
|
+
},
|
|
3323
|
+
{ $unwind: "$meta" },
|
|
3324
|
+
{
|
|
3325
|
+
$setWindowFields: {
|
|
3326
|
+
partitionBy: "$faction",
|
|
3327
|
+
sortBy: { "meta.xp.amount": -1 },
|
|
3328
|
+
output: { factionRank: { $rank: {} } }
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
{ $project: { factionRank: 1 } }
|
|
3332
|
+
])).map(({ _id: r, factionRank: a }) => ({
|
|
3333
|
+
updateOne: {
|
|
3334
|
+
filter: { user: r },
|
|
3335
|
+
update: { $set: { faction: a } },
|
|
3336
|
+
upsert: !0
|
|
3337
|
+
}
|
|
3338
|
+
}));
|
|
3339
|
+
t.length > 0 && await v.bulkWrite(t), this.clearAll();
|
|
3340
|
+
}
|
|
3341
|
+
async computeAllRanks() {
|
|
3342
|
+
await Promise.all([
|
|
3343
|
+
this.computeAllXpRanks(),
|
|
3344
|
+
this.computeAllBerryRanks(),
|
|
3345
|
+
this.computeAllFactionRanks()
|
|
3346
|
+
]);
|
|
3333
3347
|
}
|
|
3334
3348
|
}
|
|
3335
|
-
const
|
|
3336
|
-
|
|
3349
|
+
const ca = async (n) => await v.create({
|
|
3350
|
+
user: n
|
|
3351
|
+
});
|
|
3352
|
+
async function oa(n) {
|
|
3353
|
+
const e = await v.findOne({ user: n }).lean();
|
|
3354
|
+
return e || y(await ca(n));
|
|
3355
|
+
}
|
|
3356
|
+
const da = (n, e) => v.findOneAndUpdate({ user: n }, e, {
|
|
3357
|
+
returnDocument: "after",
|
|
3358
|
+
upsert: !0
|
|
3359
|
+
}).lean();
|
|
3360
|
+
class la extends ua {
|
|
3361
|
+
constructor() {
|
|
3362
|
+
super(300);
|
|
3363
|
+
}
|
|
3364
|
+
normalizeKey(e) {
|
|
3365
|
+
return e.toString();
|
|
3366
|
+
}
|
|
3367
|
+
getKey(e) {
|
|
3368
|
+
return e.user;
|
|
3369
|
+
}
|
|
3370
|
+
fetchFromDb(e) {
|
|
3371
|
+
return oa(e);
|
|
3372
|
+
}
|
|
3373
|
+
updateInDb(e, t) {
|
|
3374
|
+
return da(e, t);
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
const ci = new la();
|
|
3378
|
+
class pa extends f {
|
|
3337
3379
|
async isBuyLimitReached(e, t, r) {
|
|
3338
3380
|
const a = await d.getAllEntitiesLimit();
|
|
3339
3381
|
if (await d.isEntityId(t, d.isEquipment))
|
|
@@ -3343,7 +3385,7 @@ class sa extends f {
|
|
|
3343
3385
|
const c = await w.hasRevolutionaryBuff(e);
|
|
3344
3386
|
return s.lastShopId !== r ? !1 : (c === "half" && t === "chest_2" && (o += 2), c === "full" && t === "chest_3" && (o += 1), !!(o && i && i >= o));
|
|
3345
3387
|
}
|
|
3346
|
-
async getShopItemRest(e, t, r, a =
|
|
3388
|
+
async getShopItemRest(e, t, r, a = Rt) {
|
|
3347
3389
|
const s = await d.getAllEntitiesLimit();
|
|
3348
3390
|
if (await d.isEntityId(t, d.isEquipment))
|
|
3349
3391
|
return a;
|
|
@@ -3378,16 +3420,16 @@ class sa extends f {
|
|
|
3378
3420
|
]);
|
|
3379
3421
|
}
|
|
3380
3422
|
}
|
|
3381
|
-
const
|
|
3423
|
+
const ya = async (n) => await se.create({
|
|
3382
3424
|
user: n
|
|
3383
|
-
}),
|
|
3384
|
-
const e = await
|
|
3385
|
-
return e || y(await
|
|
3386
|
-
},
|
|
3425
|
+
}), fa = async (n) => {
|
|
3426
|
+
const e = await se.findOne({ user: n }).lean();
|
|
3427
|
+
return e || y(await ya(n));
|
|
3428
|
+
}, ma = (n, e) => se.findOneAndUpdate({ user: n }, e, {
|
|
3387
3429
|
upsert: !0,
|
|
3388
3430
|
returnDocument: "after"
|
|
3389
3431
|
}).lean();
|
|
3390
|
-
class
|
|
3432
|
+
class ha extends pa {
|
|
3391
3433
|
constructor() {
|
|
3392
3434
|
super(300);
|
|
3393
3435
|
}
|
|
@@ -3398,14 +3440,14 @@ class oa extends sa {
|
|
|
3398
3440
|
return e;
|
|
3399
3441
|
}
|
|
3400
3442
|
fetchFromDb(e) {
|
|
3401
|
-
return
|
|
3443
|
+
return fa(e);
|
|
3402
3444
|
}
|
|
3403
3445
|
updateInDb(e, t) {
|
|
3404
|
-
return
|
|
3446
|
+
return ma(e, t);
|
|
3405
3447
|
}
|
|
3406
3448
|
}
|
|
3407
|
-
const
|
|
3408
|
-
class
|
|
3449
|
+
const oi = new ha();
|
|
3450
|
+
class wa extends f {
|
|
3409
3451
|
async didSevenDoubleAtDoQ(e) {
|
|
3410
3452
|
await this.update(e, {
|
|
3411
3453
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -3429,10 +3471,10 @@ class da extends f {
|
|
|
3429
3471
|
await this.update(e, { $inc: { drawCount: 1 } });
|
|
3430
3472
|
}
|
|
3431
3473
|
async bet666(e) {
|
|
3432
|
-
const t =
|
|
3474
|
+
const t = N();
|
|
3433
3475
|
t.setHours(0, 0, 0, 0);
|
|
3434
3476
|
const r = /* @__PURE__ */ new Date();
|
|
3435
|
-
r.setHours(0, 0, 0, 0), await
|
|
3477
|
+
r.setHours(0, 0, 0, 0), await A.updateOne(
|
|
3436
3478
|
{
|
|
3437
3479
|
user: e,
|
|
3438
3480
|
"bet666.last": {
|
|
@@ -3441,7 +3483,7 @@ class da extends f {
|
|
|
3441
3483
|
}
|
|
3442
3484
|
},
|
|
3443
3485
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
3444
|
-
), await
|
|
3486
|
+
), await A.updateOne(
|
|
3445
3487
|
{
|
|
3446
3488
|
user: e,
|
|
3447
3489
|
"bet666.last": {
|
|
@@ -3484,18 +3526,18 @@ class da extends f {
|
|
|
3484
3526
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
3485
3527
|
}
|
|
3486
3528
|
}
|
|
3487
|
-
const
|
|
3529
|
+
const ga = async (n) => await A.create({
|
|
3488
3530
|
user: n
|
|
3489
3531
|
});
|
|
3490
|
-
async function
|
|
3491
|
-
const e = await
|
|
3492
|
-
return e || y(await
|
|
3532
|
+
async function Sa(n) {
|
|
3533
|
+
const e = await A.findOne({ user: n }).lean();
|
|
3534
|
+
return e || y(await ga(n));
|
|
3493
3535
|
}
|
|
3494
|
-
const
|
|
3536
|
+
const ba = (n, e) => A.findOneAndUpdate({ user: n }, e, {
|
|
3495
3537
|
upsert: !0,
|
|
3496
3538
|
returnDocument: "after"
|
|
3497
3539
|
}).lean();
|
|
3498
|
-
class
|
|
3540
|
+
class $a extends wa {
|
|
3499
3541
|
constructor() {
|
|
3500
3542
|
super(300);
|
|
3501
3543
|
}
|
|
@@ -3506,14 +3548,14 @@ class fa extends da {
|
|
|
3506
3548
|
return e;
|
|
3507
3549
|
}
|
|
3508
3550
|
fetchFromDb(e) {
|
|
3509
|
-
return
|
|
3551
|
+
return Sa(e);
|
|
3510
3552
|
}
|
|
3511
3553
|
updateInDb(e, t) {
|
|
3512
|
-
return
|
|
3554
|
+
return ba(e, t);
|
|
3513
3555
|
}
|
|
3514
3556
|
}
|
|
3515
|
-
const
|
|
3516
|
-
class
|
|
3557
|
+
const di = new $a();
|
|
3558
|
+
class Ea extends f {
|
|
3517
3559
|
async increaseXpGiven(e, t) {
|
|
3518
3560
|
await this.update(e, {
|
|
3519
3561
|
$inc: {
|
|
@@ -3535,18 +3577,18 @@ class ma extends f {
|
|
|
3535
3577
|
t ? await this.update(e, { $set: { timeCrewAbove90PercentXp: 0 } }) : await this.update(e, { $inc: { timeCrewAbove90PercentXp: 1 } });
|
|
3536
3578
|
}
|
|
3537
3579
|
}
|
|
3538
|
-
const
|
|
3580
|
+
const Ua = async (n) => await ie.create({
|
|
3539
3581
|
user: n
|
|
3540
3582
|
});
|
|
3541
|
-
async function
|
|
3542
|
-
const e = await
|
|
3543
|
-
return e || y(await
|
|
3583
|
+
async function Ia(n) {
|
|
3584
|
+
const e = await ie.findOne({ user: n }).lean();
|
|
3585
|
+
return e || y(await Ua(n));
|
|
3544
3586
|
}
|
|
3545
|
-
const
|
|
3587
|
+
const Da = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
|
|
3546
3588
|
upsert: !0,
|
|
3547
3589
|
returnDocument: "after"
|
|
3548
3590
|
}).lean();
|
|
3549
|
-
class
|
|
3591
|
+
class Oa extends Ea {
|
|
3550
3592
|
constructor() {
|
|
3551
3593
|
super(300);
|
|
3552
3594
|
}
|
|
@@ -3557,14 +3599,14 @@ class Sa extends ma {
|
|
|
3557
3599
|
return e;
|
|
3558
3600
|
}
|
|
3559
3601
|
fetchFromDb(e) {
|
|
3560
|
-
return
|
|
3602
|
+
return Ia(e);
|
|
3561
3603
|
}
|
|
3562
3604
|
updateInDb(e, t) {
|
|
3563
|
-
return
|
|
3605
|
+
return Da(e, t);
|
|
3564
3606
|
}
|
|
3565
3607
|
}
|
|
3566
|
-
const
|
|
3567
|
-
class
|
|
3608
|
+
const li = new Oa();
|
|
3609
|
+
class Ta extends f {
|
|
3568
3610
|
async workIncrement(e) {
|
|
3569
3611
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
3570
3612
|
}
|
|
@@ -3576,18 +3618,18 @@ class ba extends f {
|
|
|
3576
3618
|
});
|
|
3577
3619
|
}
|
|
3578
3620
|
}
|
|
3579
|
-
const
|
|
3621
|
+
const Ra = (n) => ue.create({
|
|
3580
3622
|
user: n
|
|
3581
3623
|
});
|
|
3582
|
-
async function
|
|
3583
|
-
const e = await
|
|
3584
|
-
return e || y(await
|
|
3624
|
+
async function Ca(n) {
|
|
3625
|
+
const e = await ue.findOne({ user: n }).lean();
|
|
3626
|
+
return e || y(await Ra(n));
|
|
3585
3627
|
}
|
|
3586
|
-
const
|
|
3628
|
+
const va = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
|
|
3587
3629
|
upsert: !0,
|
|
3588
3630
|
returnDocument: "after"
|
|
3589
3631
|
}).lean();
|
|
3590
|
-
class
|
|
3632
|
+
class Aa extends Ta {
|
|
3591
3633
|
constructor() {
|
|
3592
3634
|
super(300);
|
|
3593
3635
|
}
|
|
@@ -3598,14 +3640,14 @@ class Ua extends ba {
|
|
|
3598
3640
|
return e;
|
|
3599
3641
|
}
|
|
3600
3642
|
fetchFromDb(e) {
|
|
3601
|
-
return
|
|
3643
|
+
return Ca(e);
|
|
3602
3644
|
}
|
|
3603
3645
|
updateInDb(e, t) {
|
|
3604
|
-
return
|
|
3646
|
+
return va(e, t);
|
|
3605
3647
|
}
|
|
3606
3648
|
}
|
|
3607
|
-
const
|
|
3608
|
-
class
|
|
3649
|
+
const Ma = new Aa();
|
|
3650
|
+
class Ba extends f {
|
|
3609
3651
|
async randomMessageIncrement(e) {
|
|
3610
3652
|
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
3611
3653
|
}
|
|
@@ -3623,18 +3665,18 @@ class Ta extends f {
|
|
|
3623
3665
|
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
3624
3666
|
}
|
|
3625
3667
|
}
|
|
3626
|
-
const
|
|
3668
|
+
const xa = async (n) => await ce.create({
|
|
3627
3669
|
user: n
|
|
3628
3670
|
});
|
|
3629
|
-
async function
|
|
3630
|
-
const e = await
|
|
3631
|
-
return e || y(await
|
|
3671
|
+
async function qa(n) {
|
|
3672
|
+
const e = await ce.findOne({ user: n }).lean();
|
|
3673
|
+
return e || y(await xa(n));
|
|
3632
3674
|
}
|
|
3633
|
-
const
|
|
3675
|
+
const ka = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
|
|
3634
3676
|
upsert: !0,
|
|
3635
3677
|
returnDocument: "after"
|
|
3636
3678
|
}).lean();
|
|
3637
|
-
class
|
|
3679
|
+
class _a extends Ba {
|
|
3638
3680
|
constructor() {
|
|
3639
3681
|
super(300);
|
|
3640
3682
|
}
|
|
@@ -3647,14 +3689,14 @@ class va extends Ta {
|
|
|
3647
3689
|
return e;
|
|
3648
3690
|
}
|
|
3649
3691
|
fetchFromDb(e) {
|
|
3650
|
-
return
|
|
3692
|
+
return qa(e);
|
|
3651
3693
|
}
|
|
3652
3694
|
updateInDb(e, t) {
|
|
3653
|
-
return
|
|
3695
|
+
return ka(e, t);
|
|
3654
3696
|
}
|
|
3655
3697
|
}
|
|
3656
|
-
const
|
|
3657
|
-
class
|
|
3698
|
+
const pi = new _a();
|
|
3699
|
+
class Na extends f {
|
|
3658
3700
|
async hasReportedSomeone(e) {
|
|
3659
3701
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
3660
3702
|
}
|
|
@@ -3685,18 +3727,18 @@ class Ma extends f {
|
|
|
3685
3727
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
3686
3728
|
}
|
|
3687
3729
|
}
|
|
3688
|
-
const
|
|
3730
|
+
const Fa = async (n) => await oe.create({
|
|
3689
3731
|
user: n
|
|
3690
3732
|
});
|
|
3691
|
-
async function
|
|
3692
|
-
const e = await
|
|
3693
|
-
return e || y(await
|
|
3733
|
+
async function ja(n) {
|
|
3734
|
+
const e = await oe.findOne({ user: n }).lean();
|
|
3735
|
+
return e || y(await Fa(n));
|
|
3694
3736
|
}
|
|
3695
|
-
const
|
|
3737
|
+
const za = (n, e) => oe.findOneAndUpdate({ user: n }, e, {
|
|
3696
3738
|
upsert: !0,
|
|
3697
3739
|
returnDocument: "after"
|
|
3698
3740
|
}).lean();
|
|
3699
|
-
class
|
|
3741
|
+
class Ka extends Na {
|
|
3700
3742
|
constructor() {
|
|
3701
3743
|
super(300);
|
|
3702
3744
|
}
|
|
@@ -3707,14 +3749,14 @@ class xa extends Ma {
|
|
|
3707
3749
|
return e;
|
|
3708
3750
|
}
|
|
3709
3751
|
fetchFromDb(e) {
|
|
3710
|
-
return
|
|
3752
|
+
return ja(e);
|
|
3711
3753
|
}
|
|
3712
3754
|
updateInDb(e, t) {
|
|
3713
|
-
return
|
|
3755
|
+
return za(e, t);
|
|
3714
3756
|
}
|
|
3715
3757
|
}
|
|
3716
|
-
const
|
|
3717
|
-
class
|
|
3758
|
+
const yi = new Ka();
|
|
3759
|
+
class Pa extends f {
|
|
3718
3760
|
async readEdito(e) {
|
|
3719
3761
|
const t = /* @__PURE__ */ new Date();
|
|
3720
3762
|
t.setHours(0, 0, 0, 0), await M.updateOne(
|
|
@@ -3741,18 +3783,18 @@ class qa extends f {
|
|
|
3741
3783
|
), this.invalidate(e);
|
|
3742
3784
|
}
|
|
3743
3785
|
}
|
|
3744
|
-
const
|
|
3786
|
+
const Ha = async (n) => await M.create({
|
|
3745
3787
|
user: n
|
|
3746
3788
|
});
|
|
3747
|
-
async function
|
|
3789
|
+
async function La(n) {
|
|
3748
3790
|
const e = await M.findOne({ user: n }).lean();
|
|
3749
|
-
return e || y(await
|
|
3791
|
+
return e || y(await Ha(n));
|
|
3750
3792
|
}
|
|
3751
|
-
const
|
|
3793
|
+
const Qa = (n, e) => M.findOneAndUpdate({ user: n }, e, {
|
|
3752
3794
|
upsert: !0,
|
|
3753
3795
|
returnDocument: "after"
|
|
3754
3796
|
}).lean();
|
|
3755
|
-
class
|
|
3797
|
+
class Wa extends Pa {
|
|
3756
3798
|
constructor() {
|
|
3757
3799
|
super(300);
|
|
3758
3800
|
}
|
|
@@ -3763,14 +3805,14 @@ class ja extends qa {
|
|
|
3763
3805
|
return e;
|
|
3764
3806
|
}
|
|
3765
3807
|
fetchFromDb(e) {
|
|
3766
|
-
return
|
|
3808
|
+
return La(e);
|
|
3767
3809
|
}
|
|
3768
3810
|
updateInDb(e, t) {
|
|
3769
|
-
return
|
|
3811
|
+
return Qa(e, t);
|
|
3770
3812
|
}
|
|
3771
3813
|
}
|
|
3772
|
-
const
|
|
3773
|
-
class
|
|
3814
|
+
const fi = new Wa();
|
|
3815
|
+
class Ga extends f {
|
|
3774
3816
|
async updateCraftStats(e, t, r) {
|
|
3775
3817
|
const a = await d.get(r);
|
|
3776
3818
|
!a || !d.isItem(a) || await this.update(e, {
|
|
@@ -3793,7 +3835,7 @@ class za extends f {
|
|
|
3793
3835
|
}
|
|
3794
3836
|
async incrementBottleUsedToday(e, t) {
|
|
3795
3837
|
const r = /* @__PURE__ */ new Date();
|
|
3796
|
-
r.setHours(0, 0, 0, 0), await
|
|
3838
|
+
r.setHours(0, 0, 0, 0), await B.updateOne(
|
|
3797
3839
|
{
|
|
3798
3840
|
user: e,
|
|
3799
3841
|
"bottle.lastUsed": {
|
|
@@ -3804,7 +3846,7 @@ class za extends f {
|
|
|
3804
3846
|
$inc: { "bottle.usedToday": t },
|
|
3805
3847
|
$set: { "bottle.lastUsed": /* @__PURE__ */ new Date() }
|
|
3806
3848
|
}
|
|
3807
|
-
), await
|
|
3849
|
+
), await B.updateOne(
|
|
3808
3850
|
{
|
|
3809
3851
|
user: e,
|
|
3810
3852
|
"bottle.lastUsed": {
|
|
@@ -3830,18 +3872,18 @@ class za extends f {
|
|
|
3830
3872
|
});
|
|
3831
3873
|
}
|
|
3832
3874
|
}
|
|
3833
|
-
const
|
|
3875
|
+
const Ya = async (n) => await B.create({
|
|
3834
3876
|
user: n
|
|
3835
3877
|
});
|
|
3836
|
-
async function
|
|
3837
|
-
const e = await
|
|
3838
|
-
return e || y(await
|
|
3878
|
+
async function Xa(n) {
|
|
3879
|
+
const e = await B.findOne({ user: n }).lean();
|
|
3880
|
+
return e || y(await Ya(n));
|
|
3839
3881
|
}
|
|
3840
|
-
const
|
|
3882
|
+
const Va = (n, e) => B.findOneAndUpdate({ user: n }, e, {
|
|
3841
3883
|
upsert: !0,
|
|
3842
3884
|
returnDocument: "after"
|
|
3843
3885
|
}).lean();
|
|
3844
|
-
class
|
|
3886
|
+
class Ja extends Ga {
|
|
3845
3887
|
constructor() {
|
|
3846
3888
|
super(300);
|
|
3847
3889
|
}
|
|
@@ -3852,14 +3894,14 @@ class La extends za {
|
|
|
3852
3894
|
return e;
|
|
3853
3895
|
}
|
|
3854
3896
|
fetchFromDb(e) {
|
|
3855
|
-
return
|
|
3897
|
+
return Xa(e);
|
|
3856
3898
|
}
|
|
3857
3899
|
updateInDb(e, t) {
|
|
3858
|
-
return
|
|
3900
|
+
return Va(e, t);
|
|
3859
3901
|
}
|
|
3860
3902
|
}
|
|
3861
|
-
const
|
|
3862
|
-
class
|
|
3903
|
+
const mi = new Ja();
|
|
3904
|
+
class Za extends b {
|
|
3863
3905
|
async maxCraftQuantity(e, t) {
|
|
3864
3906
|
const r = await w.get(e);
|
|
3865
3907
|
let a = 1 / 0;
|
|
@@ -3892,57 +3934,57 @@ class Qa extends b {
|
|
|
3892
3934
|
return !!(await this.getAll()).find((r) => r.craftId === e);
|
|
3893
3935
|
}
|
|
3894
3936
|
async getRecipeResult(e, t) {
|
|
3895
|
-
const r = await w.get(e), a = (await
|
|
3937
|
+
const r = await w.get(e), a = (await U.getPanoplyBonus(r.equippedItems)).find(
|
|
3896
3938
|
([s, i]) => s.panoplyId === "little_blacksmith" && i !== null
|
|
3897
3939
|
);
|
|
3898
3940
|
return a?.[1] === "full" && t === "chest_3" ? "chest_blacksmith_3" : a?.[1] === "half" && t === "chest_2" ? "chest_blacksmith_2" : a?.[1] === "half" && t === "chest_1" ? "chest_blacksmith_1" : t;
|
|
3899
3941
|
}
|
|
3900
3942
|
}
|
|
3901
|
-
const
|
|
3943
|
+
const es = new u(
|
|
3902
3944
|
{
|
|
3903
3945
|
entityId: { type: String, required: !0 },
|
|
3904
3946
|
size: { type: Number, required: !0 }
|
|
3905
3947
|
},
|
|
3906
3948
|
{ _id: !1 }
|
|
3907
|
-
),
|
|
3949
|
+
), ts = new u(
|
|
3908
3950
|
{
|
|
3909
3951
|
entityId: { type: String, required: !0 },
|
|
3910
3952
|
size: { type: Number, required: !0 }
|
|
3911
3953
|
},
|
|
3912
3954
|
{ _id: !1 }
|
|
3913
|
-
),
|
|
3955
|
+
), ns = new u(
|
|
3914
3956
|
{
|
|
3915
3957
|
craftId: { type: String, unique: !0, required: !0 },
|
|
3916
3958
|
name: { type: String, required: !0 },
|
|
3917
|
-
entities: { type: [
|
|
3918
|
-
result: { type:
|
|
3959
|
+
entities: { type: [es], required: !0 },
|
|
3960
|
+
result: { type: ts, required: !0 }
|
|
3919
3961
|
},
|
|
3920
3962
|
{ minimize: !1 }
|
|
3921
|
-
),
|
|
3963
|
+
), le = l?.Recipes || p("Recipes", ns), rs = async (n) => await le.create({
|
|
3922
3964
|
...n
|
|
3923
|
-
}),
|
|
3924
|
-
async function
|
|
3925
|
-
const e = await
|
|
3965
|
+
}), as = async (n, e) => le.find(n, {}, e).lean();
|
|
3966
|
+
async function ss(n) {
|
|
3967
|
+
const e = await le.findOne({ craftId: n }).lean();
|
|
3926
3968
|
return e || null;
|
|
3927
3969
|
}
|
|
3928
|
-
const
|
|
3970
|
+
const is = (n, e) => le.findOneAndUpdate(n, e, {
|
|
3929
3971
|
returnDocument: "after"
|
|
3930
3972
|
}).lean();
|
|
3931
|
-
class
|
|
3973
|
+
class us extends Za {
|
|
3932
3974
|
constructor() {
|
|
3933
3975
|
super(3600);
|
|
3934
3976
|
}
|
|
3935
3977
|
createInDb(e) {
|
|
3936
|
-
return
|
|
3978
|
+
return rs(e);
|
|
3937
3979
|
}
|
|
3938
3980
|
updateInDb(e, t) {
|
|
3939
|
-
return
|
|
3981
|
+
return is(e, t);
|
|
3940
3982
|
}
|
|
3941
3983
|
fetchFromDb(e) {
|
|
3942
|
-
return
|
|
3984
|
+
return ss(e);
|
|
3943
3985
|
}
|
|
3944
|
-
fetchManyFromDb(e) {
|
|
3945
|
-
return
|
|
3986
|
+
fetchManyFromDb(e, t) {
|
|
3987
|
+
return as(e, t);
|
|
3946
3988
|
}
|
|
3947
3989
|
normalizeKey(e) {
|
|
3948
3990
|
return e;
|
|
@@ -3951,14 +3993,14 @@ class es extends Qa {
|
|
|
3951
3993
|
return e.craftId;
|
|
3952
3994
|
}
|
|
3953
3995
|
}
|
|
3954
|
-
const
|
|
3996
|
+
const hi = new us(), cs = new u({
|
|
3955
3997
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3956
3998
|
authorId: { type: String, required: !0 },
|
|
3957
3999
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
3958
4000
|
reason: { type: String, required: !0 },
|
|
3959
4001
|
guildId: { type: String, required: !0 }
|
|
3960
|
-
}),
|
|
3961
|
-
class
|
|
4002
|
+
}), pe = l?.Bans || p("Bans", cs), os = (n, e) => pe.deleteOne({ bannedUserId: n, guildId: e });
|
|
4003
|
+
class ds extends b {
|
|
3962
4004
|
async getUnbanUsers() {
|
|
3963
4005
|
return this.getMany({
|
|
3964
4006
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
@@ -3972,14 +4014,14 @@ class rs extends b {
|
|
|
3972
4014
|
return !!(r && (!r.unbannedTimestamp || r.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
3973
4015
|
}
|
|
3974
4016
|
async deleteBan(e, t) {
|
|
3975
|
-
await
|
|
4017
|
+
await os(e, t), this.invalidate({ bannedUserId: e, guildId: t });
|
|
3976
4018
|
}
|
|
3977
4019
|
}
|
|
3978
|
-
const
|
|
4020
|
+
const ls = (n) => pe.find(n).lean(), ps = (n) => pe.findOne(n).lean(), ys = (n, e) => pe.findOneAndUpdate(n, e, {
|
|
3979
4021
|
returnDocument: "after",
|
|
3980
4022
|
upsert: !0
|
|
3981
4023
|
}).lean();
|
|
3982
|
-
class
|
|
4024
|
+
class fs extends ds {
|
|
3983
4025
|
constructor() {
|
|
3984
4026
|
super(3600 * 36);
|
|
3985
4027
|
}
|
|
@@ -3990,16 +4032,16 @@ class us extends rs {
|
|
|
3990
4032
|
return { bannedUserId: e, guildId: t };
|
|
3991
4033
|
}
|
|
3992
4034
|
fetchFromDb(e) {
|
|
3993
|
-
return
|
|
4035
|
+
return ps(e);
|
|
3994
4036
|
}
|
|
3995
4037
|
fetchManyFromDb(e) {
|
|
3996
|
-
return
|
|
4038
|
+
return ls(e);
|
|
3997
4039
|
}
|
|
3998
4040
|
updateInDb(e, t) {
|
|
3999
|
-
return
|
|
4041
|
+
return ys(e, t);
|
|
4000
4042
|
}
|
|
4001
4043
|
}
|
|
4002
|
-
const
|
|
4044
|
+
const wi = new fs(), ms = new u({
|
|
4003
4045
|
senderId: {
|
|
4004
4046
|
type: u.Types.ObjectId,
|
|
4005
4047
|
required: !0,
|
|
@@ -4016,35 +4058,36 @@ const oi = new us(), cs = new u({
|
|
|
4016
4058
|
meta: {
|
|
4017
4059
|
rps: { type: String, default: void 0 }
|
|
4018
4060
|
}
|
|
4019
|
-
}),
|
|
4061
|
+
}), ye = l?.Invitation || p("Invitation", ms), hs = (n) => ye.create({
|
|
4020
4062
|
...n
|
|
4021
|
-
}),
|
|
4022
|
-
await
|
|
4063
|
+
}), ws = async (n) => {
|
|
4064
|
+
await ye.deleteMany({
|
|
4023
4065
|
...n
|
|
4024
4066
|
});
|
|
4025
4067
|
};
|
|
4026
|
-
class
|
|
4068
|
+
class gs extends f {
|
|
4027
4069
|
async sendInvitation({
|
|
4028
4070
|
senderId: e,
|
|
4029
4071
|
receiverId: t,
|
|
4030
4072
|
gameMode: r,
|
|
4031
4073
|
...a
|
|
4032
4074
|
}) {
|
|
4033
|
-
return await this.get({ senderId: e, gameMode: r, receiverId: t }) ?
|
|
4034
|
-
}
|
|
4035
|
-
async receiveInvitation(e) {
|
|
4036
|
-
return this.get(e);
|
|
4075
|
+
return await this.get({ senderId: e, gameMode: r, receiverId: t }) ? null : await hs({ ...a, senderId: e, gameMode: r, receiverId: t });
|
|
4037
4076
|
}
|
|
4038
|
-
async deleteInvitation(
|
|
4039
|
-
|
|
4077
|
+
async deleteInvitation({
|
|
4078
|
+
senderId: e,
|
|
4079
|
+
receiverId: t,
|
|
4080
|
+
gameMode: r
|
|
4081
|
+
}) {
|
|
4082
|
+
await ws({ senderId: e, gameMode: r, receiverId: t }), this.invalidate({ senderId: e, gameMode: r, receiverId: t });
|
|
4040
4083
|
}
|
|
4041
4084
|
}
|
|
4042
|
-
const
|
|
4085
|
+
const Ss = (n) => ye.findOne({
|
|
4043
4086
|
...n
|
|
4044
|
-
}).lean(),
|
|
4087
|
+
}).lean(), bs = (n, e) => ye.findOneAndUpdate(n, e, {
|
|
4045
4088
|
returnDocument: "after"
|
|
4046
4089
|
}).lean();
|
|
4047
|
-
class
|
|
4090
|
+
class $s extends gs {
|
|
4048
4091
|
constructor() {
|
|
4049
4092
|
super(3600);
|
|
4050
4093
|
}
|
|
@@ -4059,19 +4102,19 @@ class fs extends ls {
|
|
|
4059
4102
|
return { gameMode: t, receiverId: e, senderId: r };
|
|
4060
4103
|
}
|
|
4061
4104
|
fetchFromDb(e) {
|
|
4062
|
-
return
|
|
4105
|
+
return Ss(e);
|
|
4063
4106
|
}
|
|
4064
4107
|
updateInDb(e, t) {
|
|
4065
|
-
return
|
|
4108
|
+
return bs(e, t);
|
|
4066
4109
|
}
|
|
4067
4110
|
}
|
|
4068
|
-
const
|
|
4069
|
-
class
|
|
4111
|
+
const gi = new $s();
|
|
4112
|
+
class Es extends f {
|
|
4070
4113
|
async setEditoChannel(e, t) {
|
|
4071
4114
|
await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
|
|
4072
4115
|
}
|
|
4073
4116
|
async randomizeEditoPrice(e) {
|
|
4074
|
-
const t =
|
|
4117
|
+
const t = X(100, 1001);
|
|
4075
4118
|
return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
|
|
4076
4119
|
}
|
|
4077
4120
|
async setEditoMessageId(e, t) {
|
|
@@ -4127,7 +4170,7 @@ class ms extends f {
|
|
|
4127
4170
|
);
|
|
4128
4171
|
}
|
|
4129
4172
|
}
|
|
4130
|
-
const
|
|
4173
|
+
const Us = new u({
|
|
4131
4174
|
guildId: { type: String, required: !0, unique: !0 },
|
|
4132
4175
|
ranking: {
|
|
4133
4176
|
channelId: { type: String, default: null },
|
|
@@ -4136,7 +4179,11 @@ const hs = new u({
|
|
|
4136
4179
|
roles: {
|
|
4137
4180
|
premium: { type: String, default: null },
|
|
4138
4181
|
booster: { type: String, default: null },
|
|
4139
|
-
scam: { type: String, default: null }
|
|
4182
|
+
scam: { type: String, default: null },
|
|
4183
|
+
factions: {
|
|
4184
|
+
canChange: { type: String, default: null },
|
|
4185
|
+
canChoose: { type: String, default: null }
|
|
4186
|
+
}
|
|
4140
4187
|
},
|
|
4141
4188
|
channels: {
|
|
4142
4189
|
gambling: { type: String, default: null },
|
|
@@ -4169,16 +4216,16 @@ const hs = new u({
|
|
|
4169
4216
|
}
|
|
4170
4217
|
},
|
|
4171
4218
|
shopChannelId: { type: String, default: null }
|
|
4172
|
-
}),
|
|
4219
|
+
}), De = l?.Settings || p("Settings", Us), Is = (n) => De.create({
|
|
4173
4220
|
guildId: n
|
|
4174
|
-
}),
|
|
4175
|
-
const e = await
|
|
4176
|
-
return e || y(await
|
|
4177
|
-
},
|
|
4221
|
+
}), Ds = async (n) => {
|
|
4222
|
+
const e = await De.findOne({ guildId: n }).lean();
|
|
4223
|
+
return e || y(await Is(n));
|
|
4224
|
+
}, Os = (n, e) => De.findOneAndUpdate(n, e, {
|
|
4178
4225
|
upsert: !0,
|
|
4179
4226
|
returnDocument: "after"
|
|
4180
4227
|
}).lean();
|
|
4181
|
-
class
|
|
4228
|
+
class Ts extends Es {
|
|
4182
4229
|
constructor() {
|
|
4183
4230
|
super(3600 * 24 * 30);
|
|
4184
4231
|
}
|
|
@@ -4189,13 +4236,13 @@ class bs extends ms {
|
|
|
4189
4236
|
return e;
|
|
4190
4237
|
}
|
|
4191
4238
|
fetchFromDb(e) {
|
|
4192
|
-
return
|
|
4239
|
+
return Ds(e);
|
|
4193
4240
|
}
|
|
4194
4241
|
updateInDb(e, t) {
|
|
4195
|
-
return
|
|
4242
|
+
return Os(e, t);
|
|
4196
4243
|
}
|
|
4197
4244
|
}
|
|
4198
|
-
const
|
|
4245
|
+
const Si = new Ts(), Rs = new u(
|
|
4199
4246
|
{
|
|
4200
4247
|
shopType: { type: String, required: !0, unique: !0 },
|
|
4201
4248
|
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
@@ -4224,11 +4271,11 @@ const li = new bs(), $s = new u(
|
|
|
4224
4271
|
}
|
|
4225
4272
|
},
|
|
4226
4273
|
{ minimize: !1 }
|
|
4227
|
-
),
|
|
4274
|
+
), Oe = l?.Shop || p("Shop", Rs), Cs = (n) => Oe.create({
|
|
4228
4275
|
shopType: n
|
|
4229
|
-
}),
|
|
4230
|
-
const e = await
|
|
4231
|
-
return e || y(await
|
|
4276
|
+
}), vs = async (n) => {
|
|
4277
|
+
const e = await Oe.findOne({ shopType: n }).lean();
|
|
4278
|
+
return e || y(await Cs(n));
|
|
4232
4279
|
};
|
|
4233
4280
|
class E {
|
|
4234
4281
|
toDBShopItem() {
|
|
@@ -4240,11 +4287,11 @@ class E {
|
|
|
4240
4287
|
};
|
|
4241
4288
|
}
|
|
4242
4289
|
async onBuy(e, t) {
|
|
4243
|
-
this.currency === "berry" ? (await
|
|
4290
|
+
this.currency === "berry" ? (await I.updateUserBerry(
|
|
4244
4291
|
e,
|
|
4245
4292
|
-1 * this.price * t,
|
|
4246
4293
|
!1
|
|
4247
|
-
), await
|
|
4294
|
+
), await Ma.updateTotalSpentInShop(
|
|
4248
4295
|
e,
|
|
4249
4296
|
this.price * t
|
|
4250
4297
|
)) : await w.removeItem(
|
|
@@ -4281,7 +4328,7 @@ class E {
|
|
|
4281
4328
|
return !1;
|
|
4282
4329
|
}
|
|
4283
4330
|
}
|
|
4284
|
-
class
|
|
4331
|
+
class As extends E {
|
|
4285
4332
|
price;
|
|
4286
4333
|
size;
|
|
4287
4334
|
currency;
|
|
@@ -4295,13 +4342,13 @@ class Us extends E {
|
|
|
4295
4342
|
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4296
4343
|
}
|
|
4297
4344
|
async onBuy(e, t) {
|
|
4298
|
-
await super.onBuy(e, t), await
|
|
4345
|
+
await super.onBuy(e, t), await Y.unlockBackground(e, this.data.ornamentId);
|
|
4299
4346
|
}
|
|
4300
4347
|
isBackground() {
|
|
4301
4348
|
return !0;
|
|
4302
4349
|
}
|
|
4303
4350
|
}
|
|
4304
|
-
class
|
|
4351
|
+
class Ms extends E {
|
|
4305
4352
|
price;
|
|
4306
4353
|
size;
|
|
4307
4354
|
currency;
|
|
@@ -4321,7 +4368,7 @@ class Ds extends E {
|
|
|
4321
4368
|
return !0;
|
|
4322
4369
|
}
|
|
4323
4370
|
}
|
|
4324
|
-
class
|
|
4371
|
+
class Bs extends E {
|
|
4325
4372
|
price;
|
|
4326
4373
|
size;
|
|
4327
4374
|
currency;
|
|
@@ -4341,7 +4388,7 @@ class Ts extends E {
|
|
|
4341
4388
|
return !0;
|
|
4342
4389
|
}
|
|
4343
4390
|
}
|
|
4344
|
-
class
|
|
4391
|
+
class xs extends E {
|
|
4345
4392
|
price;
|
|
4346
4393
|
size;
|
|
4347
4394
|
currency;
|
|
@@ -4361,7 +4408,7 @@ class Os extends E {
|
|
|
4361
4408
|
return !0;
|
|
4362
4409
|
}
|
|
4363
4410
|
}
|
|
4364
|
-
class
|
|
4411
|
+
class qs extends E {
|
|
4365
4412
|
price;
|
|
4366
4413
|
size;
|
|
4367
4414
|
currency;
|
|
@@ -4377,7 +4424,7 @@ class Cs extends E {
|
|
|
4377
4424
|
async onBuy(e, t) {
|
|
4378
4425
|
await super.onBuy(e, t), await w.addEquipments(
|
|
4379
4426
|
e,
|
|
4380
|
-
|
|
4427
|
+
mt({ stop: t }).map(
|
|
4381
4428
|
() => d.seedEquipment(
|
|
4382
4429
|
{ ...this.data },
|
|
4383
4430
|
Date.now() - Math.round(Math.random() * 1e3)
|
|
@@ -4392,7 +4439,7 @@ class Cs extends E {
|
|
|
4392
4439
|
return !0;
|
|
4393
4440
|
}
|
|
4394
4441
|
}
|
|
4395
|
-
class
|
|
4442
|
+
class ks extends E {
|
|
4396
4443
|
price;
|
|
4397
4444
|
size;
|
|
4398
4445
|
currency;
|
|
@@ -4412,7 +4459,7 @@ class Rs extends E {
|
|
|
4412
4459
|
return !0;
|
|
4413
4460
|
}
|
|
4414
4461
|
}
|
|
4415
|
-
class
|
|
4462
|
+
class _s extends E {
|
|
4416
4463
|
price;
|
|
4417
4464
|
size;
|
|
4418
4465
|
currency;
|
|
@@ -4432,7 +4479,7 @@ class vs extends E {
|
|
|
4432
4479
|
return !0;
|
|
4433
4480
|
}
|
|
4434
4481
|
}
|
|
4435
|
-
class
|
|
4482
|
+
class Ns extends E {
|
|
4436
4483
|
price;
|
|
4437
4484
|
size;
|
|
4438
4485
|
currency;
|
|
@@ -4452,7 +4499,7 @@ class Ms extends E {
|
|
|
4452
4499
|
return !0;
|
|
4453
4500
|
}
|
|
4454
4501
|
}
|
|
4455
|
-
class
|
|
4502
|
+
class Fs extends E {
|
|
4456
4503
|
price;
|
|
4457
4504
|
size;
|
|
4458
4505
|
currency;
|
|
@@ -4466,36 +4513,36 @@ class As extends E {
|
|
|
4466
4513
|
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4467
4514
|
}
|
|
4468
4515
|
async onBuy(e, t) {
|
|
4469
|
-
await super.onBuy(e, t), await
|
|
4516
|
+
await super.onBuy(e, t), await Y.unlockTitle(e, this.data.ornamentId);
|
|
4470
4517
|
}
|
|
4471
4518
|
isTitle() {
|
|
4472
4519
|
return !0;
|
|
4473
4520
|
}
|
|
4474
4521
|
}
|
|
4475
|
-
class
|
|
4522
|
+
class js extends f {
|
|
4476
4523
|
async getShopItem(e, t) {
|
|
4477
4524
|
const a = (await this.get(e)).items.find((S) => S.id === t);
|
|
4478
4525
|
if (!a)
|
|
4479
4526
|
return;
|
|
4480
4527
|
const { price: s, size: i, currency: o } = a, c = await d.get(a.id) ?? await g.get(a.id);
|
|
4481
4528
|
if (g.isOrnament(c) && g.isBackground(c))
|
|
4482
|
-
return new Us({ price: s, item: c, size: i, currency: o });
|
|
4483
|
-
if (g.isOrnament(c) && g.isTitle(c))
|
|
4484
4529
|
return new As({ price: s, item: c, size: i, currency: o });
|
|
4530
|
+
if (g.isOrnament(c) && g.isTitle(c))
|
|
4531
|
+
return new Fs({ price: s, item: c, size: i, currency: o });
|
|
4485
4532
|
if (d.isEntity(c) && d.isChestItem(c))
|
|
4486
|
-
return new
|
|
4533
|
+
return new Bs({ price: s, item: c, size: i, currency: o });
|
|
4487
4534
|
if (d.isEntity(c) && d.isBoostItem(c))
|
|
4488
|
-
return new
|
|
4535
|
+
return new Ms({ price: s, item: c, size: i, currency: o });
|
|
4489
4536
|
if (d.isEntity(c) && d.isRepairItem(c))
|
|
4490
|
-
return new
|
|
4537
|
+
return new _s({ price: s, item: c, size: i, currency: o });
|
|
4491
4538
|
if (d.isEntity(c) && d.isStoreItem(c))
|
|
4492
|
-
return new
|
|
4539
|
+
return new Ns({ price: s, item: c, size: i, currency: o });
|
|
4493
4540
|
if (d.isEntity(c) && d.isObjectItem(c))
|
|
4494
|
-
return new
|
|
4541
|
+
return new xs({ price: s, item: c, size: i, currency: o });
|
|
4495
4542
|
if (d.isEntity(c) && d.isEquipment(c))
|
|
4496
|
-
return new
|
|
4543
|
+
return new qs({ price: s, item: c, size: i, currency: o });
|
|
4497
4544
|
if (d.isEntity(c) && d.isBottleItem(c))
|
|
4498
|
-
return new
|
|
4545
|
+
return new ks({ price: s, size: i, item: c, currency: o });
|
|
4499
4546
|
}
|
|
4500
4547
|
async getShopItemList(e) {
|
|
4501
4548
|
const t = await this.get(e), r = [];
|
|
@@ -4554,8 +4601,8 @@ class Bs extends f {
|
|
|
4554
4601
|
);
|
|
4555
4602
|
}
|
|
4556
4603
|
}
|
|
4557
|
-
const
|
|
4558
|
-
class
|
|
4604
|
+
const zs = (n, e) => Oe.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
4605
|
+
class Ks extends js {
|
|
4559
4606
|
constructor() {
|
|
4560
4607
|
super(3600);
|
|
4561
4608
|
}
|
|
@@ -4566,28 +4613,28 @@ class xs extends Bs {
|
|
|
4566
4613
|
return e;
|
|
4567
4614
|
}
|
|
4568
4615
|
fetchFromDb(e) {
|
|
4569
|
-
return
|
|
4616
|
+
return vs(e);
|
|
4570
4617
|
}
|
|
4571
4618
|
updateInDb(e, t) {
|
|
4572
|
-
return
|
|
4619
|
+
return zs(e, t);
|
|
4573
4620
|
}
|
|
4574
4621
|
}
|
|
4575
|
-
const
|
|
4622
|
+
const bi = new Ks(), Ps = new u({
|
|
4576
4623
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
4577
4624
|
authorId: String,
|
|
4578
4625
|
date: { type: Date, default: Date.now() },
|
|
4579
4626
|
reason: { type: String, default: null }
|
|
4580
|
-
}),
|
|
4581
|
-
class
|
|
4627
|
+
}), rt = l?.Warn || p("Warn", Ps), Hs = (n) => rt.countDocuments(n);
|
|
4628
|
+
class Ls extends b {
|
|
4582
4629
|
getUserWarns(e) {
|
|
4583
4630
|
return this.getMany({ warnedUserId: e });
|
|
4584
4631
|
}
|
|
4585
4632
|
getUserWarnCount(e) {
|
|
4586
|
-
return
|
|
4633
|
+
return Hs({ warnedUserId: e });
|
|
4587
4634
|
}
|
|
4588
4635
|
}
|
|
4589
|
-
const
|
|
4590
|
-
class
|
|
4636
|
+
const Qs = (n) => rt.find(n).lean();
|
|
4637
|
+
class Ws extends Ls {
|
|
4591
4638
|
constructor() {
|
|
4592
4639
|
super(300);
|
|
4593
4640
|
}
|
|
@@ -4601,63 +4648,64 @@ class js extends Ns {
|
|
|
4601
4648
|
throw new Error("Method not implemented.");
|
|
4602
4649
|
}
|
|
4603
4650
|
fetchManyFromDb(e) {
|
|
4604
|
-
return
|
|
4651
|
+
return Qs(e);
|
|
4605
4652
|
}
|
|
4606
4653
|
updateInDb() {
|
|
4607
4654
|
throw new Error("Method not implemented.");
|
|
4608
4655
|
}
|
|
4609
4656
|
}
|
|
4610
|
-
const
|
|
4611
|
-
|
|
4657
|
+
const $i = new Ws(), Ei = (n) => {
|
|
4658
|
+
ot(n);
|
|
4612
4659
|
};
|
|
4613
|
-
class
|
|
4660
|
+
class Ui extends dt.ObjectId {
|
|
4614
4661
|
}
|
|
4615
4662
|
export {
|
|
4616
|
-
|
|
4617
|
-
|
|
4663
|
+
ai as COOLDOWN_COMMANDS,
|
|
4664
|
+
Ui as ObjectId,
|
|
4618
4665
|
h as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4666
|
+
ge as RAID_MIDDLEWARE_EVENT_NAME,
|
|
4667
|
+
wi as banService,
|
|
4668
|
+
Ei as connectToServices,
|
|
4669
|
+
ve as crewMetaService,
|
|
4670
|
+
ei as crewOrnamentsService,
|
|
4671
|
+
ti as crewQuestService,
|
|
4672
|
+
Bt as crewService,
|
|
4673
|
+
ni as crewStatsEngagementService,
|
|
4674
|
+
ri as crewStatsFrequencyService,
|
|
4628
4675
|
m as emitQuestMiddlewareEvent,
|
|
4629
|
-
|
|
4676
|
+
we as emitRaidMiddlewareEvent,
|
|
4630
4677
|
d as entityService,
|
|
4631
|
-
|
|
4632
|
-
|
|
4678
|
+
vs as findShop,
|
|
4679
|
+
gi as invitationService,
|
|
4633
4680
|
g as ornamentService,
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4681
|
+
U as panoplyService,
|
|
4682
|
+
hi as recipeService,
|
|
4683
|
+
Js as registerQuestMiddlewareEvents,
|
|
4684
|
+
Zs as registerRaidMiddlewareEvents,
|
|
4685
|
+
L as reminderService,
|
|
4686
|
+
Si as settingsService,
|
|
4687
|
+
Oe as shopModel,
|
|
4688
|
+
bi as shopService,
|
|
4689
|
+
Br as userCooldownService,
|
|
4690
|
+
sr as userCrewService,
|
|
4691
|
+
si as userDailyReportService,
|
|
4692
|
+
fe as userEncyclopediaService,
|
|
4693
|
+
ii as userGamesService,
|
|
4647
4694
|
w as userInventoryService,
|
|
4648
|
-
|
|
4649
|
-
|
|
4695
|
+
I as userMetaService,
|
|
4696
|
+
Y as userOrnamentService,
|
|
4650
4697
|
Me as userQuestService,
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4698
|
+
ui as userRaidService,
|
|
4699
|
+
ci as userRankService,
|
|
4700
|
+
$n as userService,
|
|
4701
|
+
Ae as userSettingsService,
|
|
4702
|
+
oi as userShopService,
|
|
4703
|
+
di as userStatsCasinoService,
|
|
4704
|
+
li as userStatsCrewService,
|
|
4705
|
+
Ma as userStatsEconomyService,
|
|
4706
|
+
pi as userStatsEngagementService,
|
|
4707
|
+
yi as userStatsFlagsService,
|
|
4708
|
+
fi as userStatsFrequencyService,
|
|
4709
|
+
mi as userStatsInventoryService,
|
|
4710
|
+
$i as warnService
|
|
4663
4711
|
};
|