UNPKG

@z0mt3c/f1-telemetry-client

Version:

[![Node.js CI](https://github.com/z0mt3c/f1-telemetry-client/actions/workflows/node.js.yml/badge.svg)](https://github.com/z0mt3c/f1-telemetry-client/actions/workflows/node.js.yml) [![NPM Release](https://img.shields.io/npm/v/@z0mt3c/f1-telemetry-client.sv

41 lines (40 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParticipantDataParser = void 0; const F1Parser_1 = require("../F1Parser"); class LiveryColourParser extends F1Parser_1.F1Parser { constructor() { super(); this.endianess('little').uint8('red').uint8('green').uint8('blue'); } } class ParticipantDataParser extends F1Parser_1.F1Parser { constructor(packetFormat) { super(); this.uint8('m_aiControlled').uint8('m_driverId'); if (packetFormat >= 2021) { this.uint8('m_networkId'); } this.uint8('m_teamId'); if (packetFormat >= 2021) { this.uint8('m_myTeam'); } const nameLength = packetFormat >= 2025 ? 32 : 48; this.uint8('m_raceNumber').uint8('m_nationality').string('m_name', { length: nameLength, stripNull: true, }); if (packetFormat >= 2019) this.uint8('m_yourTelemetry'); if (packetFormat >= 2023) this.uint8('m_showOnlineNames'); if (packetFormat >= 2024) this.uint16le('m_techLevel'); if (packetFormat >= 2023) this.uint8('m_platform'); if (packetFormat >= 2025) { this.uint8('m_numColours').array('m_liveryColours', { length: 4, type: new LiveryColourParser() }); } } } exports.ParticipantDataParser = ParticipantDataParser;