UNPKG

steam-condenser

Version:
71 lines 3.56 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 S2AInfoBasePacket_1 = __importDefault(require("./S2AInfoBasePacket")); var SteamPacket_1 = __importDefault(require("./SteamPacket")); var S2AInfo2Packet = /** @class */ (function (_super) { __extends(S2AInfo2Packet, _super); function S2AInfo2Packet(data) { var _this = _super.call(this, SteamPacket_1.default.S2A_INFO2_HEADER, data) || this; _this.info.networkVersion = _this.contentData.getByte(); _this.info.serverName = _this.contentData.getString(); _this.info.mapName = _this.contentData.getString(); _this.info.gameDir = _this.contentData.getString(); _this.info.gameDesc = _this.contentData.getString(); _this.info.appId = _this.contentData.getShort(); _this.info.numberOfPlayers = _this.contentData.getByte(); _this.info.maxPlayers = _this.contentData.getByte(); _this.info.botNumber = _this.contentData.getByte(); _this.info.dedicated = String.fromCharCode(_this.contentData.getByte()); _this.info.operatingSystem = String.fromCharCode(_this.contentData.getByte()); _this.info.passwordProtected = _this.contentData.getByte() === 1; _this.info.secureServer = _this.contentData.getByte() === 1; _this.info.gameVersion = _this.contentData.getString(); if (_this.contentData.remaining() > 0) { var extraDataFlag = _this.contentData.getByte(); if (extraDataFlag & S2AInfo2Packet.EDF_GAME_PORT) { _this.info.serverPort = _this.contentData.getShort(); } if (extraDataFlag & S2AInfo2Packet.EDF_SERVER_ID) { _this.info.serverId = _this.contentData.getUnsignedLong() | (_this.contentData.getUnsignedLong() << 32); } if (extraDataFlag & S2AInfo2Packet.EDF_SOURCE_TV) { _this.info.tvPort = _this.contentData.getShort(); _this.info.tvName = _this.contentData.getString(); } if (extraDataFlag & S2AInfo2Packet.EDF_SERVER_TAGS) { _this.info.serverTags = _this.contentData.getString(); } if (extraDataFlag & S2AInfo2Packet.EDF_GAME_ID) { _this.info.gameId = _this.contentData.getUnsignedLong() | (_this.contentData.getUnsignedLong() << 32); } } return _this; } S2AInfo2Packet.EDF_GAME_ID = 0x01; S2AInfo2Packet.EDF_GAME_PORT = 0x80; S2AInfo2Packet.EDF_SERVER_ID = 0x10; S2AInfo2Packet.EDF_SERVER_TAGS = 0x20; S2AInfo2Packet.EDF_SOURCE_TV = 0x40; return S2AInfo2Packet; }(S2AInfoBasePacket_1.default)); exports.default = S2AInfo2Packet; //# sourceMappingURL=S2AInfo2Packet.js.map