UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

179 lines (178 loc) 7.15 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.PitWorkFlags = exports.IS_PIT = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); /** * PIT stop (stop at pit garage) */ var IS_PIT = /** @class */ (function (_super) { __extends(IS_PIT, _super); function IS_PIT() { var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this; _this.Size = 24; _this.Type = enums_1.PacketType.ISP_PIT; _this.ReqI = 0; /** Player's unique id */ _this.PLID = 0; /** Laps completed */ _this.LapsDone = 0; /** Player flags */ _this.Flags = 0; /** /showfuel yes: fuel added percent / no: 255 */ _this.FuelAdd = 0; /** Current penalty value */ _this.Penalty = enums_1.PenaltyValue.PENALTY_NONE; /** Number of pit stops */ _this.NumStops = 0; _this.Sp3 = 0; /** Rear left tyre compound */ _this.TyreRL = enums_1.TyreCompound.TYRE_R1; /** Rear right tyre compound */ _this.TyreRR = enums_1.TyreCompound.TYRE_R1; /** Front left tyre compound */ _this.TyreFL = enums_1.TyreCompound.TYRE_R1; /** Front right tyre compound */ _this.TyreFR = enums_1.TyreCompound.TYRE_R1; /** Pit work */ _this.Work = 0; _this.Spare = 0; return _this; } __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "PLID", void 0); __decorate([ (0, decorators_1.word)() ], IS_PIT.prototype, "LapsDone", void 0); __decorate([ (0, decorators_1.word)() ], IS_PIT.prototype, "Flags", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "FuelAdd", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "Penalty", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "NumStops", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "Sp3", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "TyreRL", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "TyreRR", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "TyreFL", void 0); __decorate([ (0, decorators_1.byte)() ], IS_PIT.prototype, "TyreFR", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_PIT.prototype, "Work", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_PIT.prototype, "Spare", void 0); return IS_PIT; }(base_1.Packet)); exports.IS_PIT = IS_PIT; var PitWorkFlags; (function (PitWorkFlags) { /** No work done */ PitWorkFlags[PitWorkFlags["PSE_NOTHING"] = 1] = "PSE_NOTHING"; /** Stopped at pit box */ PitWorkFlags[PitWorkFlags["PSE_STOP"] = 2] = "PSE_STOP"; /** Front damage */ PitWorkFlags[PitWorkFlags["PSE_FR_DAM"] = 4] = "PSE_FR_DAM"; /** Front wheels change */ PitWorkFlags[PitWorkFlags["PSE_FR_WHL"] = 8] = "PSE_FR_WHL"; /** Left front damage */ PitWorkFlags[PitWorkFlags["PSE_LE_FR_DAM"] = 16] = "PSE_LE_FR_DAM"; /** Left front wheel change */ PitWorkFlags[PitWorkFlags["PSE_LE_FR_WHL"] = 32] = "PSE_LE_FR_WHL"; /** Right front damage */ PitWorkFlags[PitWorkFlags["PSE_RI_FR_DAM"] = 64] = "PSE_RI_FR_DAM"; /** Right front wheel change */ PitWorkFlags[PitWorkFlags["PSE_RI_FR_WHL"] = 128] = "PSE_RI_FR_WHL"; /** Rear damage */ PitWorkFlags[PitWorkFlags["PSE_RE_DAM"] = 256] = "PSE_RE_DAM"; /** Rear wheels change */ PitWorkFlags[PitWorkFlags["PSE_RE_WHL"] = 512] = "PSE_RE_WHL"; /** Left rear damage */ PitWorkFlags[PitWorkFlags["PSE_LE_RE_DAM"] = 1024] = "PSE_LE_RE_DAM"; /** Left rear wheel change */ PitWorkFlags[PitWorkFlags["PSE_LE_RE_WHL"] = 2048] = "PSE_LE_RE_WHL"; /** Right rear damage */ PitWorkFlags[PitWorkFlags["PSE_RI_RE_DAM"] = 4096] = "PSE_RI_RE_DAM"; /** Right rear wheel change */ PitWorkFlags[PitWorkFlags["PSE_RI_RE_WHL"] = 8192] = "PSE_RI_RE_WHL"; /** Minor body damage */ PitWorkFlags[PitWorkFlags["PSE_BODY_MINOR"] = 16384] = "PSE_BODY_MINOR"; /** Major body damage */ PitWorkFlags[PitWorkFlags["PSE_BODY_MAJOR"] = 32768] = "PSE_BODY_MAJOR"; /** Setup adjustments */ PitWorkFlags[PitWorkFlags["PSE_SETUP"] = 65536] = "PSE_SETUP"; /** Refuel */ PitWorkFlags[PitWorkFlags["PSE_REFUEL"] = 131072] = "PSE_REFUEL"; })(PitWorkFlags || (exports.PitWorkFlags = PitWorkFlags = {}));