node-insim
Version:
An InSim library for NodeJS with TypeScript support
163 lines (162 loc) • 7.11 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;
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.License = exports.Language = exports.IS_NCI = void 0;
var decorators_1 = require("../decorators");
var base_1 = require("./base");
var enums_1 = require("./enums");
/**
* New Conn Info - sent on host only if an admin password has been set
*/
var IS_NCI = /** @class */ (function (_super) {
__extends(IS_NCI, _super);
function IS_NCI() {
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
_this.Size = 16;
_this.Type = enums_1.PacketType.ISP_NCI;
/** 0 unless this is a reply to a {@link TINY_NCI} request */
_this.ReqI = 0;
/** Connection's unique id (0 = host) */
_this.UCID = 0;
/** Languages */
_this.Language = 0;
/** 0:demo / 1:S1 ... */
_this.License = 0;
_this.Sp2 = 0;
_this.Sp3 = 0;
/** LFS UserID */
_this.UserID = 0;
/** IP address formatted as 255.255.255.255 */
_this.IPAddress = '';
return _this;
}
IS_NCI.prototype.unpack = function (buffer) {
_super.prototype.unpack.call(this, buffer);
this.IPAddress = buffer.slice(12, 16).join('.');
return this;
};
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "Size", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "Type", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "ReqI", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "UCID", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "Language", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "License", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "Sp2", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_NCI.prototype, "Sp3", void 0);
__decorate([
(0, decorators_1.unsigned)()
], IS_NCI.prototype, "UserID", void 0);
__decorate([
(0, decorators_1.unsigned)()
], IS_NCI.prototype, "IPAddress", void 0);
return IS_NCI;
}(base_1.Packet));
exports.IS_NCI = IS_NCI;
var Language;
(function (Language) {
Language[Language["LFS_ENGLISH"] = 0] = "LFS_ENGLISH";
Language[Language["LFS_DEUTSCH"] = 1] = "LFS_DEUTSCH";
Language[Language["LFS_PORTUGUESE"] = 2] = "LFS_PORTUGUESE";
Language[Language["LFS_FRENCH"] = 3] = "LFS_FRENCH";
Language[Language["LFS_SUOMI"] = 4] = "LFS_SUOMI";
Language[Language["LFS_NORSK"] = 5] = "LFS_NORSK";
Language[Language["LFS_NEDERLANDS"] = 6] = "LFS_NEDERLANDS";
Language[Language["LFS_CATALAN"] = 7] = "LFS_CATALAN";
Language[Language["LFS_TURKISH"] = 8] = "LFS_TURKISH";
Language[Language["LFS_CASTELLANO"] = 9] = "LFS_CASTELLANO";
Language[Language["LFS_ITALIANO"] = 10] = "LFS_ITALIANO";
Language[Language["LFS_DANSK"] = 11] = "LFS_DANSK";
Language[Language["LFS_CZECH"] = 12] = "LFS_CZECH";
Language[Language["LFS_RUSSIAN"] = 13] = "LFS_RUSSIAN";
Language[Language["LFS_ESTONIAN"] = 14] = "LFS_ESTONIAN";
Language[Language["LFS_SERBIAN"] = 15] = "LFS_SERBIAN";
Language[Language["LFS_GREEK"] = 16] = "LFS_GREEK";
Language[Language["LFS_POLSKI"] = 17] = "LFS_POLSKI";
Language[Language["LFS_CROATIAN"] = 18] = "LFS_CROATIAN";
Language[Language["LFS_HUNGARIAN"] = 19] = "LFS_HUNGARIAN";
Language[Language["LFS_BRAZILIAN"] = 20] = "LFS_BRAZILIAN";
Language[Language["LFS_SWEDISH"] = 21] = "LFS_SWEDISH";
Language[Language["LFS_SLOVAK"] = 22] = "LFS_SLOVAK";
Language[Language["LFS_GALEGO"] = 23] = "LFS_GALEGO";
Language[Language["LFS_SLOVENSKI"] = 24] = "LFS_SLOVENSKI";
Language[Language["LFS_BELARUSSIAN"] = 25] = "LFS_BELARUSSIAN";
Language[Language["LFS_LATVIAN"] = 26] = "LFS_LATVIAN";
Language[Language["LFS_LITHUANIAN"] = 27] = "LFS_LITHUANIAN";
Language[Language["LFS_TRADITIONAL_CHINESE"] = 28] = "LFS_TRADITIONAL_CHINESE";
Language[Language["LFS_SIMPLIFIED_CHINESE"] = 29] = "LFS_SIMPLIFIED_CHINESE";
Language[Language["LFS_JAPANESE"] = 30] = "LFS_JAPANESE";
Language[Language["LFS_KOREAN"] = 31] = "LFS_KOREAN";
Language[Language["LFS_BULGARIAN"] = 32] = "LFS_BULGARIAN";
Language[Language["LFS_LATINO"] = 33] = "LFS_LATINO";
Language[Language["LFS_UKRAINIAN"] = 34] = "LFS_UKRAINIAN";
Language[Language["LFS_INDONESIAN"] = 35] = "LFS_INDONESIAN";
Language[Language["LFS_ROMANIAN"] = 36] = "LFS_ROMANIAN";
})(Language || (exports.Language = Language = {}));
var License;
(function (License) {
License[License["Demo"] = 0] = "Demo";
License[License["S1"] = 1] = "S1";
License[License["S2"] = 2] = "S2";
License[License["S3"] = 3] = "S3";
})(License || (exports.License = License = {}));