lol-constants 3.0.0-rc.2 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/helpers/item.d.ts +7 -7
- package/dist/helpers/item.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -125,6 +125,6 @@ Besides being an easy-to-update library with each League patch and to stay updat
|
|
125
125
|
+ Enable total backwards compatibility with older patches (i.e. no missing items or something for last couple of patches, preferably two years, which is the limit set by Riot API)
|
126
126
|
+ Fulfill any missing types and constants within the context of Riot API. Perhaps provide interfaces for Riot API responses.
|
127
127
|
+ More detailed champions, items, runes, and spells information. Would require using an own database of those instead of relying on DataDragon.
|
128
|
-
+ Optimized library size/splitting (currently library should be around ~100KB).
|
128
|
+
+ Optimized library size/splitting (currently library should be around ~100KB tscompiled).
|
129
129
|
|
130
130
|
So, why not give this library a star and see where it goes?
|
package/dist/helpers/item.d.ts
CHANGED
@@ -26,13 +26,13 @@ import { MapId } from '../objects/Maps';
|
|
26
26
|
* Use `lol.item.isAvailable` to determine whether item is available on a certain map.
|
27
27
|
*/
|
28
28
|
export declare function getItem(id_name: ItemId | ItemName, mapId?: MapId): typeof Items[keyof typeof Items];
|
29
|
-
export declare function isStarterItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
30
|
-
export declare function isBasicItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
31
|
-
export declare function isEpicItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
32
|
-
export declare function isLegendaryItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
33
|
-
export declare function isTrinketItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
34
|
-
export declare function isBootsItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
35
|
-
export declare function isConsumableItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName): boolean;
|
29
|
+
export declare function isStarterItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
30
|
+
export declare function isBasicItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
31
|
+
export declare function isEpicItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
32
|
+
export declare function isLegendaryItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
33
|
+
export declare function isTrinketItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
34
|
+
export declare function isBootsItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
35
|
+
export declare function isConsumableItem(item_id_name: typeof ItemsArr[number] | ItemId | ItemName | 0): boolean;
|
36
36
|
/** Check whether item is available on a certain map. */
|
37
37
|
export declare function isItemAvailableOnMap(itemId: ItemId, mapId: MapId): boolean;
|
38
38
|
export declare function isItemId(id: number | null | undefined): id is ItemId;
|
package/dist/helpers/item.js
CHANGED
@@ -62,31 +62,43 @@ function getItemIdByName(itemName, mapId = 11) {
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
export function isStarterItem(item_id_name) {
|
65
|
+
if (item_id_name == 0)
|
66
|
+
return false;
|
65
67
|
if (typeof item_id_name == 'object')
|
66
68
|
return item_id_name.srType == ItemSrTypes.STARTER;
|
67
69
|
return getItem(item_id_name).srType == ItemSrTypes.STARTER;
|
68
70
|
}
|
69
71
|
export function isBasicItem(item_id_name) {
|
72
|
+
if (item_id_name == 0)
|
73
|
+
return false;
|
70
74
|
if (typeof item_id_name == 'object')
|
71
75
|
return item_id_name.srType == ItemSrTypes.BASIC;
|
72
76
|
return getItem(item_id_name).srType == ItemSrTypes.BASIC;
|
73
77
|
}
|
74
78
|
export function isEpicItem(item_id_name) {
|
79
|
+
if (item_id_name == 0)
|
80
|
+
return false;
|
75
81
|
if (typeof item_id_name == 'object')
|
76
82
|
return item_id_name.srType == ItemSrTypes.EPIC;
|
77
83
|
return getItem(item_id_name).srType == ItemSrTypes.EPIC;
|
78
84
|
}
|
79
85
|
export function isLegendaryItem(item_id_name) {
|
86
|
+
if (item_id_name == 0)
|
87
|
+
return false;
|
80
88
|
if (typeof item_id_name == 'object')
|
81
89
|
return item_id_name.srType == ItemSrTypes.LEGENDARY;
|
82
90
|
return getItem(item_id_name).srType == ItemSrTypes.LEGENDARY;
|
83
91
|
}
|
84
92
|
export function isTrinketItem(item_id_name) {
|
93
|
+
if (item_id_name == 0)
|
94
|
+
return false;
|
85
95
|
if (typeof item_id_name == 'object')
|
86
96
|
return item_id_name.srType == ItemSrTypes.TRINKET;
|
87
97
|
return getItem(item_id_name).srType == ItemSrTypes.TRINKET;
|
88
98
|
}
|
89
99
|
export function isBootsItem(item_id_name) {
|
100
|
+
if (item_id_name == 0)
|
101
|
+
return false;
|
90
102
|
if (typeof item_id_name == 'object')
|
91
103
|
return item_id_name.id in bootsItemIds;
|
92
104
|
if (typeof item_id_name == 'number')
|
@@ -94,6 +106,8 @@ export function isBootsItem(item_id_name) {
|
|
94
106
|
return getItemIdByName(item_id_name) in bootsItemIds;
|
95
107
|
}
|
96
108
|
export function isConsumableItem(item_id_name) {
|
109
|
+
if (item_id_name == 0)
|
110
|
+
return false;
|
97
111
|
if (typeof item_id_name == 'object')
|
98
112
|
return item_id_name.srType == ItemSrTypes.CONSUMABLE;
|
99
113
|
return getItem(item_id_name).srType == ItemSrTypes.CONSUMABLE;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "lol-constants",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.1",
|
4
4
|
"description": "League of Legends constants, functions, and types. Provides a plathera of functions to easily convert between ID, Name, and Key for champions, items, summoner spells, and runes.",
|
5
5
|
"license": "MIT",
|
6
6
|
"type": "module",
|