feat Variant

This commit is contained in:
cha0s 2020-05-21 08:57:23 -05:00
parent a424101ee3
commit 4954220305

View File

@ -0,0 +1,24 @@
import msgpack from 'msgpack-lite';
export default function (Superclass) {
return class VariantPacket extends Superclass {
static pack(packet) {
packet.data[1] = msgpack.encode(packet.data[1]);
return super.pack(packet);
}
static get schema() {
return {
...super.schema,
data: 'buffer',
};
}
static unpack(packet) {
const data = super.unpack(packet);
return msgpack.decode(data);
}
}
}