node-insim
Version:
An InSim library for NodeJS with TypeScript support
60 lines (59 loc) • 1.67 kB
JavaScript
import { __decorate } from "tslib";
import { byte } from '../decorators';
import { SendablePacket } from './base';
import { PacketType } from './enums';
/**
* Single CHaracter
*
* You can send individual key presses to LFS with the IS_SCH packet.
* For standard keys (e.g. V and H) you should send a capital letter.
* This does not work with some keys like F keys, arrows or CTRL keys.
* You can also use {@link IS_MST} with the /press /shift /ctrl /alt commands.
*/
export class IS_SCH extends SendablePacket {
constructor(data) {
super();
this.Size = 8;
this.Type = PacketType.ISP_SCH;
this.ReqI = 0;
this.Zero = 0;
/** Key to press */
this.CharB = 0;
/** Bit 0: Shift / bit 1: Ctrl */
this.Flags = 0;
this.Spare2 = 0;
this.Spare3 = 0;
this.initialize(data);
}
}
__decorate([
byte()
], IS_SCH.prototype, "Size", void 0);
__decorate([
byte()
], IS_SCH.prototype, "Type", void 0);
__decorate([
byte()
], IS_SCH.prototype, "ReqI", void 0);
__decorate([
byte()
], IS_SCH.prototype, "Zero", void 0);
__decorate([
byte()
], IS_SCH.prototype, "CharB", void 0);
__decorate([
byte()
], IS_SCH.prototype, "Flags", void 0);
__decorate([
byte()
], IS_SCH.prototype, "Spare2", void 0);
__decorate([
byte()
], IS_SCH.prototype, "Spare3", void 0);
export var CharacterModifiers;
(function (CharacterModifiers) {
/** Shift key */
CharacterModifiers[CharacterModifiers["SHIFT"] = 1] = "SHIFT";
/** Ctrl key */
CharacterModifiers[CharacterModifiers["CTRL"] = 2] = "CTRL";
})(CharacterModifiers || (CharacterModifiers = {}));