159 lines
6.6 KiB
JavaScript
159 lines
6.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const UUID_1 = require("../UUID");
|
|
const MessageFlags_1 = require("../../enums/MessageFlags");
|
|
const Message_1 = require("../../enums/Message");
|
|
class RezScriptMessage {
|
|
constructor() {
|
|
this.name = 'RezScript';
|
|
this.messageFlags = MessageFlags_1.MessageFlags.Zerocoded | MessageFlags_1.MessageFlags.FrequencyLow;
|
|
this.id = Message_1.Message.RezScript;
|
|
}
|
|
getSize() {
|
|
return (this.InventoryBlock['Name'].length + 1 + this.InventoryBlock['Description'].length + 1) + 189;
|
|
}
|
|
writeToBuffer(buf, pos) {
|
|
const startPos = pos;
|
|
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.AgentData['GroupID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt32LE(this.UpdateBlock['ObjectLocalID'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8((this.UpdateBlock['Enabled']) ? 1 : 0, pos++);
|
|
this.InventoryBlock['ItemID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.InventoryBlock['FolderID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.InventoryBlock['CreatorID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.InventoryBlock['OwnerID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
this.InventoryBlock['GroupID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeUInt32LE(this.InventoryBlock['BaseMask'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.InventoryBlock['OwnerMask'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.InventoryBlock['GroupMask'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.InventoryBlock['EveryoneMask'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.InventoryBlock['NextOwnerMask'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8((this.InventoryBlock['GroupOwned']) ? 1 : 0, pos++);
|
|
this.InventoryBlock['TransactionID'].writeToBuffer(buf, pos);
|
|
pos += 16;
|
|
buf.writeInt8(this.InventoryBlock['Type'], pos++);
|
|
buf.writeInt8(this.InventoryBlock['InvType'], pos++);
|
|
buf.writeUInt32LE(this.InventoryBlock['Flags'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8(this.InventoryBlock['SaleType'], pos++);
|
|
buf.writeInt32LE(this.InventoryBlock['SalePrice'], pos);
|
|
pos += 4;
|
|
buf.writeUInt8(this.InventoryBlock['Name'].length, pos++);
|
|
this.InventoryBlock['Name'].copy(buf, pos);
|
|
pos += this.InventoryBlock['Name'].length;
|
|
buf.writeUInt8(this.InventoryBlock['Description'].length, pos++);
|
|
this.InventoryBlock['Description'].copy(buf, pos);
|
|
pos += this.InventoryBlock['Description'].length;
|
|
buf.writeInt32LE(this.InventoryBlock['CreationDate'], pos);
|
|
pos += 4;
|
|
buf.writeUInt32LE(this.InventoryBlock['CRC'], pos);
|
|
pos += 4;
|
|
return pos - startPos;
|
|
}
|
|
readFromBuffer(buf, pos) {
|
|
const startPos = pos;
|
|
let varLength = 0;
|
|
const newObjAgentData = {
|
|
AgentID: UUID_1.UUID.zero(),
|
|
SessionID: UUID_1.UUID.zero(),
|
|
GroupID: UUID_1.UUID.zero()
|
|
};
|
|
newObjAgentData['AgentID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentData['SessionID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjAgentData['GroupID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
this.AgentData = newObjAgentData;
|
|
const newObjUpdateBlock = {
|
|
ObjectLocalID: 0,
|
|
Enabled: false
|
|
};
|
|
newObjUpdateBlock['ObjectLocalID'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjUpdateBlock['Enabled'] = (buf.readUInt8(pos++) === 1);
|
|
this.UpdateBlock = newObjUpdateBlock;
|
|
const newObjInventoryBlock = {
|
|
ItemID: UUID_1.UUID.zero(),
|
|
FolderID: UUID_1.UUID.zero(),
|
|
CreatorID: UUID_1.UUID.zero(),
|
|
OwnerID: UUID_1.UUID.zero(),
|
|
GroupID: UUID_1.UUID.zero(),
|
|
BaseMask: 0,
|
|
OwnerMask: 0,
|
|
GroupMask: 0,
|
|
EveryoneMask: 0,
|
|
NextOwnerMask: 0,
|
|
GroupOwned: false,
|
|
TransactionID: UUID_1.UUID.zero(),
|
|
Type: 0,
|
|
InvType: 0,
|
|
Flags: 0,
|
|
SaleType: 0,
|
|
SalePrice: 0,
|
|
Name: Buffer.allocUnsafe(0),
|
|
Description: Buffer.allocUnsafe(0),
|
|
CreationDate: 0,
|
|
CRC: 0
|
|
};
|
|
newObjInventoryBlock['ItemID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['FolderID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['CreatorID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['OwnerID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['GroupID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['BaseMask'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['OwnerMask'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['GroupMask'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['EveryoneMask'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['NextOwnerMask'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['GroupOwned'] = (buf.readUInt8(pos++) === 1);
|
|
newObjInventoryBlock['TransactionID'] = new UUID_1.UUID(buf, pos);
|
|
pos += 16;
|
|
newObjInventoryBlock['Type'] = buf.readInt8(pos++);
|
|
newObjInventoryBlock['InvType'] = buf.readInt8(pos++);
|
|
newObjInventoryBlock['Flags'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['SaleType'] = buf.readUInt8(pos++);
|
|
newObjInventoryBlock['SalePrice'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
varLength = buf.readUInt8(pos++);
|
|
newObjInventoryBlock['Name'] = buf.slice(pos, pos + varLength);
|
|
pos += varLength;
|
|
varLength = buf.readUInt8(pos++);
|
|
newObjInventoryBlock['Description'] = buf.slice(pos, pos + varLength);
|
|
pos += varLength;
|
|
newObjInventoryBlock['CreationDate'] = buf.readInt32LE(pos);
|
|
pos += 4;
|
|
newObjInventoryBlock['CRC'] = buf.readUInt32LE(pos);
|
|
pos += 4;
|
|
this.InventoryBlock = newObjInventoryBlock;
|
|
return pos - startPos;
|
|
}
|
|
}
|
|
exports.RezScriptMessage = RezScriptMessage;
|
|
//# sourceMappingURL=RezScript.js.map
|