Files
node-metaverse/dist/classes/packets/LeaveGroupReply.js
2017-12-13 15:23:50 +00:00

43 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const UUID_1 = require("../UUID");
const MessageFlags_1 = require("../../enums/MessageFlags");
class LeaveGroupReplyPacket {
constructor() {
this.name = 'LeaveGroupReply';
this.flags = MessageFlags_1.MessageFlags.Trusted | MessageFlags_1.MessageFlags.FrequencyLow;
this.id = 4294902108;
}
getSize() {
return 33;
}
writeToBuffer(buf, pos) {
const startPos = pos;
this.AgentData['AgentID'].writeToBuffer(buf, pos);
pos += 16;
this.GroupData['GroupID'].writeToBuffer(buf, pos);
pos += 16;
buf.writeUInt8((this.GroupData['Success']) ? 1 : 0, pos++);
return pos - startPos;
}
readFromBuffer(buf, pos) {
const startPos = pos;
const newObjAgentData = {
AgentID: UUID_1.UUID.zero()
};
newObjAgentData['AgentID'] = new UUID_1.UUID(buf, pos);
pos += 16;
this.AgentData = newObjAgentData;
const newObjGroupData = {
GroupID: UUID_1.UUID.zero(),
Success: false
};
newObjGroupData['GroupID'] = new UUID_1.UUID(buf, pos);
pos += 16;
newObjGroupData['Success'] = (buf.readUInt8(pos++) === 1);
this.GroupData = newObjGroupData;
return pos - startPos;
}
}
exports.LeaveGroupReplyPacket = LeaveGroupReplyPacket;
//# sourceMappingURL=LeaveGroupReply.js.map