enefel 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/color.js ADDED
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isColor = exports.getGameColors = exports.colorShade = void 0;
4
+ exports.invertColor = invertColor;
5
+ exports.isColorTooClose = isColorTooClose;
6
+ const colorShade = (col, amt) => {
7
+ if (!col) {
8
+ return "#000000"; // Retourne noir par défaut si la couleur est null ou undefined
9
+ }
10
+ col = col.replace(/^#/, "");
11
+ if (col.length === 3) {
12
+ col = col[0] + col[0] + col[1] + col[1] + col[2] + col[2];
13
+ }
14
+ const parts = col.match(/.{2}/g);
15
+ if (!parts || parts.length !== 3) {
16
+ return "#000000"; // Retourne noir par défaut si le format est invalide
17
+ }
18
+ let [r, g, b] = parts.map((part) => parseInt(part, 16) + amt);
19
+ r = Math.max(Math.min(255, r), 0);
20
+ g = Math.max(Math.min(255, g), 0);
21
+ b = Math.max(Math.min(255, b), 0);
22
+ const toHex = (n) => n.toString(16).padStart(2, "0");
23
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
24
+ };
25
+ exports.colorShade = colorShade;
26
+ function deltaE(rgbA, rgbB) {
27
+ let labA = rgb2lab(rgbA);
28
+ let labB = rgb2lab(rgbB);
29
+ let deltaL = labA[0] - labB[0];
30
+ let deltaA = labA[1] - labB[1];
31
+ let deltaB = labA[2] - labB[2];
32
+ let c1 = Math.sqrt(labA[1] * labA[1] + labA[2] * labA[2]);
33
+ let c2 = Math.sqrt(labB[1] * labB[1] + labB[2] * labB[2]);
34
+ let deltaC = c1 - c2;
35
+ let deltaH = deltaA * deltaA + deltaB * deltaB - deltaC * deltaC;
36
+ deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
37
+ let sc = 1.0 + 0.045 * c1;
38
+ let sh = 1.0 + 0.015 * c1;
39
+ let deltaLKlsl = deltaL / 1.0;
40
+ let deltaCkcsc = deltaC / sc;
41
+ let deltaHkhsh = deltaH / sh;
42
+ let i = deltaLKlsl * deltaLKlsl + deltaCkcsc * deltaCkcsc + deltaHkhsh * deltaHkhsh;
43
+ return i < 0 ? 0 : Math.sqrt(i);
44
+ }
45
+ function rgb2lab(rgb) {
46
+ let r = rgb[0] / 255, g = rgb[1] / 255, b = rgb[2] / 255, x, y, z;
47
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
48
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
49
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
50
+ x = (r * 0.4124 + g * 0.3576 + b * 0.1805) / 0.95047;
51
+ y = (r * 0.2126 + g * 0.7152 + b * 0.0722) / 1.0;
52
+ z = (r * 0.0193 + g * 0.1192 + b * 0.9505) / 1.08883;
53
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
54
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
55
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
56
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
57
+ }
58
+ function hexToRgb(hex) {
59
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
60
+ return result
61
+ ? {
62
+ r: parseInt(result[1], 16),
63
+ g: parseInt(result[2], 16),
64
+ b: parseInt(result[3], 16),
65
+ }
66
+ : null;
67
+ }
68
+ function distanceColor(a, b) {
69
+ const rgbA = hexToRgb(a);
70
+ const rgbB = hexToRgb(b);
71
+ if (!rgbA || !rgbB)
72
+ return 100; // Retourne une grande distance si les couleurs ne sont pas valides
73
+ return deltaE([rgbA.r, rgbA.g, rgbA.b], [rgbB.r, rgbB.g, rgbB.b]);
74
+ }
75
+ // Delta E Perception
76
+ // <= 1.0 Not perceptible by human eyes.
77
+ // 1 - 2 Perceptible through close observation.
78
+ // 2 - 10 Perceptible at a glance.
79
+ // 11 - 49 Colors are more similar than opposite
80
+ // 100 Colors are exact opposite
81
+ function isColorTooClose(a, b) {
82
+ return distanceColor(a, b) < 50;
83
+ }
84
+ function invertColor(hexTripletColor) {
85
+ let color = hexTripletColor;
86
+ color = color.substring(1); // remove #
87
+ let colorInt = parseInt(color, 16); // convert to integer
88
+ colorInt = 0xffffff ^ colorInt; // invert three bytes
89
+ color = colorInt.toString(16); // convert to hex
90
+ color = ("000000" + color).slice(-6); // pad with leading zeros
91
+ color = "#" + color; // prepend #
92
+ return color;
93
+ }
94
+ const isColor = (strColor) => {
95
+ if (!strColor)
96
+ return false;
97
+ const regex = /^((0x){0,1}|#{0,1})([0-9A-F]{8}|[0-9A-F]{6})$/gi;
98
+ return regex.test(strColor);
99
+ };
100
+ exports.isColor = isColor;
101
+ const getGameColors = (game) => {
102
+ const color1 = game?.team1?.color1;
103
+ const color1Bis = game?.team1?.color2;
104
+ let color2 = game?.team2?.color1;
105
+ let color2Bis = game?.team2?.color2;
106
+ if (color1 && color2 && isColorTooClose(`#${color1}`, `#${color2}`)) {
107
+ color2 = game?.team2?.color2;
108
+ color2Bis = game?.team2?.color1;
109
+ }
110
+ return [color1, color1Bis, color2, color2Bis];
111
+ };
112
+ exports.getGameColors = getGameColors;
package/dist/date.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateTimeRemaining = void 0;
4
+ exports.isDateMoreThanDays = isDateMoreThanDays;
5
+ exports.isFullMoon = isFullMoon;
6
+ function getMoonPhase(year, month, day) {
7
+ let c = 0;
8
+ let e = 0;
9
+ let jd = 0;
10
+ let b = 0;
11
+ if (month < 3) {
12
+ year--;
13
+ month += 12;
14
+ }
15
+ ++month;
16
+ c = 365.25 * year;
17
+ e = 30.6 * month;
18
+ jd = c + e + day - 694039.09; // jd is total days elapsed
19
+ jd /= 29.5305882; // divide by the moon cycle
20
+ b = parseInt(jd.toString()); // int(jd) -> b, take integer part of jd
21
+ jd -= b; // subtract integer part to leave fractional part of original jd
22
+ b = Math.round(jd * 8); // scale fraction from 0-8 and round
23
+ if (b >= 8) {
24
+ b = 0; // 0 and 8 are the same so turn 8 into 0
25
+ }
26
+ // 0 => New Moon
27
+ // 1 => Waxing Crescent Moon
28
+ // 2 => Quarter Moon
29
+ // 3 => Waxing Gibbous Moon
30
+ // 4 => Full Moon
31
+ // 5 => Waning Gibbous Moon
32
+ // 6 => Last Quarter Moon
33
+ // 7 => Waning Crescent Moon
34
+ return b;
35
+ }
36
+ function isFullMoon(currentDate = new Date()) {
37
+ var year = currentDate.getFullYear();
38
+ var month = currentDate.getMonth() + 1;
39
+ var day = currentDate.getDate();
40
+ return getMoonPhase(year, month, day) === 4;
41
+ }
42
+ function isDateMoreThanDays(dateString, days = 30) {
43
+ // Convert the date string to a Date object
44
+ const endDate = new Date(dateString);
45
+ // Get the current date
46
+ const now = new Date();
47
+ // Calculate the difference in milliseconds between the two dates
48
+ const difference = now.getTime() - endDate.getTime();
49
+ // Convert the difference to days
50
+ const daysDiff = difference / (1000 * 3600 * 24);
51
+ // Convert the days to months
52
+ const monthsDiff = daysDiff / days;
53
+ // If the difference is greater than or equal to 1, the date is more than one month ago
54
+ return monthsDiff >= 1;
55
+ }
56
+ const calculateTimeRemaining = (targetDate) => {
57
+ const targetTime = new Date(targetDate).getTime();
58
+ const currentTime = new Date().getTime();
59
+ const timeRemaining = targetTime - currentTime;
60
+ return timeRemaining > 0 ? timeRemaining : 0;
61
+ };
62
+ exports.calculateTimeRemaining = calculateTimeRemaining;
package/dist/dice.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlayerDice = void 0;
4
+ const DICE = {
5
+ default: {
6
+ color: "#000000",
7
+ background: "#ffffff",
8
+ },
9
+ };
10
+ const getPlayerDice = () => {
11
+ return DICE.default;
12
+ };
13
+ exports.getPlayerDice = getPlayerDice;
package/dist/elo.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESULT_WIN = exports.RESULT_LOST = exports.RESULT_DRAW = exports.ELO_START = void 0;
4
+ exports.getNewRating = getNewRating;
5
+ const ELO_START = 1000;
6
+ exports.ELO_START = ELO_START;
7
+ const FACTOR = 32;
8
+ const RESULT_WIN = 1;
9
+ exports.RESULT_WIN = RESULT_WIN;
10
+ const RESULT_LOST = -1;
11
+ exports.RESULT_LOST = RESULT_LOST;
12
+ const RESULT_DRAW = 0;
13
+ exports.RESULT_DRAW = RESULT_DRAW;
14
+ function getRatingDelta(myRating, opponentRating, myGameResult) {
15
+ if ([RESULT_LOST, RESULT_DRAW, RESULT_WIN].indexOf(myGameResult) === -1) {
16
+ myGameResult = RESULT_DRAW;
17
+ }
18
+ let result = 0.5;
19
+ if (myGameResult === RESULT_WIN) {
20
+ result = 1;
21
+ }
22
+ else if (myGameResult === RESULT_LOST) {
23
+ result = 0;
24
+ }
25
+ const myChanceToWin = 1 / (1 + Math.pow(10, (opponentRating - myRating) / 400));
26
+ return Math.round(FACTOR * (result - myChanceToWin));
27
+ }
28
+ function getNewRating(myRating, opponentRating, myGameResult) {
29
+ return myRating + getRatingDelta(myRating, opponentRating, myGameResult);
30
+ }
package/dist/game.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGameFirstHalfTime = exports.isGameFinish = exports.hasGameCasualty = exports.getGameFanBonus = exports.getGameFan = exports.getDateStartHalfTime = exports.getDateEndHalfTime = exports.GAME_TYPE = exports.GAME_STATUS = exports.CLEAN_HISTORY_DAY = void 0;
4
+ const random_1 = require("./random");
5
+ const time_1 = require("./time");
6
+ const CLEAN_HISTORY_DAY = 30;
7
+ exports.CLEAN_HISTORY_DAY = CLEAN_HISTORY_DAY;
8
+ var GAME_TYPE;
9
+ (function (GAME_TYPE) {
10
+ GAME_TYPE["DIVISION"] = "division";
11
+ GAME_TYPE["FRIENDLY"] = "friendly";
12
+ GAME_TYPE["OPEN"] = "open";
13
+ GAME_TYPE["PLAYOFF"] = "playoff";
14
+ })(GAME_TYPE || (exports.GAME_TYPE = GAME_TYPE = {}));
15
+ var GAME_STATUS;
16
+ (function (GAME_STATUS) {
17
+ GAME_STATUS[GAME_STATUS["WAITING"] = 0] = "WAITING";
18
+ GAME_STATUS[GAME_STATUS["BEFORE"] = 1] = "BEFORE";
19
+ GAME_STATUS[GAME_STATUS["ONGOING"] = 2] = "ONGOING";
20
+ GAME_STATUS[GAME_STATUS["TD"] = 3] = "TD";
21
+ GAME_STATUS[GAME_STATUS["END"] = 4] = "END";
22
+ GAME_STATUS[GAME_STATUS["FINISH"] = 5] = "FINISH";
23
+ GAME_STATUS[GAME_STATUS["HALFTIME"] = 6] = "HALFTIME";
24
+ })(GAME_STATUS || (exports.GAME_STATUS = GAME_STATUS = {}));
25
+ const isGameFinish = (game) => {
26
+ return game.status === GAME_STATUS.END || game.status === GAME_STATUS.FINISH;
27
+ };
28
+ exports.isGameFinish = isGameFinish;
29
+ const hasGameCasualty = (game) => {
30
+ return game.type !== GAME_TYPE.FRIENDLY;
31
+ };
32
+ exports.hasGameCasualty = hasGameCasualty;
33
+ const getGameFanBonus = (game) => {
34
+ // if (game.type === GAME_TYPE.FRIENDLY) {
35
+ // return -5;
36
+ // }
37
+ if (game.type === GAME_TYPE.PLAYOFF) {
38
+ return 5;
39
+ }
40
+ return 0;
41
+ };
42
+ exports.getGameFanBonus = getGameFanBonus;
43
+ const getGameFan = (game) => {
44
+ return (0, random_1.d6)(2) + getGameFanBonus(game);
45
+ };
46
+ exports.getGameFan = getGameFan;
47
+ const getDateStartHalfTime = (game) => {
48
+ const start = new Date(game.date_start);
49
+ const end = new Date(game.date_end);
50
+ return new Date(start.getTime() +
51
+ (end.getTime() - start.getTime()) / 2 -
52
+ ((0, time_1.getTime)(time_1.TYPE_TIMER.HALF_TIME_PAUSE) * 1000) / 2);
53
+ };
54
+ exports.getDateStartHalfTime = getDateStartHalfTime;
55
+ const getDateEndHalfTime = (game) => {
56
+ const half = getDateStartHalfTime(game);
57
+ return new Date(half.getTime() + (0, time_1.getTime)(time_1.TYPE_TIMER.HALF_TIME_PAUSE) * 1000);
58
+ };
59
+ exports.getDateEndHalfTime = getDateEndHalfTime;
60
+ const isGameFirstHalfTime = (game) => {
61
+ const now = new Date(Date.now());
62
+ return getDateStartHalfTime(game).getTime() - now.getTime() > 0;
63
+ };
64
+ exports.isGameFirstHalfTime = isGameFirstHalfTime;
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ // const ICON_MAP = {
3
+ // "snotling-lineman1": { x: 0, y: 0 },
4
+ // "snotling-lineman1_1": { x: 1, y: 0 },
5
+ // "snotling-lineman1_2": { x: 2, y: 0 },
6
+ // "snotling-runner1": { x: 0, y: 1 },
7
+ // "snotling-runner1_1": { x: 1, y: 1 },
8
+ // "snotling-runner1_2": { x: 2, y: 1 },
9
+ // "snotling-wagon1": { x: 0, y: 2 },
10
+ // "snotling-wagon1_1": { x: 1, y: 2 },
11
+ // "snotling-wagon1_2": { x: 2, y: 2 },
12
+ // "snotling-troll1": { x: 0, y: 3 },
13
+ // "snotling-troll1_1": { x: 1, y: 3 },
14
+ // "snotling-troll1_2": { x: 2, y: 3 },
15
+ // "nurgle-rotter1": { x: 0, y: 4 },
16
+ // "nurgle-rotter1_1": { x: 1, y: 4 },
17
+ // "nurgle-rotter1_2": { x: 2, y: 4 },
18
+ // "nurgle-pestigor1": { x: 0, y: 5 },
19
+ // "nurgle-pestigor1_1": { x: 1, y: 5 },
20
+ // "nurgle-pestigor1_2": { x: 2, y: 5 },
21
+ // "nurgle-bloater1": { x: 0, y: 6 },
22
+ // "nurgle-bloater1_1": { x: 1, y: 6 },
23
+ // "nurgle-bloater1_2": { x: 2, y: 6 },
24
+ // "nurgle-rotspawn1": { x: 0, y: 7 },
25
+ // "nurgle-rotspawn1_1": { x: 1, y: 7 },
26
+ // "nurgle-rotspawn1_2": { x: 2, y: 7 },
27
+ // "necromantic-zombie1": { x: 0, y: 8 },
28
+ // "necromantic-zombie1_1": { x: 1, y: 8 },
29
+ // "necromantic-zombie1_2": { x: 2, y: 8 },
30
+ // "necromantic-ghoul1": { x: 0, y: 9 },
31
+ // "necromantic-ghoul1_1": { x: 1, y: 9 },
32
+ // "necromantic-ghoul1_2": { x: 2, y: 9 },
33
+ // "necromantic-wraith1": { x: 0, y: 10 },
34
+ // "necromantic-wraith1_1": { x: 1, y: 10 },
35
+ // "necromantic-wraith1_2": { x: 2, y: 10 },
36
+ // "necromantic-werewolf1": { x: 0, y: 11 },
37
+ // "necromantic-werewolf1_1": { x: 1, y: 11 },
38
+ // "necromantic-werewolf1_2": { x: 2, y: 11 },
39
+ // "necromantic-golem1": { x: 0, y: 12 },
40
+ // "necromantic-golem1_1": { x: 1, y: 12 },
41
+ // "necromantic-golem1_2": { x: 2, y: 12 },
42
+ // "khorne-lineman1": { x: 0, y: 13 },
43
+ // "khorne-lineman1_1": { x: 1, y: 13 },
44
+ // "khorne-lineman1_2": { x: 2, y: 13 },
45
+ // "khorne-khorngor1": { x: 0, y: 14 },
46
+ // "khorne-khorngor1_1": { x: 1, y: 14 },
47
+ // "khorne-khorngor1_2": { x: 2, y: 14 },
48
+ // "khorne-bloodseeker1": { x: 0, y: 15 },
49
+ // "khorne-bloodseeker1_1": { x: 1, y: 15 },
50
+ // "khorne-bloodseeker1_2": { x: 2, y: 15 },
51
+ // "khorne-bloodspawn1": { x: 0, y: 16 },
52
+ // "khorne-bloodspawn1_1": { x: 1, y: 16 },
53
+ // "khorne-bloodspawn1_2": { x: 2, y: 16 },
54
+ // "imperial-lineman1": { x: 0, y: 17 },
55
+ // "imperial-lineman1_1": { x: 1, y: 17 },
56
+ // "imperial-lineman1_2": { x: 2, y: 17 },
57
+ // "imperial-thrower1": { x: 0, y: 18 },
58
+ // "imperial-thrower1_1": { x: 1, y: 18 },
59
+ // "imperial-thrower1_2": { x: 2, y: 18 },
60
+ // "imperial-blitzer1": { x: 0, y: 19 },
61
+ // "imperial-blitzer1_1": { x: 1, y: 19 },
62
+ // "imperial-blitzer1_2": { x: 2, y: 19 },
63
+ // "imperial-bodyguard1": { x: 0, y: 20 },
64
+ // "imperial-bodyguard1_1": { x: 1, y: 20 },
65
+ // "imperial-bodyguard1_2": { x: 2, y: 20 },
66
+ // "imperial-ogre1": { x: 0, y: 21 },
67
+ // "imperial-ogre1_1": { x: 1, y: 21 },
68
+ // "imperial-ogre1_2": { x: 2, y: 21 },
69
+ // "gobelin-lineman1": { x: 0, y: 22 },
70
+ // "gobelin-lineman1_1": { x: 1, y: 22 },
71
+ // "gobelin-lineman1_2": { x: 2, y: 22 },
72
+ // "gobelin-troll1": { x: 0, y: 23 },
73
+ // "gobelin-troll1_1": { x: 1, y: 23 },
74
+ // "gobelin-troll1_2": { x: 2, y: 23 },
75
+ // "elven-union-lineman1": { x: 0, y: 24 },
76
+ // "elven-union-lineman1_1": { x: 1, y: 24 },
77
+ // "elven-union-lineman1_2": { x: 2, y: 24 },
78
+ // "elven-union-thrower1": { x: 0, y: 25 },
79
+ // "elven-union-thrower1_1": { x: 1, y: 25 },
80
+ // "elven-union-thrower1_2": { x: 2, y: 25 },
81
+ // "elven-union-catcher1": { x: 0, y: 26 },
82
+ // "elven-union-catcher1_1": { x: 1, y: 26 },
83
+ // "elven-union-catcher1_2": { x: 2, y: 26 },
84
+ // "elven-union-blitzer1": { x: 0, y: 27 },
85
+ // "elven-union-blitzer1_1": { x: 1, y: 27 },
86
+ // "elven-union-blitzer1_2": { x: 2, y: 27 },
87
+ // "undead-skeleton1": { x: 0, y: 28 },
88
+ // "undead-skeleton1_1": { x: 1, y: 28 },
89
+ // "undead-skeleton1_2": { x: 2, y: 28 },
90
+ // "undead-zombie1": { x: 0, y: 29 },
91
+ // "undead-zombie1_1": { x: 1, y: 29 },
92
+ // "undead-zombie1_2": { x: 2, y: 29 },
93
+ // "undead-ghoul1": { x: 0, y: 30 },
94
+ // "undead-ghoul1_1": { x: 1, y: 30 },
95
+ // "undead-ghoul1_2": { x: 2, y: 30 },
96
+ // "undead-wight1": { x: 0, y: 31 },
97
+ // "undead-wight1_1": { x: 1, y: 31 },
98
+ // "undead-wight1_2": { x: 2, y: 31 },
99
+ // "undead-mummies1": { x: 0, y: 32 },
100
+ // "undead-mummies1_1": { x: 1, y: 32 },
101
+ // "undead-mummies1_2": { x: 2, y: 32 },
102
+ // "lizardmen-skink1": { x: 0, y: 33 },
103
+ // "lizardmen-skink1_1": { x: 1, y: 33 },
104
+ // "lizardmen-skink1_2": { x: 2, y: 33 },
105
+ // "lizardmen-chameleon1": { x: 0, y: 34 },
106
+ // "lizardmen-chameleon1_1": { x: 1, y: 34 },
107
+ // "lizardmen-chameleon1_2": { x: 2, y: 34 },
108
+ // "lizardmen-saurus1": { x: 0, y: 35 },
109
+ // "lizardmen-saurus1_1": { x: 1, y: 35 },
110
+ // "lizardmen-saurus1_2": { x: 2, y: 35 },
111
+ // "lizardmen-kroxigor1": { x: 0, y: 36 },
112
+ // "lizardmen-kroxigor1_1": { x: 1, y: 36 },
113
+ // "lizardmen-kroxigor1_2": { x: 2, y: 36 },
114
+ // "norse-lineman1": { x: 0, y: 37 },
115
+ // "norse-lineman1_1": { x: 1, y: 37 },
116
+ // "norse-lineman1_2": { x: 2, y: 37 },
117
+ // "norse-thrower1": { x: 0, y: 38 },
118
+ // "norse-thrower1_1": { x: 1, y: 38 },
119
+ // "norse-thrower1_2": { x: 2, y: 38 },
120
+ // "norse-catcher1": { x: 0, y: 39 },
121
+ // "norse-catcher1_1": { x: 1, y: 39 },
122
+ // "norse-catcher1_2": { x: 2, y: 39 },
123
+ // "norse-berserker1": { x: 0, y: 40 },
124
+ // "norse-berserker1_1": { x: 1, y: 40 },
125
+ // "norse-berserker1_2": { x: 2, y: 40 },
126
+ // "norse-ulfwereners1": { x: 0, y: 41 },
127
+ // "norse-ulfwereners1_1": { x: 1, y: 41 },
128
+ // "norse-ulfwereners1_2": { x: 2, y: 41 },
129
+ // "norse-yhetee1": { x: 0, y: 42 },
130
+ // "norse-yhetee1_1": { x: 1, y: 42 },
131
+ // "norse-yhetee1_2": { x: 2, y: 42 },
132
+ // "amazon-linewomen1": { x: 0, y: 43 },
133
+ // "amazon-linewomen1_1": { x: 1, y: 43 },
134
+ // "amazon-linewomen1_2": { x: 2, y: 43 },
135
+ // "amazon-thrower1": { x: 0, y: 44 },
136
+ // "amazon-thrower1_1": { x: 1, y: 44 },
137
+ // "amazon-thrower1_2": { x: 2, y: 44 },
138
+ // "amazon-catcher1": { x: 0, y: 45 },
139
+ // "amazon-catcher1_1": { x: 1, y: 45 },
140
+ // "amazon-catcher1_2": { x: 2, y: 45 },
141
+ // "amazon-blitzer1": { x: 0, y: 46 },
142
+ // "amazon-blitzer1_1": { x: 1, y: 46 },
143
+ // "amazon-blitzer1_2": { x: 2, y: 46 },
144
+ // human1: { x: 0, y: 47 },
145
+ // human1_1: { x: 1, y: 47 },
146
+ // human1_2: { x: 2, y: 47 },
147
+ // "human-catcher1": { x: 0, y: 48 },
148
+ // "human-catcher1_1": { x: 1, y: 48 },
149
+ // "human-catcher1_2": { x: 2, y: 48 },
150
+ // "human-thrower1": { x: 0, y: 49 },
151
+ // "human-thrower1_1": { x: 1, y: 49 },
152
+ // "human-thrower1_2": { x: 2, y: 49 },
153
+ // "human-blitzer1": { x: 0, y: 50 },
154
+ // "human-blitzer1_1": { x: 1, y: 50 },
155
+ // "human-blitzer1_2": { x: 2, y: 50 },
156
+ // "human-ogre1": { x: 0, y: 51 },
157
+ // "human-ogre1_1": { x: 1, y: 51 },
158
+ // "human-ogre1_2": { x: 2, y: 51 },
159
+ // orc1: { x: 0, y: 52 },
160
+ // orc1_1: { x: 1, y: 52 },
161
+ // orc1_2: { x: 2, y: 52 },
162
+ // "orc-thrower1": { x: 0, y: 53 },
163
+ // "orc-thrower1_1": { x: 1, y: 53 },
164
+ // "orc-thrower1_2": { x: 2, y: 53 },
165
+ // "orc-blitzer1": { x: 0, y: 54 },
166
+ // "orc-blitzer1_1": { x: 1, y: 54 },
167
+ // "orc-blitzer1_2": { x: 2, y: 54 },
168
+ // "orc-black-orc1": { x: 0, y: 55 },
169
+ // "orc-black-orc1_1": { x: 1, y: 55 },
170
+ // "orc-black-orc1_2": { x: 2, y: 55 },
171
+ // "orc-troll1": { x: 0, y: 56 },
172
+ // "orc-troll1_1": { x: 1, y: 56 },
173
+ // "orc-troll1_2": { x: 2, y: 56 },
174
+ // dwarf1: { x: 0, y: 57 },
175
+ // dwarf1_1: { x: 1, y: 57 },
176
+ // dwarf1_2: { x: 2, y: 57 },
177
+ // "dwarf-runner1": { x: 0, y: 58 },
178
+ // "dwarf-runner1_1": { x: 1, y: 58 },
179
+ // "dwarf-runner1_2": { x: 2, y: 58 },
180
+ // "dwarf-blitzer1": { x: 0, y: 59 },
181
+ // "dwarf-blitzer1_1": { x: 1, y: 59 },
182
+ // "dwarf-blitzer1_2": { x: 2, y: 59 },
183
+ // "dwarf-troll-slayer1": { x: 0, y: 60 },
184
+ // "dwarf-troll-slayer1_1": { x: 1, y: 60 },
185
+ // "dwarf-troll-slayer1_2": { x: 2, y: 60 },
186
+ // "dwarf-deathroller1": { x: 0, y: 61 },
187
+ // "dwarf-deathroller1_1": { x: 1, y: 61 },
188
+ // "dwarf-deathroller1_2": { x: 2, y: 61 },
189
+ // rat1: { x: 0, y: 62 },
190
+ // rat1_1: { x: 1, y: 62 },
191
+ // rat1_2: { x: 2, y: 62 },
192
+ // "rat-thrower1": { x: 0, y: 63 },
193
+ // "rat-thrower1_1": { x: 1, y: 63 },
194
+ // "rat-thrower1_2": { x: 2, y: 63 },
195
+ // "rat-runner1": { x: 0, y: 64 },
196
+ // "rat-runner1_1": { x: 1, y: 64 },
197
+ // "rat-runner1_2": { x: 2, y: 64 },
198
+ // "rat-blitzer1": { x: 0, y: 65 },
199
+ // "rat-blitzer1_1": { x: 1, y: 65 },
200
+ // "rat-blitzer1_2": { x: 2, y: 65 },
201
+ // "rat-ogre1": { x: 0, y: 66 },
202
+ // "rat-ogre1_1": { x: 1, y: 66 },
203
+ // "rat-ogre1_2": { x: 2, y: 66 },
204
+ // silvan1: { x: 0, y: 67 },
205
+ // silvan1_1: { x: 1, y: 67 },
206
+ // silvan1_2: { x: 2, y: 67 },
207
+ // "silvan-catcher1": { x: 0, y: 68 },
208
+ // "silvan-catcher1_1": { x: 1, y: 68 },
209
+ // "silvan-catcher1_2": { x: 2, y: 68 },
210
+ // "silvan-thrower1": { x: 0, y: 69 },
211
+ // "silvan-thrower1_1": { x: 1, y: 69 },
212
+ // "silvan-thrower1_2": { x: 2, y: 69 },
213
+ // "silvan-wardancer1": { x: 0, y: 70 },
214
+ // "silvan-wardancer1_1": { x: 1, y: 70 },
215
+ // "silvan-wardancer1_2": { x: 2, y: 70 },
216
+ // "chaos-beastman1": { x: 0, y: 71 },
217
+ // "chaos-beastman1_1": { x: 1, y: 71 },
218
+ // "chaos-beastman1_2": { x: 2, y: 71 },
219
+ // "chaos-warrior1": { x: 0, y: 72 },
220
+ // "chaos-warrior1_1": { x: 1, y: 72 },
221
+ // "chaos-warrior1_2": { x: 2, y: 72 },
222
+ // "chaos-minotaur1": { x: 0, y: 73 },
223
+ // "chaos-minotaur1_1": { x: 1, y: 73 },
224
+ // "chaos-minotaur1_2": { x: 2, y: 73 },
225
+ // "dark-elfe-lineman1": { x: 0, y: 74 },
226
+ // "dark-elfe-lineman1_1": { x: 1, y: 74 },
227
+ // "dark-elfe-lineman1_2": { x: 2, y: 74 },
228
+ // "dark-elfe-runner1": { x: 0, y: 75 },
229
+ // "dark-elfe-runner1_1": { x: 1, y: 75 },
230
+ // "dark-elfe-runner1_2": { x: 2, y: 75 },
231
+ // "dark-elfe-blitzer1": { x: 0, y: 76 },
232
+ // "dark-elfe-blitzer1_1": { x: 1, y: 76 },
233
+ // "dark-elfe-blitzer1_2": { x: 2, y: 76 },
234
+ // "dark-elfe-witch1": { x: 0, y: 77 },
235
+ // "dark-elfe-witch1_1": { x: 1, y: 77 },
236
+ // "dark-elfe-witch1_2": { x: 2, y: 77 },
237
+ // "chaos-dwarf-hobgobelin1": { x: 0, y: 78 },
238
+ // "chaos-dwarf-hobgobelin1_1": { x: 1, y: 78 },
239
+ // "chaos-dwarf-hobgobelin1_2": { x: 2, y: 78 },
240
+ // "chaos-dwarf-blocker1": { x: 0, y: 79 },
241
+ // "chaos-dwarf-blocker1_1": { x: 1, y: 79 },
242
+ // "chaos-dwarf-blocker1_2": { x: 2, y: 79 },
243
+ // "chaos-dwarf-bull-centaur1": { x: 0, y: 80 },
244
+ // "chaos-dwarf-bull-centaur1_1": { x: 1, y: 80 },
245
+ // "chaos-dwarf-bull-centaur1_2": { x: 2, y: 80 },
246
+ // "halfling-lineman1": { x: 0, y: 81 },
247
+ // "halfling-lineman1_1": { x: 1, y: 81 },
248
+ // "halfling-lineman1_2": { x: 2, y: 81 },
249
+ // "halfling-hefty1": { x: 0, y: 82 },
250
+ // "halfling-hefty1_1": { x: 1, y: 82 },
251
+ // "halfling-hefty1_2": { x: 2, y: 82 },
252
+ // "halfling-catcher1": { x: 0, y: 83 },
253
+ // "halfling-catcher1_1": { x: 1, y: 83 },
254
+ // "halfling-catcher1_2": { x: 2, y: 83 },
255
+ // "halfling-treeman1": { x: 0, y: 84 },
256
+ // "halfling-treeman1_1": { x: 1, y: 84 },
257
+ // "halfling-treeman1_2": { x: 2, y: 84 },
258
+ // };
259
+ // module.exports = {
260
+ // ICON_MAP,
261
+ // };
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SPP_TYPE = exports.ranges = exports.getSPP = exports.getNextRangeCoach = exports.getNextRange = exports.getCurrentRange = exports.getAgingMinExperience = exports.coachRanges = void 0;
4
+ var GAME_TYPE;
5
+ (function (GAME_TYPE) {
6
+ GAME_TYPE["FRIENDLY"] = "friendly";
7
+ GAME_TYPE["DIVISION"] = "division";
8
+ GAME_TYPE["OPEN"] = "open";
9
+ GAME_TYPE["PLAYOFF"] = "playoff";
10
+ })(GAME_TYPE || (GAME_TYPE = {}));
11
+ // STAR PLAYER POINTS
12
+ var SPP_TYPE;
13
+ (function (SPP_TYPE) {
14
+ SPP_TYPE["BONUS"] = "BONUS";
15
+ SPP_TYPE["INT"] = "INT";
16
+ SPP_TYPE["KO"] = "KO";
17
+ SPP_TYPE["REU"] = "REU";
18
+ SPP_TYPE["SOR"] = "SOR";
19
+ SPP_TYPE["TD"] = "TD";
20
+ SPP_TYPE["FALL"] = "FALL";
21
+ SPP_TYPE["ASSIST"] = "ASSIST";
22
+ })(SPP_TYPE || (exports.SPP_TYPE = SPP_TYPE = {}));
23
+ const SPP = {
24
+ [GAME_TYPE.FRIENDLY]: {
25
+ EXP_BONUS: 1,
26
+ EXP_INT: 2,
27
+ EXP_KO: 1,
28
+ EXP_REU: 1,
29
+ EXP_SOR: 2,
30
+ EXP_TD: 3,
31
+ EXP_FALL: 0,
32
+ EXP_ASSIST: 0,
33
+ },
34
+ [GAME_TYPE.DIVISION]: {
35
+ EXP_BONUS: 1,
36
+ EXP_INT: 2,
37
+ EXP_KO: 1,
38
+ EXP_REU: 1,
39
+ EXP_SOR: 2,
40
+ EXP_TD: 3,
41
+ EXP_FALL: 0,
42
+ EXP_ASSIST: 0,
43
+ },
44
+ [GAME_TYPE.OPEN]: {
45
+ EXP_BONUS: 1,
46
+ EXP_INT: 2,
47
+ EXP_KO: 1,
48
+ EXP_REU: 1,
49
+ EXP_SOR: 2,
50
+ EXP_TD: 3,
51
+ EXP_FALL: 0,
52
+ EXP_ASSIST: 0,
53
+ },
54
+ [GAME_TYPE.PLAYOFF]: {
55
+ EXP_BONUS: 1,
56
+ EXP_INT: 2,
57
+ EXP_KO: 1,
58
+ EXP_REU: 1,
59
+ EXP_SOR: 2,
60
+ EXP_TD: 3,
61
+ EXP_FALL: 0,
62
+ EXP_ASSIST: 0,
63
+ },
64
+ };
65
+ const ranges = [6, 16, 31, 51, 76, 176];
66
+ exports.ranges = ranges;
67
+ const coachRanges = [3, 8, 15, 25, 36, 80];
68
+ exports.coachRanges = coachRanges;
69
+ const getSPP = (game, type) => {
70
+ return SPP[game.type][`EXP_${type}`];
71
+ };
72
+ exports.getSPP = getSPP;
73
+ const getCurrentRange = (currentExp) => {
74
+ for (let i = 0; i < ranges.length; i++) {
75
+ if (currentExp < ranges[i]) {
76
+ return i + 1;
77
+ }
78
+ }
79
+ return ranges.length + 1;
80
+ };
81
+ exports.getCurrentRange = getCurrentRange;
82
+ const getNextRange = (currentExp) => {
83
+ for (let i = 0; i < ranges.length; i++) {
84
+ if (currentExp < ranges[i]) {
85
+ return ranges[i];
86
+ }
87
+ }
88
+ return "∞";
89
+ };
90
+ exports.getNextRange = getNextRange;
91
+ const getNextRangeCoach = (currentRange) => {
92
+ for (let i = 0; i < coachRanges.length; i++) {
93
+ if (currentRange < coachRanges[i]) {
94
+ return coachRanges[i];
95
+ }
96
+ }
97
+ return "∞";
98
+ };
99
+ exports.getNextRangeCoach = getNextRangeCoach;
100
+ const getAgingMinExperience = () => {
101
+ return ranges[1];
102
+ };
103
+ exports.getAgingMinExperience = getAgingMinExperience;