lol-constants 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/core/constants/DataDragonUrls.js +2 -2
- package/core/constants/QueueTypes.d.ts +7 -0
- package/core/constants/QueueTypes.js +12 -0
- package/core/constants/Runes/RuneIconFileNames.d.ts +3 -2
- package/core/constants/Runes/RuneIconFileNames.js +6 -4
- package/core/helpers/Runes/getRuneCdnUrl.d.ts +1 -1
- package/core/helpers/Runes/getRuneCdnUrl.js +4 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Provides constants and types for League of Legends related stuff within the context of [Riot APIs](https://developer.riotgames.com/docs/lol). Types such as [`ChampionId`](src/core/constants/Champions/ChampionIds.ts), [`ChampionName`](src/core/constants/Champions/ChampionNames.ts), [`ItemKey`](src/core/constants/Items/ItemKeys.ts), [`RuneId`](src/core/constants/Runes/RuneSetsByRuneNames.ts#L55), [`SpellName`](src/core/constants/Spells/SpellNames.ts), [`Position`](src/core/constants/Positions.ts), [`
|
1
|
+
Provides constants and types for League of Legends related stuff within the context of [Riot APIs](https://developer.riotgames.com/docs/lol). Types such as [`ChampionId`](src/core/constants/Champions/ChampionIds.ts), [`ChampionName`](src/core/constants/Champions/ChampionNames.ts), [`ItemKey`](src/core/constants/Items/ItemKeys.ts), [`RuneId`](src/core/constants/Runes/RuneSetsByRuneNames.ts#L55), [`SpellName`](src/core/constants/Spells/SpellNames.ts), [`Position`](src/core/constants/Positions.ts), [`QueueType`](src/core/constants/QueueTypes.ts), [`RankedTier`](src/core/constants/RankedTiers.ts), [`Region`](src/core/constants/Regions.ts) and more are provided. Certain URLs and URIs are available as constants as well in [`DataDragonUrls`](src/core/constants/DataDragonUrls.ts), [`PlatformApiUris`](src/core/constants/PlatformApiUris.ts), [`RegionalApiUris`](src/core/constants/RegionalApiUris.ts).
|
2
2
|
|
3
3
|
Advantages:
|
4
4
|
- Four categories — champions, items, runes, summoner spells — are armed with getter functions that exchange between id–key–name such as [`getChampionNameByKey`](src/core/helpers/Champions/getChampionNameByKey.ts)–[`getChampionIdByName`](src/core/helpers/Champions/getChampionIdByName.ts)–[`getChampionKeyById`](src/core/helpers/Champions/getChampionKeyById.ts)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.DataDragonUrls = void 0;
|
4
|
-
const version = '13.
|
5
|
-
const cdragonVersion = '13.
|
4
|
+
const version = '13.17.1';
|
5
|
+
const cdragonVersion = '13.17';
|
6
6
|
const base = `https://ddragon.leagueoflegends.com/cdn/${version}`;
|
7
7
|
const cdragonBase = `https://raw.communitydragon.org/${cdragonVersion}`;
|
8
8
|
const locale = 'en_US';
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export declare const QueueTypes: {
|
2
|
+
readonly RANKED_SOLO_5x5: "RANKED_SOLO_5x5";
|
3
|
+
readonly RANKED_FLEX_SR: "RANKED_FLEX_SR";
|
4
|
+
readonly RANKED_TFT: "RANKED_TFT";
|
5
|
+
};
|
6
|
+
export type QueueType = typeof QueueTypes[keyof typeof QueueTypes];
|
7
|
+
export declare function isQueueType(value: any): value is QueueType;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isQueueType = exports.QueueTypes = void 0;
|
4
|
+
exports.QueueTypes = {
|
5
|
+
'RANKED_SOLO_5x5': 'RANKED_SOLO_5x5',
|
6
|
+
'RANKED_FLEX_SR': 'RANKED_FLEX_SR',
|
7
|
+
'RANKED_TFT': 'RANKED_TFT',
|
8
|
+
};
|
9
|
+
function isQueueType(value) {
|
10
|
+
return typeof value == 'string' && value in exports.QueueTypes;
|
11
|
+
}
|
12
|
+
exports.isQueueType = isQueueType;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { RuneName } from './RuneSets';
|
2
2
|
import { RuneTreeName } from './RuneTreeNames';
|
3
3
|
/**
|
4
|
-
* The file names themselves
|
4
|
+
* The file names themselves for runes,
|
5
5
|
* according to https://raw.communitydragon.org.
|
6
6
|
* The file names are excluding the extension (`.png`).
|
7
7
|
*
|
@@ -9,5 +9,6 @@ import { RuneTreeName } from './RuneTreeNames';
|
|
9
9
|
* @see https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/perk-images/styles/
|
10
10
|
*/
|
11
11
|
export declare const RuneIconFileNames: {
|
12
|
-
readonly [k in
|
12
|
+
readonly [k in RuneIconFile]: string;
|
13
13
|
};
|
14
|
+
export type RuneIconFile = RuneName | RuneTreeName | 'runesicon';
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.RuneIconFileNames = void 0;
|
4
4
|
/**
|
5
|
-
* The file names themselves
|
5
|
+
* The file names themselves for runes,
|
6
6
|
* according to https://raw.communitydragon.org.
|
7
7
|
* The file names are excluding the extension (`.png`).
|
8
8
|
*
|
@@ -16,7 +16,7 @@ exports.RuneIconFileNames = {
|
|
16
16
|
'Sorcery': '7202_sorcery',
|
17
17
|
'Resolve': '7204_resolve',
|
18
18
|
'Inspiration': '7203_whimsy',
|
19
|
-
// ##
|
19
|
+
// ## Runes
|
20
20
|
// ### Precision
|
21
21
|
'Conqueror': 'conqueror',
|
22
22
|
'Coup de Grace': 'coupdegrace',
|
@@ -93,9 +93,11 @@ exports.RuneIconFileNames = {
|
|
93
93
|
// ###
|
94
94
|
'Flex (AF)': 'statmodsadaptiveforceicon',
|
95
95
|
'Flex (AR)': 'statmodsarmoricon',
|
96
|
-
'Flex (MR)': 'statmodsmagicresicon
|
96
|
+
'Flex (MR)': 'statmodsmagicresicon',
|
97
97
|
// ###
|
98
98
|
'Defense (HP)': 'statmodshealthscalingicon',
|
99
99
|
'Defense (AR)': 'statmodsarmoricon',
|
100
|
-
'Defense (MR)': 'statmodsmagicresicon
|
100
|
+
'Defense (MR)': 'statmodsmagicresicon',
|
101
|
+
// ## Misc.
|
102
|
+
runesicon: 'runesicon',
|
101
103
|
};
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { RuneName } from '../../constants/Runes/RuneSets';
|
2
2
|
import { RuneTreeName } from '../../constants/Runes/RuneTreeNames';
|
3
|
-
export declare function getRuneCdnUrl(name: RuneName | RuneTreeName): string;
|
3
|
+
export declare function getRuneCdnUrl(name: (RuneName | RuneTreeName | 'runesicon')): string;
|
@@ -7,6 +7,8 @@ const RuneTreeNames_1 = require("../../constants/Runes/RuneTreeNames");
|
|
7
7
|
const getRuneCategoryName_1 = require("./getRuneCategoryName");
|
8
8
|
const isStatRuneName_1 = require("./isStatRuneName");
|
9
9
|
function getRuneCdnUrl(name) {
|
10
|
+
if (name == 'runesicon')
|
11
|
+
return `${DataDragonUrls_1.DataDragonUrls.TREE_RUNE_ICON_BASE}/${RuneIconFileNames_1.RuneIconFileNames[name]}.png`;
|
10
12
|
// Choose the appropriate base path
|
11
13
|
const base = (0, isStatRuneName_1.isStatRuneName)(name)
|
12
14
|
? DataDragonUrls_1.DataDragonUrls.STAT_RUNE_ICON_BASE
|
@@ -21,7 +23,7 @@ function getRuneCdnUrl(name) {
|
|
21
23
|
let category = (0, getRuneCategoryName_1.getRuneCategoryName)(name);
|
22
24
|
// Remove spaces, colons, apostrophes and make lowercase
|
23
25
|
let runeTreeFolder = category.replaceAll(' ', '').toLowerCase();
|
24
|
-
let runeFolder = name.replaceAll(/[:']/g, '').toLowerCase();
|
26
|
+
let runeFolder = name.replaceAll(/[:' ]/g, '').toLowerCase();
|
25
27
|
// Some runes, for whatever reason, are displaced and badly organized.
|
26
28
|
// Therefore we are going to add special cases to these runes.
|
27
29
|
switch (name) {
|
@@ -43,6 +45,7 @@ function getRuneCdnUrl(name) {
|
|
43
45
|
break;
|
44
46
|
case 'Approach Velocity':
|
45
47
|
runeTreeFolder = 'resolve';
|
48
|
+
break;
|
46
49
|
}
|
47
50
|
return `${base}/${runeTreeFolder}/${runeFolder}/${RuneIconFileNames_1.RuneIconFileNames[name]}.png`;
|
48
51
|
}
|
package/core/index.d.ts
CHANGED
@@ -17,7 +17,7 @@ export * from './constants/PlatformIds';
|
|
17
17
|
export * from './constants/Positions';
|
18
18
|
export * from './constants/QueueDescriptions';
|
19
19
|
export * from './constants/QueueIds';
|
20
|
-
export * from './constants/
|
20
|
+
export * from './constants/QueueTypes';
|
21
21
|
export * from './constants/RankedRanks';
|
22
22
|
export * from './constants/RankedTiers';
|
23
23
|
export * from './constants/RegionalApiUris';
|
package/core/index.js
CHANGED
@@ -34,7 +34,7 @@ __exportStar(require("./constants/PlatformIds"), exports);
|
|
34
34
|
__exportStar(require("./constants/Positions"), exports);
|
35
35
|
__exportStar(require("./constants/QueueDescriptions"), exports);
|
36
36
|
__exportStar(require("./constants/QueueIds"), exports);
|
37
|
-
__exportStar(require("./constants/
|
37
|
+
__exportStar(require("./constants/QueueTypes"), exports);
|
38
38
|
__exportStar(require("./constants/RankedRanks"), exports);
|
39
39
|
__exportStar(require("./constants/RankedTiers"), exports);
|
40
40
|
__exportStar(require("./constants/RegionalApiUris"), exports);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "lol-constants",
|
3
|
-
"version": "2.9.
|
3
|
+
"version": "2.9.1",
|
4
4
|
"description": "League of Legends constants and data resources, such as champion, item, runes reforged, summoner spells.",
|
5
5
|
"main": "core/index.js",
|
6
6
|
"types": "core/index.d.ts",
|
@@ -15,9 +15,9 @@
|
|
15
15
|
"dev": "vite"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
18
|
-
"@types/node": "^20.
|
19
|
-
"typescript": "^5.
|
20
|
-
"vite": "^4.
|
18
|
+
"@types/node": "^20.6.0",
|
19
|
+
"typescript": "^5.2.2",
|
20
|
+
"vite": "^4.4.9"
|
21
21
|
},
|
22
22
|
"repository": {
|
23
23
|
"type": "git",
|