Receive and respond to friend requests and inventory offers

This commit is contained in:
Casper Warden
2017-12-19 19:59:06 +00:00
parent 6cbe790657
commit 70fd5a99ce
23 changed files with 382 additions and 11 deletions

View File

@@ -1,11 +1,12 @@
import {UUID} from './UUID';
import {ClientEvents} from './ClientEvents';
import {AssetType} from '../enums/AssetType';
export class Inventory
{
main: {
skeleton: {
typeDefault: number,
typeDefault: AssetType,
version: number,
name: string,
folderID: UUID,
@@ -34,4 +35,24 @@ export class Inventory
{
this.clientEvents = clientEvents;
}
findFolderForType(type: AssetType): UUID
{
if (this.main.root === undefined)
{
return UUID.zero();
}
if (type === AssetType.Folder)
{
return this.main.root;
}
let found = UUID.zero();
this.main.skeleton.forEach((folder) =>
{
if (folder.typeDefault === type)
{
found = folder.folderID;
}
});
return found;
}
}