Files
node-metaverse/lib/classes/InventoryItem.ts
Casper Warden 76b080757b - Mesh upload support
- LLMesh asset decoding and encoding (inc. LLPhysicsConvex, LLSkin, LLSubMesh)
- Query inventory folder by type
- onSelectedObject event
- fetchInventoryItem command
- Fix packing/unpacking of object shape
- Time sync with SimulatorViewerTimeMessage
- Changed several classes to a .from style rather than setting up in the constructor (exception friendly)
- Whole bunch of other improvements
- Object building
2018-11-15 03:22:07 +00:00

69 lines
1.9 KiB
TypeScript

import {UUID} from './UUID';
import {InventoryType} from '../enums/InventoryType';
import {PermissionMask} from '../enums/PermissionMask';
import {AssetType, InventoryItemFlags} from '..';
export class InventoryItem
{
assetID: UUID = UUID.zero();
inventoryType: InventoryType;
name: string;
salePrice: number;
saleType: number;
created: Date;
parentID: UUID;
flags: InventoryItemFlags;
itemID: UUID;
description: string;
type: AssetType;
permissions: {
baseMask: PermissionMask;
groupMask: PermissionMask;
nextOwnerMask: PermissionMask;
ownerMask: PermissionMask;
everyoneMask: PermissionMask;
lastOwner: UUID;
owner: UUID;
creator: UUID;
group: UUID;
groupOwned?: boolean
} = {
baseMask: 0,
groupMask: 0,
nextOwnerMask: 0,
ownerMask: 0,
everyoneMask: 0,
lastOwner: UUID.zero(),
owner: UUID.zero(),
creator: UUID.zero(),
group: UUID.zero(),
groupOwned: false
};
getCRC(): number
{
let crc = 0;
crc += this.assetID.CRC();
crc += this.parentID.CRC();
crc += this.itemID.CRC();
crc += this.permissions.creator.CRC();
crc += this.permissions.owner.CRC();
crc += this.permissions.group.CRC();
crc += this.permissions.ownerMask;
crc += this.permissions.nextOwnerMask;
crc += this.permissions.everyoneMask;
crc += this.permissions.groupMask;
crc += this.flags;
crc += this.inventoryType;
crc += this.type;
crc += Math.round(this.created.getTime() / 1000);
crc += this.salePrice;
crc += this.saleType * 0x07073096;
while (crc > 4294967295)
{
crc -= 4294967295;
}
return crc;
}
}