match_collector: track gold advantage when items are bought

also add api.ts with Riot API types
This commit is contained in:
2026-04-17 10:51:21 +02:00
parent 19a9226dac
commit b7435f0884
3 changed files with 275 additions and 43 deletions

125
match_collector/api.ts Normal file
View File

@@ -0,0 +1,125 @@
type Match = {
metadata: {
dataVersion: string
matchId: string
participants: string[]
}
info: {
endOfGameResult: string
frameInterval: number
gameId: number
participants: Participant[]
teams: Team[]
}
timeline: Timeline
}
type Timeline = {
metadata: {
dataVersion: string
matchId: string
participants: string[]
}
info: {
endOfGameResult: string
frameInterval: number
gameId: number
participants: {
participantId: number
puuid: string
}[]
frames: Frame[]
}
}
type Team = {
bans: Ban[]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
objectives: any
teamId: number
win: boolean
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Ban = any
type Participant = {
allInPing: number
assistMePings: number
assists: number
baronKills: number
bountyLevel: number
champExperience: number
champLevel: number
championId: number
championName: string
commandPings: number
championTransform: number
consumablesPurchased: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
challenges: any
damageDealtToBuildings: number
deaths: number
item0: number
item1: number
item2: number
item3: number
item4: number
item5: number
item6: number
itemsPurchased: number
kills: number
lane: string
participantId: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
perks: any
puuid: string
summoner1Id: number
summoner2Id: number
summonerId: string
teamId: number
teamPosition: string
win: boolean
}
type Frame = {
events: Event[]
participantFrames: {
'1': ParticipantFrame
'2': ParticipantFrame
'3': ParticipantFrame
'4': ParticipantFrame
'5': ParticipantFrame
'6': ParticipantFrame
'7': ParticipantFrame
'8': ParticipantFrame
'9': ParticipantFrame
'10': ParticipantFrame
}
timestamp: number
}
type ParticipantFrame = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
championStats: any
currentGold: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
damageStats: any
goldPerSecond: number
jungleMinionsKilled: number
level: number
minionsKilled: number
participantId: number
position: {
x: number
y: number
}
timeEnemySpentControlled: number
totalGold: number
xp: number
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Event = any
export { Match, Timeline, Team, Ban, Participant, Frame, Event }