jka-core
Version:
Library for working with Jedi Academy servers
30 lines (29 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.clientUsersFromRconStatusJapro = void 0;
function clientUsersFromRconStatusJapro(clientsInfoStrArray) {
return clientsInfoStrArray.map(line => {
var _a, _b, _c;
const id = parseInt(line.slice(0, 2).trim());
const score = parseInt(line.slice(3, 8).trim());
const isBot = line.slice(20, 42).trim() === 'bot';
const ping = isBot
? null
: (_a = parseInt(line.slice(9, 13).trim())) !== null && _a !== void 0 ? _a : null;
const rate = (_b = parseInt(line.slice(14, 19).trim())) !== null && _b !== void 0 ? _b : null;
const address = isBot
? null
: line.slice(20, 42).trim();
const name = (_c = line.slice(43, -2).trim()) !== null && _c !== void 0 ? _c : null;
return {
id,
name,
address,
isBot,
ping,
score,
rate,
};
});
}
exports.clientUsersFromRconStatusJapro = clientUsersFromRconStatusJapro;