Add support for sending teleport requests. Closes #33

This commit is contained in:
Casper Warden
2020-11-19 15:56:29 +00:00
parent f6cdcbd7ae
commit 5c7fcd09bd
2 changed files with 32 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import { PacketFlags } from '../../enums/PacketFlags';
import { GroupChatSessionJoinEvent } from '../../events/GroupChatSessionJoinEvent';
import { ScriptDialogEvent } from '../../events/ScriptDialogEvent';
import Timer = NodeJS.Timer;
import { StartLureMessage } from '../messages/StartLure';
export class CommunicationsCommands extends CommandsBase
{
@@ -100,6 +101,32 @@ export class CommunicationsCommands extends CommandsBase
return await this.circuit.waitForAck(sequenceNo, 10000);
}
async sendTeleport(target: UUID | string, message?: string)
{
if (typeof target === 'string')
{
target = new UUID(target);
}
if (message === undefined)
{
message = 'Join me in ' + this.currentRegion.regionName;
}
const p = new StartLureMessage();
p.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
p.Info = {
LureType: 0,
Message: Utils.StringToBuffer(message)
}
p.TargetData = [{
TargetID: target
}];
const sequenceNo = this.circuit.sendMessage(p, PacketFlags.Reliable);
return await this.circuit.waitForAck(sequenceNo, 10000);
}
async stopTypingLocal(): Promise<void>
{
const cfv = new ChatFromViewerMessage();