UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

126 lines (125 loc) 5.29 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 (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.InSimFlags = exports.IS_ISI_ReqI = exports.IS_ISI = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); /** * InSim Init - packet to initialise the InSim system */ var IS_ISI = /** @class */ (function (_super) { __extends(IS_ISI, _super); function IS_ISI(data) { var _this = _super.call(this) || this; _this.Size = 44; _this.Type = enums_1.PacketType.ISP_ISI; /** If non-zero LFS will send an {@link IS_VER} packet */ _this.ReqI = 0; _this.Zero = 0; /** Port for UDP replies from LFS (0 to 65535) */ _this.UDPPort = 0; /** Bit flags for options */ _this.Flags = 0; /** The INSIM_VERSION used by your program */ _this.InSimVer = 0; /** Special host message prefix character */ _this.Prefix = ''; /** Time in ms between {@link IS_NLP} or {@link IS_MCI} (0 = none) */ _this.Interval = 0; /** Admin password (if set in LFS) */ _this.Admin = ''; /** A short name for your program */ _this.IName = ''; _this.initialize(data); return _this; } __decorate([ (0, decorators_1.byte)() ], IS_ISI.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_ISI.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_ISI.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_ISI.prototype, "Zero", void 0); __decorate([ (0, decorators_1.word)() ], IS_ISI.prototype, "UDPPort", void 0); __decorate([ (0, decorators_1.word)() ], IS_ISI.prototype, "Flags", void 0); __decorate([ (0, decorators_1.byte)() ], IS_ISI.prototype, "InSimVer", void 0); __decorate([ (0, decorators_1.string)(1) ], IS_ISI.prototype, "Prefix", void 0); __decorate([ (0, decorators_1.word)() ], IS_ISI.prototype, "Interval", void 0); __decorate([ (0, decorators_1.stringNull)(16) ], IS_ISI.prototype, "Admin", void 0); __decorate([ (0, decorators_1.stringNull)(16) ], IS_ISI.prototype, "IName", void 0); return IS_ISI; }(base_1.SendablePacket)); exports.IS_ISI = IS_ISI; var IS_ISI_ReqI; (function (IS_ISI_ReqI) { IS_ISI_ReqI[IS_ISI_ReqI["ZERO"] = 0] = "ZERO"; /** Send back an {@link IS_VER} packet */ IS_ISI_ReqI[IS_ISI_ReqI["SEND_VERSION"] = 1] = "SEND_VERSION"; })(IS_ISI_ReqI || (exports.IS_ISI_ReqI = IS_ISI_ReqI = {})); var InSimFlags; (function (InSimFlags) { /** Spare */ InSimFlags[InSimFlags["ISF_RES_0"] = 1] = "ISF_RES_0"; /** Spare */ InSimFlags[InSimFlags["ISF_RES_1"] = 2] = "ISF_RES_1"; /** Guest or single player */ InSimFlags[InSimFlags["ISF_LOCAL"] = 4] = "ISF_LOCAL"; /** Keep colours in {@link IS_MSO} text */ InSimFlags[InSimFlags["ISF_MSO_COLS"] = 8] = "ISF_MSO_COLS"; /** Receive {@link IS_NLP} packets */ InSimFlags[InSimFlags["ISF_NLP"] = 16] = "ISF_NLP"; /** Receive {@link IS_MCI} packets */ InSimFlags[InSimFlags["ISF_MCI"] = 32] = "ISF_MCI"; /** Receive {@link IS_CON} packets */ InSimFlags[InSimFlags["ISF_CON"] = 64] = "ISF_CON"; /** Receive {@link IS_OBH} packets */ InSimFlags[InSimFlags["ISF_OBH"] = 128] = "ISF_OBH"; /** Receive {@link IS_HLV} packets */ InSimFlags[InSimFlags["ISF_HLV"] = 256] = "ISF_HLV"; /** Receive {@link IS_AXM} when loading a layout */ InSimFlags[InSimFlags["ISF_AXM_LOAD"] = 512] = "ISF_AXM_LOAD"; /** Receive {@link IS_AXM} when changing objects */ InSimFlags[InSimFlags["ISF_AXM_EDIT"] = 1024] = "ISF_AXM_EDIT"; /** Process join requests */ InSimFlags[InSimFlags["ISF_REQ_JOIN"] = 2048] = "ISF_REQ_JOIN"; })(InSimFlags || (exports.InSimFlags = InSimFlags = {}));