@opfr/services 1.6.0 → 1.7.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 (63) hide show
  1. package/dist/index.es.js +1140 -780
  2. package/dist/index.umd.js +1 -1
  3. package/dist/services/index.d.ts +2 -0
  4. package/dist/services/index.d.ts.map +1 -1
  5. package/dist/services/reminder/types.d.ts +1 -2
  6. package/dist/services/reminder/types.d.ts.map +1 -1
  7. package/dist/services/story/definition/model.d.ts +4 -0
  8. package/dist/services/story/definition/model.d.ts.map +1 -0
  9. package/dist/services/story/definition/schema.d.ts +13 -0
  10. package/dist/services/story/definition/schema.d.ts.map +1 -0
  11. package/dist/services/story/helper.d.ts +10 -0
  12. package/dist/services/story/helper.d.ts.map +1 -0
  13. package/dist/services/story/index.d.ts +3 -0
  14. package/dist/services/story/index.d.ts.map +1 -0
  15. package/dist/services/story/process/create.d.ts +3 -0
  16. package/dist/services/story/process/create.d.ts.map +1 -0
  17. package/dist/services/story/process/findMany.d.ts +5 -0
  18. package/dist/services/story/process/findMany.d.ts.map +1 -0
  19. package/dist/services/story/process/findOne.d.ts +4 -0
  20. package/dist/services/story/process/findOne.d.ts.map +1 -0
  21. package/dist/services/story/process/updateOne.d.ts +4 -0
  22. package/dist/services/story/process/updateOne.d.ts.map +1 -0
  23. package/dist/services/story/service.d.ts +15 -0
  24. package/dist/services/story/service.d.ts.map +1 -0
  25. package/dist/services/story/types.d.ts +11 -0
  26. package/dist/services/story/types.d.ts.map +1 -0
  27. package/dist/services/user-cooldown/definition/schema.d.ts.map +1 -1
  28. package/dist/services/user-cooldown/helper.d.ts +3 -3
  29. package/dist/services/user-cooldown/helper.d.ts.map +1 -1
  30. package/dist/services/user-cooldown/index.d.ts +0 -1
  31. package/dist/services/user-cooldown/index.d.ts.map +1 -1
  32. package/dist/services/user-cooldown/types.d.ts +1 -8
  33. package/dist/services/user-cooldown/types.d.ts.map +1 -1
  34. package/dist/services/user-settings/definition/schema.d.ts.map +1 -1
  35. package/dist/services/user-settings/types.d.ts +1 -6
  36. package/dist/services/user-settings/types.d.ts.map +1 -1
  37. package/dist/services/user-story/definition/model.d.ts +4 -0
  38. package/dist/services/user-story/definition/model.d.ts.map +1 -0
  39. package/dist/services/user-story/definition/schema.d.ts +13 -0
  40. package/dist/services/user-story/definition/schema.d.ts.map +1 -0
  41. package/dist/services/user-story/helper.d.ts +31 -0
  42. package/dist/services/user-story/helper.d.ts.map +1 -0
  43. package/dist/services/user-story/index.d.ts +3 -0
  44. package/dist/services/user-story/index.d.ts.map +1 -0
  45. package/dist/services/user-story/process/create.d.ts +4 -0
  46. package/dist/services/user-story/process/create.d.ts.map +1 -0
  47. package/dist/services/user-story/process/deleteOne.d.ts +3 -0
  48. package/dist/services/user-story/process/deleteOne.d.ts.map +1 -0
  49. package/dist/services/user-story/process/findMany.d.ts +5 -0
  50. package/dist/services/user-story/process/findMany.d.ts.map +1 -0
  51. package/dist/services/user-story/process/findOne.d.ts +5 -0
  52. package/dist/services/user-story/process/findOne.d.ts.map +1 -0
  53. package/dist/services/user-story/process/updateOne.d.ts +5 -0
  54. package/dist/services/user-story/process/updateOne.d.ts.map +1 -0
  55. package/dist/services/user-story/service.d.ts +15 -0
  56. package/dist/services/user-story/service.d.ts.map +1 -0
  57. package/dist/services/user-story/types.d.ts +43 -0
  58. package/dist/services/user-story/types.d.ts.map +1 -0
  59. package/dist/services/user-story/utils.d.ts +8 -0
  60. package/dist/services/user-story/utils.d.ts.map +1 -0
  61. package/package.json +3 -3
  62. package/dist/services/user-cooldown/constants.d.ts +0 -2
  63. package/dist/services/user-cooldown/constants.d.ts.map +0 -1
package/dist/index.es.js CHANGED
@@ -1,65 +1,65 @@
1
- import { Schema as u, models as c, model as d, connect as Fe, Types as Ne } from "mongoose";
2
- import { QuestStatus as v, DEFAULT_FACTION as He, GAME_TYPES as Ke, EFFECT_KEYS as je, EQUIPMENT_SLOT as he, CHARACTERISTICS as Pe, getComputedCharacteristicValue as ze, getCurrentLevel as Le, HP_PER_VITALITY as Qe, DEFAULT_MAX_HP as Ge, transformToDBBuff as We, RANK_IDS_WITHOUT_BASIC as le } from "@opfr/definitions";
3
- import Ye from "node-cache";
4
- import * as ge from "events";
5
- import { filterNullAndUndefined as H, recordToArray as B, arrayToRecord as we, mergeObjects as K, seededRandom as Ve, sortBy as ie, randomBetween as Se, hasExpire as re, isString as Xe, capitalizeAllWords as Je, pickNthByOdds as pe, pickFrom as Ze, sameDay as be, yesterday as j, exclude as N } from "@opfr/utils-lang";
6
- const P = "___ALL_ENTITIES___";
1
+ import { Schema as c, models as d, model as l, connect as Qe, Types as Ye } from "mongoose";
2
+ import { QuestStatus as q, DEFAULT_FACTION as Ge, EFFECT_KEYS as We, EQUIPMENT_SLOT as Ie, CHARACTERISTICS as Ve, getComputedCharacteristicValue as Xe, getCurrentLevel as Je, HP_PER_VITALITY as Ze, DEFAULT_MAX_HP as et, transformToDBBuff as tt, RANK_IDS_WITHOUT_BASIC as ge, STORY_MESSAGE_ARGS as nt, STORY_ACTION_TYPES as rt, STORY_STEP_TYPES as at, STORY_SPEAKER_TYPES as st, chapterOne as oe, speakers as it } from "@opfr/definitions";
3
+ import ut from "node-cache";
4
+ import * as Ue from "events";
5
+ import { filterNullAndUndefined as L, recordToArray as B, arrayToRecord as Te, mergeObjects as Q, seededRandom as ct, sortBy as pe, randomBetween as Ee, hasExpire as de, isString as ot, capitalizeAllWords as dt, pickNthByOdds as Se, pickFrom as lt, sameDay as Oe, yesterday as Y, exclude as P } from "@opfr/utils-lang";
6
+ const G = "___ALL_ENTITIES___";
7
7
  class y {
8
8
  cache;
9
9
  constructor(e) {
10
- this.cache = new Ye({
10
+ this.cache = new ut({
11
11
  stdTTL: e,
12
12
  checkperiod: e * 0.2,
13
13
  useClones: !1
14
14
  });
15
15
  }
16
16
  async get(e, t) {
17
- const a = this.normalizeKey(e), r = this.cache.get(a);
18
- if (r)
19
- return r;
17
+ const r = this.normalizeKey(e), a = this.cache.get(r);
18
+ if (a)
19
+ return a;
20
20
  const s = await this.fetchFromDb(e, t ?? {});
21
- return s && this.cache.set(a, s), s;
21
+ return s && this.cache.set(r, s), s;
22
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(P), this.cache.set(this.normalizeKey(s), r);
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(G), this.cache.set(this.normalizeKey(s), a);
28
28
  }
29
- return r;
29
+ return a;
30
30
  }
31
31
  invalidate(e) {
32
- this.cache.del(P), e && this.cache.del(this.normalizeKey(e));
32
+ this.cache.del(G), e && this.cache.del(this.normalizeKey(e));
33
33
  }
34
34
  clearAll() {
35
35
  this.cache.flushAll();
36
36
  }
37
37
  }
38
- class m extends y {
38
+ class f extends y {
39
39
  async getAll() {
40
- const e = this.cache.get(P);
40
+ const e = this.cache.get(G);
41
41
  if (e)
42
42
  return e;
43
43
  const t = await this.fetchManyFromDb({}, {});
44
- return this.cache.set(P, t), t.forEach((a) => {
45
- this.cache.set(this.normalizeKey(this.getKey(a)), a);
44
+ return this.cache.set(G, t), t.forEach((r) => {
45
+ this.cache.set(this.normalizeKey(this.getKey(r)), r);
46
46
  }), t;
47
47
  }
48
48
  async getMany(e, t = {}) {
49
- const a = await this.fetchManyFromDb(e, t);
50
- return a.forEach((r) => {
51
- this.cache.set(this.normalizeKey(this.getKey(r)), r);
52
- }), a;
49
+ const r = await this.fetchManyFromDb(e, t);
50
+ return r.forEach((a) => {
51
+ this.cache.set(this.normalizeKey(this.getKey(a)), a);
52
+ }), r;
53
53
  }
54
54
  }
55
- const $e = new ge.EventEmitter(), h = (n, e, t) => {
56
- $e.emit(n, e, t);
57
- }, pr = (n) => {
55
+ const De = new Ue.EventEmitter(), S = (n, e, t) => {
56
+ De.emit(n, e, t);
57
+ }, La = (n) => {
58
58
  for (const [e, t] of Object.entries(n))
59
- $e.on(e, (a, r) => {
60
- t(a, r);
59
+ De.on(e, (r, a) => {
60
+ t(r, a);
61
61
  });
62
- }, g = {
62
+ }, w = {
63
63
  USER: "middleware/quest/USER",
64
64
  USER_INVENTORY: "middleware/quest/USER_INVENTORY",
65
65
  USER_META: "middleware/quest/USER_META",
@@ -71,10 +71,10 @@ const $e = new ge.EventEmitter(), h = (n, e, t) => {
71
71
  USER_STATS_FLAGS: "middleware/quest/USER_STATS_FLAGS",
72
72
  USER_STATS_FREQUENCY: "middleware/quest/USER_STATS_FREQUENCY",
73
73
  USER_STATS_INVENTORY: "middleware/quest/USER_STATS_INVENTORY"
74
- }, Ue = new u(
74
+ }, ve = new c(
75
75
  {
76
76
  user: {
77
- type: u.Types.ObjectId,
77
+ type: c.Types.ObjectId,
78
78
  required: !0,
79
79
  ref: "User",
80
80
  index: !0
@@ -84,42 +84,34 @@ const $e = new ge.EventEmitter(), h = (n, e, t) => {
84
84
  required: !0,
85
85
  index: !0
86
86
  },
87
- status: { type: String, default: v.IN_PROGRESS, index: 1 },
87
+ status: { type: String, default: q.IN_PROGRESS, index: 1 },
88
88
  lastCompletionDate: Date,
89
89
  streak: Number
90
90
  },
91
91
  { minimize: !1 }
92
92
  );
93
- Ue.post("findOneAndUpdate", function(n) {
94
- n && h(
95
- g.USER_QUEST,
93
+ ve.post("findOneAndUpdate", function(n) {
94
+ n && S(
95
+ w.USER_QUEST,
96
96
  n.user._id,
97
97
  n
98
98
  );
99
99
  });
100
- const R = c?.UserQuest || d("UserQuest", Ue), et = new u({
100
+ const C = d?.UserQuest || l("UserQuest", ve), pt = new c({
101
101
  user: {
102
- type: u.Types.ObjectId,
102
+ type: c.Types.ObjectId,
103
103
  required: !0,
104
104
  unique: !0,
105
105
  ref: "User"
106
106
  },
107
- raid: {
108
- classic: { type: Date, default: /* @__PURE__ */ new Date(0) },
109
- special: { type: Date, default: /* @__PURE__ */ new Date(0) }
110
- },
111
- lockUserCommand: { type: Date, default: /* @__PURE__ */ new Date(0) },
112
107
  commands: {
113
- work: { type: Date, default: /* @__PURE__ */ new Date(0) },
114
- dice: { type: Date, default: /* @__PURE__ */ new Date(0) },
115
- doubleOrQuit: { type: Date, default: /* @__PURE__ */ new Date(0) },
116
- priceIsRight: { type: Date, default: /* @__PURE__ */ new Date(0) },
117
- blackJack: { type: Date, default: /* @__PURE__ */ new Date(0) },
118
- rps: { type: Date, default: /* @__PURE__ */ new Date(0) }
119
- }
120
- }), z = c?.UserCooldown || d("UserCooldown", et), tt = new u({
108
+ type: Map,
109
+ of: Date,
110
+ default: /* @__PURE__ */ new Map()
111
+ }
112
+ }), W = d?.UserCooldown || l("UserCooldown", pt), yt = new c({
121
113
  user: {
122
- type: u.Types.ObjectId,
114
+ type: c.Types.ObjectId,
123
115
  required: !0,
124
116
  unique: !0,
125
117
  ref: "User"
@@ -133,17 +125,17 @@ const R = c?.UserQuest || d("UserQuest", Ue), et = new u({
133
125
  },
134
126
  previousCompletedQuest: { type: [String], default: [] },
135
127
  previousMessageSent: { type: Number, default: 0 }
136
- }), L = c?.UserDailyReport || d("UserDailyReport", tt), nt = new u({
128
+ }), V = d?.UserDailyReport || l("UserDailyReport", yt), ft = new c({
137
129
  user: {
138
- type: u.Types.ObjectId,
130
+ type: c.Types.ObjectId,
139
131
  required: !0,
140
132
  unique: !0,
141
133
  ref: "User"
142
134
  },
143
135
  encyclopedia: { type: [String], default: [] }
144
- }), Q = c?.UserEncyclopedia || d("UserEncyclopedia", nt), at = new u({
136
+ }), X = d?.UserEncyclopedia || l("UserEncyclopedia", ft), mt = new c({
145
137
  user: {
146
- type: u.Types.ObjectId,
138
+ type: c.Types.ObjectId,
147
139
  required: !0,
148
140
  unique: !0,
149
141
  ref: "User",
@@ -158,10 +150,10 @@ const R = c?.UserQuest || d("UserQuest", Ue), et = new u({
158
150
  },
159
151
  default: null
160
152
  }
161
- }), G = c?.UserGames || d("UserGames", at), Ee = new u(
153
+ }), J = d?.UserGames || l("UserGames", mt), Me = new c(
162
154
  {
163
155
  user: {
164
- type: u.Types.ObjectId,
156
+ type: c.Types.ObjectId,
165
157
  required: !0,
166
158
  unique: !0,
167
159
  ref: "User"
@@ -180,23 +172,23 @@ const R = c?.UserQuest || d("UserQuest", Ue), et = new u({
180
172
  },
181
173
  { minimize: !1 }
182
174
  );
183
- Ee.post("findOneAndUpdate", function(n) {
184
- n && h(
185
- g.USER_INVENTORY,
175
+ Me.post("findOneAndUpdate", function(n) {
176
+ n && S(
177
+ w.USER_INVENTORY,
186
178
  n.user._id,
187
179
  n
188
180
  );
189
181
  });
190
- const W = c?.UserInventory || d("UserInventory", Ee), rt = new ge.EventEmitter(), st = (n, e) => {
191
- rt.emit(n, e);
192
- }, T = {
182
+ const Z = d?.UserInventory || l("UserInventory", Me), ht = new Ue.EventEmitter(), gt = (n, e) => {
183
+ ht.emit(n, e);
184
+ }, M = {
193
185
  multiplier: { type: Number, default: 0 },
194
186
  origin: String,
195
187
  expireAt: { type: Date, default: null },
196
188
  startAt: { type: Date, default: null }
197
- }, De = new u({
189
+ }, xe = new c({
198
190
  user: {
199
- type: u.Types.ObjectId,
191
+ type: c.Types.ObjectId,
200
192
  required: !0,
201
193
  unique: !0,
202
194
  ref: "User"
@@ -216,33 +208,33 @@ const W = c?.UserInventory || d("UserInventory", Ee), rt = new ge.EventEmitter()
216
208
  buffs: {
217
209
  cooldown: {
218
210
  casino: {
219
- type: [T],
211
+ type: [M],
220
212
  default: []
221
213
  },
222
214
  work: {
223
- type: [T],
215
+ type: [M],
224
216
  default: []
225
217
  }
226
218
  },
227
219
  berry: {
228
220
  work: {
229
- type: [T],
221
+ type: [M],
230
222
  default: []
231
223
  },
232
224
  global: {
233
- type: [T],
225
+ type: [M],
234
226
  default: []
235
227
  }
236
228
  },
237
229
  drop: {
238
230
  work: {
239
- type: [T],
231
+ type: [M],
240
232
  default: []
241
233
  }
242
234
  },
243
235
  xp: {
244
236
  global: {
245
- type: [T],
237
+ type: [M],
246
238
  default: []
247
239
  }
248
240
  }
@@ -268,16 +260,16 @@ const W = c?.UserInventory || d("UserInventory", Ee), rt = new ge.EventEmitter()
268
260
  wisdom: { type: Number, default: 0 }
269
261
  }
270
262
  });
271
- De.post("findOneAndUpdate", async function(n) {
272
- n && (h(
273
- g.USER_META,
263
+ xe.post("findOneAndUpdate", async function(n) {
264
+ n && (S(
265
+ w.USER_META,
274
266
  n.user._id,
275
267
  n
276
- ), n.hp <= 0 && st("death", n.user._id));
268
+ ), n.hp <= 0 && gt("death", n.user._id));
277
269
  });
278
- const I = c?.UserMeta || d("UserMeta", De), Ie = new u({
270
+ const v = d?.UserMeta || l("UserMeta", xe), qe = new c({
279
271
  user: {
280
- type: u.Types.ObjectId,
272
+ type: c.Types.ObjectId,
281
273
  required: !0,
282
274
  unique: !0,
283
275
  ref: "User"
@@ -292,16 +284,16 @@ const I = c?.UserMeta || d("UserMeta", De), Ie = new u({
292
284
  unlockedBags: { type: [String], default: ["default"] },
293
285
  selectedBag: { type: String, default: "default" }
294
286
  });
295
- Ie.post("findOneAndUpdate", function(n) {
296
- n && h(
297
- g.USER_ORNAMENT,
287
+ qe.post("findOneAndUpdate", function(n) {
288
+ n && S(
289
+ w.USER_ORNAMENT,
298
290
  n.user._id,
299
291
  n
300
292
  );
301
293
  });
302
- const Y = c?.UserOrnament || d("UserOrnament", Ie), it = new u({
294
+ const ee = d?.UserOrnament || l("UserOrnament", qe), St = new c({
303
295
  user: {
304
- type: u.Types.ObjectId,
296
+ type: c.Types.ObjectId,
305
297
  required: !0,
306
298
  unique: !0,
307
299
  ref: "User"
@@ -312,22 +304,15 @@ const Y = c?.UserOrnament || d("UserOrnament", Ie), it = new u({
312
304
  sendDailyReport: { type: Boolean, default: !1, index: !0 },
313
305
  sendDailyQuest: { type: Boolean, default: !1 },
314
306
  reminder: {
315
- raid: {
316
- classic: { type: Boolean, default: !1 },
317
- special: { type: Boolean, default: !1 }
318
- },
319
307
  commands: {
320
- work: { type: Boolean, default: !1 },
321
- dice: { type: Boolean, default: !1 },
322
- qod: { type: Boolean, default: !1 },
323
- blackjack: { type: Boolean, default: !1 },
324
- guess: { type: Boolean, default: !1 },
325
- rps: { type: Boolean, default: !1 }
308
+ type: Map,
309
+ of: Boolean,
310
+ default: /* @__PURE__ */ new Map()
326
311
  }
327
312
  }
328
- }), C = c?.UserSettings || d("UserSettings", it), Te = new u({
313
+ }), F = d?.UserSettings || l("UserSettings", St), Ae = new c({
329
314
  user: {
330
- type: u.Types.ObjectId,
315
+ type: c.Types.ObjectId,
331
316
  required: !0,
332
317
  unique: !0,
333
318
  ref: "User"
@@ -360,16 +345,16 @@ const Y = c?.UserOrnament || d("UserOrnament", Ie), it = new u({
360
345
  guessInOneTryCount: { type: Number, default: 0 }
361
346
  }
362
347
  });
363
- Te.post("findOneAndUpdate", function(n) {
364
- n && h(
365
- g.USER_STATS_CASINO,
348
+ Ae.post("findOneAndUpdate", function(n) {
349
+ n && S(
350
+ w.USER_STATS_CASINO,
366
351
  n.user._id,
367
352
  n
368
353
  );
369
354
  });
370
- const M = c?.UserStatsCasino || d("UserStatsCasino", Te), Oe = new u({
355
+ const A = d?.UserStatsCasino || l("UserStatsCasino", Ae), ke = new c({
371
356
  user: {
372
- type: u.Types.ObjectId,
357
+ type: c.Types.ObjectId,
373
358
  required: !0,
374
359
  unique: !0,
375
360
  ref: "User"
@@ -377,16 +362,16 @@ const M = c?.UserStatsCasino || d("UserStatsCasino", Te), Oe = new u({
377
362
  workCount: { type: Number, default: 0 },
378
363
  totalSpentInShop: { type: Number, default: 0 }
379
364
  });
380
- Oe.post("findOneAndUpdate", function(n) {
381
- n && h(
382
- g.USER_STATS_ECONOMY,
365
+ ke.post("findOneAndUpdate", function(n) {
366
+ n && S(
367
+ w.USER_STATS_ECONOMY,
383
368
  n.user._id,
384
369
  n
385
370
  );
386
371
  });
387
- const V = c?.UserStatsEconomy || d("UserStatsEconomy", Oe), ve = new u({
372
+ const te = d?.UserStatsEconomy || l("UserStatsEconomy", ke), Re = new c({
388
373
  user: {
389
- type: u.Types.ObjectId,
374
+ type: c.Types.ObjectId,
390
375
  required: !0,
391
376
  unique: !0,
392
377
  ref: "User"
@@ -396,19 +381,19 @@ const V = c?.UserStatsEconomy || d("UserStatsEconomy", Oe), ve = new u({
396
381
  randomMessageClaimed: { type: Number, default: 0 },
397
382
  writeDifferentChatIds: { type: [String], default: [] }
398
383
  });
399
- ve.post("findOneAndUpdate", function(n) {
400
- n && h(
401
- g.USER_STATS_ENGAGEMENT,
384
+ Re.post("findOneAndUpdate", function(n) {
385
+ n && S(
386
+ w.USER_STATS_ENGAGEMENT,
402
387
  n.user._id,
403
388
  n
404
389
  );
405
390
  });
406
- const X = c?.UserStatsEngagement || d(
391
+ const ne = d?.UserStatsEngagement || l(
407
392
  "UserStatsEngagement",
408
- ve
409
- ), Me = new u({
393
+ Re
394
+ ), Ce = new c({
410
395
  user: {
411
- type: u.Types.ObjectId,
396
+ type: c.Types.ObjectId,
412
397
  required: !0,
413
398
  unique: !0,
414
399
  ref: "User"
@@ -425,16 +410,16 @@ const X = c?.UserStatsEngagement || d(
425
410
  loseEverything: { type: Boolean, default: !1 }
426
411
  }
427
412
  });
428
- Me.post("findOneAndUpdate", function(n) {
429
- n && h(
430
- g.USER_STATS_FLAGS,
413
+ Ce.post("findOneAndUpdate", function(n) {
414
+ n && S(
415
+ w.USER_STATS_FLAGS,
431
416
  n.user._id,
432
417
  n
433
418
  );
434
419
  });
435
- const J = c?.UserStatsFlags || d("UserStatsFlags", Me), ke = new u({
420
+ const re = d?.UserStatsFlags || l("UserStatsFlags", Ce), _e = new c({
436
421
  user: {
437
- type: u.Types.ObjectId,
422
+ type: c.Types.ObjectId,
438
423
  required: !0,
439
424
  unique: !0,
440
425
  ref: "User"
@@ -444,19 +429,19 @@ const J = c?.UserStatsFlags || d("UserStatsFlags", Me), ke = new u({
444
429
  lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date(), index: !0 }
445
430
  }
446
431
  });
447
- ke.post("findOneAndUpdate", function(n) {
448
- n && h(
449
- g.USER_STATS_FREQUENCY,
432
+ _e.post("findOneAndUpdate", function(n) {
433
+ n && S(
434
+ w.USER_STATS_FREQUENCY,
450
435
  n.user._id,
451
436
  n
452
437
  );
453
438
  });
454
- const D = c?.UserStatsFrequency || d(
439
+ const D = d?.UserStatsFrequency || l(
455
440
  "UserStatsFrequency",
456
- ke
457
- ), Ae = new u({
441
+ _e
442
+ ), Be = new c({
458
443
  user: {
459
- type: u.Types.ObjectId,
444
+ type: c.Types.ObjectId,
460
445
  required: !0,
461
446
  unique: !0,
462
447
  ref: "User"
@@ -481,39 +466,39 @@ const D = c?.UserStatsFrequency || d(
481
466
  totalCrafted: { type: Number, default: 0 }
482
467
  }
483
468
  });
484
- Ae.post("findOneAndUpdate", function(n) {
485
- n && h(
486
- g.USER_STATS_INVENTORY,
469
+ Be.post("findOneAndUpdate", function(n) {
470
+ n && S(
471
+ w.USER_STATS_INVENTORY,
487
472
  n.user._id,
488
473
  n
489
474
  );
490
475
  });
491
- const k = c?.UserStatsInventory || d(
476
+ const k = d?.UserStatsInventory || l(
492
477
  "UserStatsInventory",
493
- Ae
494
- ), ue = new u({
478
+ Be
479
+ ), ye = new c({
495
480
  discordId: { type: String, required: !0, unique: !0 },
496
481
  scam: { type: Boolean, default: !1 },
497
482
  birthday: { type: Date, default: null, index: 1 },
498
- faction: { type: String, default: He, index: 1 },
483
+ faction: { type: String, default: Ge, index: 1 },
499
484
  canChangeFaction: { type: Boolean, default: !1 },
500
485
  canChooseFaction: { type: Boolean, default: !1 }
501
486
  });
502
- ue.post("findOneAndUpdate", function(n) {
503
- n && h(g.USER, n._id, n);
487
+ ye.post("findOneAndUpdate", function(n) {
488
+ n && S(w.USER, n._id, n);
504
489
  });
505
- ue.post("deleteOne", async function() {
490
+ ye.post("deleteOne", async function() {
506
491
  const n = this.getQuery()._id;
507
- await z.deleteOne({ user: n }), await L.deleteOne({ user: n }), await Q.deleteOne({ user: n }), await G.deleteOne({ user: n }), await W.deleteOne({ user: n }), await I.deleteOne({ user: n }), await Y.deleteOne({ user: n }), await R.deleteMany({ user: n }), await C.deleteOne({ user: n }), await M.deleteOne({ user: n }), await V.deleteOne({ user: n }), await X.deleteOne({ user: n }), await J.deleteOne({ user: n }), await D.deleteOne({ user: n }), await k.deleteOne({ user: n });
492
+ await W.deleteOne({ user: n }), await V.deleteOne({ user: n }), await X.deleteOne({ user: n }), await J.deleteOne({ user: n }), await Z.deleteOne({ user: n }), await v.deleteOne({ user: n }), await ee.deleteOne({ user: n }), await C.deleteMany({ user: n }), await F.deleteOne({ user: n }), await A.deleteOne({ user: n }), await te.deleteOne({ user: n }), await ne.deleteOne({ user: n }), await re.deleteOne({ user: n }), await D.deleteOne({ user: n }), await k.deleteOne({ user: n });
508
493
  });
509
- const w = c?.User || d("User", ue);
510
- class ut extends m {
494
+ const b = d?.User || l("User", ye);
495
+ class wt extends f {
511
496
  getByObjectId(e) {
512
497
  return this.update({ _id: e }, {});
513
498
  }
514
499
  getNextBirthdays() {
515
500
  const e = /* @__PURE__ */ new Date(), t = e.getFullYear();
516
- return w.aggregate([
501
+ return b.aggregate([
517
502
  {
518
503
  $match: {
519
504
  birthday: { $ne: null }
@@ -564,7 +549,7 @@ class ut extends m {
564
549
  ]);
565
550
  }
566
551
  getFactionRanking(e) {
567
- return w.aggregate([
552
+ return b.aggregate([
568
553
  { $match: { faction: e } },
569
554
  {
570
555
  $lookup: {
@@ -587,7 +572,7 @@ class ut extends m {
587
572
  ]);
588
573
  }
589
574
  getGlobalRanking() {
590
- return w.aggregate([
575
+ return b.aggregate([
591
576
  {
592
577
  $lookup: {
593
578
  from: "usermetas",
@@ -609,7 +594,7 @@ class ut extends m {
609
594
  ]);
610
595
  }
611
596
  getBerryRanking() {
612
- return w.aggregate([
597
+ return b.aggregate([
613
598
  {
614
599
  $lookup: {
615
600
  from: "usermetas",
@@ -631,10 +616,10 @@ class ut extends m {
631
616
  ]);
632
617
  }
633
618
  getQuestRanking() {
634
- return R.aggregate([
619
+ return C.aggregate([
635
620
  {
636
621
  $match: {
637
- status: v.COMPLETED
622
+ status: q.COMPLETED
638
623
  }
639
624
  },
640
625
  {
@@ -678,7 +663,7 @@ class ut extends m {
678
663
  }
679
664
  getTodayAllBirthday() {
680
665
  const e = /* @__PURE__ */ new Date();
681
- return w.aggregate([
666
+ return b.aggregate([
682
667
  { $match: { birthday: { $ne: null } } },
683
668
  {
684
669
  $addFields: {
@@ -725,18 +710,18 @@ class ut extends m {
725
710
  );
726
711
  }
727
712
  }
728
- const ot = (n, e) => w.find(n, {}, e).lean(), p = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }), ct = (n) => w.create({
713
+ const bt = (n, e) => b.find(n, {}, e).lean(), p = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }), $t = (n) => b.create({
729
714
  discordId: n
730
715
  });
731
- async function dt(n, { upsert: e = !0, ...t }) {
732
- const a = await w.findOne({ discordId: n }, {}, t).lean();
733
- return !a && e ? p(await ct(n)) : a;
716
+ async function It(n, { upsert: e = !0, ...t }) {
717
+ const r = await b.findOne({ discordId: n }, {}, t).lean();
718
+ return !r && e ? p(await $t(n)) : r;
734
719
  }
735
- const lt = (n, e) => w.findOneAndUpdate(n, e, {
720
+ const Ut = (n, e) => b.findOneAndUpdate(n, e, {
736
721
  upsert: !0,
737
722
  returnDocument: "after"
738
723
  }).lean();
739
- class pt extends ut {
724
+ class Tt extends wt {
740
725
  constructor() {
741
726
  super(3600);
742
727
  }
@@ -747,19 +732,19 @@ class pt extends ut {
747
732
  return e;
748
733
  }
749
734
  fetchFromDb(e, t) {
750
- return dt(e, t);
735
+ return It(e, t);
751
736
  }
752
737
  fetchManyFromDb(e, t) {
753
- return ot(e, t);
738
+ return bt(e, t);
754
739
  }
755
740
  updateInDb(e, t) {
756
- return lt(e, t);
741
+ return Ut(e, t);
757
742
  }
758
743
  }
759
- const yt = new pt(), yr = ["work", ...Ke], ft = new u(
744
+ const Et = new Tt(), Ot = new c(
760
745
  {
761
746
  user: {
762
- type: u.Types.ObjectId,
747
+ type: c.Types.ObjectId,
763
748
  ref: "User",
764
749
  required: !0,
765
750
  index: !0
@@ -768,53 +753,53 @@ const yt = new pt(), yr = ["work", ...Ke], ft = new u(
768
753
  type: { type: String, required: !0 }
769
754
  },
770
755
  { minimize: !1 }
771
- ), _ = c?.Reminder || d("Reminder", ft), mt = async (n) => {
772
- await _.deleteMany(n);
773
- }, ht = async (n, e) => {
774
- await _.deleteOne({ user: n, type: e });
756
+ ), N = d?.Reminder || l("Reminder", Ot), Dt = async (n) => {
757
+ await N.deleteMany(n);
758
+ }, vt = async (n, e) => {
759
+ await N.deleteOne({ user: n, type: e });
775
760
  };
776
- class gt extends m {
761
+ class Mt extends f {
777
762
  getAllPassedReminder() {
778
763
  return this.getMany({ date: { $lte: /* @__PURE__ */ new Date() } });
779
764
  }
780
- async addReminder(e, t, a) {
781
- await this.update({ user: e, type: t }, { $set: { date: a } }, { upsert: !0 });
765
+ async addReminder(e, t, r) {
766
+ await this.update({ user: e, type: t }, { $set: { date: r } }, { upsert: !0 });
782
767
  }
783
- async updateReminderDate(e, t, a) {
768
+ async updateReminderDate(e, t, r) {
784
769
  await this.update({ user: e, type: t }, [
785
770
  {
786
771
  $set: {
787
772
  date: {
788
- $add: ["$date", a]
773
+ $add: ["$date", r]
789
774
  }
790
775
  }
791
776
  }
792
777
  ]);
793
778
  }
794
779
  async removeReminder(e, t) {
795
- await ht(e, t), this.invalidate({ user: e, type: t });
780
+ await vt(e, t), this.invalidate({ user: e, type: t });
796
781
  }
797
782
  async deleteSelectedReminders(e) {
798
- const t = e.map((a) => a._id);
799
- await mt({ _id: { $in: t } }), e.forEach((a) => {
800
- this.invalidate({ user: a.user, type: a.type });
783
+ const t = e.map((r) => r._id);
784
+ await Dt({ _id: { $in: t } }), e.forEach((r) => {
785
+ this.invalidate({ user: r.user, type: r.type });
801
786
  });
802
787
  }
803
788
  }
804
- function wt(n, e) {
805
- return _.find(n, {}, e).lean();
789
+ function xt(n, e) {
790
+ return N.find(n, {}, e).lean();
806
791
  }
807
- async function St(n) {
808
- const e = await _.findOne(n).lean();
792
+ async function qt(n) {
793
+ const e = await N.findOne(n).lean();
809
794
  return e || null;
810
795
  }
811
- async function bt(n, e, t) {
812
- return _.findOneAndUpdate(n, e, {
796
+ async function At(n, e, t) {
797
+ return N.findOneAndUpdate(n, e, {
813
798
  ...t,
814
799
  returnDocument: "after"
815
800
  }).lean();
816
801
  }
817
- class $t extends gt {
802
+ class kt extends Mt {
818
803
  constructor() {
819
804
  super(300);
820
805
  }
@@ -828,66 +813,66 @@ class $t extends gt {
828
813
  return `${e.toString()}/${t}`;
829
814
  }
830
815
  fetchFromDb(e) {
831
- return St(e);
816
+ return qt(e);
832
817
  }
833
818
  fetchManyFromDb(e, t) {
834
- return wt(e, t);
819
+ return xt(e, t);
835
820
  }
836
- updateInDb(e, t, a = { upsert: !1 }) {
837
- return bt(e, t, a);
821
+ updateInDb(e, t, r = { upsert: !1 }) {
822
+ return At(e, t, r);
838
823
  }
839
824
  }
840
- const Ut = new $t(), Et = new u(
825
+ const Rt = new kt(), Ct = new c(
841
826
  {
842
827
  panoplyId: { unique: !0, index: 1, required: !0, type: String },
843
828
  name: { required: !0, type: String },
844
829
  equipments: {
845
830
  required: !0,
846
- type: [{ type: u.Types.ObjectId, ref: "Entities" }]
831
+ type: [{ type: c.Types.ObjectId, ref: "Entities" }]
847
832
  },
848
833
  fullBonusStr: { type: String },
849
834
  halfBonusStr: { type: String },
850
- fullBonus: u.Types.Mixed,
851
- halfBonus: u.Types.Mixed
835
+ fullBonus: c.Types.Mixed,
836
+ halfBonus: c.Types.Mixed
852
837
  },
853
838
  { minimize: !1 }
854
- ), F = c?.Panoplies || d("Panoplies", Et), Dt = (n, e) => F.find(n, {}, e).lean(), It = async (n, e) => F.find(n, {}, e).populate("equipments");
855
- async function Tt(n) {
856
- const e = await F.findOne({ panoplyId: n }).lean();
839
+ ), K = d?.Panoplies || l("Panoplies", Ct), _t = (n, e) => K.find(n, {}, e).lean(), Bt = async (n, e) => K.find(n, {}, e).populate("equipments");
840
+ async function Ft(n) {
841
+ const e = await K.findOne({ panoplyId: n }).lean();
857
842
  return e || null;
858
843
  }
859
- const Ot = async (n) => F.findOne(n).populate("equipments");
860
- class vt extends m {
844
+ const Nt = async (n) => K.findOne(n).populate("equipments");
845
+ class Kt extends f {
861
846
  getAllPopulated() {
862
- return It({}, {});
847
+ return Bt({}, {});
863
848
  }
864
849
  getPopulated(e) {
865
- return Ot({ panoplyId: e });
850
+ return Nt({ panoplyId: e });
866
851
  }
867
852
  hasPanoply(e, t) {
868
- const a = H(Object.values(e)), r = t.equipments.filter(
869
- (s) => a.find((i) => i.entityId === s.entityId)
853
+ const r = L(Object.values(e)), a = t.equipments.filter(
854
+ (s) => r.find((i) => i.entityId === s.entityId)
870
855
  ).length;
871
- if (r === t.equipments.length)
856
+ if (a === t.equipments.length)
872
857
  return t.fullBonus;
873
- if (r >= t.equipments.length / 2)
858
+ if (a >= t.equipments.length / 2)
874
859
  return t.halfBonus;
875
860
  }
876
861
  async getPanoplyBonus(e) {
877
- const t = [], a = await this.getAllPopulated();
878
- for (const r of a) {
879
- const s = H(Object.values(e)), i = r.equipments.filter(
880
- (o) => s.find(({ entityId: l }) => l === o.entityId)
862
+ const t = [], r = await this.getAllPopulated();
863
+ for (const a of r) {
864
+ const s = L(Object.values(e)), i = a.equipments.filter(
865
+ (u) => s.find(({ entityId: o }) => o === u.entityId)
881
866
  );
882
- 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]);
867
+ 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]);
883
868
  }
884
869
  return t;
885
870
  }
886
871
  }
887
- const Mt = async (n, e) => F.findOneAndUpdate(n, e, {
872
+ const Ht = async (n, e) => K.findOneAndUpdate(n, e, {
888
873
  returnDocument: "after"
889
874
  }).lean();
890
- class kt extends vt {
875
+ class Pt extends Kt {
891
876
  constructor() {
892
877
  super(3600);
893
878
  }
@@ -898,26 +883,26 @@ class kt extends vt {
898
883
  return e;
899
884
  }
900
885
  updateInDb(e, t) {
901
- return Mt(e, t);
886
+ return Ht(e, t);
902
887
  }
903
888
  fetchFromDb(e) {
904
- return Tt(e);
889
+ return Ft(e);
905
890
  }
906
891
  fetchManyFromDb(e, t) {
907
- return Dt(e, t);
892
+ return _t(e, t);
908
893
  }
909
894
  }
910
- const A = new kt(), At = new u(
895
+ const R = new Pt(), jt = new c(
911
896
  {
912
897
  type: {
913
898
  type: String,
914
- enum: je,
899
+ enum: We,
915
900
  required: !0
916
901
  },
917
- params: { type: u.Types.Mixed }
902
+ params: { type: c.Types.Mixed }
918
903
  },
919
904
  { _id: !1 }
920
- ), Rt = new u(
905
+ ), zt = new c(
921
906
  {
922
907
  entityId: { unique: !0, required: !0, type: String }
923
908
  },
@@ -925,11 +910,11 @@ const A = new kt(), At = new u(
925
910
  minimize: !1,
926
911
  discriminatorKey: "type"
927
912
  }
928
- ), qt = new u({
913
+ ), Lt = new c({
929
914
  category: { required: !0, type: String },
930
915
  subtype: { type: String },
931
916
  rankId: String,
932
- effects: { type: [At], default: [] },
917
+ effects: { type: [jt], default: [] },
933
918
  usage: {
934
919
  _id: !1,
935
920
  type: {
@@ -938,17 +923,17 @@ const A = new kt(), At = new u(
938
923
  },
939
924
  default: void 0
940
925
  }
941
- }), xt = new u({
926
+ }), Qt = new c({
942
927
  category: { required: !0, type: String },
943
928
  characteristics: {
944
929
  _id: !1,
945
930
  type: Object
946
931
  },
947
932
  panoply: String
948
- }), q = c?.Entities || d("Entities", Rt), Bt = q.discriminator("item", qt);
949
- q.discriminator("equipment", xt);
950
- const Ct = async (n, e) => q.find(n, {}, e).lean(), _t = async (n, e) => Bt.find(n, {}, e).lean();
951
- class Ft extends m {
933
+ }), _ = d?.Entities || l("Entities", zt), Yt = _.discriminator("item", Lt);
934
+ _.discriminator("equipment", Qt);
935
+ const Gt = async (n, e) => _.find(n, {}, e).lean(), Wt = async (n, e) => Yt.find(n, {}, e).lean();
936
+ class Vt extends f {
952
937
  isEntity(e) {
953
938
  return !!e && "entityId" in e;
954
939
  }
@@ -959,7 +944,7 @@ class Ft extends m {
959
944
  return e.type === "equipment";
960
945
  }
961
946
  async isEntityId(e, t = () => !0) {
962
- return (await this.getAll()).filter(t).map(({ entityId: r }) => r).includes(e);
947
+ return (await this.getAll()).filter(t).map(({ entityId: a }) => a).includes(e);
963
948
  }
964
949
  async idArrayToEntities(e) {
965
950
  return (await this.getAll()).filter(
@@ -971,14 +956,14 @@ class Ft extends m {
971
956
  }
972
957
  async recordToEntityTuple(e) {
973
958
  const t = await this.getAll();
974
- return B(e).reduce((a, [r, s]) => {
975
- const i = t.find(({ entityId: o }) => o === r);
976
- return i && a.push([i, s]), a;
959
+ return B(e).reduce((r, [a, s]) => {
960
+ const i = t.find(({ entityId: u }) => u === a);
961
+ return i && r.push([i, s]), r;
977
962
  }, []);
978
963
  }
979
964
  async getAllEntitiesLimit() {
980
965
  const e = await this.getAll();
981
- return we(
966
+ return Te(
982
967
  e.map((t) => [t.entityId, t.shop?.limit ?? 0])
983
968
  );
984
969
  }
@@ -986,17 +971,17 @@ class Ft extends m {
986
971
  return (await this.getAll()).filter(e);
987
972
  }
988
973
  async getAllItemsBy(e) {
989
- return (await _t({}, {})).filter(e);
974
+ return (await Wt({}, {})).filter(e);
990
975
  }
991
976
  async fromDBToEquipableEquipment(e) {
992
- const a = (await this.getAll()).filter(
993
- (r) => this.isEquipment(r)
977
+ const r = (await this.getAll()).filter(
978
+ (a) => this.isEquipment(a)
994
979
  ).find(
995
- ({ entityId: r }) => r === e.entityId
980
+ ({ entityId: a }) => a === e.entityId
996
981
  );
997
- if (!a)
982
+ if (!r)
998
983
  throw new Error(`cannot find any equipment: ${e.entityId}`);
999
- return this.seedEquipment(a, e.seed);
984
+ return this.seedEquipment(r, e.seed);
1000
985
  }
1001
986
  async getUserEquipmentsCharacteristics(e) {
1002
987
  let t = {
@@ -1007,21 +992,21 @@ class Ft extends m {
1007
992
  intelligence: 0,
1008
993
  wisdom: 0
1009
994
  };
1010
- const a = await A.getAllPopulated();
1011
- for (const r of he) {
1012
- const s = e[r];
1013
- s && (t = K(
995
+ const r = await R.getAllPopulated();
996
+ for (const a of Ie) {
997
+ const s = e[a];
998
+ s && (t = Q(
1014
999
  t,
1015
1000
  (await this.fromDBToEquipableEquipment(s)).characteristics,
1016
- (i, o) => i + o
1001
+ (i, u) => i + u
1017
1002
  ));
1018
1003
  }
1019
- for (const r of a) {
1020
- const s = A.hasPanoply(e, r);
1021
- s && !("target" in s) && (t = K(
1004
+ for (const a of r) {
1005
+ const s = R.hasPanoply(e, a);
1006
+ s && !("target" in s) && (t = Q(
1022
1007
  t,
1023
1008
  s,
1024
- (i, o) => i + o
1009
+ (i, u) => i + u
1025
1010
  ));
1026
1011
  }
1027
1012
  return t;
@@ -1049,7 +1034,7 @@ class Ft extends m {
1049
1034
  return e.entityId === t.entityId && e.seed === t.seed;
1050
1035
  }
1051
1036
  seedEquipment(e, t) {
1052
- const a = Ve(t), r = ie(
1037
+ const r = ct(t), a = pe(
1053
1038
  B(e.characteristics),
1054
1039
  ([s]) => s
1055
1040
  );
@@ -1057,44 +1042,44 @@ class Ft extends m {
1057
1042
  ...e,
1058
1043
  seed: t,
1059
1044
  characteristics: Object.fromEntries(
1060
- r.map(([s, i]) => [
1045
+ a.map(([s, i]) => [
1061
1046
  s,
1062
- Array.isArray(i) ? Se(i[0], i[1] + 1, a) : i
1047
+ Array.isArray(i) ? Ee(i[0], i[1] + 1, r) : i
1063
1048
  ])
1064
1049
  )
1065
1050
  };
1066
1051
  }
1067
1052
  isEquipped(e, t) {
1068
1053
  return !!Object.values(e).find(
1069
- (a) => a && this.isSameEquipment(a, t)
1054
+ (r) => r && this.isSameEquipment(r, t)
1070
1055
  );
1071
1056
  }
1072
1057
  }
1073
- const Nt = async (n) => await q.create({
1058
+ const Xt = async (n) => await _.create({
1074
1059
  ...n
1075
1060
  });
1076
- async function Ht(n) {
1077
- const e = await q.findOne({ entityId: n }).lean();
1061
+ async function Jt(n) {
1062
+ const e = await _.findOne({ entityId: n }).lean();
1078
1063
  return e || null;
1079
1064
  }
1080
- const Kt = (n, e) => q.findOneAndUpdate(n, e, {
1065
+ const Zt = (n, e) => _.findOneAndUpdate(n, e, {
1081
1066
  returnDocument: "after"
1082
1067
  }).lean();
1083
- class jt extends Ft {
1068
+ class en extends Vt {
1084
1069
  constructor() {
1085
1070
  super(3600);
1086
1071
  }
1087
1072
  createInDb(e) {
1088
- return Nt(e);
1073
+ return Xt(e);
1089
1074
  }
1090
1075
  updateInDb(e, t) {
1091
- return Kt(e, t);
1076
+ return Zt(e, t);
1092
1077
  }
1093
1078
  fetchFromDb(e) {
1094
- return Ht(e);
1079
+ return Jt(e);
1095
1080
  }
1096
1081
  fetchManyFromDb(e, t) {
1097
- return Ct(e, t);
1082
+ return Gt(e, t);
1098
1083
  }
1099
1084
  normalizeKey(e) {
1100
1085
  return e;
@@ -1103,8 +1088,8 @@ class jt extends Ft {
1103
1088
  return e.entityId;
1104
1089
  }
1105
1090
  }
1106
- const f = new jt();
1107
- class Pt extends y {
1091
+ const m = new en();
1092
+ class tn extends y {
1108
1093
  hasAlreadyFoundEntity(e, t) {
1109
1094
  return e.encyclopedia.includes(t);
1110
1095
  }
@@ -1114,23 +1099,23 @@ class Pt extends y {
1114
1099
  });
1115
1100
  }
1116
1101
  }
1117
- const zt = async (n) => await Q.create({
1102
+ const nn = async (n) => await X.create({
1118
1103
  user: n
1119
1104
  });
1120
- async function Lt(n) {
1121
- const e = await Q.findOne({ user: n }).lean();
1122
- return e || p(await zt(n));
1105
+ async function rn(n) {
1106
+ const e = await X.findOne({ user: n }).lean();
1107
+ return e || p(await nn(n));
1123
1108
  }
1124
- const Qt = (n, e) => Q.findOneAndUpdate({ user: n }, e, {
1109
+ const an = (n, e) => X.findOneAndUpdate({ user: n }, e, {
1125
1110
  upsert: !0,
1126
1111
  returnDocument: "after"
1127
1112
  }).lean();
1128
- class Gt extends Pt {
1113
+ class sn extends tn {
1129
1114
  constructor() {
1130
1115
  super(300);
1131
1116
  }
1132
1117
  fetchFromDb(e) {
1133
- return Lt(e);
1118
+ return rn(e);
1134
1119
  }
1135
1120
  getKey({ user: e }) {
1136
1121
  return e;
@@ -1139,11 +1124,11 @@ class Gt extends Pt {
1139
1124
  return e.toString();
1140
1125
  }
1141
1126
  updateInDb(e, t) {
1142
- return Qt(e, t);
1127
+ return an(e, t);
1143
1128
  }
1144
1129
  }
1145
- const se = new Gt();
1146
- class Wt extends y {
1130
+ const le = new sn();
1131
+ class un extends y {
1147
1132
  async getUserEquipmentsCharacteristics(e) {
1148
1133
  let t = {
1149
1134
  vitality: 0,
@@ -1153,79 +1138,79 @@ class Wt extends y {
1153
1138
  intelligence: 0,
1154
1139
  wisdom: 0
1155
1140
  };
1156
- for (const a of he) {
1157
- const r = e.equippedItems?.[a];
1158
- if (!r)
1141
+ for (const r of Ie) {
1142
+ const a = e.equippedItems?.[r];
1143
+ if (!a)
1159
1144
  continue;
1160
- const s = await f.fromDBToEquipableEquipment(r);
1161
- t = K(
1145
+ const s = await m.fromDBToEquipableEquipment(a);
1146
+ t = Q(
1162
1147
  t,
1163
1148
  s.characteristics,
1164
- (i, o) => i + o
1149
+ (i, u) => i + u
1165
1150
  );
1166
1151
  }
1167
1152
  return t;
1168
1153
  }
1169
1154
  async hasInventoryRequirements(e, t) {
1170
- const a = await this.get(e);
1155
+ const r = await this.get(e);
1171
1156
  return B(t).reduce(
1172
- (r, [s, i]) => r && (a.itemList[s] ?? 0) >= (i ?? 0),
1157
+ (a, [s, i]) => a && (r.itemList[s] ?? 0) >= (i ?? 0),
1173
1158
  !0
1174
1159
  );
1175
1160
  }
1176
- async hasEnoughEntity(e, t, a) {
1177
- return ((await this.get(e)).itemList[a] ?? 0) >= t;
1161
+ async hasEnoughEntity(e, t, r) {
1162
+ return ((await this.get(e)).itemList[r] ?? 0) >= t;
1178
1163
  }
1179
1164
  async getItemList(e) {
1180
1165
  return (await this.get(e)).itemList;
1181
1166
  }
1182
1167
  async calcMinStreakForWorkLoot(e) {
1183
- const t = await this.get(e), a = (await A.getPanoplyBonus(t.equippedItems)).find(
1184
- ([r, s]) => r.panoplyId === "marine" && s !== null
1168
+ const t = await this.get(e), r = (await R.getPanoplyBonus(t.equippedItems)).find(
1169
+ ([a, s]) => a.panoplyId === "marine" && s !== null
1185
1170
  );
1186
- return a && a[1] === "full" ? 10 : a && a[1] === "half" ? 20 : 1 / 0;
1171
+ return r && r[1] === "full" ? 10 : r && r[1] === "half" ? 20 : 1 / 0;
1187
1172
  }
1188
1173
  async hasRevolutionaryBuff(e) {
1189
1174
  const t = await this.get(e);
1190
- return (await A.getPanoplyBonus(t.equippedItems)).find(
1191
- ([r, s]) => r.panoplyId === "revolutionary" && s !== null
1175
+ return (await R.getPanoplyBonus(t.equippedItems)).find(
1176
+ ([a, s]) => a.panoplyId === "revolutionary" && s !== null
1192
1177
  )?.[1] ?? null;
1193
1178
  }
1194
1179
  /*
1195
1180
  ** UPDATES
1196
1181
  */
1197
- async addItem(e, t, a) {
1182
+ async addItem(e, t, r) {
1198
1183
  await this.update(e, {
1199
- $inc: { [`itemList.${t}`]: a }
1200
- }), await se.addEntities(e, [t]);
1184
+ $inc: { [`itemList.${t}`]: r }
1185
+ }), await le.addEntities(e, [t]);
1201
1186
  }
1202
1187
  async addItems(e, t) {
1203
1188
  await this.update(e, {
1204
1189
  $inc: Object.fromEntries(
1205
- Object.entries(t).filter(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
1190
+ Object.entries(t).filter(([, r]) => (r ?? 0) > 0).map(([r, a]) => [`itemList.${r}`, a])
1206
1191
  )
1207
- }), await se.addEntities(
1192
+ }), await le.addEntities(
1208
1193
  e,
1209
- B(t).filter(([, a]) => a > 0).map(([a]) => a)
1194
+ B(t).filter(([, r]) => r > 0).map(([r]) => r)
1210
1195
  );
1211
1196
  }
1212
- async removeItem(e, t, a) {
1213
- a !== 0 && await this.update(e, [
1197
+ async removeItem(e, t, r) {
1198
+ r !== 0 && await this.update(e, [
1214
1199
  {
1215
1200
  $set: {
1216
1201
  [`itemList.${t}`]: {
1217
- $max: [{ $add: [`$itemList.${t}`, -a] }, 0]
1202
+ $max: [{ $add: [`$itemList.${t}`, -r] }, 0]
1218
1203
  }
1219
1204
  }
1220
1205
  }
1221
1206
  ]);
1222
1207
  }
1223
- async removeEquipment(e, t, a) {
1208
+ async removeEquipment(e, t, r) {
1224
1209
  await this.update(e, {
1225
1210
  $pull: {
1226
1211
  equipmentList: {
1227
1212
  entityId: t,
1228
- seed: a
1213
+ seed: r
1229
1214
  }
1230
1215
  }
1231
1216
  });
@@ -1236,9 +1221,9 @@ class Wt extends y {
1236
1221
  async addEquipments(e, t) {
1237
1222
  await this.update(e, {
1238
1223
  $push: { equipmentList: { $each: t } }
1239
- }), await se.addEntities(
1224
+ }), await le.addEntities(
1240
1225
  e,
1241
- t.map((a) => a.entityId)
1226
+ t.map((r) => r.entityId)
1242
1227
  );
1243
1228
  }
1244
1229
  async saveEquipments(e) {
@@ -1251,64 +1236,64 @@ class Wt extends y {
1251
1236
  ]);
1252
1237
  }
1253
1238
  async changeEquippedEquipment(e, t) {
1254
- const a = await this.get(e);
1255
- a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
1239
+ const r = await this.get(e);
1240
+ r?.equipmentSave[t] && await this.equip(e, r.equipmentSave[t]);
1256
1241
  }
1257
1242
  async equip(e, t) {
1258
- const a = await E.getMaxHp(e), r = Object.fromEntries(
1243
+ const r = await O.getMaxHp(e), a = Object.fromEntries(
1259
1244
  B(t).map(([s, i]) => [
1260
1245
  `equippedItems.${s}`,
1261
1246
  i
1262
1247
  ])
1263
1248
  );
1264
1249
  await this.update(e, {
1265
- $set: r
1266
- }), await E.updateHp(e, a);
1250
+ $set: a
1251
+ }), await O.updateHp(e, r);
1267
1252
  }
1268
1253
  async unequip(e, t) {
1269
- const a = await E.getMaxHp(e);
1254
+ const r = await O.getMaxHp(e);
1270
1255
  await this.update(e, {
1271
1256
  $set: {
1272
1257
  [`equippedItems.${t}`]: null
1273
1258
  }
1274
- }), await E.updateHp(e, a);
1259
+ }), await O.updateHp(e, r);
1275
1260
  }
1276
- async craftItem(e, t, a, r) {
1277
- for (const { entityId: o, size: l } of t.entities)
1278
- await this.removeItem(e, o, l * a);
1261
+ async craftItem(e, t, r, a) {
1262
+ for (const { entityId: u, size: o } of t.entities)
1263
+ await this.removeItem(e, u, o * r);
1279
1264
  const { entityId: s, size: i } = t.result;
1280
- await f.isEntityId(s, f.isEquipment) ? await this.addEquipments(e, [{ entityId: s, seed: r }]) : await f.isEntityId(s, f.isItem) && await this.addItem(e, s, i * a);
1265
+ await m.isEntityId(s, m.isEquipment) ? await this.addEquipments(e, [{ entityId: s, seed: a }]) : await m.isEntityId(s, m.isItem) && await this.addItem(e, s, i * r);
1281
1266
  }
1282
- async dismantleEntity(e, t, a, r, s) {
1283
- f.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : f.isItem(t) && await this.removeItem(e, t.entityId, r);
1284
- for (const { entityId: i, quantity: o } of a)
1285
- await f.isEntityId(i, f.isItem) && await this.addItem(e, i, r * o);
1267
+ async dismantleEntity(e, t, r, a, s) {
1268
+ m.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : m.isItem(t) && await this.removeItem(e, t.entityId, a);
1269
+ for (const { entityId: i, quantity: u } of r)
1270
+ await m.isEntityId(i, m.isItem) && await this.addItem(e, i, a * u);
1286
1271
  await this.removeItem(e, "tools", 1);
1287
1272
  }
1288
- async enchantItem(e, t, a, r, s) {
1289
- await this.removeItem(e, t, s * 4), await this.removeItem(e, r, s), await this.addItem(e, a, s);
1273
+ async enchantItem(e, t, r, a, s) {
1274
+ await this.removeItem(e, t, s * 4), await this.removeItem(e, a, s), await this.addItem(e, r, s);
1290
1275
  }
1291
1276
  async unlockRecipe(e, t) {
1292
1277
  await this.update(e, { $addToSet: { recipes: t } });
1293
1278
  }
1294
1279
  }
1295
- const Yt = (n) => W.create({
1280
+ const cn = (n) => Z.create({
1296
1281
  user: n
1297
1282
  });
1298
- async function Vt(n) {
1299
- const e = await W.findOne({ user: n }).lean();
1300
- return e || p(await Yt(n));
1283
+ async function on(n) {
1284
+ const e = await Z.findOne({ user: n }).lean();
1285
+ return e || p(await cn(n));
1301
1286
  }
1302
- const Xt = (n, e) => W.findOneAndUpdate({ user: n }, e, {
1287
+ const dn = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
1303
1288
  upsert: !0,
1304
1289
  returnDocument: "after"
1305
1290
  }).lean();
1306
- class Jt extends Wt {
1291
+ class ln extends un {
1307
1292
  constructor() {
1308
1293
  super(300);
1309
1294
  }
1310
1295
  fetchFromDb(e) {
1311
- return Vt(e);
1296
+ return on(e);
1312
1297
  }
1313
1298
  normalizeKey(e) {
1314
1299
  return e.toString();
@@ -1317,17 +1302,17 @@ class Jt extends Wt {
1317
1302
  return e;
1318
1303
  }
1319
1304
  updateInDb(e, t) {
1320
- return Xt(e, t);
1305
+ return dn(e, t);
1321
1306
  }
1322
1307
  }
1323
- const U = new Jt();
1324
- class Zt extends m {
1308
+ const E = new ln();
1309
+ class pn extends f {
1325
1310
  async getTotalCharacteristics(e) {
1326
- const { characteristics: t, scrolls: a } = await this.get(e);
1327
- return we(
1328
- Pe.map((r) => [
1329
- r,
1330
- ze(t[r]) + a[r]
1311
+ const { characteristics: t, scrolls: r } = await this.get(e);
1312
+ return Te(
1313
+ Ve.map((a) => [
1314
+ a,
1315
+ Xe(t[a]) + r[a]
1331
1316
  ])
1332
1317
  );
1333
1318
  }
@@ -1374,59 +1359,59 @@ class Zt extends m {
1374
1359
  });
1375
1360
  }
1376
1361
  async calcXpBoost(e) {
1377
- const t = await this.get(e), { boost: a } = t.xp, r = a !== null && Date.now() < a.getTime() ? 0.2 : 0, s = Math.max(
1362
+ const t = await this.get(e), { boost: r } = t.xp, a = r !== null && Date.now() < r.getTime() ? 0.2 : 0, s = Math.max(
1378
1363
  t.premium ? 0.5 : 0,
1379
1364
  t.booster ? 0.25 : 0
1380
1365
  );
1381
- return r + s + t.buffs.xp.global.reduce(
1382
- (i, { expireAt: o, startAt: l, multiplier: S }) => l && l > /* @__PURE__ */ new Date() || o && re(o) ? i : i + S,
1366
+ return a + s + t.buffs.xp.global.reduce(
1367
+ (i, { expireAt: u, startAt: o, multiplier: h }) => o && o > /* @__PURE__ */ new Date() || u && de(u) ? i : i + h,
1383
1368
  0
1384
1369
  );
1385
1370
  }
1386
1371
  calcMessageXp(e) {
1387
- const t = e.trim().length, a = 2;
1388
- return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
1372
+ const t = e.trim().length, r = 2;
1373
+ return t < 10 ? 10 * r : t > 300 ? 300 * r : t * r;
1389
1374
  }
1390
1375
  async getXpDeathPenalties(e) {
1391
- const t = await this.get(e), a = Le(t.xp.amount);
1392
- 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;
1376
+ const t = await this.get(e), r = Je(t.xp.amount);
1377
+ 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;
1393
1378
  }
1394
- async calcXp(e, t, a) {
1395
- return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * a);
1379
+ async calcXp(e, t, r) {
1380
+ return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * r);
1396
1381
  }
1397
- async calcBerry(e, t, a) {
1382
+ async calcBerry(e, t, r) {
1398
1383
  if (t <= 0) return t;
1399
- const r = a ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
1400
- return Math.ceil(t * (r || 1));
1384
+ const a = r ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
1385
+ return Math.ceil(t * (a || 1));
1401
1386
  }
1402
- async calcBuffMultiplier(e, t, a) {
1403
- return (await this.get(e)).buffs[t][a].reduce(
1404
- (i, { expireAt: o, startAt: l, multiplier: S }) => i + (/* @__PURE__ */ new Date() >= (l ?? /* @__PURE__ */ new Date()) && (!o || !re(o)) ? S : 0),
1387
+ async calcBuffMultiplier(e, t, r) {
1388
+ return (await this.get(e)).buffs[t][r].reduce(
1389
+ (i, { expireAt: u, startAt: o, multiplier: h }) => i + (/* @__PURE__ */ new Date() >= (o ?? /* @__PURE__ */ new Date()) && (!u || !de(u)) ? h : 0),
1405
1390
  1
1406
1391
  );
1407
1392
  }
1408
1393
  async getMaxHp(e) {
1409
- const t = await U.get(e), { vitality: a } = await this.getTotalCharacteristics(e), r = await U.getUserEquipmentsCharacteristics(
1394
+ const t = await E.get(e), { vitality: r } = await this.getTotalCharacteristics(e), a = await E.getUserEquipmentsCharacteristics(
1410
1395
  t
1411
1396
  );
1412
- return (a + r.vitality) * Qe + Ge;
1397
+ return (r + a.vitality) * Ze + et;
1413
1398
  }
1414
1399
  async getHpRatio(e) {
1415
- const t = await this.get(e), a = await this.getMaxHp(e);
1416
- return Math.min(t.hp / a, 1);
1400
+ const t = await this.get(e), r = await this.getMaxHp(e);
1401
+ return Math.min(t.hp / r, 1);
1417
1402
  }
1418
1403
  async hasCharacteristicRequirement(e, t) {
1419
- const a = await U.get(e), r = await U.getUserEquipmentsCharacteristics(
1420
- a
1421
- ), s = K(
1404
+ const r = await E.get(e), a = await E.getUserEquipmentsCharacteristics(
1405
+ r
1406
+ ), s = Q(
1422
1407
  await this.getTotalCharacteristics(e),
1423
- r,
1424
- (i, o) => i + o
1408
+ a,
1409
+ (i, u) => i + u
1425
1410
  );
1426
1411
  if ("sum" in t) {
1427
1412
  let i = 0;
1428
- for (const o of t.characteristics)
1429
- i += s[o] ?? 0;
1413
+ for (const u of t.characteristics)
1414
+ i += s[u] ?? 0;
1430
1415
  return i >= t.sum;
1431
1416
  } else {
1432
1417
  for (const i of Object.keys(
@@ -1439,10 +1424,10 @@ class Zt extends m {
1439
1424
  }
1440
1425
  async hasMalusBuff(e) {
1441
1426
  const t = await this.get(e);
1442
- for (const a of Object.values(t.buffs))
1443
- for (const r of Object.values(a))
1444
- for (const { multiplier: s, startAt: i, expireAt: o } of r)
1445
- if (s < 0 && (!o || !re(o)) && (i ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
1427
+ for (const r of Object.values(t.buffs))
1428
+ for (const a of Object.values(r))
1429
+ for (const { multiplier: s, startAt: i, expireAt: u } of a)
1430
+ if (s < 0 && (!u || !de(u)) && (i ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
1446
1431
  return !0;
1447
1432
  return !1;
1448
1433
  }
@@ -1471,7 +1456,7 @@ class Zt extends m {
1471
1456
  }
1472
1457
  async updateBoost(e, t) {
1473
1458
  const {
1474
- xp: { boost: a }
1459
+ xp: { boost: r }
1475
1460
  } = await this.update(e, [
1476
1461
  {
1477
1462
  $set: {
@@ -1490,15 +1475,15 @@ class Zt extends m {
1490
1475
  }
1491
1476
  }
1492
1477
  ]);
1493
- return a;
1478
+ return r;
1494
1479
  }
1495
1480
  async updateBuff(e, t) {
1496
1481
  if (Array.isArray(t)) {
1497
- for (const r of t)
1498
- await this.updateBuff(e, r);
1482
+ for (const a of t)
1483
+ await this.updateBuff(e, a);
1499
1484
  return;
1500
1485
  }
1501
- const a = We(t);
1486
+ const r = tt(t);
1502
1487
  await this.update(e, [
1503
1488
  {
1504
1489
  $set: {
@@ -1523,10 +1508,10 @@ class Zt extends m {
1523
1508
  then: {
1524
1509
  multiplier: t.multiplier,
1525
1510
  origin: t.origin,
1526
- expireAt: a.expireAt ? {
1511
+ expireAt: r.expireAt ? {
1527
1512
  $cond: {
1528
1513
  if: { $lt: ["$$buff.expireAt", /* @__PURE__ */ new Date()] },
1529
- then: a.expireAt,
1514
+ then: r.expireAt,
1530
1515
  else: {
1531
1516
  $add: [
1532
1517
  "$$buff.expireAt",
@@ -1579,7 +1564,7 @@ class Zt extends m {
1579
1564
  },
1580
1565
  then: `$buffs.${t.target}`,
1581
1566
  else: {
1582
- $concatArrays: [`$buffs.${t.target}`, [{ ...a }]]
1567
+ $concatArrays: [`$buffs.${t.target}`, [{ ...r }]]
1583
1568
  }
1584
1569
  }
1585
1570
  }
@@ -1592,21 +1577,21 @@ class Zt extends m {
1592
1577
  $pull: { [`buffs.${t.target}`]: { origin: t.origin } }
1593
1578
  });
1594
1579
  }
1595
- async updatePanoplyBuff(e, t, a, r) {
1596
- const s = await f.fromDBToEquipableEquipment(t), i = H(Object.values(a)), l = (await A.getAllPopulated()).find(
1597
- ($) => $.panoplyId === s.panoply
1580
+ async updatePanoplyBuff(e, t, r, a) {
1581
+ const s = await m.fromDBToEquipableEquipment(t), i = L(Object.values(r)), o = (await R.getAllPopulated()).find(
1582
+ (g) => g.panoplyId === s.panoply
1598
1583
  );
1599
- if (!l)
1584
+ if (!o)
1600
1585
  return;
1601
- const S = l.equipments.filter(
1602
- ($) => (i.find((ae) => $.entityId === ae.entityId) || !r && s.entityId === $.entityId) && (r ? s.entityId !== $.entityId : !0)
1603
- ).length, x = S === l.equipments.length ? l.fullBonus : S >= l.equipments.length / 2 ? l.halfBonus : void 0;
1604
- l.halfBonus && "target" in l.halfBonus && await this.removeBuff(e, l.halfBonus), l.fullBonus && "target" in l.fullBonus && await this.removeBuff(e, l.fullBonus), x && "target" in x && await this.updateBuff(e, x);
1586
+ const h = o.equipments.filter(
1587
+ (g) => (i.find(($) => g.entityId === $.entityId) || !a && s.entityId === g.entityId) && (a ? s.entityId !== g.entityId : !0)
1588
+ ).length, I = h === o.equipments.length ? o.fullBonus : h >= o.equipments.length / 2 ? o.halfBonus : void 0;
1589
+ o.halfBonus && "target" in o.halfBonus && await this.removeBuff(e, o.halfBonus), o.fullBonus && "target" in o.fullBonus && await this.removeBuff(e, o.fullBonus), I && "target" in I && await this.updateBuff(e, I);
1605
1590
  }
1606
1591
  async gainHp(e, t) {
1607
- const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
1592
+ const r = await this.get(e), s = await this.getMaxHp(e) - r.hp;
1608
1593
  await this.update(e, {
1609
- $set: { hp: a.hp + Math.floor(Math.min(t, s)) }
1594
+ $set: { hp: r.hp + Math.floor(Math.min(t, s)) }
1610
1595
  });
1611
1596
  }
1612
1597
  async loseHp(e, t) {
@@ -1617,14 +1602,14 @@ class Zt extends m {
1617
1602
  ]);
1618
1603
  }
1619
1604
  async updateHp(e, t) {
1620
- const a = await this.getMaxHp(e);
1605
+ const r = await this.getMaxHp(e);
1621
1606
  await this.update(e, [
1622
1607
  {
1623
1608
  $set: {
1624
1609
  hp: {
1625
1610
  $round: [
1626
1611
  {
1627
- $multiply: [{ $divide: ["$hp", t] }, a]
1612
+ $multiply: [{ $divide: ["$hp", t] }, r]
1628
1613
  },
1629
1614
  0
1630
1615
  ]
@@ -1634,23 +1619,23 @@ class Zt extends m {
1634
1619
  ]);
1635
1620
  }
1636
1621
  async addCharacteristics(e, t) {
1637
- const a = await this.getMaxHp(e), r = Object.fromEntries(
1622
+ const r = await this.getMaxHp(e), a = Object.fromEntries(
1638
1623
  Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`characteristics.${s}`, i])
1639
1624
  );
1640
1625
  await this.update(e, {
1641
- $inc: r
1642
- }), await this.updateHp(e, a);
1626
+ $inc: a
1627
+ }), await this.updateHp(e, r);
1643
1628
  }
1644
1629
  async addScrollCharacteristic(e, t) {
1645
- const a = await this.getMaxHp(e), r = Object.fromEntries(
1630
+ const r = await this.getMaxHp(e), a = Object.fromEntries(
1646
1631
  Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`scrolls.${s}`, i])
1647
1632
  );
1648
1633
  await this.update(e, {
1649
- $inc: r
1650
- }), await this.updateHp(e, a);
1634
+ $inc: a
1635
+ }), await this.updateHp(e, r);
1651
1636
  }
1652
1637
  async resetCharacteristics(e) {
1653
- const t = await this.getMaxHp(e), a = {
1638
+ const t = await this.getMaxHp(e), r = {
1654
1639
  vitality: 0,
1655
1640
  strength: 0,
1656
1641
  agility: 0,
@@ -1660,7 +1645,7 @@ class Zt extends m {
1660
1645
  };
1661
1646
  await this.update(e, {
1662
1647
  $set: {
1663
- characteristics: a
1648
+ characteristics: r
1664
1649
  },
1665
1650
  $inc: {
1666
1651
  berry: -1e8
@@ -1694,30 +1679,30 @@ class Zt extends m {
1694
1679
  });
1695
1680
  }
1696
1681
  async updateUserXp(e, t) {
1697
- const a = await this.calcXp(
1682
+ const r = await this.calcXp(
1698
1683
  e,
1699
1684
  t,
1700
1685
  await this.getHpRatio(e)
1701
1686
  );
1702
- return await this.addXp(e, a), a;
1687
+ return await this.addXp(e, r), r;
1703
1688
  }
1704
- async updateUserBerry(e, t, a) {
1705
- const r = await this.calcBerry(e, t, a);
1706
- return await this.addBerry(e, r), r;
1689
+ async updateUserBerry(e, t, r) {
1690
+ const a = await this.calcBerry(e, t, r);
1691
+ return await this.addBerry(e, a), a;
1707
1692
  }
1708
1693
  }
1709
- const en = (n) => I.find(n).lean(), tn = async (n) => await I.create({
1694
+ const yn = (n) => v.find(n).lean(), fn = async (n) => await v.create({
1710
1695
  user: n
1711
1696
  });
1712
- async function nn(n) {
1713
- const e = await I.findOne({ user: n }).lean();
1714
- return e || p(await tn(n));
1697
+ async function mn(n) {
1698
+ const e = await v.findOne({ user: n }).lean();
1699
+ return e || p(await fn(n));
1715
1700
  }
1716
- const an = (n, e) => I.findOneAndUpdate({ user: n }, e, {
1701
+ const hn = (n, e) => v.findOneAndUpdate({ user: n }, e, {
1717
1702
  returnDocument: "after",
1718
1703
  upsert: !0
1719
1704
  }).lean();
1720
- class rn extends Zt {
1705
+ class gn extends pn {
1721
1706
  constructor() {
1722
1707
  super(300);
1723
1708
  }
@@ -1728,17 +1713,17 @@ class rn extends Zt {
1728
1713
  return e;
1729
1714
  }
1730
1715
  fetchFromDb(e) {
1731
- return nn(e);
1716
+ return mn(e);
1732
1717
  }
1733
1718
  fetchManyFromDb(e) {
1734
- return en(e);
1719
+ return yn(e);
1735
1720
  }
1736
1721
  updateInDb(e, t) {
1737
- return an(e, t);
1722
+ return hn(e, t);
1738
1723
  }
1739
1724
  }
1740
- const E = new rn();
1741
- class sn extends m {
1725
+ const O = new gn();
1726
+ class Sn extends f {
1742
1727
  async updateSendDailyQuest(e, t) {
1743
1728
  await this.update(e, { $set: { sendDailyQuest: t } });
1744
1729
  }
@@ -1748,8 +1733,8 @@ class sn extends m {
1748
1733
  async updateInventorySort(e, t) {
1749
1734
  await this.update(e, { $set: { "sort.inventory": t } });
1750
1735
  }
1751
- async updateReminderSettings(e, t, a) {
1752
- await this.update(e, { $set: { [`reminder.${t}`]: a } });
1736
+ async updateReminderSettings(e, t, r) {
1737
+ await this.update(e, { $set: { [`reminder.${t}`]: r } });
1753
1738
  }
1754
1739
  getUsersWithDailyReportEnable() {
1755
1740
  return this.getMany({
@@ -1757,18 +1742,18 @@ class sn extends m {
1757
1742
  });
1758
1743
  }
1759
1744
  }
1760
- const un = (n) => C.find(n).lean(), on = async (n) => await C.create({
1745
+ const wn = (n) => F.find(n).lean(), bn = async (n) => await F.create({
1761
1746
  user: n
1762
1747
  });
1763
- async function cn(n) {
1764
- const e = await C.findOne({ user: n }).lean();
1765
- return e || p(await on(n));
1748
+ async function $n(n) {
1749
+ const e = await F.findOne({ user: n }).lean();
1750
+ return e || p(await bn(n));
1766
1751
  }
1767
- const dn = (n, e) => C.findOneAndUpdate({ user: n }, e, {
1752
+ const In = (n, e) => F.findOneAndUpdate({ user: n }, e, {
1768
1753
  returnDocument: "after",
1769
1754
  upsert: !0
1770
1755
  }).lean();
1771
- class ln extends sn {
1756
+ class Un extends Sn {
1772
1757
  constructor() {
1773
1758
  super(3600);
1774
1759
  }
@@ -1779,17 +1764,17 @@ class ln extends sn {
1779
1764
  return e.user;
1780
1765
  }
1781
1766
  fetchFromDb(e) {
1782
- return cn(e);
1767
+ return $n(e);
1783
1768
  }
1784
1769
  fetchManyFromDb(e) {
1785
- return un(e);
1770
+ return wn(e);
1786
1771
  }
1787
1772
  updateInDb(e, t) {
1788
- return dn(e, t);
1773
+ return In(e, t);
1789
1774
  }
1790
1775
  }
1791
- const Re = new ln();
1792
- class pn extends y {
1776
+ const Fe = new Un();
1777
+ class Tn extends y {
1793
1778
  async getCommandCooldown(e, t) {
1794
1779
  return (await this.get(e)).commands[t];
1795
1780
  }
@@ -1798,33 +1783,33 @@ class pn extends y {
1798
1783
  $set: {
1799
1784
  lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
1800
1785
  }
1801
- }), await E.gainHp(e, 1);
1786
+ }), await O.gainHp(e, 1);
1802
1787
  }
1803
- async useCommand(e, t, a) {
1804
- const { reminder: r } = await Re.get(e);
1788
+ async useCommand(e, t, r) {
1789
+ const { reminder: a } = await Fe.get(e);
1805
1790
  await this.update(e, {
1806
1791
  $set: {
1807
- [`commands.${t}`]: new Date(Date.now() + a)
1792
+ [`commands.${t}`]: new Date(Date.now() + r)
1808
1793
  }
1809
- }), r.commands[t] && await Ut.addReminder(
1794
+ }), a.commands[t] && await Rt.addReminder(
1810
1795
  e,
1811
1796
  `commands/${t}`,
1812
- new Date(Date.now() + a)
1797
+ new Date(Date.now() + r)
1813
1798
  );
1814
1799
  }
1815
1800
  }
1816
- const yn = async (n) => await z.create({
1801
+ const En = async (n) => await W.create({
1817
1802
  user: n
1818
1803
  });
1819
- async function fn(n) {
1820
- const e = await z.findOne({ user: n }).lean();
1821
- return e || p(await yn(n));
1804
+ async function On(n) {
1805
+ const e = await W.findOne({ user: n }).lean();
1806
+ return e || p(await En(n));
1822
1807
  }
1823
- const mn = (n, e) => z.findOneAndUpdate({ user: n }, e, {
1808
+ const Dn = (n, e) => W.findOneAndUpdate({ user: n }, e, {
1824
1809
  returnDocument: "after",
1825
1810
  upsert: !0
1826
1811
  }).lean();
1827
- class hn extends pn {
1812
+ class vn extends Tn {
1828
1813
  constructor() {
1829
1814
  super(300);
1830
1815
  }
@@ -1835,17 +1820,17 @@ class hn extends pn {
1835
1820
  return e.user;
1836
1821
  }
1837
1822
  fetchFromDb(e) {
1838
- return fn(e);
1823
+ return On(e);
1839
1824
  }
1840
1825
  updateInDb(e, t) {
1841
- return mn(e, t);
1826
+ return Dn(e, t);
1842
1827
  }
1843
1828
  }
1844
- const fr = new hn();
1845
- class gn extends m {
1829
+ const Qa = new vn();
1830
+ class Mn extends f {
1846
1831
  async isOrnamentIds(e, t = () => !0) {
1847
- const r = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
1848
- return e.every((s) => r.includes(s));
1832
+ const a = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
1833
+ return e.every((s) => a.includes(s));
1849
1834
  }
1850
1835
  isOrnament(e) {
1851
1836
  return !!e && "ornamentId" in e;
@@ -1881,47 +1866,47 @@ class gn extends m {
1881
1866
  return (await this.getAll()).filter((e) => this.isShopTitle(e));
1882
1867
  }
1883
1868
  formatBackgroundId(e) {
1884
- const t = Xe(e) ? e : e.ornamentId;
1885
- return t === "background_default" ? "par défaut" : `"${Je(t.split("_").join(" "))}"`;
1869
+ const t = ot(e) ? e : e.ornamentId;
1870
+ return t === "background_default" ? "par défaut" : `"${dt(t.split("_").join(" "))}"`;
1886
1871
  }
1887
1872
  async getSomeShopTitles(e) {
1888
1873
  const t = await this.getAllShopTitles();
1889
- return ie(
1890
- pe(
1874
+ return pe(
1875
+ Se(
1891
1876
  e,
1892
1877
  t,
1893
- (a) => a.ornamentId,
1894
- (a) => a.odd ?? 0
1878
+ (r) => r.ornamentId,
1879
+ (r) => r.odd ?? 0
1895
1880
  ),
1896
- (a) => a.price
1881
+ (r) => r.price
1897
1882
  );
1898
1883
  }
1899
1884
  async getSomeBackgrounds(e) {
1900
1885
  const t = await this.getAllBackgrounds();
1901
- return ie(
1902
- pe(
1886
+ return pe(
1887
+ Se(
1903
1888
  e,
1904
1889
  t,
1905
- (a) => a.ornamentId,
1906
- (a) => a.odd ?? 0
1890
+ (r) => r.ornamentId,
1891
+ (r) => r.odd ?? 0
1907
1892
  ),
1908
- (a) => a.price ?? 0
1893
+ (r) => r.price ?? 0
1909
1894
  );
1910
1895
  }
1911
1896
  pickEachRarityOrnament(e, t) {
1912
- if (t.length !== le.length)
1897
+ if (t.length !== ge.length)
1913
1898
  throw new RangeError(
1914
1899
  "pickEachRarityOrnament - must give same number of odds than ranks"
1915
1900
  );
1916
- return H(
1917
- t.map((a, r) => {
1918
- const s = le[r], i = e[s];
1919
- return Math.random() > a || !i || !i.length ? null : Ze(i);
1901
+ return L(
1902
+ t.map((r, a) => {
1903
+ const s = ge[a], i = e[s];
1904
+ return Math.random() > r || !i || !i.length ? null : lt(i);
1920
1905
  })
1921
1906
  );
1922
1907
  }
1923
1908
  }
1924
- const wn = new u(
1909
+ const xn = new c(
1925
1910
  {
1926
1911
  ornamentId: { unique: !0, index: 1, required: !0, type: String },
1927
1912
  type: { required: !0, type: String },
@@ -1935,26 +1920,26 @@ const wn = new u(
1935
1920
  strength: Number
1936
1921
  },
1937
1922
  { minimize: !1 }
1938
- ), oe = c?.Ornaments || d("Ornaments", wn), Sn = async (n, e) => oe.find(n, {}, e).lean();
1939
- async function bn(n) {
1940
- const e = await oe.findOne({ ornamentId: n }).lean();
1923
+ ), fe = d?.Ornaments || l("Ornaments", xn), qn = async (n, e) => fe.find(n, {}, e).lean();
1924
+ async function An(n) {
1925
+ const e = await fe.findOne({ ornamentId: n }).lean();
1941
1926
  return e || null;
1942
1927
  }
1943
- const $n = (n, e) => oe.findOneAndUpdate(n, e, {
1928
+ const kn = (n, e) => fe.findOneAndUpdate(n, e, {
1944
1929
  returnDocument: "after"
1945
1930
  }).lean();
1946
- class Un extends gn {
1931
+ class Rn extends Mn {
1947
1932
  constructor() {
1948
1933
  super(3600);
1949
1934
  }
1950
1935
  updateInDb(e, t) {
1951
- return $n(e, t);
1936
+ return kn(e, t);
1952
1937
  }
1953
1938
  fetchFromDb(e) {
1954
- return bn(e);
1939
+ return An(e);
1955
1940
  }
1956
1941
  fetchManyFromDb(e, t) {
1957
- return Sn(e, t);
1942
+ return qn(e, t);
1958
1943
  }
1959
1944
  getKey(e) {
1960
1945
  return e.ornamentId;
@@ -1963,13 +1948,13 @@ class Un extends gn {
1963
1948
  return e;
1964
1949
  }
1965
1950
  }
1966
- const b = new Un();
1967
- class En extends y {
1951
+ const U = new Rn();
1952
+ class Cn extends y {
1968
1953
  async unlockTitle(e, t) {
1969
- await b.isOrnamentIds([t], b.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
1954
+ await U.isOrnamentIds([t], U.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
1970
1955
  }
1971
1956
  async unlockTitles(e, t) {
1972
- await b.isOrnamentIds(t, b.isTitle) && await this.update(e, {
1957
+ await U.isOrnamentIds(t, U.isTitle) && await this.update(e, {
1973
1958
  $addToSet: { unlockedTitles: { $each: t } }
1974
1959
  });
1975
1960
  }
@@ -1977,17 +1962,17 @@ class En extends y {
1977
1962
  await this.update(e, { $set: { selectedTitle: t } });
1978
1963
  }
1979
1964
  async unlockBackground(e, t) {
1980
- await b.isOrnamentIds(
1965
+ await U.isOrnamentIds(
1981
1966
  [t],
1982
- b.isBackground
1967
+ U.isBackground
1983
1968
  ) && await this.update(e, {
1984
1969
  $addToSet: { unlockedBackgrounds: t }
1985
1970
  });
1986
1971
  }
1987
1972
  async unlockBackgrounds(e, t) {
1988
- await b.isOrnamentIds(
1973
+ await U.isOrnamentIds(
1989
1974
  t,
1990
- b.isBackground
1975
+ U.isBackground
1991
1976
  ) && await this.update(e, {
1992
1977
  $addToSet: { unlockedBackgrounds: { $each: t } }
1993
1978
  });
@@ -1997,9 +1982,9 @@ class En extends y {
1997
1982
  $set: { selectedBackground: t }
1998
1983
  });
1999
1984
  }
2000
- async unlockBadge(e, t, a) {
1985
+ async unlockBadge(e, t, r) {
2001
1986
  t.isProgressive ? await this.update(e, {
2002
- $addToSet: { unlockedBadges: `${t.id}_${a}` }
1987
+ $addToSet: { unlockedBadges: `${t.id}_${r}` }
2003
1988
  }) : await this.update(e, {
2004
1989
  $addToSet: { unlockedBadges: t.id }
2005
1990
  });
@@ -2033,18 +2018,18 @@ class En extends y {
2033
2018
  });
2034
2019
  }
2035
2020
  }
2036
- const Dn = async (n) => await Y.create({
2021
+ const _n = async (n) => await ee.create({
2037
2022
  user: n
2038
2023
  });
2039
- async function In(n) {
2040
- const e = await Y.findOne({ user: n }).lean();
2041
- return e || p(await Dn(n));
2024
+ async function Bn(n) {
2025
+ const e = await ee.findOne({ user: n }).lean();
2026
+ return e || p(await _n(n));
2042
2027
  }
2043
- const Tn = async (n, e) => Y.findOneAndUpdate({ user: n }, e, {
2028
+ const Fn = async (n, e) => ee.findOneAndUpdate({ user: n }, e, {
2044
2029
  upsert: !0,
2045
2030
  returnDocument: "after"
2046
2031
  }).lean();
2047
- class On extends En {
2032
+ class Nn extends Cn {
2048
2033
  constructor() {
2049
2034
  super(300);
2050
2035
  }
@@ -2055,14 +2040,14 @@ class On extends En {
2055
2040
  return e;
2056
2041
  }
2057
2042
  fetchFromDb(e) {
2058
- return In(e);
2043
+ return Bn(e);
2059
2044
  }
2060
2045
  updateInDb(e, t) {
2061
- return Tn(e, t);
2046
+ return Fn(e, t);
2062
2047
  }
2063
2048
  }
2064
- const ye = new On();
2065
- class vn extends m {
2049
+ const we = new Nn();
2050
+ class Kn extends f {
2066
2051
  async getStatus(e, t) {
2067
2052
  return (await this.get({ user: e, questId: t })).status;
2068
2053
  }
@@ -2070,21 +2055,21 @@ class vn extends m {
2070
2055
  return await this.getStatus(e, t) === "COMPLETED";
2071
2056
  }
2072
2057
  async isStreaking(e, t) {
2073
- const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
2074
- return !!a && be(j(), a);
2058
+ const { lastCompletionDate: r } = await this.get({ user: e, questId: t });
2059
+ return !!r && Oe(Y(), r);
2075
2060
  }
2076
2061
  async getStreakMultiplier(e, t) {
2077
- const a = await this.get({ user: e, questId: t });
2078
- return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
2062
+ const r = await this.get({ user: e, questId: t });
2063
+ return await this.isStreaking(e, t) ? 1 + Math.min(2, (r.streak ?? 0) / 10) : 1;
2079
2064
  }
2080
2065
  async getCompletedCount(e) {
2081
- return (await this.getMany({ user: e, status: v.COMPLETED })).length;
2066
+ return (await this.getMany({ user: e, status: q.COMPLETED })).length;
2082
2067
  }
2083
2068
  async completeQuest(e, t = !1) {
2084
- const a = j();
2085
- a.setHours(0, 0, 0, 0);
2086
- const r = /* @__PURE__ */ new Date();
2087
- return r.setHours(0, 0, 0, 0), this.update(
2069
+ const r = Y();
2070
+ r.setHours(0, 0, 0, 0);
2071
+ const a = /* @__PURE__ */ new Date();
2072
+ return a.setHours(0, 0, 0, 0), this.update(
2088
2073
  e,
2089
2074
  [
2090
2075
  {
@@ -2094,8 +2079,8 @@ class vn extends m {
2094
2079
  $cond: {
2095
2080
  if: {
2096
2081
  $and: [
2097
- { $gte: ["$lastCompletionDate", a] },
2098
- { $lt: ["$lastCompletionDate", r] }
2082
+ { $gte: ["$lastCompletionDate", r] },
2083
+ { $lt: ["$lastCompletionDate", a] }
2099
2084
  ]
2100
2085
  },
2101
2086
  then: { $add: [{ $ifNull: ["$streak", 0] }, 1] },
@@ -2104,7 +2089,7 @@ class vn extends m {
2104
2089
  }
2105
2090
  } : {},
2106
2091
  lastCompletionDate: /* @__PURE__ */ new Date(),
2107
- status: v.COMPLETED
2092
+ status: q.COMPLETED
2108
2093
  }
2109
2094
  }
2110
2095
  ],
@@ -2112,24 +2097,24 @@ class vn extends m {
2112
2097
  );
2113
2098
  }
2114
2099
  }
2115
- function Mn(n) {
2116
- return R.find(n).lean();
2100
+ function Hn(n) {
2101
+ return C.find(n).lean();
2117
2102
  }
2118
- const kn = async (n) => await R.create({
2103
+ const Pn = async (n) => await C.create({
2119
2104
  ...n
2120
2105
  });
2121
- async function An(n) {
2122
- const e = await R.findOne(n).lean();
2123
- return e || p(await kn(n));
2106
+ async function jn(n) {
2107
+ const e = await C.findOne(n).lean();
2108
+ return e || p(await Pn(n));
2124
2109
  }
2125
- function Rn(n, e, t) {
2126
- return R.findOneAndUpdate(n, e, {
2110
+ function zn(n, e, t) {
2111
+ return C.findOneAndUpdate(n, e, {
2127
2112
  upsert: !0,
2128
2113
  ...t,
2129
2114
  returnDocument: "after"
2130
2115
  }).lean();
2131
2116
  }
2132
- class qn extends vn {
2117
+ class Ln extends Kn {
2133
2118
  constructor() {
2134
2119
  super(3600);
2135
2120
  }
@@ -2143,17 +2128,17 @@ class qn extends vn {
2143
2128
  return { user: e, questId: t };
2144
2129
  }
2145
2130
  fetchFromDb(e) {
2146
- return An(e);
2131
+ return jn(e);
2147
2132
  }
2148
2133
  fetchManyFromDb(e) {
2149
- return Mn(e);
2134
+ return Hn(e);
2150
2135
  }
2151
- updateInDb(e, t, a) {
2152
- return Rn(e, t, a);
2136
+ updateInDb(e, t, r) {
2137
+ return zn(e, t, r);
2153
2138
  }
2154
2139
  }
2155
- const fe = new qn();
2156
- class xn extends y {
2140
+ const be = new Ln();
2141
+ class Qn extends y {
2157
2142
  async randomMessageIncrement(e) {
2158
2143
  await this.update(e, { $inc: { randomMessageClaimed: 1 } });
2159
2144
  }
@@ -2171,18 +2156,18 @@ class xn extends y {
2171
2156
  await this.update(e, { $inc: { totalMinutesInVoice: t } });
2172
2157
  }
2173
2158
  }
2174
- const Bn = async (n) => await X.create({
2159
+ const Yn = async (n) => await ne.create({
2175
2160
  user: n
2176
2161
  });
2177
- async function Cn(n) {
2178
- const e = await X.findOne({ user: n }).lean();
2179
- return e || p(await Bn(n));
2162
+ async function Gn(n) {
2163
+ const e = await ne.findOne({ user: n }).lean();
2164
+ return e || p(await Yn(n));
2180
2165
  }
2181
- const _n = (n, e) => X.findOneAndUpdate({ user: n }, e, {
2166
+ const Wn = (n, e) => ne.findOneAndUpdate({ user: n }, e, {
2182
2167
  upsert: !0,
2183
2168
  returnDocument: "after"
2184
2169
  }).lean();
2185
- class Fn extends xn {
2170
+ class Vn extends Qn {
2186
2171
  constructor() {
2187
2172
  super(300);
2188
2173
  }
@@ -2195,29 +2180,29 @@ class Fn extends xn {
2195
2180
  return e;
2196
2181
  }
2197
2182
  fetchFromDb(e) {
2198
- return Cn(e);
2183
+ return Gn(e);
2199
2184
  }
2200
2185
  updateInDb(e, t) {
2201
- return _n(e, t);
2186
+ return Wn(e, t);
2202
2187
  }
2203
2188
  }
2204
- const me = new Fn();
2205
- class Nn extends y {
2189
+ const $e = new Vn();
2190
+ class Xn extends y {
2206
2191
  async updateDailyReport(e) {
2207
- const t = await E.get(e), a = await ye.get(e), r = await fe.getMany({
2192
+ const t = await O.get(e), r = await we.get(e), a = await be.getMany({
2208
2193
  user: e,
2209
- status: v.COMPLETED
2210
- }), s = await me.get(e);
2194
+ status: q.COMPLETED
2195
+ }), s = await $e.get(e);
2211
2196
  await this.update(e, {
2212
2197
  $set: {
2213
2198
  xpYesterday: t.xp.amount,
2214
2199
  berryYesterday: t.berry,
2215
- previousCompletedQuest: r.map(
2200
+ previousCompletedQuest: a.map(
2216
2201
  ({ questId: i }) => i
2217
2202
  ),
2218
- "previousOrnament.unlockedBadges": a.unlockedBadges,
2219
- "previousOrnament.unlockedTitles": a.unlockedTitles,
2220
- "previousOrnament.unlockedBackgrounds": a.unlockedBackgrounds,
2203
+ "previousOrnament.unlockedBadges": r.unlockedBadges,
2204
+ "previousOrnament.unlockedTitles": r.unlockedTitles,
2205
+ "previousOrnament.unlockedBackgrounds": r.unlockedBackgrounds,
2221
2206
  previousMessageSent: s.messageSent
2222
2207
  }
2223
2208
  });
@@ -2225,57 +2210,57 @@ class Nn extends y {
2225
2210
  async getDailyReport(e) {
2226
2211
  const {
2227
2212
  previousOrnament: t,
2228
- previousCompletedQuest: a,
2229
- xpYesterday: r,
2213
+ previousCompletedQuest: r,
2214
+ xpYesterday: a,
2230
2215
  berryYesterday: s,
2231
2216
  previousMessageSent: i
2232
- } = await this.get(e), o = await E.get(e), l = await fe.getMany({
2217
+ } = await this.get(e), u = await O.get(e), o = await be.getMany({
2233
2218
  user: e,
2234
- status: v.COMPLETED
2235
- }), S = await ye.get(e), x = await me.get(e), { berry: $, xp: ae } = o, { voice: de, amount: qe } = ae, { unlockedBadges: xe, unlockedBackgrounds: Be, unlockedTitles: Ce } = S;
2219
+ status: q.COMPLETED
2220
+ }), h = await we.get(e), I = await $e.get(e), { berry: g, xp: $ } = u, { voice: he, amount: He } = $, { unlockedBadges: Pe, unlockedBackgrounds: je, unlockedTitles: ze } = h;
2236
2221
  return {
2237
- berry: $ - s,
2238
- xp: qe - r,
2239
- message: x.messageSent - i,
2240
- voice: be(de.lastConnection, j()) ? de.minutesInVoiceToday : 0,
2241
- quest: N(
2242
- l.map(({ questId: _e }) => _e),
2243
- a
2222
+ berry: g - s,
2223
+ xp: He - a,
2224
+ message: I.messageSent - i,
2225
+ voice: Oe(he.lastConnection, Y()) ? he.minutesInVoiceToday : 0,
2226
+ quest: P(
2227
+ o.map(({ questId: Le }) => Le),
2228
+ r
2244
2229
  ),
2245
- badge: N(xe, t.unlockedBadges),
2246
- title: N(Ce, t.unlockedTitles),
2247
- background: N(
2248
- Be,
2230
+ badge: P(Pe, t.unlockedBadges),
2231
+ title: P(ze, t.unlockedTitles),
2232
+ background: P(
2233
+ je,
2249
2234
  t.unlockedBackgrounds
2250
2235
  )
2251
2236
  };
2252
2237
  }
2253
2238
  async getAllDailyReportsToSend() {
2254
- const e = await Re.getUsersWithDailyReportEnable(), t = await yt.getMany({
2255
- _id: { $in: e.map(({ user: a }) => a) },
2239
+ const e = await Fe.getUsersWithDailyReportEnable(), t = await Et.getMany({
2240
+ _id: { $in: e.map(({ user: r }) => r) },
2256
2241
  faction: { $ne: "citizen" }
2257
2242
  });
2258
2243
  return await Promise.all(
2259
- t.map(async ({ _id: a, discordId: r }) => ({
2260
- report: await this.getDailyReport(a),
2261
- user: a,
2262
- discordId: r
2244
+ t.map(async ({ _id: r, discordId: a }) => ({
2245
+ report: await this.getDailyReport(r),
2246
+ user: r,
2247
+ discordId: a
2263
2248
  }))
2264
2249
  );
2265
2250
  }
2266
2251
  }
2267
- const Hn = (n) => L.create({
2252
+ const Jn = (n) => V.create({
2268
2253
  user: n
2269
2254
  });
2270
- async function Kn(n) {
2271
- const e = await L.findOne({ user: n }).lean();
2272
- return e || p(await Hn(n));
2255
+ async function Zn(n) {
2256
+ const e = await V.findOne({ user: n }).lean();
2257
+ return e || p(await Jn(n));
2273
2258
  }
2274
- const jn = (n, e) => L.findOneAndUpdate({ user: n }, e, {
2259
+ const er = (n, e) => V.findOneAndUpdate({ user: n }, e, {
2275
2260
  upsert: !0,
2276
2261
  returnDocument: "after"
2277
2262
  }).lean();
2278
- class Pn extends Nn {
2263
+ class tr extends Xn {
2279
2264
  constructor() {
2280
2265
  super(60);
2281
2266
  }
@@ -2286,21 +2271,21 @@ class Pn extends Nn {
2286
2271
  return e.user;
2287
2272
  }
2288
2273
  fetchFromDb(e) {
2289
- return Kn(e);
2274
+ return Zn(e);
2290
2275
  }
2291
2276
  updateInDb(e, t) {
2292
- return jn(e, t);
2277
+ return er(e, t);
2293
2278
  }
2294
2279
  }
2295
- const mr = new Pn();
2296
- class zn extends y {
2297
- async setGuessGame(e, t, a, r) {
2280
+ const Ya = new tr();
2281
+ class nr extends y {
2282
+ async setGuessGame(e, t, r, a) {
2298
2283
  await this.update(e, {
2299
2284
  $set: {
2300
2285
  guess: {
2301
2286
  amount: t,
2302
- tries: a,
2303
- numberToGuess: r,
2287
+ tries: r,
2288
+ numberToGuess: a,
2304
2289
  lastGuess: 0
2305
2290
  }
2306
2291
  }
@@ -2324,18 +2309,18 @@ class zn extends y {
2324
2309
  });
2325
2310
  }
2326
2311
  }
2327
- const Ln = async (n) => await G.create({
2312
+ const rr = async (n) => await J.create({
2328
2313
  user: n
2329
2314
  });
2330
- async function Qn(n) {
2331
- const e = await G.findOne({ user: n }).lean();
2332
- return e || p(await Ln(n));
2315
+ async function ar(n) {
2316
+ const e = await J.findOne({ user: n }).lean();
2317
+ return e || p(await rr(n));
2333
2318
  }
2334
- const Gn = (n, e) => G.findOneAndUpdate({ user: n }, e, {
2319
+ const sr = (n, e) => J.findOneAndUpdate({ user: n }, e, {
2335
2320
  upsert: !0,
2336
2321
  returnDocument: "after"
2337
2322
  }).lean();
2338
- class Wn extends zn {
2323
+ class ir extends nr {
2339
2324
  constructor() {
2340
2325
  super(300);
2341
2326
  }
@@ -2346,15 +2331,15 @@ class Wn extends zn {
2346
2331
  return e;
2347
2332
  }
2348
2333
  fetchFromDb(e) {
2349
- return Qn(e);
2334
+ return ar(e);
2350
2335
  }
2351
2336
  updateInDb(e, t) {
2352
- return Gn(e, t);
2337
+ return sr(e, t);
2353
2338
  }
2354
2339
  }
2355
- const hr = new Wn(), Yn = new u({
2340
+ const Ga = new ir(), ur = new c({
2356
2341
  user: {
2357
- type: u.Types.ObjectId,
2342
+ type: c.Types.ObjectId,
2358
2343
  required: !0,
2359
2344
  unique: !0,
2360
2345
  ref: "User"
@@ -2362,10 +2347,10 @@ const hr = new Wn(), Yn = new u({
2362
2347
  xp: { type: Number, default: 0 },
2363
2348
  berry: { type: Number, default: 0 },
2364
2349
  faction: { type: Number, default: 0 }
2365
- }), O = c?.UserRank || d("UserRank", Yn);
2366
- class Vn extends y {
2350
+ }), x = d?.UserRank || l("UserRank", ur);
2351
+ class cr extends y {
2367
2352
  async computeAllXpRanks() {
2368
- const t = (await I.aggregate([
2353
+ const t = (await v.aggregate([
2369
2354
  {
2370
2355
  $setWindowFields: {
2371
2356
  sortBy: { "xp.amount": -1 },
@@ -2373,17 +2358,17 @@ class Vn extends y {
2373
2358
  }
2374
2359
  },
2375
2360
  { $project: { user: 1, xpRank: 1 } }
2376
- ])).map(({ user: a, xpRank: r }) => ({
2361
+ ])).map(({ user: r, xpRank: a }) => ({
2377
2362
  updateOne: {
2378
- filter: { user: a },
2379
- update: { $set: { xp: r } },
2363
+ filter: { user: r },
2364
+ update: { $set: { xp: a } },
2380
2365
  upsert: !0
2381
2366
  }
2382
2367
  }));
2383
- t.length > 0 && await O.bulkWrite(t), this.clearAll();
2368
+ t.length > 0 && await x.bulkWrite(t), this.clearAll();
2384
2369
  }
2385
2370
  async computeAllBerryRanks() {
2386
- const t = (await I.aggregate([
2371
+ const t = (await v.aggregate([
2387
2372
  {
2388
2373
  $setWindowFields: {
2389
2374
  sortBy: { berry: -1 },
@@ -2391,17 +2376,17 @@ class Vn extends y {
2391
2376
  }
2392
2377
  },
2393
2378
  { $project: { user: 1, berryRank: 1 } }
2394
- ])).map(({ user: a, berryRank: r }) => ({
2379
+ ])).map(({ user: r, berryRank: a }) => ({
2395
2380
  updateOne: {
2396
- filter: { user: a },
2397
- update: { $set: { berry: r } },
2381
+ filter: { user: r },
2382
+ update: { $set: { berry: a } },
2398
2383
  upsert: !0
2399
2384
  }
2400
2385
  }));
2401
- t.length > 0 && await O.bulkWrite(t), this.clearAll();
2386
+ t.length > 0 && await x.bulkWrite(t), this.clearAll();
2402
2387
  }
2403
2388
  async computeAllFactionRanks() {
2404
- const t = (await w.aggregate([
2389
+ const t = (await b.aggregate([
2405
2390
  {
2406
2391
  $lookup: {
2407
2392
  from: "usermetas",
@@ -2419,14 +2404,14 @@ class Vn extends y {
2419
2404
  }
2420
2405
  },
2421
2406
  { $project: { factionRank: 1 } }
2422
- ])).map(({ _id: a, factionRank: r }) => ({
2407
+ ])).map(({ _id: r, factionRank: a }) => ({
2423
2408
  updateOne: {
2424
- filter: { user: a },
2425
- update: { $set: { faction: r } },
2409
+ filter: { user: r },
2410
+ update: { $set: { faction: a } },
2426
2411
  upsert: !0
2427
2412
  }
2428
2413
  }));
2429
- t.length > 0 && await O.bulkWrite(t), this.clearAll();
2414
+ t.length > 0 && await x.bulkWrite(t), this.clearAll();
2430
2415
  }
2431
2416
  async computeAllRanks() {
2432
2417
  await Promise.all([
@@ -2436,18 +2421,18 @@ class Vn extends y {
2436
2421
  ]);
2437
2422
  }
2438
2423
  }
2439
- const Xn = async (n) => await O.create({
2424
+ const or = async (n) => await x.create({
2440
2425
  user: n
2441
2426
  });
2442
- async function Jn(n) {
2443
- const e = await O.findOne({ user: n }).lean();
2444
- return e || p(await Xn(n));
2427
+ async function dr(n) {
2428
+ const e = await x.findOne({ user: n }).lean();
2429
+ return e || p(await or(n));
2445
2430
  }
2446
- const Zn = (n, e) => O.findOneAndUpdate({ user: n }, e, {
2431
+ const lr = (n, e) => x.findOneAndUpdate({ user: n }, e, {
2447
2432
  returnDocument: "after",
2448
2433
  upsert: !0
2449
2434
  }).lean();
2450
- class ea extends Vn {
2435
+ class pr extends cr {
2451
2436
  constructor() {
2452
2437
  super(300);
2453
2438
  }
@@ -2458,14 +2443,388 @@ class ea extends Vn {
2458
2443
  return e.user;
2459
2444
  }
2460
2445
  fetchFromDb(e) {
2461
- return Jn(e);
2446
+ return dr(e);
2447
+ }
2448
+ updateInDb(e, t) {
2449
+ return lr(e, t);
2450
+ }
2451
+ }
2452
+ const Wa = new pr(), yr = new c(
2453
+ {
2454
+ speakerId: { type: String, required: !0 },
2455
+ order: { type: Number },
2456
+ args: { type: [String], enum: nt, default: void 0 }
2457
+ },
2458
+ { _id: !1 }
2459
+ ), fr = new c(
2460
+ {
2461
+ stepId: { type: String, required: !0 },
2462
+ type: {
2463
+ type: String,
2464
+ required: !0,
2465
+ enum: at
2466
+ },
2467
+ actionType: { type: String, enum: rt },
2468
+ messages: { type: [yr], default: void 0 },
2469
+ payload: { type: c.Types.Mixed, default: void 0 },
2470
+ next: { type: String }
2471
+ },
2472
+ { _id: !1 }
2473
+ ), mr = new c(
2474
+ {
2475
+ sceneId: { type: String, required: !0 },
2476
+ steps: { type: Map, of: fr, required: !0 },
2477
+ entryStepId: { type: String, required: !0 },
2478
+ next: { type: String }
2479
+ },
2480
+ { _id: !1 }
2481
+ ), hr = new c(
2482
+ {
2483
+ chapterId: { type: String, required: !0 },
2484
+ scenes: { type: Map, of: mr, required: !0 },
2485
+ entrySceneId: { type: String, required: !0 },
2486
+ next: { type: String }
2487
+ },
2488
+ { _id: !1 }
2489
+ ), gr = new c(
2490
+ {
2491
+ type: {
2492
+ type: String,
2493
+ required: !0,
2494
+ enum: st
2495
+ },
2496
+ speakerId: { type: String, required: !0 }
2497
+ },
2498
+ { _id: !1 }
2499
+ ), Ne = new c({
2500
+ storyId: {
2501
+ type: String,
2502
+ required: !0,
2503
+ unique: !0
2504
+ },
2505
+ speakers: { type: [gr], required: !0 },
2506
+ chapters: { type: Map, of: hr, required: !0 },
2507
+ entryChapterId: { type: String, required: !0 }
2508
+ });
2509
+ Ne.pre("findOneAndUpdate", function() {
2510
+ this.setOptions({ runValidators: !0 });
2511
+ });
2512
+ const ae = d?.Story || l("Story", Ne), Sr = async (n) => await ae.create(n), j = {
2513
+ storyId: "main",
2514
+ speakers: it,
2515
+ chapters: {
2516
+ [oe.chapterId]: oe
2517
+ },
2518
+ entryChapterId: oe.chapterId
2519
+ };
2520
+ class wr extends f {
2521
+ async seed() {
2522
+ return await this.get(j.storyId) ? this.update({ storyId: j.storyId }, { $set: j }) : Sr(j);
2523
+ }
2524
+ }
2525
+ const br = (n, e = {}) => ae.find(n, null, e).lean(), $r = (n) => ae.findOne({ storyId: n }).lean(), Ir = (n, e) => ae.findOneAndUpdate({ storyId: n }, e, {
2526
+ returnDocument: "after"
2527
+ }).lean();
2528
+ class Ur extends wr {
2529
+ constructor() {
2530
+ super(86400);
2531
+ }
2532
+ normalizeKey(e) {
2533
+ return e;
2534
+ }
2535
+ getKey(e) {
2536
+ return e.storyId;
2537
+ }
2538
+ fetchFromDb(e) {
2539
+ return $r(e);
2540
+ }
2541
+ fetchManyFromDb(e, t) {
2542
+ return br(e, t);
2543
+ }
2544
+ updateInDb(e, t) {
2545
+ const r = typeof e == "string" ? e : e.storyId;
2546
+ return Ir(r, t);
2547
+ }
2548
+ }
2549
+ const T = new Ur(), Tr = new c(
2550
+ {
2551
+ chapterId: { type: String, required: !0 },
2552
+ sceneId: { type: String, required: !0 },
2553
+ stepId: { type: String, required: !0 },
2554
+ value: { type: String, required: !0 }
2555
+ },
2556
+ { _id: !1 }
2557
+ ), Ke = new c({
2558
+ user: {
2559
+ type: c.Types.ObjectId,
2560
+ required: !0,
2561
+ ref: "User",
2562
+ index: !0
2563
+ },
2564
+ storyId: {
2565
+ type: String,
2566
+ required: !0
2567
+ },
2568
+ currentChapterId: { type: String, required: !0 },
2569
+ currentSceneId: { type: String, required: !0 },
2570
+ currentStepId: { type: String, required: !0 },
2571
+ status: {
2572
+ type: String,
2573
+ required: !0,
2574
+ enum: ["in_progress", "completed"],
2575
+ default: "in_progress"
2576
+ },
2577
+ choices: { type: [Tr], default: [] }
2578
+ });
2579
+ Ke.index({ user: 1, storyId: 1 }, { unique: !0 });
2580
+ const H = d?.UserStory || l("UserStory", Ke), Er = async (n, e, t, r, a) => await H.create({
2581
+ user: n,
2582
+ storyId: e,
2583
+ currentChapterId: t,
2584
+ currentSceneId: r,
2585
+ currentStepId: a,
2586
+ status: "in_progress"
2587
+ }), Or = (n, e) => H.deleteOne({ user: n, storyId: e }).then(() => {
2588
+ }), Dr = (n, e, t, r) => {
2589
+ const a = n.chapters[e];
2590
+ if (!a) return null;
2591
+ const s = a.scenes[t];
2592
+ if (!s) return null;
2593
+ if (s.steps[r])
2594
+ return { chapterId: e, sceneId: t, stepId: r };
2595
+ if (s.next) {
2596
+ const i = a.scenes[s.next];
2597
+ if (i)
2598
+ return {
2599
+ chapterId: e,
2600
+ sceneId: s.next,
2601
+ stepId: i.entryStepId
2602
+ };
2603
+ }
2604
+ if (a.next) {
2605
+ const i = n.chapters[a.next];
2606
+ if (i) {
2607
+ const u = i.scenes[i.entrySceneId];
2608
+ if (u)
2609
+ return {
2610
+ chapterId: a.next,
2611
+ sceneId: i.entrySceneId,
2612
+ stepId: u.entryStepId
2613
+ };
2614
+ }
2615
+ }
2616
+ return null;
2617
+ }, z = (n, e) => {
2618
+ const t = n.chapters[e.currentChapterId];
2619
+ if (!t) return null;
2620
+ const r = t.scenes[e.currentSceneId];
2621
+ return r ? r.steps[e.currentStepId] ?? null : null;
2622
+ }, vr = (n, e, t, r, a) => {
2623
+ const s = [], i = /* @__PURE__ */ new Set();
2624
+ let u = n.entryStepId;
2625
+ for (; u && !i.has(u); ) {
2626
+ i.add(u);
2627
+ const o = n.steps[u];
2628
+ if (!o) break;
2629
+ if (o.type !== "action") {
2630
+ if (s.push({ step: o }), u === a) break;
2631
+ u = o.next;
2632
+ continue;
2633
+ }
2634
+ if (o.actionType === "button") {
2635
+ const I = e.find(
2636
+ ($) => $.chapterId === t && $.sceneId === r && $.stepId === u
2637
+ );
2638
+ if (!I) {
2639
+ s.push({ step: o });
2640
+ break;
2641
+ }
2642
+ const g = o.payload.find(
2643
+ ($) => $.actionId === I.value
2644
+ );
2645
+ if (!g || (s.push({ step: o, selectedAction: g }), u === a)) break;
2646
+ u = g.next;
2647
+ continue;
2648
+ }
2649
+ if (s.push({ step: o }), u === a) break;
2650
+ u = o.payload[0]?.next;
2651
+ }
2652
+ return s;
2653
+ };
2654
+ class Mr extends f {
2655
+ async getCurrentStep(e, t) {
2656
+ const r = await this.get({ user: e, storyId: t });
2657
+ if (!r) return null;
2658
+ const a = await T.get(t);
2659
+ return a ? z(a, r) : null;
2660
+ }
2661
+ async getSceneSteps(e, t, r, a) {
2662
+ const s = await this.get({ user: e, storyId: t });
2663
+ if (!s) return null;
2664
+ const i = await T.get(t);
2665
+ if (!i) return null;
2666
+ const u = i.chapters[r];
2667
+ if (!u) return null;
2668
+ const o = u.scenes[a];
2669
+ if (!o) return null;
2670
+ const h = s.status === "in_progress" && s.currentChapterId === r && s.currentSceneId === a;
2671
+ return vr(
2672
+ o,
2673
+ s.choices,
2674
+ r,
2675
+ a,
2676
+ h ? s.currentStepId : void 0
2677
+ );
2678
+ }
2679
+ async start(e, t) {
2680
+ const r = await T.get(t);
2681
+ if (!r) return null;
2682
+ const a = r.chapters[r.entryChapterId];
2683
+ if (!a) return null;
2684
+ const s = a.scenes[a.entrySceneId];
2685
+ if (!s) return null;
2686
+ await Or(e, t), this.invalidate({ user: e, storyId: t });
2687
+ const i = await Er(
2688
+ e,
2689
+ t,
2690
+ r.entryChapterId,
2691
+ a.entrySceneId,
2692
+ s.entryStepId
2693
+ ), u = p(i);
2694
+ return this.cache.set(this.normalizeKey({ user: e, storyId: t }), u), u;
2695
+ }
2696
+ async advanceToNext(e, t) {
2697
+ const r = await this.get({ user: e, storyId: t });
2698
+ if (!r) return { status: "error" };
2699
+ if (r.status === "completed") return { status: "completed" };
2700
+ const a = await T.get(t);
2701
+ if (!a) return { status: "error" };
2702
+ const s = z(a, r);
2703
+ if (!s) return { status: "error" };
2704
+ if (s.type === "action") return { status: "action_required" };
2705
+ if (!s.next) return { status: "scene_ended" };
2706
+ const i = a.chapters[r.currentChapterId];
2707
+ if (!i) return { status: "error" };
2708
+ const u = i.scenes[r.currentSceneId];
2709
+ if (!u) return { status: "error" };
2710
+ if (!u.steps[s.next]) return { status: "scene_ended" };
2711
+ const o = await this.advanceTo(
2712
+ e,
2713
+ t,
2714
+ a,
2715
+ r.currentChapterId,
2716
+ r.currentSceneId,
2717
+ s.next
2718
+ );
2719
+ return o ? { status: "advanced", data: o } : { status: "error" };
2720
+ }
2721
+ async advanceToNextScene(e, t) {
2722
+ const r = await this.get({ user: e, storyId: t });
2723
+ if (!r || r.status === "completed") return null;
2724
+ const a = await T.get(t);
2725
+ if (!a) return null;
2726
+ const s = a.chapters[r.currentChapterId];
2727
+ if (!s) return null;
2728
+ const i = s.scenes[r.currentSceneId];
2729
+ if (!i || !i.next) return null;
2730
+ const u = s.scenes[i.next];
2731
+ return u ? this.update(
2732
+ { user: e, storyId: t },
2733
+ {
2734
+ $set: {
2735
+ currentSceneId: i.next,
2736
+ currentStepId: u.entryStepId
2737
+ }
2738
+ }
2739
+ ) : null;
2740
+ }
2741
+ async validateCommandAndAdvance(e, t, r) {
2742
+ const a = await this.get({ user: e, storyId: t });
2743
+ if (!a || a.status === "completed") return null;
2744
+ const s = await T.get(t);
2745
+ if (!s) return null;
2746
+ const i = z(s, a);
2747
+ if (!i || i.type !== "action" || i.actionType !== "command")
2748
+ return null;
2749
+ const u = i.payload.find((o) => o.commandId === r);
2750
+ return u ? this.advanceTo(
2751
+ e,
2752
+ t,
2753
+ s,
2754
+ a.currentChapterId,
2755
+ a.currentSceneId,
2756
+ u.next
2757
+ ) : null;
2758
+ }
2759
+ async validateActionAndAdvance(e, t, r) {
2760
+ const a = await this.get({ user: e, storyId: t });
2761
+ if (!a || a.status === "completed") return null;
2762
+ const s = await T.get(t);
2763
+ if (!s) return null;
2764
+ const i = z(s, a);
2765
+ if (!i || i.type !== "action") return null;
2766
+ const u = i.payload.find((o) => o.actionId === r);
2767
+ return u ? this.advanceTo(
2768
+ e,
2769
+ t,
2770
+ s,
2771
+ a.currentChapterId,
2772
+ a.currentSceneId,
2773
+ u.next,
2774
+ {
2775
+ chapterId: a.currentChapterId,
2776
+ sceneId: a.currentSceneId,
2777
+ stepId: a.currentStepId,
2778
+ value: r
2779
+ }
2780
+ ) : null;
2781
+ }
2782
+ async advanceTo(e, t, r, a, s, i, u) {
2783
+ const o = Dr(r, a, s, i);
2784
+ return o ? this.update(
2785
+ { user: e, storyId: t },
2786
+ {
2787
+ $set: {
2788
+ currentChapterId: o.chapterId,
2789
+ currentSceneId: o.sceneId,
2790
+ currentStepId: o.stepId
2791
+ },
2792
+ ...u && { $push: { choices: u } }
2793
+ }
2794
+ ) : this.update(
2795
+ { user: e, storyId: t },
2796
+ {
2797
+ $set: { status: "completed" },
2798
+ ...u && { $push: { choices: u } }
2799
+ }
2800
+ );
2801
+ }
2802
+ }
2803
+ const xr = (n, e = {}) => H.find(n, null, e).lean(), qr = (n, e) => H.findOne({ user: n, storyId: e }).lean(), Ar = (n, e) => H.findOneAndUpdate(n, e, {
2804
+ returnDocument: "after"
2805
+ }).lean();
2806
+ class kr extends Mr {
2807
+ constructor() {
2808
+ super(120);
2809
+ }
2810
+ normalizeKey(e) {
2811
+ return `${e.user.toString()}:${e.storyId}`;
2812
+ }
2813
+ getKey(e) {
2814
+ return { user: e.user, storyId: e.storyId };
2815
+ }
2816
+ fetchFromDb(e) {
2817
+ return qr(e.user, e.storyId);
2818
+ }
2819
+ fetchManyFromDb(e, t) {
2820
+ return xr(e, t);
2462
2821
  }
2463
2822
  updateInDb(e, t) {
2464
- return Zn(e, t);
2823
+ return Ar(e, t);
2465
2824
  }
2466
2825
  }
2467
- const gr = new ea();
2468
- class ta extends y {
2826
+ const Va = new kr();
2827
+ class Rr extends y {
2469
2828
  async didSevenDoubleAtDoQ(e) {
2470
2829
  await this.update(e, {
2471
2830
  $inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
@@ -2474,11 +2833,11 @@ class ta extends y {
2474
2833
  async winWithBlackjack(e) {
2475
2834
  await this.update(e, { $inc: { "blackJack.blackJackCount": 1 } });
2476
2835
  }
2477
- async updateLastGames(e, t, a) {
2836
+ async updateLastGames(e, t, r) {
2478
2837
  await this.update(e, {
2479
2838
  $push: {
2480
2839
  lastGames: {
2481
- $each: [{ gameType: t, endState: a }],
2840
+ $each: [{ gameType: t, endState: r }],
2482
2841
  $position: 0,
2483
2842
  $slice: 20
2484
2843
  }
@@ -2489,19 +2848,19 @@ class ta extends y {
2489
2848
  await this.update(e, { $inc: { drawCount: 1 } });
2490
2849
  }
2491
2850
  async bet666(e) {
2492
- const t = j();
2851
+ const t = Y();
2493
2852
  t.setHours(0, 0, 0, 0);
2494
- const a = /* @__PURE__ */ new Date();
2495
- a.setHours(0, 0, 0, 0), await M.updateOne(
2853
+ const r = /* @__PURE__ */ new Date();
2854
+ r.setHours(0, 0, 0, 0), await A.updateOne(
2496
2855
  {
2497
2856
  user: e,
2498
2857
  "bet666.last": {
2499
2858
  $gte: t,
2500
- $lt: a
2859
+ $lt: r
2501
2860
  }
2502
2861
  },
2503
2862
  { $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
2504
- ), await M.updateOne(
2863
+ ), await A.updateOne(
2505
2864
  {
2506
2865
  user: e,
2507
2866
  "bet666.last": {
@@ -2544,18 +2903,18 @@ class ta extends y {
2544
2903
  await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
2545
2904
  }
2546
2905
  }
2547
- const na = async (n) => await M.create({
2906
+ const Cr = async (n) => await A.create({
2548
2907
  user: n
2549
2908
  });
2550
- async function aa(n) {
2551
- const e = await M.findOne({ user: n }).lean();
2552
- return e || p(await na(n));
2909
+ async function _r(n) {
2910
+ const e = await A.findOne({ user: n }).lean();
2911
+ return e || p(await Cr(n));
2553
2912
  }
2554
- const ra = (n, e) => M.findOneAndUpdate({ user: n }, e, {
2913
+ const Br = (n, e) => A.findOneAndUpdate({ user: n }, e, {
2555
2914
  upsert: !0,
2556
2915
  returnDocument: "after"
2557
2916
  }).lean();
2558
- class sa extends ta {
2917
+ class Fr extends Rr {
2559
2918
  constructor() {
2560
2919
  super(300);
2561
2920
  }
@@ -2566,14 +2925,14 @@ class sa extends ta {
2566
2925
  return e;
2567
2926
  }
2568
2927
  fetchFromDb(e) {
2569
- return aa(e);
2928
+ return _r(e);
2570
2929
  }
2571
2930
  updateInDb(e, t) {
2572
- return ra(e, t);
2931
+ return Br(e, t);
2573
2932
  }
2574
2933
  }
2575
- const wr = new sa();
2576
- class ia extends y {
2934
+ const Xa = new Fr();
2935
+ class Nr extends y {
2577
2936
  async workIncrement(e) {
2578
2937
  await this.update(e, { $inc: { workCount: 1 } });
2579
2938
  }
@@ -2585,18 +2944,18 @@ class ia extends y {
2585
2944
  });
2586
2945
  }
2587
2946
  }
2588
- const ua = (n) => V.create({
2947
+ const Kr = (n) => te.create({
2589
2948
  user: n
2590
2949
  });
2591
- async function oa(n) {
2592
- const e = await V.findOne({ user: n }).lean();
2593
- return e || p(await ua(n));
2950
+ async function Hr(n) {
2951
+ const e = await te.findOne({ user: n }).lean();
2952
+ return e || p(await Kr(n));
2594
2953
  }
2595
- const ca = (n, e) => V.findOneAndUpdate({ user: n }, e, {
2954
+ const Pr = (n, e) => te.findOneAndUpdate({ user: n }, e, {
2596
2955
  upsert: !0,
2597
2956
  returnDocument: "after"
2598
2957
  }).lean();
2599
- class da extends ia {
2958
+ class jr extends Nr {
2600
2959
  constructor() {
2601
2960
  super(300);
2602
2961
  }
@@ -2607,14 +2966,14 @@ class da extends ia {
2607
2966
  return e;
2608
2967
  }
2609
2968
  fetchFromDb(e) {
2610
- return oa(e);
2969
+ return Hr(e);
2611
2970
  }
2612
2971
  updateInDb(e, t) {
2613
- return ca(e, t);
2972
+ return Pr(e, t);
2614
2973
  }
2615
2974
  }
2616
- const Sr = new da();
2617
- class la extends y {
2975
+ const Ja = new jr();
2976
+ class zr extends y {
2618
2977
  async hasReportedSomeone(e) {
2619
2978
  await this.update(e, { $set: { reportedSomeone: !0 } });
2620
2979
  }
@@ -2645,18 +3004,18 @@ class la extends y {
2645
3004
  await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
2646
3005
  }
2647
3006
  }
2648
- const pa = async (n) => await J.create({
3007
+ const Lr = async (n) => await re.create({
2649
3008
  user: n
2650
3009
  });
2651
- async function ya(n) {
2652
- const e = await J.findOne({ user: n }).lean();
2653
- return e || p(await pa(n));
3010
+ async function Qr(n) {
3011
+ const e = await re.findOne({ user: n }).lean();
3012
+ return e || p(await Lr(n));
2654
3013
  }
2655
- const fa = (n, e) => J.findOneAndUpdate({ user: n }, e, {
3014
+ const Yr = (n, e) => re.findOneAndUpdate({ user: n }, e, {
2656
3015
  upsert: !0,
2657
3016
  returnDocument: "after"
2658
3017
  }).lean();
2659
- class ma extends la {
3018
+ class Gr extends zr {
2660
3019
  constructor() {
2661
3020
  super(300);
2662
3021
  }
@@ -2667,14 +3026,14 @@ class ma extends la {
2667
3026
  return e;
2668
3027
  }
2669
3028
  fetchFromDb(e) {
2670
- return ya(e);
3029
+ return Qr(e);
2671
3030
  }
2672
3031
  updateInDb(e, t) {
2673
- return fa(e, t);
3032
+ return Yr(e, t);
2674
3033
  }
2675
3034
  }
2676
- const br = new ma();
2677
- class ha extends y {
3035
+ const Za = new Gr();
3036
+ class Wr extends y {
2678
3037
  async readEdito(e) {
2679
3038
  const t = /* @__PURE__ */ new Date();
2680
3039
  t.setHours(0, 0, 0, 0), await D.updateOne(
@@ -2713,18 +3072,18 @@ class ha extends y {
2713
3072
  ]))[0]?.total ?? 0;
2714
3073
  }
2715
3074
  }
2716
- const ga = async (n) => await D.create({
3075
+ const Vr = async (n) => await D.create({
2717
3076
  user: n
2718
3077
  });
2719
- async function wa(n) {
3078
+ async function Xr(n) {
2720
3079
  const e = await D.findOne({ user: n }).lean();
2721
- return e || p(await ga(n));
3080
+ return e || p(await Vr(n));
2722
3081
  }
2723
- const Sa = (n, e) => D.findOneAndUpdate({ user: n }, e, {
3082
+ const Jr = (n, e) => D.findOneAndUpdate({ user: n }, e, {
2724
3083
  upsert: !0,
2725
3084
  returnDocument: "after"
2726
3085
  }).lean();
2727
- class ba extends ha {
3086
+ class Zr extends Wr {
2728
3087
  constructor() {
2729
3088
  super(300);
2730
3089
  }
@@ -2735,39 +3094,39 @@ class ba extends ha {
2735
3094
  return e;
2736
3095
  }
2737
3096
  fetchFromDb(e) {
2738
- return wa(e);
3097
+ return Xr(e);
2739
3098
  }
2740
3099
  updateInDb(e, t) {
2741
- return Sa(e, t);
3100
+ return Jr(e, t);
2742
3101
  }
2743
3102
  }
2744
- const $r = new ba();
2745
- class $a extends y {
2746
- async updateCraftStats(e, t, a) {
2747
- const r = await f.get(a);
2748
- !r || !f.isItem(r) || await this.update(e, {
3103
+ const es = new Zr();
3104
+ class ea extends y {
3105
+ async updateCraftStats(e, t, r) {
3106
+ const a = await m.get(r);
3107
+ !a || !m.isItem(a) || await this.update(e, {
2749
3108
  $inc: {
2750
3109
  "crafts.totalCrafted": t
2751
3110
  }
2752
3111
  });
2753
3112
  }
2754
- async incrementAlcoholDrink(e, t, a) {
3113
+ async incrementAlcoholDrink(e, t, r) {
2755
3114
  ["wine", "beer", "rhum"].includes(t) && await this.update(e, {
2756
3115
  $inc: {
2757
- "alcohols.wines": t === "wine" ? a : 0,
2758
- "alcohols.beers": t === "beer" ? a : 0,
2759
- "alcohols.rhums": t === "rhum" ? a : 0,
2760
- "alcohols.totalConsumed": a
3116
+ "alcohols.wines": t === "wine" ? r : 0,
3117
+ "alcohols.beers": t === "beer" ? r : 0,
3118
+ "alcohols.rhums": t === "rhum" ? r : 0,
3119
+ "alcohols.totalConsumed": r
2761
3120
  }
2762
3121
  });
2763
3122
  }
2764
3123
  async incrementBottleUsedToday(e, t) {
2765
- const a = /* @__PURE__ */ new Date();
2766
- a.setHours(0, 0, 0, 0), await k.updateOne(
3124
+ const r = /* @__PURE__ */ new Date();
3125
+ r.setHours(0, 0, 0, 0), await k.updateOne(
2767
3126
  {
2768
3127
  user: e,
2769
3128
  "bottle.lastUsed": {
2770
- $gte: a
3129
+ $gte: r
2771
3130
  }
2772
3131
  },
2773
3132
  {
@@ -2778,7 +3137,7 @@ class $a extends y {
2778
3137
  {
2779
3138
  user: e,
2780
3139
  "bottle.lastUsed": {
2781
- $lt: a
3140
+ $lt: r
2782
3141
  }
2783
3142
  },
2784
3143
  {
@@ -2800,18 +3159,18 @@ class $a extends y {
2800
3159
  });
2801
3160
  }
2802
3161
  }
2803
- const Ua = async (n) => await k.create({
3162
+ const ta = async (n) => await k.create({
2804
3163
  user: n
2805
3164
  });
2806
- async function Ea(n) {
3165
+ async function na(n) {
2807
3166
  const e = await k.findOne({ user: n }).lean();
2808
- return e || p(await Ua(n));
3167
+ return e || p(await ta(n));
2809
3168
  }
2810
- const Da = (n, e) => k.findOneAndUpdate({ user: n }, e, {
3169
+ const ra = (n, e) => k.findOneAndUpdate({ user: n }, e, {
2811
3170
  upsert: !0,
2812
3171
  returnDocument: "after"
2813
3172
  }).lean();
2814
- class Ia extends $a {
3173
+ class aa extends ea {
2815
3174
  constructor() {
2816
3175
  super(300);
2817
3176
  }
@@ -2822,97 +3181,97 @@ class Ia extends $a {
2822
3181
  return e;
2823
3182
  }
2824
3183
  fetchFromDb(e) {
2825
- return Ea(e);
3184
+ return na(e);
2826
3185
  }
2827
3186
  updateInDb(e, t) {
2828
- return Da(e, t);
3187
+ return ra(e, t);
2829
3188
  }
2830
3189
  }
2831
- const Ur = new Ia();
2832
- class Ta extends m {
3190
+ const ts = new aa();
3191
+ class sa extends f {
2833
3192
  async maxCraftQuantity(e, t) {
2834
- const a = await U.get(e);
2835
- let r = 1 / 0;
3193
+ const r = await E.get(e);
3194
+ let a = 1 / 0;
2836
3195
  for (const s of t)
2837
- r = Math.min(
2838
- r,
3196
+ a = Math.min(
3197
+ a,
2839
3198
  Math.floor(
2840
- (a.itemList[s.entityId] ?? 0) / s.size
3199
+ (r.itemList[s.entityId] ?? 0) / s.size
2841
3200
  )
2842
3201
  );
2843
- return r;
3202
+ return a;
2844
3203
  }
2845
- async hasEnoughItemsForRecipe(e, t, a) {
2846
- const r = await U.get(e);
3204
+ async hasEnoughItemsForRecipe(e, t, r) {
3205
+ const a = await E.get(e);
2847
3206
  for (const s of t.entities)
2848
- if ((r.itemList[s.entityId] ?? 0) < s.size * a)
3207
+ if ((a.itemList[s.entityId] ?? 0) < s.size * r)
2849
3208
  return !1;
2850
3209
  return !0;
2851
3210
  }
2852
3211
  decodeCraftId(e) {
2853
- return e.split(";").map((t, a) => ({
3212
+ return e.split(";").map((t, r) => ({
2854
3213
  entityId: t === "null" ? null : t,
2855
- index: a
3214
+ index: r
2856
3215
  }));
2857
3216
  }
2858
3217
  encodeCraftId(e) {
2859
3218
  return e.map(({ entityId: t }) => `${t}`).join(";");
2860
3219
  }
2861
3220
  async isValidRecipe(e) {
2862
- return !!(await this.getAll()).find((a) => a.craftId === e);
3221
+ return !!(await this.getAll()).find((r) => r.craftId === e);
2863
3222
  }
2864
3223
  async getRecipeResult(e, t) {
2865
- const a = await U.get(e), r = (await A.getPanoplyBonus(a.equippedItems)).find(
3224
+ const r = await E.get(e), a = (await R.getPanoplyBonus(r.equippedItems)).find(
2866
3225
  ([s, i]) => s.panoplyId === "little_blacksmith" && i !== null
2867
3226
  );
2868
- return r?.[1] === "full" && t === "chest_3" ? "chest_blacksmith_3" : r?.[1] === "half" && t === "chest_2" ? "chest_blacksmith_2" : r?.[1] === "half" && t === "chest_1" ? "chest_blacksmith_1" : t;
3227
+ 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;
2869
3228
  }
2870
3229
  }
2871
- const Oa = new u(
3230
+ const ia = new c(
2872
3231
  {
2873
3232
  entityId: { type: String, required: !0 },
2874
3233
  size: { type: Number, required: !0 }
2875
3234
  },
2876
3235
  { _id: !1 }
2877
- ), va = new u(
3236
+ ), ua = new c(
2878
3237
  {
2879
3238
  entityId: { type: String, required: !0 },
2880
3239
  size: { type: Number, required: !0 }
2881
3240
  },
2882
3241
  { _id: !1 }
2883
- ), Ma = new u(
3242
+ ), ca = new c(
2884
3243
  {
2885
3244
  craftId: { type: String, unique: !0, required: !0 },
2886
3245
  name: { type: String, required: !0 },
2887
- entities: { type: [Oa], required: !0 },
2888
- result: { type: va, required: !0 }
3246
+ entities: { type: [ia], required: !0 },
3247
+ result: { type: ua, required: !0 }
2889
3248
  },
2890
3249
  { minimize: !1 }
2891
- ), Z = c?.Recipes || d("Recipes", Ma), ka = async (n) => await Z.create({
3250
+ ), se = d?.Recipes || l("Recipes", ca), oa = async (n) => await se.create({
2892
3251
  ...n
2893
- }), Aa = async (n, e) => Z.find(n, {}, e).lean();
2894
- async function Ra(n) {
2895
- const e = await Z.findOne({ craftId: n }).lean();
3252
+ }), da = async (n, e) => se.find(n, {}, e).lean();
3253
+ async function la(n) {
3254
+ const e = await se.findOne({ craftId: n }).lean();
2896
3255
  return e || null;
2897
3256
  }
2898
- const qa = (n, e) => Z.findOneAndUpdate(n, e, {
3257
+ const pa = (n, e) => se.findOneAndUpdate(n, e, {
2899
3258
  returnDocument: "after"
2900
3259
  }).lean();
2901
- class xa extends Ta {
3260
+ class ya extends sa {
2902
3261
  constructor() {
2903
3262
  super(3600);
2904
3263
  }
2905
3264
  createInDb(e) {
2906
- return ka(e);
3265
+ return oa(e);
2907
3266
  }
2908
3267
  updateInDb(e, t) {
2909
- return qa(e, t);
3268
+ return pa(e, t);
2910
3269
  }
2911
3270
  fetchFromDb(e) {
2912
- return Ra(e);
3271
+ return la(e);
2913
3272
  }
2914
3273
  fetchManyFromDb(e, t) {
2915
- return Aa(e, t);
3274
+ return da(e, t);
2916
3275
  }
2917
3276
  normalizeKey(e) {
2918
3277
  return e;
@@ -2921,35 +3280,35 @@ class xa extends Ta {
2921
3280
  return e.craftId;
2922
3281
  }
2923
3282
  }
2924
- const Er = new xa(), Ba = new u({
3283
+ const ns = new ya(), fa = new c({
2925
3284
  bannedUserId: { type: String, index: !0, required: !0 },
2926
3285
  authorId: { type: String, required: !0 },
2927
3286
  unbannedTimestamp: { type: Date, index: 1 },
2928
3287
  reason: { type: String, required: !0 },
2929
3288
  guildId: { type: String, required: !0 }
2930
- }), ee = c?.Bans || d("Bans", Ba), Ca = (n, e) => ee.deleteOne({ bannedUserId: n, guildId: e });
2931
- class _a extends m {
3289
+ }), ie = d?.Bans || l("Bans", fa), ma = (n, e) => ie.deleteOne({ bannedUserId: n, guildId: e });
3290
+ class ha extends f {
2932
3291
  async getUnbanUsers() {
2933
3292
  return this.getMany({
2934
3293
  unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
2935
3294
  });
2936
3295
  }
2937
- async banUserFromGuild({ bannedUserId: e, guildId: t, ...a }) {
2938
- await this.update({ bannedUserId: e, guildId: t }, { ...a });
3296
+ async banUserFromGuild({ bannedUserId: e, guildId: t, ...r }) {
3297
+ await this.update({ bannedUserId: e, guildId: t }, { ...r });
2939
3298
  }
2940
3299
  async isBannedFromGuild(e, t) {
2941
- const a = await this.get({ bannedUserId: e, guildId: t });
2942
- return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
3300
+ const r = await this.get({ bannedUserId: e, guildId: t });
3301
+ return !!(r && (!r.unbannedTimestamp || r.unbannedTimestamp > /* @__PURE__ */ new Date()));
2943
3302
  }
2944
3303
  async deleteBan(e, t) {
2945
- await Ca(e, t), this.invalidate({ bannedUserId: e, guildId: t });
3304
+ await ma(e, t), this.invalidate({ bannedUserId: e, guildId: t });
2946
3305
  }
2947
3306
  }
2948
- const Fa = (n) => ee.find(n).lean(), Na = (n) => ee.findOne(n).lean(), Ha = (n, e) => ee.findOneAndUpdate(n, e, {
3307
+ const ga = (n) => ie.find(n).lean(), Sa = (n) => ie.findOne(n).lean(), wa = (n, e) => ie.findOneAndUpdate(n, e, {
2949
3308
  returnDocument: "after",
2950
3309
  upsert: !0
2951
3310
  }).lean();
2952
- class Ka extends _a {
3311
+ class ba extends ha {
2953
3312
  constructor() {
2954
3313
  super(3600 * 36);
2955
3314
  }
@@ -2960,23 +3319,23 @@ class Ka extends _a {
2960
3319
  return { bannedUserId: e, guildId: t };
2961
3320
  }
2962
3321
  fetchFromDb(e) {
2963
- return Na(e);
3322
+ return Sa(e);
2964
3323
  }
2965
3324
  fetchManyFromDb(e) {
2966
- return Fa(e);
3325
+ return ga(e);
2967
3326
  }
2968
3327
  updateInDb(e, t) {
2969
- return Ha(e, t);
3328
+ return wa(e, t);
2970
3329
  }
2971
3330
  }
2972
- const Dr = new Ka(), ja = new u({
3331
+ const rs = new ba(), $a = new c({
2973
3332
  senderId: {
2974
- type: u.Types.ObjectId,
3333
+ type: c.Types.ObjectId,
2975
3334
  required: !0,
2976
3335
  ref: "User"
2977
3336
  },
2978
3337
  receiverId: {
2979
- type: u.Types.ObjectId,
3338
+ type: c.Types.ObjectId,
2980
3339
  required: !0,
2981
3340
  index: !0,
2982
3341
  ref: "User"
@@ -2986,36 +3345,36 @@ const Dr = new Ka(), ja = new u({
2986
3345
  meta: {
2987
3346
  rps: { type: String, default: void 0 }
2988
3347
  }
2989
- }), te = c?.Invitation || d("Invitation", ja), Pa = (n) => te.create({
3348
+ }), ue = d?.Invitation || l("Invitation", $a), Ia = (n) => ue.create({
2990
3349
  ...n
2991
- }), za = async (n) => {
2992
- await te.deleteMany({
3350
+ }), Ua = async (n) => {
3351
+ await ue.deleteMany({
2993
3352
  ...n
2994
3353
  });
2995
3354
  };
2996
- class La extends y {
3355
+ class Ta extends y {
2997
3356
  async sendInvitation({
2998
3357
  senderId: e,
2999
3358
  receiverId: t,
3000
- gameMode: a,
3001
- ...r
3359
+ gameMode: r,
3360
+ ...a
3002
3361
  }) {
3003
- return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? null : await Pa({ ...r, senderId: e, gameMode: a, receiverId: t });
3362
+ return await this.get({ senderId: e, gameMode: r, receiverId: t }) ? null : await Ia({ ...a, senderId: e, gameMode: r, receiverId: t });
3004
3363
  }
3005
3364
  async deleteInvitation({
3006
3365
  senderId: e,
3007
3366
  receiverId: t,
3008
- gameMode: a
3367
+ gameMode: r
3009
3368
  }) {
3010
- await za({ senderId: e, gameMode: a, receiverId: t }), this.invalidate({ senderId: e, gameMode: a, receiverId: t });
3369
+ await Ua({ senderId: e, gameMode: r, receiverId: t }), this.invalidate({ senderId: e, gameMode: r, receiverId: t });
3011
3370
  }
3012
3371
  }
3013
- const Qa = (n) => te.findOne({
3372
+ const Ea = (n) => ue.findOne({
3014
3373
  ...n
3015
- }).lean(), Ga = (n, e) => te.findOneAndUpdate(n, e, {
3374
+ }).lean(), Oa = (n, e) => ue.findOneAndUpdate(n, e, {
3016
3375
  returnDocument: "after"
3017
3376
  }).lean();
3018
- class Wa extends La {
3377
+ class Da extends Ta {
3019
3378
  constructor() {
3020
3379
  super(3600);
3021
3380
  }
@@ -3025,21 +3384,21 @@ class Wa extends La {
3025
3384
  getKey({
3026
3385
  receiverId: e,
3027
3386
  gameMode: t,
3028
- senderId: a
3387
+ senderId: r
3029
3388
  }) {
3030
- return { gameMode: t, receiverId: e, senderId: a };
3389
+ return { gameMode: t, receiverId: e, senderId: r };
3031
3390
  }
3032
3391
  fetchFromDb(e) {
3033
- return Qa(e);
3392
+ return Ea(e);
3034
3393
  }
3035
3394
  updateInDb(e, t) {
3036
- return Ga(e, t);
3395
+ return Oa(e, t);
3037
3396
  }
3038
3397
  }
3039
- const Ir = new Wa();
3040
- class Ya extends y {
3398
+ const as = new Da();
3399
+ class va extends y {
3041
3400
  async randomizeEditoPrice(e) {
3042
- const t = Se(100, 1001);
3401
+ const t = Ee(100, 1001);
3043
3402
  return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
3044
3403
  }
3045
3404
  async setEditoMessageId(e, t) {
@@ -3051,11 +3410,11 @@ class Ya extends y {
3051
3410
  { $set: { "ranking.messageId": t } }
3052
3411
  );
3053
3412
  }
3054
- async addCrewChannelId(e, t, a) {
3413
+ async addCrewChannelId(e, t, r) {
3055
3414
  await this.update(
3056
3415
  { guildId: e },
3057
3416
  {
3058
- $push: { "crew.crewChannelIds": { channelId: a, crewId: t } }
3417
+ $push: { "crew.crewChannelIds": { channelId: r, crewId: t } }
3059
3418
  }
3060
3419
  );
3061
3420
  }
@@ -3064,7 +3423,7 @@ class Ya extends y {
3064
3423
  { guildId: e },
3065
3424
  {
3066
3425
  $set: Object.fromEntries(
3067
- Object.entries(t).map(([a, r]) => [`roles.${a}`, r])
3426
+ Object.entries(t).map(([r, a]) => [`roles.${r}`, a])
3068
3427
  )
3069
3428
  }
3070
3429
  );
@@ -3074,16 +3433,16 @@ class Ya extends y {
3074
3433
  { guildId: e },
3075
3434
  {
3076
3435
  $set: Object.fromEntries(
3077
- Object.entries(t).map(([a, r]) => [
3078
- `channels.${a}`,
3079
- r
3436
+ Object.entries(t).map(([r, a]) => [
3437
+ `channels.${r}`,
3438
+ a
3080
3439
  ])
3081
3440
  )
3082
3441
  }
3083
3442
  );
3084
3443
  }
3085
3444
  }
3086
- const Va = new u({
3445
+ const Ma = new c({
3087
3446
  guildId: { type: String, required: !0, unique: !0 },
3088
3447
  ranking: {
3089
3448
  messageId: { type: String, default: null }
@@ -3131,16 +3490,16 @@ const Va = new u({
3131
3490
  default: []
3132
3491
  }
3133
3492
  }
3134
- }), ce = c?.Settings || d("Settings", Va), Xa = (n) => ce.create({
3493
+ }), me = d?.Settings || l("Settings", Ma), xa = (n) => me.create({
3135
3494
  guildId: n
3136
- }), Ja = async (n) => {
3137
- const e = await ce.findOne({ guildId: n }).lean();
3138
- return e || p(await Xa(n));
3139
- }, Za = (n, e) => ce.findOneAndUpdate(n, e, {
3495
+ }), qa = async (n) => {
3496
+ const e = await me.findOne({ guildId: n }).lean();
3497
+ return e || p(await xa(n));
3498
+ }, Aa = (n, e) => me.findOneAndUpdate(n, e, {
3140
3499
  upsert: !0,
3141
3500
  returnDocument: "after"
3142
3501
  }).lean();
3143
- class er extends Ya {
3502
+ class ka extends va {
3144
3503
  constructor() {
3145
3504
  super(3600 * 24 * 30);
3146
3505
  }
@@ -3151,37 +3510,37 @@ class er extends Ya {
3151
3510
  return e;
3152
3511
  }
3153
3512
  fetchFromDb(e) {
3154
- return Ja(e);
3513
+ return qa(e);
3155
3514
  }
3156
3515
  updateInDb(e, t) {
3157
- return Za(e, t);
3516
+ return Aa(e, t);
3158
3517
  }
3159
3518
  }
3160
- const Tr = new er(), tr = new u({
3519
+ const ss = new ka(), Ra = new c({
3161
3520
  warnedUserId: { type: String, required: !0, index: !0 },
3162
3521
  authorId: String,
3163
3522
  date: { type: Date, default: Date.now() },
3164
3523
  reason: { type: String, default: null }
3165
- }), ne = c?.Warn || d("Warn", tr), nr = (n) => ne.countDocuments(n), ar = (n) => ne.create({
3524
+ }), ce = d?.Warn || l("Warn", Ra), Ca = (n) => ce.countDocuments(n), _a = (n) => ce.create({
3166
3525
  ...n
3167
- }), rr = (n) => ne.findByIdAndDelete(n).lean();
3168
- class sr extends m {
3526
+ }), Ba = (n) => ce.findByIdAndDelete(n).lean();
3527
+ class Fa extends f {
3169
3528
  getUserWarns(e) {
3170
3529
  return this.getMany({ warnedUserId: e });
3171
3530
  }
3172
3531
  getUserWarnCount(e) {
3173
- return nr({ warnedUserId: e });
3532
+ return Ca({ warnedUserId: e });
3174
3533
  }
3175
3534
  async createWarn(e) {
3176
- await ar(e);
3535
+ await _a(e);
3177
3536
  }
3178
3537
  async deleteWarn(e) {
3179
- const t = await rr(e);
3538
+ const t = await Ba(e);
3180
3539
  return t && this.invalidate(this.getKey(t)), t;
3181
3540
  }
3182
3541
  }
3183
- const ir = (n) => ne.find(n).lean();
3184
- class ur extends sr {
3542
+ const Na = (n) => ce.find(n).lean();
3543
+ class Ka extends Fa {
3185
3544
  constructor() {
3186
3545
  super(300);
3187
3546
  }
@@ -3195,48 +3554,49 @@ class ur extends sr {
3195
3554
  throw new Error("Method not implemented.");
3196
3555
  }
3197
3556
  fetchManyFromDb(e) {
3198
- return ir(e);
3557
+ return Na(e);
3199
3558
  }
3200
3559
  updateInDb() {
3201
3560
  throw new Error("Method not implemented.");
3202
3561
  }
3203
3562
  }
3204
- const Or = new ur(), vr = (n) => {
3205
- Fe(n);
3563
+ const is = new Ka(), us = (n) => {
3564
+ Qe(n);
3206
3565
  };
3207
- class Mr extends Ne.ObjectId {
3566
+ class cs extends Ye.ObjectId {
3208
3567
  }
3209
3568
  export {
3210
- yr as COOLDOWN_COMMANDS,
3211
- Mr as ObjectId,
3212
- g as QUEST_MIDDLEWARE_EVENT_NAME,
3213
- Dr as banService,
3214
- vr as connectToServices,
3215
- h as emitQuestMiddlewareEvent,
3216
- f as entityService,
3217
- Ir as invitationService,
3218
- b as ornamentService,
3219
- A as panoplyService,
3220
- Er as recipeService,
3221
- pr as registerQuestMiddlewareEvents,
3222
- Ut as reminderService,
3223
- Tr as settingsService,
3224
- fr as userCooldownService,
3225
- mr as userDailyReportService,
3226
- se as userEncyclopediaService,
3227
- hr as userGamesService,
3228
- U as userInventoryService,
3229
- E as userMetaService,
3230
- ye as userOrnamentService,
3231
- fe as userQuestService,
3232
- gr as userRankService,
3233
- yt as userService,
3234
- Re as userSettingsService,
3235
- wr as userStatsCasinoService,
3236
- Sr as userStatsEconomyService,
3237
- me as userStatsEngagementService,
3238
- br as userStatsFlagsService,
3239
- $r as userStatsFrequencyService,
3240
- Ur as userStatsInventoryService,
3241
- Or as warnService
3569
+ cs as ObjectId,
3570
+ w as QUEST_MIDDLEWARE_EVENT_NAME,
3571
+ rs as banService,
3572
+ us as connectToServices,
3573
+ S as emitQuestMiddlewareEvent,
3574
+ m as entityService,
3575
+ as as invitationService,
3576
+ U as ornamentService,
3577
+ R as panoplyService,
3578
+ ns as recipeService,
3579
+ La as registerQuestMiddlewareEvents,
3580
+ Rt as reminderService,
3581
+ ss as settingsService,
3582
+ T as storyService,
3583
+ Qa as userCooldownService,
3584
+ Ya as userDailyReportService,
3585
+ le as userEncyclopediaService,
3586
+ Ga as userGamesService,
3587
+ E as userInventoryService,
3588
+ O as userMetaService,
3589
+ we as userOrnamentService,
3590
+ be as userQuestService,
3591
+ Wa as userRankService,
3592
+ Et as userService,
3593
+ Fe as userSettingsService,
3594
+ Xa as userStatsCasinoService,
3595
+ Ja as userStatsEconomyService,
3596
+ $e as userStatsEngagementService,
3597
+ Za as userStatsFlagsService,
3598
+ es as userStatsFrequencyService,
3599
+ ts as userStatsInventoryService,
3600
+ Va as userStoryService,
3601
+ is as warnService
3242
3602
  };