Ping / circuit latency, break out commands, add typing function for IM, add thinkingTime and charactersPerSecond parameters to typing functions
This commit is contained in:
7
dist/classes/commands/AgentCommands.d.ts
vendored
Normal file
7
dist/classes/commands/AgentCommands.d.ts
vendored
Normal 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
32
dist/classes/commands/AgentCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/AgentCommands.js.map
vendored
Normal file
1
dist/classes/commands/AgentCommands.js.map
vendored
Normal 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"}
|
||||
8
dist/classes/commands/AssetCommands.d.ts
vendored
Normal file
8
dist/classes/commands/AssetCommands.d.ts
vendored
Normal 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
41
dist/classes/commands/AssetCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/AssetCommands.js.map
vendored
Normal file
1
dist/classes/commands/AssetCommands.js.map
vendored
Normal 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,IAAI;oBAClB,gBAAgB,EAAE,aAAK,CAAC,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,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
11
dist/classes/commands/CommandsBase.d.ts
vendored
Normal 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
12
dist/classes/commands/CommandsBase.js
vendored
Normal 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
|
||||
1
dist/classes/commands/CommandsBase.js.map
vendored
Normal file
1
dist/classes/commands/CommandsBase.js.map
vendored
Normal 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"}
|
||||
16
dist/classes/commands/CommunicationsCommands.d.ts
vendored
Normal file
16
dist/classes/commands/CommunicationsCommands.d.ts
vendored
Normal 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>;
|
||||
}
|
||||
242
dist/classes/commands/CommunicationsCommands.js
vendored
Normal file
242
dist/classes/commands/CommunicationsCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/CommunicationsCommands.js.map
vendored
Normal file
1
dist/classes/commands/CommunicationsCommands.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
9
dist/classes/commands/GridCommands.d.ts
vendored
Normal file
9
dist/classes/commands/GridCommands.d.ts
vendored
Normal 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
114
dist/classes/commands/GridCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/GridCommands.js.map
vendored
Normal file
1
dist/classes/commands/GridCommands.js.map
vendored
Normal 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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commands/GroupCommands.d.ts
vendored
Normal file
5
dist/classes/commands/GroupCommands.d.ts
vendored
Normal 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
44
dist/classes/commands/GroupCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/GroupCommands.js.map
vendored
Normal file
1
dist/classes/commands/GroupCommands.js.map
vendored
Normal 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"}
|
||||
5
dist/classes/commands/NetworkCommands.d.ts
vendored
Normal file
5
dist/classes/commands/NetworkCommands.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { CommandsBase } from './CommandsBase';
|
||||
export declare class NetworkCommands extends CommandsBase {
|
||||
private throttleGenCounter;
|
||||
setBandwidth(total: number): void;
|
||||
}
|
||||
48
dist/classes/commands/NetworkCommands.js
vendored
Normal file
48
dist/classes/commands/NetworkCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/NetworkCommands.js.map
vendored
Normal file
1
dist/classes/commands/NetworkCommands.js.map
vendored
Normal 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;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C;QAChD,GAAG,IAAI,CAAC,CAAC;QACT,YAAY,CAAC,YAAY,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAE9C,aAAa,CAAC,QAAQ,GAAG;YACrB,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE;YACrC,SAAS,EAAE,YAAY;SAC1B,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,yBAAW,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACJ;AA7CD,0CA6CC"}
|
||||
3
dist/classes/commands/RegionCommands.d.ts
vendored
Normal file
3
dist/classes/commands/RegionCommands.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import { CommandsBase } from './CommandsBase';
|
||||
export declare class RegionCommands extends CommandsBase {
|
||||
}
|
||||
7
dist/classes/commands/RegionCommands.js
vendored
Normal file
7
dist/classes/commands/RegionCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/RegionCommands.js.map
vendored
Normal file
1
dist/classes/commands/RegionCommands.js.map
vendored
Normal 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"}
|
||||
6
dist/classes/commands/TeleportCommands.d.ts
vendored
Normal file
6
dist/classes/commands/TeleportCommands.d.ts
vendored
Normal 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>;
|
||||
}
|
||||
65
dist/classes/commands/TeleportCommands.js
vendored
Normal file
65
dist/classes/commands/TeleportCommands.js
vendored
Normal 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
|
||||
1
dist/classes/commands/TeleportCommands.js.map
vendored
Normal file
1
dist/classes/commands/TeleportCommands.js.map
vendored
Normal 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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