UNPKG

jka-core

Version:

Library for working with Jedi Academy servers

30 lines (29 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.clientUsersFromRconStatusYbeproxy = void 0; function clientUsersFromRconStatusYbeproxy(clientsInfoStrArray) { return clientsInfoStrArray.map(line => { var _a, _b, _c; const score = parseInt(line.slice(0, 5).trim()); const isBot = line.slice(18, 40).trim() === 'bot'; const ping = isBot ? null : (_a = parseInt(line.slice(6, 10).trim())) !== null && _a !== void 0 ? _a : null; const rate = (_b = parseInt(line.slice(11, 17).trim())) !== null && _b !== void 0 ? _b : null; const address = isBot ? null : line.slice(18, 40).trim(); const id = parseInt(line.slice(41, 43).trim()); const name = (_c = line.slice(44, -2).trim()) !== null && _c !== void 0 ? _c : null; return { id, name, address, isBot, ping, score, rate, }; }); } exports.clientUsersFromRconStatusYbeproxy = clientUsersFromRconStatusYbeproxy;