@opfr/services 1.2.0 → 1.3.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 +968 -894
- package/dist/index.umd.js +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/recipe/data.d.ts +3 -0
- package/dist/services/recipe/data.d.ts.map +1 -0
- package/dist/services/recipe/definition/model.d.ts +5 -0
- package/dist/services/recipe/definition/model.d.ts.map +1 -0
- package/dist/services/recipe/definition/schema.d.ts +13 -0
- package/dist/services/recipe/definition/schema.d.ts.map +1 -0
- package/dist/services/recipe/helper.d.ts +12 -0
- package/dist/services/recipe/helper.d.ts.map +1 -0
- package/dist/services/recipe/index.d.ts +3 -0
- package/dist/services/recipe/index.d.ts.map +1 -0
- package/dist/services/recipe/process/create.d.ts +3 -0
- package/dist/services/recipe/process/create.d.ts.map +1 -0
- package/dist/services/recipe/process/findMany.d.ts +5 -0
- package/dist/services/recipe/process/findMany.d.ts.map +1 -0
- package/dist/services/recipe/process/findOne.d.ts +4 -0
- package/dist/services/recipe/process/findOne.d.ts.map +1 -0
- package/dist/services/recipe/process/updateOne.d.ts +5 -0
- package/dist/services/recipe/process/updateOne.d.ts.map +1 -0
- package/dist/services/recipe/service.d.ts +24 -0
- package/dist/services/recipe/service.d.ts.map +1 -0
- package/dist/services/recipe/types.d.ts +24 -0
- package/dist/services/recipe/types.d.ts.map +1 -0
- package/dist/services/user-inventory/helper.d.ts +6 -20
- package/dist/services/user-inventory/helper.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { Schema as u, models as l, model as p, connect as
|
|
2
|
-
import { randomBetween as Y, hasExpire as L, sameDay as
|
|
3
|
-
import
|
|
4
|
-
import { CREW_DEFAULT_DISINTEGRATION as
|
|
5
|
-
import * as
|
|
1
|
+
import { Schema as u, models as l, model as p, connect as ct, Types as ot } from "mongoose";
|
|
2
|
+
import { randomBetween as Y, hasExpire as L, sameDay as fe, yesterday as k, capitalizeAllWords as dt, filterNullAndUndefined as N, pickFrom as lt, shuffle as Te, recordToArray as R, arrayToRecord as Ae, mergeObjects as F, exclude as q, groupBy as pt, sortBy as Oe, seededRandom as yt, range as ft } from "@opfr/utils-lang";
|
|
3
|
+
import mt from "node-cache";
|
|
4
|
+
import { CREW_DEFAULT_DISINTEGRATION as Be, CREW_DEFAULT_MEMBER_LIMIT as ht, QuestStatus as T, CREW_DEFAULT_XP_PERCENT as wt, DEFAULT_FACTION as gt, RANK_IDS_WITHOUT_BASIC as Ce, EQUIPMENT_SLOT as _e, EQUIPMENT_FROM_SLOT_TO_TYPE as St, EFFECT_KEYS as bt, CHARACTERISTICS as $t, getComputedCharacteristicValue as Et, getCurrentLevel as It, HP_PER_VITALITY as Ut, DEFAULT_MAX_HP as Dt, transformToDBBuff as Tt, SHOP_DEFAULT_AVAILABLE_ENTITY_AMOUNT as Ot } from "@opfr/definitions";
|
|
5
|
+
import * as me from "events";
|
|
6
6
|
const Q = "___ALL_ENTITIES___";
|
|
7
7
|
class f {
|
|
8
8
|
cache;
|
|
9
9
|
constructor(e) {
|
|
10
|
-
this.cache = new
|
|
10
|
+
this.cache = new mt({
|
|
11
11
|
stdTTL: e,
|
|
12
12
|
checkperiod: e * 0.2,
|
|
13
13
|
useClones: !1
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
async get(e) {
|
|
17
|
-
const t = this.normalizeKey(e),
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
async update(e, t,
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const s = this.getKey(
|
|
27
|
-
this.cache.del(Q), this.cache.set(this.normalizeKey(s),
|
|
17
|
+
const t = this.normalizeKey(e), r = this.cache.get(t);
|
|
18
|
+
if (r)
|
|
19
|
+
return r;
|
|
20
|
+
const a = await this.fetchFromDb(e);
|
|
21
|
+
return a && this.cache.set(t, a), a;
|
|
22
|
+
}
|
|
23
|
+
async update(e, t, r) {
|
|
24
|
+
const a = await this.updateInDb(e, t, r);
|
|
25
|
+
if (a) {
|
|
26
|
+
const s = this.getKey(a);
|
|
27
|
+
this.cache.del(Q), this.cache.set(this.normalizeKey(s), a);
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return a;
|
|
30
30
|
}
|
|
31
31
|
invalidate(e) {
|
|
32
32
|
this.cache.del(Q), e && this.cache.del(this.normalizeKey(e));
|
|
@@ -41,23 +41,23 @@ class b extends f {
|
|
|
41
41
|
if (e)
|
|
42
42
|
return e;
|
|
43
43
|
const t = await this.fetchManyFromDb({});
|
|
44
|
-
return this.cache.set(Q, t), t.forEach((
|
|
45
|
-
this.cache.set(this.normalizeKey(this.getKey(
|
|
44
|
+
return this.cache.set(Q, t), t.forEach((r) => {
|
|
45
|
+
this.cache.set(this.normalizeKey(this.getKey(r)), r);
|
|
46
46
|
}), t;
|
|
47
47
|
}
|
|
48
48
|
async getMany(e) {
|
|
49
49
|
const t = await this.fetchManyFromDb(e);
|
|
50
|
-
return t.forEach((
|
|
51
|
-
this.cache.set(this.normalizeKey(this.getKey(
|
|
50
|
+
return t.forEach((r) => {
|
|
51
|
+
this.cache.set(this.normalizeKey(this.getKey(r)), r);
|
|
52
52
|
}), t;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
55
|
+
const xe = new me.EventEmitter(), m = (n, e, t) => {
|
|
56
|
+
xe.emit(n, e, t);
|
|
57
|
+
}, Ls = (n) => {
|
|
58
58
|
for (const [e, t] of Object.entries(n))
|
|
59
|
-
|
|
60
|
-
t(
|
|
59
|
+
xe.on(e, (r, a) => {
|
|
60
|
+
t(r, a);
|
|
61
61
|
});
|
|
62
62
|
}, h = {
|
|
63
63
|
CREW: "middleware/quest/CREW",
|
|
@@ -79,34 +79,34 @@ const _e = new fe.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
|
+
}, qe = new me.EventEmitter(), he = (n, e, t) => {
|
|
83
|
+
qe.emit(n, e, t);
|
|
84
|
+
}, Qs = (n) => {
|
|
85
85
|
for (const [e, t] of Object.entries(n))
|
|
86
|
-
|
|
87
|
-
t(
|
|
86
|
+
qe.on(e, (r, a) => {
|
|
87
|
+
t(r, a);
|
|
88
88
|
});
|
|
89
|
-
},
|
|
89
|
+
}, we = {
|
|
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
|
+
}, ke = 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: ht },
|
|
100
|
+
disintegration: { type: Number, default: Be },
|
|
101
101
|
faction: String
|
|
102
102
|
},
|
|
103
103
|
{ timestamps: !0, minimize: !1 }
|
|
104
104
|
);
|
|
105
|
-
|
|
105
|
+
ke.post("findOneAndUpdate", async function(n) {
|
|
106
106
|
m(h.CREW, n._id, n);
|
|
107
107
|
});
|
|
108
|
-
const W = l?.Crew || p("Crew",
|
|
109
|
-
class
|
|
108
|
+
const W = l?.Crew || p("Crew", ke);
|
|
109
|
+
class Ct extends f {
|
|
110
110
|
async getCrewRank(e) {
|
|
111
111
|
return (await W.aggregate([
|
|
112
112
|
{
|
|
@@ -173,13 +173,13 @@ class Ot extends f {
|
|
|
173
173
|
async applyDisintegration(e) {
|
|
174
174
|
const t = await this.get(e);
|
|
175
175
|
if (!t) return;
|
|
176
|
-
const { memberLimit:
|
|
176
|
+
const { memberLimit: r } = t, [a, s] = [r - 2, (r - 3) * 2 + 3];
|
|
177
177
|
await this.update(e, [
|
|
178
178
|
{
|
|
179
179
|
$set: {
|
|
180
180
|
disintegration: {
|
|
181
181
|
$max: [
|
|
182
|
-
{ $add: ["$disintegration", -1 * Y(
|
|
182
|
+
{ $add: ["$disintegration", -1 * Y(a, s)] },
|
|
183
183
|
0
|
|
184
184
|
]
|
|
185
185
|
}
|
|
@@ -188,13 +188,13 @@ class Ot extends f {
|
|
|
188
188
|
]);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const Rt = async (n) => {
|
|
192
192
|
const e = await W.findById(n).lean();
|
|
193
193
|
return e || null;
|
|
194
|
-
},
|
|
194
|
+
}, vt = (n, e) => W.findOneAndUpdate({ _id: n }, e, {
|
|
195
195
|
returnDocument: "after"
|
|
196
196
|
}).lean();
|
|
197
|
-
class Mt extends
|
|
197
|
+
class Mt extends Ct {
|
|
198
198
|
constructor() {
|
|
199
199
|
super(3600);
|
|
200
200
|
}
|
|
@@ -205,23 +205,23 @@ class Mt extends Ot {
|
|
|
205
205
|
return e;
|
|
206
206
|
}
|
|
207
207
|
fetchFromDb(e) {
|
|
208
|
-
return
|
|
208
|
+
return Rt(e);
|
|
209
209
|
}
|
|
210
210
|
updateInDb(e, t) {
|
|
211
|
-
return
|
|
211
|
+
return vt(e, t);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
class
|
|
214
|
+
const At = new Mt();
|
|
215
|
+
class Bt extends f {
|
|
216
216
|
async hasXpBuff(e) {
|
|
217
217
|
const t = await this.get(e);
|
|
218
218
|
if (!L(t.buffs.xp.expireAt))
|
|
219
219
|
return t.buffs.xp;
|
|
220
220
|
}
|
|
221
221
|
async calcXp(e, t) {
|
|
222
|
-
const
|
|
223
|
-
return
|
|
224
|
-
t * (
|
|
222
|
+
const r = await At.get(e);
|
|
223
|
+
return r ? Math.ceil(
|
|
224
|
+
t * (r.disintegration / Be) * ((await this.hasXpBuff(e))?.boost ?? 1)
|
|
225
225
|
) : 0;
|
|
226
226
|
}
|
|
227
227
|
async addXp(e, t) {
|
|
@@ -246,18 +246,18 @@ class At extends f {
|
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
async addXpBuff(e, t) {
|
|
249
|
-
const
|
|
249
|
+
const r = /* @__PURE__ */ new Date();
|
|
250
250
|
await this.update(e, [
|
|
251
251
|
{
|
|
252
252
|
$set: {
|
|
253
253
|
"buffs.xp": {
|
|
254
254
|
$cond: {
|
|
255
255
|
if: {
|
|
256
|
-
lt: ["$buffs.xp.expireAt",
|
|
256
|
+
lt: ["$buffs.xp.expireAt", r]
|
|
257
257
|
},
|
|
258
258
|
then: {
|
|
259
259
|
boost: 1.1,
|
|
260
|
-
expireAt: { $add: [
|
|
260
|
+
expireAt: { $add: [r, t * 60 * 60 * 1e3] }
|
|
261
261
|
},
|
|
262
262
|
else: {
|
|
263
263
|
boost: 1.1,
|
|
@@ -272,7 +272,7 @@ class At 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 }), Ne = 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 }), ke = new
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
|
-
|
|
291
|
+
Ne.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 ge = l?.CrewMeta || p("CrewMeta", Ne), _t = async (n) => await ge.create({
|
|
299
299
|
crew: n
|
|
300
300
|
});
|
|
301
|
-
async function
|
|
302
|
-
const e = await
|
|
303
|
-
return e || y(await
|
|
301
|
+
async function xt(n) {
|
|
302
|
+
const e = await ge.findOne({ crew: n }).lean();
|
|
303
|
+
return e || y(await _t(n));
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const qt = (n, e) => ge.findOneAndUpdate({ crew: n }, e, {
|
|
306
306
|
returnDocument: "after",
|
|
307
307
|
upsert: !0
|
|
308
308
|
}).lean();
|
|
309
|
-
class
|
|
309
|
+
class kt extends Bt {
|
|
310
310
|
constructor() {
|
|
311
311
|
super(300);
|
|
312
312
|
}
|
|
@@ -317,23 +317,23 @@ class qt extends At {
|
|
|
317
317
|
return e;
|
|
318
318
|
}
|
|
319
319
|
fetchFromDb(e) {
|
|
320
|
-
return
|
|
320
|
+
return xt(e);
|
|
321
321
|
}
|
|
322
322
|
updateInDb(e, t) {
|
|
323
|
-
return
|
|
323
|
+
return qt(e, t);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
const
|
|
327
|
-
class
|
|
328
|
-
async unlockBadge(e, t,
|
|
326
|
+
const Re = new kt();
|
|
327
|
+
class Nt extends f {
|
|
328
|
+
async unlockBadge(e, t, r) {
|
|
329
329
|
t.isProgressive ? await this.update(e, {
|
|
330
|
-
$addToSet: { unlockedBadges: `${t.id}_${
|
|
330
|
+
$addToSet: { unlockedBadges: `${t.id}_${r}` }
|
|
331
331
|
}) : await this.update(e, {
|
|
332
332
|
$addToSet: { unlockedBadges: t.id }
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
const
|
|
336
|
+
const Fe = new u({
|
|
337
337
|
crew: {
|
|
338
338
|
type: u.Types.ObjectId,
|
|
339
339
|
required: !0,
|
|
@@ -342,25 +342,25 @@ const Ne = new u({
|
|
|
342
342
|
},
|
|
343
343
|
unlockedBadges: { type: [String], default: [] }
|
|
344
344
|
});
|
|
345
|
-
|
|
345
|
+
Fe.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 Se = l?.CrewOrnaments || p("CrewOrnaments", Fe), Ft = (n) => Se.create({
|
|
353
353
|
crew: n
|
|
354
354
|
});
|
|
355
|
-
async function
|
|
356
|
-
const e = await
|
|
357
|
-
return e || y(await
|
|
355
|
+
async function jt(n) {
|
|
356
|
+
const e = await Se.findOne({ crew: n }).lean();
|
|
357
|
+
return e || y(await Ft(n));
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const zt = (n, e) => Se.findOneAndUpdate({ crew: n }, e, {
|
|
360
360
|
upsert: !0,
|
|
361
361
|
returnDocument: "after"
|
|
362
362
|
}).lean();
|
|
363
|
-
class
|
|
363
|
+
class Kt extends Nt {
|
|
364
364
|
constructor() {
|
|
365
365
|
super(300);
|
|
366
366
|
}
|
|
@@ -371,13 +371,13 @@ class zt extends kt {
|
|
|
371
371
|
return e;
|
|
372
372
|
}
|
|
373
373
|
fetchFromDb(e) {
|
|
374
|
-
return
|
|
374
|
+
return jt(e);
|
|
375
375
|
}
|
|
376
376
|
updateInDb(e, t) {
|
|
377
|
-
return
|
|
377
|
+
return zt(e, t);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
const
|
|
380
|
+
const Ws = new Kt();
|
|
381
381
|
class Pt extends b {
|
|
382
382
|
async getStatus(e, t) {
|
|
383
383
|
return (await this.get({ crew: e, questId: t })).status;
|
|
@@ -386,8 +386,8 @@ class Pt extends b {
|
|
|
386
386
|
return await this.getStatus(e, t) === "COMPLETED";
|
|
387
387
|
}
|
|
388
388
|
async isStreaking(e, t) {
|
|
389
|
-
const { lastCompletionDate:
|
|
390
|
-
return !!
|
|
389
|
+
const { lastCompletionDate: r } = await this.get({ crew: e, questId: t });
|
|
390
|
+
return !!r && fe(k(), r);
|
|
391
391
|
}
|
|
392
392
|
async completeQuest(e) {
|
|
393
393
|
return this.update(
|
|
@@ -396,7 +396,7 @@ class Pt extends b {
|
|
|
396
396
|
{
|
|
397
397
|
$set: {
|
|
398
398
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
399
|
-
status:
|
|
399
|
+
status: T.COMPLETED
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
],
|
|
@@ -404,7 +404,7 @@ class Pt extends b {
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const je = new u(
|
|
408
408
|
{
|
|
409
409
|
crew: {
|
|
410
410
|
type: u.Types.ObjectId,
|
|
@@ -417,37 +417,37 @@ const Fe = new u(
|
|
|
417
417
|
required: !0,
|
|
418
418
|
index: !0
|
|
419
419
|
},
|
|
420
|
-
status: { type: String, default:
|
|
420
|
+
status: { type: String, default: T.IN_PROGRESS, index: !0 },
|
|
421
421
|
lastCompletionDate: Date
|
|
422
422
|
},
|
|
423
423
|
{ minimize: !1 }
|
|
424
424
|
);
|
|
425
|
-
|
|
425
|
+
je.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 X = l?.CrewQuest || p("CrewQuest",
|
|
433
|
-
function
|
|
432
|
+
const X = l?.CrewQuest || p("CrewQuest", je);
|
|
433
|
+
function Ht(n) {
|
|
434
434
|
return X.find(n).lean();
|
|
435
435
|
}
|
|
436
|
-
const
|
|
436
|
+
const Lt = async (n) => await X.create({
|
|
437
437
|
...n
|
|
438
438
|
});
|
|
439
|
-
async function
|
|
439
|
+
async function Qt(n) {
|
|
440
440
|
const e = await X.findOne(n).lean();
|
|
441
|
-
return e || y(await
|
|
441
|
+
return e || y(await Lt(n));
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function Wt(n, e, t) {
|
|
444
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 Gt extends Pt {
|
|
451
451
|
constructor() {
|
|
452
452
|
super(300);
|
|
453
453
|
}
|
|
@@ -461,17 +461,17 @@ class Wt extends Pt {
|
|
|
461
461
|
return { crew: e, questId: t };
|
|
462
462
|
}
|
|
463
463
|
fetchFromDb(e) {
|
|
464
|
-
return
|
|
464
|
+
return Qt(e);
|
|
465
465
|
}
|
|
466
466
|
fetchManyFromDb(e) {
|
|
467
|
-
return
|
|
467
|
+
return Ht(e);
|
|
468
468
|
}
|
|
469
|
-
updateInDb(e, t,
|
|
470
|
-
return
|
|
469
|
+
updateInDb(e, t, r) {
|
|
470
|
+
return Wt(e, t, r);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
const
|
|
474
|
-
class
|
|
473
|
+
const Gs = new Gt();
|
|
474
|
+
class Yt extends f {
|
|
475
475
|
async setActualVoiceMembers(e, t) {
|
|
476
476
|
await this.update(e, {
|
|
477
477
|
$set: {
|
|
@@ -488,7 +488,7 @@ class Gt extends f {
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
const
|
|
491
|
+
const ze = new u({
|
|
492
492
|
crew: {
|
|
493
493
|
type: u.Types.ObjectId,
|
|
494
494
|
required: !0,
|
|
@@ -501,28 +501,28 @@ const je = new u({
|
|
|
501
501
|
connectedAt: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
|
-
|
|
504
|
+
ze.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 be = l?.CrewStatsEngagement || p(
|
|
512
512
|
"CrewStatsEngagement",
|
|
513
|
-
|
|
514
|
-
),
|
|
513
|
+
ze
|
|
514
|
+
), Xt = (n) => be.create({
|
|
515
515
|
crew: n
|
|
516
516
|
});
|
|
517
|
-
async function
|
|
518
|
-
const e = await
|
|
519
|
-
return e || y(await
|
|
517
|
+
async function Vt(n) {
|
|
518
|
+
const e = await be.findOne({ crew: n }).lean();
|
|
519
|
+
return e || y(await Xt(n));
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const Jt = (n, e) => be.findOneAndUpdate({ crew: n }, e, {
|
|
522
522
|
upsert: !0,
|
|
523
523
|
returnDocument: "after"
|
|
524
524
|
}).lean();
|
|
525
|
-
class
|
|
525
|
+
class Zt extends Yt {
|
|
526
526
|
constructor() {
|
|
527
527
|
super(300);
|
|
528
528
|
}
|
|
@@ -535,16 +535,16 @@ class Jt extends Gt {
|
|
|
535
535
|
return e;
|
|
536
536
|
}
|
|
537
537
|
fetchFromDb(e) {
|
|
538
|
-
return
|
|
538
|
+
return Vt(e);
|
|
539
539
|
}
|
|
540
540
|
updateInDb(e, t) {
|
|
541
|
-
return
|
|
541
|
+
return Jt(e, t);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
const
|
|
545
|
-
class
|
|
544
|
+
const Ys = new Zt();
|
|
545
|
+
class en extends f {
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const Ke = new u({
|
|
548
548
|
crew: {
|
|
549
549
|
type: u.Types.ObjectId,
|
|
550
550
|
required: !0,
|
|
@@ -553,28 +553,28 @@ const ze = new u({
|
|
|
553
553
|
},
|
|
554
554
|
streak80Percent: { type: Number, default: 0 }
|
|
555
555
|
});
|
|
556
|
-
|
|
556
|
+
Ke.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 $e = l?.CrewStatsFrequency || p(
|
|
564
564
|
"CrewStatsFrequency",
|
|
565
|
-
|
|
566
|
-
),
|
|
565
|
+
Ke
|
|
566
|
+
), tn = (n) => $e.create({
|
|
567
567
|
crew: n
|
|
568
568
|
});
|
|
569
|
-
async function
|
|
570
|
-
const e = await
|
|
571
|
-
return e || y(await
|
|
569
|
+
async function nn(n) {
|
|
570
|
+
const e = await $e.findOne({ crew: n }).lean();
|
|
571
|
+
return e || y(await tn(n));
|
|
572
572
|
}
|
|
573
|
-
const
|
|
573
|
+
const rn = (n, e) => $e.findOneAndUpdate({ crew: n }, e, {
|
|
574
574
|
upsert: !0,
|
|
575
575
|
returnDocument: "after"
|
|
576
576
|
}).lean();
|
|
577
|
-
class an extends
|
|
577
|
+
class an extends en {
|
|
578
578
|
constructor() {
|
|
579
579
|
super(300);
|
|
580
580
|
}
|
|
@@ -585,13 +585,13 @@ class an extends Zt {
|
|
|
585
585
|
return e;
|
|
586
586
|
}
|
|
587
587
|
fetchFromDb(e) {
|
|
588
|
-
return
|
|
588
|
+
return nn(e);
|
|
589
589
|
}
|
|
590
590
|
updateInDb(e, t) {
|
|
591
|
-
return
|
|
591
|
+
return rn(e, t);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
const
|
|
594
|
+
const Xs = new an(), Pe = new u(
|
|
595
595
|
{
|
|
596
596
|
user: {
|
|
597
597
|
type: u.Types.ObjectId,
|
|
@@ -604,15 +604,15 @@ const js = new an(), Pe = new u(
|
|
|
604
604
|
required: !0,
|
|
605
605
|
index: !0
|
|
606
606
|
},
|
|
607
|
-
status: { type: String, default:
|
|
607
|
+
status: { type: String, default: T.IN_PROGRESS, index: 1 },
|
|
608
608
|
lastCompletionDate: Date,
|
|
609
609
|
streak: Number
|
|
610
610
|
},
|
|
611
611
|
{ minimize: !1 }
|
|
612
612
|
);
|
|
613
613
|
Pe.post("findOneAndUpdate", function(n) {
|
|
614
|
-
|
|
615
|
-
|
|
614
|
+
he(
|
|
615
|
+
we.USER_QUEST,
|
|
616
616
|
n.user._id,
|
|
617
617
|
n
|
|
618
618
|
), m(
|
|
@@ -621,7 +621,7 @@ Pe.post("findOneAndUpdate", function(n) {
|
|
|
621
621
|
n
|
|
622
622
|
);
|
|
623
623
|
});
|
|
624
|
-
const B = l?.UserQuest || p("UserQuest", Pe),
|
|
624
|
+
const B = l?.UserQuest || p("UserQuest", Pe), sn = new u({
|
|
625
625
|
user: {
|
|
626
626
|
type: u.Types.ObjectId,
|
|
627
627
|
required: !0,
|
|
@@ -641,7 +641,7 @@ const B = l?.UserQuest || p("UserQuest", Pe), rn = 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
|
-
}), V = l?.UserCooldown || p("UserCooldown",
|
|
644
|
+
}), V = l?.UserCooldown || p("UserCooldown", sn), He = new u(
|
|
645
645
|
{
|
|
646
646
|
user: {
|
|
647
647
|
type: u.Types.ObjectId,
|
|
@@ -656,18 +656,18 @@ const B = l?.UserQuest || p("UserQuest", Pe), rn = 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: wt }
|
|
660
660
|
},
|
|
661
661
|
{ minimize: !1 }
|
|
662
662
|
);
|
|
663
|
-
|
|
663
|
+
He.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 _ = l?.UserCrew || p("UserCrew",
|
|
670
|
+
const _ = l?.UserCrew || p("UserCrew", He), un = new u({
|
|
671
671
|
user: {
|
|
672
672
|
type: u.Types.ObjectId,
|
|
673
673
|
required: !0,
|
|
@@ -683,7 +683,7 @@ const _ = l?.UserCrew || p("UserCrew", Ke), sn = new u({
|
|
|
683
683
|
},
|
|
684
684
|
previousCompletedQuest: { type: [String], default: [] },
|
|
685
685
|
previousMessageSent: { type: Number, default: 0 }
|
|
686
|
-
}), J = l?.UserDailyReport || p("UserDailyReport",
|
|
686
|
+
}), J = l?.UserDailyReport || p("UserDailyReport", un), cn = new u({
|
|
687
687
|
user: {
|
|
688
688
|
type: u.Types.ObjectId,
|
|
689
689
|
required: !0,
|
|
@@ -691,7 +691,7 @@ const _ = l?.UserCrew || p("UserCrew", Ke), sn = new u({
|
|
|
691
691
|
ref: "User"
|
|
692
692
|
},
|
|
693
693
|
encyclopedia: { type: [String], default: [] }
|
|
694
|
-
}), Z = l?.UserEncyclopedia || p("UserEncyclopedia",
|
|
694
|
+
}), Z = l?.UserEncyclopedia || p("UserEncyclopedia", cn), on = new u({
|
|
695
695
|
user: {
|
|
696
696
|
type: u.Types.ObjectId,
|
|
697
697
|
required: !0,
|
|
@@ -708,7 +708,7 @@ const _ = l?.UserCrew || p("UserCrew", Ke), sn = new u({
|
|
|
708
708
|
},
|
|
709
709
|
default: null
|
|
710
710
|
}
|
|
711
|
-
}), ee = l?.UserGames || p("UserGames",
|
|
711
|
+
}), ee = l?.UserGames || p("UserGames", on), Le = new u(
|
|
712
712
|
{
|
|
713
713
|
user: {
|
|
714
714
|
type: u.Types.ObjectId,
|
|
@@ -730,9 +730,9 @@ const _ = l?.UserCrew || p("UserCrew", Ke), sn = new u({
|
|
|
730
730
|
},
|
|
731
731
|
{ minimize: !1 }
|
|
732
732
|
);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
733
|
+
Le.post("findOneAndUpdate", function(n) {
|
|
734
|
+
he(
|
|
735
|
+
we.USER_INVENTORY,
|
|
736
736
|
n.user._id,
|
|
737
737
|
n
|
|
738
738
|
), m(
|
|
@@ -741,14 +741,14 @@ He.post("findOneAndUpdate", function(n) {
|
|
|
741
741
|
n
|
|
742
742
|
);
|
|
743
743
|
});
|
|
744
|
-
const te = l?.UserInventory || p("UserInventory",
|
|
745
|
-
|
|
744
|
+
const te = l?.UserInventory || p("UserInventory", Le), dn = new me.EventEmitter(), ln = (n, e) => {
|
|
745
|
+
dn.emit(n, e);
|
|
746
746
|
}, C = {
|
|
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
|
+
}, Qe = new u({
|
|
752
752
|
user: {
|
|
753
753
|
type: u.Types.ObjectId,
|
|
754
754
|
required: !0,
|
|
@@ -825,14 +825,14 @@ const te = l?.UserInventory || p("UserInventory", He), on = new fe.EventEmitter(
|
|
|
825
825
|
wisdom: { type: Number, default: 0 }
|
|
826
826
|
}
|
|
827
827
|
});
|
|
828
|
-
|
|
828
|
+
Qe.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 && ln("death", n.user._id);
|
|
834
834
|
});
|
|
835
|
-
const O = l?.UserMeta || p("UserMeta",
|
|
835
|
+
const O = l?.UserMeta || p("UserMeta", Qe), We = new u({
|
|
836
836
|
user: {
|
|
837
837
|
type: u.Types.ObjectId,
|
|
838
838
|
required: !0,
|
|
@@ -849,14 +849,14 @@ const O = l?.UserMeta || p("UserMeta", Le), Qe = new u({
|
|
|
849
849
|
unlockedBags: { type: [String], default: ["default"] },
|
|
850
850
|
selectedBag: { type: String, default: "default" }
|
|
851
851
|
});
|
|
852
|
-
|
|
852
|
+
We.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 ne = l?.UserOrnament || p("UserOrnament",
|
|
859
|
+
const ne = l?.UserOrnament || p("UserOrnament", We), Ge = new u(
|
|
860
860
|
{
|
|
861
861
|
user: {
|
|
862
862
|
type: u.Types.ObjectId,
|
|
@@ -880,14 +880,14 @@ const ne = l?.UserOrnament || p("UserOrnament", Qe), We = new u(
|
|
|
880
880
|
},
|
|
881
881
|
{ minimize: !1 }
|
|
882
882
|
);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
883
|
+
Ge.post("findOneAndUpdate", function(n) {
|
|
884
|
+
he(
|
|
885
|
+
we.USER_RAID,
|
|
886
886
|
n.user._id,
|
|
887
887
|
n
|
|
888
888
|
);
|
|
889
889
|
});
|
|
890
|
-
const
|
|
890
|
+
const re = l?.UserRaid || p("UserRaid", Ge), pn = new u({
|
|
891
891
|
user: {
|
|
892
892
|
type: u.Types.ObjectId,
|
|
893
893
|
required: !0,
|
|
@@ -913,7 +913,7 @@ const ae = l?.UserRaid || p("UserRaid", We), ln = new u({
|
|
|
913
913
|
rps: { type: Boolean, default: !1 }
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
}), j = l?.UserSettings || p("UserSettings",
|
|
916
|
+
}), j = l?.UserSettings || p("UserSettings", pn), yn = new u(
|
|
917
917
|
{
|
|
918
918
|
user: {
|
|
919
919
|
type: u.Types.ObjectId,
|
|
@@ -925,7 +925,7 @@ const ae = l?.UserRaid || p("UserRaid", We), ln = new u({
|
|
|
925
925
|
limit: { type: u.Types.Mixed, default: {} }
|
|
926
926
|
},
|
|
927
927
|
{ minimize: !1 }
|
|
928
|
-
),
|
|
928
|
+
), ae = l?.UserShop || p("UserShop", yn), Ye = new u({
|
|
929
929
|
user: {
|
|
930
930
|
type: u.Types.ObjectId,
|
|
931
931
|
required: !0,
|
|
@@ -960,14 +960,14 @@ const ae = l?.UserRaid || p("UserRaid", We), ln = new u({
|
|
|
960
960
|
guessInOneTryCount: { type: Number, default: 0 }
|
|
961
961
|
}
|
|
962
962
|
});
|
|
963
|
-
|
|
963
|
+
Ye.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", Ye), Xe = new u({
|
|
971
971
|
user: {
|
|
972
972
|
type: u.Types.ObjectId,
|
|
973
973
|
required: !0,
|
|
@@ -979,14 +979,14 @@ const M = l?.UserStatsCasino || p("UserStatsCasino", Ge), Ye = new u({
|
|
|
979
979
|
timeCrewBeyond10PercentXp: { type: Number, default: 0 },
|
|
980
980
|
timeCrewAbove90PercentXp: { type: Number, default: 0 }
|
|
981
981
|
});
|
|
982
|
-
|
|
982
|
+
Xe.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 se = l?.UserStatsCrew || p("UserStatsCrew",
|
|
989
|
+
const se = l?.UserStatsCrew || p("UserStatsCrew", Xe), Ve = new u({
|
|
990
990
|
user: {
|
|
991
991
|
type: u.Types.ObjectId,
|
|
992
992
|
required: !0,
|
|
@@ -997,14 +997,14 @@ const se = l?.UserStatsCrew || p("UserStatsCrew", Ye), Xe = new u({
|
|
|
997
997
|
raidFinishedCount: { type: Number, default: 0 },
|
|
998
998
|
totalSpentInShop: { type: Number, default: 0 }
|
|
999
999
|
});
|
|
1000
|
-
|
|
1000
|
+
Ve.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 ie = l?.UserStatsEconomy || p("UserStatsEconomy",
|
|
1007
|
+
const ie = l?.UserStatsEconomy || p("UserStatsEconomy", Ve), Je = new u({
|
|
1008
1008
|
user: {
|
|
1009
1009
|
type: u.Types.ObjectId,
|
|
1010
1010
|
required: !0,
|
|
@@ -1016,7 +1016,7 @@ const ie = l?.UserStatsEconomy || p("UserStatsEconomy", Xe), Ve = new u({
|
|
|
1016
1016
|
randomMessageClaimed: { type: Number, default: 0 },
|
|
1017
1017
|
writeDifferentChatIds: { type: [String], default: [] }
|
|
1018
1018
|
});
|
|
1019
|
-
|
|
1019
|
+
Je.post("findOneAndUpdate", function(n) {
|
|
1020
1020
|
m(
|
|
1021
1021
|
h.USER_STATS_ENGAGEMENT,
|
|
1022
1022
|
n.user._id,
|
|
@@ -1025,8 +1025,8 @@ Ve.post("findOneAndUpdate", function(n) {
|
|
|
1025
1025
|
});
|
|
1026
1026
|
const ue = l?.UserStatsEngagement || p(
|
|
1027
1027
|
"UserStatsEngagement",
|
|
1028
|
-
|
|
1029
|
-
),
|
|
1028
|
+
Je
|
|
1029
|
+
), Ze = new u({
|
|
1030
1030
|
user: {
|
|
1031
1031
|
type: u.Types.ObjectId,
|
|
1032
1032
|
required: !0,
|
|
@@ -1045,14 +1045,14 @@ const ue = l?.UserStatsEngagement || p(
|
|
|
1045
1045
|
loseEverything: { type: Boolean, default: !1 }
|
|
1046
1046
|
}
|
|
1047
1047
|
});
|
|
1048
|
-
|
|
1048
|
+
Ze.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 ce = l?.UserStatsFlags || p("UserStatsFlags",
|
|
1055
|
+
const ce = l?.UserStatsFlags || p("UserStatsFlags", Ze), et = new u({
|
|
1056
1056
|
user: {
|
|
1057
1057
|
type: u.Types.ObjectId,
|
|
1058
1058
|
required: !0,
|
|
@@ -1064,17 +1064,17 @@ const ce = l?.UserStatsFlags || p("UserStatsFlags", Je), Ze = new u({
|
|
|
1064
1064
|
lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date() }
|
|
1065
1065
|
}
|
|
1066
1066
|
});
|
|
1067
|
-
|
|
1067
|
+
et.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
|
+
et
|
|
1077
|
+
), tt = new u({
|
|
1078
1078
|
user: {
|
|
1079
1079
|
type: u.Types.ObjectId,
|
|
1080
1080
|
required: !0,
|
|
@@ -1101,7 +1101,7 @@ const v = l?.UserStatsFrequency || p(
|
|
|
1101
1101
|
totalCrafted: { type: Number, default: 0 }
|
|
1102
1102
|
}
|
|
1103
1103
|
});
|
|
1104
|
-
|
|
1104
|
+
tt.post("findOneAndUpdate", function(n) {
|
|
1105
1105
|
m(
|
|
1106
1106
|
h.USER_STATS_INVENTORY,
|
|
1107
1107
|
n.user._id,
|
|
@@ -1110,23 +1110,23 @@ et.post("findOneAndUpdate", function(n) {
|
|
|
1110
1110
|
});
|
|
1111
1111
|
const A = l?.UserStatsInventory || p(
|
|
1112
1112
|
"UserStatsInventory",
|
|
1113
|
-
|
|
1114
|
-
),
|
|
1113
|
+
tt
|
|
1114
|
+
), Ee = 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: gt, index: 1 },
|
|
1118
1118
|
canChangeFaction: { type: Boolean, default: !1 },
|
|
1119
1119
|
canChooseFaction: { type: Boolean, default: !1 }
|
|
1120
1120
|
});
|
|
1121
|
-
|
|
1121
|
+
Ee.post("findOneAndUpdate", function(n) {
|
|
1122
1122
|
m(h.USER, n._id, n);
|
|
1123
1123
|
});
|
|
1124
|
-
|
|
1124
|
+
Ee.post("deleteOne", async function() {
|
|
1125
1125
|
const n = this.getQuery()._id;
|
|
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 O.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await B.deleteMany({ user: n }), 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 O.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await B.deleteMany({ user: n }), await re.deleteOne({ user: n }), await j.deleteOne({ user: n }), await ae.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 $ = l?.User || p("User",
|
|
1129
|
-
class
|
|
1128
|
+
const $ = l?.User || p("User", Ee);
|
|
1129
|
+
class fn extends b {
|
|
1130
1130
|
getByObjectId(e) {
|
|
1131
1131
|
return this.update({ _id: e }, {});
|
|
1132
1132
|
}
|
|
@@ -1281,7 +1281,7 @@ class yn extends b {
|
|
|
1281
1281
|
return B.aggregate([
|
|
1282
1282
|
{
|
|
1283
1283
|
$match: {
|
|
1284
|
-
status:
|
|
1284
|
+
status: T.COMPLETED
|
|
1285
1285
|
}
|
|
1286
1286
|
},
|
|
1287
1287
|
{
|
|
@@ -1352,18 +1352,18 @@ class yn extends b {
|
|
|
1352
1352
|
await this.update({ discordId: e }, { $set: { faction: t } });
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
const
|
|
1355
|
+
const mn = (n) => $.find(n), hn = (n) => $.create({
|
|
1356
1356
|
discordId: n
|
|
1357
1357
|
});
|
|
1358
|
-
async function
|
|
1358
|
+
async function wn(n) {
|
|
1359
1359
|
const e = await $.findOne({ discordId: n }).lean();
|
|
1360
|
-
return e || y(await
|
|
1360
|
+
return e || y(await hn(n));
|
|
1361
1361
|
}
|
|
1362
|
-
const
|
|
1362
|
+
const gn = (n, e) => $.findOneAndUpdate(n, e, {
|
|
1363
1363
|
upsert: !0,
|
|
1364
1364
|
returnDocument: "after"
|
|
1365
1365
|
});
|
|
1366
|
-
class
|
|
1366
|
+
class Sn extends fn {
|
|
1367
1367
|
constructor() {
|
|
1368
1368
|
super(3600);
|
|
1369
1369
|
}
|
|
@@ -1374,23 +1374,23 @@ class gn extends yn {
|
|
|
1374
1374
|
return e;
|
|
1375
1375
|
}
|
|
1376
1376
|
fetchFromDb(e) {
|
|
1377
|
-
return
|
|
1377
|
+
return wn(e);
|
|
1378
1378
|
}
|
|
1379
1379
|
fetchManyFromDb(e) {
|
|
1380
|
-
return
|
|
1380
|
+
return mn(e);
|
|
1381
1381
|
}
|
|
1382
1382
|
updateInDb(e, t) {
|
|
1383
|
-
return
|
|
1383
|
+
return gn(e, t);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
const
|
|
1386
|
+
const bn = new Sn(), Vs = [
|
|
1387
1387
|
"work",
|
|
1388
1388
|
"rps",
|
|
1389
1389
|
"blackjack",
|
|
1390
1390
|
"guess",
|
|
1391
1391
|
"qod",
|
|
1392
1392
|
"dice"
|
|
1393
|
-
],
|
|
1393
|
+
], $n = new u(
|
|
1394
1394
|
{
|
|
1395
1395
|
user: {
|
|
1396
1396
|
type: u.Types.ObjectId,
|
|
@@ -1402,53 +1402,53 @@ const Sn = new gn(), zs = [
|
|
|
1402
1402
|
type: { type: String, required: !0 }
|
|
1403
1403
|
},
|
|
1404
1404
|
{ minimize: !1 }
|
|
1405
|
-
), z = l?.Reminder || p("Reminder",
|
|
1405
|
+
), z = l?.Reminder || p("Reminder", $n), En = async (n) => {
|
|
1406
1406
|
await z.deleteMany(n);
|
|
1407
|
-
},
|
|
1407
|
+
}, In = async (n, e) => {
|
|
1408
1408
|
await z.deleteOne({ user: n, type: e });
|
|
1409
1409
|
};
|
|
1410
1410
|
class Un extends b {
|
|
1411
1411
|
getAllPassedReminder() {
|
|
1412
1412
|
return this.getMany({ date: { $lte: /* @__PURE__ */ new Date() } });
|
|
1413
1413
|
}
|
|
1414
|
-
async addReminder(e, t,
|
|
1415
|
-
await this.update({ user: e, type: t }, { $set: { date:
|
|
1414
|
+
async addReminder(e, t, r) {
|
|
1415
|
+
await this.update({ user: e, type: t }, { $set: { date: r } }, { upsert: !0 });
|
|
1416
1416
|
}
|
|
1417
|
-
async updateReminderDate(e, t,
|
|
1417
|
+
async updateReminderDate(e, t, r) {
|
|
1418
1418
|
await this.update({ user: e, type: t }, [
|
|
1419
1419
|
{
|
|
1420
1420
|
$set: {
|
|
1421
1421
|
date: {
|
|
1422
|
-
$add: ["$date",
|
|
1422
|
+
$add: ["$date", r]
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
1426
|
]);
|
|
1427
1427
|
}
|
|
1428
1428
|
async removeReminder(e, t) {
|
|
1429
|
-
await
|
|
1429
|
+
await In(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
|
|
1434
|
-
this.invalidate({ user:
|
|
1433
|
+
await En({ _id: { $in: e } }), t.forEach((r) => {
|
|
1434
|
+
this.invalidate({ user: r.user, type: r.type });
|
|
1435
1435
|
});
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function Dn(n, e = {}) {
|
|
1439
1439
|
return z.find(n, e).lean();
|
|
1440
1440
|
}
|
|
1441
1441
|
async function Tn(n) {
|
|
1442
1442
|
const e = await z.findOne(n).lean();
|
|
1443
1443
|
return e || null;
|
|
1444
1444
|
}
|
|
1445
|
-
async function
|
|
1445
|
+
async function On(n, e, t) {
|
|
1446
1446
|
return z.findOneAndUpdate(n, e, {
|
|
1447
1447
|
...t,
|
|
1448
1448
|
returnDocument: "after"
|
|
1449
1449
|
}).lean();
|
|
1450
1450
|
}
|
|
1451
|
-
class
|
|
1451
|
+
class Cn extends Un {
|
|
1452
1452
|
constructor() {
|
|
1453
1453
|
super(300);
|
|
1454
1454
|
}
|
|
@@ -1465,17 +1465,17 @@ class On extends Un {
|
|
|
1465
1465
|
return Tn(e);
|
|
1466
1466
|
}
|
|
1467
1467
|
fetchManyFromDb(e, t) {
|
|
1468
|
-
return
|
|
1468
|
+
return Dn(e, t);
|
|
1469
1469
|
}
|
|
1470
|
-
updateInDb(e, t,
|
|
1471
|
-
return
|
|
1470
|
+
updateInDb(e, t, r = { upsert: !1 }) {
|
|
1471
|
+
return On(e, t, r);
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const H = new
|
|
1475
|
-
class
|
|
1474
|
+
const H = new Cn();
|
|
1475
|
+
class Rn extends b {
|
|
1476
1476
|
async isOrnamentIds(e, t = () => !0) {
|
|
1477
|
-
const
|
|
1478
|
-
return e.every((s) =>
|
|
1477
|
+
const a = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
|
|
1478
|
+
return e.every((s) => a.includes(s));
|
|
1479
1479
|
}
|
|
1480
1480
|
isOrnament(e) {
|
|
1481
1481
|
return !!e && "ornamentId" in e;
|
|
@@ -1511,19 +1511,19 @@ class Cn 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" : `"${dt(e.ornamentId.split("_").join(" "))}"`;
|
|
1515
1515
|
}
|
|
1516
1516
|
pickOrnament(e) {
|
|
1517
1517
|
const t = Math.random();
|
|
1518
|
-
let
|
|
1518
|
+
let r = 0;
|
|
1519
1519
|
if (Object.keys(e).map((s) => parseFloat(s)).reduce((s, i) => s + i, 0) !== 1)
|
|
1520
1520
|
throw RangeError(
|
|
1521
1521
|
"pickOrnament - Sum of all odds (keys) must be equal to 1"
|
|
1522
1522
|
);
|
|
1523
1523
|
for (const [s, i] of Object.entries(e)) {
|
|
1524
1524
|
const o = parseFloat(s);
|
|
1525
|
-
if (t >=
|
|
1526
|
-
|
|
1525
|
+
if (t >= r + o) {
|
|
1526
|
+
r += o;
|
|
1527
1527
|
continue;
|
|
1528
1528
|
}
|
|
1529
1529
|
if (i.length !== 0)
|
|
@@ -1532,19 +1532,19 @@ class Cn extends b {
|
|
|
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 !== Ce.length)
|
|
1536
1536
|
throw new RangeError(
|
|
1537
1537
|
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
1538
1538
|
);
|
|
1539
1539
|
return N(
|
|
1540
|
-
t.map((
|
|
1541
|
-
const s =
|
|
1542
|
-
return Math.random() >
|
|
1540
|
+
t.map((r, a) => {
|
|
1541
|
+
const s = Ce[a], i = e[s];
|
|
1542
|
+
return Math.random() > r || !i || !i.length ? null : lt(i);
|
|
1543
1543
|
})
|
|
1544
1544
|
);
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
|
-
const
|
|
1547
|
+
const vn = 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,23 @@ const Rn = new u(
|
|
|
1558
1558
|
strength: Number
|
|
1559
1559
|
},
|
|
1560
1560
|
{ minimize: !1 }
|
|
1561
|
-
),
|
|
1562
|
-
async function
|
|
1563
|
-
const e = await
|
|
1561
|
+
), Ie = l?.Ornaments || p("Ornaments", vn), Mn = async (n, e = {}) => Ie.find(n, e).lean();
|
|
1562
|
+
async function An(n) {
|
|
1563
|
+
const e = await Ie.findOne({ ornamentId: n }).lean();
|
|
1564
1564
|
return e || null;
|
|
1565
1565
|
}
|
|
1566
|
-
const
|
|
1566
|
+
const Bn = (n, e) => Ie.findOneAndUpdate(n, e, {
|
|
1567
1567
|
returnDocument: "after"
|
|
1568
1568
|
}).lean();
|
|
1569
|
-
class
|
|
1569
|
+
class _n extends Rn {
|
|
1570
1570
|
constructor() {
|
|
1571
1571
|
super(3600);
|
|
1572
1572
|
}
|
|
1573
1573
|
updateInDb(e, t) {
|
|
1574
|
-
return
|
|
1574
|
+
return Bn(e, t);
|
|
1575
1575
|
}
|
|
1576
1576
|
fetchFromDb(e) {
|
|
1577
|
-
return
|
|
1577
|
+
return An(e);
|
|
1578
1578
|
}
|
|
1579
1579
|
fetchManyFromDb(e) {
|
|
1580
1580
|
return Mn(e);
|
|
@@ -1586,7 +1586,7 @@ class Bn extends Cn {
|
|
|
1586
1586
|
return e;
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
|
-
const g = new
|
|
1589
|
+
const g = new _n(), xn = new u(
|
|
1590
1590
|
{
|
|
1591
1591
|
panoplyId: { unique: !0, index: 1, required: !0, type: String },
|
|
1592
1592
|
name: { required: !0, type: String },
|
|
@@ -1600,43 +1600,43 @@ const g = new Bn(), _n = new u(
|
|
|
1600
1600
|
halfBonus: u.Types.Mixed
|
|
1601
1601
|
},
|
|
1602
1602
|
{ minimize: !1 }
|
|
1603
|
-
),
|
|
1604
|
-
async function
|
|
1605
|
-
const e = await
|
|
1603
|
+
), K = l?.Panoplies || p("Panoplies", xn), qn = (n) => K.find(n).lean(), kn = async (n) => K.find(n).populate("equipments");
|
|
1604
|
+
async function Nn(n) {
|
|
1605
|
+
const e = await K.findOne({ panoplyId: n }).lean();
|
|
1606
1606
|
return e || null;
|
|
1607
1607
|
}
|
|
1608
|
-
const
|
|
1609
|
-
class
|
|
1608
|
+
const Fn = async (n) => K.findOne(n).populate("equipments");
|
|
1609
|
+
class jn extends b {
|
|
1610
1610
|
getAllPopulated() {
|
|
1611
|
-
return
|
|
1611
|
+
return kn({});
|
|
1612
1612
|
}
|
|
1613
1613
|
getPopulated(e) {
|
|
1614
|
-
return
|
|
1614
|
+
return Fn({ panoplyId: e });
|
|
1615
1615
|
}
|
|
1616
1616
|
hasPanoply(e, t) {
|
|
1617
|
-
const
|
|
1618
|
-
(s) =>
|
|
1617
|
+
const r = N(Object.values(e)), a = t.equipments.filter(
|
|
1618
|
+
(s) => r.find((i) => i.entityId === s.entityId)
|
|
1619
1619
|
).length;
|
|
1620
|
-
if (
|
|
1620
|
+
if (a === t.equipments.length)
|
|
1621
1621
|
return t.fullBonus;
|
|
1622
|
-
if (
|
|
1622
|
+
if (a >= t.equipments.length / 2)
|
|
1623
1623
|
return t.halfBonus;
|
|
1624
1624
|
}
|
|
1625
1625
|
async getPanoplyBonus(e) {
|
|
1626
|
-
const t = [],
|
|
1627
|
-
for (const
|
|
1628
|
-
const s = N(Object.values(e)), i =
|
|
1626
|
+
const t = [], r = await this.getAllPopulated();
|
|
1627
|
+
for (const a of r) {
|
|
1628
|
+
const s = N(Object.values(e)), i = a.equipments.filter(
|
|
1629
1629
|
(o) => s.find(({ entityId: c }) => c === o.entityId)
|
|
1630
1630
|
);
|
|
1631
|
-
i.length ===
|
|
1631
|
+
i.length === a.equipments.length ? t.push([a, "full"]) : i.length >= a.equipments.length / 2 ? t.push([a, "half"]) : i.length >= 1 && t.push([a, null]);
|
|
1632
1632
|
}
|
|
1633
1633
|
return t;
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
|
-
const
|
|
1636
|
+
const zn = async (n, e) => K.findOneAndUpdate(n, e, {
|
|
1637
1637
|
returnDocument: "after"
|
|
1638
1638
|
}).lean();
|
|
1639
|
-
class
|
|
1639
|
+
class Kn extends jn {
|
|
1640
1640
|
constructor() {
|
|
1641
1641
|
super(3600);
|
|
1642
1642
|
}
|
|
@@ -1647,16 +1647,16 @@ class zn extends Fn {
|
|
|
1647
1647
|
return e;
|
|
1648
1648
|
}
|
|
1649
1649
|
updateInDb(e, t) {
|
|
1650
|
-
return
|
|
1650
|
+
return zn(e, t);
|
|
1651
1651
|
}
|
|
1652
1652
|
fetchFromDb(e) {
|
|
1653
|
-
return
|
|
1653
|
+
return Nn(e);
|
|
1654
1654
|
}
|
|
1655
1655
|
fetchManyFromDb(e = {}) {
|
|
1656
|
-
return
|
|
1656
|
+
return qn(e);
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
1659
|
-
const
|
|
1659
|
+
const I = new Kn();
|
|
1660
1660
|
class Pn extends b {
|
|
1661
1661
|
isEntity(e) {
|
|
1662
1662
|
return !!e && "entityId" in e;
|
|
@@ -1668,7 +1668,7 @@ class Pn extends b {
|
|
|
1668
1668
|
return e.category === "equipment";
|
|
1669
1669
|
}
|
|
1670
1670
|
async isEntityId(e, t = () => !0) {
|
|
1671
|
-
return (await this.getAll()).filter(t).map(({ entityId:
|
|
1671
|
+
return (await this.getAll()).filter(t).map(({ entityId: a }) => a).includes(e);
|
|
1672
1672
|
}
|
|
1673
1673
|
async getSomeStoreItems(e) {
|
|
1674
1674
|
const t = (await this.getAll()).filter(this.isStoreItem);
|
|
@@ -1680,7 +1680,7 @@ class Pn extends b {
|
|
|
1680
1680
|
}
|
|
1681
1681
|
async getSomeObjectItems(e) {
|
|
1682
1682
|
const t = (await this.getAll()).filter(this.isObjectItem);
|
|
1683
|
-
return Te(t.filter((
|
|
1683
|
+
return Te(t.filter((r) => !!r.shop?.price)).slice(
|
|
1684
1684
|
0,
|
|
1685
1685
|
e
|
|
1686
1686
|
);
|
|
@@ -1695,14 +1695,14 @@ class Pn extends b {
|
|
|
1695
1695
|
}
|
|
1696
1696
|
async recordToEntityTuple(e) {
|
|
1697
1697
|
const t = await this.getAll();
|
|
1698
|
-
return R(e).reduce((
|
|
1699
|
-
const i = t.find(({ entityId: o }) => o ===
|
|
1700
|
-
return i &&
|
|
1698
|
+
return R(e).reduce((r, [a, s]) => {
|
|
1699
|
+
const i = t.find(({ entityId: o }) => o === a);
|
|
1700
|
+
return i && r.push([i, s]), r;
|
|
1701
1701
|
}, []);
|
|
1702
1702
|
}
|
|
1703
1703
|
async getAllEntitiesLimit() {
|
|
1704
1704
|
const e = await this.getAll();
|
|
1705
|
-
return
|
|
1705
|
+
return Ae(
|
|
1706
1706
|
e.map((t) => [t.entityId, t.shop?.limit ?? 0])
|
|
1707
1707
|
);
|
|
1708
1708
|
}
|
|
@@ -1710,12 +1710,12 @@ class Pn extends b {
|
|
|
1710
1710
|
return (await this.getAll()).filter(e);
|
|
1711
1711
|
}
|
|
1712
1712
|
async fromDBToEquipableEquipment(e) {
|
|
1713
|
-
const
|
|
1714
|
-
({ entityId:
|
|
1713
|
+
const r = (await this.getAll()).filter(this.isEquipment).find(
|
|
1714
|
+
({ entityId: a }) => a === e.entityId
|
|
1715
1715
|
);
|
|
1716
|
-
if (!
|
|
1716
|
+
if (!r)
|
|
1717
1717
|
throw new Error(`cannot find any equipment: ${e.entityId}`);
|
|
1718
|
-
return this.seedEquipment(
|
|
1718
|
+
return this.seedEquipment(r, e.seed);
|
|
1719
1719
|
}
|
|
1720
1720
|
async getUserEquipmentsCharacteristics(e) {
|
|
1721
1721
|
let t = {
|
|
@@ -1726,17 +1726,17 @@ class Pn extends b {
|
|
|
1726
1726
|
intelligence: 0,
|
|
1727
1727
|
wisdom: 0
|
|
1728
1728
|
};
|
|
1729
|
-
const
|
|
1730
|
-
for (const
|
|
1731
|
-
const s = e[
|
|
1729
|
+
const r = await I.getAllPopulated();
|
|
1730
|
+
for (const a of _e) {
|
|
1731
|
+
const s = e[a];
|
|
1732
1732
|
s && (t = F(
|
|
1733
1733
|
t,
|
|
1734
1734
|
(await this.fromDBToEquipableEquipment(s)).characteristics,
|
|
1735
1735
|
(i, o) => i + o
|
|
1736
1736
|
));
|
|
1737
1737
|
}
|
|
1738
|
-
for (const
|
|
1739
|
-
const s =
|
|
1738
|
+
for (const a of r) {
|
|
1739
|
+
const s = I.hasPanoply(e, a);
|
|
1740
1740
|
s && !("target" in s) && (t = F(
|
|
1741
1741
|
t,
|
|
1742
1742
|
s,
|
|
@@ -1746,16 +1746,16 @@ class Pn extends b {
|
|
|
1746
1746
|
return t;
|
|
1747
1747
|
}
|
|
1748
1748
|
getSomeItems(e, t) {
|
|
1749
|
-
const
|
|
1750
|
-
for (;
|
|
1751
|
-
const
|
|
1752
|
-
|
|
1749
|
+
const r = [];
|
|
1750
|
+
for (; r.length < e; ) {
|
|
1751
|
+
const a = q(t, r, (s) => s.entityId);
|
|
1752
|
+
r.push(
|
|
1753
1753
|
g.pickOrnament(
|
|
1754
|
-
|
|
1754
|
+
pt(a, (s) => s.shop?.odd ?? 0)
|
|
1755
1755
|
)
|
|
1756
1756
|
);
|
|
1757
1757
|
}
|
|
1758
|
-
return
|
|
1758
|
+
return Oe(r, (a) => a.shop?.price ?? 0);
|
|
1759
1759
|
}
|
|
1760
1760
|
filterCraftEntities(e) {
|
|
1761
1761
|
return e.filter((t) => t.usage?.craft);
|
|
@@ -1812,10 +1812,10 @@ class Pn extends b {
|
|
|
1812
1812
|
return e.entityId === t.entityId && e.seed === t.seed;
|
|
1813
1813
|
}
|
|
1814
1814
|
getEquipmentSlotType(e) {
|
|
1815
|
-
return
|
|
1815
|
+
return St[e];
|
|
1816
1816
|
}
|
|
1817
1817
|
seedEquipment(e, t) {
|
|
1818
|
-
const
|
|
1818
|
+
const r = yt(t), a = Oe(
|
|
1819
1819
|
R(e.characteristics),
|
|
1820
1820
|
([s]) => s
|
|
1821
1821
|
);
|
|
@@ -1823,33 +1823,33 @@ class Pn extends b {
|
|
|
1823
1823
|
...e,
|
|
1824
1824
|
seed: t,
|
|
1825
1825
|
characteristics: Object.fromEntries(
|
|
1826
|
-
|
|
1826
|
+
a.map(([s, i]) => [
|
|
1827
1827
|
s,
|
|
1828
|
-
Array.isArray(i) ? Y(i[0], i[1] + 1,
|
|
1828
|
+
Array.isArray(i) ? Y(i[0], i[1] + 1, r) : i
|
|
1829
1829
|
])
|
|
1830
1830
|
)
|
|
1831
1831
|
};
|
|
1832
1832
|
}
|
|
1833
1833
|
isEquipped(e, t) {
|
|
1834
1834
|
return !!Object.values(e).find(
|
|
1835
|
-
(
|
|
1835
|
+
(r) => r && this.isSameEquipment(r, t)
|
|
1836
1836
|
);
|
|
1837
1837
|
}
|
|
1838
1838
|
calcILvl(e) {
|
|
1839
|
-
return Object.values(e.characteristics).reduce((
|
|
1839
|
+
return Object.values(e.characteristics).reduce((r, a) => r + a, 0) + e.level;
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
1842
|
-
const
|
|
1842
|
+
const Hn = new u(
|
|
1843
1843
|
{
|
|
1844
1844
|
type: {
|
|
1845
1845
|
type: String,
|
|
1846
|
-
enum:
|
|
1846
|
+
enum: bt,
|
|
1847
1847
|
required: !0
|
|
1848
1848
|
},
|
|
1849
1849
|
params: { type: u.Types.Mixed }
|
|
1850
1850
|
},
|
|
1851
1851
|
{ _id: !1 }
|
|
1852
|
-
),
|
|
1852
|
+
), Ln = new u(
|
|
1853
1853
|
{
|
|
1854
1854
|
entityId: { unique: !0, required: !0, type: String },
|
|
1855
1855
|
type: { required: !0, type: String },
|
|
@@ -1871,7 +1871,7 @@ const Kn = new u(
|
|
|
1871
1871
|
image: { required: !0, type: String },
|
|
1872
1872
|
emojis: { required: !0, type: String },
|
|
1873
1873
|
category: { required: !0, type: String },
|
|
1874
|
-
effects: { type: [
|
|
1874
|
+
effects: { type: [Hn], default: [] },
|
|
1875
1875
|
rankId: String,
|
|
1876
1876
|
usage: {
|
|
1877
1877
|
_id: !1,
|
|
@@ -1932,31 +1932,31 @@ const Kn = new u(
|
|
|
1932
1932
|
panoply: String
|
|
1933
1933
|
},
|
|
1934
1934
|
{ minimize: !1 }
|
|
1935
|
-
), oe = l?.Entities || p("Entities",
|
|
1935
|
+
), oe = l?.Entities || p("Entities", Ln), Qn = async (n) => await oe.create({
|
|
1936
1936
|
...n
|
|
1937
|
-
}),
|
|
1938
|
-
async function
|
|
1937
|
+
}), Wn = async (n, e = {}) => oe.find(n, e).lean();
|
|
1938
|
+
async function Gn(n) {
|
|
1939
1939
|
const e = await oe.findOne({ entityId: n }).lean();
|
|
1940
1940
|
return e || null;
|
|
1941
1941
|
}
|
|
1942
|
-
const
|
|
1942
|
+
const Yn = (n, e) => oe.findOneAndUpdate(n, e, {
|
|
1943
1943
|
returnDocument: "after"
|
|
1944
1944
|
}).lean();
|
|
1945
|
-
class
|
|
1945
|
+
class Xn extends Pn {
|
|
1946
1946
|
constructor() {
|
|
1947
1947
|
super(3600);
|
|
1948
1948
|
}
|
|
1949
1949
|
createInDb(e) {
|
|
1950
|
-
return
|
|
1950
|
+
return Qn(e);
|
|
1951
1951
|
}
|
|
1952
1952
|
updateInDb(e, t) {
|
|
1953
|
-
return
|
|
1953
|
+
return Yn(e, t);
|
|
1954
1954
|
}
|
|
1955
1955
|
fetchFromDb(e) {
|
|
1956
|
-
return
|
|
1956
|
+
return Gn(e);
|
|
1957
1957
|
}
|
|
1958
1958
|
fetchManyFromDb(e) {
|
|
1959
|
-
return
|
|
1959
|
+
return Wn(e);
|
|
1960
1960
|
}
|
|
1961
1961
|
normalizeKey(e) {
|
|
1962
1962
|
return e;
|
|
@@ -1965,14 +1965,14 @@ class Yn extends Pn {
|
|
|
1965
1965
|
return e.entityId;
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
|
-
const d = new
|
|
1968
|
+
const d = new Xn(), Vn = (n, e, t) => _.create({
|
|
1969
1969
|
user: n,
|
|
1970
1970
|
crew: e,
|
|
1971
1971
|
permission: t
|
|
1972
|
-
}),
|
|
1972
|
+
}), Jn = async (n) => {
|
|
1973
1973
|
await _.deleteOne({ user: n });
|
|
1974
1974
|
};
|
|
1975
|
-
class
|
|
1975
|
+
class Zn extends b {
|
|
1976
1976
|
async updatePercent(e, t) {
|
|
1977
1977
|
await this.update(e, {
|
|
1978
1978
|
$set: {
|
|
@@ -1987,22 +1987,22 @@ class Jn extends b {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
});
|
|
1989
1989
|
}
|
|
1990
|
-
async addUserToCrew(e, t,
|
|
1991
|
-
await
|
|
1990
|
+
async addUserToCrew(e, t, r) {
|
|
1991
|
+
await Vn(e, t, r), this.invalidate(t);
|
|
1992
1992
|
}
|
|
1993
1993
|
async removeUserFromCrew(e, t) {
|
|
1994
|
-
await
|
|
1994
|
+
await Jn(e), this.invalidate(e), this.invalidate(t);
|
|
1995
1995
|
}
|
|
1996
1996
|
async getAllUserIdsFromCrew(e) {
|
|
1997
|
-
const t = e.toString(),
|
|
1998
|
-
if (
|
|
1999
|
-
return
|
|
2000
|
-
const
|
|
2001
|
-
return this.cache.set(t,
|
|
1997
|
+
const t = e.toString(), r = this.cache.get(t);
|
|
1998
|
+
if (r)
|
|
1999
|
+
return r.map(({ user: s }) => s);
|
|
2000
|
+
const a = await this.getMany({ crew: e });
|
|
2001
|
+
return this.cache.set(t, a), a.map(({ user: s }) => s);
|
|
2002
2002
|
}
|
|
2003
2003
|
}
|
|
2004
|
-
const
|
|
2005
|
-
class
|
|
2004
|
+
const er = (n) => _.find(n).lean(), tr = (n) => _.findOne({ user: n }).lean(), nr = (n, e) => _.findOneAndUpdate({ user: n }, e, { returnDocument: "after" }).lean();
|
|
2005
|
+
class rr extends Zn {
|
|
2006
2006
|
constructor() {
|
|
2007
2007
|
super(300);
|
|
2008
2008
|
}
|
|
@@ -2013,17 +2013,17 @@ class na extends Jn {
|
|
|
2013
2013
|
return e;
|
|
2014
2014
|
}
|
|
2015
2015
|
fetchFromDb(e) {
|
|
2016
|
-
return
|
|
2016
|
+
return tr(e);
|
|
2017
2017
|
}
|
|
2018
2018
|
fetchManyFromDb(e) {
|
|
2019
|
-
return
|
|
2019
|
+
return er(e);
|
|
2020
2020
|
}
|
|
2021
2021
|
updateInDb(e, t) {
|
|
2022
|
-
return
|
|
2022
|
+
return nr(e, t);
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
|
-
const
|
|
2026
|
-
class
|
|
2025
|
+
const ar = new rr();
|
|
2026
|
+
class sr extends f {
|
|
2027
2027
|
hasAlreadyFoundEntity(e, t) {
|
|
2028
2028
|
return e.encyclopedia.includes(t);
|
|
2029
2029
|
}
|
|
@@ -2033,23 +2033,23 @@ class ra extends f {
|
|
|
2033
2033
|
});
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
const
|
|
2036
|
+
const ir = async (n) => await Z.create({
|
|
2037
2037
|
user: n
|
|
2038
2038
|
});
|
|
2039
|
-
async function
|
|
2039
|
+
async function ur(n) {
|
|
2040
2040
|
const e = await Z.findOne({ user: n }).lean();
|
|
2041
|
-
return e || y(await
|
|
2041
|
+
return e || y(await ir(n));
|
|
2042
2042
|
}
|
|
2043
|
-
const
|
|
2043
|
+
const cr = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
|
|
2044
2044
|
upsert: !0,
|
|
2045
2045
|
returnDocument: "after"
|
|
2046
2046
|
}).lean();
|
|
2047
|
-
class
|
|
2047
|
+
class or extends sr {
|
|
2048
2048
|
constructor() {
|
|
2049
2049
|
super(300);
|
|
2050
2050
|
}
|
|
2051
2051
|
fetchFromDb(e) {
|
|
2052
|
-
return
|
|
2052
|
+
return ur(e);
|
|
2053
2053
|
}
|
|
2054
2054
|
getKey({ user: e }) {
|
|
2055
2055
|
return e;
|
|
@@ -2058,20 +2058,20 @@ class ca extends ra {
|
|
|
2058
2058
|
return e.toString();
|
|
2059
2059
|
}
|
|
2060
2060
|
updateInDb(e, t) {
|
|
2061
|
-
return
|
|
2061
|
+
return cr(e, t);
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
const
|
|
2065
|
-
class
|
|
2064
|
+
const ye = new or();
|
|
2065
|
+
class dr extends f {
|
|
2066
2066
|
getPanoplyEffectiveBonus(e, t) {
|
|
2067
|
-
const
|
|
2067
|
+
const r = N(
|
|
2068
2068
|
Object.values(e.equippedItems)
|
|
2069
|
-
),
|
|
2070
|
-
(s) =>
|
|
2069
|
+
), a = t.equipments.filter(
|
|
2070
|
+
(s) => r.find((i) => i.entityId === s.entityId)
|
|
2071
2071
|
).length;
|
|
2072
|
-
if (
|
|
2072
|
+
if (a === t.equipments.length)
|
|
2073
2073
|
return t.fullBonus;
|
|
2074
|
-
if (
|
|
2074
|
+
if (a >= t.equipments.length / 2)
|
|
2075
2075
|
return t.halfBonus;
|
|
2076
2076
|
}
|
|
2077
2077
|
async getUserEquipmentsCharacteristics(e) {
|
|
@@ -2083,9 +2083,9 @@ class oa extends f {
|
|
|
2083
2083
|
intelligence: 0,
|
|
2084
2084
|
wisdom: 0
|
|
2085
2085
|
};
|
|
2086
|
-
const
|
|
2087
|
-
for (const
|
|
2088
|
-
const s = e.equippedItems?.[
|
|
2086
|
+
const r = await I.getAllPopulated();
|
|
2087
|
+
for (const a of _e) {
|
|
2088
|
+
const s = e.equippedItems?.[a];
|
|
2089
2089
|
if (!s)
|
|
2090
2090
|
continue;
|
|
2091
2091
|
const i = await d.fromDBToEquipableEquipment(s);
|
|
@@ -2095,8 +2095,8 @@ class oa extends f {
|
|
|
2095
2095
|
(o, c) => o + c
|
|
2096
2096
|
);
|
|
2097
2097
|
}
|
|
2098
|
-
for (const
|
|
2099
|
-
const s = this.getPanoplyEffectiveBonus(e,
|
|
2098
|
+
for (const a of r) {
|
|
2099
|
+
const s = this.getPanoplyEffectiveBonus(e, a);
|
|
2100
2100
|
s && !("target" in s) && (t = F(
|
|
2101
2101
|
t,
|
|
2102
2102
|
s,
|
|
@@ -2105,36 +2105,22 @@ class oa extends f {
|
|
|
2105
2105
|
}
|
|
2106
2106
|
return t;
|
|
2107
2107
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
for (const r of t)
|
|
2111
|
-
a = Math.min(
|
|
2112
|
-
a,
|
|
2113
|
-
Math.floor((e.itemList[r.entityId] ?? 0) / r.size)
|
|
2114
|
-
);
|
|
2115
|
-
return a;
|
|
2116
|
-
}
|
|
2117
|
-
hasEnoughItemsForRecipe(e, t, a) {
|
|
2118
|
-
for (const r of t)
|
|
2119
|
-
if ((e.itemList[r.entityId] ?? 0) < r.size * a)
|
|
2120
|
-
return !1;
|
|
2121
|
-
return !0;
|
|
2122
|
-
}
|
|
2123
|
-
hasInventoryRequirements(e, t) {
|
|
2108
|
+
async hasInventoryRequirements(e, t) {
|
|
2109
|
+
const r = await this.get(e);
|
|
2124
2110
|
return R(t).reduce(
|
|
2125
|
-
(a, [
|
|
2111
|
+
(a, [s, i]) => a && (r.itemList[s] ?? 0) >= (i ?? 0),
|
|
2126
2112
|
!0
|
|
2127
2113
|
);
|
|
2128
2114
|
}
|
|
2129
|
-
hasEnoughEntity(e, t,
|
|
2130
|
-
return (e.itemList[
|
|
2115
|
+
async hasEnoughEntity(e, t, r) {
|
|
2116
|
+
return ((await this.get(e)).itemList[r] ?? 0) >= t;
|
|
2131
2117
|
}
|
|
2132
|
-
getItemList(e) {
|
|
2133
|
-
return
|
|
2118
|
+
async getItemList(e) {
|
|
2119
|
+
return (await this.get(e)).itemList;
|
|
2134
2120
|
}
|
|
2135
2121
|
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2122
|
+
const r = await this.get(e), s = (await I.getPanoplyBonus(
|
|
2123
|
+
r.equippedItems
|
|
2138
2124
|
)).find(
|
|
2139
2125
|
([i, o]) => i.panoplyId === "herbalist" && o !== null
|
|
2140
2126
|
);
|
|
@@ -2147,58 +2133,52 @@ class oa extends f {
|
|
|
2147
2133
|
})) : t;
|
|
2148
2134
|
}
|
|
2149
2135
|
async calcMinStreakForWorkLoot(e) {
|
|
2150
|
-
const t = (await
|
|
2151
|
-
([a,
|
|
2136
|
+
const t = await this.get(e), r = (await I.getPanoplyBonus(t.equippedItems)).find(
|
|
2137
|
+
([a, s]) => a.panoplyId === "marine" && s !== null
|
|
2152
2138
|
);
|
|
2153
|
-
return
|
|
2139
|
+
return r && r[1] === "full" ? 10 : r && r[1] === "half" ? 20 : 1 / 0;
|
|
2154
2140
|
}
|
|
2155
2141
|
async hasRevolutionaryBuff(e) {
|
|
2156
2142
|
const t = await this.get(e);
|
|
2157
|
-
return (await
|
|
2158
|
-
([
|
|
2143
|
+
return (await I.getPanoplyBonus(t.equippedItems)).find(
|
|
2144
|
+
([a, s]) => a.panoplyId === "revolutionary" && s !== null
|
|
2159
2145
|
)?.[1] ?? null;
|
|
2160
2146
|
}
|
|
2161
|
-
async getRecipeResult(e, t) {
|
|
2162
|
-
const a = (await U.getPanoplyBonus(e.equippedItems)).find(
|
|
2163
|
-
([r, s]) => r.panoplyId === "little_blacksmith" && s !== null
|
|
2164
|
-
);
|
|
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;
|
|
2166
|
-
}
|
|
2167
2147
|
/*
|
|
2168
2148
|
** UPDATES
|
|
2169
2149
|
*/
|
|
2170
|
-
async addItem(e, t,
|
|
2150
|
+
async addItem(e, t, r) {
|
|
2171
2151
|
await this.update(e, {
|
|
2172
|
-
$inc: { [`itemList.${t}`]:
|
|
2173
|
-
}), await
|
|
2152
|
+
$inc: { [`itemList.${t}`]: r }
|
|
2153
|
+
}), await ye.addEntities(e, [t]);
|
|
2174
2154
|
}
|
|
2175
2155
|
async addItems(e, t) {
|
|
2176
2156
|
await this.update(e, {
|
|
2177
2157
|
$inc: Object.fromEntries(
|
|
2178
|
-
Object.entries(t).filter(([,
|
|
2158
|
+
Object.entries(t).filter(([, r]) => (r ?? 0) > 0).map(([r, a]) => [`itemList.${r}`, a])
|
|
2179
2159
|
)
|
|
2180
|
-
}), await
|
|
2160
|
+
}), await ye.addEntities(
|
|
2181
2161
|
e,
|
|
2182
|
-
R(t).filter(([,
|
|
2162
|
+
R(t).filter(([, r]) => r > 0).map(([r]) => r)
|
|
2183
2163
|
);
|
|
2184
2164
|
}
|
|
2185
|
-
async removeItem(e, t,
|
|
2186
|
-
|
|
2165
|
+
async removeItem(e, t, r) {
|
|
2166
|
+
r !== 0 && await this.update(e, [
|
|
2187
2167
|
{
|
|
2188
2168
|
$set: {
|
|
2189
2169
|
[`itemList.${t}`]: {
|
|
2190
|
-
$max: [{ $add: [`$itemList.${t}`, -
|
|
2170
|
+
$max: [{ $add: [`$itemList.${t}`, -r] }, 0]
|
|
2191
2171
|
}
|
|
2192
2172
|
}
|
|
2193
2173
|
}
|
|
2194
2174
|
]);
|
|
2195
2175
|
}
|
|
2196
|
-
async removeEquipment(e, t,
|
|
2176
|
+
async removeEquipment(e, t, r) {
|
|
2197
2177
|
await this.update(e, {
|
|
2198
2178
|
$pull: {
|
|
2199
2179
|
equipmentList: {
|
|
2200
2180
|
entityId: t,
|
|
2201
|
-
seed:
|
|
2181
|
+
seed: r
|
|
2202
2182
|
}
|
|
2203
2183
|
}
|
|
2204
2184
|
});
|
|
@@ -2209,9 +2189,9 @@ class oa extends f {
|
|
|
2209
2189
|
async addEquipments(e, t) {
|
|
2210
2190
|
await this.update(e, {
|
|
2211
2191
|
$push: { equipmentList: { $each: t } }
|
|
2212
|
-
}), await
|
|
2192
|
+
}), await ye.addEntities(
|
|
2213
2193
|
e,
|
|
2214
|
-
t.map((
|
|
2194
|
+
t.map((r) => r.entityId)
|
|
2215
2195
|
);
|
|
2216
2196
|
}
|
|
2217
2197
|
async saveEquipments(e) {
|
|
@@ -2224,64 +2204,64 @@ class oa extends f {
|
|
|
2224
2204
|
]);
|
|
2225
2205
|
}
|
|
2226
2206
|
async changeEquippedEquipment(e, t) {
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2207
|
+
const r = await this.get(e);
|
|
2208
|
+
r?.equipmentSave[t] && await this.equip(e, r.equipmentSave[t]);
|
|
2229
2209
|
}
|
|
2230
2210
|
async equip(e, t) {
|
|
2231
|
-
const
|
|
2211
|
+
const r = await U.getMaxHp(e), a = Object.fromEntries(
|
|
2232
2212
|
R(t).map(([s, i]) => [
|
|
2233
2213
|
`equippedItems.${s}`,
|
|
2234
2214
|
i
|
|
2235
2215
|
])
|
|
2236
2216
|
);
|
|
2237
2217
|
await this.update(e, {
|
|
2238
|
-
$set:
|
|
2239
|
-
}), await
|
|
2218
|
+
$set: a
|
|
2219
|
+
}), await U.updateHp(e, r);
|
|
2240
2220
|
}
|
|
2241
2221
|
async unequip(e, t) {
|
|
2242
|
-
const
|
|
2222
|
+
const r = await U.getMaxHp(e);
|
|
2243
2223
|
await this.update(e, {
|
|
2244
2224
|
$set: {
|
|
2245
2225
|
[`equippedItems.${t}`]: null
|
|
2246
2226
|
}
|
|
2247
|
-
}), await
|
|
2248
|
-
}
|
|
2249
|
-
async craftItem(e, t,
|
|
2250
|
-
for (const { entityId:
|
|
2251
|
-
await this.removeItem(e,
|
|
2252
|
-
const { entityId:
|
|
2253
|
-
await d.isEntityId(
|
|
2254
|
-
}
|
|
2255
|
-
async dismantleEntity(e, t,
|
|
2256
|
-
d.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : d.isItem(t) && await this.removeItem(e, t.entityId,
|
|
2257
|
-
for (const { entityId: i, quantity: o } of
|
|
2258
|
-
await d.isEntityId(i, d.isItem) && await this.addItem(e, i,
|
|
2227
|
+
}), await U.updateHp(e, r);
|
|
2228
|
+
}
|
|
2229
|
+
async craftItem(e, t, r, a) {
|
|
2230
|
+
for (const { entityId: o, size: c } of t.entities)
|
|
2231
|
+
await this.removeItem(e, o, c * r);
|
|
2232
|
+
const { entityId: s, size: i } = t.result;
|
|
2233
|
+
await d.isEntityId(s, d.isEquipment) ? await this.addEquipments(e, [{ entityId: s, seed: a }]) : await d.isEntityId(s, d.isItem) && await this.addItem(e, s, i * r);
|
|
2234
|
+
}
|
|
2235
|
+
async dismantleEntity(e, t, r, a, s) {
|
|
2236
|
+
d.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : d.isItem(t) && await this.removeItem(e, t.entityId, a);
|
|
2237
|
+
for (const { entityId: i, quantity: o } of r)
|
|
2238
|
+
await d.isEntityId(i, d.isItem) && await this.addItem(e, i, a * o);
|
|
2259
2239
|
await this.removeItem(e, "tools", 1);
|
|
2260
2240
|
}
|
|
2261
|
-
async enchantItem(e, t,
|
|
2262
|
-
await this.removeItem(e, t,
|
|
2241
|
+
async enchantItem(e, t, r, a) {
|
|
2242
|
+
await this.removeItem(e, t, a * 4), await this.removeItem(e, "enchanted_stone", a), await this.addItem(e, r, a);
|
|
2263
2243
|
}
|
|
2264
2244
|
async unlockRecipe(e, t) {
|
|
2265
2245
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
2266
2246
|
}
|
|
2267
2247
|
}
|
|
2268
|
-
const
|
|
2248
|
+
const lr = (n) => te.create({
|
|
2269
2249
|
user: n
|
|
2270
2250
|
});
|
|
2271
|
-
async function
|
|
2251
|
+
async function pr(n) {
|
|
2272
2252
|
const e = await te.findOne({ user: n }).lean();
|
|
2273
|
-
return e || y(await
|
|
2253
|
+
return e || y(await lr(n));
|
|
2274
2254
|
}
|
|
2275
|
-
const
|
|
2255
|
+
const yr = (n, e) => te.findOneAndUpdate({ user: n }, e, {
|
|
2276
2256
|
upsert: !0,
|
|
2277
2257
|
returnDocument: "after"
|
|
2278
2258
|
}).lean();
|
|
2279
|
-
class
|
|
2259
|
+
class fr extends dr {
|
|
2280
2260
|
constructor() {
|
|
2281
2261
|
super(300);
|
|
2282
2262
|
}
|
|
2283
2263
|
fetchFromDb(e) {
|
|
2284
|
-
return
|
|
2264
|
+
return pr(e);
|
|
2285
2265
|
}
|
|
2286
2266
|
normalizeKey(e) {
|
|
2287
2267
|
return e.toString();
|
|
@@ -2290,19 +2270,19 @@ class ya extends oa {
|
|
|
2290
2270
|
return e;
|
|
2291
2271
|
}
|
|
2292
2272
|
updateInDb(e, t) {
|
|
2293
|
-
return
|
|
2273
|
+
return yr(e, t);
|
|
2294
2274
|
}
|
|
2295
2275
|
}
|
|
2296
|
-
const
|
|
2297
|
-
class
|
|
2276
|
+
const w = new fr();
|
|
2277
|
+
class mr extends b {
|
|
2298
2278
|
getTotalCharacteristics({
|
|
2299
2279
|
characteristics: e,
|
|
2300
2280
|
scrolls: t
|
|
2301
2281
|
}) {
|
|
2302
|
-
return
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2282
|
+
return Ae(
|
|
2283
|
+
$t.map((r) => [
|
|
2284
|
+
r,
|
|
2285
|
+
Et(e[r]) + t[r]
|
|
2306
2286
|
])
|
|
2307
2287
|
);
|
|
2308
2288
|
}
|
|
@@ -2349,52 +2329,52 @@ class fa extends b {
|
|
|
2349
2329
|
});
|
|
2350
2330
|
}
|
|
2351
2331
|
async calcXpBoost(e) {
|
|
2352
|
-
const t = await this.get(e), { boost:
|
|
2332
|
+
const t = await this.get(e), { boost: r } = t.xp, a = r !== null && Date.now() < r.getTime() ? 0.2 : 0, s = Math.max(
|
|
2353
2333
|
t.premium ? 0.5 : 0,
|
|
2354
2334
|
t.booster ? 0.25 : 0
|
|
2355
2335
|
);
|
|
2356
|
-
return
|
|
2357
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2336
|
+
return a + s + t.buffs.xp.global.reduce(
|
|
2337
|
+
(i, { expireAt: o, startAt: c, multiplier: S }) => c && c > /* @__PURE__ */ new Date() || o && L(o) ? i : i + S,
|
|
2358
2338
|
0
|
|
2359
2339
|
);
|
|
2360
2340
|
}
|
|
2361
2341
|
calcMessageXp(e) {
|
|
2362
|
-
const t = e.trim().length,
|
|
2363
|
-
return t < 10 ? 10 *
|
|
2342
|
+
const t = e.trim().length, r = 2;
|
|
2343
|
+
return t < 10 ? 10 * r : t > 300 ? 300 * r : t * r;
|
|
2364
2344
|
}
|
|
2365
2345
|
async getXpDeathPenalties(e) {
|
|
2366
|
-
const t = await this.get(e),
|
|
2367
|
-
return
|
|
2346
|
+
const t = await this.get(e), r = It(t.xp.amount);
|
|
2347
|
+
return r <= 10 ? 5e3 : r <= 20 ? 1e4 : r <= 30 ? 2e4 : r <= 40 ? 3e4 : r <= 50 ? 5e4 : r <= 60 ? 75e3 : r <= 70 ? 15e4 : r <= 80 ? 25e4 : r <= 90 ? 4e5 : r <= 100 ? 75e4 : 14e6;
|
|
2368
2348
|
}
|
|
2369
|
-
async calcXp(e, t,
|
|
2370
|
-
return t *= 1 + await this.calcXpBoost(e), Math.ceil(t *
|
|
2349
|
+
async calcXp(e, t, r) {
|
|
2350
|
+
return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * r);
|
|
2371
2351
|
}
|
|
2372
|
-
async calcBerry(e, t,
|
|
2352
|
+
async calcBerry(e, t, r) {
|
|
2373
2353
|
if (t <= 0) return t;
|
|
2374
|
-
const
|
|
2375
|
-
return Math.ceil(t * (
|
|
2354
|
+
const a = r ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
|
|
2355
|
+
return Math.ceil(t * (a || 1));
|
|
2376
2356
|
}
|
|
2377
|
-
async calcBuffMultiplier(e, t,
|
|
2378
|
-
return (await this.get(e)).buffs[t][
|
|
2379
|
-
(i, { expireAt: o, startAt: c, multiplier:
|
|
2357
|
+
async calcBuffMultiplier(e, t, r) {
|
|
2358
|
+
return (await this.get(e)).buffs[t][r].reduce(
|
|
2359
|
+
(i, { expireAt: o, startAt: c, multiplier: S }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !L(o)) ? S : 0),
|
|
2380
2360
|
1
|
|
2381
2361
|
);
|
|
2382
2362
|
}
|
|
2383
2363
|
async getMaxHp(e) {
|
|
2384
|
-
const t = await this.get(e),
|
|
2385
|
-
|
|
2364
|
+
const t = await this.get(e), r = await w.get(e), { vitality: a } = this.getTotalCharacteristics(t), s = await w.getUserEquipmentsCharacteristics(
|
|
2365
|
+
r
|
|
2386
2366
|
);
|
|
2387
|
-
return (
|
|
2367
|
+
return (a + s.vitality) * Ut + Dt;
|
|
2388
2368
|
}
|
|
2389
2369
|
async getHpRatio(e) {
|
|
2390
|
-
const t = await this.get(e),
|
|
2391
|
-
return Math.min(t.hp /
|
|
2370
|
+
const t = await this.get(e), r = await this.getMaxHp(e);
|
|
2371
|
+
return Math.min(t.hp / r, 1);
|
|
2392
2372
|
}
|
|
2393
2373
|
async hasCharacteristicRequirement(e, t) {
|
|
2394
|
-
const
|
|
2395
|
-
|
|
2374
|
+
const r = await this.get(e), a = await w.get(e), s = await w.getUserEquipmentsCharacteristics(
|
|
2375
|
+
a
|
|
2396
2376
|
), i = F(
|
|
2397
|
-
this.getTotalCharacteristics(
|
|
2377
|
+
this.getTotalCharacteristics(r),
|
|
2398
2378
|
s,
|
|
2399
2379
|
(o, c) => o + c
|
|
2400
2380
|
);
|
|
@@ -2441,7 +2421,7 @@ class fa extends b {
|
|
|
2441
2421
|
]))[0];
|
|
2442
2422
|
}
|
|
2443
2423
|
async hasMalusBuff(e) {
|
|
2444
|
-
const t = await this.get(e),
|
|
2424
|
+
const t = await this.get(e), r = [
|
|
2445
2425
|
...t.buffs.xp.global,
|
|
2446
2426
|
...t.buffs.berry.global,
|
|
2447
2427
|
...t.buffs.berry.work,
|
|
@@ -2449,8 +2429,8 @@ class fa extends b {
|
|
|
2449
2429
|
...t.buffs.cooldown.casino,
|
|
2450
2430
|
...t.buffs.drop.work
|
|
2451
2431
|
];
|
|
2452
|
-
for (const { multiplier:
|
|
2453
|
-
if (
|
|
2432
|
+
for (const { multiplier: a, startAt: s, expireAt: i } of r)
|
|
2433
|
+
if (a < 0 && (!i || !L(i)) && (s ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2454
2434
|
return !0;
|
|
2455
2435
|
return !1;
|
|
2456
2436
|
}
|
|
@@ -2479,7 +2459,7 @@ class fa extends b {
|
|
|
2479
2459
|
}
|
|
2480
2460
|
async updateBoost(e, t) {
|
|
2481
2461
|
const {
|
|
2482
|
-
xp: { boost:
|
|
2462
|
+
xp: { boost: r }
|
|
2483
2463
|
} = await this.update(e, [
|
|
2484
2464
|
{
|
|
2485
2465
|
$set: {
|
|
@@ -2498,15 +2478,15 @@ class fa extends b {
|
|
|
2498
2478
|
}
|
|
2499
2479
|
}
|
|
2500
2480
|
]);
|
|
2501
|
-
return
|
|
2481
|
+
return r;
|
|
2502
2482
|
}
|
|
2503
2483
|
async updateBuff(e, t) {
|
|
2504
2484
|
if (Array.isArray(t)) {
|
|
2505
|
-
for (const
|
|
2506
|
-
await this.updateBuff(e,
|
|
2485
|
+
for (const a of t)
|
|
2486
|
+
await this.updateBuff(e, a);
|
|
2507
2487
|
return;
|
|
2508
2488
|
}
|
|
2509
|
-
const
|
|
2489
|
+
const r = Tt(t);
|
|
2510
2490
|
await this.update(e, [
|
|
2511
2491
|
{
|
|
2512
2492
|
$set: {
|
|
@@ -2531,10 +2511,10 @@ class fa extends b {
|
|
|
2531
2511
|
then: {
|
|
2532
2512
|
multiplier: t.multiplier,
|
|
2533
2513
|
origin: t.origin,
|
|
2534
|
-
expireAt:
|
|
2514
|
+
expireAt: r.expireAt ? {
|
|
2535
2515
|
$cond: {
|
|
2536
2516
|
if: { $lt: ["$$buff.expireAt", /* @__PURE__ */ new Date()] },
|
|
2537
|
-
then:
|
|
2517
|
+
then: r.expireAt,
|
|
2538
2518
|
else: {
|
|
2539
2519
|
$add: [
|
|
2540
2520
|
"$$buff.expireAt",
|
|
@@ -2587,7 +2567,7 @@ class fa extends b {
|
|
|
2587
2567
|
},
|
|
2588
2568
|
then: `$buffs.${t.target}`,
|
|
2589
2569
|
else: {
|
|
2590
|
-
$concatArrays: [`$buffs.${t.target}`, [{ ...
|
|
2570
|
+
$concatArrays: [`$buffs.${t.target}`, [{ ...r }]]
|
|
2591
2571
|
}
|
|
2592
2572
|
}
|
|
2593
2573
|
}
|
|
@@ -2600,21 +2580,21 @@ class fa extends b {
|
|
|
2600
2580
|
$pull: { [`buffs.${t.target}`]: { origin: t.origin } }
|
|
2601
2581
|
});
|
|
2602
2582
|
}
|
|
2603
|
-
async updatePanoplyBuff(e, t,
|
|
2604
|
-
const s = await d.fromDBToEquipableEquipment(t), i = N(Object.values(
|
|
2605
|
-
(
|
|
2583
|
+
async updatePanoplyBuff(e, t, r, a) {
|
|
2584
|
+
const s = await d.fromDBToEquipableEquipment(t), i = N(Object.values(r)), c = (await I.getAllPopulated()).find(
|
|
2585
|
+
(D) => D.panoplyId === s.panoply
|
|
2606
2586
|
);
|
|
2607
2587
|
if (!c)
|
|
2608
2588
|
return;
|
|
2609
|
-
const
|
|
2610
|
-
(
|
|
2611
|
-
).length, x =
|
|
2589
|
+
const S = c.equipments.filter(
|
|
2590
|
+
(D) => (i.find((P) => D.entityId === P.entityId) || !a && s.entityId === D.entityId) && (a ? s.entityId !== D.entityId : !0)
|
|
2591
|
+
).length, x = S === c.equipments.length ? c.fullBonus : S >= c.equipments.length / 2 ? c.halfBonus : void 0;
|
|
2612
2592
|
c.halfBonus && "target" in c.halfBonus && await this.removeBuff(e, c.halfBonus), c.fullBonus && "target" in c.fullBonus && await this.removeBuff(e, c.fullBonus), x && "target" in x && await this.updateBuff(e, x);
|
|
2613
2593
|
}
|
|
2614
2594
|
async gainHp(e, t) {
|
|
2615
|
-
const
|
|
2595
|
+
const r = await this.get(e), s = await this.getMaxHp(e) - r.hp;
|
|
2616
2596
|
await this.update(e, {
|
|
2617
|
-
$set: { hp:
|
|
2597
|
+
$set: { hp: r.hp + Math.floor(Math.min(t, s)) }
|
|
2618
2598
|
});
|
|
2619
2599
|
}
|
|
2620
2600
|
async loseHp(e, t) {
|
|
@@ -2625,14 +2605,14 @@ class fa extends b {
|
|
|
2625
2605
|
]);
|
|
2626
2606
|
}
|
|
2627
2607
|
async updateHp(e, t) {
|
|
2628
|
-
const
|
|
2608
|
+
const r = await this.getMaxHp(e);
|
|
2629
2609
|
await this.update(e, [
|
|
2630
2610
|
{
|
|
2631
2611
|
$set: {
|
|
2632
2612
|
hp: {
|
|
2633
2613
|
$round: [
|
|
2634
2614
|
{
|
|
2635
|
-
$multiply: [{ $divide: ["$hp", t] },
|
|
2615
|
+
$multiply: [{ $divide: ["$hp", t] }, r]
|
|
2636
2616
|
},
|
|
2637
2617
|
0
|
|
2638
2618
|
]
|
|
@@ -2642,23 +2622,23 @@ class fa extends b {
|
|
|
2642
2622
|
]);
|
|
2643
2623
|
}
|
|
2644
2624
|
async addCharacteristics(e, t) {
|
|
2645
|
-
const
|
|
2625
|
+
const r = await this.getMaxHp(e), a = Object.fromEntries(
|
|
2646
2626
|
Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`characteristics.${s}`, i])
|
|
2647
2627
|
);
|
|
2648
2628
|
await this.update(e, {
|
|
2649
|
-
$inc:
|
|
2650
|
-
}), await this.updateHp(e,
|
|
2629
|
+
$inc: a
|
|
2630
|
+
}), await this.updateHp(e, r);
|
|
2651
2631
|
}
|
|
2652
2632
|
async addScrollCharacteristic(e, t) {
|
|
2653
|
-
const
|
|
2633
|
+
const r = await this.getMaxHp(e), a = Object.fromEntries(
|
|
2654
2634
|
Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`scrolls.${s}`, i])
|
|
2655
2635
|
);
|
|
2656
2636
|
await this.update(e, {
|
|
2657
|
-
$inc:
|
|
2658
|
-
}), await this.updateHp(e,
|
|
2637
|
+
$inc: a
|
|
2638
|
+
}), await this.updateHp(e, r);
|
|
2659
2639
|
}
|
|
2660
2640
|
async resetCharacteristics(e, t) {
|
|
2661
|
-
const
|
|
2641
|
+
const r = await this.getMaxHp(e), a = {
|
|
2662
2642
|
vitality: 0,
|
|
2663
2643
|
strength: 0,
|
|
2664
2644
|
agility: 0,
|
|
@@ -2668,12 +2648,12 @@ class fa extends b {
|
|
|
2668
2648
|
};
|
|
2669
2649
|
t ? await this.update(e, {
|
|
2670
2650
|
$set: {
|
|
2671
|
-
characteristics:
|
|
2651
|
+
characteristics: a,
|
|
2672
2652
|
"resetCharacteristics.free": !1
|
|
2673
2653
|
}
|
|
2674
2654
|
}) : await this.update(e, {
|
|
2675
2655
|
$set: {
|
|
2676
|
-
characteristics:
|
|
2656
|
+
characteristics: a,
|
|
2677
2657
|
"resetCharacteristics.nextAvailable": new Date(
|
|
2678
2658
|
Date.now() + 720 * 60 * 60 * 1e3
|
|
2679
2659
|
)
|
|
@@ -2681,7 +2661,7 @@ class fa extends b {
|
|
|
2681
2661
|
$inc: {
|
|
2682
2662
|
berry: -1e8
|
|
2683
2663
|
}
|
|
2684
|
-
}), await this.updateHp(e,
|
|
2664
|
+
}), await this.updateHp(e, r);
|
|
2685
2665
|
}
|
|
2686
2666
|
async resetMinutesInVoiceToday(e) {
|
|
2687
2667
|
await this.update(e, { $set: { "xp.voice.minutesInVoiceToday": 0 } });
|
|
@@ -2712,34 +2692,34 @@ class fa extends b {
|
|
|
2712
2692
|
});
|
|
2713
2693
|
}
|
|
2714
2694
|
async updateUserXp(e, t) {
|
|
2715
|
-
const
|
|
2695
|
+
const r = await ar.get(e), a = r?.percent ?? 0, s = await this.calcXp(
|
|
2716
2696
|
e,
|
|
2717
2697
|
t,
|
|
2718
|
-
(1 -
|
|
2698
|
+
(1 - a) * await this.getHpRatio(e)
|
|
2719
2699
|
);
|
|
2720
2700
|
let i = 0;
|
|
2721
|
-
return await this.addXp(e, s),
|
|
2722
|
-
|
|
2723
|
-
t *
|
|
2724
|
-
), await
|
|
2701
|
+
return await this.addXp(e, s), r && (i = await Re.calcXp(
|
|
2702
|
+
r.crew,
|
|
2703
|
+
t * a
|
|
2704
|
+
), await Re.addXp(r.crew, i)), { userXp: s, crewXp: i };
|
|
2725
2705
|
}
|
|
2726
|
-
async updateUserBerry(e, t,
|
|
2727
|
-
const
|
|
2728
|
-
return await this.addBerry(e,
|
|
2706
|
+
async updateUserBerry(e, t, r) {
|
|
2707
|
+
const a = await this.calcBerry(e, t, r);
|
|
2708
|
+
return await this.addBerry(e, a), a;
|
|
2729
2709
|
}
|
|
2730
2710
|
}
|
|
2731
|
-
const
|
|
2711
|
+
const hr = (n) => O.find(n).lean(), wr = async (n) => await O.create({
|
|
2732
2712
|
user: n
|
|
2733
2713
|
});
|
|
2734
|
-
async function
|
|
2714
|
+
async function gr(n) {
|
|
2735
2715
|
const e = await O.findOne({ user: n }).lean();
|
|
2736
|
-
return e || y(await
|
|
2716
|
+
return e || y(await wr(n));
|
|
2737
2717
|
}
|
|
2738
|
-
const
|
|
2718
|
+
const Sr = (n, e) => O.findOneAndUpdate({ user: n }, e, {
|
|
2739
2719
|
returnDocument: "after",
|
|
2740
2720
|
upsert: !0
|
|
2741
2721
|
}).lean();
|
|
2742
|
-
class
|
|
2722
|
+
class br extends mr {
|
|
2743
2723
|
constructor() {
|
|
2744
2724
|
super(300);
|
|
2745
2725
|
}
|
|
@@ -2750,17 +2730,17 @@ class Sa extends fa {
|
|
|
2750
2730
|
return e;
|
|
2751
2731
|
}
|
|
2752
2732
|
fetchFromDb(e) {
|
|
2753
|
-
return
|
|
2733
|
+
return gr(e);
|
|
2754
2734
|
}
|
|
2755
2735
|
fetchManyFromDb(e) {
|
|
2756
|
-
return
|
|
2736
|
+
return hr(e);
|
|
2757
2737
|
}
|
|
2758
2738
|
updateInDb(e, t) {
|
|
2759
|
-
return
|
|
2739
|
+
return Sr(e, t);
|
|
2760
2740
|
}
|
|
2761
2741
|
}
|
|
2762
|
-
const
|
|
2763
|
-
class
|
|
2742
|
+
const U = new br();
|
|
2743
|
+
class $r extends b {
|
|
2764
2744
|
async updateSendDailyQuest(e, t) {
|
|
2765
2745
|
await this.update(e, { $set: { sendDailyQuest: t } });
|
|
2766
2746
|
}
|
|
@@ -2770,8 +2750,8 @@ class ba extends b {
|
|
|
2770
2750
|
async updateInventorySort(e, t) {
|
|
2771
2751
|
await this.update(e, { $set: { "sort.inventory": t } });
|
|
2772
2752
|
}
|
|
2773
|
-
async updateReminderSettings(e, t,
|
|
2774
|
-
await this.update(e, { $set: { [`reminder.${t}`]:
|
|
2753
|
+
async updateReminderSettings(e, t, r) {
|
|
2754
|
+
await this.update(e, { $set: { [`reminder.${t}`]: r } });
|
|
2775
2755
|
}
|
|
2776
2756
|
getUsersWithDailyReportEnable() {
|
|
2777
2757
|
return this.getMany({
|
|
@@ -2779,18 +2759,18 @@ class ba extends b {
|
|
|
2779
2759
|
});
|
|
2780
2760
|
}
|
|
2781
2761
|
}
|
|
2782
|
-
const
|
|
2762
|
+
const Er = (n) => j.find(n).lean(), Ir = async (n) => await j.create({
|
|
2783
2763
|
user: n
|
|
2784
2764
|
});
|
|
2785
|
-
async function
|
|
2765
|
+
async function Ur(n) {
|
|
2786
2766
|
const e = await j.findOne({ user: n }).lean();
|
|
2787
|
-
return e || y(await
|
|
2767
|
+
return e || y(await Ir(n));
|
|
2788
2768
|
}
|
|
2789
|
-
const
|
|
2769
|
+
const Dr = (n, e) => j.findOneAndUpdate({ user: n }, e, {
|
|
2790
2770
|
returnDocument: "after",
|
|
2791
2771
|
upsert: !0
|
|
2792
2772
|
}).lean();
|
|
2793
|
-
class
|
|
2773
|
+
class Tr extends $r {
|
|
2794
2774
|
constructor() {
|
|
2795
2775
|
super(3600);
|
|
2796
2776
|
}
|
|
@@ -2801,17 +2781,17 @@ class Ta extends ba {
|
|
|
2801
2781
|
return e.user;
|
|
2802
2782
|
}
|
|
2803
2783
|
fetchFromDb(e) {
|
|
2804
|
-
return
|
|
2784
|
+
return Ur(e);
|
|
2805
2785
|
}
|
|
2806
2786
|
fetchManyFromDb(e) {
|
|
2807
|
-
return
|
|
2787
|
+
return Er(e);
|
|
2808
2788
|
}
|
|
2809
2789
|
updateInDb(e, t) {
|
|
2810
|
-
return
|
|
2790
|
+
return Dr(e, t);
|
|
2811
2791
|
}
|
|
2812
2792
|
}
|
|
2813
|
-
const
|
|
2814
|
-
class
|
|
2793
|
+
const ve = new Tr();
|
|
2794
|
+
class Or extends f {
|
|
2815
2795
|
async getCommandCooldown(e, t) {
|
|
2816
2796
|
return (await this.get(e)).commands[t];
|
|
2817
2797
|
}
|
|
@@ -2846,14 +2826,14 @@ class Da extends f {
|
|
|
2846
2826
|
-1 * t * 3600 * 1e3
|
|
2847
2827
|
);
|
|
2848
2828
|
}
|
|
2849
|
-
async startRaidCooldown(e, t,
|
|
2850
|
-
const { reminder:
|
|
2829
|
+
async startRaidCooldown(e, t, r) {
|
|
2830
|
+
const { reminder: a } = await ve.get(e);
|
|
2851
2831
|
await this.update(e, {
|
|
2852
|
-
$set: { [`raid.${t}`]: new Date(Date.now() +
|
|
2853
|
-
}),
|
|
2832
|
+
$set: { [`raid.${t}`]: new Date(Date.now() + r) }
|
|
2833
|
+
}), a.raid[t] && await H.addReminder(
|
|
2854
2834
|
e,
|
|
2855
2835
|
`raid/${t}`,
|
|
2856
|
-
new Date(Date.now() +
|
|
2836
|
+
new Date(Date.now() + r)
|
|
2857
2837
|
);
|
|
2858
2838
|
}
|
|
2859
2839
|
async lockUserCommand(e) {
|
|
@@ -2861,33 +2841,33 @@ class Da extends f {
|
|
|
2861
2841
|
$set: {
|
|
2862
2842
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
2863
2843
|
}
|
|
2864
|
-
}), await
|
|
2844
|
+
}), await U.gainHp(e, 1);
|
|
2865
2845
|
}
|
|
2866
|
-
async useCommand(e, t,
|
|
2867
|
-
const { reminder:
|
|
2846
|
+
async useCommand(e, t, r) {
|
|
2847
|
+
const { reminder: a } = await ve.get(e);
|
|
2868
2848
|
await this.update(e, {
|
|
2869
2849
|
$set: {
|
|
2870
|
-
[`commands.${t}`]: new Date(Date.now() +
|
|
2850
|
+
[`commands.${t}`]: new Date(Date.now() + r)
|
|
2871
2851
|
}
|
|
2872
|
-
}),
|
|
2852
|
+
}), a.commands[t] && await H.addReminder(
|
|
2873
2853
|
e,
|
|
2874
2854
|
`commands/${t}`,
|
|
2875
|
-
new Date(Date.now() +
|
|
2855
|
+
new Date(Date.now() + r)
|
|
2876
2856
|
);
|
|
2877
2857
|
}
|
|
2878
2858
|
}
|
|
2879
|
-
const
|
|
2859
|
+
const Cr = async (n) => await V.create({
|
|
2880
2860
|
user: n
|
|
2881
2861
|
});
|
|
2882
|
-
async function
|
|
2862
|
+
async function Rr(n) {
|
|
2883
2863
|
const e = await V.findOne({ user: n }).lean();
|
|
2884
|
-
return e || y(await
|
|
2864
|
+
return e || y(await Cr(n));
|
|
2885
2865
|
}
|
|
2886
|
-
const
|
|
2866
|
+
const vr = (n, e) => V.findOneAndUpdate({ user: n }, e, {
|
|
2887
2867
|
returnDocument: "after",
|
|
2888
2868
|
upsert: !0
|
|
2889
2869
|
}).lean();
|
|
2890
|
-
class
|
|
2870
|
+
class Mr extends Or {
|
|
2891
2871
|
constructor() {
|
|
2892
2872
|
super(300);
|
|
2893
2873
|
}
|
|
@@ -2898,14 +2878,14 @@ class Ma extends Da {
|
|
|
2898
2878
|
return e.user;
|
|
2899
2879
|
}
|
|
2900
2880
|
fetchFromDb(e) {
|
|
2901
|
-
return
|
|
2881
|
+
return Rr(e);
|
|
2902
2882
|
}
|
|
2903
2883
|
updateInDb(e, t) {
|
|
2904
|
-
return
|
|
2884
|
+
return vr(e, t);
|
|
2905
2885
|
}
|
|
2906
2886
|
}
|
|
2907
|
-
const
|
|
2908
|
-
class
|
|
2887
|
+
const Ar = new Mr();
|
|
2888
|
+
class Br extends f {
|
|
2909
2889
|
async unlockTitle(e, t) {
|
|
2910
2890
|
await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2911
2891
|
}
|
|
@@ -2938,9 +2918,9 @@ class Aa extends f {
|
|
|
2938
2918
|
$set: { selectedBackground: t }
|
|
2939
2919
|
});
|
|
2940
2920
|
}
|
|
2941
|
-
async unlockBadge(e, t,
|
|
2921
|
+
async unlockBadge(e, t, r) {
|
|
2942
2922
|
t.isProgressive ? await this.update(e, {
|
|
2943
|
-
$addToSet: { unlockedBadges: `${t.id}_${
|
|
2923
|
+
$addToSet: { unlockedBadges: `${t.id}_${r}` }
|
|
2944
2924
|
}) : await this.update(e, {
|
|
2945
2925
|
$addToSet: { unlockedBadges: t.id }
|
|
2946
2926
|
});
|
|
@@ -2974,18 +2954,18 @@ class Aa extends f {
|
|
|
2974
2954
|
});
|
|
2975
2955
|
}
|
|
2976
2956
|
}
|
|
2977
|
-
const
|
|
2957
|
+
const _r = async (n) => await ne.create({
|
|
2978
2958
|
user: n
|
|
2979
2959
|
});
|
|
2980
|
-
async function
|
|
2960
|
+
async function xr(n) {
|
|
2981
2961
|
const e = await ne.findOne({ user: n }).lean();
|
|
2982
|
-
return e || y(await
|
|
2962
|
+
return e || y(await _r(n));
|
|
2983
2963
|
}
|
|
2984
|
-
const
|
|
2964
|
+
const qr = async (n, e) => ne.findOneAndUpdate({ user: n }, e, {
|
|
2985
2965
|
upsert: !0,
|
|
2986
2966
|
returnDocument: "after"
|
|
2987
2967
|
}).lean();
|
|
2988
|
-
class
|
|
2968
|
+
class kr extends Br {
|
|
2989
2969
|
constructor() {
|
|
2990
2970
|
super(300);
|
|
2991
2971
|
}
|
|
@@ -2996,14 +2976,14 @@ class qa extends Aa {
|
|
|
2996
2976
|
return e;
|
|
2997
2977
|
}
|
|
2998
2978
|
fetchFromDb(e) {
|
|
2999
|
-
return
|
|
2979
|
+
return xr(e);
|
|
3000
2980
|
}
|
|
3001
2981
|
updateInDb(e, t) {
|
|
3002
|
-
return
|
|
2982
|
+
return qr(e, t);
|
|
3003
2983
|
}
|
|
3004
2984
|
}
|
|
3005
|
-
const G = new
|
|
3006
|
-
class
|
|
2985
|
+
const G = new kr();
|
|
2986
|
+
class Nr extends b {
|
|
3007
2987
|
async getStatus(e, t) {
|
|
3008
2988
|
return (await this.get({ user: e, questId: t })).status;
|
|
3009
2989
|
}
|
|
@@ -3011,18 +2991,18 @@ class ka extends b {
|
|
|
3011
2991
|
return await this.getStatus(e, t) === "COMPLETED";
|
|
3012
2992
|
}
|
|
3013
2993
|
async isStreaking(e, t) {
|
|
3014
|
-
const { lastCompletionDate:
|
|
3015
|
-
return !!
|
|
2994
|
+
const { lastCompletionDate: r } = await this.get({ user: e, questId: t });
|
|
2995
|
+
return !!r && fe(k(), r);
|
|
3016
2996
|
}
|
|
3017
2997
|
async getStreakMultiplier(e, t) {
|
|
3018
|
-
const
|
|
3019
|
-
return await this.isStreaking(e, t) ? 1 + Math.min(2, (
|
|
2998
|
+
const r = await this.get({ user: e, questId: t });
|
|
2999
|
+
return await this.isStreaking(e, t) ? 1 + Math.min(2, (r.streak ?? 0) / 10) : 1;
|
|
3020
3000
|
}
|
|
3021
3001
|
async completeQuest(e, t = !1) {
|
|
3022
|
-
const
|
|
3023
|
-
|
|
3024
|
-
const
|
|
3025
|
-
return
|
|
3002
|
+
const r = k();
|
|
3003
|
+
r.setHours(0, 0, 0, 0);
|
|
3004
|
+
const a = /* @__PURE__ */ new Date();
|
|
3005
|
+
return a.setHours(0, 0, 0, 0), this.update(
|
|
3026
3006
|
e,
|
|
3027
3007
|
[
|
|
3028
3008
|
{
|
|
@@ -3032,8 +3012,8 @@ class ka extends b {
|
|
|
3032
3012
|
$cond: {
|
|
3033
3013
|
if: {
|
|
3034
3014
|
$and: [
|
|
3035
|
-
{ $gte: ["$lastCompletionDate",
|
|
3036
|
-
{ $lt: ["$lastCompletionDate",
|
|
3015
|
+
{ $gte: ["$lastCompletionDate", r] },
|
|
3016
|
+
{ $lt: ["$lastCompletionDate", a] }
|
|
3037
3017
|
]
|
|
3038
3018
|
},
|
|
3039
3019
|
then: { $add: [{ $ifNull: ["$streak", 0] }, 1] },
|
|
@@ -3042,7 +3022,7 @@ class ka extends b {
|
|
|
3042
3022
|
}
|
|
3043
3023
|
} : {},
|
|
3044
3024
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
3045
|
-
status:
|
|
3025
|
+
status: T.COMPLETED
|
|
3046
3026
|
}
|
|
3047
3027
|
}
|
|
3048
3028
|
],
|
|
@@ -3050,24 +3030,24 @@ class ka extends b {
|
|
|
3050
3030
|
);
|
|
3051
3031
|
}
|
|
3052
3032
|
}
|
|
3053
|
-
function
|
|
3033
|
+
function Fr(n) {
|
|
3054
3034
|
return B.find(n).lean();
|
|
3055
3035
|
}
|
|
3056
|
-
const
|
|
3036
|
+
const jr = async (n) => await B.create({
|
|
3057
3037
|
...n
|
|
3058
3038
|
});
|
|
3059
|
-
async function
|
|
3039
|
+
async function zr(n) {
|
|
3060
3040
|
const e = await B.findOne(n).lean();
|
|
3061
|
-
return e || y(await
|
|
3041
|
+
return e || y(await jr(n));
|
|
3062
3042
|
}
|
|
3063
|
-
function
|
|
3043
|
+
function Kr(n, e, t) {
|
|
3064
3044
|
return B.findOneAndUpdate(n, e, {
|
|
3065
3045
|
upsert: !0,
|
|
3066
3046
|
...t,
|
|
3067
3047
|
returnDocument: "after"
|
|
3068
3048
|
}).lean();
|
|
3069
3049
|
}
|
|
3070
|
-
class
|
|
3050
|
+
class Pr extends Nr {
|
|
3071
3051
|
constructor() {
|
|
3072
3052
|
super(3600);
|
|
3073
3053
|
}
|
|
@@ -3081,32 +3061,32 @@ class Pa extends ka {
|
|
|
3081
3061
|
return { user: e, questId: t };
|
|
3082
3062
|
}
|
|
3083
3063
|
fetchFromDb(e) {
|
|
3084
|
-
return
|
|
3064
|
+
return zr(e);
|
|
3085
3065
|
}
|
|
3086
3066
|
fetchManyFromDb(e) {
|
|
3087
|
-
return
|
|
3067
|
+
return Fr(e);
|
|
3088
3068
|
}
|
|
3089
|
-
updateInDb(e, t,
|
|
3090
|
-
return
|
|
3069
|
+
updateInDb(e, t, r) {
|
|
3070
|
+
return Kr(e, t, r);
|
|
3091
3071
|
}
|
|
3092
3072
|
}
|
|
3093
|
-
const Me = new
|
|
3094
|
-
class
|
|
3073
|
+
const Me = new Pr();
|
|
3074
|
+
class Hr extends f {
|
|
3095
3075
|
async updateDailyReport(e) {
|
|
3096
|
-
const t = await
|
|
3076
|
+
const t = await U.get(e), r = await G.get(e), a = await Me.getMany({
|
|
3097
3077
|
user: e,
|
|
3098
|
-
status:
|
|
3078
|
+
status: T.COMPLETED
|
|
3099
3079
|
});
|
|
3100
3080
|
await this.update(e, {
|
|
3101
3081
|
$set: {
|
|
3102
3082
|
xpYesterday: t.xp.amount,
|
|
3103
3083
|
berryYesterday: t.berry,
|
|
3104
|
-
previousCompletedQuest:
|
|
3084
|
+
previousCompletedQuest: a.map(
|
|
3105
3085
|
({ questId: s }) => s
|
|
3106
3086
|
),
|
|
3107
|
-
"previousOrnament.unlockedBadges":
|
|
3108
|
-
"previousOrnament.unlockedTitles":
|
|
3109
|
-
"previousOrnament.unlockedBackgrounds":
|
|
3087
|
+
"previousOrnament.unlockedBadges": r.unlockedBadges,
|
|
3088
|
+
"previousOrnament.unlockedTitles": r.unlockedTitles,
|
|
3089
|
+
"previousOrnament.unlockedBackgrounds": r.unlockedBackgrounds
|
|
3110
3090
|
// TODO
|
|
3111
3091
|
// previousMessageSent: user.questMeta.messageSent,
|
|
3112
3092
|
}
|
|
@@ -3114,61 +3094,61 @@ class Ka extends f {
|
|
|
3114
3094
|
}
|
|
3115
3095
|
async getDailyReport(e) {
|
|
3116
3096
|
const t = await this.get(e), {
|
|
3117
|
-
previousOrnament:
|
|
3118
|
-
previousCompletedQuest:
|
|
3097
|
+
previousOrnament: r,
|
|
3098
|
+
previousCompletedQuest: a,
|
|
3119
3099
|
xpYesterday: s,
|
|
3120
3100
|
berryYesterday: i
|
|
3121
3101
|
} = t;
|
|
3122
3102
|
if (s <= 0)
|
|
3123
3103
|
return;
|
|
3124
|
-
const o = await
|
|
3104
|
+
const o = await U.get(e), c = await Me.getMany({
|
|
3125
3105
|
user: e,
|
|
3126
|
-
status:
|
|
3127
|
-
}),
|
|
3106
|
+
status: T.COMPLETED
|
|
3107
|
+
}), S = await G.get(e), { berry: x, xp: D } = o, { voice: P, amount: rt } = D, { unlockedBadges: at, unlockedBackgrounds: st, unlockedTitles: it } = S;
|
|
3128
3108
|
return {
|
|
3129
3109
|
berry: x - i,
|
|
3130
|
-
xp:
|
|
3110
|
+
xp: rt - s,
|
|
3131
3111
|
// TODO
|
|
3132
3112
|
// message: user.questMeta.messageSent - previousMessageSent,
|
|
3133
|
-
voice:
|
|
3113
|
+
voice: fe(P.lastConnection, k()) ? P.minutesInVoiceToday : 0,
|
|
3134
3114
|
quest: q(
|
|
3135
|
-
c.map(({ questId:
|
|
3136
|
-
|
|
3115
|
+
c.map(({ questId: ut }) => ut),
|
|
3116
|
+
a
|
|
3137
3117
|
),
|
|
3138
|
-
badge: q(at,
|
|
3139
|
-
title: q(
|
|
3118
|
+
badge: q(at, r.unlockedBadges),
|
|
3119
|
+
title: q(it, r.unlockedTitles),
|
|
3140
3120
|
background: q(
|
|
3141
|
-
|
|
3142
|
-
|
|
3121
|
+
st,
|
|
3122
|
+
r.unlockedBackgrounds
|
|
3143
3123
|
)
|
|
3144
3124
|
};
|
|
3145
3125
|
}
|
|
3146
3126
|
async getAllDailyReportsToSend() {
|
|
3147
|
-
const e = await
|
|
3127
|
+
const e = await bn.getMany({
|
|
3148
3128
|
"settings.sendDailyReport": !0,
|
|
3149
3129
|
faction: { $ne: "citizen" }
|
|
3150
3130
|
});
|
|
3151
3131
|
return await Promise.all(
|
|
3152
|
-
e.map(async ({ _id: t, discordId:
|
|
3132
|
+
e.map(async ({ _id: t, discordId: r }) => ({
|
|
3153
3133
|
...await this.getDailyReport(t),
|
|
3154
3134
|
user: t,
|
|
3155
|
-
discordId:
|
|
3135
|
+
discordId: r
|
|
3156
3136
|
}))
|
|
3157
3137
|
);
|
|
3158
3138
|
}
|
|
3159
3139
|
}
|
|
3160
|
-
const
|
|
3140
|
+
const Lr = (n) => J.create({
|
|
3161
3141
|
user: n
|
|
3162
3142
|
});
|
|
3163
|
-
async function
|
|
3143
|
+
async function Qr(n) {
|
|
3164
3144
|
const e = await J.findOne({ user: n }).lean();
|
|
3165
|
-
return e || y(await
|
|
3145
|
+
return e || y(await Lr(n));
|
|
3166
3146
|
}
|
|
3167
|
-
const
|
|
3147
|
+
const Wr = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
3168
3148
|
upsert: !0,
|
|
3169
3149
|
returnDocument: "after"
|
|
3170
3150
|
}).lean();
|
|
3171
|
-
class
|
|
3151
|
+
class Gr extends Hr {
|
|
3172
3152
|
constructor() {
|
|
3173
3153
|
super(60);
|
|
3174
3154
|
}
|
|
@@ -3179,21 +3159,21 @@ class Wa extends Ka {
|
|
|
3179
3159
|
return e.user;
|
|
3180
3160
|
}
|
|
3181
3161
|
fetchFromDb(e) {
|
|
3182
|
-
return
|
|
3162
|
+
return Qr(e);
|
|
3183
3163
|
}
|
|
3184
3164
|
updateInDb(e, t) {
|
|
3185
|
-
return
|
|
3165
|
+
return Wr(e, t);
|
|
3186
3166
|
}
|
|
3187
3167
|
}
|
|
3188
|
-
const
|
|
3189
|
-
class
|
|
3190
|
-
async setGuessGame(e, t,
|
|
3168
|
+
const Js = new Gr();
|
|
3169
|
+
class Yr extends f {
|
|
3170
|
+
async setGuessGame(e, t, r, a) {
|
|
3191
3171
|
await this.update(e, {
|
|
3192
3172
|
$set: {
|
|
3193
3173
|
guess: {
|
|
3194
3174
|
amount: t,
|
|
3195
|
-
tries:
|
|
3196
|
-
numberToGuess:
|
|
3175
|
+
tries: r,
|
|
3176
|
+
numberToGuess: a,
|
|
3197
3177
|
lastGuess: 0
|
|
3198
3178
|
}
|
|
3199
3179
|
}
|
|
@@ -3217,18 +3197,18 @@ class Ga extends f {
|
|
|
3217
3197
|
});
|
|
3218
3198
|
}
|
|
3219
3199
|
}
|
|
3220
|
-
const
|
|
3200
|
+
const Xr = async (n) => await ee.create({
|
|
3221
3201
|
user: n
|
|
3222
3202
|
});
|
|
3223
|
-
async function
|
|
3203
|
+
async function Vr(n) {
|
|
3224
3204
|
const e = await ee.findOne({ user: n }).lean();
|
|
3225
|
-
return e || y(await
|
|
3205
|
+
return e || y(await Xr(n));
|
|
3226
3206
|
}
|
|
3227
|
-
const
|
|
3207
|
+
const Jr = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
|
|
3228
3208
|
upsert: !0,
|
|
3229
3209
|
returnDocument: "after"
|
|
3230
3210
|
}).lean();
|
|
3231
|
-
class
|
|
3211
|
+
class Zr extends Yr {
|
|
3232
3212
|
constructor() {
|
|
3233
3213
|
super(300);
|
|
3234
3214
|
}
|
|
@@ -3239,48 +3219,48 @@ class Ja extends Ga {
|
|
|
3239
3219
|
return e;
|
|
3240
3220
|
}
|
|
3241
3221
|
fetchFromDb(e) {
|
|
3242
|
-
return
|
|
3222
|
+
return Vr(e);
|
|
3243
3223
|
}
|
|
3244
3224
|
updateInDb(e, t) {
|
|
3245
|
-
return
|
|
3225
|
+
return Jr(e, t);
|
|
3246
3226
|
}
|
|
3247
3227
|
}
|
|
3248
|
-
const
|
|
3249
|
-
class
|
|
3228
|
+
const Zs = new Zr();
|
|
3229
|
+
class ea extends f {
|
|
3250
3230
|
async hasUnlockedRaid(e, t) {
|
|
3251
3231
|
return (await this.get(e)).unlocked?.[t];
|
|
3252
3232
|
}
|
|
3253
|
-
async alreadyObtainedRaidReward(e, t,
|
|
3254
|
-
const
|
|
3255
|
-
return t in
|
|
3233
|
+
async alreadyObtainedRaidReward(e, t, r) {
|
|
3234
|
+
const a = await this.get(e);
|
|
3235
|
+
return t in a.obtainedRewards ? a.obtainedRewards[t].includes(r) : !1;
|
|
3256
3236
|
}
|
|
3257
3237
|
async getObtainedRaidReward(e, t) {
|
|
3258
3238
|
return (await this.get(e)).obtainedRewards[t] ?? [];
|
|
3259
3239
|
}
|
|
3260
|
-
async fulfillCondition(e, t,
|
|
3240
|
+
async fulfillCondition(e, t, r, a) {
|
|
3261
3241
|
const s = await this.get(e);
|
|
3262
|
-
return
|
|
3242
|
+
return a === "include" ? r.every(
|
|
3263
3243
|
(i) => (s.obtainedConditions[t] ?? []).includes(i)
|
|
3264
|
-
) :
|
|
3244
|
+
) : r.every(
|
|
3265
3245
|
(i) => !(s.obtainedConditions[t] ?? []).includes(i)
|
|
3266
3246
|
);
|
|
3267
3247
|
}
|
|
3268
3248
|
async unlockRaid(e, t) {
|
|
3269
3249
|
await this.update(e, { $set: { [`unlocked.${t}`]: !0 } });
|
|
3270
3250
|
}
|
|
3271
|
-
async startRaid(e, t,
|
|
3251
|
+
async startRaid(e, t, r, a, s) {
|
|
3272
3252
|
const i = Date.now();
|
|
3273
3253
|
return await this.update(e, {
|
|
3274
3254
|
$set: {
|
|
3275
3255
|
currentRaid: {
|
|
3276
3256
|
raidId: t,
|
|
3277
|
-
buffItem:
|
|
3257
|
+
buffItem: r,
|
|
3278
3258
|
seed: i,
|
|
3279
3259
|
progression: [],
|
|
3280
3260
|
rewards: {}
|
|
3281
3261
|
}
|
|
3282
3262
|
}
|
|
3283
|
-
}), await
|
|
3263
|
+
}), await Ar.startRaidCooldown(e, a, s), i;
|
|
3284
3264
|
}
|
|
3285
3265
|
async resetRaid(e) {
|
|
3286
3266
|
await this.update(e, {
|
|
@@ -3303,39 +3283,39 @@ class Za extends f {
|
|
|
3303
3283
|
}
|
|
3304
3284
|
});
|
|
3305
3285
|
}
|
|
3306
|
-
async claimReward(e, t,
|
|
3286
|
+
async claimReward(e, t, r) {
|
|
3307
3287
|
await this.update(e, {
|
|
3308
3288
|
$addToSet: {
|
|
3309
|
-
[`obtainedRewards.${t}`]:
|
|
3289
|
+
[`obtainedRewards.${t}`]: r
|
|
3310
3290
|
}
|
|
3311
3291
|
});
|
|
3312
3292
|
}
|
|
3313
3293
|
async addRewardsToRaid(e, t) {
|
|
3314
3294
|
await this.update(e, {
|
|
3315
3295
|
$inc: Object.fromEntries(
|
|
3316
|
-
R(t).filter(([
|
|
3296
|
+
R(t).filter(([r]) => r !== "title" && r !== "condition").map(([r, a]) => [`currentRaid.rewards.${r}`, a])
|
|
3317
3297
|
),
|
|
3318
3298
|
...t.title ? { $set: { "currentRaid.rewards.title": t.title } } : {}
|
|
3319
3299
|
});
|
|
3320
3300
|
}
|
|
3321
|
-
async updateCondition(e, t,
|
|
3301
|
+
async updateCondition(e, t, r) {
|
|
3322
3302
|
await this.update(e, {
|
|
3323
3303
|
$addToSet: {
|
|
3324
|
-
[`obtainedConditions.${t}`]:
|
|
3304
|
+
[`obtainedConditions.${t}`]: r
|
|
3325
3305
|
}
|
|
3326
3306
|
});
|
|
3327
3307
|
}
|
|
3328
3308
|
}
|
|
3329
|
-
const
|
|
3309
|
+
const ta = (n) => re.create({
|
|
3330
3310
|
user: n
|
|
3331
|
-
}),
|
|
3332
|
-
const e = await
|
|
3333
|
-
return e || y(await
|
|
3334
|
-
},
|
|
3311
|
+
}), na = async (n) => {
|
|
3312
|
+
const e = await re.findOne({ user: n }).lean();
|
|
3313
|
+
return e || y(await ta(n));
|
|
3314
|
+
}, ra = (n, e) => re.findOneAndUpdate({ user: n }, e, {
|
|
3335
3315
|
upsert: !0,
|
|
3336
3316
|
returnDocument: "after"
|
|
3337
3317
|
});
|
|
3338
|
-
class
|
|
3318
|
+
class aa extends ea {
|
|
3339
3319
|
constructor() {
|
|
3340
3320
|
super(3600);
|
|
3341
3321
|
}
|
|
@@ -3346,32 +3326,32 @@ class ar extends Za {
|
|
|
3346
3326
|
return e;
|
|
3347
3327
|
}
|
|
3348
3328
|
fetchFromDb(e) {
|
|
3349
|
-
return
|
|
3329
|
+
return na(e);
|
|
3350
3330
|
}
|
|
3351
3331
|
updateInDb(e, t) {
|
|
3352
|
-
return
|
|
3332
|
+
return ra(e, t);
|
|
3353
3333
|
}
|
|
3354
3334
|
}
|
|
3355
|
-
const
|
|
3356
|
-
class
|
|
3357
|
-
async isBuyLimitReached(e, t,
|
|
3358
|
-
const
|
|
3335
|
+
const ei = new aa();
|
|
3336
|
+
class sa extends f {
|
|
3337
|
+
async isBuyLimitReached(e, t, r) {
|
|
3338
|
+
const a = await d.getAllEntitiesLimit();
|
|
3359
3339
|
if (await d.isEntityId(t, d.isEquipment))
|
|
3360
3340
|
return !1;
|
|
3361
3341
|
const s = await this.get(e), i = s.limit?.[t];
|
|
3362
|
-
let o =
|
|
3363
|
-
const c = await
|
|
3364
|
-
return s.lastShopId !==
|
|
3342
|
+
let o = a[t];
|
|
3343
|
+
const c = await w.hasRevolutionaryBuff(e);
|
|
3344
|
+
return s.lastShopId !== r ? !1 : (c === "half" && t === "chest_2" && (o += 2), c === "full" && t === "chest_3" && (o += 1), !!(o && i && i >= o));
|
|
3365
3345
|
}
|
|
3366
|
-
async getShopItemRest(e, t,
|
|
3346
|
+
async getShopItemRest(e, t, r, a = Ot) {
|
|
3367
3347
|
const s = await d.getAllEntitiesLimit();
|
|
3368
3348
|
if (await d.isEntityId(t, d.isEquipment))
|
|
3369
|
-
return
|
|
3349
|
+
return a;
|
|
3370
3350
|
let i = s[t];
|
|
3371
|
-
const o = await this.get(e), c = o.limit?.[t],
|
|
3372
|
-
return
|
|
3351
|
+
const o = await this.get(e), c = o.limit?.[t], S = await w.hasRevolutionaryBuff(e);
|
|
3352
|
+
return S === "half" && t === "chest_2" && (i += 2), S === "full" && t === "chest_3" && (i += 1), i ? o.lastShopId !== r ? i : c ? i - c : Math.min(i, a) : a;
|
|
3373
3353
|
}
|
|
3374
|
-
async increaseBuyLimit(e, t,
|
|
3354
|
+
async increaseBuyLimit(e, t, r, a) {
|
|
3375
3355
|
await this.update(e, [
|
|
3376
3356
|
{
|
|
3377
3357
|
$set: {
|
|
@@ -3380,15 +3360,15 @@ class rr extends f {
|
|
|
3380
3360
|
if: { $eq: ["$lastShopId", t] },
|
|
3381
3361
|
then: {
|
|
3382
3362
|
$setField: {
|
|
3383
|
-
field:
|
|
3363
|
+
field: r,
|
|
3384
3364
|
input: { $ifNull: ["$limit", {}] },
|
|
3385
3365
|
value: {
|
|
3386
|
-
$add: [{ $ifNull: [`$limit.${
|
|
3366
|
+
$add: [{ $ifNull: [`$limit.${r}`, 0] }, a]
|
|
3387
3367
|
}
|
|
3388
3368
|
}
|
|
3389
3369
|
},
|
|
3390
3370
|
else: {
|
|
3391
|
-
[
|
|
3371
|
+
[r]: a
|
|
3392
3372
|
}
|
|
3393
3373
|
}
|
|
3394
3374
|
},
|
|
@@ -3398,16 +3378,16 @@ class rr extends f {
|
|
|
3398
3378
|
]);
|
|
3399
3379
|
}
|
|
3400
3380
|
}
|
|
3401
|
-
const
|
|
3381
|
+
const ia = async (n) => await ae.create({
|
|
3402
3382
|
user: n
|
|
3403
|
-
}),
|
|
3404
|
-
const e = await
|
|
3405
|
-
return e || y(await
|
|
3406
|
-
},
|
|
3383
|
+
}), ua = async (n) => {
|
|
3384
|
+
const e = await ae.findOne({ user: n }).lean();
|
|
3385
|
+
return e || y(await ia(n));
|
|
3386
|
+
}, ca = (n, e) => ae.findOneAndUpdate({ user: n }, e, {
|
|
3407
3387
|
upsert: !0,
|
|
3408
3388
|
returnDocument: "after"
|
|
3409
3389
|
}).lean();
|
|
3410
|
-
class
|
|
3390
|
+
class oa extends sa {
|
|
3411
3391
|
constructor() {
|
|
3412
3392
|
super(300);
|
|
3413
3393
|
}
|
|
@@ -3418,14 +3398,14 @@ class cr extends rr {
|
|
|
3418
3398
|
return e;
|
|
3419
3399
|
}
|
|
3420
3400
|
fetchFromDb(e) {
|
|
3421
|
-
return
|
|
3401
|
+
return ua(e);
|
|
3422
3402
|
}
|
|
3423
3403
|
updateInDb(e, t) {
|
|
3424
|
-
return
|
|
3404
|
+
return ca(e, t);
|
|
3425
3405
|
}
|
|
3426
3406
|
}
|
|
3427
|
-
const
|
|
3428
|
-
class
|
|
3407
|
+
const ti = new oa();
|
|
3408
|
+
class da extends f {
|
|
3429
3409
|
async didSevenDoubleAtDoQ(e) {
|
|
3430
3410
|
await this.update(e, {
|
|
3431
3411
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -3434,11 +3414,11 @@ class or extends f {
|
|
|
3434
3414
|
async winWithBlackjack(e) {
|
|
3435
3415
|
await this.update(e, { $inc: { "blackJack.blackJackCount": 1 } });
|
|
3436
3416
|
}
|
|
3437
|
-
async updateLastGames(e, t,
|
|
3417
|
+
async updateLastGames(e, t, r) {
|
|
3438
3418
|
await this.update(e, {
|
|
3439
3419
|
$push: {
|
|
3440
3420
|
lastGames: {
|
|
3441
|
-
$each: [{ gameType: t, endState:
|
|
3421
|
+
$each: [{ gameType: t, endState: r }],
|
|
3442
3422
|
$position: 0,
|
|
3443
3423
|
$slice: 20
|
|
3444
3424
|
}
|
|
@@ -3451,17 +3431,17 @@ class or extends f {
|
|
|
3451
3431
|
async bet666(e) {
|
|
3452
3432
|
const t = k();
|
|
3453
3433
|
t.setHours(0, 0, 0, 0);
|
|
3454
|
-
const
|
|
3455
|
-
|
|
3434
|
+
const r = /* @__PURE__ */ new Date();
|
|
3435
|
+
r.setHours(0, 0, 0, 0), await v.updateOne(
|
|
3456
3436
|
{
|
|
3457
3437
|
user: e,
|
|
3458
3438
|
"bet666.last": {
|
|
3459
3439
|
$gte: t,
|
|
3460
|
-
$lt:
|
|
3440
|
+
$lt: r
|
|
3461
3441
|
}
|
|
3462
3442
|
},
|
|
3463
3443
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
3464
|
-
), await
|
|
3444
|
+
), await v.updateOne(
|
|
3465
3445
|
{
|
|
3466
3446
|
user: e,
|
|
3467
3447
|
"bet666.last": {
|
|
@@ -3504,18 +3484,18 @@ class or extends f {
|
|
|
3504
3484
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
3505
3485
|
}
|
|
3506
3486
|
}
|
|
3507
|
-
const
|
|
3487
|
+
const la = async (n) => await v.create({
|
|
3508
3488
|
user: n
|
|
3509
3489
|
});
|
|
3510
|
-
async function
|
|
3511
|
-
const e = await
|
|
3512
|
-
return e || y(await
|
|
3490
|
+
async function pa(n) {
|
|
3491
|
+
const e = await v.findOne({ user: n }).lean();
|
|
3492
|
+
return e || y(await la(n));
|
|
3513
3493
|
}
|
|
3514
|
-
const
|
|
3494
|
+
const ya = (n, e) => v.findOneAndUpdate({ user: n }, e, {
|
|
3515
3495
|
upsert: !0,
|
|
3516
3496
|
returnDocument: "after"
|
|
3517
3497
|
}).lean();
|
|
3518
|
-
class
|
|
3498
|
+
class fa extends da {
|
|
3519
3499
|
constructor() {
|
|
3520
3500
|
super(300);
|
|
3521
3501
|
}
|
|
@@ -3526,14 +3506,14 @@ class yr extends or {
|
|
|
3526
3506
|
return e;
|
|
3527
3507
|
}
|
|
3528
3508
|
fetchFromDb(e) {
|
|
3529
|
-
return
|
|
3509
|
+
return pa(e);
|
|
3530
3510
|
}
|
|
3531
3511
|
updateInDb(e, t) {
|
|
3532
|
-
return
|
|
3512
|
+
return ya(e, t);
|
|
3533
3513
|
}
|
|
3534
3514
|
}
|
|
3535
|
-
const
|
|
3536
|
-
class
|
|
3515
|
+
const ni = new fa();
|
|
3516
|
+
class ma extends f {
|
|
3537
3517
|
async increaseXpGiven(e, t) {
|
|
3538
3518
|
await this.update(e, {
|
|
3539
3519
|
$inc: {
|
|
@@ -3555,18 +3535,18 @@ class fr extends f {
|
|
|
3555
3535
|
t ? await this.update(e, { $set: { timeCrewAbove90PercentXp: 0 } }) : await this.update(e, { $inc: { timeCrewAbove90PercentXp: 1 } });
|
|
3556
3536
|
}
|
|
3557
3537
|
}
|
|
3558
|
-
const
|
|
3538
|
+
const ha = async (n) => await se.create({
|
|
3559
3539
|
user: n
|
|
3560
3540
|
});
|
|
3561
|
-
async function
|
|
3541
|
+
async function wa(n) {
|
|
3562
3542
|
const e = await se.findOne({ user: n }).lean();
|
|
3563
|
-
return e || y(await
|
|
3543
|
+
return e || y(await ha(n));
|
|
3564
3544
|
}
|
|
3565
|
-
const
|
|
3545
|
+
const ga = (n, e) => se.findOneAndUpdate({ user: n }, e, {
|
|
3566
3546
|
upsert: !0,
|
|
3567
3547
|
returnDocument: "after"
|
|
3568
3548
|
}).lean();
|
|
3569
|
-
class
|
|
3549
|
+
class Sa extends ma {
|
|
3570
3550
|
constructor() {
|
|
3571
3551
|
super(300);
|
|
3572
3552
|
}
|
|
@@ -3577,14 +3557,14 @@ class gr extends fr {
|
|
|
3577
3557
|
return e;
|
|
3578
3558
|
}
|
|
3579
3559
|
fetchFromDb(e) {
|
|
3580
|
-
return
|
|
3560
|
+
return wa(e);
|
|
3581
3561
|
}
|
|
3582
3562
|
updateInDb(e, t) {
|
|
3583
|
-
return
|
|
3563
|
+
return ga(e, t);
|
|
3584
3564
|
}
|
|
3585
3565
|
}
|
|
3586
|
-
const
|
|
3587
|
-
class
|
|
3566
|
+
const ri = new Sa();
|
|
3567
|
+
class ba extends f {
|
|
3588
3568
|
async workIncrement(e) {
|
|
3589
3569
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
3590
3570
|
}
|
|
@@ -3596,18 +3576,18 @@ class Sr extends f {
|
|
|
3596
3576
|
});
|
|
3597
3577
|
}
|
|
3598
3578
|
}
|
|
3599
|
-
const
|
|
3579
|
+
const $a = (n) => ie.create({
|
|
3600
3580
|
user: n
|
|
3601
3581
|
});
|
|
3602
|
-
async function
|
|
3582
|
+
async function Ea(n) {
|
|
3603
3583
|
const e = await ie.findOne({ user: n }).lean();
|
|
3604
|
-
return e || y(await
|
|
3584
|
+
return e || y(await $a(n));
|
|
3605
3585
|
}
|
|
3606
|
-
const
|
|
3586
|
+
const Ia = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
|
|
3607
3587
|
upsert: !0,
|
|
3608
3588
|
returnDocument: "after"
|
|
3609
3589
|
}).lean();
|
|
3610
|
-
class
|
|
3590
|
+
class Ua extends ba {
|
|
3611
3591
|
constructor() {
|
|
3612
3592
|
super(300);
|
|
3613
3593
|
}
|
|
@@ -3618,14 +3598,14 @@ class Ur extends Sr {
|
|
|
3618
3598
|
return e;
|
|
3619
3599
|
}
|
|
3620
3600
|
fetchFromDb(e) {
|
|
3621
|
-
return
|
|
3601
|
+
return Ea(e);
|
|
3622
3602
|
}
|
|
3623
3603
|
updateInDb(e, t) {
|
|
3624
|
-
return
|
|
3604
|
+
return Ia(e, t);
|
|
3625
3605
|
}
|
|
3626
3606
|
}
|
|
3627
|
-
const
|
|
3628
|
-
class
|
|
3607
|
+
const Da = new Ua();
|
|
3608
|
+
class Ta extends f {
|
|
3629
3609
|
async randomMessageIncrement(e) {
|
|
3630
3610
|
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
3631
3611
|
}
|
|
@@ -3643,18 +3623,18 @@ class Tr extends f {
|
|
|
3643
3623
|
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
3644
3624
|
}
|
|
3645
3625
|
}
|
|
3646
|
-
const
|
|
3626
|
+
const Oa = async (n) => await ue.create({
|
|
3647
3627
|
user: n
|
|
3648
3628
|
});
|
|
3649
|
-
async function
|
|
3629
|
+
async function Ca(n) {
|
|
3650
3630
|
const e = await ue.findOne({ user: n }).lean();
|
|
3651
|
-
return e || y(await
|
|
3631
|
+
return e || y(await Oa(n));
|
|
3652
3632
|
}
|
|
3653
|
-
const
|
|
3633
|
+
const Ra = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
|
|
3654
3634
|
upsert: !0,
|
|
3655
3635
|
returnDocument: "after"
|
|
3656
3636
|
}).lean();
|
|
3657
|
-
class
|
|
3637
|
+
class va extends Ta {
|
|
3658
3638
|
constructor() {
|
|
3659
3639
|
super(300);
|
|
3660
3640
|
}
|
|
@@ -3667,14 +3647,14 @@ class Rr extends Tr {
|
|
|
3667
3647
|
return e;
|
|
3668
3648
|
}
|
|
3669
3649
|
fetchFromDb(e) {
|
|
3670
|
-
return
|
|
3650
|
+
return Ca(e);
|
|
3671
3651
|
}
|
|
3672
3652
|
updateInDb(e, t) {
|
|
3673
|
-
return
|
|
3653
|
+
return Ra(e, t);
|
|
3674
3654
|
}
|
|
3675
3655
|
}
|
|
3676
|
-
const
|
|
3677
|
-
class
|
|
3656
|
+
const ai = new va();
|
|
3657
|
+
class Ma extends f {
|
|
3678
3658
|
async hasReportedSomeone(e) {
|
|
3679
3659
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
3680
3660
|
}
|
|
@@ -3705,18 +3685,18 @@ class Mr extends f {
|
|
|
3705
3685
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
3706
3686
|
}
|
|
3707
3687
|
}
|
|
3708
|
-
const
|
|
3688
|
+
const Aa = async (n) => await ce.create({
|
|
3709
3689
|
user: n
|
|
3710
3690
|
});
|
|
3711
|
-
async function
|
|
3691
|
+
async function Ba(n) {
|
|
3712
3692
|
const e = await ce.findOne({ user: n }).lean();
|
|
3713
|
-
return e || y(await
|
|
3693
|
+
return e || y(await Aa(n));
|
|
3714
3694
|
}
|
|
3715
|
-
const
|
|
3695
|
+
const _a = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
|
|
3716
3696
|
upsert: !0,
|
|
3717
3697
|
returnDocument: "after"
|
|
3718
3698
|
}).lean();
|
|
3719
|
-
class
|
|
3699
|
+
class xa extends Ma {
|
|
3720
3700
|
constructor() {
|
|
3721
3701
|
super(300);
|
|
3722
3702
|
}
|
|
@@ -3727,17 +3707,17 @@ class _r extends Mr {
|
|
|
3727
3707
|
return e;
|
|
3728
3708
|
}
|
|
3729
3709
|
fetchFromDb(e) {
|
|
3730
|
-
return
|
|
3710
|
+
return Ba(e);
|
|
3731
3711
|
}
|
|
3732
3712
|
updateInDb(e, t) {
|
|
3733
|
-
return
|
|
3713
|
+
return _a(e, t);
|
|
3734
3714
|
}
|
|
3735
3715
|
}
|
|
3736
|
-
const
|
|
3737
|
-
class
|
|
3716
|
+
const si = new xa();
|
|
3717
|
+
class qa extends f {
|
|
3738
3718
|
async readEdito(e) {
|
|
3739
3719
|
const t = /* @__PURE__ */ new Date();
|
|
3740
|
-
t.setHours(0, 0, 0, 0), await
|
|
3720
|
+
t.setHours(0, 0, 0, 0), await M.updateOne(
|
|
3741
3721
|
{
|
|
3742
3722
|
user: e,
|
|
3743
3723
|
"edito.lastTimeRead": {
|
|
@@ -3748,7 +3728,7 @@ class xr extends f {
|
|
|
3748
3728
|
$inc: { "edito.readToday": 1 },
|
|
3749
3729
|
$set: { "edito.lastTimeRead": /* @__PURE__ */ new Date() }
|
|
3750
3730
|
}
|
|
3751
|
-
), await
|
|
3731
|
+
), await M.updateOne(
|
|
3752
3732
|
{
|
|
3753
3733
|
user: e,
|
|
3754
3734
|
"edito.lastTimeRead": {
|
|
@@ -3761,18 +3741,18 @@ class xr extends f {
|
|
|
3761
3741
|
), this.invalidate(e);
|
|
3762
3742
|
}
|
|
3763
3743
|
}
|
|
3764
|
-
const
|
|
3744
|
+
const ka = async (n) => await M.create({
|
|
3765
3745
|
user: n
|
|
3766
3746
|
});
|
|
3767
|
-
async function
|
|
3768
|
-
const e = await
|
|
3769
|
-
return e || y(await
|
|
3747
|
+
async function Na(n) {
|
|
3748
|
+
const e = await M.findOne({ user: n }).lean();
|
|
3749
|
+
return e || y(await ka(n));
|
|
3770
3750
|
}
|
|
3771
|
-
const
|
|
3751
|
+
const Fa = (n, e) => M.findOneAndUpdate({ user: n }, e, {
|
|
3772
3752
|
upsert: !0,
|
|
3773
3753
|
returnDocument: "after"
|
|
3774
3754
|
}).lean();
|
|
3775
|
-
class
|
|
3755
|
+
class ja extends qa {
|
|
3776
3756
|
constructor() {
|
|
3777
3757
|
super(300);
|
|
3778
3758
|
}
|
|
@@ -3783,41 +3763,41 @@ class Fr extends xr {
|
|
|
3783
3763
|
return e;
|
|
3784
3764
|
}
|
|
3785
3765
|
fetchFromDb(e) {
|
|
3786
|
-
return
|
|
3766
|
+
return Na(e);
|
|
3787
3767
|
}
|
|
3788
3768
|
updateInDb(e, t) {
|
|
3789
|
-
return
|
|
3769
|
+
return Fa(e, t);
|
|
3790
3770
|
}
|
|
3791
3771
|
}
|
|
3792
|
-
const
|
|
3793
|
-
class
|
|
3794
|
-
async updateCraftStats(e, t,
|
|
3795
|
-
const
|
|
3796
|
-
!
|
|
3772
|
+
const ii = new ja();
|
|
3773
|
+
class za extends f {
|
|
3774
|
+
async updateCraftStats(e, t, r) {
|
|
3775
|
+
const a = await d.get(r);
|
|
3776
|
+
!a || !d.isItem(a) || await this.update(e, {
|
|
3797
3777
|
$inc: {
|
|
3798
|
-
"crafts.cookedMeal": d.isCookedMeal(
|
|
3799
|
-
"crafts.scrolls": d.isScrollItem(
|
|
3778
|
+
"crafts.cookedMeal": d.isCookedMeal(a) ? t : 0,
|
|
3779
|
+
"crafts.scrolls": d.isScrollItem(a) ? t : 0,
|
|
3800
3780
|
"crafts.totalCrafted": t
|
|
3801
3781
|
}
|
|
3802
3782
|
});
|
|
3803
3783
|
}
|
|
3804
|
-
async incrementAlcoholDrink(e, t,
|
|
3784
|
+
async incrementAlcoholDrink(e, t, r) {
|
|
3805
3785
|
["wine", "beer", "rhum"].includes(t) && await this.update(e, {
|
|
3806
3786
|
$inc: {
|
|
3807
|
-
"alcohols.wines": t === "wine" ?
|
|
3808
|
-
"alcohols.beers": t === "beer" ?
|
|
3809
|
-
"alcohols.rhums": t === "rhum" ?
|
|
3810
|
-
"alcohols.totalConsumed":
|
|
3787
|
+
"alcohols.wines": t === "wine" ? r : 0,
|
|
3788
|
+
"alcohols.beers": t === "beer" ? r : 0,
|
|
3789
|
+
"alcohols.rhums": t === "rhum" ? r : 0,
|
|
3790
|
+
"alcohols.totalConsumed": r
|
|
3811
3791
|
}
|
|
3812
3792
|
});
|
|
3813
3793
|
}
|
|
3814
3794
|
async incrementBottleUsedToday(e, t) {
|
|
3815
|
-
const
|
|
3816
|
-
|
|
3795
|
+
const r = /* @__PURE__ */ new Date();
|
|
3796
|
+
r.setHours(0, 0, 0, 0), await A.updateOne(
|
|
3817
3797
|
{
|
|
3818
3798
|
user: e,
|
|
3819
3799
|
"bottle.lastUsed": {
|
|
3820
|
-
$gte:
|
|
3800
|
+
$gte: r
|
|
3821
3801
|
}
|
|
3822
3802
|
},
|
|
3823
3803
|
{
|
|
@@ -3828,7 +3808,7 @@ class jr extends f {
|
|
|
3828
3808
|
{
|
|
3829
3809
|
user: e,
|
|
3830
3810
|
"bottle.lastUsed": {
|
|
3831
|
-
$lt:
|
|
3811
|
+
$lt: r
|
|
3832
3812
|
}
|
|
3833
3813
|
},
|
|
3834
3814
|
{
|
|
@@ -3850,18 +3830,18 @@ class jr extends f {
|
|
|
3850
3830
|
});
|
|
3851
3831
|
}
|
|
3852
3832
|
}
|
|
3853
|
-
const
|
|
3833
|
+
const Ka = async (n) => await A.create({
|
|
3854
3834
|
user: n
|
|
3855
3835
|
});
|
|
3856
|
-
async function
|
|
3836
|
+
async function Pa(n) {
|
|
3857
3837
|
const e = await A.findOne({ user: n }).lean();
|
|
3858
|
-
return e || y(await
|
|
3838
|
+
return e || y(await Ka(n));
|
|
3859
3839
|
}
|
|
3860
|
-
const
|
|
3840
|
+
const Ha = (n, e) => A.findOneAndUpdate({ user: n }, e, {
|
|
3861
3841
|
upsert: !0,
|
|
3862
3842
|
returnDocument: "after"
|
|
3863
3843
|
}).lean();
|
|
3864
|
-
class
|
|
3844
|
+
class La extends za {
|
|
3865
3845
|
constructor() {
|
|
3866
3846
|
super(300);
|
|
3867
3847
|
}
|
|
@@ -3872,41 +3852,134 @@ class Hr extends jr {
|
|
|
3872
3852
|
return e;
|
|
3873
3853
|
}
|
|
3874
3854
|
fetchFromDb(e) {
|
|
3875
|
-
return
|
|
3855
|
+
return Pa(e);
|
|
3856
|
+
}
|
|
3857
|
+
updateInDb(e, t) {
|
|
3858
|
+
return Ha(e, t);
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
const ui = new La();
|
|
3862
|
+
class Qa extends b {
|
|
3863
|
+
async maxCraftQuantity(e, t) {
|
|
3864
|
+
const r = await w.get(e);
|
|
3865
|
+
let a = 1 / 0;
|
|
3866
|
+
for (const s of t)
|
|
3867
|
+
a = Math.min(
|
|
3868
|
+
a,
|
|
3869
|
+
Math.floor(
|
|
3870
|
+
(r.itemList[s.entityId] ?? 0) / s.size
|
|
3871
|
+
)
|
|
3872
|
+
);
|
|
3873
|
+
return a;
|
|
3874
|
+
}
|
|
3875
|
+
async hasEnoughItemsForRecipe(e, t, r) {
|
|
3876
|
+
const a = await w.get(e);
|
|
3877
|
+
for (const s of t.entities)
|
|
3878
|
+
if ((a.itemList[s.entityId] ?? 0) < s.size * r)
|
|
3879
|
+
return !1;
|
|
3880
|
+
return !0;
|
|
3881
|
+
}
|
|
3882
|
+
decodeCraftId(e) {
|
|
3883
|
+
return e.split(";").map((t, r) => ({
|
|
3884
|
+
entityId: t === "null" ? null : t,
|
|
3885
|
+
index: r
|
|
3886
|
+
}));
|
|
3887
|
+
}
|
|
3888
|
+
encodeCraftId(e) {
|
|
3889
|
+
return e.map(({ entityId: t }) => `${t}`).join(";");
|
|
3890
|
+
}
|
|
3891
|
+
async isValidRecipe(e) {
|
|
3892
|
+
return !!(await this.getAll()).find((r) => r.craftId === e);
|
|
3893
|
+
}
|
|
3894
|
+
async getRecipeResult(e, t) {
|
|
3895
|
+
const r = await w.get(e), a = (await I.getPanoplyBonus(r.equippedItems)).find(
|
|
3896
|
+
([s, i]) => s.panoplyId === "little_blacksmith" && i !== null
|
|
3897
|
+
);
|
|
3898
|
+
return a?.[1] === "full" && t === "chest_3" ? "chest_blacksmith_3" : a?.[1] === "half" && t === "chest_2" ? "chest_blacksmith_2" : a?.[1] === "half" && t === "chest_1" ? "chest_blacksmith_1" : t;
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
const Wa = new u(
|
|
3902
|
+
{
|
|
3903
|
+
entityId: { type: String, required: !0 },
|
|
3904
|
+
size: { type: Number, required: !0 }
|
|
3905
|
+
},
|
|
3906
|
+
{ _id: !1 }
|
|
3907
|
+
), Ga = new u(
|
|
3908
|
+
{
|
|
3909
|
+
entityId: { type: String, required: !0 },
|
|
3910
|
+
size: { type: Number, required: !0 }
|
|
3911
|
+
},
|
|
3912
|
+
{ _id: !1 }
|
|
3913
|
+
), Ya = new u(
|
|
3914
|
+
{
|
|
3915
|
+
craftId: { type: String, unique: !0, required: !0 },
|
|
3916
|
+
name: { type: String, required: !0 },
|
|
3917
|
+
entities: { type: [Wa], required: !0 },
|
|
3918
|
+
result: { type: Ga, required: !0 }
|
|
3919
|
+
},
|
|
3920
|
+
{ minimize: !1 }
|
|
3921
|
+
), de = l?.Recipes || p("Recipes", Ya), Xa = async (n) => await de.create({
|
|
3922
|
+
...n
|
|
3923
|
+
}), Va = async (n, e = {}) => de.find(n, e).lean();
|
|
3924
|
+
async function Ja(n) {
|
|
3925
|
+
const e = await de.findOne({ craftId: n }).lean();
|
|
3926
|
+
return e || null;
|
|
3927
|
+
}
|
|
3928
|
+
const Za = (n, e) => de.findOneAndUpdate(n, e, {
|
|
3929
|
+
returnDocument: "after"
|
|
3930
|
+
}).lean();
|
|
3931
|
+
class es extends Qa {
|
|
3932
|
+
constructor() {
|
|
3933
|
+
super(3600);
|
|
3934
|
+
}
|
|
3935
|
+
createInDb(e) {
|
|
3936
|
+
return Xa(e);
|
|
3876
3937
|
}
|
|
3877
3938
|
updateInDb(e, t) {
|
|
3878
|
-
return
|
|
3939
|
+
return Za(e, t);
|
|
3940
|
+
}
|
|
3941
|
+
fetchFromDb(e) {
|
|
3942
|
+
return Ja(e);
|
|
3943
|
+
}
|
|
3944
|
+
fetchManyFromDb(e) {
|
|
3945
|
+
return Va(e);
|
|
3946
|
+
}
|
|
3947
|
+
normalizeKey(e) {
|
|
3948
|
+
return e;
|
|
3949
|
+
}
|
|
3950
|
+
getKey(e) {
|
|
3951
|
+
return e.craftId;
|
|
3879
3952
|
}
|
|
3880
3953
|
}
|
|
3881
|
-
const
|
|
3954
|
+
const ci = new es(), ts = new u({
|
|
3882
3955
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3883
3956
|
authorId: { type: String, required: !0 },
|
|
3884
3957
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
3885
3958
|
reason: { type: String, required: !0 },
|
|
3886
3959
|
guildId: { type: String, required: !0 }
|
|
3887
|
-
}),
|
|
3888
|
-
class
|
|
3960
|
+
}), le = l?.Bans || p("Bans", ts), ns = (n, e) => le.deleteOne({ bannedUserId: n, guildId: e });
|
|
3961
|
+
class rs extends b {
|
|
3889
3962
|
async getUnbanUsers() {
|
|
3890
3963
|
return this.getMany({
|
|
3891
3964
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
3892
3965
|
});
|
|
3893
3966
|
}
|
|
3894
|
-
async banUserFromGuild({ bannedUserId: e, guildId: t, ...
|
|
3895
|
-
await this.update({ bannedUserId: e, guildId: t }, { ...
|
|
3967
|
+
async banUserFromGuild({ bannedUserId: e, guildId: t, ...r }) {
|
|
3968
|
+
await this.update({ bannedUserId: e, guildId: t }, { ...r });
|
|
3896
3969
|
}
|
|
3897
3970
|
async isBannedFromGuild(e, t) {
|
|
3898
|
-
const
|
|
3899
|
-
return !!(
|
|
3971
|
+
const r = await this.get({ bannedUserId: e, guildId: t });
|
|
3972
|
+
return !!(r && (!r.unbannedTimestamp || r.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
3900
3973
|
}
|
|
3901
3974
|
async deleteBan(e, t) {
|
|
3902
|
-
await
|
|
3975
|
+
await ns(e, t), this.invalidate({ bannedUserId: e, guildId: t });
|
|
3903
3976
|
}
|
|
3904
3977
|
}
|
|
3905
|
-
const
|
|
3978
|
+
const as = (n) => le.find(n).lean(), ss = (n) => le.findOne(n).lean(), is = (n, e) => le.findOneAndUpdate(n, e, {
|
|
3906
3979
|
returnDocument: "after",
|
|
3907
3980
|
upsert: !0
|
|
3908
3981
|
}).lean();
|
|
3909
|
-
class
|
|
3982
|
+
class us extends rs {
|
|
3910
3983
|
constructor() {
|
|
3911
3984
|
super(3600 * 36);
|
|
3912
3985
|
}
|
|
@@ -3917,16 +3990,16 @@ class Vr extends Wr {
|
|
|
3917
3990
|
return { bannedUserId: e, guildId: t };
|
|
3918
3991
|
}
|
|
3919
3992
|
fetchFromDb(e) {
|
|
3920
|
-
return
|
|
3993
|
+
return ss(e);
|
|
3921
3994
|
}
|
|
3922
3995
|
fetchManyFromDb(e) {
|
|
3923
|
-
return
|
|
3996
|
+
return as(e);
|
|
3924
3997
|
}
|
|
3925
3998
|
updateInDb(e, t) {
|
|
3926
|
-
return
|
|
3999
|
+
return is(e, t);
|
|
3927
4000
|
}
|
|
3928
4001
|
}
|
|
3929
|
-
const
|
|
4002
|
+
const oi = new us(), cs = new u({
|
|
3930
4003
|
senderId: {
|
|
3931
4004
|
type: u.Types.ObjectId,
|
|
3932
4005
|
required: !0,
|
|
@@ -3943,35 +4016,35 @@ const Js = new Vr(), Jr = new u({
|
|
|
3943
4016
|
meta: {
|
|
3944
4017
|
rps: { type: String, default: void 0 }
|
|
3945
4018
|
}
|
|
3946
|
-
}),
|
|
4019
|
+
}), pe = l?.Invitation || p("Invitation", cs), os = (n) => pe.create({
|
|
3947
4020
|
...n
|
|
3948
|
-
}),
|
|
3949
|
-
await
|
|
4021
|
+
}), ds = async (n) => {
|
|
4022
|
+
await pe.deleteMany({
|
|
3950
4023
|
...n
|
|
3951
4024
|
});
|
|
3952
4025
|
};
|
|
3953
|
-
class
|
|
4026
|
+
class ls extends f {
|
|
3954
4027
|
async sendInvitation({
|
|
3955
4028
|
senderId: e,
|
|
3956
4029
|
receiverId: t,
|
|
3957
|
-
gameMode:
|
|
3958
|
-
...
|
|
4030
|
+
gameMode: r,
|
|
4031
|
+
...a
|
|
3959
4032
|
}) {
|
|
3960
|
-
return await this.get({ senderId: e, gameMode:
|
|
4033
|
+
return await this.get({ senderId: e, gameMode: r, receiverId: t }) ? !1 : (await os({ ...a, senderId: e, gameMode: r, receiverId: t }), !0);
|
|
3961
4034
|
}
|
|
3962
4035
|
async receiveInvitation(e) {
|
|
3963
4036
|
return this.get(e);
|
|
3964
4037
|
}
|
|
3965
4038
|
async deleteInvitation(e) {
|
|
3966
|
-
await
|
|
4039
|
+
await ds(e), this.invalidate(e);
|
|
3967
4040
|
}
|
|
3968
4041
|
}
|
|
3969
|
-
const
|
|
4042
|
+
const ps = (n) => pe.findOne({
|
|
3970
4043
|
...n
|
|
3971
|
-
}).lean(),
|
|
4044
|
+
}).lean(), ys = (n, e) => pe.findOneAndUpdate(n, e, {
|
|
3972
4045
|
returnDocument: "after"
|
|
3973
4046
|
}).lean();
|
|
3974
|
-
class
|
|
4047
|
+
class fs extends ls {
|
|
3975
4048
|
constructor() {
|
|
3976
4049
|
super(3600);
|
|
3977
4050
|
}
|
|
@@ -3981,19 +4054,19 @@ class rs extends ts {
|
|
|
3981
4054
|
getKey({
|
|
3982
4055
|
receiverId: e,
|
|
3983
4056
|
gameMode: t,
|
|
3984
|
-
senderId:
|
|
4057
|
+
senderId: r
|
|
3985
4058
|
}) {
|
|
3986
|
-
return { gameMode: t, receiverId: e, senderId:
|
|
4059
|
+
return { gameMode: t, receiverId: e, senderId: r };
|
|
3987
4060
|
}
|
|
3988
4061
|
fetchFromDb(e) {
|
|
3989
|
-
return
|
|
4062
|
+
return ps(e);
|
|
3990
4063
|
}
|
|
3991
4064
|
updateInDb(e, t) {
|
|
3992
|
-
return
|
|
4065
|
+
return ys(e, t);
|
|
3993
4066
|
}
|
|
3994
4067
|
}
|
|
3995
|
-
const
|
|
3996
|
-
class
|
|
4068
|
+
const di = new fs();
|
|
4069
|
+
class ms extends f {
|
|
3997
4070
|
async setEditoChannel(e, t) {
|
|
3998
4071
|
await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
|
|
3999
4072
|
}
|
|
@@ -4022,11 +4095,11 @@ class ss extends f {
|
|
|
4022
4095
|
{ $set: { "crew.infoChannelId": t } }
|
|
4023
4096
|
);
|
|
4024
4097
|
}
|
|
4025
|
-
async addCrewChannelId(e, t,
|
|
4098
|
+
async addCrewChannelId(e, t, r) {
|
|
4026
4099
|
await this.update(
|
|
4027
4100
|
{ guildId: e },
|
|
4028
4101
|
{
|
|
4029
|
-
$push: { "crew.crewChannelIds": { channelId:
|
|
4102
|
+
$push: { "crew.crewChannelIds": { channelId: r, crewId: t } }
|
|
4030
4103
|
}
|
|
4031
4104
|
);
|
|
4032
4105
|
}
|
|
@@ -4035,7 +4108,7 @@ class ss extends f {
|
|
|
4035
4108
|
{ guildId: e },
|
|
4036
4109
|
{
|
|
4037
4110
|
$set: Object.fromEntries(
|
|
4038
|
-
Object.entries(t).map(([
|
|
4111
|
+
Object.entries(t).map(([r, a]) => [`roles.${r}`, a])
|
|
4039
4112
|
)
|
|
4040
4113
|
}
|
|
4041
4114
|
);
|
|
@@ -4045,16 +4118,16 @@ class ss extends f {
|
|
|
4045
4118
|
{ guildId: e },
|
|
4046
4119
|
{
|
|
4047
4120
|
$set: Object.fromEntries(
|
|
4048
|
-
Object.entries(t).map(([
|
|
4049
|
-
`channels.${
|
|
4050
|
-
|
|
4121
|
+
Object.entries(t).map(([r, a]) => [
|
|
4122
|
+
`channels.${r}`,
|
|
4123
|
+
a
|
|
4051
4124
|
])
|
|
4052
4125
|
)
|
|
4053
4126
|
}
|
|
4054
4127
|
);
|
|
4055
4128
|
}
|
|
4056
4129
|
}
|
|
4057
|
-
const
|
|
4130
|
+
const hs = new u({
|
|
4058
4131
|
guildId: { type: String, required: !0, unique: !0 },
|
|
4059
4132
|
ranking: {
|
|
4060
4133
|
channelId: { type: String, default: null },
|
|
@@ -4096,16 +4169,16 @@ const is = new u({
|
|
|
4096
4169
|
}
|
|
4097
4170
|
},
|
|
4098
4171
|
shopChannelId: { type: String, default: null }
|
|
4099
|
-
}), Ue = l?.Settings || p("Settings",
|
|
4172
|
+
}), Ue = l?.Settings || p("Settings", hs), ws = (n) => Ue.create({
|
|
4100
4173
|
guildId: n
|
|
4101
|
-
}),
|
|
4174
|
+
}), gs = async (n) => {
|
|
4102
4175
|
const e = await Ue.findOne({ guildId: n }).lean();
|
|
4103
|
-
return e || y(await
|
|
4104
|
-
},
|
|
4176
|
+
return e || y(await ws(n));
|
|
4177
|
+
}, Ss = (n, e) => Ue.findOneAndUpdate(n, e, {
|
|
4105
4178
|
upsert: !0,
|
|
4106
4179
|
returnDocument: "after"
|
|
4107
4180
|
}).lean();
|
|
4108
|
-
class
|
|
4181
|
+
class bs extends ms {
|
|
4109
4182
|
constructor() {
|
|
4110
4183
|
super(3600 * 24 * 30);
|
|
4111
4184
|
}
|
|
@@ -4116,13 +4189,13 @@ class ds extends ss {
|
|
|
4116
4189
|
return e;
|
|
4117
4190
|
}
|
|
4118
4191
|
fetchFromDb(e) {
|
|
4119
|
-
return
|
|
4192
|
+
return gs(e);
|
|
4120
4193
|
}
|
|
4121
4194
|
updateInDb(e, t) {
|
|
4122
|
-
return
|
|
4195
|
+
return Ss(e, t);
|
|
4123
4196
|
}
|
|
4124
4197
|
}
|
|
4125
|
-
const
|
|
4198
|
+
const li = new bs(), $s = new u(
|
|
4126
4199
|
{
|
|
4127
4200
|
shopType: { type: String, required: !0, unique: !0 },
|
|
4128
4201
|
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
@@ -4151,11 +4224,11 @@ const ei = new ds(), ls = new u(
|
|
|
4151
4224
|
}
|
|
4152
4225
|
},
|
|
4153
4226
|
{ minimize: !1 }
|
|
4154
|
-
),
|
|
4227
|
+
), De = l?.Shop || p("Shop", $s), Es = (n) => De.create({
|
|
4155
4228
|
shopType: n
|
|
4156
|
-
}),
|
|
4157
|
-
const e = await
|
|
4158
|
-
return e || y(await
|
|
4229
|
+
}), Is = async (n) => {
|
|
4230
|
+
const e = await De.findOne({ shopType: n }).lean();
|
|
4231
|
+
return e || y(await Es(n));
|
|
4159
4232
|
};
|
|
4160
4233
|
class E {
|
|
4161
4234
|
toDBShopItem() {
|
|
@@ -4167,14 +4240,14 @@ class E {
|
|
|
4167
4240
|
};
|
|
4168
4241
|
}
|
|
4169
4242
|
async onBuy(e, t) {
|
|
4170
|
-
this.currency === "berry" ? (await
|
|
4243
|
+
this.currency === "berry" ? (await U.updateUserBerry(
|
|
4171
4244
|
e,
|
|
4172
4245
|
-1 * this.price * t,
|
|
4173
4246
|
!1
|
|
4174
|
-
), await
|
|
4247
|
+
), await Da.updateTotalSpentInShop(
|
|
4175
4248
|
e,
|
|
4176
4249
|
this.price * t
|
|
4177
|
-
)) : await
|
|
4250
|
+
)) : await w.removeItem(
|
|
4178
4251
|
e,
|
|
4179
4252
|
this.currency,
|
|
4180
4253
|
this.price * t
|
|
@@ -4208,7 +4281,7 @@ class E {
|
|
|
4208
4281
|
return !1;
|
|
4209
4282
|
}
|
|
4210
4283
|
}
|
|
4211
|
-
class
|
|
4284
|
+
class Us extends E {
|
|
4212
4285
|
price;
|
|
4213
4286
|
size;
|
|
4214
4287
|
currency;
|
|
@@ -4216,10 +4289,10 @@ class fs extends E {
|
|
|
4216
4289
|
constructor({
|
|
4217
4290
|
price: e,
|
|
4218
4291
|
item: t,
|
|
4219
|
-
size:
|
|
4220
|
-
currency:
|
|
4292
|
+
size: r,
|
|
4293
|
+
currency: a
|
|
4221
4294
|
}) {
|
|
4222
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4295
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4223
4296
|
}
|
|
4224
4297
|
async onBuy(e, t) {
|
|
4225
4298
|
await super.onBuy(e, t), await G.unlockBackground(e, this.data.ornamentId);
|
|
@@ -4228,7 +4301,7 @@ class fs extends E {
|
|
|
4228
4301
|
return !0;
|
|
4229
4302
|
}
|
|
4230
4303
|
}
|
|
4231
|
-
class
|
|
4304
|
+
class Ds extends E {
|
|
4232
4305
|
price;
|
|
4233
4306
|
size;
|
|
4234
4307
|
currency;
|
|
@@ -4236,19 +4309,19 @@ class ms extends E {
|
|
|
4236
4309
|
constructor({
|
|
4237
4310
|
price: e,
|
|
4238
4311
|
item: t,
|
|
4239
|
-
size:
|
|
4240
|
-
currency:
|
|
4312
|
+
size: r,
|
|
4313
|
+
currency: a
|
|
4241
4314
|
}) {
|
|
4242
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4315
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4243
4316
|
}
|
|
4244
4317
|
async onBuy(e, t) {
|
|
4245
|
-
await super.onBuy(e, t), await
|
|
4318
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4246
4319
|
}
|
|
4247
4320
|
isBoostXp() {
|
|
4248
4321
|
return !0;
|
|
4249
4322
|
}
|
|
4250
4323
|
}
|
|
4251
|
-
class
|
|
4324
|
+
class Ts extends E {
|
|
4252
4325
|
price;
|
|
4253
4326
|
size;
|
|
4254
4327
|
currency;
|
|
@@ -4256,19 +4329,19 @@ class hs extends E {
|
|
|
4256
4329
|
constructor({
|
|
4257
4330
|
price: e,
|
|
4258
4331
|
item: t,
|
|
4259
|
-
size:
|
|
4260
|
-
currency:
|
|
4332
|
+
size: r,
|
|
4333
|
+
currency: a
|
|
4261
4334
|
}) {
|
|
4262
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4335
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4263
4336
|
}
|
|
4264
4337
|
async onBuy(e, t) {
|
|
4265
|
-
await super.onBuy(e, t), await
|
|
4338
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4266
4339
|
}
|
|
4267
4340
|
isChest() {
|
|
4268
4341
|
return !0;
|
|
4269
4342
|
}
|
|
4270
4343
|
}
|
|
4271
|
-
class
|
|
4344
|
+
class Os extends E {
|
|
4272
4345
|
price;
|
|
4273
4346
|
size;
|
|
4274
4347
|
currency;
|
|
@@ -4276,19 +4349,19 @@ class ws extends E {
|
|
|
4276
4349
|
constructor({
|
|
4277
4350
|
price: e,
|
|
4278
4351
|
item: t,
|
|
4279
|
-
size:
|
|
4280
|
-
currency:
|
|
4352
|
+
size: r,
|
|
4353
|
+
currency: a
|
|
4281
4354
|
}) {
|
|
4282
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4355
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4283
4356
|
}
|
|
4284
4357
|
async onBuy(e, t) {
|
|
4285
|
-
await super.onBuy(e, t), await
|
|
4358
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4286
4359
|
}
|
|
4287
4360
|
isObject() {
|
|
4288
4361
|
return !0;
|
|
4289
4362
|
}
|
|
4290
4363
|
}
|
|
4291
|
-
class
|
|
4364
|
+
class Cs extends E {
|
|
4292
4365
|
price;
|
|
4293
4366
|
size;
|
|
4294
4367
|
currency;
|
|
@@ -4296,22 +4369,22 @@ class gs extends E {
|
|
|
4296
4369
|
constructor({
|
|
4297
4370
|
price: e,
|
|
4298
4371
|
item: t,
|
|
4299
|
-
size:
|
|
4300
|
-
currency:
|
|
4372
|
+
size: r,
|
|
4373
|
+
currency: a
|
|
4301
4374
|
}) {
|
|
4302
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4375
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4303
4376
|
}
|
|
4304
4377
|
async onBuy(e, t) {
|
|
4305
|
-
await super.onBuy(e, t), await
|
|
4378
|
+
await super.onBuy(e, t), await w.addEquipments(
|
|
4306
4379
|
e,
|
|
4307
|
-
|
|
4380
|
+
ft({ stop: t }).map(
|
|
4308
4381
|
() => d.seedEquipment(
|
|
4309
4382
|
{ ...this.data },
|
|
4310
4383
|
Date.now() - Math.round(Math.random() * 1e3)
|
|
4311
4384
|
)
|
|
4312
|
-
).map((
|
|
4313
|
-
entityId:
|
|
4314
|
-
seed:
|
|
4385
|
+
).map((r) => ({
|
|
4386
|
+
entityId: r.entityId,
|
|
4387
|
+
seed: r.seed
|
|
4315
4388
|
}))
|
|
4316
4389
|
);
|
|
4317
4390
|
}
|
|
@@ -4319,7 +4392,7 @@ class gs extends E {
|
|
|
4319
4392
|
return !0;
|
|
4320
4393
|
}
|
|
4321
4394
|
}
|
|
4322
|
-
class
|
|
4395
|
+
class Rs extends E {
|
|
4323
4396
|
price;
|
|
4324
4397
|
size;
|
|
4325
4398
|
currency;
|
|
@@ -4327,19 +4400,19 @@ class Ss extends E {
|
|
|
4327
4400
|
constructor({
|
|
4328
4401
|
price: e,
|
|
4329
4402
|
item: t,
|
|
4330
|
-
size:
|
|
4331
|
-
currency:
|
|
4403
|
+
size: r,
|
|
4404
|
+
currency: a
|
|
4332
4405
|
}) {
|
|
4333
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4406
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4334
4407
|
}
|
|
4335
4408
|
async onBuy(e, t) {
|
|
4336
|
-
await super.onBuy(e, t), await
|
|
4409
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4337
4410
|
}
|
|
4338
4411
|
isBottle() {
|
|
4339
4412
|
return !0;
|
|
4340
4413
|
}
|
|
4341
4414
|
}
|
|
4342
|
-
class
|
|
4415
|
+
class vs extends E {
|
|
4343
4416
|
price;
|
|
4344
4417
|
size;
|
|
4345
4418
|
currency;
|
|
@@ -4347,19 +4420,19 @@ class bs extends E {
|
|
|
4347
4420
|
constructor({
|
|
4348
4421
|
price: e,
|
|
4349
4422
|
item: t,
|
|
4350
|
-
size:
|
|
4351
|
-
currency:
|
|
4423
|
+
size: r,
|
|
4424
|
+
currency: a
|
|
4352
4425
|
}) {
|
|
4353
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4426
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4354
4427
|
}
|
|
4355
4428
|
async onBuy(e, t) {
|
|
4356
|
-
await super.onBuy(e, t), await
|
|
4429
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4357
4430
|
}
|
|
4358
4431
|
isRepair() {
|
|
4359
4432
|
return !0;
|
|
4360
4433
|
}
|
|
4361
4434
|
}
|
|
4362
|
-
class
|
|
4435
|
+
class Ms extends E {
|
|
4363
4436
|
price;
|
|
4364
4437
|
size;
|
|
4365
4438
|
currency;
|
|
@@ -4367,19 +4440,19 @@ class $s extends E {
|
|
|
4367
4440
|
constructor({
|
|
4368
4441
|
price: e,
|
|
4369
4442
|
item: t,
|
|
4370
|
-
size:
|
|
4371
|
-
currency:
|
|
4443
|
+
size: r,
|
|
4444
|
+
currency: a
|
|
4372
4445
|
}) {
|
|
4373
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4446
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4374
4447
|
}
|
|
4375
4448
|
async onBuy(e, t) {
|
|
4376
|
-
await super.onBuy(e, t), await
|
|
4449
|
+
await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
|
|
4377
4450
|
}
|
|
4378
4451
|
isStore() {
|
|
4379
4452
|
return !0;
|
|
4380
4453
|
}
|
|
4381
4454
|
}
|
|
4382
|
-
class
|
|
4455
|
+
class As extends E {
|
|
4383
4456
|
price;
|
|
4384
4457
|
size;
|
|
4385
4458
|
currency;
|
|
@@ -4387,10 +4460,10 @@ class Es extends E {
|
|
|
4387
4460
|
constructor({
|
|
4388
4461
|
price: e,
|
|
4389
4462
|
item: t,
|
|
4390
|
-
size:
|
|
4391
|
-
currency:
|
|
4463
|
+
size: r,
|
|
4464
|
+
currency: a
|
|
4392
4465
|
}) {
|
|
4393
|
-
super(), this.data = t, this.price = e, this.size =
|
|
4466
|
+
super(), this.data = t, this.price = e, this.size = r, this.currency = a;
|
|
4394
4467
|
}
|
|
4395
4468
|
async onBuy(e, t) {
|
|
4396
4469
|
await super.onBuy(e, t), await G.unlockTitle(e, this.data.ornamentId);
|
|
@@ -4399,58 +4472,58 @@ class Es extends E {
|
|
|
4399
4472
|
return !0;
|
|
4400
4473
|
}
|
|
4401
4474
|
}
|
|
4402
|
-
class
|
|
4475
|
+
class Bs extends f {
|
|
4403
4476
|
async getShopItem(e, t) {
|
|
4404
|
-
const
|
|
4405
|
-
if (!
|
|
4477
|
+
const a = (await this.get(e)).items.find((S) => S.id === t);
|
|
4478
|
+
if (!a)
|
|
4406
4479
|
return;
|
|
4407
|
-
const { price: s, size: i, currency: o } =
|
|
4480
|
+
const { price: s, size: i, currency: o } = a, c = await d.get(a.id) ?? await g.get(a.id);
|
|
4408
4481
|
if (g.isOrnament(c) && g.isBackground(c))
|
|
4409
|
-
return new
|
|
4482
|
+
return new Us({ price: s, item: c, size: i, currency: o });
|
|
4410
4483
|
if (g.isOrnament(c) && g.isTitle(c))
|
|
4411
|
-
return new
|
|
4484
|
+
return new As({ price: s, item: c, size: i, currency: o });
|
|
4412
4485
|
if (d.isEntity(c) && d.isChestItem(c))
|
|
4413
|
-
return new
|
|
4486
|
+
return new Ts({ price: s, item: c, size: i, currency: o });
|
|
4414
4487
|
if (d.isEntity(c) && d.isBoostItem(c))
|
|
4415
|
-
return new
|
|
4488
|
+
return new Ds({ price: s, item: c, size: i, currency: o });
|
|
4416
4489
|
if (d.isEntity(c) && d.isRepairItem(c))
|
|
4417
|
-
return new
|
|
4490
|
+
return new vs({ price: s, item: c, size: i, currency: o });
|
|
4418
4491
|
if (d.isEntity(c) && d.isStoreItem(c))
|
|
4419
|
-
return new
|
|
4492
|
+
return new Ms({ price: s, item: c, size: i, currency: o });
|
|
4420
4493
|
if (d.isEntity(c) && d.isObjectItem(c))
|
|
4421
|
-
return new
|
|
4494
|
+
return new Os({ price: s, item: c, size: i, currency: o });
|
|
4422
4495
|
if (d.isEntity(c) && d.isEquipment(c))
|
|
4423
|
-
return new
|
|
4496
|
+
return new Cs({ price: s, item: c, size: i, currency: o });
|
|
4424
4497
|
if (d.isEntity(c) && d.isBottleItem(c))
|
|
4425
|
-
return new
|
|
4498
|
+
return new Rs({ price: s, size: i, item: c, currency: o });
|
|
4426
4499
|
}
|
|
4427
4500
|
async getShopItemList(e) {
|
|
4428
|
-
const t = await this.get(e),
|
|
4429
|
-
for (const { id:
|
|
4430
|
-
const s = await this.getShopItem(e,
|
|
4431
|
-
s &&
|
|
4501
|
+
const t = await this.get(e), r = [];
|
|
4502
|
+
for (const { id: a } of t.items) {
|
|
4503
|
+
const s = await this.getShopItem(e, a);
|
|
4504
|
+
s && r.push(s);
|
|
4432
4505
|
}
|
|
4433
|
-
return
|
|
4506
|
+
return r;
|
|
4434
4507
|
}
|
|
4435
4508
|
getShopItemId(e) {
|
|
4436
4509
|
return d.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
|
|
4437
4510
|
}
|
|
4438
|
-
async updateShopStats(e, t,
|
|
4511
|
+
async updateShopStats(e, t, r) {
|
|
4439
4512
|
await this.update(
|
|
4440
4513
|
{ shopType: e },
|
|
4441
4514
|
{
|
|
4442
4515
|
$inc: {
|
|
4443
|
-
"stats.berrySpent": t.price *
|
|
4444
|
-
"stats.itemBought":
|
|
4445
|
-
"stats.chestBought": t.isChest() ?
|
|
4446
|
-
"stats.percentBought": t.isRepair() ? (t.data.effects.find((
|
|
4516
|
+
"stats.berrySpent": t.price * r,
|
|
4517
|
+
"stats.itemBought": r,
|
|
4518
|
+
"stats.chestBought": t.isChest() ? r : 0,
|
|
4519
|
+
"stats.percentBought": t.isRepair() ? (t.data.effects.find((a) => a.type === "CREW_REPAIR")?.params.amount ?? 0) * r : 0,
|
|
4447
4520
|
"stats.boostTimeBought": t.isBoostXp() ? t.data.ms / (1440 * 60 * 1e3) : 0
|
|
4448
4521
|
}
|
|
4449
4522
|
}
|
|
4450
4523
|
);
|
|
4451
4524
|
}
|
|
4452
|
-
async buyShopItem(e, t,
|
|
4453
|
-
const s = t.map((i) => (i.id === this.getShopItemId(
|
|
4525
|
+
async buyShopItem(e, t, r, a) {
|
|
4526
|
+
const s = t.map((i) => (i.id === this.getShopItemId(r) && i.size && (i.size -= a), i));
|
|
4454
4527
|
await this.update(
|
|
4455
4528
|
{ shopType: e },
|
|
4456
4529
|
{
|
|
@@ -4481,8 +4554,8 @@ class Us extends f {
|
|
|
4481
4554
|
);
|
|
4482
4555
|
}
|
|
4483
4556
|
}
|
|
4484
|
-
const
|
|
4485
|
-
class
|
|
4557
|
+
const _s = (n, e) => De.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
4558
|
+
class xs extends Bs {
|
|
4486
4559
|
constructor() {
|
|
4487
4560
|
super(3600);
|
|
4488
4561
|
}
|
|
@@ -4493,28 +4566,28 @@ class Ts extends Us {
|
|
|
4493
4566
|
return e;
|
|
4494
4567
|
}
|
|
4495
4568
|
fetchFromDb(e) {
|
|
4496
|
-
return
|
|
4569
|
+
return Is(e);
|
|
4497
4570
|
}
|
|
4498
4571
|
updateInDb(e, t) {
|
|
4499
|
-
return
|
|
4572
|
+
return _s(e, t);
|
|
4500
4573
|
}
|
|
4501
4574
|
}
|
|
4502
|
-
const
|
|
4575
|
+
const pi = new xs(), qs = new u({
|
|
4503
4576
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
4504
4577
|
authorId: String,
|
|
4505
4578
|
date: { type: Date, default: Date.now() },
|
|
4506
4579
|
reason: { type: String, default: null }
|
|
4507
|
-
}),
|
|
4508
|
-
class
|
|
4580
|
+
}), nt = l?.Warn || p("Warn", qs), ks = (n) => nt.countDocuments(n);
|
|
4581
|
+
class Ns extends b {
|
|
4509
4582
|
getUserWarns(e) {
|
|
4510
4583
|
return this.getMany({ warnedUserId: e });
|
|
4511
4584
|
}
|
|
4512
4585
|
getUserWarnCount(e) {
|
|
4513
|
-
return
|
|
4586
|
+
return ks({ warnedUserId: e });
|
|
4514
4587
|
}
|
|
4515
4588
|
}
|
|
4516
|
-
const
|
|
4517
|
-
class
|
|
4589
|
+
const Fs = (n) => nt.find(n).lean();
|
|
4590
|
+
class js extends Ns {
|
|
4518
4591
|
constructor() {
|
|
4519
4592
|
super(300);
|
|
4520
4593
|
}
|
|
@@ -4528,62 +4601,63 @@ class Ms extends Cs {
|
|
|
4528
4601
|
throw new Error("Method not implemented.");
|
|
4529
4602
|
}
|
|
4530
4603
|
fetchManyFromDb(e) {
|
|
4531
|
-
return
|
|
4604
|
+
return Fs(e);
|
|
4532
4605
|
}
|
|
4533
4606
|
updateInDb() {
|
|
4534
4607
|
throw new Error("Method not implemented.");
|
|
4535
4608
|
}
|
|
4536
4609
|
}
|
|
4537
|
-
const
|
|
4538
|
-
|
|
4610
|
+
const yi = new js(), fi = (n) => {
|
|
4611
|
+
ct(n);
|
|
4539
4612
|
};
|
|
4540
|
-
class
|
|
4613
|
+
class mi extends ot.ObjectId {
|
|
4541
4614
|
}
|
|
4542
4615
|
export {
|
|
4543
|
-
|
|
4544
|
-
|
|
4616
|
+
Vs as COOLDOWN_COMMANDS,
|
|
4617
|
+
mi as ObjectId,
|
|
4545
4618
|
h as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4619
|
+
we as RAID_MIDDLEWARE_EVENT_NAME,
|
|
4620
|
+
oi as banService,
|
|
4621
|
+
fi as connectToServices,
|
|
4622
|
+
Re as crewMetaService,
|
|
4623
|
+
Ws as crewOrnamentsService,
|
|
4624
|
+
Gs as crewQuestService,
|
|
4625
|
+
At as crewService,
|
|
4626
|
+
Ys as crewStatsEngagementService,
|
|
4627
|
+
Xs as crewStatsFrequencyService,
|
|
4555
4628
|
m as emitQuestMiddlewareEvent,
|
|
4556
|
-
|
|
4629
|
+
he as emitRaidMiddlewareEvent,
|
|
4557
4630
|
d as entityService,
|
|
4558
|
-
|
|
4559
|
-
|
|
4631
|
+
Is as findShop,
|
|
4632
|
+
di as invitationService,
|
|
4560
4633
|
g as ornamentService,
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4634
|
+
I as panoplyService,
|
|
4635
|
+
ci as recipeService,
|
|
4636
|
+
Ls as registerQuestMiddlewareEvents,
|
|
4637
|
+
Qs as registerRaidMiddlewareEvents,
|
|
4564
4638
|
H as reminderService,
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4639
|
+
li as settingsService,
|
|
4640
|
+
De as shopModel,
|
|
4641
|
+
pi as shopService,
|
|
4642
|
+
Ar as userCooldownService,
|
|
4643
|
+
ar as userCrewService,
|
|
4644
|
+
Js as userDailyReportService,
|
|
4645
|
+
ye as userEncyclopediaService,
|
|
4646
|
+
Zs as userGamesService,
|
|
4647
|
+
w as userInventoryService,
|
|
4648
|
+
U as userMetaService,
|
|
4575
4649
|
G as userOrnamentService,
|
|
4576
4650
|
Me as userQuestService,
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4651
|
+
ei as userRaidService,
|
|
4652
|
+
bn as userService,
|
|
4653
|
+
ve as userSettingsService,
|
|
4654
|
+
ti as userShopService,
|
|
4655
|
+
ni as userStatsCasinoService,
|
|
4656
|
+
ri as userStatsCrewService,
|
|
4657
|
+
Da as userStatsEconomyService,
|
|
4658
|
+
ai as userStatsEngagementService,
|
|
4659
|
+
si as userStatsFlagsService,
|
|
4660
|
+
ii as userStatsFrequencyService,
|
|
4661
|
+
ui as userStatsInventoryService,
|
|
4662
|
+
yi as warnService
|
|
4589
4663
|
};
|