@opfr/services 1.0.3 → 1.0.5
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 +840 -737
- package/dist/index.umd.js +1 -1
- package/dist/services/AbstractCachedService.d.ts +1 -1
- package/dist/services/AbstractCachedService.d.ts.map +1 -1
- package/dist/services/ban/definition/model.d.ts +1 -1
- package/dist/services/ban/definition/model.d.ts.map +1 -1
- package/dist/services/ban/definition/schema.d.ts +1 -1
- package/dist/services/ban/definition/schema.d.ts.map +1 -1
- package/dist/services/ban/helper.d.ts +2 -2
- package/dist/services/ban/helper.d.ts.map +1 -1
- package/dist/services/ban/index.d.ts +1 -1
- package/dist/services/ban/index.d.ts.map +1 -1
- package/dist/services/ban/process/create.d.ts +1 -1
- package/dist/services/ban/process/create.d.ts.map +1 -1
- package/dist/services/ban/process/findMany.d.ts +1 -1
- package/dist/services/ban/process/findMany.d.ts.map +1 -1
- package/dist/services/ban/process/findOne.d.ts +1 -1
- package/dist/services/ban/process/findOne.d.ts.map +1 -1
- package/dist/services/ban/process/updateOne.d.ts +5 -0
- package/dist/services/ban/process/updateOne.d.ts.map +1 -0
- package/dist/services/ban/service.d.ts +3 -3
- package/dist/services/ban/service.d.ts.map +1 -1
- package/dist/services/ban/{type.d.ts → types.d.ts} +1 -1
- package/dist/services/ban/types.d.ts.map +1 -0
- package/dist/services/entities/helper.d.ts +0 -2
- package/dist/services/entities/helper.d.ts.map +1 -1
- package/dist/services/entities/process/updateOne.d.ts +3 -2
- package/dist/services/entities/process/updateOne.d.ts.map +1 -1
- package/dist/services/entities/service.d.ts +1 -1
- 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/process/updateOne.d.ts +5 -0
- package/dist/services/invitations/process/updateOne.d.ts.map +1 -0
- package/dist/services/invitations/service.d.ts +3 -3
- package/dist/services/invitations/service.d.ts.map +1 -1
- package/dist/services/ornaments/process/updateOne.d.ts +3 -2
- package/dist/services/ornaments/process/updateOne.d.ts.map +1 -1
- package/dist/services/ornaments/service.d.ts +1 -1
- package/dist/services/ornaments/service.d.ts.map +1 -1
- package/dist/services/panoplies/process/updateOne.d.ts +2 -1
- package/dist/services/panoplies/process/updateOne.d.ts.map +1 -1
- package/dist/services/panoplies/service.d.ts +1 -1
- package/dist/services/panoplies/service.d.ts.map +1 -1
- package/dist/services/user-cooldown/helper.d.ts +2 -2
- package/dist/services/user-cooldown/helper.d.ts.map +1 -1
- package/dist/services/user-daily-report/index.d.ts +1 -0
- package/dist/services/user-daily-report/index.d.ts.map +1 -1
- package/package.json +10 -5
- package/dist/services/ban/type.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Schema as u, models 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 ut, Types as ct } from "mongoose";
|
|
2
|
+
import { randomBetween as Y, hasExpire as L, sameDay as pe, yesterday as k, capitalizeAllWords as ot, filterNullAndUndefined as N, pickFrom as dt, shuffle as Te, recordToArray as C, arrayToRecord as Me, mergeObjects as F, exclude as q, groupBy as lt, sortBy as Oe, seededRandom as pt, range as yt } from "@opfr/utils-lang";
|
|
3
|
+
import ft from "node-cache";
|
|
4
|
+
import { CREW_DEFAULT_DISINTEGRATION as Ae, CREW_DEFAULT_MEMBER_LIMIT as mt, QuestStatus as O, CREW_DEFAULT_XP_PERCENT as ht, DEFAULT_FACTION as wt, RANK_IDS_WITHOUT_BASIC as De, EQUIPMENT_SLOT as Be, EQUIPMENT_FROM_SLOT_TO_TYPE as gt, EFFECT_KEYS as St, CHARACTERISTICS as bt, getComputedCharacteristicValue as $t, getCurrentLevel as Et, HP_PER_VITALITY as Ut, DEFAULT_MAX_HP as It, transformToDBBuff as Tt, SHOP_DEFAULT_AVAILABLE_ENTITY_AMOUNT as Ot } from "@opfr/definitions";
|
|
5
|
+
import * as ye from "events";
|
|
6
|
+
const Q = "___ALL_ENTITIES___";
|
|
7
7
|
class f {
|
|
8
8
|
cache;
|
|
9
9
|
constructor(e) {
|
|
10
|
-
this.cache = new
|
|
10
|
+
this.cache = new ft({
|
|
11
11
|
stdTTL: e,
|
|
12
12
|
checkperiod: e * 0.2,
|
|
13
13
|
useClones: !1
|
|
@@ -24,12 +24,12 @@ class f {
|
|
|
24
24
|
const r = await this.updateInDb(e, t, a);
|
|
25
25
|
if (r) {
|
|
26
26
|
const s = this.getKey(r);
|
|
27
|
-
this.cache.del(
|
|
27
|
+
this.cache.del(Q), this.cache.set(this.normalizeKey(s), r);
|
|
28
28
|
}
|
|
29
29
|
return r;
|
|
30
30
|
}
|
|
31
31
|
invalidate(e) {
|
|
32
|
-
this.cache.del(
|
|
32
|
+
this.cache.del(Q), e && this.cache.del(this.normalizeKey(e));
|
|
33
33
|
}
|
|
34
34
|
clearAll() {
|
|
35
35
|
this.cache.flushAll();
|
|
@@ -37,11 +37,11 @@ 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(Q);
|
|
41
41
|
if (e)
|
|
42
42
|
return e;
|
|
43
43
|
const t = await this.fetchManyFromDb({});
|
|
44
|
-
return this.cache.set(
|
|
44
|
+
return this.cache.set(Q, t), t.forEach((a) => {
|
|
45
45
|
this.cache.set(this.normalizeKey(this.getKey(a)), a);
|
|
46
46
|
}), t;
|
|
47
47
|
}
|
|
@@ -52,11 +52,11 @@ class b extends f {
|
|
|
52
52
|
}), t;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
55
|
+
const _e = new ye.EventEmitter(), m = (n, e, t) => {
|
|
56
|
+
_e.emit(n, e, t);
|
|
57
|
+
}, Bs = (n) => {
|
|
58
58
|
for (const [e, t] of Object.entries(n))
|
|
59
|
-
|
|
59
|
+
_e.on(e, (a, r) => {
|
|
60
60
|
t(a, r);
|
|
61
61
|
});
|
|
62
62
|
}, h = {
|
|
@@ -79,36 +79,36 @@ const De = new ue.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
|
+
}, xe = new ye.EventEmitter(), fe = (n, e, t) => {
|
|
83
|
+
xe.emit(n, e, t);
|
|
84
|
+
}, _s = (n) => {
|
|
85
85
|
for (const [e, t] of Object.entries(n))
|
|
86
|
-
|
|
86
|
+
xe.on(e, (a, r) => {
|
|
87
87
|
t(a, r);
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, me = {
|
|
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
|
+
}, qe = 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: mt },
|
|
100
|
+
disintegration: { type: Number, default: Ae },
|
|
101
101
|
faction: String
|
|
102
102
|
},
|
|
103
103
|
{ timestamps: !0, minimize: !1 }
|
|
104
104
|
);
|
|
105
|
-
|
|
105
|
+
qe.post("findOneAndUpdate", async function(n) {
|
|
106
106
|
m(h.CREW, n._id, n);
|
|
107
107
|
});
|
|
108
|
-
const
|
|
109
|
-
class
|
|
108
|
+
const W = l?.Crew || p("Crew", qe);
|
|
109
|
+
class Dt extends f {
|
|
110
110
|
async getCrewRank(e) {
|
|
111
|
-
return (await
|
|
111
|
+
return (await W.aggregate([
|
|
112
112
|
{
|
|
113
113
|
$lookup: {
|
|
114
114
|
from: "crewmetas",
|
|
@@ -134,7 +134,7 @@ class bt extends f {
|
|
|
134
134
|
]))[0];
|
|
135
135
|
}
|
|
136
136
|
getCrewRanking() {
|
|
137
|
-
return
|
|
137
|
+
return W.aggregate([
|
|
138
138
|
{
|
|
139
139
|
$lookup: {
|
|
140
140
|
from: "crewmetas",
|
|
@@ -179,7 +179,7 @@ class bt extends f {
|
|
|
179
179
|
$set: {
|
|
180
180
|
disintegration: {
|
|
181
181
|
$max: [
|
|
182
|
-
{ $add: ["$disintegration", -1 *
|
|
182
|
+
{ $add: ["$disintegration", -1 * Y(r, s)] },
|
|
183
183
|
0
|
|
184
184
|
]
|
|
185
185
|
}
|
|
@@ -188,13 +188,13 @@ class bt extends f {
|
|
|
188
188
|
]);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
const
|
|
192
|
-
const e = await
|
|
191
|
+
const Ct = async (n) => {
|
|
192
|
+
const e = await W.findById(n).lean();
|
|
193
193
|
return e || null;
|
|
194
|
-
},
|
|
194
|
+
}, Rt = (n, e) => W.findOneAndUpdate({ _id: n }, e, {
|
|
195
195
|
returnDocument: "after"
|
|
196
196
|
}).lean();
|
|
197
|
-
class
|
|
197
|
+
class vt extends Dt {
|
|
198
198
|
constructor() {
|
|
199
199
|
super(3600);
|
|
200
200
|
}
|
|
@@ -205,23 +205,23 @@ class It extends bt {
|
|
|
205
205
|
return e;
|
|
206
206
|
}
|
|
207
207
|
fetchFromDb(e) {
|
|
208
|
-
return
|
|
208
|
+
return Ct(e);
|
|
209
209
|
}
|
|
210
210
|
updateInDb(e, t) {
|
|
211
|
-
return
|
|
211
|
+
return Rt(e, t);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
class
|
|
214
|
+
const Mt = new vt();
|
|
215
|
+
class At extends f {
|
|
216
216
|
async hasXpBuff(e) {
|
|
217
217
|
const t = await this.get(e);
|
|
218
|
-
if (!
|
|
218
|
+
if (!L(t.buffs.xp.expireAt))
|
|
219
219
|
return t.buffs.xp.boost;
|
|
220
220
|
}
|
|
221
221
|
async calcXp(e, t) {
|
|
222
|
-
const a = await
|
|
222
|
+
const a = await Mt.get(e);
|
|
223
223
|
return a ? Math.ceil(
|
|
224
|
-
t * (a.disintegration /
|
|
224
|
+
t * (a.disintegration / Ae) * (await this.hasXpBuff(e) ?? 1)
|
|
225
225
|
) : 0;
|
|
226
226
|
}
|
|
227
227
|
async addXp(e, t) {
|
|
@@ -272,7 +272,7 @@ class Tt 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 }), ke = 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 }), Me = new
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
|
-
|
|
291
|
+
ke.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 he = l?.CrewMeta || p("CrewMeta", ke), Bt = async (n) => await he.create({
|
|
299
299
|
crew: n
|
|
300
300
|
});
|
|
301
|
-
async function
|
|
302
|
-
const e = await
|
|
303
|
-
return e || y(await
|
|
301
|
+
async function _t(n) {
|
|
302
|
+
const e = await he.findOne({ user: n }).lean();
|
|
303
|
+
return e || y(await Bt(n));
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const xt = (n, e) => he.findOneAndUpdate({ user: n }, e, {
|
|
306
306
|
returnDocument: "after",
|
|
307
307
|
upsert: !0
|
|
308
308
|
}).lean();
|
|
309
|
-
class
|
|
309
|
+
class qt extends At {
|
|
310
310
|
constructor() {
|
|
311
311
|
super(300);
|
|
312
312
|
}
|
|
@@ -317,14 +317,14 @@ class Rt extends Tt {
|
|
|
317
317
|
return e;
|
|
318
318
|
}
|
|
319
319
|
fetchFromDb(e) {
|
|
320
|
-
return
|
|
320
|
+
return _t(e);
|
|
321
321
|
}
|
|
322
322
|
updateInDb(e, t) {
|
|
323
|
-
return
|
|
323
|
+
return xt(e, t);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
const
|
|
327
|
-
class
|
|
326
|
+
const Ce = new qt();
|
|
327
|
+
class kt extends f {
|
|
328
328
|
async unlockBadge(e, t, a) {
|
|
329
329
|
t.isProgressive ? await this.update(e, {
|
|
330
330
|
$addToSet: { unlockedBadges: `${t.id}_${a}` }
|
|
@@ -333,7 +333,7 @@ class Mt extends f {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
const
|
|
336
|
+
const Ne = new u({
|
|
337
337
|
crew: {
|
|
338
338
|
type: u.Types.ObjectId,
|
|
339
339
|
required: !0,
|
|
@@ -342,25 +342,25 @@ const ve = new u({
|
|
|
342
342
|
},
|
|
343
343
|
unlockedBadges: { type: [String], default: [] }
|
|
344
344
|
});
|
|
345
|
-
|
|
345
|
+
Ne.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 we = l?.CrewOrnaments || p("CrewOrnaments", Ne), Nt = (n) => we.create({
|
|
353
353
|
crew: n
|
|
354
354
|
});
|
|
355
|
-
async function
|
|
356
|
-
const e = await
|
|
357
|
-
return e || y(await
|
|
355
|
+
async function Ft(n) {
|
|
356
|
+
const e = await we.findOne({ crew: n }).lean();
|
|
357
|
+
return e || y(await Nt(n));
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const jt = (n, e) => we.findOneAndUpdate({ crew: n }, e, {
|
|
360
360
|
upsert: !0,
|
|
361
361
|
returnDocument: "after"
|
|
362
362
|
}).lean();
|
|
363
|
-
class
|
|
363
|
+
class zt extends kt {
|
|
364
364
|
constructor() {
|
|
365
365
|
super(300);
|
|
366
366
|
}
|
|
@@ -371,14 +371,14 @@ class Bt extends Mt {
|
|
|
371
371
|
return e;
|
|
372
372
|
}
|
|
373
373
|
fetchFromDb(e) {
|
|
374
|
-
return
|
|
374
|
+
return Ft(e);
|
|
375
375
|
}
|
|
376
376
|
updateInDb(e, t) {
|
|
377
|
-
return
|
|
377
|
+
return jt(e, t);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
const
|
|
381
|
-
class
|
|
380
|
+
const xs = new zt();
|
|
381
|
+
class Pt 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 qt extends b {
|
|
|
387
387
|
}
|
|
388
388
|
async isStreaking(e, t) {
|
|
389
389
|
const { lastCompletionDate: a } = await this.get({ crew: e, questId: t });
|
|
390
|
-
return !!a &&
|
|
390
|
+
return !!a && pe(k(), a);
|
|
391
391
|
}
|
|
392
392
|
async completeQuest(e) {
|
|
393
393
|
return this.update(
|
|
@@ -396,7 +396,7 @@ class qt extends b {
|
|
|
396
396
|
{
|
|
397
397
|
$set: {
|
|
398
398
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
399
|
-
status:
|
|
399
|
+
status: O.COMPLETED
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
],
|
|
@@ -404,7 +404,7 @@ class qt extends b {
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const Fe = new u(
|
|
408
408
|
{
|
|
409
409
|
crew: {
|
|
410
410
|
type: u.Types.ObjectId,
|
|
@@ -417,37 +417,37 @@ const _e = new u(
|
|
|
417
417
|
required: !0,
|
|
418
418
|
index: !0
|
|
419
419
|
},
|
|
420
|
-
status: { type: String, default:
|
|
420
|
+
status: { type: String, default: O.IN_PROGRESS, index: !0 },
|
|
421
421
|
lastCompletionDate: Date
|
|
422
422
|
},
|
|
423
423
|
{ minimize: !1 }
|
|
424
424
|
);
|
|
425
|
-
|
|
425
|
+
Fe.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 X = l?.CrewQuest || p("CrewQuest", Fe);
|
|
433
|
+
function Kt(n) {
|
|
434
|
+
return X.find(n).lean();
|
|
435
435
|
}
|
|
436
|
-
const
|
|
436
|
+
const Ht = async (n) => await X.create({
|
|
437
437
|
...n
|
|
438
438
|
});
|
|
439
|
-
async function
|
|
440
|
-
const e = await
|
|
441
|
-
return e || y(await
|
|
439
|
+
async function Lt(n) {
|
|
440
|
+
const e = await X.findOne(n).lean();
|
|
441
|
+
return e || y(await Ht(n));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
443
|
+
function Qt(n, e, t) {
|
|
444
|
+
return X.findOneAndUpdate(n, e, {
|
|
445
445
|
upsert: !0,
|
|
446
446
|
...t,
|
|
447
447
|
returnDocument: "after"
|
|
448
448
|
}).lean();
|
|
449
449
|
}
|
|
450
|
-
class
|
|
450
|
+
class Wt extends Pt {
|
|
451
451
|
constructor() {
|
|
452
452
|
super(300);
|
|
453
453
|
}
|
|
@@ -461,17 +461,17 @@ class jt extends qt {
|
|
|
461
461
|
return { crew: e, questId: t };
|
|
462
462
|
}
|
|
463
463
|
fetchFromDb(e) {
|
|
464
|
-
return
|
|
464
|
+
return Lt(e);
|
|
465
465
|
}
|
|
466
466
|
fetchManyFromDb(e) {
|
|
467
|
-
return
|
|
467
|
+
return Kt(e);
|
|
468
468
|
}
|
|
469
469
|
updateInDb(e, t, a) {
|
|
470
|
-
return
|
|
470
|
+
return Qt(e, t, a);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
const
|
|
474
|
-
class
|
|
473
|
+
const qs = new Wt();
|
|
474
|
+
class Gt extends f {
|
|
475
475
|
async setActualVoiceMembers(e, t) {
|
|
476
476
|
await this.update(e, {
|
|
477
477
|
$set: {
|
|
@@ -488,7 +488,7 @@ class zt extends f {
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
const
|
|
491
|
+
const je = new u({
|
|
492
492
|
crew: {
|
|
493
493
|
type: u.Types.ObjectId,
|
|
494
494
|
required: !0,
|
|
@@ -501,28 +501,28 @@ const Ae = new u({
|
|
|
501
501
|
connectedAt: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
|
-
|
|
504
|
+
je.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 ge = l?.CrewStatsEngagement || p(
|
|
512
512
|
"CrewStatsEngagement",
|
|
513
|
-
|
|
514
|
-
),
|
|
513
|
+
je
|
|
514
|
+
), Yt = (n) => ge.create({
|
|
515
515
|
crew: n
|
|
516
516
|
});
|
|
517
|
-
async function
|
|
518
|
-
const e = await
|
|
519
|
-
return e || y(await
|
|
517
|
+
async function Xt(n) {
|
|
518
|
+
const e = await ge.findOne({ crew: n }).lean();
|
|
519
|
+
return e || y(await Yt(n));
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const Vt = (n, e) => ge.findOneAndUpdate({ crew: n }, e, {
|
|
522
522
|
upsert: !0,
|
|
523
523
|
returnDocument: "after"
|
|
524
524
|
}).lean();
|
|
525
|
-
class
|
|
525
|
+
class Jt extends Gt {
|
|
526
526
|
constructor() {
|
|
527
527
|
super(300);
|
|
528
528
|
}
|
|
@@ -535,16 +535,16 @@ class Lt extends zt {
|
|
|
535
535
|
return e;
|
|
536
536
|
}
|
|
537
537
|
fetchFromDb(e) {
|
|
538
|
-
return
|
|
538
|
+
return Xt(e);
|
|
539
539
|
}
|
|
540
540
|
updateInDb(e, t) {
|
|
541
|
-
return
|
|
541
|
+
return Vt(e, t);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
const
|
|
545
|
-
class
|
|
544
|
+
const ks = new Jt();
|
|
545
|
+
class Zt extends f {
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const ze = new u({
|
|
548
548
|
crew: {
|
|
549
549
|
type: u.Types.ObjectId,
|
|
550
550
|
required: !0,
|
|
@@ -553,28 +553,28 @@ const Be = new u({
|
|
|
553
553
|
},
|
|
554
554
|
streak80Percent: { type: Number, default: 0 }
|
|
555
555
|
});
|
|
556
|
-
|
|
556
|
+
ze.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 Se = l?.CrewStatsFrequency || p(
|
|
564
564
|
"CrewStatsFrequency",
|
|
565
|
-
|
|
566
|
-
),
|
|
565
|
+
ze
|
|
566
|
+
), en = (n) => Se.create({
|
|
567
567
|
crew: n
|
|
568
568
|
});
|
|
569
|
-
async function
|
|
570
|
-
const e = await
|
|
571
|
-
return e || y(await
|
|
569
|
+
async function tn(n) {
|
|
570
|
+
const e = await Se.findOne({ crew: n }).lean();
|
|
571
|
+
return e || y(await en(n));
|
|
572
572
|
}
|
|
573
|
-
const
|
|
573
|
+
const nn = (n, e) => Se.findOneAndUpdate({ crew: n }, e, {
|
|
574
574
|
upsert: !0,
|
|
575
575
|
returnDocument: "after"
|
|
576
576
|
}).lean();
|
|
577
|
-
class
|
|
577
|
+
class an extends Zt {
|
|
578
578
|
constructor() {
|
|
579
579
|
super(300);
|
|
580
580
|
}
|
|
@@ -585,13 +585,13 @@ class Xt extends Qt {
|
|
|
585
585
|
return e;
|
|
586
586
|
}
|
|
587
587
|
fetchFromDb(e) {
|
|
588
|
-
return
|
|
588
|
+
return tn(e);
|
|
589
589
|
}
|
|
590
590
|
updateInDb(e, t) {
|
|
591
|
-
return
|
|
591
|
+
return nn(e, t);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
const
|
|
594
|
+
const Ns = new an(), Pe = new u(
|
|
595
595
|
{
|
|
596
596
|
user: {
|
|
597
597
|
type: u.Types.ObjectId,
|
|
@@ -604,15 +604,15 @@ const Es = new Xt(), qe = new u(
|
|
|
604
604
|
required: !0,
|
|
605
605
|
index: !0
|
|
606
606
|
},
|
|
607
|
-
status: { type: String, default:
|
|
607
|
+
status: { type: String, default: O.IN_PROGRESS, index: 1 },
|
|
608
608
|
lastCompletionDate: Date,
|
|
609
609
|
streak: Number
|
|
610
610
|
},
|
|
611
611
|
{ minimize: !1 }
|
|
612
612
|
);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
Pe.post("findOneAndUpdate", function(n) {
|
|
614
|
+
fe(
|
|
615
|
+
me.USER_QUEST,
|
|
616
616
|
n.user._id,
|
|
617
617
|
n
|
|
618
618
|
), m(
|
|
@@ -621,7 +621,7 @@ qe.post("findOneAndUpdate", function(n) {
|
|
|
621
621
|
n
|
|
622
622
|
);
|
|
623
623
|
});
|
|
624
|
-
const
|
|
624
|
+
const B = l?.UserQuest || p("UserQuest", Pe), rn = new u({
|
|
625
625
|
user: {
|
|
626
626
|
type: u.Types.ObjectId,
|
|
627
627
|
required: !0,
|
|
@@ -641,7 +641,7 @@ const v = d?.UserQuest || l("UserQuest", qe), Vt = new u({
|
|
|
641
641
|
blackjack: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
642
642
|
rps: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
643
643
|
}
|
|
644
|
-
}),
|
|
644
|
+
}), V = l?.UserCooldown || p("UserCooldown", rn), Ke = new u(
|
|
645
645
|
{
|
|
646
646
|
user: {
|
|
647
647
|
type: u.Types.ObjectId,
|
|
@@ -656,18 +656,18 @@ const v = d?.UserQuest || l("UserQuest", qe), Vt = 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: ht }
|
|
660
660
|
},
|
|
661
661
|
{ minimize: !1 }
|
|
662
662
|
);
|
|
663
|
-
|
|
663
|
+
Ke.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 _ = l?.UserCrew || p("UserCrew", Ke), sn = new u({
|
|
671
671
|
user: {
|
|
672
672
|
type: u.Types.ObjectId,
|
|
673
673
|
required: !0,
|
|
@@ -683,7 +683,7 @@ const _ = d?.UserCrew || l("UserCrew", xe), Jt = new u({
|
|
|
683
683
|
},
|
|
684
684
|
previousCompletedQuest: { type: [String], default: [] },
|
|
685
685
|
previousMessageSent: { type: Number, default: 0 }
|
|
686
|
-
}),
|
|
686
|
+
}), J = l?.UserDailyReport || p("UserDailyReport", sn), un = new u({
|
|
687
687
|
user: {
|
|
688
688
|
type: u.Types.ObjectId,
|
|
689
689
|
required: !0,
|
|
@@ -691,7 +691,7 @@ const _ = d?.UserCrew || l("UserCrew", xe), Jt = new u({
|
|
|
691
691
|
ref: "User"
|
|
692
692
|
},
|
|
693
693
|
encyclopedia: { type: [String], default: [] }
|
|
694
|
-
}),
|
|
694
|
+
}), Z = l?.UserEncyclopedia || p("UserEncyclopedia", un), cn = new u({
|
|
695
695
|
user: {
|
|
696
696
|
type: u.Types.ObjectId,
|
|
697
697
|
required: !0,
|
|
@@ -708,7 +708,7 @@ const _ = d?.UserCrew || l("UserCrew", xe), Jt = new u({
|
|
|
708
708
|
},
|
|
709
709
|
default: null
|
|
710
710
|
}
|
|
711
|
-
}),
|
|
711
|
+
}), ee = l?.UserGames || p("UserGames", cn), He = new u(
|
|
712
712
|
{
|
|
713
713
|
user: {
|
|
714
714
|
type: u.Types.ObjectId,
|
|
@@ -730,9 +730,9 @@ const _ = d?.UserCrew || l("UserCrew", xe), Jt = new u({
|
|
|
730
730
|
},
|
|
731
731
|
{ minimize: !1 }
|
|
732
732
|
);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
733
|
+
He.post("findOneAndUpdate", function(n) {
|
|
734
|
+
fe(
|
|
735
|
+
me.USER_INVENTORY,
|
|
736
736
|
n.user._id,
|
|
737
737
|
n
|
|
738
738
|
), m(
|
|
@@ -741,14 +741,14 @@ ke.post("findOneAndUpdate", function(n) {
|
|
|
741
741
|
n
|
|
742
742
|
);
|
|
743
743
|
});
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
},
|
|
744
|
+
const te = l?.UserInventory || p("UserInventory", He), on = new ye.EventEmitter(), dn = (n, e) => {
|
|
745
|
+
on.emit(n, e);
|
|
746
|
+
}, D = {
|
|
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
|
+
}, Le = new u({
|
|
752
752
|
user: {
|
|
753
753
|
type: u.Types.ObjectId,
|
|
754
754
|
required: !0,
|
|
@@ -771,33 +771,33 @@ const Y = d?.UserInventory || l("UserInventory", ke), nn = new ue.EventEmitter()
|
|
|
771
771
|
buffs: {
|
|
772
772
|
cooldown: {
|
|
773
773
|
casino: {
|
|
774
|
-
type: [
|
|
774
|
+
type: [D],
|
|
775
775
|
default: []
|
|
776
776
|
},
|
|
777
777
|
work: {
|
|
778
|
-
type: [
|
|
778
|
+
type: [D],
|
|
779
779
|
default: []
|
|
780
780
|
}
|
|
781
781
|
},
|
|
782
782
|
berry: {
|
|
783
783
|
work: {
|
|
784
|
-
type: [
|
|
784
|
+
type: [D],
|
|
785
785
|
default: []
|
|
786
786
|
},
|
|
787
787
|
global: {
|
|
788
|
-
type: [
|
|
788
|
+
type: [D],
|
|
789
789
|
default: []
|
|
790
790
|
}
|
|
791
791
|
},
|
|
792
792
|
drop: {
|
|
793
793
|
work: {
|
|
794
|
-
type: [
|
|
794
|
+
type: [D],
|
|
795
795
|
default: []
|
|
796
796
|
}
|
|
797
797
|
},
|
|
798
798
|
xp: {
|
|
799
799
|
global: {
|
|
800
|
-
type: [
|
|
800
|
+
type: [D],
|
|
801
801
|
default: []
|
|
802
802
|
}
|
|
803
803
|
}
|
|
@@ -825,14 +825,14 @@ const Y = d?.UserInventory || l("UserInventory", ke), nn = new ue.EventEmitter()
|
|
|
825
825
|
wisdom: { type: Number, default: 0 }
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
|
|
828
|
+
Le.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 && dn("death", n.user._id);
|
|
834
834
|
});
|
|
835
|
-
const
|
|
835
|
+
const R = l?.UserMeta || p("UserMeta", Le), Qe = new u({
|
|
836
836
|
user: {
|
|
837
837
|
type: u.Types.ObjectId,
|
|
838
838
|
required: !0,
|
|
@@ -849,14 +849,14 @@ const D = d?.UserMeta || l("UserMeta", Ne), Fe = new u({
|
|
|
849
849
|
unlockedBags: { type: [String], default: ["default"] },
|
|
850
850
|
selectedBag: { type: String, default: "default" }
|
|
851
851
|
});
|
|
852
|
-
|
|
852
|
+
Qe.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 ne = l?.UserOrnament || p("UserOrnament", Qe), We = new u(
|
|
860
860
|
{
|
|
861
861
|
user: {
|
|
862
862
|
type: u.Types.ObjectId,
|
|
@@ -880,14 +880,14 @@ const X = d?.UserOrnament || l("UserOrnament", Fe), je = new u(
|
|
|
880
880
|
},
|
|
881
881
|
{ minimize: !1 }
|
|
882
882
|
);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
883
|
+
We.post("findOneAndUpdate", function(n) {
|
|
884
|
+
fe(
|
|
885
|
+
me.USER_RAID,
|
|
886
886
|
n.user._id,
|
|
887
887
|
n
|
|
888
888
|
);
|
|
889
889
|
});
|
|
890
|
-
const
|
|
890
|
+
const ae = l?.UserRaid || p("UserRaid", We), ln = new u({
|
|
891
891
|
user: {
|
|
892
892
|
type: u.Types.ObjectId,
|
|
893
893
|
required: !0,
|
|
@@ -913,7 +913,7 @@ const V = d?.UserRaid || l("UserRaid", je), rn = new u({
|
|
|
913
913
|
rps: { type: Boolean, default: !1 }
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
}),
|
|
916
|
+
}), j = l?.UserSettings || p("UserSettings", ln), pn = new u(
|
|
917
917
|
{
|
|
918
918
|
user: {
|
|
919
919
|
type: u.Types.ObjectId,
|
|
@@ -925,7 +925,7 @@ const V = d?.UserRaid || l("UserRaid", je), rn = new u({
|
|
|
925
925
|
limit: { type: u.Types.Mixed, default: {} }
|
|
926
926
|
},
|
|
927
927
|
{ minimize: !1 }
|
|
928
|
-
),
|
|
928
|
+
), re = l?.UserShop || p("UserShop", pn), Ge = new u({
|
|
929
929
|
user: {
|
|
930
930
|
type: u.Types.ObjectId,
|
|
931
931
|
required: !0,
|
|
@@ -960,14 +960,14 @@ const V = d?.UserRaid || l("UserRaid", je), rn = new u({
|
|
|
960
960
|
guessInOneTryCount: { type: Number, default: 0 }
|
|
961
961
|
}
|
|
962
962
|
});
|
|
963
|
-
|
|
963
|
+
Ge.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 v = l?.UserStatsCasino || p("UserStatsCasino", Ge), Ye = new u({
|
|
971
971
|
user: {
|
|
972
972
|
type: u.Types.ObjectId,
|
|
973
973
|
required: !0,
|
|
@@ -979,14 +979,14 @@ const C = d?.UserStatsCasino || l("UserStatsCasino", ze), Ke = new u({
|
|
|
979
979
|
timeCrewBeyond10PercentXp: { type: Number, default: 0 },
|
|
980
980
|
timeCrewAbove90PercentXp: { type: Number, default: 0 }
|
|
981
981
|
});
|
|
982
|
-
|
|
982
|
+
Ye.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 se = l?.UserStatsCrew || p("UserStatsCrew", Ye), Xe = new u({
|
|
990
990
|
user: {
|
|
991
991
|
type: u.Types.ObjectId,
|
|
992
992
|
required: !0,
|
|
@@ -997,14 +997,14 @@ const Z = d?.UserStatsCrew || l("UserStatsCrew", Ke), Pe = new u({
|
|
|
997
997
|
raidFinishedCount: { type: Number, default: 0 },
|
|
998
998
|
totalSpentInShop: { type: Number, default: 0 }
|
|
999
999
|
});
|
|
1000
|
-
|
|
1000
|
+
Xe.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 ie = l?.UserStatsEconomy || p("UserStatsEconomy", Xe), Ve = new u({
|
|
1008
1008
|
user: {
|
|
1009
1009
|
type: u.Types.ObjectId,
|
|
1010
1010
|
required: !0,
|
|
@@ -1016,17 +1016,17 @@ const ee = d?.UserStatsEconomy || l("UserStatsEconomy", Pe), He = new u({
|
|
|
1016
1016
|
randomMessageClaimed: { type: Number, default: 0 },
|
|
1017
1017
|
writeDifferentChatIds: { type: [String], default: [] }
|
|
1018
1018
|
});
|
|
1019
|
-
|
|
1019
|
+
Ve.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 ue = l?.UserStatsEngagement || p(
|
|
1027
1027
|
"UserStatsEngagement",
|
|
1028
|
-
|
|
1029
|
-
),
|
|
1028
|
+
Ve
|
|
1029
|
+
), Je = new u({
|
|
1030
1030
|
user: {
|
|
1031
1031
|
type: u.Types.ObjectId,
|
|
1032
1032
|
required: !0,
|
|
@@ -1045,14 +1045,14 @@ const te = d?.UserStatsEngagement || l(
|
|
|
1045
1045
|
loseEverything: { type: Boolean, default: !1 }
|
|
1046
1046
|
}
|
|
1047
1047
|
});
|
|
1048
|
-
|
|
1048
|
+
Je.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 ce = l?.UserStatsFlags || p("UserStatsFlags", Je), Ze = new u({
|
|
1056
1056
|
user: {
|
|
1057
1057
|
type: u.Types.ObjectId,
|
|
1058
1058
|
required: !0,
|
|
@@ -1064,17 +1064,17 @@ const ne = d?.UserStatsFlags || l("UserStatsFlags", Le), Qe = new u({
|
|
|
1064
1064
|
lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date() }
|
|
1065
1065
|
}
|
|
1066
1066
|
});
|
|
1067
|
-
|
|
1067
|
+
Ze.post("findOneAndUpdate", function(n) {
|
|
1068
1068
|
m(
|
|
1069
1069
|
h.USER_STATS_FREQUENCY,
|
|
1070
1070
|
n.user._id,
|
|
1071
1071
|
n
|
|
1072
1072
|
);
|
|
1073
1073
|
});
|
|
1074
|
-
const
|
|
1074
|
+
const M = l?.UserStatsFrequency || p(
|
|
1075
1075
|
"UserStatsFrequency",
|
|
1076
|
-
|
|
1077
|
-
),
|
|
1076
|
+
Ze
|
|
1077
|
+
), et = new u({
|
|
1078
1078
|
user: {
|
|
1079
1079
|
type: u.Types.ObjectId,
|
|
1080
1080
|
required: !0,
|
|
@@ -1101,32 +1101,32 @@ const R = d?.UserStatsFrequency || l(
|
|
|
1101
1101
|
totalCrafted: { type: Number, default: 0 }
|
|
1102
1102
|
}
|
|
1103
1103
|
});
|
|
1104
|
-
|
|
1104
|
+
et.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 A = l?.UserStatsInventory || p(
|
|
1112
1112
|
"UserStatsInventory",
|
|
1113
|
-
|
|
1114
|
-
),
|
|
1113
|
+
et
|
|
1114
|
+
), be = 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: wt, index: 1 },
|
|
1118
1118
|
canChangeFaction: { type: Boolean, default: !1 },
|
|
1119
1119
|
canChooseFaction: { type: Boolean, default: !1 }
|
|
1120
1120
|
});
|
|
1121
|
-
|
|
1121
|
+
be.post("findOneAndUpdate", function(n) {
|
|
1122
1122
|
m(h.USER, n._id, n);
|
|
1123
1123
|
});
|
|
1124
|
-
|
|
1124
|
+
be.post("deleteOne", async function() {
|
|
1125
1125
|
const n = this.getQuery()._id;
|
|
1126
|
-
await
|
|
1126
|
+
await V.deleteOne({ user: n }), await _.deleteOne({ user: n }), await J.deleteOne({ user: n }), await Z.deleteOne({ user: n }), await ee.deleteOne({ user: n }), await te.deleteOne({ user: n }), await R.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await B.deleteMany({ user: n }), await ae.deleteOne({ user: n }), await j.deleteOne({ user: n }), await re.deleteOne({ user: n }), await v.deleteOne({ user: n }), await se.deleteOne({ user: n }), await ie.deleteOne({ user: n }), await ue.deleteOne({ user: n }), await ce.deleteOne({ user: n }), await M.deleteOne({ user: n }), await A.deleteOne({ user: n });
|
|
1127
1127
|
});
|
|
1128
|
-
const $ =
|
|
1129
|
-
class
|
|
1128
|
+
const $ = l?.User || p("User", be);
|
|
1129
|
+
class yn extends b {
|
|
1130
1130
|
getByObjectId(e) {
|
|
1131
1131
|
return this.update({ _id: e }, {});
|
|
1132
1132
|
}
|
|
@@ -1278,10 +1278,10 @@ class un extends b {
|
|
|
1278
1278
|
]);
|
|
1279
1279
|
}
|
|
1280
1280
|
getQuestRanking() {
|
|
1281
|
-
return
|
|
1281
|
+
return B.aggregate([
|
|
1282
1282
|
{
|
|
1283
1283
|
$match: {
|
|
1284
|
-
status:
|
|
1284
|
+
status: O.COMPLETED
|
|
1285
1285
|
}
|
|
1286
1286
|
},
|
|
1287
1287
|
{
|
|
@@ -1352,18 +1352,18 @@ class un extends b {
|
|
|
1352
1352
|
await this.update({ discordId: e }, { $set: { faction: t } });
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
const
|
|
1355
|
+
const fn = (n) => $.find(n), mn = (n) => $.create({
|
|
1356
1356
|
discordId: n
|
|
1357
1357
|
});
|
|
1358
|
-
async function
|
|
1358
|
+
async function hn(n) {
|
|
1359
1359
|
const e = await $.findOne({ discordId: n }).lean();
|
|
1360
|
-
return e || y(await
|
|
1360
|
+
return e || y(await mn(n));
|
|
1361
1361
|
}
|
|
1362
|
-
const
|
|
1362
|
+
const wn = (n, e) => $.findOneAndUpdate(n, e, {
|
|
1363
1363
|
upsert: !0,
|
|
1364
1364
|
returnDocument: "after"
|
|
1365
1365
|
});
|
|
1366
|
-
class
|
|
1366
|
+
class gn extends yn {
|
|
1367
1367
|
constructor() {
|
|
1368
1368
|
super(3600);
|
|
1369
1369
|
}
|
|
@@ -1374,23 +1374,23 @@ class pn extends un {
|
|
|
1374
1374
|
return e;
|
|
1375
1375
|
}
|
|
1376
1376
|
fetchFromDb(e) {
|
|
1377
|
-
return
|
|
1377
|
+
return hn(e);
|
|
1378
1378
|
}
|
|
1379
1379
|
fetchManyFromDb(e) {
|
|
1380
|
-
return
|
|
1380
|
+
return fn(e);
|
|
1381
1381
|
}
|
|
1382
1382
|
updateInDb(e, t) {
|
|
1383
|
-
return
|
|
1383
|
+
return wn(e, t);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
const
|
|
1386
|
+
const Sn = new gn(), Fs = [
|
|
1387
1387
|
"work",
|
|
1388
1388
|
"rps",
|
|
1389
1389
|
"blackjack",
|
|
1390
1390
|
"guess",
|
|
1391
1391
|
"qod",
|
|
1392
1392
|
"dice"
|
|
1393
|
-
],
|
|
1393
|
+
], bn = new u(
|
|
1394
1394
|
{
|
|
1395
1395
|
user: {
|
|
1396
1396
|
type: u.Types.ObjectId,
|
|
@@ -1402,12 +1402,12 @@ const Is = new pn(), Us = [
|
|
|
1402
1402
|
type: { type: String, required: !0 }
|
|
1403
1403
|
},
|
|
1404
1404
|
{ minimize: !1 }
|
|
1405
|
-
),
|
|
1406
|
-
await
|
|
1407
|
-
},
|
|
1408
|
-
await
|
|
1405
|
+
), z = l?.Reminder || p("Reminder", bn), $n = async (n) => {
|
|
1406
|
+
await z.deleteMany(n);
|
|
1407
|
+
}, En = async (n, e) => {
|
|
1408
|
+
await z.deleteOne({ user: n, type: e });
|
|
1409
1409
|
};
|
|
1410
|
-
class
|
|
1410
|
+
class Un extends b {
|
|
1411
1411
|
getAllPassedReminder() {
|
|
1412
1412
|
return this.getMany({ date: { $lte: /* @__PURE__ */ new Date() } });
|
|
1413
1413
|
}
|
|
@@ -1426,29 +1426,29 @@ class hn extends b {
|
|
|
1426
1426
|
]);
|
|
1427
1427
|
}
|
|
1428
1428
|
async removeReminder(e, t) {
|
|
1429
|
-
await
|
|
1429
|
+
await En(e, t), this.invalidate({ user: e, type: t });
|
|
1430
1430
|
}
|
|
1431
1431
|
async deleteSelectedReminders(e) {
|
|
1432
1432
|
const t = await this.getMany({ _id: { $in: e } });
|
|
1433
|
-
await
|
|
1433
|
+
await $n({ _id: { $in: e } }), t.forEach((a) => {
|
|
1434
1434
|
this.invalidate({ user: a.user, type: a.type });
|
|
1435
1435
|
});
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1439
|
-
return
|
|
1438
|
+
function In(n, e = {}) {
|
|
1439
|
+
return z.find(n, e).lean();
|
|
1440
1440
|
}
|
|
1441
|
-
async function
|
|
1442
|
-
const e = await
|
|
1441
|
+
async function Tn(n) {
|
|
1442
|
+
const e = await z.findOne(n).lean();
|
|
1443
1443
|
return e || null;
|
|
1444
1444
|
}
|
|
1445
|
-
async function
|
|
1446
|
-
return
|
|
1445
|
+
async function On(n, e, t) {
|
|
1446
|
+
return z.findOneAndUpdate(n, e, {
|
|
1447
1447
|
...t,
|
|
1448
1448
|
returnDocument: "after"
|
|
1449
1449
|
}).lean();
|
|
1450
1450
|
}
|
|
1451
|
-
class
|
|
1451
|
+
class Dn extends Un {
|
|
1452
1452
|
constructor() {
|
|
1453
1453
|
super(300);
|
|
1454
1454
|
}
|
|
@@ -1462,17 +1462,17 @@ class bn extends hn {
|
|
|
1462
1462
|
return `${e.toString()}/${t}`;
|
|
1463
1463
|
}
|
|
1464
1464
|
fetchFromDb(e) {
|
|
1465
|
-
return
|
|
1465
|
+
return Tn(e);
|
|
1466
1466
|
}
|
|
1467
1467
|
fetchManyFromDb(e, t) {
|
|
1468
|
-
return
|
|
1468
|
+
return In(e, t);
|
|
1469
1469
|
}
|
|
1470
1470
|
updateInDb(e, t, a = { upsert: !1 }) {
|
|
1471
|
-
return
|
|
1471
|
+
return On(e, t, a);
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const
|
|
1475
|
-
class
|
|
1474
|
+
const H = new Dn();
|
|
1475
|
+
class Cn extends b {
|
|
1476
1476
|
async isOrnamentIds(e, t = () => !0) {
|
|
1477
1477
|
const r = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
|
|
1478
1478
|
return e.every((s) => r.includes(s));
|
|
@@ -1511,7 +1511,7 @@ class $n extends b {
|
|
|
1511
1511
|
return (await this.getAll()).filter(this.isShopTitle);
|
|
1512
1512
|
}
|
|
1513
1513
|
formatBackgroundId(e) {
|
|
1514
|
-
return e.ornamentId === "background_default" ? "par défaut" : `"${
|
|
1514
|
+
return e.ornamentId === "background_default" ? "par défaut" : `"${ot(e.ornamentId.split("_").join(" "))}"`;
|
|
1515
1515
|
}
|
|
1516
1516
|
pickOrnament(e) {
|
|
1517
1517
|
const t = Math.random();
|
|
@@ -1527,24 +1527,24 @@ class $n extends b {
|
|
|
1527
1527
|
continue;
|
|
1528
1528
|
}
|
|
1529
1529
|
if (i.length !== 0)
|
|
1530
|
-
return i[
|
|
1530
|
+
return i[Y(0, i.length)];
|
|
1531
1531
|
}
|
|
1532
1532
|
throw Error("pickOrnament - All ods array were empty");
|
|
1533
1533
|
}
|
|
1534
1534
|
pickEachRarityOrnament(e, t) {
|
|
1535
|
-
if (t.length !==
|
|
1535
|
+
if (t.length !== De.length)
|
|
1536
1536
|
throw new RangeError(
|
|
1537
1537
|
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
1538
1538
|
);
|
|
1539
|
-
return
|
|
1539
|
+
return N(
|
|
1540
1540
|
t.map((a, r) => {
|
|
1541
|
-
const s =
|
|
1542
|
-
return Math.random() > a || !i || !i.length ? null :
|
|
1541
|
+
const s = De[r], i = e[s];
|
|
1542
|
+
return Math.random() > a || !i || !i.length ? null : dt(i);
|
|
1543
1543
|
})
|
|
1544
1544
|
);
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
|
-
const
|
|
1547
|
+
const Rn = new u(
|
|
1548
1548
|
{
|
|
1549
1549
|
ornamentId: { unique: !0, index: 1, required: !0, type: String },
|
|
1550
1550
|
type: { required: !0, type: String },
|
|
@@ -1558,23 +1558,26 @@ const En = new u(
|
|
|
1558
1558
|
strength: Number
|
|
1559
1559
|
},
|
|
1560
1560
|
{ minimize: !1 }
|
|
1561
|
-
),
|
|
1562
|
-
async function
|
|
1563
|
-
const e = await
|
|
1561
|
+
), $e = l?.Ornaments || p("Ornaments", Rn), vn = async (n, e = {}) => $e.find(n, e).lean();
|
|
1562
|
+
async function Mn(n) {
|
|
1563
|
+
const e = await $e.findOne({ ornamentId: n }).lean();
|
|
1564
1564
|
return e || null;
|
|
1565
1565
|
}
|
|
1566
|
-
|
|
1566
|
+
const An = (n, e) => $e.findOneAndUpdate(n, e, {
|
|
1567
|
+
returnDocument: "after"
|
|
1568
|
+
}).lean();
|
|
1569
|
+
class Bn extends Cn {
|
|
1567
1570
|
constructor() {
|
|
1568
1571
|
super(3600);
|
|
1569
1572
|
}
|
|
1570
1573
|
updateInDb(e, t) {
|
|
1571
|
-
|
|
1574
|
+
return An(e, t);
|
|
1572
1575
|
}
|
|
1573
1576
|
fetchFromDb(e) {
|
|
1574
|
-
return
|
|
1577
|
+
return Mn(e);
|
|
1575
1578
|
}
|
|
1576
1579
|
fetchManyFromDb(e) {
|
|
1577
|
-
return
|
|
1580
|
+
return vn(e);
|
|
1578
1581
|
}
|
|
1579
1582
|
getKey(e) {
|
|
1580
1583
|
return e.ornamentId;
|
|
@@ -1583,7 +1586,7 @@ class Tn extends $n {
|
|
|
1583
1586
|
return e;
|
|
1584
1587
|
}
|
|
1585
1588
|
}
|
|
1586
|
-
const
|
|
1589
|
+
const g = new Bn(), _n = new u(
|
|
1587
1590
|
{
|
|
1588
1591
|
panoplyId: { unique: !0, index: 1, required: !0, type: String },
|
|
1589
1592
|
name: { required: !0, type: String },
|
|
@@ -1597,21 +1600,21 @@ const w = new Tn(), On = new u(
|
|
|
1597
1600
|
halfBonus: u.Types.Mixed
|
|
1598
1601
|
},
|
|
1599
1602
|
{ minimize: !1 }
|
|
1600
|
-
),
|
|
1601
|
-
async function
|
|
1602
|
-
const e = await
|
|
1603
|
+
), P = l?.Panoplies || p("Panoplies", _n), xn = (n) => P.find(n).lean(), qn = async (n) => P.find(n).populate("equipments");
|
|
1604
|
+
async function kn(n) {
|
|
1605
|
+
const e = await P.findOne({ panoplyId: n }).lean();
|
|
1603
1606
|
return e || null;
|
|
1604
1607
|
}
|
|
1605
|
-
const
|
|
1606
|
-
class
|
|
1608
|
+
const Nn = async (n) => P.findOne(n).populate("equipments");
|
|
1609
|
+
class Fn extends b {
|
|
1607
1610
|
getAllPopulated() {
|
|
1608
|
-
return
|
|
1611
|
+
return qn({});
|
|
1609
1612
|
}
|
|
1610
1613
|
getPopulated(e) {
|
|
1611
|
-
return
|
|
1614
|
+
return Nn({ panoplyId: e });
|
|
1612
1615
|
}
|
|
1613
1616
|
hasPanoply(e, t) {
|
|
1614
|
-
const a =
|
|
1617
|
+
const a = N(Object.values(e)), r = t.equipments.filter(
|
|
1615
1618
|
(s) => a.find((i) => i.entityId === s.entityId)
|
|
1616
1619
|
).length;
|
|
1617
1620
|
if (r === t.equipments.length)
|
|
@@ -1622,7 +1625,7 @@ class vn extends b {
|
|
|
1622
1625
|
async getPanoplyBonus(e) {
|
|
1623
1626
|
const t = [], a = await this.getAllPopulated();
|
|
1624
1627
|
for (const r of a) {
|
|
1625
|
-
const s =
|
|
1628
|
+
const s = N(Object.values(e)), i = r.equipments.filter(
|
|
1626
1629
|
(o) => s.find(({ entityId: c }) => c === o.entityId)
|
|
1627
1630
|
);
|
|
1628
1631
|
i.length === r.equipments.length ? t.push([r, "full"]) : i.length >= r.equipments.length / 2 ? t.push([r, "half"]) : i.length >= 1 && t.push([r, null]);
|
|
@@ -1630,7 +1633,10 @@ class vn extends b {
|
|
|
1630
1633
|
return t;
|
|
1631
1634
|
}
|
|
1632
1635
|
}
|
|
1633
|
-
|
|
1636
|
+
const jn = async (n, e) => P.findOneAndUpdate(n, e, {
|
|
1637
|
+
returnDocument: "after"
|
|
1638
|
+
}).lean();
|
|
1639
|
+
class zn extends Fn {
|
|
1634
1640
|
constructor() {
|
|
1635
1641
|
super(3600);
|
|
1636
1642
|
}
|
|
@@ -1641,22 +1647,22 @@ class _n extends vn {
|
|
|
1641
1647
|
return e;
|
|
1642
1648
|
}
|
|
1643
1649
|
updateInDb(e, t) {
|
|
1644
|
-
|
|
1650
|
+
return jn(e, t);
|
|
1645
1651
|
}
|
|
1646
1652
|
fetchFromDb(e) {
|
|
1647
|
-
return
|
|
1653
|
+
return kn(e);
|
|
1648
1654
|
}
|
|
1649
1655
|
fetchManyFromDb(e = {}) {
|
|
1650
|
-
return
|
|
1656
|
+
return xn(e);
|
|
1651
1657
|
}
|
|
1652
1658
|
}
|
|
1653
|
-
const
|
|
1654
|
-
class
|
|
1659
|
+
const U = new zn();
|
|
1660
|
+
class Pn extends b {
|
|
1655
1661
|
isEntity(e) {
|
|
1656
1662
|
return !!e && "entityId" in e;
|
|
1657
1663
|
}
|
|
1658
1664
|
isItem(e) {
|
|
1659
|
-
return
|
|
1665
|
+
return e.category !== "equipment";
|
|
1660
1666
|
}
|
|
1661
1667
|
isEquipment(e) {
|
|
1662
1668
|
return e.category === "equipment";
|
|
@@ -1664,25 +1670,17 @@ class An extends b {
|
|
|
1664
1670
|
async isEntityId(e, t = () => !0) {
|
|
1665
1671
|
return (await this.getAll()).filter(t).map(({ entityId: r }) => r).includes(e);
|
|
1666
1672
|
}
|
|
1667
|
-
async isEquipmentId(e) {
|
|
1668
|
-
const a = (await this.getAll()).find((r) => r.entityId === e);
|
|
1669
|
-
return !!a && this.isEquipment(a);
|
|
1670
|
-
}
|
|
1671
|
-
async isItemId(e) {
|
|
1672
|
-
const a = (await this.getAll()).find((r) => r.entityId === e);
|
|
1673
|
-
return !!a && this.isItem(a);
|
|
1674
|
-
}
|
|
1675
1673
|
async getSomeStoreItems(e) {
|
|
1676
1674
|
const t = (await this.getAll()).filter(this.isStoreItem);
|
|
1677
1675
|
return this.getSomeItems(e, t);
|
|
1678
1676
|
}
|
|
1679
1677
|
async getSomeRepairItems(e) {
|
|
1680
1678
|
const t = (await this.getAll()).filter(this.isRepairItem);
|
|
1681
|
-
return
|
|
1679
|
+
return Te(t).slice(0, e);
|
|
1682
1680
|
}
|
|
1683
1681
|
async getSomeObjectItems(e) {
|
|
1684
1682
|
const t = (await this.getAll()).filter(this.isObjectItem);
|
|
1685
|
-
return
|
|
1683
|
+
return Te(t.filter((a) => !!a.shop?.price)).slice(
|
|
1686
1684
|
0,
|
|
1687
1685
|
e
|
|
1688
1686
|
);
|
|
@@ -1697,14 +1695,14 @@ class An extends b {
|
|
|
1697
1695
|
}
|
|
1698
1696
|
async recordToEntityTuple(e) {
|
|
1699
1697
|
const t = await this.getAll();
|
|
1700
|
-
return
|
|
1698
|
+
return C(e).reduce((a, [r, s]) => {
|
|
1701
1699
|
const i = t.find(({ entityId: o }) => o === r);
|
|
1702
1700
|
return i && a.push([i, s]), a;
|
|
1703
1701
|
}, []);
|
|
1704
1702
|
}
|
|
1705
1703
|
async getAllEntitiesLimit() {
|
|
1706
1704
|
const e = await this.getAll();
|
|
1707
|
-
return
|
|
1705
|
+
return Me(
|
|
1708
1706
|
e.map((t) => [t.entityId, t.shop?.limit ?? 0])
|
|
1709
1707
|
);
|
|
1710
1708
|
}
|
|
@@ -1728,18 +1726,18 @@ class An extends b {
|
|
|
1728
1726
|
intelligence: 0,
|
|
1729
1727
|
wisdom: 0
|
|
1730
1728
|
};
|
|
1731
|
-
const a = await
|
|
1732
|
-
for (const r of
|
|
1729
|
+
const a = await U.getAllPopulated();
|
|
1730
|
+
for (const r of Be) {
|
|
1733
1731
|
const s = e[r];
|
|
1734
|
-
s && (t =
|
|
1732
|
+
s && (t = F(
|
|
1735
1733
|
t,
|
|
1736
1734
|
(await this.fromDBToEquipableEquipment(s)).characteristics,
|
|
1737
1735
|
(i, o) => i + o
|
|
1738
1736
|
));
|
|
1739
1737
|
}
|
|
1740
1738
|
for (const r of a) {
|
|
1741
|
-
const s =
|
|
1742
|
-
s && !("target" in s) && (t =
|
|
1739
|
+
const s = U.hasPanoply(e, r);
|
|
1740
|
+
s && !("target" in s) && (t = F(
|
|
1743
1741
|
t,
|
|
1744
1742
|
s,
|
|
1745
1743
|
(i, o) => i + o
|
|
@@ -1750,14 +1748,14 @@ class An extends b {
|
|
|
1750
1748
|
getSomeItems(e, t) {
|
|
1751
1749
|
const a = [];
|
|
1752
1750
|
for (; a.length < e; ) {
|
|
1753
|
-
const r =
|
|
1751
|
+
const r = q(t, a, (s) => s.entityId);
|
|
1754
1752
|
a.push(
|
|
1755
|
-
|
|
1756
|
-
|
|
1753
|
+
g.pickOrnament(
|
|
1754
|
+
lt(r, (s) => s.shop?.odd ?? 0)
|
|
1757
1755
|
)
|
|
1758
1756
|
);
|
|
1759
1757
|
}
|
|
1760
|
-
return
|
|
1758
|
+
return Oe(a, (r) => r.shop?.price ?? 0);
|
|
1761
1759
|
}
|
|
1762
1760
|
filterCraftEntities(e) {
|
|
1763
1761
|
return e.filter((t) => t.usage?.craft);
|
|
@@ -1814,11 +1812,11 @@ class An extends b {
|
|
|
1814
1812
|
return e.entityId === t.entityId && e.seed === t.seed;
|
|
1815
1813
|
}
|
|
1816
1814
|
getEquipmentSlotType(e) {
|
|
1817
|
-
return
|
|
1815
|
+
return gt[e];
|
|
1818
1816
|
}
|
|
1819
1817
|
seedEquipment(e, t) {
|
|
1820
|
-
const a =
|
|
1821
|
-
|
|
1818
|
+
const a = pt(t), r = Oe(
|
|
1819
|
+
C(e.characteristics),
|
|
1822
1820
|
([s]) => s
|
|
1823
1821
|
);
|
|
1824
1822
|
return {
|
|
@@ -1827,7 +1825,7 @@ class An extends b {
|
|
|
1827
1825
|
characteristics: Object.fromEntries(
|
|
1828
1826
|
r.map(([s, i]) => [
|
|
1829
1827
|
s,
|
|
1830
|
-
Array.isArray(i) ?
|
|
1828
|
+
Array.isArray(i) ? Y(i[0], i[1] + 1, a) : i
|
|
1831
1829
|
])
|
|
1832
1830
|
)
|
|
1833
1831
|
};
|
|
@@ -1841,17 +1839,17 @@ class An extends b {
|
|
|
1841
1839
|
return Object.values(e.characteristics).reduce((a, r) => a + r, 0) + e.level;
|
|
1842
1840
|
}
|
|
1843
1841
|
}
|
|
1844
|
-
const
|
|
1842
|
+
const Kn = new u(
|
|
1845
1843
|
{
|
|
1846
1844
|
type: {
|
|
1847
1845
|
type: String,
|
|
1848
|
-
enum:
|
|
1846
|
+
enum: St,
|
|
1849
1847
|
required: !0
|
|
1850
1848
|
},
|
|
1851
1849
|
params: { type: u.Types.Mixed }
|
|
1852
1850
|
},
|
|
1853
1851
|
{ _id: !1 }
|
|
1854
|
-
),
|
|
1852
|
+
), Hn = new u(
|
|
1855
1853
|
{
|
|
1856
1854
|
entityId: { unique: !0, required: !0, type: String },
|
|
1857
1855
|
type: { required: !0, type: String },
|
|
@@ -1873,7 +1871,7 @@ const Bn = new u(
|
|
|
1873
1871
|
image: { required: !0, type: String },
|
|
1874
1872
|
emojis: { required: !0, type: String },
|
|
1875
1873
|
category: { required: !0, type: String },
|
|
1876
|
-
effects: { type: [
|
|
1874
|
+
effects: { type: [Kn], default: [] },
|
|
1877
1875
|
rankId: String,
|
|
1878
1876
|
usage: {
|
|
1879
1877
|
_id: !1,
|
|
@@ -1934,23 +1932,26 @@ const Bn = new u(
|
|
|
1934
1932
|
panoply: String
|
|
1935
1933
|
},
|
|
1936
1934
|
{ minimize: !1 }
|
|
1937
|
-
),
|
|
1938
|
-
async function
|
|
1939
|
-
const e = await
|
|
1935
|
+
), Ee = l?.Entities || p("Entities", Hn), Ln = async (n, e = {}) => Ee.find(n, e).lean();
|
|
1936
|
+
async function Qn(n) {
|
|
1937
|
+
const e = await Ee.findOne({ entityId: n }).lean();
|
|
1940
1938
|
return e || null;
|
|
1941
1939
|
}
|
|
1942
|
-
|
|
1940
|
+
const Wn = (n, e) => Ee.findOneAndUpdate(n, e, {
|
|
1941
|
+
returnDocument: "after"
|
|
1942
|
+
}).lean();
|
|
1943
|
+
class Gn extends Pn {
|
|
1943
1944
|
constructor() {
|
|
1944
1945
|
super(3600);
|
|
1945
1946
|
}
|
|
1946
1947
|
updateInDb(e, t) {
|
|
1947
|
-
|
|
1948
|
+
return Wn(e, t);
|
|
1948
1949
|
}
|
|
1949
1950
|
fetchFromDb(e) {
|
|
1950
|
-
return
|
|
1951
|
+
return Qn(e);
|
|
1951
1952
|
}
|
|
1952
1953
|
fetchManyFromDb(e) {
|
|
1953
|
-
return
|
|
1954
|
+
return Ln(e);
|
|
1954
1955
|
}
|
|
1955
1956
|
normalizeKey(e) {
|
|
1956
1957
|
return e;
|
|
@@ -1959,14 +1960,14 @@ class Nn extends An {
|
|
|
1959
1960
|
return e.entityId;
|
|
1960
1961
|
}
|
|
1961
1962
|
}
|
|
1962
|
-
const
|
|
1963
|
+
const d = new Gn(), Yn = (n, e, t) => _.create({
|
|
1963
1964
|
user: n,
|
|
1964
1965
|
crew: e,
|
|
1965
1966
|
permission: t
|
|
1966
|
-
}),
|
|
1967
|
+
}), Xn = async (n) => {
|
|
1967
1968
|
await _.deleteOne({ user: n });
|
|
1968
1969
|
};
|
|
1969
|
-
class
|
|
1970
|
+
class Vn extends b {
|
|
1970
1971
|
async updatePercent(e, t) {
|
|
1971
1972
|
await this.update(e, {
|
|
1972
1973
|
$set: {
|
|
@@ -1982,10 +1983,10 @@ class zn extends b {
|
|
|
1982
1983
|
});
|
|
1983
1984
|
}
|
|
1984
1985
|
async addUserToCrew(e, t, a) {
|
|
1985
|
-
await
|
|
1986
|
+
await Yn(e, t, a), this.invalidate(t);
|
|
1986
1987
|
}
|
|
1987
1988
|
async removeUserFromCrew(e, t) {
|
|
1988
|
-
await
|
|
1989
|
+
await Xn(e), this.invalidate(e), this.invalidate(t);
|
|
1989
1990
|
}
|
|
1990
1991
|
async getAllUserIdsFromCrew(e) {
|
|
1991
1992
|
const t = e.toString(), a = this.cache.get(t);
|
|
@@ -1995,8 +1996,8 @@ class zn extends b {
|
|
|
1995
1996
|
return this.cache.set(t, r), r.map(({ user: s }) => s);
|
|
1996
1997
|
}
|
|
1997
1998
|
}
|
|
1998
|
-
const
|
|
1999
|
-
class
|
|
1999
|
+
const Jn = (n) => _.find(n).lean(), Zn = (n) => _.findOne({ user: n }).lean(), ea = (n, e) => _.findOneAndUpdate({ user: n }, e).lean();
|
|
2000
|
+
class ta extends Vn {
|
|
2000
2001
|
constructor() {
|
|
2001
2002
|
super(300);
|
|
2002
2003
|
}
|
|
@@ -2007,17 +2008,17 @@ class Ln extends zn {
|
|
|
2007
2008
|
return e;
|
|
2008
2009
|
}
|
|
2009
2010
|
fetchFromDb(e) {
|
|
2010
|
-
return
|
|
2011
|
+
return Zn(e);
|
|
2011
2012
|
}
|
|
2012
2013
|
fetchManyFromDb(e) {
|
|
2013
|
-
return
|
|
2014
|
+
return Jn(e);
|
|
2014
2015
|
}
|
|
2015
2016
|
updateInDb(e, t) {
|
|
2016
|
-
return
|
|
2017
|
+
return ea(e, t);
|
|
2017
2018
|
}
|
|
2018
2019
|
}
|
|
2019
|
-
const
|
|
2020
|
-
class
|
|
2020
|
+
const na = new ta();
|
|
2021
|
+
class aa extends f {
|
|
2021
2022
|
hasAlreadyFoundEntity(e, t) {
|
|
2022
2023
|
return e.encyclopedia.includes(t);
|
|
2023
2024
|
}
|
|
@@ -2027,23 +2028,23 @@ class Wn extends f {
|
|
|
2027
2028
|
});
|
|
2028
2029
|
}
|
|
2029
2030
|
}
|
|
2030
|
-
const
|
|
2031
|
+
const ra = async (n) => await Z.create({
|
|
2031
2032
|
user: n
|
|
2032
2033
|
});
|
|
2033
|
-
async function
|
|
2034
|
-
const e = await
|
|
2035
|
-
return e || y(await
|
|
2034
|
+
async function sa(n) {
|
|
2035
|
+
const e = await Z.findOne({ user: n }).lean();
|
|
2036
|
+
return e || y(await ra(n));
|
|
2036
2037
|
}
|
|
2037
|
-
const
|
|
2038
|
+
const ia = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
|
|
2038
2039
|
upsert: !0,
|
|
2039
2040
|
returnDocument: "after"
|
|
2040
2041
|
}).lean();
|
|
2041
|
-
class
|
|
2042
|
+
class ua extends aa {
|
|
2042
2043
|
constructor() {
|
|
2043
2044
|
super(300);
|
|
2044
2045
|
}
|
|
2045
2046
|
fetchFromDb(e) {
|
|
2046
|
-
return
|
|
2047
|
+
return sa(e);
|
|
2047
2048
|
}
|
|
2048
2049
|
getKey({ user: e }) {
|
|
2049
2050
|
return e;
|
|
@@ -2052,13 +2053,13 @@ class Vn extends Wn {
|
|
|
2052
2053
|
return e.toString();
|
|
2053
2054
|
}
|
|
2054
2055
|
updateInDb(e, t) {
|
|
2055
|
-
return
|
|
2056
|
+
return ia(e, t);
|
|
2056
2057
|
}
|
|
2057
2058
|
}
|
|
2058
|
-
const
|
|
2059
|
-
class
|
|
2059
|
+
const le = new ua();
|
|
2060
|
+
class ca extends f {
|
|
2060
2061
|
getPanoplyEffectiveBonus(e, t) {
|
|
2061
|
-
const a =
|
|
2062
|
+
const a = N(
|
|
2062
2063
|
Object.values(e.equippedItems)
|
|
2063
2064
|
), r = t.equipments.filter(
|
|
2064
2065
|
(s) => a.find((i) => i.entityId === s.entityId)
|
|
@@ -2077,13 +2078,13 @@ class Jn extends f {
|
|
|
2077
2078
|
intelligence: 0,
|
|
2078
2079
|
wisdom: 0
|
|
2079
2080
|
};
|
|
2080
|
-
const a = await
|
|
2081
|
-
for (const r of
|
|
2081
|
+
const a = await U.getAllPopulated();
|
|
2082
|
+
for (const r of Be) {
|
|
2082
2083
|
const s = e.equippedItems?.[r];
|
|
2083
2084
|
if (!s)
|
|
2084
2085
|
continue;
|
|
2085
|
-
const i = await
|
|
2086
|
-
t =
|
|
2086
|
+
const i = await d.fromDBToEquipableEquipment(s);
|
|
2087
|
+
t = F(
|
|
2087
2088
|
t,
|
|
2088
2089
|
i.characteristics,
|
|
2089
2090
|
(o, c) => o + c
|
|
@@ -2091,7 +2092,7 @@ class Jn extends f {
|
|
|
2091
2092
|
}
|
|
2092
2093
|
for (const r of a) {
|
|
2093
2094
|
const s = this.getPanoplyEffectiveBonus(e, r);
|
|
2094
|
-
s && !("target" in s) && (t =
|
|
2095
|
+
s && !("target" in s) && (t = F(
|
|
2095
2096
|
t,
|
|
2096
2097
|
s,
|
|
2097
2098
|
(i, o) => i + o
|
|
@@ -2115,7 +2116,7 @@ class Jn extends f {
|
|
|
2115
2116
|
return !0;
|
|
2116
2117
|
}
|
|
2117
2118
|
hasInventoryRequirements(e, t) {
|
|
2118
|
-
return
|
|
2119
|
+
return C(t).reduce(
|
|
2119
2120
|
(a, [r, s]) => a && (e.itemList[r] ?? 0) >= (s ?? 0),
|
|
2120
2121
|
!0
|
|
2121
2122
|
);
|
|
@@ -2127,7 +2128,7 @@ class Jn extends f {
|
|
|
2127
2128
|
return Object.fromEntries(e.itemList);
|
|
2128
2129
|
}
|
|
2129
2130
|
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
2130
|
-
const a = await this.get(e), s = (await
|
|
2131
|
+
const a = await this.get(e), s = (await U.getPanoplyBonus(
|
|
2131
2132
|
a.equippedItems
|
|
2132
2133
|
)).find(
|
|
2133
2134
|
([i, o]) => i.panoplyId === "herbalist" && o !== null
|
|
@@ -2141,19 +2142,19 @@ class Jn extends f {
|
|
|
2141
2142
|
})) : t;
|
|
2142
2143
|
}
|
|
2143
2144
|
async calcMinStreakForWorkLoot(e) {
|
|
2144
|
-
const t = (await
|
|
2145
|
+
const t = (await U.getPanoplyBonus(e.equippedItems)).find(
|
|
2145
2146
|
([a, r]) => a.panoplyId === "marine" && r !== null
|
|
2146
2147
|
);
|
|
2147
2148
|
return t && t[1] === "full" ? 10 : t && t[1] === "half" ? 20 : 1 / 0;
|
|
2148
2149
|
}
|
|
2149
2150
|
async hasRevolutionaryBuff(e) {
|
|
2150
2151
|
const t = await this.get(e);
|
|
2151
|
-
return (await
|
|
2152
|
+
return (await U.getPanoplyBonus(t.equippedItems)).find(
|
|
2152
2153
|
([r, s]) => r.panoplyId === "revolutionary" && s !== null
|
|
2153
2154
|
)?.[1] ?? null;
|
|
2154
2155
|
}
|
|
2155
2156
|
async getRecipeResult(e, t) {
|
|
2156
|
-
const a = (await
|
|
2157
|
+
const a = (await U.getPanoplyBonus(e.equippedItems)).find(
|
|
2157
2158
|
([r, s]) => r.panoplyId === "little_blacksmith" && s !== null
|
|
2158
2159
|
);
|
|
2159
2160
|
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;
|
|
@@ -2164,16 +2165,16 @@ class Jn extends f {
|
|
|
2164
2165
|
async addItem(e, t, a) {
|
|
2165
2166
|
await this.update(e, {
|
|
2166
2167
|
$inc: { [`itemList.${t}`]: a }
|
|
2167
|
-
}), await
|
|
2168
|
+
}), await le.addEntities(e, [t]);
|
|
2168
2169
|
}
|
|
2169
2170
|
async addItems(e, t) {
|
|
2170
2171
|
await this.update(e, {
|
|
2171
2172
|
$inc: Object.fromEntries(
|
|
2172
2173
|
Object.entries(t).filter(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
|
|
2173
2174
|
)
|
|
2174
|
-
}), await
|
|
2175
|
+
}), await le.addEntities(
|
|
2175
2176
|
e,
|
|
2176
|
-
|
|
2177
|
+
C(t).filter(([, a]) => a > 0).map(([a]) => a)
|
|
2177
2178
|
);
|
|
2178
2179
|
}
|
|
2179
2180
|
async removeItem(e, t, a) {
|
|
@@ -2203,7 +2204,7 @@ class Jn extends f {
|
|
|
2203
2204
|
async addEquipments(e, t) {
|
|
2204
2205
|
await this.update(e, {
|
|
2205
2206
|
$push: { equipmentList: { $each: t } }
|
|
2206
|
-
}), await
|
|
2207
|
+
}), await le.addEntities(
|
|
2207
2208
|
e,
|
|
2208
2209
|
t.map((a) => a.entityId)
|
|
2209
2210
|
);
|
|
@@ -2222,34 +2223,34 @@ class Jn extends f {
|
|
|
2222
2223
|
a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
|
|
2223
2224
|
}
|
|
2224
2225
|
async equip(e, t) {
|
|
2225
|
-
const a = await
|
|
2226
|
-
|
|
2226
|
+
const a = await I.getMaxHp(e), r = Object.fromEntries(
|
|
2227
|
+
C(t).map(([s, i]) => [
|
|
2227
2228
|
`equippedItems.${s}`,
|
|
2228
2229
|
i
|
|
2229
2230
|
])
|
|
2230
2231
|
);
|
|
2231
2232
|
await this.update(e, {
|
|
2232
2233
|
$set: r
|
|
2233
|
-
}), await
|
|
2234
|
+
}), await I.updateHp(e, a);
|
|
2234
2235
|
}
|
|
2235
2236
|
async unequip(e, t) {
|
|
2236
|
-
const a = await
|
|
2237
|
+
const a = await I.getMaxHp(e);
|
|
2237
2238
|
await this.update(e, {
|
|
2238
2239
|
$set: {
|
|
2239
2240
|
[`equippedItems.${t}`]: null
|
|
2240
2241
|
}
|
|
2241
|
-
}), await
|
|
2242
|
+
}), await I.updateHp(e, a);
|
|
2242
2243
|
}
|
|
2243
2244
|
async craftItem(e, t, a, r, s) {
|
|
2244
|
-
for (const { entityId: c, size:
|
|
2245
|
-
await this.removeItem(e, c,
|
|
2245
|
+
for (const { entityId: c, size: w } of t)
|
|
2246
|
+
await this.removeItem(e, c, w * r);
|
|
2246
2247
|
const { entityId: i, size: o } = a;
|
|
2247
|
-
await
|
|
2248
|
+
await d.isEntityId(i, d.isEquipment) ? await this.addEquipments(e, [{ entityId: i, seed: s }]) : await d.isEntityId(i, d.isItem) && await this.addItem(e, i, o * r);
|
|
2248
2249
|
}
|
|
2249
2250
|
async dismantleEntity(e, t, a, r, s) {
|
|
2250
|
-
|
|
2251
|
+
d.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : d.isItem(t) && await this.removeItem(e, t.entityId, r);
|
|
2251
2252
|
for (const { entityId: i, quantity: o } of a)
|
|
2252
|
-
await
|
|
2253
|
+
await d.isEntityId(i, d.isItem) && await this.addItem(e, i, r * o);
|
|
2253
2254
|
await this.removeItem(e, "tools", 1);
|
|
2254
2255
|
}
|
|
2255
2256
|
async enchantItem(e, t, a, r) {
|
|
@@ -2259,23 +2260,23 @@ class Jn extends f {
|
|
|
2259
2260
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
2260
2261
|
}
|
|
2261
2262
|
}
|
|
2262
|
-
const
|
|
2263
|
+
const oa = (n) => te.create({
|
|
2263
2264
|
user: n
|
|
2264
2265
|
});
|
|
2265
|
-
async function
|
|
2266
|
-
const e = await
|
|
2267
|
-
return e || y(await
|
|
2266
|
+
async function da(n) {
|
|
2267
|
+
const e = await te.findOne({ user: n }).lean();
|
|
2268
|
+
return e || y(await oa(n));
|
|
2268
2269
|
}
|
|
2269
|
-
const
|
|
2270
|
+
const la = (n, e) => te.findOneAndUpdate({ user: n }, e, {
|
|
2270
2271
|
upsert: !0,
|
|
2271
2272
|
returnDocument: "after"
|
|
2272
2273
|
}).lean();
|
|
2273
|
-
class
|
|
2274
|
+
class pa extends ca {
|
|
2274
2275
|
constructor() {
|
|
2275
2276
|
super(300);
|
|
2276
2277
|
}
|
|
2277
2278
|
fetchFromDb(e) {
|
|
2278
|
-
return
|
|
2279
|
+
return da(e);
|
|
2279
2280
|
}
|
|
2280
2281
|
normalizeKey(e) {
|
|
2281
2282
|
return e.toString();
|
|
@@ -2284,19 +2285,19 @@ class na extends Jn {
|
|
|
2284
2285
|
return e;
|
|
2285
2286
|
}
|
|
2286
2287
|
updateInDb(e, t) {
|
|
2287
|
-
return
|
|
2288
|
+
return la(e, t);
|
|
2288
2289
|
}
|
|
2289
2290
|
}
|
|
2290
|
-
const
|
|
2291
|
-
class
|
|
2291
|
+
const S = new pa();
|
|
2292
|
+
class ya extends f {
|
|
2292
2293
|
getTotalCharacteristics({
|
|
2293
2294
|
characteristics: e,
|
|
2294
2295
|
scrolls: t
|
|
2295
2296
|
}) {
|
|
2296
|
-
return
|
|
2297
|
-
|
|
2297
|
+
return Me(
|
|
2298
|
+
bt.map((a) => [
|
|
2298
2299
|
a,
|
|
2299
|
-
|
|
2300
|
+
$t(e[a]) + t[a]
|
|
2300
2301
|
])
|
|
2301
2302
|
);
|
|
2302
2303
|
}
|
|
@@ -2310,7 +2311,7 @@ class aa extends f {
|
|
|
2310
2311
|
t.booster ? 0.25 : 0
|
|
2311
2312
|
);
|
|
2312
2313
|
return r + s + t.buffs.xp.global.reduce(
|
|
2313
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2314
|
+
(i, { expireAt: o, startAt: c, multiplier: w }) => c && c > /* @__PURE__ */ new Date() || o && L(o) ? i : i + w,
|
|
2314
2315
|
0
|
|
2315
2316
|
);
|
|
2316
2317
|
}
|
|
@@ -2319,7 +2320,7 @@ class aa extends f {
|
|
|
2319
2320
|
return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
|
|
2320
2321
|
}
|
|
2321
2322
|
async getXpDeathPenalties(e) {
|
|
2322
|
-
const t = await this.get(e), a =
|
|
2323
|
+
const t = await this.get(e), a = Et(t.xp.amount);
|
|
2323
2324
|
return a <= 10 ? 5e3 : a <= 20 ? 1e4 : a <= 30 ? 2e4 : a <= 40 ? 3e4 : a <= 50 ? 5e4 : a <= 60 ? 75e3 : a <= 70 ? 15e4 : a <= 80 ? 25e4 : a <= 90 ? 4e5 : a <= 100 ? 75e4 : 14e6;
|
|
2324
2325
|
}
|
|
2325
2326
|
async calcXp(e, t, a) {
|
|
@@ -2332,24 +2333,24 @@ class aa extends f {
|
|
|
2332
2333
|
}
|
|
2333
2334
|
async calcBuffMultiplier(e, t, a) {
|
|
2334
2335
|
return (await this.get(e)).buffs[t][a].reduce(
|
|
2335
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2336
|
+
(i, { expireAt: o, startAt: c, multiplier: w }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !L(o)) ? w : 0),
|
|
2336
2337
|
1
|
|
2337
2338
|
);
|
|
2338
2339
|
}
|
|
2339
2340
|
async getMaxHp(e) {
|
|
2340
|
-
const t = await this.get(e), a = await
|
|
2341
|
+
const t = await this.get(e), a = await S.get(e), { vitality: r } = this.getTotalCharacteristics(t), s = await S.getUserEquipmentsCharacteristics(
|
|
2341
2342
|
a
|
|
2342
2343
|
);
|
|
2343
|
-
return (r + s.vitality) *
|
|
2344
|
+
return (r + s.vitality) * Ut + It;
|
|
2344
2345
|
}
|
|
2345
2346
|
async getHpRatio(e) {
|
|
2346
2347
|
const t = await this.get(e), a = await this.getMaxHp(e);
|
|
2347
2348
|
return Math.min(t.hp / a, 1);
|
|
2348
2349
|
}
|
|
2349
2350
|
async hasCharacteristicRequirement(e, t) {
|
|
2350
|
-
const a = await this.get(e), r = await
|
|
2351
|
+
const a = await this.get(e), r = await S.get(e), s = await S.getUserEquipmentsCharacteristics(
|
|
2351
2352
|
r
|
|
2352
|
-
), i =
|
|
2353
|
+
), i = F(
|
|
2353
2354
|
this.getTotalCharacteristics(a),
|
|
2354
2355
|
s,
|
|
2355
2356
|
(o, c) => o + c
|
|
@@ -2369,7 +2370,7 @@ class aa extends f {
|
|
|
2369
2370
|
}
|
|
2370
2371
|
}
|
|
2371
2372
|
async getGlobalRank(e) {
|
|
2372
|
-
return (await
|
|
2373
|
+
return (await R.aggregate([
|
|
2373
2374
|
{
|
|
2374
2375
|
$setWindowFields: {
|
|
2375
2376
|
sortBy: { "xp.amount": -1 },
|
|
@@ -2383,7 +2384,7 @@ class aa extends f {
|
|
|
2383
2384
|
]))[0];
|
|
2384
2385
|
}
|
|
2385
2386
|
async getBerryRank(e) {
|
|
2386
|
-
return (await
|
|
2387
|
+
return (await R.aggregate([
|
|
2387
2388
|
{
|
|
2388
2389
|
$setWindowFields: {
|
|
2389
2390
|
sortBy: { berry: -1 },
|
|
@@ -2406,7 +2407,7 @@ class aa extends f {
|
|
|
2406
2407
|
...t.buffs.drop.work
|
|
2407
2408
|
];
|
|
2408
2409
|
for (const { multiplier: r, startAt: s, expireAt: i } of a)
|
|
2409
|
-
if (r < 0 && (!i || !
|
|
2410
|
+
if (r < 0 && (!i || !L(i)) && (s ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2410
2411
|
return !0;
|
|
2411
2412
|
return !1;
|
|
2412
2413
|
}
|
|
@@ -2462,7 +2463,7 @@ class aa extends f {
|
|
|
2462
2463
|
await this.updateBuff(e, r);
|
|
2463
2464
|
return;
|
|
2464
2465
|
}
|
|
2465
|
-
const a =
|
|
2466
|
+
const a = Tt(t);
|
|
2466
2467
|
await this.update(e, [
|
|
2467
2468
|
{
|
|
2468
2469
|
$set: {
|
|
@@ -2557,15 +2558,15 @@ class aa extends f {
|
|
|
2557
2558
|
});
|
|
2558
2559
|
}
|
|
2559
2560
|
async updatePanoplyBuff(e, t, a, r) {
|
|
2560
|
-
const s = await
|
|
2561
|
-
(
|
|
2561
|
+
const s = await d.fromDBToEquipableEquipment(t), i = N(Object.values(a)), c = (await U.getAllPopulated()).find(
|
|
2562
|
+
(T) => T.panoplyId === s.panoply
|
|
2562
2563
|
);
|
|
2563
2564
|
if (!c)
|
|
2564
2565
|
return;
|
|
2565
|
-
const
|
|
2566
|
-
(
|
|
2567
|
-
).length,
|
|
2568
|
-
c.halfBonus && "target" in c.halfBonus && await this.removeBuff(e, c.halfBonus), c.fullBonus && "target" in c.fullBonus && await this.removeBuff(e, c.fullBonus),
|
|
2566
|
+
const w = c.equipments.filter(
|
|
2567
|
+
(T) => (i.find((K) => T.entityId === K.entityId) || !r && s.entityId === T.entityId) && (r ? s.entityId !== T.entityId : !0)
|
|
2568
|
+
).length, x = w === c.equipments.length ? c.fullBonus : w >= c.equipments.length / 2 ? c.halfBonus : void 0;
|
|
2569
|
+
c.halfBonus && "target" in c.halfBonus && await this.removeBuff(e, c.halfBonus), c.fullBonus && "target" in c.fullBonus && await this.removeBuff(e, c.fullBonus), x && "target" in x && await this.updateBuff(e, x);
|
|
2569
2570
|
}
|
|
2570
2571
|
async gainHp(e, t) {
|
|
2571
2572
|
const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
|
|
@@ -2668,34 +2669,34 @@ class aa extends f {
|
|
|
2668
2669
|
});
|
|
2669
2670
|
}
|
|
2670
2671
|
async updateUserXp(e, t) {
|
|
2671
|
-
const a = await
|
|
2672
|
+
const a = await na.get(e), r = a?.percent ?? 0, s = await this.calcXp(
|
|
2672
2673
|
e,
|
|
2673
2674
|
t,
|
|
2674
2675
|
(1 - r) * await this.getHpRatio(e)
|
|
2675
2676
|
);
|
|
2676
2677
|
let i = 0;
|
|
2677
|
-
return await this.addXp(e, s), a && (i = await
|
|
2678
|
+
return await this.addXp(e, s), a && (i = await Ce.calcXp(
|
|
2678
2679
|
a.crew,
|
|
2679
2680
|
t * r
|
|
2680
|
-
), await
|
|
2681
|
+
), await Ce.addXp(a.crew, i)), { userXp: s, crewXp: i };
|
|
2681
2682
|
}
|
|
2682
2683
|
async updateUserBerry(e, t, a) {
|
|
2683
2684
|
const r = await this.calcBerry(e, t, a);
|
|
2684
2685
|
return await this.addBerry(e, r), r;
|
|
2685
2686
|
}
|
|
2686
2687
|
}
|
|
2687
|
-
const
|
|
2688
|
+
const fa = async (n) => await R.create({
|
|
2688
2689
|
user: n
|
|
2689
2690
|
});
|
|
2690
|
-
async function
|
|
2691
|
-
const e = await
|
|
2692
|
-
return e || y(await
|
|
2691
|
+
async function ma(n) {
|
|
2692
|
+
const e = await R.findOne({ user: n }).lean();
|
|
2693
|
+
return e || y(await fa(n));
|
|
2693
2694
|
}
|
|
2694
|
-
const
|
|
2695
|
+
const ha = (n, e) => R.findOneAndUpdate({ user: n }, e, {
|
|
2695
2696
|
returnDocument: "after",
|
|
2696
2697
|
upsert: !0
|
|
2697
2698
|
}).lean();
|
|
2698
|
-
class
|
|
2699
|
+
class wa extends ya {
|
|
2699
2700
|
constructor() {
|
|
2700
2701
|
super(300);
|
|
2701
2702
|
}
|
|
@@ -2706,14 +2707,14 @@ class ua extends aa {
|
|
|
2706
2707
|
return e;
|
|
2707
2708
|
}
|
|
2708
2709
|
fetchFromDb(e) {
|
|
2709
|
-
return
|
|
2710
|
+
return ma(e);
|
|
2710
2711
|
}
|
|
2711
2712
|
updateInDb(e, t) {
|
|
2712
|
-
return
|
|
2713
|
+
return ha(e, t);
|
|
2713
2714
|
}
|
|
2714
2715
|
}
|
|
2715
|
-
const
|
|
2716
|
-
class
|
|
2716
|
+
const I = new wa();
|
|
2717
|
+
class ga extends b {
|
|
2717
2718
|
async updateSendDailyQuest(e, t) {
|
|
2718
2719
|
await this.update(
|
|
2719
2720
|
{ discordId: e },
|
|
@@ -2742,18 +2743,18 @@ class ca extends b {
|
|
|
2742
2743
|
});
|
|
2743
2744
|
}
|
|
2744
2745
|
}
|
|
2745
|
-
const
|
|
2746
|
+
const Sa = (n) => j.find(n).lean(), ba = async (n) => await j.create({
|
|
2746
2747
|
user: n
|
|
2747
2748
|
});
|
|
2748
|
-
async function
|
|
2749
|
-
const e = await
|
|
2750
|
-
return e || y(await
|
|
2749
|
+
async function $a(n) {
|
|
2750
|
+
const e = await j.findOne({ user: n }).lean();
|
|
2751
|
+
return e || y(await ba(n));
|
|
2751
2752
|
}
|
|
2752
|
-
const
|
|
2753
|
+
const Ea = (n, e) => j.findOneAndUpdate({ user: n }, e, {
|
|
2753
2754
|
returnDocument: "after",
|
|
2754
2755
|
upsert: !0
|
|
2755
2756
|
}).lean();
|
|
2756
|
-
class
|
|
2757
|
+
class Ua extends ga {
|
|
2757
2758
|
constructor() {
|
|
2758
2759
|
super(3600);
|
|
2759
2760
|
}
|
|
@@ -2764,22 +2765,22 @@ class ya extends ca {
|
|
|
2764
2765
|
return e.user;
|
|
2765
2766
|
}
|
|
2766
2767
|
fetchFromDb(e) {
|
|
2767
|
-
return
|
|
2768
|
+
return $a(e);
|
|
2768
2769
|
}
|
|
2769
2770
|
fetchManyFromDb(e) {
|
|
2770
|
-
return
|
|
2771
|
+
return Sa(e);
|
|
2771
2772
|
}
|
|
2772
2773
|
updateInDb(e, t) {
|
|
2773
|
-
return
|
|
2774
|
+
return Ea(e, t);
|
|
2774
2775
|
}
|
|
2775
2776
|
}
|
|
2776
|
-
const
|
|
2777
|
-
class
|
|
2778
|
-
getCommandCooldown(e, t) {
|
|
2779
|
-
return e.commands[t];
|
|
2777
|
+
const Re = new Ua();
|
|
2778
|
+
class Ia extends f {
|
|
2779
|
+
async getCommandCooldown(e, t) {
|
|
2780
|
+
return (await this.get(e)).commands[t];
|
|
2780
2781
|
}
|
|
2781
|
-
getRaidCooldown(e, t) {
|
|
2782
|
-
return e.raid[t];
|
|
2782
|
+
async getRaidCooldown(e, t) {
|
|
2783
|
+
return (await this.get(e)).raid[t];
|
|
2783
2784
|
}
|
|
2784
2785
|
async reduceRaidCooldown(e, t) {
|
|
2785
2786
|
await this.update(e, [
|
|
@@ -2799,21 +2800,21 @@ class fa extends f {
|
|
|
2799
2800
|
}
|
|
2800
2801
|
}
|
|
2801
2802
|
}
|
|
2802
|
-
]), await
|
|
2803
|
+
]), await H.updateReminderDate(
|
|
2803
2804
|
e,
|
|
2804
2805
|
"raid/special",
|
|
2805
2806
|
-1 * t * 3600 * 1e3
|
|
2806
|
-
), await
|
|
2807
|
+
), await H.updateReminderDate(
|
|
2807
2808
|
e,
|
|
2808
2809
|
"raid/classic",
|
|
2809
2810
|
-1 * t * 3600 * 1e3
|
|
2810
2811
|
);
|
|
2811
2812
|
}
|
|
2812
2813
|
async startRaidCooldown(e, t, a) {
|
|
2813
|
-
const { reminder: r } = await
|
|
2814
|
+
const { reminder: r } = await Re.get(e);
|
|
2814
2815
|
await this.update(e, {
|
|
2815
2816
|
$set: { [`raid.${t}`]: new Date(Date.now() + a) }
|
|
2816
|
-
}), r.raid[t] && await
|
|
2817
|
+
}), r.raid[t] && await H.addReminder(
|
|
2817
2818
|
e,
|
|
2818
2819
|
`raid/${t}`,
|
|
2819
2820
|
new Date(Date.now() + a)
|
|
@@ -2824,33 +2825,33 @@ class fa extends f {
|
|
|
2824
2825
|
$set: {
|
|
2825
2826
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
2826
2827
|
}
|
|
2827
|
-
}), await
|
|
2828
|
+
}), await I.gainHp(e, 1);
|
|
2828
2829
|
}
|
|
2829
2830
|
async useCommand(e, t, a) {
|
|
2830
|
-
const { reminder: r } = await
|
|
2831
|
+
const { reminder: r } = await Re.get(e);
|
|
2831
2832
|
await this.update(e, {
|
|
2832
2833
|
$set: {
|
|
2833
2834
|
[`commands.${t}`]: new Date(Date.now() + a)
|
|
2834
2835
|
}
|
|
2835
|
-
}), r.commands[t] && await
|
|
2836
|
+
}), r.commands[t] && await H.addReminder(
|
|
2836
2837
|
e,
|
|
2837
2838
|
`commands/${t}`,
|
|
2838
2839
|
new Date(Date.now() + a)
|
|
2839
2840
|
);
|
|
2840
2841
|
}
|
|
2841
2842
|
}
|
|
2842
|
-
const
|
|
2843
|
+
const Ta = async (n) => await V.create({
|
|
2843
2844
|
user: n
|
|
2844
2845
|
});
|
|
2845
|
-
async function
|
|
2846
|
-
const e = await
|
|
2847
|
-
return e || y(await
|
|
2846
|
+
async function Oa(n) {
|
|
2847
|
+
const e = await V.findOne({ user: n }).lean();
|
|
2848
|
+
return e || y(await Ta(n));
|
|
2848
2849
|
}
|
|
2849
|
-
const
|
|
2850
|
+
const Da = (n, e) => V.findOneAndUpdate({ user: n }, e, {
|
|
2850
2851
|
returnDocument: "after",
|
|
2851
2852
|
upsert: !0
|
|
2852
2853
|
}).lean();
|
|
2853
|
-
class
|
|
2854
|
+
class Ca extends Ia {
|
|
2854
2855
|
constructor() {
|
|
2855
2856
|
super(300);
|
|
2856
2857
|
}
|
|
@@ -2861,79 +2862,19 @@ class ga extends fa {
|
|
|
2861
2862
|
return e.user;
|
|
2862
2863
|
}
|
|
2863
2864
|
fetchFromDb(e) {
|
|
2864
|
-
return
|
|
2865
|
+
return Oa(e);
|
|
2865
2866
|
}
|
|
2866
2867
|
updateInDb(e, t) {
|
|
2867
|
-
return
|
|
2868
|
+
return Da(e, t);
|
|
2868
2869
|
}
|
|
2869
2870
|
}
|
|
2870
|
-
const
|
|
2871
|
-
class
|
|
2872
|
-
async setGuessGame(e, t, a, r) {
|
|
2873
|
-
await this.update(e, {
|
|
2874
|
-
$set: {
|
|
2875
|
-
guess: {
|
|
2876
|
-
amount: t,
|
|
2877
|
-
tries: a,
|
|
2878
|
-
numberToGuess: r,
|
|
2879
|
-
lastGuess: 0
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
});
|
|
2883
|
-
}
|
|
2884
|
-
async resetGuessGame(e) {
|
|
2885
|
-
await this.update(e, {
|
|
2886
|
-
$set: {
|
|
2887
|
-
guess: null
|
|
2888
|
-
}
|
|
2889
|
-
});
|
|
2890
|
-
}
|
|
2891
|
-
async updateGuessGame(e) {
|
|
2892
|
-
await this.update(e, {
|
|
2893
|
-
$inc: {
|
|
2894
|
-
"guess.tries": 1
|
|
2895
|
-
},
|
|
2896
|
-
$set: {
|
|
2897
|
-
"guess.lastGuess": Date.now()
|
|
2898
|
-
}
|
|
2899
|
-
});
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
const $a = async (n) => await G.create({
|
|
2903
|
-
user: n
|
|
2904
|
-
});
|
|
2905
|
-
async function Ea(n) {
|
|
2906
|
-
const e = await G.findOne({ user: n }).lean();
|
|
2907
|
-
return e || y(await $a(n));
|
|
2908
|
-
}
|
|
2909
|
-
const Ia = (n, e) => G.findOneAndUpdate({ user: n }, e, {
|
|
2910
|
-
upsert: !0,
|
|
2911
|
-
returnDocument: "after"
|
|
2912
|
-
}).lean();
|
|
2913
|
-
class Ua extends ba {
|
|
2914
|
-
constructor() {
|
|
2915
|
-
super(300);
|
|
2916
|
-
}
|
|
2917
|
-
normalizeKey(e) {
|
|
2918
|
-
return e.toString();
|
|
2919
|
-
}
|
|
2920
|
-
getKey({ user: e }) {
|
|
2921
|
-
return e;
|
|
2922
|
-
}
|
|
2923
|
-
fetchFromDb(e) {
|
|
2924
|
-
return Ea(e);
|
|
2925
|
-
}
|
|
2926
|
-
updateInDb(e, t) {
|
|
2927
|
-
return Ia(e, t);
|
|
2928
|
-
}
|
|
2929
|
-
}
|
|
2930
|
-
const Ts = new Ua();
|
|
2931
|
-
class Ta extends f {
|
|
2871
|
+
const Ra = new Ca();
|
|
2872
|
+
class va extends f {
|
|
2932
2873
|
async unlockTitle(e, t) {
|
|
2933
|
-
await
|
|
2874
|
+
await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2934
2875
|
}
|
|
2935
2876
|
async unlockTitles(e, t) {
|
|
2936
|
-
await
|
|
2877
|
+
await g.isOrnamentIds(t, g.isTitle) && await this.update(e, {
|
|
2937
2878
|
$addToSet: { unlockedTitles: { $each: t } }
|
|
2938
2879
|
});
|
|
2939
2880
|
}
|
|
@@ -2941,17 +2882,17 @@ class Ta extends f {
|
|
|
2941
2882
|
await this.update(e, { $set: { selectedTitle: t } });
|
|
2942
2883
|
}
|
|
2943
2884
|
async unlockBackground(e, t) {
|
|
2944
|
-
await
|
|
2885
|
+
await g.isOrnamentIds(
|
|
2945
2886
|
[t],
|
|
2946
|
-
|
|
2887
|
+
g.isBackground
|
|
2947
2888
|
) && await this.update(e, {
|
|
2948
2889
|
$addToSet: { unlockedBackgrounds: t }
|
|
2949
2890
|
});
|
|
2950
2891
|
}
|
|
2951
2892
|
async unlockBackgrounds(e, t) {
|
|
2952
|
-
await
|
|
2893
|
+
await g.isOrnamentIds(
|
|
2953
2894
|
t,
|
|
2954
|
-
|
|
2895
|
+
g.isBackground
|
|
2955
2896
|
) && await this.update(e, {
|
|
2956
2897
|
$addToSet: { unlockedBackgrounds: { $each: t } }
|
|
2957
2898
|
});
|
|
@@ -2997,18 +2938,18 @@ class Ta extends f {
|
|
|
2997
2938
|
});
|
|
2998
2939
|
}
|
|
2999
2940
|
}
|
|
3000
|
-
const
|
|
2941
|
+
const Ma = async (n) => await ne.create({
|
|
3001
2942
|
user: n
|
|
3002
2943
|
});
|
|
3003
|
-
async function
|
|
3004
|
-
const e = await
|
|
3005
|
-
return e || y(await
|
|
2944
|
+
async function Aa(n) {
|
|
2945
|
+
const e = await ne.findOne({ user: n }).lean();
|
|
2946
|
+
return e || y(await Ma(n));
|
|
3006
2947
|
}
|
|
3007
|
-
const
|
|
2948
|
+
const Ba = async (n, e) => ne.findOneAndUpdate({ user: n }, e, {
|
|
3008
2949
|
upsert: !0,
|
|
3009
2950
|
returnDocument: "after"
|
|
3010
2951
|
}).lean();
|
|
3011
|
-
class
|
|
2952
|
+
class _a extends va {
|
|
3012
2953
|
constructor() {
|
|
3013
2954
|
super(300);
|
|
3014
2955
|
}
|
|
@@ -3019,14 +2960,14 @@ class Ra extends Ta {
|
|
|
3019
2960
|
return e;
|
|
3020
2961
|
}
|
|
3021
2962
|
fetchFromDb(e) {
|
|
3022
|
-
return
|
|
2963
|
+
return Aa(e);
|
|
3023
2964
|
}
|
|
3024
2965
|
updateInDb(e, t) {
|
|
3025
|
-
return
|
|
2966
|
+
return Ba(e, t);
|
|
3026
2967
|
}
|
|
3027
2968
|
}
|
|
3028
|
-
const
|
|
3029
|
-
class
|
|
2969
|
+
const G = new _a();
|
|
2970
|
+
class xa extends b {
|
|
3030
2971
|
async getStatus(e, t) {
|
|
3031
2972
|
return (await this.get({ user: e, questId: t })).status;
|
|
3032
2973
|
}
|
|
@@ -3035,14 +2976,14 @@ class Ma extends b {
|
|
|
3035
2976
|
}
|
|
3036
2977
|
async isStreaking(e, t) {
|
|
3037
2978
|
const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
|
|
3038
|
-
return !!a &&
|
|
2979
|
+
return !!a && pe(k(), a);
|
|
3039
2980
|
}
|
|
3040
2981
|
async getStreakMultiplier(e, t) {
|
|
3041
2982
|
const a = await this.get({ user: e, questId: t });
|
|
3042
2983
|
return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
|
|
3043
2984
|
}
|
|
3044
2985
|
async completeQuest(e, t = !1) {
|
|
3045
|
-
const a =
|
|
2986
|
+
const a = k();
|
|
3046
2987
|
a.setHours(0, 0, 0, 0);
|
|
3047
2988
|
const r = /* @__PURE__ */ new Date();
|
|
3048
2989
|
return r.setHours(0, 0, 0, 0), this.update(
|
|
@@ -3065,7 +3006,7 @@ class Ma extends b {
|
|
|
3065
3006
|
}
|
|
3066
3007
|
} : {},
|
|
3067
3008
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
3068
|
-
status:
|
|
3009
|
+
status: O.COMPLETED
|
|
3069
3010
|
}
|
|
3070
3011
|
}
|
|
3071
3012
|
],
|
|
@@ -3073,24 +3014,24 @@ class Ma extends b {
|
|
|
3073
3014
|
);
|
|
3074
3015
|
}
|
|
3075
3016
|
}
|
|
3076
|
-
function
|
|
3077
|
-
return
|
|
3017
|
+
function qa(n) {
|
|
3018
|
+
return B.find(n).lean();
|
|
3078
3019
|
}
|
|
3079
|
-
const
|
|
3020
|
+
const ka = async (n) => await B.create({
|
|
3080
3021
|
...n
|
|
3081
3022
|
});
|
|
3082
|
-
async function
|
|
3083
|
-
const e = await
|
|
3084
|
-
return e || y(await
|
|
3023
|
+
async function Na(n) {
|
|
3024
|
+
const e = await B.findOne(n).lean();
|
|
3025
|
+
return e || y(await ka(n));
|
|
3085
3026
|
}
|
|
3086
|
-
function
|
|
3087
|
-
return
|
|
3027
|
+
function Fa(n, e, t) {
|
|
3028
|
+
return B.findOneAndUpdate(n, e, {
|
|
3088
3029
|
upsert: !0,
|
|
3089
3030
|
...t,
|
|
3090
3031
|
returnDocument: "after"
|
|
3091
3032
|
}).lean();
|
|
3092
3033
|
}
|
|
3093
|
-
class
|
|
3034
|
+
class ja extends xa {
|
|
3094
3035
|
constructor() {
|
|
3095
3036
|
super(3600);
|
|
3096
3037
|
}
|
|
@@ -3104,17 +3045,172 @@ class qa extends Ma {
|
|
|
3104
3045
|
return { user: e, questId: t };
|
|
3105
3046
|
}
|
|
3106
3047
|
fetchFromDb(e) {
|
|
3107
|
-
return
|
|
3048
|
+
return Na(e);
|
|
3108
3049
|
}
|
|
3109
3050
|
fetchManyFromDb(e) {
|
|
3110
|
-
return
|
|
3051
|
+
return qa(e);
|
|
3111
3052
|
}
|
|
3112
3053
|
updateInDb(e, t, a) {
|
|
3113
|
-
return
|
|
3054
|
+
return Fa(e, t, a);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
const ve = new ja();
|
|
3058
|
+
class za extends f {
|
|
3059
|
+
async updateDailyReport(e) {
|
|
3060
|
+
const t = await I.get(e), a = await G.get(e), r = await ve.getMany({
|
|
3061
|
+
user: e,
|
|
3062
|
+
status: O.COMPLETED
|
|
3063
|
+
});
|
|
3064
|
+
await this.update(e, {
|
|
3065
|
+
$set: {
|
|
3066
|
+
xpYesterday: t.xp.amount,
|
|
3067
|
+
berryYesterday: t.berry,
|
|
3068
|
+
previousCompletedQuest: r.map(
|
|
3069
|
+
({ questId: s }) => s
|
|
3070
|
+
),
|
|
3071
|
+
"previousOrnament.unlockedBadges": a.unlockedBadges,
|
|
3072
|
+
"previousOrnament.unlockedTitles": a.unlockedTitles,
|
|
3073
|
+
"previousOrnament.unlockedBackgrounds": a.unlockedBackgrounds
|
|
3074
|
+
// TODO
|
|
3075
|
+
// previousMessageSent: user.questMeta.messageSent,
|
|
3076
|
+
}
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
async getDailyReport(e) {
|
|
3080
|
+
const t = await this.get(e), {
|
|
3081
|
+
previousOrnament: a,
|
|
3082
|
+
previousCompletedQuest: r,
|
|
3083
|
+
xpYesterday: s,
|
|
3084
|
+
berryYesterday: i
|
|
3085
|
+
} = t;
|
|
3086
|
+
if (s <= 0)
|
|
3087
|
+
return;
|
|
3088
|
+
const o = await I.get(e), c = await ve.getMany({
|
|
3089
|
+
user: e,
|
|
3090
|
+
status: O.COMPLETED
|
|
3091
|
+
}), w = await G.get(e), { berry: x, xp: T } = o, { voice: K, amount: nt } = T, { unlockedBadges: at, unlockedBackgrounds: rt, unlockedTitles: st } = w;
|
|
3092
|
+
return {
|
|
3093
|
+
berry: x - i,
|
|
3094
|
+
xp: nt - s,
|
|
3095
|
+
// TODO
|
|
3096
|
+
// message: user.questMeta.messageSent - previousMessageSent,
|
|
3097
|
+
voice: pe(K.lastConnection, k()) ? K.minutesInVoiceToday : 0,
|
|
3098
|
+
quest: q(
|
|
3099
|
+
c.map(({ questId: it }) => it),
|
|
3100
|
+
r
|
|
3101
|
+
),
|
|
3102
|
+
badge: q(at, a.unlockedBadges),
|
|
3103
|
+
title: q(st, a.unlockedTitles),
|
|
3104
|
+
background: q(
|
|
3105
|
+
rt,
|
|
3106
|
+
a.unlockedBackgrounds
|
|
3107
|
+
)
|
|
3108
|
+
};
|
|
3109
|
+
}
|
|
3110
|
+
async getAllDailyReportsToSend() {
|
|
3111
|
+
const e = await Sn.getMany({
|
|
3112
|
+
"settings.sendDailyReport": !0,
|
|
3113
|
+
faction: { $ne: "citizen" }
|
|
3114
|
+
});
|
|
3115
|
+
return await Promise.all(
|
|
3116
|
+
e.map(async ({ _id: t, discordId: a }) => ({
|
|
3117
|
+
...await this.getDailyReport(t),
|
|
3118
|
+
user: t,
|
|
3119
|
+
discordId: a
|
|
3120
|
+
}))
|
|
3121
|
+
);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
const Pa = (n) => J.create({
|
|
3125
|
+
user: n
|
|
3126
|
+
});
|
|
3127
|
+
async function Ka(n) {
|
|
3128
|
+
const e = await J.findOne({ user: n }).lean();
|
|
3129
|
+
return e || y(await Pa(n));
|
|
3130
|
+
}
|
|
3131
|
+
const Ha = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
3132
|
+
upsert: !0,
|
|
3133
|
+
returnDocument: "after"
|
|
3134
|
+
}).lean();
|
|
3135
|
+
class La extends za {
|
|
3136
|
+
constructor() {
|
|
3137
|
+
super(60);
|
|
3138
|
+
}
|
|
3139
|
+
normalizeKey(e) {
|
|
3140
|
+
return e.toString();
|
|
3141
|
+
}
|
|
3142
|
+
getKey(e) {
|
|
3143
|
+
return e.user;
|
|
3144
|
+
}
|
|
3145
|
+
fetchFromDb(e) {
|
|
3146
|
+
return Ka(e);
|
|
3147
|
+
}
|
|
3148
|
+
updateInDb(e, t) {
|
|
3149
|
+
return Ha(e, t);
|
|
3114
3150
|
}
|
|
3115
3151
|
}
|
|
3116
|
-
const
|
|
3117
|
-
class
|
|
3152
|
+
const js = new La();
|
|
3153
|
+
class Qa extends f {
|
|
3154
|
+
async setGuessGame(e, t, a, r) {
|
|
3155
|
+
await this.update(e, {
|
|
3156
|
+
$set: {
|
|
3157
|
+
guess: {
|
|
3158
|
+
amount: t,
|
|
3159
|
+
tries: a,
|
|
3160
|
+
numberToGuess: r,
|
|
3161
|
+
lastGuess: 0
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
async resetGuessGame(e) {
|
|
3167
|
+
await this.update(e, {
|
|
3168
|
+
$set: {
|
|
3169
|
+
guess: null
|
|
3170
|
+
}
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
async updateGuessGame(e) {
|
|
3174
|
+
await this.update(e, {
|
|
3175
|
+
$inc: {
|
|
3176
|
+
"guess.tries": 1
|
|
3177
|
+
},
|
|
3178
|
+
$set: {
|
|
3179
|
+
"guess.lastGuess": Date.now()
|
|
3180
|
+
}
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
const Wa = async (n) => await ee.create({
|
|
3185
|
+
user: n
|
|
3186
|
+
});
|
|
3187
|
+
async function Ga(n) {
|
|
3188
|
+
const e = await ee.findOne({ user: n }).lean();
|
|
3189
|
+
return e || y(await Wa(n));
|
|
3190
|
+
}
|
|
3191
|
+
const Ya = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
|
|
3192
|
+
upsert: !0,
|
|
3193
|
+
returnDocument: "after"
|
|
3194
|
+
}).lean();
|
|
3195
|
+
class Xa extends Qa {
|
|
3196
|
+
constructor() {
|
|
3197
|
+
super(300);
|
|
3198
|
+
}
|
|
3199
|
+
normalizeKey(e) {
|
|
3200
|
+
return e.toString();
|
|
3201
|
+
}
|
|
3202
|
+
getKey({ user: e }) {
|
|
3203
|
+
return e;
|
|
3204
|
+
}
|
|
3205
|
+
fetchFromDb(e) {
|
|
3206
|
+
return Ga(e);
|
|
3207
|
+
}
|
|
3208
|
+
updateInDb(e, t) {
|
|
3209
|
+
return Ya(e, t);
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
const zs = new Xa();
|
|
3213
|
+
class Va extends f {
|
|
3118
3214
|
async hasUnlockedRaid(e, t) {
|
|
3119
3215
|
return (await this.get(e)).unlocked?.[t];
|
|
3120
3216
|
}
|
|
@@ -3148,7 +3244,7 @@ class xa extends f {
|
|
|
3148
3244
|
rewards: {}
|
|
3149
3245
|
}
|
|
3150
3246
|
}
|
|
3151
|
-
}), await
|
|
3247
|
+
}), await Ra.startRaidCooldown(e, r, s), i;
|
|
3152
3248
|
}
|
|
3153
3249
|
async resetRaid(e) {
|
|
3154
3250
|
await this.update(e, {
|
|
@@ -3181,7 +3277,7 @@ class xa extends f {
|
|
|
3181
3277
|
async addRewardsToRaid(e, t) {
|
|
3182
3278
|
await this.update(e, {
|
|
3183
3279
|
$inc: Object.fromEntries(
|
|
3184
|
-
|
|
3280
|
+
C(t).filter(([a]) => a !== "title" && a !== "condition").map(([a, r]) => [`currentRaid.rewards.${a}`, r])
|
|
3185
3281
|
),
|
|
3186
3282
|
...t.title ? { $set: { "currentRaid.rewards.title": t.title } } : {}
|
|
3187
3283
|
});
|
|
@@ -3194,16 +3290,16 @@ class xa extends f {
|
|
|
3194
3290
|
});
|
|
3195
3291
|
}
|
|
3196
3292
|
}
|
|
3197
|
-
const
|
|
3293
|
+
const Ja = (n) => ae.create({
|
|
3198
3294
|
user: n
|
|
3199
|
-
}),
|
|
3200
|
-
const e = await
|
|
3201
|
-
return e || y(await
|
|
3202
|
-
},
|
|
3295
|
+
}), Za = async (n) => {
|
|
3296
|
+
const e = await ae.findOne({ user: n }).lean();
|
|
3297
|
+
return e || y(await Ja(n));
|
|
3298
|
+
}, er = (n, e) => ae.findOneAndUpdate({ user: n }, e, {
|
|
3203
3299
|
upsert: !0,
|
|
3204
3300
|
returnDocument: "after"
|
|
3205
3301
|
});
|
|
3206
|
-
class
|
|
3302
|
+
class tr extends Va {
|
|
3207
3303
|
constructor() {
|
|
3208
3304
|
super(3600);
|
|
3209
3305
|
}
|
|
@@ -3214,30 +3310,30 @@ class ja extends xa {
|
|
|
3214
3310
|
return e;
|
|
3215
3311
|
}
|
|
3216
3312
|
fetchFromDb(e) {
|
|
3217
|
-
return
|
|
3313
|
+
return Za(e);
|
|
3218
3314
|
}
|
|
3219
3315
|
updateInDb(e, t) {
|
|
3220
|
-
return
|
|
3316
|
+
return er(e, t);
|
|
3221
3317
|
}
|
|
3222
3318
|
}
|
|
3223
|
-
const
|
|
3224
|
-
class
|
|
3319
|
+
const Ps = new tr();
|
|
3320
|
+
class nr extends f {
|
|
3225
3321
|
async isBuyLimitReached(e, t, a) {
|
|
3226
|
-
const r = await
|
|
3227
|
-
if (await
|
|
3322
|
+
const r = await d.getAllEntitiesLimit();
|
|
3323
|
+
if (await d.isEntityId(t, d.isEquipment))
|
|
3228
3324
|
return !1;
|
|
3229
3325
|
const s = await this.get(e), i = s.limit?.[t];
|
|
3230
3326
|
let o = r[t];
|
|
3231
|
-
const c = await
|
|
3327
|
+
const c = await S.hasRevolutionaryBuff(e);
|
|
3232
3328
|
return s.lastShopId !== a ? !1 : (c === "half" && t === "chest_2" && (o += 2), c === "full" && t === "chest_3" && (o += 1), !!(o && i && i >= o));
|
|
3233
3329
|
}
|
|
3234
|
-
async getShopItemRest(e, t, a, r =
|
|
3235
|
-
const s = await
|
|
3236
|
-
if (await
|
|
3330
|
+
async getShopItemRest(e, t, a, r = Ot) {
|
|
3331
|
+
const s = await d.getAllEntitiesLimit();
|
|
3332
|
+
if (await d.isEntityId(t, d.isEquipment))
|
|
3237
3333
|
return r;
|
|
3238
3334
|
let i = s[t];
|
|
3239
|
-
const o = await this.get(e), c = o.limit?.[t],
|
|
3240
|
-
return
|
|
3335
|
+
const o = await this.get(e), c = o.limit?.[t], w = await S.hasRevolutionaryBuff(e);
|
|
3336
|
+
return w === "half" && t === "chest_2" && (i += 2), w === "full" && t === "chest_3" && (i += 1), i ? o.lastShopId !== a ? i : c ? i - c : Math.min(i, r) : r;
|
|
3241
3337
|
}
|
|
3242
3338
|
async increaseBuyLimit(e, t, a, r) {
|
|
3243
3339
|
await this.update(e, [
|
|
@@ -3266,16 +3362,16 @@ class za extends f {
|
|
|
3266
3362
|
]);
|
|
3267
3363
|
}
|
|
3268
3364
|
}
|
|
3269
|
-
const
|
|
3365
|
+
const ar = async (n) => await re.create({
|
|
3270
3366
|
user: n
|
|
3271
|
-
}),
|
|
3272
|
-
const e = await
|
|
3273
|
-
return e || y(await
|
|
3274
|
-
},
|
|
3367
|
+
}), rr = async (n) => {
|
|
3368
|
+
const e = await re.findOne({ user: n }).lean();
|
|
3369
|
+
return e || y(await ar(n));
|
|
3370
|
+
}, sr = (n, e) => re.findOneAndUpdate({ user: n }, e, {
|
|
3275
3371
|
upsert: !0,
|
|
3276
3372
|
returnDocument: "after"
|
|
3277
3373
|
}).lean();
|
|
3278
|
-
class
|
|
3374
|
+
class ir extends nr {
|
|
3279
3375
|
constructor() {
|
|
3280
3376
|
super(300);
|
|
3281
3377
|
}
|
|
@@ -3286,14 +3382,14 @@ class La extends za {
|
|
|
3286
3382
|
return e;
|
|
3287
3383
|
}
|
|
3288
3384
|
fetchFromDb(e) {
|
|
3289
|
-
return
|
|
3385
|
+
return rr(e);
|
|
3290
3386
|
}
|
|
3291
3387
|
updateInDb(e, t) {
|
|
3292
|
-
return
|
|
3388
|
+
return sr(e, t);
|
|
3293
3389
|
}
|
|
3294
3390
|
}
|
|
3295
|
-
const
|
|
3296
|
-
class
|
|
3391
|
+
const Ks = new ir();
|
|
3392
|
+
class ur extends f {
|
|
3297
3393
|
async didSevenDoubleAtDoQ(e) {
|
|
3298
3394
|
await this.update(e, {
|
|
3299
3395
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -3317,10 +3413,10 @@ class Qa extends f {
|
|
|
3317
3413
|
await this.update(e, { $inc: { drawCount: 1 } });
|
|
3318
3414
|
}
|
|
3319
3415
|
async bet666(e) {
|
|
3320
|
-
const t =
|
|
3416
|
+
const t = k();
|
|
3321
3417
|
t.setHours(0, 0, 0, 0);
|
|
3322
3418
|
const a = /* @__PURE__ */ new Date();
|
|
3323
|
-
a.setHours(0, 0, 0, 0), await
|
|
3419
|
+
a.setHours(0, 0, 0, 0), await v.updateOne(
|
|
3324
3420
|
{
|
|
3325
3421
|
user: e,
|
|
3326
3422
|
"bet666.last": {
|
|
@@ -3329,7 +3425,7 @@ class Qa extends f {
|
|
|
3329
3425
|
}
|
|
3330
3426
|
},
|
|
3331
3427
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
3332
|
-
), await
|
|
3428
|
+
), await v.updateOne(
|
|
3333
3429
|
{
|
|
3334
3430
|
user: e,
|
|
3335
3431
|
"bet666.last": {
|
|
@@ -3372,18 +3468,18 @@ class Qa extends f {
|
|
|
3372
3468
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
3373
3469
|
}
|
|
3374
3470
|
}
|
|
3375
|
-
const
|
|
3471
|
+
const cr = async (n) => await v.create({
|
|
3376
3472
|
user: n
|
|
3377
3473
|
});
|
|
3378
|
-
async function
|
|
3379
|
-
const e = await
|
|
3380
|
-
return e || y(await
|
|
3474
|
+
async function or(n) {
|
|
3475
|
+
const e = await v.findOne({ user: n }).lean();
|
|
3476
|
+
return e || y(await cr(n));
|
|
3381
3477
|
}
|
|
3382
|
-
const
|
|
3478
|
+
const dr = (n, e) => v.findOneAndUpdate({ user: n }, e, {
|
|
3383
3479
|
upsert: !0,
|
|
3384
3480
|
returnDocument: "after"
|
|
3385
3481
|
}).lean();
|
|
3386
|
-
class
|
|
3482
|
+
class lr extends ur {
|
|
3387
3483
|
constructor() {
|
|
3388
3484
|
super(300);
|
|
3389
3485
|
}
|
|
@@ -3394,14 +3490,14 @@ class Xa extends Qa {
|
|
|
3394
3490
|
return e;
|
|
3395
3491
|
}
|
|
3396
3492
|
fetchFromDb(e) {
|
|
3397
|
-
return
|
|
3493
|
+
return or(e);
|
|
3398
3494
|
}
|
|
3399
3495
|
updateInDb(e, t) {
|
|
3400
|
-
return
|
|
3496
|
+
return dr(e, t);
|
|
3401
3497
|
}
|
|
3402
3498
|
}
|
|
3403
|
-
const
|
|
3404
|
-
class
|
|
3499
|
+
const Hs = new lr();
|
|
3500
|
+
class pr extends f {
|
|
3405
3501
|
async increaseXpGiven(e, t) {
|
|
3406
3502
|
await this.update(e, {
|
|
3407
3503
|
$inc: {
|
|
@@ -3423,18 +3519,18 @@ class Va extends f {
|
|
|
3423
3519
|
t ? await this.update(e, { $set: { timeCrewAbove90PercentXp: 0 } }) : await this.update(e, { $inc: { timeCrewAbove90PercentXp: 1 } });
|
|
3424
3520
|
}
|
|
3425
3521
|
}
|
|
3426
|
-
const
|
|
3522
|
+
const yr = async (n) => await se.create({
|
|
3427
3523
|
user: n
|
|
3428
3524
|
});
|
|
3429
|
-
async function
|
|
3430
|
-
const e = await
|
|
3431
|
-
return e || y(await
|
|
3525
|
+
async function fr(n) {
|
|
3526
|
+
const e = await se.findOne({ user: n }).lean();
|
|
3527
|
+
return e || y(await yr(n));
|
|
3432
3528
|
}
|
|
3433
|
-
const
|
|
3529
|
+
const mr = (n, e) => se.findOneAndUpdate({ user: n }, e, {
|
|
3434
3530
|
upsert: !0,
|
|
3435
3531
|
returnDocument: "after"
|
|
3436
3532
|
}).lean();
|
|
3437
|
-
class
|
|
3533
|
+
class hr extends pr {
|
|
3438
3534
|
constructor() {
|
|
3439
3535
|
super(300);
|
|
3440
3536
|
}
|
|
@@ -3445,14 +3541,14 @@ class tr extends Va {
|
|
|
3445
3541
|
return e;
|
|
3446
3542
|
}
|
|
3447
3543
|
fetchFromDb(e) {
|
|
3448
|
-
return
|
|
3544
|
+
return fr(e);
|
|
3449
3545
|
}
|
|
3450
3546
|
updateInDb(e, t) {
|
|
3451
|
-
return
|
|
3547
|
+
return mr(e, t);
|
|
3452
3548
|
}
|
|
3453
3549
|
}
|
|
3454
|
-
const
|
|
3455
|
-
class
|
|
3550
|
+
const Ls = new hr();
|
|
3551
|
+
class wr extends f {
|
|
3456
3552
|
async workIncrement(e) {
|
|
3457
3553
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
3458
3554
|
}
|
|
@@ -3464,18 +3560,18 @@ class nr extends f {
|
|
|
3464
3560
|
});
|
|
3465
3561
|
}
|
|
3466
3562
|
}
|
|
3467
|
-
const
|
|
3563
|
+
const gr = (n) => ie.create({
|
|
3468
3564
|
user: n
|
|
3469
3565
|
});
|
|
3470
|
-
async function
|
|
3471
|
-
const e = await
|
|
3472
|
-
return e || y(await
|
|
3566
|
+
async function Sr(n) {
|
|
3567
|
+
const e = await ie.findOne({ user: n }).lean();
|
|
3568
|
+
return e || y(await gr(n));
|
|
3473
3569
|
}
|
|
3474
|
-
const
|
|
3570
|
+
const br = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
|
|
3475
3571
|
upsert: !0,
|
|
3476
3572
|
returnDocument: "after"
|
|
3477
3573
|
}).lean();
|
|
3478
|
-
class
|
|
3574
|
+
class $r extends wr {
|
|
3479
3575
|
constructor() {
|
|
3480
3576
|
super(300);
|
|
3481
3577
|
}
|
|
@@ -3486,14 +3582,14 @@ class ir extends nr {
|
|
|
3486
3582
|
return e;
|
|
3487
3583
|
}
|
|
3488
3584
|
fetchFromDb(e) {
|
|
3489
|
-
return
|
|
3585
|
+
return Sr(e);
|
|
3490
3586
|
}
|
|
3491
3587
|
updateInDb(e, t) {
|
|
3492
|
-
return
|
|
3588
|
+
return br(e, t);
|
|
3493
3589
|
}
|
|
3494
3590
|
}
|
|
3495
|
-
const
|
|
3496
|
-
class
|
|
3591
|
+
const Er = new $r();
|
|
3592
|
+
class Ur extends f {
|
|
3497
3593
|
async randomMessageIncrement(e) {
|
|
3498
3594
|
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
3499
3595
|
}
|
|
@@ -3511,18 +3607,18 @@ class cr extends f {
|
|
|
3511
3607
|
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
3512
3608
|
}
|
|
3513
3609
|
}
|
|
3514
|
-
const
|
|
3610
|
+
const Ir = async (n) => await ue.create({
|
|
3515
3611
|
user: n
|
|
3516
3612
|
});
|
|
3517
|
-
async function
|
|
3518
|
-
const e = await
|
|
3519
|
-
return e || y(await
|
|
3613
|
+
async function Tr(n) {
|
|
3614
|
+
const e = await ue.findOne({ user: n }).lean();
|
|
3615
|
+
return e || y(await Ir(n));
|
|
3520
3616
|
}
|
|
3521
|
-
const
|
|
3617
|
+
const Or = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
|
|
3522
3618
|
upsert: !0,
|
|
3523
3619
|
returnDocument: "after"
|
|
3524
3620
|
}).lean();
|
|
3525
|
-
class
|
|
3621
|
+
class Dr extends Ur {
|
|
3526
3622
|
constructor() {
|
|
3527
3623
|
super(300);
|
|
3528
3624
|
}
|
|
@@ -3535,14 +3631,14 @@ class pr extends cr {
|
|
|
3535
3631
|
return e;
|
|
3536
3632
|
}
|
|
3537
3633
|
fetchFromDb(e) {
|
|
3538
|
-
return
|
|
3634
|
+
return Tr(e);
|
|
3539
3635
|
}
|
|
3540
3636
|
updateInDb(e, t) {
|
|
3541
|
-
return
|
|
3637
|
+
return Or(e, t);
|
|
3542
3638
|
}
|
|
3543
3639
|
}
|
|
3544
|
-
const
|
|
3545
|
-
class
|
|
3640
|
+
const Qs = new Dr();
|
|
3641
|
+
class Cr extends f {
|
|
3546
3642
|
async hasReportedSomeone(e) {
|
|
3547
3643
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
3548
3644
|
}
|
|
@@ -3573,18 +3669,18 @@ class yr extends f {
|
|
|
3573
3669
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
3574
3670
|
}
|
|
3575
3671
|
}
|
|
3576
|
-
const
|
|
3672
|
+
const Rr = async (n) => await ce.create({
|
|
3577
3673
|
user: n
|
|
3578
3674
|
});
|
|
3579
|
-
async function
|
|
3580
|
-
const e = await
|
|
3581
|
-
return e || y(await
|
|
3675
|
+
async function vr(n) {
|
|
3676
|
+
const e = await ce.findOne({ user: n }).lean();
|
|
3677
|
+
return e || y(await Rr(n));
|
|
3582
3678
|
}
|
|
3583
|
-
const
|
|
3679
|
+
const Mr = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
|
|
3584
3680
|
upsert: !0,
|
|
3585
3681
|
returnDocument: "after"
|
|
3586
3682
|
}).lean();
|
|
3587
|
-
class
|
|
3683
|
+
class Ar extends Cr {
|
|
3588
3684
|
constructor() {
|
|
3589
3685
|
super(300);
|
|
3590
3686
|
}
|
|
@@ -3595,17 +3691,17 @@ class wr extends yr {
|
|
|
3595
3691
|
return e;
|
|
3596
3692
|
}
|
|
3597
3693
|
fetchFromDb(e) {
|
|
3598
|
-
return
|
|
3694
|
+
return vr(e);
|
|
3599
3695
|
}
|
|
3600
3696
|
updateInDb(e, t) {
|
|
3601
|
-
return
|
|
3697
|
+
return Mr(e, t);
|
|
3602
3698
|
}
|
|
3603
3699
|
}
|
|
3604
|
-
const
|
|
3605
|
-
class
|
|
3700
|
+
const Ws = new Ar();
|
|
3701
|
+
class Br extends f {
|
|
3606
3702
|
async readEdito(e) {
|
|
3607
3703
|
const t = /* @__PURE__ */ new Date();
|
|
3608
|
-
t.setHours(0, 0, 0, 0), await
|
|
3704
|
+
t.setHours(0, 0, 0, 0), await M.updateOne(
|
|
3609
3705
|
{
|
|
3610
3706
|
user: e,
|
|
3611
3707
|
"edito.lastTimeRead": {
|
|
@@ -3616,7 +3712,7 @@ class gr extends f {
|
|
|
3616
3712
|
$inc: { "edito.readToday": 1 },
|
|
3617
3713
|
$set: { "edito.lastTimeRead": /* @__PURE__ */ new Date() }
|
|
3618
3714
|
}
|
|
3619
|
-
), await
|
|
3715
|
+
), await M.updateOne(
|
|
3620
3716
|
{
|
|
3621
3717
|
user: e,
|
|
3622
3718
|
"edito.lastTimeRead": {
|
|
@@ -3629,18 +3725,18 @@ class gr extends f {
|
|
|
3629
3725
|
), this.invalidate(e);
|
|
3630
3726
|
}
|
|
3631
3727
|
}
|
|
3632
|
-
const
|
|
3728
|
+
const _r = async (n) => await M.create({
|
|
3633
3729
|
user: n
|
|
3634
3730
|
});
|
|
3635
|
-
async function
|
|
3636
|
-
const e = await
|
|
3637
|
-
return e || y(await
|
|
3731
|
+
async function xr(n) {
|
|
3732
|
+
const e = await M.findOne({ user: n }).lean();
|
|
3733
|
+
return e || y(await _r(n));
|
|
3638
3734
|
}
|
|
3639
|
-
const
|
|
3735
|
+
const qr = (n, e) => M.findOneAndUpdate({ user: n }, e, {
|
|
3640
3736
|
upsert: !0,
|
|
3641
3737
|
returnDocument: "after"
|
|
3642
3738
|
}).lean();
|
|
3643
|
-
class
|
|
3739
|
+
class kr extends Br {
|
|
3644
3740
|
constructor() {
|
|
3645
3741
|
super(300);
|
|
3646
3742
|
}
|
|
@@ -3651,20 +3747,20 @@ class Er extends gr {
|
|
|
3651
3747
|
return e;
|
|
3652
3748
|
}
|
|
3653
3749
|
fetchFromDb(e) {
|
|
3654
|
-
return
|
|
3750
|
+
return xr(e);
|
|
3655
3751
|
}
|
|
3656
3752
|
updateInDb(e, t) {
|
|
3657
|
-
return
|
|
3753
|
+
return qr(e, t);
|
|
3658
3754
|
}
|
|
3659
3755
|
}
|
|
3660
|
-
const
|
|
3661
|
-
class
|
|
3756
|
+
const Gs = new kr();
|
|
3757
|
+
class Nr extends f {
|
|
3662
3758
|
async updateCraftStats(e, t, a) {
|
|
3663
|
-
const r = await
|
|
3664
|
-
!r || !
|
|
3759
|
+
const r = await d.get(a);
|
|
3760
|
+
!r || !d.isItem(r) || await this.update(e, {
|
|
3665
3761
|
$inc: {
|
|
3666
|
-
"crafts.cookedMeal":
|
|
3667
|
-
"crafts.scrolls":
|
|
3762
|
+
"crafts.cookedMeal": d.isCookedMeal(r) ? t : 0,
|
|
3763
|
+
"crafts.scrolls": d.isScrollItem(r) ? t : 0,
|
|
3668
3764
|
"crafts.totalCrafted": t
|
|
3669
3765
|
}
|
|
3670
3766
|
});
|
|
@@ -3681,7 +3777,7 @@ class Ir extends f {
|
|
|
3681
3777
|
}
|
|
3682
3778
|
async incrementBottleUsedToday(e, t) {
|
|
3683
3779
|
const a = /* @__PURE__ */ new Date();
|
|
3684
|
-
a.setHours(0, 0, 0, 0), await
|
|
3780
|
+
a.setHours(0, 0, 0, 0), await A.updateOne(
|
|
3685
3781
|
{
|
|
3686
3782
|
user: e,
|
|
3687
3783
|
"bottle.lastUsed": {
|
|
@@ -3692,7 +3788,7 @@ class Ir extends f {
|
|
|
3692
3788
|
$inc: { "bottle.usedToday": t },
|
|
3693
3789
|
$set: { "bottle.lastUsed": /* @__PURE__ */ new Date() }
|
|
3694
3790
|
}
|
|
3695
|
-
), await
|
|
3791
|
+
), await A.updateOne(
|
|
3696
3792
|
{
|
|
3697
3793
|
user: e,
|
|
3698
3794
|
"bottle.lastUsed": {
|
|
@@ -3718,18 +3814,18 @@ class Ir extends f {
|
|
|
3718
3814
|
});
|
|
3719
3815
|
}
|
|
3720
3816
|
}
|
|
3721
|
-
const
|
|
3817
|
+
const Fr = async (n) => await A.create({
|
|
3722
3818
|
user: n
|
|
3723
3819
|
});
|
|
3724
|
-
async function
|
|
3725
|
-
const e = await
|
|
3726
|
-
return e || y(await
|
|
3820
|
+
async function jr(n) {
|
|
3821
|
+
const e = await A.findOne({ user: n }).lean();
|
|
3822
|
+
return e || y(await Fr(n));
|
|
3727
3823
|
}
|
|
3728
|
-
const
|
|
3824
|
+
const zr = (n, e) => A.findOneAndUpdate({ user: n }, e, {
|
|
3729
3825
|
upsert: !0,
|
|
3730
3826
|
returnDocument: "after"
|
|
3731
3827
|
}).lean();
|
|
3732
|
-
class
|
|
3828
|
+
class Pr extends Nr {
|
|
3733
3829
|
constructor() {
|
|
3734
3830
|
super(300);
|
|
3735
3831
|
}
|
|
@@ -3740,36 +3836,39 @@ class Dr extends Ir {
|
|
|
3740
3836
|
return e;
|
|
3741
3837
|
}
|
|
3742
3838
|
fetchFromDb(e) {
|
|
3743
|
-
return
|
|
3839
|
+
return jr(e);
|
|
3744
3840
|
}
|
|
3745
3841
|
updateInDb(e, t) {
|
|
3746
|
-
return
|
|
3842
|
+
return zr(e, t);
|
|
3747
3843
|
}
|
|
3748
3844
|
}
|
|
3749
|
-
const
|
|
3845
|
+
const Ys = new Pr(), Kr = new u({
|
|
3750
3846
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3751
3847
|
authorId: { type: String, required: !0 },
|
|
3752
3848
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
3753
3849
|
reason: { type: String, required: !0 },
|
|
3754
3850
|
guildId: { type: String, required: !0 }
|
|
3755
|
-
}),
|
|
3851
|
+
}), oe = l?.Bans || p("Bans", Kr), Hr = (n) => oe.create({
|
|
3756
3852
|
...n
|
|
3757
|
-
})
|
|
3758
|
-
class
|
|
3853
|
+
});
|
|
3854
|
+
class Lr extends b {
|
|
3759
3855
|
async getUnbanUsers() {
|
|
3760
3856
|
return this.getMany({
|
|
3761
3857
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
3762
3858
|
});
|
|
3763
3859
|
}
|
|
3764
3860
|
async banUserFromGuild(e) {
|
|
3765
|
-
await
|
|
3861
|
+
await Hr(e);
|
|
3766
3862
|
}
|
|
3767
3863
|
async isBannedFromGuild(e, t) {
|
|
3768
|
-
|
|
3864
|
+
const a = await this.get({ bannedUserId: e, guildId: t });
|
|
3865
|
+
return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
3769
3866
|
}
|
|
3770
3867
|
}
|
|
3771
|
-
const
|
|
3772
|
-
|
|
3868
|
+
const Qr = (n) => oe.find(n).lean(), Wr = (n) => oe.findOne(n).lean(), Gr = (n, e) => oe.findOneAndUpdate(n, e, {
|
|
3869
|
+
returnDocument: "after"
|
|
3870
|
+
}).lean();
|
|
3871
|
+
class Yr extends Lr {
|
|
3773
3872
|
constructor() {
|
|
3774
3873
|
super(3600 * 36);
|
|
3775
3874
|
}
|
|
@@ -3780,16 +3879,16 @@ class Br extends vr {
|
|
|
3780
3879
|
return { bannedUserId: e, guildId: t };
|
|
3781
3880
|
}
|
|
3782
3881
|
fetchFromDb(e) {
|
|
3783
|
-
return
|
|
3882
|
+
return Wr(e);
|
|
3784
3883
|
}
|
|
3785
3884
|
fetchManyFromDb(e) {
|
|
3786
|
-
return
|
|
3885
|
+
return Qr(e);
|
|
3787
3886
|
}
|
|
3788
|
-
updateInDb() {
|
|
3789
|
-
|
|
3887
|
+
updateInDb(e, t) {
|
|
3888
|
+
return Gr(e, t);
|
|
3790
3889
|
}
|
|
3791
3890
|
}
|
|
3792
|
-
const
|
|
3891
|
+
const Xs = new Yr(), Xr = new u({
|
|
3793
3892
|
senderId: {
|
|
3794
3893
|
type: u.Types.ObjectId,
|
|
3795
3894
|
required: !0,
|
|
@@ -3806,33 +3905,35 @@ const qs = new Br(), qr = new u({
|
|
|
3806
3905
|
meta: {
|
|
3807
3906
|
rps: { type: String, default: void 0 }
|
|
3808
3907
|
}
|
|
3809
|
-
}),
|
|
3908
|
+
}), de = l?.Invitation || p("Invitation", Xr), Vr = (n) => de.create({
|
|
3810
3909
|
...n
|
|
3811
|
-
}),
|
|
3812
|
-
await
|
|
3910
|
+
}), Jr = async (n) => {
|
|
3911
|
+
await de.deleteMany({
|
|
3813
3912
|
...n
|
|
3814
3913
|
});
|
|
3815
3914
|
};
|
|
3816
|
-
class
|
|
3915
|
+
class Zr extends f {
|
|
3817
3916
|
async sendInvitation({
|
|
3818
3917
|
senderId: e,
|
|
3819
3918
|
receiverId: t,
|
|
3820
3919
|
gameMode: a,
|
|
3821
3920
|
...r
|
|
3822
3921
|
}) {
|
|
3823
|
-
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? !1 : (await
|
|
3922
|
+
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? !1 : (await Vr({ ...r, senderId: e, gameMode: a, receiverId: t }), !0);
|
|
3824
3923
|
}
|
|
3825
3924
|
async receiveInvitation(e) {
|
|
3826
3925
|
return this.get(e);
|
|
3827
3926
|
}
|
|
3828
3927
|
async deleteInvitation(e) {
|
|
3829
|
-
await
|
|
3928
|
+
await Jr(e), this.invalidate(e);
|
|
3830
3929
|
}
|
|
3831
3930
|
}
|
|
3832
|
-
const
|
|
3931
|
+
const es = (n) => de.findOne({
|
|
3833
3932
|
...n
|
|
3933
|
+
}).lean(), ts = (n, e) => de.findOneAndUpdate(n, e, {
|
|
3934
|
+
returnDocument: "after"
|
|
3834
3935
|
}).lean();
|
|
3835
|
-
class
|
|
3936
|
+
class ns extends Zr {
|
|
3836
3937
|
constructor() {
|
|
3837
3938
|
super(3600);
|
|
3838
3939
|
}
|
|
@@ -3847,19 +3948,19 @@ class jr extends Nr {
|
|
|
3847
3948
|
return { gameMode: t, receiverId: e, senderId: a };
|
|
3848
3949
|
}
|
|
3849
3950
|
fetchFromDb(e) {
|
|
3850
|
-
return
|
|
3951
|
+
return es(e);
|
|
3851
3952
|
}
|
|
3852
|
-
updateInDb() {
|
|
3853
|
-
|
|
3953
|
+
updateInDb(e, t) {
|
|
3954
|
+
return ts(e, t);
|
|
3854
3955
|
}
|
|
3855
3956
|
}
|
|
3856
|
-
const
|
|
3857
|
-
class
|
|
3957
|
+
const Vs = new ns();
|
|
3958
|
+
class as extends f {
|
|
3858
3959
|
async setEditoChannel(e, t) {
|
|
3859
3960
|
await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
|
|
3860
3961
|
}
|
|
3861
3962
|
async randomizeEditoPrice(e) {
|
|
3862
|
-
const t =
|
|
3963
|
+
const t = Y(100, 1001);
|
|
3863
3964
|
return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
|
|
3864
3965
|
}
|
|
3865
3966
|
async setEditoMessageId(e, t) {
|
|
@@ -3915,7 +4016,7 @@ class zr extends f {
|
|
|
3915
4016
|
);
|
|
3916
4017
|
}
|
|
3917
4018
|
}
|
|
3918
|
-
const
|
|
4019
|
+
const rs = new u({
|
|
3919
4020
|
guildId: { type: String, required: !0, unique: !0 },
|
|
3920
4021
|
ranking: {
|
|
3921
4022
|
channelId: { type: String, default: null },
|
|
@@ -3957,16 +4058,16 @@ const Kr = new u({
|
|
|
3957
4058
|
}
|
|
3958
4059
|
},
|
|
3959
4060
|
shopChannelId: { type: String, default: null }
|
|
3960
|
-
}),
|
|
4061
|
+
}), Ue = l?.Settings || p("Settings", rs), ss = (n) => Ue.create({
|
|
3961
4062
|
guildId: n
|
|
3962
|
-
}),
|
|
3963
|
-
const e = await
|
|
3964
|
-
return e || y(await
|
|
3965
|
-
},
|
|
4063
|
+
}), is = async (n) => {
|
|
4064
|
+
const e = await Ue.findOne({ guildId: n }).lean();
|
|
4065
|
+
return e || y(await ss(n));
|
|
4066
|
+
}, us = (n, e) => Ue.findOneAndUpdate(n, e, {
|
|
3966
4067
|
upsert: !0,
|
|
3967
4068
|
returnDocument: "after"
|
|
3968
4069
|
}).lean();
|
|
3969
|
-
class
|
|
4070
|
+
class cs extends as {
|
|
3970
4071
|
constructor() {
|
|
3971
4072
|
super(3600 * 24 * 30);
|
|
3972
4073
|
}
|
|
@@ -3977,13 +4078,13 @@ class Qr extends zr {
|
|
|
3977
4078
|
return e;
|
|
3978
4079
|
}
|
|
3979
4080
|
fetchFromDb(e) {
|
|
3980
|
-
return
|
|
4081
|
+
return is(e);
|
|
3981
4082
|
}
|
|
3982
4083
|
updateInDb(e, t) {
|
|
3983
|
-
return
|
|
4084
|
+
return us(e, t);
|
|
3984
4085
|
}
|
|
3985
4086
|
}
|
|
3986
|
-
const
|
|
4087
|
+
const Js = new cs(), os = new u(
|
|
3987
4088
|
{
|
|
3988
4089
|
shopType: { type: String, required: !0, unique: !0 },
|
|
3989
4090
|
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
@@ -4012,11 +4113,11 @@ const ks = new Qr(), Wr = new u(
|
|
|
4012
4113
|
}
|
|
4013
4114
|
},
|
|
4014
4115
|
{ minimize: !1 }
|
|
4015
|
-
),
|
|
4116
|
+
), Ie = l?.Shop || p("Shop", os), ds = (n) => Ie.create({
|
|
4016
4117
|
shopType: n
|
|
4017
|
-
}),
|
|
4018
|
-
const e = await
|
|
4019
|
-
return e || y(await
|
|
4118
|
+
}), ls = async (n) => {
|
|
4119
|
+
const e = await Ie.findOne({ shopType: n }).lean();
|
|
4120
|
+
return e || y(await ds(n));
|
|
4020
4121
|
};
|
|
4021
4122
|
class E {
|
|
4022
4123
|
toDBShopItem() {
|
|
@@ -4028,14 +4129,14 @@ class E {
|
|
|
4028
4129
|
};
|
|
4029
4130
|
}
|
|
4030
4131
|
async onBuy(e, t) {
|
|
4031
|
-
this.currency === "berry" ? (await
|
|
4132
|
+
this.currency === "berry" ? (await I.updateUserBerry(
|
|
4032
4133
|
e,
|
|
4033
4134
|
-1 * this.price * t,
|
|
4034
4135
|
!1
|
|
4035
|
-
), await
|
|
4136
|
+
), await Er.updateTotalSpentInShop(
|
|
4036
4137
|
e,
|
|
4037
4138
|
this.price * t
|
|
4038
|
-
)) : await
|
|
4139
|
+
)) : await S.removeItem(
|
|
4039
4140
|
e,
|
|
4040
4141
|
this.currency,
|
|
4041
4142
|
this.price * t
|
|
@@ -4069,7 +4170,7 @@ class E {
|
|
|
4069
4170
|
return !1;
|
|
4070
4171
|
}
|
|
4071
4172
|
}
|
|
4072
|
-
class
|
|
4173
|
+
class ps extends E {
|
|
4073
4174
|
price;
|
|
4074
4175
|
size;
|
|
4075
4176
|
currency;
|
|
@@ -4083,13 +4184,13 @@ class Xr extends E {
|
|
|
4083
4184
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4084
4185
|
}
|
|
4085
4186
|
async onBuy(e, t) {
|
|
4086
|
-
await super.onBuy(e, t), await
|
|
4187
|
+
await super.onBuy(e, t), await G.unlockBackground(e, this.data.ornamentId);
|
|
4087
4188
|
}
|
|
4088
4189
|
isBackground() {
|
|
4089
4190
|
return !0;
|
|
4090
4191
|
}
|
|
4091
4192
|
}
|
|
4092
|
-
class
|
|
4193
|
+
class ys extends E {
|
|
4093
4194
|
price;
|
|
4094
4195
|
size;
|
|
4095
4196
|
currency;
|
|
@@ -4103,13 +4204,13 @@ class Vr extends E {
|
|
|
4103
4204
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4104
4205
|
}
|
|
4105
4206
|
async onBuy(e, t) {
|
|
4106
|
-
await super.onBuy(e, t), await
|
|
4207
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4107
4208
|
}
|
|
4108
4209
|
isBoostXp() {
|
|
4109
4210
|
return !0;
|
|
4110
4211
|
}
|
|
4111
4212
|
}
|
|
4112
|
-
class
|
|
4213
|
+
class fs extends E {
|
|
4113
4214
|
price;
|
|
4114
4215
|
size;
|
|
4115
4216
|
currency;
|
|
@@ -4123,13 +4224,13 @@ class Jr extends E {
|
|
|
4123
4224
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4124
4225
|
}
|
|
4125
4226
|
async onBuy(e, t) {
|
|
4126
|
-
await super.onBuy(e, t), await
|
|
4227
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4127
4228
|
}
|
|
4128
4229
|
isChest() {
|
|
4129
4230
|
return !0;
|
|
4130
4231
|
}
|
|
4131
4232
|
}
|
|
4132
|
-
class
|
|
4233
|
+
class ms extends E {
|
|
4133
4234
|
price;
|
|
4134
4235
|
size;
|
|
4135
4236
|
currency;
|
|
@@ -4143,13 +4244,13 @@ class Zr extends E {
|
|
|
4143
4244
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4144
4245
|
}
|
|
4145
4246
|
async onBuy(e, t) {
|
|
4146
|
-
await super.onBuy(e, t), await
|
|
4247
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4147
4248
|
}
|
|
4148
4249
|
isObject() {
|
|
4149
4250
|
return !0;
|
|
4150
4251
|
}
|
|
4151
4252
|
}
|
|
4152
|
-
class
|
|
4253
|
+
class hs extends E {
|
|
4153
4254
|
price;
|
|
4154
4255
|
size;
|
|
4155
4256
|
currency;
|
|
@@ -4163,10 +4264,10 @@ class es extends E {
|
|
|
4163
4264
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4164
4265
|
}
|
|
4165
4266
|
async onBuy(e, t) {
|
|
4166
|
-
await super.onBuy(e, t), await
|
|
4267
|
+
await super.onBuy(e, t), await S.addEquipments(
|
|
4167
4268
|
e,
|
|
4168
|
-
|
|
4169
|
-
() =>
|
|
4269
|
+
yt({ stop: t }).map(
|
|
4270
|
+
() => d.seedEquipment(
|
|
4170
4271
|
{ ...this.data },
|
|
4171
4272
|
Date.now() - Math.round(Math.random() * 1e3)
|
|
4172
4273
|
)
|
|
@@ -4180,7 +4281,7 @@ class es extends E {
|
|
|
4180
4281
|
return !0;
|
|
4181
4282
|
}
|
|
4182
4283
|
}
|
|
4183
|
-
class
|
|
4284
|
+
class ws extends E {
|
|
4184
4285
|
price;
|
|
4185
4286
|
size;
|
|
4186
4287
|
currency;
|
|
@@ -4194,13 +4295,13 @@ class ts extends E {
|
|
|
4194
4295
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4195
4296
|
}
|
|
4196
4297
|
async onBuy(e, t) {
|
|
4197
|
-
await super.onBuy(e, t), await
|
|
4298
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4198
4299
|
}
|
|
4199
4300
|
isBottle() {
|
|
4200
4301
|
return !0;
|
|
4201
4302
|
}
|
|
4202
4303
|
}
|
|
4203
|
-
class
|
|
4304
|
+
class gs extends E {
|
|
4204
4305
|
price;
|
|
4205
4306
|
size;
|
|
4206
4307
|
currency;
|
|
@@ -4214,13 +4315,13 @@ class ns extends E {
|
|
|
4214
4315
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4215
4316
|
}
|
|
4216
4317
|
async onBuy(e, t) {
|
|
4217
|
-
await super.onBuy(e, t), await
|
|
4318
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4218
4319
|
}
|
|
4219
4320
|
isRepair() {
|
|
4220
4321
|
return !0;
|
|
4221
4322
|
}
|
|
4222
4323
|
}
|
|
4223
|
-
class
|
|
4324
|
+
class Ss extends E {
|
|
4224
4325
|
price;
|
|
4225
4326
|
size;
|
|
4226
4327
|
currency;
|
|
@@ -4234,13 +4335,13 @@ class as extends E {
|
|
|
4234
4335
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4235
4336
|
}
|
|
4236
4337
|
async onBuy(e, t) {
|
|
4237
|
-
await super.onBuy(e, t), await
|
|
4338
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4238
4339
|
}
|
|
4239
4340
|
isStore() {
|
|
4240
4341
|
return !0;
|
|
4241
4342
|
}
|
|
4242
4343
|
}
|
|
4243
|
-
class
|
|
4344
|
+
class bs extends E {
|
|
4244
4345
|
price;
|
|
4245
4346
|
size;
|
|
4246
4347
|
currency;
|
|
@@ -4254,36 +4355,36 @@ class rs extends E {
|
|
|
4254
4355
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4255
4356
|
}
|
|
4256
4357
|
async onBuy(e, t) {
|
|
4257
|
-
await super.onBuy(e, t), await
|
|
4358
|
+
await super.onBuy(e, t), await G.unlockTitle(e, this.data.ornamentId);
|
|
4258
4359
|
}
|
|
4259
4360
|
isTitle() {
|
|
4260
4361
|
return !0;
|
|
4261
4362
|
}
|
|
4262
4363
|
}
|
|
4263
|
-
class
|
|
4364
|
+
class $s extends f {
|
|
4264
4365
|
async getShopItem(e, t) {
|
|
4265
|
-
const r = (await this.get(e)).items.find((
|
|
4366
|
+
const r = (await this.get(e)).items.find((w) => w.id === t);
|
|
4266
4367
|
if (!r)
|
|
4267
4368
|
return;
|
|
4268
|
-
const { price: s, size: i, currency: o } = r, c = await
|
|
4269
|
-
if (
|
|
4270
|
-
return new
|
|
4271
|
-
if (
|
|
4272
|
-
return new
|
|
4273
|
-
if (
|
|
4274
|
-
return new
|
|
4275
|
-
if (
|
|
4276
|
-
return new
|
|
4277
|
-
if (
|
|
4278
|
-
return new
|
|
4279
|
-
if (
|
|
4280
|
-
return new
|
|
4281
|
-
if (
|
|
4282
|
-
return new
|
|
4283
|
-
if (
|
|
4284
|
-
return new
|
|
4285
|
-
if (
|
|
4286
|
-
return new
|
|
4369
|
+
const { price: s, size: i, currency: o } = r, c = await d.get(r.id) ?? await g.get(r.id);
|
|
4370
|
+
if (g.isOrnament(c) && g.isBackground(c))
|
|
4371
|
+
return new ps({ price: s, item: c, size: i, currency: o });
|
|
4372
|
+
if (g.isOrnament(c) && g.isTitle(c))
|
|
4373
|
+
return new bs({ price: s, item: c, size: i, currency: o });
|
|
4374
|
+
if (d.isEntity(c) && d.isChestItem(c))
|
|
4375
|
+
return new fs({ price: s, item: c, size: i, currency: o });
|
|
4376
|
+
if (d.isEntity(c) && d.isBoostItem(c))
|
|
4377
|
+
return new ys({ price: s, item: c, size: i, currency: o });
|
|
4378
|
+
if (d.isEntity(c) && d.isRepairItem(c))
|
|
4379
|
+
return new gs({ price: s, item: c, size: i, currency: o });
|
|
4380
|
+
if (d.isEntity(c) && d.isStoreItem(c))
|
|
4381
|
+
return new Ss({ price: s, item: c, size: i, currency: o });
|
|
4382
|
+
if (d.isEntity(c) && d.isObjectItem(c))
|
|
4383
|
+
return new ms({ price: s, item: c, size: i, currency: o });
|
|
4384
|
+
if (d.isEntity(c) && d.isEquipment(c))
|
|
4385
|
+
return new hs({ price: s, item: c, size: i, currency: o });
|
|
4386
|
+
if (d.isEntity(c) && d.isBottleItem(c))
|
|
4387
|
+
return new ws({ price: s, size: i, item: c, currency: o });
|
|
4287
4388
|
}
|
|
4288
4389
|
async getShopItemList(e) {
|
|
4289
4390
|
const t = await this.get(e), a = [];
|
|
@@ -4294,7 +4395,7 @@ class ss extends f {
|
|
|
4294
4395
|
return a;
|
|
4295
4396
|
}
|
|
4296
4397
|
getShopItemId(e) {
|
|
4297
|
-
return
|
|
4398
|
+
return d.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
|
|
4298
4399
|
}
|
|
4299
4400
|
async updateShopStats(e, t, a) {
|
|
4300
4401
|
await this.update(
|
|
@@ -4342,8 +4443,8 @@ class ss extends f {
|
|
|
4342
4443
|
);
|
|
4343
4444
|
}
|
|
4344
4445
|
}
|
|
4345
|
-
const
|
|
4346
|
-
class
|
|
4446
|
+
const Es = (n, e) => Ie.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
4447
|
+
class Us extends $s {
|
|
4347
4448
|
constructor() {
|
|
4348
4449
|
super(3600);
|
|
4349
4450
|
}
|
|
@@ -4354,28 +4455,28 @@ class us extends ss {
|
|
|
4354
4455
|
return e;
|
|
4355
4456
|
}
|
|
4356
4457
|
fetchFromDb(e) {
|
|
4357
|
-
return
|
|
4458
|
+
return ls(e);
|
|
4358
4459
|
}
|
|
4359
4460
|
updateInDb(e, t) {
|
|
4360
|
-
return
|
|
4461
|
+
return Es(e, t);
|
|
4361
4462
|
}
|
|
4362
4463
|
}
|
|
4363
|
-
const
|
|
4464
|
+
const Zs = new Us(), Is = new u({
|
|
4364
4465
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
4365
4466
|
authorId: String,
|
|
4366
4467
|
date: { type: Date, default: Date.now() },
|
|
4367
4468
|
reason: { type: String, default: null }
|
|
4368
|
-
}),
|
|
4369
|
-
class
|
|
4469
|
+
}), tt = l?.Warn || p("Warn", Is), Ts = (n) => tt.countDocuments(n);
|
|
4470
|
+
class Os extends b {
|
|
4370
4471
|
getUserWarns(e) {
|
|
4371
4472
|
return this.getMany({ warnedUserId: e });
|
|
4372
4473
|
}
|
|
4373
4474
|
getUserWarnCount(e) {
|
|
4374
|
-
return
|
|
4475
|
+
return Ts({ warnedUserId: e });
|
|
4375
4476
|
}
|
|
4376
4477
|
}
|
|
4377
|
-
const
|
|
4378
|
-
class
|
|
4478
|
+
const Ds = (n) => tt.find(n).lean();
|
|
4479
|
+
class Cs extends Os {
|
|
4379
4480
|
constructor() {
|
|
4380
4481
|
super(300);
|
|
4381
4482
|
}
|
|
@@ -4389,60 +4490,62 @@ class ps extends ds {
|
|
|
4389
4490
|
throw new Error("Method not implemented.");
|
|
4390
4491
|
}
|
|
4391
4492
|
fetchManyFromDb(e) {
|
|
4392
|
-
return
|
|
4493
|
+
return Ds(e);
|
|
4393
4494
|
}
|
|
4394
4495
|
updateInDb() {
|
|
4395
4496
|
throw new Error("Method not implemented.");
|
|
4396
4497
|
}
|
|
4397
4498
|
}
|
|
4398
|
-
const
|
|
4399
|
-
|
|
4499
|
+
const ei = new Cs(), ti = (n) => {
|
|
4500
|
+
ut(n);
|
|
4400
4501
|
};
|
|
4401
|
-
class
|
|
4502
|
+
class ni extends ct.ObjectId {
|
|
4402
4503
|
}
|
|
4403
4504
|
export {
|
|
4404
|
-
|
|
4405
|
-
|
|
4505
|
+
Fs as COOLDOWN_COMMANDS,
|
|
4506
|
+
ni as ObjectId,
|
|
4406
4507
|
h as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4508
|
+
me as RAID_MIDDLEWARE_EVENT_NAME,
|
|
4509
|
+
Xs as banService,
|
|
4510
|
+
ti as connectToServices,
|
|
4511
|
+
Ce as crewMetaService,
|
|
4512
|
+
xs as crewOrnamentsService,
|
|
4513
|
+
qs as crewQuestService,
|
|
4514
|
+
Mt as crewService,
|
|
4515
|
+
ks as crewStatsEngagementService,
|
|
4516
|
+
Ns as crewStatsFrequencyService,
|
|
4416
4517
|
m as emitQuestMiddlewareEvent,
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4518
|
+
fe as emitRaidMiddlewareEvent,
|
|
4519
|
+
d as entityService,
|
|
4520
|
+
ls as findShop,
|
|
4521
|
+
Vs as invitationService,
|
|
4522
|
+
g as ornamentService,
|
|
4523
|
+
U as panoplyService,
|
|
4524
|
+
Bs as registerQuestMiddlewareEvents,
|
|
4525
|
+
_s as registerRaidMiddlewareEvents,
|
|
4526
|
+
H as reminderService,
|
|
4527
|
+
Js as settingsService,
|
|
4528
|
+
Ie as shopModel,
|
|
4529
|
+
Zs as shopService,
|
|
4530
|
+
Ra as userCooldownService,
|
|
4531
|
+
na as userCrewService,
|
|
4532
|
+
js as userDailyReportService,
|
|
4533
|
+
le as userEncyclopediaService,
|
|
4534
|
+
zs as userGamesService,
|
|
4535
|
+
S as userInventoryService,
|
|
4536
|
+
I as userMetaService,
|
|
4537
|
+
G as userOrnamentService,
|
|
4538
|
+
ve as userQuestService,
|
|
4539
|
+
Ps as userRaidService,
|
|
4540
|
+
Sn as userService,
|
|
4541
|
+
Re as userSettingsService,
|
|
4542
|
+
Ks as userShopService,
|
|
4543
|
+
Hs as userStatsCasinoService,
|
|
4544
|
+
Ls as userStatsCrewService,
|
|
4545
|
+
Er as userStatsEconomyService,
|
|
4546
|
+
Qs as userStatsEngagementService,
|
|
4547
|
+
Ws as userStatsFlagsService,
|
|
4548
|
+
Gs as userStatsFrequencyService,
|
|
4549
|
+
Ys as userStatsInventoryService,
|
|
4550
|
+
ei as warnService
|
|
4448
4551
|
};
|