Add support for the Inventory Accepted / Declined response
This commit is contained in:
@@ -27,6 +27,7 @@ import { ObjectResolvedEvent } from '../events/ObjectResolvedEvent';
|
||||
import { GameObject } from './public/GameObject';
|
||||
import { Avatar } from './public/Avatar';
|
||||
import { BulkUpdateInventoryEvent } from '../events/BulkUpdateInventoryEvent';
|
||||
import { InventoryResponseEvent } from '../events/InventoryResponseEvent';
|
||||
|
||||
export class ClientEvents
|
||||
{
|
||||
@@ -44,6 +45,7 @@ export class ClientEvents
|
||||
onGroupChatSessionJoin: Subject<GroupChatSessionJoinEvent> = new Subject<GroupChatSessionJoinEvent>();
|
||||
onGroupChatAgentListUpdate: Subject<GroupChatSessionAgentListEvent> = new Subject<GroupChatSessionAgentListEvent>();
|
||||
onFriendResponse: Subject<FriendResponseEvent> = new Subject<FriendResponseEvent>();
|
||||
onInventoryResponse: Subject<InventoryResponseEvent> = new Subject<InventoryResponseEvent>();
|
||||
onScriptDialog: Subject<ScriptDialogEvent> = new Subject<ScriptDialogEvent>();
|
||||
onEventQueueStateChange: Subject<EventQueueStateChangeEvent> = new Subject<EventQueueStateChangeEvent>();
|
||||
onFriendOnline: Subject<FriendOnlineEvent> = new Subject<FriendOnlineEvent>();
|
||||
|
||||
@@ -22,6 +22,7 @@ import { FriendResponseEvent } from '../events/FriendResponseEvent';
|
||||
import { GroupChatEvent } from '../events/GroupChatEvent';
|
||||
import { ChatEvent } from '../events/ChatEvent';
|
||||
import { ScriptDialogEvent } from '../events/ScriptDialogEvent';
|
||||
import { InventoryResponseEvent } from '../events/InventoryResponseEvent';
|
||||
|
||||
export class Comms
|
||||
{
|
||||
@@ -85,9 +86,27 @@ export class Comms
|
||||
break;
|
||||
}
|
||||
case InstantMessageDialog.InventoryAccepted:
|
||||
{
|
||||
const irEvent = new InventoryResponseEvent();
|
||||
irEvent.from = im.AgentData.AgentID;
|
||||
irEvent.fromName = Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
|
||||
irEvent.message = Utils.BufferToStringSimple(im.MessageBlock.Message);
|
||||
irEvent.requestID = im.MessageBlock.ID;
|
||||
irEvent.accepted = true;
|
||||
this.clientEvents.onInventoryResponse.next(irEvent);
|
||||
break;
|
||||
}
|
||||
case InstantMessageDialog.InventoryDeclined:
|
||||
{
|
||||
const irEvent = new InventoryResponseEvent();
|
||||
irEvent.from = im.AgentData.AgentID;
|
||||
irEvent.fromName = Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
|
||||
irEvent.message = Utils.BufferToStringSimple(im.MessageBlock.Message);
|
||||
irEvent.requestID = im.MessageBlock.ID;
|
||||
irEvent.accepted = false;
|
||||
this.clientEvents.onInventoryResponse.next(irEvent);
|
||||
break;
|
||||
}
|
||||
case InstantMessageDialog.TaskInventoryOffered:
|
||||
{
|
||||
const fromName = Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
|
||||
|
||||
10
lib/events/InventoryResponseEvent.ts
Normal file
10
lib/events/InventoryResponseEvent.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { UUID } from '../classes/UUID';
|
||||
|
||||
export class InventoryResponseEvent
|
||||
{
|
||||
from: UUID;
|
||||
fromName: string;
|
||||
message: string;
|
||||
accepted: boolean;
|
||||
requestID: UUID;
|
||||
}
|
||||
Reference in New Issue
Block a user