UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

156 lines (155 loc) 5.83 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; }; 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.IS_RES = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); /** * RESult (qualify or confirmed finish) */ var IS_RES = /** @class */ (function (_super) { __extends(IS_RES, _super); function IS_RES() { var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this; _this.Size = 84; _this.Type = enums_1.PacketType.ISP_RES; /** 0 unless this is a reply to a {@link TINY_RES} request */ _this.ReqI = 0; /** Player's unique id (0 = player left before result was sent) */ _this.PLID = 0; /** Username */ _this.UName = ''; /** Nickname */ _this.PName = ''; /** Number plate - NO ZERO AT END! */ _this.Plate = ''; /** Skin prefix */ _this.CName = ''; /** Race or autocross: total time / qualify: session time (ms) */ _this.TTime = 0; /** Best lap (ms) */ _this.BTime = 0; _this.SpA = 0; /** Number of pit stops */ _this.NumStops = 0; /** confirmation flags: disqualified etc. */ _this.Confirm = 0; _this.SpB = 0; /** Laps completed */ _this.LapsDone = 0; /** Player flags: help settings etc. */ _this.Flags = 0; /** Finish or qualify pos (0 = win / 255 = not added to table) */ _this.ResultNum = 0; /** Total number of results (qualify doesn't always add a new one) */ _this.NumRes = 0; /** Penalty time in seconds (already included in race time) */ _this.PSeconds = 0; return _this; } __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "PLID", void 0); __decorate([ (0, decorators_1.stringNull)(24) ], IS_RES.prototype, "UName", void 0); __decorate([ (0, decorators_1.stringNull)(24) ], IS_RES.prototype, "PName", void 0); __decorate([ (0, decorators_1.string)(8) ], IS_RES.prototype, "Plate", void 0); __decorate([ (0, decorators_1.stringNull)(4) ], IS_RES.prototype, "CName", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_RES.prototype, "TTime", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_RES.prototype, "BTime", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "SpA", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "NumStops", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "Confirm", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "SpB", void 0); __decorate([ (0, decorators_1.word)() ], IS_RES.prototype, "LapsDone", void 0); __decorate([ (0, decorators_1.word)() ], IS_RES.prototype, "Flags", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "ResultNum", void 0); __decorate([ (0, decorators_1.byte)() ], IS_RES.prototype, "NumRes", void 0); __decorate([ (0, decorators_1.word)() ], IS_RES.prototype, "PSeconds", void 0); return IS_RES; }(base_1.Packet)); exports.IS_RES = IS_RES;