lol-livegame-client 1.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/README.md +75 -0
- package/dist/api/LiveApiClient.d.ts +30 -0
- package/dist/api/LiveApiClient.d.ts.map +1 -0
- package/dist/api/LiveApiClient.js +41 -0
- package/dist/api/LiveApiClient.js.map +1 -0
- package/dist/api/events/EventManager.d.ts +68 -0
- package/dist/api/events/EventManager.d.ts.map +1 -0
- package/dist/api/events/EventManager.js +120 -0
- package/dist/api/events/EventManager.js.map +1 -0
- package/dist/data/ActivePlayer.d.ts +20 -0
- package/dist/data/ActivePlayer.d.ts.map +1 -0
- package/dist/data/ActivePlayer.js +2 -0
- package/dist/data/ActivePlayer.js.map +1 -0
- package/dist/data/ActivePlayerMin.d.ts +20 -0
- package/dist/data/ActivePlayerMin.d.ts.map +1 -0
- package/dist/data/ActivePlayerMin.js +2 -0
- package/dist/data/ActivePlayerMin.js.map +1 -0
- package/dist/data/ChampionAbilities.d.ts +18 -0
- package/dist/data/ChampionAbilities.d.ts.map +1 -0
- package/dist/data/ChampionAbilities.js +2 -0
- package/dist/data/ChampionAbilities.js.map +1 -0
- package/dist/data/ChampionStats.d.ts +32 -0
- package/dist/data/ChampionStats.d.ts.map +1 -0
- package/dist/data/ChampionStats.js +2 -0
- package/dist/data/ChampionStats.js.map +1 -0
- package/dist/data/Constants.d.ts +31 -0
- package/dist/data/Constants.d.ts.map +1 -0
- package/dist/data/Constants.js +34 -0
- package/dist/data/Constants.js.map +1 -0
- package/dist/data/GameData.d.ts +8 -0
- package/dist/data/GameData.d.ts.map +1 -0
- package/dist/data/GameData.js +2 -0
- package/dist/data/GameData.js.map +1 -0
- package/dist/data/Item.d.ts +13 -0
- package/dist/data/Item.d.ts.map +1 -0
- package/dist/data/Item.js +2 -0
- package/dist/data/Item.js.map +1 -0
- package/dist/data/LiveData.d.ts +16 -0
- package/dist/data/LiveData.d.ts.map +1 -0
- package/dist/data/LiveData.js +2 -0
- package/dist/data/LiveData.js.map +1 -0
- package/dist/data/LoLEvents.d.ts +140 -0
- package/dist/data/LoLEvents.d.ts.map +1 -0
- package/dist/data/LoLEvents.js +20 -0
- package/dist/data/LoLEvents.js.map +1 -0
- package/dist/data/Maps.d.ts +55 -0
- package/dist/data/Maps.d.ts.map +1 -0
- package/dist/data/Maps.js +55 -0
- package/dist/data/Maps.js.map +1 -0
- package/dist/data/Player.d.ts +27 -0
- package/dist/data/Player.d.ts.map +1 -0
- package/dist/data/Player.js +2 -0
- package/dist/data/Player.js.map +1 -0
- package/dist/data/SummonerSpells.d.ts +11 -0
- package/dist/data/SummonerSpells.d.ts.map +1 -0
- package/dist/data/SummonerSpells.js +2 -0
- package/dist/data/SummonerSpells.js.map +1 -0
- package/dist/data/Turret.d.ts +22 -0
- package/dist/data/Turret.d.ts.map +1 -0
- package/dist/data/Turret.js +34 -0
- package/dist/data/Turret.js.map +1 -0
- package/dist/data/runes/FullRunes.d.ts +11 -0
- package/dist/data/runes/FullRunes.d.ts.map +1 -0
- package/dist/data/runes/FullRunes.js +2 -0
- package/dist/data/runes/FullRunes.js.map +1 -0
- package/dist/data/runes/PlayerRunes.d.ts +14 -0
- package/dist/data/runes/PlayerRunes.d.ts.map +1 -0
- package/dist/data/runes/PlayerRunes.js +2 -0
- package/dist/data/runes/PlayerRunes.js.map +1 -0
- package/dist/data/runes/Rune.d.ts +8 -0
- package/dist/data/runes/Rune.d.ts.map +1 -0
- package/dist/data/runes/Rune.js +2 -0
- package/dist/data/runes/Rune.js.map +1 -0
- package/dist/data/runes/RuneTree.d.ts +8 -0
- package/dist/data/runes/RuneTree.d.ts.map +1 -0
- package/dist/data/runes/RuneTree.js +2 -0
- package/dist/data/runes/RuneTree.js.map +1 -0
- package/dist/data/runes/StatRune.d.ts +5 -0
- package/dist/data/runes/StatRune.d.ts.map +1 -0
- package/dist/data/runes/StatRune.js +2 -0
- package/dist/data/runes/StatRune.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/riotgames.pem.d.ts +2 -0
- package/dist/resources/riotgames.pem.d.ts.map +1 -0
- package/dist/resources/riotgames.pem.js +27 -0
- package/dist/resources/riotgames.pem.js.map +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# lol-livegame-client
|
|
2
|
+
A client for the League of Legends [Game Client Api](https://developer.riotgames.com/docs/lol#game-client-api). With types and constant values and event handling.
|
|
3
|
+
|
|
4
|
+
## Make Requests
|
|
5
|
+
|
|
6
|
+
Use the `GameClient` object to make requests to the game.
|
|
7
|
+
|
|
8
|
+
#### Usage Example:
|
|
9
|
+
|
|
10
|
+
````typescript
|
|
11
|
+
GameClient.getAllGameData().then(gameData: GameData => console.log(JSON.stringify(gameData)))
|
|
12
|
+
````
|
|
13
|
+
|
|
14
|
+
In case I am too slow updating the library, you can make custom requests:
|
|
15
|
+
|
|
16
|
+
````typescript
|
|
17
|
+
GameClient.requestLiveApi('/liveclientdata/newendpoint').then(response => console.log(response))
|
|
18
|
+
````
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Events
|
|
22
|
+
|
|
23
|
+
To listen to events, subscribe to the `LoLEventManager` and start fetching events (requesting `GET https://127.0.0.1:2999/liveclientdata/eventdata`) .
|
|
24
|
+
You can start fetching before the game starts. The event manager will retry until the game starts or max retries are reached.
|
|
25
|
+
|
|
26
|
+
#### Usage Example:
|
|
27
|
+
|
|
28
|
+
````typescript
|
|
29
|
+
|
|
30
|
+
const eventManager = new LoLEventManager()
|
|
31
|
+
|
|
32
|
+
eventManager.subscribe((event: LoLEvent) => {
|
|
33
|
+
switch (event.EventName) {
|
|
34
|
+
case EventName.GameStart:
|
|
35
|
+
console.log('Game started!')
|
|
36
|
+
break;
|
|
37
|
+
case EventName.GameEnd:
|
|
38
|
+
console.log('Game ended!')
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
console.log('Unknown event:', event.EventName)
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
````
|
|
45
|
+
|
|
46
|
+
You can find supported events in the [EventName](src/data/LoLEvents.ts) enum.
|
|
47
|
+
|
|
48
|
+
## Static Names
|
|
49
|
+
|
|
50
|
+
##### Turrets and Inhibitors
|
|
51
|
+
|
|
52
|
+
Turrets and inhibitors are named in the format `{type}_T{team}_L{lane}_P{position}_{native id}` but you dont need to remember this. Thats what the [Turret](src/data/Turret.ts) class is for. It extracts all information from the name.
|
|
53
|
+
|
|
54
|
+
You can find all names at [StructureNames.md](src/resources/StructureNames.md)
|
|
55
|
+
|
|
56
|
+
#### Usage Example:
|
|
57
|
+
|
|
58
|
+
````typescript
|
|
59
|
+
const turretName = (event as TurretKilled).TurretKilled; //Turret_TChaos_L1_P2_2237424422
|
|
60
|
+
|
|
61
|
+
const turret = new Turret(eventName);
|
|
62
|
+
|
|
63
|
+
if(turret.lane === Lane.Mid) { // Lane.Mid === 1
|
|
64
|
+
console.log("Mid lane turret killed!")
|
|
65
|
+
}
|
|
66
|
+
````
|
|
67
|
+
|
|
68
|
+
# Contributing
|
|
69
|
+
Contributions are welcome!
|
|
70
|
+
If something doesn't work, make an issue or a pull request...duh
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LoLEvent } from "../data/LoLEvents.js";
|
|
2
|
+
import { LiveClientData } from "../data/LiveData.js";
|
|
3
|
+
import { ActivePlayer } from "../data/ActivePlayer.js";
|
|
4
|
+
import { ChampionAbilities } from "../data/ChampionAbilities.js";
|
|
5
|
+
import { ActivePlayerRunes, PlayerRunes } from "../data/runes/PlayerRunes.js";
|
|
6
|
+
import { Player, PlayerScores } from "../data/Player.js";
|
|
7
|
+
import { SummonerSpells } from "../data/SummonerSpells.js";
|
|
8
|
+
import { Item } from "../data/Item.js";
|
|
9
|
+
export declare const GameClient: {
|
|
10
|
+
/**
|
|
11
|
+
* Custom request to get live client data
|
|
12
|
+
* @param uri not host. Just the path. Example: '/liveclientdata/allplayerdata'
|
|
13
|
+
*/
|
|
14
|
+
requestLiveApi: (uri: string) => Promise<unknown>;
|
|
15
|
+
getAllGameData: () => Promise<LiveClientData>;
|
|
16
|
+
getActivePlayer: () => Promise<ActivePlayer>;
|
|
17
|
+
getActivePlayerName: () => Promise<any>;
|
|
18
|
+
getActivePlayerAbilities: () => Promise<ChampionAbilities>;
|
|
19
|
+
getActivePlayerRunes: () => Promise<ActivePlayerRunes>;
|
|
20
|
+
getAllPlayers: () => Promise<Player[]>;
|
|
21
|
+
getPlayerScore: (riotId: string) => Promise<PlayerScores>;
|
|
22
|
+
getPlayerSummonerSpells: (riotId: string) => Promise<SummonerSpells>;
|
|
23
|
+
getPlayerMainRunes: (riotId: string) => Promise<PlayerRunes>;
|
|
24
|
+
getPlayerItems: (riotId: string) => Promise<Item[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Get all events from the game. Result differs depending on if you are spectator or player. (Spectator gets less events)
|
|
27
|
+
*/
|
|
28
|
+
getEvents: () => Promise<LoLEvent[]>;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=LiveApiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveApiClient.d.ts","sourceRoot":"","sources":["../../src/api/LiveApiClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAqBrC,eAAO,MAAM,UAAU;IACnB;;;OAGG;0BACmB,MAAM;;;;;;;6BAUH,MAAM;sCACG,MAAM;iCACX,MAAM;6BACV,MAAM;IAE/B;;OAEG;;CAIN,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Agent, request } from "undici";
|
|
2
|
+
import { RIOT_CERT } from "../resources/riotgames.pem.js";
|
|
3
|
+
const CERT_AGENT = new Agent({
|
|
4
|
+
connect: {
|
|
5
|
+
ca: RIOT_CERT,
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
const DEFAULT_HEADERS = {
|
|
9
|
+
'Content-Type': 'application/json'
|
|
10
|
+
};
|
|
11
|
+
const GET_REQUEST_OPTIONS = {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: DEFAULT_HEADERS,
|
|
14
|
+
dispatcher: CERT_AGENT
|
|
15
|
+
};
|
|
16
|
+
const HOST = 'https://127.0.0.1:2999';
|
|
17
|
+
export const GameClient = {
|
|
18
|
+
/**
|
|
19
|
+
* Custom request to get live client data
|
|
20
|
+
* @param uri not host. Just the path. Example: '/liveclientdata/allplayerdata'
|
|
21
|
+
*/
|
|
22
|
+
requestLiveApi: (uri) => request(`${HOST}${uri}`, GET_REQUEST_OPTIONS).then(res => res.body.json(), err => {
|
|
23
|
+
console.error(`Error fetching live client "${HOST + uri}" Cause: ${err.message}`);
|
|
24
|
+
throw err;
|
|
25
|
+
}),
|
|
26
|
+
getAllGameData: () => GameClient.requestLiveApi('/liveclientdata/allgamedata').then((res) => res),
|
|
27
|
+
getActivePlayer: () => GameClient.requestLiveApi('/liveclientdata/activeplayer').then((res) => res),
|
|
28
|
+
getActivePlayerName: () => GameClient.requestLiveApi('/liveclientdata/activeplayername').then((res) => res.Name),
|
|
29
|
+
getActivePlayerAbilities: () => GameClient.requestLiveApi('/liveclientdata/activeplayerabilities').then((res) => res),
|
|
30
|
+
getActivePlayerRunes: () => GameClient.requestLiveApi('/liveclientdata/activeplayerrunes').then((res) => res),
|
|
31
|
+
getAllPlayers: () => GameClient.requestLiveApi('/liveclientdata/playerlist').then((res) => res),
|
|
32
|
+
getPlayerScore: (riotId) => GameClient.requestLiveApi(`/liveclientdata/playerscore?riotId=${riotId}`).then((res) => res),
|
|
33
|
+
getPlayerSummonerSpells: (riotId) => GameClient.requestLiveApi(`/liveclientdata/playersummonerspells?riotId=${riotId}`).then((res) => res),
|
|
34
|
+
getPlayerMainRunes: (riotId) => GameClient.requestLiveApi(`/liveclientdata/playermainrunes?riotId=${riotId}`).then((res) => res),
|
|
35
|
+
getPlayerItems: (riotId) => GameClient.requestLiveApi(`/liveclientdata/playeritems?riotId=${riotId}`).then((res) => res),
|
|
36
|
+
/**
|
|
37
|
+
* Get all events from the game. Result differs depending on if you are spectator or player. (Spectator gets less events)
|
|
38
|
+
*/
|
|
39
|
+
getEvents: () => GameClient.requestLiveApi('/liveclientdata/eventdata').then((res) => (res.Events ?? [])),
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=LiveApiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveApiClient.js","sourceRoot":"","sources":["../../src/api/LiveApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAWxD,MAAM,UAAU,GAAG,IAAI,KAAK,CAAC;IACzB,OAAO,EAAE;QACL,EAAE,EAAE,SAAS;KAChB;CACJ,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG;IACpB,cAAc,EAAE,kBAAkB;CACrC,CAAA;AAED,MAAM,mBAAmB,GAAG;IACxB,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,eAAe;IACxB,UAAU,E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A4B,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAe,CAAC;IAChH,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAmB,CAAC;IACrJ,uBAAuB,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,+CAA+C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAqB,CAAC;IACzK,kBAAkB,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAkB,CAAC;IAC5J,cAAc,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,sCAAsC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAa,CAAC;IAE/I;;OAEG;IACH,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAe,CAAC;CAG/H,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { LoLEvent } from "../../data/LoLEvents.js";
|
|
2
|
+
export interface Subscription {
|
|
3
|
+
unsubscribe(): void;
|
|
4
|
+
readonly filter?: (e: LoLEvent) => boolean;
|
|
5
|
+
readonly eventHandler: (event: LoLEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
export type FetchOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Interval in milliseconds | default: 1000
|
|
10
|
+
*/
|
|
11
|
+
interval?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Max retries before giving up | default: 100
|
|
14
|
+
*/
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Callback for errors.
|
|
18
|
+
*/
|
|
19
|
+
onError?: (err: Error) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Callback for max retries reached
|
|
22
|
+
*/
|
|
23
|
+
onMaxRetriesReached?: (err: Error) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Disables error logging to console
|
|
26
|
+
*/
|
|
27
|
+
disableErrorLogging?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Handles fetching of events from the Riot API and notifies observers about new events
|
|
31
|
+
*/
|
|
32
|
+
export declare class LoLEventManager {
|
|
33
|
+
private readonly fetchInterval;
|
|
34
|
+
private readonly maxRetries;
|
|
35
|
+
private readonly onError?;
|
|
36
|
+
private readonly onMaxRetriesReached?;
|
|
37
|
+
private readonly disableErrorLogging;
|
|
38
|
+
private timer?;
|
|
39
|
+
private observers;
|
|
40
|
+
private latestEventIndex;
|
|
41
|
+
private retryCount;
|
|
42
|
+
private running;
|
|
43
|
+
private inFlight;
|
|
44
|
+
constructor(fetchOptions?: FetchOptions);
|
|
45
|
+
isFetching(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Starts fetching events from the Riot API. Fetching stops when max retries reached or is manually stopped.
|
|
48
|
+
*/
|
|
49
|
+
startFetching(): void;
|
|
50
|
+
private tick;
|
|
51
|
+
/**
|
|
52
|
+
* Stops fetching events.
|
|
53
|
+
*/
|
|
54
|
+
stopFetching(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe to new events
|
|
57
|
+
* @param eventHandler event handler
|
|
58
|
+
* @param filter optional filter function. Only events that pass the filter will be notified
|
|
59
|
+
*/
|
|
60
|
+
subscribe(eventHandler: (event: LoLEvent) => void, filter?: (e: LoLEvent) => boolean): Subscription;
|
|
61
|
+
/**
|
|
62
|
+
* Unsubscribe from events. Better use the returned subscription object from {@link subscribe}
|
|
63
|
+
* @param eventHandler event handler to unsubscribe
|
|
64
|
+
* @param filter optional filter function. Only events that pass the filter will be notified
|
|
65
|
+
*/
|
|
66
|
+
unsubscribe(eventHandler: (event: LoLEvent) => void, filter?: (e: LoLEvent) => boolean): void;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=EventManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventManager.d.ts","sourceRoot":"","sources":["../../../src/api/events/EventManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAG5D,MAAM,WAAW,YAAY;IACzB,WAAW,IAAI,IAAI,CAAC;IAEpB,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAA;IAC1C,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;CACnD;AAED,MAAM,MAAM,YAAY,GAAG;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;IAE9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;IAE1C;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAChC,CAAA;AAED;;GAEG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAuB;IAChD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAkB;IAEtD,OAAO,CAAC,KAAK,CAAC,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAsB;IAEvC,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAkB;gBAEf,YAAY,CAAC,EAAE,YAAY;IAQvC,UAAU,IAAI,OAAO;IAI5B;;OAEG;IACI,aAAa,IAAI,IAAI;IAS5B,OAAO,CAAC,IAAI,CAgDV;IAEF;;OAEG;IACI,YAAY,IAAI,IAAI;IAS3B;;;;OAIG;IACI,SAAS,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,GAAG,YAAY;IAU1G;;;;OAIG;IACI,WAAW,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,OAAO,GAAG,IAAI;CAGvG"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { EventName } from "../../data/LoLEvents.js";
|
|
2
|
+
import { GameClient } from "../LiveApiClient.js";
|
|
3
|
+
/**
|
|
4
|
+
* Handles fetching of events from the Riot API and notifies observers about new events
|
|
5
|
+
*/
|
|
6
|
+
export class LoLEventManager {
|
|
7
|
+
fetchInterval = 1000;
|
|
8
|
+
maxRetries = 100;
|
|
9
|
+
onError;
|
|
10
|
+
onMaxRetriesReached;
|
|
11
|
+
disableErrorLogging = false;
|
|
12
|
+
timer;
|
|
13
|
+
observers = [];
|
|
14
|
+
latestEventIndex = 0;
|
|
15
|
+
retryCount = 0;
|
|
16
|
+
running = false;
|
|
17
|
+
inFlight = false;
|
|
18
|
+
constructor(fetchOptions) {
|
|
19
|
+
this.fetchInterval = fetchOptions?.interval ?? this.fetchInterval;
|
|
20
|
+
this.maxRetries = fetchOptions?.maxRetries ?? this.maxRetries;
|
|
21
|
+
this.onError = fetchOptions?.onError;
|
|
22
|
+
this.onMaxRetriesReached = fetchOptions?.onMaxRetriesReached;
|
|
23
|
+
this.disableErrorLogging = fetchOptions?.disableErrorLogging ?? this.disableErrorLogging;
|
|
24
|
+
}
|
|
25
|
+
isFetching() {
|
|
26
|
+
return this.running;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Starts fetching events from the Riot API. Fetching stops when max retries reached or is manually stopped.
|
|
30
|
+
*/
|
|
31
|
+
startFetching() {
|
|
32
|
+
if (this.running)
|
|
33
|
+
return;
|
|
34
|
+
this.running = true;
|
|
35
|
+
console.debug(`Fetching events every ${this.fetchInterval}ms`);
|
|
36
|
+
this.timer = setTimeout(this.tick, this.fetchInterval);
|
|
37
|
+
}
|
|
38
|
+
//tick is called every fetchInterval milliseconds
|
|
39
|
+
tick = async () => {
|
|
40
|
+
if (!this.running)
|
|
41
|
+
return;
|
|
42
|
+
// Prevent overlapping requests if the endpoint is slow
|
|
43
|
+
if (this.inFlight) {
|
|
44
|
+
this.timer = setTimeout(this.tick, this.fetchInterval);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.inFlight = true;
|
|
48
|
+
try {
|
|
49
|
+
const fetchedEvents = await GameClient.getEvents();
|
|
50
|
+
this.retryCount = 0;
|
|
51
|
+
if (fetchedEvents.length > this.latestEventIndex) {
|
|
52
|
+
const newEvents = fetchedEvents.slice(this.latestEventIndex);
|
|
53
|
+
for (const ev of newEvents) {
|
|
54
|
+
this.observers
|
|
55
|
+
.filter(s => !s.filter || s.filter(ev))
|
|
56
|
+
.forEach(s => s.eventHandler(ev));
|
|
57
|
+
}
|
|
58
|
+
this.latestEventIndex = fetchedEvents.length;
|
|
59
|
+
if (newEvents[this.latestEventIndex - 1].EventName === EventName.GAME_END) {
|
|
60
|
+
this.latestEventIndex = 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
66
|
+
if (!this.disableErrorLogging) {
|
|
67
|
+
console.error(`[${this.retryCount + 1}] Error fetching events: ${e.message}`);
|
|
68
|
+
}
|
|
69
|
+
this.retryCount++;
|
|
70
|
+
this.onError?.(e);
|
|
71
|
+
if (this.retryCount >= this.maxRetries) {
|
|
72
|
+
if (!this.disableErrorLogging) {
|
|
73
|
+
console.error(`Max retries reached (${this.maxRetries}). Stopping fetching events`);
|
|
74
|
+
}
|
|
75
|
+
this.stopFetching();
|
|
76
|
+
this.onMaxRetriesReached?.(e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
this.inFlight = false;
|
|
81
|
+
if (this.running) {
|
|
82
|
+
this.timer = setTimeout(this.tick, this.fetchInterval);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Stops fetching events.
|
|
88
|
+
*/
|
|
89
|
+
stopFetching() {
|
|
90
|
+
this.running = false;
|
|
91
|
+
if (this.timer) {
|
|
92
|
+
clearTimeout(this.timer);
|
|
93
|
+
this.timer = undefined;
|
|
94
|
+
}
|
|
95
|
+
this.inFlight = false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Subscribe to new events
|
|
99
|
+
* @param eventHandler event handler
|
|
100
|
+
* @param filter optional filter function. Only events that pass the filter will be notified
|
|
101
|
+
*/
|
|
102
|
+
subscribe(eventHandler, filter) {
|
|
103
|
+
const subscription = {
|
|
104
|
+
eventHandler: eventHandler,
|
|
105
|
+
filter: filter,
|
|
106
|
+
unsubscribe: () => this.unsubscribe(eventHandler, filter)
|
|
107
|
+
};
|
|
108
|
+
this.observers.push(subscription);
|
|
109
|
+
return subscription;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Unsubscribe from events. Better use the returned subscription object from {@link subscribe}
|
|
113
|
+
* @param eventHandler event handler to unsubscribe
|
|
114
|
+
* @param filter optional filter function. Only events that pass the filter will be notified
|
|
115
|
+
*/
|
|
116
|
+
unsubscribe(eventHandler, filter) {
|
|
117
|
+
this.observers = this.observers.filter(s => s.eventHandler !== eventHandler || s.filter !== filter);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=EventManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventManager.js","sourceRoot":"","sources":["../../../src/api/events/EventManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAW,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAmC/C;;GAEG;AACH,MAAM,OAAO,eAAe;IAEP,aAAa,GAAW,IAAI,CAAC;IAC7B,UAAU,GAAW,GAAG,CAAC;IACzB,OAAO,CAAwB;IAC/B,mBAAmB,CAAwB;IAC3C,mBAAmB,GAAY,KAAK,CAAC;IAE9C,KAAK,CAAkB;IACvB,SAAS,GAAmB,EAAE,CAAC;IAE/B,gBAAgB,GAAW,CAAC,CAAC;IAC7B,UAAU,GAAW,CAAC,CAAC;IAEvB,OAAO,GAAY,KAAK,CAAC;IACzB,QAAQ,GAAY,KAAK,CAAC;IAElC,YAAmB,YAA2B;QAC1C,IAAI,CAAC,aAAa,GAAG,YAAY,EAAE,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,YAAY,EAAE,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;QAC9D,IAAI,CAAC,OAAO,GAAG,YAAY,EAAE,OAAO,CAAC;QACrC,IAAI,CAAC,mBAAmB,GAAG,YAAY,EAAE,mBAAmB,CAAC;QAC7D,IAAI,CAAC,mBAAmB,GAAG,YAAY,EAAE,mBAAmB,IAAI,IAAI,CAAC,mBAAmB,CAAC;IAC7F,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,O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ACI,YAAY;QACf,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,YAAuC,EAAE,MAAiC;QACvF,MAAM,YAAY,GAAiB;YAC/B,YAAY,EAAE,YAAY;YAC1B,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,CAAC;SAC5D,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,WAAW,CAAC,YAAuC,EAAE,MAAiC;QACzF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,YAAY,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IACxG,CAAC;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChampionAbilities } from "./ChampionAbilities.js";
|
|
2
|
+
import type { ChampionStats } from "./ChampionStats.js";
|
|
3
|
+
import type { FullRunes } from "./runes/FullRunes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Type that is used for the active player in the all-game-data endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export type ActivePlayerMin = {
|
|
8
|
+
abilities: ChampionAbilities;
|
|
9
|
+
championStats: ChampionStats;
|
|
10
|
+
currentGold: number;
|
|
11
|
+
fullRunes: FullRunes;
|
|
12
|
+
level: number;
|
|
13
|
+
summonerName: string;
|
|
14
|
+
};
|
|
15
|
+
export type ActivePlayer = ActivePlayerMin & {
|
|
16
|
+
riotId: string;
|
|
17
|
+
riotIdGameName: string;
|
|
18
|
+
riotIdTagLine: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ActivePlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivePlayer.d.ts","sourceRoot":"","sources":["../../src/data/ActivePlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivePlayer.js","sourceRoot":"","sources":["../../src/data/ActivePlayer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ChampionAbilities } from "./ChampionAbilities.js";
|
|
2
|
+
import type { ChampionStats } from "./ChampionStats.js";
|
|
3
|
+
import type { FullRunes } from "./runes/FullRunes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Type that is used for the active player in the all-game-data endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export type ActivePlayerMin = {
|
|
8
|
+
abilities: ChampionAbilities;
|
|
9
|
+
championStats: ChampionStats;
|
|
10
|
+
currentGold: number;
|
|
11
|
+
fullRunes: FullRunes;
|
|
12
|
+
level: number;
|
|
13
|
+
summonerName: string;
|
|
14
|
+
};
|
|
15
|
+
export type ActivePlayer = ActivePlayerMin & {
|
|
16
|
+
riotId: string;
|
|
17
|
+
riotIdGameName: string;
|
|
18
|
+
riotIdTagLine: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=ActivePlayerMin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivePlayerMin.d.ts","sourceRoot":"","sources":["../../src/data/ActivePlayerMin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivePlayerMin.js","sourceRoot":"","sources":["../../src/data/ActivePlayerMin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Ability = {
|
|
2
|
+
/** Translated name */
|
|
3
|
+
displayName: string;
|
|
4
|
+
id: string;
|
|
5
|
+
rawDescription: string;
|
|
6
|
+
rawDisplayName: string;
|
|
7
|
+
};
|
|
8
|
+
export type ActiveAbility = Ability & {
|
|
9
|
+
abilityLevel: number;
|
|
10
|
+
};
|
|
11
|
+
export type ChampionAbilities = {
|
|
12
|
+
E: ActiveAbility;
|
|
13
|
+
Q: ActiveAbility;
|
|
14
|
+
R: ActiveAbility;
|
|
15
|
+
W: ActiveAbility;
|
|
16
|
+
Passive: Ability;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=ChampionAbilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChampionAbilities.d.ts","sourceRoot":"","sources":["../../src/data/ChampionAbilities.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IAClB,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChampionAbilities.js","sourceRoot":"","sources":["../../src/data/ChampionAbilities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ChampionStats {
|
|
2
|
+
abilityHaste: number;
|
|
3
|
+
abilityPower: number;
|
|
4
|
+
armor: number;
|
|
5
|
+
armorPenetrationFlat: number;
|
|
6
|
+
armorPenetrationPercent: number;
|
|
7
|
+
attackDamage: number;
|
|
8
|
+
attackRange: number;
|
|
9
|
+
attackSpeed: number;
|
|
10
|
+
bonusArmorPenetrationPercent: number;
|
|
11
|
+
bonusMagicPenetrationPercent: number;
|
|
12
|
+
cooldownReduction: number;
|
|
13
|
+
critChance: number;
|
|
14
|
+
critDamage: number;
|
|
15
|
+
currentHealth: number;
|
|
16
|
+
healthRegenRate: number;
|
|
17
|
+
lifeSteal: number;
|
|
18
|
+
magicLethality: number;
|
|
19
|
+
magicPenetrationFlat: number;
|
|
20
|
+
magicPenetrationPercent: number;
|
|
21
|
+
magicResist: number;
|
|
22
|
+
maxHealth: number;
|
|
23
|
+
moveSpeed: number;
|
|
24
|
+
physicalLethality: number;
|
|
25
|
+
resourceMax: number;
|
|
26
|
+
resourceRegenRate: number;
|
|
27
|
+
resourceType: string;
|
|
28
|
+
resourceValue: number;
|
|
29
|
+
spellVamp: number;
|
|
30
|
+
tenacity: number;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ChampionStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChampionStats.d.ts","sourceRoot":"","sources":["../../src/data/ChampionStats.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,4BAA4B,EAAE,MAAM,CAAC;IACrC,4BAA4B,EAAE,MAAM,CAAC;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChampionStats.js","sourceRoot":"","sources":["../../src/data/ChampionStats.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const BLUE = "Order";
|
|
2
|
+
export declare const RED = "Chaos";
|
|
3
|
+
export declare const TEAM: {
|
|
4
|
+
BLUE: string;
|
|
5
|
+
RED: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const INHIB = "Inhib";
|
|
8
|
+
export declare const TURRET = "Turret";
|
|
9
|
+
export declare const LANE_BOT = 0;
|
|
10
|
+
export declare const LANE_MID = 1;
|
|
11
|
+
export declare const LANE_TOP = 2;
|
|
12
|
+
export declare const Lane: {
|
|
13
|
+
Bot: number;
|
|
14
|
+
Mid: number;
|
|
15
|
+
Top: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const T_POSITION_OUT = 3;
|
|
18
|
+
export declare const T_POSITION_BASE = 2;
|
|
19
|
+
export declare const T_POSITION_INHIB = 1;
|
|
20
|
+
export type TeamName = 'Order' | 'Chaos';
|
|
21
|
+
export declare const NAME_PROXY = "{type}_T{team}_L{lane}_P{position}_{native id}";
|
|
22
|
+
export declare enum DragonType {
|
|
23
|
+
AIR = "Air",
|
|
24
|
+
EARTH = "Earth",
|
|
25
|
+
FIRE = "Fire",
|
|
26
|
+
WATER = "Water",
|
|
27
|
+
HEXTECH = "Hextech",
|
|
28
|
+
CHEMTECH = "Chemtech",
|
|
29
|
+
ELDER = "Elder"
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/data/Constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,UAAU,CAAA;AAC3B,eAAO,MAAM,GAAG,UAAU,CAAA;AAC1B,eAAO,MAAM,IAAI;;;CAEhB,CAAA;AAGD,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B,eAAO,MAAM,MAAM,WAAW,CAAA;AAG9B,eAAO,MAAM,QAAQ,IAAI,CAAA;AACzB,eAAO,MAAM,QAAQ,IAAI,CAAA;AACzB,eAAO,MAAM,QAAQ,IAAI,CAAA;AAEzB,eAAO,MAAM,IAAI;;;;CAIhB,CAAA;AAGD,eAAO,MAAM,cAAc,IAAI,CAAA;AAC/B,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzC,eAAO,MAAM,UAAU,mDAAmD,CAAA;AAE1E,oBAAY,UAAU;IAClB,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAClB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//Teams
|
|
2
|
+
export const BLUE = 'Order';
|
|
3
|
+
export const RED = 'Chaos';
|
|
4
|
+
export const TEAM = {
|
|
5
|
+
BLUE, RED
|
|
6
|
+
};
|
|
7
|
+
//Structures
|
|
8
|
+
export const INHIB = 'Inhib';
|
|
9
|
+
export const TURRET = 'Turret';
|
|
10
|
+
//Lanes
|
|
11
|
+
export const LANE_BOT = 0;
|
|
12
|
+
export const LANE_MID = 1;
|
|
13
|
+
export const LANE_TOP = 2;
|
|
14
|
+
export const Lane = {
|
|
15
|
+
Bot: LANE_BOT,
|
|
16
|
+
Mid: LANE_MID,
|
|
17
|
+
Top: LANE_TOP
|
|
18
|
+
};
|
|
19
|
+
//Turret positions
|
|
20
|
+
export const T_POSITION_OUT = 3;
|
|
21
|
+
export const T_POSITION_BASE = 2;
|
|
22
|
+
export const T_POSITION_INHIB = 1;
|
|
23
|
+
export const NAME_PROXY = "{type}_T{team}_L{lane}_P{position}_{native id}";
|
|
24
|
+
export var DragonType;
|
|
25
|
+
(function (DragonType) {
|
|
26
|
+
DragonType["AIR"] = "Air";
|
|
27
|
+
DragonType["EARTH"] = "Earth";
|
|
28
|
+
DragonType["FIRE"] = "Fire";
|
|
29
|
+
DragonType["WATER"] = "Water";
|
|
30
|
+
DragonType["HEXTECH"] = "Hextech";
|
|
31
|
+
DragonType["CHEMTECH"] = "Chemtech";
|
|
32
|
+
DragonType["ELDER"] = "Elder";
|
|
33
|
+
})(DragonType || (DragonType = {}));
|
|
34
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/data/Constants.ts"],"names":[],"mappings":"AAAA,OAAO;AACP,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAA;AAC3B,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAA;AAC1B,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,IAAI,EAAE,GAAG;CACZ,CAAA;AAED,YAAY;AACZ,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAA;AAE9B,OAAO;AACP,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAA;AACzB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAA;AACzB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAA;AAEzB,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;CAChB,CAAA;AAED,kBAAkB;AAClB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAIjC,MAAM,CAAC,MAAM,UAAU,GAAG,gDAAgD,CAAA;AAE1E,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IAClB,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;AACnB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameData.d.ts","sourceRoot":"","sources":["../../src/data/GameData.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameData.js","sourceRoot":"","sources":["../../src/data/GameData.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Item = {
|
|
2
|
+
canUse: boolean;
|
|
3
|
+
consumable: boolean;
|
|
4
|
+
count: number;
|
|
5
|
+
/** Translated name */
|
|
6
|
+
displayName: string;
|
|
7
|
+
itemID: number;
|
|
8
|
+
price: number;
|
|
9
|
+
rawDescription: string;
|
|
10
|
+
rawDisplayName: string;
|
|
11
|
+
slot: number;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../src/data/Item.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../src/data/Item.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ActivePlayerMin } from "./ActivePlayer.js";
|
|
2
|
+
import type { GameData } from "./GameData.js";
|
|
3
|
+
import type { Player } from "./Player.js";
|
|
4
|
+
import type { LoLEvent } from "./LoLEvents.js";
|
|
5
|
+
/**
|
|
6
|
+
* Response from requesting all game data.
|
|
7
|
+
*/
|
|
8
|
+
export type LiveClientData = {
|
|
9
|
+
activePlayer: ActivePlayerMin;
|
|
10
|
+
allPlayers: Player[];
|
|
11
|
+
events: {
|
|
12
|
+
Events: LoLEvent[];
|
|
13
|
+
};
|
|
14
|
+
gameData: GameData;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=LiveData.d.ts.map
|