@opfr/services 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +841 -733
- 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 +2 -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-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 ye, 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 De, 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 D, CREW_DEFAULT_XP_PERCENT as ht, DEFAULT_FACTION as wt, RANK_IDS_WITHOUT_BASIC as Oe, 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 Dt } from "@opfr/definitions";
|
|
5
|
+
import * as fe 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 fe.EventEmitter(), m = (n, e, t) => {
|
|
56
|
+
_e.emit(n, e, t);
|
|
57
|
+
}, _s = (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 Ce = 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 fe.EventEmitter(), me = (n, e, t) => {
|
|
83
|
+
xe.emit(n, e, t);
|
|
84
|
+
}, xs = (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
|
+
}, he = {
|
|
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 Ot 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 Ot {
|
|
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 we = l?.CrewMeta || p("CrewMeta", ke), Bt = async (n) => await we.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 we.findOne({ user: n }).lean();
|
|
303
|
+
return e || y(await Bt(n));
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const xt = (n, e) => we.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 ge = l?.CrewOrnaments || p("CrewOrnaments", Ne), Nt = (n) => ge.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 ge.findOne({ crew: n }).lean();
|
|
357
|
+
return e || y(await Nt(n));
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const jt = (n, e) => ge.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 qs = 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 && ye(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: D.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: D.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 ks = 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 Se = l?.CrewStatsEngagement || p(
|
|
512
512
|
"CrewStatsEngagement",
|
|
513
|
-
|
|
514
|
-
),
|
|
513
|
+
je
|
|
514
|
+
), Yt = (n) => Se.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 Se.findOne({ crew: n }).lean();
|
|
519
|
+
return e || y(await Yt(n));
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const Vt = (n, e) => Se.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 Ns = 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 be = l?.CrewStatsFrequency || p(
|
|
564
564
|
"CrewStatsFrequency",
|
|
565
|
-
|
|
566
|
-
),
|
|
565
|
+
ze
|
|
566
|
+
), en = (n) => be.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 be.findOne({ crew: n }).lean();
|
|
571
|
+
return e || y(await en(n));
|
|
572
572
|
}
|
|
573
|
-
const
|
|
573
|
+
const nn = (n, e) => be.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 Fs = 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: D.IN_PROGRESS, index: 1 },
|
|
608
608
|
lastCompletionDate: Date,
|
|
609
609
|
streak: Number
|
|
610
610
|
},
|
|
611
611
|
{ minimize: !1 }
|
|
612
612
|
);
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
613
|
+
Pe.post("findOneAndUpdate", function(n) {
|
|
614
|
+
me(
|
|
615
|
+
he.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
|
+
me(
|
|
735
|
+
he.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 fe.EventEmitter(), dn = (n, e) => {
|
|
745
|
+
on.emit(n, e);
|
|
746
|
+
}, O = {
|
|
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: [O],
|
|
775
775
|
default: []
|
|
776
776
|
},
|
|
777
777
|
work: {
|
|
778
|
-
type: [
|
|
778
|
+
type: [O],
|
|
779
779
|
default: []
|
|
780
780
|
}
|
|
781
781
|
},
|
|
782
782
|
berry: {
|
|
783
783
|
work: {
|
|
784
|
-
type: [
|
|
784
|
+
type: [O],
|
|
785
785
|
default: []
|
|
786
786
|
},
|
|
787
787
|
global: {
|
|
788
|
-
type: [
|
|
788
|
+
type: [O],
|
|
789
789
|
default: []
|
|
790
790
|
}
|
|
791
791
|
},
|
|
792
792
|
drop: {
|
|
793
793
|
work: {
|
|
794
|
-
type: [
|
|
794
|
+
type: [O],
|
|
795
795
|
default: []
|
|
796
796
|
}
|
|
797
797
|
},
|
|
798
798
|
xp: {
|
|
799
799
|
global: {
|
|
800
|
-
type: [
|
|
800
|
+
type: [O],
|
|
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 C = 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
|
+
me(
|
|
885
|
+
he.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 D = 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
|
+
), $e = 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
|
+
$e.post("findOneAndUpdate", function(n) {
|
|
1122
1122
|
m(h.USER, n._id, n);
|
|
1123
1123
|
});
|
|
1124
|
-
|
|
1124
|
+
$e.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", $e);
|
|
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: D.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(), js = [
|
|
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 Dn(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 On 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 Dn(e, t, a);
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const
|
|
1475
|
-
class
|
|
1474
|
+
const H = new On();
|
|
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 !== Oe.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 = Oe[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
|
+
), Ee = l?.Ornaments || p("Ornaments", Rn), vn = async (n, e = {}) => Ee.find(n, e).lean();
|
|
1562
|
+
async function Mn(n) {
|
|
1563
|
+
const e = await Ee.findOne({ ornamentId: n }).lean();
|
|
1564
1564
|
return e || null;
|
|
1565
1565
|
}
|
|
1566
|
-
|
|
1566
|
+
const An = (n, e) => Ee.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 De(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 = De(
|
|
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,31 @@ const Bn = new u(
|
|
|
1934
1932
|
panoply: String
|
|
1935
1933
|
},
|
|
1936
1934
|
{ minimize: !1 }
|
|
1937
|
-
),
|
|
1938
|
-
|
|
1939
|
-
|
|
1935
|
+
), oe = l?.Entities || p("Entities", Hn), Ln = async (n) => await oe.create({
|
|
1936
|
+
...n
|
|
1937
|
+
}), Qn = async (n, e = {}) => oe.find(n, e).lean();
|
|
1938
|
+
async function Wn(n) {
|
|
1939
|
+
const e = await oe.findOne({ entityId: n }).lean();
|
|
1940
1940
|
return e || null;
|
|
1941
1941
|
}
|
|
1942
|
-
|
|
1942
|
+
const Gn = (n, e) => oe.findOneAndUpdate(n, e, {
|
|
1943
|
+
returnDocument: "after"
|
|
1944
|
+
}).lean();
|
|
1945
|
+
class Yn extends Pn {
|
|
1943
1946
|
constructor() {
|
|
1944
1947
|
super(3600);
|
|
1945
1948
|
}
|
|
1949
|
+
createInDb(e) {
|
|
1950
|
+
return Ln(e);
|
|
1951
|
+
}
|
|
1946
1952
|
updateInDb(e, t) {
|
|
1947
|
-
|
|
1953
|
+
return Gn(e, t);
|
|
1948
1954
|
}
|
|
1949
1955
|
fetchFromDb(e) {
|
|
1950
|
-
return
|
|
1956
|
+
return Wn(e);
|
|
1951
1957
|
}
|
|
1952
1958
|
fetchManyFromDb(e) {
|
|
1953
|
-
return
|
|
1959
|
+
return Qn(e);
|
|
1954
1960
|
}
|
|
1955
1961
|
normalizeKey(e) {
|
|
1956
1962
|
return e;
|
|
@@ -1959,14 +1965,14 @@ class Nn extends An {
|
|
|
1959
1965
|
return e.entityId;
|
|
1960
1966
|
}
|
|
1961
1967
|
}
|
|
1962
|
-
const
|
|
1968
|
+
const d = new Yn(), Xn = (n, e, t) => _.create({
|
|
1963
1969
|
user: n,
|
|
1964
1970
|
crew: e,
|
|
1965
1971
|
permission: t
|
|
1966
|
-
}),
|
|
1972
|
+
}), Vn = async (n) => {
|
|
1967
1973
|
await _.deleteOne({ user: n });
|
|
1968
1974
|
};
|
|
1969
|
-
class
|
|
1975
|
+
class Jn extends b {
|
|
1970
1976
|
async updatePercent(e, t) {
|
|
1971
1977
|
await this.update(e, {
|
|
1972
1978
|
$set: {
|
|
@@ -1982,10 +1988,10 @@ class zn extends b {
|
|
|
1982
1988
|
});
|
|
1983
1989
|
}
|
|
1984
1990
|
async addUserToCrew(e, t, a) {
|
|
1985
|
-
await
|
|
1991
|
+
await Xn(e, t, a), this.invalidate(t);
|
|
1986
1992
|
}
|
|
1987
1993
|
async removeUserFromCrew(e, t) {
|
|
1988
|
-
await
|
|
1994
|
+
await Vn(e), this.invalidate(e), this.invalidate(t);
|
|
1989
1995
|
}
|
|
1990
1996
|
async getAllUserIdsFromCrew(e) {
|
|
1991
1997
|
const t = e.toString(), a = this.cache.get(t);
|
|
@@ -1995,8 +2001,8 @@ class zn extends b {
|
|
|
1995
2001
|
return this.cache.set(t, r), r.map(({ user: s }) => s);
|
|
1996
2002
|
}
|
|
1997
2003
|
}
|
|
1998
|
-
const
|
|
1999
|
-
class
|
|
2004
|
+
const Zn = (n) => _.find(n).lean(), ea = (n) => _.findOne({ user: n }).lean(), ta = (n, e) => _.findOneAndUpdate({ user: n }, e).lean();
|
|
2005
|
+
class na extends Jn {
|
|
2000
2006
|
constructor() {
|
|
2001
2007
|
super(300);
|
|
2002
2008
|
}
|
|
@@ -2007,17 +2013,17 @@ class Ln extends zn {
|
|
|
2007
2013
|
return e;
|
|
2008
2014
|
}
|
|
2009
2015
|
fetchFromDb(e) {
|
|
2010
|
-
return
|
|
2016
|
+
return ea(e);
|
|
2011
2017
|
}
|
|
2012
2018
|
fetchManyFromDb(e) {
|
|
2013
|
-
return
|
|
2019
|
+
return Zn(e);
|
|
2014
2020
|
}
|
|
2015
2021
|
updateInDb(e, t) {
|
|
2016
|
-
return
|
|
2022
|
+
return ta(e, t);
|
|
2017
2023
|
}
|
|
2018
2024
|
}
|
|
2019
|
-
const
|
|
2020
|
-
class
|
|
2025
|
+
const aa = new na();
|
|
2026
|
+
class ra extends f {
|
|
2021
2027
|
hasAlreadyFoundEntity(e, t) {
|
|
2022
2028
|
return e.encyclopedia.includes(t);
|
|
2023
2029
|
}
|
|
@@ -2027,23 +2033,23 @@ class Wn extends f {
|
|
|
2027
2033
|
});
|
|
2028
2034
|
}
|
|
2029
2035
|
}
|
|
2030
|
-
const
|
|
2036
|
+
const sa = async (n) => await Z.create({
|
|
2031
2037
|
user: n
|
|
2032
2038
|
});
|
|
2033
|
-
async function
|
|
2034
|
-
const e = await
|
|
2035
|
-
return e || y(await
|
|
2039
|
+
async function ia(n) {
|
|
2040
|
+
const e = await Z.findOne({ user: n }).lean();
|
|
2041
|
+
return e || y(await sa(n));
|
|
2036
2042
|
}
|
|
2037
|
-
const
|
|
2043
|
+
const ua = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
|
|
2038
2044
|
upsert: !0,
|
|
2039
2045
|
returnDocument: "after"
|
|
2040
2046
|
}).lean();
|
|
2041
|
-
class
|
|
2047
|
+
class ca extends ra {
|
|
2042
2048
|
constructor() {
|
|
2043
2049
|
super(300);
|
|
2044
2050
|
}
|
|
2045
2051
|
fetchFromDb(e) {
|
|
2046
|
-
return
|
|
2052
|
+
return ia(e);
|
|
2047
2053
|
}
|
|
2048
2054
|
getKey({ user: e }) {
|
|
2049
2055
|
return e;
|
|
@@ -2052,13 +2058,13 @@ class Vn extends Wn {
|
|
|
2052
2058
|
return e.toString();
|
|
2053
2059
|
}
|
|
2054
2060
|
updateInDb(e, t) {
|
|
2055
|
-
return
|
|
2061
|
+
return ua(e, t);
|
|
2056
2062
|
}
|
|
2057
2063
|
}
|
|
2058
|
-
const
|
|
2059
|
-
class
|
|
2064
|
+
const pe = new ca();
|
|
2065
|
+
class oa extends f {
|
|
2060
2066
|
getPanoplyEffectiveBonus(e, t) {
|
|
2061
|
-
const a =
|
|
2067
|
+
const a = N(
|
|
2062
2068
|
Object.values(e.equippedItems)
|
|
2063
2069
|
), r = t.equipments.filter(
|
|
2064
2070
|
(s) => a.find((i) => i.entityId === s.entityId)
|
|
@@ -2077,13 +2083,13 @@ class Jn extends f {
|
|
|
2077
2083
|
intelligence: 0,
|
|
2078
2084
|
wisdom: 0
|
|
2079
2085
|
};
|
|
2080
|
-
const a = await
|
|
2081
|
-
for (const r of
|
|
2086
|
+
const a = await U.getAllPopulated();
|
|
2087
|
+
for (const r of Be) {
|
|
2082
2088
|
const s = e.equippedItems?.[r];
|
|
2083
2089
|
if (!s)
|
|
2084
2090
|
continue;
|
|
2085
|
-
const i = await
|
|
2086
|
-
t =
|
|
2091
|
+
const i = await d.fromDBToEquipableEquipment(s);
|
|
2092
|
+
t = F(
|
|
2087
2093
|
t,
|
|
2088
2094
|
i.characteristics,
|
|
2089
2095
|
(o, c) => o + c
|
|
@@ -2091,7 +2097,7 @@ class Jn extends f {
|
|
|
2091
2097
|
}
|
|
2092
2098
|
for (const r of a) {
|
|
2093
2099
|
const s = this.getPanoplyEffectiveBonus(e, r);
|
|
2094
|
-
s && !("target" in s) && (t =
|
|
2100
|
+
s && !("target" in s) && (t = F(
|
|
2095
2101
|
t,
|
|
2096
2102
|
s,
|
|
2097
2103
|
(i, o) => i + o
|
|
@@ -2115,7 +2121,7 @@ class Jn extends f {
|
|
|
2115
2121
|
return !0;
|
|
2116
2122
|
}
|
|
2117
2123
|
hasInventoryRequirements(e, t) {
|
|
2118
|
-
return
|
|
2124
|
+
return C(t).reduce(
|
|
2119
2125
|
(a, [r, s]) => a && (e.itemList[r] ?? 0) >= (s ?? 0),
|
|
2120
2126
|
!0
|
|
2121
2127
|
);
|
|
@@ -2127,7 +2133,7 @@ class Jn extends f {
|
|
|
2127
2133
|
return Object.fromEntries(e.itemList);
|
|
2128
2134
|
}
|
|
2129
2135
|
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
2130
|
-
const a = await this.get(e), s = (await
|
|
2136
|
+
const a = await this.get(e), s = (await U.getPanoplyBonus(
|
|
2131
2137
|
a.equippedItems
|
|
2132
2138
|
)).find(
|
|
2133
2139
|
([i, o]) => i.panoplyId === "herbalist" && o !== null
|
|
@@ -2141,19 +2147,19 @@ class Jn extends f {
|
|
|
2141
2147
|
})) : t;
|
|
2142
2148
|
}
|
|
2143
2149
|
async calcMinStreakForWorkLoot(e) {
|
|
2144
|
-
const t = (await
|
|
2150
|
+
const t = (await U.getPanoplyBonus(e.equippedItems)).find(
|
|
2145
2151
|
([a, r]) => a.panoplyId === "marine" && r !== null
|
|
2146
2152
|
);
|
|
2147
2153
|
return t && t[1] === "full" ? 10 : t && t[1] === "half" ? 20 : 1 / 0;
|
|
2148
2154
|
}
|
|
2149
2155
|
async hasRevolutionaryBuff(e) {
|
|
2150
2156
|
const t = await this.get(e);
|
|
2151
|
-
return (await
|
|
2157
|
+
return (await U.getPanoplyBonus(t.equippedItems)).find(
|
|
2152
2158
|
([r, s]) => r.panoplyId === "revolutionary" && s !== null
|
|
2153
2159
|
)?.[1] ?? null;
|
|
2154
2160
|
}
|
|
2155
2161
|
async getRecipeResult(e, t) {
|
|
2156
|
-
const a = (await
|
|
2162
|
+
const a = (await U.getPanoplyBonus(e.equippedItems)).find(
|
|
2157
2163
|
([r, s]) => r.panoplyId === "little_blacksmith" && s !== null
|
|
2158
2164
|
);
|
|
2159
2165
|
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 +2170,16 @@ class Jn extends f {
|
|
|
2164
2170
|
async addItem(e, t, a) {
|
|
2165
2171
|
await this.update(e, {
|
|
2166
2172
|
$inc: { [`itemList.${t}`]: a }
|
|
2167
|
-
}), await
|
|
2173
|
+
}), await pe.addEntities(e, [t]);
|
|
2168
2174
|
}
|
|
2169
2175
|
async addItems(e, t) {
|
|
2170
2176
|
await this.update(e, {
|
|
2171
2177
|
$inc: Object.fromEntries(
|
|
2172
2178
|
Object.entries(t).filter(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
|
|
2173
2179
|
)
|
|
2174
|
-
}), await
|
|
2180
|
+
}), await pe.addEntities(
|
|
2175
2181
|
e,
|
|
2176
|
-
|
|
2182
|
+
C(t).filter(([, a]) => a > 0).map(([a]) => a)
|
|
2177
2183
|
);
|
|
2178
2184
|
}
|
|
2179
2185
|
async removeItem(e, t, a) {
|
|
@@ -2203,7 +2209,7 @@ class Jn extends f {
|
|
|
2203
2209
|
async addEquipments(e, t) {
|
|
2204
2210
|
await this.update(e, {
|
|
2205
2211
|
$push: { equipmentList: { $each: t } }
|
|
2206
|
-
}), await
|
|
2212
|
+
}), await pe.addEntities(
|
|
2207
2213
|
e,
|
|
2208
2214
|
t.map((a) => a.entityId)
|
|
2209
2215
|
);
|
|
@@ -2222,34 +2228,34 @@ class Jn extends f {
|
|
|
2222
2228
|
a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
|
|
2223
2229
|
}
|
|
2224
2230
|
async equip(e, t) {
|
|
2225
|
-
const a = await
|
|
2226
|
-
|
|
2231
|
+
const a = await I.getMaxHp(e), r = Object.fromEntries(
|
|
2232
|
+
C(t).map(([s, i]) => [
|
|
2227
2233
|
`equippedItems.${s}`,
|
|
2228
2234
|
i
|
|
2229
2235
|
])
|
|
2230
2236
|
);
|
|
2231
2237
|
await this.update(e, {
|
|
2232
2238
|
$set: r
|
|
2233
|
-
}), await
|
|
2239
|
+
}), await I.updateHp(e, a);
|
|
2234
2240
|
}
|
|
2235
2241
|
async unequip(e, t) {
|
|
2236
|
-
const a = await
|
|
2242
|
+
const a = await I.getMaxHp(e);
|
|
2237
2243
|
await this.update(e, {
|
|
2238
2244
|
$set: {
|
|
2239
2245
|
[`equippedItems.${t}`]: null
|
|
2240
2246
|
}
|
|
2241
|
-
}), await
|
|
2247
|
+
}), await I.updateHp(e, a);
|
|
2242
2248
|
}
|
|
2243
2249
|
async craftItem(e, t, a, r, s) {
|
|
2244
|
-
for (const { entityId: c, size:
|
|
2245
|
-
await this.removeItem(e, c,
|
|
2250
|
+
for (const { entityId: c, size: w } of t)
|
|
2251
|
+
await this.removeItem(e, c, w * r);
|
|
2246
2252
|
const { entityId: i, size: o } = a;
|
|
2247
|
-
await
|
|
2253
|
+
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
2254
|
}
|
|
2249
2255
|
async dismantleEntity(e, t, a, r, s) {
|
|
2250
|
-
|
|
2256
|
+
d.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : d.isItem(t) && await this.removeItem(e, t.entityId, r);
|
|
2251
2257
|
for (const { entityId: i, quantity: o } of a)
|
|
2252
|
-
await
|
|
2258
|
+
await d.isEntityId(i, d.isItem) && await this.addItem(e, i, r * o);
|
|
2253
2259
|
await this.removeItem(e, "tools", 1);
|
|
2254
2260
|
}
|
|
2255
2261
|
async enchantItem(e, t, a, r) {
|
|
@@ -2259,23 +2265,23 @@ class Jn extends f {
|
|
|
2259
2265
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
2260
2266
|
}
|
|
2261
2267
|
}
|
|
2262
|
-
const
|
|
2268
|
+
const da = (n) => te.create({
|
|
2263
2269
|
user: n
|
|
2264
2270
|
});
|
|
2265
|
-
async function
|
|
2266
|
-
const e = await
|
|
2267
|
-
return e || y(await
|
|
2271
|
+
async function la(n) {
|
|
2272
|
+
const e = await te.findOne({ user: n }).lean();
|
|
2273
|
+
return e || y(await da(n));
|
|
2268
2274
|
}
|
|
2269
|
-
const
|
|
2275
|
+
const pa = (n, e) => te.findOneAndUpdate({ user: n }, e, {
|
|
2270
2276
|
upsert: !0,
|
|
2271
2277
|
returnDocument: "after"
|
|
2272
2278
|
}).lean();
|
|
2273
|
-
class
|
|
2279
|
+
class ya extends oa {
|
|
2274
2280
|
constructor() {
|
|
2275
2281
|
super(300);
|
|
2276
2282
|
}
|
|
2277
2283
|
fetchFromDb(e) {
|
|
2278
|
-
return
|
|
2284
|
+
return la(e);
|
|
2279
2285
|
}
|
|
2280
2286
|
normalizeKey(e) {
|
|
2281
2287
|
return e.toString();
|
|
@@ -2284,19 +2290,19 @@ class na extends Jn {
|
|
|
2284
2290
|
return e;
|
|
2285
2291
|
}
|
|
2286
2292
|
updateInDb(e, t) {
|
|
2287
|
-
return
|
|
2293
|
+
return pa(e, t);
|
|
2288
2294
|
}
|
|
2289
2295
|
}
|
|
2290
|
-
const
|
|
2291
|
-
class
|
|
2296
|
+
const S = new ya();
|
|
2297
|
+
class fa extends f {
|
|
2292
2298
|
getTotalCharacteristics({
|
|
2293
2299
|
characteristics: e,
|
|
2294
2300
|
scrolls: t
|
|
2295
2301
|
}) {
|
|
2296
|
-
return
|
|
2297
|
-
|
|
2302
|
+
return Me(
|
|
2303
|
+
bt.map((a) => [
|
|
2298
2304
|
a,
|
|
2299
|
-
|
|
2305
|
+
$t(e[a]) + t[a]
|
|
2300
2306
|
])
|
|
2301
2307
|
);
|
|
2302
2308
|
}
|
|
@@ -2310,7 +2316,7 @@ class aa extends f {
|
|
|
2310
2316
|
t.booster ? 0.25 : 0
|
|
2311
2317
|
);
|
|
2312
2318
|
return r + s + t.buffs.xp.global.reduce(
|
|
2313
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2319
|
+
(i, { expireAt: o, startAt: c, multiplier: w }) => c && c > /* @__PURE__ */ new Date() || o && L(o) ? i : i + w,
|
|
2314
2320
|
0
|
|
2315
2321
|
);
|
|
2316
2322
|
}
|
|
@@ -2319,7 +2325,7 @@ class aa extends f {
|
|
|
2319
2325
|
return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
|
|
2320
2326
|
}
|
|
2321
2327
|
async getXpDeathPenalties(e) {
|
|
2322
|
-
const t = await this.get(e), a =
|
|
2328
|
+
const t = await this.get(e), a = Et(t.xp.amount);
|
|
2323
2329
|
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
2330
|
}
|
|
2325
2331
|
async calcXp(e, t, a) {
|
|
@@ -2332,24 +2338,24 @@ class aa extends f {
|
|
|
2332
2338
|
}
|
|
2333
2339
|
async calcBuffMultiplier(e, t, a) {
|
|
2334
2340
|
return (await this.get(e)).buffs[t][a].reduce(
|
|
2335
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2341
|
+
(i, { expireAt: o, startAt: c, multiplier: w }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !L(o)) ? w : 0),
|
|
2336
2342
|
1
|
|
2337
2343
|
);
|
|
2338
2344
|
}
|
|
2339
2345
|
async getMaxHp(e) {
|
|
2340
|
-
const t = await this.get(e), a = await
|
|
2346
|
+
const t = await this.get(e), a = await S.get(e), { vitality: r } = this.getTotalCharacteristics(t), s = await S.getUserEquipmentsCharacteristics(
|
|
2341
2347
|
a
|
|
2342
2348
|
);
|
|
2343
|
-
return (r + s.vitality) *
|
|
2349
|
+
return (r + s.vitality) * Ut + It;
|
|
2344
2350
|
}
|
|
2345
2351
|
async getHpRatio(e) {
|
|
2346
2352
|
const t = await this.get(e), a = await this.getMaxHp(e);
|
|
2347
2353
|
return Math.min(t.hp / a, 1);
|
|
2348
2354
|
}
|
|
2349
2355
|
async hasCharacteristicRequirement(e, t) {
|
|
2350
|
-
const a = await this.get(e), r = await
|
|
2356
|
+
const a = await this.get(e), r = await S.get(e), s = await S.getUserEquipmentsCharacteristics(
|
|
2351
2357
|
r
|
|
2352
|
-
), i =
|
|
2358
|
+
), i = F(
|
|
2353
2359
|
this.getTotalCharacteristics(a),
|
|
2354
2360
|
s,
|
|
2355
2361
|
(o, c) => o + c
|
|
@@ -2369,7 +2375,7 @@ class aa extends f {
|
|
|
2369
2375
|
}
|
|
2370
2376
|
}
|
|
2371
2377
|
async getGlobalRank(e) {
|
|
2372
|
-
return (await
|
|
2378
|
+
return (await R.aggregate([
|
|
2373
2379
|
{
|
|
2374
2380
|
$setWindowFields: {
|
|
2375
2381
|
sortBy: { "xp.amount": -1 },
|
|
@@ -2383,7 +2389,7 @@ class aa extends f {
|
|
|
2383
2389
|
]))[0];
|
|
2384
2390
|
}
|
|
2385
2391
|
async getBerryRank(e) {
|
|
2386
|
-
return (await
|
|
2392
|
+
return (await R.aggregate([
|
|
2387
2393
|
{
|
|
2388
2394
|
$setWindowFields: {
|
|
2389
2395
|
sortBy: { berry: -1 },
|
|
@@ -2406,7 +2412,7 @@ class aa extends f {
|
|
|
2406
2412
|
...t.buffs.drop.work
|
|
2407
2413
|
];
|
|
2408
2414
|
for (const { multiplier: r, startAt: s, expireAt: i } of a)
|
|
2409
|
-
if (r < 0 && (!i || !
|
|
2415
|
+
if (r < 0 && (!i || !L(i)) && (s ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2410
2416
|
return !0;
|
|
2411
2417
|
return !1;
|
|
2412
2418
|
}
|
|
@@ -2462,7 +2468,7 @@ class aa extends f {
|
|
|
2462
2468
|
await this.updateBuff(e, r);
|
|
2463
2469
|
return;
|
|
2464
2470
|
}
|
|
2465
|
-
const a =
|
|
2471
|
+
const a = Tt(t);
|
|
2466
2472
|
await this.update(e, [
|
|
2467
2473
|
{
|
|
2468
2474
|
$set: {
|
|
@@ -2557,15 +2563,15 @@ class aa extends f {
|
|
|
2557
2563
|
});
|
|
2558
2564
|
}
|
|
2559
2565
|
async updatePanoplyBuff(e, t, a, r) {
|
|
2560
|
-
const s = await
|
|
2561
|
-
(
|
|
2566
|
+
const s = await d.fromDBToEquipableEquipment(t), i = N(Object.values(a)), c = (await U.getAllPopulated()).find(
|
|
2567
|
+
(T) => T.panoplyId === s.panoply
|
|
2562
2568
|
);
|
|
2563
2569
|
if (!c)
|
|
2564
2570
|
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),
|
|
2571
|
+
const w = c.equipments.filter(
|
|
2572
|
+
(T) => (i.find((K) => T.entityId === K.entityId) || !r && s.entityId === T.entityId) && (r ? s.entityId !== T.entityId : !0)
|
|
2573
|
+
).length, x = w === c.equipments.length ? c.fullBonus : w >= c.equipments.length / 2 ? c.halfBonus : void 0;
|
|
2574
|
+
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
2575
|
}
|
|
2570
2576
|
async gainHp(e, t) {
|
|
2571
2577
|
const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
|
|
@@ -2668,34 +2674,34 @@ class aa extends f {
|
|
|
2668
2674
|
});
|
|
2669
2675
|
}
|
|
2670
2676
|
async updateUserXp(e, t) {
|
|
2671
|
-
const a = await
|
|
2677
|
+
const a = await aa.get(e), r = a?.percent ?? 0, s = await this.calcXp(
|
|
2672
2678
|
e,
|
|
2673
2679
|
t,
|
|
2674
2680
|
(1 - r) * await this.getHpRatio(e)
|
|
2675
2681
|
);
|
|
2676
2682
|
let i = 0;
|
|
2677
|
-
return await this.addXp(e, s), a && (i = await
|
|
2683
|
+
return await this.addXp(e, s), a && (i = await Ce.calcXp(
|
|
2678
2684
|
a.crew,
|
|
2679
2685
|
t * r
|
|
2680
|
-
), await
|
|
2686
|
+
), await Ce.addXp(a.crew, i)), { userXp: s, crewXp: i };
|
|
2681
2687
|
}
|
|
2682
2688
|
async updateUserBerry(e, t, a) {
|
|
2683
2689
|
const r = await this.calcBerry(e, t, a);
|
|
2684
2690
|
return await this.addBerry(e, r), r;
|
|
2685
2691
|
}
|
|
2686
2692
|
}
|
|
2687
|
-
const
|
|
2693
|
+
const ma = async (n) => await R.create({
|
|
2688
2694
|
user: n
|
|
2689
2695
|
});
|
|
2690
|
-
async function
|
|
2691
|
-
const e = await
|
|
2692
|
-
return e || y(await
|
|
2696
|
+
async function ha(n) {
|
|
2697
|
+
const e = await R.findOne({ user: n }).lean();
|
|
2698
|
+
return e || y(await ma(n));
|
|
2693
2699
|
}
|
|
2694
|
-
const
|
|
2700
|
+
const wa = (n, e) => R.findOneAndUpdate({ user: n }, e, {
|
|
2695
2701
|
returnDocument: "after",
|
|
2696
2702
|
upsert: !0
|
|
2697
2703
|
}).lean();
|
|
2698
|
-
class
|
|
2704
|
+
class ga extends fa {
|
|
2699
2705
|
constructor() {
|
|
2700
2706
|
super(300);
|
|
2701
2707
|
}
|
|
@@ -2706,14 +2712,14 @@ class ua extends aa {
|
|
|
2706
2712
|
return e;
|
|
2707
2713
|
}
|
|
2708
2714
|
fetchFromDb(e) {
|
|
2709
|
-
return
|
|
2715
|
+
return ha(e);
|
|
2710
2716
|
}
|
|
2711
2717
|
updateInDb(e, t) {
|
|
2712
|
-
return
|
|
2718
|
+
return wa(e, t);
|
|
2713
2719
|
}
|
|
2714
2720
|
}
|
|
2715
|
-
const
|
|
2716
|
-
class
|
|
2721
|
+
const I = new ga();
|
|
2722
|
+
class Sa extends b {
|
|
2717
2723
|
async updateSendDailyQuest(e, t) {
|
|
2718
2724
|
await this.update(
|
|
2719
2725
|
{ discordId: e },
|
|
@@ -2742,18 +2748,18 @@ class ca extends b {
|
|
|
2742
2748
|
});
|
|
2743
2749
|
}
|
|
2744
2750
|
}
|
|
2745
|
-
const
|
|
2751
|
+
const ba = (n) => j.find(n).lean(), $a = async (n) => await j.create({
|
|
2746
2752
|
user: n
|
|
2747
2753
|
});
|
|
2748
|
-
async function
|
|
2749
|
-
const e = await
|
|
2750
|
-
return e || y(await
|
|
2754
|
+
async function Ea(n) {
|
|
2755
|
+
const e = await j.findOne({ user: n }).lean();
|
|
2756
|
+
return e || y(await $a(n));
|
|
2751
2757
|
}
|
|
2752
|
-
const
|
|
2758
|
+
const Ua = (n, e) => j.findOneAndUpdate({ user: n }, e, {
|
|
2753
2759
|
returnDocument: "after",
|
|
2754
2760
|
upsert: !0
|
|
2755
2761
|
}).lean();
|
|
2756
|
-
class
|
|
2762
|
+
class Ia extends Sa {
|
|
2757
2763
|
constructor() {
|
|
2758
2764
|
super(3600);
|
|
2759
2765
|
}
|
|
@@ -2764,17 +2770,17 @@ class ya extends ca {
|
|
|
2764
2770
|
return e.user;
|
|
2765
2771
|
}
|
|
2766
2772
|
fetchFromDb(e) {
|
|
2767
|
-
return
|
|
2773
|
+
return Ea(e);
|
|
2768
2774
|
}
|
|
2769
2775
|
fetchManyFromDb(e) {
|
|
2770
|
-
return
|
|
2776
|
+
return ba(e);
|
|
2771
2777
|
}
|
|
2772
2778
|
updateInDb(e, t) {
|
|
2773
|
-
return
|
|
2779
|
+
return Ua(e, t);
|
|
2774
2780
|
}
|
|
2775
2781
|
}
|
|
2776
|
-
const
|
|
2777
|
-
class
|
|
2782
|
+
const Re = new Ia();
|
|
2783
|
+
class Ta extends f {
|
|
2778
2784
|
async getCommandCooldown(e, t) {
|
|
2779
2785
|
return (await this.get(e)).commands[t];
|
|
2780
2786
|
}
|
|
@@ -2799,21 +2805,21 @@ class fa extends f {
|
|
|
2799
2805
|
}
|
|
2800
2806
|
}
|
|
2801
2807
|
}
|
|
2802
|
-
]), await
|
|
2808
|
+
]), await H.updateReminderDate(
|
|
2803
2809
|
e,
|
|
2804
2810
|
"raid/special",
|
|
2805
2811
|
-1 * t * 3600 * 1e3
|
|
2806
|
-
), await
|
|
2812
|
+
), await H.updateReminderDate(
|
|
2807
2813
|
e,
|
|
2808
2814
|
"raid/classic",
|
|
2809
2815
|
-1 * t * 3600 * 1e3
|
|
2810
2816
|
);
|
|
2811
2817
|
}
|
|
2812
2818
|
async startRaidCooldown(e, t, a) {
|
|
2813
|
-
const { reminder: r } = await
|
|
2819
|
+
const { reminder: r } = await Re.get(e);
|
|
2814
2820
|
await this.update(e, {
|
|
2815
2821
|
$set: { [`raid.${t}`]: new Date(Date.now() + a) }
|
|
2816
|
-
}), r.raid[t] && await
|
|
2822
|
+
}), r.raid[t] && await H.addReminder(
|
|
2817
2823
|
e,
|
|
2818
2824
|
`raid/${t}`,
|
|
2819
2825
|
new Date(Date.now() + a)
|
|
@@ -2824,33 +2830,33 @@ class fa extends f {
|
|
|
2824
2830
|
$set: {
|
|
2825
2831
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
2826
2832
|
}
|
|
2827
|
-
}), await
|
|
2833
|
+
}), await I.gainHp(e, 1);
|
|
2828
2834
|
}
|
|
2829
2835
|
async useCommand(e, t, a) {
|
|
2830
|
-
const { reminder: r } = await
|
|
2836
|
+
const { reminder: r } = await Re.get(e);
|
|
2831
2837
|
await this.update(e, {
|
|
2832
2838
|
$set: {
|
|
2833
2839
|
[`commands.${t}`]: new Date(Date.now() + a)
|
|
2834
2840
|
}
|
|
2835
|
-
}), r.commands[t] && await
|
|
2841
|
+
}), r.commands[t] && await H.addReminder(
|
|
2836
2842
|
e,
|
|
2837
2843
|
`commands/${t}`,
|
|
2838
2844
|
new Date(Date.now() + a)
|
|
2839
2845
|
);
|
|
2840
2846
|
}
|
|
2841
2847
|
}
|
|
2842
|
-
const
|
|
2848
|
+
const Da = async (n) => await V.create({
|
|
2843
2849
|
user: n
|
|
2844
2850
|
});
|
|
2845
|
-
async function
|
|
2846
|
-
const e = await
|
|
2847
|
-
return e || y(await
|
|
2851
|
+
async function Oa(n) {
|
|
2852
|
+
const e = await V.findOne({ user: n }).lean();
|
|
2853
|
+
return e || y(await Da(n));
|
|
2848
2854
|
}
|
|
2849
|
-
const
|
|
2855
|
+
const Ca = (n, e) => V.findOneAndUpdate({ user: n }, e, {
|
|
2850
2856
|
returnDocument: "after",
|
|
2851
2857
|
upsert: !0
|
|
2852
2858
|
}).lean();
|
|
2853
|
-
class
|
|
2859
|
+
class Ra extends Ta {
|
|
2854
2860
|
constructor() {
|
|
2855
2861
|
super(300);
|
|
2856
2862
|
}
|
|
@@ -2861,79 +2867,19 @@ class ga extends fa {
|
|
|
2861
2867
|
return e.user;
|
|
2862
2868
|
}
|
|
2863
2869
|
fetchFromDb(e) {
|
|
2864
|
-
return
|
|
2865
|
-
}
|
|
2866
|
-
updateInDb(e, t) {
|
|
2867
|
-
return wa(e, t);
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
const Sa = new ga();
|
|
2871
|
-
class ba extends f {
|
|
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);
|
|
2870
|
+
return Oa(e);
|
|
2925
2871
|
}
|
|
2926
2872
|
updateInDb(e, t) {
|
|
2927
|
-
return
|
|
2873
|
+
return Ca(e, t);
|
|
2928
2874
|
}
|
|
2929
2875
|
}
|
|
2930
|
-
const
|
|
2931
|
-
class
|
|
2876
|
+
const va = new Ra();
|
|
2877
|
+
class Ma extends f {
|
|
2932
2878
|
async unlockTitle(e, t) {
|
|
2933
|
-
await
|
|
2879
|
+
await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2934
2880
|
}
|
|
2935
2881
|
async unlockTitles(e, t) {
|
|
2936
|
-
await
|
|
2882
|
+
await g.isOrnamentIds(t, g.isTitle) && await this.update(e, {
|
|
2937
2883
|
$addToSet: { unlockedTitles: { $each: t } }
|
|
2938
2884
|
});
|
|
2939
2885
|
}
|
|
@@ -2941,17 +2887,17 @@ class Ta extends f {
|
|
|
2941
2887
|
await this.update(e, { $set: { selectedTitle: t } });
|
|
2942
2888
|
}
|
|
2943
2889
|
async unlockBackground(e, t) {
|
|
2944
|
-
await
|
|
2890
|
+
await g.isOrnamentIds(
|
|
2945
2891
|
[t],
|
|
2946
|
-
|
|
2892
|
+
g.isBackground
|
|
2947
2893
|
) && await this.update(e, {
|
|
2948
2894
|
$addToSet: { unlockedBackgrounds: t }
|
|
2949
2895
|
});
|
|
2950
2896
|
}
|
|
2951
2897
|
async unlockBackgrounds(e, t) {
|
|
2952
|
-
await
|
|
2898
|
+
await g.isOrnamentIds(
|
|
2953
2899
|
t,
|
|
2954
|
-
|
|
2900
|
+
g.isBackground
|
|
2955
2901
|
) && await this.update(e, {
|
|
2956
2902
|
$addToSet: { unlockedBackgrounds: { $each: t } }
|
|
2957
2903
|
});
|
|
@@ -2997,18 +2943,18 @@ class Ta extends f {
|
|
|
2997
2943
|
});
|
|
2998
2944
|
}
|
|
2999
2945
|
}
|
|
3000
|
-
const
|
|
2946
|
+
const Aa = async (n) => await ne.create({
|
|
3001
2947
|
user: n
|
|
3002
2948
|
});
|
|
3003
|
-
async function
|
|
3004
|
-
const e = await
|
|
3005
|
-
return e || y(await
|
|
2949
|
+
async function Ba(n) {
|
|
2950
|
+
const e = await ne.findOne({ user: n }).lean();
|
|
2951
|
+
return e || y(await Aa(n));
|
|
3006
2952
|
}
|
|
3007
|
-
const
|
|
2953
|
+
const _a = async (n, e) => ne.findOneAndUpdate({ user: n }, e, {
|
|
3008
2954
|
upsert: !0,
|
|
3009
2955
|
returnDocument: "after"
|
|
3010
2956
|
}).lean();
|
|
3011
|
-
class
|
|
2957
|
+
class xa extends Ma {
|
|
3012
2958
|
constructor() {
|
|
3013
2959
|
super(300);
|
|
3014
2960
|
}
|
|
@@ -3019,14 +2965,14 @@ class Ra extends Ta {
|
|
|
3019
2965
|
return e;
|
|
3020
2966
|
}
|
|
3021
2967
|
fetchFromDb(e) {
|
|
3022
|
-
return
|
|
2968
|
+
return Ba(e);
|
|
3023
2969
|
}
|
|
3024
2970
|
updateInDb(e, t) {
|
|
3025
|
-
return
|
|
2971
|
+
return _a(e, t);
|
|
3026
2972
|
}
|
|
3027
2973
|
}
|
|
3028
|
-
const
|
|
3029
|
-
class
|
|
2974
|
+
const G = new xa();
|
|
2975
|
+
class qa extends b {
|
|
3030
2976
|
async getStatus(e, t) {
|
|
3031
2977
|
return (await this.get({ user: e, questId: t })).status;
|
|
3032
2978
|
}
|
|
@@ -3035,14 +2981,14 @@ class Ma extends b {
|
|
|
3035
2981
|
}
|
|
3036
2982
|
async isStreaking(e, t) {
|
|
3037
2983
|
const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
|
|
3038
|
-
return !!a &&
|
|
2984
|
+
return !!a && ye(k(), a);
|
|
3039
2985
|
}
|
|
3040
2986
|
async getStreakMultiplier(e, t) {
|
|
3041
2987
|
const a = await this.get({ user: e, questId: t });
|
|
3042
2988
|
return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
|
|
3043
2989
|
}
|
|
3044
2990
|
async completeQuest(e, t = !1) {
|
|
3045
|
-
const a =
|
|
2991
|
+
const a = k();
|
|
3046
2992
|
a.setHours(0, 0, 0, 0);
|
|
3047
2993
|
const r = /* @__PURE__ */ new Date();
|
|
3048
2994
|
return r.setHours(0, 0, 0, 0), this.update(
|
|
@@ -3065,7 +3011,7 @@ class Ma extends b {
|
|
|
3065
3011
|
}
|
|
3066
3012
|
} : {},
|
|
3067
3013
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
3068
|
-
status:
|
|
3014
|
+
status: D.COMPLETED
|
|
3069
3015
|
}
|
|
3070
3016
|
}
|
|
3071
3017
|
],
|
|
@@ -3073,24 +3019,24 @@ class Ma extends b {
|
|
|
3073
3019
|
);
|
|
3074
3020
|
}
|
|
3075
3021
|
}
|
|
3076
|
-
function
|
|
3077
|
-
return
|
|
3022
|
+
function ka(n) {
|
|
3023
|
+
return B.find(n).lean();
|
|
3078
3024
|
}
|
|
3079
|
-
const
|
|
3025
|
+
const Na = async (n) => await B.create({
|
|
3080
3026
|
...n
|
|
3081
3027
|
});
|
|
3082
|
-
async function
|
|
3083
|
-
const e = await
|
|
3084
|
-
return e || y(await
|
|
3028
|
+
async function Fa(n) {
|
|
3029
|
+
const e = await B.findOne(n).lean();
|
|
3030
|
+
return e || y(await Na(n));
|
|
3085
3031
|
}
|
|
3086
|
-
function
|
|
3087
|
-
return
|
|
3032
|
+
function ja(n, e, t) {
|
|
3033
|
+
return B.findOneAndUpdate(n, e, {
|
|
3088
3034
|
upsert: !0,
|
|
3089
3035
|
...t,
|
|
3090
3036
|
returnDocument: "after"
|
|
3091
3037
|
}).lean();
|
|
3092
3038
|
}
|
|
3093
|
-
class
|
|
3039
|
+
class za extends qa {
|
|
3094
3040
|
constructor() {
|
|
3095
3041
|
super(3600);
|
|
3096
3042
|
}
|
|
@@ -3104,17 +3050,172 @@ class qa extends Ma {
|
|
|
3104
3050
|
return { user: e, questId: t };
|
|
3105
3051
|
}
|
|
3106
3052
|
fetchFromDb(e) {
|
|
3107
|
-
return
|
|
3053
|
+
return Fa(e);
|
|
3108
3054
|
}
|
|
3109
3055
|
fetchManyFromDb(e) {
|
|
3110
|
-
return
|
|
3056
|
+
return ka(e);
|
|
3111
3057
|
}
|
|
3112
3058
|
updateInDb(e, t, a) {
|
|
3113
|
-
return
|
|
3059
|
+
return ja(e, t, a);
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
const ve = new za();
|
|
3063
|
+
class Pa extends f {
|
|
3064
|
+
async updateDailyReport(e) {
|
|
3065
|
+
const t = await I.get(e), a = await G.get(e), r = await ve.getMany({
|
|
3066
|
+
user: e,
|
|
3067
|
+
status: D.COMPLETED
|
|
3068
|
+
});
|
|
3069
|
+
await this.update(e, {
|
|
3070
|
+
$set: {
|
|
3071
|
+
xpYesterday: t.xp.amount,
|
|
3072
|
+
berryYesterday: t.berry,
|
|
3073
|
+
previousCompletedQuest: r.map(
|
|
3074
|
+
({ questId: s }) => s
|
|
3075
|
+
),
|
|
3076
|
+
"previousOrnament.unlockedBadges": a.unlockedBadges,
|
|
3077
|
+
"previousOrnament.unlockedTitles": a.unlockedTitles,
|
|
3078
|
+
"previousOrnament.unlockedBackgrounds": a.unlockedBackgrounds
|
|
3079
|
+
// TODO
|
|
3080
|
+
// previousMessageSent: user.questMeta.messageSent,
|
|
3081
|
+
}
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
async getDailyReport(e) {
|
|
3085
|
+
const t = await this.get(e), {
|
|
3086
|
+
previousOrnament: a,
|
|
3087
|
+
previousCompletedQuest: r,
|
|
3088
|
+
xpYesterday: s,
|
|
3089
|
+
berryYesterday: i
|
|
3090
|
+
} = t;
|
|
3091
|
+
if (s <= 0)
|
|
3092
|
+
return;
|
|
3093
|
+
const o = await I.get(e), c = await ve.getMany({
|
|
3094
|
+
user: e,
|
|
3095
|
+
status: D.COMPLETED
|
|
3096
|
+
}), w = await G.get(e), { berry: x, xp: T } = o, { voice: K, amount: nt } = T, { unlockedBadges: at, unlockedBackgrounds: rt, unlockedTitles: st } = w;
|
|
3097
|
+
return {
|
|
3098
|
+
berry: x - i,
|
|
3099
|
+
xp: nt - s,
|
|
3100
|
+
// TODO
|
|
3101
|
+
// message: user.questMeta.messageSent - previousMessageSent,
|
|
3102
|
+
voice: ye(K.lastConnection, k()) ? K.minutesInVoiceToday : 0,
|
|
3103
|
+
quest: q(
|
|
3104
|
+
c.map(({ questId: it }) => it),
|
|
3105
|
+
r
|
|
3106
|
+
),
|
|
3107
|
+
badge: q(at, a.unlockedBadges),
|
|
3108
|
+
title: q(st, a.unlockedTitles),
|
|
3109
|
+
background: q(
|
|
3110
|
+
rt,
|
|
3111
|
+
a.unlockedBackgrounds
|
|
3112
|
+
)
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
async getAllDailyReportsToSend() {
|
|
3116
|
+
const e = await Sn.getMany({
|
|
3117
|
+
"settings.sendDailyReport": !0,
|
|
3118
|
+
faction: { $ne: "citizen" }
|
|
3119
|
+
});
|
|
3120
|
+
return await Promise.all(
|
|
3121
|
+
e.map(async ({ _id: t, discordId: a }) => ({
|
|
3122
|
+
...await this.getDailyReport(t),
|
|
3123
|
+
user: t,
|
|
3124
|
+
discordId: a
|
|
3125
|
+
}))
|
|
3126
|
+
);
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
const Ka = (n) => J.create({
|
|
3130
|
+
user: n
|
|
3131
|
+
});
|
|
3132
|
+
async function Ha(n) {
|
|
3133
|
+
const e = await J.findOne({ user: n }).lean();
|
|
3134
|
+
return e || y(await Ka(n));
|
|
3135
|
+
}
|
|
3136
|
+
const La = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
3137
|
+
upsert: !0,
|
|
3138
|
+
returnDocument: "after"
|
|
3139
|
+
}).lean();
|
|
3140
|
+
class Qa extends Pa {
|
|
3141
|
+
constructor() {
|
|
3142
|
+
super(60);
|
|
3143
|
+
}
|
|
3144
|
+
normalizeKey(e) {
|
|
3145
|
+
return e.toString();
|
|
3146
|
+
}
|
|
3147
|
+
getKey(e) {
|
|
3148
|
+
return e.user;
|
|
3149
|
+
}
|
|
3150
|
+
fetchFromDb(e) {
|
|
3151
|
+
return Ha(e);
|
|
3152
|
+
}
|
|
3153
|
+
updateInDb(e, t) {
|
|
3154
|
+
return La(e, t);
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
const zs = new Qa();
|
|
3158
|
+
class Wa extends f {
|
|
3159
|
+
async setGuessGame(e, t, a, r) {
|
|
3160
|
+
await this.update(e, {
|
|
3161
|
+
$set: {
|
|
3162
|
+
guess: {
|
|
3163
|
+
amount: t,
|
|
3164
|
+
tries: a,
|
|
3165
|
+
numberToGuess: r,
|
|
3166
|
+
lastGuess: 0
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
async resetGuessGame(e) {
|
|
3172
|
+
await this.update(e, {
|
|
3173
|
+
$set: {
|
|
3174
|
+
guess: null
|
|
3175
|
+
}
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
async updateGuessGame(e) {
|
|
3179
|
+
await this.update(e, {
|
|
3180
|
+
$inc: {
|
|
3181
|
+
"guess.tries": 1
|
|
3182
|
+
},
|
|
3183
|
+
$set: {
|
|
3184
|
+
"guess.lastGuess": Date.now()
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
const Ga = async (n) => await ee.create({
|
|
3190
|
+
user: n
|
|
3191
|
+
});
|
|
3192
|
+
async function Ya(n) {
|
|
3193
|
+
const e = await ee.findOne({ user: n }).lean();
|
|
3194
|
+
return e || y(await Ga(n));
|
|
3195
|
+
}
|
|
3196
|
+
const Xa = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
|
|
3197
|
+
upsert: !0,
|
|
3198
|
+
returnDocument: "after"
|
|
3199
|
+
}).lean();
|
|
3200
|
+
class Va extends Wa {
|
|
3201
|
+
constructor() {
|
|
3202
|
+
super(300);
|
|
3203
|
+
}
|
|
3204
|
+
normalizeKey(e) {
|
|
3205
|
+
return e.toString();
|
|
3206
|
+
}
|
|
3207
|
+
getKey({ user: e }) {
|
|
3208
|
+
return e;
|
|
3209
|
+
}
|
|
3210
|
+
fetchFromDb(e) {
|
|
3211
|
+
return Ya(e);
|
|
3212
|
+
}
|
|
3213
|
+
updateInDb(e, t) {
|
|
3214
|
+
return Xa(e, t);
|
|
3114
3215
|
}
|
|
3115
3216
|
}
|
|
3116
|
-
const
|
|
3117
|
-
class
|
|
3217
|
+
const Ps = new Va();
|
|
3218
|
+
class Ja extends f {
|
|
3118
3219
|
async hasUnlockedRaid(e, t) {
|
|
3119
3220
|
return (await this.get(e)).unlocked?.[t];
|
|
3120
3221
|
}
|
|
@@ -3148,7 +3249,7 @@ class xa extends f {
|
|
|
3148
3249
|
rewards: {}
|
|
3149
3250
|
}
|
|
3150
3251
|
}
|
|
3151
|
-
}), await
|
|
3252
|
+
}), await va.startRaidCooldown(e, r, s), i;
|
|
3152
3253
|
}
|
|
3153
3254
|
async resetRaid(e) {
|
|
3154
3255
|
await this.update(e, {
|
|
@@ -3181,7 +3282,7 @@ class xa extends f {
|
|
|
3181
3282
|
async addRewardsToRaid(e, t) {
|
|
3182
3283
|
await this.update(e, {
|
|
3183
3284
|
$inc: Object.fromEntries(
|
|
3184
|
-
|
|
3285
|
+
C(t).filter(([a]) => a !== "title" && a !== "condition").map(([a, r]) => [`currentRaid.rewards.${a}`, r])
|
|
3185
3286
|
),
|
|
3186
3287
|
...t.title ? { $set: { "currentRaid.rewards.title": t.title } } : {}
|
|
3187
3288
|
});
|
|
@@ -3194,16 +3295,16 @@ class xa extends f {
|
|
|
3194
3295
|
});
|
|
3195
3296
|
}
|
|
3196
3297
|
}
|
|
3197
|
-
const
|
|
3298
|
+
const Za = (n) => ae.create({
|
|
3198
3299
|
user: n
|
|
3199
|
-
}),
|
|
3200
|
-
const e = await
|
|
3201
|
-
return e || y(await
|
|
3202
|
-
},
|
|
3300
|
+
}), er = async (n) => {
|
|
3301
|
+
const e = await ae.findOne({ user: n }).lean();
|
|
3302
|
+
return e || y(await Za(n));
|
|
3303
|
+
}, tr = (n, e) => ae.findOneAndUpdate({ user: n }, e, {
|
|
3203
3304
|
upsert: !0,
|
|
3204
3305
|
returnDocument: "after"
|
|
3205
3306
|
});
|
|
3206
|
-
class
|
|
3307
|
+
class nr extends Ja {
|
|
3207
3308
|
constructor() {
|
|
3208
3309
|
super(3600);
|
|
3209
3310
|
}
|
|
@@ -3214,30 +3315,30 @@ class ja extends xa {
|
|
|
3214
3315
|
return e;
|
|
3215
3316
|
}
|
|
3216
3317
|
fetchFromDb(e) {
|
|
3217
|
-
return
|
|
3318
|
+
return er(e);
|
|
3218
3319
|
}
|
|
3219
3320
|
updateInDb(e, t) {
|
|
3220
|
-
return
|
|
3321
|
+
return tr(e, t);
|
|
3221
3322
|
}
|
|
3222
3323
|
}
|
|
3223
|
-
const
|
|
3224
|
-
class
|
|
3324
|
+
const Ks = new nr();
|
|
3325
|
+
class ar extends f {
|
|
3225
3326
|
async isBuyLimitReached(e, t, a) {
|
|
3226
|
-
const r = await
|
|
3227
|
-
if (await
|
|
3327
|
+
const r = await d.getAllEntitiesLimit();
|
|
3328
|
+
if (await d.isEntityId(t, d.isEquipment))
|
|
3228
3329
|
return !1;
|
|
3229
3330
|
const s = await this.get(e), i = s.limit?.[t];
|
|
3230
3331
|
let o = r[t];
|
|
3231
|
-
const c = await
|
|
3332
|
+
const c = await S.hasRevolutionaryBuff(e);
|
|
3232
3333
|
return s.lastShopId !== a ? !1 : (c === "half" && t === "chest_2" && (o += 2), c === "full" && t === "chest_3" && (o += 1), !!(o && i && i >= o));
|
|
3233
3334
|
}
|
|
3234
|
-
async getShopItemRest(e, t, a, r =
|
|
3235
|
-
const s = await
|
|
3236
|
-
if (await
|
|
3335
|
+
async getShopItemRest(e, t, a, r = Dt) {
|
|
3336
|
+
const s = await d.getAllEntitiesLimit();
|
|
3337
|
+
if (await d.isEntityId(t, d.isEquipment))
|
|
3237
3338
|
return r;
|
|
3238
3339
|
let i = s[t];
|
|
3239
|
-
const o = await this.get(e), c = o.limit?.[t],
|
|
3240
|
-
return
|
|
3340
|
+
const o = await this.get(e), c = o.limit?.[t], w = await S.hasRevolutionaryBuff(e);
|
|
3341
|
+
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
3342
|
}
|
|
3242
3343
|
async increaseBuyLimit(e, t, a, r) {
|
|
3243
3344
|
await this.update(e, [
|
|
@@ -3266,16 +3367,16 @@ class za extends f {
|
|
|
3266
3367
|
]);
|
|
3267
3368
|
}
|
|
3268
3369
|
}
|
|
3269
|
-
const
|
|
3370
|
+
const rr = async (n) => await re.create({
|
|
3270
3371
|
user: n
|
|
3271
|
-
}),
|
|
3272
|
-
const e = await
|
|
3273
|
-
return e || y(await
|
|
3274
|
-
},
|
|
3372
|
+
}), sr = async (n) => {
|
|
3373
|
+
const e = await re.findOne({ user: n }).lean();
|
|
3374
|
+
return e || y(await rr(n));
|
|
3375
|
+
}, ir = (n, e) => re.findOneAndUpdate({ user: n }, e, {
|
|
3275
3376
|
upsert: !0,
|
|
3276
3377
|
returnDocument: "after"
|
|
3277
3378
|
}).lean();
|
|
3278
|
-
class
|
|
3379
|
+
class ur extends ar {
|
|
3279
3380
|
constructor() {
|
|
3280
3381
|
super(300);
|
|
3281
3382
|
}
|
|
@@ -3286,14 +3387,14 @@ class La extends za {
|
|
|
3286
3387
|
return e;
|
|
3287
3388
|
}
|
|
3288
3389
|
fetchFromDb(e) {
|
|
3289
|
-
return
|
|
3390
|
+
return sr(e);
|
|
3290
3391
|
}
|
|
3291
3392
|
updateInDb(e, t) {
|
|
3292
|
-
return
|
|
3393
|
+
return ir(e, t);
|
|
3293
3394
|
}
|
|
3294
3395
|
}
|
|
3295
|
-
const
|
|
3296
|
-
class
|
|
3396
|
+
const Hs = new ur();
|
|
3397
|
+
class cr extends f {
|
|
3297
3398
|
async didSevenDoubleAtDoQ(e) {
|
|
3298
3399
|
await this.update(e, {
|
|
3299
3400
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -3317,10 +3418,10 @@ class Qa extends f {
|
|
|
3317
3418
|
await this.update(e, { $inc: { drawCount: 1 } });
|
|
3318
3419
|
}
|
|
3319
3420
|
async bet666(e) {
|
|
3320
|
-
const t =
|
|
3421
|
+
const t = k();
|
|
3321
3422
|
t.setHours(0, 0, 0, 0);
|
|
3322
3423
|
const a = /* @__PURE__ */ new Date();
|
|
3323
|
-
a.setHours(0, 0, 0, 0), await
|
|
3424
|
+
a.setHours(0, 0, 0, 0), await v.updateOne(
|
|
3324
3425
|
{
|
|
3325
3426
|
user: e,
|
|
3326
3427
|
"bet666.last": {
|
|
@@ -3329,7 +3430,7 @@ class Qa extends f {
|
|
|
3329
3430
|
}
|
|
3330
3431
|
},
|
|
3331
3432
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
3332
|
-
), await
|
|
3433
|
+
), await v.updateOne(
|
|
3333
3434
|
{
|
|
3334
3435
|
user: e,
|
|
3335
3436
|
"bet666.last": {
|
|
@@ -3372,18 +3473,18 @@ class Qa extends f {
|
|
|
3372
3473
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
3373
3474
|
}
|
|
3374
3475
|
}
|
|
3375
|
-
const
|
|
3476
|
+
const or = async (n) => await v.create({
|
|
3376
3477
|
user: n
|
|
3377
3478
|
});
|
|
3378
|
-
async function
|
|
3379
|
-
const e = await
|
|
3380
|
-
return e || y(await
|
|
3479
|
+
async function dr(n) {
|
|
3480
|
+
const e = await v.findOne({ user: n }).lean();
|
|
3481
|
+
return e || y(await or(n));
|
|
3381
3482
|
}
|
|
3382
|
-
const
|
|
3483
|
+
const lr = (n, e) => v.findOneAndUpdate({ user: n }, e, {
|
|
3383
3484
|
upsert: !0,
|
|
3384
3485
|
returnDocument: "after"
|
|
3385
3486
|
}).lean();
|
|
3386
|
-
class
|
|
3487
|
+
class pr extends cr {
|
|
3387
3488
|
constructor() {
|
|
3388
3489
|
super(300);
|
|
3389
3490
|
}
|
|
@@ -3394,14 +3495,14 @@ class Xa extends Qa {
|
|
|
3394
3495
|
return e;
|
|
3395
3496
|
}
|
|
3396
3497
|
fetchFromDb(e) {
|
|
3397
|
-
return
|
|
3498
|
+
return dr(e);
|
|
3398
3499
|
}
|
|
3399
3500
|
updateInDb(e, t) {
|
|
3400
|
-
return
|
|
3501
|
+
return lr(e, t);
|
|
3401
3502
|
}
|
|
3402
3503
|
}
|
|
3403
|
-
const
|
|
3404
|
-
class
|
|
3504
|
+
const Ls = new pr();
|
|
3505
|
+
class yr extends f {
|
|
3405
3506
|
async increaseXpGiven(e, t) {
|
|
3406
3507
|
await this.update(e, {
|
|
3407
3508
|
$inc: {
|
|
@@ -3423,18 +3524,18 @@ class Va extends f {
|
|
|
3423
3524
|
t ? await this.update(e, { $set: { timeCrewAbove90PercentXp: 0 } }) : await this.update(e, { $inc: { timeCrewAbove90PercentXp: 1 } });
|
|
3424
3525
|
}
|
|
3425
3526
|
}
|
|
3426
|
-
const
|
|
3527
|
+
const fr = async (n) => await se.create({
|
|
3427
3528
|
user: n
|
|
3428
3529
|
});
|
|
3429
|
-
async function
|
|
3430
|
-
const e = await
|
|
3431
|
-
return e || y(await
|
|
3530
|
+
async function mr(n) {
|
|
3531
|
+
const e = await se.findOne({ user: n }).lean();
|
|
3532
|
+
return e || y(await fr(n));
|
|
3432
3533
|
}
|
|
3433
|
-
const
|
|
3534
|
+
const hr = (n, e) => se.findOneAndUpdate({ user: n }, e, {
|
|
3434
3535
|
upsert: !0,
|
|
3435
3536
|
returnDocument: "after"
|
|
3436
3537
|
}).lean();
|
|
3437
|
-
class
|
|
3538
|
+
class wr extends yr {
|
|
3438
3539
|
constructor() {
|
|
3439
3540
|
super(300);
|
|
3440
3541
|
}
|
|
@@ -3445,14 +3546,14 @@ class tr extends Va {
|
|
|
3445
3546
|
return e;
|
|
3446
3547
|
}
|
|
3447
3548
|
fetchFromDb(e) {
|
|
3448
|
-
return
|
|
3549
|
+
return mr(e);
|
|
3449
3550
|
}
|
|
3450
3551
|
updateInDb(e, t) {
|
|
3451
|
-
return
|
|
3552
|
+
return hr(e, t);
|
|
3452
3553
|
}
|
|
3453
3554
|
}
|
|
3454
|
-
const
|
|
3455
|
-
class
|
|
3555
|
+
const Qs = new wr();
|
|
3556
|
+
class gr extends f {
|
|
3456
3557
|
async workIncrement(e) {
|
|
3457
3558
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
3458
3559
|
}
|
|
@@ -3464,18 +3565,18 @@ class nr extends f {
|
|
|
3464
3565
|
});
|
|
3465
3566
|
}
|
|
3466
3567
|
}
|
|
3467
|
-
const
|
|
3568
|
+
const Sr = (n) => ie.create({
|
|
3468
3569
|
user: n
|
|
3469
3570
|
});
|
|
3470
|
-
async function
|
|
3471
|
-
const e = await
|
|
3472
|
-
return e || y(await
|
|
3571
|
+
async function br(n) {
|
|
3572
|
+
const e = await ie.findOne({ user: n }).lean();
|
|
3573
|
+
return e || y(await Sr(n));
|
|
3473
3574
|
}
|
|
3474
|
-
const
|
|
3575
|
+
const $r = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
|
|
3475
3576
|
upsert: !0,
|
|
3476
3577
|
returnDocument: "after"
|
|
3477
3578
|
}).lean();
|
|
3478
|
-
class
|
|
3579
|
+
class Er extends gr {
|
|
3479
3580
|
constructor() {
|
|
3480
3581
|
super(300);
|
|
3481
3582
|
}
|
|
@@ -3486,14 +3587,14 @@ class ir extends nr {
|
|
|
3486
3587
|
return e;
|
|
3487
3588
|
}
|
|
3488
3589
|
fetchFromDb(e) {
|
|
3489
|
-
return
|
|
3590
|
+
return br(e);
|
|
3490
3591
|
}
|
|
3491
3592
|
updateInDb(e, t) {
|
|
3492
|
-
return
|
|
3593
|
+
return $r(e, t);
|
|
3493
3594
|
}
|
|
3494
3595
|
}
|
|
3495
|
-
const
|
|
3496
|
-
class
|
|
3596
|
+
const Ur = new Er();
|
|
3597
|
+
class Ir extends f {
|
|
3497
3598
|
async randomMessageIncrement(e) {
|
|
3498
3599
|
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
3499
3600
|
}
|
|
@@ -3511,18 +3612,18 @@ class cr extends f {
|
|
|
3511
3612
|
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
3512
3613
|
}
|
|
3513
3614
|
}
|
|
3514
|
-
const
|
|
3615
|
+
const Tr = async (n) => await ue.create({
|
|
3515
3616
|
user: n
|
|
3516
3617
|
});
|
|
3517
|
-
async function
|
|
3518
|
-
const e = await
|
|
3519
|
-
return e || y(await
|
|
3618
|
+
async function Dr(n) {
|
|
3619
|
+
const e = await ue.findOne({ user: n }).lean();
|
|
3620
|
+
return e || y(await Tr(n));
|
|
3520
3621
|
}
|
|
3521
|
-
const
|
|
3622
|
+
const Or = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
|
|
3522
3623
|
upsert: !0,
|
|
3523
3624
|
returnDocument: "after"
|
|
3524
3625
|
}).lean();
|
|
3525
|
-
class
|
|
3626
|
+
class Cr extends Ir {
|
|
3526
3627
|
constructor() {
|
|
3527
3628
|
super(300);
|
|
3528
3629
|
}
|
|
@@ -3535,14 +3636,14 @@ class pr extends cr {
|
|
|
3535
3636
|
return e;
|
|
3536
3637
|
}
|
|
3537
3638
|
fetchFromDb(e) {
|
|
3538
|
-
return
|
|
3639
|
+
return Dr(e);
|
|
3539
3640
|
}
|
|
3540
3641
|
updateInDb(e, t) {
|
|
3541
|
-
return
|
|
3642
|
+
return Or(e, t);
|
|
3542
3643
|
}
|
|
3543
3644
|
}
|
|
3544
|
-
const
|
|
3545
|
-
class
|
|
3645
|
+
const Ws = new Cr();
|
|
3646
|
+
class Rr extends f {
|
|
3546
3647
|
async hasReportedSomeone(e) {
|
|
3547
3648
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
3548
3649
|
}
|
|
@@ -3573,18 +3674,18 @@ class yr extends f {
|
|
|
3573
3674
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
3574
3675
|
}
|
|
3575
3676
|
}
|
|
3576
|
-
const
|
|
3677
|
+
const vr = async (n) => await ce.create({
|
|
3577
3678
|
user: n
|
|
3578
3679
|
});
|
|
3579
|
-
async function
|
|
3580
|
-
const e = await
|
|
3581
|
-
return e || y(await
|
|
3680
|
+
async function Mr(n) {
|
|
3681
|
+
const e = await ce.findOne({ user: n }).lean();
|
|
3682
|
+
return e || y(await vr(n));
|
|
3582
3683
|
}
|
|
3583
|
-
const
|
|
3684
|
+
const Ar = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
|
|
3584
3685
|
upsert: !0,
|
|
3585
3686
|
returnDocument: "after"
|
|
3586
3687
|
}).lean();
|
|
3587
|
-
class
|
|
3688
|
+
class Br extends Rr {
|
|
3588
3689
|
constructor() {
|
|
3589
3690
|
super(300);
|
|
3590
3691
|
}
|
|
@@ -3595,17 +3696,17 @@ class wr extends yr {
|
|
|
3595
3696
|
return e;
|
|
3596
3697
|
}
|
|
3597
3698
|
fetchFromDb(e) {
|
|
3598
|
-
return
|
|
3699
|
+
return Mr(e);
|
|
3599
3700
|
}
|
|
3600
3701
|
updateInDb(e, t) {
|
|
3601
|
-
return
|
|
3702
|
+
return Ar(e, t);
|
|
3602
3703
|
}
|
|
3603
3704
|
}
|
|
3604
|
-
const
|
|
3605
|
-
class
|
|
3705
|
+
const Gs = new Br();
|
|
3706
|
+
class _r extends f {
|
|
3606
3707
|
async readEdito(e) {
|
|
3607
3708
|
const t = /* @__PURE__ */ new Date();
|
|
3608
|
-
t.setHours(0, 0, 0, 0), await
|
|
3709
|
+
t.setHours(0, 0, 0, 0), await M.updateOne(
|
|
3609
3710
|
{
|
|
3610
3711
|
user: e,
|
|
3611
3712
|
"edito.lastTimeRead": {
|
|
@@ -3616,7 +3717,7 @@ class gr extends f {
|
|
|
3616
3717
|
$inc: { "edito.readToday": 1 },
|
|
3617
3718
|
$set: { "edito.lastTimeRead": /* @__PURE__ */ new Date() }
|
|
3618
3719
|
}
|
|
3619
|
-
), await
|
|
3720
|
+
), await M.updateOne(
|
|
3620
3721
|
{
|
|
3621
3722
|
user: e,
|
|
3622
3723
|
"edito.lastTimeRead": {
|
|
@@ -3629,18 +3730,18 @@ class gr extends f {
|
|
|
3629
3730
|
), this.invalidate(e);
|
|
3630
3731
|
}
|
|
3631
3732
|
}
|
|
3632
|
-
const
|
|
3733
|
+
const xr = async (n) => await M.create({
|
|
3633
3734
|
user: n
|
|
3634
3735
|
});
|
|
3635
|
-
async function
|
|
3636
|
-
const e = await
|
|
3637
|
-
return e || y(await
|
|
3736
|
+
async function qr(n) {
|
|
3737
|
+
const e = await M.findOne({ user: n }).lean();
|
|
3738
|
+
return e || y(await xr(n));
|
|
3638
3739
|
}
|
|
3639
|
-
const
|
|
3740
|
+
const kr = (n, e) => M.findOneAndUpdate({ user: n }, e, {
|
|
3640
3741
|
upsert: !0,
|
|
3641
3742
|
returnDocument: "after"
|
|
3642
3743
|
}).lean();
|
|
3643
|
-
class
|
|
3744
|
+
class Nr extends _r {
|
|
3644
3745
|
constructor() {
|
|
3645
3746
|
super(300);
|
|
3646
3747
|
}
|
|
@@ -3651,20 +3752,20 @@ class Er extends gr {
|
|
|
3651
3752
|
return e;
|
|
3652
3753
|
}
|
|
3653
3754
|
fetchFromDb(e) {
|
|
3654
|
-
return
|
|
3755
|
+
return qr(e);
|
|
3655
3756
|
}
|
|
3656
3757
|
updateInDb(e, t) {
|
|
3657
|
-
return
|
|
3758
|
+
return kr(e, t);
|
|
3658
3759
|
}
|
|
3659
3760
|
}
|
|
3660
|
-
const
|
|
3661
|
-
class
|
|
3761
|
+
const Ys = new Nr();
|
|
3762
|
+
class Fr extends f {
|
|
3662
3763
|
async updateCraftStats(e, t, a) {
|
|
3663
|
-
const r = await
|
|
3664
|
-
!r || !
|
|
3764
|
+
const r = await d.get(a);
|
|
3765
|
+
!r || !d.isItem(r) || await this.update(e, {
|
|
3665
3766
|
$inc: {
|
|
3666
|
-
"crafts.cookedMeal":
|
|
3667
|
-
"crafts.scrolls":
|
|
3767
|
+
"crafts.cookedMeal": d.isCookedMeal(r) ? t : 0,
|
|
3768
|
+
"crafts.scrolls": d.isScrollItem(r) ? t : 0,
|
|
3668
3769
|
"crafts.totalCrafted": t
|
|
3669
3770
|
}
|
|
3670
3771
|
});
|
|
@@ -3681,7 +3782,7 @@ class Ir extends f {
|
|
|
3681
3782
|
}
|
|
3682
3783
|
async incrementBottleUsedToday(e, t) {
|
|
3683
3784
|
const a = /* @__PURE__ */ new Date();
|
|
3684
|
-
a.setHours(0, 0, 0, 0), await
|
|
3785
|
+
a.setHours(0, 0, 0, 0), await A.updateOne(
|
|
3685
3786
|
{
|
|
3686
3787
|
user: e,
|
|
3687
3788
|
"bottle.lastUsed": {
|
|
@@ -3692,7 +3793,7 @@ class Ir extends f {
|
|
|
3692
3793
|
$inc: { "bottle.usedToday": t },
|
|
3693
3794
|
$set: { "bottle.lastUsed": /* @__PURE__ */ new Date() }
|
|
3694
3795
|
}
|
|
3695
|
-
), await
|
|
3796
|
+
), await A.updateOne(
|
|
3696
3797
|
{
|
|
3697
3798
|
user: e,
|
|
3698
3799
|
"bottle.lastUsed": {
|
|
@@ -3718,18 +3819,18 @@ class Ir extends f {
|
|
|
3718
3819
|
});
|
|
3719
3820
|
}
|
|
3720
3821
|
}
|
|
3721
|
-
const
|
|
3822
|
+
const jr = async (n) => await A.create({
|
|
3722
3823
|
user: n
|
|
3723
3824
|
});
|
|
3724
|
-
async function
|
|
3725
|
-
const e = await
|
|
3726
|
-
return e || y(await
|
|
3825
|
+
async function zr(n) {
|
|
3826
|
+
const e = await A.findOne({ user: n }).lean();
|
|
3827
|
+
return e || y(await jr(n));
|
|
3727
3828
|
}
|
|
3728
|
-
const
|
|
3829
|
+
const Pr = (n, e) => A.findOneAndUpdate({ user: n }, e, {
|
|
3729
3830
|
upsert: !0,
|
|
3730
3831
|
returnDocument: "after"
|
|
3731
3832
|
}).lean();
|
|
3732
|
-
class
|
|
3833
|
+
class Kr extends Fr {
|
|
3733
3834
|
constructor() {
|
|
3734
3835
|
super(300);
|
|
3735
3836
|
}
|
|
@@ -3740,36 +3841,39 @@ class Cr extends Ir {
|
|
|
3740
3841
|
return e;
|
|
3741
3842
|
}
|
|
3742
3843
|
fetchFromDb(e) {
|
|
3743
|
-
return
|
|
3844
|
+
return zr(e);
|
|
3744
3845
|
}
|
|
3745
3846
|
updateInDb(e, t) {
|
|
3746
|
-
return
|
|
3847
|
+
return Pr(e, t);
|
|
3747
3848
|
}
|
|
3748
3849
|
}
|
|
3749
|
-
const
|
|
3850
|
+
const Xs = new Kr(), Hr = new u({
|
|
3750
3851
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3751
3852
|
authorId: { type: String, required: !0 },
|
|
3752
3853
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
3753
3854
|
reason: { type: String, required: !0 },
|
|
3754
3855
|
guildId: { type: String, required: !0 }
|
|
3755
|
-
}),
|
|
3856
|
+
}), de = l?.Bans || p("Bans", Hr), Lr = (n) => de.create({
|
|
3756
3857
|
...n
|
|
3757
|
-
})
|
|
3758
|
-
class
|
|
3858
|
+
});
|
|
3859
|
+
class Qr extends b {
|
|
3759
3860
|
async getUnbanUsers() {
|
|
3760
3861
|
return this.getMany({
|
|
3761
3862
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
3762
3863
|
});
|
|
3763
3864
|
}
|
|
3764
3865
|
async banUserFromGuild(e) {
|
|
3765
|
-
await
|
|
3866
|
+
await Lr(e);
|
|
3766
3867
|
}
|
|
3767
3868
|
async isBannedFromGuild(e, t) {
|
|
3768
|
-
|
|
3869
|
+
const a = await this.get({ bannedUserId: e, guildId: t });
|
|
3870
|
+
return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
3769
3871
|
}
|
|
3770
3872
|
}
|
|
3771
|
-
const
|
|
3772
|
-
|
|
3873
|
+
const Wr = (n) => de.find(n).lean(), Gr = (n) => de.findOne(n).lean(), Yr = (n, e) => de.findOneAndUpdate(n, e, {
|
|
3874
|
+
returnDocument: "after"
|
|
3875
|
+
}).lean();
|
|
3876
|
+
class Xr extends Qr {
|
|
3773
3877
|
constructor() {
|
|
3774
3878
|
super(3600 * 36);
|
|
3775
3879
|
}
|
|
@@ -3780,16 +3884,16 @@ class Br extends vr {
|
|
|
3780
3884
|
return { bannedUserId: e, guildId: t };
|
|
3781
3885
|
}
|
|
3782
3886
|
fetchFromDb(e) {
|
|
3783
|
-
return
|
|
3887
|
+
return Gr(e);
|
|
3784
3888
|
}
|
|
3785
3889
|
fetchManyFromDb(e) {
|
|
3786
|
-
return
|
|
3890
|
+
return Wr(e);
|
|
3787
3891
|
}
|
|
3788
|
-
updateInDb() {
|
|
3789
|
-
|
|
3892
|
+
updateInDb(e, t) {
|
|
3893
|
+
return Yr(e, t);
|
|
3790
3894
|
}
|
|
3791
3895
|
}
|
|
3792
|
-
const
|
|
3896
|
+
const Vs = new Xr(), Vr = new u({
|
|
3793
3897
|
senderId: {
|
|
3794
3898
|
type: u.Types.ObjectId,
|
|
3795
3899
|
required: !0,
|
|
@@ -3806,33 +3910,35 @@ const qs = new Br(), qr = new u({
|
|
|
3806
3910
|
meta: {
|
|
3807
3911
|
rps: { type: String, default: void 0 }
|
|
3808
3912
|
}
|
|
3809
|
-
}),
|
|
3913
|
+
}), le = l?.Invitation || p("Invitation", Vr), Jr = (n) => le.create({
|
|
3810
3914
|
...n
|
|
3811
|
-
}),
|
|
3812
|
-
await
|
|
3915
|
+
}), Zr = async (n) => {
|
|
3916
|
+
await le.deleteMany({
|
|
3813
3917
|
...n
|
|
3814
3918
|
});
|
|
3815
3919
|
};
|
|
3816
|
-
class
|
|
3920
|
+
class es extends f {
|
|
3817
3921
|
async sendInvitation({
|
|
3818
3922
|
senderId: e,
|
|
3819
3923
|
receiverId: t,
|
|
3820
3924
|
gameMode: a,
|
|
3821
3925
|
...r
|
|
3822
3926
|
}) {
|
|
3823
|
-
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? !1 : (await
|
|
3927
|
+
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? !1 : (await Jr({ ...r, senderId: e, gameMode: a, receiverId: t }), !0);
|
|
3824
3928
|
}
|
|
3825
3929
|
async receiveInvitation(e) {
|
|
3826
3930
|
return this.get(e);
|
|
3827
3931
|
}
|
|
3828
3932
|
async deleteInvitation(e) {
|
|
3829
|
-
await
|
|
3933
|
+
await Zr(e), this.invalidate(e);
|
|
3830
3934
|
}
|
|
3831
3935
|
}
|
|
3832
|
-
const
|
|
3936
|
+
const ts = (n) => le.findOne({
|
|
3833
3937
|
...n
|
|
3938
|
+
}).lean(), ns = (n, e) => le.findOneAndUpdate(n, e, {
|
|
3939
|
+
returnDocument: "after"
|
|
3834
3940
|
}).lean();
|
|
3835
|
-
class
|
|
3941
|
+
class as extends es {
|
|
3836
3942
|
constructor() {
|
|
3837
3943
|
super(3600);
|
|
3838
3944
|
}
|
|
@@ -3847,19 +3953,19 @@ class jr extends Nr {
|
|
|
3847
3953
|
return { gameMode: t, receiverId: e, senderId: a };
|
|
3848
3954
|
}
|
|
3849
3955
|
fetchFromDb(e) {
|
|
3850
|
-
return
|
|
3956
|
+
return ts(e);
|
|
3851
3957
|
}
|
|
3852
|
-
updateInDb() {
|
|
3853
|
-
|
|
3958
|
+
updateInDb(e, t) {
|
|
3959
|
+
return ns(e, t);
|
|
3854
3960
|
}
|
|
3855
3961
|
}
|
|
3856
|
-
const
|
|
3857
|
-
class
|
|
3962
|
+
const Js = new as();
|
|
3963
|
+
class rs extends f {
|
|
3858
3964
|
async setEditoChannel(e, t) {
|
|
3859
3965
|
await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
|
|
3860
3966
|
}
|
|
3861
3967
|
async randomizeEditoPrice(e) {
|
|
3862
|
-
const t =
|
|
3968
|
+
const t = Y(100, 1001);
|
|
3863
3969
|
return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
|
|
3864
3970
|
}
|
|
3865
3971
|
async setEditoMessageId(e, t) {
|
|
@@ -3915,7 +4021,7 @@ class zr extends f {
|
|
|
3915
4021
|
);
|
|
3916
4022
|
}
|
|
3917
4023
|
}
|
|
3918
|
-
const
|
|
4024
|
+
const ss = new u({
|
|
3919
4025
|
guildId: { type: String, required: !0, unique: !0 },
|
|
3920
4026
|
ranking: {
|
|
3921
4027
|
channelId: { type: String, default: null },
|
|
@@ -3957,16 +4063,16 @@ const Kr = new u({
|
|
|
3957
4063
|
}
|
|
3958
4064
|
},
|
|
3959
4065
|
shopChannelId: { type: String, default: null }
|
|
3960
|
-
}),
|
|
4066
|
+
}), Ue = l?.Settings || p("Settings", ss), is = (n) => Ue.create({
|
|
3961
4067
|
guildId: n
|
|
3962
|
-
}),
|
|
3963
|
-
const e = await
|
|
3964
|
-
return e || y(await
|
|
3965
|
-
},
|
|
4068
|
+
}), us = async (n) => {
|
|
4069
|
+
const e = await Ue.findOne({ guildId: n }).lean();
|
|
4070
|
+
return e || y(await is(n));
|
|
4071
|
+
}, cs = (n, e) => Ue.findOneAndUpdate(n, e, {
|
|
3966
4072
|
upsert: !0,
|
|
3967
4073
|
returnDocument: "after"
|
|
3968
4074
|
}).lean();
|
|
3969
|
-
class
|
|
4075
|
+
class os extends rs {
|
|
3970
4076
|
constructor() {
|
|
3971
4077
|
super(3600 * 24 * 30);
|
|
3972
4078
|
}
|
|
@@ -3977,13 +4083,13 @@ class Qr extends zr {
|
|
|
3977
4083
|
return e;
|
|
3978
4084
|
}
|
|
3979
4085
|
fetchFromDb(e) {
|
|
3980
|
-
return
|
|
4086
|
+
return us(e);
|
|
3981
4087
|
}
|
|
3982
4088
|
updateInDb(e, t) {
|
|
3983
|
-
return
|
|
4089
|
+
return cs(e, t);
|
|
3984
4090
|
}
|
|
3985
4091
|
}
|
|
3986
|
-
const
|
|
4092
|
+
const Zs = new os(), ds = new u(
|
|
3987
4093
|
{
|
|
3988
4094
|
shopType: { type: String, required: !0, unique: !0 },
|
|
3989
4095
|
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
@@ -4012,11 +4118,11 @@ const ks = new Qr(), Wr = new u(
|
|
|
4012
4118
|
}
|
|
4013
4119
|
},
|
|
4014
4120
|
{ minimize: !1 }
|
|
4015
|
-
),
|
|
4121
|
+
), Ie = l?.Shop || p("Shop", ds), ls = (n) => Ie.create({
|
|
4016
4122
|
shopType: n
|
|
4017
|
-
}),
|
|
4018
|
-
const e = await
|
|
4019
|
-
return e || y(await
|
|
4123
|
+
}), ps = async (n) => {
|
|
4124
|
+
const e = await Ie.findOne({ shopType: n }).lean();
|
|
4125
|
+
return e || y(await ls(n));
|
|
4020
4126
|
};
|
|
4021
4127
|
class E {
|
|
4022
4128
|
toDBShopItem() {
|
|
@@ -4028,14 +4134,14 @@ class E {
|
|
|
4028
4134
|
};
|
|
4029
4135
|
}
|
|
4030
4136
|
async onBuy(e, t) {
|
|
4031
|
-
this.currency === "berry" ? (await
|
|
4137
|
+
this.currency === "berry" ? (await I.updateUserBerry(
|
|
4032
4138
|
e,
|
|
4033
4139
|
-1 * this.price * t,
|
|
4034
4140
|
!1
|
|
4035
|
-
), await
|
|
4141
|
+
), await Ur.updateTotalSpentInShop(
|
|
4036
4142
|
e,
|
|
4037
4143
|
this.price * t
|
|
4038
|
-
)) : await
|
|
4144
|
+
)) : await S.removeItem(
|
|
4039
4145
|
e,
|
|
4040
4146
|
this.currency,
|
|
4041
4147
|
this.price * t
|
|
@@ -4069,7 +4175,7 @@ class E {
|
|
|
4069
4175
|
return !1;
|
|
4070
4176
|
}
|
|
4071
4177
|
}
|
|
4072
|
-
class
|
|
4178
|
+
class ys extends E {
|
|
4073
4179
|
price;
|
|
4074
4180
|
size;
|
|
4075
4181
|
currency;
|
|
@@ -4083,13 +4189,13 @@ class Xr extends E {
|
|
|
4083
4189
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4084
4190
|
}
|
|
4085
4191
|
async onBuy(e, t) {
|
|
4086
|
-
await super.onBuy(e, t), await
|
|
4192
|
+
await super.onBuy(e, t), await G.unlockBackground(e, this.data.ornamentId);
|
|
4087
4193
|
}
|
|
4088
4194
|
isBackground() {
|
|
4089
4195
|
return !0;
|
|
4090
4196
|
}
|
|
4091
4197
|
}
|
|
4092
|
-
class
|
|
4198
|
+
class fs extends E {
|
|
4093
4199
|
price;
|
|
4094
4200
|
size;
|
|
4095
4201
|
currency;
|
|
@@ -4103,13 +4209,13 @@ class Vr extends E {
|
|
|
4103
4209
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4104
4210
|
}
|
|
4105
4211
|
async onBuy(e, t) {
|
|
4106
|
-
await super.onBuy(e, t), await
|
|
4212
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4107
4213
|
}
|
|
4108
4214
|
isBoostXp() {
|
|
4109
4215
|
return !0;
|
|
4110
4216
|
}
|
|
4111
4217
|
}
|
|
4112
|
-
class
|
|
4218
|
+
class ms extends E {
|
|
4113
4219
|
price;
|
|
4114
4220
|
size;
|
|
4115
4221
|
currency;
|
|
@@ -4123,13 +4229,13 @@ class Jr extends E {
|
|
|
4123
4229
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4124
4230
|
}
|
|
4125
4231
|
async onBuy(e, t) {
|
|
4126
|
-
await super.onBuy(e, t), await
|
|
4232
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4127
4233
|
}
|
|
4128
4234
|
isChest() {
|
|
4129
4235
|
return !0;
|
|
4130
4236
|
}
|
|
4131
4237
|
}
|
|
4132
|
-
class
|
|
4238
|
+
class hs extends E {
|
|
4133
4239
|
price;
|
|
4134
4240
|
size;
|
|
4135
4241
|
currency;
|
|
@@ -4143,13 +4249,13 @@ class Zr extends E {
|
|
|
4143
4249
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4144
4250
|
}
|
|
4145
4251
|
async onBuy(e, t) {
|
|
4146
|
-
await super.onBuy(e, t), await
|
|
4252
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4147
4253
|
}
|
|
4148
4254
|
isObject() {
|
|
4149
4255
|
return !0;
|
|
4150
4256
|
}
|
|
4151
4257
|
}
|
|
4152
|
-
class
|
|
4258
|
+
class ws extends E {
|
|
4153
4259
|
price;
|
|
4154
4260
|
size;
|
|
4155
4261
|
currency;
|
|
@@ -4163,10 +4269,10 @@ class es extends E {
|
|
|
4163
4269
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4164
4270
|
}
|
|
4165
4271
|
async onBuy(e, t) {
|
|
4166
|
-
await super.onBuy(e, t), await
|
|
4272
|
+
await super.onBuy(e, t), await S.addEquipments(
|
|
4167
4273
|
e,
|
|
4168
|
-
|
|
4169
|
-
() =>
|
|
4274
|
+
yt({ stop: t }).map(
|
|
4275
|
+
() => d.seedEquipment(
|
|
4170
4276
|
{ ...this.data },
|
|
4171
4277
|
Date.now() - Math.round(Math.random() * 1e3)
|
|
4172
4278
|
)
|
|
@@ -4180,7 +4286,7 @@ class es extends E {
|
|
|
4180
4286
|
return !0;
|
|
4181
4287
|
}
|
|
4182
4288
|
}
|
|
4183
|
-
class
|
|
4289
|
+
class gs extends E {
|
|
4184
4290
|
price;
|
|
4185
4291
|
size;
|
|
4186
4292
|
currency;
|
|
@@ -4194,13 +4300,13 @@ class ts extends E {
|
|
|
4194
4300
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4195
4301
|
}
|
|
4196
4302
|
async onBuy(e, t) {
|
|
4197
|
-
await super.onBuy(e, t), await
|
|
4303
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4198
4304
|
}
|
|
4199
4305
|
isBottle() {
|
|
4200
4306
|
return !0;
|
|
4201
4307
|
}
|
|
4202
4308
|
}
|
|
4203
|
-
class
|
|
4309
|
+
class Ss extends E {
|
|
4204
4310
|
price;
|
|
4205
4311
|
size;
|
|
4206
4312
|
currency;
|
|
@@ -4214,13 +4320,13 @@ class ns extends E {
|
|
|
4214
4320
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4215
4321
|
}
|
|
4216
4322
|
async onBuy(e, t) {
|
|
4217
|
-
await super.onBuy(e, t), await
|
|
4323
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4218
4324
|
}
|
|
4219
4325
|
isRepair() {
|
|
4220
4326
|
return !0;
|
|
4221
4327
|
}
|
|
4222
4328
|
}
|
|
4223
|
-
class
|
|
4329
|
+
class bs extends E {
|
|
4224
4330
|
price;
|
|
4225
4331
|
size;
|
|
4226
4332
|
currency;
|
|
@@ -4234,13 +4340,13 @@ class as extends E {
|
|
|
4234
4340
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4235
4341
|
}
|
|
4236
4342
|
async onBuy(e, t) {
|
|
4237
|
-
await super.onBuy(e, t), await
|
|
4343
|
+
await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
|
|
4238
4344
|
}
|
|
4239
4345
|
isStore() {
|
|
4240
4346
|
return !0;
|
|
4241
4347
|
}
|
|
4242
4348
|
}
|
|
4243
|
-
class
|
|
4349
|
+
class $s extends E {
|
|
4244
4350
|
price;
|
|
4245
4351
|
size;
|
|
4246
4352
|
currency;
|
|
@@ -4254,36 +4360,36 @@ class rs extends E {
|
|
|
4254
4360
|
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4255
4361
|
}
|
|
4256
4362
|
async onBuy(e, t) {
|
|
4257
|
-
await super.onBuy(e, t), await
|
|
4363
|
+
await super.onBuy(e, t), await G.unlockTitle(e, this.data.ornamentId);
|
|
4258
4364
|
}
|
|
4259
4365
|
isTitle() {
|
|
4260
4366
|
return !0;
|
|
4261
4367
|
}
|
|
4262
4368
|
}
|
|
4263
|
-
class
|
|
4369
|
+
class Es extends f {
|
|
4264
4370
|
async getShopItem(e, t) {
|
|
4265
|
-
const r = (await this.get(e)).items.find((
|
|
4371
|
+
const r = (await this.get(e)).items.find((w) => w.id === t);
|
|
4266
4372
|
if (!r)
|
|
4267
4373
|
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
|
|
4374
|
+
const { price: s, size: i, currency: o } = r, c = await d.get(r.id) ?? await g.get(r.id);
|
|
4375
|
+
if (g.isOrnament(c) && g.isBackground(c))
|
|
4376
|
+
return new ys({ price: s, item: c, size: i, currency: o });
|
|
4377
|
+
if (g.isOrnament(c) && g.isTitle(c))
|
|
4378
|
+
return new $s({ price: s, item: c, size: i, currency: o });
|
|
4379
|
+
if (d.isEntity(c) && d.isChestItem(c))
|
|
4380
|
+
return new ms({ price: s, item: c, size: i, currency: o });
|
|
4381
|
+
if (d.isEntity(c) && d.isBoostItem(c))
|
|
4382
|
+
return new fs({ price: s, item: c, size: i, currency: o });
|
|
4383
|
+
if (d.isEntity(c) && d.isRepairItem(c))
|
|
4384
|
+
return new Ss({ price: s, item: c, size: i, currency: o });
|
|
4385
|
+
if (d.isEntity(c) && d.isStoreItem(c))
|
|
4386
|
+
return new bs({ price: s, item: c, size: i, currency: o });
|
|
4387
|
+
if (d.isEntity(c) && d.isObjectItem(c))
|
|
4388
|
+
return new hs({ price: s, item: c, size: i, currency: o });
|
|
4389
|
+
if (d.isEntity(c) && d.isEquipment(c))
|
|
4390
|
+
return new ws({ price: s, item: c, size: i, currency: o });
|
|
4391
|
+
if (d.isEntity(c) && d.isBottleItem(c))
|
|
4392
|
+
return new gs({ price: s, size: i, item: c, currency: o });
|
|
4287
4393
|
}
|
|
4288
4394
|
async getShopItemList(e) {
|
|
4289
4395
|
const t = await this.get(e), a = [];
|
|
@@ -4294,7 +4400,7 @@ class ss extends f {
|
|
|
4294
4400
|
return a;
|
|
4295
4401
|
}
|
|
4296
4402
|
getShopItemId(e) {
|
|
4297
|
-
return
|
|
4403
|
+
return d.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
|
|
4298
4404
|
}
|
|
4299
4405
|
async updateShopStats(e, t, a) {
|
|
4300
4406
|
await this.update(
|
|
@@ -4342,8 +4448,8 @@ class ss extends f {
|
|
|
4342
4448
|
);
|
|
4343
4449
|
}
|
|
4344
4450
|
}
|
|
4345
|
-
const
|
|
4346
|
-
class
|
|
4451
|
+
const Us = (n, e) => Ie.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
4452
|
+
class Is extends Es {
|
|
4347
4453
|
constructor() {
|
|
4348
4454
|
super(3600);
|
|
4349
4455
|
}
|
|
@@ -4354,28 +4460,28 @@ class us extends ss {
|
|
|
4354
4460
|
return e;
|
|
4355
4461
|
}
|
|
4356
4462
|
fetchFromDb(e) {
|
|
4357
|
-
return
|
|
4463
|
+
return ps(e);
|
|
4358
4464
|
}
|
|
4359
4465
|
updateInDb(e, t) {
|
|
4360
|
-
return
|
|
4466
|
+
return Us(e, t);
|
|
4361
4467
|
}
|
|
4362
4468
|
}
|
|
4363
|
-
const
|
|
4469
|
+
const ei = new Is(), Ts = new u({
|
|
4364
4470
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
4365
4471
|
authorId: String,
|
|
4366
4472
|
date: { type: Date, default: Date.now() },
|
|
4367
4473
|
reason: { type: String, default: null }
|
|
4368
|
-
}),
|
|
4369
|
-
class
|
|
4474
|
+
}), tt = l?.Warn || p("Warn", Ts), Ds = (n) => tt.countDocuments(n);
|
|
4475
|
+
class Os extends b {
|
|
4370
4476
|
getUserWarns(e) {
|
|
4371
4477
|
return this.getMany({ warnedUserId: e });
|
|
4372
4478
|
}
|
|
4373
4479
|
getUserWarnCount(e) {
|
|
4374
|
-
return
|
|
4480
|
+
return Ds({ warnedUserId: e });
|
|
4375
4481
|
}
|
|
4376
4482
|
}
|
|
4377
|
-
const
|
|
4378
|
-
class
|
|
4483
|
+
const Cs = (n) => tt.find(n).lean();
|
|
4484
|
+
class Rs extends Os {
|
|
4379
4485
|
constructor() {
|
|
4380
4486
|
super(300);
|
|
4381
4487
|
}
|
|
@@ -4389,60 +4495,62 @@ class ps extends ds {
|
|
|
4389
4495
|
throw new Error("Method not implemented.");
|
|
4390
4496
|
}
|
|
4391
4497
|
fetchManyFromDb(e) {
|
|
4392
|
-
return
|
|
4498
|
+
return Cs(e);
|
|
4393
4499
|
}
|
|
4394
4500
|
updateInDb() {
|
|
4395
4501
|
throw new Error("Method not implemented.");
|
|
4396
4502
|
}
|
|
4397
4503
|
}
|
|
4398
|
-
const
|
|
4399
|
-
|
|
4504
|
+
const ti = new Rs(), ni = (n) => {
|
|
4505
|
+
ut(n);
|
|
4400
4506
|
};
|
|
4401
|
-
class
|
|
4507
|
+
class ai extends ct.ObjectId {
|
|
4402
4508
|
}
|
|
4403
4509
|
export {
|
|
4404
|
-
|
|
4405
|
-
|
|
4510
|
+
js as COOLDOWN_COMMANDS,
|
|
4511
|
+
ai as ObjectId,
|
|
4406
4512
|
h as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4513
|
+
he as RAID_MIDDLEWARE_EVENT_NAME,
|
|
4514
|
+
Vs as banService,
|
|
4515
|
+
ni as connectToServices,
|
|
4516
|
+
Ce as crewMetaService,
|
|
4517
|
+
qs as crewOrnamentsService,
|
|
4518
|
+
ks as crewQuestService,
|
|
4519
|
+
Mt as crewService,
|
|
4520
|
+
Ns as crewStatsEngagementService,
|
|
4521
|
+
Fs as crewStatsFrequencyService,
|
|
4416
4522
|
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
|
-
|
|
4523
|
+
me as emitRaidMiddlewareEvent,
|
|
4524
|
+
d as entityService,
|
|
4525
|
+
ps as findShop,
|
|
4526
|
+
Js as invitationService,
|
|
4527
|
+
g as ornamentService,
|
|
4528
|
+
U as panoplyService,
|
|
4529
|
+
_s as registerQuestMiddlewareEvents,
|
|
4530
|
+
xs as registerRaidMiddlewareEvents,
|
|
4531
|
+
H as reminderService,
|
|
4532
|
+
Zs as settingsService,
|
|
4533
|
+
Ie as shopModel,
|
|
4534
|
+
ei as shopService,
|
|
4535
|
+
va as userCooldownService,
|
|
4536
|
+
aa as userCrewService,
|
|
4537
|
+
zs as userDailyReportService,
|
|
4538
|
+
pe as userEncyclopediaService,
|
|
4539
|
+
Ps as userGamesService,
|
|
4540
|
+
S as userInventoryService,
|
|
4541
|
+
I as userMetaService,
|
|
4542
|
+
G as userOrnamentService,
|
|
4543
|
+
ve as userQuestService,
|
|
4544
|
+
Ks as userRaidService,
|
|
4545
|
+
Sn as userService,
|
|
4546
|
+
Re as userSettingsService,
|
|
4547
|
+
Hs as userShopService,
|
|
4548
|
+
Ls as userStatsCasinoService,
|
|
4549
|
+
Qs as userStatsCrewService,
|
|
4550
|
+
Ur as userStatsEconomyService,
|
|
4551
|
+
Ws as userStatsEngagementService,
|
|
4552
|
+
Gs as userStatsFlagsService,
|
|
4553
|
+
Ys as userStatsFrequencyService,
|
|
4554
|
+
Xs as userStatsInventoryService,
|
|
4555
|
+
ti as warnService
|
|
4448
4556
|
};
|