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