@opfr/services 1.4.0 → 1.5.1
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 +1170 -2015
- package/dist/index.umd.js +1 -1
- package/dist/services/AbstractCachedService.d.ts +10 -3
- package/dist/services/AbstractCachedService.d.ts.map +1 -1
- package/dist/services/entities/helper.d.ts +0 -1
- package/dist/services/entities/helper.d.ts.map +1 -1
- package/dist/services/entities/process/findMany.d.ts +2 -2
- package/dist/services/entities/process/findMany.d.ts.map +1 -1
- package/dist/services/entities/service.d.ts +2 -2
- package/dist/services/entities/service.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/ornaments/process/findMany.d.ts +2 -2
- package/dist/services/ornaments/process/findMany.d.ts.map +1 -1
- package/dist/services/ornaments/service.d.ts +2 -2
- package/dist/services/ornaments/service.d.ts.map +1 -1
- package/dist/services/panoplies/process/findMany.d.ts +3 -3
- package/dist/services/panoplies/process/findMany.d.ts.map +1 -1
- package/dist/services/panoplies/service.d.ts +2 -2
- package/dist/services/panoplies/service.d.ts.map +1 -1
- package/dist/services/recipe/process/findMany.d.ts +2 -2
- package/dist/services/recipe/process/findMany.d.ts.map +1 -1
- package/dist/services/recipe/service.d.ts +2 -2
- package/dist/services/recipe/service.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/reminder/process/findMany.d.ts +2 -2
- package/dist/services/reminder/process/findMany.d.ts.map +1 -1
- package/dist/services/reminder/service.d.ts +2 -2
- package/dist/services/reminder/service.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/process/findMany.d.ts +2 -2
- package/dist/services/user/process/findMany.d.ts.map +1 -1
- package/dist/services/user/process/findOne.d.ts +2 -1
- package/dist/services/user/process/findOne.d.ts.map +1 -1
- package/dist/services/user/process/updateOne.d.ts.map +1 -1
- package/dist/services/user/service.d.ts +3 -2
- package/dist/services/user/service.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-quest/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/frequency/helper.d.ts +1 -0
- package/dist/services/user-stats/frequency/helper.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/bet/definition/model.d.ts +0 -5
- package/dist/services/bet/definition/model.d.ts.map +0 -1
- package/dist/services/bet/definition/schema.d.ts +0 -15
- package/dist/services/bet/definition/schema.d.ts.map +0 -1
- package/dist/services/bet/index.d.ts +0 -5
- package/dist/services/bet/index.d.ts.map +0 -1
- package/dist/services/bet/process/create.d.ts +0 -3
- package/dist/services/bet/process/create.d.ts.map +0 -1
- package/dist/services/bet/process/findOne.d.ts +0 -9
- package/dist/services/bet/process/findOne.d.ts.map +0 -1
- package/dist/services/bet/process/updateOne.d.ts +0 -4
- package/dist/services/bet/process/updateOne.d.ts.map +0 -1
- package/dist/services/bet/types.d.ts +0 -22
- package/dist/services/bet/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
|
-
async get(e) {
|
|
17
|
-
const
|
|
16
|
+
async get(e, t) {
|
|
17
|
+
const a = this.normalizeKey(e), r = this.cache.get(a);
|
|
18
18
|
if (r)
|
|
19
19
|
return r;
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
async update(e, t,
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const s = this.getKey(
|
|
27
|
-
this.cache.del(
|
|
20
|
+
const s = await this.fetchFromDb(e, t ?? {});
|
|
21
|
+
return s && this.cache.set(a, s), s;
|
|
22
|
+
}
|
|
23
|
+
async update(e, t, a) {
|
|
24
|
+
const r = await this.updateInDb(e, t, a);
|
|
25
|
+
if (r) {
|
|
26
|
+
const s = this.getKey(r);
|
|
27
|
+
this.cache.del(P), this.cache.set(this.normalizeKey(s), r);
|
|
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
|
-
const t = await this.fetchManyFromDb({});
|
|
44
|
-
return this.cache.set(
|
|
45
|
-
this.cache.set(this.normalizeKey(this.getKey(
|
|
43
|
+
const t = await this.fetchManyFromDb({}, {});
|
|
44
|
+
return this.cache.set(P, t), t.forEach((a) => {
|
|
45
|
+
this.cache.set(this.normalizeKey(this.getKey(a)), a);
|
|
46
46
|
}), t;
|
|
47
47
|
}
|
|
48
|
-
async getMany(e) {
|
|
49
|
-
const
|
|
50
|
-
return
|
|
48
|
+
async getMany(e, t = {}) {
|
|
49
|
+
const a = await this.fetchManyFromDb(e, t);
|
|
50
|
+
return a.forEach((r) => {
|
|
51
51
|
this.cache.set(this.normalizeKey(this.getKey(r)), r);
|
|
52
|
-
}),
|
|
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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
|
+
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 e
|
|
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
|
-
});
|
|
1338
|
-
class
|
|
752
|
+
}).lean();
|
|
753
|
+
class St extends ft {
|
|
1339
754
|
constructor() {
|
|
1340
755
|
super(3600);
|
|
1341
756
|
}
|
|
@@ -1345,20 +760,20 @@ class bn extends mn {
|
|
|
1345
760
|
getKey({ discordId: e }) {
|
|
1346
761
|
return e;
|
|
1347
762
|
}
|
|
1348
|
-
fetchFromDb(e) {
|
|
1349
|
-
return
|
|
763
|
+
fetchFromDb(e, t) {
|
|
764
|
+
return gt(e, t);
|
|
1350
765
|
}
|
|
1351
|
-
fetchManyFromDb(e) {
|
|
1352
|
-
return
|
|
766
|
+
fetchManyFromDb(e, t) {
|
|
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:
|
|
794
|
+
async addReminder(e, t, a) {
|
|
795
|
+
await this.update({ user: e, type: t }, { $set: { date: a } }, { upsert: !0 });
|
|
1381
796
|
}
|
|
1382
|
-
async updateReminderDate(e, t,
|
|
797
|
+
async updateReminderDate(e, t, a) {
|
|
1383
798
|
await this.update({ user: e, type: t }, [
|
|
1384
799
|
{
|
|
1385
800
|
$set: {
|
|
1386
801
|
date: {
|
|
1387
|
-
$add: ["$date",
|
|
802
|
+
$add: ["$date", a]
|
|
1388
803
|
}
|
|
1389
804
|
}
|
|
1390
805
|
}
|
|
1391
806
|
]);
|
|
1392
807
|
}
|
|
1393
808
|
async removeReminder(e, t) {
|
|
1394
|
-
await
|
|
1395
|
-
}
|
|
1396
|
-
async deleteSelectedReminders(e) {
|
|
1397
|
-
const t =
|
|
1398
|
-
await
|
|
1399
|
-
this.invalidate({ user:
|
|
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;
|
|
1493
|
-
}
|
|
1494
|
-
if (i.length !== 0)
|
|
1495
|
-
return i[X(0, i.length)];
|
|
1496
|
-
}
|
|
1497
|
-
throw Error("pickOrnament - All ods array were empty");
|
|
1498
|
-
}
|
|
1499
|
-
pickEachRarityOrnament(e, t) {
|
|
1500
|
-
if (t.length !== Ce.length)
|
|
1501
|
-
throw new RangeError(
|
|
1502
|
-
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
1503
|
-
);
|
|
1504
|
-
return F(
|
|
1505
|
-
t.map((r, a) => {
|
|
1506
|
-
const s = Ce[a], i = e[s];
|
|
1507
|
-
return Math.random() > r || !i || !i.length ? null : pt(i);
|
|
1508
|
-
})
|
|
1509
|
-
);
|
|
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 };
|
|
1540
837
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
838
|
+
normalizeKey({
|
|
839
|
+
user: e,
|
|
840
|
+
type: t
|
|
841
|
+
}) {
|
|
842
|
+
return `${e.toString()}/${t}`;
|
|
1543
843
|
}
|
|
1544
|
-
|
|
1545
|
-
return
|
|
844
|
+
fetchFromDb(e) {
|
|
845
|
+
return Tt(e);
|
|
1546
846
|
}
|
|
1547
|
-
|
|
1548
|
-
return e
|
|
847
|
+
fetchManyFromDb(e, t) {
|
|
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
|
-
fetchManyFromDb(e
|
|
1621
|
-
return
|
|
920
|
+
fetchManyFromDb(e, t) {
|
|
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
939
|
const t = (await this.getAll()).filter(this.isStoreItem);
|
|
1640
|
-
return
|
|
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
951
|
const t = (await this.getAll()).filter(this.isRepairItem);
|
|
1644
|
-
return
|
|
952
|
+
return ge(t).slice(0, e);
|
|
1645
953
|
}
|
|
1646
954
|
async getSomeObjectItems(e) {
|
|
1647
955
|
const t = (await this.getAll()).filter(this.isObjectItem);
|
|
1648
|
-
return
|
|
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,12 @@ class Hn extends b {
|
|
|
1675
983
|
return (await this.getAll()).filter(e);
|
|
1676
984
|
}
|
|
1677
985
|
async fromDBToEquipableEquipment(e) {
|
|
1678
|
-
const
|
|
1679
|
-
({ entityId:
|
|
986
|
+
const a = (await this.getAll()).filter(this.isEquipment).find(
|
|
987
|
+
({ entityId: r }) => r === e.entityId
|
|
1680
988
|
);
|
|
1681
|
-
if (!
|
|
989
|
+
if (!a)
|
|
1682
990
|
throw new Error(`cannot find any equipment: ${e.entityId}`);
|
|
1683
|
-
return this.seedEquipment(
|
|
991
|
+
return this.seedEquipment(a, e.seed);
|
|
1684
992
|
}
|
|
1685
993
|
async getUserEquipmentsCharacteristics(e) {
|
|
1686
994
|
let t = {
|
|
@@ -1691,37 +999,25 @@ class Hn extends b {
|
|
|
1691
999
|
intelligence: 0,
|
|
1692
1000
|
wisdom: 0
|
|
1693
1001
|
};
|
|
1694
|
-
const
|
|
1695
|
-
for (const
|
|
1696
|
-
const s = e[
|
|
1697
|
-
s && (t =
|
|
1002
|
+
const a = await E.getAllPopulated();
|
|
1003
|
+
for (const r of be) {
|
|
1004
|
+
const s = e[r];
|
|
1005
|
+
s && (t = C(
|
|
1698
1006
|
t,
|
|
1699
1007
|
(await this.fromDBToEquipableEquipment(s)).characteristics,
|
|
1700
|
-
(i,
|
|
1008
|
+
(i, c) => i + c
|
|
1701
1009
|
));
|
|
1702
1010
|
}
|
|
1703
|
-
for (const
|
|
1704
|
-
const s =
|
|
1705
|
-
s && !("target" in s) && (t =
|
|
1011
|
+
for (const r of a) {
|
|
1012
|
+
const s = E.hasPanoply(e, r);
|
|
1013
|
+
s && !("target" in s) && (t = C(
|
|
1706
1014
|
t,
|
|
1707
1015
|
s,
|
|
1708
|
-
(i,
|
|
1016
|
+
(i, c) => i + c
|
|
1709
1017
|
));
|
|
1710
1018
|
}
|
|
1711
1019
|
return t;
|
|
1712
1020
|
}
|
|
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
1021
|
filterCraftEntities(e) {
|
|
1726
1022
|
return e.filter((t) => t.usage?.craft);
|
|
1727
1023
|
}
|
|
@@ -1777,41 +1073,41 @@ class Hn extends b {
|
|
|
1777
1073
|
return e.entityId === t.entityId && e.seed === t.seed;
|
|
1778
1074
|
}
|
|
1779
1075
|
seedEquipment(e, t) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1076
|
+
const a = tt(t), r = H(
|
|
1077
|
+
x(e.characteristics),
|
|
1782
1078
|
([s]) => s
|
|
1783
1079
|
);
|
|
1784
1080
|
return {
|
|
1785
1081
|
...e,
|
|
1786
1082
|
seed: t,
|
|
1787
1083
|
characteristics: Object.fromEntries(
|
|
1788
|
-
|
|
1084
|
+
r.map(([s, i]) => [
|
|
1789
1085
|
s,
|
|
1790
|
-
Array.isArray(i) ?
|
|
1086
|
+
Array.isArray(i) ? Ee(i[0], i[1] + 1, a) : i
|
|
1791
1087
|
])
|
|
1792
1088
|
)
|
|
1793
1089
|
};
|
|
1794
1090
|
}
|
|
1795
1091
|
isEquipped(e, t) {
|
|
1796
1092
|
return !!Object.values(e).find(
|
|
1797
|
-
(
|
|
1093
|
+
(a) => a && this.isSameEquipment(a, t)
|
|
1798
1094
|
);
|
|
1799
1095
|
}
|
|
1800
1096
|
calcILvl(e) {
|
|
1801
|
-
return Object.values(e.characteristics).reduce((
|
|
1097
|
+
return Object.values(e.characteristics).reduce((a, r) => a + r, 0) + e.level;
|
|
1802
1098
|
}
|
|
1803
1099
|
}
|
|
1804
|
-
const
|
|
1100
|
+
const Ft = new o(
|
|
1805
1101
|
{
|
|
1806
1102
|
type: {
|
|
1807
1103
|
type: String,
|
|
1808
|
-
enum:
|
|
1104
|
+
enum: Qe,
|
|
1809
1105
|
required: !0
|
|
1810
1106
|
},
|
|
1811
|
-
params: { type:
|
|
1107
|
+
params: { type: o.Types.Mixed }
|
|
1812
1108
|
},
|
|
1813
1109
|
{ _id: !1 }
|
|
1814
|
-
),
|
|
1110
|
+
), zt = new o(
|
|
1815
1111
|
{
|
|
1816
1112
|
entityId: { unique: !0, required: !0, type: String },
|
|
1817
1113
|
type: { required: !0, type: String },
|
|
@@ -1833,7 +1129,7 @@ const Ln = new u(
|
|
|
1833
1129
|
image: { required: !0, type: String },
|
|
1834
1130
|
emojis: { required: !0, type: String },
|
|
1835
1131
|
category: { required: !0, type: String },
|
|
1836
|
-
effects: { type: [
|
|
1132
|
+
effects: { type: [Ft], default: [] },
|
|
1837
1133
|
rankId: String,
|
|
1838
1134
|
usage: {
|
|
1839
1135
|
_id: !1,
|
|
@@ -1863,7 +1159,7 @@ const Ln = new u(
|
|
|
1863
1159
|
_id: !1,
|
|
1864
1160
|
type: {
|
|
1865
1161
|
xp: {
|
|
1866
|
-
type:
|
|
1162
|
+
type: o.Types.Union,
|
|
1867
1163
|
of: [Number, [Number]],
|
|
1868
1164
|
required: !0
|
|
1869
1165
|
},
|
|
@@ -1894,31 +1190,31 @@ const Ln = new u(
|
|
|
1894
1190
|
panoply: String
|
|
1895
1191
|
},
|
|
1896
1192
|
{ minimize: !1 }
|
|
1897
|
-
),
|
|
1193
|
+
), ne = d?.Entities || p("Entities", zt), jt = async (n) => await ne.create({
|
|
1898
1194
|
...n
|
|
1899
|
-
}),
|
|
1900
|
-
async function
|
|
1901
|
-
const e = await
|
|
1195
|
+
}), Ht = async (n, e) => ne.find(n, {}, e).lean();
|
|
1196
|
+
async function Kt(n) {
|
|
1197
|
+
const e = await ne.findOne({ entityId: n }).lean();
|
|
1902
1198
|
return e || null;
|
|
1903
1199
|
}
|
|
1904
|
-
const
|
|
1200
|
+
const Pt = (n, e) => ne.findOneAndUpdate(n, e, {
|
|
1905
1201
|
returnDocument: "after"
|
|
1906
1202
|
}).lean();
|
|
1907
|
-
class
|
|
1203
|
+
class Lt extends Nt {
|
|
1908
1204
|
constructor() {
|
|
1909
1205
|
super(3600);
|
|
1910
1206
|
}
|
|
1911
1207
|
createInDb(e) {
|
|
1912
|
-
return
|
|
1208
|
+
return jt(e);
|
|
1913
1209
|
}
|
|
1914
1210
|
updateInDb(e, t) {
|
|
1915
|
-
return
|
|
1211
|
+
return Pt(e, t);
|
|
1916
1212
|
}
|
|
1917
1213
|
fetchFromDb(e) {
|
|
1918
|
-
return
|
|
1214
|
+
return Kt(e);
|
|
1919
1215
|
}
|
|
1920
|
-
fetchManyFromDb(e) {
|
|
1921
|
-
return
|
|
1216
|
+
fetchManyFromDb(e, t) {
|
|
1217
|
+
return Ht(e, t);
|
|
1922
1218
|
}
|
|
1923
1219
|
normalizeKey(e) {
|
|
1924
1220
|
return e;
|
|
@@ -1927,65 +1223,8 @@ class Vn extends Hn {
|
|
|
1927
1223
|
return e.entityId;
|
|
1928
1224
|
}
|
|
1929
1225
|
}
|
|
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 {
|
|
1226
|
+
const l = new Lt();
|
|
1227
|
+
class Qt extends f {
|
|
1989
1228
|
hasAlreadyFoundEntity(e, t) {
|
|
1990
1229
|
return e.encyclopedia.includes(t);
|
|
1991
1230
|
}
|
|
@@ -1995,23 +1234,23 @@ class ir extends f {
|
|
|
1995
1234
|
});
|
|
1996
1235
|
}
|
|
1997
1236
|
}
|
|
1998
|
-
const
|
|
1237
|
+
const Wt = async (n) => await G.create({
|
|
1999
1238
|
user: n
|
|
2000
1239
|
});
|
|
2001
|
-
async function
|
|
2002
|
-
const e = await
|
|
2003
|
-
return e || y(await
|
|
1240
|
+
async function Gt(n) {
|
|
1241
|
+
const e = await G.findOne({ user: n }).lean();
|
|
1242
|
+
return e || y(await Wt(n));
|
|
2004
1243
|
}
|
|
2005
|
-
const
|
|
1244
|
+
const Yt = (n, e) => G.findOneAndUpdate({ user: n }, e, {
|
|
2006
1245
|
upsert: !0,
|
|
2007
1246
|
returnDocument: "after"
|
|
2008
1247
|
}).lean();
|
|
2009
|
-
class
|
|
1248
|
+
class Vt extends Qt {
|
|
2010
1249
|
constructor() {
|
|
2011
1250
|
super(300);
|
|
2012
1251
|
}
|
|
2013
1252
|
fetchFromDb(e) {
|
|
2014
|
-
return
|
|
1253
|
+
return Gt(e);
|
|
2015
1254
|
}
|
|
2016
1255
|
getKey({ user: e }) {
|
|
2017
1256
|
return e;
|
|
@@ -2020,20 +1259,20 @@ class dr extends ir {
|
|
|
2020
1259
|
return e.toString();
|
|
2021
1260
|
}
|
|
2022
1261
|
updateInDb(e, t) {
|
|
2023
|
-
return
|
|
1262
|
+
return Yt(e, t);
|
|
2024
1263
|
}
|
|
2025
1264
|
}
|
|
2026
|
-
const
|
|
2027
|
-
class
|
|
1265
|
+
const ce = new Vt();
|
|
1266
|
+
class Xt extends f {
|
|
2028
1267
|
getPanoplyEffectiveBonus(e, t) {
|
|
2029
|
-
const
|
|
1268
|
+
const a = _(
|
|
2030
1269
|
Object.values(e.equippedItems)
|
|
2031
|
-
),
|
|
2032
|
-
(s) =>
|
|
1270
|
+
), r = t.equipments.filter(
|
|
1271
|
+
(s) => a.find((i) => i.entityId === s.entityId)
|
|
2033
1272
|
).length;
|
|
2034
|
-
if (
|
|
1273
|
+
if (r === t.equipments.length)
|
|
2035
1274
|
return t.fullBonus;
|
|
2036
|
-
if (
|
|
1275
|
+
if (r >= t.equipments.length / 2)
|
|
2037
1276
|
return t.halfBonus;
|
|
2038
1277
|
}
|
|
2039
1278
|
async getUserEquipmentsCharacteristics(e) {
|
|
@@ -2045,46 +1284,46 @@ class lr extends f {
|
|
|
2045
1284
|
intelligence: 0,
|
|
2046
1285
|
wisdom: 0
|
|
2047
1286
|
};
|
|
2048
|
-
const
|
|
2049
|
-
for (const
|
|
2050
|
-
const s = e.equippedItems?.[
|
|
1287
|
+
const a = await E.getAllPopulated();
|
|
1288
|
+
for (const r of be) {
|
|
1289
|
+
const s = e.equippedItems?.[r];
|
|
2051
1290
|
if (!s)
|
|
2052
1291
|
continue;
|
|
2053
|
-
const i = await
|
|
2054
|
-
t =
|
|
1292
|
+
const i = await l.fromDBToEquipableEquipment(s);
|
|
1293
|
+
t = C(
|
|
2055
1294
|
t,
|
|
2056
1295
|
i.characteristics,
|
|
2057
|
-
(
|
|
1296
|
+
(c, u) => c + u
|
|
2058
1297
|
);
|
|
2059
1298
|
}
|
|
2060
|
-
for (const
|
|
2061
|
-
const s = this.getPanoplyEffectiveBonus(e,
|
|
2062
|
-
s && !("target" in s) && (t =
|
|
1299
|
+
for (const r of a) {
|
|
1300
|
+
const s = this.getPanoplyEffectiveBonus(e, r);
|
|
1301
|
+
s && !("target" in s) && (t = C(
|
|
2063
1302
|
t,
|
|
2064
1303
|
s,
|
|
2065
|
-
(i,
|
|
1304
|
+
(i, c) => i + c
|
|
2066
1305
|
));
|
|
2067
1306
|
}
|
|
2068
1307
|
return t;
|
|
2069
1308
|
}
|
|
2070
1309
|
async hasInventoryRequirements(e, t) {
|
|
2071
|
-
const
|
|
2072
|
-
return
|
|
2073
|
-
(
|
|
1310
|
+
const a = await this.get(e);
|
|
1311
|
+
return x(t).reduce(
|
|
1312
|
+
(r, [s, i]) => r && (a.itemList[s] ?? 0) >= (i ?? 0),
|
|
2074
1313
|
!0
|
|
2075
1314
|
);
|
|
2076
1315
|
}
|
|
2077
|
-
async hasEnoughEntity(e, t,
|
|
2078
|
-
return ((await this.get(e)).itemList[
|
|
1316
|
+
async hasEnoughEntity(e, t, a) {
|
|
1317
|
+
return ((await this.get(e)).itemList[a] ?? 0) >= t;
|
|
2079
1318
|
}
|
|
2080
1319
|
async getItemList(e) {
|
|
2081
1320
|
return (await this.get(e)).itemList;
|
|
2082
1321
|
}
|
|
2083
1322
|
async calcBottleMultiplier(e, { bottle: { buffs: t } }) {
|
|
2084
|
-
const
|
|
2085
|
-
|
|
1323
|
+
const a = await this.get(e), s = (await E.getPanoplyBonus(
|
|
1324
|
+
a.equippedItems
|
|
2086
1325
|
)).find(
|
|
2087
|
-
([i,
|
|
1326
|
+
([i, c]) => i.panoplyId === "herbalist" && c !== null
|
|
2088
1327
|
);
|
|
2089
1328
|
return s && s[1] === "full" ? t.map((i) => ({
|
|
2090
1329
|
...i,
|
|
@@ -2095,52 +1334,52 @@ class lr extends f {
|
|
|
2095
1334
|
})) : t;
|
|
2096
1335
|
}
|
|
2097
1336
|
async calcMinStreakForWorkLoot(e) {
|
|
2098
|
-
const t = await this.get(e),
|
|
2099
|
-
([
|
|
1337
|
+
const t = await this.get(e), a = (await E.getPanoplyBonus(t.equippedItems)).find(
|
|
1338
|
+
([r, s]) => r.panoplyId === "marine" && s !== null
|
|
2100
1339
|
);
|
|
2101
|
-
return
|
|
1340
|
+
return a && a[1] === "full" ? 10 : a && a[1] === "half" ? 20 : 1 / 0;
|
|
2102
1341
|
}
|
|
2103
1342
|
async hasRevolutionaryBuff(e) {
|
|
2104
1343
|
const t = await this.get(e);
|
|
2105
|
-
return (await
|
|
2106
|
-
([
|
|
1344
|
+
return (await E.getPanoplyBonus(t.equippedItems)).find(
|
|
1345
|
+
([r, s]) => r.panoplyId === "revolutionary" && s !== null
|
|
2107
1346
|
)?.[1] ?? null;
|
|
2108
1347
|
}
|
|
2109
1348
|
/*
|
|
2110
1349
|
** UPDATES
|
|
2111
1350
|
*/
|
|
2112
|
-
async addItem(e, t,
|
|
1351
|
+
async addItem(e, t, a) {
|
|
2113
1352
|
await this.update(e, {
|
|
2114
|
-
$inc: { [`itemList.${t}`]:
|
|
2115
|
-
}), await
|
|
1353
|
+
$inc: { [`itemList.${t}`]: a }
|
|
1354
|
+
}), await ce.addEntities(e, [t]);
|
|
2116
1355
|
}
|
|
2117
1356
|
async addItems(e, t) {
|
|
2118
1357
|
await this.update(e, {
|
|
2119
1358
|
$inc: Object.fromEntries(
|
|
2120
|
-
Object.entries(t).filter(([,
|
|
1359
|
+
Object.entries(t).filter(([, a]) => (a ?? 0) > 0).map(([a, r]) => [`itemList.${a}`, r])
|
|
2121
1360
|
)
|
|
2122
|
-
}), await
|
|
1361
|
+
}), await ce.addEntities(
|
|
2123
1362
|
e,
|
|
2124
|
-
|
|
1363
|
+
x(t).filter(([, a]) => a > 0).map(([a]) => a)
|
|
2125
1364
|
);
|
|
2126
1365
|
}
|
|
2127
|
-
async removeItem(e, t,
|
|
2128
|
-
|
|
1366
|
+
async removeItem(e, t, a) {
|
|
1367
|
+
a !== 0 && await this.update(e, [
|
|
2129
1368
|
{
|
|
2130
1369
|
$set: {
|
|
2131
1370
|
[`itemList.${t}`]: {
|
|
2132
|
-
$max: [{ $add: [`$itemList.${t}`, -
|
|
1371
|
+
$max: [{ $add: [`$itemList.${t}`, -a] }, 0]
|
|
2133
1372
|
}
|
|
2134
1373
|
}
|
|
2135
1374
|
}
|
|
2136
1375
|
]);
|
|
2137
1376
|
}
|
|
2138
|
-
async removeEquipment(e, t,
|
|
1377
|
+
async removeEquipment(e, t, a) {
|
|
2139
1378
|
await this.update(e, {
|
|
2140
1379
|
$pull: {
|
|
2141
1380
|
equipmentList: {
|
|
2142
1381
|
entityId: t,
|
|
2143
|
-
seed:
|
|
1382
|
+
seed: a
|
|
2144
1383
|
}
|
|
2145
1384
|
}
|
|
2146
1385
|
});
|
|
@@ -2151,9 +1390,9 @@ class lr extends f {
|
|
|
2151
1390
|
async addEquipments(e, t) {
|
|
2152
1391
|
await this.update(e, {
|
|
2153
1392
|
$push: { equipmentList: { $each: t } }
|
|
2154
|
-
}), await
|
|
1393
|
+
}), await ce.addEntities(
|
|
2155
1394
|
e,
|
|
2156
|
-
t.map((
|
|
1395
|
+
t.map((a) => a.entityId)
|
|
2157
1396
|
);
|
|
2158
1397
|
}
|
|
2159
1398
|
async saveEquipments(e) {
|
|
@@ -2166,64 +1405,64 @@ class lr extends f {
|
|
|
2166
1405
|
]);
|
|
2167
1406
|
}
|
|
2168
1407
|
async changeEquippedEquipment(e, t) {
|
|
2169
|
-
const
|
|
2170
|
-
|
|
1408
|
+
const a = await this.get(e);
|
|
1409
|
+
a?.equipmentSave[t] && await this.equip(e, a.equipmentSave[t]);
|
|
2171
1410
|
}
|
|
2172
1411
|
async equip(e, t) {
|
|
2173
|
-
const
|
|
2174
|
-
|
|
1412
|
+
const a = await U.getMaxHp(e), r = Object.fromEntries(
|
|
1413
|
+
x(t).map(([s, i]) => [
|
|
2175
1414
|
`equippedItems.${s}`,
|
|
2176
1415
|
i
|
|
2177
1416
|
])
|
|
2178
1417
|
);
|
|
2179
1418
|
await this.update(e, {
|
|
2180
|
-
$set:
|
|
2181
|
-
}), await
|
|
1419
|
+
$set: r
|
|
1420
|
+
}), await U.updateHp(e, a);
|
|
2182
1421
|
}
|
|
2183
1422
|
async unequip(e, t) {
|
|
2184
|
-
const
|
|
1423
|
+
const a = await U.getMaxHp(e);
|
|
2185
1424
|
await this.update(e, {
|
|
2186
1425
|
$set: {
|
|
2187
1426
|
[`equippedItems.${t}`]: null
|
|
2188
1427
|
}
|
|
2189
|
-
}), await
|
|
1428
|
+
}), await U.updateHp(e, a);
|
|
2190
1429
|
}
|
|
2191
|
-
async craftItem(e, t,
|
|
2192
|
-
for (const { entityId:
|
|
2193
|
-
await this.removeItem(e,
|
|
1430
|
+
async craftItem(e, t, a, r) {
|
|
1431
|
+
for (const { entityId: c, size: u } of t.entities)
|
|
1432
|
+
await this.removeItem(e, c, u * a);
|
|
2194
1433
|
const { entityId: s, size: i } = t.result;
|
|
2195
|
-
await
|
|
1434
|
+
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
1435
|
}
|
|
2197
|
-
async dismantleEntity(e, t,
|
|
2198
|
-
|
|
2199
|
-
for (const { entityId: i, quantity:
|
|
2200
|
-
await
|
|
1436
|
+
async dismantleEntity(e, t, a, r, s) {
|
|
1437
|
+
l.isEquipment(t) ? await this.removeEquipment(e, t.entityId, s) : l.isItem(t) && await this.removeItem(e, t.entityId, r);
|
|
1438
|
+
for (const { entityId: i, quantity: c } of a)
|
|
1439
|
+
await l.isEntityId(i, l.isItem) && await this.addItem(e, i, r * c);
|
|
2201
1440
|
await this.removeItem(e, "tools", 1);
|
|
2202
1441
|
}
|
|
2203
|
-
async enchantItem(e, t,
|
|
2204
|
-
await this.removeItem(e, t, s * 4), await this.removeItem(e,
|
|
1442
|
+
async enchantItem(e, t, a, r, s) {
|
|
1443
|
+
await this.removeItem(e, t, s * 4), await this.removeItem(e, r, s), await this.addItem(e, a, s);
|
|
2205
1444
|
}
|
|
2206
1445
|
async unlockRecipe(e, t) {
|
|
2207
1446
|
await this.update(e, { $addToSet: { recipes: t } });
|
|
2208
1447
|
}
|
|
2209
1448
|
}
|
|
2210
|
-
const
|
|
1449
|
+
const Jt = (n) => V.create({
|
|
2211
1450
|
user: n
|
|
2212
1451
|
});
|
|
2213
|
-
async function
|
|
2214
|
-
const e = await
|
|
2215
|
-
return e || y(await
|
|
1452
|
+
async function Zt(n) {
|
|
1453
|
+
const e = await V.findOne({ user: n }).lean();
|
|
1454
|
+
return e || y(await Jt(n));
|
|
2216
1455
|
}
|
|
2217
|
-
const
|
|
1456
|
+
const en = (n, e) => V.findOneAndUpdate({ user: n }, e, {
|
|
2218
1457
|
upsert: !0,
|
|
2219
1458
|
returnDocument: "after"
|
|
2220
1459
|
}).lean();
|
|
2221
|
-
class
|
|
1460
|
+
class tn extends Xt {
|
|
2222
1461
|
constructor() {
|
|
2223
1462
|
super(300);
|
|
2224
1463
|
}
|
|
2225
1464
|
fetchFromDb(e) {
|
|
2226
|
-
return
|
|
1465
|
+
return Zt(e);
|
|
2227
1466
|
}
|
|
2228
1467
|
normalizeKey(e) {
|
|
2229
1468
|
return e.toString();
|
|
@@ -2232,17 +1471,17 @@ class mr extends lr {
|
|
|
2232
1471
|
return e;
|
|
2233
1472
|
}
|
|
2234
1473
|
updateInDb(e, t) {
|
|
2235
|
-
return
|
|
1474
|
+
return en(e, t);
|
|
2236
1475
|
}
|
|
2237
1476
|
}
|
|
2238
|
-
const
|
|
2239
|
-
class
|
|
1477
|
+
const m = new tn();
|
|
1478
|
+
class nn extends w {
|
|
2240
1479
|
async getTotalCharacteristics(e) {
|
|
2241
|
-
const { characteristics: t, scrolls:
|
|
2242
|
-
return
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
1480
|
+
const { characteristics: t, scrolls: a } = await this.get(e);
|
|
1481
|
+
return Ie(
|
|
1482
|
+
We.map((r) => [
|
|
1483
|
+
r,
|
|
1484
|
+
Ge(t[r]) + a[r]
|
|
2246
1485
|
])
|
|
2247
1486
|
);
|
|
2248
1487
|
}
|
|
@@ -2289,59 +1528,59 @@ class hr extends b {
|
|
|
2289
1528
|
});
|
|
2290
1529
|
}
|
|
2291
1530
|
async calcXpBoost(e) {
|
|
2292
|
-
const t = await this.get(e), { boost:
|
|
1531
|
+
const t = await this.get(e), { boost: a } = t.xp, r = a !== null && Date.now() < a.getTime() ? 0.2 : 0, s = Math.max(
|
|
2293
1532
|
t.premium ? 0.5 : 0,
|
|
2294
1533
|
t.booster ? 0.25 : 0
|
|
2295
1534
|
);
|
|
2296
|
-
return
|
|
2297
|
-
(i, { expireAt:
|
|
1535
|
+
return r + s + t.buffs.xp.global.reduce(
|
|
1536
|
+
(i, { expireAt: c, startAt: u, multiplier: h }) => u && u > /* @__PURE__ */ new Date() || c && oe(c) ? i : i + h,
|
|
2298
1537
|
0
|
|
2299
1538
|
);
|
|
2300
1539
|
}
|
|
2301
1540
|
calcMessageXp(e) {
|
|
2302
|
-
const t = e.trim().length,
|
|
2303
|
-
return t < 10 ? 10 *
|
|
1541
|
+
const t = e.trim().length, a = 2;
|
|
1542
|
+
return t < 10 ? 10 * a : t > 300 ? 300 * a : t * a;
|
|
2304
1543
|
}
|
|
2305
1544
|
async getXpDeathPenalties(e) {
|
|
2306
|
-
const t = await this.get(e),
|
|
2307
|
-
return
|
|
1545
|
+
const t = await this.get(e), a = Ye(t.xp.amount);
|
|
1546
|
+
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
1547
|
}
|
|
2309
|
-
async calcXp(e, t,
|
|
2310
|
-
return t *= 1 + await this.calcXpBoost(e), Math.ceil(t *
|
|
1548
|
+
async calcXp(e, t, a) {
|
|
1549
|
+
return t *= 1 + await this.calcXpBoost(e), Math.ceil(t * a);
|
|
2311
1550
|
}
|
|
2312
|
-
async calcBerry(e, t,
|
|
1551
|
+
async calcBerry(e, t, a) {
|
|
2313
1552
|
if (t <= 0) return t;
|
|
2314
|
-
const
|
|
2315
|
-
return Math.ceil(t * (
|
|
1553
|
+
const r = a ? 1 : await this.calcBuffMultiplier(e, "berry", "global");
|
|
1554
|
+
return Math.ceil(t * (r || 1));
|
|
2316
1555
|
}
|
|
2317
|
-
async calcBuffMultiplier(e, t,
|
|
2318
|
-
return (await this.get(e)).buffs[t][
|
|
2319
|
-
(i, { expireAt:
|
|
1556
|
+
async calcBuffMultiplier(e, t, a) {
|
|
1557
|
+
return (await this.get(e)).buffs[t][a].reduce(
|
|
1558
|
+
(i, { expireAt: c, startAt: u, multiplier: h }) => i + (/* @__PURE__ */ new Date() >= (u ?? /* @__PURE__ */ new Date()) && (!c || !oe(c)) ? h : 0),
|
|
2320
1559
|
1
|
|
2321
1560
|
);
|
|
2322
1561
|
}
|
|
2323
1562
|
async getMaxHp(e) {
|
|
2324
|
-
const t = await
|
|
1563
|
+
const t = await m.get(e), { vitality: a } = await this.getTotalCharacteristics(e), r = await m.getUserEquipmentsCharacteristics(
|
|
2325
1564
|
t
|
|
2326
1565
|
);
|
|
2327
|
-
return (
|
|
1566
|
+
return (a + r.vitality) * Ve + Xe;
|
|
2328
1567
|
}
|
|
2329
1568
|
async getHpRatio(e) {
|
|
2330
|
-
const t = await this.get(e),
|
|
2331
|
-
return Math.min(t.hp /
|
|
1569
|
+
const t = await this.get(e), a = await this.getMaxHp(e);
|
|
1570
|
+
return Math.min(t.hp / a, 1);
|
|
2332
1571
|
}
|
|
2333
1572
|
async hasCharacteristicRequirement(e, t) {
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
), s =
|
|
1573
|
+
const a = await m.get(e), r = await m.getUserEquipmentsCharacteristics(
|
|
1574
|
+
a
|
|
1575
|
+
), s = C(
|
|
2337
1576
|
await this.getTotalCharacteristics(e),
|
|
2338
|
-
|
|
2339
|
-
(i,
|
|
1577
|
+
r,
|
|
1578
|
+
(i, c) => i + c
|
|
2340
1579
|
);
|
|
2341
1580
|
if ("sum" in t) {
|
|
2342
1581
|
let i = 0;
|
|
2343
|
-
for (const
|
|
2344
|
-
i += s[
|
|
1582
|
+
for (const c of t.characteristics)
|
|
1583
|
+
i += s[c] ?? 0;
|
|
2345
1584
|
return i >= t.sum;
|
|
2346
1585
|
} else {
|
|
2347
1586
|
for (const i of Object.keys(
|
|
@@ -2354,10 +1593,10 @@ class hr extends b {
|
|
|
2354
1593
|
}
|
|
2355
1594
|
async hasMalusBuff(e) {
|
|
2356
1595
|
const t = await this.get(e);
|
|
2357
|
-
for (const
|
|
2358
|
-
for (const
|
|
2359
|
-
for (const { multiplier: s, startAt: i, expireAt:
|
|
2360
|
-
if (s < 0 && (!
|
|
1596
|
+
for (const a of Object.values(t.buffs))
|
|
1597
|
+
for (const r of Object.values(a))
|
|
1598
|
+
for (const { multiplier: s, startAt: i, expireAt: c } of r)
|
|
1599
|
+
if (s < 0 && (!c || !oe(c)) && (i ?? /* @__PURE__ */ new Date()) <= /* @__PURE__ */ new Date())
|
|
2361
1600
|
return !0;
|
|
2362
1601
|
return !1;
|
|
2363
1602
|
}
|
|
@@ -2386,7 +1625,7 @@ class hr extends b {
|
|
|
2386
1625
|
}
|
|
2387
1626
|
async updateBoost(e, t) {
|
|
2388
1627
|
const {
|
|
2389
|
-
xp: { boost:
|
|
1628
|
+
xp: { boost: a }
|
|
2390
1629
|
} = await this.update(e, [
|
|
2391
1630
|
{
|
|
2392
1631
|
$set: {
|
|
@@ -2405,15 +1644,15 @@ class hr extends b {
|
|
|
2405
1644
|
}
|
|
2406
1645
|
}
|
|
2407
1646
|
]);
|
|
2408
|
-
return
|
|
1647
|
+
return a;
|
|
2409
1648
|
}
|
|
2410
1649
|
async updateBuff(e, t) {
|
|
2411
1650
|
if (Array.isArray(t)) {
|
|
2412
|
-
for (const
|
|
2413
|
-
await this.updateBuff(e,
|
|
1651
|
+
for (const r of t)
|
|
1652
|
+
await this.updateBuff(e, r);
|
|
2414
1653
|
return;
|
|
2415
1654
|
}
|
|
2416
|
-
const
|
|
1655
|
+
const a = Je(t);
|
|
2417
1656
|
await this.update(e, [
|
|
2418
1657
|
{
|
|
2419
1658
|
$set: {
|
|
@@ -2438,10 +1677,10 @@ class hr extends b {
|
|
|
2438
1677
|
then: {
|
|
2439
1678
|
multiplier: t.multiplier,
|
|
2440
1679
|
origin: t.origin,
|
|
2441
|
-
expireAt:
|
|
1680
|
+
expireAt: a.expireAt ? {
|
|
2442
1681
|
$cond: {
|
|
2443
1682
|
if: { $lt: ["$$buff.expireAt", /* @__PURE__ */ new Date()] },
|
|
2444
|
-
then:
|
|
1683
|
+
then: a.expireAt,
|
|
2445
1684
|
else: {
|
|
2446
1685
|
$add: [
|
|
2447
1686
|
"$$buff.expireAt",
|
|
@@ -2494,7 +1733,7 @@ class hr extends b {
|
|
|
2494
1733
|
},
|
|
2495
1734
|
then: `$buffs.${t.target}`,
|
|
2496
1735
|
else: {
|
|
2497
|
-
$concatArrays: [`$buffs.${t.target}`, [{ ...
|
|
1736
|
+
$concatArrays: [`$buffs.${t.target}`, [{ ...a }]]
|
|
2498
1737
|
}
|
|
2499
1738
|
}
|
|
2500
1739
|
}
|
|
@@ -2507,21 +1746,21 @@ class hr extends b {
|
|
|
2507
1746
|
$pull: { [`buffs.${t.target}`]: { origin: t.origin } }
|
|
2508
1747
|
});
|
|
2509
1748
|
}
|
|
2510
|
-
async updatePanoplyBuff(e, t,
|
|
2511
|
-
const s = await
|
|
2512
|
-
(
|
|
1749
|
+
async updatePanoplyBuff(e, t, a, r) {
|
|
1750
|
+
const s = await l.fromDBToEquipableEquipment(t), i = _(Object.values(a)), u = (await E.getAllPopulated()).find(
|
|
1751
|
+
(D) => D.panoplyId === s.panoply
|
|
2513
1752
|
);
|
|
2514
|
-
if (!
|
|
1753
|
+
if (!u)
|
|
2515
1754
|
return;
|
|
2516
|
-
const
|
|
2517
|
-
(
|
|
2518
|
-
).length,
|
|
2519
|
-
|
|
1755
|
+
const h = u.equipments.filter(
|
|
1756
|
+
(D) => (i.find((ue) => D.entityId === ue.entityId) || !r && s.entityId === D.entityId) && (r ? s.entityId !== D.entityId : !0)
|
|
1757
|
+
).length, R = h === u.equipments.length ? u.fullBonus : h >= u.equipments.length / 2 ? u.halfBonus : void 0;
|
|
1758
|
+
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
1759
|
}
|
|
2521
1760
|
async gainHp(e, t) {
|
|
2522
|
-
const
|
|
1761
|
+
const a = await this.get(e), s = await this.getMaxHp(e) - a.hp;
|
|
2523
1762
|
await this.update(e, {
|
|
2524
|
-
$set: { hp:
|
|
1763
|
+
$set: { hp: a.hp + Math.floor(Math.min(t, s)) }
|
|
2525
1764
|
});
|
|
2526
1765
|
}
|
|
2527
1766
|
async loseHp(e, t) {
|
|
@@ -2532,14 +1771,14 @@ class hr extends b {
|
|
|
2532
1771
|
]);
|
|
2533
1772
|
}
|
|
2534
1773
|
async updateHp(e, t) {
|
|
2535
|
-
const
|
|
1774
|
+
const a = await this.getMaxHp(e);
|
|
2536
1775
|
await this.update(e, [
|
|
2537
1776
|
{
|
|
2538
1777
|
$set: {
|
|
2539
1778
|
hp: {
|
|
2540
1779
|
$round: [
|
|
2541
1780
|
{
|
|
2542
|
-
$multiply: [{ $divide: ["$hp", t] },
|
|
1781
|
+
$multiply: [{ $divide: ["$hp", t] }, a]
|
|
2543
1782
|
},
|
|
2544
1783
|
0
|
|
2545
1784
|
]
|
|
@@ -2549,23 +1788,23 @@ class hr extends b {
|
|
|
2549
1788
|
]);
|
|
2550
1789
|
}
|
|
2551
1790
|
async addCharacteristics(e, t) {
|
|
2552
|
-
const
|
|
1791
|
+
const a = await this.getMaxHp(e), r = Object.fromEntries(
|
|
2553
1792
|
Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`characteristics.${s}`, i])
|
|
2554
1793
|
);
|
|
2555
1794
|
await this.update(e, {
|
|
2556
|
-
$inc:
|
|
2557
|
-
}), await this.updateHp(e,
|
|
1795
|
+
$inc: r
|
|
1796
|
+
}), await this.updateHp(e, a);
|
|
2558
1797
|
}
|
|
2559
1798
|
async addScrollCharacteristic(e, t) {
|
|
2560
|
-
const
|
|
1799
|
+
const a = await this.getMaxHp(e), r = Object.fromEntries(
|
|
2561
1800
|
Object.entries(t).filter(([, s]) => s !== 0).map(([s, i]) => [`scrolls.${s}`, i])
|
|
2562
1801
|
);
|
|
2563
1802
|
await this.update(e, {
|
|
2564
|
-
$inc:
|
|
2565
|
-
}), await this.updateHp(e,
|
|
1803
|
+
$inc: r
|
|
1804
|
+
}), await this.updateHp(e, a);
|
|
2566
1805
|
}
|
|
2567
1806
|
async resetCharacteristics(e, t) {
|
|
2568
|
-
const
|
|
1807
|
+
const a = await this.getMaxHp(e), r = {
|
|
2569
1808
|
vitality: 0,
|
|
2570
1809
|
strength: 0,
|
|
2571
1810
|
agility: 0,
|
|
@@ -2575,12 +1814,12 @@ class hr extends b {
|
|
|
2575
1814
|
};
|
|
2576
1815
|
t ? await this.update(e, {
|
|
2577
1816
|
$set: {
|
|
2578
|
-
characteristics:
|
|
1817
|
+
characteristics: r,
|
|
2579
1818
|
"resetCharacteristics.free": !1
|
|
2580
1819
|
}
|
|
2581
1820
|
}) : await this.update(e, {
|
|
2582
1821
|
$set: {
|
|
2583
|
-
characteristics:
|
|
1822
|
+
characteristics: r,
|
|
2584
1823
|
"resetCharacteristics.nextAvailable": new Date(
|
|
2585
1824
|
Date.now() + 720 * 60 * 60 * 1e3
|
|
2586
1825
|
)
|
|
@@ -2588,7 +1827,10 @@ class hr extends b {
|
|
|
2588
1827
|
$inc: {
|
|
2589
1828
|
berry: -1e8
|
|
2590
1829
|
}
|
|
2591
|
-
}), await this.updateHp(e,
|
|
1830
|
+
}), await this.updateHp(e, a);
|
|
1831
|
+
}
|
|
1832
|
+
async updateLastMessageWithXpDate(e) {
|
|
1833
|
+
await this.update(e, { $set: { "xp.lastMessageWithXp": /* @__PURE__ */ new Date() } });
|
|
2592
1834
|
}
|
|
2593
1835
|
async resetMinutesInVoiceToday(e) {
|
|
2594
1836
|
await this.update(e, { $set: { "xp.voice.minutesInVoiceToday": 0 } });
|
|
@@ -2613,40 +1855,31 @@ class hr extends b {
|
|
|
2613
1855
|
$set: { workUnluckyStreak: 0 }
|
|
2614
1856
|
});
|
|
2615
1857
|
}
|
|
2616
|
-
async updateScam(e, t) {
|
|
2617
|
-
await this.update(e, {
|
|
2618
|
-
$set: { scam: t }
|
|
2619
|
-
});
|
|
2620
|
-
}
|
|
2621
1858
|
async updateUserXp(e, t) {
|
|
2622
|
-
const
|
|
1859
|
+
const a = await this.calcXp(
|
|
2623
1860
|
e,
|
|
2624
1861
|
t,
|
|
2625
|
-
|
|
1862
|
+
await this.getHpRatio(e)
|
|
2626
1863
|
);
|
|
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 };
|
|
1864
|
+
return await this.addXp(e, a), a;
|
|
2632
1865
|
}
|
|
2633
|
-
async updateUserBerry(e, t,
|
|
2634
|
-
const
|
|
2635
|
-
return await this.addBerry(e,
|
|
1866
|
+
async updateUserBerry(e, t, a) {
|
|
1867
|
+
const r = await this.calcBerry(e, t, a);
|
|
1868
|
+
return await this.addBerry(e, r), r;
|
|
2636
1869
|
}
|
|
2637
1870
|
}
|
|
2638
|
-
const
|
|
1871
|
+
const an = (n) => O.find(n).lean(), rn = async (n) => await O.create({
|
|
2639
1872
|
user: n
|
|
2640
1873
|
});
|
|
2641
|
-
async function
|
|
2642
|
-
const e = await
|
|
2643
|
-
return e || y(await
|
|
1874
|
+
async function sn(n) {
|
|
1875
|
+
const e = await O.findOne({ user: n }).lean();
|
|
1876
|
+
return e || y(await rn(n));
|
|
2644
1877
|
}
|
|
2645
|
-
const
|
|
1878
|
+
const un = (n, e) => O.findOneAndUpdate({ user: n }, e, {
|
|
2646
1879
|
returnDocument: "after",
|
|
2647
1880
|
upsert: !0
|
|
2648
1881
|
}).lean();
|
|
2649
|
-
class
|
|
1882
|
+
class on extends nn {
|
|
2650
1883
|
constructor() {
|
|
2651
1884
|
super(300);
|
|
2652
1885
|
}
|
|
@@ -2657,17 +1890,17 @@ class $r extends hr {
|
|
|
2657
1890
|
return e;
|
|
2658
1891
|
}
|
|
2659
1892
|
fetchFromDb(e) {
|
|
2660
|
-
return
|
|
1893
|
+
return sn(e);
|
|
2661
1894
|
}
|
|
2662
1895
|
fetchManyFromDb(e) {
|
|
2663
|
-
return
|
|
1896
|
+
return an(e);
|
|
2664
1897
|
}
|
|
2665
1898
|
updateInDb(e, t) {
|
|
2666
|
-
return
|
|
1899
|
+
return un(e, t);
|
|
2667
1900
|
}
|
|
2668
1901
|
}
|
|
2669
|
-
const
|
|
2670
|
-
class
|
|
1902
|
+
const U = new on();
|
|
1903
|
+
class cn extends w {
|
|
2671
1904
|
async updateSendDailyQuest(e, t) {
|
|
2672
1905
|
await this.update(e, { $set: { sendDailyQuest: t } });
|
|
2673
1906
|
}
|
|
@@ -2677,8 +1910,8 @@ class Er extends b {
|
|
|
2677
1910
|
async updateInventorySort(e, t) {
|
|
2678
1911
|
await this.update(e, { $set: { "sort.inventory": t } });
|
|
2679
1912
|
}
|
|
2680
|
-
async updateReminderSettings(e, t,
|
|
2681
|
-
await this.update(e, { $set: { [`reminder.${t}`]:
|
|
1913
|
+
async updateReminderSettings(e, t, a) {
|
|
1914
|
+
await this.update(e, { $set: { [`reminder.${t}`]: a } });
|
|
2682
1915
|
}
|
|
2683
1916
|
getUsersWithDailyReportEnable() {
|
|
2684
1917
|
return this.getMany({
|
|
@@ -2686,18 +1919,18 @@ class Er extends b {
|
|
|
2686
1919
|
});
|
|
2687
1920
|
}
|
|
2688
1921
|
}
|
|
2689
|
-
const
|
|
1922
|
+
const ln = (n) => N.find(n).lean(), dn = async (n) => await N.create({
|
|
2690
1923
|
user: n
|
|
2691
1924
|
});
|
|
2692
|
-
async function
|
|
2693
|
-
const e = await
|
|
2694
|
-
return e || y(await
|
|
1925
|
+
async function pn(n) {
|
|
1926
|
+
const e = await N.findOne({ user: n }).lean();
|
|
1927
|
+
return e || y(await dn(n));
|
|
2695
1928
|
}
|
|
2696
|
-
const
|
|
1929
|
+
const yn = (n, e) => N.findOneAndUpdate({ user: n }, e, {
|
|
2697
1930
|
returnDocument: "after",
|
|
2698
1931
|
upsert: !0
|
|
2699
1932
|
}).lean();
|
|
2700
|
-
class
|
|
1933
|
+
class fn extends cn {
|
|
2701
1934
|
constructor() {
|
|
2702
1935
|
super(3600);
|
|
2703
1936
|
}
|
|
@@ -2708,93 +1941,52 @@ class Tr extends Er {
|
|
|
2708
1941
|
return e.user;
|
|
2709
1942
|
}
|
|
2710
1943
|
fetchFromDb(e) {
|
|
2711
|
-
return
|
|
1944
|
+
return pn(e);
|
|
2712
1945
|
}
|
|
2713
1946
|
fetchManyFromDb(e) {
|
|
2714
|
-
return
|
|
1947
|
+
return ln(e);
|
|
2715
1948
|
}
|
|
2716
1949
|
updateInDb(e, t) {
|
|
2717
|
-
return
|
|
1950
|
+
return yn(e, t);
|
|
2718
1951
|
}
|
|
2719
1952
|
}
|
|
2720
|
-
const
|
|
2721
|
-
class
|
|
1953
|
+
const _e = new fn();
|
|
1954
|
+
class mn extends f {
|
|
2722
1955
|
async getCommandCooldown(e, t) {
|
|
2723
1956
|
return (await this.get(e)).commands[t];
|
|
2724
1957
|
}
|
|
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
1958
|
async lockUserCommand(e) {
|
|
2767
1959
|
await this.update(e, {
|
|
2768
1960
|
$set: {
|
|
2769
1961
|
lockUserCommand: new Date(Date.now() + 2 * 3600 * 1e3)
|
|
2770
1962
|
}
|
|
2771
|
-
}), await
|
|
1963
|
+
}), await U.gainHp(e, 1);
|
|
2772
1964
|
}
|
|
2773
|
-
async useCommand(e, t,
|
|
2774
|
-
const { reminder:
|
|
1965
|
+
async useCommand(e, t, a) {
|
|
1966
|
+
const { reminder: r } = await _e.get(e);
|
|
2775
1967
|
await this.update(e, {
|
|
2776
1968
|
$set: {
|
|
2777
|
-
[`commands.${t}`]: new Date(Date.now() +
|
|
1969
|
+
[`commands.${t}`]: new Date(Date.now() + a)
|
|
2778
1970
|
}
|
|
2779
|
-
}),
|
|
1971
|
+
}), r.commands[t] && await Bt.addReminder(
|
|
2780
1972
|
e,
|
|
2781
1973
|
`commands/${t}`,
|
|
2782
|
-
new Date(Date.now() +
|
|
1974
|
+
new Date(Date.now() + a)
|
|
2783
1975
|
);
|
|
2784
1976
|
}
|
|
2785
1977
|
}
|
|
2786
|
-
const
|
|
1978
|
+
const hn = async (n) => await Q.create({
|
|
2787
1979
|
user: n
|
|
2788
1980
|
});
|
|
2789
|
-
async function
|
|
2790
|
-
const e = await
|
|
2791
|
-
return e || y(await
|
|
1981
|
+
async function gn(n) {
|
|
1982
|
+
const e = await Q.findOne({ user: n }).lean();
|
|
1983
|
+
return e || y(await hn(n));
|
|
2792
1984
|
}
|
|
2793
|
-
const
|
|
1985
|
+
const wn = (n, e) => Q.findOneAndUpdate({ user: n }, e, {
|
|
2794
1986
|
returnDocument: "after",
|
|
2795
1987
|
upsert: !0
|
|
2796
1988
|
}).lean();
|
|
2797
|
-
class
|
|
1989
|
+
class Sn extends mn {
|
|
2798
1990
|
constructor() {
|
|
2799
1991
|
super(300);
|
|
2800
1992
|
}
|
|
@@ -2805,14 +1997,136 @@ class Mr extends Rr {
|
|
|
2805
1997
|
return e.user;
|
|
2806
1998
|
}
|
|
2807
1999
|
fetchFromDb(e) {
|
|
2808
|
-
return
|
|
2000
|
+
return gn(e);
|
|
2001
|
+
}
|
|
2002
|
+
updateInDb(e, t) {
|
|
2003
|
+
return wn(e, t);
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
const Nr = new Sn();
|
|
2007
|
+
class bn extends w {
|
|
2008
|
+
async isOrnamentIds(e, t = () => !0) {
|
|
2009
|
+
const r = (await this.getAll()).filter(t).map(({ ornamentId: s }) => s);
|
|
2010
|
+
return e.every((s) => r.includes(s));
|
|
2011
|
+
}
|
|
2012
|
+
isOrnament(e) {
|
|
2013
|
+
return !!e && "ornamentId" in e;
|
|
2014
|
+
}
|
|
2015
|
+
isTitle(e) {
|
|
2016
|
+
return e.type === "title";
|
|
2017
|
+
}
|
|
2018
|
+
isBackground(e) {
|
|
2019
|
+
return e.type === "background";
|
|
2020
|
+
}
|
|
2021
|
+
isQuestTitle(e) {
|
|
2022
|
+
return this.isTitle(e) && !("faction" in e) && !("price" in e);
|
|
2023
|
+
}
|
|
2024
|
+
isFactionTitle(e) {
|
|
2025
|
+
return this.isTitle(e) && "faction" in e;
|
|
2026
|
+
}
|
|
2027
|
+
isShopTitle(e) {
|
|
2028
|
+
return this.isTitle(e) && "price" in e;
|
|
2029
|
+
}
|
|
2030
|
+
async getAllBackgrounds() {
|
|
2031
|
+
return (await this.getAll()).filter(this.isBackground);
|
|
2032
|
+
}
|
|
2033
|
+
async getAllTitles() {
|
|
2034
|
+
return (await this.getAll()).filter(this.isTitle);
|
|
2035
|
+
}
|
|
2036
|
+
async getAllFactionTitles() {
|
|
2037
|
+
return (await this.getAll()).filter(this.isFactionTitle);
|
|
2038
|
+
}
|
|
2039
|
+
async getAllQuestTitles() {
|
|
2040
|
+
return (await this.getAll()).filter(this.isQuestTitle);
|
|
2041
|
+
}
|
|
2042
|
+
async getAllShopTitles() {
|
|
2043
|
+
return (await this.getAll()).filter(this.isShopTitle);
|
|
2044
|
+
}
|
|
2045
|
+
formatBackgroundId(e) {
|
|
2046
|
+
const t = nt(e) ? e : e.ornamentId;
|
|
2047
|
+
return t === "background_default" ? "par défaut" : `"${at(t.split("_").join(" "))}"`;
|
|
2048
|
+
}
|
|
2049
|
+
async getSomeShopTitles(e) {
|
|
2050
|
+
const t = await this.getAllShopTitles();
|
|
2051
|
+
return H(
|
|
2052
|
+
le(
|
|
2053
|
+
e,
|
|
2054
|
+
t,
|
|
2055
|
+
(a) => a.ornamentId,
|
|
2056
|
+
(a) => a.odd ?? 0
|
|
2057
|
+
),
|
|
2058
|
+
(a) => a.price
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
async getSomeBackgrounds(e) {
|
|
2062
|
+
const t = await this.getAllBackgrounds();
|
|
2063
|
+
return H(
|
|
2064
|
+
le(
|
|
2065
|
+
e,
|
|
2066
|
+
t,
|
|
2067
|
+
(a) => a.ornamentId,
|
|
2068
|
+
(a) => a.odd ?? 0
|
|
2069
|
+
),
|
|
2070
|
+
(a) => a.price ?? 0
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
pickEachRarityOrnament(e, t) {
|
|
2074
|
+
if (t.length !== he.length)
|
|
2075
|
+
throw new RangeError(
|
|
2076
|
+
"pickEachRarityOrnament - must give same number of odds than ranks"
|
|
2077
|
+
);
|
|
2078
|
+
return _(
|
|
2079
|
+
t.map((a, r) => {
|
|
2080
|
+
const s = he[r], i = e[s];
|
|
2081
|
+
return Math.random() > a || !i || !i.length ? null : rt(i);
|
|
2082
|
+
})
|
|
2083
|
+
);
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
const $n = new o(
|
|
2087
|
+
{
|
|
2088
|
+
ornamentId: { unique: !0, index: 1, required: !0, type: String },
|
|
2089
|
+
type: { required: !0, type: String },
|
|
2090
|
+
rankId: { required: !0, type: String },
|
|
2091
|
+
name: { required: !0, type: String },
|
|
2092
|
+
price: Number,
|
|
2093
|
+
odd: Number,
|
|
2094
|
+
size: Number,
|
|
2095
|
+
faction: String,
|
|
2096
|
+
roleId: String,
|
|
2097
|
+
strength: Number
|
|
2098
|
+
},
|
|
2099
|
+
{ minimize: !1 }
|
|
2100
|
+
), pe = d?.Ornaments || p("Ornaments", $n), In = async (n, e) => pe.find(n, {}, e).lean();
|
|
2101
|
+
async function En(n) {
|
|
2102
|
+
const e = await pe.findOne({ ornamentId: n }).lean();
|
|
2103
|
+
return e || null;
|
|
2104
|
+
}
|
|
2105
|
+
const Un = (n, e) => pe.findOneAndUpdate(n, e, {
|
|
2106
|
+
returnDocument: "after"
|
|
2107
|
+
}).lean();
|
|
2108
|
+
class Dn extends bn {
|
|
2109
|
+
constructor() {
|
|
2110
|
+
super(3600);
|
|
2809
2111
|
}
|
|
2810
2112
|
updateInDb(e, t) {
|
|
2811
|
-
return
|
|
2113
|
+
return Un(e, t);
|
|
2114
|
+
}
|
|
2115
|
+
fetchFromDb(e) {
|
|
2116
|
+
return En(e);
|
|
2117
|
+
}
|
|
2118
|
+
fetchManyFromDb(e, t) {
|
|
2119
|
+
return In(e, t);
|
|
2120
|
+
}
|
|
2121
|
+
getKey(e) {
|
|
2122
|
+
return e.ornamentId;
|
|
2123
|
+
}
|
|
2124
|
+
normalizeKey(e) {
|
|
2125
|
+
return e;
|
|
2812
2126
|
}
|
|
2813
2127
|
}
|
|
2814
|
-
const
|
|
2815
|
-
class
|
|
2128
|
+
const g = new Dn();
|
|
2129
|
+
class Tn extends f {
|
|
2816
2130
|
async unlockTitle(e, t) {
|
|
2817
2131
|
await g.isOrnamentIds([t], g.isTitle) && await this.update(e, { $addToSet: { unlockedTitles: t } });
|
|
2818
2132
|
}
|
|
@@ -2845,9 +2159,9 @@ class xr extends f {
|
|
|
2845
2159
|
$set: { selectedBackground: t }
|
|
2846
2160
|
});
|
|
2847
2161
|
}
|
|
2848
|
-
async unlockBadge(e, t,
|
|
2162
|
+
async unlockBadge(e, t, a) {
|
|
2849
2163
|
t.isProgressive ? await this.update(e, {
|
|
2850
|
-
$addToSet: { unlockedBadges: `${t.id}_${
|
|
2164
|
+
$addToSet: { unlockedBadges: `${t.id}_${a}` }
|
|
2851
2165
|
}) : await this.update(e, {
|
|
2852
2166
|
$addToSet: { unlockedBadges: t.id }
|
|
2853
2167
|
});
|
|
@@ -2881,18 +2195,18 @@ class xr extends f {
|
|
|
2881
2195
|
});
|
|
2882
2196
|
}
|
|
2883
2197
|
}
|
|
2884
|
-
const
|
|
2198
|
+
const On = async (n) => await X.create({
|
|
2885
2199
|
user: n
|
|
2886
2200
|
});
|
|
2887
|
-
async function
|
|
2888
|
-
const e = await
|
|
2889
|
-
return e || y(await
|
|
2201
|
+
async function vn(n) {
|
|
2202
|
+
const e = await X.findOne({ user: n }).lean();
|
|
2203
|
+
return e || y(await On(n));
|
|
2890
2204
|
}
|
|
2891
|
-
const
|
|
2205
|
+
const Bn = async (n, e) => X.findOneAndUpdate({ user: n }, e, {
|
|
2892
2206
|
upsert: !0,
|
|
2893
2207
|
returnDocument: "after"
|
|
2894
2208
|
}).lean();
|
|
2895
|
-
class
|
|
2209
|
+
class Mn extends Tn {
|
|
2896
2210
|
constructor() {
|
|
2897
2211
|
super(300);
|
|
2898
2212
|
}
|
|
@@ -2903,14 +2217,14 @@ class Nr extends xr {
|
|
|
2903
2217
|
return e;
|
|
2904
2218
|
}
|
|
2905
2219
|
fetchFromDb(e) {
|
|
2906
|
-
return
|
|
2220
|
+
return vn(e);
|
|
2907
2221
|
}
|
|
2908
2222
|
updateInDb(e, t) {
|
|
2909
|
-
return
|
|
2223
|
+
return Bn(e, t);
|
|
2910
2224
|
}
|
|
2911
2225
|
}
|
|
2912
|
-
const
|
|
2913
|
-
class
|
|
2226
|
+
const L = new Mn();
|
|
2227
|
+
class kn extends w {
|
|
2914
2228
|
async getStatus(e, t) {
|
|
2915
2229
|
return (await this.get({ user: e, questId: t })).status;
|
|
2916
2230
|
}
|
|
@@ -2918,21 +2232,21 @@ class Fr extends b {
|
|
|
2918
2232
|
return await this.getStatus(e, t) === "COMPLETED";
|
|
2919
2233
|
}
|
|
2920
2234
|
async isStreaking(e, t) {
|
|
2921
|
-
const { lastCompletionDate:
|
|
2922
|
-
return !!
|
|
2235
|
+
const { lastCompletionDate: a } = await this.get({ user: e, questId: t });
|
|
2236
|
+
return !!a && Ue(K(), a);
|
|
2923
2237
|
}
|
|
2924
2238
|
async getStreakMultiplier(e, t) {
|
|
2925
|
-
const
|
|
2926
|
-
return await this.isStreaking(e, t) ? 1 + Math.min(2, (
|
|
2239
|
+
const a = await this.get({ user: e, questId: t });
|
|
2240
|
+
return await this.isStreaking(e, t) ? 1 + Math.min(2, (a.streak ?? 0) / 10) : 1;
|
|
2927
2241
|
}
|
|
2928
2242
|
async getCompletedCount(e) {
|
|
2929
|
-
return (await this.getMany({ user: e, status:
|
|
2243
|
+
return (await this.getMany({ user: e, status: M.COMPLETED })).length;
|
|
2930
2244
|
}
|
|
2931
2245
|
async completeQuest(e, t = !1) {
|
|
2932
|
-
const
|
|
2933
|
-
|
|
2934
|
-
const
|
|
2935
|
-
return
|
|
2246
|
+
const a = K();
|
|
2247
|
+
a.setHours(0, 0, 0, 0);
|
|
2248
|
+
const r = /* @__PURE__ */ new Date();
|
|
2249
|
+
return r.setHours(0, 0, 0, 0), this.update(
|
|
2936
2250
|
e,
|
|
2937
2251
|
[
|
|
2938
2252
|
{
|
|
@@ -2942,8 +2256,8 @@ class Fr extends b {
|
|
|
2942
2256
|
$cond: {
|
|
2943
2257
|
if: {
|
|
2944
2258
|
$and: [
|
|
2945
|
-
{ $gte: ["$lastCompletionDate",
|
|
2946
|
-
{ $lt: ["$lastCompletionDate",
|
|
2259
|
+
{ $gte: ["$lastCompletionDate", a] },
|
|
2260
|
+
{ $lt: ["$lastCompletionDate", r] }
|
|
2947
2261
|
]
|
|
2948
2262
|
},
|
|
2949
2263
|
then: { $add: [{ $ifNull: ["$streak", 0] }, 1] },
|
|
@@ -2952,7 +2266,7 @@ class Fr extends b {
|
|
|
2952
2266
|
}
|
|
2953
2267
|
} : {},
|
|
2954
2268
|
lastCompletionDate: /* @__PURE__ */ new Date(),
|
|
2955
|
-
status:
|
|
2269
|
+
status: M.COMPLETED
|
|
2956
2270
|
}
|
|
2957
2271
|
}
|
|
2958
2272
|
],
|
|
@@ -2960,24 +2274,24 @@ class Fr extends b {
|
|
|
2960
2274
|
);
|
|
2961
2275
|
}
|
|
2962
2276
|
}
|
|
2963
|
-
function
|
|
2964
|
-
return
|
|
2277
|
+
function An(n) {
|
|
2278
|
+
return q.find(n).lean();
|
|
2965
2279
|
}
|
|
2966
|
-
const
|
|
2280
|
+
const qn = async (n) => await q.create({
|
|
2967
2281
|
...n
|
|
2968
2282
|
});
|
|
2969
|
-
async function
|
|
2970
|
-
const e = await
|
|
2971
|
-
return e || y(await
|
|
2283
|
+
async function Rn(n) {
|
|
2284
|
+
const e = await q.findOne(n).lean();
|
|
2285
|
+
return e || y(await qn(n));
|
|
2972
2286
|
}
|
|
2973
|
-
function
|
|
2974
|
-
return
|
|
2287
|
+
function xn(n, e, t) {
|
|
2288
|
+
return q.findOneAndUpdate(n, e, {
|
|
2975
2289
|
upsert: !0,
|
|
2976
2290
|
...t,
|
|
2977
2291
|
returnDocument: "after"
|
|
2978
2292
|
}).lean();
|
|
2979
2293
|
}
|
|
2980
|
-
class
|
|
2294
|
+
class _n extends kn {
|
|
2981
2295
|
constructor() {
|
|
2982
2296
|
super(3600);
|
|
2983
2297
|
}
|
|
@@ -2991,94 +2305,139 @@ class Hr extends Fr {
|
|
|
2991
2305
|
return { user: e, questId: t };
|
|
2992
2306
|
}
|
|
2993
2307
|
fetchFromDb(e) {
|
|
2994
|
-
return
|
|
2308
|
+
return Rn(e);
|
|
2995
2309
|
}
|
|
2996
2310
|
fetchManyFromDb(e) {
|
|
2997
|
-
return
|
|
2311
|
+
return An(e);
|
|
2312
|
+
}
|
|
2313
|
+
updateInDb(e, t, a) {
|
|
2314
|
+
return xn(e, t, a);
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
const we = new _n();
|
|
2318
|
+
class Cn extends f {
|
|
2319
|
+
async randomMessageIncrement(e) {
|
|
2320
|
+
await this.update(e, { $inc: { randomMessageClaimed: 1 } });
|
|
2321
|
+
}
|
|
2322
|
+
async addWrittenTextChannel(e, t) {
|
|
2323
|
+
await this.update(e, {
|
|
2324
|
+
$addToSet: { writeDifferentChatIds: t }
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
async incrementMessageSend(e) {
|
|
2328
|
+
await this.update(e, {
|
|
2329
|
+
$inc: { messageSent: 1 }
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
async addTotalMinutesInVoice(e, t) {
|
|
2333
|
+
await this.update(e, { $inc: { totalMinutesInVoice: t } });
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
const Nn = async (n) => await ee.create({
|
|
2337
|
+
user: n
|
|
2338
|
+
});
|
|
2339
|
+
async function Fn(n) {
|
|
2340
|
+
const e = await ee.findOne({ user: n }).lean();
|
|
2341
|
+
return e || y(await Nn(n));
|
|
2342
|
+
}
|
|
2343
|
+
const zn = (n, e) => ee.findOneAndUpdate({ user: n }, e, {
|
|
2344
|
+
upsert: !0,
|
|
2345
|
+
returnDocument: "after"
|
|
2346
|
+
}).lean();
|
|
2347
|
+
class jn extends Cn {
|
|
2348
|
+
constructor() {
|
|
2349
|
+
super(300);
|
|
2350
|
+
}
|
|
2351
|
+
normalizeKey(e) {
|
|
2352
|
+
return e.toString();
|
|
2353
|
+
}
|
|
2354
|
+
getKey({
|
|
2355
|
+
user: e
|
|
2356
|
+
}) {
|
|
2357
|
+
return e;
|
|
2358
|
+
}
|
|
2359
|
+
fetchFromDb(e) {
|
|
2360
|
+
return Fn(e);
|
|
2998
2361
|
}
|
|
2999
|
-
updateInDb(e, t
|
|
3000
|
-
return
|
|
2362
|
+
updateInDb(e, t) {
|
|
2363
|
+
return zn(e, t);
|
|
3001
2364
|
}
|
|
3002
2365
|
}
|
|
3003
|
-
const
|
|
3004
|
-
class
|
|
2366
|
+
const Se = new jn();
|
|
2367
|
+
class Hn extends f {
|
|
3005
2368
|
async updateDailyReport(e) {
|
|
3006
|
-
const t = await
|
|
2369
|
+
const t = await U.get(e), a = await L.get(e), r = await we.getMany({
|
|
3007
2370
|
user: e,
|
|
3008
|
-
status:
|
|
3009
|
-
});
|
|
2371
|
+
status: M.COMPLETED
|
|
2372
|
+
}), s = await Se.get(e);
|
|
3010
2373
|
await this.update(e, {
|
|
3011
2374
|
$set: {
|
|
3012
2375
|
xpYesterday: t.xp.amount,
|
|
3013
2376
|
berryYesterday: t.berry,
|
|
3014
|
-
previousCompletedQuest:
|
|
3015
|
-
({ questId:
|
|
2377
|
+
previousCompletedQuest: r.map(
|
|
2378
|
+
({ questId: i }) => i
|
|
3016
2379
|
),
|
|
3017
|
-
"previousOrnament.unlockedBadges":
|
|
3018
|
-
"previousOrnament.unlockedTitles":
|
|
3019
|
-
"previousOrnament.unlockedBackgrounds":
|
|
3020
|
-
|
|
3021
|
-
// previousMessageSent: user.questMeta.messageSent,
|
|
2380
|
+
"previousOrnament.unlockedBadges": a.unlockedBadges,
|
|
2381
|
+
"previousOrnament.unlockedTitles": a.unlockedTitles,
|
|
2382
|
+
"previousOrnament.unlockedBackgrounds": a.unlockedBackgrounds,
|
|
2383
|
+
previousMessageSent: s.messageSent
|
|
3022
2384
|
}
|
|
3023
2385
|
});
|
|
3024
2386
|
}
|
|
3025
2387
|
async getDailyReport(e) {
|
|
3026
|
-
const
|
|
3027
|
-
previousOrnament:
|
|
2388
|
+
const {
|
|
2389
|
+
previousOrnament: t,
|
|
3028
2390
|
previousCompletedQuest: a,
|
|
3029
|
-
xpYesterday:
|
|
3030
|
-
berryYesterday:
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
return;
|
|
3034
|
-
const o = await I.get(e), c = await Me.getMany({
|
|
2391
|
+
xpYesterday: r,
|
|
2392
|
+
berryYesterday: s,
|
|
2393
|
+
previousMessageSent: i
|
|
2394
|
+
} = await this.get(e), c = await U.get(e), u = await we.getMany({
|
|
3035
2395
|
user: e,
|
|
3036
|
-
status:
|
|
3037
|
-
}),
|
|
2396
|
+
status: M.COMPLETED
|
|
2397
|
+
}), 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
2398
|
return {
|
|
3039
|
-
berry:
|
|
3040
|
-
xp:
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
c.map(({ questId: ct }) => ct),
|
|
2399
|
+
berry: D - s,
|
|
2400
|
+
xp: Ce - r,
|
|
2401
|
+
message: R.messageSent - i,
|
|
2402
|
+
voice: Ue(me.lastConnection, K()) ? me.minutesInVoiceToday : 0,
|
|
2403
|
+
quest: j(
|
|
2404
|
+
u.map(({ questId: je }) => je),
|
|
3046
2405
|
a
|
|
3047
2406
|
),
|
|
3048
|
-
badge:
|
|
3049
|
-
title:
|
|
3050
|
-
background:
|
|
3051
|
-
|
|
3052
|
-
|
|
2407
|
+
badge: j(Ne, t.unlockedBadges),
|
|
2408
|
+
title: j(ze, t.unlockedTitles),
|
|
2409
|
+
background: j(
|
|
2410
|
+
Fe,
|
|
2411
|
+
t.unlockedBackgrounds
|
|
3053
2412
|
)
|
|
3054
2413
|
};
|
|
3055
2414
|
}
|
|
3056
2415
|
async getAllDailyReportsToSend() {
|
|
3057
|
-
const e = await
|
|
3058
|
-
|
|
2416
|
+
const e = await _e.getUsersWithDailyReportEnable(), t = await bt.getMany({
|
|
2417
|
+
_id: { $in: e.map(({ user: a }) => a) },
|
|
3059
2418
|
faction: { $ne: "citizen" }
|
|
3060
2419
|
});
|
|
3061
2420
|
return await Promise.all(
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
user:
|
|
2421
|
+
t.map(async ({ _id: a, discordId: r }) => ({
|
|
2422
|
+
report: await this.getDailyReport(a),
|
|
2423
|
+
user: a,
|
|
3065
2424
|
discordId: r
|
|
3066
2425
|
}))
|
|
3067
2426
|
);
|
|
3068
2427
|
}
|
|
3069
2428
|
}
|
|
3070
|
-
const
|
|
2429
|
+
const Kn = (n) => W.create({
|
|
3071
2430
|
user: n
|
|
3072
2431
|
});
|
|
3073
|
-
async function
|
|
3074
|
-
const e = await
|
|
3075
|
-
return e || y(await
|
|
2432
|
+
async function Pn(n) {
|
|
2433
|
+
const e = await W.findOne({ user: n }).lean();
|
|
2434
|
+
return e || y(await Kn(n));
|
|
3076
2435
|
}
|
|
3077
|
-
const
|
|
2436
|
+
const Ln = (n, e) => W.findOneAndUpdate({ user: n }, e, {
|
|
3078
2437
|
upsert: !0,
|
|
3079
2438
|
returnDocument: "after"
|
|
3080
2439
|
}).lean();
|
|
3081
|
-
class
|
|
2440
|
+
class Qn extends Hn {
|
|
3082
2441
|
constructor() {
|
|
3083
2442
|
super(60);
|
|
3084
2443
|
}
|
|
@@ -3089,21 +2448,21 @@ class Yr extends Lr {
|
|
|
3089
2448
|
return e.user;
|
|
3090
2449
|
}
|
|
3091
2450
|
fetchFromDb(e) {
|
|
3092
|
-
return
|
|
2451
|
+
return Pn(e);
|
|
3093
2452
|
}
|
|
3094
2453
|
updateInDb(e, t) {
|
|
3095
|
-
return
|
|
2454
|
+
return Ln(e, t);
|
|
3096
2455
|
}
|
|
3097
2456
|
}
|
|
3098
|
-
const
|
|
3099
|
-
class
|
|
3100
|
-
async setGuessGame(e, t,
|
|
2457
|
+
const Fr = new Qn();
|
|
2458
|
+
class Wn extends f {
|
|
2459
|
+
async setGuessGame(e, t, a, r) {
|
|
3101
2460
|
await this.update(e, {
|
|
3102
2461
|
$set: {
|
|
3103
2462
|
guess: {
|
|
3104
2463
|
amount: t,
|
|
3105
|
-
tries:
|
|
3106
|
-
numberToGuess:
|
|
2464
|
+
tries: a,
|
|
2465
|
+
numberToGuess: r,
|
|
3107
2466
|
lastGuess: 0
|
|
3108
2467
|
}
|
|
3109
2468
|
}
|
|
@@ -3127,18 +2486,18 @@ class Xr extends f {
|
|
|
3127
2486
|
});
|
|
3128
2487
|
}
|
|
3129
2488
|
}
|
|
3130
|
-
const
|
|
2489
|
+
const Gn = async (n) => await Y.create({
|
|
3131
2490
|
user: n
|
|
3132
2491
|
});
|
|
3133
|
-
async function
|
|
3134
|
-
const e = await
|
|
3135
|
-
return e || y(await
|
|
2492
|
+
async function Yn(n) {
|
|
2493
|
+
const e = await Y.findOne({ user: n }).lean();
|
|
2494
|
+
return e || y(await Gn(n));
|
|
3136
2495
|
}
|
|
3137
|
-
const
|
|
2496
|
+
const Vn = (n, e) => Y.findOneAndUpdate({ user: n }, e, {
|
|
3138
2497
|
upsert: !0,
|
|
3139
2498
|
returnDocument: "after"
|
|
3140
2499
|
}).lean();
|
|
3141
|
-
class
|
|
2500
|
+
class Xn extends Wn {
|
|
3142
2501
|
constructor() {
|
|
3143
2502
|
super(300);
|
|
3144
2503
|
}
|
|
@@ -3149,122 +2508,15 @@ class ea extends Xr {
|
|
|
3149
2508
|
return e;
|
|
3150
2509
|
}
|
|
3151
2510
|
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);
|
|
2511
|
+
return Yn(e);
|
|
3260
2512
|
}
|
|
3261
2513
|
updateInDb(e, t) {
|
|
3262
|
-
return
|
|
2514
|
+
return Vn(e, t);
|
|
3263
2515
|
}
|
|
3264
2516
|
}
|
|
3265
|
-
const
|
|
2517
|
+
const zr = new Xn(), Jn = new o({
|
|
3266
2518
|
user: {
|
|
3267
|
-
type:
|
|
2519
|
+
type: o.Types.ObjectId,
|
|
3268
2520
|
required: !0,
|
|
3269
2521
|
unique: !0,
|
|
3270
2522
|
ref: "User"
|
|
@@ -3272,10 +2524,10 @@ const ui = new sa(), ia = new u({
|
|
|
3272
2524
|
xp: { type: Number, default: 0 },
|
|
3273
2525
|
berry: { type: Number, default: 0 },
|
|
3274
2526
|
faction: { type: Number, default: 0 }
|
|
3275
|
-
}),
|
|
3276
|
-
class
|
|
2527
|
+
}), B = d?.UserRank || p("UserRank", Jn);
|
|
2528
|
+
class Zn extends f {
|
|
3277
2529
|
async computeAllXpRanks() {
|
|
3278
|
-
const t = (await
|
|
2530
|
+
const t = (await O.aggregate([
|
|
3279
2531
|
{
|
|
3280
2532
|
$setWindowFields: {
|
|
3281
2533
|
sortBy: { "xp.amount": -1 },
|
|
@@ -3283,17 +2535,17 @@ class ua extends f {
|
|
|
3283
2535
|
}
|
|
3284
2536
|
},
|
|
3285
2537
|
{ $project: { user: 1, xpRank: 1 } }
|
|
3286
|
-
])).map(({ user:
|
|
2538
|
+
])).map(({ user: a, xpRank: r }) => ({
|
|
3287
2539
|
updateOne: {
|
|
3288
|
-
filter: { user:
|
|
3289
|
-
update: { $set: { xp:
|
|
2540
|
+
filter: { user: a },
|
|
2541
|
+
update: { $set: { xp: r } },
|
|
3290
2542
|
upsert: !0
|
|
3291
2543
|
}
|
|
3292
2544
|
}));
|
|
3293
|
-
t.length > 0 && await
|
|
2545
|
+
t.length > 0 && await B.bulkWrite(t), this.clearAll();
|
|
3294
2546
|
}
|
|
3295
2547
|
async computeAllBerryRanks() {
|
|
3296
|
-
const t = (await
|
|
2548
|
+
const t = (await O.aggregate([
|
|
3297
2549
|
{
|
|
3298
2550
|
$setWindowFields: {
|
|
3299
2551
|
sortBy: { berry: -1 },
|
|
@@ -3301,14 +2553,14 @@ class ua extends f {
|
|
|
3301
2553
|
}
|
|
3302
2554
|
},
|
|
3303
2555
|
{ $project: { user: 1, berryRank: 1 } }
|
|
3304
|
-
])).map(({ user:
|
|
2556
|
+
])).map(({ user: a, berryRank: r }) => ({
|
|
3305
2557
|
updateOne: {
|
|
3306
|
-
filter: { user:
|
|
3307
|
-
update: { $set: { berry:
|
|
2558
|
+
filter: { user: a },
|
|
2559
|
+
update: { $set: { berry: r } },
|
|
3308
2560
|
upsert: !0
|
|
3309
2561
|
}
|
|
3310
2562
|
}));
|
|
3311
|
-
t.length > 0 && await
|
|
2563
|
+
t.length > 0 && await B.bulkWrite(t), this.clearAll();
|
|
3312
2564
|
}
|
|
3313
2565
|
async computeAllFactionRanks() {
|
|
3314
2566
|
const t = (await $.aggregate([
|
|
@@ -3329,14 +2581,14 @@ class ua extends f {
|
|
|
3329
2581
|
}
|
|
3330
2582
|
},
|
|
3331
2583
|
{ $project: { factionRank: 1 } }
|
|
3332
|
-
])).map(({ _id:
|
|
2584
|
+
])).map(({ _id: a, factionRank: r }) => ({
|
|
3333
2585
|
updateOne: {
|
|
3334
|
-
filter: { user:
|
|
3335
|
-
update: { $set: { faction:
|
|
2586
|
+
filter: { user: a },
|
|
2587
|
+
update: { $set: { faction: r } },
|
|
3336
2588
|
upsert: !0
|
|
3337
2589
|
}
|
|
3338
2590
|
}));
|
|
3339
|
-
t.length > 0 && await
|
|
2591
|
+
t.length > 0 && await B.bulkWrite(t), this.clearAll();
|
|
3340
2592
|
}
|
|
3341
2593
|
async computeAllRanks() {
|
|
3342
2594
|
await Promise.all([
|
|
@@ -3346,18 +2598,18 @@ class ua extends f {
|
|
|
3346
2598
|
]);
|
|
3347
2599
|
}
|
|
3348
2600
|
}
|
|
3349
|
-
const
|
|
2601
|
+
const ea = async (n) => await B.create({
|
|
3350
2602
|
user: n
|
|
3351
2603
|
});
|
|
3352
|
-
async function
|
|
3353
|
-
const e = await
|
|
3354
|
-
return e || y(await
|
|
2604
|
+
async function ta(n) {
|
|
2605
|
+
const e = await B.findOne({ user: n }).lean();
|
|
2606
|
+
return e || y(await ea(n));
|
|
3355
2607
|
}
|
|
3356
|
-
const
|
|
2608
|
+
const na = (n, e) => B.findOneAndUpdate({ user: n }, e, {
|
|
3357
2609
|
returnDocument: "after",
|
|
3358
2610
|
upsert: !0
|
|
3359
2611
|
}).lean();
|
|
3360
|
-
class
|
|
2612
|
+
class aa extends Zn {
|
|
3361
2613
|
constructor() {
|
|
3362
2614
|
super(300);
|
|
3363
2615
|
}
|
|
@@ -3368,32 +2620,32 @@ class la extends ua {
|
|
|
3368
2620
|
return e.user;
|
|
3369
2621
|
}
|
|
3370
2622
|
fetchFromDb(e) {
|
|
3371
|
-
return
|
|
2623
|
+
return ta(e);
|
|
3372
2624
|
}
|
|
3373
2625
|
updateInDb(e, t) {
|
|
3374
|
-
return
|
|
2626
|
+
return na(e, t);
|
|
3375
2627
|
}
|
|
3376
2628
|
}
|
|
3377
|
-
const
|
|
3378
|
-
class
|
|
3379
|
-
async isBuyLimitReached(e, t,
|
|
3380
|
-
const
|
|
3381
|
-
if (await
|
|
2629
|
+
const jr = new aa();
|
|
2630
|
+
class ra extends f {
|
|
2631
|
+
async isBuyLimitReached(e, t, a) {
|
|
2632
|
+
const r = await l.getAllEntitiesLimit();
|
|
2633
|
+
if (await l.isEntityId(t, l.isEquipment))
|
|
3382
2634
|
return !1;
|
|
3383
2635
|
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
|
|
2636
|
+
let c = r[t];
|
|
2637
|
+
const u = await m.hasRevolutionaryBuff(e);
|
|
2638
|
+
return s.lastShopId !== a ? !1 : (u === "half" && t === "chest_2" && (c += 2), u === "full" && t === "chest_3" && (c += 1), !!(c && i && i >= c));
|
|
2639
|
+
}
|
|
2640
|
+
async getShopItemRest(e, t, a, r = Ze) {
|
|
2641
|
+
const s = await l.getAllEntitiesLimit();
|
|
2642
|
+
if (await l.isEntityId(t, l.isEquipment))
|
|
2643
|
+
return r;
|
|
3392
2644
|
let i = s[t];
|
|
3393
|
-
const
|
|
3394
|
-
return
|
|
2645
|
+
const c = await this.get(e), u = c.limit?.[t], h = await m.hasRevolutionaryBuff(e);
|
|
2646
|
+
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
2647
|
}
|
|
3396
|
-
async increaseBuyLimit(e, t,
|
|
2648
|
+
async increaseBuyLimit(e, t, a, r) {
|
|
3397
2649
|
await this.update(e, [
|
|
3398
2650
|
{
|
|
3399
2651
|
$set: {
|
|
@@ -3402,15 +2654,15 @@ class pa extends f {
|
|
|
3402
2654
|
if: { $eq: ["$lastShopId", t] },
|
|
3403
2655
|
then: {
|
|
3404
2656
|
$setField: {
|
|
3405
|
-
field:
|
|
2657
|
+
field: a,
|
|
3406
2658
|
input: { $ifNull: ["$limit", {}] },
|
|
3407
2659
|
value: {
|
|
3408
|
-
$add: [{ $ifNull: [`$limit.${
|
|
2660
|
+
$add: [{ $ifNull: [`$limit.${a}`, 0] }, r]
|
|
3409
2661
|
}
|
|
3410
2662
|
}
|
|
3411
2663
|
},
|
|
3412
2664
|
else: {
|
|
3413
|
-
[
|
|
2665
|
+
[a]: r
|
|
3414
2666
|
}
|
|
3415
2667
|
}
|
|
3416
2668
|
},
|
|
@@ -3420,16 +2672,16 @@ class pa extends f {
|
|
|
3420
2672
|
]);
|
|
3421
2673
|
}
|
|
3422
2674
|
}
|
|
3423
|
-
const
|
|
2675
|
+
const sa = async (n) => await J.create({
|
|
3424
2676
|
user: n
|
|
3425
|
-
}),
|
|
3426
|
-
const e = await
|
|
3427
|
-
return e || y(await
|
|
3428
|
-
},
|
|
2677
|
+
}), ia = async (n) => {
|
|
2678
|
+
const e = await J.findOne({ user: n }).lean();
|
|
2679
|
+
return e || y(await sa(n));
|
|
2680
|
+
}, ua = (n, e) => J.findOneAndUpdate({ user: n }, e, {
|
|
3429
2681
|
upsert: !0,
|
|
3430
2682
|
returnDocument: "after"
|
|
3431
2683
|
}).lean();
|
|
3432
|
-
class
|
|
2684
|
+
class oa extends ra {
|
|
3433
2685
|
constructor() {
|
|
3434
2686
|
super(300);
|
|
3435
2687
|
}
|
|
@@ -3440,14 +2692,14 @@ class ha extends pa {
|
|
|
3440
2692
|
return e;
|
|
3441
2693
|
}
|
|
3442
2694
|
fetchFromDb(e) {
|
|
3443
|
-
return
|
|
2695
|
+
return ia(e);
|
|
3444
2696
|
}
|
|
3445
2697
|
updateInDb(e, t) {
|
|
3446
|
-
return
|
|
2698
|
+
return ua(e, t);
|
|
3447
2699
|
}
|
|
3448
2700
|
}
|
|
3449
|
-
const
|
|
3450
|
-
class
|
|
2701
|
+
const Hr = new oa();
|
|
2702
|
+
class ca extends f {
|
|
3451
2703
|
async didSevenDoubleAtDoQ(e) {
|
|
3452
2704
|
await this.update(e, {
|
|
3453
2705
|
$inc: { "doubleOrQuit.sevenDoubleInARowCount": 1 }
|
|
@@ -3456,11 +2708,11 @@ class wa extends f {
|
|
|
3456
2708
|
async winWithBlackjack(e) {
|
|
3457
2709
|
await this.update(e, { $inc: { "blackJack.blackJackCount": 1 } });
|
|
3458
2710
|
}
|
|
3459
|
-
async updateLastGames(e, t,
|
|
2711
|
+
async updateLastGames(e, t, a) {
|
|
3460
2712
|
await this.update(e, {
|
|
3461
2713
|
$push: {
|
|
3462
2714
|
lastGames: {
|
|
3463
|
-
$each: [{ gameType: t, endState:
|
|
2715
|
+
$each: [{ gameType: t, endState: a }],
|
|
3464
2716
|
$position: 0,
|
|
3465
2717
|
$slice: 20
|
|
3466
2718
|
}
|
|
@@ -3471,19 +2723,19 @@ class wa extends f {
|
|
|
3471
2723
|
await this.update(e, { $inc: { drawCount: 1 } });
|
|
3472
2724
|
}
|
|
3473
2725
|
async bet666(e) {
|
|
3474
|
-
const t =
|
|
2726
|
+
const t = K();
|
|
3475
2727
|
t.setHours(0, 0, 0, 0);
|
|
3476
|
-
const
|
|
3477
|
-
|
|
2728
|
+
const a = /* @__PURE__ */ new Date();
|
|
2729
|
+
a.setHours(0, 0, 0, 0), await k.updateOne(
|
|
3478
2730
|
{
|
|
3479
2731
|
user: e,
|
|
3480
2732
|
"bet666.last": {
|
|
3481
2733
|
$gte: t,
|
|
3482
|
-
$lt:
|
|
2734
|
+
$lt: a
|
|
3483
2735
|
}
|
|
3484
2736
|
},
|
|
3485
2737
|
{ $inc: { "bet666.count": 1 }, $set: { "bet666.last": /* @__PURE__ */ new Date() } }
|
|
3486
|
-
), await
|
|
2738
|
+
), await k.updateOne(
|
|
3487
2739
|
{
|
|
3488
2740
|
user: e,
|
|
3489
2741
|
"bet666.last": {
|
|
@@ -3526,69 +2778,18 @@ class wa extends f {
|
|
|
3526
2778
|
await this.update(e, { $inc: { "dice.drawWithDoubleSixCount": 1 } });
|
|
3527
2779
|
}
|
|
3528
2780
|
}
|
|
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({
|
|
2781
|
+
const la = async (n) => await k.create({
|
|
3581
2782
|
user: n
|
|
3582
2783
|
});
|
|
3583
|
-
async function
|
|
3584
|
-
const e = await
|
|
3585
|
-
return e || y(await
|
|
2784
|
+
async function da(n) {
|
|
2785
|
+
const e = await k.findOne({ user: n }).lean();
|
|
2786
|
+
return e || y(await la(n));
|
|
3586
2787
|
}
|
|
3587
|
-
const
|
|
2788
|
+
const pa = (n, e) => k.findOneAndUpdate({ user: n }, e, {
|
|
3588
2789
|
upsert: !0,
|
|
3589
2790
|
returnDocument: "after"
|
|
3590
2791
|
}).lean();
|
|
3591
|
-
class
|
|
2792
|
+
class ya extends ca {
|
|
3592
2793
|
constructor() {
|
|
3593
2794
|
super(300);
|
|
3594
2795
|
}
|
|
@@ -3599,14 +2800,14 @@ class Oa extends Ea {
|
|
|
3599
2800
|
return e;
|
|
3600
2801
|
}
|
|
3601
2802
|
fetchFromDb(e) {
|
|
3602
|
-
return
|
|
2803
|
+
return da(e);
|
|
3603
2804
|
}
|
|
3604
2805
|
updateInDb(e, t) {
|
|
3605
|
-
return
|
|
2806
|
+
return pa(e, t);
|
|
3606
2807
|
}
|
|
3607
2808
|
}
|
|
3608
|
-
const
|
|
3609
|
-
class
|
|
2809
|
+
const Kr = new ya();
|
|
2810
|
+
class fa extends f {
|
|
3610
2811
|
async workIncrement(e) {
|
|
3611
2812
|
await this.update(e, { $inc: { workCount: 1 } });
|
|
3612
2813
|
}
|
|
@@ -3618,18 +2819,18 @@ class Ta extends f {
|
|
|
3618
2819
|
});
|
|
3619
2820
|
}
|
|
3620
2821
|
}
|
|
3621
|
-
const
|
|
2822
|
+
const ma = (n) => Z.create({
|
|
3622
2823
|
user: n
|
|
3623
2824
|
});
|
|
3624
|
-
async function
|
|
3625
|
-
const e = await
|
|
3626
|
-
return e || y(await
|
|
2825
|
+
async function ha(n) {
|
|
2826
|
+
const e = await Z.findOne({ user: n }).lean();
|
|
2827
|
+
return e || y(await ma(n));
|
|
3627
2828
|
}
|
|
3628
|
-
const
|
|
2829
|
+
const ga = (n, e) => Z.findOneAndUpdate({ user: n }, e, {
|
|
3629
2830
|
upsert: !0,
|
|
3630
2831
|
returnDocument: "after"
|
|
3631
2832
|
}).lean();
|
|
3632
|
-
class
|
|
2833
|
+
class wa extends fa {
|
|
3633
2834
|
constructor() {
|
|
3634
2835
|
super(300);
|
|
3635
2836
|
}
|
|
@@ -3640,63 +2841,14 @@ class Aa extends Ta {
|
|
|
3640
2841
|
return e;
|
|
3641
2842
|
}
|
|
3642
2843
|
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);
|
|
2844
|
+
return ha(e);
|
|
3693
2845
|
}
|
|
3694
2846
|
updateInDb(e, t) {
|
|
3695
|
-
return
|
|
2847
|
+
return ga(e, t);
|
|
3696
2848
|
}
|
|
3697
2849
|
}
|
|
3698
|
-
const
|
|
3699
|
-
class
|
|
2850
|
+
const Sa = new wa();
|
|
2851
|
+
class ba extends f {
|
|
3700
2852
|
async hasReportedSomeone(e) {
|
|
3701
2853
|
await this.update(e, { $set: { reportedSomeone: !0 } });
|
|
3702
2854
|
}
|
|
@@ -3727,18 +2879,18 @@ class Na extends f {
|
|
|
3727
2879
|
await this.update(e, { $set: { "gamblingFlags.lose10M": !0 } });
|
|
3728
2880
|
}
|
|
3729
2881
|
}
|
|
3730
|
-
const
|
|
2882
|
+
const $a = async (n) => await te.create({
|
|
3731
2883
|
user: n
|
|
3732
2884
|
});
|
|
3733
|
-
async function
|
|
3734
|
-
const e = await
|
|
3735
|
-
return e || y(await
|
|
2885
|
+
async function Ia(n) {
|
|
2886
|
+
const e = await te.findOne({ user: n }).lean();
|
|
2887
|
+
return e || y(await $a(n));
|
|
3736
2888
|
}
|
|
3737
|
-
const
|
|
2889
|
+
const Ea = (n, e) => te.findOneAndUpdate({ user: n }, e, {
|
|
3738
2890
|
upsert: !0,
|
|
3739
2891
|
returnDocument: "after"
|
|
3740
2892
|
}).lean();
|
|
3741
|
-
class
|
|
2893
|
+
class Ua extends ba {
|
|
3742
2894
|
constructor() {
|
|
3743
2895
|
super(300);
|
|
3744
2896
|
}
|
|
@@ -3749,17 +2901,17 @@ class Ka extends Na {
|
|
|
3749
2901
|
return e;
|
|
3750
2902
|
}
|
|
3751
2903
|
fetchFromDb(e) {
|
|
3752
|
-
return
|
|
2904
|
+
return Ia(e);
|
|
3753
2905
|
}
|
|
3754
2906
|
updateInDb(e, t) {
|
|
3755
|
-
return
|
|
2907
|
+
return Ea(e, t);
|
|
3756
2908
|
}
|
|
3757
2909
|
}
|
|
3758
|
-
const
|
|
3759
|
-
class
|
|
2910
|
+
const Pr = new Ua();
|
|
2911
|
+
class Da extends f {
|
|
3760
2912
|
async readEdito(e) {
|
|
3761
2913
|
const t = /* @__PURE__ */ new Date();
|
|
3762
|
-
t.setHours(0, 0, 0, 0), await
|
|
2914
|
+
t.setHours(0, 0, 0, 0), await T.updateOne(
|
|
3763
2915
|
{
|
|
3764
2916
|
user: e,
|
|
3765
2917
|
"edito.lastTimeRead": {
|
|
@@ -3770,7 +2922,7 @@ class Pa extends f {
|
|
|
3770
2922
|
$inc: { "edito.readToday": 1 },
|
|
3771
2923
|
$set: { "edito.lastTimeRead": /* @__PURE__ */ new Date() }
|
|
3772
2924
|
}
|
|
3773
|
-
), await
|
|
2925
|
+
), await T.updateOne(
|
|
3774
2926
|
{
|
|
3775
2927
|
user: e,
|
|
3776
2928
|
"edito.lastTimeRead": {
|
|
@@ -3782,19 +2934,31 @@ class Pa extends f {
|
|
|
3782
2934
|
}
|
|
3783
2935
|
), this.invalidate(e);
|
|
3784
2936
|
}
|
|
2937
|
+
async getTotalEditoReadToday() {
|
|
2938
|
+
const e = /* @__PURE__ */ new Date();
|
|
2939
|
+
return e.setHours(0, 0, 0, 0), (await T.aggregate([
|
|
2940
|
+
{
|
|
2941
|
+
$match: {
|
|
2942
|
+
"edito.lastTimeRead": { $gte: e },
|
|
2943
|
+
"edito.readToday": { $gt: 0 }
|
|
2944
|
+
}
|
|
2945
|
+
},
|
|
2946
|
+
{ $group: { _id: null, total: { $sum: "$edito.readToday" } } }
|
|
2947
|
+
]))[0]?.total ?? 0;
|
|
2948
|
+
}
|
|
3785
2949
|
}
|
|
3786
|
-
const
|
|
2950
|
+
const Ta = async (n) => await T.create({
|
|
3787
2951
|
user: n
|
|
3788
2952
|
});
|
|
3789
|
-
async function
|
|
3790
|
-
const e = await
|
|
3791
|
-
return e || y(await
|
|
2953
|
+
async function Oa(n) {
|
|
2954
|
+
const e = await T.findOne({ user: n }).lean();
|
|
2955
|
+
return e || y(await Ta(n));
|
|
3792
2956
|
}
|
|
3793
|
-
const
|
|
2957
|
+
const va = (n, e) => T.findOneAndUpdate({ user: n }, e, {
|
|
3794
2958
|
upsert: !0,
|
|
3795
2959
|
returnDocument: "after"
|
|
3796
2960
|
}).lean();
|
|
3797
|
-
class
|
|
2961
|
+
class Ba extends Da {
|
|
3798
2962
|
constructor() {
|
|
3799
2963
|
super(300);
|
|
3800
2964
|
}
|
|
@@ -3805,52 +2969,52 @@ class Wa extends Pa {
|
|
|
3805
2969
|
return e;
|
|
3806
2970
|
}
|
|
3807
2971
|
fetchFromDb(e) {
|
|
3808
|
-
return
|
|
2972
|
+
return Oa(e);
|
|
3809
2973
|
}
|
|
3810
2974
|
updateInDb(e, t) {
|
|
3811
|
-
return
|
|
2975
|
+
return va(e, t);
|
|
3812
2976
|
}
|
|
3813
2977
|
}
|
|
3814
|
-
const
|
|
3815
|
-
class
|
|
3816
|
-
async updateCraftStats(e, t,
|
|
3817
|
-
const
|
|
3818
|
-
!
|
|
2978
|
+
const Lr = new Ba();
|
|
2979
|
+
class Ma extends f {
|
|
2980
|
+
async updateCraftStats(e, t, a) {
|
|
2981
|
+
const r = await l.get(a);
|
|
2982
|
+
!r || !l.isItem(r) || await this.update(e, {
|
|
3819
2983
|
$inc: {
|
|
3820
|
-
"crafts.cookedMeal":
|
|
3821
|
-
"crafts.scrolls":
|
|
2984
|
+
"crafts.cookedMeal": l.isCookedMeal(r) ? t : 0,
|
|
2985
|
+
"crafts.scrolls": l.isScrollItem(r) ? t : 0,
|
|
3822
2986
|
"crafts.totalCrafted": t
|
|
3823
2987
|
}
|
|
3824
2988
|
});
|
|
3825
2989
|
}
|
|
3826
|
-
async incrementAlcoholDrink(e, t,
|
|
2990
|
+
async incrementAlcoholDrink(e, t, a) {
|
|
3827
2991
|
["wine", "beer", "rhum"].includes(t) && await this.update(e, {
|
|
3828
2992
|
$inc: {
|
|
3829
|
-
"alcohols.wines": t === "wine" ?
|
|
3830
|
-
"alcohols.beers": t === "beer" ?
|
|
3831
|
-
"alcohols.rhums": t === "rhum" ?
|
|
3832
|
-
"alcohols.totalConsumed":
|
|
2993
|
+
"alcohols.wines": t === "wine" ? a : 0,
|
|
2994
|
+
"alcohols.beers": t === "beer" ? a : 0,
|
|
2995
|
+
"alcohols.rhums": t === "rhum" ? a : 0,
|
|
2996
|
+
"alcohols.totalConsumed": a
|
|
3833
2997
|
}
|
|
3834
2998
|
});
|
|
3835
2999
|
}
|
|
3836
3000
|
async incrementBottleUsedToday(e, t) {
|
|
3837
|
-
const
|
|
3838
|
-
|
|
3001
|
+
const a = /* @__PURE__ */ new Date();
|
|
3002
|
+
a.setHours(0, 0, 0, 0), await A.updateOne(
|
|
3839
3003
|
{
|
|
3840
3004
|
user: e,
|
|
3841
3005
|
"bottle.lastUsed": {
|
|
3842
|
-
$gte:
|
|
3006
|
+
$gte: a
|
|
3843
3007
|
}
|
|
3844
3008
|
},
|
|
3845
3009
|
{
|
|
3846
3010
|
$inc: { "bottle.usedToday": t },
|
|
3847
3011
|
$set: { "bottle.lastUsed": /* @__PURE__ */ new Date() }
|
|
3848
3012
|
}
|
|
3849
|
-
), await
|
|
3013
|
+
), await A.updateOne(
|
|
3850
3014
|
{
|
|
3851
3015
|
user: e,
|
|
3852
3016
|
"bottle.lastUsed": {
|
|
3853
|
-
$lt:
|
|
3017
|
+
$lt: a
|
|
3854
3018
|
}
|
|
3855
3019
|
},
|
|
3856
3020
|
{
|
|
@@ -3872,18 +3036,18 @@ class Ga extends f {
|
|
|
3872
3036
|
});
|
|
3873
3037
|
}
|
|
3874
3038
|
}
|
|
3875
|
-
const
|
|
3039
|
+
const ka = async (n) => await A.create({
|
|
3876
3040
|
user: n
|
|
3877
3041
|
});
|
|
3878
|
-
async function
|
|
3879
|
-
const e = await
|
|
3880
|
-
return e || y(await
|
|
3042
|
+
async function Aa(n) {
|
|
3043
|
+
const e = await A.findOne({ user: n }).lean();
|
|
3044
|
+
return e || y(await ka(n));
|
|
3881
3045
|
}
|
|
3882
|
-
const
|
|
3046
|
+
const qa = (n, e) => A.findOneAndUpdate({ user: n }, e, {
|
|
3883
3047
|
upsert: !0,
|
|
3884
3048
|
returnDocument: "after"
|
|
3885
3049
|
}).lean();
|
|
3886
|
-
class
|
|
3050
|
+
class Ra extends Ma {
|
|
3887
3051
|
constructor() {
|
|
3888
3052
|
super(300);
|
|
3889
3053
|
}
|
|
@@ -3894,97 +3058,97 @@ class Ja extends Ga {
|
|
|
3894
3058
|
return e;
|
|
3895
3059
|
}
|
|
3896
3060
|
fetchFromDb(e) {
|
|
3897
|
-
return
|
|
3061
|
+
return Aa(e);
|
|
3898
3062
|
}
|
|
3899
3063
|
updateInDb(e, t) {
|
|
3900
|
-
return
|
|
3064
|
+
return qa(e, t);
|
|
3901
3065
|
}
|
|
3902
3066
|
}
|
|
3903
|
-
const
|
|
3904
|
-
class
|
|
3067
|
+
const Qr = new Ra();
|
|
3068
|
+
class xa extends w {
|
|
3905
3069
|
async maxCraftQuantity(e, t) {
|
|
3906
|
-
const
|
|
3907
|
-
let
|
|
3070
|
+
const a = await m.get(e);
|
|
3071
|
+
let r = 1 / 0;
|
|
3908
3072
|
for (const s of t)
|
|
3909
|
-
|
|
3910
|
-
|
|
3073
|
+
r = Math.min(
|
|
3074
|
+
r,
|
|
3911
3075
|
Math.floor(
|
|
3912
|
-
(
|
|
3076
|
+
(a.itemList[s.entityId] ?? 0) / s.size
|
|
3913
3077
|
)
|
|
3914
3078
|
);
|
|
3915
|
-
return
|
|
3079
|
+
return r;
|
|
3916
3080
|
}
|
|
3917
|
-
async hasEnoughItemsForRecipe(e, t,
|
|
3918
|
-
const
|
|
3081
|
+
async hasEnoughItemsForRecipe(e, t, a) {
|
|
3082
|
+
const r = await m.get(e);
|
|
3919
3083
|
for (const s of t.entities)
|
|
3920
|
-
if ((
|
|
3084
|
+
if ((r.itemList[s.entityId] ?? 0) < s.size * a)
|
|
3921
3085
|
return !1;
|
|
3922
3086
|
return !0;
|
|
3923
3087
|
}
|
|
3924
3088
|
decodeCraftId(e) {
|
|
3925
|
-
return e.split(";").map((t,
|
|
3089
|
+
return e.split(";").map((t, a) => ({
|
|
3926
3090
|
entityId: t === "null" ? null : t,
|
|
3927
|
-
index:
|
|
3091
|
+
index: a
|
|
3928
3092
|
}));
|
|
3929
3093
|
}
|
|
3930
3094
|
encodeCraftId(e) {
|
|
3931
3095
|
return e.map(({ entityId: t }) => `${t}`).join(";");
|
|
3932
3096
|
}
|
|
3933
3097
|
async isValidRecipe(e) {
|
|
3934
|
-
return !!(await this.getAll()).find((
|
|
3098
|
+
return !!(await this.getAll()).find((a) => a.craftId === e);
|
|
3935
3099
|
}
|
|
3936
3100
|
async getRecipeResult(e, t) {
|
|
3937
|
-
const
|
|
3101
|
+
const a = await m.get(e), r = (await E.getPanoplyBonus(a.equippedItems)).find(
|
|
3938
3102
|
([s, i]) => s.panoplyId === "little_blacksmith" && i !== null
|
|
3939
3103
|
);
|
|
3940
|
-
return
|
|
3104
|
+
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
3105
|
}
|
|
3942
3106
|
}
|
|
3943
|
-
const
|
|
3107
|
+
const _a = new o(
|
|
3944
3108
|
{
|
|
3945
3109
|
entityId: { type: String, required: !0 },
|
|
3946
3110
|
size: { type: Number, required: !0 }
|
|
3947
3111
|
},
|
|
3948
3112
|
{ _id: !1 }
|
|
3949
|
-
),
|
|
3113
|
+
), Ca = new o(
|
|
3950
3114
|
{
|
|
3951
3115
|
entityId: { type: String, required: !0 },
|
|
3952
3116
|
size: { type: Number, required: !0 }
|
|
3953
3117
|
},
|
|
3954
3118
|
{ _id: !1 }
|
|
3955
|
-
),
|
|
3119
|
+
), Na = new o(
|
|
3956
3120
|
{
|
|
3957
3121
|
craftId: { type: String, unique: !0, required: !0 },
|
|
3958
3122
|
name: { type: String, required: !0 },
|
|
3959
|
-
entities: { type: [
|
|
3960
|
-
result: { type:
|
|
3123
|
+
entities: { type: [_a], required: !0 },
|
|
3124
|
+
result: { type: Ca, required: !0 }
|
|
3961
3125
|
},
|
|
3962
3126
|
{ minimize: !1 }
|
|
3963
|
-
),
|
|
3127
|
+
), ae = d?.Recipes || p("Recipes", Na), Fa = async (n) => await ae.create({
|
|
3964
3128
|
...n
|
|
3965
|
-
}),
|
|
3966
|
-
async function
|
|
3967
|
-
const e = await
|
|
3129
|
+
}), za = async (n, e) => ae.find(n, {}, e).lean();
|
|
3130
|
+
async function ja(n) {
|
|
3131
|
+
const e = await ae.findOne({ craftId: n }).lean();
|
|
3968
3132
|
return e || null;
|
|
3969
3133
|
}
|
|
3970
|
-
const
|
|
3134
|
+
const Ha = (n, e) => ae.findOneAndUpdate(n, e, {
|
|
3971
3135
|
returnDocument: "after"
|
|
3972
3136
|
}).lean();
|
|
3973
|
-
class
|
|
3137
|
+
class Ka extends xa {
|
|
3974
3138
|
constructor() {
|
|
3975
3139
|
super(3600);
|
|
3976
3140
|
}
|
|
3977
3141
|
createInDb(e) {
|
|
3978
|
-
return
|
|
3142
|
+
return Fa(e);
|
|
3979
3143
|
}
|
|
3980
3144
|
updateInDb(e, t) {
|
|
3981
|
-
return
|
|
3145
|
+
return Ha(e, t);
|
|
3982
3146
|
}
|
|
3983
3147
|
fetchFromDb(e) {
|
|
3984
|
-
return
|
|
3148
|
+
return ja(e);
|
|
3985
3149
|
}
|
|
3986
|
-
fetchManyFromDb(e) {
|
|
3987
|
-
return
|
|
3150
|
+
fetchManyFromDb(e, t) {
|
|
3151
|
+
return za(e, t);
|
|
3988
3152
|
}
|
|
3989
3153
|
normalizeKey(e) {
|
|
3990
3154
|
return e;
|
|
@@ -3993,35 +3157,35 @@ class us extends Za {
|
|
|
3993
3157
|
return e.craftId;
|
|
3994
3158
|
}
|
|
3995
3159
|
}
|
|
3996
|
-
const
|
|
3160
|
+
const Wr = new Ka(), Pa = new o({
|
|
3997
3161
|
bannedUserId: { type: String, index: !0, required: !0 },
|
|
3998
3162
|
authorId: { type: String, required: !0 },
|
|
3999
3163
|
unbannedTimestamp: { type: Date, index: 1 },
|
|
4000
3164
|
reason: { type: String, required: !0 },
|
|
4001
3165
|
guildId: { type: String, required: !0 }
|
|
4002
|
-
}),
|
|
4003
|
-
class
|
|
3166
|
+
}), re = d?.Bans || p("Bans", Pa), La = (n, e) => re.deleteOne({ bannedUserId: n, guildId: e });
|
|
3167
|
+
class Qa extends w {
|
|
4004
3168
|
async getUnbanUsers() {
|
|
4005
3169
|
return this.getMany({
|
|
4006
3170
|
unbannedTimestamp: { $lte: /* @__PURE__ */ new Date(), $ne: null }
|
|
4007
3171
|
});
|
|
4008
3172
|
}
|
|
4009
|
-
async banUserFromGuild({ bannedUserId: e, guildId: t, ...
|
|
4010
|
-
await this.update({ bannedUserId: e, guildId: t }, { ...
|
|
3173
|
+
async banUserFromGuild({ bannedUserId: e, guildId: t, ...a }) {
|
|
3174
|
+
await this.update({ bannedUserId: e, guildId: t }, { ...a });
|
|
4011
3175
|
}
|
|
4012
3176
|
async isBannedFromGuild(e, t) {
|
|
4013
|
-
const
|
|
4014
|
-
return !!(
|
|
3177
|
+
const a = await this.get({ bannedUserId: e, guildId: t });
|
|
3178
|
+
return !!(a && (!a.unbannedTimestamp || a.unbannedTimestamp > /* @__PURE__ */ new Date()));
|
|
4015
3179
|
}
|
|
4016
3180
|
async deleteBan(e, t) {
|
|
4017
|
-
await
|
|
3181
|
+
await La(e, t), this.invalidate({ bannedUserId: e, guildId: t });
|
|
4018
3182
|
}
|
|
4019
3183
|
}
|
|
4020
|
-
const
|
|
3184
|
+
const Wa = (n) => re.find(n).lean(), Ga = (n) => re.findOne(n).lean(), Ya = (n, e) => re.findOneAndUpdate(n, e, {
|
|
4021
3185
|
returnDocument: "after",
|
|
4022
3186
|
upsert: !0
|
|
4023
3187
|
}).lean();
|
|
4024
|
-
class
|
|
3188
|
+
class Va extends Qa {
|
|
4025
3189
|
constructor() {
|
|
4026
3190
|
super(3600 * 36);
|
|
4027
3191
|
}
|
|
@@ -4032,23 +3196,23 @@ class fs extends ds {
|
|
|
4032
3196
|
return { bannedUserId: e, guildId: t };
|
|
4033
3197
|
}
|
|
4034
3198
|
fetchFromDb(e) {
|
|
4035
|
-
return
|
|
3199
|
+
return Ga(e);
|
|
4036
3200
|
}
|
|
4037
3201
|
fetchManyFromDb(e) {
|
|
4038
|
-
return
|
|
3202
|
+
return Wa(e);
|
|
4039
3203
|
}
|
|
4040
3204
|
updateInDb(e, t) {
|
|
4041
|
-
return
|
|
3205
|
+
return Ya(e, t);
|
|
4042
3206
|
}
|
|
4043
3207
|
}
|
|
4044
|
-
const
|
|
3208
|
+
const Gr = new Va(), Xa = new o({
|
|
4045
3209
|
senderId: {
|
|
4046
|
-
type:
|
|
3210
|
+
type: o.Types.ObjectId,
|
|
4047
3211
|
required: !0,
|
|
4048
3212
|
ref: "User"
|
|
4049
3213
|
},
|
|
4050
3214
|
receiverId: {
|
|
4051
|
-
type:
|
|
3215
|
+
type: o.Types.ObjectId,
|
|
4052
3216
|
required: !0,
|
|
4053
3217
|
index: !0,
|
|
4054
3218
|
ref: "User"
|
|
@@ -4058,36 +3222,36 @@ const wi = new fs(), ms = new u({
|
|
|
4058
3222
|
meta: {
|
|
4059
3223
|
rps: { type: String, default: void 0 }
|
|
4060
3224
|
}
|
|
4061
|
-
}),
|
|
3225
|
+
}), se = d?.Invitation || p("Invitation", Xa), Ja = (n) => se.create({
|
|
4062
3226
|
...n
|
|
4063
|
-
}),
|
|
4064
|
-
await
|
|
3227
|
+
}), Za = async (n) => {
|
|
3228
|
+
await se.deleteMany({
|
|
4065
3229
|
...n
|
|
4066
3230
|
});
|
|
4067
3231
|
};
|
|
4068
|
-
class
|
|
3232
|
+
class er extends f {
|
|
4069
3233
|
async sendInvitation({
|
|
4070
3234
|
senderId: e,
|
|
4071
3235
|
receiverId: t,
|
|
4072
|
-
gameMode:
|
|
4073
|
-
...
|
|
3236
|
+
gameMode: a,
|
|
3237
|
+
...r
|
|
4074
3238
|
}) {
|
|
4075
|
-
return await this.get({ senderId: e, gameMode:
|
|
3239
|
+
return await this.get({ senderId: e, gameMode: a, receiverId: t }) ? null : await Ja({ ...r, senderId: e, gameMode: a, receiverId: t });
|
|
4076
3240
|
}
|
|
4077
3241
|
async deleteInvitation({
|
|
4078
3242
|
senderId: e,
|
|
4079
3243
|
receiverId: t,
|
|
4080
|
-
gameMode:
|
|
3244
|
+
gameMode: a
|
|
4081
3245
|
}) {
|
|
4082
|
-
await
|
|
3246
|
+
await Za({ senderId: e, gameMode: a, receiverId: t }), this.invalidate({ senderId: e, gameMode: a, receiverId: t });
|
|
4083
3247
|
}
|
|
4084
3248
|
}
|
|
4085
|
-
const
|
|
3249
|
+
const tr = (n) => se.findOne({
|
|
4086
3250
|
...n
|
|
4087
|
-
}).lean(),
|
|
3251
|
+
}).lean(), nr = (n, e) => se.findOneAndUpdate(n, e, {
|
|
4088
3252
|
returnDocument: "after"
|
|
4089
3253
|
}).lean();
|
|
4090
|
-
class
|
|
3254
|
+
class ar extends er {
|
|
4091
3255
|
constructor() {
|
|
4092
3256
|
super(3600);
|
|
4093
3257
|
}
|
|
@@ -4097,52 +3261,37 @@ class $s extends gs {
|
|
|
4097
3261
|
getKey({
|
|
4098
3262
|
receiverId: e,
|
|
4099
3263
|
gameMode: t,
|
|
4100
|
-
senderId:
|
|
3264
|
+
senderId: a
|
|
4101
3265
|
}) {
|
|
4102
|
-
return { gameMode: t, receiverId: e, senderId:
|
|
3266
|
+
return { gameMode: t, receiverId: e, senderId: a };
|
|
4103
3267
|
}
|
|
4104
3268
|
fetchFromDb(e) {
|
|
4105
|
-
return
|
|
3269
|
+
return tr(e);
|
|
4106
3270
|
}
|
|
4107
3271
|
updateInDb(e, t) {
|
|
4108
|
-
return
|
|
3272
|
+
return nr(e, t);
|
|
4109
3273
|
}
|
|
4110
3274
|
}
|
|
4111
|
-
const
|
|
4112
|
-
class
|
|
4113
|
-
async setEditoChannel(e, t) {
|
|
4114
|
-
await this.update({ guildId: e }, { $set: { "edito.channelId": t } });
|
|
4115
|
-
}
|
|
3275
|
+
const Yr = new ar();
|
|
3276
|
+
class rr extends f {
|
|
4116
3277
|
async randomizeEditoPrice(e) {
|
|
4117
|
-
const t =
|
|
3278
|
+
const t = Ee(100, 1001);
|
|
4118
3279
|
return await this.update({ guildId: e }, { $set: { "edito.price": t } }), t;
|
|
4119
3280
|
}
|
|
4120
3281
|
async setEditoMessageId(e, t) {
|
|
4121
3282
|
await this.update({ guildId: e }, { $set: { "edito.messageId": t } });
|
|
4122
3283
|
}
|
|
4123
|
-
async setRankingChannel(e, t) {
|
|
4124
|
-
await this.update(
|
|
4125
|
-
{ guildId: e },
|
|
4126
|
-
{ $set: { "ranking.channelId": t } }
|
|
4127
|
-
);
|
|
4128
|
-
}
|
|
4129
3284
|
async setRankingMessage(e, t) {
|
|
4130
3285
|
await this.update(
|
|
4131
3286
|
{ guildId: e },
|
|
4132
3287
|
{ $set: { "ranking.messageId": t } }
|
|
4133
3288
|
);
|
|
4134
3289
|
}
|
|
4135
|
-
async
|
|
4136
|
-
await this.update(
|
|
4137
|
-
{ guildId: e },
|
|
4138
|
-
{ $set: { "crew.infoChannelId": t } }
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
async addCrewChannelId(e, t, r) {
|
|
3290
|
+
async addCrewChannelId(e, t, a) {
|
|
4142
3291
|
await this.update(
|
|
4143
3292
|
{ guildId: e },
|
|
4144
3293
|
{
|
|
4145
|
-
$push: { "crew.crewChannelIds": { channelId:
|
|
3294
|
+
$push: { "crew.crewChannelIds": { channelId: a, crewId: t } }
|
|
4146
3295
|
}
|
|
4147
3296
|
);
|
|
4148
3297
|
}
|
|
@@ -4151,7 +3300,7 @@ class Es extends f {
|
|
|
4151
3300
|
{ guildId: e },
|
|
4152
3301
|
{
|
|
4153
3302
|
$set: Object.fromEntries(
|
|
4154
|
-
Object.entries(t).map(([
|
|
3303
|
+
Object.entries(t).map(([a, r]) => [`roles.${a}`, r])
|
|
4155
3304
|
)
|
|
4156
3305
|
}
|
|
4157
3306
|
);
|
|
@@ -4161,29 +3310,31 @@ class Es extends f {
|
|
|
4161
3310
|
{ guildId: e },
|
|
4162
3311
|
{
|
|
4163
3312
|
$set: Object.fromEntries(
|
|
4164
|
-
Object.entries(t).map(([
|
|
4165
|
-
`channels.${
|
|
4166
|
-
|
|
3313
|
+
Object.entries(t).map(([a, r]) => [
|
|
3314
|
+
`channels.${a}`,
|
|
3315
|
+
r
|
|
4167
3316
|
])
|
|
4168
3317
|
)
|
|
4169
3318
|
}
|
|
4170
3319
|
);
|
|
4171
3320
|
}
|
|
4172
3321
|
}
|
|
4173
|
-
const
|
|
3322
|
+
const sr = new o({
|
|
4174
3323
|
guildId: { type: String, required: !0, unique: !0 },
|
|
4175
3324
|
ranking: {
|
|
4176
|
-
channelId: { type: String, default: null },
|
|
4177
3325
|
messageId: { type: String, default: null }
|
|
4178
3326
|
},
|
|
4179
3327
|
roles: {
|
|
4180
3328
|
premium: { type: String, default: null },
|
|
4181
3329
|
booster: { type: String, default: null },
|
|
4182
3330
|
scam: { type: String, default: null },
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
}
|
|
3331
|
+
canChangeFaction: { type: String, default: null },
|
|
3332
|
+
canChooseFaction: { type: String, default: null },
|
|
3333
|
+
staff: { type: String, default: null },
|
|
3334
|
+
moderator: { type: String, default: null },
|
|
3335
|
+
marine: { type: String, default: null },
|
|
3336
|
+
pirate: { type: String, default: null },
|
|
3337
|
+
revolutionary: { type: String, default: null }
|
|
4187
3338
|
},
|
|
4188
3339
|
channels: {
|
|
4189
3340
|
gambling: { type: String, default: null },
|
|
@@ -4196,15 +3347,16 @@ const Us = new u({
|
|
|
4196
3347
|
discussion: { type: String, default: null },
|
|
4197
3348
|
questFallback: { type: String, default: null },
|
|
4198
3349
|
reportBug: { type: String, default: null },
|
|
4199
|
-
shop: { type: String, default: null }
|
|
3350
|
+
shop: { type: String, default: null },
|
|
3351
|
+
edito: { type: String, default: null },
|
|
3352
|
+
crew: { type: String, default: null },
|
|
3353
|
+
ranking: { type: String, default: null }
|
|
4200
3354
|
},
|
|
4201
3355
|
edito: {
|
|
4202
|
-
channelId: { type: String, default: null },
|
|
4203
3356
|
price: { type: Number, default: 100 },
|
|
4204
3357
|
messageId: { type: String, default: null }
|
|
4205
3358
|
},
|
|
4206
3359
|
crew: {
|
|
4207
|
-
infoChannelId: { type: String, default: null },
|
|
4208
3360
|
crewChannelIds: {
|
|
4209
3361
|
type: [
|
|
4210
3362
|
{
|
|
@@ -4214,18 +3366,17 @@ const Us = new u({
|
|
|
4214
3366
|
],
|
|
4215
3367
|
default: []
|
|
4216
3368
|
}
|
|
4217
|
-
}
|
|
4218
|
-
|
|
4219
|
-
}), De = l?.Settings || p("Settings", Us), Is = (n) => De.create({
|
|
3369
|
+
}
|
|
3370
|
+
}), ye = d?.Settings || p("Settings", sr), ir = (n) => ye.create({
|
|
4220
3371
|
guildId: n
|
|
4221
|
-
}),
|
|
4222
|
-
const e = await
|
|
4223
|
-
return e || y(await
|
|
4224
|
-
},
|
|
3372
|
+
}), ur = async (n) => {
|
|
3373
|
+
const e = await ye.findOne({ guildId: n }).lean();
|
|
3374
|
+
return e || y(await ir(n));
|
|
3375
|
+
}, or = (n, e) => ye.findOneAndUpdate(n, e, {
|
|
4225
3376
|
upsert: !0,
|
|
4226
3377
|
returnDocument: "after"
|
|
4227
3378
|
}).lean();
|
|
4228
|
-
class
|
|
3379
|
+
class cr extends rr {
|
|
4229
3380
|
constructor() {
|
|
4230
3381
|
super(3600 * 24 * 30);
|
|
4231
3382
|
}
|
|
@@ -4236,48 +3387,14 @@ class Ts extends Es {
|
|
|
4236
3387
|
return e;
|
|
4237
3388
|
}
|
|
4238
3389
|
fetchFromDb(e) {
|
|
4239
|
-
return
|
|
3390
|
+
return ur(e);
|
|
4240
3391
|
}
|
|
4241
3392
|
updateInDb(e, t) {
|
|
4242
|
-
return
|
|
3393
|
+
return or(e, t);
|
|
4243
3394
|
}
|
|
4244
3395
|
}
|
|
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 {
|
|
3396
|
+
const Vr = new cr();
|
|
3397
|
+
class I {
|
|
4281
3398
|
toDBShopItem() {
|
|
4282
3399
|
return {
|
|
4283
3400
|
price: this.price,
|
|
@@ -4287,14 +3404,14 @@ class E {
|
|
|
4287
3404
|
};
|
|
4288
3405
|
}
|
|
4289
3406
|
async onBuy(e, t) {
|
|
4290
|
-
this.currency === "berry" ? (await
|
|
3407
|
+
this.currency === "berry" ? (await U.updateUserBerry(
|
|
4291
3408
|
e,
|
|
4292
3409
|
-1 * this.price * t,
|
|
4293
3410
|
!1
|
|
4294
|
-
), await
|
|
3411
|
+
), await Sa.updateTotalSpentInShop(
|
|
4295
3412
|
e,
|
|
4296
3413
|
this.price * t
|
|
4297
|
-
)) : await
|
|
3414
|
+
)) : await m.removeItem(
|
|
4298
3415
|
e,
|
|
4299
3416
|
this.currency,
|
|
4300
3417
|
this.price * t
|
|
@@ -4328,7 +3445,7 @@ class E {
|
|
|
4328
3445
|
return !1;
|
|
4329
3446
|
}
|
|
4330
3447
|
}
|
|
4331
|
-
class
|
|
3448
|
+
class lr extends I {
|
|
4332
3449
|
price;
|
|
4333
3450
|
size;
|
|
4334
3451
|
currency;
|
|
@@ -4336,19 +3453,19 @@ class As extends E {
|
|
|
4336
3453
|
constructor({
|
|
4337
3454
|
price: e,
|
|
4338
3455
|
item: t,
|
|
4339
|
-
size:
|
|
4340
|
-
currency:
|
|
3456
|
+
size: a,
|
|
3457
|
+
currency: r
|
|
4341
3458
|
}) {
|
|
4342
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3459
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4343
3460
|
}
|
|
4344
3461
|
async onBuy(e, t) {
|
|
4345
|
-
await super.onBuy(e, t), await
|
|
3462
|
+
await super.onBuy(e, t), await L.unlockBackground(e, this.data.ornamentId);
|
|
4346
3463
|
}
|
|
4347
3464
|
isBackground() {
|
|
4348
3465
|
return !0;
|
|
4349
3466
|
}
|
|
4350
3467
|
}
|
|
4351
|
-
class
|
|
3468
|
+
class dr extends I {
|
|
4352
3469
|
price;
|
|
4353
3470
|
size;
|
|
4354
3471
|
currency;
|
|
@@ -4356,19 +3473,19 @@ class Ms extends E {
|
|
|
4356
3473
|
constructor({
|
|
4357
3474
|
price: e,
|
|
4358
3475
|
item: t,
|
|
4359
|
-
size:
|
|
4360
|
-
currency:
|
|
3476
|
+
size: a,
|
|
3477
|
+
currency: r
|
|
4361
3478
|
}) {
|
|
4362
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3479
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4363
3480
|
}
|
|
4364
3481
|
async onBuy(e, t) {
|
|
4365
|
-
await super.onBuy(e, t), await
|
|
3482
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4366
3483
|
}
|
|
4367
3484
|
isBoostXp() {
|
|
4368
3485
|
return !0;
|
|
4369
3486
|
}
|
|
4370
3487
|
}
|
|
4371
|
-
class
|
|
3488
|
+
class pr extends I {
|
|
4372
3489
|
price;
|
|
4373
3490
|
size;
|
|
4374
3491
|
currency;
|
|
@@ -4376,19 +3493,19 @@ class Bs extends E {
|
|
|
4376
3493
|
constructor({
|
|
4377
3494
|
price: e,
|
|
4378
3495
|
item: t,
|
|
4379
|
-
size:
|
|
4380
|
-
currency:
|
|
3496
|
+
size: a,
|
|
3497
|
+
currency: r
|
|
4381
3498
|
}) {
|
|
4382
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3499
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4383
3500
|
}
|
|
4384
3501
|
async onBuy(e, t) {
|
|
4385
|
-
await super.onBuy(e, t), await
|
|
3502
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4386
3503
|
}
|
|
4387
3504
|
isChest() {
|
|
4388
3505
|
return !0;
|
|
4389
3506
|
}
|
|
4390
3507
|
}
|
|
4391
|
-
class
|
|
3508
|
+
class yr extends I {
|
|
4392
3509
|
price;
|
|
4393
3510
|
size;
|
|
4394
3511
|
currency;
|
|
@@ -4396,19 +3513,19 @@ class xs extends E {
|
|
|
4396
3513
|
constructor({
|
|
4397
3514
|
price: e,
|
|
4398
3515
|
item: t,
|
|
4399
|
-
size:
|
|
4400
|
-
currency:
|
|
3516
|
+
size: a,
|
|
3517
|
+
currency: r
|
|
4401
3518
|
}) {
|
|
4402
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3519
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4403
3520
|
}
|
|
4404
3521
|
async onBuy(e, t) {
|
|
4405
|
-
await super.onBuy(e, t), await
|
|
3522
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4406
3523
|
}
|
|
4407
3524
|
isObject() {
|
|
4408
3525
|
return !0;
|
|
4409
3526
|
}
|
|
4410
3527
|
}
|
|
4411
|
-
class
|
|
3528
|
+
class fr extends I {
|
|
4412
3529
|
price;
|
|
4413
3530
|
size;
|
|
4414
3531
|
currency;
|
|
@@ -4416,22 +3533,22 @@ class qs extends E {
|
|
|
4416
3533
|
constructor({
|
|
4417
3534
|
price: e,
|
|
4418
3535
|
item: t,
|
|
4419
|
-
size:
|
|
4420
|
-
currency:
|
|
3536
|
+
size: a,
|
|
3537
|
+
currency: r
|
|
4421
3538
|
}) {
|
|
4422
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3539
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4423
3540
|
}
|
|
4424
3541
|
async onBuy(e, t) {
|
|
4425
|
-
await super.onBuy(e, t), await
|
|
3542
|
+
await super.onBuy(e, t), await m.addEquipments(
|
|
4426
3543
|
e,
|
|
4427
|
-
|
|
4428
|
-
() =>
|
|
3544
|
+
st({ stop: t }).map(
|
|
3545
|
+
() => l.seedEquipment(
|
|
4429
3546
|
{ ...this.data },
|
|
4430
3547
|
Date.now() - Math.round(Math.random() * 1e3)
|
|
4431
3548
|
)
|
|
4432
|
-
).map((
|
|
4433
|
-
entityId:
|
|
4434
|
-
seed:
|
|
3549
|
+
).map((a) => ({
|
|
3550
|
+
entityId: a.entityId,
|
|
3551
|
+
seed: a.seed
|
|
4435
3552
|
}))
|
|
4436
3553
|
);
|
|
4437
3554
|
}
|
|
@@ -4439,7 +3556,7 @@ class qs extends E {
|
|
|
4439
3556
|
return !0;
|
|
4440
3557
|
}
|
|
4441
3558
|
}
|
|
4442
|
-
class
|
|
3559
|
+
class mr extends I {
|
|
4443
3560
|
price;
|
|
4444
3561
|
size;
|
|
4445
3562
|
currency;
|
|
@@ -4447,19 +3564,19 @@ class ks extends E {
|
|
|
4447
3564
|
constructor({
|
|
4448
3565
|
price: e,
|
|
4449
3566
|
item: t,
|
|
4450
|
-
size:
|
|
4451
|
-
currency:
|
|
3567
|
+
size: a,
|
|
3568
|
+
currency: r
|
|
4452
3569
|
}) {
|
|
4453
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3570
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4454
3571
|
}
|
|
4455
3572
|
async onBuy(e, t) {
|
|
4456
|
-
await super.onBuy(e, t), await
|
|
3573
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4457
3574
|
}
|
|
4458
3575
|
isBottle() {
|
|
4459
3576
|
return !0;
|
|
4460
3577
|
}
|
|
4461
3578
|
}
|
|
4462
|
-
class
|
|
3579
|
+
class hr extends I {
|
|
4463
3580
|
price;
|
|
4464
3581
|
size;
|
|
4465
3582
|
currency;
|
|
@@ -4467,19 +3584,19 @@ class _s extends E {
|
|
|
4467
3584
|
constructor({
|
|
4468
3585
|
price: e,
|
|
4469
3586
|
item: t,
|
|
4470
|
-
size:
|
|
4471
|
-
currency:
|
|
3587
|
+
size: a,
|
|
3588
|
+
currency: r
|
|
4472
3589
|
}) {
|
|
4473
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3590
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4474
3591
|
}
|
|
4475
3592
|
async onBuy(e, t) {
|
|
4476
|
-
await super.onBuy(e, t), await
|
|
3593
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4477
3594
|
}
|
|
4478
3595
|
isRepair() {
|
|
4479
3596
|
return !0;
|
|
4480
3597
|
}
|
|
4481
3598
|
}
|
|
4482
|
-
class
|
|
3599
|
+
class gr extends I {
|
|
4483
3600
|
price;
|
|
4484
3601
|
size;
|
|
4485
3602
|
currency;
|
|
@@ -4487,19 +3604,19 @@ class Ns extends E {
|
|
|
4487
3604
|
constructor({
|
|
4488
3605
|
price: e,
|
|
4489
3606
|
item: t,
|
|
4490
|
-
size:
|
|
4491
|
-
currency:
|
|
3607
|
+
size: a,
|
|
3608
|
+
currency: r
|
|
4492
3609
|
}) {
|
|
4493
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3610
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4494
3611
|
}
|
|
4495
3612
|
async onBuy(e, t) {
|
|
4496
|
-
await super.onBuy(e, t), await
|
|
3613
|
+
await super.onBuy(e, t), await m.addItem(e, this.data.entityId, t);
|
|
4497
3614
|
}
|
|
4498
3615
|
isStore() {
|
|
4499
3616
|
return !0;
|
|
4500
3617
|
}
|
|
4501
3618
|
}
|
|
4502
|
-
class
|
|
3619
|
+
class wr extends I {
|
|
4503
3620
|
price;
|
|
4504
3621
|
size;
|
|
4505
3622
|
currency;
|
|
@@ -4507,70 +3624,70 @@ class Fs extends E {
|
|
|
4507
3624
|
constructor({
|
|
4508
3625
|
price: e,
|
|
4509
3626
|
item: t,
|
|
4510
|
-
size:
|
|
4511
|
-
currency:
|
|
3627
|
+
size: a,
|
|
3628
|
+
currency: r
|
|
4512
3629
|
}) {
|
|
4513
|
-
super(), this.data = t, this.price = e, this.size =
|
|
3630
|
+
super(), this.data = t, this.price = e, this.size = a, this.currency = r;
|
|
4514
3631
|
}
|
|
4515
3632
|
async onBuy(e, t) {
|
|
4516
|
-
await super.onBuy(e, t), await
|
|
3633
|
+
await super.onBuy(e, t), await L.unlockTitle(e, this.data.ornamentId);
|
|
4517
3634
|
}
|
|
4518
3635
|
isTitle() {
|
|
4519
3636
|
return !0;
|
|
4520
3637
|
}
|
|
4521
3638
|
}
|
|
4522
|
-
class
|
|
3639
|
+
class Sr extends f {
|
|
4523
3640
|
async getShopItem(e, t) {
|
|
4524
|
-
const
|
|
4525
|
-
if (!
|
|
3641
|
+
const r = (await this.get(e)).items.find((h) => h.id === t);
|
|
3642
|
+
if (!r)
|
|
4526
3643
|
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
|
|
3644
|
+
const { price: s, size: i, currency: c } = r, u = await l.get(r.id) ?? await g.get(r.id);
|
|
3645
|
+
if (g.isOrnament(u) && g.isBackground(u))
|
|
3646
|
+
return new lr({ price: s, item: u, size: i, currency: c });
|
|
3647
|
+
if (g.isOrnament(u) && g.isShopTitle(u))
|
|
3648
|
+
return new wr({ price: s, item: u, size: i, currency: c });
|
|
3649
|
+
if (l.isEntity(u) && l.isChestItem(u))
|
|
3650
|
+
return new pr({ price: s, item: u, size: i, currency: c });
|
|
3651
|
+
if (l.isEntity(u) && l.isBoostItem(u))
|
|
3652
|
+
return new dr({ price: s, item: u, size: i, currency: c });
|
|
3653
|
+
if (l.isEntity(u) && l.isRepairItem(u))
|
|
3654
|
+
return new hr({ price: s, item: u, size: i, currency: c });
|
|
3655
|
+
if (l.isEntity(u) && l.isStoreItem(u))
|
|
3656
|
+
return new gr({ price: s, item: u, size: i, currency: c });
|
|
3657
|
+
if (l.isEntity(u) && l.isObjectItem(u))
|
|
3658
|
+
return new yr({ price: s, item: u, size: i, currency: c });
|
|
3659
|
+
if (l.isEntity(u) && l.isEquipment(u))
|
|
3660
|
+
return new fr({ price: s, item: u, size: i, currency: c });
|
|
3661
|
+
if (l.isEntity(u) && l.isBottleItem(u))
|
|
3662
|
+
return new mr({ price: s, size: i, item: u, currency: c });
|
|
4546
3663
|
}
|
|
4547
3664
|
async getShopItemList(e) {
|
|
4548
|
-
const t = await this.get(e),
|
|
4549
|
-
for (const { id:
|
|
4550
|
-
const s = await this.getShopItem(e,
|
|
4551
|
-
s &&
|
|
3665
|
+
const t = await this.get(e), a = [];
|
|
3666
|
+
for (const { id: r } of t.items) {
|
|
3667
|
+
const s = await this.getShopItem(e, r);
|
|
3668
|
+
s && a.push(s);
|
|
4552
3669
|
}
|
|
4553
|
-
return
|
|
3670
|
+
return a;
|
|
4554
3671
|
}
|
|
4555
3672
|
getShopItemId(e) {
|
|
4556
|
-
return
|
|
3673
|
+
return l.isEntity(e.data) ? e.data.entityId : e.data.ornamentId;
|
|
4557
3674
|
}
|
|
4558
|
-
async updateShopStats(e, t,
|
|
3675
|
+
async updateShopStats(e, t, a) {
|
|
4559
3676
|
await this.update(
|
|
4560
3677
|
{ shopType: e },
|
|
4561
3678
|
{
|
|
4562
3679
|
$inc: {
|
|
4563
|
-
"stats.berrySpent": t.price *
|
|
4564
|
-
"stats.itemBought":
|
|
4565
|
-
"stats.chestBought": t.isChest() ?
|
|
4566
|
-
"stats.percentBought": t.
|
|
4567
|
-
"stats.boostTimeBought": t.
|
|
3680
|
+
"stats.berrySpent": t.price * a,
|
|
3681
|
+
"stats.itemBought": a,
|
|
3682
|
+
"stats.chestBought": t.isChest() ? a : 0,
|
|
3683
|
+
"stats.percentBought": t.data.type === "repair" ? (t.data.effects.find((r) => r.type === "CREW_REPAIR")?.params.amount ?? 0) * a : 0,
|
|
3684
|
+
"stats.boostTimeBought": t.data.type === "boost" && t.data.ms ? t.data.ms / (1440 * 60 * 1e3) : 0
|
|
4568
3685
|
}
|
|
4569
3686
|
}
|
|
4570
3687
|
);
|
|
4571
3688
|
}
|
|
4572
|
-
async buyShopItem(e, t,
|
|
4573
|
-
const s = t.map((i) => (i.id === this.getShopItemId(
|
|
3689
|
+
async buyShopItem(e, t, a, r) {
|
|
3690
|
+
const s = t.map((i) => (i.id === this.getShopItemId(a) && i.size && (i.size -= r), i));
|
|
4574
3691
|
await this.update(
|
|
4575
3692
|
{ shopType: e },
|
|
4576
3693
|
{
|
|
@@ -4601,8 +3718,42 @@ class js extends f {
|
|
|
4601
3718
|
);
|
|
4602
3719
|
}
|
|
4603
3720
|
}
|
|
4604
|
-
const
|
|
4605
|
-
|
|
3721
|
+
const br = new o(
|
|
3722
|
+
{
|
|
3723
|
+
shopType: { type: String, required: !0, unique: !0 },
|
|
3724
|
+
publishedAt: { type: Date, default: /* @__PURE__ */ new Date() },
|
|
3725
|
+
duration: { type: Number, default: null },
|
|
3726
|
+
closeAt: { type: Date, default: null },
|
|
3727
|
+
items: {
|
|
3728
|
+
type: [
|
|
3729
|
+
{
|
|
3730
|
+
_id: !1,
|
|
3731
|
+
type: {
|
|
3732
|
+
price: Number,
|
|
3733
|
+
size: { type: Number, default: null },
|
|
3734
|
+
id: String,
|
|
3735
|
+
currency: String
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
],
|
|
3739
|
+
default: []
|
|
3740
|
+
},
|
|
3741
|
+
stats: {
|
|
3742
|
+
berrySpent: { type: Number, default: 0 },
|
|
3743
|
+
itemBought: { type: Number, default: 0 },
|
|
3744
|
+
chestBought: { type: Number, default: 0 },
|
|
3745
|
+
boostTimeBought: { type: Number, default: 0 },
|
|
3746
|
+
percentBought: { type: Number, default: 0 }
|
|
3747
|
+
}
|
|
3748
|
+
},
|
|
3749
|
+
{ minimize: !1 }
|
|
3750
|
+
), fe = d?.Shop || p("Shop", br), $r = (n) => fe.create({
|
|
3751
|
+
shopType: n
|
|
3752
|
+
}), Ir = async (n) => {
|
|
3753
|
+
const e = await fe.findOne({ shopType: n }).lean();
|
|
3754
|
+
return e || y(await $r(n));
|
|
3755
|
+
}, Er = (n, e) => fe.findOneAndUpdate(n, e, { upsert: !0, returnDocument: "after" }).lean();
|
|
3756
|
+
class Ur extends Sr {
|
|
4606
3757
|
constructor() {
|
|
4607
3758
|
super(3600);
|
|
4608
3759
|
}
|
|
@@ -4613,28 +3764,37 @@ class Ks extends js {
|
|
|
4613
3764
|
return e;
|
|
4614
3765
|
}
|
|
4615
3766
|
fetchFromDb(e) {
|
|
4616
|
-
return
|
|
3767
|
+
return Ir(e);
|
|
4617
3768
|
}
|
|
4618
3769
|
updateInDb(e, t) {
|
|
4619
|
-
return
|
|
3770
|
+
return Er(e, t);
|
|
4620
3771
|
}
|
|
4621
3772
|
}
|
|
4622
|
-
const
|
|
3773
|
+
const Xr = new Ur(), Dr = new o({
|
|
4623
3774
|
warnedUserId: { type: String, required: !0, index: !0 },
|
|
4624
3775
|
authorId: String,
|
|
4625
3776
|
date: { type: Date, default: Date.now() },
|
|
4626
3777
|
reason: { type: String, default: null }
|
|
4627
|
-
}),
|
|
4628
|
-
|
|
3778
|
+
}), ie = d?.Warn || p("Warn", Dr), Tr = (n) => ie.countDocuments(n), Or = (n) => ie.create({
|
|
3779
|
+
...n
|
|
3780
|
+
}), vr = (n) => ie.findByIdAndDelete(n).lean();
|
|
3781
|
+
class Br extends w {
|
|
4629
3782
|
getUserWarns(e) {
|
|
4630
3783
|
return this.getMany({ warnedUserId: e });
|
|
4631
3784
|
}
|
|
4632
3785
|
getUserWarnCount(e) {
|
|
4633
|
-
return
|
|
3786
|
+
return Tr({ warnedUserId: e });
|
|
3787
|
+
}
|
|
3788
|
+
async createWarn(e) {
|
|
3789
|
+
await Or(e);
|
|
3790
|
+
}
|
|
3791
|
+
async deleteWarn(e) {
|
|
3792
|
+
const t = await vr(e);
|
|
3793
|
+
return t && this.invalidate(this.getKey(t)), t;
|
|
4634
3794
|
}
|
|
4635
3795
|
}
|
|
4636
|
-
const
|
|
4637
|
-
class
|
|
3796
|
+
const Mr = (n) => ie.find(n).lean();
|
|
3797
|
+
class kr extends Br {
|
|
4638
3798
|
constructor() {
|
|
4639
3799
|
super(300);
|
|
4640
3800
|
}
|
|
@@ -4648,64 +3808,59 @@ class Ws extends Ls {
|
|
|
4648
3808
|
throw new Error("Method not implemented.");
|
|
4649
3809
|
}
|
|
4650
3810
|
fetchManyFromDb(e) {
|
|
4651
|
-
return
|
|
3811
|
+
return Mr(e);
|
|
4652
3812
|
}
|
|
4653
3813
|
updateInDb() {
|
|
4654
3814
|
throw new Error("Method not implemented.");
|
|
4655
3815
|
}
|
|
4656
3816
|
}
|
|
4657
|
-
const
|
|
4658
|
-
|
|
3817
|
+
const Jr = new kr(), Zr = (n) => {
|
|
3818
|
+
He(n);
|
|
4659
3819
|
};
|
|
4660
|
-
class
|
|
3820
|
+
class es extends Ke.ObjectId {
|
|
4661
3821
|
}
|
|
4662
3822
|
export {
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
3823
|
+
lr as BackgroundShopItem,
|
|
3824
|
+
dr as BoostXpShopItem,
|
|
3825
|
+
mr as BottleShopItem,
|
|
3826
|
+
Cr as COOLDOWN_COMMANDS,
|
|
3827
|
+
pr as ChestShopItem,
|
|
3828
|
+
fr as EquipmentShopItem,
|
|
3829
|
+
es as ObjectId,
|
|
3830
|
+
yr as ObjectShopItem,
|
|
3831
|
+
b as QUEST_MIDDLEWARE_EVENT_NAME,
|
|
3832
|
+
hr as RepairShopItem,
|
|
3833
|
+
gr as StoreShopItem,
|
|
3834
|
+
wr as TitleShopItem,
|
|
3835
|
+
Gr as banService,
|
|
3836
|
+
Zr as connectToServices,
|
|
3837
|
+
S as emitQuestMiddlewareEvent,
|
|
3838
|
+
l as entityService,
|
|
3839
|
+
Yr as invitationService,
|
|
4680
3840
|
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
|
|
3841
|
+
E as panoplyService,
|
|
3842
|
+
Wr as recipeService,
|
|
3843
|
+
_r as registerQuestMiddlewareEvents,
|
|
3844
|
+
Bt as reminderService,
|
|
3845
|
+
Vr as settingsService,
|
|
3846
|
+
Xr as shopService,
|
|
3847
|
+
Nr as userCooldownService,
|
|
3848
|
+
Fr as userDailyReportService,
|
|
3849
|
+
ce as userEncyclopediaService,
|
|
3850
|
+
zr as userGamesService,
|
|
3851
|
+
m as userInventoryService,
|
|
3852
|
+
U as userMetaService,
|
|
3853
|
+
L as userOrnamentService,
|
|
3854
|
+
we as userQuestService,
|
|
3855
|
+
jr as userRankService,
|
|
3856
|
+
bt as userService,
|
|
3857
|
+
_e as userSettingsService,
|
|
3858
|
+
Hr as userShopService,
|
|
3859
|
+
Kr as userStatsCasinoService,
|
|
3860
|
+
Sa as userStatsEconomyService,
|
|
3861
|
+
Se as userStatsEngagementService,
|
|
3862
|
+
Pr as userStatsFlagsService,
|
|
3863
|
+
Lr as userStatsFrequencyService,
|
|
3864
|
+
Qr as userStatsInventoryService,
|
|
3865
|
+
Jr as warnService
|
|
4711
3866
|
};
|