@opfr/services 1.1.5 → 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.
Files changed (50) hide show
  1. package/dist/index.es.js +1029 -922
  2. package/dist/index.umd.js +1 -1
  3. package/dist/services/ban/helper.d.ts +2 -1
  4. package/dist/services/ban/helper.d.ts.map +1 -1
  5. package/dist/services/ban/process/updateOne.d.ts +1 -1
  6. package/dist/services/ban/process/updateOne.d.ts.map +1 -1
  7. package/dist/services/ban/service.d.ts +1 -1
  8. package/dist/services/ban/service.d.ts.map +1 -1
  9. package/dist/services/crew-meta/helper.d.ts +4 -1
  10. package/dist/services/crew-meta/helper.d.ts.map +1 -1
  11. package/dist/services/crew-meta/process/findOne.d.ts +1 -1
  12. package/dist/services/crew-meta/process/updateOne.d.ts +1 -1
  13. package/dist/services/index.d.ts +1 -0
  14. package/dist/services/index.d.ts.map +1 -1
  15. package/dist/services/recipe/data.d.ts +3 -0
  16. package/dist/services/recipe/data.d.ts.map +1 -0
  17. package/dist/services/recipe/definition/model.d.ts +5 -0
  18. package/dist/services/recipe/definition/model.d.ts.map +1 -0
  19. package/dist/services/recipe/definition/schema.d.ts +13 -0
  20. package/dist/services/recipe/definition/schema.d.ts.map +1 -0
  21. package/dist/services/recipe/helper.d.ts +12 -0
  22. package/dist/services/recipe/helper.d.ts.map +1 -0
  23. package/dist/services/recipe/index.d.ts +3 -0
  24. package/dist/services/recipe/index.d.ts.map +1 -0
  25. package/dist/services/recipe/process/create.d.ts +3 -0
  26. package/dist/services/recipe/process/create.d.ts.map +1 -0
  27. package/dist/services/recipe/process/findMany.d.ts +5 -0
  28. package/dist/services/recipe/process/findMany.d.ts.map +1 -0
  29. package/dist/services/recipe/process/findOne.d.ts +4 -0
  30. package/dist/services/recipe/process/findOne.d.ts.map +1 -0
  31. package/dist/services/recipe/process/updateOne.d.ts +5 -0
  32. package/dist/services/recipe/process/updateOne.d.ts.map +1 -0
  33. package/dist/services/recipe/service.d.ts +24 -0
  34. package/dist/services/recipe/service.d.ts.map +1 -0
  35. package/dist/services/recipe/types.d.ts +24 -0
  36. package/dist/services/recipe/types.d.ts.map +1 -0
  37. package/dist/services/reminder/helper.d.ts +2 -1
  38. package/dist/services/reminder/helper.d.ts.map +1 -1
  39. package/dist/services/user-crew/process/updateOne.d.ts.map +1 -1
  40. package/dist/services/user-inventory/helper.d.ts +6 -20
  41. package/dist/services/user-inventory/helper.d.ts.map +1 -1
  42. package/dist/services/user-meta/helper.d.ts +7 -2
  43. package/dist/services/user-meta/helper.d.ts.map +1 -1
  44. package/dist/services/user-meta/process/findMany.d.ts +5 -0
  45. package/dist/services/user-meta/process/findMany.d.ts.map +1 -0
  46. package/dist/services/user-meta/service.d.ts +2 -1
  47. package/dist/services/user-meta/service.d.ts.map +1 -1
  48. package/dist/services/user-settings/helper.d.ts +4 -4
  49. package/dist/services/user-settings/helper.d.ts.map +1 -1
  50. 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 ut, Types as ct } from "mongoose";
2
- import { randomBetween as Y, hasExpire as L, sameDay as ye, yesterday as k, capitalizeAllWords as ot, filterNullAndUndefined as N, pickFrom as dt, shuffle as Te, recordToArray as C, arrayToRecord as Me, mergeObjects as F, exclude as q, groupBy as lt, sortBy as De, seededRandom as pt, range as yt } from "@opfr/utils-lang";
3
- import ft from "node-cache";
4
- import { CREW_DEFAULT_DISINTEGRATION as Ae, CREW_DEFAULT_MEMBER_LIMIT as mt, QuestStatus as D, CREW_DEFAULT_XP_PERCENT as ht, DEFAULT_FACTION as wt, RANK_IDS_WITHOUT_BASIC as Oe, EQUIPMENT_SLOT as Be, EQUIPMENT_FROM_SLOT_TO_TYPE as gt, EFFECT_KEYS as St, CHARACTERISTICS as bt, getComputedCharacteristicValue as $t, getCurrentLevel as Et, HP_PER_VITALITY as Ut, DEFAULT_MAX_HP as It, transformToDBBuff as Tt, SHOP_DEFAULT_AVAILABLE_ENTITY_AMOUNT as Dt } from "@opfr/definitions";
5
- import * as fe from "events";
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 ft({
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), a = this.cache.get(t);
18
- if (a)
19
- return a;
20
- const r = await this.fetchFromDb(e);
21
- return r && this.cache.set(t, r), r;
22
- }
23
- async update(e, t, a) {
24
- const r = await this.updateInDb(e, t, a);
25
- if (r) {
26
- const s = this.getKey(r);
27
- this.cache.del(Q), this.cache.set(this.normalizeKey(s), r);
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 r;
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((a) => {
45
- this.cache.set(this.normalizeKey(this.getKey(a)), a);
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((a) => {
51
- this.cache.set(this.normalizeKey(this.getKey(a)), a);
50
+ return t.forEach((r) => {
51
+ this.cache.set(this.normalizeKey(this.getKey(r)), r);
52
52
  }), t;
53
53
  }
54
54
  }
55
- const _e = new fe.EventEmitter(), m = (n, e, t) => {
56
- _e.emit(n, e, t);
57
- }, _s = (n) => {
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
- _e.on(e, (a, r) => {
60
- t(a, r);
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
- }, xe = new fe.EventEmitter(), me = (n, e, t) => {
83
- xe.emit(n, e, t);
84
- }, xs = (n) => {
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
- xe.on(e, (a, r) => {
87
- t(a, r);
86
+ qe.on(e, (r, a) => {
87
+ t(r, a);
88
88
  });
89
- }, he = {
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
- }, qe = new u(
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: mt },
100
- disintegration: { type: Number, default: Ae },
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
- qe.post("findOneAndUpdate", async function(n) {
105
+ ke.post("findOneAndUpdate", async function(n) {
106
106
  m(h.CREW, n._id, n);
107
107
  });
108
- const W = l?.Crew || p("Crew", qe);
109
- class Ot extends f {
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: a } = t, [r, s] = [a - 2, (a - 3) * 2 + 3];
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(r, s)] },
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 Ct = async (n) => {
191
+ const Rt = async (n) => {
192
192
  const e = await W.findById(n).lean();
193
193
  return e || null;
194
- }, Rt = (n, e) => W.findOneAndUpdate({ _id: n }, e, {
194
+ }, vt = (n, e) => W.findOneAndUpdate({ _id: n }, e, {
195
195
  returnDocument: "after"
196
196
  }).lean();
197
- class vt extends Ot {
197
+ class Mt extends Ct {
198
198
  constructor() {
199
199
  super(3600);
200
200
  }
@@ -205,23 +205,23 @@ class vt extends Ot {
205
205
  return e;
206
206
  }
207
207
  fetchFromDb(e) {
208
- return Ct(e);
208
+ return Rt(e);
209
209
  }
210
210
  updateInDb(e, t) {
211
- return Rt(e, t);
211
+ return vt(e, t);
212
212
  }
213
213
  }
214
- const Mt = new vt();
215
- class At extends f {
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
- return t.buffs.xp.boost;
219
+ return t.buffs.xp;
220
220
  }
221
221
  async calcXp(e, t) {
222
- const a = await Mt.get(e);
223
- return a ? Math.ceil(
224
- t * (a.disintegration / Ae) * (await this.hasXpBuff(e) ?? 1)
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 a = /* @__PURE__ */ new Date();
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", a]
256
+ lt: ["$buffs.xp.expireAt", r]
257
257
  },
258
258
  then: {
259
259
  boost: 1.1,
260
- expireAt: { $add: [a, t * 60 * 60 * 1e3] }
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 }), ke = new u({
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
- ke.post("findOneAndUpdate", async function(n) {
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 we = l?.CrewMeta || p("CrewMeta", ke), Bt = async (n) => await we.create({
298
+ const ge = l?.CrewMeta || p("CrewMeta", Ne), _t = async (n) => await ge.create({
299
299
  crew: n
300
300
  });
301
- async function _t(n) {
302
- const e = await we.findOne({ user: n }).lean();
303
- return e || y(await Bt(n));
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 xt = (n, e) => we.findOneAndUpdate({ user: n }, e, {
305
+ const qt = (n, e) => ge.findOneAndUpdate({ crew: n }, e, {
306
306
  returnDocument: "after",
307
307
  upsert: !0
308
308
  }).lean();
309
- class qt extends At {
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 _t(e);
320
+ return xt(e);
321
321
  }
322
322
  updateInDb(e, t) {
323
- return xt(e, t);
323
+ return qt(e, t);
324
324
  }
325
325
  }
326
- const Ce = new qt();
327
- class kt extends f {
328
- async unlockBadge(e, t, a) {
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}_${a}` }
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 Ne = new u({
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
- Ne.post("findOneAndUpdate", async function(n) {
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 ge = l?.CrewOrnaments || p("CrewOrnaments", Ne), Nt = (n) => ge.create({
352
+ const Se = l?.CrewOrnaments || p("CrewOrnaments", Fe), Ft = (n) => Se.create({
353
353
  crew: n
354
354
  });
355
- async function Ft(n) {
356
- const e = await ge.findOne({ crew: n }).lean();
357
- return e || y(await Nt(n));
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 jt = (n, e) => ge.findOneAndUpdate({ crew: n }, e, {
359
+ const zt = (n, e) => Se.findOneAndUpdate({ crew: n }, e, {
360
360
  upsert: !0,
361
361
  returnDocument: "after"
362
362
  }).lean();
363
- class zt extends kt {
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 Ft(e);
374
+ return jt(e);
375
375
  }
376
376
  updateInDb(e, t) {
377
- return jt(e, t);
377
+ return zt(e, t);
378
378
  }
379
379
  }
380
- const qs = new zt();
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: a } = await this.get({ crew: e, questId: t });
390
- return !!a && ye(k(), a);
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: D.COMPLETED
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 Fe = new u(
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: D.IN_PROGRESS, index: !0 },
420
+ status: { type: String, default: T.IN_PROGRESS, index: !0 },
421
421
  lastCompletionDate: Date
422
422
  },
423
423
  { minimize: !1 }
424
424
  );
425
- Fe.post("findOneAndUpdate", function(n) {
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", Fe);
433
- function Kt(n) {
432
+ const X = l?.CrewQuest || p("CrewQuest", je);
433
+ function Ht(n) {
434
434
  return X.find(n).lean();
435
435
  }
436
- const Ht = async (n) => await X.create({
436
+ const Lt = async (n) => await X.create({
437
437
  ...n
438
438
  });
439
- async function Lt(n) {
439
+ async function Qt(n) {
440
440
  const e = await X.findOne(n).lean();
441
- return e || y(await Ht(n));
441
+ return e || y(await Lt(n));
442
442
  }
443
- function Qt(n, e, t) {
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 Wt extends Pt {
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 Lt(e);
464
+ return Qt(e);
465
465
  }
466
466
  fetchManyFromDb(e) {
467
- return Kt(e);
467
+ return Ht(e);
468
468
  }
469
- updateInDb(e, t, a) {
470
- return Qt(e, t, a);
469
+ updateInDb(e, t, r) {
470
+ return Wt(e, t, r);
471
471
  }
472
472
  }
473
- const ks = new Wt();
474
- class Gt extends f {
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 je = new u({
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
- je.post("findOneAndUpdate", function(n) {
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 Se = l?.CrewStatsEngagement || p(
511
+ const be = l?.CrewStatsEngagement || p(
512
512
  "CrewStatsEngagement",
513
- je
514
- ), Yt = (n) => Se.create({
513
+ ze
514
+ ), Xt = (n) => be.create({
515
515
  crew: n
516
516
  });
517
- async function Xt(n) {
518
- const e = await Se.findOne({ crew: n }).lean();
519
- return e || y(await Yt(n));
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 Vt = (n, e) => Se.findOneAndUpdate({ crew: n }, e, {
521
+ const Jt = (n, e) => be.findOneAndUpdate({ crew: n }, e, {
522
522
  upsert: !0,
523
523
  returnDocument: "after"
524
524
  }).lean();
525
- class Jt extends Gt {
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 Xt(e);
538
+ return Vt(e);
539
539
  }
540
540
  updateInDb(e, t) {
541
- return Vt(e, t);
541
+ return Jt(e, t);
542
542
  }
543
543
  }
544
- const Ns = new Jt();
545
- class Zt extends f {
544
+ const Ys = new Zt();
545
+ class en extends f {
546
546
  }
547
- const ze = new u({
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
- ze.post("findOneAndUpdate", function(n) {
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 be = l?.CrewStatsFrequency || p(
563
+ const $e = l?.CrewStatsFrequency || p(
564
564
  "CrewStatsFrequency",
565
- ze
566
- ), en = (n) => be.create({
565
+ Ke
566
+ ), tn = (n) => $e.create({
567
567
  crew: n
568
568
  });
569
- async function tn(n) {
570
- const e = await be.findOne({ crew: n }).lean();
571
- return e || y(await en(n));
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 nn = (n, e) => be.findOneAndUpdate({ crew: n }, e, {
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 Zt {
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 tn(e);
588
+ return nn(e);
589
589
  }
590
590
  updateInDb(e, t) {
591
- return nn(e, t);
591
+ return rn(e, t);
592
592
  }
593
593
  }
594
- const Fs = new an(), Pe = new u(
594
+ const Xs = new an(), Pe = new u(
595
595
  {
596
596
  user: {
597
597
  type: u.Types.ObjectId,
@@ -604,15 +604,15 @@ const Fs = new an(), Pe = new u(
604
604
  required: !0,
605
605
  index: !0
606
606
  },
607
- status: { type: String, default: D.IN_PROGRESS, index: 1 },
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
- me(
615
- he.USER_QUEST,
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), rn = new u({
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", rn), Ke = new u(
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: ht }
659
+ percent: { type: Number, default: wt }
660
660
  },
661
661
  { minimize: !1 }
662
662
  );
663
- Ke.post("findOneAndUpdate", function(n) {
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", Ke), sn = new u({
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", sn), un = new u({
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", un), cn = new u({
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", cn), He = new u(
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
- He.post("findOneAndUpdate", function(n) {
734
- me(
735
- he.USER_INVENTORY,
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", He), on = new fe.EventEmitter(), dn = (n, e) => {
745
- on.emit(n, e);
746
- }, O = {
744
+ const te = l?.UserInventory || p("UserInventory", Le), dn = new me.EventEmitter(), ln = (n, e) => {
745
+ dn.emit(n, e);
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
- }, Le = new u({
751
+ }, Qe = new u({
752
752
  user: {
753
753
  type: u.Types.ObjectId,
754
754
  required: !0,
@@ -771,33 +771,33 @@ const te = l?.UserInventory || p("UserInventory", He), on = new fe.EventEmitter(
771
771
  buffs: {
772
772
  cooldown: {
773
773
  casino: {
774
- type: [O],
774
+ type: [C],
775
775
  default: []
776
776
  },
777
777
  work: {
778
- type: [O],
778
+ type: [C],
779
779
  default: []
780
780
  }
781
781
  },
782
782
  berry: {
783
783
  work: {
784
- type: [O],
784
+ type: [C],
785
785
  default: []
786
786
  },
787
787
  global: {
788
- type: [O],
788
+ type: [C],
789
789
  default: []
790
790
  }
791
791
  },
792
792
  drop: {
793
793
  work: {
794
- type: [O],
794
+ type: [C],
795
795
  default: []
796
796
  }
797
797
  },
798
798
  xp: {
799
799
  global: {
800
- type: [O],
800
+ type: [C],
801
801
  default: []
802
802
  }
803
803
  }
@@ -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
- Le.post("findOneAndUpdate", async function(n) {
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 && dn("death", n.user._id);
833
+ ), n.hp <= 0 && ln("death", n.user._id);
834
834
  });
835
- const R = l?.UserMeta || p("UserMeta", Le), Qe = new u({
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 R = 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
- Qe.post("findOneAndUpdate", function(n) {
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", Qe), We = new u(
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
- We.post("findOneAndUpdate", function(n) {
884
- me(
885
- he.USER_RAID,
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 ae = l?.UserRaid || p("UserRaid", We), ln = new u({
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", ln), pn = new u(
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
- ), re = l?.UserShop || p("UserShop", pn), Ge = new u({
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
- Ge.post("findOneAndUpdate", function(n) {
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 v = l?.UserStatsCasino || p("UserStatsCasino", Ge), Ye = new u({
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 v = 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
- Ye.post("findOneAndUpdate", function(n) {
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", Ye), Xe = new u({
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
- Xe.post("findOneAndUpdate", function(n) {
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", Xe), Ve = new u({
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
- Ve.post("findOneAndUpdate", function(n) {
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
- Ve
1029
- ), Je = new u({
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
- Je.post("findOneAndUpdate", function(n) {
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", Je), Ze = new u({
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,7 +1064,7 @@ const ce = l?.UserStatsFlags || p("UserStatsFlags", Je), Ze = new u({
1064
1064
  lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date() }
1065
1065
  }
1066
1066
  });
1067
- Ze.post("findOneAndUpdate", function(n) {
1067
+ et.post("findOneAndUpdate", function(n) {
1068
1068
  m(
1069
1069
  h.USER_STATS_FREQUENCY,
1070
1070
  n.user._id,
@@ -1073,8 +1073,8 @@ Ze.post("findOneAndUpdate", function(n) {
1073
1073
  });
1074
1074
  const M = l?.UserStatsFrequency || p(
1075
1075
  "UserStatsFrequency",
1076
- Ze
1077
- ), et = new u({
1076
+ et
1077
+ ), tt = new u({
1078
1078
  user: {
1079
1079
  type: u.Types.ObjectId,
1080
1080
  required: !0,
@@ -1101,7 +1101,7 @@ const M = l?.UserStatsFrequency || p(
1101
1101
  totalCrafted: { type: Number, default: 0 }
1102
1102
  }
1103
1103
  });
1104
- et.post("findOneAndUpdate", function(n) {
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
- et
1114
- ), $e = new u({
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: wt, index: 1 },
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
- $e.post("findOneAndUpdate", function(n) {
1121
+ Ee.post("findOneAndUpdate", function(n) {
1122
1122
  m(h.USER, n._id, n);
1123
1123
  });
1124
- $e.post("deleteOne", async function() {
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 R.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await B.deleteMany({ user: n }), await ae.deleteOne({ user: n }), await j.deleteOne({ user: n }), await re.deleteOne({ user: n }), await v.deleteOne({ user: n }), await se.deleteOne({ user: n }), await ie.deleteOne({ user: n }), await ue.deleteOne({ user: n }), await ce.deleteOne({ user: n }), await M.deleteOne({ user: n }), await A.deleteOne({ user: n });
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", $e);
1129
- class yn extends b {
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: D.COMPLETED
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 fn = (n) => $.find(n), mn = (n) => $.create({
1355
+ const mn = (n) => $.find(n), hn = (n) => $.create({
1356
1356
  discordId: n
1357
1357
  });
1358
- async function hn(n) {
1358
+ async function wn(n) {
1359
1359
  const e = await $.findOne({ discordId: n }).lean();
1360
- return e || y(await mn(n));
1360
+ return e || y(await hn(n));
1361
1361
  }
1362
- const wn = (n, e) => $.findOneAndUpdate(n, e, {
1362
+ const gn = (n, e) => $.findOneAndUpdate(n, e, {
1363
1363
  upsert: !0,
1364
1364
  returnDocument: "after"
1365
1365
  });
1366
- class gn extends yn {
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 hn(e);
1377
+ return wn(e);
1378
1378
  }
1379
1379
  fetchManyFromDb(e) {
1380
- return fn(e);
1380
+ return mn(e);
1381
1381
  }
1382
1382
  updateInDb(e, t) {
1383
- return wn(e, t);
1383
+ return gn(e, t);
1384
1384
  }
1385
1385
  }
1386
- const Sn = new gn(), js = [
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
- ], bn = new u(
1393
+ ], $n = new u(
1394
1394
  {
1395
1395
  user: {
1396
1396
  type: u.Types.ObjectId,
@@ -1402,53 +1402,53 @@ const Sn = new gn(), js = [
1402
1402
  type: { type: String, required: !0 }
1403
1403
  },
1404
1404
  { minimize: !1 }
1405
- ), z = l?.Reminder || p("Reminder", bn), $n = async (n) => {
1405
+ ), z = l?.Reminder || p("Reminder", $n), En = async (n) => {
1406
1406
  await z.deleteMany(n);
1407
- }, En = async (n, e) => {
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, a) {
1415
- await this.update({ user: e, type: t }, { $set: { date: a } }, { upsert: !0 });
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, a) {
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", a]
1422
+ $add: ["$date", r]
1423
1423
  }
1424
1424
  }
1425
1425
  }
1426
1426
  ]);
1427
1427
  }
1428
1428
  async removeReminder(e, t) {
1429
- await En(e, t), this.invalidate({ user: e, type: t });
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 $n({ _id: { $in: e } }), t.forEach((a) => {
1434
- this.invalidate({ user: a.user, type: a.type });
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 In(n, e = {}) {
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 Dn(n, e, t) {
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 On extends Un {
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 In(e, t);
1468
+ return Dn(e, t);
1469
1469
  }
1470
- updateInDb(e, t, a = { upsert: !1 }) {
1471
- return Dn(e, t, a);
1470
+ updateInDb(e, t, r = { upsert: !1 }) {
1471
+ return On(e, t, r);
1472
1472
  }
1473
1473
  }
1474
- const H = new On();
1475
- class Cn extends b {
1474
+ const H = new Cn();
1475
+ class Rn extends b {
1476
1476
  async isOrnamentIds(e, t = () => !0) {
1477
- const r = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
1478
- return e.every((s) => r.includes(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" : `"${ot(e.ornamentId.split("_").join(" "))}"`;
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 a = 0;
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 >= a + o) {
1526
- a += o;
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 !== Oe.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((a, r) => {
1541
- const s = Oe[r], i = e[s];
1542
- return Math.random() > a || !i || !i.length ? null : dt(i);
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 Rn = new u(
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,26 +1558,26 @@ const Rn = new u(
1558
1558
  strength: Number
1559
1559
  },
1560
1560
  { minimize: !1 }
1561
- ), Ee = l?.Ornaments || p("Ornaments", Rn), vn = async (n, e = {}) => Ee.find(n, e).lean();
1562
- async function Mn(n) {
1563
- const e = await Ee.findOne({ ornamentId: n }).lean();
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 An = (n, e) => Ee.findOneAndUpdate(n, e, {
1566
+ const Bn = (n, e) => Ie.findOneAndUpdate(n, e, {
1567
1567
  returnDocument: "after"
1568
1568
  }).lean();
1569
- class Bn extends Cn {
1569
+ class _n extends Rn {
1570
1570
  constructor() {
1571
1571
  super(3600);
1572
1572
  }
1573
1573
  updateInDb(e, t) {
1574
- return An(e, t);
1574
+ return Bn(e, t);
1575
1575
  }
1576
1576
  fetchFromDb(e) {
1577
- return Mn(e);
1577
+ return An(e);
1578
1578
  }
1579
1579
  fetchManyFromDb(e) {
1580
- return vn(e);
1580
+ return Mn(e);
1581
1581
  }
1582
1582
  getKey(e) {
1583
1583
  return e.ornamentId;
@@ -1586,7 +1586,7 @@ class Bn extends Cn {
1586
1586
  return e;
1587
1587
  }
1588
1588
  }
1589
- const g = new Bn(), _n = new u(
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
- ), P = l?.Panoplies || p("Panoplies", _n), xn = (n) => P.find(n).lean(), qn = async (n) => P.find(n).populate("equipments");
1604
- async function kn(n) {
1605
- const e = await P.findOne({ panoplyId: n }).lean();
1603
+ ), 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 Nn = async (n) => P.findOne(n).populate("equipments");
1609
- class Fn extends b {
1608
+ const Fn = async (n) => K.findOne(n).populate("equipments");
1609
+ class jn extends b {
1610
1610
  getAllPopulated() {
1611
- return qn({});
1611
+ return kn({});
1612
1612
  }
1613
1613
  getPopulated(e) {
1614
- return Nn({ panoplyId: e });
1614
+ return Fn({ panoplyId: e });
1615
1615
  }
1616
1616
  hasPanoply(e, t) {
1617
- const a = N(Object.values(e)), r = t.equipments.filter(
1618
- (s) => a.find((i) => i.entityId === s.entityId)
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 (r === t.equipments.length)
1620
+ if (a === t.equipments.length)
1621
1621
  return t.fullBonus;
1622
- if (r >= t.equipments.length / 2)
1622
+ if (a >= t.equipments.length / 2)
1623
1623
  return t.halfBonus;
1624
1624
  }
1625
1625
  async getPanoplyBonus(e) {
1626
- const t = [], a = await this.getAllPopulated();
1627
- for (const r of a) {
1628
- const s = N(Object.values(e)), i = r.equipments.filter(
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 === r.equipments.length ? t.push([r, "full"]) : i.length >= r.equipments.length / 2 ? t.push([r, "half"]) : i.length >= 1 && t.push([r, null]);
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 jn = async (n, e) => P.findOneAndUpdate(n, e, {
1636
+ const zn = async (n, e) => K.findOneAndUpdate(n, e, {
1637
1637
  returnDocument: "after"
1638
1638
  }).lean();
1639
- class zn extends Fn {
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 jn(e, t);
1650
+ return zn(e, t);
1651
1651
  }
1652
1652
  fetchFromDb(e) {
1653
- return kn(e);
1653
+ return Nn(e);
1654
1654
  }
1655
1655
  fetchManyFromDb(e = {}) {
1656
- return xn(e);
1656
+ return qn(e);
1657
1657
  }
1658
1658
  }
1659
- const U = new zn();
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: r }) => r).includes(e);
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((a) => !!a.shop?.price)).slice(
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 C(e).reduce((a, [r, s]) => {
1699
- const i = t.find(({ entityId: o }) => o === r);
1700
- return i && a.push([i, s]), a;
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 Me(
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 a = (await this.getAll()).filter(this.isEquipment).find(
1714
- ({ entityId: r }) => r === e.entityId
1713
+ const r = (await this.getAll()).filter(this.isEquipment).find(
1714
+ ({ entityId: a }) => a === e.entityId
1715
1715
  );
1716
- if (!a)
1716
+ if (!r)
1717
1717
  throw new Error(`cannot find any equipment: ${e.entityId}`);
1718
- return this.seedEquipment(a, e.seed);
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 a = await U.getAllPopulated();
1730
- for (const r of Be) {
1731
- const s = e[r];
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 r of a) {
1739
- const s = U.hasPanoply(e, r);
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 a = [];
1750
- for (; a.length < e; ) {
1751
- const r = q(t, a, (s) => s.entityId);
1752
- a.push(
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
- lt(r, (s) => s.shop?.odd ?? 0)
1754
+ pt(a, (s) => s.shop?.odd ?? 0)
1755
1755
  )
1756
1756
  );
1757
1757
  }
1758
- return De(a, (r) => r.shop?.price ?? 0);
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,44 +1812,44 @@ class Pn extends b {
1812
1812
  return e.entityId === t.entityId && e.seed === t.seed;
1813
1813
  }
1814
1814
  getEquipmentSlotType(e) {
1815
- return gt[e];
1815
+ return St[e];
1816
1816
  }
1817
1817
  seedEquipment(e, t) {
1818
- const a = pt(t), r = De(
1819
- C(e.characteristics),
1818
+ const r = yt(t), a = Oe(
1819
+ R(e.characteristics),
1820
1820
  ([s]) => s
1821
1821
  );
1822
1822
  return {
1823
1823
  ...e,
1824
1824
  seed: t,
1825
1825
  characteristics: Object.fromEntries(
1826
- r.map(([s, i]) => [
1826
+ a.map(([s, i]) => [
1827
1827
  s,
1828
- Array.isArray(i) ? Y(i[0], i[1] + 1, a) : i
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
- (a) => a && this.isSameEquipment(a, t)
1835
+ (r) => r && this.isSameEquipment(r, t)
1836
1836
  );
1837
1837
  }
1838
1838
  calcILvl(e) {
1839
- return Object.values(e.characteristics).reduce((a, r) => a + r, 0) + e.level;
1839
+ return Object.values(e.characteristics).reduce((r, a) => r + a, 0) + e.level;
1840
1840
  }
1841
1841
  }
1842
- const Kn = new u(
1842
+ const Hn = new u(
1843
1843
  {
1844
1844
  type: {
1845
1845
  type: String,
1846
- enum: St,
1846
+ enum: bt,
1847
1847
  required: !0
1848
1848
  },
1849
1849
  params: { type: u.Types.Mixed }
1850
1850
  },
1851
1851
  { _id: !1 }
1852
- ), Hn = new u(
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: [Kn], default: [] },
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", Hn), Ln = async (n) => await oe.create({
1935
+ ), oe = l?.Entities || p("Entities", Ln), Qn = async (n) => await oe.create({
1936
1936
  ...n
1937
- }), Qn = async (n, e = {}) => oe.find(n, e).lean();
1938
- async function Wn(n) {
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 Gn = (n, e) => oe.findOneAndUpdate(n, e, {
1942
+ const Yn = (n, e) => oe.findOneAndUpdate(n, e, {
1943
1943
  returnDocument: "after"
1944
1944
  }).lean();
1945
- class Yn extends Pn {
1945
+ class Xn extends Pn {
1946
1946
  constructor() {
1947
1947
  super(3600);
1948
1948
  }
1949
1949
  createInDb(e) {
1950
- return Ln(e);
1950
+ return Qn(e);
1951
1951
  }
1952
1952
  updateInDb(e, t) {
1953
- return Gn(e, t);
1953
+ return Yn(e, t);
1954
1954
  }
1955
1955
  fetchFromDb(e) {
1956
- return Wn(e);
1956
+ return Gn(e);
1957
1957
  }
1958
1958
  fetchManyFromDb(e) {
1959
- return Qn(e);
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 Yn(), Xn = (n, e, t) => _.create({
1968
+ const d = new Xn(), Vn = (n, e, t) => _.create({
1969
1969
  user: n,
1970
1970
  crew: e,
1971
1971
  permission: t
1972
- }), Vn = async (n) => {
1972
+ }), Jn = async (n) => {
1973
1973
  await _.deleteOne({ user: n });
1974
1974
  };
1975
- class Jn extends b {
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, a) {
1991
- await Xn(e, t, a), this.invalidate(t);
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 Vn(e), this.invalidate(e), this.invalidate(t);
1994
+ await Jn(e), this.invalidate(e), this.invalidate(t);
1995
1995
  }
1996
1996
  async getAllUserIdsFromCrew(e) {
1997
- const t = e.toString(), a = this.cache.get(t);
1998
- if (a)
1999
- return a.map(({ user: s }) => s);
2000
- const r = await this.getMany({ crew: e });
2001
- return this.cache.set(t, r), r.map(({ user: s }) => s);
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 Zn = (n) => _.find(n).lean(), ea = (n) => _.findOne({ user: n }).lean(), ta = (n, e) => _.findOneAndUpdate({ user: n }, e).lean();
2005
- class na extends Jn {
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 ea(e);
2016
+ return tr(e);
2017
2017
  }
2018
2018
  fetchManyFromDb(e) {
2019
- return Zn(e);
2019
+ return er(e);
2020
2020
  }
2021
2021
  updateInDb(e, t) {
2022
- return ta(e, t);
2022
+ return nr(e, t);
2023
2023
  }
2024
2024
  }
2025
- const aa = new na();
2026
- class ra extends f {
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 sa = async (n) => await Z.create({
2036
+ const ir = async (n) => await Z.create({
2037
2037
  user: n
2038
2038
  });
2039
- async function ia(n) {
2039
+ async function ur(n) {
2040
2040
  const e = await Z.findOne({ user: n }).lean();
2041
- return e || y(await sa(n));
2041
+ return e || y(await ir(n));
2042
2042
  }
2043
- const ua = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
2043
+ const cr = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
2044
2044
  upsert: !0,
2045
2045
  returnDocument: "after"
2046
2046
  }).lean();
2047
- class ca extends ra {
2047
+ class or extends sr {
2048
2048
  constructor() {
2049
2049
  super(300);
2050
2050
  }
2051
2051
  fetchFromDb(e) {
2052
- return ia(e);
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 ua(e, t);
2061
+ return cr(e, t);
2062
2062
  }
2063
2063
  }
2064
- const pe = new ca();
2065
- class oa extends f {
2064
+ const ye = new or();
2065
+ class dr extends f {
2066
2066
  getPanoplyEffectiveBonus(e, t) {
2067
- const a = N(
2067
+ const r = N(
2068
2068
  Object.values(e.equippedItems)
2069
- ), r = t.equipments.filter(
2070
- (s) => a.find((i) => i.entityId === s.entityId)
2069
+ ), a = t.equipments.filter(
2070
+ (s) => r.find((i) => i.entityId === s.entityId)
2071
2071
  ).length;
2072
- if (r === t.equipments.length)
2072
+ if (a === t.equipments.length)
2073
2073
  return t.fullBonus;
2074
- if (r >= t.equipments.length / 2)
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 a = await U.getAllPopulated();
2087
- for (const r of Be) {
2088
- const s = e.equippedItems?.[r];
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 r of a) {
2099
- const s = this.getPanoplyEffectiveBonus(e, r);
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
- maxCraftQuantity(e, t) {
2109
- let a = 1 / 0;
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) {
2124
- return C(t).reduce(
2125
- (a, [r, s]) => a && (e.itemList[r] ?? 0) >= (s ?? 0),
2108
+ async hasInventoryRequirements(e, t) {
2109
+ const r = await this.get(e);
2110
+ return R(t).reduce(
2111
+ (a, [s, i]) => a && (r.itemList[s] ?? 0) >= (i ?? 0),
2126
2112
  !0
2127
2113
  );
2128
2114
  }
2129
- hasEnoughEntity(e, t, a) {
2130
- return (e.itemList[a] ?? 0) >= t;
2115
+ async hasEnoughEntity(e, t, r) {
2116
+ return ((await this.get(e)).itemList[r] ?? 0) >= t;
2131
2117
  }
2132
- getItemList(e) {
2133
- return Object.fromEntries(e.itemList);
2118
+ async getItemList(e) {
2119
+ return (await this.get(e)).itemList;
2134
2120
  }
2135
2121
  async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
2136
- const a = await this.get(e), s = (await U.getPanoplyBonus(
2137
- a.equippedItems
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 U.getPanoplyBonus(e.equippedItems)).find(
2151
- ([a, r]) => a.panoplyId === "marine" && r !== null
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 t && t[1] === "full" ? 10 : t && t[1] === "half" ? 20 : 1 / 0;
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 U.getPanoplyBonus(t.equippedItems)).find(
2158
- ([r, s]) => r.panoplyId === "revolutionary" && s !== null
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, a) {
2150
+ async addItem(e, t, r) {
2171
2151
  await this.update(e, {
2172
- $inc: { [`itemList.${t}`]: a }
2173
- }), await pe.addEntities(e, [t]);
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(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
2158
+ Object.entries(t).filter(([, r]) => (r ?? 0) > 0).map(([r, a]) => [`itemList.${r}`, a])
2179
2159
  )
2180
- }), await pe.addEntities(
2160
+ }), await ye.addEntities(
2181
2161
  e,
2182
- C(t).filter(([, a]) => a > 0).map(([a]) => a)
2162
+ R(t).filter(([, r]) => r > 0).map(([r]) => r)
2183
2163
  );
2184
2164
  }
2185
- async removeItem(e, t, a) {
2186
- a !== 0 && await this.update(e, [
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}`, -a] }, 0]
2170
+ $max: [{ $add: [`$itemList.${t}`, -r] }, 0]
2191
2171
  }
2192
2172
  }
2193
2173
  }
2194
2174
  ]);
2195
2175
  }
2196
- async removeEquipment(e, t, a) {
2176
+ async removeEquipment(e, t, r) {
2197
2177
  await this.update(e, {
2198
2178
  $pull: {
2199
2179
  equipmentList: {
2200
- id: t,
2201
- seed: a
2180
+ entityId: t,
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 pe.addEntities(
2192
+ }), await ye.addEntities(
2213
2193
  e,
2214
- t.map((a) => a.entityId)
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 a = await this.get(e);
2228
- a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
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 a = await I.getMaxHp(e), r = Object.fromEntries(
2232
- C(t).map(([s, i]) => [
2211
+ const r = await U.getMaxHp(e), a = Object.fromEntries(
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: r
2239
- }), await I.updateHp(e, a);
2218
+ $set: a
2219
+ }), await U.updateHp(e, r);
2240
2220
  }
2241
2221
  async unequip(e, t) {
2242
- const a = await I.getMaxHp(e);
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 I.updateHp(e, a);
2248
- }
2249
- async craftItem(e, t, a, r, s) {
2250
- for (const { entityId: c, size: w } of t)
2251
- await this.removeItem(e, c, w * r);
2252
- const { entityId: i, size: o } = a;
2253
- await d.isEntityId(i, d.isEquipment) ? await this.addEquipments(e, [{ entityId: i, seed: s }]) : await d.isEntityId(i, d.isItem) && await this.addItem(e, i, o * r);
2254
- }
2255
- async dismantleEntity(e, t, a, r, s) {
2256
- d.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : d.isItem(t) && await this.removeItem(e, t.entityId, r);
2257
- for (const { entityId: i, quantity: o } of a)
2258
- await d.isEntityId(i, d.isItem) && await this.addItem(e, i, r * o);
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, a, r) {
2262
- await this.removeItem(e, t, r * 4), await this.removeItem(e, "enchanted_stone", r), await this.addItem(e, a, r);
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 da = (n) => te.create({
2248
+ const lr = (n) => te.create({
2269
2249
  user: n
2270
2250
  });
2271
- async function la(n) {
2251
+ async function pr(n) {
2272
2252
  const e = await te.findOne({ user: n }).lean();
2273
- return e || y(await da(n));
2253
+ return e || y(await lr(n));
2274
2254
  }
2275
- const pa = (n, e) => te.findOneAndUpdate({ user: n }, e, {
2255
+ const yr = (n, e) => te.findOneAndUpdate({ user: n }, e, {
2276
2256
  upsert: !0,
2277
2257
  returnDocument: "after"
2278
2258
  }).lean();
2279
- class ya extends oa {
2259
+ class fr extends dr {
2280
2260
  constructor() {
2281
2261
  super(300);
2282
2262
  }
2283
2263
  fetchFromDb(e) {
2284
- return la(e);
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 pa(e, t);
2273
+ return yr(e, t);
2294
2274
  }
2295
2275
  }
2296
- const S = new ya();
2297
- class fa extends f {
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 Me(
2303
- bt.map((a) => [
2304
- a,
2305
- $t(e[a]) + t[a]
2282
+ return Ae(
2283
+ $t.map((r) => [
2284
+ r,
2285
+ Et(e[r]) + t[r]
2306
2286
  ])
2307
2287
  );
2308
2288
  }
@@ -2310,53 +2290,91 @@ class fa extends f {
2310
2290
  const t = await this.get(e);
2311
2291
  return Date.now() - t.xp.lastMessageWithXp.getTime() > 60 * 1e3;
2312
2292
  }
2293
+ async getAllWithExpiredBuffs() {
2294
+ const e = /* @__PURE__ */ new Date();
2295
+ return this.getMany({
2296
+ $or: [
2297
+ { "xp.boost": { $lt: e } },
2298
+ {
2299
+ "buffs.cooldown.casino": {
2300
+ $elemMatch: { expireAt: { $lt: e } }
2301
+ }
2302
+ },
2303
+ {
2304
+ "buffs.cooldown.work": {
2305
+ $elemMatch: { expireAt: { $lt: e } }
2306
+ }
2307
+ },
2308
+ {
2309
+ "buffs.berry.work": {
2310
+ $elemMatch: { expireAt: { $lt: e } }
2311
+ }
2312
+ },
2313
+ {
2314
+ "buffs.berry.global": {
2315
+ $elemMatch: { expireAt: { $lt: e } }
2316
+ }
2317
+ },
2318
+ {
2319
+ "buffs.drop.work": {
2320
+ $elemMatch: { expireAt: { $lt: e } }
2321
+ }
2322
+ },
2323
+ {
2324
+ "buffs.xp.global": {
2325
+ $elemMatch: { expireAt: { $lt: e } }
2326
+ }
2327
+ }
2328
+ ]
2329
+ });
2330
+ }
2313
2331
  async calcXpBoost(e) {
2314
- const t = await this.get(e), { boost: a } = t.xp, r = a !== null && Date.now() < a.getTime() ? 0.2 : 0, s = Math.max(
2332
+ const t = await this.get(e), { boost: r } = t.xp, a = r !== null && Date.now() < r.getTime() ? 0.2 : 0, s = Math.max(
2315
2333
  t.premium ? 0.5 : 0,
2316
2334
  t.booster ? 0.25 : 0
2317
2335
  );
2318
- return r + s + t.buffs.xp.global.reduce(
2319
- (i, { expireAt: o, startAt: c, multiplier: w }) => c && c > /* @__PURE__ */ new Date() || o && L(o) ? i : i + w,
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,
2320
2338
  0
2321
2339
  );
2322
2340
  }
2323
2341
  calcMessageXp(e) {
2324
- const t = e.trim().length, a = 2;
2325
- return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
2342
+ const t = e.trim().length, r = 2;
2343
+ return t < 10 ? 10 * r : t > 300 ? 300 * r : t * r;
2326
2344
  }
2327
2345
  async getXpDeathPenalties(e) {
2328
- const t = await this.get(e), a = Et(t.xp.amount);
2329
- return a <= 10 ? 5e3 : a <= 20 ? 1e4 : a <= 30 ? 2e4 : a <= 40 ? 3e4 : a <= 50 ? 5e4 : a <= 60 ? 75e3 : a <= 70 ? 15e4 : a <= 80 ? 25e4 : a <= 90 ? 4e5 : a <= 100 ? 75e4 : 14e6;
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;
2330
2348
  }
2331
- async calcXp(e, t, a) {
2332
- return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * a);
2349
+ async calcXp(e, t, r) {
2350
+ return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * r);
2333
2351
  }
2334
- async calcBerry(e, t, a) {
2352
+ async calcBerry(e, t, r) {
2335
2353
  if (t <= 0) return t;
2336
- const r = a ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
2337
- return Math.ceil(t * (r || 1));
2354
+ const a = r ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
2355
+ return Math.ceil(t * (a || 1));
2338
2356
  }
2339
- async calcBuffMultiplier(e, t, a) {
2340
- return (await this.get(e)).buffs[t][a].reduce(
2341
- (i, { expireAt: o, startAt: c, multiplier: w }) => i + (/* @__PURE__ */ new Date() >= (c ?? /* @__PURE__ */ new Date()) && (!o || !L(o)) ? w : 0),
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),
2342
2360
  1
2343
2361
  );
2344
2362
  }
2345
2363
  async getMaxHp(e) {
2346
- const t = await this.get(e), a = await S.get(e), { vitality: r } = this.getTotalCharacteristics(t), s = await S.getUserEquipmentsCharacteristics(
2347
- a
2364
+ const t = await this.get(e), r = await w.get(e), { vitality: a } = this.getTotalCharacteristics(t), s = await w.getUserEquipmentsCharacteristics(
2365
+ r
2348
2366
  );
2349
- return (r + s.vitality) * Ut + It;
2367
+ return (a + s.vitality) * Ut + Dt;
2350
2368
  }
2351
2369
  async getHpRatio(e) {
2352
- const t = await this.get(e), a = await this.getMaxHp(e);
2353
- return Math.min(t.hp / a, 1);
2370
+ const t = await this.get(e), r = await this.getMaxHp(e);
2371
+ return Math.min(t.hp / r, 1);
2354
2372
  }
2355
2373
  async hasCharacteristicRequirement(e, t) {
2356
- const a = await this.get(e), r = await S.get(e), s = await S.getUserEquipmentsCharacteristics(
2357
- r
2374
+ const r = await this.get(e), a = await w.get(e), s = await w.getUserEquipmentsCharacteristics(
2375
+ a
2358
2376
  ), i = F(
2359
- this.getTotalCharacteristics(a),
2377
+ this.getTotalCharacteristics(r),
2360
2378
  s,
2361
2379
  (o, c) => o + c
2362
2380
  );
@@ -2375,7 +2393,7 @@ class fa extends f {
2375
2393
  }
2376
2394
  }
2377
2395
  async getGlobalRank(e) {
2378
- return (await R.aggregate([
2396
+ return (await O.aggregate([
2379
2397
  {
2380
2398
  $setWindowFields: {
2381
2399
  sortBy: { "xp.amount": -1 },
@@ -2384,12 +2402,12 @@ class fa extends f {
2384
2402
  }
2385
2403
  }
2386
2404
  },
2387
- { $match: { _id: e } },
2405
+ { $match: { user: e } },
2388
2406
  { $project: { rank: 1 } }
2389
2407
  ]))[0];
2390
2408
  }
2391
2409
  async getBerryRank(e) {
2392
- return (await R.aggregate([
2410
+ return (await O.aggregate([
2393
2411
  {
2394
2412
  $setWindowFields: {
2395
2413
  sortBy: { berry: -1 },
@@ -2398,12 +2416,12 @@ class fa extends f {
2398
2416
  }
2399
2417
  }
2400
2418
  },
2401
- { $match: { _id: e } },
2419
+ { $match: { user: e } },
2402
2420
  { $project: { rank: 1 } }
2403
2421
  ]))[0];
2404
2422
  }
2405
2423
  async hasMalusBuff(e) {
2406
- const t = await this.get(e), a = [
2424
+ const t = await this.get(e), r = [
2407
2425
  ...t.buffs.xp.global,
2408
2426
  ...t.buffs.berry.global,
2409
2427
  ...t.buffs.berry.work,
@@ -2411,8 +2429,8 @@ class fa extends f {
2411
2429
  ...t.buffs.cooldown.casino,
2412
2430
  ...t.buffs.drop.work
2413
2431
  ];
2414
- for (const { multiplier: r, startAt: s, expireAt: i } of a)
2415
- if (r < 0 && (!i || !L(i)) && (s ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
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())
2416
2434
  return !0;
2417
2435
  return !1;
2418
2436
  }
@@ -2441,7 +2459,7 @@ class fa extends f {
2441
2459
  }
2442
2460
  async updateBoost(e, t) {
2443
2461
  const {
2444
- xp: { boost: a }
2462
+ xp: { boost: r }
2445
2463
  } = await this.update(e, [
2446
2464
  {
2447
2465
  $set: {
@@ -2460,15 +2478,15 @@ class fa extends f {
2460
2478
  }
2461
2479
  }
2462
2480
  ]);
2463
- return a;
2481
+ return r;
2464
2482
  }
2465
2483
  async updateBuff(e, t) {
2466
2484
  if (Array.isArray(t)) {
2467
- for (const r of t)
2468
- await this.updateBuff(e, r);
2485
+ for (const a of t)
2486
+ await this.updateBuff(e, a);
2469
2487
  return;
2470
2488
  }
2471
- const a = Tt(t);
2489
+ const r = Tt(t);
2472
2490
  await this.update(e, [
2473
2491
  {
2474
2492
  $set: {
@@ -2493,10 +2511,10 @@ class fa extends f {
2493
2511
  then: {
2494
2512
  multiplier: t.multiplier,
2495
2513
  origin: t.origin,
2496
- expireAt: a.expireAt ? {
2514
+ expireAt: r.expireAt ? {
2497
2515
  $cond: {
2498
2516
  if: { $lt: ["$$buff.expireAt", /* @__PURE__ */ new Date()] },
2499
- then: a.expireAt,
2517
+ then: r.expireAt,
2500
2518
  else: {
2501
2519
  $add: [
2502
2520
  "$$buff.expireAt",
@@ -2549,7 +2567,7 @@ class fa extends f {
2549
2567
  },
2550
2568
  then: `$buffs.${t.target}`,
2551
2569
  else: {
2552
- $concatArrays: [`$buffs.${t.target}`, [{ ...a }]]
2570
+ $concatArrays: [`$buffs.${t.target}`, [{ ...r }]]
2553
2571
  }
2554
2572
  }
2555
2573
  }
@@ -2562,21 +2580,21 @@ class fa extends f {
2562
2580
  $pull: { [`buffs.${t.target}`]: { origin: t.origin } }
2563
2581
  });
2564
2582
  }
2565
- async updatePanoplyBuff(e, t, a, r) {
2566
- const s = await d.fromDBToEquipableEquipment(t), i = N(Object.values(a)), c = (await U.getAllPopulated()).find(
2567
- (T) => T.panoplyId === s.panoply
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
2568
2586
  );
2569
2587
  if (!c)
2570
2588
  return;
2571
- const w = c.equipments.filter(
2572
- (T) => (i.find((K) => T.entityId === K.entityId) || !r && s.entityId === T.entityId) && (r ? s.entityId !== T.entityId : !0)
2573
- ).length, x = w === c.equipments.length ? c.fullBonus : w >= c.equipments.length / 2 ? c.halfBonus : void 0;
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;
2574
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);
2575
2593
  }
2576
2594
  async gainHp(e, t) {
2577
- const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
2595
+ const r = await this.get(e), s = await this.getMaxHp(e) - r.hp;
2578
2596
  await this.update(e, {
2579
- $set: { hp: a.hp + Math.floor(Math.min(t, s)) }
2597
+ $set: { hp: r.hp + Math.floor(Math.min(t, s)) }
2580
2598
  });
2581
2599
  }
2582
2600
  async loseHp(e, t) {
@@ -2587,14 +2605,14 @@ class fa extends f {
2587
2605
  ]);
2588
2606
  }
2589
2607
  async updateHp(e, t) {
2590
- const a = await this.getMaxHp(e);
2608
+ const r = await this.getMaxHp(e);
2591
2609
  await this.update(e, [
2592
2610
  {
2593
2611
  $set: {
2594
2612
  hp: {
2595
2613
  $round: [
2596
2614
  {
2597
- $multiply: [{ $divide: ["$hp", t] }, a]
2615
+ $multiply: [{ $divide: ["$hp", t] }, r]
2598
2616
  },
2599
2617
  0
2600
2618
  ]
@@ -2604,23 +2622,23 @@ class fa extends f {
2604
2622
  ]);
2605
2623
  }
2606
2624
  async addCharacteristics(e, t) {
2607
- const a = await this.getMaxHp(e), r = Object.fromEntries(
2625
+ const r = await this.getMaxHp(e), a = Object.fromEntries(
2608
2626
  Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`characteristics.${s}`, i])
2609
2627
  );
2610
2628
  await this.update(e, {
2611
- $inc: r
2612
- }), await this.updateHp(e, a);
2629
+ $inc: a
2630
+ }), await this.updateHp(e, r);
2613
2631
  }
2614
2632
  async addScrollCharacteristic(e, t) {
2615
- const a = await this.getMaxHp(e), r = Object.fromEntries(
2633
+ const r = await this.getMaxHp(e), a = Object.fromEntries(
2616
2634
  Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`scrolls.${s}`, i])
2617
2635
  );
2618
2636
  await this.update(e, {
2619
- $inc: r
2620
- }), await this.updateHp(e, a);
2637
+ $inc: a
2638
+ }), await this.updateHp(e, r);
2621
2639
  }
2622
2640
  async resetCharacteristics(e, t) {
2623
- const a = await this.getMaxHp(e), r = {
2641
+ const r = await this.getMaxHp(e), a = {
2624
2642
  vitality: 0,
2625
2643
  strength: 0,
2626
2644
  agility: 0,
@@ -2630,12 +2648,12 @@ class fa extends f {
2630
2648
  };
2631
2649
  t ? await this.update(e, {
2632
2650
  $set: {
2633
- characteristics: r,
2651
+ characteristics: a,
2634
2652
  "resetCharacteristics.free": !1
2635
2653
  }
2636
2654
  }) : await this.update(e, {
2637
2655
  $set: {
2638
- characteristics: r,
2656
+ characteristics: a,
2639
2657
  "resetCharacteristics.nextAvailable": new Date(
2640
2658
  Date.now() + 720 * 60 * 60 * 1e3
2641
2659
  )
@@ -2643,7 +2661,7 @@ class fa extends f {
2643
2661
  $inc: {
2644
2662
  berry: -1e8
2645
2663
  }
2646
- }), await this.updateHp(e, a);
2664
+ }), await this.updateHp(e, r);
2647
2665
  }
2648
2666
  async resetMinutesInVoiceToday(e) {
2649
2667
  await this.update(e, { $set: { "xp.voice.minutesInVoiceToday": 0 } });
@@ -2674,34 +2692,34 @@ class fa extends f {
2674
2692
  });
2675
2693
  }
2676
2694
  async updateUserXp(e, t) {
2677
- const a = await aa.get(e), r = a?.percent ?? 0, s = await this.calcXp(
2695
+ const r = await ar.get(e), a = r?.percent ?? 0, s = await this.calcXp(
2678
2696
  e,
2679
2697
  t,
2680
- (1 - r) * await this.getHpRatio(e)
2698
+ (1 - a) * await this.getHpRatio(e)
2681
2699
  );
2682
2700
  let i = 0;
2683
- return await this.addXp(e, s), a && (i = await Ce.calcXp(
2684
- a.crew,
2685
- t * r
2686
- ), await Ce.addXp(a.crew, i)), { userXp: s, crewXp: i };
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 };
2687
2705
  }
2688
- async updateUserBerry(e, t, a) {
2689
- const r = await this.calcBerry(e, t, a);
2690
- return await this.addBerry(e, r), r;
2706
+ async updateUserBerry(e, t, r) {
2707
+ const a = await this.calcBerry(e, t, r);
2708
+ return await this.addBerry(e, a), a;
2691
2709
  }
2692
2710
  }
2693
- const ma = async (n) => await R.create({
2711
+ const hr = (n) => O.find(n).lean(), wr = async (n) => await O.create({
2694
2712
  user: n
2695
2713
  });
2696
- async function ha(n) {
2697
- const e = await R.findOne({ user: n }).lean();
2698
- return e || y(await ma(n));
2714
+ async function gr(n) {
2715
+ const e = await O.findOne({ user: n }).lean();
2716
+ return e || y(await wr(n));
2699
2717
  }
2700
- const wa = (n, e) => R.findOneAndUpdate({ user: n }, e, {
2718
+ const Sr = (n, e) => O.findOneAndUpdate({ user: n }, e, {
2701
2719
  returnDocument: "after",
2702
2720
  upsert: !0
2703
2721
  }).lean();
2704
- class ga extends fa {
2722
+ class br extends mr {
2705
2723
  constructor() {
2706
2724
  super(300);
2707
2725
  }
@@ -2712,54 +2730,47 @@ class ga extends fa {
2712
2730
  return e;
2713
2731
  }
2714
2732
  fetchFromDb(e) {
2715
- return ha(e);
2733
+ return gr(e);
2734
+ }
2735
+ fetchManyFromDb(e) {
2736
+ return hr(e);
2716
2737
  }
2717
2738
  updateInDb(e, t) {
2718
- return wa(e, t);
2739
+ return Sr(e, t);
2719
2740
  }
2720
2741
  }
2721
- const I = new ga();
2722
- class Sa extends b {
2742
+ const U = new br();
2743
+ class $r extends b {
2723
2744
  async updateSendDailyQuest(e, t) {
2724
- await this.update(
2725
- { discordId: e },
2726
- { $set: { sendDailyQuest: t } }
2727
- );
2745
+ await this.update(e, { $set: { sendDailyQuest: t } });
2728
2746
  }
2729
2747
  async updateSendDailyReport(e, t) {
2730
- await this.update(
2731
- { discordId: e },
2732
- { $set: { sendDailyReport: t } }
2733
- );
2748
+ await this.update(e, { $set: { sendDailyReport: t } });
2734
2749
  }
2735
2750
  async updateInventorySort(e, t) {
2736
- await this.update({ discordId: e }, { $set: { "sort.inventory": t } });
2751
+ await this.update(e, { $set: { "sort.inventory": t } });
2737
2752
  }
2738
- async updateReminderSettings(e, t, a) {
2739
- await this.update(
2740
- { discordId: e },
2741
- { $set: { [`reminder.${t}`]: a } }
2742
- );
2753
+ async updateReminderSettings(e, t, r) {
2754
+ await this.update(e, { $set: { [`reminder.${t}`]: r } });
2743
2755
  }
2744
2756
  getUsersWithDailyReportEnable() {
2745
2757
  return this.getMany({
2746
- "settings.sendDailyReport": !0,
2747
- faction: { $ne: "citizen" }
2758
+ sendDailyReport: !0
2748
2759
  });
2749
2760
  }
2750
2761
  }
2751
- const ba = (n) => j.find(n).lean(), $a = async (n) => await j.create({
2762
+ const Er = (n) => j.find(n).lean(), Ir = async (n) => await j.create({
2752
2763
  user: n
2753
2764
  });
2754
- async function Ea(n) {
2765
+ async function Ur(n) {
2755
2766
  const e = await j.findOne({ user: n }).lean();
2756
- return e || y(await $a(n));
2767
+ return e || y(await Ir(n));
2757
2768
  }
2758
- const Ua = (n, e) => j.findOneAndUpdate({ user: n }, e, {
2769
+ const Dr = (n, e) => j.findOneAndUpdate({ user: n }, e, {
2759
2770
  returnDocument: "after",
2760
2771
  upsert: !0
2761
2772
  }).lean();
2762
- class Ia extends Sa {
2773
+ class Tr extends $r {
2763
2774
  constructor() {
2764
2775
  super(3600);
2765
2776
  }
@@ -2770,17 +2781,17 @@ class Ia extends Sa {
2770
2781
  return e.user;
2771
2782
  }
2772
2783
  fetchFromDb(e) {
2773
- return Ea(e);
2784
+ return Ur(e);
2774
2785
  }
2775
2786
  fetchManyFromDb(e) {
2776
- return ba(e);
2787
+ return Er(e);
2777
2788
  }
2778
2789
  updateInDb(e, t) {
2779
- return Ua(e, t);
2790
+ return Dr(e, t);
2780
2791
  }
2781
2792
  }
2782
- const Re = new Ia();
2783
- class Ta extends f {
2793
+ const ve = new Tr();
2794
+ class Or extends f {
2784
2795
  async getCommandCooldown(e, t) {
2785
2796
  return (await this.get(e)).commands[t];
2786
2797
  }
@@ -2815,14 +2826,14 @@ class Ta extends f {
2815
2826
  -1 * t * 3600 * 1e3
2816
2827
  );
2817
2828
  }
2818
- async startRaidCooldown(e, t, a) {
2819
- const { reminder: r } = await Re.get(e);
2829
+ async startRaidCooldown(e, t, r) {
2830
+ const { reminder: a } = await ve.get(e);
2820
2831
  await this.update(e, {
2821
- $set: { [`raid.${t}`]: new Date(Date.now() + a) }
2822
- }), r.raid[t] && await H.addReminder(
2832
+ $set: { [`raid.${t}`]: new Date(Date.now() + r) }
2833
+ }), a.raid[t] && await H.addReminder(
2823
2834
  e,
2824
2835
  `raid/${t}`,
2825
- new Date(Date.now() + a)
2836
+ new Date(Date.now() + r)
2826
2837
  );
2827
2838
  }
2828
2839
  async lockUserCommand(e) {
@@ -2830,33 +2841,33 @@ class Ta extends f {
2830
2841
  $set: {
2831
2842
  lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
2832
2843
  }
2833
- }), await I.gainHp(e, 1);
2844
+ }), await U.gainHp(e, 1);
2834
2845
  }
2835
- async useCommand(e, t, a) {
2836
- const { reminder: r } = await Re.get(e);
2846
+ async useCommand(e, t, r) {
2847
+ const { reminder: a } = await ve.get(e);
2837
2848
  await this.update(e, {
2838
2849
  $set: {
2839
- [`commands.${t}`]: new Date(Date.now() + a)
2850
+ [`commands.${t}`]: new Date(Date.now() + r)
2840
2851
  }
2841
- }), r.commands[t] && await H.addReminder(
2852
+ }), a.commands[t] && await H.addReminder(
2842
2853
  e,
2843
2854
  `commands/${t}`,
2844
- new Date(Date.now() + a)
2855
+ new Date(Date.now() + r)
2845
2856
  );
2846
2857
  }
2847
2858
  }
2848
- const Da = async (n) => await V.create({
2859
+ const Cr = async (n) => await V.create({
2849
2860
  user: n
2850
2861
  });
2851
- async function Oa(n) {
2862
+ async function Rr(n) {
2852
2863
  const e = await V.findOne({ user: n }).lean();
2853
- return e || y(await Da(n));
2864
+ return e || y(await Cr(n));
2854
2865
  }
2855
- const Ca = (n, e) => V.findOneAndUpdate({ user: n }, e, {
2866
+ const vr = (n, e) => V.findOneAndUpdate({ user: n }, e, {
2856
2867
  returnDocument: "after",
2857
2868
  upsert: !0
2858
2869
  }).lean();
2859
- class Ra extends Ta {
2870
+ class Mr extends Or {
2860
2871
  constructor() {
2861
2872
  super(300);
2862
2873
  }
@@ -2867,14 +2878,14 @@ class Ra extends Ta {
2867
2878
  return e.user;
2868
2879
  }
2869
2880
  fetchFromDb(e) {
2870
- return Oa(e);
2881
+ return Rr(e);
2871
2882
  }
2872
2883
  updateInDb(e, t) {
2873
- return Ca(e, t);
2884
+ return vr(e, t);
2874
2885
  }
2875
2886
  }
2876
- const va = new Ra();
2877
- class Ma extends f {
2887
+ const Ar = new Mr();
2888
+ class Br extends f {
2878
2889
  async unlockTitle(e, t) {
2879
2890
  await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
2880
2891
  }
@@ -2907,9 +2918,9 @@ class Ma extends f {
2907
2918
  $set: { selectedBackground: t }
2908
2919
  });
2909
2920
  }
2910
- async unlockBadge(e, t, a) {
2921
+ async unlockBadge(e, t, r) {
2911
2922
  t.isProgressive ? await this.update(e, {
2912
- $addToSet: { unlockedBadges: `${t.id}_${a}` }
2923
+ $addToSet: { unlockedBadges: `${t.id}_${r}` }
2913
2924
  }) : await this.update(e, {
2914
2925
  $addToSet: { unlockedBadges: t.id }
2915
2926
  });
@@ -2943,18 +2954,18 @@ class Ma extends f {
2943
2954
  });
2944
2955
  }
2945
2956
  }
2946
- const Aa = async (n) => await ne.create({
2957
+ const _r = async (n) => await ne.create({
2947
2958
  user: n
2948
2959
  });
2949
- async function Ba(n) {
2960
+ async function xr(n) {
2950
2961
  const e = await ne.findOne({ user: n }).lean();
2951
- return e || y(await Aa(n));
2962
+ return e || y(await _r(n));
2952
2963
  }
2953
- const _a = async (n, e) => ne.findOneAndUpdate({ user: n }, e, {
2964
+ const qr = async (n, e) => ne.findOneAndUpdate({ user: n }, e, {
2954
2965
  upsert: !0,
2955
2966
  returnDocument: "after"
2956
2967
  }).lean();
2957
- class xa extends Ma {
2968
+ class kr extends Br {
2958
2969
  constructor() {
2959
2970
  super(300);
2960
2971
  }
@@ -2965,14 +2976,14 @@ class xa extends Ma {
2965
2976
  return e;
2966
2977
  }
2967
2978
  fetchFromDb(e) {
2968
- return Ba(e);
2979
+ return xr(e);
2969
2980
  }
2970
2981
  updateInDb(e, t) {
2971
- return _a(e, t);
2982
+ return qr(e, t);
2972
2983
  }
2973
2984
  }
2974
- const G = new xa();
2975
- class qa extends b {
2985
+ const G = new kr();
2986
+ class Nr extends b {
2976
2987
  async getStatus(e, t) {
2977
2988
  return (await this.get({ user: e, questId: t })).status;
2978
2989
  }
@@ -2980,18 +2991,18 @@ class qa extends b {
2980
2991
  return await this.getStatus(e, t) === "COMPLETED";
2981
2992
  }
2982
2993
  async isStreaking(e, t) {
2983
- const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
2984
- return !!a && ye(k(), a);
2994
+ const { lastCompletionDate: r } = await this.get({ user: e, questId: t });
2995
+ return !!r && fe(k(), r);
2985
2996
  }
2986
2997
  async getStreakMultiplier(e, t) {
2987
- const a = await this.get({ user: e, questId: t });
2988
- return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
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;
2989
3000
  }
2990
3001
  async completeQuest(e, t = !1) {
2991
- const a = k();
2992
- a.setHours(0, 0, 0, 0);
2993
- const r = /* @__PURE__ */ new Date();
2994
- return r.setHours(0, 0, 0, 0), this.update(
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(
2995
3006
  e,
2996
3007
  [
2997
3008
  {
@@ -3001,8 +3012,8 @@ class qa extends b {
3001
3012
  $cond: {
3002
3013
  if: {
3003
3014
  $and: [
3004
- { $gte: ["$lastCompletionDate", a] },
3005
- { $lt: ["$lastCompletionDate", r] }
3015
+ { $gte: ["$lastCompletionDate", r] },
3016
+ { $lt: ["$lastCompletionDate", a] }
3006
3017
  ]
3007
3018
  },
3008
3019
  then: { $add: [{ $ifNull: ["$streak", 0] }, 1] },
@@ -3011,7 +3022,7 @@ class qa extends b {
3011
3022
  }
3012
3023
  } : {},
3013
3024
  lastCompletionDate: /* @__PURE__ */ new Date(),
3014
- status: D.COMPLETED
3025
+ status: T.COMPLETED
3015
3026
  }
3016
3027
  }
3017
3028
  ],
@@ -3019,24 +3030,24 @@ class qa extends b {
3019
3030
  );
3020
3031
  }
3021
3032
  }
3022
- function ka(n) {
3033
+ function Fr(n) {
3023
3034
  return B.find(n).lean();
3024
3035
  }
3025
- const Na = async (n) => await B.create({
3036
+ const jr = async (n) => await B.create({
3026
3037
  ...n
3027
3038
  });
3028
- async function Fa(n) {
3039
+ async function zr(n) {
3029
3040
  const e = await B.findOne(n).lean();
3030
- return e || y(await Na(n));
3041
+ return e || y(await jr(n));
3031
3042
  }
3032
- function ja(n, e, t) {
3043
+ function Kr(n, e, t) {
3033
3044
  return B.findOneAndUpdate(n, e, {
3034
3045
  upsert: !0,
3035
3046
  ...t,
3036
3047
  returnDocument: "after"
3037
3048
  }).lean();
3038
3049
  }
3039
- class za extends qa {
3050
+ class Pr extends Nr {
3040
3051
  constructor() {
3041
3052
  super(3600);
3042
3053
  }
@@ -3050,32 +3061,32 @@ class za extends qa {
3050
3061
  return { user: e, questId: t };
3051
3062
  }
3052
3063
  fetchFromDb(e) {
3053
- return Fa(e);
3064
+ return zr(e);
3054
3065
  }
3055
3066
  fetchManyFromDb(e) {
3056
- return ka(e);
3067
+ return Fr(e);
3057
3068
  }
3058
- updateInDb(e, t, a) {
3059
- return ja(e, t, a);
3069
+ updateInDb(e, t, r) {
3070
+ return Kr(e, t, r);
3060
3071
  }
3061
3072
  }
3062
- const ve = new za();
3063
- class Pa extends f {
3073
+ const Me = new Pr();
3074
+ class Hr extends f {
3064
3075
  async updateDailyReport(e) {
3065
- const t = await I.get(e), a = await G.get(e), r = await ve.getMany({
3076
+ const t = await U.get(e), r = await G.get(e), a = await Me.getMany({
3066
3077
  user: e,
3067
- status: D.COMPLETED
3078
+ status: T.COMPLETED
3068
3079
  });
3069
3080
  await this.update(e, {
3070
3081
  $set: {
3071
3082
  xpYesterday: t.xp.amount,
3072
3083
  berryYesterday: t.berry,
3073
- previousCompletedQuest: r.map(
3084
+ previousCompletedQuest: a.map(
3074
3085
  ({ questId: s }) => s
3075
3086
  ),
3076
- "previousOrnament.unlockedBadges": a.unlockedBadges,
3077
- "previousOrnament.unlockedTitles": a.unlockedTitles,
3078
- "previousOrnament.unlockedBackgrounds": a.unlockedBackgrounds
3087
+ "previousOrnament.unlockedBadges": r.unlockedBadges,
3088
+ "previousOrnament.unlockedTitles": r.unlockedTitles,
3089
+ "previousOrnament.unlockedBackgrounds": r.unlockedBackgrounds
3079
3090
  // TODO
3080
3091
  // previousMessageSent: user.questMeta.messageSent,
3081
3092
  }
@@ -3083,61 +3094,61 @@ class Pa extends f {
3083
3094
  }
3084
3095
  async getDailyReport(e) {
3085
3096
  const t = await this.get(e), {
3086
- previousOrnament: a,
3087
- previousCompletedQuest: r,
3097
+ previousOrnament: r,
3098
+ previousCompletedQuest: a,
3088
3099
  xpYesterday: s,
3089
3100
  berryYesterday: i
3090
3101
  } = t;
3091
3102
  if (s <= 0)
3092
3103
  return;
3093
- const o = await I.get(e), c = await ve.getMany({
3104
+ const o = await U.get(e), c = await Me.getMany({
3094
3105
  user: e,
3095
- status: D.COMPLETED
3096
- }), w = await G.get(e), { berry: x, xp: T } = o, { voice: K, amount: nt } = T, { unlockedBadges: at, unlockedBackgrounds: rt, unlockedTitles: st } = w;
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;
3097
3108
  return {
3098
3109
  berry: x - i,
3099
- xp: nt - s,
3110
+ xp: rt - s,
3100
3111
  // TODO
3101
3112
  // message: user.questMeta.messageSent - previousMessageSent,
3102
- voice: ye(K.lastConnection, k()) ? K.minutesInVoiceToday : 0,
3113
+ voice: fe(P.lastConnection, k()) ? P.minutesInVoiceToday : 0,
3103
3114
  quest: q(
3104
- c.map(({ questId: it }) => it),
3105
- r
3115
+ c.map(({ questId: ut }) => ut),
3116
+ a
3106
3117
  ),
3107
- badge: q(at, a.unlockedBadges),
3108
- title: q(st, a.unlockedTitles),
3118
+ badge: q(at, r.unlockedBadges),
3119
+ title: q(it, r.unlockedTitles),
3109
3120
  background: q(
3110
- rt,
3111
- a.unlockedBackgrounds
3121
+ st,
3122
+ r.unlockedBackgrounds
3112
3123
  )
3113
3124
  };
3114
3125
  }
3115
3126
  async getAllDailyReportsToSend() {
3116
- const e = await Sn.getMany({
3127
+ const e = await bn.getMany({
3117
3128
  "settings.sendDailyReport": !0,
3118
3129
  faction: { $ne: "citizen" }
3119
3130
  });
3120
3131
  return await Promise.all(
3121
- e.map(async ({ _id: t, discordId: a }) => ({
3132
+ e.map(async ({ _id: t, discordId: r }) => ({
3122
3133
  ...await this.getDailyReport(t),
3123
3134
  user: t,
3124
- discordId: a
3135
+ discordId: r
3125
3136
  }))
3126
3137
  );
3127
3138
  }
3128
3139
  }
3129
- const Ka = (n) => J.create({
3140
+ const Lr = (n) => J.create({
3130
3141
  user: n
3131
3142
  });
3132
- async function Ha(n) {
3143
+ async function Qr(n) {
3133
3144
  const e = await J.findOne({ user: n }).lean();
3134
- return e || y(await Ka(n));
3145
+ return e || y(await Lr(n));
3135
3146
  }
3136
- const La = (n, e) => J.findOneAndUpdate({ user: n }, e, {
3147
+ const Wr = (n, e) => J.findOneAndUpdate({ user: n }, e, {
3137
3148
  upsert: !0,
3138
3149
  returnDocument: "after"
3139
3150
  }).lean();
3140
- class Qa extends Pa {
3151
+ class Gr extends Hr {
3141
3152
  constructor() {
3142
3153
  super(60);
3143
3154
  }
@@ -3148,21 +3159,21 @@ class Qa extends Pa {
3148
3159
  return e.user;
3149
3160
  }
3150
3161
  fetchFromDb(e) {
3151
- return Ha(e);
3162
+ return Qr(e);
3152
3163
  }
3153
3164
  updateInDb(e, t) {
3154
- return La(e, t);
3165
+ return Wr(e, t);
3155
3166
  }
3156
3167
  }
3157
- const zs = new Qa();
3158
- class Wa extends f {
3159
- async setGuessGame(e, t, a, r) {
3168
+ const Js = new Gr();
3169
+ class Yr extends f {
3170
+ async setGuessGame(e, t, r, a) {
3160
3171
  await this.update(e, {
3161
3172
  $set: {
3162
3173
  guess: {
3163
3174
  amount: t,
3164
- tries: a,
3165
- numberToGuess: r,
3175
+ tries: r,
3176
+ numberToGuess: a,
3166
3177
  lastGuess: 0
3167
3178
  }
3168
3179
  }
@@ -3186,18 +3197,18 @@ class Wa extends f {
3186
3197
  });
3187
3198
  }
3188
3199
  }
3189
- const Ga = async (n) => await ee.create({
3200
+ const Xr = async (n) => await ee.create({
3190
3201
  user: n
3191
3202
  });
3192
- async function Ya(n) {
3203
+ async function Vr(n) {
3193
3204
  const e = await ee.findOne({ user: n }).lean();
3194
- return e || y(await Ga(n));
3205
+ return e || y(await Xr(n));
3195
3206
  }
3196
- const Xa = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
3207
+ const Jr = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
3197
3208
  upsert: !0,
3198
3209
  returnDocument: "after"
3199
3210
  }).lean();
3200
- class Va extends Wa {
3211
+ class Zr extends Yr {
3201
3212
  constructor() {
3202
3213
  super(300);
3203
3214
  }
@@ -3208,48 +3219,48 @@ class Va extends Wa {
3208
3219
  return e;
3209
3220
  }
3210
3221
  fetchFromDb(e) {
3211
- return Ya(e);
3222
+ return Vr(e);
3212
3223
  }
3213
3224
  updateInDb(e, t) {
3214
- return Xa(e, t);
3225
+ return Jr(e, t);
3215
3226
  }
3216
3227
  }
3217
- const Ps = new Va();
3218
- class Ja extends f {
3228
+ const Zs = new Zr();
3229
+ class ea extends f {
3219
3230
  async hasUnlockedRaid(e, t) {
3220
3231
  return (await this.get(e)).unlocked?.[t];
3221
3232
  }
3222
- async alreadyObtainedRaidReward(e, t, a) {
3223
- const r = await this.get(e);
3224
- return t in r.obtainedRewards ? r.obtainedRewards[t].includes(a) : !1;
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;
3225
3236
  }
3226
3237
  async getObtainedRaidReward(e, t) {
3227
3238
  return (await this.get(e)).obtainedRewards[t] ?? [];
3228
3239
  }
3229
- async fulfillCondition(e, t, a, r) {
3240
+ async fulfillCondition(e, t, r, a) {
3230
3241
  const s = await this.get(e);
3231
- return r === "include" ? a.every(
3242
+ return a === "include" ? r.every(
3232
3243
  (i) => (s.obtainedConditions[t] ?? []).includes(i)
3233
- ) : a.every(
3244
+ ) : r.every(
3234
3245
  (i) => !(s.obtainedConditions[t] ?? []).includes(i)
3235
3246
  );
3236
3247
  }
3237
3248
  async unlockRaid(e, t) {
3238
3249
  await this.update(e, { $set: { [`unlocked.${t}`]: !0 } });
3239
3250
  }
3240
- async startRaid(e, t, a, r, s) {
3251
+ async startRaid(e, t, r, a, s) {
3241
3252
  const i = Date.now();
3242
3253
  return await this.update(e, {
3243
3254
  $set: {
3244
3255
  currentRaid: {
3245
3256
  raidId: t,
3246
- buffItem: a,
3257
+ buffItem: r,
3247
3258
  seed: i,
3248
3259
  progression: [],
3249
3260
  rewards: {}
3250
3261
  }
3251
3262
  }
3252
- }), await va.startRaidCooldown(e, r, s), i;
3263
+ }), await Ar.startRaidCooldown(e, a, s), i;
3253
3264
  }
3254
3265
  async resetRaid(e) {
3255
3266
  await this.update(e, {
@@ -3272,39 +3283,39 @@ class Ja extends f {
3272
3283
  }
3273
3284
  });
3274
3285
  }
3275
- async claimReward(e, t, a) {
3286
+ async claimReward(e, t, r) {
3276
3287
  await this.update(e, {
3277
3288
  $addToSet: {
3278
- [`obtainedRewards.${t}`]: a
3289
+ [`obtainedRewards.${t}`]: r
3279
3290
  }
3280
3291
  });
3281
3292
  }
3282
3293
  async addRewardsToRaid(e, t) {
3283
3294
  await this.update(e, {
3284
3295
  $inc: Object.fromEntries(
3285
- C(t).filter(([a]) => a !== "title" && a !== "condition").map(([a, r]) => [`currentRaid.rewards.${a}`, r])
3296
+ R(t).filter(([r]) => r !== "title" && r !== "condition").map(([r, a]) => [`currentRaid.rewards.${r}`, a])
3286
3297
  ),
3287
3298
  ...t.title ? { $set: { "currentRaid.rewards.title": t.title } } : {}
3288
3299
  });
3289
3300
  }
3290
- async updateCondition(e, t, a) {
3301
+ async updateCondition(e, t, r) {
3291
3302
  await this.update(e, {
3292
3303
  $addToSet: {
3293
- [`obtainedConditions.${t}`]: a
3304
+ [`obtainedConditions.${t}`]: r
3294
3305
  }
3295
3306
  });
3296
3307
  }
3297
3308
  }
3298
- const Za = (n) => ae.create({
3309
+ const ta = (n) => re.create({
3299
3310
  user: n
3300
- }), er = async (n) => {
3301
- const e = await ae.findOne({ user: n }).lean();
3302
- return e || y(await Za(n));
3303
- }, tr = (n, e) => ae.findOneAndUpdate({ user: n }, e, {
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, {
3304
3315
  upsert: !0,
3305
3316
  returnDocument: "after"
3306
3317
  });
3307
- class nr extends Ja {
3318
+ class aa extends ea {
3308
3319
  constructor() {
3309
3320
  super(3600);
3310
3321
  }
@@ -3315,32 +3326,32 @@ class nr extends Ja {
3315
3326
  return e;
3316
3327
  }
3317
3328
  fetchFromDb(e) {
3318
- return er(e);
3329
+ return na(e);
3319
3330
  }
3320
3331
  updateInDb(e, t) {
3321
- return tr(e, t);
3332
+ return ra(e, t);
3322
3333
  }
3323
3334
  }
3324
- const Ks = new nr();
3325
- class ar extends f {
3326
- async isBuyLimitReached(e, t, a) {
3327
- const r = await d.getAllEntitiesLimit();
3335
+ const ei = new aa();
3336
+ class sa extends f {
3337
+ async isBuyLimitReached(e, t, r) {
3338
+ const a = await d.getAllEntitiesLimit();
3328
3339
  if (await d.isEntityId(t, d.isEquipment))
3329
3340
  return !1;
3330
3341
  const s = await this.get(e), i = s.limit?.[t];
3331
- let o = r[t];
3332
- const c = await S.hasRevolutionaryBuff(e);
3333
- return s.lastShopId !== a ? !1 : (c === "half" && t === "chest_2" && (o += 2), c === "full" && t === "chest_3" && (o += 1), !!(o && i && i >= o));
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));
3334
3345
  }
3335
- async getShopItemRest(e, t, a, r = Dt) {
3346
+ async getShopItemRest(e, t, r, a = Ot) {
3336
3347
  const s = await d.getAllEntitiesLimit();
3337
3348
  if (await d.isEntityId(t, d.isEquipment))
3338
- return r;
3349
+ return a;
3339
3350
  let i = s[t];
3340
- const o = await this.get(e), c = o.limit?.[t], w = await S.hasRevolutionaryBuff(e);
3341
- return w === "half" && t === "chest_2" && (i += 2), w === "full" && t === "chest_3" && (i += 1), i ? o.lastShopId !== a ? i : c ? i - c : Math.min(i, r) : r;
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;
3342
3353
  }
3343
- async increaseBuyLimit(e, t, a, r) {
3354
+ async increaseBuyLimit(e, t, r, a) {
3344
3355
  await this.update(e, [
3345
3356
  {
3346
3357
  $set: {
@@ -3349,15 +3360,15 @@ class ar extends f {
3349
3360
  if: { $eq: ["$lastShopId", t] },
3350
3361
  then: {
3351
3362
  $setField: {
3352
- field: a,
3363
+ field: r,
3353
3364
  input: { $ifNull: ["$limit", {}] },
3354
3365
  value: {
3355
- $add: [{ $ifNull: [`$limit.${a}`, 0] }, r]
3366
+ $add: [{ $ifNull: [`$limit.${r}`, 0] }, a]
3356
3367
  }
3357
3368
  }
3358
3369
  },
3359
3370
  else: {
3360
- [a]: r
3371
+ [r]: a
3361
3372
  }
3362
3373
  }
3363
3374
  },
@@ -3367,16 +3378,16 @@ class ar extends f {
3367
3378
  ]);
3368
3379
  }
3369
3380
  }
3370
- const rr = async (n) => await re.create({
3381
+ const ia = async (n) => await ae.create({
3371
3382
  user: n
3372
- }), sr = async (n) => {
3373
- const e = await re.findOne({ user: n }).lean();
3374
- return e || y(await rr(n));
3375
- }, ir = (n, e) => re.findOneAndUpdate({ user: n }, e, {
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, {
3376
3387
  upsert: !0,
3377
3388
  returnDocument: "after"
3378
3389
  }).lean();
3379
- class ur extends ar {
3390
+ class oa extends sa {
3380
3391
  constructor() {
3381
3392
  super(300);
3382
3393
  }
@@ -3387,14 +3398,14 @@ class ur extends ar {
3387
3398
  return e;
3388
3399
  }
3389
3400
  fetchFromDb(e) {
3390
- return sr(e);
3401
+ return ua(e);
3391
3402
  }
3392
3403
  updateInDb(e, t) {
3393
- return ir(e, t);
3404
+ return ca(e, t);
3394
3405
  }
3395
3406
  }
3396
- const Hs = new ur();
3397
- class cr extends f {
3407
+ const ti = new oa();
3408
+ class da extends f {
3398
3409
  async didSevenDoubleAtDoQ(e) {
3399
3410
  await this.update(e, {
3400
3411
  $inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
@@ -3403,11 +3414,11 @@ class cr extends f {
3403
3414
  async winWithBlackjack(e) {
3404
3415
  await this.update(e, { $inc: { "blackJack.blackJackCount": 1 } });
3405
3416
  }
3406
- async updateLastGames(e, t, a) {
3417
+ async updateLastGames(e, t, r) {
3407
3418
  await this.update(e, {
3408
3419
  $push: {
3409
3420
  lastGames: {
3410
- $each: [{ gameType: t, endState: a }],
3421
+ $each: [{ gameType: t, endState: r }],
3411
3422
  $position: 0,
3412
3423
  $slice: 20
3413
3424
  }
@@ -3420,13 +3431,13 @@ class cr extends f {
3420
3431
  async bet666(e) {
3421
3432
  const t = k();
3422
3433
  t.setHours(0, 0, 0, 0);
3423
- const a = /* @__PURE__ */ new Date();
3424
- a.setHours(0, 0, 0, 0), await v.updateOne(
3434
+ const r = /* @__PURE__ */ new Date();
3435
+ r.setHours(0, 0, 0, 0), await v.updateOne(
3425
3436
  {
3426
3437
  user: e,
3427
3438
  "bet666.last": {
3428
3439
  $gte: t,
3429
- $lt: a
3440
+ $lt: r
3430
3441
  }
3431
3442
  },
3432
3443
  { $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
@@ -3473,18 +3484,18 @@ class cr extends f {
3473
3484
  await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
3474
3485
  }
3475
3486
  }
3476
- const or = async (n) => await v.create({
3487
+ const la = async (n) => await v.create({
3477
3488
  user: n
3478
3489
  });
3479
- async function dr(n) {
3490
+ async function pa(n) {
3480
3491
  const e = await v.findOne({ user: n }).lean();
3481
- return e || y(await or(n));
3492
+ return e || y(await la(n));
3482
3493
  }
3483
- const lr = (n, e) => v.findOneAndUpdate({ user: n }, e, {
3494
+ const ya = (n, e) => v.findOneAndUpdate({ user: n }, e, {
3484
3495
  upsert: !0,
3485
3496
  returnDocument: "after"
3486
3497
  }).lean();
3487
- class pr extends cr {
3498
+ class fa extends da {
3488
3499
  constructor() {
3489
3500
  super(300);
3490
3501
  }
@@ -3495,14 +3506,14 @@ class pr extends cr {
3495
3506
  return e;
3496
3507
  }
3497
3508
  fetchFromDb(e) {
3498
- return dr(e);
3509
+ return pa(e);
3499
3510
  }
3500
3511
  updateInDb(e, t) {
3501
- return lr(e, t);
3512
+ return ya(e, t);
3502
3513
  }
3503
3514
  }
3504
- const Ls = new pr();
3505
- class yr extends f {
3515
+ const ni = new fa();
3516
+ class ma extends f {
3506
3517
  async increaseXpGiven(e, t) {
3507
3518
  await this.update(e, {
3508
3519
  $inc: {
@@ -3524,18 +3535,18 @@ class yr extends f {
3524
3535
  t ? await this.update(e, { $set: { timeCrewAbove90PercentXp: 0 } }) : await this.update(e, { $inc: { timeCrewAbove90PercentXp: 1 } });
3525
3536
  }
3526
3537
  }
3527
- const fr = async (n) => await se.create({
3538
+ const ha = async (n) => await se.create({
3528
3539
  user: n
3529
3540
  });
3530
- async function mr(n) {
3541
+ async function wa(n) {
3531
3542
  const e = await se.findOne({ user: n }).lean();
3532
- return e || y(await fr(n));
3543
+ return e || y(await ha(n));
3533
3544
  }
3534
- const hr = (n, e) => se.findOneAndUpdate({ user: n }, e, {
3545
+ const ga = (n, e) => se.findOneAndUpdate({ user: n }, e, {
3535
3546
  upsert: !0,
3536
3547
  returnDocument: "after"
3537
3548
  }).lean();
3538
- class wr extends yr {
3549
+ class Sa extends ma {
3539
3550
  constructor() {
3540
3551
  super(300);
3541
3552
  }
@@ -3546,14 +3557,14 @@ class wr extends yr {
3546
3557
  return e;
3547
3558
  }
3548
3559
  fetchFromDb(e) {
3549
- return mr(e);
3560
+ return wa(e);
3550
3561
  }
3551
3562
  updateInDb(e, t) {
3552
- return hr(e, t);
3563
+ return ga(e, t);
3553
3564
  }
3554
3565
  }
3555
- const Qs = new wr();
3556
- class gr extends f {
3566
+ const ri = new Sa();
3567
+ class ba extends f {
3557
3568
  async workIncrement(e) {
3558
3569
  await this.update(e, { $inc: { workCount: 1 } });
3559
3570
  }
@@ -3565,18 +3576,18 @@ class gr extends f {
3565
3576
  });
3566
3577
  }
3567
3578
  }
3568
- const Sr = (n) => ie.create({
3579
+ const $a = (n) => ie.create({
3569
3580
  user: n
3570
3581
  });
3571
- async function br(n) {
3582
+ async function Ea(n) {
3572
3583
  const e = await ie.findOne({ user: n }).lean();
3573
- return e || y(await Sr(n));
3584
+ return e || y(await $a(n));
3574
3585
  }
3575
- const $r = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
3586
+ const Ia = (n, e) => ie.findOneAndUpdate({ user: n }, e, {
3576
3587
  upsert: !0,
3577
3588
  returnDocument: "after"
3578
3589
  }).lean();
3579
- class Er extends gr {
3590
+ class Ua extends ba {
3580
3591
  constructor() {
3581
3592
  super(300);
3582
3593
  }
@@ -3587,14 +3598,14 @@ class Er extends gr {
3587
3598
  return e;
3588
3599
  }
3589
3600
  fetchFromDb(e) {
3590
- return br(e);
3601
+ return Ea(e);
3591
3602
  }
3592
3603
  updateInDb(e, t) {
3593
- return $r(e, t);
3604
+ return Ia(e, t);
3594
3605
  }
3595
3606
  }
3596
- const Ur = new Er();
3597
- class Ir extends f {
3607
+ const Da = new Ua();
3608
+ class Ta extends f {
3598
3609
  async randomMessageIncrement(e) {
3599
3610
  await this.update(e, { $inc: { randomMessageClaimed: 1 } });
3600
3611
  }
@@ -3612,18 +3623,18 @@ class Ir extends f {
3612
3623
  await this.update(e, { $inc: { totalMinutesInVoice: t } });
3613
3624
  }
3614
3625
  }
3615
- const Tr = async (n) => await ue.create({
3626
+ const Oa = async (n) => await ue.create({
3616
3627
  user: n
3617
3628
  });
3618
- async function Dr(n) {
3629
+ async function Ca(n) {
3619
3630
  const e = await ue.findOne({ user: n }).lean();
3620
- return e || y(await Tr(n));
3631
+ return e || y(await Oa(n));
3621
3632
  }
3622
- const Or = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
3633
+ const Ra = (n, e) => ue.findOneAndUpdate({ user: n }, e, {
3623
3634
  upsert: !0,
3624
3635
  returnDocument: "after"
3625
3636
  }).lean();
3626
- class Cr extends Ir {
3637
+ class va extends Ta {
3627
3638
  constructor() {
3628
3639
  super(300);
3629
3640
  }
@@ -3636,14 +3647,14 @@ class Cr extends Ir {
3636
3647
  return e;
3637
3648
  }
3638
3649
  fetchFromDb(e) {
3639
- return Dr(e);
3650
+ return Ca(e);
3640
3651
  }
3641
3652
  updateInDb(e, t) {
3642
- return Or(e, t);
3653
+ return Ra(e, t);
3643
3654
  }
3644
3655
  }
3645
- const Ws = new Cr();
3646
- class Rr extends f {
3656
+ const ai = new va();
3657
+ class Ma extends f {
3647
3658
  async hasReportedSomeone(e) {
3648
3659
  await this.update(e, { $set: { reportedSomeone: !0 } });
3649
3660
  }
@@ -3674,18 +3685,18 @@ class Rr extends f {
3674
3685
  await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
3675
3686
  }
3676
3687
  }
3677
- const vr = async (n) => await ce.create({
3688
+ const Aa = async (n) => await ce.create({
3678
3689
  user: n
3679
3690
  });
3680
- async function Mr(n) {
3691
+ async function Ba(n) {
3681
3692
  const e = await ce.findOne({ user: n }).lean();
3682
- return e || y(await vr(n));
3693
+ return e || y(await Aa(n));
3683
3694
  }
3684
- const Ar = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
3695
+ const _a = (n, e) => ce.findOneAndUpdate({ user: n }, e, {
3685
3696
  upsert: !0,
3686
3697
  returnDocument: "after"
3687
3698
  }).lean();
3688
- class Br extends Rr {
3699
+ class xa extends Ma {
3689
3700
  constructor() {
3690
3701
  super(300);
3691
3702
  }
@@ -3696,14 +3707,14 @@ class Br extends Rr {
3696
3707
  return e;
3697
3708
  }
3698
3709
  fetchFromDb(e) {
3699
- return Mr(e);
3710
+ return Ba(e);
3700
3711
  }
3701
3712
  updateInDb(e, t) {
3702
- return Ar(e, t);
3713
+ return _a(e, t);
3703
3714
  }
3704
3715
  }
3705
- const Gs = new Br();
3706
- class _r extends f {
3716
+ const si = new xa();
3717
+ class qa extends f {
3707
3718
  async readEdito(e) {
3708
3719
  const t = /* @__PURE__ */ new Date();
3709
3720
  t.setHours(0, 0, 0, 0), await M.updateOne(
@@ -3730,18 +3741,18 @@ class _r extends f {
3730
3741
  ), this.invalidate(e);
3731
3742
  }
3732
3743
  }
3733
- const xr = async (n) => await M.create({
3744
+ const ka = async (n) => await M.create({
3734
3745
  user: n
3735
3746
  });
3736
- async function qr(n) {
3747
+ async function Na(n) {
3737
3748
  const e = await M.findOne({ user: n }).lean();
3738
- return e || y(await xr(n));
3749
+ return e || y(await ka(n));
3739
3750
  }
3740
- const kr = (n, e) => M.findOneAndUpdate({ user: n }, e, {
3751
+ const Fa = (n, e) => M.findOneAndUpdate({ user: n }, e, {
3741
3752
  upsert: !0,
3742
3753
  returnDocument: "after"
3743
3754
  }).lean();
3744
- class Nr extends _r {
3755
+ class ja extends qa {
3745
3756
  constructor() {
3746
3757
  super(300);
3747
3758
  }
@@ -3752,41 +3763,41 @@ class Nr extends _r {
3752
3763
  return e;
3753
3764
  }
3754
3765
  fetchFromDb(e) {
3755
- return qr(e);
3766
+ return Na(e);
3756
3767
  }
3757
3768
  updateInDb(e, t) {
3758
- return kr(e, t);
3769
+ return Fa(e, t);
3759
3770
  }
3760
3771
  }
3761
- const Ys = new Nr();
3762
- class Fr extends f {
3763
- async updateCraftStats(e, t, a) {
3764
- const r = await d.get(a);
3765
- !r || !d.isItem(r) || await this.update(e, {
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, {
3766
3777
  $inc: {
3767
- "crafts.cookedMeal": d.isCookedMeal(r) ? t : 0,
3768
- "crafts.scrolls": d.isScrollItem(r) ? t : 0,
3778
+ "crafts.cookedMeal": d.isCookedMeal(a) ? t : 0,
3779
+ "crafts.scrolls": d.isScrollItem(a) ? t : 0,
3769
3780
  "crafts.totalCrafted": t
3770
3781
  }
3771
3782
  });
3772
3783
  }
3773
- async incrementAlcoholDrink(e, t, a) {
3784
+ async incrementAlcoholDrink(e, t, r) {
3774
3785
  ["wine", "beer", "rhum"].includes(t) && await this.update(e, {
3775
3786
  $inc: {
3776
- "alcohols.wines": t === "wine" ? a : 0,
3777
- "alcohols.beers": t === "beer" ? a : 0,
3778
- "alcohols.rhums": t === "rhum" ? a : 0,
3779
- "alcohols.totalConsumed": a
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
3780
3791
  }
3781
3792
  });
3782
3793
  }
3783
3794
  async incrementBottleUsedToday(e, t) {
3784
- const a = /* @__PURE__ */ new Date();
3785
- a.setHours(0, 0, 0, 0), await A.updateOne(
3795
+ const r = /* @__PURE__ */ new Date();
3796
+ r.setHours(0, 0, 0, 0), await A.updateOne(
3786
3797
  {
3787
3798
  user: e,
3788
3799
  "bottle.lastUsed": {
3789
- $gte: a
3800
+ $gte: r
3790
3801
  }
3791
3802
  },
3792
3803
  {
@@ -3797,7 +3808,7 @@ class Fr extends f {
3797
3808
  {
3798
3809
  user: e,
3799
3810
  "bottle.lastUsed": {
3800
- $lt: a
3811
+ $lt: r
3801
3812
  }
3802
3813
  },
3803
3814
  {
@@ -3819,18 +3830,18 @@ class Fr extends f {
3819
3830
  });
3820
3831
  }
3821
3832
  }
3822
- const jr = async (n) => await A.create({
3833
+ const Ka = async (n) => await A.create({
3823
3834
  user: n
3824
3835
  });
3825
- async function zr(n) {
3836
+ async function Pa(n) {
3826
3837
  const e = await A.findOne({ user: n }).lean();
3827
- return e || y(await jr(n));
3838
+ return e || y(await Ka(n));
3828
3839
  }
3829
- const Pr = (n, e) => A.findOneAndUpdate({ user: n }, e, {
3840
+ const Ha = (n, e) => A.findOneAndUpdate({ user: n }, e, {
3830
3841
  upsert: !0,
3831
3842
  returnDocument: "after"
3832
3843
  }).lean();
3833
- class Kr extends Fr {
3844
+ class La extends za {
3834
3845
  constructor() {
3835
3846
  super(300);
3836
3847
  }
@@ -3841,39 +3852,134 @@ class Kr extends Fr {
3841
3852
  return e;
3842
3853
  }
3843
3854
  fetchFromDb(e) {
3844
- return zr(e);
3855
+ return Pa(e);
3845
3856
  }
3846
3857
  updateInDb(e, t) {
3847
- return Pr(e, t);
3858
+ return Ha(e, t);
3848
3859
  }
3849
3860
  }
3850
- const Xs = new Kr(), Hr = new u({
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);
3937
+ }
3938
+ updateInDb(e, t) {
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;
3952
+ }
3953
+ }
3954
+ const ci = new es(), ts = new u({
3851
3955
  bannedUserId: { type: String, index: !0, required: !0 },
3852
3956
  authorId: { type: String, required: !0 },
3853
3957
  unbannedTimestamp: { type: Date, index: 1 },
3854
3958
  reason: { type: String, required: !0 },
3855
3959
  guildId: { type: String, required: !0 }
3856
- }), de = l?.Bans || p("Bans", Hr), Lr = (n) => de.create({
3857
- ...n
3858
- });
3859
- class Qr extends b {
3960
+ }), le = l?.Bans || p("Bans", ts), ns = (n, e) => le.deleteOne({ bannedUserId: n, guildId: e });
3961
+ class rs extends b {
3860
3962
  async getUnbanUsers() {
3861
3963
  return this.getMany({
3862
3964
  unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
3863
3965
  });
3864
3966
  }
3865
- async banUserFromGuild(e) {
3866
- await Lr(e);
3967
+ async banUserFromGuild({ bannedUserId: e, guildId: t, ...r }) {
3968
+ await this.update({ bannedUserId: e, guildId: t }, { ...r });
3867
3969
  }
3868
3970
  async isBannedFromGuild(e, t) {
3869
- const a = await this.get({ bannedUserId: e, guildId: t });
3870
- return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
3971
+ const r = await this.get({ bannedUserId: e, guildId: t });
3972
+ return !!(r && (!r.unbannedTimestamp || r.unbannedTimestamp > /* @__PURE__ */ new Date()));
3973
+ }
3974
+ async deleteBan(e, t) {
3975
+ await ns(e, t), this.invalidate({ bannedUserId: e, guildId: t });
3871
3976
  }
3872
3977
  }
3873
- const Wr = (n) => de.find(n).lean(), Gr = (n) => de.findOne(n).lean(), Yr = (n, e) => de.findOneAndUpdate(n, e, {
3874
- returnDocument: "after"
3978
+ const as = (n) => le.find(n).lean(), ss = (n) => le.findOne(n).lean(), is = (n, e) => le.findOneAndUpdate(n, e, {
3979
+ returnDocument: "after",
3980
+ upsert: !0
3875
3981
  }).lean();
3876
- class Xr extends Qr {
3982
+ class us extends rs {
3877
3983
  constructor() {
3878
3984
  super(3600 * 36);
3879
3985
  }
@@ -3884,16 +3990,16 @@ class Xr extends Qr {
3884
3990
  return { bannedUserId: e, guildId: t };
3885
3991
  }
3886
3992
  fetchFromDb(e) {
3887
- return Gr(e);
3993
+ return ss(e);
3888
3994
  }
3889
3995
  fetchManyFromDb(e) {
3890
- return Wr(e);
3996
+ return as(e);
3891
3997
  }
3892
3998
  updateInDb(e, t) {
3893
- return Yr(e, t);
3999
+ return is(e, t);
3894
4000
  }
3895
4001
  }
3896
- const Vs = new Xr(), Vr = new u({
4002
+ const oi = new us(), cs = new u({
3897
4003
  senderId: {
3898
4004
  type: u.Types.ObjectId,
3899
4005
  required: !0,
@@ -3910,35 +4016,35 @@ const Vs = new Xr(), Vr = new u({
3910
4016
  meta: {
3911
4017
  rps: { type: String, default: void 0 }
3912
4018
  }
3913
- }), le = l?.Invitation || p("Invitation", Vr), Jr = (n) => le.create({
4019
+ }), pe = l?.Invitation || p("Invitation", cs), os = (n) => pe.create({
3914
4020
  ...n
3915
- }), Zr = async (n) => {
3916
- await le.deleteMany({
4021
+ }), ds = async (n) => {
4022
+ await pe.deleteMany({
3917
4023
  ...n
3918
4024
  });
3919
4025
  };
3920
- class es extends f {
4026
+ class ls extends f {
3921
4027
  async sendInvitation({
3922
4028
  senderId: e,
3923
4029
  receiverId: t,
3924
- gameMode: a,
3925
- ...r
4030
+ gameMode: r,
4031
+ ...a
3926
4032
  }) {
3927
- return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? !1 : (await Jr({ ...r, senderId: e, gameMode: a, receiverId: t }), !0);
4033
+ return await this.get({ senderId: e, gameMode: r, receiverId: t }) ? !1 : (await os({ ...a, senderId: e, gameMode: r, receiverId: t }), !0);
3928
4034
  }
3929
4035
  async receiveInvitation(e) {
3930
4036
  return this.get(e);
3931
4037
  }
3932
4038
  async deleteInvitation(e) {
3933
- await Zr(e), this.invalidate(e);
4039
+ await ds(e), this.invalidate(e);
3934
4040
  }
3935
4041
  }
3936
- const ts = (n) => le.findOne({
4042
+ const ps = (n) => pe.findOne({
3937
4043
  ...n
3938
- }).lean(), ns = (n, e) => le.findOneAndUpdate(n, e, {
4044
+ }).lean(), ys = (n, e) => pe.findOneAndUpdate(n, e, {
3939
4045
  returnDocument: "after"
3940
4046
  }).lean();
3941
- class as extends es {
4047
+ class fs extends ls {
3942
4048
  constructor() {
3943
4049
  super(3600);
3944
4050
  }
@@ -3948,19 +4054,19 @@ class as extends es {
3948
4054
  getKey({
3949
4055
  receiverId: e,
3950
4056
  gameMode: t,
3951
- senderId: a
4057
+ senderId: r
3952
4058
  }) {
3953
- return { gameMode: t, receiverId: e, senderId: a };
4059
+ return { gameMode: t, receiverId: e, senderId: r };
3954
4060
  }
3955
4061
  fetchFromDb(e) {
3956
- return ts(e);
4062
+ return ps(e);
3957
4063
  }
3958
4064
  updateInDb(e, t) {
3959
- return ns(e, t);
4065
+ return ys(e, t);
3960
4066
  }
3961
4067
  }
3962
- const Js = new as();
3963
- class rs extends f {
4068
+ const di = new fs();
4069
+ class ms extends f {
3964
4070
  async setEditoChannel(e, t) {
3965
4071
  await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
3966
4072
  }
@@ -3989,11 +4095,11 @@ class rs extends f {
3989
4095
  { $set: { "crew.infoChannelId": t } }
3990
4096
  );
3991
4097
  }
3992
- async addCrewChannelId(e, t, a) {
4098
+ async addCrewChannelId(e, t, r) {
3993
4099
  await this.update(
3994
4100
  { guildId: e },
3995
4101
  {
3996
- $push: { "crew.crewChannelIds": { channelId: a, crewId: t } }
4102
+ $push: { "crew.crewChannelIds": { channelId: r, crewId: t } }
3997
4103
  }
3998
4104
  );
3999
4105
  }
@@ -4002,7 +4108,7 @@ class rs extends f {
4002
4108
  { guildId: e },
4003
4109
  {
4004
4110
  $set: Object.fromEntries(
4005
- Object.entries(t).map(([a, r]) => [`roles.${a}`, r])
4111
+ Object.entries(t).map(([r, a]) => [`roles.${r}`, a])
4006
4112
  )
4007
4113
  }
4008
4114
  );
@@ -4012,16 +4118,16 @@ class rs extends f {
4012
4118
  { guildId: e },
4013
4119
  {
4014
4120
  $set: Object.fromEntries(
4015
- Object.entries(t).map(([a, r]) => [
4016
- `channels.${a}`,
4017
- r
4121
+ Object.entries(t).map(([r, a]) => [
4122
+ `channels.${r}`,
4123
+ a
4018
4124
  ])
4019
4125
  )
4020
4126
  }
4021
4127
  );
4022
4128
  }
4023
4129
  }
4024
- const ss = new u({
4130
+ const hs = new u({
4025
4131
  guildId: { type: String, required: !0, unique: !0 },
4026
4132
  ranking: {
4027
4133
  channelId: { type: String, default: null },
@@ -4063,16 +4169,16 @@ const ss = new u({
4063
4169
  }
4064
4170
  },
4065
4171
  shopChannelId: { type: String, default: null }
4066
- }), Ue = l?.Settings || p("Settings", ss), is = (n) => Ue.create({
4172
+ }), Ue = l?.Settings || p("Settings", hs), ws = (n) => Ue.create({
4067
4173
  guildId: n
4068
- }), us = async (n) => {
4174
+ }), gs = async (n) => {
4069
4175
  const e = await Ue.findOne({ guildId: n }).lean();
4070
- return e || y(await is(n));
4071
- }, cs = (n, e) => Ue.findOneAndUpdate(n, e, {
4176
+ return e || y(await ws(n));
4177
+ }, Ss = (n, e) => Ue.findOneAndUpdate(n, e, {
4072
4178
  upsert: !0,
4073
4179
  returnDocument: "after"
4074
4180
  }).lean();
4075
- class os extends rs {
4181
+ class bs extends ms {
4076
4182
  constructor() {
4077
4183
  super(3600 * 24 * 30);
4078
4184
  }
@@ -4083,13 +4189,13 @@ class os extends rs {
4083
4189
  return e;
4084
4190
  }
4085
4191
  fetchFromDb(e) {
4086
- return us(e);
4192
+ return gs(e);
4087
4193
  }
4088
4194
  updateInDb(e, t) {
4089
- return cs(e, t);
4195
+ return Ss(e, t);
4090
4196
  }
4091
4197
  }
4092
- const Zs = new os(), ds = new u(
4198
+ const li = new bs(), $s = new u(
4093
4199
  {
4094
4200
  shopType: { type: String, required: !0, unique: !0 },
4095
4201
  publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
@@ -4118,11 +4224,11 @@ const Zs = new os(), ds = new u(
4118
4224
  }
4119
4225
  },
4120
4226
  { minimize: !1 }
4121
- ), Ie = l?.Shop || p("Shop", ds), ls = (n) => Ie.create({
4227
+ ), De = l?.Shop || p("Shop", $s), Es = (n) => De.create({
4122
4228
  shopType: n
4123
- }), ps = async (n) => {
4124
- const e = await Ie.findOne({ shopType: n }).lean();
4125
- return e || y(await ls(n));
4229
+ }), Is = async (n) => {
4230
+ const e = await De.findOne({ shopType: n }).lean();
4231
+ return e || y(await Es(n));
4126
4232
  };
4127
4233
  class E {
4128
4234
  toDBShopItem() {
@@ -4134,14 +4240,14 @@ class E {
4134
4240
  };
4135
4241
  }
4136
4242
  async onBuy(e, t) {
4137
- this.currency === "berry" ? (await I.updateUserBerry(
4243
+ this.currency === "berry" ? (await U.updateUserBerry(
4138
4244
  e,
4139
4245
  -1 * this.price * t,
4140
4246
  !1
4141
- ), await Ur.updateTotalSpentInShop(
4247
+ ), await Da.updateTotalSpentInShop(
4142
4248
  e,
4143
4249
  this.price * t
4144
- )) : await S.removeItem(
4250
+ )) : await w.removeItem(
4145
4251
  e,
4146
4252
  this.currency,
4147
4253
  this.price * t
@@ -4175,7 +4281,7 @@ class E {
4175
4281
  return !1;
4176
4282
  }
4177
4283
  }
4178
- class ys extends E {
4284
+ class Us extends E {
4179
4285
  price;
4180
4286
  size;
4181
4287
  currency;
@@ -4183,10 +4289,10 @@ class ys extends E {
4183
4289
  constructor({
4184
4290
  price: e,
4185
4291
  item: t,
4186
- size: a,
4187
- currency: r
4292
+ size: r,
4293
+ currency: a
4188
4294
  }) {
4189
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4295
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4190
4296
  }
4191
4297
  async onBuy(e, t) {
4192
4298
  await super.onBuy(e, t), await G.unlockBackground(e, this.data.ornamentId);
@@ -4195,7 +4301,7 @@ class ys extends E {
4195
4301
  return !0;
4196
4302
  }
4197
4303
  }
4198
- class fs extends E {
4304
+ class Ds extends E {
4199
4305
  price;
4200
4306
  size;
4201
4307
  currency;
@@ -4203,19 +4309,19 @@ class fs extends E {
4203
4309
  constructor({
4204
4310
  price: e,
4205
4311
  item: t,
4206
- size: a,
4207
- currency: r
4312
+ size: r,
4313
+ currency: a
4208
4314
  }) {
4209
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4315
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4210
4316
  }
4211
4317
  async onBuy(e, t) {
4212
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4318
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4213
4319
  }
4214
4320
  isBoostXp() {
4215
4321
  return !0;
4216
4322
  }
4217
4323
  }
4218
- class ms extends E {
4324
+ class Ts extends E {
4219
4325
  price;
4220
4326
  size;
4221
4327
  currency;
@@ -4223,19 +4329,19 @@ class ms extends E {
4223
4329
  constructor({
4224
4330
  price: e,
4225
4331
  item: t,
4226
- size: a,
4227
- currency: r
4332
+ size: r,
4333
+ currency: a
4228
4334
  }) {
4229
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4335
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4230
4336
  }
4231
4337
  async onBuy(e, t) {
4232
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4338
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4233
4339
  }
4234
4340
  isChest() {
4235
4341
  return !0;
4236
4342
  }
4237
4343
  }
4238
- class hs extends E {
4344
+ class Os extends E {
4239
4345
  price;
4240
4346
  size;
4241
4347
  currency;
@@ -4243,19 +4349,19 @@ class hs extends E {
4243
4349
  constructor({
4244
4350
  price: e,
4245
4351
  item: t,
4246
- size: a,
4247
- currency: r
4352
+ size: r,
4353
+ currency: a
4248
4354
  }) {
4249
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4355
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4250
4356
  }
4251
4357
  async onBuy(e, t) {
4252
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4358
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4253
4359
  }
4254
4360
  isObject() {
4255
4361
  return !0;
4256
4362
  }
4257
4363
  }
4258
- class ws extends E {
4364
+ class Cs extends E {
4259
4365
  price;
4260
4366
  size;
4261
4367
  currency;
@@ -4263,22 +4369,22 @@ class ws extends E {
4263
4369
  constructor({
4264
4370
  price: e,
4265
4371
  item: t,
4266
- size: a,
4267
- currency: r
4372
+ size: r,
4373
+ currency: a
4268
4374
  }) {
4269
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4375
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4270
4376
  }
4271
4377
  async onBuy(e, t) {
4272
- await super.onBuy(e, t), await S.addEquipments(
4378
+ await super.onBuy(e, t), await w.addEquipments(
4273
4379
  e,
4274
- yt({ stop: t }).map(
4380
+ ft({ stop: t }).map(
4275
4381
  () => d.seedEquipment(
4276
4382
  { ...this.data },
4277
4383
  Date.now() - Math.round(Math.random() * 1e3)
4278
4384
  )
4279
- ).map((a) => ({
4280
- entityId: a.entityId,
4281
- seed: a.seed
4385
+ ).map((r) => ({
4386
+ entityId: r.entityId,
4387
+ seed: r.seed
4282
4388
  }))
4283
4389
  );
4284
4390
  }
@@ -4286,7 +4392,7 @@ class ws extends E {
4286
4392
  return !0;
4287
4393
  }
4288
4394
  }
4289
- class gs extends E {
4395
+ class Rs extends E {
4290
4396
  price;
4291
4397
  size;
4292
4398
  currency;
@@ -4294,19 +4400,19 @@ class gs extends E {
4294
4400
  constructor({
4295
4401
  price: e,
4296
4402
  item: t,
4297
- size: a,
4298
- currency: r
4403
+ size: r,
4404
+ currency: a
4299
4405
  }) {
4300
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4406
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4301
4407
  }
4302
4408
  async onBuy(e, t) {
4303
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4409
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4304
4410
  }
4305
4411
  isBottle() {
4306
4412
  return !0;
4307
4413
  }
4308
4414
  }
4309
- class Ss extends E {
4415
+ class vs extends E {
4310
4416
  price;
4311
4417
  size;
4312
4418
  currency;
@@ -4314,19 +4420,19 @@ class Ss extends E {
4314
4420
  constructor({
4315
4421
  price: e,
4316
4422
  item: t,
4317
- size: a,
4318
- currency: r
4423
+ size: r,
4424
+ currency: a
4319
4425
  }) {
4320
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4426
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4321
4427
  }
4322
4428
  async onBuy(e, t) {
4323
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4429
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4324
4430
  }
4325
4431
  isRepair() {
4326
4432
  return !0;
4327
4433
  }
4328
4434
  }
4329
- class bs extends E {
4435
+ class Ms extends E {
4330
4436
  price;
4331
4437
  size;
4332
4438
  currency;
@@ -4334,19 +4440,19 @@ class bs extends E {
4334
4440
  constructor({
4335
4441
  price: e,
4336
4442
  item: t,
4337
- size: a,
4338
- currency: r
4443
+ size: r,
4444
+ currency: a
4339
4445
  }) {
4340
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4446
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4341
4447
  }
4342
4448
  async onBuy(e, t) {
4343
- await super.onBuy(e, t), await S.addItem(e, this.data.entityId, t);
4449
+ await super.onBuy(e, t), await w.addItem(e, this.data.entityId, t);
4344
4450
  }
4345
4451
  isStore() {
4346
4452
  return !0;
4347
4453
  }
4348
4454
  }
4349
- class $s extends E {
4455
+ class As extends E {
4350
4456
  price;
4351
4457
  size;
4352
4458
  currency;
@@ -4354,10 +4460,10 @@ class $s extends E {
4354
4460
  constructor({
4355
4461
  price: e,
4356
4462
  item: t,
4357
- size: a,
4358
- currency: r
4463
+ size: r,
4464
+ currency: a
4359
4465
  }) {
4360
- super(), this.data = t, this.price = e, this.size = a, this.currency = r;
4466
+ super(), this.data = t, this.price = e, this.size = r, this.currency = a;
4361
4467
  }
4362
4468
  async onBuy(e, t) {
4363
4469
  await super.onBuy(e, t), await G.unlockTitle(e, this.data.ornamentId);
@@ -4366,58 +4472,58 @@ class $s extends E {
4366
4472
  return !0;
4367
4473
  }
4368
4474
  }
4369
- class Es extends f {
4475
+ class Bs extends f {
4370
4476
  async getShopItem(e, t) {
4371
- const r = (await this.get(e)).items.find((w) => w.id === t);
4372
- if (!r)
4477
+ const a = (await this.get(e)).items.find((S) => S.id === t);
4478
+ if (!a)
4373
4479
  return;
4374
- const { price: s, size: i, currency: o } = r, c = await d.get(r.id) ?? await g.get(r.id);
4480
+ const { price: s, size: i, currency: o } = a, c = await d.get(a.id) ?? await g.get(a.id);
4375
4481
  if (g.isOrnament(c) && g.isBackground(c))
4376
- return new ys({ price: s, item: c, size: i, currency: o });
4482
+ return new Us({ price: s, item: c, size: i, currency: o });
4377
4483
  if (g.isOrnament(c) && g.isTitle(c))
4378
- return new $s({ price: s, item: c, size: i, currency: o });
4484
+ return new As({ price: s, item: c, size: i, currency: o });
4379
4485
  if (d.isEntity(c) && d.isChestItem(c))
4380
- return new ms({ price: s, item: c, size: i, currency: o });
4486
+ return new Ts({ price: s, item: c, size: i, currency: o });
4381
4487
  if (d.isEntity(c) && d.isBoostItem(c))
4382
- return new fs({ price: s, item: c, size: i, currency: o });
4488
+ return new Ds({ price: s, item: c, size: i, currency: o });
4383
4489
  if (d.isEntity(c) && d.isRepairItem(c))
4384
- return new Ss({ price: s, item: c, size: i, currency: o });
4490
+ return new vs({ price: s, item: c, size: i, currency: o });
4385
4491
  if (d.isEntity(c) && d.isStoreItem(c))
4386
- return new bs({ price: s, item: c, size: i, currency: o });
4492
+ return new Ms({ price: s, item: c, size: i, currency: o });
4387
4493
  if (d.isEntity(c) && d.isObjectItem(c))
4388
- return new hs({ price: s, item: c, size: i, currency: o });
4494
+ return new Os({ price: s, item: c, size: i, currency: o });
4389
4495
  if (d.isEntity(c) && d.isEquipment(c))
4390
- return new ws({ price: s, item: c, size: i, currency: o });
4496
+ return new Cs({ price: s, item: c, size: i, currency: o });
4391
4497
  if (d.isEntity(c) && d.isBottleItem(c))
4392
- return new gs({ price: s, size: i, item: c, currency: o });
4498
+ return new Rs({ price: s, size: i, item: c, currency: o });
4393
4499
  }
4394
4500
  async getShopItemList(e) {
4395
- const t = await this.get(e), a = [];
4396
- for (const { id: r } of t.items) {
4397
- const s = await this.getShopItem(e, r);
4398
- s && a.push(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);
4399
4505
  }
4400
- return a;
4506
+ return r;
4401
4507
  }
4402
4508
  getShopItemId(e) {
4403
4509
  return d.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
4404
4510
  }
4405
- async updateShopStats(e, t, a) {
4511
+ async updateShopStats(e, t, r) {
4406
4512
  await this.update(
4407
4513
  { shopType: e },
4408
4514
  {
4409
4515
  $inc: {
4410
- "stats.berrySpent": t.price * a,
4411
- "stats.itemBought": a,
4412
- "stats.chestBought": t.isChest() ? a : 0,
4413
- "stats.percentBought": t.isRepair() ? (t.data.effects.find((r) => r.type === "CREW_REPAIR")?.params.amount ?? 0) * a : 0,
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,
4414
4520
  "stats.boostTimeBought": t.isBoostXp() ? t.data.ms / (1440 * 60 * 1e3) : 0
4415
4521
  }
4416
4522
  }
4417
4523
  );
4418
4524
  }
4419
- async buyShopItem(e, t, a, r) {
4420
- const s = t.map((i) => (i.id === this.getShopItemId(a) && i.size && (i.size -= r), i));
4525
+ async buyShopItem(e, t, r, a) {
4526
+ const s = t.map((i) => (i.id === this.getShopItemId(r) && i.size && (i.size -= a), i));
4421
4527
  await this.update(
4422
4528
  { shopType: e },
4423
4529
  {
@@ -4448,8 +4554,8 @@ class Es extends f {
4448
4554
  );
4449
4555
  }
4450
4556
  }
4451
- const Us = (n, e) => Ie.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
4452
- class Is extends Es {
4557
+ const _s = (n, e) => De.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
4558
+ class xs extends Bs {
4453
4559
  constructor() {
4454
4560
  super(3600);
4455
4561
  }
@@ -4460,28 +4566,28 @@ class Is extends Es {
4460
4566
  return e;
4461
4567
  }
4462
4568
  fetchFromDb(e) {
4463
- return ps(e);
4569
+ return Is(e);
4464
4570
  }
4465
4571
  updateInDb(e, t) {
4466
- return Us(e, t);
4572
+ return _s(e, t);
4467
4573
  }
4468
4574
  }
4469
- const ei = new Is(), Ts = new u({
4575
+ const pi = new xs(), qs = new u({
4470
4576
  warnedUserId: { type: String, required: !0, index: !0 },
4471
4577
  authorId: String,
4472
4578
  date: { type: Date, default: Date.now() },
4473
4579
  reason: { type: String, default: null }
4474
- }), tt = l?.Warn || p("Warn", Ts), Ds = (n) => tt.countDocuments(n);
4475
- class Os extends b {
4580
+ }), nt = l?.Warn || p("Warn", qs), ks = (n) => nt.countDocuments(n);
4581
+ class Ns extends b {
4476
4582
  getUserWarns(e) {
4477
4583
  return this.getMany({ warnedUserId: e });
4478
4584
  }
4479
4585
  getUserWarnCount(e) {
4480
- return Ds({ warnedUserId: e });
4586
+ return ks({ warnedUserId: e });
4481
4587
  }
4482
4588
  }
4483
- const Cs = (n) => tt.find(n).lean();
4484
- class Rs extends Os {
4589
+ const Fs = (n) => nt.find(n).lean();
4590
+ class js extends Ns {
4485
4591
  constructor() {
4486
4592
  super(300);
4487
4593
  }
@@ -4495,62 +4601,63 @@ class Rs extends Os {
4495
4601
  throw new Error("Method not implemented.");
4496
4602
  }
4497
4603
  fetchManyFromDb(e) {
4498
- return Cs(e);
4604
+ return Fs(e);
4499
4605
  }
4500
4606
  updateInDb() {
4501
4607
  throw new Error("Method not implemented.");
4502
4608
  }
4503
4609
  }
4504
- const ti = new Rs(), ni = (n) => {
4505
- ut(n);
4610
+ const yi = new js(), fi = (n) => {
4611
+ ct(n);
4506
4612
  };
4507
- class ai extends ct.ObjectId {
4613
+ class mi extends ot.ObjectId {
4508
4614
  }
4509
4615
  export {
4510
- js as COOLDOWN_COMMANDS,
4511
- ai as ObjectId,
4616
+ Vs as COOLDOWN_COMMANDS,
4617
+ mi as ObjectId,
4512
4618
  h as QUEST_MIDDLEWARE_EVENT_NAME,
4513
- he as RAID_MIDDLEWARE_EVENT_NAME,
4514
- Vs as banService,
4515
- ni as connectToServices,
4516
- Ce as crewMetaService,
4517
- qs as crewOrnamentsService,
4518
- ks as crewQuestService,
4519
- Mt as crewService,
4520
- Ns as crewStatsEngagementService,
4521
- Fs as crewStatsFrequencyService,
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,
4522
4628
  m as emitQuestMiddlewareEvent,
4523
- me as emitRaidMiddlewareEvent,
4629
+ he as emitRaidMiddlewareEvent,
4524
4630
  d as entityService,
4525
- ps as findShop,
4526
- Js as invitationService,
4631
+ Is as findShop,
4632
+ di as invitationService,
4527
4633
  g as ornamentService,
4528
- U as panoplyService,
4529
- _s as registerQuestMiddlewareEvents,
4530
- xs as registerRaidMiddlewareEvents,
4634
+ I as panoplyService,
4635
+ ci as recipeService,
4636
+ Ls as registerQuestMiddlewareEvents,
4637
+ Qs as registerRaidMiddlewareEvents,
4531
4638
  H as reminderService,
4532
- Zs as settingsService,
4533
- Ie as shopModel,
4534
- ei as shopService,
4535
- va as userCooldownService,
4536
- aa as userCrewService,
4537
- zs as userDailyReportService,
4538
- pe as userEncyclopediaService,
4539
- Ps as userGamesService,
4540
- S as userInventoryService,
4541
- I as userMetaService,
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,
4542
4649
  G as userOrnamentService,
4543
- ve as userQuestService,
4544
- Ks as userRaidService,
4545
- Sn as userService,
4546
- Re as userSettingsService,
4547
- Hs as userShopService,
4548
- Ls as userStatsCasinoService,
4549
- Qs as userStatsCrewService,
4550
- Ur as userStatsEconomyService,
4551
- Ws as userStatsEngagementService,
4552
- Gs as userStatsFlagsService,
4553
- Ys as userStatsFrequencyService,
4554
- Xs as userStatsInventoryService,
4555
- ti as warnService
4650
+ Me as userQuestService,
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
4556
4663
  };