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