tsinsim
Version:
An InSim library for Node.js (JavaScript runtime environment) with TypeScript support.
83 lines (82 loc) • 2.79 kB
JavaScript
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 __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Sendable } from "../../utilities/index.js";
import { define, byte } from "../../utilities/decorators.js";
import { PacketType } from "../../types/PacketType.js";
import { PMOAction } from "../../enums/index.js";
import { ObjectInfo } from "../ObjectInfo.js";
let IS_AXM = class IS_AXM extends Sendable {
constructor(options = {}) {
super();
Object.assign(this, options);
}
Size = 8;
Type = PacketType.ISP_AXM;
ReqI = 0;
NumO = 0;
UCID = 0;
PMOAction = 0;
PMOFlags = 0;
Sp3 = 0;
Info = [];
pack() {
this.NumO = this.Info.length > 60 ? 60 : this.Info.length;
var buffer = super.pack(this.Size + this.Info.length * 8);
for (const item of this.Info.slice(0, 60)) {
buffer = Buffer.concat([buffer, item.pack()]);
}
return buffer;
}
unpack(data) {
super.unpack(data);
for (var i = 0; i < this.NumO; i++) {
const start = 8 + 8 * i;
this.Info.push(new ObjectInfo().unpack(data.subarray(start, start + 8)));
}
return this;
}
};
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "Size", void 0);
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "Type", void 0);
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "ReqI", void 0);
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "NumO", void 0);
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "UCID", void 0);
__decorate([
byte(),
__metadata("design:type", Number)
], IS_AXM.prototype, "PMOAction", void 0);
__decorate([
byte(),
__metadata("design:type", Number)
], IS_AXM.prototype, "PMOFlags", void 0);
__decorate([
byte(),
__metadata("design:type", Object)
], IS_AXM.prototype, "Sp3", void 0);
IS_AXM = __decorate([
define,
__metadata("design:paramtypes", [Object])
], IS_AXM);
export { IS_AXM };