Files
node-metaverse/lib/classes/InventoryItem.ts

69 lines
1.9 KiB
TypeScript
Raw Normal View History

import {UUID} from './UUID';
import {InventoryType} from '../enums/InventoryType';
import {PermissionMask} from '../enums/PermissionMask';
2018-10-10 10:36:12 +01:00
import {AssetType, InventoryItemFlags} from '..';
2017-12-19 23:43:00 +00:00
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;
- Add "GET" method to Caps - New events: ObjectPhysicsDataEvent, ParcelPropertiesEvent, NewObjectEvent, ObjectUpdateEvent, ObjectKilledEvent - Added getXML function to Color4, Vector2, Vector3, Vector4, GameObject, Region, Quaternion, UUID for opensim-compatible XML export - Added TextureAnim and ParticleSystem decoding to the "full" ObjectStore - Object store will automatically request missing "parent" prims - "setPersist" - When persist is TRUE, the ObjectStore will not forget about "killed" prims - useful for region scanning - Support for Flexible params, Light params, LightImage params, Mesh data, Sculpt maps - Fixed object scale being incorrectly calculated - Add terrain decoding (this was a ballache) - Add parcel map decoding - Add support for region windlight settings (region.environment) - Add support for materials (normal / specular maps) - Add getBuffer, getLong and bitwiseOr to UUID - Added a circular-reference-safe JSONStringify to Utils - Add XferFile capability to Circuit PUBLIC API: AssetCommands: - Rework "downloadAsset" to detect failures - NEW: downloadInventoryAsset() - uses TransferRequest for prim inventory items - NEW: getMaterials() - resolves material UUIDs RegionCommands: - NEW: getTerrainTextures() - NEW: exportSettings() - OpenSim XML export of region settings - NEW: async getTerrain() - Get binary terrain heightmap, 256x256 float32 - resolveObjects() - now fetches task inventory contents too. - resolveObjects() - fix calculation of land impact - NEW: getObjectByLocalID(localID: number, timeout: number) - NEW: getObjectByUUID(uuid: UUID, timeout: number) - NEW: getParcels(); - NEW: pruneObjects - removes missing GameObjects from a list - NEW: setPersist - prevent objectstore from forgetting about killed gameobjects
2018-10-31 11:28:24 +00:00
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;
}
}