import * as React from 'react' import type { TalkNPCs, TalkNPC } from '@lastres/talk-npc' import OutputPacketTalk from '@lastres/output-packet/talk' export interface TalkNPCsComponentProps { talkNPCs: TalkNPCs | null websocket: WebSocket | null } export default function TalkNPCsComponent (props: TalkNPCsComponentProps): JSX.Element { const npcs = props.talkNPCs function onWordlesslyTalk (npc: TalkNPC): void { if (props.websocket === null) { return } new OutputPacketTalk(npc.identifier).send(props.websocket) } function printAvatar (npc: TalkNPC): JSX.Element { if (npc.icon === undefined) { return <> } return
} if (npcs === null) { return <> } if (Object.keys(npcs).length < 1) { return <>

No hay nadie para hablar ahora.

} return ( <>

Disponible para hablar:

{ Object.keys(npcs).map((identifier) => { const npc = npcs[identifier] return
{ printAvatar(npc) }

{npc.name}

}) } ) }