node-insim
Version:
An InSim library for NodeJS with TypeScript support
80 lines (79 loc) • 3.38 kB
JavaScript
;
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IR_SEL_ReqI = exports.IR_SEL = void 0;
var decorators_1 = require("../decorators");
var base_1 = require("./base");
var enums_1 = require("./enums");
/**
* Relay select - packet to select a host, so relay starts sending you data.
*/
var IR_SEL = /** @class */ (function (_super) {
__extends(IR_SEL, _super);
function IR_SEL(data) {
var _this = _super.call(this) || this;
_this.SIZE_MULTIPLIER = 1;
_this.Size = 68;
_this.Type = enums_1.PacketType.IRP_SEL;
/** If non-zero Relay will reply with an {@link IS_VER} packet */
_this.ReqI = 0;
_this.Zero = 0;
/** Hostname to receive data from - may be colour code stripped */
_this.HName = '';
/** Admin password (to gain admin access to host) */
_this.Admin = '';
/** Spectator password (if host requires it) */
_this.Spec = '';
_this.initialize(data);
return _this;
}
__decorate([
(0, decorators_1.byte)()
], IR_SEL.prototype, "Size", void 0);
__decorate([
(0, decorators_1.byte)()
], IR_SEL.prototype, "Type", void 0);
__decorate([
(0, decorators_1.byte)()
], IR_SEL.prototype, "ReqI", void 0);
__decorate([
(0, decorators_1.byte)()
], IR_SEL.prototype, "Zero", void 0);
__decorate([
(0, decorators_1.stringNull)(32)
], IR_SEL.prototype, "HName", void 0);
__decorate([
(0, decorators_1.stringNull)(16)
], IR_SEL.prototype, "Admin", void 0);
__decorate([
(0, decorators_1.stringNull)(16)
], IR_SEL.prototype, "Spec", void 0);
return IR_SEL;
}(base_1.SendablePacket));
exports.IR_SEL = IR_SEL;
var IR_SEL_ReqI;
(function (IR_SEL_ReqI) {
IR_SEL_ReqI[IR_SEL_ReqI["ZERO"] = 0] = "ZERO";
/** Send back an {@link IS_VER} packet */
IR_SEL_ReqI[IR_SEL_ReqI["SEND_VERSION"] = 1] = "SEND_VERSION";
})(IR_SEL_ReqI || (exports.IR_SEL_ReqI = IR_SEL_ReqI = {}));