Colorfulstan
6/28/2017 - 4:05 PM

Typescript typings for League of Legends lol-champ-select outputs in LeagueClient.log

Typescript typings for League of Legends lol-champ-select outputs in LeagueClient.log

interface ChampionSelectInfo {
    actions: Array<ChampionSelectAction[]> // TODO: are there some times more then one ChampionSelectAction[] items?
    bans: {
        myTeamBans: any[] // TODO: typing
        numBans: number
        theirTeamBans: any[] // TODO: typing
    }
    ceremonials: any[] // TODO: what, why, how? - typing
    chatDetails: {
        /** @example
         * "0n67i+HRx1oOlT+E70pqDtt4qAHMRhu1@sec" */
        chatRoomName: string
        chatRoomPassword: string
    }
    isSpectating: boolean
    /** CellId for the current Player.
     * Can be used to figure out the players actions */
    localPlayerCellId: ChampionSelectCellId
    myTeam: ChampionSelectPlayerInfo[]
    theirTeam: ChampionSelectPlayerInfo[]
    timer: ChampionSelectTimerInfo
    trades: any // TODO: typings
}

interface ChampionSelectAction {
    actorCellId: ChampionSelectCellId,
    championId: number,
    completed: boolean,
    /** action Id (continuos?) */
    id: number,
    pickTurn: number,
    type: "pick" | "ban"
}

type ChampionSelectCellId = number

interface ChampionSelectPlayerInfo {
    assignedPosition: ChampionSelectPosition,
    cellId: ChampionSelectCellId,
    /** 0 for Bots (or when not visible?) */
    championId: 84,
    /** 0 if nothing picked */
    championPickIntent: number,
    displayName: string,
    playerType: "PLAYER" | "BOT",
    /** built by <championId><skin id padded to 3 digits>
     * @example
     * 84007 = championId: 84, skindId: 7*/
    selectedSkinId: number,
    spell1Id: ChampionSelectSpellId,
    spell2Id: ChampionSelectSpellId,
    /** equivalent to 100/200 TODO: make sure this is correct */
    team: 1 | 2,
    /** -1 for bots (and if not visible?) 0 = default ? */
    wardSkinId: number // TODO: make sure doc is correct
}

/** for bots this number can either be 0 or something completely bogus like 18446744073709551615 */
type ChampionSelectSpellId = number

type ChampionSelectPosition = string // TODO: typing as union type of possibilities

interface ChampionSelectTimerInfo {
    adjustedTimeLeftInPhase: number,
    adjustedTimeLeftInPhaseInSec: number,
    internalNowInEpochMs: number,
    isInfinite: boolean,
    phase: ChampionSelectPhase,
    timeLeftInPhase: number,
    timeLeftInPhaseInSec: number,
    totalTimeInPhase: number
}