@skyhelperbot/utils 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/classes/LeaderBoardCard.d.ts +59 -0
- package/dist/classes/LeaderBoardCard.js +249 -0
- package/dist/classes/SkytimesUtils.d.ts +73 -0
- package/dist/classes/SkytimesUtils.js +119 -0
- package/dist/classes/UpdateEvent.d.ts +30 -0
- package/dist/classes/UpdateEvent.js +52 -0
- package/dist/classes/UpdateTs.d.ts +35 -0
- package/dist/classes/UpdateTs.js +62 -0
- package/dist/classes/WinnerCard.d.ts +13 -0
- package/dist/classes/WinnerCard.js +118 -0
- package/dist/classes/index.d.ts +7 -0
- package/dist/classes/index.js +7 -0
- package/dist/classes/shardsUtil.d.ts +41 -0
- package/dist/classes/shardsUtil.js +122 -0
- package/dist/classes/utils.d.ts +13 -0
- package/dist/classes/utils.js +22 -0
- package/dist/constants/eventDatas.d.ts +31 -0
- package/dist/constants/eventDatas.js +105 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/shardsInfo.d.ts +50 -0
- package/dist/constants/shardsInfo.js +424 -0
- package/dist/constants/shardsTimeline.d.ts +19 -0
- package/dist/constants/shardsTimeline.js +57 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/typings.d.ts +62 -0
- package/dist/typings.js +3 -0
- package/dist/utils/buildTimesHTML.d.ts +14 -0
- package/dist/utils/buildTimesHTML.js +208 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/parseDateFormat.d.ts +9 -0
- package/dist/utils/parseDateFormat.js +25 -0
- package/dist/utils/parsePerms.d.ts +49 -0
- package/dist/utils/parsePerms.js +54 -0
- package/dist/utils/postToBin.d.ts +5 -0
- package/dist/utils/postToBin.js +15 -0
- package/dist/utils/recursiveReadDir.d.ts +15 -0
- package/dist/utils/recursiveReadDir.js +37 -0
- package/package.json +44 -0
- package/shared/assets/Point.png +0 -0
- package/shared/assets/Win.png +0 -0
- package/shared/assets/medal_champion_award_winner_olympic_icon_207790.png +0 -0
- package/shared/assets/server.svg +41 -0
- package/shared/fonts/circularstd-black.otf +0 -0
- package/shared/fonts/notoemoji-bold.ttf +0 -0
- package/shared/fonts/notosans-black.ttf +0 -0
- package/shared/fonts/notosans-jp-black.ttf +0 -0
- package/shared/fonts/notosans-kr-black.ttf +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @class
|
|
3
|
+
* @classdesc A class to update traveling spirit details in the client constructor
|
|
4
|
+
* @method update updates the ts details
|
|
5
|
+
* @returns {Object}
|
|
6
|
+
*/
|
|
7
|
+
export class UpdateTS {
|
|
8
|
+
data;
|
|
9
|
+
constructor(data) {
|
|
10
|
+
this.data = data;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Sets the name of the TS
|
|
14
|
+
* @param name Name of the returning TS
|
|
15
|
+
*/
|
|
16
|
+
setName(name) {
|
|
17
|
+
if (!name || typeof name !== "string") {
|
|
18
|
+
throw new TypeError("Name must be a non-empty string.");
|
|
19
|
+
}
|
|
20
|
+
this.data.name = name;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets the visit date of the ts
|
|
25
|
+
* @param date Returnig date. Format: DD-MM-YYYY
|
|
26
|
+
*/
|
|
27
|
+
setVisit(date) {
|
|
28
|
+
if (!date || typeof date !== "string") {
|
|
29
|
+
throw new TypeError("Date must be a non-empty string.");
|
|
30
|
+
}
|
|
31
|
+
this.data.visitDate = date;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets the value of the t spirit
|
|
36
|
+
* @param value The value of the spirit in the spiritsData
|
|
37
|
+
*/
|
|
38
|
+
setValue(value) {
|
|
39
|
+
if (!value || typeof value !== "string") {
|
|
40
|
+
throw new TypeError("Value must be a non-empty string.");
|
|
41
|
+
}
|
|
42
|
+
this.data.value = value;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Sets the index of the returning ts
|
|
47
|
+
* @param index The returning index of the TS
|
|
48
|
+
*/
|
|
49
|
+
setIndex(index) {
|
|
50
|
+
if (!index || typeof index !== "number") {
|
|
51
|
+
throw new TypeError("Index must be a number.");
|
|
52
|
+
}
|
|
53
|
+
this.data.index = index;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* returns the updated ts details
|
|
58
|
+
*/
|
|
59
|
+
async update() {
|
|
60
|
+
return await this.data.save();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { User, GuildMember, Client } from "discord.js";
|
|
2
|
+
export declare class GameWinnerCard {
|
|
3
|
+
private name;
|
|
4
|
+
private client;
|
|
5
|
+
private thumbnail;
|
|
6
|
+
private points;
|
|
7
|
+
private total;
|
|
8
|
+
constructor(winner: User | GuildMember, wins: number, total: number, client: Client);
|
|
9
|
+
private path;
|
|
10
|
+
private roundRect;
|
|
11
|
+
private changeFontSize;
|
|
12
|
+
build(): Promise<Buffer>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createCanvas, loadImage } from "@napi-rs/canvas";
|
|
2
|
+
import { User, GuildMember, Client } from "discord.js";
|
|
3
|
+
import { colors, fancyCount } from "./utils.js";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
const size = 100;
|
|
6
|
+
// TODO: Integrate it with other game types
|
|
7
|
+
export class GameWinnerCard {
|
|
8
|
+
name;
|
|
9
|
+
client;
|
|
10
|
+
thumbnail;
|
|
11
|
+
points;
|
|
12
|
+
total;
|
|
13
|
+
constructor(winner, wins, total, client) {
|
|
14
|
+
if (winner instanceof User) {
|
|
15
|
+
this.name = winner?.displayName || winner?.globalName || winner?.username;
|
|
16
|
+
this.thumbnail = winner?.displayAvatarURL({ forceStatic: true, extension: "jpg" });
|
|
17
|
+
}
|
|
18
|
+
if (winner instanceof GuildMember) {
|
|
19
|
+
this.name = winner.user?.globalName || winner?.displayName || winner.user.username;
|
|
20
|
+
this.thumbnail = winner.user?.displayAvatarURL({ forceStatic: true, extension: "jpg" });
|
|
21
|
+
}
|
|
22
|
+
this.client = client;
|
|
23
|
+
this.points = wins;
|
|
24
|
+
this.total = total;
|
|
25
|
+
}
|
|
26
|
+
path(strs) {
|
|
27
|
+
return join(__dirname, strs);
|
|
28
|
+
}
|
|
29
|
+
roundRect(ctx, x, y, w, h, r) {
|
|
30
|
+
if (w < 2 * r)
|
|
31
|
+
r = w / 2;
|
|
32
|
+
if (h < 2 * r)
|
|
33
|
+
r = h / 2;
|
|
34
|
+
ctx.beginPath();
|
|
35
|
+
ctx.moveTo(x + r, y);
|
|
36
|
+
ctx.arcTo(x + w, y, x + w, y + h, r);
|
|
37
|
+
ctx.arcTo(x + w, y + h, x, y + h, r);
|
|
38
|
+
ctx.arcTo(x, y + h, x, y, r);
|
|
39
|
+
ctx.arcTo(x, y, x + w, y, r);
|
|
40
|
+
ctx.closePath();
|
|
41
|
+
return ctx;
|
|
42
|
+
}
|
|
43
|
+
changeFontSize(ctx, _size) {
|
|
44
|
+
const fontArgs = ctx.font.split(" ");
|
|
45
|
+
ctx.font = `${_size} ${fontArgs.slice(1).join(" ")}`; // / using the last part
|
|
46
|
+
return ctx;
|
|
47
|
+
}
|
|
48
|
+
async build() {
|
|
49
|
+
const canvas = createCanvas(16 * size, 5 * size);
|
|
50
|
+
const ctx = canvas.getContext("2d");
|
|
51
|
+
const { width: w, height: h } = canvas;
|
|
52
|
+
ctx.font = "85px SegoeUI, SegoeUIEmoji";
|
|
53
|
+
ctx.fillStyle = colors.darkgrey;
|
|
54
|
+
this.roundRect(ctx, 0, 0, w, h, size * 0.75).clip();
|
|
55
|
+
ctx.fill();
|
|
56
|
+
// box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
57
|
+
// ctx.shadowOffsetY = 40;
|
|
58
|
+
// ctx.shadowColor = 'rgba(0, 0, 0, 0.25)';
|
|
59
|
+
// ctx.shadowOffsetX = 40;
|
|
60
|
+
// Avatar
|
|
61
|
+
//
|
|
62
|
+
ctx.save();
|
|
63
|
+
ctx.lineWidth = 6;
|
|
64
|
+
ctx.beginPath();
|
|
65
|
+
ctx.arc(h / 2, h / 2, h * 0.3, 0, Math.PI * 2, true);
|
|
66
|
+
ctx.closePath();
|
|
67
|
+
ctx.clip();
|
|
68
|
+
ctx.fillStyle = colors.grey;
|
|
69
|
+
ctx.fillRect(h * 0.2, h * 0.2, h * 0.6, h * 0.6);
|
|
70
|
+
ctx.drawImage(await loadImage(this.thumbnail), h * 0.2, h * 0.2, h * 0.6, h * 0.6);
|
|
71
|
+
ctx.restore();
|
|
72
|
+
// Status
|
|
73
|
+
ctx.save();
|
|
74
|
+
ctx.translate(size * 3.55, size * 3.55);
|
|
75
|
+
ctx.fillStyle = colors.darkgrey;
|
|
76
|
+
ctx.beginPath();
|
|
77
|
+
ctx.arc(0, 0, size * 0.4, 0, Math.PI * 2, true);
|
|
78
|
+
ctx.closePath();
|
|
79
|
+
ctx.fill();
|
|
80
|
+
ctx.drawImage(await loadImage(this.path("../../shared/assets/Win.png")), -size * 0.3, -size * 0.3, size * 0.6, size * 0.6);
|
|
81
|
+
ctx.restore();
|
|
82
|
+
// User Text
|
|
83
|
+
//
|
|
84
|
+
ctx.fillStyle = colors.blue;
|
|
85
|
+
this.changeFontSize(ctx, h * 0.17 + "px");
|
|
86
|
+
ctx.fillText(this.name, w * 0.3, h * 0.45, w * 0.425);
|
|
87
|
+
ctx.fillStyle = colors.idle;
|
|
88
|
+
ctx.fillText("#", w * 0.3 + w * 0.4375, h * 0.45);
|
|
89
|
+
ctx.fillStyle = colors.online;
|
|
90
|
+
ctx.fillText("1", w * 0.3 + w * 0.425 + w * 0.05, h * 0.45, w * 0.15625);
|
|
91
|
+
// Botlist URL
|
|
92
|
+
//
|
|
93
|
+
// ctx.textBaseline = 'middle';
|
|
94
|
+
ctx.textAlign = "center";
|
|
95
|
+
ctx.fillStyle = colors.blue;
|
|
96
|
+
this.roundRect(ctx, w * 0.5, -(w * 0.0625), w * 0.5, h * 0.4, w * 0.0625);
|
|
97
|
+
ctx.fill();
|
|
98
|
+
ctx.fillRect(w * 0.625, 0, w * 0.5, w * 0.0625);
|
|
99
|
+
ctx.fillStyle = colors.darkgrey;
|
|
100
|
+
this.changeFontSize(ctx, h * 0.15 + "px");
|
|
101
|
+
ctx.fillText("Sky CoTL Quiz Game", w * 0.55 + h * 0.65, h * 0.15, w * 0.421875);
|
|
102
|
+
// Counters
|
|
103
|
+
//
|
|
104
|
+
ctx.textAlign = "left";
|
|
105
|
+
ctx.fillStyle = colors.lightgrey;
|
|
106
|
+
ctx.drawImage(await loadImage(this.path("../../shared/assets/Point.png")), w * 0.3, h * 0.65, w * 0.0625, w * 0.0625);
|
|
107
|
+
this.changeFontSize(ctx, h * 0.15 + "px");
|
|
108
|
+
ctx.fillText(`${fancyCount(this.points)}/${fancyCount(this.total)} points`, w * 0.25 + h * 0.45, h * 0.65 + h * 0.15, h * 10);
|
|
109
|
+
// ctx.drawImage(await loadImage(this.path('../../shared/assets/vote.svg')), w * 0.6, h * 0.65, w * 0.0625, w * 0.0625);
|
|
110
|
+
// ctx.fillText(fancyCount(this.total), w * 0.55 + h * 0.45, h * 0.65 + h * 0.15, h * 0.45);
|
|
111
|
+
// Library
|
|
112
|
+
ctx.fillStyle = colors.grey;
|
|
113
|
+
this.roundRect(ctx, w * 0.875, h * 0.6, h * 0.4, h * 0.4, h * 0.15).clip();
|
|
114
|
+
ctx.fill();
|
|
115
|
+
ctx.drawImage(await loadImage(this.client.user.displayAvatarURL({ forceStatic: true, extension: "jpg" })), w * 0.875, h * 0.6, h * 0.4, h * 0.4);
|
|
116
|
+
return canvas.toBuffer("image/png");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { LeaderboardCard } from "./LeaderBoardCard.js";
|
|
2
|
+
export { GameWinnerCard } from "./WinnerCard.js";
|
|
3
|
+
export { UpdateTS } from "./UpdateTs.js";
|
|
4
|
+
export { UpdateEvent } from "./UpdateEvent.js";
|
|
5
|
+
export { ShardsUtil } from "./shardsUtil.js";
|
|
6
|
+
export { SkytimesUtils } from "./SkytimesUtils.js";
|
|
7
|
+
export * from "./SkytimesUtils.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { LeaderboardCard } from "./LeaderBoardCard.js";
|
|
2
|
+
export { GameWinnerCard } from "./WinnerCard.js";
|
|
3
|
+
export { UpdateTS } from "./UpdateTs.js";
|
|
4
|
+
export { UpdateEvent } from "./UpdateEvent.js";
|
|
5
|
+
export { ShardsUtil } from "./shardsUtil.js";
|
|
6
|
+
export { SkytimesUtils } from "./SkytimesUtils.js";
|
|
7
|
+
export * from "./SkytimesUtils.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import moment from "moment-timezone";
|
|
2
|
+
import "moment-duration-format";
|
|
3
|
+
import type { ShardsCountdown } from "../typings.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sequence of Shards pattern
|
|
6
|
+
*/
|
|
7
|
+
declare const shardSequence: readonly ["C", "b", "A", "a", "B", "b", "C", "a", "A", "b", "B", "a"];
|
|
8
|
+
/**
|
|
9
|
+
* Sequence of realms pattern of shard
|
|
10
|
+
*/
|
|
11
|
+
declare const realmSequence: readonly ["prairie", "forest", "valley", "wasteland", "vault"];
|
|
12
|
+
/**
|
|
13
|
+
* @class shardsUtil
|
|
14
|
+
* @classdesc A class to handle shards and realms indexing.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ShardsUtil {
|
|
17
|
+
/**
|
|
18
|
+
* @method getDate - get provided date in moment
|
|
19
|
+
* @param date - date to get in moment
|
|
20
|
+
*/
|
|
21
|
+
static getDate(date?: string | undefined | null): moment.Moment | string;
|
|
22
|
+
/**
|
|
23
|
+
* Returns shards index for a given date
|
|
24
|
+
* @param date
|
|
25
|
+
*/
|
|
26
|
+
static shardsIndex(date: moment.Moment): {
|
|
27
|
+
currentShard: (typeof shardSequence)[number];
|
|
28
|
+
currentRealm: (typeof realmSequence)[number];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns suffix for a given number
|
|
32
|
+
* @param number The number to get the suffix for
|
|
33
|
+
*/
|
|
34
|
+
static getSuffix(number: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get all three shards status for a given date relative to the current time
|
|
37
|
+
* @param date The date for which to get the status for
|
|
38
|
+
*/
|
|
39
|
+
static getStatus(date: moment.Moment): ShardsCountdown[] | "No Shard";
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import moment from "moment-timezone";
|
|
2
|
+
import "moment-duration-format";
|
|
3
|
+
import { shardsTimeline, shardConfig } from "../constants/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Sequence of Shards pattern
|
|
6
|
+
*/
|
|
7
|
+
const shardSequence = ["C", "b", "A", "a", "B", "b", "C", "a", "A", "b", "B", "a"];
|
|
8
|
+
/**
|
|
9
|
+
* Sequence of realms pattern of shard
|
|
10
|
+
*/
|
|
11
|
+
const realmSequence = ["prairie", "forest", "valley", "wasteland", "vault"];
|
|
12
|
+
/**
|
|
13
|
+
* @class shardsUtil
|
|
14
|
+
* @classdesc A class to handle shards and realms indexing.
|
|
15
|
+
*/
|
|
16
|
+
export class ShardsUtil {
|
|
17
|
+
/**
|
|
18
|
+
* @method getDate - get provided date in moment
|
|
19
|
+
* @param date - date to get in moment
|
|
20
|
+
*/
|
|
21
|
+
static getDate(date) {
|
|
22
|
+
const timezone = "America/Los_Angeles";
|
|
23
|
+
let currentDate;
|
|
24
|
+
try {
|
|
25
|
+
if (date) {
|
|
26
|
+
currentDate = moment.tz(date, "Y-MM-DD", timezone).startOf("day");
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
currentDate = moment().tz(timezone);
|
|
30
|
+
}
|
|
31
|
+
if (!currentDate.isValid()) {
|
|
32
|
+
return "invalid";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return currentDate;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new Error(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns shards index for a given date
|
|
44
|
+
* @param date
|
|
45
|
+
*/
|
|
46
|
+
static shardsIndex(date) {
|
|
47
|
+
const dayOfMonth = date.date();
|
|
48
|
+
const shardIndex = (dayOfMonth - 1) % shardSequence.length;
|
|
49
|
+
const currentShard = shardSequence[shardIndex];
|
|
50
|
+
const realmIndex = (dayOfMonth - 1) % realmSequence.length;
|
|
51
|
+
const currentRealm = realmSequence[realmIndex];
|
|
52
|
+
return { currentShard, currentRealm };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns suffix for a given number
|
|
56
|
+
* @param number The number to get the suffix for
|
|
57
|
+
*/
|
|
58
|
+
static getSuffix(number) {
|
|
59
|
+
const suffixes = ["th", "st", "nd", "rd"];
|
|
60
|
+
const remainder10 = number % 10;
|
|
61
|
+
const remainder100 = number % 100;
|
|
62
|
+
// Suffix for shards index
|
|
63
|
+
return suffixes[remainder10 === 1 && remainder100 !== 11
|
|
64
|
+
? 1
|
|
65
|
+
: remainder10 === 2 && remainder100 !== 12
|
|
66
|
+
? 2
|
|
67
|
+
: remainder10 === 3 && remainder100 !== 13
|
|
68
|
+
? 3
|
|
69
|
+
: 0];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get all three shards status for a given date relative to the current time
|
|
73
|
+
* @param date The date for which to get the status for
|
|
74
|
+
*/
|
|
75
|
+
static getStatus(date) {
|
|
76
|
+
const timezone = "America/Los_Angeles";
|
|
77
|
+
const { currentShard } = this.shardsIndex(date);
|
|
78
|
+
const timings = shardsTimeline(date)[currentShard];
|
|
79
|
+
const present = moment().tz(timezone);
|
|
80
|
+
const isNoShard = shardConfig[currentShard].weekdays.includes(date.day());
|
|
81
|
+
if (isNoShard)
|
|
82
|
+
return "No Shard";
|
|
83
|
+
const toReturn = [];
|
|
84
|
+
for (let i = 0; i < timings.length; i++) {
|
|
85
|
+
const eventTiming = timings[i];
|
|
86
|
+
// Active
|
|
87
|
+
if (present.isBetween(eventTiming.start, eventTiming.end)) {
|
|
88
|
+
toReturn.push({
|
|
89
|
+
index: i + 1,
|
|
90
|
+
active: true,
|
|
91
|
+
start: eventTiming.start,
|
|
92
|
+
end: eventTiming.end,
|
|
93
|
+
duration: moment.duration(eventTiming.end.diff(present)).format("d[d] h[h] m[m] s[s]"),
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
// Yet to fall
|
|
97
|
+
}
|
|
98
|
+
else if (present.isBefore(eventTiming.start)) {
|
|
99
|
+
toReturn.push({
|
|
100
|
+
index: i + 1,
|
|
101
|
+
active: false,
|
|
102
|
+
start: eventTiming.start,
|
|
103
|
+
end: eventTiming.end,
|
|
104
|
+
duration: moment.duration(eventTiming.start.diff(present)).format("d[d] h[h] m[m] s[s]"),
|
|
105
|
+
});
|
|
106
|
+
continue;
|
|
107
|
+
// All ended
|
|
108
|
+
}
|
|
109
|
+
else if (present.isAfter(eventTiming.end)) {
|
|
110
|
+
toReturn.push({
|
|
111
|
+
index: i + 1,
|
|
112
|
+
ended: true,
|
|
113
|
+
start: eventTiming.start,
|
|
114
|
+
end: eventTiming.end,
|
|
115
|
+
duration: moment.duration(present.diff(eventTiming.end)).format("d[d] h[h] m[m] s[s]"),
|
|
116
|
+
});
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return toReturn;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
blue: string;
|
|
3
|
+
white: string;
|
|
4
|
+
lightgrey: string;
|
|
5
|
+
grey: string;
|
|
6
|
+
darkgrey: string;
|
|
7
|
+
black: string;
|
|
8
|
+
online: string;
|
|
9
|
+
offline: string;
|
|
10
|
+
dnd: string;
|
|
11
|
+
idle: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function fancyCount(n: number): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
blue: "#7289DA",
|
|
3
|
+
white: "#FFFFFF",
|
|
4
|
+
lightgrey: "#99AAB5",
|
|
5
|
+
grey: "#2C2F33",
|
|
6
|
+
darkgrey: "#23272A",
|
|
7
|
+
black: "#000000",
|
|
8
|
+
online: "#2db85b",
|
|
9
|
+
offline: "#666",
|
|
10
|
+
dnd: "#cc3737",
|
|
11
|
+
idle: "#dab026",
|
|
12
|
+
};
|
|
13
|
+
export function fancyCount(n) {
|
|
14
|
+
if (n > 1000000)
|
|
15
|
+
return Math.floor(n / 1000000) + "M";
|
|
16
|
+
if (n > 1000) {
|
|
17
|
+
if (n < 10000)
|
|
18
|
+
return (n / 1000).toFixed(1) + "k";
|
|
19
|
+
return Math.floor(n / 1000) + "k";
|
|
20
|
+
}
|
|
21
|
+
return Math.floor(n) + "";
|
|
22
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface EventData {
|
|
2
|
+
[key: string]: {
|
|
3
|
+
/** Name of the event */
|
|
4
|
+
name: string;
|
|
5
|
+
/** The index of the event to appear on the embed */
|
|
6
|
+
index: number;
|
|
7
|
+
/** The Offset of the event (in minutes) */
|
|
8
|
+
offset: number;
|
|
9
|
+
/** Approximate duration of the event during which its active after it starts (in minutes) */
|
|
10
|
+
duration?: number;
|
|
11
|
+
/** The interval at which the event occurs (in minutes) */
|
|
12
|
+
interval?: number;
|
|
13
|
+
/** Whether to display all their occurrence times in the embed */
|
|
14
|
+
displayAllTimes?: boolean;
|
|
15
|
+
/** The days on which the event occurs */
|
|
16
|
+
occursOn?: {
|
|
17
|
+
/** Weekdays on which the event occurs */
|
|
18
|
+
weekDays?: number[];
|
|
19
|
+
/** The day on which the event occurs */
|
|
20
|
+
dayOfTheMonth?: number;
|
|
21
|
+
};
|
|
22
|
+
/** Infographic related to the event, if any (Discord link)*/
|
|
23
|
+
infographic?: {
|
|
24
|
+
/** Credit */
|
|
25
|
+
by: string;
|
|
26
|
+
/** The guide */
|
|
27
|
+
image: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare const eventData: EventData;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const getMinutes = (hours) => hours * 60;
|
|
2
|
+
export const eventData = {
|
|
3
|
+
geyser: {
|
|
4
|
+
name: "Geyser",
|
|
5
|
+
index: 0,
|
|
6
|
+
duration: 15,
|
|
7
|
+
offset: 0,
|
|
8
|
+
infographic: {
|
|
9
|
+
by: "Clement",
|
|
10
|
+
image: "https://media.discordapp.net/attachments/867638574571323424/1252998364941914243/Visit_Geyser_Clement.png?ex=66744129&is=6672efa9&hm=8d76d1767aca362d23547b1e3beb2b610f58e4fbec24b12af56fdc745f7074e8&",
|
|
11
|
+
},
|
|
12
|
+
displayAllTimes: true,
|
|
13
|
+
interval: getMinutes(2),
|
|
14
|
+
},
|
|
15
|
+
grandma: {
|
|
16
|
+
name: "Grandma",
|
|
17
|
+
index: 1,
|
|
18
|
+
duration: 15,
|
|
19
|
+
offset: 30,
|
|
20
|
+
infographic: {
|
|
21
|
+
by: "Clement",
|
|
22
|
+
image: "https://media.discordapp.net/attachments/867638574571323424/1252998366288416849/Visit_Grandma_Clement.png?ex=6674412a&is=6672efaa&hm=7228b695ec7008204fede2f3d6b4864a06a7cfa25a14ab4d7572957ee940044c&",
|
|
23
|
+
},
|
|
24
|
+
displayAllTimes: true,
|
|
25
|
+
interval: getMinutes(2),
|
|
26
|
+
},
|
|
27
|
+
turtle: {
|
|
28
|
+
name: "Turtle",
|
|
29
|
+
index: 2,
|
|
30
|
+
duration: 10,
|
|
31
|
+
offset: 50,
|
|
32
|
+
infographic: {
|
|
33
|
+
by: "Velvet",
|
|
34
|
+
image: "https://media.discordapp.net/attachments/867638574571323424/1252998363205472316/Visit_Turtle_Velvet.jpg?ex=66744129&is=6672efa9&hm=8c189ff8501fc88810606b832addbea8a9a81eb7a7a6b17019ff1ced593e1ae8&",
|
|
35
|
+
},
|
|
36
|
+
displayAllTimes: true,
|
|
37
|
+
interval: getMinutes(2),
|
|
38
|
+
},
|
|
39
|
+
"daily-reset": {
|
|
40
|
+
name: "Daily Reset",
|
|
41
|
+
index: 3,
|
|
42
|
+
offset: 0,
|
|
43
|
+
interval: getMinutes(24),
|
|
44
|
+
},
|
|
45
|
+
eden: {
|
|
46
|
+
name: "Eden/Weekly Reset",
|
|
47
|
+
index: 4,
|
|
48
|
+
offset: 0,
|
|
49
|
+
interval: getMinutes(24 * 7),
|
|
50
|
+
occursOn: { weekDays: [7] },
|
|
51
|
+
},
|
|
52
|
+
aurora: {
|
|
53
|
+
name: "Aurora's concert",
|
|
54
|
+
index: 5,
|
|
55
|
+
offset: 0,
|
|
56
|
+
duration: 50,
|
|
57
|
+
displayAllTimes: true,
|
|
58
|
+
interval: getMinutes(2),
|
|
59
|
+
},
|
|
60
|
+
"dream-skater": {
|
|
61
|
+
name: "Dream Skater",
|
|
62
|
+
index: 6,
|
|
63
|
+
duration: 15,
|
|
64
|
+
displayAllTimes: true,
|
|
65
|
+
occursOn: { weekDays: [5, 6, 7] },
|
|
66
|
+
offset: getMinutes(1),
|
|
67
|
+
interval: getMinutes(2),
|
|
68
|
+
},
|
|
69
|
+
"passage-quests": {
|
|
70
|
+
name: "Passage Quests",
|
|
71
|
+
index: 7,
|
|
72
|
+
offset: 0,
|
|
73
|
+
displayAllTimes: true,
|
|
74
|
+
interval: 15,
|
|
75
|
+
},
|
|
76
|
+
"nest-sunset": {
|
|
77
|
+
name: "Nest Sunset",
|
|
78
|
+
index: 8,
|
|
79
|
+
offset: 40,
|
|
80
|
+
displayAllTimes: true,
|
|
81
|
+
interval: getMinutes(1),
|
|
82
|
+
},
|
|
83
|
+
"fireworks-festival": {
|
|
84
|
+
name: "Fireworks Festival",
|
|
85
|
+
index: 9,
|
|
86
|
+
offset: 0,
|
|
87
|
+
displayAllTimes: true,
|
|
88
|
+
interval: getMinutes(4),
|
|
89
|
+
occursOn: { dayOfTheMonth: 1 },
|
|
90
|
+
},
|
|
91
|
+
"fairy-ring": {
|
|
92
|
+
name: "Fairy Ring",
|
|
93
|
+
index: 11,
|
|
94
|
+
offset: 50,
|
|
95
|
+
displayAllTimes: true,
|
|
96
|
+
interval: 60,
|
|
97
|
+
},
|
|
98
|
+
"brook-rainbow": {
|
|
99
|
+
name: "Forest Brook Rainbow",
|
|
100
|
+
index: 12,
|
|
101
|
+
displayAllTimes: true,
|
|
102
|
+
offset: getMinutes(5),
|
|
103
|
+
interval: getMinutes(12),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const shardConfig: {
|
|
2
|
+
a: {
|
|
3
|
+
type: string;
|
|
4
|
+
colors: string;
|
|
5
|
+
weekdays: number[];
|
|
6
|
+
};
|
|
7
|
+
A: {
|
|
8
|
+
type: string;
|
|
9
|
+
colors: string;
|
|
10
|
+
weekdays: number[];
|
|
11
|
+
};
|
|
12
|
+
b: {
|
|
13
|
+
type: string;
|
|
14
|
+
colors: string;
|
|
15
|
+
weekdays: number[];
|
|
16
|
+
};
|
|
17
|
+
B: {
|
|
18
|
+
type: string;
|
|
19
|
+
colors: string;
|
|
20
|
+
weekdays: number[];
|
|
21
|
+
};
|
|
22
|
+
C: {
|
|
23
|
+
type: string;
|
|
24
|
+
colors: string;
|
|
25
|
+
weekdays: number[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export interface ShardInfo {
|
|
29
|
+
area: string;
|
|
30
|
+
rewards: string;
|
|
31
|
+
image: string;
|
|
32
|
+
type: string;
|
|
33
|
+
colors: string;
|
|
34
|
+
weekdays: number[];
|
|
35
|
+
locations: {
|
|
36
|
+
description: string;
|
|
37
|
+
image: string;
|
|
38
|
+
}[];
|
|
39
|
+
}
|
|
40
|
+
export interface ShardsInfo {
|
|
41
|
+
[key: string]: {
|
|
42
|
+
[key: string]: ShardInfo;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the shard information for each area
|
|
47
|
+
* @example
|
|
48
|
+
* const info = shardsInfo[currentRealm][currentShard]
|
|
49
|
+
*/
|
|
50
|
+
export declare const shardsInfo: ShardsInfo;
|