Ping / circuit latency, break out commands, add typing function for IM, add thinkingTime and charactersPerSecond parameters to typing functions

This commit is contained in:
Casper Warden
2017-12-13 19:55:08 +00:00
parent af71aa597e
commit 4e8feb181f
96 changed files with 2151 additions and 935 deletions

View File

@@ -60,8 +60,5 @@ export declare class Agent {
sendAgentUpdate(): void;
shutdown(): void;
onAnimState(packet: Packet): void;
private animate(anim, run);
startAnimations(anim: UUID[]): Promise<void>;
stopAnimations(anim: UUID[]): Promise<void>;
setInitialAppearance(): void;
}

24
dist/classes/Agent.js vendored
View File

@@ -18,7 +18,6 @@ const InventorySortOrder_1 = require("../enums/InventorySortOrder");
const RezSingleAttachmentFromInv_1 = require("./messages/RezSingleAttachmentFromInv");
const AttachmentPoint_1 = require("../enums/AttachmentPoint");
const Utils_1 = require("./Utils");
const AgentAnimation_1 = require("./messages/AgentAnimation");
class Agent {
constructor(clientEvents) {
this.localID = 0;
@@ -90,29 +89,6 @@ class Agent {
}
}
}
animate(anim, run) {
const circuit = this.currentRegion.circuit;
const animPacket = new AgentAnimation_1.AgentAnimationMessage();
animPacket.AgentData = {
AgentID: this.agentID,
SessionID: circuit.sessionID
};
animPacket.PhysicalAvatarEventList = [];
animPacket.AnimationList = [];
anim.forEach((a) => {
animPacket.AnimationList.push({
AnimID: a,
StartAnim: run
});
});
return circuit.waitForAck(circuit.sendMessage(animPacket, PacketFlags_1.PacketFlags.Reliable), 10000);
}
startAnimations(anim) {
return this.animate(anim, true);
}
stopAnimations(anim) {
return this.animate(anim, false);
}
setInitialAppearance() {
const circuit = this.currentRegion.circuit;
const wearablesRequest = new AgentWearablesRequest_1.AgentWearablesRequestMessage();

File diff suppressed because one or more lines are too long

View File

@@ -22,6 +22,7 @@ export declare class Circuit {
[key: number]: {
packet: Packet;
timeout: number;
sent: number;
};
};
receivedPackets: {
@@ -41,6 +42,7 @@ export declare class Circuit {
sendPacket(packet: Packet): void;
ackReceived(sequenceNumber: number): void;
sendAck(sequenceNumber: number): void;
getOldestUnacked(): number;
expireReceivedPacket(sequenceNumber: number): void;
receivedPacket(bytes: Buffer): void;
}

View File

@@ -133,7 +133,8 @@ class Circuit {
this.awaitingAck[packet.sequenceNumber] =
{
packet: packet,
timeout: setTimeout(this.resend.bind(this, packet.sequenceNumber), 1000)
timeout: setTimeout(this.resend.bind(this, packet.sequenceNumber), 1000),
sent: new Date().getTime()
};
}
let dataToSend = Buffer.allocUnsafe(packet.getSize());
@@ -162,6 +163,19 @@ class Circuit {
];
this.sendMessage(msg, 0);
}
getOldestUnacked() {
let result = 0;
let oldest = -1;
const keys = Object.keys(this.awaitingAck);
keys.forEach((seqID) => {
const nSeq = parseInt(seqID, 10);
if (oldest === -1 || this.awaitingAck[nSeq].sent < oldest) {
result = nSeq;
oldest = this.awaitingAck[nSeq].sent;
}
});
return result;
}
expireReceivedPacket(sequenceNumber) {
if (this.receivedPackets[sequenceNumber]) {
delete this.receivedPackets[sequenceNumber];

File diff suppressed because one or more lines are too long

22
dist/classes/ClientCommands.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
import { Region } from './Region';
import { Agent } from './Agent';
import { Bot } from '../Bot';
import { NetworkCommands } from './commands/NetworkCommands';
import { AssetCommands } from './commands/AssetCommands';
import { TeleportCommands } from './commands/TeleportCommands';
import { RegionCommands } from './commands/RegionCommands';
import { GridCommands } from './commands/GridCommands';
import { CommunicationsCommands } from './commands/CommunicationsCommands';
import { AgentCommands } from './commands/AgentCommands';
import { GroupCommands } from './commands/GroupCommands';
export declare class ClientCommands {
network: NetworkCommands;
asset: AssetCommands;
teleport: TeleportCommands;
region: RegionCommands;
grid: GridCommands;
comms: CommunicationsCommands;
agent: AgentCommands;
group: GroupCommands;
constructor(region: Region, agent: Agent, bot: Bot);
}

24
dist/classes/ClientCommands.js vendored Normal file
View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const NetworkCommands_1 = require("./commands/NetworkCommands");
const AssetCommands_1 = require("./commands/AssetCommands");
const TeleportCommands_1 = require("./commands/TeleportCommands");
const RegionCommands_1 = require("./commands/RegionCommands");
const GridCommands_1 = require("./commands/GridCommands");
const CommunicationsCommands_1 = require("./commands/CommunicationsCommands");
const AgentCommands_1 = require("./commands/AgentCommands");
const GroupCommands_1 = require("./commands/GroupCommands");
class ClientCommands {
constructor(region, agent, bot) {
this.network = new NetworkCommands_1.NetworkCommands(region, agent, bot);
this.asset = new AssetCommands_1.AssetCommands(region, agent, bot);
this.teleport = new TeleportCommands_1.TeleportCommands(region, agent, bot);
this.region = new RegionCommands_1.RegionCommands(region, agent, bot);
this.grid = new GridCommands_1.GridCommands(region, agent, bot);
this.comms = new CommunicationsCommands_1.CommunicationsCommands(region, agent, bot);
this.agent = new AgentCommands_1.AgentCommands(region, agent, bot);
this.group = new GroupCommands_1.GroupCommands(region, agent, bot);
}
}
exports.ClientCommands = ClientCommands;
//# sourceMappingURL=ClientCommands.js.map

1
dist/classes/ClientCommands.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ClientCommands.js","sourceRoot":"","sources":["../../lib/classes/ClientCommands.ts"],"names":[],"mappings":";;AAGA,gEAA2D;AAC3D,4DAAuD;AACvD,kEAA6D;AAC7D,8DAAyD;AACzD,0DAAqD;AACrD,8EAAyE;AACzE,4DAAuD;AACvD,4DAAuD;AAEvD;IAWI,YAAY,MAAc,EAAE,KAAY,EAAE,GAAQ;QAE9C,IAAI,CAAC,OAAO,GAAG,IAAI,iCAAe,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK,GAAG,IAAI,6BAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,mCAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,IAAI,+BAAc,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,GAAG,IAAI,2BAAY,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,+CAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,6BAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,6BAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC;CACJ;AAtBD,wCAsBC"}

View File

@@ -2,8 +2,17 @@ import { LureEvent } from '../events/LureEvent';
import { ChatEvent } from '../events/ChatEvent';
import { TeleportEvent } from '../events/TeleportEvent';
import { Subject } from 'rxjs/Subject';
import { InstantMessageEvent } from '../events/InstantMessageEvent';
import { GroupInviteEvent } from '../events/GroupInviteEvent';
import { FriendRequestEvent } from '../events/FriendRequestEvent';
import { DisconnectEvent } from '../events/DisconnectEvent';
export declare class ClientEvents {
onNearbyChat: Subject<ChatEvent>;
onInstantMessage: Subject<InstantMessageEvent>;
onGroupInvite: Subject<GroupInviteEvent>;
onFriendRequest: Subject<FriendRequestEvent>;
onLure: Subject<LureEvent>;
onTeleportEvent: Subject<TeleportEvent>;
onDisconnected: Subject<DisconnectEvent>;
onCircuitLatency: Subject<number>;
}

View File

@@ -4,8 +4,13 @@ const Subject_1 = require("rxjs/Subject");
class ClientEvents {
constructor() {
this.onNearbyChat = new Subject_1.Subject();
this.onInstantMessage = new Subject_1.Subject();
this.onGroupInvite = new Subject_1.Subject();
this.onFriendRequest = new Subject_1.Subject();
this.onLure = new Subject_1.Subject();
this.onTeleportEvent = new Subject_1.Subject();
this.onDisconnected = new Subject_1.Subject();
this.onCircuitLatency = new Subject_1.Subject();
}
}
exports.ClientEvents = ClientEvents;

View File

@@ -1 +1 @@
{"version":3,"file":"ClientEvents.js","sourceRoot":"","sources":["../../lib/classes/ClientEvents.ts"],"names":[],"mappings":";;AAGA,0CAAqC;AAErC;IAAA;QAEI,iBAAY,GAAuB,IAAI,iBAAO,EAAa,CAAC;QAC5D,WAAM,GAAuB,IAAI,iBAAO,EAAa,CAAC;QACtD,oBAAe,GAA2B,IAAI,iBAAO,EAAiB,CAAC;IAC3E,CAAC;CAAA;AALD,oCAKC"}
{"version":3,"file":"ClientEvents.js","sourceRoot":"","sources":["../../lib/classes/ClientEvents.ts"],"names":[],"mappings":";;AAGA,0CAAqC;AAMrC;IAAA;QAEI,iBAAY,GAAuB,IAAI,iBAAO,EAAa,CAAC;QAC5D,qBAAgB,GAAiC,IAAI,iBAAO,EAAuB,CAAC;QACpF,kBAAa,GAA8B,IAAI,iBAAO,EAAoB,CAAC;QAC3E,oBAAe,GAAgC,IAAI,iBAAO,EAAsB,CAAC;QACjF,WAAM,GAAuB,IAAI,iBAAO,EAAa,CAAC;QACtD,oBAAe,GAA2B,IAAI,iBAAO,EAAiB,CAAC;QACvE,mBAAc,GAA8B,IAAI,iBAAO,EAAmB,CAAC;QAC3E,qBAAgB,GAAoB,IAAI,iBAAO,EAAU,CAAC;IAC9D,CAAC;CAAA;AAVD,oCAUC"}

View File

@@ -1,20 +1,10 @@
import { Circuit } from './Circuit';
import { Agent } from './Agent';
import { ChatType } from '../enums/ChatType';
import { UUID } from './UUID';
import { ClientEvents } from './ClientEvents';
export declare class Comms {
private circuit;
private agent;
private clientEvents;
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents);
nearbyChat(message: string, type: ChatType, channel?: number): void;
say(message: string, channel?: number): void;
whisper(message: string, channel?: number): void;
shout(message: string, channel?: number): void;
startTypingLocal(): void;
stopTypingLocal(): void;
typeMessage(message: string): void;
shutdown(): void;
sendInstantMessage(to: UUID | string, message: string): Promise<void>;
}

171
dist/classes/Comms.js vendored
View File

@@ -1,16 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Message_1 = require("../enums/Message");
const ImprovedInstantMessage_1 = require("./messages/ImprovedInstantMessage");
const ChatType_1 = require("../enums/ChatType");
const Utils_1 = require("./Utils");
const ChatFromViewer_1 = require("./messages/ChatFromViewer");
const PacketFlags_1 = require("../enums/PacketFlags");
const ChatEvent_1 = require("../events/ChatEvent");
const UUID_1 = require("./UUID");
const InstantMessageDialog_1 = require("../enums/InstantMessageDialog");
const LureEvent_1 = require("../events/LureEvent");
const Vector3_1 = require("./Vector3");
const InstantMessageEvent_1 = require("../events/InstantMessageEvent");
const ChatSourceType_1 = require("../enums/ChatSourceType");
const InstantMessageEventFlags_1 = require("../enums/InstantMessageEventFlags");
class Comms {
constructor(circuit, agent, clientEvents) {
this.clientEvents = clientEvents;
@@ -26,7 +23,18 @@ class Comms {
const im = packet.message;
switch (im.MessageBlock.Dialog) {
case InstantMessageDialog_1.InstantMessageDialog.MessageFromAgent:
break;
{
console.log(im);
const imEvent = new InstantMessageEvent_1.InstantMessageEvent();
imEvent.source = ChatSourceType_1.ChatSourceType.Agent;
imEvent.from = im.AgentData.AgentID;
imEvent.owner = im.AgentData.AgentID;
imEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
imEvent.message = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.Message);
imEvent.flags = InstantMessageEventFlags_1.InstantMessageEventFlags.normal;
this.clientEvents.onInstantMessage.next(imEvent);
break;
}
case InstantMessageDialog_1.InstantMessageDialog.MessageBox:
break;
case InstantMessageDialog_1.InstantMessageDialog.GroupInvitation:
@@ -44,14 +52,36 @@ class Comms {
case InstantMessageDialog_1.InstantMessageDialog.TaskInventoryDeclined:
break;
case InstantMessageDialog_1.InstantMessageDialog.MessageFromObject:
break;
{
console.log(im);
const imEvent = new InstantMessageEvent_1.InstantMessageEvent();
imEvent.source = ChatSourceType_1.ChatSourceType.Object;
imEvent.owner = im.AgentData.AgentID;
imEvent.from = im.MessageBlock.ID;
imEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
imEvent.message = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.Message);
imEvent.flags = InstantMessageEventFlags_1.InstantMessageEventFlags.normal;
this.clientEvents.onInstantMessage.next(imEvent);
break;
}
case InstantMessageDialog_1.InstantMessageDialog.BusyAutoResponse:
break;
{
const imEvent = new InstantMessageEvent_1.InstantMessageEvent();
imEvent.source = ChatSourceType_1.ChatSourceType.Agent;
imEvent.from = im.AgentData.AgentID;
imEvent.owner = im.AgentData.AgentID;
imEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
imEvent.message = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.Message);
imEvent.flags = InstantMessageEventFlags_1.InstantMessageEventFlags.busyResponse;
this.clientEvents.onInstantMessage.next(imEvent);
break;
}
case InstantMessageDialog_1.InstantMessageDialog.ConsoleAndChatHistory:
break;
case InstantMessageDialog_1.InstantMessageDialog.RequestTeleport:
const lureEvent = new LureEvent_1.LureEvent();
const extraData = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.BinaryBucket).split('|');
lureEvent.from = im.AgentData.AgentID;
lureEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
lureEvent.lureMessage = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.Message);
lureEvent.regionID = im.MessageBlock.RegionID;
@@ -90,9 +120,29 @@ class Comms {
case InstantMessageDialog_1.InstantMessageDialog.FriendshipDeclined:
break;
case InstantMessageDialog_1.InstantMessageDialog.StartTyping:
break;
{
const imEvent = new InstantMessageEvent_1.InstantMessageEvent();
imEvent.source = ChatSourceType_1.ChatSourceType.Agent;
imEvent.from = im.AgentData.AgentID;
imEvent.owner = im.AgentData.AgentID;
imEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
imEvent.message = '';
imEvent.flags = InstantMessageEventFlags_1.InstantMessageEventFlags.startTyping;
this.clientEvents.onInstantMessage.next(imEvent);
break;
}
case InstantMessageDialog_1.InstantMessageDialog.StopTyping:
break;
{
const imEvent = new InstantMessageEvent_1.InstantMessageEvent();
imEvent.source = ChatSourceType_1.ChatSourceType.Agent;
imEvent.from = im.AgentData.AgentID;
imEvent.owner = im.AgentData.AgentID;
imEvent.fromName = Utils_1.Utils.BufferToStringSimple(im.MessageBlock.FromAgentName);
imEvent.message = '';
imEvent.flags = InstantMessageEventFlags_1.InstantMessageEventFlags.finishTyping;
this.clientEvents.onInstantMessage.next(imEvent);
break;
}
}
break;
case Message_1.Message.ChatFromSimulator:
@@ -110,113 +160,18 @@ class Comms {
break;
case Message_1.Message.AlertMessage:
const alertm = packet.message;
let alertMessage = Utils_1.Utils.BufferToStringSimple(alertm.AlertData.Message);
const alertMessage = Utils_1.Utils.BufferToStringSimple(alertm.AlertData.Message);
console.log('Alert message: ' + alertMessage);
alertm.AlertInfo.forEach((info) => {
let alertInfoMessage = Utils_1.Utils.BufferToStringSimple(info.Message);
const alertInfoMessage = Utils_1.Utils.BufferToStringSimple(info.Message);
console.log('Alert info message: ' + alertInfoMessage);
});
break;
}
});
}
nearbyChat(message, type, channel) {
if (channel === undefined) {
channel = 0;
}
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Utils_1.Utils.StringToBuffer(message),
Type: type,
Channel: channel
};
this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
}
say(message, channel) {
this.nearbyChat(message, ChatType_1.ChatType.Normal, channel);
}
whisper(message, channel) {
this.nearbyChat(message, ChatType_1.ChatType.Whisper, channel);
}
shout(message, channel) {
this.nearbyChat(message, ChatType_1.ChatType.Shout, channel);
}
startTypingLocal() {
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Buffer.allocUnsafe(0),
Type: ChatType_1.ChatType.StartTyping,
Channel: 0
};
this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
}
stopTypingLocal() {
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Buffer.allocUnsafe(0),
Type: ChatType_1.ChatType.StopTyping,
Channel: 0
};
this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
}
typeMessage(message) {
this.startTypingLocal();
this.agent.startAnimations([new UUID_1.UUID('c541c47f-e0c0-058b-ad1a-d6ae3a4584d9')]).then(() => {
const timeToWait = (message.length / 5) * 1000;
setTimeout(() => {
this.stopTypingLocal();
this.agent.stopAnimations([new UUID_1.UUID('c541c47f-e0c0-058b-ad1a-d6ae3a4584d9')]).then(() => {
this.say(message);
});
}, timeToWait);
});
}
shutdown() {
}
sendInstantMessage(to, message) {
const circuit = this.circuit;
if (typeof to === 'string') {
to = new UUID_1.UUID(to);
}
message += '\0';
const agentName = this.agent.firstName + ' ' + this.agent.lastName;
const im = new ImprovedInstantMessage_1.ImprovedInstantMessageMessage();
im.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
im.MessageBlock = {
FromGroup: false,
ToAgentID: to,
ParentEstateID: 0,
RegionID: UUID_1.UUID.zero(),
Position: Vector3_1.Vector3.getZero(),
Offline: 0,
Dialog: 0,
ID: UUID_1.UUID.zero(),
Timestamp: 0,
FromAgentName: Utils_1.Utils.StringToBuffer(agentName),
Message: Utils_1.Utils.StringToBuffer(message),
BinaryBucket: Buffer.allocUnsafe(0)
};
im.EstateBlock = {
EstateID: 0
};
const sequenceNo = circuit.sendMessage(im, PacketFlags_1.PacketFlags.Reliable);
return circuit.waitForAck(sequenceNo, 10000);
}
}
exports.Comms = Comms;
//# sourceMappingURL=Comms.js.map

File diff suppressed because one or more lines are too long

View File

@@ -5,19 +5,29 @@ class IPAddress {
constructor(buf, pos) {
this.ip = null;
this.toString = () => {
return this.ip.toString();
};
if (buf !== undefined && buf instanceof Buffer) {
if (pos !== undefined) {
const bytes = buf.slice(pos, 4);
this.ip = ipaddr.fromByteArray(bytes);
try {
return this.ip.toString();
}
else {
if (ipaddr.isValid(buf)) {
this.ip = ipaddr.parse(buf);
catch (ignore) {
return '';
}
};
try {
if (buf !== undefined && buf instanceof Buffer) {
if (pos !== undefined) {
const bytes = buf.slice(pos, 4);
this.ip = ipaddr.fromByteArray(bytes);
}
else {
if (ipaddr.isValid(buf)) {
this.ip = ipaddr.parse(buf);
}
}
}
}
catch (ignore) {
this.ip = ipaddr.parse('0.0.0.0');
}
}
static zero() {
return new IPAddress('0.0.0.0');

View File

@@ -1 +1 @@
{"version":3,"file":"IPAddress.js","sourceRoot":"","sources":["../../lib/classes/IPAddress.ts"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEpC;IAYI,YAAY,GAAqB,EAAE,GAAY;QAV/C,OAAE,GAAQ,IAAI,CAAC;QAMR,aAAQ,GAAG,GAAW,EAAE;YAE3B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC,CAAC;QAGE,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,YAAY,MAAM,CAAC,CAC/C,CAAC;YACG,EAAE,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC,CACtB,CAAC;gBACG,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;YACD,IAAI,CACJ,CAAC;gBACG,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CACxB,CAAC;oBACG,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAChC,CAAC;YAC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AG,EAAE,CAAC,CAAC,CAAC;oBAChC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gBAC1C,CAAC;gBACD,IAAI,CACJ,CAAC;oBACG,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CACxB,CAAC;wBACG,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAChC,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;QACD,KAAK,CAAC,CAAC,MAAM,CAAC,CACd,CAAC;YACG,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAvCD,MAAM,CAAC,IAAI;QAEP,MAAM,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAqCD,aAAa,CAAC,GAAW,EAAE,GAAW;QAElC,MAAM,KAAK,GAAe,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;QAChD,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;CACJ;AApDD,8BAoDC"}

View File

@@ -0,0 +1,7 @@
import { UUID } from '../UUID';
import { CommandsBase } from './CommandsBase';
export declare class AgentCommands extends CommandsBase {
private animate(anim, run);
startAnimations(anim: UUID[]): Promise<void>;
stopAnimations(anim: UUID[]): Promise<void>;
}

32
dist/classes/commands/AgentCommands.js vendored Normal file
View File

@@ -0,0 +1,32 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const AgentAnimation_1 = require("../messages/AgentAnimation");
const PacketFlags_1 = require("../../enums/PacketFlags");
const CommandsBase_1 = require("./CommandsBase");
class AgentCommands extends CommandsBase_1.CommandsBase {
animate(anim, run) {
const circuit = this.currentRegion.circuit;
const animPacket = new AgentAnimation_1.AgentAnimationMessage();
animPacket.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
animPacket.PhysicalAvatarEventList = [];
animPacket.AnimationList = [];
anim.forEach((a) => {
animPacket.AnimationList.push({
AnimID: a,
StartAnim: run
});
});
return circuit.waitForAck(circuit.sendMessage(animPacket, PacketFlags_1.PacketFlags.Reliable), 10000);
}
startAnimations(anim) {
return this.animate(anim, true);
}
stopAnimations(anim) {
return this.animate(anim, false);
}
}
exports.AgentCommands = AgentCommands;
//# sourceMappingURL=AgentCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AgentCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/AgentCommands.ts"],"names":[],"mappings":";;AACA,+DAAiE;AACjE,yDAAoD;AACpD,iDAA4C;AAE5C,mBAA2B,SAAQ,2BAAY;IAEnC,OAAO,CAAC,IAAY,EAAE,GAAY;QAGtC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QAC3C,MAAM,UAAU,GAAG,IAAI,sCAAqB,EAAE,CAAC;QAC/C,UAAU,CAAC,SAAS,GAAG;YACnB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;SAC/B,CAAC;QACF,UAAU,CAAC,uBAAuB,GAAG,EAAE,CAAC;QACxC,UAAU,CAAC,aAAa,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAEf,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;gBAC1B,MAAM,EAAE,CAAC;gBACT,SAAS,EAAE,GAAG;aACjB,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,yBAAW,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5F,CAAC;IAED,eAAe,CAAC,IAAY;QAExB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,cAAc,CAAC,IAAY;QAEvB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;CACJ;AAjCD,sCAiCC"}

View File

@@ -0,0 +1,8 @@
/// <reference types="node" />
import { CommandsBase } from './CommandsBase';
import { HTTPAssets } from '../../enums/HTTPAssets';
import { UUID } from '../UUID';
export declare class AssetCommands extends CommandsBase {
downloadAsset(type: HTTPAssets, uuid: UUID): Promise<Buffer>;
uploadAsset(type: HTTPAssets, data: Buffer, name: string, description: string): Promise<UUID>;
}

41
dist/classes/commands/AssetCommands.js vendored Normal file
View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
const UUID_1 = require("../UUID");
const LLSD = require("llsd");
const Utils_1 = require("../Utils");
class AssetCommands extends CommandsBase_1.CommandsBase {
downloadAsset(type, uuid) {
return this.currentRegion.caps.downloadAsset(uuid, type);
}
uploadAsset(type, data, name, description) {
return new Promise((resolve, reject) => {
if (this.agent && this.agent.inventory && this.agent.inventory.main && this.agent.inventory.main.root) {
this.currentRegion.caps.capsRequestXML('NewFileAgentInventory', {
'folder_id': new LLSD.UUID(this.agent.inventory.main.root.toString()),
'asset_type': type,
'inventory_type': Utils_1.Utils.HTTPAssetTypeToInventoryType(type),
'name': name,
'description': description,
'everyone_mask': (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19),
'group_mask': (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19),
'next_owner_mask': (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19),
'expected_upload_cost': 0
}).then((response) => {
if (response['state'] === 'upload') {
const uploadURL = response['uploader'];
this.currentRegion.caps.capsRequestUpload(uploadURL, data).then((responseUpload) => {
resolve(new UUID_1.UUID(responseUpload['new_asset'].toString()));
}).catch((err) => {
reject(err);
});
}
}).catch((err) => {
console.log(err);
});
}
});
}
}
exports.AssetCommands = AssetCommands;
//# sourceMappingURL=AssetCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AssetCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/AssetCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAE5C,kCAA6B;AAC7B,6BAA6B;AAC7B,oCAA+B;AAE/B,mBAA2B,SAAQ,2BAAY;IAE3C,aAAa,CAAC,IAAgB,EAAE,IAAU;QAEtC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,WAAW,CAAC,IAAgB,EAAE,IAAY,EAAE,IAAY,EAAE,WAAmB;QAEzE,MAAM,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAEzC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CACtG,CAAC;gBACG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,uBAAuB,EAAE;oBAC5D,WAAW,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACrE,YAAY,EAAE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AAE,EAAE;oBAEb,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC,CAAC,CAAA;YACN,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA3CD,sCA2CC"}

11
dist/classes/commands/CommandsBase.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
import { Region } from '../Region';
import { Bot } from '../../Bot';
import { Agent } from '../Agent';
import { Circuit } from '../Circuit';
export declare class CommandsBase {
protected currentRegion: Region;
protected agent: Agent;
protected bot: Bot;
protected circuit: Circuit;
constructor(region: Region, agent: Agent, bot: Bot);
}

12
dist/classes/commands/CommandsBase.js vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class CommandsBase {
constructor(region, agent, bot) {
this.currentRegion = region;
this.agent = agent;
this.bot = bot;
this.circuit = this.currentRegion.circuit;
}
}
exports.CommandsBase = CommandsBase;
//# sourceMappingURL=CommandsBase.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CommandsBase.js","sourceRoot":"","sources":["../../../lib/classes/commands/CommandsBase.ts"],"names":[],"mappings":";;AAKA;IAOI,YAAY,MAAc,EAAE,KAAY,EAAE,GAAQ;QAE9C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;IAC9C,CAAC;CACJ;AAdD,oCAcC"}

View File

@@ -0,0 +1,16 @@
import { CommandsBase } from './CommandsBase';
import { UUID } from '../UUID';
import { ChatType } from '../../enums/ChatType';
export declare class CommunicationsCommands extends CommandsBase {
sendInstantMessage(to: UUID | string, message: string): Promise<void>;
nearbyChat(message: string, type: ChatType, channel?: number): Promise<void>;
say(message: string, channel?: number): Promise<void>;
whisper(message: string, channel?: number): Promise<void>;
shout(message: string, channel?: number): Promise<void>;
startTypingLocal(): Promise<void>;
stopTypingLocal(): Promise<void>;
startTypingIM(to: UUID | string): Promise<void>;
stopTypingIM(to: UUID | string): Promise<void>;
typeInstantMessage(to: UUID | string, message: string, thinkingTime?: number, charactersPerSecond?: number): Promise<void>;
typeLocalMessage(message: string, thinkingTime?: number, charactersPerSecond?: number): Promise<void>;
}

View File

@@ -0,0 +1,242 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
const UUID_1 = require("../UUID");
const Utils_1 = require("../Utils");
const PacketFlags_1 = require("../../enums/PacketFlags");
const ImprovedInstantMessage_1 = require("../messages/ImprovedInstantMessage");
const Vector3_1 = require("../Vector3");
const ChatFromViewer_1 = require("../messages/ChatFromViewer");
const ChatType_1 = require("../../enums/ChatType");
const InstantMessageDialog_1 = require("../../enums/InstantMessageDialog");
class CommunicationsCommands extends CommandsBase_1.CommandsBase {
sendInstantMessage(to, message) {
const circuit = this.circuit;
if (typeof to === 'string') {
to = new UUID_1.UUID(to);
}
const agentName = this.agent.firstName + ' ' + this.agent.lastName;
const im = new ImprovedInstantMessage_1.ImprovedInstantMessageMessage();
im.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
im.MessageBlock = {
FromGroup: false,
ToAgentID: to,
ParentEstateID: 0,
RegionID: UUID_1.UUID.zero(),
Position: Vector3_1.Vector3.getZero(),
Offline: 1,
Dialog: 0,
ID: UUID_1.UUID.zero(),
Timestamp: 0,
FromAgentName: Utils_1.Utils.StringToBuffer(agentName),
Message: Utils_1.Utils.StringToBuffer(message),
BinaryBucket: Buffer.allocUnsafe(0)
};
im.EstateBlock = {
EstateID: 0
};
const sequenceNo = circuit.sendMessage(im, PacketFlags_1.PacketFlags.Reliable);
return circuit.waitForAck(sequenceNo, 10000);
}
nearbyChat(message, type, channel) {
if (channel === undefined) {
channel = 0;
}
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Utils_1.Utils.StringToBuffer(message),
Type: type,
Channel: channel
};
const sequenceNo = this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
return this.circuit.waitForAck(sequenceNo, 10000);
}
say(message, channel) {
return this.nearbyChat(message, ChatType_1.ChatType.Normal, channel);
}
whisper(message, channel) {
return this.nearbyChat(message, ChatType_1.ChatType.Whisper, channel);
}
shout(message, channel) {
return this.nearbyChat(message, ChatType_1.ChatType.Shout, channel);
}
startTypingLocal() {
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Buffer.allocUnsafe(0),
Type: ChatType_1.ChatType.StartTyping,
Channel: 0
};
const sequenceNo = this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
return this.circuit.waitForAck(sequenceNo, 10000);
}
stopTypingLocal() {
const cfv = new ChatFromViewer_1.ChatFromViewerMessage();
cfv.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID
};
cfv.ChatData = {
Message: Buffer.allocUnsafe(0),
Type: ChatType_1.ChatType.StopTyping,
Channel: 0
};
const sequenceNo = this.circuit.sendMessage(cfv, PacketFlags_1.PacketFlags.Reliable);
return this.circuit.waitForAck(sequenceNo, 10000);
}
startTypingIM(to) {
if (typeof to === 'string') {
to = new UUID_1.UUID(to);
}
const circuit = this.circuit;
const agentName = this.agent.firstName + ' ' + this.agent.lastName;
const im = new ImprovedInstantMessage_1.ImprovedInstantMessageMessage();
im.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
im.MessageBlock = {
FromGroup: false,
ToAgentID: to,
ParentEstateID: 0,
RegionID: UUID_1.UUID.zero(),
Position: Vector3_1.Vector3.getZero(),
Offline: 0,
Dialog: InstantMessageDialog_1.InstantMessageDialog.StartTyping,
ID: UUID_1.UUID.zero(),
Timestamp: 0,
FromAgentName: Utils_1.Utils.StringToBuffer(agentName),
Message: Utils_1.Utils.StringToBuffer(''),
BinaryBucket: Buffer.allocUnsafe(0)
};
im.EstateBlock = {
EstateID: 0
};
const sequenceNo = circuit.sendMessage(im, PacketFlags_1.PacketFlags.Reliable);
return circuit.waitForAck(sequenceNo, 10000);
}
stopTypingIM(to) {
if (typeof to === 'string') {
to = new UUID_1.UUID(to);
}
const circuit = this.circuit;
const agentName = this.agent.firstName + ' ' + this.agent.lastName;
const im = new ImprovedInstantMessage_1.ImprovedInstantMessageMessage();
im.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
im.MessageBlock = {
FromGroup: false,
ToAgentID: to,
ParentEstateID: 0,
RegionID: UUID_1.UUID.zero(),
Position: Vector3_1.Vector3.getZero(),
Offline: 0,
Dialog: InstantMessageDialog_1.InstantMessageDialog.StopTyping,
ID: UUID_1.UUID.zero(),
Timestamp: 0,
FromAgentName: Utils_1.Utils.StringToBuffer(agentName),
Message: Utils_1.Utils.StringToBuffer(''),
BinaryBucket: Buffer.allocUnsafe(0)
};
im.EstateBlock = {
EstateID: 0
};
const sequenceNo = circuit.sendMessage(im, PacketFlags_1.PacketFlags.Reliable);
return circuit.waitForAck(sequenceNo, 10000);
}
typeInstantMessage(to, message, thinkingTime, charactersPerSecond) {
return new Promise((resolve, reject) => {
if (thinkingTime === undefined) {
thinkingTime = 2000;
}
setTimeout(() => {
if (typeof to === 'string') {
to = new UUID_1.UUID(to);
}
let typeTimer = null;
this.startTypingIM(to).then(() => {
typeTimer = setInterval(() => {
this.startTypingIM(to).catch(() => {
});
}, 5000);
if (charactersPerSecond === undefined) {
charactersPerSecond = 5;
}
const timeToWait = (message.length / charactersPerSecond) * 1000;
setTimeout(() => {
if (typeTimer !== null) {
clearInterval(typeTimer);
typeTimer = null;
}
this.stopTypingIM(to).then(() => {
this.sendInstantMessage(to, message).then(() => {
resolve();
}).catch((err) => {
reject(err);
});
}).catch((err) => {
reject(err);
});
}, timeToWait);
}).catch((err) => {
if (typeTimer !== null) {
clearInterval(typeTimer);
typeTimer = null;
}
reject(err);
});
}, thinkingTime);
});
}
typeLocalMessage(message, thinkingTime, charactersPerSecond) {
return new Promise((resolve, reject) => {
if (thinkingTime === undefined) {
thinkingTime = 0;
}
setTimeout(() => {
this.startTypingLocal().then(() => {
this.bot.clientCommands.agent.startAnimations([new UUID_1.UUID('c541c47f-e0c0-058b-ad1a-d6ae3a4584d9')]).then(() => {
if (charactersPerSecond === undefined) {
charactersPerSecond = 5;
}
const timeToWait = (message.length / charactersPerSecond) * 1000;
setTimeout(() => {
this.stopTypingLocal().then(() => {
this.bot.clientCommands.agent.stopAnimations([new UUID_1.UUID('c541c47f-e0c0-058b-ad1a-d6ae3a4584d9')]).then(() => {
this.say(message).then(() => {
resolve();
}).catch((err) => {
reject(err);
});
}).catch((err) => {
reject(err);
});
}).catch((err) => {
reject(err);
});
}, timeToWait);
}).catch((err) => {
reject(err);
});
}).catch((err) => {
reject(err);
});
}, thinkingTime);
});
}
}
exports.CommunicationsCommands = CommunicationsCommands;
//# sourceMappingURL=CommunicationsCommands.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
/// <reference types="long" />
import { MapInfoReply } from '../../events/MapInfoReply';
import * as Long from 'long';
import { UUID } from '../UUID';
import { CommandsBase } from './CommandsBase';
export declare class GridCommands extends CommandsBase {
getRegionHandle(regionID: UUID): Promise<Long>;
getRegionMapInfo(gridX: number, gridY: number): Promise<MapInfoReply>;
}

114
dist/classes/commands/GridCommands.js vendored Normal file
View File

@@ -0,0 +1,114 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const MapInfoReply_1 = require("../../events/MapInfoReply");
const RegionHandleRequest_1 = require("../messages/RegionHandleRequest");
const Message_1 = require("../../enums/Message");
const MapBlockRequest_1 = require("../messages/MapBlockRequest");
const MapItemRequest_1 = require("../messages/MapItemRequest");
const Utils_1 = require("../Utils");
const PacketFlags_1 = require("../../enums/PacketFlags");
const GridItemType_1 = require("../../enums/GridItemType");
const CommandsBase_1 = require("./CommandsBase");
class GridCommands extends CommandsBase_1.CommandsBase {
getRegionHandle(regionID) {
return new Promise((resolve, reject) => {
const circuit = this.currentRegion.circuit;
const msg = new RegionHandleRequest_1.RegionHandleRequestMessage();
msg.RequestBlock = {
RegionID: regionID,
};
circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
circuit.waitForMessage(Message_1.Message.RegionIDAndHandleReply, 10000, (packet) => {
const filterMsg = packet.message;
return (filterMsg.ReplyBlock.RegionID.toString() === regionID.toString());
}).then((packet) => {
const responseMsg = packet.message;
resolve(responseMsg.ReplyBlock.RegionHandle);
});
});
}
getRegionMapInfo(gridX, gridY) {
return new Promise((resolve, reject) => {
const circuit = this.currentRegion.circuit;
const response = new MapInfoReply_1.MapInfoReply();
const msg = new MapBlockRequest_1.MapBlockRequestMessage();
msg.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID,
Flags: 65536,
EstateID: 0,
Godlike: true
};
msg.PositionData = {
MinX: (gridX / 256),
MaxX: (gridX / 256),
MinY: (gridY / 256),
MaxY: (gridY / 256)
};
circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
circuit.waitForMessage(Message_1.Message.MapBlockReply, 10000, (packet) => {
const filterMsg = packet.message;
let found = false;
filterMsg.Data.forEach((data) => {
if (data.X === (gridX / 256) && data.Y === (gridY / 256)) {
found = true;
}
});
return found;
}).then((packet) => {
const responseMsg = packet.message;
responseMsg.Data.forEach((data) => {
if (data.X === (gridX / 256) && data.Y === (gridY / 256)) {
response.name = Utils_1.Utils.BufferToStringSimple(data.Name);
response.accessFlags = data.Access;
response.mapImage = data.MapImageID;
}
});
const regionHandle = Utils_1.Utils.RegionCoordinatesToHandle(gridX, gridY);
const mi = new MapItemRequest_1.MapItemRequestMessage();
mi.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID,
Flags: 2,
EstateID: 0,
Godlike: false
};
mi.RequestData = {
ItemType: GridItemType_1.GridItemType.AgentLocations,
RegionHandle: regionHandle
};
circuit.sendMessage(mi, PacketFlags_1.PacketFlags.Reliable);
const minX = Math.floor(gridX / 256) * 256;
const maxX = minX + 256;
const minY = Math.floor(gridY / 256) * 256;
const maxY = minY + 256;
response.avatars = [];
circuit.waitForMessage(Message_1.Message.MapItemReply, 10000, (packet) => {
const filterMsg = packet.message;
let found = false;
filterMsg.Data.forEach((data) => {
if (data.X >= minX && data.X <= maxX && data.Y >= minY && data.Y <= maxY) {
found = true;
}
});
return found;
}).then((packet2) => {
const responseMsg2 = packet2.message;
responseMsg2.Data.forEach((data) => {
response.avatars.push({
X: data.X,
Y: data.Y
});
});
resolve(response);
}).catch((err) => {
reject(err);
});
}).catch((err) => {
reject(err);
});
});
}
}
exports.GridCommands = GridCommands;
//# sourceMappingURL=GridCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GridCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/GridCommands.ts"],"names":[],"mappings":";;AAAA,4DAAuD;AAGvD,yEAA2E;AAE3E,iDAA4C;AAE5C,iEAAmE;AAEnE,+DAAiE;AACjE,oCAA+B;AAC/B,yDAAoD;AACpD,2DAAsD;AAEtD,iDAA4C;AAC5C,kBAA0B,SAAQ,2BAAY;IAE1C,eAAe,CAAC,QAAc;QAE1B,MAAM,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAEzC,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YAC3C,MAAM,GAAG,GAA+B,IAAI,gDAA0B,EAAE,CAAC;YACzE,GAAG,CAAC,YAAY,GAAG;gBACf,QAAQ,EAAE,QAAQ;aACrB,CAAC;YACF,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,yBAAW,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO,CAAC,cAAc,CAAC,iBAAO,CAAC,sBAAsB,EAAE,KAAK,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BACjB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAe,EAAE,EAAE;oBAExB,MAAM,YAAY,GAAG,OAAO,CAAC,OAA8B,CAAC;oBAC5D,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;wBAE/B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;4BAClB,CAAC,EAAE,IAAI,CAAC,CAAC;4BACT,CAAC,EAAE,IAAI,CAAC,CAAC;yBACZ,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBAEb,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBAEb,MAAM,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA7HD,oCA6HC"}

View File

@@ -0,0 +1,5 @@
import { CommandsBase } from './CommandsBase';
import { UUID } from '../UUID';
export declare class GroupCommands extends CommandsBase {
sendGroupNotice(group: UUID | string, subject: string, message: string): Promise<void>;
}

44
dist/classes/commands/GroupCommands.js vendored Normal file
View File

@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
const UUID_1 = require("../UUID");
const InstantMessageDialog_1 = require("../../enums/InstantMessageDialog");
const Utils_1 = require("../Utils");
const PacketFlags_1 = require("../../enums/PacketFlags");
const ImprovedInstantMessage_1 = require("../messages/ImprovedInstantMessage");
const Vector3_1 = require("../Vector3");
class GroupCommands extends CommandsBase_1.CommandsBase {
sendGroupNotice(group, subject, message) {
if (typeof group === 'string') {
group = new UUID_1.UUID(group);
}
const circuit = this.circuit;
const agentName = this.agent.firstName + ' ' + this.agent.lastName;
const im = new ImprovedInstantMessage_1.ImprovedInstantMessageMessage();
im.AgentData = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID
};
im.MessageBlock = {
FromGroup: false,
ToAgentID: group,
ParentEstateID: 0,
RegionID: UUID_1.UUID.zero(),
Position: Vector3_1.Vector3.getZero(),
Offline: 0,
Dialog: InstantMessageDialog_1.InstantMessageDialog.GroupNotice,
ID: UUID_1.UUID.zero(),
Timestamp: 0,
FromAgentName: Utils_1.Utils.StringToBuffer(agentName),
Message: Utils_1.Utils.StringToBuffer(subject + '|' + message),
BinaryBucket: Buffer.allocUnsafe(0)
};
im.EstateBlock = {
EstateID: 0
};
const sequenceNo = circuit.sendMessage(im, PacketFlags_1.PacketFlags.Reliable);
return circuit.waitForAck(sequenceNo, 10000);
}
}
exports.GroupCommands = GroupCommands;
//# sourceMappingURL=GroupCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"GroupCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/GroupCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAC5C,kCAA6B;AAC7B,2EAAsE;AACtE,oCAA+B;AAC/B,yDAAoD;AACpD,+EAAiF;AACjF,wCAAmC;AAEnC,mBAA2B,SAAQ,2BAAY;IAE3C,eAAe,CAAC,KAAoB,EAAE,OAAe,EAAE,OAAe;QAElE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAC9B,CAAC;YACG,KAAK,GAAG,IAAI,WAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QACnE,MAAM,EAAE,GAAkC,IAAI,sDAA6B,EAAE,CAAC;QAC9E,EAAE,CAAC,SAAS,GAAG;YACX,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;SAC/B,CAAC;QACF,EAAE,CAAC,YAAY,GAAG;YACd,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,KAAK;YAChB,cAAc,EAAE,CAAC;YACjB,QAAQ,EAAE,WAAI,CAAC,IAAI,EAAE;YACrB,QAAQ,EAAE,iBAAO,CAAC,OAAO,EAAE;YAC3B,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,2CAAoB,CAAC,WAAW;YACxC,EAAE,EAAE,WAAI,CAAC,IAAI,EAAE;YACf,SAAS,EAAE,CAAC;YACZ,aAAa,EAAE,aAAK,CAAC,cAAc,CAAC,SAAS,CAAC;YAC9C,OAAO,EAAE,aAAK,CAAC,cAAc,CAAC,OAAO,GAAG,GAAG,GAAG,OAAO,CAAC;YACtD,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;SACtC,CAAC;QACF,EAAE,CAAC,WAAW,GAAG;YACb,QAAQ,EAAE,CAAC;SACd,CAAC;QACF,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,yBAAW,CAAC,QAAQ,CAAC,CAAC;QACjE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACJ;AAnCD,sCAmCC"}

View File

@@ -0,0 +1,5 @@
import { CommandsBase } from './CommandsBase';
export declare class NetworkCommands extends CommandsBase {
private throttleGenCounter;
setBandwidth(total: number): void;
}

View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
const PacketFlags_1 = require("../../enums/PacketFlags");
const AgentThrottle_1 = require("../messages/AgentThrottle");
class NetworkCommands extends CommandsBase_1.CommandsBase {
constructor() {
super(...arguments);
this.throttleGenCounter = 0;
}
setBandwidth(total) {
const agentThrottle = new AgentThrottle_1.AgentThrottleMessage();
agentThrottle.AgentData = {
AgentID: this.agent.agentID,
SessionID: this.circuit.sessionID,
CircuitCode: this.circuit.circuitCode
};
const throttleData = Buffer.allocUnsafe(28);
let pos = 0;
const resendThrottle = total * 0.1;
const landThrottle = total * 0.172;
const windThrottle = total * 0.05;
const cloudThrottle = total * 0.05;
const taskThrottle = total * 0.234;
const textureThrottle = total * 0.234;
const assetThrottle = total * 0.160;
throttleData.writeFloatLE(resendThrottle, pos);
pos += 4;
throttleData.writeFloatLE(landThrottle, pos);
pos += 4;
throttleData.writeFloatLE(windThrottle, pos);
pos += 4;
throttleData.writeFloatLE(cloudThrottle, pos);
pos += 4;
throttleData.writeFloatLE(taskThrottle, pos);
pos += 4;
throttleData.writeFloatLE(textureThrottle, pos);
pos += 4;
throttleData.writeFloatLE(assetThrottle, pos);
agentThrottle.Throttle = {
GenCounter: this.throttleGenCounter++,
Throttles: throttleData
};
this.circuit.sendMessage(agentThrottle, PacketFlags_1.PacketFlags.Reliable);
}
}
exports.NetworkCommands = NetworkCommands;
//# sourceMappingURL=NetworkCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NetworkCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/NetworkCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAC5C,yDAAoD;AACpD,6DAA+D;AAE/D,qBAA6B,SAAQ,2BAAY;IAAjD;;QAEY,uBAAkB,GAAG,CAAC,CAAC;IA2CnC,CAAC;IAzCG,YAAY,CAAC,KAAa;QAEtB,MAAM,aAAa,GAAyB,IAAI,oCAAoB,EAAE,CAAC;QACvE,aAAa,CAAC,SAAS,GAAG;YACtB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;YACjC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW;SACxC,CAAC;QAEF,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,G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from './CommandsBase';
export declare class RegionCommands extends CommandsBase {
}

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
class RegionCommands extends CommandsBase_1.CommandsBase {
}
exports.RegionCommands = RegionCommands;
//# sourceMappingURL=RegionCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RegionCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/RegionCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAE5C,oBAA4B,SAAQ,2BAAY;CAG/C;AAHD,wCAGC"}

View File

@@ -0,0 +1,6 @@
import { CommandsBase } from './CommandsBase';
import { LureEvent } from '../../events/LureEvent';
import { TeleportEvent } from '../../events/TeleportEvent';
export declare class TeleportCommands extends CommandsBase {
acceptTeleport(lure: LureEvent): Promise<TeleportEvent>;
}

View File

@@ -0,0 +1,65 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const CommandsBase_1 = require("./CommandsBase");
const Region_1 = require("../Region");
const TeleportEventType_1 = require("../../enums/TeleportEventType");
const PacketFlags_1 = require("../../enums/PacketFlags");
const TeleportLureRequest_1 = require("../messages/TeleportLureRequest");
const TeleportFlags_1 = require("../../enums/TeleportFlags");
class TeleportCommands extends CommandsBase_1.CommandsBase {
acceptTeleport(lure) {
return new Promise((resolve, reject) => {
const circuit = this.currentRegion.circuit;
const tlr = new TeleportLureRequest_1.TeleportLureRequestMessage();
tlr.Info = {
AgentID: this.agent.agentID,
SessionID: circuit.sessionID,
LureID: lure.lureID,
TeleportFlags: TeleportFlags_1.TeleportFlags.ViaLure
};
circuit.sendMessage(tlr, PacketFlags_1.PacketFlags.Reliable);
if (this.currentRegion.caps.eventQueueClient) {
if (this.bot.clientEvents === null) {
reject(new Error('ClientEvents is null'));
return;
}
const subscription = this.bot.clientEvents.onTeleportEvent.subscribe((e) => {
if (e.eventType === TeleportEventType_1.TeleportEventType.TeleportFailed || e.eventType === TeleportEventType_1.TeleportEventType.TeleportCompleted) {
subscription.unsubscribe();
}
if (e.eventType === TeleportEventType_1.TeleportEventType.TeleportFailed) {
reject(e);
}
else if (e.eventType === TeleportEventType_1.TeleportEventType.TeleportCompleted) {
if (e.simIP === 'local') {
resolve(e);
return;
}
if (this.bot.clientEvents === null) {
reject(new Error('ClientEvents is null'));
return;
}
this.currentRegion.shutdown();
const region = new Region_1.Region(this.agent, this.bot.clientEvents);
region.circuit.circuitCode = this.currentRegion.circuit.circuitCode;
region.circuit.secureSessionID = this.currentRegion.circuit.secureSessionID;
region.circuit.sessionID = this.currentRegion.circuit.sessionID;
region.circuit.udpBlacklist = this.currentRegion.circuit.udpBlacklist;
region.circuit.ipAddress = e.simIP;
region.circuit.port = e.simPort;
this.agent.setCurrentRegion(region);
this.currentRegion = region;
this.currentRegion.activateCaps(e.seedCapability);
this.bot.changeRegion(this.currentRegion).then(() => {
resolve(e);
}).catch((error) => {
reject(error);
});
}
});
}
});
}
}
exports.TeleportCommands = TeleportCommands;
//# sourceMappingURL=TeleportCommands.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TeleportCommands.js","sourceRoot":"","sources":["../../../lib/classes/commands/TeleportCommands.ts"],"names":[],"mappings":";;AAAA,iDAA4C;AAC5C,sCAAiC;AAEjC,qEAAgE;AAEhE,yDAAoD;AACpD,yEAA2E;AAC3E,6DAAwD;AAExD,sBAA8B,SAAQ,2BAAY;IAE9C,cAAc,CAAC,IAAe;QAE1B,MAAM,CAAC,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAElD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YAC3C,MAAM,GAAG,GAAG,IAAI,gDAA0B,EAAE,CAAC;YAC7C,GAAG,CAAC,IAAI,GAAG;gBACP,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;gBAC3B,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,MAAM,EAAE,IAAI,CA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