UNPKG

steam-condenser

Version:
63 lines 2.28 kB
"use strict"; 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 Packet_1 = __importDefault(require("../Packet")); var RCONPacket = /** @class */ (function (_super) { __extends(RCONPacket, _super); function RCONPacket(id, body, type) { var _this = _super.call(this, Buffer.alloc(Buffer.byteLength(body) + 14)) || this; _this.writeLong(_this.buffer.length - 4); _this.writeLong(id); _this.writeLong(type); _this.writeString(body); _this.writeShort(0x00); return _this; } Object.defineProperty(RCONPacket.prototype, "size", { get: function () { return this.buffer.readInt32LE(0); }, enumerable: false, configurable: true }); Object.defineProperty(RCONPacket.prototype, "ID", { get: function () { return this.buffer.readInt32LE(4); }, enumerable: false, configurable: true }); Object.defineProperty(RCONPacket.prototype, "type", { get: function () { return this.buffer.readInt32LE(8); }, enumerable: false, configurable: true }); Object.defineProperty(RCONPacket.prototype, "body", { get: function () { // Remove string terminator return this.buffer.slice(12, this.buffer.length - 2).toString(); }, enumerable: false, configurable: true }); return RCONPacket; }(Packet_1.default)); exports.default = RCONPacket; //# sourceMappingURL=RCONPacket.js.map