jka-core
Version:
Library for working with Jedi Academy servers
34 lines (33 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.clientUsersFromRconStatusBase = void 0;
function clientUsersFromRconStatusBase(clientsInfoStrArray) {
return clientsInfoStrArray.map(line => {
var _a, _b, _c, _d, _e;
const id = parseInt(line.slice(0, 3).trim());
const score = parseInt(line.slice(4, 9).trim());
const isBot = line.slice(39, 60).trim() === 'bot';
const ping = isBot
? null
: (_a = parseInt(line.slice(10, 14).trim())) !== null && _a !== void 0 ? _a : null;
const name = (_b = line.slice(15, 30).trim()) !== null && _b !== void 0 ? _b : null;
const lastmsg = (_c = parseInt(line.slice(31, 38).trim())) !== null && _c !== void 0 ? _c : null;
const address = isBot
? null
: line.slice(39, 60).trim();
const qport = (_d = parseInt(line.slice(61, 66).trim())) !== null && _d !== void 0 ? _d : null;
const rate = (_e = parseInt(line.slice(67, 72).trim())) !== null && _e !== void 0 ? _e : null;
return {
id,
name,
address,
isBot,
ping,
score,
qport,
rate,
lastmsg,
};
});
}
exports.clientUsersFromRconStatusBase = clientUsersFromRconStatusBase;