@opfr/services 1.5.2 → 1.6.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 +623 -1249
- package/dist/index.umd.js +1 -1
- package/dist/services/entities/definition/model.d.ts +12 -2
- package/dist/services/entities/definition/model.d.ts.map +1 -1
- package/dist/services/entities/definition/schema.d.ts +20 -2
- package/dist/services/entities/definition/schema.d.ts.map +1 -1
- package/dist/services/entities/helper.d.ts +5 -20
- package/dist/services/entities/helper.d.ts.map +1 -1
- package/dist/services/entities/process/findMany.d.ts +2 -1
- package/dist/services/entities/process/findMany.d.ts.map +1 -1
- package/dist/services/entities/process/findOne.d.ts +3 -1
- package/dist/services/entities/process/findOne.d.ts.map +1 -1
- package/dist/services/entities/types.d.ts +5 -1
- package/dist/services/entities/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/user/definition/schema.d.ts.map +1 -1
- package/dist/services/user-inventory/helper.d.ts +1 -3
- package/dist/services/user-inventory/helper.d.ts.map +1 -1
- package/dist/services/user-meta/definition/schema.d.ts.map +1 -1
- package/dist/services/user-meta/helper.d.ts +1 -1
- package/dist/services/user-meta/helper.d.ts.map +1 -1
- package/dist/services/user-meta/types.d.ts +2 -4
- package/dist/services/user-meta/types.d.ts.map +1 -1
- package/dist/services/user-stats/inventory/helper.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/services/shop/definition/model.d.ts +0 -4
- package/dist/services/shop/definition/model.d.ts.map +0 -1
- package/dist/services/shop/definition/schema.d.ts +0 -13
- package/dist/services/shop/definition/schema.d.ts.map +0 -1
- package/dist/services/shop/helper.d.ts +0 -14
- package/dist/services/shop/helper.d.ts.map +0 -1
- package/dist/services/shop/index.d.ts +0 -4
- package/dist/services/shop/index.d.ts.map +0 -1
- package/dist/services/shop/items/background.d.ts +0 -18
- package/dist/services/shop/items/background.d.ts.map +0 -1
- package/dist/services/shop/items/boostXp.d.ts +0 -18
- package/dist/services/shop/items/boostXp.d.ts.map +0 -1
- package/dist/services/shop/items/bottle.d.ts +0 -18
- package/dist/services/shop/items/bottle.d.ts.map +0 -1
- package/dist/services/shop/items/chest.d.ts +0 -18
- package/dist/services/shop/items/chest.d.ts.map +0 -1
- package/dist/services/shop/items/default.d.ts +0 -21
- package/dist/services/shop/items/default.d.ts.map +0 -1
- package/dist/services/shop/items/equipments.d.ts +0 -18
- package/dist/services/shop/items/equipments.d.ts.map +0 -1
- package/dist/services/shop/items/index.d.ts +0 -10
- package/dist/services/shop/items/index.d.ts.map +0 -1
- package/dist/services/shop/items/object.d.ts +0 -18
- package/dist/services/shop/items/object.d.ts.map +0 -1
- package/dist/services/shop/items/repair.d.ts +0 -18
- package/dist/services/shop/items/repair.d.ts.map +0 -1
- package/dist/services/shop/items/store.d.ts +0 -18
- package/dist/services/shop/items/store.d.ts.map +0 -1
- package/dist/services/shop/items/title.d.ts +0 -18
- package/dist/services/shop/items/title.d.ts.map +0 -1
- package/dist/services/shop/process/create.d.ts +0 -4
- package/dist/services/shop/process/create.d.ts.map +0 -1
- package/dist/services/shop/process/findOne.d.ts +0 -5
- package/dist/services/shop/process/findOne.d.ts.map +0 -1
- package/dist/services/shop/process/updateOne.d.ts +0 -5
- package/dist/services/shop/process/updateOne.d.ts.map +0 -1
- package/dist/services/shop/service.d.ts +0 -19
- package/dist/services/shop/service.d.ts.map +0 -1
- package/dist/services/shop/types.d.ts +0 -5
- package/dist/services/shop/types.d.ts.map +0 -1
- package/dist/services/user-shop/definition/model.d.ts +0 -4
- package/dist/services/user-shop/definition/model.d.ts.map +0 -1
- package/dist/services/user-shop/definition/schema.d.ts +0 -13
- package/dist/services/user-shop/definition/schema.d.ts.map +0 -1
- package/dist/services/user-shop/helper.d.ts +0 -9
- package/dist/services/user-shop/helper.d.ts.map +0 -1
- package/dist/services/user-shop/index.d.ts +0 -3
- package/dist/services/user-shop/index.d.ts.map +0 -1
- package/dist/services/user-shop/process/create.d.ts +0 -4
- package/dist/services/user-shop/process/create.d.ts.map +0 -1
- package/dist/services/user-shop/process/findOne.d.ts +0 -5
- package/dist/services/user-shop/process/findOne.d.ts.map +0 -1
- package/dist/services/user-shop/process/updateOne.d.ts +0 -5
- package/dist/services/user-shop/process/updateOne.d.ts.map +0 -1
- package/dist/services/user-shop/service.d.ts +0 -14
- package/dist/services/user-shop/service.d.ts.map +0 -1
- package/dist/services/user-shop/types.d.ts +0 -9
- package/dist/services/user-shop/types.d.ts.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Schema as
|
|
2
|
-
import { QuestStatus as
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import { filterNullAndUndefined as
|
|
1
|
+
import { Schema as u, models as c, model as d, connect as Fe, Types as Ne } from "mongoose";
|
|
2
|
+
import { QuestStatus as v, DEFAULT_FACTION as He, GAME_TYPES as Ke, EFFECT_KEYS as je, EQUIPMENT_SLOT as he, CHARACTERISTICS as Pe, getComputedCharacteristicValue as ze, getCurrentLevel as Le, HP_PER_VITALITY as Qe, DEFAULT_MAX_HP as Ge, transformToDBBuff as We, RANK_IDS_WITHOUT_BASIC as le } from "@opfr/definitions";
|
|
3
|
+
import Ye from "node-cache";
|
|
4
|
+
import * as ge from "events";
|
|
5
|
+
import { filterNullAndUndefined as H, recordToArray as B, arrayToRecord as we, mergeObjects as K, seededRandom as Ve, sortBy as ie, randomBetween as Se, hasExpire as re, isString as Xe, capitalizeAllWords as Je, pickNthByOdds as pe, pickFrom as Ze, sameDay as be, yesterday as j, exclude as N } from "@opfr/utils-lang";
|
|
6
6
|
const P = "___ALL_ENTITIES___";
|
|
7
|
-
class
|
|
7
|
+
class y {
|
|
8
8
|
cache;
|
|
9
9
|
constructor(e) {
|
|
10
|
-
this.cache = new
|
|
10
|
+
this.cache = new Ye({
|
|
11
11
|
stdTTL: e,
|
|
12
12
|
checkperiod: e * 0.2,
|
|
13
13
|
useClones: !1
|
|
@@ -35,7 +35,7 @@ class f {
|
|
|
35
35
|
this.cache.flushAll();
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
class
|
|
38
|
+
class m extends y {
|
|
39
39
|
async getAll() {
|
|
40
40
|
const e = this.cache.get(P);
|
|
41
41
|
if (e)
|
|
@@ -52,14 +52,14 @@ class w extends f {
|
|
|
52
52
|
}), a;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
},
|
|
55
|
+
const $e = new ge.EventEmitter(), h = (n, e, t) => {
|
|
56
|
+
$e.emit(n, e, t);
|
|
57
|
+
}, pr = (n) => {
|
|
58
58
|
for (const [e, t] of Object.entries(n))
|
|
59
|
-
|
|
59
|
+
$e.on(e, (a, r) => {
|
|
60
60
|
t(a, r);
|
|
61
61
|
});
|
|
62
|
-
},
|
|
62
|
+
}, g = {
|
|
63
63
|
USER: "middleware/quest/USER",
|
|
64
64
|
USER_INVENTORY: "middleware/quest/USER_INVENTORY",
|
|
65
65
|
USER_META: "middleware/quest/USER_META",
|
|
@@ -71,10 +71,10 @@ const De = new $e.EventEmitter(), S = (n, e, t) => {
|
|
|
71
71
|
USER_STATS_FLAGS: "middleware/quest/USER_STATS_FLAGS",
|
|
72
72
|
USER_STATS_FREQUENCY: "middleware/quest/USER_STATS_FREQUENCY",
|
|
73
73
|
USER_STATS_INVENTORY: "middleware/quest/USER_STATS_INVENTORY"
|
|
74
|
-
},
|
|
74
|
+
}, Ue = new u(
|
|
75
75
|
{
|
|
76
76
|
user: {
|
|
77
|
-
type:
|
|
77
|
+
type: u.Types.ObjectId,
|
|
78
78
|
required: !0,
|
|
79
79
|
ref: "User",
|
|
80
80
|
index: !0
|
|
@@ -84,22 +84,22 @@ const De = new $e.EventEmitter(), S = (n, e, t) => {
|
|
|
84
84
|
required: !0,
|
|
85
85
|
index: !0
|
|
86
86
|
},
|
|
87
|
-
status: { type: String, default:
|
|
87
|
+
status: { type: String, default: v.IN_PROGRESS, index: 1 },
|
|
88
88
|
lastCompletionDate: Date,
|
|
89
89
|
streak: Number
|
|
90
90
|
},
|
|
91
91
|
{ minimize: !1 }
|
|
92
92
|
);
|
|
93
|
-
|
|
94
|
-
n &&
|
|
95
|
-
|
|
93
|
+
Ue.post("findOneAndUpdate", function(n) {
|
|
94
|
+
n && h(
|
|
95
|
+
g.USER_QUEST,
|
|
96
96
|
n.user._id,
|
|
97
97
|
n
|
|
98
98
|
);
|
|
99
99
|
});
|
|
100
|
-
const
|
|
100
|
+
const R = c?.UserQuest || d("UserQuest", Ue), et = new u({
|
|
101
101
|
user: {
|
|
102
|
-
type:
|
|
102
|
+
type: u.Types.ObjectId,
|
|
103
103
|
required: !0,
|
|
104
104
|
unique: !0,
|
|
105
105
|
ref: "User"
|
|
@@ -117,9 +117,9 @@ const q = d?.UserQuest || p("UserQuest", Te), it = new o({
|
|
|
117
117
|
blackJack: { type: Date, default: /* @__PURE__ */ new Date(0) },
|
|
118
118
|
rps: { type: Date, default: /* @__PURE__ */ new Date(0) }
|
|
119
119
|
}
|
|
120
|
-
}),
|
|
120
|
+
}), z = c?.UserCooldown || d("UserCooldown", et), tt = new u({
|
|
121
121
|
user: {
|
|
122
|
-
type:
|
|
122
|
+
type: u.Types.ObjectId,
|
|
123
123
|
required: !0,
|
|
124
124
|
unique: !0,
|
|
125
125
|
ref: "User"
|
|
@@ -133,17 +133,17 @@ const q = d?.UserQuest || p("UserQuest", Te), it = new o({
|
|
|
133
133
|
},
|
|
134
134
|
previousCompletedQuest: { type: [String], default: [] },
|
|
135
135
|
previousMessageSent: { type: Number, default: 0 }
|
|
136
|
-
}),
|
|
136
|
+
}), L = c?.UserDailyReport || d("UserDailyReport", tt), nt = new u({
|
|
137
137
|
user: {
|
|
138
|
-
type:
|
|
138
|
+
type: u.Types.ObjectId,
|
|
139
139
|
required: !0,
|
|
140
140
|
unique: !0,
|
|
141
141
|
ref: "User"
|
|
142
142
|
},
|
|
143
143
|
encyclopedia: { type: [String], default: [] }
|
|
144
|
-
}),
|
|
144
|
+
}), Q = c?.UserEncyclopedia || d("UserEncyclopedia", nt), at = new u({
|
|
145
145
|
user: {
|
|
146
|
-
type:
|
|
146
|
+
type: u.Types.ObjectId,
|
|
147
147
|
required: !0,
|
|
148
148
|
unique: !0,
|
|
149
149
|
ref: "User",
|
|
@@ -158,10 +158,10 @@ const q = d?.UserQuest || p("UserQuest", Te), it = new o({
|
|
|
158
158
|
},
|
|
159
159
|
default: null
|
|
160
160
|
}
|
|
161
|
-
}),
|
|
161
|
+
}), G = c?.UserGames || d("UserGames", at), Ee = new u(
|
|
162
162
|
{
|
|
163
163
|
user: {
|
|
164
|
-
type:
|
|
164
|
+
type: u.Types.ObjectId,
|
|
165
165
|
required: !0,
|
|
166
166
|
unique: !0,
|
|
167
167
|
ref: "User"
|
|
@@ -180,23 +180,23 @@ const q = d?.UserQuest || p("UserQuest", Te), it = new o({
|
|
|
180
180
|
},
|
|
181
181
|
{ minimize: !1 }
|
|
182
182
|
);
|
|
183
|
-
|
|
184
|
-
n &&
|
|
185
|
-
|
|
183
|
+
Ee.post("findOneAndUpdate", function(n) {
|
|
184
|
+
n && h(
|
|
185
|
+
g.USER_INVENTORY,
|
|
186
186
|
n.user._id,
|
|
187
187
|
n
|
|
188
188
|
);
|
|
189
189
|
});
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
},
|
|
190
|
+
const W = c?.UserInventory || d("UserInventory", Ee), rt = new ge.EventEmitter(), st = (n, e) => {
|
|
191
|
+
rt.emit(n, e);
|
|
192
|
+
}, T = {
|
|
193
193
|
multiplier: { type: Number, default: 0 },
|
|
194
194
|
origin: String,
|
|
195
195
|
expireAt: { type: Date, default: null },
|
|
196
196
|
startAt: { type: Date, default: null }
|
|
197
|
-
},
|
|
197
|
+
}, De = new u({
|
|
198
198
|
user: {
|
|
199
|
-
type:
|
|
199
|
+
type: u.Types.ObjectId,
|
|
200
200
|
required: !0,
|
|
201
201
|
unique: !0,
|
|
202
202
|
ref: "User"
|
|
@@ -216,38 +216,40 @@ const V = d?.UserInventory || p("UserInventory", Oe), lt = new $e.EventEmitter()
|
|
|
216
216
|
buffs: {
|
|
217
217
|
cooldown: {
|
|
218
218
|
casino: {
|
|
219
|
-
type: [
|
|
219
|
+
type: [T],
|
|
220
220
|
default: []
|
|
221
221
|
},
|
|
222
222
|
work: {
|
|
223
|
-
type: [
|
|
223
|
+
type: [T],
|
|
224
224
|
default: []
|
|
225
225
|
}
|
|
226
226
|
},
|
|
227
227
|
berry: {
|
|
228
228
|
work: {
|
|
229
|
-
type: [
|
|
229
|
+
type: [T],
|
|
230
230
|
default: []
|
|
231
231
|
},
|
|
232
232
|
global: {
|
|
233
|
-
type: [
|
|
233
|
+
type: [T],
|
|
234
234
|
default: []
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
237
|
drop: {
|
|
238
238
|
work: {
|
|
239
|
-
type: [
|
|
239
|
+
type: [T],
|
|
240
240
|
default: []
|
|
241
241
|
}
|
|
242
242
|
},
|
|
243
243
|
xp: {
|
|
244
244
|
global: {
|
|
245
|
-
type: [
|
|
245
|
+
type: [T],
|
|
246
246
|
default: []
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
},
|
|
250
250
|
hp: { type: Number, default: 100 },
|
|
251
|
+
energyMax: { type: Number, default: 10 },
|
|
252
|
+
energy: { type: Number, default: 10 },
|
|
251
253
|
workUnluckyStreak: { type: Number, default: 0 },
|
|
252
254
|
characteristics: {
|
|
253
255
|
vitality: { type: Number, default: 0 },
|
|
@@ -257,10 +259,6 @@ const V = d?.UserInventory || p("UserInventory", Oe), lt = new $e.EventEmitter()
|
|
|
257
259
|
intelligence: { type: Number, default: 0 },
|
|
258
260
|
wisdom: { type: Number, default: 0 }
|
|
259
261
|
},
|
|
260
|
-
resetCharacteristics: {
|
|
261
|
-
free: { type: Boolean, default: !0 },
|
|
262
|
-
nextAvailable: { type: Date, default: null }
|
|
263
|
-
},
|
|
264
262
|
scrolls: {
|
|
265
263
|
vitality: { type: Number, default: 0 },
|
|
266
264
|
strength: { type: Number, default: 0 },
|
|
@@ -270,16 +268,16 @@ const V = d?.UserInventory || p("UserInventory", Oe), lt = new $e.EventEmitter()
|
|
|
270
268
|
wisdom: { type: Number, default: 0 }
|
|
271
269
|
}
|
|
272
270
|
});
|
|
273
|
-
|
|
274
|
-
n && (
|
|
275
|
-
|
|
271
|
+
De.post("findOneAndUpdate", async function(n) {
|
|
272
|
+
n && (h(
|
|
273
|
+
g.USER_META,
|
|
276
274
|
n.user._id,
|
|
277
275
|
n
|
|
278
|
-
), n.hp <= 0 &&
|
|
276
|
+
), n.hp <= 0 && st("death", n.user._id));
|
|
279
277
|
});
|
|
280
|
-
const
|
|
278
|
+
const I = c?.UserMeta || d("UserMeta", De), Ie = new u({
|
|
281
279
|
user: {
|
|
282
|
-
type:
|
|
280
|
+
type: u.Types.ObjectId,
|
|
283
281
|
required: !0,
|
|
284
282
|
unique: !0,
|
|
285
283
|
ref: "User"
|
|
@@ -294,16 +292,16 @@ const O = d?.UserMeta || p("UserMeta", ve), Be = new o({
|
|
|
294
292
|
unlockedBags: { type: [String], default: ["default"] },
|
|
295
293
|
selectedBag: { type: String, default: "default" }
|
|
296
294
|
});
|
|
297
|
-
|
|
298
|
-
n &&
|
|
299
|
-
|
|
295
|
+
Ie.post("findOneAndUpdate", function(n) {
|
|
296
|
+
n && h(
|
|
297
|
+
g.USER_ORNAMENT,
|
|
300
298
|
n.user._id,
|
|
301
299
|
n
|
|
302
300
|
);
|
|
303
301
|
});
|
|
304
|
-
const
|
|
302
|
+
const Y = c?.UserOrnament || d("UserOrnament", Ie), it = new u({
|
|
305
303
|
user: {
|
|
306
|
-
type:
|
|
304
|
+
type: u.Types.ObjectId,
|
|
307
305
|
required: !0,
|
|
308
306
|
unique: !0,
|
|
309
307
|
ref: "User"
|
|
@@ -327,21 +325,9 @@ const X = d?.UserOrnament || p("UserOrnament", Be), pt = new o({
|
|
|
327
325
|
rps: { type: Boolean, default: !1 }
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
|
-
}),
|
|
331
|
-
{
|
|
332
|
-
user: {
|
|
333
|
-
type: o.Types.ObjectId,
|
|
334
|
-
required: !0,
|
|
335
|
-
unique: !0,
|
|
336
|
-
ref: "User"
|
|
337
|
-
},
|
|
338
|
-
lastShopId: o.Types.ObjectId,
|
|
339
|
-
limit: { type: o.Types.Mixed, default: {} }
|
|
340
|
-
},
|
|
341
|
-
{ minimize: !1 }
|
|
342
|
-
), J = d?.UserShop || p("UserShop", yt), Me = new o({
|
|
328
|
+
}), C = c?.UserSettings || d("UserSettings", it), Te = new u({
|
|
343
329
|
user: {
|
|
344
|
-
type:
|
|
330
|
+
type: u.Types.ObjectId,
|
|
345
331
|
required: !0,
|
|
346
332
|
unique: !0,
|
|
347
333
|
ref: "User"
|
|
@@ -374,16 +360,16 @@ const X = d?.UserOrnament || p("UserOrnament", Be), pt = new o({
|
|
|
374
360
|
guessInOneTryCount: { type: Number, default: 0 }
|
|
375
361
|
}
|
|
376
362
|
});
|
|
377
|
-
|
|
378
|
-
n &&
|
|
379
|
-
|
|
363
|
+
Te.post("findOneAndUpdate", function(n) {
|
|
364
|
+
n && h(
|
|
365
|
+
g.USER_STATS_CASINO,
|
|
380
366
|
n.user._id,
|
|
381
367
|
n
|
|
382
368
|
);
|
|
383
369
|
});
|
|
384
|
-
const
|
|
370
|
+
const M = c?.UserStatsCasino || d("UserStatsCasino", Te), Oe = new u({
|
|
385
371
|
user: {
|
|
386
|
-
type:
|
|
372
|
+
type: u.Types.ObjectId,
|
|
387
373
|
required: !0,
|
|
388
374
|
unique: !0,
|
|
389
375
|
ref: "User"
|
|
@@ -391,16 +377,16 @@ const k = d?.UserStatsCasino || p("UserStatsCasino", Me), ke = new o({
|
|
|
391
377
|
workCount: { type: Number, default: 0 },
|
|
392
378
|
totalSpentInShop: { type: Number, default: 0 }
|
|
393
379
|
});
|
|
394
|
-
|
|
395
|
-
n &&
|
|
396
|
-
|
|
380
|
+
Oe.post("findOneAndUpdate", function(n) {
|
|
381
|
+
n && h(
|
|
382
|
+
g.USER_STATS_ECONOMY,
|
|
397
383
|
n.user._id,
|
|
398
384
|
n
|
|
399
385
|
);
|
|
400
386
|
});
|
|
401
|
-
const
|
|
387
|
+
const V = c?.UserStatsEconomy || d("UserStatsEconomy", Oe), ve = new u({
|
|
402
388
|
user: {
|
|
403
|
-
type:
|
|
389
|
+
type: u.Types.ObjectId,
|
|
404
390
|
required: !0,
|
|
405
391
|
unique: !0,
|
|
406
392
|
ref: "User"
|
|
@@ -410,19 +396,19 @@ const Z = d?.UserStatsEconomy || p("UserStatsEconomy", ke), Ae = new o({
|
|
|
410
396
|
randomMessageClaimed: { type: Number, default: 0 },
|
|
411
397
|
writeDifferentChatIds: { type: [String], default: [] }
|
|
412
398
|
});
|
|
413
|
-
|
|
414
|
-
n &&
|
|
415
|
-
|
|
399
|
+
ve.post("findOneAndUpdate", function(n) {
|
|
400
|
+
n && h(
|
|
401
|
+
g.USER_STATS_ENGAGEMENT,
|
|
416
402
|
n.user._id,
|
|
417
403
|
n
|
|
418
404
|
);
|
|
419
405
|
});
|
|
420
|
-
const
|
|
406
|
+
const X = c?.UserStatsEngagement || d(
|
|
421
407
|
"UserStatsEngagement",
|
|
422
|
-
|
|
423
|
-
),
|
|
408
|
+
ve
|
|
409
|
+
), Me = new u({
|
|
424
410
|
user: {
|
|
425
|
-
type:
|
|
411
|
+
type: u.Types.ObjectId,
|
|
426
412
|
required: !0,
|
|
427
413
|
unique: !0,
|
|
428
414
|
ref: "User"
|
|
@@ -439,16 +425,16 @@ const ee = d?.UserStatsEngagement || p(
|
|
|
439
425
|
loseEverything: { type: Boolean, default: !1 }
|
|
440
426
|
}
|
|
441
427
|
});
|
|
442
|
-
|
|
443
|
-
n &&
|
|
444
|
-
|
|
428
|
+
Me.post("findOneAndUpdate", function(n) {
|
|
429
|
+
n && h(
|
|
430
|
+
g.USER_STATS_FLAGS,
|
|
445
431
|
n.user._id,
|
|
446
432
|
n
|
|
447
433
|
);
|
|
448
434
|
});
|
|
449
|
-
const
|
|
435
|
+
const J = c?.UserStatsFlags || d("UserStatsFlags", Me), ke = new u({
|
|
450
436
|
user: {
|
|
451
|
-
type:
|
|
437
|
+
type: u.Types.ObjectId,
|
|
452
438
|
required: !0,
|
|
453
439
|
unique: !0,
|
|
454
440
|
ref: "User"
|
|
@@ -458,19 +444,19 @@ const te = d?.UserStatsFlags || p("UserStatsFlags", qe), Re = new o({
|
|
|
458
444
|
lastTimeRead: { type: Date, default: /* @__PURE__ */ new Date(), index: !0 }
|
|
459
445
|
}
|
|
460
446
|
});
|
|
461
|
-
|
|
462
|
-
n &&
|
|
463
|
-
|
|
447
|
+
ke.post("findOneAndUpdate", function(n) {
|
|
448
|
+
n && h(
|
|
449
|
+
g.USER_STATS_FREQUENCY,
|
|
464
450
|
n.user._id,
|
|
465
451
|
n
|
|
466
452
|
);
|
|
467
453
|
});
|
|
468
|
-
const
|
|
454
|
+
const D = c?.UserStatsFrequency || d(
|
|
469
455
|
"UserStatsFrequency",
|
|
470
|
-
|
|
471
|
-
),
|
|
456
|
+
ke
|
|
457
|
+
), Ae = new u({
|
|
472
458
|
user: {
|
|
473
|
-
type:
|
|
459
|
+
type: u.Types.ObjectId,
|
|
474
460
|
required: !0,
|
|
475
461
|
unique: !0,
|
|
476
462
|
ref: "User"
|
|
@@ -495,39 +481,39 @@ const T = d?.UserStatsFrequency || p(
|
|
|
495
481
|
totalCrafted: { type: Number, default: 0 }
|
|
496
482
|
}
|
|
497
483
|
});
|
|
498
|
-
|
|
499
|
-
n &&
|
|
500
|
-
|
|
484
|
+
Ae.post("findOneAndUpdate", function(n) {
|
|
485
|
+
n && h(
|
|
486
|
+
g.USER_STATS_INVENTORY,
|
|
501
487
|
n.user._id,
|
|
502
488
|
n
|
|
503
489
|
);
|
|
504
490
|
});
|
|
505
|
-
const
|
|
491
|
+
const k = c?.UserStatsInventory || d(
|
|
506
492
|
"UserStatsInventory",
|
|
507
|
-
|
|
508
|
-
),
|
|
493
|
+
Ae
|
|
494
|
+
), ue = new u({
|
|
509
495
|
discordId: { type: String, required: !0, unique: !0 },
|
|
510
496
|
scam: { type: Boolean, default: !1 },
|
|
511
497
|
birthday: { type: Date, default: null, index: 1 },
|
|
512
|
-
faction: { type: String, default:
|
|
498
|
+
faction: { type: String, default: He, index: 1 },
|
|
513
499
|
canChangeFaction: { type: Boolean, default: !1 },
|
|
514
500
|
canChooseFaction: { type: Boolean, default: !1 }
|
|
515
501
|
});
|
|
516
|
-
|
|
517
|
-
n &&
|
|
502
|
+
ue.post("findOneAndUpdate", function(n) {
|
|
503
|
+
n && h(g.USER, n._id, n);
|
|
518
504
|
});
|
|
519
|
-
|
|
505
|
+
ue.post("deleteOne", async function() {
|
|
520
506
|
const n = this.getQuery()._id;
|
|
521
|
-
await
|
|
507
|
+
await z.deleteOne({ user: n }), await L.deleteOne({ user: n }), await Q.deleteOne({ user: n }), await G.deleteOne({ user: n }), await W.deleteOne({ user: n }), await I.deleteOne({ user: n }), await Y.deleteOne({ user: n }), await R.deleteMany({ user: n }), await C.deleteOne({ user: n }), await M.deleteOne({ user: n }), await V.deleteOne({ user: n }), await X.deleteOne({ user: n }), await J.deleteOne({ user: n }), await D.deleteOne({ user: n }), await k.deleteOne({ user: n });
|
|
522
508
|
});
|
|
523
|
-
const
|
|
524
|
-
class
|
|
509
|
+
const w = c?.User || d("User", ue);
|
|
510
|
+
class ut extends m {
|
|
525
511
|
getByObjectId(e) {
|
|
526
512
|
return this.update({ _id: e }, {});
|
|
527
513
|
}
|
|
528
514
|
getNextBirthdays() {
|
|
529
515
|
const e = /* @__PURE__ */ new Date(), t = e.getFullYear();
|
|
530
|
-
return
|
|
516
|
+
return w.aggregate([
|
|
531
517
|
{
|
|
532
518
|
$match: {
|
|
533
519
|
birthday: { $ne: null }
|
|
@@ -578,7 +564,7 @@ class ft extends w {
|
|
|
578
564
|
]);
|
|
579
565
|
}
|
|
580
566
|
getFactionRanking(e) {
|
|
581
|
-
return
|
|
567
|
+
return w.aggregate([
|
|
582
568
|
{ $match: { faction: e } },
|
|
583
569
|
{
|
|
584
570
|
$lookup: {
|
|
@@ -601,7 +587,7 @@ class ft extends w {
|
|
|
601
587
|
]);
|
|
602
588
|
}
|
|
603
589
|
getGlobalRanking() {
|
|
604
|
-
return
|
|
590
|
+
return w.aggregate([
|
|
605
591
|
{
|
|
606
592
|
$lookup: {
|
|
607
593
|
from: "usermetas",
|
|
@@ -623,7 +609,7 @@ class ft extends w {
|
|
|
623
609
|
]);
|
|
624
610
|
}
|
|
625
611
|
getBerryRanking() {
|
|
626
|
-
return
|
|
612
|
+
return w.aggregate([
|
|
627
613
|
{
|
|
628
614
|
$lookup: {
|
|
629
615
|
from: "usermetas",
|
|
@@ -645,10 +631,10 @@ class ft extends w {
|
|
|
645
631
|
]);
|
|
646
632
|
}
|
|
647
633
|
getQuestRanking() {
|
|
648
|
-
return
|
|
634
|
+
return R.aggregate([
|
|
649
635
|
{
|
|
650
636
|
$match: {
|
|
651
|
-
status:
|
|
637
|
+
status: v.COMPLETED
|
|
652
638
|
}
|
|
653
639
|
},
|
|
654
640
|
{
|
|
@@ -692,7 +678,7 @@ class ft extends w {
|
|
|
692
678
|
}
|
|
693
679
|
getTodayAllBirthday() {
|
|
694
680
|
const e = /* @__PURE__ */ new Date();
|
|
695
|
-
return
|
|
681
|
+
return w.aggregate([
|
|
696
682
|
{ $match: { birthday: { $ne: null } } },
|
|
697
683
|
{
|
|
698
684
|
$addFields: {
|
|
@@ -739,18 +725,18 @@ class ft extends w {
|
|
|
739
725
|
);
|
|
740
726
|
}
|
|
741
727
|
}
|
|
742
|
-
const
|
|
728
|
+
const ot = (n, e) => w.find(n, {}, e).lean(), p = (n) => n.toObject({ flattenMaps: !0, flattenObjectIds: !1 }), ct = (n) => w.create({
|
|
743
729
|
discordId: n
|
|
744
730
|
});
|
|
745
|
-
async function
|
|
746
|
-
const a = await
|
|
747
|
-
return !a && e ?
|
|
731
|
+
async function dt(n, { upsert: e = !0, ...t }) {
|
|
732
|
+
const a = await w.findOne({ discordId: n }, {}, t).lean();
|
|
733
|
+
return !a && e ? p(await ct(n)) : a;
|
|
748
734
|
}
|
|
749
|
-
const
|
|
735
|
+
const lt = (n, e) => w.findOneAndUpdate(n, e, {
|
|
750
736
|
upsert: !0,
|
|
751
737
|
returnDocument: "after"
|
|
752
738
|
}).lean();
|
|
753
|
-
class
|
|
739
|
+
class pt extends ut {
|
|
754
740
|
constructor() {
|
|
755
741
|
super(3600);
|
|
756
742
|
}
|
|
@@ -761,19 +747,19 @@ class St extends ft {
|
|
|
761
747
|
return e;
|
|
762
748
|
}
|
|
763
749
|
fetchFromDb(e, t) {
|
|
764
|
-
return
|
|
750
|
+
return dt(e, t);
|
|
765
751
|
}
|
|
766
752
|
fetchManyFromDb(e, t) {
|
|
767
|
-
return
|
|
753
|
+
return ot(e, t);
|
|
768
754
|
}
|
|
769
755
|
updateInDb(e, t) {
|
|
770
|
-
return
|
|
756
|
+
return lt(e, t);
|
|
771
757
|
}
|
|
772
758
|
}
|
|
773
|
-
const
|
|
759
|
+
const yt = new pt(), yr = ["work", ...Ke], ft = new u(
|
|
774
760
|
{
|
|
775
761
|
user: {
|
|
776
|
-
type:
|
|
762
|
+
type: u.Types.ObjectId,
|
|
777
763
|
ref: "User",
|
|
778
764
|
required: !0,
|
|
779
765
|
index: !0
|
|
@@ -782,12 +768,12 @@ const bt = new St(), Cr = ["work", ...Le], $t = new o(
|
|
|
782
768
|
type: { type: String, required: !0 }
|
|
783
769
|
},
|
|
784
770
|
{ minimize: !1 }
|
|
785
|
-
),
|
|
786
|
-
await
|
|
787
|
-
},
|
|
788
|
-
await
|
|
771
|
+
), _ = c?.Reminder || d("Reminder", ft), mt = async (n) => {
|
|
772
|
+
await _.deleteMany(n);
|
|
773
|
+
}, ht = async (n, e) => {
|
|
774
|
+
await _.deleteOne({ user: n, type: e });
|
|
789
775
|
};
|
|
790
|
-
class
|
|
776
|
+
class gt extends m {
|
|
791
777
|
getAllPassedReminder() {
|
|
792
778
|
return this.getMany({ date: { $lte: /* @__PURE__ */ new Date() } });
|
|
793
779
|
}
|
|
@@ -806,29 +792,29 @@ class Ut extends w {
|
|
|
806
792
|
]);
|
|
807
793
|
}
|
|
808
794
|
async removeReminder(e, t) {
|
|
809
|
-
await
|
|
795
|
+
await ht(e, t), this.invalidate({ user: e, type: t });
|
|
810
796
|
}
|
|
811
797
|
async deleteSelectedReminders(e) {
|
|
812
798
|
const t = e.map((a) => a._id);
|
|
813
|
-
await
|
|
799
|
+
await mt({ _id: { $in: t } }), e.forEach((a) => {
|
|
814
800
|
this.invalidate({ user: a.user, type: a.type });
|
|
815
801
|
});
|
|
816
802
|
}
|
|
817
803
|
}
|
|
818
|
-
function
|
|
819
|
-
return
|
|
804
|
+
function wt(n, e) {
|
|
805
|
+
return _.find(n, {}, e).lean();
|
|
820
806
|
}
|
|
821
|
-
async function
|
|
822
|
-
const e = await
|
|
807
|
+
async function St(n) {
|
|
808
|
+
const e = await _.findOne(n).lean();
|
|
823
809
|
return e || null;
|
|
824
810
|
}
|
|
825
|
-
async function
|
|
826
|
-
return
|
|
811
|
+
async function bt(n, e, t) {
|
|
812
|
+
return _.findOneAndUpdate(n, e, {
|
|
827
813
|
...t,
|
|
828
814
|
returnDocument: "after"
|
|
829
815
|
}).lean();
|
|
830
816
|
}
|
|
831
|
-
class
|
|
817
|
+
class $t extends gt {
|
|
832
818
|
constructor() {
|
|
833
819
|
super(300);
|
|
834
820
|
}
|
|
@@ -842,44 +828,44 @@ class vt extends Ut {
|
|
|
842
828
|
return `${e.toString()}/${t}`;
|
|
843
829
|
}
|
|
844
830
|
fetchFromDb(e) {
|
|
845
|
-
return
|
|
831
|
+
return St(e);
|
|
846
832
|
}
|
|
847
833
|
fetchManyFromDb(e, t) {
|
|
848
|
-
return
|
|
834
|
+
return wt(e, t);
|
|
849
835
|
}
|
|
850
836
|
updateInDb(e, t, a = { upsert: !1 }) {
|
|
851
|
-
return
|
|
837
|
+
return bt(e, t, a);
|
|
852
838
|
}
|
|
853
839
|
}
|
|
854
|
-
const
|
|
840
|
+
const Ut = new $t(), Et = new u(
|
|
855
841
|
{
|
|
856
842
|
panoplyId: { unique: !0, index: 1, required: !0, type: String },
|
|
857
843
|
name: { required: !0, type: String },
|
|
858
844
|
equipments: {
|
|
859
845
|
required: !0,
|
|
860
|
-
type: [{ type:
|
|
846
|
+
type: [{ type: u.Types.ObjectId, ref: "Entities" }]
|
|
861
847
|
},
|
|
862
848
|
fullBonusStr: { type: String },
|
|
863
849
|
halfBonusStr: { type: String },
|
|
864
|
-
fullBonus:
|
|
865
|
-
halfBonus:
|
|
850
|
+
fullBonus: u.Types.Mixed,
|
|
851
|
+
halfBonus: u.Types.Mixed
|
|
866
852
|
},
|
|
867
853
|
{ minimize: !1 }
|
|
868
|
-
),
|
|
869
|
-
async function
|
|
870
|
-
const e = await
|
|
854
|
+
), F = c?.Panoplies || d("Panoplies", Et), Dt = (n, e) => F.find(n, {}, e).lean(), It = async (n, e) => F.find(n, {}, e).populate("equipments");
|
|
855
|
+
async function Tt(n) {
|
|
856
|
+
const e = await F.findOne({ panoplyId: n }).lean();
|
|
871
857
|
return e || null;
|
|
872
858
|
}
|
|
873
|
-
const
|
|
874
|
-
class
|
|
859
|
+
const Ot = async (n) => F.findOne(n).populate("equipments");
|
|
860
|
+
class vt extends m {
|
|
875
861
|
getAllPopulated() {
|
|
876
|
-
return
|
|
862
|
+
return It({}, {});
|
|
877
863
|
}
|
|
878
864
|
getPopulated(e) {
|
|
879
|
-
return
|
|
865
|
+
return Ot({ panoplyId: e });
|
|
880
866
|
}
|
|
881
867
|
hasPanoply(e, t) {
|
|
882
|
-
const a =
|
|
868
|
+
const a = H(Object.values(e)), r = t.equipments.filter(
|
|
883
869
|
(s) => a.find((i) => i.entityId === s.entityId)
|
|
884
870
|
).length;
|
|
885
871
|
if (r === t.equipments.length)
|
|
@@ -890,18 +876,18 @@ class xt extends w {
|
|
|
890
876
|
async getPanoplyBonus(e) {
|
|
891
877
|
const t = [], a = await this.getAllPopulated();
|
|
892
878
|
for (const r of a) {
|
|
893
|
-
const s =
|
|
894
|
-
(
|
|
879
|
+
const s = H(Object.values(e)), i = r.equipments.filter(
|
|
880
|
+
(o) => s.find(({ entityId: l }) => l === o.entityId)
|
|
895
881
|
);
|
|
896
882
|
i.length === r.equipments.length ? t.push([r, "full"]) : i.length >= r.equipments.length / 2 ? t.push([r, "half"]) : i.length >= 1 && t.push([r, null]);
|
|
897
883
|
}
|
|
898
884
|
return t;
|
|
899
885
|
}
|
|
900
886
|
}
|
|
901
|
-
const
|
|
887
|
+
const Mt = async (n, e) => F.findOneAndUpdate(n, e, {
|
|
902
888
|
returnDocument: "after"
|
|
903
889
|
}).lean();
|
|
904
|
-
class
|
|
890
|
+
class kt extends vt {
|
|
905
891
|
constructor() {
|
|
906
892
|
super(3600);
|
|
907
893
|
}
|
|
@@ -912,52 +898,69 @@ class Ct extends xt {
|
|
|
912
898
|
return e;
|
|
913
899
|
}
|
|
914
900
|
updateInDb(e, t) {
|
|
915
|
-
return
|
|
901
|
+
return Mt(e, t);
|
|
916
902
|
}
|
|
917
903
|
fetchFromDb(e) {
|
|
918
|
-
return
|
|
904
|
+
return Tt(e);
|
|
919
905
|
}
|
|
920
906
|
fetchManyFromDb(e, t) {
|
|
921
|
-
return
|
|
907
|
+
return Dt(e, t);
|
|
922
908
|
}
|
|
923
909
|
}
|
|
924
|
-
const
|
|
925
|
-
|
|
910
|
+
const A = new kt(), At = new u(
|
|
911
|
+
{
|
|
912
|
+
type: {
|
|
913
|
+
type: String,
|
|
914
|
+
enum: je,
|
|
915
|
+
required: !0
|
|
916
|
+
},
|
|
917
|
+
params: { type: u.Types.Mixed }
|
|
918
|
+
},
|
|
919
|
+
{ _id: !1 }
|
|
920
|
+
), Rt = new u(
|
|
921
|
+
{
|
|
922
|
+
entityId: { unique: !0, required: !0, type: String }
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
minimize: !1,
|
|
926
|
+
discriminatorKey: "type"
|
|
927
|
+
}
|
|
928
|
+
), qt = new u({
|
|
929
|
+
category: { required: !0, type: String },
|
|
930
|
+
subtype: { type: String },
|
|
931
|
+
rankId: String,
|
|
932
|
+
effects: { type: [At], default: [] },
|
|
933
|
+
usage: {
|
|
934
|
+
_id: !1,
|
|
935
|
+
type: {
|
|
936
|
+
mode: String,
|
|
937
|
+
craft: Boolean
|
|
938
|
+
},
|
|
939
|
+
default: void 0
|
|
940
|
+
}
|
|
941
|
+
}), xt = new u({
|
|
942
|
+
category: { required: !0, type: String },
|
|
943
|
+
characteristics: {
|
|
944
|
+
_id: !1,
|
|
945
|
+
type: Object
|
|
946
|
+
},
|
|
947
|
+
panoply: String
|
|
948
|
+
}), q = c?.Entities || d("Entities", Rt), Bt = q.discriminator("item", qt);
|
|
949
|
+
q.discriminator("equipment", xt);
|
|
950
|
+
const Ct = async (n, e) => q.find(n, {}, e).lean(), _t = async (n, e) => Bt.find(n, {}, e).lean();
|
|
951
|
+
class Ft extends m {
|
|
926
952
|
isEntity(e) {
|
|
927
953
|
return !!e && "entityId" in e;
|
|
928
954
|
}
|
|
929
955
|
isItem(e) {
|
|
930
|
-
return e.
|
|
956
|
+
return e.type === "item";
|
|
931
957
|
}
|
|
932
958
|
isEquipment(e) {
|
|
933
|
-
return e.
|
|
959
|
+
return e.type === "equipment";
|
|
934
960
|
}
|
|
935
961
|
async isEntityId(e, t = () => !0) {
|
|
936
962
|
return (await this.getAll()).filter(t).map(({ entityId: r }) => r).includes(e);
|
|
937
963
|
}
|
|
938
|
-
async getSomeStoreItems(e) {
|
|
939
|
-
const t = (await this.getAll()).filter((a) => this.isStoreItem(a));
|
|
940
|
-
return H(
|
|
941
|
-
le(
|
|
942
|
-
e,
|
|
943
|
-
t,
|
|
944
|
-
(a) => a.entityId,
|
|
945
|
-
(a) => a.shop.odd ?? 0
|
|
946
|
-
),
|
|
947
|
-
(a) => a.shop.price
|
|
948
|
-
);
|
|
949
|
-
}
|
|
950
|
-
async getSomeRepairItems(e) {
|
|
951
|
-
const t = (await this.getAll()).filter((a) => this.isRepairItem(a));
|
|
952
|
-
return ge(t).slice(0, e);
|
|
953
|
-
}
|
|
954
|
-
async getSomeObjectItems(e) {
|
|
955
|
-
const t = (await this.getAll()).filter((a) => this.isObjectItem(a));
|
|
956
|
-
return ge(t.filter((a) => !!a.shop?.price)).slice(
|
|
957
|
-
0,
|
|
958
|
-
e
|
|
959
|
-
);
|
|
960
|
-
}
|
|
961
964
|
async idArrayToEntities(e) {
|
|
962
965
|
return (await this.getAll()).filter(
|
|
963
966
|
(t) => e.includes(t.entityId)
|
|
@@ -968,20 +971,23 @@ class Nt extends w {
|
|
|
968
971
|
}
|
|
969
972
|
async recordToEntityTuple(e) {
|
|
970
973
|
const t = await this.getAll();
|
|
971
|
-
return
|
|
972
|
-
const i = t.find(({ entityId:
|
|
974
|
+
return B(e).reduce((a, [r, s]) => {
|
|
975
|
+
const i = t.find(({ entityId: o }) => o === r);
|
|
973
976
|
return i && a.push([i, s]), a;
|
|
974
977
|
}, []);
|
|
975
978
|
}
|
|
976
979
|
async getAllEntitiesLimit() {
|
|
977
980
|
const e = await this.getAll();
|
|
978
|
-
return
|
|
981
|
+
return we(
|
|
979
982
|
e.map((t) => [t.entityId, t.shop?.limit ?? 0])
|
|
980
983
|
);
|
|
981
984
|
}
|
|
982
985
|
async getAllEntitiesBy(e) {
|
|
983
986
|
return (await this.getAll()).filter(e);
|
|
984
987
|
}
|
|
988
|
+
async getAllItemsBy(e) {
|
|
989
|
+
return (await _t({}, {})).filter(e);
|
|
990
|
+
}
|
|
985
991
|
async fromDBToEquipableEquipment(e) {
|
|
986
992
|
const a = (await this.getAll()).filter(
|
|
987
993
|
(r) => this.isEquipment(r)
|
|
@@ -1001,82 +1007,50 @@ class Nt extends w {
|
|
|
1001
1007
|
intelligence: 0,
|
|
1002
1008
|
wisdom: 0
|
|
1003
1009
|
};
|
|
1004
|
-
const a = await
|
|
1005
|
-
for (const r of
|
|
1010
|
+
const a = await A.getAllPopulated();
|
|
1011
|
+
for (const r of he) {
|
|
1006
1012
|
const s = e[r];
|
|
1007
|
-
s && (t =
|
|
1013
|
+
s && (t = K(
|
|
1008
1014
|
t,
|
|
1009
1015
|
(await this.fromDBToEquipableEquipment(s)).characteristics,
|
|
1010
|
-
(i,
|
|
1016
|
+
(i, o) => i + o
|
|
1011
1017
|
));
|
|
1012
1018
|
}
|
|
1013
1019
|
for (const r of a) {
|
|
1014
|
-
const s =
|
|
1015
|
-
s && !("target" in s) && (t =
|
|
1020
|
+
const s = A.hasPanoply(e, r);
|
|
1021
|
+
s && !("target" in s) && (t = K(
|
|
1016
1022
|
t,
|
|
1017
1023
|
s,
|
|
1018
|
-
(i,
|
|
1024
|
+
(i, o) => i + o
|
|
1019
1025
|
));
|
|
1020
1026
|
}
|
|
1021
1027
|
return t;
|
|
1022
1028
|
}
|
|
1023
|
-
filterCraftEntities(e) {
|
|
1024
|
-
return e.filter((t) => t.usage?.craft);
|
|
1025
|
-
}
|
|
1026
|
-
filterDismantleEntities(e) {
|
|
1027
|
-
return e.filter((t) => t.usage?.dismantle);
|
|
1028
|
-
}
|
|
1029
1029
|
filterUsableEntities(e) {
|
|
1030
|
-
return e.filter(
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
return e.filter((t) => t.usage?.enchant);
|
|
1034
|
-
}
|
|
1035
|
-
hasCraftEntities(e) {
|
|
1036
|
-
return !!e.find((t) => t.usage?.craft);
|
|
1037
|
-
}
|
|
1038
|
-
hasDismantleEntities(e) {
|
|
1039
|
-
return !!e.find((t) => t.usage?.dismantle);
|
|
1040
|
-
}
|
|
1041
|
-
hasEnchantableEntities(e) {
|
|
1042
|
-
return !!e.find((t) => t.usage?.enchant);
|
|
1030
|
+
return e.filter(
|
|
1031
|
+
(t) => this.isConsumableItem(t) && t.usage?.mode
|
|
1032
|
+
);
|
|
1043
1033
|
}
|
|
1044
1034
|
hasUsableEntities(e) {
|
|
1045
|
-
return !!e.find(
|
|
1035
|
+
return !!e.find(
|
|
1036
|
+
(t) => this.isConsumableItem(t) && t.usage?.mode
|
|
1037
|
+
);
|
|
1046
1038
|
}
|
|
1047
1039
|
isChestItem(e) {
|
|
1048
|
-
return e.
|
|
1040
|
+
return this.isItem(e) && e.category === "chest";
|
|
1049
1041
|
}
|
|
1050
|
-
|
|
1051
|
-
return e.
|
|
1042
|
+
isConsumableItem(e) {
|
|
1043
|
+
return this.isItem(e) && e.category === "consumable";
|
|
1052
1044
|
}
|
|
1053
|
-
|
|
1054
|
-
return e.
|
|
1055
|
-
}
|
|
1056
|
-
isRepairItem(e) {
|
|
1057
|
-
return e.type === "repair";
|
|
1058
|
-
}
|
|
1059
|
-
isStoreItem(e) {
|
|
1060
|
-
return e.type === "store";
|
|
1061
|
-
}
|
|
1062
|
-
isObjectItem(e) {
|
|
1063
|
-
return e.type === "object";
|
|
1064
|
-
}
|
|
1065
|
-
isScrollItem(e) {
|
|
1066
|
-
return e.type === "scroll";
|
|
1067
|
-
}
|
|
1068
|
-
isCookedMeal(e) {
|
|
1069
|
-
return e.type === "cookedMeal";
|
|
1070
|
-
}
|
|
1071
|
-
isAlcoholItem(e) {
|
|
1072
|
-
return e.type === "alcohol";
|
|
1045
|
+
isResourceItem(e) {
|
|
1046
|
+
return this.isItem(e) && e.category === "resource";
|
|
1073
1047
|
}
|
|
1074
1048
|
isSameEquipment(e, t) {
|
|
1075
1049
|
return e.entityId === t.entityId && e.seed === t.seed;
|
|
1076
1050
|
}
|
|
1077
1051
|
seedEquipment(e, t) {
|
|
1078
|
-
const a =
|
|
1079
|
-
|
|
1052
|
+
const a = Ve(t), r = ie(
|
|
1053
|
+
B(e.characteristics),
|
|
1080
1054
|
([s]) => s
|
|
1081
1055
|
);
|
|
1082
1056
|
return {
|
|
@@ -1085,7 +1059,7 @@ class Nt extends w {
|
|
|
1085
1059
|
characteristics: Object.fromEntries(
|
|
1086
1060
|
r.map(([s, i]) => [
|
|
1087
1061
|
s,
|
|
1088
|
-
Array.isArray(i) ?
|
|
1062
|
+
Array.isArray(i) ? Se(i[0], i[1] + 1, a) : i
|
|
1089
1063
|
])
|
|
1090
1064
|
)
|
|
1091
1065
|
};
|
|
@@ -1095,128 +1069,32 @@ class Nt extends w {
|
|
|
1095
1069
|
(a) => a && this.isSameEquipment(a, t)
|
|
1096
1070
|
);
|
|
1097
1071
|
}
|
|
1098
|
-
calcILvl(e) {
|
|
1099
|
-
return Object.values(e.characteristics).reduce((a, r) => a + r, 0) + e.level;
|
|
1100
|
-
}
|
|
1101
1072
|
}
|
|
1102
|
-
const
|
|
1103
|
-
{
|
|
1104
|
-
type: {
|
|
1105
|
-
type: String,
|
|
1106
|
-
enum: Qe,
|
|
1107
|
-
required: !0
|
|
1108
|
-
},
|
|
1109
|
-
params: { type: o.Types.Mixed }
|
|
1110
|
-
},
|
|
1111
|
-
{ _id: !1 }
|
|
1112
|
-
), zt = new o(
|
|
1113
|
-
{
|
|
1114
|
-
entityId: { unique: !0, required: !0, type: String },
|
|
1115
|
-
type: { required: !0, type: String },
|
|
1116
|
-
name: {
|
|
1117
|
-
required: !0,
|
|
1118
|
-
_id: !1,
|
|
1119
|
-
type: {
|
|
1120
|
-
key: { required: !0, type: String },
|
|
1121
|
-
context: String
|
|
1122
|
-
}
|
|
1123
|
-
},
|
|
1124
|
-
description: {
|
|
1125
|
-
_id: !1,
|
|
1126
|
-
type: {
|
|
1127
|
-
key: { required: !0, type: String },
|
|
1128
|
-
context: String
|
|
1129
|
-
}
|
|
1130
|
-
},
|
|
1131
|
-
image: { required: !0, type: String },
|
|
1132
|
-
emojis: { required: !0, type: String },
|
|
1133
|
-
category: { required: !0, type: String },
|
|
1134
|
-
effects: { type: [Ft], default: [] },
|
|
1135
|
-
rankId: String,
|
|
1136
|
-
usage: {
|
|
1137
|
-
_id: !1,
|
|
1138
|
-
type: {
|
|
1139
|
-
mode: String,
|
|
1140
|
-
craft: Boolean,
|
|
1141
|
-
enchant: String,
|
|
1142
|
-
dismantle: {
|
|
1143
|
-
type: [{ type: { entityId: String, quantity: Number }, _id: !1 }],
|
|
1144
|
-
default: void 0
|
|
1145
|
-
}
|
|
1146
|
-
},
|
|
1147
|
-
default: void 0
|
|
1148
|
-
},
|
|
1149
|
-
shop: {
|
|
1150
|
-
default: void 0,
|
|
1151
|
-
_id: !1,
|
|
1152
|
-
type: {
|
|
1153
|
-
price: { required: !0, type: Number },
|
|
1154
|
-
limit: Number,
|
|
1155
|
-
size: Number,
|
|
1156
|
-
odd: Number
|
|
1157
|
-
}
|
|
1158
|
-
},
|
|
1159
|
-
bottle: {
|
|
1160
|
-
default: void 0,
|
|
1161
|
-
_id: !1,
|
|
1162
|
-
type: {
|
|
1163
|
-
xp: {
|
|
1164
|
-
type: o.Types.Union,
|
|
1165
|
-
of: [Number, [Number]],
|
|
1166
|
-
required: !0
|
|
1167
|
-
},
|
|
1168
|
-
buffs: {
|
|
1169
|
-
required: !0,
|
|
1170
|
-
default: [],
|
|
1171
|
-
type: [
|
|
1172
|
-
{
|
|
1173
|
-
target: { type: String, required: !0 },
|
|
1174
|
-
multiplier: { type: Number, required: !0 },
|
|
1175
|
-
origin: { type: String, required: !0 },
|
|
1176
|
-
startIn: { type: Number, default: null },
|
|
1177
|
-
endIn: { type: Number, default: null },
|
|
1178
|
-
_id: !1
|
|
1179
|
-
}
|
|
1180
|
-
]
|
|
1181
|
-
},
|
|
1182
|
-
hp: Number,
|
|
1183
|
-
tier: Number
|
|
1184
|
-
}
|
|
1185
|
-
},
|
|
1186
|
-
ms: Number,
|
|
1187
|
-
characteristics: {
|
|
1188
|
-
_id: !1,
|
|
1189
|
-
type: Object
|
|
1190
|
-
},
|
|
1191
|
-
level: Number,
|
|
1192
|
-
panoply: String
|
|
1193
|
-
},
|
|
1194
|
-
{ minimize: !1 }
|
|
1195
|
-
), ne = d?.Entities || p("Entities", zt), jt = async (n) => await ne.create({
|
|
1073
|
+
const Nt = async (n) => await q.create({
|
|
1196
1074
|
...n
|
|
1197
|
-
})
|
|
1198
|
-
async function
|
|
1199
|
-
const e = await
|
|
1075
|
+
});
|
|
1076
|
+
async function Ht(n) {
|
|
1077
|
+
const e = await q.findOne({ entityId: n }).lean();
|
|
1200
1078
|
return e || null;
|
|
1201
1079
|
}
|
|
1202
|
-
const
|
|
1080
|
+
const Kt = (n, e) => q.findOneAndUpdate(n, e, {
|
|
1203
1081
|
returnDocument: "after"
|
|
1204
1082
|
}).lean();
|
|
1205
|
-
class
|
|
1083
|
+
class jt extends Ft {
|
|
1206
1084
|
constructor() {
|
|
1207
1085
|
super(3600);
|
|
1208
1086
|
}
|
|
1209
1087
|
createInDb(e) {
|
|
1210
|
-
return
|
|
1088
|
+
return Nt(e);
|
|
1211
1089
|
}
|
|
1212
1090
|
updateInDb(e, t) {
|
|
1213
|
-
return
|
|
1091
|
+
return Kt(e, t);
|
|
1214
1092
|
}
|
|
1215
1093
|
fetchFromDb(e) {
|
|
1216
|
-
return
|
|
1094
|
+
return Ht(e);
|
|
1217
1095
|
}
|
|
1218
1096
|
fetchManyFromDb(e, t) {
|
|
1219
|
-
return
|
|
1097
|
+
return Ct(e, t);
|
|
1220
1098
|
}
|
|
1221
1099
|
normalizeKey(e) {
|
|
1222
1100
|
return e;
|
|
@@ -1225,8 +1103,8 @@ class Lt extends Nt {
|
|
|
1225
1103
|
return e.entityId;
|
|
1226
1104
|
}
|
|
1227
1105
|
}
|
|
1228
|
-
const
|
|
1229
|
-
class
|
|
1106
|
+
const f = new jt();
|
|
1107
|
+
class Pt extends y {
|
|
1230
1108
|
hasAlreadyFoundEntity(e, t) {
|
|
1231
1109
|
return e.encyclopedia.includes(t);
|
|
1232
1110
|
}
|
|
@@ -1236,23 +1114,23 @@ class Qt extends f {
|
|
|
1236
1114
|
});
|
|
1237
1115
|
}
|
|
1238
1116
|
}
|
|
1239
|
-
const
|
|
1117
|
+
const zt = async (n) => await Q.create({
|
|
1240
1118
|
user: n
|
|
1241
1119
|
});
|
|
1242
|
-
async function
|
|
1243
|
-
const e = await
|
|
1244
|
-
return e ||
|
|
1120
|
+
async function Lt(n) {
|
|
1121
|
+
const e = await Q.findOne({ user: n }).lean();
|
|
1122
|
+
return e || p(await zt(n));
|
|
1245
1123
|
}
|
|
1246
|
-
const
|
|
1124
|
+
const Qt = (n, e) => Q.findOneAndUpdate({ user: n }, e, {
|
|
1247
1125
|
upsert: !0,
|
|
1248
1126
|
returnDocument: "after"
|
|
1249
1127
|
}).lean();
|
|
1250
|
-
class
|
|
1128
|
+
class Gt extends Pt {
|
|
1251
1129
|
constructor() {
|
|
1252
1130
|
super(300);
|
|
1253
1131
|
}
|
|
1254
1132
|
fetchFromDb(e) {
|
|
1255
|
-
return
|
|
1133
|
+
return Lt(e);
|
|
1256
1134
|
}
|
|
1257
1135
|
getKey({ user: e }) {
|
|
1258
1136
|
return e;
|
|
@@ -1261,22 +1139,11 @@ class Vt extends Qt {
|
|
|
1261
1139
|
return e.toString();
|
|
1262
1140
|
}
|
|
1263
1141
|
updateInDb(e, t) {
|
|
1264
|
-
return
|
|
1142
|
+
return Qt(e, t);
|
|
1265
1143
|
}
|
|
1266
1144
|
}
|
|
1267
|
-
const
|
|
1268
|
-
class
|
|
1269
|
-
getPanoplyEffectiveBonus(e, t) {
|
|
1270
|
-
const a = _(
|
|
1271
|
-
Object.values(e.equippedItems)
|
|
1272
|
-
), r = t.equipments.filter(
|
|
1273
|
-
(s) => a.find((i) => i.entityId === s.entityId)
|
|
1274
|
-
).length;
|
|
1275
|
-
if (r === t.equipments.length)
|
|
1276
|
-
return t.fullBonus;
|
|
1277
|
-
if (r >= t.equipments.length / 2)
|
|
1278
|
-
return t.halfBonus;
|
|
1279
|
-
}
|
|
1145
|
+
const se = new Gt();
|
|
1146
|
+
class Wt extends y {
|
|
1280
1147
|
async getUserEquipmentsCharacteristics(e) {
|
|
1281
1148
|
let t = {
|
|
1282
1149
|
vitality: 0,
|
|
@@ -1286,31 +1153,22 @@ class Xt extends f {
|
|
|
1286
1153
|
intelligence: 0,
|
|
1287
1154
|
wisdom: 0
|
|
1288
1155
|
};
|
|
1289
|
-
const a
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
if (!s)
|
|
1156
|
+
for (const a of he) {
|
|
1157
|
+
const r = e.equippedItems?.[a];
|
|
1158
|
+
if (!r)
|
|
1293
1159
|
continue;
|
|
1294
|
-
const
|
|
1295
|
-
t =
|
|
1160
|
+
const s = await f.fromDBToEquipableEquipment(r);
|
|
1161
|
+
t = K(
|
|
1296
1162
|
t,
|
|
1297
|
-
|
|
1298
|
-
(
|
|
1163
|
+
s.characteristics,
|
|
1164
|
+
(i, o) => i + o
|
|
1299
1165
|
);
|
|
1300
1166
|
}
|
|
1301
|
-
for (const r of a) {
|
|
1302
|
-
const s = this.getPanoplyEffectiveBonus(e, r);
|
|
1303
|
-
s && !("target" in s) && (t = C(
|
|
1304
|
-
t,
|
|
1305
|
-
s,
|
|
1306
|
-
(i, c) => i + c
|
|
1307
|
-
));
|
|
1308
|
-
}
|
|
1309
1167
|
return t;
|
|
1310
1168
|
}
|
|
1311
1169
|
async hasInventoryRequirements(e, t) {
|
|
1312
1170
|
const a = await this.get(e);
|
|
1313
|
-
return
|
|
1171
|
+
return B(t).reduce(
|
|
1314
1172
|
(r, [s, i]) => r && (a.itemList[s] ?? 0) >= (i ?? 0),
|
|
1315
1173
|
!0
|
|
1316
1174
|
);
|
|
@@ -1321,29 +1179,15 @@ class Xt extends f {
|
|
|
1321
1179
|
async getItemList(e) {
|
|
1322
1180
|
return (await this.get(e)).itemList;
|
|
1323
1181
|
}
|
|
1324
|
-
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
1325
|
-
const a = await this.get(e), s = (await E.getPanoplyBonus(
|
|
1326
|
-
a.equippedItems
|
|
1327
|
-
)).find(
|
|
1328
|
-
([i, c]) => i.panoplyId === "herbalist" && c !== null
|
|
1329
|
-
);
|
|
1330
|
-
return s && s[1] === "full" ? t.map((i) => ({
|
|
1331
|
-
...i,
|
|
1332
|
-
multiplier: i.multiplier * 1.25
|
|
1333
|
-
})) : s && s[1] === "half" ? t.map((i) => ({
|
|
1334
|
-
...i,
|
|
1335
|
-
multiplier: i.multiplier * 1.1
|
|
1336
|
-
})) : t;
|
|
1337
|
-
}
|
|
1338
1182
|
async calcMinStreakForWorkLoot(e) {
|
|
1339
|
-
const t = await this.get(e), a = (await
|
|
1183
|
+
const t = await this.get(e), a = (await A.getPanoplyBonus(t.equippedItems)).find(
|
|
1340
1184
|
([r, s]) => r.panoplyId === "marine" && s !== null
|
|
1341
1185
|
);
|
|
1342
1186
|
return a && a[1] === "full" ? 10 : a && a[1] === "half" ? 20 : 1 / 0;
|
|
1343
1187
|
}
|
|
1344
1188
|
async hasRevolutionaryBuff(e) {
|
|
1345
1189
|
const t = await this.get(e);
|
|
1346
|
-
return (await
|
|
1190
|
+
return (await A.getPanoplyBonus(t.equippedItems)).find(
|
|
1347
1191
|
([r, s]) => r.panoplyId === "revolutionary" && s !== null
|
|
1348
1192
|
)?.[1] ?? null;
|
|
1349
1193
|
}
|
|
@@ -1353,16 +1197,16 @@ class Xt extends f {
|
|
|
1353
1197
|
async addItem(e, t, a) {
|
|
1354
1198
|
await this.update(e, {
|
|
1355
1199
|
$inc: { [`itemList.${t}`]: a }
|
|
1356
|
-
}), await
|
|
1200
|
+
}), await se.addEntities(e, [t]);
|
|
1357
1201
|
}
|
|
1358
1202
|
async addItems(e, t) {
|
|
1359
1203
|
await this.update(e, {
|
|
1360
1204
|
$inc: Object.fromEntries(
|
|
1361
1205
|
Object.entries(t).filter(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
|
|
1362
1206
|
)
|
|
1363
|
-
}), await
|
|
1207
|
+
}), await se.addEntities(
|
|
1364
1208
|
e,
|
|
1365
|
-
|
|
1209
|
+
B(t).filter(([, a]) => a > 0).map(([a]) => a)
|
|
1366
1210
|
);
|
|
1367
1211
|
}
|
|
1368
1212
|
async removeItem(e, t, a) {
|
|
@@ -1392,7 +1236,7 @@ class Xt extends f {
|
|
|
1392
1236
|
async addEquipments(e, t) {
|
|
1393
1237
|
await this.update(e, {
|
|
1394
1238
|
$push: { equipmentList: { $each: t } }
|
|
1395
|
-
}), await
|
|
1239
|
+
}), await se.addEntities(
|
|
1396
1240
|
e,
|
|
1397
1241
|
t.map((a) => a.entityId)
|
|
1398
1242
|
);
|
|
@@ -1411,34 +1255,34 @@ class Xt extends f {
|
|
|
1411
1255
|
a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
|
|
1412
1256
|
}
|
|
1413
1257
|
async equip(e, t) {
|
|
1414
|
-
const a = await
|
|
1415
|
-
|
|
1258
|
+
const a = await E.getMaxHp(e), r = Object.fromEntries(
|
|
1259
|
+
B(t).map(([s, i]) => [
|
|
1416
1260
|
`equippedItems.${s}`,
|
|
1417
1261
|
i
|
|
1418
1262
|
])
|
|
1419
1263
|
);
|
|
1420
1264
|
await this.update(e, {
|
|
1421
1265
|
$set: r
|
|
1422
|
-
}), await
|
|
1266
|
+
}), await E.updateHp(e, a);
|
|
1423
1267
|
}
|
|
1424
1268
|
async unequip(e, t) {
|
|
1425
|
-
const a = await
|
|
1269
|
+
const a = await E.getMaxHp(e);
|
|
1426
1270
|
await this.update(e, {
|
|
1427
1271
|
$set: {
|
|
1428
1272
|
[`equippedItems.${t}`]: null
|
|
1429
1273
|
}
|
|
1430
|
-
}), await
|
|
1274
|
+
}), await E.updateHp(e, a);
|
|
1431
1275
|
}
|
|
1432
1276
|
async craftItem(e, t, a, r) {
|
|
1433
|
-
for (const { entityId:
|
|
1434
|
-
await this.removeItem(e,
|
|
1277
|
+
for (const { entityId: o, size: l } of t.entities)
|
|
1278
|
+
await this.removeItem(e, o, l * a);
|
|
1435
1279
|
const { entityId: s, size: i } = t.result;
|
|
1436
|
-
await
|
|
1280
|
+
await f.isEntityId(s, f.isEquipment) ? await this.addEquipments(e, [{ entityId: s, seed: r }]) : await f.isEntityId(s, f.isItem) && await this.addItem(e, s, i * a);
|
|
1437
1281
|
}
|
|
1438
1282
|
async dismantleEntity(e, t, a, r, s) {
|
|
1439
|
-
|
|
1440
|
-
for (const { entityId: i, quantity:
|
|
1441
|
-
await
|
|
1283
|
+
f.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : f.isItem(t) && await this.removeItem(e, t.entityId, r);
|
|
1284
|
+
for (const { entityId: i, quantity: o } of a)
|
|
1285
|
+
await f.isEntityId(i, f.isItem) && await this.addItem(e, i, r * o);
|
|
1442
1286
|
await this.removeItem(e, "tools", 1);
|
|
1443
1287
|
}
|
|
1444
1288
|
async enchantItem(e, t, a, r, s) {
|
|
@@ -1448,23 +1292,23 @@ class Xt extends f {
|
|
|
1448
1292
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
1449
1293
|
}
|
|
1450
1294
|
}
|
|
1451
|
-
const
|
|
1295
|
+
const Yt = (n) => W.create({
|
|
1452
1296
|
user: n
|
|
1453
1297
|
});
|
|
1454
|
-
async function
|
|
1455
|
-
const e = await
|
|
1456
|
-
return e ||
|
|
1298
|
+
async function Vt(n) {
|
|
1299
|
+
const e = await W.findOne({ user: n }).lean();
|
|
1300
|
+
return e || p(await Yt(n));
|
|
1457
1301
|
}
|
|
1458
|
-
const
|
|
1302
|
+
const Xt = (n, e) => W.findOneAndUpdate({ user: n }, e, {
|
|
1459
1303
|
upsert: !0,
|
|
1460
1304
|
returnDocument: "after"
|
|
1461
1305
|
}).lean();
|
|
1462
|
-
class
|
|
1306
|
+
class Jt extends Wt {
|
|
1463
1307
|
constructor() {
|
|
1464
1308
|
super(300);
|
|
1465
1309
|
}
|
|
1466
1310
|
fetchFromDb(e) {
|
|
1467
|
-
return
|
|
1311
|
+
return Vt(e);
|
|
1468
1312
|
}
|
|
1469
1313
|
normalizeKey(e) {
|
|
1470
1314
|
return e.toString();
|
|
@@ -1473,17 +1317,17 @@ class tn extends Xt {
|
|
|
1473
1317
|
return e;
|
|
1474
1318
|
}
|
|
1475
1319
|
updateInDb(e, t) {
|
|
1476
|
-
return
|
|
1320
|
+
return Xt(e, t);
|
|
1477
1321
|
}
|
|
1478
1322
|
}
|
|
1479
|
-
const
|
|
1480
|
-
class
|
|
1323
|
+
const U = new Jt();
|
|
1324
|
+
class Zt extends m {
|
|
1481
1325
|
async getTotalCharacteristics(e) {
|
|
1482
1326
|
const { characteristics: t, scrolls: a } = await this.get(e);
|
|
1483
|
-
return
|
|
1484
|
-
|
|
1327
|
+
return we(
|
|
1328
|
+
Pe.map((r) => [
|
|
1485
1329
|
r,
|
|
1486
|
-
|
|
1330
|
+
ze(t[r]) + a[r]
|
|
1487
1331
|
])
|
|
1488
1332
|
);
|
|
1489
1333
|
}
|
|
@@ -1535,7 +1379,7 @@ class nn extends w {
|
|
|
1535
1379
|
t.booster ? 0.25 : 0
|
|
1536
1380
|
);
|
|
1537
1381
|
return r + s + t.buffs.xp.global.reduce(
|
|
1538
|
-
(i, { expireAt:
|
|
1382
|
+
(i, { expireAt: o, startAt: l, multiplier: S }) => l && l > /* @__PURE__ */ new Date() || o && re(o) ? i : i + S,
|
|
1539
1383
|
0
|
|
1540
1384
|
);
|
|
1541
1385
|
}
|
|
@@ -1544,7 +1388,7 @@ class nn extends w {
|
|
|
1544
1388
|
return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
|
|
1545
1389
|
}
|
|
1546
1390
|
async getXpDeathPenalties(e) {
|
|
1547
|
-
const t = await this.get(e), a =
|
|
1391
|
+
const t = await this.get(e), a = Le(t.xp.amount);
|
|
1548
1392
|
return a <= 10 ? 5e3 : a <= 20 ? 1e4 : a <= 30 ? 2e4 : a <= 40 ? 3e4 : a <= 50 ? 5e4 : a <= 60 ? 75e3 : a <= 70 ? 15e4 : a <= 80 ? 25e4 : a <= 90 ? 4e5 : a <= 100 ? 75e4 : 14e6;
|
|
1549
1393
|
}
|
|
1550
1394
|
async calcXp(e, t, a) {
|
|
@@ -1557,32 +1401,32 @@ class nn extends w {
|
|
|
1557
1401
|
}
|
|
1558
1402
|
async calcBuffMultiplier(e, t, a) {
|
|
1559
1403
|
return (await this.get(e)).buffs[t][a].reduce(
|
|
1560
|
-
(i, { expireAt:
|
|
1404
|
+
(i, { expireAt: o, startAt: l, multiplier: S }) => i + (/* @__PURE__ */ new Date() >= (l ?? /* @__PURE__ */ new Date()) && (!o || !re(o)) ? S : 0),
|
|
1561
1405
|
1
|
|
1562
1406
|
);
|
|
1563
1407
|
}
|
|
1564
1408
|
async getMaxHp(e) {
|
|
1565
|
-
const t = await
|
|
1409
|
+
const t = await U.get(e), { vitality: a } = await this.getTotalCharacteristics(e), r = await U.getUserEquipmentsCharacteristics(
|
|
1566
1410
|
t
|
|
1567
1411
|
);
|
|
1568
|
-
return (a + r.vitality) *
|
|
1412
|
+
return (a + r.vitality) * Qe + Ge;
|
|
1569
1413
|
}
|
|
1570
1414
|
async getHpRatio(e) {
|
|
1571
1415
|
const t = await this.get(e), a = await this.getMaxHp(e);
|
|
1572
1416
|
return Math.min(t.hp / a, 1);
|
|
1573
1417
|
}
|
|
1574
1418
|
async hasCharacteristicRequirement(e, t) {
|
|
1575
|
-
const a = await
|
|
1419
|
+
const a = await U.get(e), r = await U.getUserEquipmentsCharacteristics(
|
|
1576
1420
|
a
|
|
1577
|
-
), s =
|
|
1421
|
+
), s = K(
|
|
1578
1422
|
await this.getTotalCharacteristics(e),
|
|
1579
1423
|
r,
|
|
1580
|
-
(i,
|
|
1424
|
+
(i, o) => i + o
|
|
1581
1425
|
);
|
|
1582
1426
|
if ("sum" in t) {
|
|
1583
1427
|
let i = 0;
|
|
1584
|
-
for (const
|
|
1585
|
-
i += s[
|
|
1428
|
+
for (const o of t.characteristics)
|
|
1429
|
+
i += s[o] ?? 0;
|
|
1586
1430
|
return i >= t.sum;
|
|
1587
1431
|
} else {
|
|
1588
1432
|
for (const i of Object.keys(
|
|
@@ -1597,8 +1441,8 @@ class nn extends w {
|
|
|
1597
1441
|
const t = await this.get(e);
|
|
1598
1442
|
for (const a of Object.values(t.buffs))
|
|
1599
1443
|
for (const r of Object.values(a))
|
|
1600
|
-
for (const { multiplier: s, startAt: i, expireAt:
|
|
1601
|
-
if (s < 0 && (!
|
|
1444
|
+
for (const { multiplier: s, startAt: i, expireAt: o } of r)
|
|
1445
|
+
if (s < 0 && (!o || !re(o)) && (i ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
1602
1446
|
return !0;
|
|
1603
1447
|
return !1;
|
|
1604
1448
|
}
|
|
@@ -1654,7 +1498,7 @@ class nn extends w {
|
|
|
1654
1498
|
await this.updateBuff(e, r);
|
|
1655
1499
|
return;
|
|
1656
1500
|
}
|
|
1657
|
-
const a =
|
|
1501
|
+
const a = We(t);
|
|
1658
1502
|
await this.update(e, [
|
|
1659
1503
|
{
|
|
1660
1504
|
$set: {
|
|
@@ -1749,15 +1593,15 @@ class nn extends w {
|
|
|
1749
1593
|
});
|
|
1750
1594
|
}
|
|
1751
1595
|
async updatePanoplyBuff(e, t, a, r) {
|
|
1752
|
-
const s = await
|
|
1753
|
-
(
|
|
1596
|
+
const s = await f.fromDBToEquipableEquipment(t), i = H(Object.values(a)), l = (await A.getAllPopulated()).find(
|
|
1597
|
+
($) => $.panoplyId === s.panoply
|
|
1754
1598
|
);
|
|
1755
|
-
if (!
|
|
1599
|
+
if (!l)
|
|
1756
1600
|
return;
|
|
1757
|
-
const
|
|
1758
|
-
(
|
|
1759
|
-
).length,
|
|
1760
|
-
|
|
1601
|
+
const S = l.equipments.filter(
|
|
1602
|
+
($) => (i.find((ae) => $.entityId === ae.entityId) || !r && s.entityId === $.entityId) && (r ? s.entityId !== $.entityId : !0)
|
|
1603
|
+
).length, x = S === l.equipments.length ? l.fullBonus : S >= l.equipments.length / 2 ? l.halfBonus : void 0;
|
|
1604
|
+
l.halfBonus && "target" in l.halfBonus && await this.removeBuff(e, l.halfBonus), l.fullBonus && "target" in l.fullBonus && await this.removeBuff(e, l.fullBonus), x && "target" in x && await this.updateBuff(e, x);
|
|
1761
1605
|
}
|
|
1762
1606
|
async gainHp(e, t) {
|
|
1763
1607
|
const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
|
|
@@ -1805,8 +1649,8 @@ class nn extends w {
|
|
|
1805
1649
|
$inc: r
|
|
1806
1650
|
}), await this.updateHp(e, a);
|
|
1807
1651
|
}
|
|
1808
|
-
async resetCharacteristics(e
|
|
1809
|
-
const
|
|
1652
|
+
async resetCharacteristics(e) {
|
|
1653
|
+
const t = await this.getMaxHp(e), a = {
|
|
1810
1654
|
vitality: 0,
|
|
1811
1655
|
strength: 0,
|
|
1812
1656
|
agility: 0,
|
|
@@ -1814,22 +1658,14 @@ class nn extends w {
|
|
|
1814
1658
|
intelligence: 0,
|
|
1815
1659
|
wisdom: 0
|
|
1816
1660
|
};
|
|
1817
|
-
|
|
1818
|
-
$set: {
|
|
1819
|
-
characteristics: r,
|
|
1820
|
-
"resetCharacteristics.free": !1
|
|
1821
|
-
}
|
|
1822
|
-
}) : await this.update(e, {
|
|
1661
|
+
await this.update(e, {
|
|
1823
1662
|
$set: {
|
|
1824
|
-
characteristics:
|
|
1825
|
-
"resetCharacteristics.nextAvailable": new Date(
|
|
1826
|
-
Date.now() + 720 * 60 * 60 * 1e3
|
|
1827
|
-
)
|
|
1663
|
+
characteristics: a
|
|
1828
1664
|
},
|
|
1829
1665
|
$inc: {
|
|
1830
1666
|
berry: -1e8
|
|
1831
1667
|
}
|
|
1832
|
-
}), await this.updateHp(e,
|
|
1668
|
+
}), await this.updateHp(e, t);
|
|
1833
1669
|
}
|
|
1834
1670
|
async updateLastMessageWithXpDate(e) {
|
|
1835
1671
|
await this.update(e, { $set: { "xp.lastMessageWithXp": /* @__PURE__ */ new Date() } });
|
|
@@ -1870,18 +1706,18 @@ class nn extends w {
|
|
|
1870
1706
|
return await this.addBerry(e, r), r;
|
|
1871
1707
|
}
|
|
1872
1708
|
}
|
|
1873
|
-
const
|
|
1709
|
+
const en = (n) => I.find(n).lean(), tn = async (n) => await I.create({
|
|
1874
1710
|
user: n
|
|
1875
1711
|
});
|
|
1876
|
-
async function
|
|
1877
|
-
const e = await
|
|
1878
|
-
return e ||
|
|
1712
|
+
async function nn(n) {
|
|
1713
|
+
const e = await I.findOne({ user: n }).lean();
|
|
1714
|
+
return e || p(await tn(n));
|
|
1879
1715
|
}
|
|
1880
|
-
const
|
|
1716
|
+
const an = (n, e) => I.findOneAndUpdate({ user: n }, e, {
|
|
1881
1717
|
returnDocument: "after",
|
|
1882
1718
|
upsert: !0
|
|
1883
1719
|
}).lean();
|
|
1884
|
-
class
|
|
1720
|
+
class rn extends Zt {
|
|
1885
1721
|
constructor() {
|
|
1886
1722
|
super(300);
|
|
1887
1723
|
}
|
|
@@ -1892,17 +1728,17 @@ class on extends nn {
|
|
|
1892
1728
|
return e;
|
|
1893
1729
|
}
|
|
1894
1730
|
fetchFromDb(e) {
|
|
1895
|
-
return
|
|
1731
|
+
return nn(e);
|
|
1896
1732
|
}
|
|
1897
1733
|
fetchManyFromDb(e) {
|
|
1898
|
-
return
|
|
1734
|
+
return en(e);
|
|
1899
1735
|
}
|
|
1900
1736
|
updateInDb(e, t) {
|
|
1901
|
-
return
|
|
1737
|
+
return an(e, t);
|
|
1902
1738
|
}
|
|
1903
1739
|
}
|
|
1904
|
-
const
|
|
1905
|
-
class
|
|
1740
|
+
const E = new rn();
|
|
1741
|
+
class sn extends m {
|
|
1906
1742
|
async updateSendDailyQuest(e, t) {
|
|
1907
1743
|
await this.update(e, { $set: { sendDailyQuest: t } });
|
|
1908
1744
|
}
|
|
@@ -1921,18 +1757,18 @@ class cn extends w {
|
|
|
1921
1757
|
});
|
|
1922
1758
|
}
|
|
1923
1759
|
}
|
|
1924
|
-
const
|
|
1760
|
+
const un = (n) => C.find(n).lean(), on = async (n) => await C.create({
|
|
1925
1761
|
user: n
|
|
1926
1762
|
});
|
|
1927
|
-
async function
|
|
1928
|
-
const e = await
|
|
1929
|
-
return e ||
|
|
1763
|
+
async function cn(n) {
|
|
1764
|
+
const e = await C.findOne({ user: n }).lean();
|
|
1765
|
+
return e || p(await on(n));
|
|
1930
1766
|
}
|
|
1931
|
-
const
|
|
1767
|
+
const dn = (n, e) => C.findOneAndUpdate({ user: n }, e, {
|
|
1932
1768
|
returnDocument: "after",
|
|
1933
1769
|
upsert: !0
|
|
1934
1770
|
}).lean();
|
|
1935
|
-
class
|
|
1771
|
+
class ln extends sn {
|
|
1936
1772
|
constructor() {
|
|
1937
1773
|
super(3600);
|
|
1938
1774
|
}
|
|
@@ -1943,17 +1779,17 @@ class fn extends cn {
|
|
|
1943
1779
|
return e.user;
|
|
1944
1780
|
}
|
|
1945
1781
|
fetchFromDb(e) {
|
|
1946
|
-
return
|
|
1782
|
+
return cn(e);
|
|
1947
1783
|
}
|
|
1948
1784
|
fetchManyFromDb(e) {
|
|
1949
|
-
return
|
|
1785
|
+
return un(e);
|
|
1950
1786
|
}
|
|
1951
1787
|
updateInDb(e, t) {
|
|
1952
|
-
return
|
|
1788
|
+
return dn(e, t);
|
|
1953
1789
|
}
|
|
1954
1790
|
}
|
|
1955
|
-
const
|
|
1956
|
-
class
|
|
1791
|
+
const Re = new ln();
|
|
1792
|
+
class pn extends y {
|
|
1957
1793
|
async getCommandCooldown(e, t) {
|
|
1958
1794
|
return (await this.get(e)).commands[t];
|
|
1959
1795
|
}
|
|
@@ -1962,33 +1798,33 @@ class mn extends f {
|
|
|
1962
1798
|
$set: {
|
|
1963
1799
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
1964
1800
|
}
|
|
1965
|
-
}), await
|
|
1801
|
+
}), await E.gainHp(e, 1);
|
|
1966
1802
|
}
|
|
1967
1803
|
async useCommand(e, t, a) {
|
|
1968
|
-
const { reminder: r } = await
|
|
1804
|
+
const { reminder: r } = await Re.get(e);
|
|
1969
1805
|
await this.update(e, {
|
|
1970
1806
|
$set: {
|
|
1971
1807
|
[`commands.${t}`]: new Date(Date.now() + a)
|
|
1972
1808
|
}
|
|
1973
|
-
}), r.commands[t] && await
|
|
1809
|
+
}), r.commands[t] && await Ut.addReminder(
|
|
1974
1810
|
e,
|
|
1975
1811
|
`commands/${t}`,
|
|
1976
1812
|
new Date(Date.now() + a)
|
|
1977
1813
|
);
|
|
1978
1814
|
}
|
|
1979
1815
|
}
|
|
1980
|
-
const
|
|
1816
|
+
const yn = async (n) => await z.create({
|
|
1981
1817
|
user: n
|
|
1982
1818
|
});
|
|
1983
|
-
async function
|
|
1984
|
-
const e = await
|
|
1985
|
-
return e ||
|
|
1819
|
+
async function fn(n) {
|
|
1820
|
+
const e = await z.findOne({ user: n }).lean();
|
|
1821
|
+
return e || p(await yn(n));
|
|
1986
1822
|
}
|
|
1987
|
-
const
|
|
1823
|
+
const mn = (n, e) => z.findOneAndUpdate({ user: n }, e, {
|
|
1988
1824
|
returnDocument: "after",
|
|
1989
1825
|
upsert: !0
|
|
1990
1826
|
}).lean();
|
|
1991
|
-
class
|
|
1827
|
+
class hn extends pn {
|
|
1992
1828
|
constructor() {
|
|
1993
1829
|
super(300);
|
|
1994
1830
|
}
|
|
@@ -1999,14 +1835,14 @@ class Sn extends mn {
|
|
|
1999
1835
|
return e.user;
|
|
2000
1836
|
}
|
|
2001
1837
|
fetchFromDb(e) {
|
|
2002
|
-
return
|
|
1838
|
+
return fn(e);
|
|
2003
1839
|
}
|
|
2004
1840
|
updateInDb(e, t) {
|
|
2005
|
-
return
|
|
1841
|
+
return mn(e, t);
|
|
2006
1842
|
}
|
|
2007
1843
|
}
|
|
2008
|
-
const
|
|
2009
|
-
class
|
|
1844
|
+
const fr = new hn();
|
|
1845
|
+
class gn extends m {
|
|
2010
1846
|
async isOrnamentIds(e, t = () => !0) {
|
|
2011
1847
|
const r = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
|
|
2012
1848
|
return e.every((s) => r.includes(s));
|
|
@@ -2045,13 +1881,13 @@ class bn extends w {
|
|
|
2045
1881
|
return (await this.getAll()).filter((e) => this.isShopTitle(e));
|
|
2046
1882
|
}
|
|
2047
1883
|
formatBackgroundId(e) {
|
|
2048
|
-
const t =
|
|
2049
|
-
return t === "background_default" ? "par défaut" : `"${
|
|
1884
|
+
const t = Xe(e) ? e : e.ornamentId;
|
|
1885
|
+
return t === "background_default" ? "par défaut" : `"${Je(t.split("_").join(" "))}"`;
|
|
2050
1886
|
}
|
|
2051
1887
|
async getSomeShopTitles(e) {
|
|
2052
1888
|
const t = await this.getAllShopTitles();
|
|
2053
|
-
return
|
|
2054
|
-
|
|
1889
|
+
return ie(
|
|
1890
|
+
pe(
|
|
2055
1891
|
e,
|
|
2056
1892
|
t,
|
|
2057
1893
|
(a) => a.ornamentId,
|
|
@@ -2062,8 +1898,8 @@ class bn extends w {
|
|
|
2062
1898
|
}
|
|
2063
1899
|
async getSomeBackgrounds(e) {
|
|
2064
1900
|
const t = await this.getAllBackgrounds();
|
|
2065
|
-
return
|
|
2066
|
-
|
|
1901
|
+
return ie(
|
|
1902
|
+
pe(
|
|
2067
1903
|
e,
|
|
2068
1904
|
t,
|
|
2069
1905
|
(a) => a.ornamentId,
|
|
@@ -2073,19 +1909,19 @@ class bn extends w {
|
|
|
2073
1909
|
);
|
|
2074
1910
|
}
|
|
2075
1911
|
pickEachRarityOrnament(e, t) {
|
|
2076
|
-
if (t.length !==
|
|
1912
|
+
if (t.length !== le.length)
|
|
2077
1913
|
throw new RangeError(
|
|
2078
1914
|
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
2079
1915
|
);
|
|
2080
|
-
return
|
|
1916
|
+
return H(
|
|
2081
1917
|
t.map((a, r) => {
|
|
2082
|
-
const s =
|
|
2083
|
-
return Math.random() > a || !i || !i.length ? null :
|
|
1918
|
+
const s = le[r], i = e[s];
|
|
1919
|
+
return Math.random() > a || !i || !i.length ? null : Ze(i);
|
|
2084
1920
|
})
|
|
2085
1921
|
);
|
|
2086
1922
|
}
|
|
2087
1923
|
}
|
|
2088
|
-
const
|
|
1924
|
+
const wn = new u(
|
|
2089
1925
|
{
|
|
2090
1926
|
ornamentId: { unique: !0, index: 1, required: !0, type: String },
|
|
2091
1927
|
type: { required: !0, type: String },
|
|
@@ -2099,26 +1935,26 @@ const $n = new o(
|
|
|
2099
1935
|
strength: Number
|
|
2100
1936
|
},
|
|
2101
1937
|
{ minimize: !1 }
|
|
2102
|
-
),
|
|
2103
|
-
async function
|
|
2104
|
-
const e = await
|
|
1938
|
+
), oe = c?.Ornaments || d("Ornaments", wn), Sn = async (n, e) => oe.find(n, {}, e).lean();
|
|
1939
|
+
async function bn(n) {
|
|
1940
|
+
const e = await oe.findOne({ ornamentId: n }).lean();
|
|
2105
1941
|
return e || null;
|
|
2106
1942
|
}
|
|
2107
|
-
const
|
|
1943
|
+
const $n = (n, e) => oe.findOneAndUpdate(n, e, {
|
|
2108
1944
|
returnDocument: "after"
|
|
2109
1945
|
}).lean();
|
|
2110
|
-
class
|
|
1946
|
+
class Un extends gn {
|
|
2111
1947
|
constructor() {
|
|
2112
1948
|
super(3600);
|
|
2113
1949
|
}
|
|
2114
1950
|
updateInDb(e, t) {
|
|
2115
|
-
return
|
|
1951
|
+
return $n(e, t);
|
|
2116
1952
|
}
|
|
2117
1953
|
fetchFromDb(e) {
|
|
2118
|
-
return
|
|
1954
|
+
return bn(e);
|
|
2119
1955
|
}
|
|
2120
1956
|
fetchManyFromDb(e, t) {
|
|
2121
|
-
return
|
|
1957
|
+
return Sn(e, t);
|
|
2122
1958
|
}
|
|
2123
1959
|
getKey(e) {
|
|
2124
1960
|
return e.ornamentId;
|
|
@@ -2127,13 +1963,13 @@ class Dn extends bn {
|
|
|
2127
1963
|
return e;
|
|
2128
1964
|
}
|
|
2129
1965
|
}
|
|
2130
|
-
const
|
|
2131
|
-
class
|
|
1966
|
+
const b = new Un();
|
|
1967
|
+
class En extends y {
|
|
2132
1968
|
async unlockTitle(e, t) {
|
|
2133
|
-
await
|
|
1969
|
+
await b.isOrnamentIds([t], b.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2134
1970
|
}
|
|
2135
1971
|
async unlockTitles(e, t) {
|
|
2136
|
-
await
|
|
1972
|
+
await b.isOrnamentIds(t, b.isTitle) && await this.update(e, {
|
|
2137
1973
|
$addToSet: { unlockedTitles: { $each: t } }
|
|
2138
1974
|
});
|
|
2139
1975
|
}
|
|
@@ -2141,17 +1977,17 @@ class Tn extends f {
|
|
|
2141
1977
|
await this.update(e, { $set: { selectedTitle: t } });
|
|
2142
1978
|
}
|
|
2143
1979
|
async unlockBackground(e, t) {
|
|
2144
|
-
await
|
|
1980
|
+
await b.isOrnamentIds(
|
|
2145
1981
|
[t],
|
|
2146
|
-
|
|
1982
|
+
b.isBackground
|
|
2147
1983
|
) && await this.update(e, {
|
|
2148
1984
|
$addToSet: { unlockedBackgrounds: t }
|
|
2149
1985
|
});
|
|
2150
1986
|
}
|
|
2151
1987
|
async unlockBackgrounds(e, t) {
|
|
2152
|
-
await
|
|
1988
|
+
await b.isOrnamentIds(
|
|
2153
1989
|
t,
|
|
2154
|
-
|
|
1990
|
+
b.isBackground
|
|
2155
1991
|
) && await this.update(e, {
|
|
2156
1992
|
$addToSet: { unlockedBackgrounds: { $each: t } }
|
|
2157
1993
|
});
|
|
@@ -2197,18 +2033,18 @@ class Tn extends f {
|
|
|
2197
2033
|
});
|
|
2198
2034
|
}
|
|
2199
2035
|
}
|
|
2200
|
-
const
|
|
2036
|
+
const Dn = async (n) => await Y.create({
|
|
2201
2037
|
user: n
|
|
2202
2038
|
});
|
|
2203
|
-
async function
|
|
2204
|
-
const e = await
|
|
2205
|
-
return e ||
|
|
2039
|
+
async function In(n) {
|
|
2040
|
+
const e = await Y.findOne({ user: n }).lean();
|
|
2041
|
+
return e || p(await Dn(n));
|
|
2206
2042
|
}
|
|
2207
|
-
const
|
|
2043
|
+
const Tn = async (n, e) => Y.findOneAndUpdate({ user: n }, e, {
|
|
2208
2044
|
upsert: !0,
|
|
2209
2045
|
returnDocument: "after"
|
|
2210
2046
|
}).lean();
|
|
2211
|
-
class
|
|
2047
|
+
class On extends En {
|
|
2212
2048
|
constructor() {
|
|
2213
2049
|
super(300);
|
|
2214
2050
|
}
|
|
@@ -2219,14 +2055,14 @@ class Mn extends Tn {
|
|
|
2219
2055
|
return e;
|
|
2220
2056
|
}
|
|
2221
2057
|
fetchFromDb(e) {
|
|
2222
|
-
return
|
|
2058
|
+
return In(e);
|
|
2223
2059
|
}
|
|
2224
2060
|
updateInDb(e, t) {
|
|
2225
|
-
return
|
|
2061
|
+
return Tn(e, t);
|
|
2226
2062
|
}
|
|
2227
2063
|
}
|
|
2228
|
-
const
|
|
2229
|
-
class
|
|
2064
|
+
const ye = new On();
|
|
2065
|
+
class vn extends m {
|
|
2230
2066
|
async getStatus(e, t) {
|
|
2231
2067
|
return (await this.get({ user: e, questId: t })).status;
|
|
2232
2068
|
}
|
|
@@ -2235,17 +2071,17 @@ class kn extends w {
|
|
|
2235
2071
|
}
|
|
2236
2072
|
async isStreaking(e, t) {
|
|
2237
2073
|
const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
|
|
2238
|
-
return !!a &&
|
|
2074
|
+
return !!a && be(j(), a);
|
|
2239
2075
|
}
|
|
2240
2076
|
async getStreakMultiplier(e, t) {
|
|
2241
2077
|
const a = await this.get({ user: e, questId: t });
|
|
2242
2078
|
return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
|
|
2243
2079
|
}
|
|
2244
2080
|
async getCompletedCount(e) {
|
|
2245
|
-
return (await this.getMany({ user: e, status:
|
|
2081
|
+
return (await this.getMany({ user: e, status: v.COMPLETED })).length;
|
|
2246
2082
|
}
|
|
2247
2083
|
async completeQuest(e, t = !1) {
|
|
2248
|
-
const a =
|
|
2084
|
+
const a = j();
|
|
2249
2085
|
a.setHours(0, 0, 0, 0);
|
|
2250
2086
|
const r = /* @__PURE__ */ new Date();
|
|
2251
2087
|
return r.setHours(0, 0, 0, 0), this.update(
|
|
@@ -2268,7 +2104,7 @@ class kn extends w {
|
|
|
2268
2104
|
}
|
|
2269
2105
|
} : {},
|
|
2270
2106
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
2271
|
-
status:
|
|
2107
|
+
status: v.COMPLETED
|
|
2272
2108
|
}
|
|
2273
2109
|
}
|
|
2274
2110
|
],
|
|
@@ -2276,24 +2112,24 @@ class kn extends w {
|
|
|
2276
2112
|
);
|
|
2277
2113
|
}
|
|
2278
2114
|
}
|
|
2279
|
-
function
|
|
2280
|
-
return
|
|
2115
|
+
function Mn(n) {
|
|
2116
|
+
return R.find(n).lean();
|
|
2281
2117
|
}
|
|
2282
|
-
const
|
|
2118
|
+
const kn = async (n) => await R.create({
|
|
2283
2119
|
...n
|
|
2284
2120
|
});
|
|
2285
|
-
async function
|
|
2286
|
-
const e = await
|
|
2287
|
-
return e ||
|
|
2121
|
+
async function An(n) {
|
|
2122
|
+
const e = await R.findOne(n).lean();
|
|
2123
|
+
return e || p(await kn(n));
|
|
2288
2124
|
}
|
|
2289
|
-
function
|
|
2290
|
-
return
|
|
2125
|
+
function Rn(n, e, t) {
|
|
2126
|
+
return R.findOneAndUpdate(n, e, {
|
|
2291
2127
|
upsert: !0,
|
|
2292
2128
|
...t,
|
|
2293
2129
|
returnDocument: "after"
|
|
2294
2130
|
}).lean();
|
|
2295
2131
|
}
|
|
2296
|
-
class
|
|
2132
|
+
class qn extends vn {
|
|
2297
2133
|
constructor() {
|
|
2298
2134
|
super(3600);
|
|
2299
2135
|
}
|
|
@@ -2307,17 +2143,17 @@ class _n extends kn {
|
|
|
2307
2143
|
return { user: e, questId: t };
|
|
2308
2144
|
}
|
|
2309
2145
|
fetchFromDb(e) {
|
|
2310
|
-
return
|
|
2146
|
+
return An(e);
|
|
2311
2147
|
}
|
|
2312
2148
|
fetchManyFromDb(e) {
|
|
2313
|
-
return
|
|
2149
|
+
return Mn(e);
|
|
2314
2150
|
}
|
|
2315
2151
|
updateInDb(e, t, a) {
|
|
2316
|
-
return
|
|
2152
|
+
return Rn(e, t, a);
|
|
2317
2153
|
}
|
|
2318
2154
|
}
|
|
2319
|
-
const
|
|
2320
|
-
class
|
|
2155
|
+
const fe = new qn();
|
|
2156
|
+
class xn extends y {
|
|
2321
2157
|
async randomMessageIncrement(e) {
|
|
2322
2158
|
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
2323
2159
|
}
|
|
@@ -2335,18 +2171,18 @@ class Cn extends f {
|
|
|
2335
2171
|
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
2336
2172
|
}
|
|
2337
2173
|
}
|
|
2338
|
-
const
|
|
2174
|
+
const Bn = async (n) => await X.create({
|
|
2339
2175
|
user: n
|
|
2340
2176
|
});
|
|
2341
|
-
async function
|
|
2342
|
-
const e = await
|
|
2343
|
-
return e ||
|
|
2177
|
+
async function Cn(n) {
|
|
2178
|
+
const e = await X.findOne({ user: n }).lean();
|
|
2179
|
+
return e || p(await Bn(n));
|
|
2344
2180
|
}
|
|
2345
|
-
const
|
|
2181
|
+
const _n = (n, e) => X.findOneAndUpdate({ user: n }, e, {
|
|
2346
2182
|
upsert: !0,
|
|
2347
2183
|
returnDocument: "after"
|
|
2348
2184
|
}).lean();
|
|
2349
|
-
class
|
|
2185
|
+
class Fn extends xn {
|
|
2350
2186
|
constructor() {
|
|
2351
2187
|
super(300);
|
|
2352
2188
|
}
|
|
@@ -2359,19 +2195,19 @@ class jn extends Cn {
|
|
|
2359
2195
|
return e;
|
|
2360
2196
|
}
|
|
2361
2197
|
fetchFromDb(e) {
|
|
2362
|
-
return
|
|
2198
|
+
return Cn(e);
|
|
2363
2199
|
}
|
|
2364
2200
|
updateInDb(e, t) {
|
|
2365
|
-
return
|
|
2201
|
+
return _n(e, t);
|
|
2366
2202
|
}
|
|
2367
2203
|
}
|
|
2368
|
-
const
|
|
2369
|
-
class
|
|
2204
|
+
const me = new Fn();
|
|
2205
|
+
class Nn extends y {
|
|
2370
2206
|
async updateDailyReport(e) {
|
|
2371
|
-
const t = await
|
|
2207
|
+
const t = await E.get(e), a = await ye.get(e), r = await fe.getMany({
|
|
2372
2208
|
user: e,
|
|
2373
|
-
status:
|
|
2374
|
-
}), s = await
|
|
2209
|
+
status: v.COMPLETED
|
|
2210
|
+
}), s = await me.get(e);
|
|
2375
2211
|
await this.update(e, {
|
|
2376
2212
|
$set: {
|
|
2377
2213
|
xpYesterday: t.xp.amount,
|
|
@@ -2393,29 +2229,29 @@ class Hn extends f {
|
|
|
2393
2229
|
xpYesterday: r,
|
|
2394
2230
|
berryYesterday: s,
|
|
2395
2231
|
previousMessageSent: i
|
|
2396
|
-
} = await this.get(e),
|
|
2232
|
+
} = await this.get(e), o = await E.get(e), l = await fe.getMany({
|
|
2397
2233
|
user: e,
|
|
2398
|
-
status:
|
|
2399
|
-
}),
|
|
2234
|
+
status: v.COMPLETED
|
|
2235
|
+
}), S = await ye.get(e), x = await me.get(e), { berry: $, xp: ae } = o, { voice: de, amount: qe } = ae, { unlockedBadges: xe, unlockedBackgrounds: Be, unlockedTitles: Ce } = S;
|
|
2400
2236
|
return {
|
|
2401
|
-
berry:
|
|
2402
|
-
xp:
|
|
2403
|
-
message:
|
|
2404
|
-
voice:
|
|
2405
|
-
quest:
|
|
2406
|
-
|
|
2237
|
+
berry: $ - s,
|
|
2238
|
+
xp: qe - r,
|
|
2239
|
+
message: x.messageSent - i,
|
|
2240
|
+
voice: be(de.lastConnection, j()) ? de.minutesInVoiceToday : 0,
|
|
2241
|
+
quest: N(
|
|
2242
|
+
l.map(({ questId: _e }) => _e),
|
|
2407
2243
|
a
|
|
2408
2244
|
),
|
|
2409
|
-
badge:
|
|
2410
|
-
title:
|
|
2411
|
-
background:
|
|
2412
|
-
|
|
2245
|
+
badge: N(xe, t.unlockedBadges),
|
|
2246
|
+
title: N(Ce, t.unlockedTitles),
|
|
2247
|
+
background: N(
|
|
2248
|
+
Be,
|
|
2413
2249
|
t.unlockedBackgrounds
|
|
2414
2250
|
)
|
|
2415
2251
|
};
|
|
2416
2252
|
}
|
|
2417
2253
|
async getAllDailyReportsToSend() {
|
|
2418
|
-
const e = await
|
|
2254
|
+
const e = await Re.getUsersWithDailyReportEnable(), t = await yt.getMany({
|
|
2419
2255
|
_id: { $in: e.map(({ user: a }) => a) },
|
|
2420
2256
|
faction: { $ne: "citizen" }
|
|
2421
2257
|
});
|
|
@@ -2428,18 +2264,18 @@ class Hn extends f {
|
|
|
2428
2264
|
);
|
|
2429
2265
|
}
|
|
2430
2266
|
}
|
|
2431
|
-
const
|
|
2267
|
+
const Hn = (n) => L.create({
|
|
2432
2268
|
user: n
|
|
2433
2269
|
});
|
|
2434
|
-
async function
|
|
2435
|
-
const e = await
|
|
2436
|
-
return e ||
|
|
2270
|
+
async function Kn(n) {
|
|
2271
|
+
const e = await L.findOne({ user: n }).lean();
|
|
2272
|
+
return e || p(await Hn(n));
|
|
2437
2273
|
}
|
|
2438
|
-
const
|
|
2274
|
+
const jn = (n, e) => L.findOneAndUpdate({ user: n }, e, {
|
|
2439
2275
|
upsert: !0,
|
|
2440
2276
|
returnDocument: "after"
|
|
2441
2277
|
}).lean();
|
|
2442
|
-
class
|
|
2278
|
+
class Pn extends Nn {
|
|
2443
2279
|
constructor() {
|
|
2444
2280
|
super(60);
|
|
2445
2281
|
}
|
|
@@ -2450,14 +2286,14 @@ class Qn extends Hn {
|
|
|
2450
2286
|
return e.user;
|
|
2451
2287
|
}
|
|
2452
2288
|
fetchFromDb(e) {
|
|
2453
|
-
return
|
|
2289
|
+
return Kn(e);
|
|
2454
2290
|
}
|
|
2455
2291
|
updateInDb(e, t) {
|
|
2456
|
-
return
|
|
2292
|
+
return jn(e, t);
|
|
2457
2293
|
}
|
|
2458
2294
|
}
|
|
2459
|
-
const
|
|
2460
|
-
class
|
|
2295
|
+
const mr = new Pn();
|
|
2296
|
+
class zn extends y {
|
|
2461
2297
|
async setGuessGame(e, t, a, r) {
|
|
2462
2298
|
await this.update(e, {
|
|
2463
2299
|
$set: {
|
|
@@ -2488,18 +2324,18 @@ class Wn extends f {
|
|
|
2488
2324
|
});
|
|
2489
2325
|
}
|
|
2490
2326
|
}
|
|
2491
|
-
const
|
|
2327
|
+
const Ln = async (n) => await G.create({
|
|
2492
2328
|
user: n
|
|
2493
2329
|
});
|
|
2494
|
-
async function
|
|
2495
|
-
const e = await
|
|
2496
|
-
return e ||
|
|
2330
|
+
async function Qn(n) {
|
|
2331
|
+
const e = await G.findOne({ user: n }).lean();
|
|
2332
|
+
return e || p(await Ln(n));
|
|
2497
2333
|
}
|
|
2498
|
-
const
|
|
2334
|
+
const Gn = (n, e) => G.findOneAndUpdate({ user: n }, e, {
|
|
2499
2335
|
upsert: !0,
|
|
2500
2336
|
returnDocument: "after"
|
|
2501
2337
|
}).lean();
|
|
2502
|
-
class
|
|
2338
|
+
class Wn extends zn {
|
|
2503
2339
|
constructor() {
|
|
2504
2340
|
super(300);
|
|
2505
2341
|
}
|
|
@@ -2510,15 +2346,15 @@ class Xn extends Wn {
|
|
|
2510
2346
|
return e;
|
|
2511
2347
|
}
|
|
2512
2348
|
fetchFromDb(e) {
|
|
2513
|
-
return
|
|
2349
|
+
return Qn(e);
|
|
2514
2350
|
}
|
|
2515
2351
|
updateInDb(e, t) {
|
|
2516
|
-
return
|
|
2352
|
+
return Gn(e, t);
|
|
2517
2353
|
}
|
|
2518
2354
|
}
|
|
2519
|
-
const
|
|
2355
|
+
const hr = new Wn(), Yn = new u({
|
|
2520
2356
|
user: {
|
|
2521
|
-
type:
|
|
2357
|
+
type: u.Types.ObjectId,
|
|
2522
2358
|
required: !0,
|
|
2523
2359
|
unique: !0,
|
|
2524
2360
|
ref: "User"
|
|
@@ -2526,10 +2362,10 @@ const zr = new Xn(), Jn = new o({
|
|
|
2526
2362
|
xp: { type: Number, default: 0 },
|
|
2527
2363
|
berry: { type: Number, default: 0 },
|
|
2528
2364
|
faction: { type: Number, default: 0 }
|
|
2529
|
-
}),
|
|
2530
|
-
class
|
|
2365
|
+
}), O = c?.UserRank || d("UserRank", Yn);
|
|
2366
|
+
class Vn extends y {
|
|
2531
2367
|
async computeAllXpRanks() {
|
|
2532
|
-
const t = (await
|
|
2368
|
+
const t = (await I.aggregate([
|
|
2533
2369
|
{
|
|
2534
2370
|
$setWindowFields: {
|
|
2535
2371
|
sortBy: { "xp.amount": -1 },
|
|
@@ -2544,10 +2380,10 @@ class Zn extends f {
|
|
|
2544
2380
|
upsert: !0
|
|
2545
2381
|
}
|
|
2546
2382
|
}));
|
|
2547
|
-
t.length > 0 && await
|
|
2383
|
+
t.length > 0 && await O.bulkWrite(t), this.clearAll();
|
|
2548
2384
|
}
|
|
2549
2385
|
async computeAllBerryRanks() {
|
|
2550
|
-
const t = (await
|
|
2386
|
+
const t = (await I.aggregate([
|
|
2551
2387
|
{
|
|
2552
2388
|
$setWindowFields: {
|
|
2553
2389
|
sortBy: { berry: -1 },
|
|
@@ -2562,10 +2398,10 @@ class Zn extends f {
|
|
|
2562
2398
|
upsert: !0
|
|
2563
2399
|
}
|
|
2564
2400
|
}));
|
|
2565
|
-
t.length > 0 && await
|
|
2401
|
+
t.length > 0 && await O.bulkWrite(t), this.clearAll();
|
|
2566
2402
|
}
|
|
2567
2403
|
async computeAllFactionRanks() {
|
|
2568
|
-
const t = (await
|
|
2404
|
+
const t = (await w.aggregate([
|
|
2569
2405
|
{
|
|
2570
2406
|
$lookup: {
|
|
2571
2407
|
from: "usermetas",
|
|
@@ -2590,7 +2426,7 @@ class Zn extends f {
|
|
|
2590
2426
|
upsert: !0
|
|
2591
2427
|
}
|
|
2592
2428
|
}));
|
|
2593
|
-
t.length > 0 && await
|
|
2429
|
+
t.length > 0 && await O.bulkWrite(t), this.clearAll();
|
|
2594
2430
|
}
|
|
2595
2431
|
async computeAllRanks() {
|
|
2596
2432
|
await Promise.all([
|
|
@@ -2600,18 +2436,18 @@ class Zn extends f {
|
|
|
2600
2436
|
]);
|
|
2601
2437
|
}
|
|
2602
2438
|
}
|
|
2603
|
-
const
|
|
2439
|
+
const Xn = async (n) => await O.create({
|
|
2604
2440
|
user: n
|
|
2605
2441
|
});
|
|
2606
|
-
async function
|
|
2607
|
-
const e = await
|
|
2608
|
-
return e ||
|
|
2442
|
+
async function Jn(n) {
|
|
2443
|
+
const e = await O.findOne({ user: n }).lean();
|
|
2444
|
+
return e || p(await Xn(n));
|
|
2609
2445
|
}
|
|
2610
|
-
const
|
|
2446
|
+
const Zn = (n, e) => O.findOneAndUpdate({ user: n }, e, {
|
|
2611
2447
|
returnDocument: "after",
|
|
2612
2448
|
upsert: !0
|
|
2613
2449
|
}).lean();
|
|
2614
|
-
class
|
|
2450
|
+
class ea extends Vn {
|
|
2615
2451
|
constructor() {
|
|
2616
2452
|
super(300);
|
|
2617
2453
|
}
|
|
@@ -2622,86 +2458,14 @@ class aa extends Zn {
|
|
|
2622
2458
|
return e.user;
|
|
2623
2459
|
}
|
|
2624
2460
|
fetchFromDb(e) {
|
|
2625
|
-
return
|
|
2461
|
+
return Jn(e);
|
|
2626
2462
|
}
|
|
2627
2463
|
updateInDb(e, t) {
|
|
2628
|
-
return
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
const jr = new aa();
|
|
2632
|
-
class ra extends f {
|
|
2633
|
-
async isBuyLimitReached(e, t, a) {
|
|
2634
|
-
const r = await l.getAllEntitiesLimit();
|
|
2635
|
-
if (await l.isEntityId(t, l.isEquipment))
|
|
2636
|
-
return !1;
|
|
2637
|
-
const s = await this.get(e), i = s.limit?.[t];
|
|
2638
|
-
let c = r[t];
|
|
2639
|
-
const u = await m.hasRevolutionaryBuff(e);
|
|
2640
|
-
return s.lastShopId !== a ? !1 : (u === "half" && t === "chest_2" && (c += 2), u === "full" && t === "chest_3" && (c += 1), !!(c && i && i >= c));
|
|
2641
|
-
}
|
|
2642
|
-
async getShopItemRest(e, t, a, r = Ze) {
|
|
2643
|
-
const s = await l.getAllEntitiesLimit();
|
|
2644
|
-
if (await l.isEntityId(t, l.isEquipment))
|
|
2645
|
-
return r;
|
|
2646
|
-
let i = s[t];
|
|
2647
|
-
const c = await this.get(e), u = c.limit?.[t], h = await m.hasRevolutionaryBuff(e);
|
|
2648
|
-
return h === "half" && t === "chest_2" && (i += 2), h === "full" && t === "chest_3" && (i += 1), i ? c.lastShopId !== a ? i : u ? i - u : Math.min(i, r) : r;
|
|
2649
|
-
}
|
|
2650
|
-
async increaseBuyLimit(e, t, a, r) {
|
|
2651
|
-
await this.update(e, [
|
|
2652
|
-
{
|
|
2653
|
-
$set: {
|
|
2654
|
-
limit: {
|
|
2655
|
-
$cond: {
|
|
2656
|
-
if: { $eq: ["$lastShopId", t] },
|
|
2657
|
-
then: {
|
|
2658
|
-
$setField: {
|
|
2659
|
-
field: a,
|
|
2660
|
-
input: { $ifNull: ["$limit", {}] },
|
|
2661
|
-
value: {
|
|
2662
|
-
$add: [{ $ifNull: [`$limit.${a}`, 0] }, r]
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
|
-
},
|
|
2666
|
-
else: {
|
|
2667
|
-
[a]: r
|
|
2668
|
-
}
|
|
2669
|
-
}
|
|
2670
|
-
},
|
|
2671
|
-
lastShopId: t
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
]);
|
|
2464
|
+
return Zn(e, t);
|
|
2675
2465
|
}
|
|
2676
2466
|
}
|
|
2677
|
-
const
|
|
2678
|
-
|
|
2679
|
-
}), ia = async (n) => {
|
|
2680
|
-
const e = await J.findOne({ user: n }).lean();
|
|
2681
|
-
return e || y(await sa(n));
|
|
2682
|
-
}, ua = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
2683
|
-
upsert: !0,
|
|
2684
|
-
returnDocument: "after"
|
|
2685
|
-
}).lean();
|
|
2686
|
-
class oa extends ra {
|
|
2687
|
-
constructor() {
|
|
2688
|
-
super(300);
|
|
2689
|
-
}
|
|
2690
|
-
normalizeKey(e) {
|
|
2691
|
-
return e.toString();
|
|
2692
|
-
}
|
|
2693
|
-
getKey({ user: e }) {
|
|
2694
|
-
return e;
|
|
2695
|
-
}
|
|
2696
|
-
fetchFromDb(e) {
|
|
2697
|
-
return ia(e);
|
|
2698
|
-
}
|
|
2699
|
-
updateInDb(e, t) {
|
|
2700
|
-
return ua(e, t);
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
const Hr = new oa();
|
|
2704
|
-
class ca extends f {
|
|
2467
|
+
const gr = new ea();
|
|
2468
|
+
class ta extends y {
|
|
2705
2469
|
async didSevenDoubleAtDoQ(e) {
|
|
2706
2470
|
await this.update(e, {
|
|
2707
2471
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -2725,10 +2489,10 @@ class ca extends f {
|
|
|
2725
2489
|
await this.update(e, { $inc: { drawCount: 1 } });
|
|
2726
2490
|
}
|
|
2727
2491
|
async bet666(e) {
|
|
2728
|
-
const t =
|
|
2492
|
+
const t = j();
|
|
2729
2493
|
t.setHours(0, 0, 0, 0);
|
|
2730
2494
|
const a = /* @__PURE__ */ new Date();
|
|
2731
|
-
a.setHours(0, 0, 0, 0), await
|
|
2495
|
+
a.setHours(0, 0, 0, 0), await M.updateOne(
|
|
2732
2496
|
{
|
|
2733
2497
|
user: e,
|
|
2734
2498
|
"bet666.last": {
|
|
@@ -2737,7 +2501,7 @@ class ca extends f {
|
|
|
2737
2501
|
}
|
|
2738
2502
|
},
|
|
2739
2503
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
2740
|
-
), await
|
|
2504
|
+
), await M.updateOne(
|
|
2741
2505
|
{
|
|
2742
2506
|
user: e,
|
|
2743
2507
|
"bet666.last": {
|
|
@@ -2780,18 +2544,18 @@ class ca extends f {
|
|
|
2780
2544
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
2781
2545
|
}
|
|
2782
2546
|
}
|
|
2783
|
-
const
|
|
2547
|
+
const na = async (n) => await M.create({
|
|
2784
2548
|
user: n
|
|
2785
2549
|
});
|
|
2786
|
-
async function
|
|
2787
|
-
const e = await
|
|
2788
|
-
return e ||
|
|
2550
|
+
async function aa(n) {
|
|
2551
|
+
const e = await M.findOne({ user: n }).lean();
|
|
2552
|
+
return e || p(await na(n));
|
|
2789
2553
|
}
|
|
2790
|
-
const
|
|
2554
|
+
const ra = (n, e) => M.findOneAndUpdate({ user: n }, e, {
|
|
2791
2555
|
upsert: !0,
|
|
2792
2556
|
returnDocument: "after"
|
|
2793
2557
|
}).lean();
|
|
2794
|
-
class
|
|
2558
|
+
class sa extends ta {
|
|
2795
2559
|
constructor() {
|
|
2796
2560
|
super(300);
|
|
2797
2561
|
}
|
|
@@ -2802,14 +2566,14 @@ class ya extends ca {
|
|
|
2802
2566
|
return e;
|
|
2803
2567
|
}
|
|
2804
2568
|
fetchFromDb(e) {
|
|
2805
|
-
return
|
|
2569
|
+
return aa(e);
|
|
2806
2570
|
}
|
|
2807
2571
|
updateInDb(e, t) {
|
|
2808
|
-
return
|
|
2572
|
+
return ra(e, t);
|
|
2809
2573
|
}
|
|
2810
2574
|
}
|
|
2811
|
-
const
|
|
2812
|
-
class
|
|
2575
|
+
const wr = new sa();
|
|
2576
|
+
class ia extends y {
|
|
2813
2577
|
async workIncrement(e) {
|
|
2814
2578
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
2815
2579
|
}
|
|
@@ -2821,18 +2585,18 @@ class fa extends f {
|
|
|
2821
2585
|
});
|
|
2822
2586
|
}
|
|
2823
2587
|
}
|
|
2824
|
-
const
|
|
2588
|
+
const ua = (n) => V.create({
|
|
2825
2589
|
user: n
|
|
2826
2590
|
});
|
|
2827
|
-
async function
|
|
2828
|
-
const e = await
|
|
2829
|
-
return e ||
|
|
2591
|
+
async function oa(n) {
|
|
2592
|
+
const e = await V.findOne({ user: n }).lean();
|
|
2593
|
+
return e || p(await ua(n));
|
|
2830
2594
|
}
|
|
2831
|
-
const
|
|
2595
|
+
const ca = (n, e) => V.findOneAndUpdate({ user: n }, e, {
|
|
2832
2596
|
upsert: !0,
|
|
2833
2597
|
returnDocument: "after"
|
|
2834
2598
|
}).lean();
|
|
2835
|
-
class
|
|
2599
|
+
class da extends ia {
|
|
2836
2600
|
constructor() {
|
|
2837
2601
|
super(300);
|
|
2838
2602
|
}
|
|
@@ -2843,14 +2607,14 @@ class wa extends fa {
|
|
|
2843
2607
|
return e;
|
|
2844
2608
|
}
|
|
2845
2609
|
fetchFromDb(e) {
|
|
2846
|
-
return
|
|
2610
|
+
return oa(e);
|
|
2847
2611
|
}
|
|
2848
2612
|
updateInDb(e, t) {
|
|
2849
|
-
return
|
|
2613
|
+
return ca(e, t);
|
|
2850
2614
|
}
|
|
2851
2615
|
}
|
|
2852
|
-
const
|
|
2853
|
-
class
|
|
2616
|
+
const Sr = new da();
|
|
2617
|
+
class la extends y {
|
|
2854
2618
|
async hasReportedSomeone(e) {
|
|
2855
2619
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
2856
2620
|
}
|
|
@@ -2881,18 +2645,18 @@ class ba extends f {
|
|
|
2881
2645
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
2882
2646
|
}
|
|
2883
2647
|
}
|
|
2884
|
-
const
|
|
2648
|
+
const pa = async (n) => await J.create({
|
|
2885
2649
|
user: n
|
|
2886
2650
|
});
|
|
2887
|
-
async function
|
|
2888
|
-
const e = await
|
|
2889
|
-
return e ||
|
|
2651
|
+
async function ya(n) {
|
|
2652
|
+
const e = await J.findOne({ user: n }).lean();
|
|
2653
|
+
return e || p(await pa(n));
|
|
2890
2654
|
}
|
|
2891
|
-
const
|
|
2655
|
+
const fa = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
2892
2656
|
upsert: !0,
|
|
2893
2657
|
returnDocument: "after"
|
|
2894
2658
|
}).lean();
|
|
2895
|
-
class
|
|
2659
|
+
class ma extends la {
|
|
2896
2660
|
constructor() {
|
|
2897
2661
|
super(300);
|
|
2898
2662
|
}
|
|
@@ -2903,17 +2667,17 @@ class Ua extends ba {
|
|
|
2903
2667
|
return e;
|
|
2904
2668
|
}
|
|
2905
2669
|
fetchFromDb(e) {
|
|
2906
|
-
return
|
|
2670
|
+
return ya(e);
|
|
2907
2671
|
}
|
|
2908
2672
|
updateInDb(e, t) {
|
|
2909
|
-
return
|
|
2673
|
+
return fa(e, t);
|
|
2910
2674
|
}
|
|
2911
2675
|
}
|
|
2912
|
-
const
|
|
2913
|
-
class
|
|
2676
|
+
const br = new ma();
|
|
2677
|
+
class ha extends y {
|
|
2914
2678
|
async readEdito(e) {
|
|
2915
2679
|
const t = /* @__PURE__ */ new Date();
|
|
2916
|
-
t.setHours(0, 0, 0, 0), await
|
|
2680
|
+
t.setHours(0, 0, 0, 0), await D.updateOne(
|
|
2917
2681
|
{
|
|
2918
2682
|
user: e,
|
|
2919
2683
|
"edito.lastTimeRead": {
|
|
@@ -2924,7 +2688,7 @@ class Da extends f {
|
|
|
2924
2688
|
$inc: { "edito.readToday": 1 },
|
|
2925
2689
|
$set: { "edito.lastTimeRead": /* @__PURE__ */ new Date() }
|
|
2926
2690
|
}
|
|
2927
|
-
), await
|
|
2691
|
+
), await D.updateOne(
|
|
2928
2692
|
{
|
|
2929
2693
|
user: e,
|
|
2930
2694
|
"edito.lastTimeRead": {
|
|
@@ -2938,7 +2702,7 @@ class Da extends f {
|
|
|
2938
2702
|
}
|
|
2939
2703
|
async getTotalEditoReadToday() {
|
|
2940
2704
|
const e = /* @__PURE__ */ new Date();
|
|
2941
|
-
return e.setHours(0, 0, 0, 0), (await
|
|
2705
|
+
return e.setHours(0, 0, 0, 0), (await D.aggregate([
|
|
2942
2706
|
{
|
|
2943
2707
|
$match: {
|
|
2944
2708
|
"edito.lastTimeRead": { $gte: e },
|
|
@@ -2949,18 +2713,18 @@ class Da extends f {
|
|
|
2949
2713
|
]))[0]?.total ?? 0;
|
|
2950
2714
|
}
|
|
2951
2715
|
}
|
|
2952
|
-
const
|
|
2716
|
+
const ga = async (n) => await D.create({
|
|
2953
2717
|
user: n
|
|
2954
2718
|
});
|
|
2955
|
-
async function
|
|
2956
|
-
const e = await
|
|
2957
|
-
return e ||
|
|
2719
|
+
async function wa(n) {
|
|
2720
|
+
const e = await D.findOne({ user: n }).lean();
|
|
2721
|
+
return e || p(await ga(n));
|
|
2958
2722
|
}
|
|
2959
|
-
const
|
|
2723
|
+
const Sa = (n, e) => D.findOneAndUpdate({ user: n }, e, {
|
|
2960
2724
|
upsert: !0,
|
|
2961
2725
|
returnDocument: "after"
|
|
2962
2726
|
}).lean();
|
|
2963
|
-
class
|
|
2727
|
+
class ba extends ha {
|
|
2964
2728
|
constructor() {
|
|
2965
2729
|
super(300);
|
|
2966
2730
|
}
|
|
@@ -2971,20 +2735,18 @@ class Ba extends Da {
|
|
|
2971
2735
|
return e;
|
|
2972
2736
|
}
|
|
2973
2737
|
fetchFromDb(e) {
|
|
2974
|
-
return
|
|
2738
|
+
return wa(e);
|
|
2975
2739
|
}
|
|
2976
2740
|
updateInDb(e, t) {
|
|
2977
|
-
return
|
|
2741
|
+
return Sa(e, t);
|
|
2978
2742
|
}
|
|
2979
2743
|
}
|
|
2980
|
-
const
|
|
2981
|
-
class
|
|
2744
|
+
const $r = new ba();
|
|
2745
|
+
class $a extends y {
|
|
2982
2746
|
async updateCraftStats(e, t, a) {
|
|
2983
|
-
const r = await
|
|
2984
|
-
!r || !
|
|
2747
|
+
const r = await f.get(a);
|
|
2748
|
+
!r || !f.isItem(r) || await this.update(e, {
|
|
2985
2749
|
$inc: {
|
|
2986
|
-
"crafts.cookedMeal": l.isCookedMeal(r) ? t : 0,
|
|
2987
|
-
"crafts.scrolls": l.isScrollItem(r) ? t : 0,
|
|
2988
2750
|
"crafts.totalCrafted": t
|
|
2989
2751
|
}
|
|
2990
2752
|
});
|
|
@@ -3001,7 +2763,7 @@ class Ma extends f {
|
|
|
3001
2763
|
}
|
|
3002
2764
|
async incrementBottleUsedToday(e, t) {
|
|
3003
2765
|
const a = /* @__PURE__ */ new Date();
|
|
3004
|
-
a.setHours(0, 0, 0, 0), await
|
|
2766
|
+
a.setHours(0, 0, 0, 0), await k.updateOne(
|
|
3005
2767
|
{
|
|
3006
2768
|
user: e,
|
|
3007
2769
|
"bottle.lastUsed": {
|
|
@@ -3012,7 +2774,7 @@ class Ma extends f {
|
|
|
3012
2774
|
$inc: { "bottle.usedToday": t },
|
|
3013
2775
|
$set: { "bottle.lastUsed": /* @__PURE__ */ new Date() }
|
|
3014
2776
|
}
|
|
3015
|
-
), await
|
|
2777
|
+
), await k.updateOne(
|
|
3016
2778
|
{
|
|
3017
2779
|
user: e,
|
|
3018
2780
|
"bottle.lastUsed": {
|
|
@@ -3038,18 +2800,18 @@ class Ma extends f {
|
|
|
3038
2800
|
});
|
|
3039
2801
|
}
|
|
3040
2802
|
}
|
|
3041
|
-
const
|
|
2803
|
+
const Ua = async (n) => await k.create({
|
|
3042
2804
|
user: n
|
|
3043
2805
|
});
|
|
3044
|
-
async function
|
|
3045
|
-
const e = await
|
|
3046
|
-
return e ||
|
|
2806
|
+
async function Ea(n) {
|
|
2807
|
+
const e = await k.findOne({ user: n }).lean();
|
|
2808
|
+
return e || p(await Ua(n));
|
|
3047
2809
|
}
|
|
3048
|
-
const
|
|
2810
|
+
const Da = (n, e) => k.findOneAndUpdate({ user: n }, e, {
|
|
3049
2811
|
upsert: !0,
|
|
3050
2812
|
returnDocument: "after"
|
|
3051
2813
|
}).lean();
|
|
3052
|
-
class
|
|
2814
|
+
class Ia extends $a {
|
|
3053
2815
|
constructor() {
|
|
3054
2816
|
super(300);
|
|
3055
2817
|
}
|
|
@@ -3060,16 +2822,16 @@ class Ra extends Ma {
|
|
|
3060
2822
|
return e;
|
|
3061
2823
|
}
|
|
3062
2824
|
fetchFromDb(e) {
|
|
3063
|
-
return
|
|
2825
|
+
return Ea(e);
|
|
3064
2826
|
}
|
|
3065
2827
|
updateInDb(e, t) {
|
|
3066
|
-
return
|
|
2828
|
+
return Da(e, t);
|
|
3067
2829
|
}
|
|
3068
2830
|
}
|
|
3069
|
-
const
|
|
3070
|
-
class
|
|
2831
|
+
const Ur = new Ia();
|
|
2832
|
+
class Ta extends m {
|
|
3071
2833
|
async maxCraftQuantity(e, t) {
|
|
3072
|
-
const a = await
|
|
2834
|
+
const a = await U.get(e);
|
|
3073
2835
|
let r = 1 / 0;
|
|
3074
2836
|
for (const s of t)
|
|
3075
2837
|
r = Math.min(
|
|
@@ -3081,7 +2843,7 @@ class xa extends w {
|
|
|
3081
2843
|
return r;
|
|
3082
2844
|
}
|
|
3083
2845
|
async hasEnoughItemsForRecipe(e, t, a) {
|
|
3084
|
-
const r = await
|
|
2846
|
+
const r = await U.get(e);
|
|
3085
2847
|
for (const s of t.entities)
|
|
3086
2848
|
if ((r.itemList[s.entityId] ?? 0) < s.size * a)
|
|
3087
2849
|
return !1;
|
|
@@ -3100,57 +2862,57 @@ class xa extends w {
|
|
|
3100
2862
|
return !!(await this.getAll()).find((a) => a.craftId === e);
|
|
3101
2863
|
}
|
|
3102
2864
|
async getRecipeResult(e, t) {
|
|
3103
|
-
const a = await
|
|
2865
|
+
const a = await U.get(e), r = (await A.getPanoplyBonus(a.equippedItems)).find(
|
|
3104
2866
|
([s, i]) => s.panoplyId === "little_blacksmith" && i !== null
|
|
3105
2867
|
);
|
|
3106
2868
|
return r?.[1] === "full" && t === "chest_3" ? "chest_blacksmith_3" : r?.[1] === "half" && t === "chest_2" ? "chest_blacksmith_2" : r?.[1] === "half" && t === "chest_1" ? "chest_blacksmith_1" : t;
|
|
3107
2869
|
}
|
|
3108
2870
|
}
|
|
3109
|
-
const
|
|
2871
|
+
const Oa = new u(
|
|
3110
2872
|
{
|
|
3111
2873
|
entityId: { type: String, required: !0 },
|
|
3112
2874
|
size: { type: Number, required: !0 }
|
|
3113
2875
|
},
|
|
3114
2876
|
{ _id: !1 }
|
|
3115
|
-
),
|
|
2877
|
+
), va = new u(
|
|
3116
2878
|
{
|
|
3117
2879
|
entityId: { type: String, required: !0 },
|
|
3118
2880
|
size: { type: Number, required: !0 }
|
|
3119
2881
|
},
|
|
3120
2882
|
{ _id: !1 }
|
|
3121
|
-
),
|
|
2883
|
+
), Ma = new u(
|
|
3122
2884
|
{
|
|
3123
2885
|
craftId: { type: String, unique: !0, required: !0 },
|
|
3124
2886
|
name: { type: String, required: !0 },
|
|
3125
|
-
entities: { type: [
|
|
3126
|
-
result: { type:
|
|
2887
|
+
entities: { type: [Oa], required: !0 },
|
|
2888
|
+
result: { type: va, required: !0 }
|
|
3127
2889
|
},
|
|
3128
2890
|
{ minimize: !1 }
|
|
3129
|
-
),
|
|
2891
|
+
), Z = c?.Recipes || d("Recipes", Ma), ka = async (n) => await Z.create({
|
|
3130
2892
|
...n
|
|
3131
|
-
}),
|
|
3132
|
-
async function
|
|
3133
|
-
const e = await
|
|
2893
|
+
}), Aa = async (n, e) => Z.find(n, {}, e).lean();
|
|
2894
|
+
async function Ra(n) {
|
|
2895
|
+
const e = await Z.findOne({ craftId: n }).lean();
|
|
3134
2896
|
return e || null;
|
|
3135
2897
|
}
|
|
3136
|
-
const
|
|
2898
|
+
const qa = (n, e) => Z.findOneAndUpdate(n, e, {
|
|
3137
2899
|
returnDocument: "after"
|
|
3138
2900
|
}).lean();
|
|
3139
|
-
class
|
|
2901
|
+
class xa extends Ta {
|
|
3140
2902
|
constructor() {
|
|
3141
2903
|
super(3600);
|
|
3142
2904
|
}
|
|
3143
2905
|
createInDb(e) {
|
|
3144
|
-
return
|
|
2906
|
+
return ka(e);
|
|
3145
2907
|
}
|
|
3146
2908
|
updateInDb(e, t) {
|
|
3147
|
-
return
|
|
2909
|
+
return qa(e, t);
|
|
3148
2910
|
}
|
|
3149
2911
|
fetchFromDb(e) {
|
|
3150
|
-
return
|
|
2912
|
+
return Ra(e);
|
|
3151
2913
|
}
|
|
3152
2914
|
fetchManyFromDb(e, t) {
|
|
3153
|
-
return
|
|
2915
|
+
return Aa(e, t);
|
|
3154
2916
|
}
|
|
3155
2917
|
normalizeKey(e) {
|
|
3156
2918
|
return e;
|
|
@@ -3159,14 +2921,14 @@ class Ka extends xa {
|
|
|
3159
2921
|
return e.craftId;
|
|
3160
2922
|
}
|
|
3161
2923
|
}
|
|
3162
|
-
const
|
|
2924
|
+
const Er = new xa(), Ba = new u({
|
|
3163
2925
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3164
2926
|
authorId: { type: String, required: !0 },
|
|
3165
2927
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
3166
2928
|
reason: { type: String, required: !0 },
|
|
3167
2929
|
guildId: { type: String, required: !0 }
|
|
3168
|
-
}),
|
|
3169
|
-
class
|
|
2930
|
+
}), ee = c?.Bans || d("Bans", Ba), Ca = (n, e) => ee.deleteOne({ bannedUserId: n, guildId: e });
|
|
2931
|
+
class _a extends m {
|
|
3170
2932
|
async getUnbanUsers() {
|
|
3171
2933
|
return this.getMany({
|
|
3172
2934
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
@@ -3180,14 +2942,14 @@ class Qa extends w {
|
|
|
3180
2942
|
return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
3181
2943
|
}
|
|
3182
2944
|
async deleteBan(e, t) {
|
|
3183
|
-
await
|
|
2945
|
+
await Ca(e, t), this.invalidate({ bannedUserId: e, guildId: t });
|
|
3184
2946
|
}
|
|
3185
2947
|
}
|
|
3186
|
-
const
|
|
2948
|
+
const Fa = (n) => ee.find(n).lean(), Na = (n) => ee.findOne(n).lean(), Ha = (n, e) => ee.findOneAndUpdate(n, e, {
|
|
3187
2949
|
returnDocument: "after",
|
|
3188
2950
|
upsert: !0
|
|
3189
2951
|
}).lean();
|
|
3190
|
-
class
|
|
2952
|
+
class Ka extends _a {
|
|
3191
2953
|
constructor() {
|
|
3192
2954
|
super(3600 * 36);
|
|
3193
2955
|
}
|
|
@@ -3198,23 +2960,23 @@ class Va extends Qa {
|
|
|
3198
2960
|
return { bannedUserId: e, guildId: t };
|
|
3199
2961
|
}
|
|
3200
2962
|
fetchFromDb(e) {
|
|
3201
|
-
return
|
|
2963
|
+
return Na(e);
|
|
3202
2964
|
}
|
|
3203
2965
|
fetchManyFromDb(e) {
|
|
3204
|
-
return
|
|
2966
|
+
return Fa(e);
|
|
3205
2967
|
}
|
|
3206
2968
|
updateInDb(e, t) {
|
|
3207
|
-
return
|
|
2969
|
+
return Ha(e, t);
|
|
3208
2970
|
}
|
|
3209
2971
|
}
|
|
3210
|
-
const
|
|
2972
|
+
const Dr = new Ka(), ja = new u({
|
|
3211
2973
|
senderId: {
|
|
3212
|
-
type:
|
|
2974
|
+
type: u.Types.ObjectId,
|
|
3213
2975
|
required: !0,
|
|
3214
2976
|
ref: "User"
|
|
3215
2977
|
},
|
|
3216
2978
|
receiverId: {
|
|
3217
|
-
type:
|
|
2979
|
+
type: u.Types.ObjectId,
|
|
3218
2980
|
required: !0,
|
|
3219
2981
|
index: !0,
|
|
3220
2982
|
ref: "User"
|
|
@@ -3224,36 +2986,36 @@ const Gr = new Va(), Xa = new o({
|
|
|
3224
2986
|
meta: {
|
|
3225
2987
|
rps: { type: String, default: void 0 }
|
|
3226
2988
|
}
|
|
3227
|
-
}),
|
|
2989
|
+
}), te = c?.Invitation || d("Invitation", ja), Pa = (n) => te.create({
|
|
3228
2990
|
...n
|
|
3229
|
-
}),
|
|
3230
|
-
await
|
|
2991
|
+
}), za = async (n) => {
|
|
2992
|
+
await te.deleteMany({
|
|
3231
2993
|
...n
|
|
3232
2994
|
});
|
|
3233
2995
|
};
|
|
3234
|
-
class
|
|
2996
|
+
class La extends y {
|
|
3235
2997
|
async sendInvitation({
|
|
3236
2998
|
senderId: e,
|
|
3237
2999
|
receiverId: t,
|
|
3238
3000
|
gameMode: a,
|
|
3239
3001
|
...r
|
|
3240
3002
|
}) {
|
|
3241
|
-
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? null : await
|
|
3003
|
+
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? null : await Pa({ ...r, senderId: e, gameMode: a, receiverId: t });
|
|
3242
3004
|
}
|
|
3243
3005
|
async deleteInvitation({
|
|
3244
3006
|
senderId: e,
|
|
3245
3007
|
receiverId: t,
|
|
3246
3008
|
gameMode: a
|
|
3247
3009
|
}) {
|
|
3248
|
-
await
|
|
3010
|
+
await za({ senderId: e, gameMode: a, receiverId: t }), this.invalidate({ senderId: e, gameMode: a, receiverId: t });
|
|
3249
3011
|
}
|
|
3250
3012
|
}
|
|
3251
|
-
const
|
|
3013
|
+
const Qa = (n) => te.findOne({
|
|
3252
3014
|
...n
|
|
3253
|
-
}).lean(),
|
|
3015
|
+
}).lean(), Ga = (n, e) => te.findOneAndUpdate(n, e, {
|
|
3254
3016
|
returnDocument: "after"
|
|
3255
3017
|
}).lean();
|
|
3256
|
-
class
|
|
3018
|
+
class Wa extends La {
|
|
3257
3019
|
constructor() {
|
|
3258
3020
|
super(3600);
|
|
3259
3021
|
}
|
|
@@ -3268,16 +3030,16 @@ class ar extends er {
|
|
|
3268
3030
|
return { gameMode: t, receiverId: e, senderId: a };
|
|
3269
3031
|
}
|
|
3270
3032
|
fetchFromDb(e) {
|
|
3271
|
-
return
|
|
3033
|
+
return Qa(e);
|
|
3272
3034
|
}
|
|
3273
3035
|
updateInDb(e, t) {
|
|
3274
|
-
return
|
|
3036
|
+
return Ga(e, t);
|
|
3275
3037
|
}
|
|
3276
3038
|
}
|
|
3277
|
-
const
|
|
3278
|
-
class
|
|
3039
|
+
const Ir = new Wa();
|
|
3040
|
+
class Ya extends y {
|
|
3279
3041
|
async randomizeEditoPrice(e) {
|
|
3280
|
-
const t =
|
|
3042
|
+
const t = Se(100, 1001);
|
|
3281
3043
|
return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
|
|
3282
3044
|
}
|
|
3283
3045
|
async setEditoMessageId(e, t) {
|
|
@@ -3321,7 +3083,7 @@ class rr extends f {
|
|
|
3321
3083
|
);
|
|
3322
3084
|
}
|
|
3323
3085
|
}
|
|
3324
|
-
const
|
|
3086
|
+
const Va = new u({
|
|
3325
3087
|
guildId: { type: String, required: !0, unique: !0 },
|
|
3326
3088
|
ranking: {
|
|
3327
3089
|
messageId: { type: String, default: null }
|
|
@@ -3369,16 +3131,16 @@ const sr = new o({
|
|
|
3369
3131
|
default: []
|
|
3370
3132
|
}
|
|
3371
3133
|
}
|
|
3372
|
-
}),
|
|
3134
|
+
}), ce = c?.Settings || d("Settings", Va), Xa = (n) => ce.create({
|
|
3373
3135
|
guildId: n
|
|
3374
|
-
}),
|
|
3375
|
-
const e = await
|
|
3376
|
-
return e ||
|
|
3377
|
-
},
|
|
3136
|
+
}), Ja = async (n) => {
|
|
3137
|
+
const e = await ce.findOne({ guildId: n }).lean();
|
|
3138
|
+
return e || p(await Xa(n));
|
|
3139
|
+
}, Za = (n, e) => ce.findOneAndUpdate(n, e, {
|
|
3378
3140
|
upsert: !0,
|
|
3379
3141
|
returnDocument: "after"
|
|
3380
3142
|
}).lean();
|
|
3381
|
-
class
|
|
3143
|
+
class er extends Ya {
|
|
3382
3144
|
constructor() {
|
|
3383
3145
|
super(3600 * 24 * 30);
|
|
3384
3146
|
}
|
|
@@ -3389,414 +3151,37 @@ class cr extends rr {
|
|
|
3389
3151
|
return e;
|
|
3390
3152
|
}
|
|
3391
3153
|
fetchFromDb(e) {
|
|
3392
|
-
return
|
|
3393
|
-
}
|
|
3394
|
-
updateInDb(e, t) {
|
|
3395
|
-
return or(e, t);
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
const Vr = new cr();
|
|
3399
|
-
class I {
|
|
3400
|
-
toDBShopItem() {
|
|
3401
|
-
return {
|
|
3402
|
-
price: this.price,
|
|
3403
|
-
size: this.size,
|
|
3404
|
-
id: "entityId" in this.data ? this.data.entityId : this.data.ornamentId,
|
|
3405
|
-
currency: this.currency
|
|
3406
|
-
};
|
|
3407
|
-
}
|
|
3408
|
-
async onBuy(e, t) {
|
|
3409
|
-
this.currency === "berry" ? (await U.updateUserBerry(
|
|
3410
|
-
e,
|
|
3411
|
-
-1 * this.price * t,
|
|
3412
|
-
!1
|
|
3413
|
-
), await Sa.updateTotalSpentInShop(
|
|
3414
|
-
e,
|
|
3415
|
-
this.price * t
|
|
3416
|
-
)) : await m.removeItem(
|
|
3417
|
-
e,
|
|
3418
|
-
this.currency,
|
|
3419
|
-
this.price * t
|
|
3420
|
-
);
|
|
3421
|
-
}
|
|
3422
|
-
isBackground() {
|
|
3423
|
-
return !1;
|
|
3424
|
-
}
|
|
3425
|
-
isChest() {
|
|
3426
|
-
return !1;
|
|
3427
|
-
}
|
|
3428
|
-
isTitle() {
|
|
3429
|
-
return !1;
|
|
3430
|
-
}
|
|
3431
|
-
isBoostXp() {
|
|
3432
|
-
return !1;
|
|
3433
|
-
}
|
|
3434
|
-
isRepair() {
|
|
3435
|
-
return !1;
|
|
3436
|
-
}
|
|
3437
|
-
isStore() {
|
|
3438
|
-
return !1;
|
|
3439
|
-
}
|
|
3440
|
-
isObject() {
|
|
3441
|
-
return !1;
|
|
3442
|
-
}
|
|
3443
|
-
isBottle() {
|
|
3444
|
-
return !1;
|
|
3445
|
-
}
|
|
3446
|
-
isEquipment() {
|
|
3447
|
-
return !1;
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3450
|
-
class lr extends I {
|
|
3451
|
-
price;
|
|
3452
|
-
size;
|
|
3453
|
-
currency;
|
|
3454
|
-
data;
|
|
3455
|
-
constructor({
|
|
3456
|
-
price: e,
|
|
3457
|
-
item: t,
|
|
3458
|
-
size: a,
|
|
3459
|
-
currency: r
|
|
3460
|
-
}) {
|
|
3461
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3462
|
-
}
|
|
3463
|
-
async onBuy(e, t) {
|
|
3464
|
-
await super.onBuy(e, t), await L.unlockBackground(e, this.data.ornamentId);
|
|
3465
|
-
}
|
|
3466
|
-
isBackground() {
|
|
3467
|
-
return !0;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
class dr extends I {
|
|
3471
|
-
price;
|
|
3472
|
-
size;
|
|
3473
|
-
currency;
|
|
3474
|
-
data;
|
|
3475
|
-
constructor({
|
|
3476
|
-
price: e,
|
|
3477
|
-
item: t,
|
|
3478
|
-
size: a,
|
|
3479
|
-
currency: r
|
|
3480
|
-
}) {
|
|
3481
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3482
|
-
}
|
|
3483
|
-
async onBuy(e, t) {
|
|
3484
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3485
|
-
}
|
|
3486
|
-
isBoostXp() {
|
|
3487
|
-
return !0;
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
|
-
class pr extends I {
|
|
3491
|
-
price;
|
|
3492
|
-
size;
|
|
3493
|
-
currency;
|
|
3494
|
-
data;
|
|
3495
|
-
constructor({
|
|
3496
|
-
price: e,
|
|
3497
|
-
item: t,
|
|
3498
|
-
size: a,
|
|
3499
|
-
currency: r
|
|
3500
|
-
}) {
|
|
3501
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3502
|
-
}
|
|
3503
|
-
async onBuy(e, t) {
|
|
3504
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3505
|
-
}
|
|
3506
|
-
isChest() {
|
|
3507
|
-
return !0;
|
|
3508
|
-
}
|
|
3509
|
-
}
|
|
3510
|
-
class yr extends I {
|
|
3511
|
-
price;
|
|
3512
|
-
size;
|
|
3513
|
-
currency;
|
|
3514
|
-
data;
|
|
3515
|
-
constructor({
|
|
3516
|
-
price: e,
|
|
3517
|
-
item: t,
|
|
3518
|
-
size: a,
|
|
3519
|
-
currency: r
|
|
3520
|
-
}) {
|
|
3521
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3522
|
-
}
|
|
3523
|
-
async onBuy(e, t) {
|
|
3524
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3525
|
-
}
|
|
3526
|
-
isObject() {
|
|
3527
|
-
return !0;
|
|
3528
|
-
}
|
|
3529
|
-
}
|
|
3530
|
-
class fr extends I {
|
|
3531
|
-
price;
|
|
3532
|
-
size;
|
|
3533
|
-
currency;
|
|
3534
|
-
data;
|
|
3535
|
-
constructor({
|
|
3536
|
-
price: e,
|
|
3537
|
-
item: t,
|
|
3538
|
-
size: a,
|
|
3539
|
-
currency: r
|
|
3540
|
-
}) {
|
|
3541
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3542
|
-
}
|
|
3543
|
-
async onBuy(e, t) {
|
|
3544
|
-
await super.onBuy(e, t), await m.addEquipments(
|
|
3545
|
-
e,
|
|
3546
|
-
st({ stop: t }).map(
|
|
3547
|
-
() => l.seedEquipment(
|
|
3548
|
-
{ ...this.data },
|
|
3549
|
-
Date.now() - Math.round(Math.random() * 1e3)
|
|
3550
|
-
)
|
|
3551
|
-
).map((a) => ({
|
|
3552
|
-
entityId: a.entityId,
|
|
3553
|
-
seed: a.seed
|
|
3554
|
-
}))
|
|
3555
|
-
);
|
|
3556
|
-
}
|
|
3557
|
-
isEquipment() {
|
|
3558
|
-
return !0;
|
|
3559
|
-
}
|
|
3560
|
-
}
|
|
3561
|
-
class mr extends I {
|
|
3562
|
-
price;
|
|
3563
|
-
size;
|
|
3564
|
-
currency;
|
|
3565
|
-
data;
|
|
3566
|
-
constructor({
|
|
3567
|
-
price: e,
|
|
3568
|
-
item: t,
|
|
3569
|
-
size: a,
|
|
3570
|
-
currency: r
|
|
3571
|
-
}) {
|
|
3572
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3573
|
-
}
|
|
3574
|
-
async onBuy(e, t) {
|
|
3575
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3576
|
-
}
|
|
3577
|
-
isBottle() {
|
|
3578
|
-
return !0;
|
|
3579
|
-
}
|
|
3580
|
-
}
|
|
3581
|
-
class hr extends I {
|
|
3582
|
-
price;
|
|
3583
|
-
size;
|
|
3584
|
-
currency;
|
|
3585
|
-
data;
|
|
3586
|
-
constructor({
|
|
3587
|
-
price: e,
|
|
3588
|
-
item: t,
|
|
3589
|
-
size: a,
|
|
3590
|
-
currency: r
|
|
3591
|
-
}) {
|
|
3592
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3593
|
-
}
|
|
3594
|
-
async onBuy(e, t) {
|
|
3595
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3596
|
-
}
|
|
3597
|
-
isRepair() {
|
|
3598
|
-
return !0;
|
|
3599
|
-
}
|
|
3600
|
-
}
|
|
3601
|
-
class gr extends I {
|
|
3602
|
-
price;
|
|
3603
|
-
size;
|
|
3604
|
-
currency;
|
|
3605
|
-
data;
|
|
3606
|
-
constructor({
|
|
3607
|
-
price: e,
|
|
3608
|
-
item: t,
|
|
3609
|
-
size: a,
|
|
3610
|
-
currency: r
|
|
3611
|
-
}) {
|
|
3612
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3613
|
-
}
|
|
3614
|
-
async onBuy(e, t) {
|
|
3615
|
-
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
3616
|
-
}
|
|
3617
|
-
isStore() {
|
|
3618
|
-
return !0;
|
|
3619
|
-
}
|
|
3620
|
-
}
|
|
3621
|
-
class wr extends I {
|
|
3622
|
-
price;
|
|
3623
|
-
size;
|
|
3624
|
-
currency;
|
|
3625
|
-
data;
|
|
3626
|
-
constructor({
|
|
3627
|
-
price: e,
|
|
3628
|
-
item: t,
|
|
3629
|
-
size: a,
|
|
3630
|
-
currency: r
|
|
3631
|
-
}) {
|
|
3632
|
-
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
3633
|
-
}
|
|
3634
|
-
async onBuy(e, t) {
|
|
3635
|
-
await super.onBuy(e, t), await L.unlockTitle(e, this.data.ornamentId);
|
|
3636
|
-
}
|
|
3637
|
-
isTitle() {
|
|
3638
|
-
return !0;
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
class Sr extends f {
|
|
3642
|
-
async getShopItem(e, t) {
|
|
3643
|
-
const r = (await this.get(e)).items.find((h) => h.id === t);
|
|
3644
|
-
if (!r)
|
|
3645
|
-
return;
|
|
3646
|
-
const { price: s, size: i, currency: c } = r, u = await l.get(r.id) ?? await g.get(r.id);
|
|
3647
|
-
if (g.isOrnament(u) && g.isBackground(u))
|
|
3648
|
-
return new lr({ price: s, item: u, size: i, currency: c });
|
|
3649
|
-
if (g.isOrnament(u) && g.isShopTitle(u))
|
|
3650
|
-
return new wr({ price: s, item: u, size: i, currency: c });
|
|
3651
|
-
if (l.isEntity(u) && l.isChestItem(u))
|
|
3652
|
-
return new pr({ price: s, item: u, size: i, currency: c });
|
|
3653
|
-
if (l.isEntity(u) && l.isBoostItem(u))
|
|
3654
|
-
return new dr({ price: s, item: u, size: i, currency: c });
|
|
3655
|
-
if (l.isEntity(u) && l.isRepairItem(u))
|
|
3656
|
-
return new hr({ price: s, item: u, size: i, currency: c });
|
|
3657
|
-
if (l.isEntity(u) && l.isStoreItem(u))
|
|
3658
|
-
return new gr({ price: s, item: u, size: i, currency: c });
|
|
3659
|
-
if (l.isEntity(u) && l.isObjectItem(u))
|
|
3660
|
-
return new yr({ price: s, item: u, size: i, currency: c });
|
|
3661
|
-
if (l.isEntity(u) && l.isEquipment(u))
|
|
3662
|
-
return new fr({ price: s, item: u, size: i, currency: c });
|
|
3663
|
-
if (l.isEntity(u) && l.isBottleItem(u))
|
|
3664
|
-
return new mr({ price: s, size: i, item: u, currency: c });
|
|
3665
|
-
}
|
|
3666
|
-
async getShopItemList(e) {
|
|
3667
|
-
const t = await this.get(e), a = [];
|
|
3668
|
-
for (const { id: r } of t.items) {
|
|
3669
|
-
const s = await this.getShopItem(e, r);
|
|
3670
|
-
s && a.push(s);
|
|
3671
|
-
}
|
|
3672
|
-
return a;
|
|
3673
|
-
}
|
|
3674
|
-
getShopItemId(e) {
|
|
3675
|
-
return l.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
|
|
3676
|
-
}
|
|
3677
|
-
async updateShopStats(e, t, a) {
|
|
3678
|
-
await this.update(
|
|
3679
|
-
{ shopType: e },
|
|
3680
|
-
{
|
|
3681
|
-
$inc: {
|
|
3682
|
-
"stats.berrySpent": t.price * a,
|
|
3683
|
-
"stats.itemBought": a,
|
|
3684
|
-
"stats.chestBought": t.isChest() ? a : 0,
|
|
3685
|
-
"stats.percentBought": t.data.type === "repair" ? (t.data.effects.find((r) => r.type === "CREW_REPAIR")?.params.amount ?? 0) * a : 0,
|
|
3686
|
-
"stats.boostTimeBought": t.data.type === "boost" && t.data.ms ? t.data.ms / (1440 * 60 * 1e3) : 0
|
|
3687
|
-
}
|
|
3688
|
-
}
|
|
3689
|
-
);
|
|
3690
|
-
}
|
|
3691
|
-
async buyShopItem(e, t, a, r) {
|
|
3692
|
-
const s = t.map((i) => (i.id === this.getShopItemId(a) && i.size && (i.size -= r), i));
|
|
3693
|
-
await this.update(
|
|
3694
|
-
{ shopType: e },
|
|
3695
|
-
{
|
|
3696
|
-
$set: {
|
|
3697
|
-
items: s
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
|
-
);
|
|
3701
|
-
}
|
|
3702
|
-
async publish(e) {
|
|
3703
|
-
await this.update(
|
|
3704
|
-
{ shopType: e },
|
|
3705
|
-
{
|
|
3706
|
-
$set: {
|
|
3707
|
-
publishedAt: /* @__PURE__ */ new Date()
|
|
3708
|
-
}
|
|
3709
|
-
}
|
|
3710
|
-
);
|
|
3711
|
-
}
|
|
3712
|
-
async setShopItems(e, t) {
|
|
3713
|
-
await this.update(
|
|
3714
|
-
{ shopType: e },
|
|
3715
|
-
{
|
|
3716
|
-
$set: {
|
|
3717
|
-
items: [...t]
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
);
|
|
3721
|
-
}
|
|
3722
|
-
}
|
|
3723
|
-
const br = new o(
|
|
3724
|
-
{
|
|
3725
|
-
shopType: { type: String, required: !0, unique: !0 },
|
|
3726
|
-
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
3727
|
-
duration: { type: Number, default: null },
|
|
3728
|
-
closeAt: { type: Date, default: null },
|
|
3729
|
-
items: {
|
|
3730
|
-
type: [
|
|
3731
|
-
{
|
|
3732
|
-
_id: !1,
|
|
3733
|
-
type: {
|
|
3734
|
-
price: Number,
|
|
3735
|
-
size: { type: Number, default: null },
|
|
3736
|
-
id: String,
|
|
3737
|
-
currency: String
|
|
3738
|
-
}
|
|
3739
|
-
}
|
|
3740
|
-
],
|
|
3741
|
-
default: []
|
|
3742
|
-
},
|
|
3743
|
-
stats: {
|
|
3744
|
-
berrySpent: { type: Number, default: 0 },
|
|
3745
|
-
itemBought: { type: Number, default: 0 },
|
|
3746
|
-
chestBought: { type: Number, default: 0 },
|
|
3747
|
-
boostTimeBought: { type: Number, default: 0 },
|
|
3748
|
-
percentBought: { type: Number, default: 0 }
|
|
3749
|
-
}
|
|
3750
|
-
},
|
|
3751
|
-
{ minimize: !1 }
|
|
3752
|
-
), fe = d?.Shop || p("Shop", br), $r = (n) => fe.create({
|
|
3753
|
-
shopType: n
|
|
3754
|
-
}), Ir = async (n) => {
|
|
3755
|
-
const e = await fe.findOne({ shopType: n }).lean();
|
|
3756
|
-
return e || y(await $r(n));
|
|
3757
|
-
}, Er = (n, e) => fe.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
3758
|
-
class Ur extends Sr {
|
|
3759
|
-
constructor() {
|
|
3760
|
-
super(3600);
|
|
3761
|
-
}
|
|
3762
|
-
normalizeKey(e) {
|
|
3763
|
-
return e;
|
|
3764
|
-
}
|
|
3765
|
-
getKey({ shopType: e }) {
|
|
3766
|
-
return e;
|
|
3767
|
-
}
|
|
3768
|
-
fetchFromDb(e) {
|
|
3769
|
-
return Ir(e);
|
|
3154
|
+
return Ja(e);
|
|
3770
3155
|
}
|
|
3771
3156
|
updateInDb(e, t) {
|
|
3772
|
-
return
|
|
3157
|
+
return Za(e, t);
|
|
3773
3158
|
}
|
|
3774
3159
|
}
|
|
3775
|
-
const
|
|
3160
|
+
const Tr = new er(), tr = new u({
|
|
3776
3161
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
3777
3162
|
authorId: String,
|
|
3778
3163
|
date: { type: Date, default: Date.now() },
|
|
3779
3164
|
reason: { type: String, default: null }
|
|
3780
|
-
}),
|
|
3165
|
+
}), ne = c?.Warn || d("Warn", tr), nr = (n) => ne.countDocuments(n), ar = (n) => ne.create({
|
|
3781
3166
|
...n
|
|
3782
|
-
}),
|
|
3783
|
-
class
|
|
3167
|
+
}), rr = (n) => ne.findByIdAndDelete(n).lean();
|
|
3168
|
+
class sr extends m {
|
|
3784
3169
|
getUserWarns(e) {
|
|
3785
3170
|
return this.getMany({ warnedUserId: e });
|
|
3786
3171
|
}
|
|
3787
3172
|
getUserWarnCount(e) {
|
|
3788
|
-
return
|
|
3173
|
+
return nr({ warnedUserId: e });
|
|
3789
3174
|
}
|
|
3790
3175
|
async createWarn(e) {
|
|
3791
|
-
await
|
|
3176
|
+
await ar(e);
|
|
3792
3177
|
}
|
|
3793
3178
|
async deleteWarn(e) {
|
|
3794
|
-
const t = await
|
|
3179
|
+
const t = await rr(e);
|
|
3795
3180
|
return t && this.invalidate(this.getKey(t)), t;
|
|
3796
3181
|
}
|
|
3797
3182
|
}
|
|
3798
|
-
const
|
|
3799
|
-
class
|
|
3183
|
+
const ir = (n) => ne.find(n).lean();
|
|
3184
|
+
class ur extends sr {
|
|
3800
3185
|
constructor() {
|
|
3801
3186
|
super(300);
|
|
3802
3187
|
}
|
|
@@ -3810,59 +3195,48 @@ class kr extends Br {
|
|
|
3810
3195
|
throw new Error("Method not implemented.");
|
|
3811
3196
|
}
|
|
3812
3197
|
fetchManyFromDb(e) {
|
|
3813
|
-
return
|
|
3198
|
+
return ir(e);
|
|
3814
3199
|
}
|
|
3815
3200
|
updateInDb() {
|
|
3816
3201
|
throw new Error("Method not implemented.");
|
|
3817
3202
|
}
|
|
3818
3203
|
}
|
|
3819
|
-
const
|
|
3820
|
-
|
|
3204
|
+
const Or = new ur(), vr = (n) => {
|
|
3205
|
+
Fe(n);
|
|
3821
3206
|
};
|
|
3822
|
-
class
|
|
3207
|
+
class Mr extends Ne.ObjectId {
|
|
3823
3208
|
}
|
|
3824
3209
|
export {
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
b as
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
jr as userRankService,
|
|
3858
|
-
bt as userService,
|
|
3859
|
-
_e as userSettingsService,
|
|
3860
|
-
Hr as userShopService,
|
|
3861
|
-
Kr as userStatsCasinoService,
|
|
3862
|
-
Sa as userStatsEconomyService,
|
|
3863
|
-
Se as userStatsEngagementService,
|
|
3864
|
-
Pr as userStatsFlagsService,
|
|
3865
|
-
Lr as userStatsFrequencyService,
|
|
3866
|
-
Qr as userStatsInventoryService,
|
|
3867
|
-
Jr as warnService
|
|
3210
|
+
yr as COOLDOWN_COMMANDS,
|
|
3211
|
+
Mr as ObjectId,
|
|
3212
|
+
g as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
3213
|
+
Dr as banService,
|
|
3214
|
+
vr as connectToServices,
|
|
3215
|
+
h as emitQuestMiddlewareEvent,
|
|
3216
|
+
f as entityService,
|
|
3217
|
+
Ir as invitationService,
|
|
3218
|
+
b as ornamentService,
|
|
3219
|
+
A as panoplyService,
|
|
3220
|
+
Er as recipeService,
|
|
3221
|
+
pr as registerQuestMiddlewareEvents,
|
|
3222
|
+
Ut as reminderService,
|
|
3223
|
+
Tr as settingsService,
|
|
3224
|
+
fr as userCooldownService,
|
|
3225
|
+
mr as userDailyReportService,
|
|
3226
|
+
se as userEncyclopediaService,
|
|
3227
|
+
hr as userGamesService,
|
|
3228
|
+
U as userInventoryService,
|
|
3229
|
+
E as userMetaService,
|
|
3230
|
+
ye as userOrnamentService,
|
|
3231
|
+
fe as userQuestService,
|
|
3232
|
+
gr as userRankService,
|
|
3233
|
+
yt as userService,
|
|
3234
|
+
Re as userSettingsService,
|
|
3235
|
+
wr as userStatsCasinoService,
|
|
3236
|
+
Sr as userStatsEconomyService,
|
|
3237
|
+
me as userStatsEngagementService,
|
|
3238
|
+
br as userStatsFlagsService,
|
|
3239
|
+
$r as userStatsFrequencyService,
|
|
3240
|
+
Ur as userStatsInventoryService,
|
|
3241
|
+
Or as warnService
|
|
3868
3242
|
};
|