UNPKG

steam-condenser

Version:
43 lines 2.04 kB
"use strict"; /* eslint-disable no-bitwise */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var SteamPacket_1 = __importDefault(require("./SteamPacket")); var M2AServerBatchPacket = /** @class */ (function (_super) { __extends(M2AServerBatchPacket, _super); function M2AServerBatchPacket(contentData) { var _this = _super.call(this, SteamPacket_1.default.M2A_SERVER_BATCH_HEADER, contentData) || this; if (_this.contentData.getByte() !== 10) { throw new Error('Master query response is missing additional 0x0A byte.'); } _this.serverArray = []; while (_this.contentData.remaining() > 0) { var ip = (_this.contentData.getByte() & 0xFF) + "." + (_this.contentData.getByte() & 0xFF) + "." + (_this.contentData.getByte() & 0xFF) + "." + (_this.contentData.getByte() & 0xFF); var port = _this.contentData.getUShort(); port = ((port & 0xFF) << 8) + (port >> 8); _this.serverArray.push(ip + ":" + port); } return _this; } M2AServerBatchPacket.prototype.getServers = function () { return this.serverArray; }; return M2AServerBatchPacket; }(SteamPacket_1.default)); exports.default = M2AServerBatchPacket; //# sourceMappingURL=M2AServerBatchPacket.js.map