Files
djhackersdev_minime/src/idz/encoder/lockProfile.ts
T
2019-11-06 17:28:29 -05:00

19 lines
449 B
TypeScript

import { LockProfileResponse } from "../response/lockProfile";
const statusCodes = {
locked: 0x0000,
unlocked: 0x0001,
obsolete: 0x0002,
};
export function lockProfile(res: LockProfileResponse) {
const buf = Buffer.alloc(0x0020);
buf.writeInt16LE(0x006a, 0x0000);
buf.writeInt8(statusCodes[res.status], 0x0018);
buf.writeInt16LE(res.field_001A, 0x001a);
buf.writeInt32LE(res.lockExpiry.getTime() / 1000, 0x001c);
return buf;
}