diff --git a/packages/shieldbow/src/structures/match/index.ts b/packages/shieldbow/src/structures/match/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/packages/shieldbow/src/structures/match/match.ts b/packages/shieldbow/src/structures/match/match.ts new file mode 100644 index 00000000..247fde85 --- /dev/null +++ b/packages/shieldbow/src/structures/match/match.ts @@ -0,0 +1,58 @@ +import { Champion, GameMap, GameMode, GameType, Item, RuneTree, SummonerSpell } from '@shieldbow/web'; +import { Client } from 'client'; +import { IMatch } from 'types'; +import { Team } from './team'; + +export class Match { + readonly id: string; + readonly dataVersion: string; + readonly endOfGameResult: string; + readonly gameCreationTimestamp: number; + readonly gameDuration: number; + readonly gameEndTimestamp: number; + readonly gameId: number; + readonly gameMode: GameMode; + readonly gameName: string; + readonly gameStartTimestamp: number; + readonly gameType: GameType; + readonly gameVersion: string; + readonly map: GameMap; + readonly teams: Team[]; + readonly tournamentCode: string; + + constructor( + client: Client, + data: IMatch, + champions: Champion[], + items: Item[], + rTrees: RuneTree[], + spells: SummonerSpell[] + ) { + this.id = data.metadata.matchId; + this.dataVersion = data.metadata.dataVersion; + this.endOfGameResult = data.info.endOfGameResult ?? 'GameComplete'; + this.gameCreationTimestamp = data.info.gameCreation; + this.gameDuration = data.info.gameDuration; + this.gameEndTimestamp = data.info.gameEndTimestamp; + this.gameId = data.info.gameId; + this.gameMode = client.gameModes.find((type) => type.gameMode === data.info.gameMode)!; + this.gameName = data.info.gameName; + this.gameStartTimestamp = data.info.gameStartTimestamp; + this.gameType = client.gameTypes.find((type) => type.gametype === data.info.gameType)!; + this.gameVersion = data.info.gameVersion; + this.map = client.maps.find((map) => map.mapId === data.info.mapId)!; + this.teams = data.info.teams.map( + (team) => + new Team( + client, + team, + data.info.participants.filter((p) => p.teamId === team.teamId), + champions, + items, + rTrees, + spells + ) + ); + this.tournamentCode = data.info.tournamentCode ?? ''; + } +} diff --git a/packages/shieldbow/src/structures/match/participant/bounty.ts b/packages/shieldbow/src/structures/match/participant/bounty.ts new file mode 100644 index 00000000..2d0c5e59 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/bounty.ts @@ -0,0 +1,104 @@ +/** + * A representation of the bounty on a match participant. + */ +export class ParticipantBounty { + /** + * The bounty level. + */ + readonly level: number; + /** + * The amount of gold killing the participant will earn. + * + * The maximum amount that can be earned at once is 1000. + * The rest is carried over when the participant respawns. + */ + readonly killBounty: number; + /** + * The amount of gold assisting in killing the participant will earn. + */ + readonly assistBounty: number; + /** + * The number of consecutive kills the participant has (to earn them this bounty). + */ + readonly consecutiveKills: number; + /** + * The number of consecutive deaths the participant has (to earn them this bounty). + */ + readonly consecutiveDeaths: number; + /** + * The announcement that is made when the participant kills an enemy. + * + * This is only available for bounty levels \> 2. + */ + readonly announcement?: string; + + /** + * Creates a new bounty instance. + * @param level - the bounty level of the participant. + */ + constructor(level: number) { + this.level = level; + this.killBounty = 300; + this.assistBounty = 150; + if (level < 0) { + this.consecutiveKills = 0; + this.consecutiveDeaths = -level; + } else { + this.consecutiveKills = level; + this.consecutiveDeaths = 0; + } + if (level < -5) { + this.killBounty = 100; + this.assistBounty = 50; + } else if (level > 7) { + this.killBounty = 1000 + (level - 7) * 100; + this.assistBounty = 150; + this.announcement = 'Legendary'; + } else + switch (level) { + case -5: + this.killBounty = 112; + this.assistBounty = 56; + break; + case -4: + this.killBounty = 140; + this.assistBounty = 70; + break; + case -3: + this.killBounty = 176; + this.assistBounty = 88; + break; + case -2: + this.killBounty = 220; + this.assistBounty = 110; + break; + case -1: + this.killBounty = 274; + this.assistBounty = 137; + break; + case 2: + this.killBounty = 450; + break; + case 3: + this.killBounty = 600; + this.announcement = 'Killing Spree'; + break; + case 4: + this.killBounty = 700; + this.announcement = 'Rampage'; + break; + case 5: + this.killBounty = 800; + this.announcement = 'Unstoppable'; + break; + case 6: + this.killBounty = 900; + this.announcement = 'Dominating'; + break; + case 7: + this.killBounty = 1000; + this.announcement = 'Godlike'; + break; + } + } +} diff --git a/packages/shieldbow/src/structures/match/participant/champion.ts b/packages/shieldbow/src/structures/match/participant/champion.ts new file mode 100644 index 00000000..ddef18e9 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/champion.ts @@ -0,0 +1,59 @@ +import { Collection } from '@discordjs/collection'; +import { Champion } from '@shieldbow/web'; +import { IMatchParticipant } from 'types'; + +/** + * Represents the stats of a champion picked by a participant in a match. + */ +export class ParticipantChampion { + /** + * The champion that the participant picked. + */ + readonly champ: Champion; + /** + * The amount of experience the participant earned on the champion. + */ + readonly xp: number; + /** + * The level of the champion. + */ + readonly level: number; + /** + * The numerical ID (key) of the champion. + */ + readonly id: number; + /** + * The name of the champion. + */ + readonly name: string; + /** + * The transformation of the champion. + * + * This is only used for Kayn - `DARKIN` or `ASSASSIN`. + */ + readonly transformation: 'NONE' | 'DARKIN' | 'ASSASSIN' = 'NONE'; + /** + * The number of times each ability of the champion was used by the participant. + */ + readonly abilitiesUsed: Collection<'Q' | 'W' | 'E' | 'R', number> = new Collection(); + + /** + * Creates a new instance of ParticipantChampion. + * @param data - The raw match participant data. + * @param champions - The array of champions. + */ + constructor(data: IMatchParticipant, champions: Champion[]) { + if (data.championName) this.champ = champions.find((c) => c.name === data.championName)!; + else this.champ = champions.find((c) => c.key === data.championId)!; + this.id = data.championId; + this.name = data.championName; + this.xp = data.champExperience; + this.level = data.champLevel; + this.transformation = data.championTransform === 0 ? 'NONE' : data.championTransform === 1 ? 'DARKIN' : 'ASSASSIN'; + + this.abilitiesUsed.set('Q', data.spell1Casts); + this.abilitiesUsed.set('W', data.spell2Casts); + this.abilitiesUsed.set('E', data.spell3Casts); + this.abilitiesUsed.set('R', data.spell4Casts); + } +} diff --git a/packages/shieldbow/src/structures/match/participant/damage.ts b/packages/shieldbow/src/structures/match/participant/damage.ts new file mode 100644 index 00000000..9a903dc2 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/damage.ts @@ -0,0 +1,64 @@ +import { IMatchParticipant } from 'types'; + +/** + * Represents the damage stats of a participant in a match. + */ +export class ParticipantDamageDealt { + /** + * The total damage dealt to buildings. + * + * This includes turrets, inhibitors, and the nexus. + */ + readonly toBuildings: number; + /** + * The total damage dealt to neutral objectives. + * + * This includes dragons, grubs, rift herald, and baron. + */ + readonly toObjectives: number; + /** + * The total damage dealt to turrets only. + */ + readonly toTurrets: number; + /** + * The total damage self-mitigated by the participant. + */ + readonly selfMitigated: number; + /** + * Creates a new instance of ParticipantDamageDealt. + * @param data - The raw match participant data. + */ + constructor(data: IMatchParticipant) { + this.toBuildings = data.damageDealtToBuildings; + this.toObjectives = data.damageDealtToObjectives; + this.toTurrets = data.damageDealtToTurrets; + this.selfMitigated = data.damageSelfMitigated; + } +} + +/** + * Represents the amount of damage of a specific type for a participant in a match. + */ +export class ParticipantDamage { + /** + * The total damage dealt. + */ + readonly dealt: number; + /** + * The total damage dealt to champions. + */ + readonly toChampions: number; + /** + * The total damage taken. + */ + readonly taken: number; + /** + * Creates a new instance of ParticipantDamage. + * @param data - The raw match participant data. + */ + constructor(data: IMatchParticipant) { + this.dealt = data.totalDamageDealt; + this.toChampions = data.totalDamageDealtToChampions; + this.taken = data.totalDamageTaken; + } +} diff --git a/packages/shieldbow/src/structures/match/participant/gold.ts b/packages/shieldbow/src/structures/match/participant/gold.ts new file mode 100644 index 00000000..3b449360 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/gold.ts @@ -0,0 +1,5 @@ +import { IMatchParticipant } from 'types'; + +export class ParticipantGold { + constructor(data: IMatchParticipant) {} +} diff --git a/packages/shieldbow/src/structures/match/participant/index.ts b/packages/shieldbow/src/structures/match/participant/index.ts new file mode 100644 index 00000000..7d12b835 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/index.ts @@ -0,0 +1,227 @@ +import { Collection } from '@discordjs/collection'; +import { Champion, Item, RuneTree, SummonerSpell } from '@shieldbow/web'; +import { Client } from 'client'; +import { IMatchParticipant, PingType } from 'types'; +import { ParticipantBounty } from './bounty'; +import { ParticipantChampion } from './champion'; +import { ParticipantDamage, ParticipantDamageDealt } from './damage'; +import { ParticipantVision } from './vision'; +import { ParticipantMultiKills } from './multikills'; +import { ParticipantGold } from './gold'; +import { ParticipantPosition } from './position'; +import { ParticipantMinions } from './minions'; + +export class MatchParticipant { + #client: Client; + readonly pings: Record = {} as Record; + readonly kills: number; + readonly deaths: number; + readonly assists: number; + readonly bounty: ParticipantBounty; + readonly challenges: Record; + readonly champion: ParticipantChampion; + readonly damageDealt: ParticipantDamageDealt; + readonly totalDamage: ParticipantDamage; + readonly physicalDamage: ParticipantDamage; + readonly magicDamage: ParticipantDamage; + readonly trueDamage: ParticipantDamage; + readonly vision: ParticipantVision; + readonly multiKills: ParticipantMultiKills; + readonly baronKills: number; + readonly dragonKills: number; + readonly eligibleForProgression: boolean; + readonly firstBlood: boolean; + readonly firstBloodAssist: boolean; + readonly firstTower: boolean; + readonly firstTowerAssist: boolean; + readonly earlySurrender: boolean; + readonly surrender: boolean; + readonly gold: ParticipantGold; + readonly position: ParticipantPosition; + readonly inhibitorsKilled: number; + readonly inhibitorTakedowns: number; + readonly inhibitorsLost: number; + readonly items: Collection<1 | 2 | 3 | 4 | 5 | 6 | 7, Item | undefined>; + readonly itemsPurchased: number; + readonly killingSprees: number; + readonly largestCriticalStrike: number; + readonly largestKillingSpree: number; + readonly longestLife: number; + readonly missions: Record; + readonly minions: ParticipantMinions; + readonly nexusKilled: number; + readonly nexusLost: number; + readonly nexusTakedown: number; + readonly objectivesStolen: number; + readonly objectivesStolenAssists: number; + readonly participantId: number; + readonly perks: ParticipantPerks; + readonly profileIconId: number; + readonly playerId: string; + readonly riotIdGameName: string; + readonly riotIdTagLine: string; + readonly summonerSpells: Collection<'D' | 'F', SummonerSpell>; + readonly summonerSpellsUsed: Collection<'D' | 'F', number>; + readonly summonerId: string; + readonly summonerLevel: number; + readonly teamEarlySurrendered: boolean; + readonly teamId: number; + readonly crowdControlScore: number; + readonly timePlayed: number; + readonly totalSelfHeal: number; + readonly totalAllyHeal: number; + readonly totalShielded: number; + readonly totalTimeCCDealt: number; + readonly totalTimeSpentDead: number; + readonly totalUnitsHealed: number; + readonly turretKills: number; + readonly turretTakedowns: number; + readonly turretsLost: number; + readonly unrealKills: number; + readonly win: boolean; + + constructor( + client: Client, + data: IMatchParticipant, + champions: Champion[], + items: Item[], + rTrees: RuneTree[], + spells: SummonerSpell[] + ) { + this.#client = client; + this.pings = { + allIn: data.allInPings ?? 0, + assistMe: data.assistMePings ?? 0, + bait: data.baitPings ?? 0, + basic: data.basicPings ?? 0, + command: data.commandPings ?? 0, + danger: data.dangerPings ?? 0, + enemyMissing: data.enemyMissingPings ?? 0, + enemyVision: data.enemyVisionPings ?? 0, + getBack: data.getBackPings ?? 0, + hold: data.holdPings ?? 0, + needVision: data.needVisionPings ?? 0, + onMyWay: data.onMyWayPings ?? 0, + push: data.pushPings ?? 0, + visionCleared: data.visionClearedPings ?? 0 + }; + + this.kills = data.kills; + this.deaths = data.deaths; + this.assists = data.assists; + this.bounty = new ParticipantBounty(data.bountyLevel); + this.challenges = data.challenges ?? {}; + this.champion = new ParticipantChampion(data, champions); + this.damageDealt = new ParticipantDamageDealt(data); + this.totalDamage = new ParticipantDamage(data); + this.physicalDamage = new ParticipantDamage(data); + this.magicDamage = new ParticipantDamage(data); + this.trueDamage = new ParticipantDamage(data); + this.vision = new ParticipantVision(data); + this.multiKills = new ParticipantMultiKills(data); + this.baronKills = data.baronKills; + this.dragonKills = data.dragonKills; + this.eligibleForProgression = data.eligibleForProgression; + this.firstBlood = data.firstBloodKill; + this.firstBloodAssist = data.firstBloodAssist; + this.firstTower = data.firstTowerKill; + this.firstTowerAssist = data.firstTowerAssist; + this.earlySurrender = data.gameEndedInEarlySurrender; + this.surrender = data.gameEndedInSurrender; + this.gold = new ParticipantGold(data); + this.position = new ParticipantPosition(data); + this.inhibitorsKilled = data.inhibitorKills; + this.inhibitorTakedowns = data.inhibitorTakedowns; + this.inhibitorsLost = data.inhibitorsLost; + + this.items = new Collection(); + this.items.set( + 1, + items.find((i) => i.id === data.item0.toString()) + ); + this.items.set( + 2, + items.find((i) => i.id === data.item1.toString()) + ); + this.items.set( + 3, + items.find((i) => i.id === data.item2.toString()) + ); + this.items.set( + 4, + items.find((i) => i.id === data.item3.toString()) + ); + this.items.set( + 5, + items.find((i) => i.id === data.item4.toString()) + ); + this.items.set( + 6, + items.find((i) => i.id === data.item5.toString()) + ); + this.items.set( + 7, + items.find((i) => i.id === data.item6.toString()) + ); + + this.itemsPurchased = data.itemsPurchased; + this.killingSprees = data.killingSprees; + this.largestCriticalStrike = data.largestCriticalStrike; + this.largestKillingSpree = data.largestKillingSpree; + this.longestLife = data.longestTimeSpentLiving; + + this.missions = data.missions ?? { + playerScore0: data.playerScore0 ?? 0, + playerScore1: data.playerScore1 ?? 0, + playerScore2: data.playerScore2 ?? 0, + playerScore3: data.playerScore3 ?? 0, + playerScore4: data.playerScore4 ?? 0, + playerScore5: data.playerScore5 ?? 0, + playerScore6: data.playerScore6 ?? 0, + playerScore7: data.playerScore7 ?? 0, + playerScore8: data.playerScore8 ?? 0, + playerScore9: data.playerScore9 ?? 0, + playerScore10: data.playerScore10 ?? 0, + playerScore11: data.playerScore11 ?? 0 + }; + + this.minions = new ParticipantMinions(data); + this.nexusKilled = data.nexusKills; + this.nexusLost = data.nexusLost; + this.nexusTakedown = data.nexusTakedowns; + this.objectivesStolen = data.objectivesStolen; + this.objectivesStolenAssists = data.objectivesStolenAssists; + this.participantId = data.participantId; + this.perks = new ParticipantPerks(data, rTrees); + this.profileIconId = data.profileIcon; + this.playerId = data.puuid; + this.riotIdGameName = data.riotIdGameName ?? data.riotIdName ?? data.summonerName; + this.riotIdTagLine = data.riotIdTagLine ?? ''; + + this.summonerSpells = new Collection(); + this.summonerSpells.set('D', spells.find((s) => s.id === data.summoner1Id.toString())!); + this.summonerSpells.set('F', spells.find((s) => s.id === data.summoner2Id.toString())!); + + this.summonerSpellsUsed = new Collection(); + this.summonerSpellsUsed.set('D', data.summoner1Casts); + this.summonerSpellsUsed.set('F', data.summoner2Casts); + + this.summonerId = data.summonerId; + this.summonerLevel = data.summonerLevel; + this.teamEarlySurrendered = data.teamEarlySurrendered; + this.teamId = data.teamId; + this.crowdControlScore = data.timeCCingOthers; + this.timePlayed = data.timePlayed; + this.totalSelfHeal = data.totalHeal; + this.totalAllyHeal = data.totalHealsOnTeammates; + this.totalShielded = data.totalDamageShieldedOnTeammates; + this.totalTimeCCDealt = data.totalTimeCCDealt; + this.totalTimeSpentDead = data.totalTimeSpentDead; + this.totalUnitsHealed = data.totalUnitsHealed; + this.turretKills = data.turretKills; + this.turretTakedowns = data.turretsTakedowns; + this.turretsLost = data.turretsLost; + this.unrealKills = data.unrealKills; + this.win = data.win; + } +} diff --git a/packages/shieldbow/src/structures/match/participant/minions.ts b/packages/shieldbow/src/structures/match/participant/minions.ts new file mode 100644 index 00000000..29c516ee --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/minions.ts @@ -0,0 +1,5 @@ +import { IMatchParticipant } from 'types'; + +export class ParticipantMinions { + constructor(data: IMatchParticipant) {} +} diff --git a/packages/shieldbow/src/structures/match/participant/multikills.ts b/packages/shieldbow/src/structures/match/participant/multikills.ts new file mode 100644 index 00000000..b3688bdb --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/multikills.ts @@ -0,0 +1,5 @@ +import { IMatchParticipant } from 'types'; + +export class ParticipantMultiKills { + constructor(data: IMatchParticipant) {} +} diff --git a/packages/shieldbow/src/structures/match/participant/perks.ts b/packages/shieldbow/src/structures/match/participant/perks.ts new file mode 100644 index 00000000..e69de29b diff --git a/packages/shieldbow/src/structures/match/participant/position.ts b/packages/shieldbow/src/structures/match/participant/position.ts new file mode 100644 index 00000000..8ea833c0 --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/position.ts @@ -0,0 +1,5 @@ +import { IMatchParticipant } from 'types'; + +export class ParticipantPosition { + constructor(data: IMatchParticipant) {} +} diff --git a/packages/shieldbow/src/structures/match/participant/vision.ts b/packages/shieldbow/src/structures/match/participant/vision.ts new file mode 100644 index 00000000..85c4113c --- /dev/null +++ b/packages/shieldbow/src/structures/match/participant/vision.ts @@ -0,0 +1,5 @@ +import { IMatchParticipant } from 'types'; + +export class ParticipantVision { + constructor(data: IMatchParticipant) {} +} diff --git a/packages/shieldbow/src/structures/match/team.ts b/packages/shieldbow/src/structures/match/team.ts new file mode 100644 index 00000000..7e3c8269 --- /dev/null +++ b/packages/shieldbow/src/structures/match/team.ts @@ -0,0 +1,46 @@ +import { Champion, Item, RuneTree, SummonerSpell } from '@shieldbow/web'; +import { Client } from 'client'; +import { IMatchParticipant, IMatchTeam, TeamObjective } from 'types'; +import { MatchParticipant } from './participant'; + +export class Team { + readonly id: number; + readonly name: 'blue' | 'red'; + readonly win: boolean; + readonly bans: Champion[]; + readonly objectiveKills: Record; + readonly firstObjectives: Record; + readonly members: MatchParticipant[]; + + constructor( + client: Client, + data: IMatchTeam, + participants: IMatchParticipant[], + champions: Champion[], + items: Item[], + rTrees: RuneTree[], + spells: SummonerSpell[] + ) { + this.id = data.teamId; + this.name = data.teamId === 100 ? 'blue' : 'red'; + this.win = data.win; + this.bans = data.bans.map((ban) => champions.find((champ) => champ.key === ban.championId)!); + this.objectiveKills = Object.keys(data.objectives).reduce( + (acc, key) => { + acc[key as TeamObjective] = data.objectives[key as TeamObjective].kills; + return acc; + }, + {} as Record + ); + this.firstObjectives = Object.keys(data.objectives).reduce( + (acc, key) => { + acc[key as TeamObjective] = data.objectives[key as TeamObjective].first; + return acc; + }, + {} as Record + ); + this.members = participants.map( + (participant) => new MatchParticipant(client, participant, champions, items, rTrees, spells) + ); + } +} diff --git a/packages/shieldbow/src/types/api/index.ts b/packages/shieldbow/src/types/api/index.ts index 8080c280..ce06d99c 100644 --- a/packages/shieldbow/src/types/api/index.ts +++ b/packages/shieldbow/src/types/api/index.ts @@ -17,3 +17,4 @@ export type { export * from './challenges'; export * from './spectator'; export * from './clash'; +export * from './match'; diff --git a/packages/shieldbow/src/types/api/match/index.ts b/packages/shieldbow/src/types/api/match/index.ts new file mode 100644 index 00000000..c2b5c8a9 --- /dev/null +++ b/packages/shieldbow/src/types/api/match/index.ts @@ -0,0 +1,25 @@ +export type PingType = + | 'allIn' + | 'assistMe' + | 'bait' + | 'basic' + | 'command' + | 'danger' + | 'enemyMissing' + | 'enemyVision' + | 'getBack' + | 'hold' + | 'needVision' + | 'onMyWay' + | 'push' + | 'visionCleared'; + +export type { IMatch, IMatchInfo, IMatchMetadata } from './match'; +export type { IMatchParticipant } from './participant'; +export type { IMatchTeam, IMatchTeamBan, IMatchTeamObjective, TeamObjective } from './team'; +export type { + IMatchParticipantPerkStyle, + IMatchParticipantPerkStyleSelection, + IMatchParticipantPerks, + IMatchParticipantStatPerks +} from './perks'; diff --git a/packages/shieldbow/src/types/api/match/match.ts b/packages/shieldbow/src/types/api/match/match.ts new file mode 100644 index 00000000..b2dfbaa6 --- /dev/null +++ b/packages/shieldbow/src/types/api/match/match.ts @@ -0,0 +1,41 @@ +import { IMatchTeam } from './team'; +import { IMatchParticipant } from './participant'; + +/** + * The raw match metadata from the API. + */ +export interface IMatchMetadata { + dataVersion: string; + matchId: string; + participants: string[]; +} + +/** + * The raw match info from the API. + */ +export interface IMatchInfo { + endOfGameResult?: string; + gameCreation: number; + gameDuration: number; + gameEndTimestamp: number; + gameId: number; + gameMode: string; + gameName: string; + gameStartTimestamp: number; + gameType: string; + gameVersion: string; + mapId: number; + participants: IMatchParticipant[]; + platformId: string; + queueId: number; + teams: IMatchTeam[]; + tournamentCode?: string; +} + +/** + * The raw match data from the API. + */ +export interface IMatch { + readonly metadata: IMatchMetadata; + readonly info: IMatchInfo; +} diff --git a/packages/shieldbow/src/types/api/match/participant.ts b/packages/shieldbow/src/types/api/match/participant.ts new file mode 100644 index 00000000..91f7b8a6 --- /dev/null +++ b/packages/shieldbow/src/types/api/match/participant.ts @@ -0,0 +1,153 @@ +import { IMatchParticipantPerks } from './perks'; + +/** + * The raw match participant data from the API. + */ +export interface IMatchParticipant { + allInPings: number; + assistMePings: number; + assists: number; + baitPings?: number; // Recently removed. + baronKills: number; + basicPings: number; + bountyLevel: number; + challenges?: Record; // Recently added + champExperience: number; + champLevel: number; + championId: number; + championName: string; + championTransform: number; + commandPings: number; + consumablesPurchased: number; + damageDealtToBuildings: number; + damageDealtToObjectives: number; + damageDealtToTurrets: number; + damageSelfMitigated: number; + dangerPings: number; + deaths: number; + detectorWardsPlaced: number; + doubleKills: number; + dragonKills: number; + eligibleForProgression: boolean; + enemyMissingPings: number; + enemyVisionPings: number; + firstBloodAssist: boolean; + firstBloodKill: boolean; + firstTowerAssist: boolean; + firstTowerKill: boolean; + gameEndedInEarlySurrender: boolean; + gameEndedInSurrender: boolean; + getBackPings: number; + goldEarned: number; + goldSpent: number; + holdPings: number; + individualPosition: string; + inhibitorKills: number; + inhibitorTakedowns: number; + inhibitorsLost: number; + item0: number; + item1: number; + item2: number; + item3: number; + item4: number; + item5: number; + item6: number; + itemsPurchased: number; + killingSprees: number; + kills: number; + lane: string; + largestCriticalStrike: number; + largestKillingSpree: number; + largestMultiKill: number; + longestTimeSpentLiving: number; + magicDamageDealt: number; + magicDamageDealtToChampions: number; + magicDamageTaken: number; + missions?: Record; // Recently added + needVisionPings: number; + neutralMinionsKilled: number; + nexusKills: number; + nexusLost: number; + nexusTakedowns: number; + objectivesStolen: number; + objectivesStolenAssists: number; + onMyWayPings: number; + participantId: number; + pentaKills: number; + perks: IMatchParticipantPerks; + physicalDamageDealt: number; + physicalDamageDealtToChampions: number; + physicalDamageTaken: number; + placement?: number; + playerAugment1?: number; + playerAugment2?: number; + playerAugment3?: number; + playerAugment4?: number; + playerAugment5?: number; // Only in new cherry (v3) + playerAugment6?: number; // ... + playerScore0?: number; // Only in old cherry (v2) + playerScore1?: number; // ... + playerScore2?: number; // ... + playerScore3?: number; // ... + playerScore4?: number; // ... + playerScore5?: number; // ... + playerScore6?: number; // ... + playerScore7?: number; // ... + playerScore8?: number; // ... + playerScore9?: number; // ... + playerScore10?: number; // ... + playerScore11?: number; // ... + playerSubteamId?: number; // Only in old cherry (v2) + profileIcon: number; + pushPings: number; + puuid: string; + quadraKills: number; + riotIdName?: string; // Only in old cherry (v1) + riotIdGameName?: string; // Other modes. + riotIdTagLine: string; + role: string; + sightWardsBoughtInGame: number; + spell1Casts: number; + spell2Casts: number; + spell3Casts: number; + spell4Casts: number; + subteamPlacement?: 0; + summoner1Casts: number; + summoner1Id: number; + summoner2Casts: number; + summoner2Id: number; + summonerId: string; + summonerLevel: number; + summonerName: string; + teamEarlySurrendered: boolean; + teamId: number; + teamPosition: string; + timeCCingOthers: number; + timePlayed: number; + totalAllyJungleMinionsKilled: number; + totalDamageDealt: number; + totalDamageDealtToChampions: number; + totalDamageShieldedOnTeammates: number; + totalDamageTaken: number; + totalEnemyJungleMinionsKilled: number; + totalHeal: number; + totalHealsOnTeammates: number; + totalMinionsKilled: number; + totalTimeCCDealt: number; + totalTimeSpentDead: number; + totalUnitsHealed: number; + tripleKills: number; + trueDamageDealt: number; + trueDamageDealtToChampions: number; + trueDamageTaken: number; + turretKills: number; + turretsLost: number; + turretsTakedowns: number; + unrealKills: number; + visionClearedPings: number; + visionScore: number; + visionWardsBoughtInGame: number; + wardsKilled: number; + wardsPlaced: number; + win: boolean; +} diff --git a/packages/shieldbow/src/types/api/match/perks.ts b/packages/shieldbow/src/types/api/match/perks.ts new file mode 100644 index 00000000..fd73bcee --- /dev/null +++ b/packages/shieldbow/src/types/api/match/perks.ts @@ -0,0 +1,35 @@ +/** + * The raw match participant stat perks data from the API. + */ +export interface IMatchParticipantStatPerks { + defense: number; + flex: number; + offense: number; +} + +/** + * The raw match participant selected perk from the API. + */ +export interface IMatchParticipantPerkStyleSelection { + perk: number; + var1: number; + var2: number; + var3: number; +} + +/** + * The raw match participant perk style data from the API. + */ +export interface IMatchParticipantPerkStyle { + description: string; + selections: IMatchParticipantPerkStyleSelection[]; + style: number; +} + +/** + * The raw match participant perks data from the API. + */ +export interface IMatchParticipantPerks { + statPerks: IMatchParticipantStatPerks; + styles: IMatchParticipantPerkStyle[]; +} diff --git a/packages/shieldbow/src/types/api/match/team.ts b/packages/shieldbow/src/types/api/match/team.ts new file mode 100644 index 00000000..91802674 --- /dev/null +++ b/packages/shieldbow/src/types/api/match/team.ts @@ -0,0 +1,30 @@ +/** + * The raw match team ban data from the API. + */ +export interface IMatchTeamBan { + championId: number; + pickTurn: number; +} + +/** + * The valid team objectives. + */ +export type TeamObjective = 'baron' | 'champion' | 'dragon' | 'horde' | 'inhibitor' | 'riftHerald' | 'tower'; + +/** + * The raw match team objective stats from the API. + */ +export interface IMatchTeamObjective { + first: boolean; + kills: number; +} + +/** + * The raw match team data from the API. + */ +export interface IMatchTeam { + teamId: number; + win: boolean; + bans: IMatchTeamBan[]; + objectives: Record; +}