diff --git a/packages/dota/src/dota/lib/heroes.ts b/packages/dota/src/dota/lib/heroes.ts index 0ed2f655..01315f60 100644 --- a/packages/dota/src/dota/lib/heroes.ts +++ b/packages/dota/src/dota/lib/heroes.ts @@ -659,7 +659,7 @@ export const translatedColor = (color: string, lng: string) => { } export const heroColors = 'Blue,Teal,Purple,Yellow,Orange,Pink,Olive,Cyan,Green,Brown'.split(',') -export function getHeroNameOrColor(id?: number, index?: number) { +export function getHeroNameOrColor(id: number, index?: number) { if (!id && typeof index === 'number') return heroColors[index] const hero = getHeroById(id) diff --git a/packages/dota/src/steam/notableplayers.ts b/packages/dota/src/steam/notableplayers.ts index 75f9070b..3d8feb8e 100644 --- a/packages/dota/src/steam/notableplayers.ts +++ b/packages/dota/src/steam/notableplayers.ts @@ -79,14 +79,13 @@ export async function notablePlayers({ }) const proPlayers: NotablePlayer[] = [] - matchPlayers.forEach((player, i: number) => { + matchPlayers.forEach((player: Player, i: number) => { const np = nps.find((np) => np.account_id === player.accountid) const props = { account_id: player.accountid, - heroId: player.heroid ?? 0, + heroId: player.heroid, position: i, - heroName: - player.playerid >= 0 ? getHeroNameOrColor(player.heroid ?? 0, player.playerid) : '?', + heroName: getHeroNameOrColor(player.heroid, i), name: np?.name ?? `Player ${i + 1}`, country_code: np?.country_code ?? '', isMe: steam32Id === player.accountid,