Add ObjectStoreLite to reduce memory footprint if the full object data is not needed
This commit is contained in:
4
dist/Bot.d.ts
vendored
4
dist/Bot.d.ts
vendored
@@ -2,6 +2,7 @@ import { LoginParameters } from './classes/LoginParameters';
|
||||
import { Region } from './classes/Region';
|
||||
import { ClientEvents } from './classes/ClientEvents';
|
||||
import { ClientCommands } from './classes/ClientCommands';
|
||||
import { BotOptionFlags } from './enums/BotOptionFlags';
|
||||
export declare class Bot {
|
||||
private loginParams;
|
||||
private currentRegion;
|
||||
@@ -10,9 +11,10 @@ export declare class Bot {
|
||||
private pingNumber;
|
||||
private lastSuccessfulPing;
|
||||
private circuitSubscription;
|
||||
private options;
|
||||
clientEvents: ClientEvents;
|
||||
clientCommands: ClientCommands;
|
||||
constructor(login: LoginParameters);
|
||||
constructor(login: LoginParameters, options: BotOptionFlags);
|
||||
login(): Promise<{}>;
|
||||
changeRegion(region: Region): Promise<{}>;
|
||||
close(): Promise<{}>;
|
||||
|
||||
5
dist/Bot.js
vendored
5
dist/Bot.js
vendored
@@ -17,17 +17,18 @@ const ClientCommands_1 = require("./classes/ClientCommands");
|
||||
const DisconnectEvent_1 = require("./events/DisconnectEvent");
|
||||
const StartPingCheck_1 = require("./classes/messages/StartPingCheck");
|
||||
class Bot {
|
||||
constructor(login) {
|
||||
constructor(login, options) {
|
||||
this.ping = null;
|
||||
this.pingNumber = 0;
|
||||
this.lastSuccessfulPing = 0;
|
||||
this.circuitSubscription = null;
|
||||
this.clientEvents = new ClientEvents_1.ClientEvents();
|
||||
this.loginParams = login;
|
||||
this.options = options;
|
||||
}
|
||||
login() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const loginHandler = new LoginHandler_1.LoginHandler(this.clientEvents);
|
||||
const loginHandler = new LoginHandler_1.LoginHandler(this.clientEvents, this.options);
|
||||
loginHandler.Login(this.loginParams).then((response) => {
|
||||
this.currentRegion = response.region;
|
||||
this.agent = response.agent;
|
||||
|
||||
2
dist/Bot.js.map
vendored
2
dist/Bot.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/LoginHandler.d.ts
vendored
4
dist/LoginHandler.d.ts
vendored
@@ -1,9 +1,11 @@
|
||||
import { LoginParameters } from './classes/LoginParameters';
|
||||
import { LoginResponse } from './classes/LoginResponse';
|
||||
import { ClientEvents } from './classes/ClientEvents';
|
||||
import { BotOptionFlags } from './enums/BotOptionFlags';
|
||||
export declare class LoginHandler {
|
||||
private clientEvents;
|
||||
private options;
|
||||
static GenerateMAC(): string;
|
||||
constructor(ce: ClientEvents);
|
||||
constructor(ce: ClientEvents, options: BotOptionFlags);
|
||||
Login(params: LoginParameters): Promise<LoginResponse>;
|
||||
}
|
||||
|
||||
5
dist/LoginHandler.js
vendored
5
dist/LoginHandler.js
vendored
@@ -17,8 +17,9 @@ class LoginHandler {
|
||||
}
|
||||
return macAddress;
|
||||
}
|
||||
constructor(ce) {
|
||||
constructor(ce, options) {
|
||||
this.clientEvents = ce;
|
||||
this.options = options;
|
||||
}
|
||||
Login(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -69,7 +70,7 @@ class LoginHandler {
|
||||
reject(new Error(value['message']));
|
||||
}
|
||||
else {
|
||||
const response = new LoginResponse_1.LoginResponse(value, this.clientEvents);
|
||||
const response = new LoginResponse_1.LoginResponse(value, this.clientEvents, this.options);
|
||||
resolve(response);
|
||||
}
|
||||
}
|
||||
|
||||
2
dist/LoginHandler.js.map
vendored
2
dist/LoginHandler.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"LoginHandler.js","sourceRoot":"","sources":["../lib/LoginHandler.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AACjC,iCAAiC;AAEjC,2DAAsD;AAEtD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B;IAII,MAAM,CAAC,WAAW;QAEd,MAAM,SAAS,GAAG,kBAAkB,CAAC;QACrC,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,GAAG,CAAC,CAAC,IAAI,CAAC,GAA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;gBACL,CAAC;YACL,CAAC,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CAEJ;AA9FD,oCA8FC"}
|
||||
4
dist/classes/Agent.js
vendored
4
dist/classes/Agent.js
vendored
@@ -136,8 +136,8 @@ class Agent {
|
||||
if (item.type === 6) {
|
||||
let found = false;
|
||||
wornObjects.forEach((obj) => {
|
||||
if (obj.NameValue['AttachItemID']) {
|
||||
if (item['item_id'].toString() === obj.NameValue['AttachItemID'].value) {
|
||||
if (obj.hasNameValueEntry('AttachItemID')) {
|
||||
if (item['item_id'].toString() === obj.getNameValueEntry('AttachItemID')) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
2
dist/classes/Agent.js.map
vendored
2
dist/classes/Agent.js.map
vendored
File diff suppressed because one or more lines are too long
64
dist/classes/GameObject.d.ts
vendored
Normal file
64
dist/classes/GameObject.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/// <reference types="node" />
|
||||
import { Vector3 } from './Vector3';
|
||||
import { UUID } from './UUID';
|
||||
import { PCode } from '../enums/PCode';
|
||||
import { Quaternion } from './Quaternion';
|
||||
import { Tree } from '../enums/Tree';
|
||||
import { SoundFlags } from '../enums/SoundFlags';
|
||||
import { NameValue } from './NameValue';
|
||||
export declare class GameObject {
|
||||
ID: number;
|
||||
State: number;
|
||||
FullID: UUID;
|
||||
CRC: number;
|
||||
PCode: PCode;
|
||||
Material: number;
|
||||
ClickAction: number;
|
||||
Scale: Vector3;
|
||||
ObjectData: Buffer;
|
||||
ParentID: number;
|
||||
UpdateFlags: number;
|
||||
Flags: number;
|
||||
PathCurve: number;
|
||||
ProfileCurve: number;
|
||||
PathBegin: number;
|
||||
PathEnd: number;
|
||||
PathScaleX: number;
|
||||
PathScaleY: number;
|
||||
PathShearX: number;
|
||||
PathShearY: number;
|
||||
PathTwist: number;
|
||||
PathTwistBegin: number;
|
||||
PathRadiusOffset: number;
|
||||
PathTaperX: number;
|
||||
PathTaperY: number;
|
||||
PathRevolutions: number;
|
||||
PathSkew: number;
|
||||
ProfileBegin: number;
|
||||
ProfileEnd: number;
|
||||
ProfileHollow: number;
|
||||
TextureEntry: Buffer;
|
||||
TextureAnim: Buffer;
|
||||
Data: Buffer;
|
||||
Text: string;
|
||||
TextColor: Buffer;
|
||||
MediaURL: string;
|
||||
PSBlock: Buffer;
|
||||
OwnerID: UUID;
|
||||
JointType: number;
|
||||
JointPivot: Vector3;
|
||||
JointAxisOrAnchor: Vector3;
|
||||
Position: Vector3;
|
||||
Rotation: Quaternion;
|
||||
AngularVelocity: Vector3;
|
||||
TreeSpecies: Tree;
|
||||
Sound: UUID;
|
||||
SoundGain: number;
|
||||
SoundFlags: SoundFlags;
|
||||
SoundRadius: number;
|
||||
IsAttachment: boolean;
|
||||
NameValue: {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
constructor();
|
||||
}
|
||||
19
dist/classes/GameObject.js
vendored
Normal file
19
dist/classes/GameObject.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Vector3_1 = require("./Vector3");
|
||||
const Quaternion_1 = require("./Quaternion");
|
||||
class GameObject {
|
||||
constructor() {
|
||||
this.Position = Vector3_1.Vector3.getZero();
|
||||
this.Rotation = Quaternion_1.Quaternion.getIdentity();
|
||||
this.IsAttachment = false;
|
||||
this.NameValue = {};
|
||||
this.AngularVelocity = Vector3_1.Vector3.getZero();
|
||||
this.TreeSpecies = 0;
|
||||
this.SoundFlags = 0;
|
||||
this.SoundRadius = 1.0;
|
||||
this.SoundGain = 1.0;
|
||||
}
|
||||
}
|
||||
exports.GameObject = GameObject;
|
||||
//# sourceMappingURL=GameObject.js.map
|
||||
1
dist/classes/GameObject.js.map
vendored
Normal file
1
dist/classes/GameObject.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"GameObject.js","sourceRoot":"","sources":["../../lib/classes/GameObject.ts"],"names":[],"mappings":";;AAAA,uCAAkC;AAGlC,6CAAwC;AAKxC;IAqDI;QAEI,IAAI,CAAC,QAAQ,GAAG,iBAAO,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,iBAAO,CAAC,OAAO,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IACzB,CAAC;CACJ;AAjED,gCAiEC"}
|
||||
67
dist/classes/GameObjectFull.d.ts
vendored
Normal file
67
dist/classes/GameObjectFull.d.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/// <reference types="node" />
|
||||
import { Vector3 } from './Vector3';
|
||||
import { UUID } from './UUID';
|
||||
import { PCode } from '../enums/PCode';
|
||||
import { Quaternion } from './Quaternion';
|
||||
import { Tree } from '../enums/Tree';
|
||||
import { SoundFlags } from '../enums/SoundFlags';
|
||||
import { NameValue } from './NameValue';
|
||||
import { IGameObject } from './interfaces/IGameObject';
|
||||
export declare class GameObjectFull implements IGameObject {
|
||||
ID: number;
|
||||
State: number;
|
||||
FullID: UUID;
|
||||
CRC: number;
|
||||
PCode: PCode;
|
||||
Material: number;
|
||||
ClickAction: number;
|
||||
Scale: Vector3;
|
||||
ObjectData: Buffer;
|
||||
ParentID: number;
|
||||
UpdateFlags: number;
|
||||
Flags: number;
|
||||
PathCurve: number;
|
||||
ProfileCurve: number;
|
||||
PathBegin: number;
|
||||
PathEnd: number;
|
||||
PathScaleX: number;
|
||||
PathScaleY: number;
|
||||
PathShearX: number;
|
||||
PathShearY: number;
|
||||
PathTwist: number;
|
||||
PathTwistBegin: number;
|
||||
PathRadiusOffset: number;
|
||||
PathTaperX: number;
|
||||
PathTaperY: number;
|
||||
PathRevolutions: number;
|
||||
PathSkew: number;
|
||||
ProfileBegin: number;
|
||||
ProfileEnd: number;
|
||||
ProfileHollow: number;
|
||||
TextureEntry: Buffer;
|
||||
TextureAnim: Buffer;
|
||||
Data: Buffer;
|
||||
Text: string;
|
||||
TextColor: Buffer;
|
||||
MediaURL: string;
|
||||
PSBlock: Buffer;
|
||||
OwnerID: UUID;
|
||||
JointType: number;
|
||||
JointPivot: Vector3;
|
||||
JointAxisOrAnchor: Vector3;
|
||||
Position: Vector3;
|
||||
Rotation: Quaternion;
|
||||
AngularVelocity: Vector3;
|
||||
TreeSpecies: Tree;
|
||||
Sound: UUID;
|
||||
SoundGain: number;
|
||||
SoundFlags: SoundFlags;
|
||||
SoundRadius: number;
|
||||
IsAttachment: boolean;
|
||||
NameValue: {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
constructor();
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
}
|
||||
31
dist/classes/GameObjectFull.js
vendored
Normal file
31
dist/classes/GameObjectFull.js
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Vector3_1 = require("./Vector3");
|
||||
const Quaternion_1 = require("./Quaternion");
|
||||
class GameObjectFull {
|
||||
constructor() {
|
||||
this.Position = Vector3_1.Vector3.getZero();
|
||||
this.Rotation = Quaternion_1.Quaternion.getIdentity();
|
||||
this.IsAttachment = false;
|
||||
this.NameValue = {};
|
||||
this.AngularVelocity = Vector3_1.Vector3.getZero();
|
||||
this.TreeSpecies = 0;
|
||||
this.SoundFlags = 0;
|
||||
this.SoundRadius = 1.0;
|
||||
this.SoundGain = 1.0;
|
||||
}
|
||||
hasNameValueEntry(key) {
|
||||
if (this.NameValue['AttachItemID']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
getNameValueEntry(key) {
|
||||
if (this.NameValue['AttachItemID']) {
|
||||
return this.NameValue['AttachItemID'].value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
exports.GameObjectFull = GameObjectFull;
|
||||
//# sourceMappingURL=GameObjectFull.js.map
|
||||
1
dist/classes/GameObjectFull.js.map
vendored
Normal file
1
dist/classes/GameObjectFull.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"GameObjectFull.js","sourceRoot":"","sources":["../../lib/classes/GameObjectFull.ts"],"names":[],"mappings":";;AAAA,uCAAkC;AAGlC,6CAAwC;AAMxC;IAqDI;QAEI,IAAI,CAAC,QAAQ,GAAG,iBAAO,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,uBAAU,CAAC,WAAW,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,iBAAO,CAAC,OAAO,EAAE,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IACzB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;QAChD,CAAC;QACD,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;CACJ;AAnFD,wCAmFC"}
|
||||
16
dist/classes/GameObjectLite.d.ts
vendored
Normal file
16
dist/classes/GameObjectLite.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { UUID } from './UUID';
|
||||
import { IGameObject } from './interfaces/IGameObject';
|
||||
import { NameValue } from './NameValue';
|
||||
export declare class GameObjectLite implements IGameObject {
|
||||
ID: number;
|
||||
FullID: UUID;
|
||||
ParentID: number;
|
||||
OwnerID: UUID;
|
||||
IsAttachment: boolean;
|
||||
NameValue: {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
constructor();
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
}
|
||||
21
dist/classes/GameObjectLite.js
vendored
Normal file
21
dist/classes/GameObjectLite.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class GameObjectLite {
|
||||
constructor() {
|
||||
this.IsAttachment = false;
|
||||
}
|
||||
hasNameValueEntry(key) {
|
||||
if (this.NameValue['AttachItemID']) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
getNameValueEntry(key) {
|
||||
if (this.NameValue['AttachItemID']) {
|
||||
return this.NameValue['AttachItemID'].value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
exports.GameObjectLite = GameObjectLite;
|
||||
//# sourceMappingURL=GameObjectLite.js.map
|
||||
1
dist/classes/GameObjectLite.js.map
vendored
Normal file
1
dist/classes/GameObjectLite.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"GameObjectLite.js","sourceRoot":"","sources":["../../lib/classes/GameObjectLite.ts"],"names":[],"mappings":";;AAIA;IAQI;QAEI,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CACnC,CAAC;YACG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC;QAChD,CAAC;QACD,MAAM,CAAC,EAAE,CAAC;IACd,CAAC;CACJ;AA9BD,wCA8BC"}
|
||||
3
dist/classes/LoginResponse.d.ts
vendored
3
dist/classes/LoginResponse.d.ts
vendored
@@ -3,6 +3,7 @@ import { Agent } from './Agent';
|
||||
import { Region } from './Region';
|
||||
import { LoginFlags } from '../enums/LoginFlags';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { BotOptionFlags } from '../enums/BotOptionFlags';
|
||||
export declare class LoginResponse {
|
||||
loginFlags: LoginFlags;
|
||||
loginMessage: string;
|
||||
@@ -30,5 +31,5 @@ export declare class LoginResponse {
|
||||
private static toRegionHandle(x_global, y_global);
|
||||
private static parseVector3(str);
|
||||
private static parseHome(str);
|
||||
constructor(json: any, ce: ClientEvents);
|
||||
constructor(json: any, clientEvents: ClientEvents, options: BotOptionFlags);
|
||||
}
|
||||
|
||||
6
dist/classes/LoginResponse.js
vendored
6
dist/classes/LoginResponse.js
vendored
@@ -7,7 +7,7 @@ const LoginFlags_1 = require("../enums/LoginFlags");
|
||||
const Vector3_1 = require("./Vector3");
|
||||
const Long = require("long");
|
||||
class LoginResponse {
|
||||
constructor(json, ce) {
|
||||
constructor(json, clientEvents, options) {
|
||||
this.events = {
|
||||
categories: []
|
||||
};
|
||||
@@ -15,9 +15,9 @@ class LoginResponse {
|
||||
categories: []
|
||||
};
|
||||
this.textures = {};
|
||||
this.clientEvents = ce;
|
||||
this.clientEvents = clientEvents;
|
||||
this.agent = new Agent_1.Agent(this.clientEvents);
|
||||
this.region = new Region_1.Region(this.agent, this.clientEvents);
|
||||
this.region = new Region_1.Region(this.agent, this.clientEvents, options);
|
||||
Object.keys(json).forEach((key) => {
|
||||
const val = json[key];
|
||||
switch (key) {
|
||||
|
||||
2
dist/classes/LoginResponse.js.map
vendored
2
dist/classes/LoginResponse.js.map
vendored
File diff suppressed because one or more lines are too long
24
dist/classes/ObjectStoreFull.d.ts
vendored
Normal file
24
dist/classes/ObjectStoreFull.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference types="node" />
|
||||
import { Circuit } from './Circuit';
|
||||
import { Agent } from './Agent';
|
||||
import { NameValue } from './NameValue';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { IObjectStore } from './interfaces/IObjectStore';
|
||||
import { GameObjectFull } from './GameObjectFull';
|
||||
import { IGameObject } from './interfaces/IGameObject';
|
||||
export declare class ObjectStoreFull implements IObjectStore {
|
||||
private circuit;
|
||||
private agent;
|
||||
private objects;
|
||||
private objectsByUUID;
|
||||
private objectsByParent;
|
||||
private clientEvents;
|
||||
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents);
|
||||
deleteObject(objectID: number): void;
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObjectFull): number;
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
parseNameValues(str: string): {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
shutdown(): void;
|
||||
}
|
||||
364
dist/classes/ObjectStoreFull.js
vendored
Normal file
364
dist/classes/ObjectStoreFull.js
vendored
Normal file
@@ -0,0 +1,364 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Message_1 = require("../enums/Message");
|
||||
const RequestMultipleObjects_1 = require("./messages/RequestMultipleObjects");
|
||||
const UUID_1 = require("./UUID");
|
||||
const Quaternion_1 = require("./Quaternion");
|
||||
const Vector3_1 = require("./Vector3");
|
||||
const CompressedFlags_1 = require("../enums/CompressedFlags");
|
||||
const Utils_1 = require("./Utils");
|
||||
const PCode_1 = require("../enums/PCode");
|
||||
const NameValue_1 = require("./NameValue");
|
||||
const GameObjectFull_1 = require("./GameObjectFull");
|
||||
class ObjectStoreFull {
|
||||
constructor(circuit, agent, clientEvents) {
|
||||
this.objects = {};
|
||||
this.objectsByUUID = {};
|
||||
this.objectsByParent = {};
|
||||
this.clientEvents = clientEvents;
|
||||
this.circuit = circuit;
|
||||
this.agent = agent;
|
||||
this.circuit.subscribeToMessages([
|
||||
Message_1.Message.ObjectUpdate,
|
||||
Message_1.Message.ObjectUpdateCached,
|
||||
Message_1.Message.ObjectUpdateCompressed,
|
||||
Message_1.Message.ImprovedTerseObjectUpdate,
|
||||
Message_1.Message.MultipleObjectUpdate,
|
||||
Message_1.Message.KillObject
|
||||
], (packet) => {
|
||||
switch (packet.message.id) {
|
||||
case Message_1.Message.ObjectUpdate:
|
||||
const objectUpdate = packet.message;
|
||||
objectUpdate.ObjectData.forEach((objData) => {
|
||||
const localID = objData.ID;
|
||||
const parentID = objData.ParentID;
|
||||
let addToParentList = true;
|
||||
if (this.objects[localID]) {
|
||||
if (this.objects[localID].ParentID !== parentID && this.objectsByParent[parentID]) {
|
||||
const ind = this.objectsByParent[parentID].indexOf(localID);
|
||||
if (ind !== -1) {
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addToParentList = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.objects[localID] = new GameObjectFull_1.GameObjectFull();
|
||||
}
|
||||
const obj = this.objects[localID];
|
||||
obj.ID = objData.ID;
|
||||
obj.State = objData.State;
|
||||
obj.FullID = objData.FullID;
|
||||
obj.CRC = objData.CRC;
|
||||
obj.PCode = objData.PCode;
|
||||
obj.Material = objData.Material;
|
||||
obj.ClickAction = objData.ClickAction;
|
||||
obj.Scale = objData.Scale;
|
||||
obj.ObjectData = objData.ObjectData;
|
||||
obj.ParentID = objData.ParentID;
|
||||
obj.Flags = objData.UpdateFlags;
|
||||
obj.PathCurve = objData.PathCurve;
|
||||
obj.ProfileCurve = objData.ProfileCurve;
|
||||
obj.PathBegin = objData.PathBegin;
|
||||
obj.PathEnd = objData.PathEnd;
|
||||
obj.PathScaleX = objData.PathScaleX;
|
||||
obj.PathScaleY = objData.PathScaleY;
|
||||
obj.PathShearX = objData.PathShearX;
|
||||
obj.PathShearY = objData.PathShearY;
|
||||
obj.PathTwist = objData.PathTwist;
|
||||
obj.PathTwistBegin = objData.PathTwistBegin;
|
||||
obj.PathRadiusOffset = objData.PathRadiusOffset;
|
||||
obj.PathTaperX = objData.PathTaperX;
|
||||
obj.PathTaperY = objData.PathTaperY;
|
||||
obj.PathRevolutions = objData.PathRevolutions;
|
||||
obj.PathSkew = objData.PathSkew;
|
||||
obj.ProfileBegin = objData.ProfileBegin;
|
||||
obj.ProfileEnd = objData.ProfileEnd;
|
||||
obj.ProfileHollow = objData.ProfileHollow;
|
||||
obj.TextureEntry = objData.TextureEntry;
|
||||
obj.TextureAnim = objData.TextureAnim;
|
||||
obj.Data = objData.Data;
|
||||
obj.Text = Utils_1.Utils.BufferToStringSimple(objData.Text);
|
||||
obj.TextColor = objData.TextColor;
|
||||
obj.MediaURL = Utils_1.Utils.BufferToStringSimple(objData.MediaURL);
|
||||
obj.PSBlock = objData.PSBlock;
|
||||
obj.Sound = objData.Sound;
|
||||
obj.OwnerID = objData.OwnerID;
|
||||
obj.SoundGain = objData.Gain;
|
||||
obj.SoundFlags = objData.Flags;
|
||||
obj.SoundRadius = objData.Radius;
|
||||
obj.JointType = objData.JointType;
|
||||
obj.JointPivot = objData.JointPivot;
|
||||
obj.JointAxisOrAnchor = objData.JointAxisOrAnchor;
|
||||
if (this.objects[localID].PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
||||
this.agent.localID = localID;
|
||||
}
|
||||
this.readExtraParams(objData.ExtraParams, 0, this.objects[localID]);
|
||||
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
||||
this.objectsByUUID[objData.FullID.toString()] = localID;
|
||||
if (!this.objectsByParent[parentID]) {
|
||||
this.objectsByParent[parentID] = [];
|
||||
}
|
||||
if (addToParentList) {
|
||||
this.objectsByParent[parentID].push(localID);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case Message_1.Message.ObjectUpdateCached:
|
||||
const objectUpdateCached = packet.message;
|
||||
const rmo = new RequestMultipleObjects_1.RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
objectUpdateCached.ObjectData.forEach((obj) => {
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
break;
|
||||
case Message_1.Message.ObjectUpdateCompressed:
|
||||
{
|
||||
const objectUpdateCompressed = packet.message;
|
||||
objectUpdateCompressed.ObjectData.forEach((obj) => {
|
||||
const flags = obj.UpdateFlags;
|
||||
const buf = obj.Data;
|
||||
let pos = 0;
|
||||
const fullID = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
const localID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
const pcode = buf.readUInt8(pos++);
|
||||
let newObj = false;
|
||||
if (!this.objects[localID]) {
|
||||
newObj = true;
|
||||
this.objects[localID] = new GameObjectFull_1.GameObjectFull();
|
||||
}
|
||||
const o = this.objects[localID];
|
||||
o.ID = localID;
|
||||
this.objectsByUUID[fullID.toString()] = localID;
|
||||
o.FullID = fullID;
|
||||
o.Flags = flags;
|
||||
o.PCode = pcode;
|
||||
o.State = buf.readUInt8(pos++);
|
||||
o.CRC = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
o.Material = buf.readUInt8(pos++);
|
||||
o.ClickAction = buf.readUInt8(pos++);
|
||||
o.Scale = new Vector3_1.Vector3(buf, pos, false);
|
||||
pos = pos + 12;
|
||||
o.Position = new Vector3_1.Vector3(buf, pos, false);
|
||||
pos = pos + 12;
|
||||
o.Rotation = new Quaternion_1.Quaternion(buf, pos);
|
||||
pos = pos + 12;
|
||||
const compressedflags = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
o.OwnerID = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasAngularVelocity) {
|
||||
o.AngularVelocity = new Vector3_1.Vector3(buf, pos, false);
|
||||
pos = pos + 12;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasParent) {
|
||||
const newParentID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
let add = true;
|
||||
if (!newObj) {
|
||||
if (newParentID !== o.ParentID) {
|
||||
const index = this.objectsByParent[o.ParentID].indexOf(localID);
|
||||
if (index !== -1) {
|
||||
this.objectsByParent[o.ParentID].splice(index, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
if (!this.objectsByParent[newParentID]) {
|
||||
this.objectsByParent[newParentID] = [];
|
||||
}
|
||||
this.objectsByParent[newParentID].push(localID);
|
||||
}
|
||||
o.ParentID = newParentID;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.Tree) {
|
||||
o.TreeSpecies = buf.readUInt8(pos++);
|
||||
}
|
||||
else if (compressedflags & CompressedFlags_1.CompressedFlags.ScratchPad) {
|
||||
o.TreeSpecies = 0;
|
||||
const scratchPadSize = buf.readUInt8(pos++);
|
||||
pos = pos + scratchPadSize;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasText) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
pos += result.readLength;
|
||||
o.Text = result.result;
|
||||
o.TextColor = buf.slice(pos, pos + 4);
|
||||
pos = pos + 4;
|
||||
}
|
||||
else {
|
||||
o.Text = '';
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.MediaURL) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
pos += result.readLength;
|
||||
o.MediaURL = result.result;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasParticles) {
|
||||
pos += 86;
|
||||
}
|
||||
pos = this.readExtraParams(buf, pos, o);
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasSound) {
|
||||
o.Sound = new UUID_1.UUID(buf, pos);
|
||||
pos = pos + 16;
|
||||
o.SoundGain = buf.readFloatLE(pos);
|
||||
pos += 4;
|
||||
o.SoundFlags = buf.readUInt8(pos++);
|
||||
o.SoundRadius = buf.readFloatLE(pos);
|
||||
pos = pos + 4;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasNameValues) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
o.NameValue = this.parseNameValues(result.result);
|
||||
pos += result.readLength;
|
||||
}
|
||||
o.PathCurve = buf.readUInt8(pos++);
|
||||
o.PathBegin = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
o.PathEnd = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
o.PathScaleX = buf.readUInt8(pos++);
|
||||
o.PathScaleY = buf.readUInt8(pos++);
|
||||
o.PathShearX = buf.readUInt8(pos++);
|
||||
o.PathShearY = buf.readUInt8(pos++);
|
||||
o.PathTwist = buf.readUInt8(pos++);
|
||||
o.PathTwistBegin = buf.readUInt8(pos++);
|
||||
o.PathRadiusOffset = buf.readUInt8(pos++);
|
||||
o.PathTaperX = buf.readUInt8(pos++);
|
||||
o.PathTaperY = buf.readUInt8(pos++);
|
||||
o.PathRevolutions = buf.readUInt8(pos++);
|
||||
o.PathSkew = buf.readUInt8(pos++);
|
||||
o.ProfileCurve = buf.readUInt8(pos++);
|
||||
o.ProfileBegin = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
o.ProfileEnd = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
o.ProfileHollow = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
pos = pos + textureEntryLength;
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.TextureAnimation) {
|
||||
pos = pos + 4;
|
||||
}
|
||||
o.IsAttachment = (compressedflags & CompressedFlags_1.CompressedFlags.HasNameValues) !== 0 && o.ParentID !== 0;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case Message_1.Message.ImprovedTerseObjectUpdate:
|
||||
const objectUpdateTerse = packet.message;
|
||||
break;
|
||||
case Message_1.Message.MultipleObjectUpdate:
|
||||
const multipleObjectUpdate = packet.message;
|
||||
console.error('TODO: MultipleObjectUpdate');
|
||||
break;
|
||||
case Message_1.Message.KillObject:
|
||||
const killObj = packet.message;
|
||||
killObj.ObjectData.forEach((obj) => {
|
||||
const objectID = obj.ID;
|
||||
this.deleteObject(objectID);
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
deleteObject(objectID) {
|
||||
if (this.objects[objectID]) {
|
||||
if (this.objectsByParent[objectID]) {
|
||||
this.objectsByParent[objectID].forEach((childObjID) => {
|
||||
this.deleteObject(childObjID);
|
||||
});
|
||||
}
|
||||
delete this.objectsByParent[objectID];
|
||||
const objct = this.objects[objectID];
|
||||
const uuid = objct.FullID.toString();
|
||||
if (this.objectsByUUID[uuid]) {
|
||||
delete this.objectsByUUID[uuid];
|
||||
}
|
||||
const parentID = objct.ParentID;
|
||||
if (this.objectsByParent[parentID]) {
|
||||
const ind = this.objectsByParent[parentID].indexOf(objectID);
|
||||
if (ind !== -1) {
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
delete this.objects[objectID];
|
||||
}
|
||||
}
|
||||
readExtraParams(buf, pos, o) {
|
||||
if (pos >= buf.length) {
|
||||
return 0;
|
||||
}
|
||||
const extraParamCount = buf.readUInt8(pos++);
|
||||
for (let k = 0; k < extraParamCount; k++) {
|
||||
const type = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
const paramLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
pos += paramLength;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
getObjectsByParent(parentID) {
|
||||
const list = this.objectsByParent[parentID];
|
||||
if (list === undefined) {
|
||||
return [];
|
||||
}
|
||||
const result = [];
|
||||
list.forEach((localID) => {
|
||||
result.push(this.objects[localID]);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
parseNameValues(str) {
|
||||
const nv = {};
|
||||
const lines = str.split('\n');
|
||||
lines.forEach((line) => {
|
||||
if (line.length > 0) {
|
||||
let kv = line.split(/[\t ]/);
|
||||
if (kv.length > 5) {
|
||||
for (let x = 5; x < kv.length; x++) {
|
||||
kv[4] += ' ' + kv[x];
|
||||
}
|
||||
kv = kv.slice(0, 5);
|
||||
}
|
||||
if (kv.length === 5) {
|
||||
const namevalue = new NameValue_1.NameValue();
|
||||
namevalue.type = kv[1];
|
||||
namevalue.class = kv[2];
|
||||
namevalue.sendTo = kv[3];
|
||||
namevalue.value = kv[4];
|
||||
nv[kv[0]] = namevalue;
|
||||
}
|
||||
else {
|
||||
console.log('namevalue unexpected length: ' + kv.length);
|
||||
console.log(kv);
|
||||
}
|
||||
}
|
||||
});
|
||||
return nv;
|
||||
}
|
||||
shutdown() {
|
||||
this.objects = {};
|
||||
this.objectsByUUID = {};
|
||||
this.objectsByParent = {};
|
||||
}
|
||||
}
|
||||
exports.ObjectStoreFull = ObjectStoreFull;
|
||||
//# sourceMappingURL=ObjectStoreFull.js.map
|
||||
1
dist/classes/ObjectStoreFull.js.map
vendored
Normal file
1
dist/classes/ObjectStoreFull.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
23
dist/classes/ObjectStoreLite.d.ts
vendored
Normal file
23
dist/classes/ObjectStoreLite.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/// <reference types="node" />
|
||||
import { Circuit } from './Circuit';
|
||||
import { Agent } from './Agent';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { IObjectStore } from './interfaces/IObjectStore';
|
||||
import { GameObjectLite } from './GameObjectLite';
|
||||
import { NameValue } from './NameValue';
|
||||
export declare class ObjectStoreLite implements IObjectStore {
|
||||
private circuit;
|
||||
private agent;
|
||||
private objects;
|
||||
private objectsByUUID;
|
||||
private objectsByParent;
|
||||
private clientEvents;
|
||||
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents);
|
||||
deleteObject(objectID: number): void;
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObjectLite): number;
|
||||
getObjectsByParent(parentID: number): GameObjectLite[];
|
||||
parseNameValues(str: string): {
|
||||
[key: string]: NameValue;
|
||||
};
|
||||
shutdown(): void;
|
||||
}
|
||||
288
dist/classes/ObjectStoreLite.js
vendored
Normal file
288
dist/classes/ObjectStoreLite.js
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Message_1 = require("../enums/Message");
|
||||
const RequestMultipleObjects_1 = require("./messages/RequestMultipleObjects");
|
||||
const UUID_1 = require("./UUID");
|
||||
const CompressedFlags_1 = require("../enums/CompressedFlags");
|
||||
const Utils_1 = require("./Utils");
|
||||
const PCode_1 = require("../enums/PCode");
|
||||
const GameObjectLite_1 = require("./GameObjectLite");
|
||||
const NameValue_1 = require("./NameValue");
|
||||
class ObjectStoreLite {
|
||||
constructor(circuit, agent, clientEvents) {
|
||||
this.objects = {};
|
||||
this.objectsByUUID = {};
|
||||
this.objectsByParent = {};
|
||||
this.clientEvents = clientEvents;
|
||||
this.circuit = circuit;
|
||||
this.agent = agent;
|
||||
this.circuit.subscribeToMessages([
|
||||
Message_1.Message.ObjectUpdate,
|
||||
Message_1.Message.ObjectUpdateCached,
|
||||
Message_1.Message.ObjectUpdateCompressed,
|
||||
Message_1.Message.ImprovedTerseObjectUpdate,
|
||||
Message_1.Message.MultipleObjectUpdate,
|
||||
Message_1.Message.KillObject
|
||||
], (packet) => {
|
||||
switch (packet.message.id) {
|
||||
case Message_1.Message.ObjectUpdate:
|
||||
const objectUpdate = packet.message;
|
||||
objectUpdate.ObjectData.forEach((objData) => {
|
||||
const localID = objData.ID;
|
||||
const parentID = objData.ParentID;
|
||||
let addToParentList = true;
|
||||
if (this.objects[localID]) {
|
||||
if (this.objects[localID].ParentID !== parentID && this.objectsByParent[parentID]) {
|
||||
const ind = this.objectsByParent[parentID].indexOf(localID);
|
||||
if (ind !== -1) {
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addToParentList = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.objects[localID] = new GameObjectLite_1.GameObjectLite();
|
||||
}
|
||||
const obj = this.objects[localID];
|
||||
obj.ID = objData.ID;
|
||||
obj.FullID = objData.FullID;
|
||||
obj.ParentID = objData.ParentID;
|
||||
obj.OwnerID = objData.OwnerID;
|
||||
this.objects[localID].NameValue = this.parseNameValues(Utils_1.Utils.BufferToStringSimple(objData.NameValue));
|
||||
if (objData.PCode === PCode_1.PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString()) {
|
||||
this.agent.localID = localID;
|
||||
}
|
||||
this.objectsByUUID[objData.FullID.toString()] = localID;
|
||||
if (!this.objectsByParent[parentID]) {
|
||||
this.objectsByParent[parentID] = [];
|
||||
}
|
||||
if (addToParentList) {
|
||||
this.objectsByParent[parentID].push(localID);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case Message_1.Message.ObjectUpdateCached:
|
||||
const objectUpdateCached = packet.message;
|
||||
const rmo = new RequestMultipleObjects_1.RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
objectUpdateCached.ObjectData.forEach((obj) => {
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
break;
|
||||
case Message_1.Message.ObjectUpdateCompressed:
|
||||
{
|
||||
const objectUpdateCompressed = packet.message;
|
||||
objectUpdateCompressed.ObjectData.forEach((obj) => {
|
||||
const flags = obj.UpdateFlags;
|
||||
const buf = obj.Data;
|
||||
let pos = 0;
|
||||
const fullID = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
const localID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
const pcode = buf.readUInt8(pos++);
|
||||
let newObj = false;
|
||||
if (!this.objects[localID]) {
|
||||
newObj = true;
|
||||
this.objects[localID] = new GameObjectLite_1.GameObjectLite();
|
||||
}
|
||||
const o = this.objects[localID];
|
||||
o.ID = localID;
|
||||
this.objectsByUUID[fullID.toString()] = localID;
|
||||
o.FullID = fullID;
|
||||
pos++;
|
||||
pos = pos + 4;
|
||||
pos++;
|
||||
pos++;
|
||||
pos = pos + 12;
|
||||
pos = pos + 12;
|
||||
pos = pos + 12;
|
||||
const compressedflags = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
o.OwnerID = new UUID_1.UUID(buf, pos);
|
||||
pos += 16;
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasAngularVelocity) {
|
||||
pos = pos + 12;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasParent) {
|
||||
const newParentID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
let add = true;
|
||||
if (!newObj) {
|
||||
if (newParentID !== o.ParentID) {
|
||||
const index = this.objectsByParent[o.ParentID].indexOf(localID);
|
||||
if (index !== -1) {
|
||||
this.objectsByParent[o.ParentID].splice(index, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
if (!this.objectsByParent[newParentID]) {
|
||||
this.objectsByParent[newParentID] = [];
|
||||
}
|
||||
this.objectsByParent[newParentID].push(localID);
|
||||
}
|
||||
o.ParentID = newParentID;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.Tree) {
|
||||
pos++;
|
||||
}
|
||||
else if (compressedflags & CompressedFlags_1.CompressedFlags.ScratchPad) {
|
||||
const scratchPadSize = buf.readUInt8(pos++);
|
||||
pos = pos + scratchPadSize;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasText) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
pos += result.readLength;
|
||||
pos = pos + 4;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.MediaURL) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
pos += result.readLength;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasParticles) {
|
||||
pos += 86;
|
||||
}
|
||||
pos = this.readExtraParams(buf, pos, o);
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasSound) {
|
||||
pos = pos + 16;
|
||||
pos += 4;
|
||||
pos++;
|
||||
pos = pos + 4;
|
||||
}
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.HasNameValues) {
|
||||
const result = Utils_1.Utils.BufferToString(buf, pos);
|
||||
o.NameValue = this.parseNameValues(result.result);
|
||||
pos += result.readLength;
|
||||
}
|
||||
pos++;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
pos = pos + 12;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
pos = pos + textureEntryLength;
|
||||
if (compressedflags & CompressedFlags_1.CompressedFlags.TextureAnimation) {
|
||||
pos = pos + 4;
|
||||
}
|
||||
o.IsAttachment = (compressedflags & CompressedFlags_1.CompressedFlags.HasNameValues) !== 0 && o.ParentID !== 0;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case Message_1.Message.ImprovedTerseObjectUpdate:
|
||||
const objectUpdateTerse = packet.message;
|
||||
break;
|
||||
case Message_1.Message.MultipleObjectUpdate:
|
||||
const multipleObjectUpdate = packet.message;
|
||||
console.error('TODO: MultipleObjectUpdate');
|
||||
break;
|
||||
case Message_1.Message.KillObject:
|
||||
const killObj = packet.message;
|
||||
killObj.ObjectData.forEach((obj) => {
|
||||
const objectID = obj.ID;
|
||||
this.deleteObject(objectID);
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
deleteObject(objectID) {
|
||||
if (this.objects[objectID]) {
|
||||
if (this.objectsByParent[objectID]) {
|
||||
this.objectsByParent[objectID].forEach((childObjID) => {
|
||||
this.deleteObject(childObjID);
|
||||
});
|
||||
}
|
||||
delete this.objectsByParent[objectID];
|
||||
const objct = this.objects[objectID];
|
||||
const uuid = objct.FullID.toString();
|
||||
if (this.objectsByUUID[uuid]) {
|
||||
delete this.objectsByUUID[uuid];
|
||||
}
|
||||
const parentID = objct.ParentID;
|
||||
if (this.objectsByParent[parentID]) {
|
||||
const ind = this.objectsByParent[parentID].indexOf(objectID);
|
||||
if (ind !== -1) {
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
delete this.objects[objectID];
|
||||
}
|
||||
}
|
||||
readExtraParams(buf, pos, o) {
|
||||
if (pos >= buf.length) {
|
||||
return 0;
|
||||
}
|
||||
const extraParamCount = buf.readUInt8(pos++);
|
||||
for (let k = 0; k < extraParamCount; k++) {
|
||||
const type = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
const paramLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
pos += paramLength;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
getObjectsByParent(parentID) {
|
||||
const list = this.objectsByParent[parentID];
|
||||
if (list === undefined) {
|
||||
return [];
|
||||
}
|
||||
const result = [];
|
||||
list.forEach((localID) => {
|
||||
result.push(this.objects[localID]);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
parseNameValues(str) {
|
||||
const nv = {};
|
||||
const lines = str.split('\n');
|
||||
lines.forEach((line) => {
|
||||
if (line.length > 0) {
|
||||
let kv = line.split(/[\t ]/);
|
||||
if (kv.length > 5) {
|
||||
for (let x = 5; x < kv.length; x++) {
|
||||
kv[4] += ' ' + kv[x];
|
||||
}
|
||||
kv = kv.slice(0, 5);
|
||||
}
|
||||
if (kv.length === 5) {
|
||||
const namevalue = new NameValue_1.NameValue();
|
||||
namevalue.type = kv[1];
|
||||
namevalue.class = kv[2];
|
||||
namevalue.sendTo = kv[3];
|
||||
namevalue.value = kv[4];
|
||||
nv[kv[0]] = namevalue;
|
||||
}
|
||||
else {
|
||||
console.log('namevalue unexpected length: ' + kv.length);
|
||||
console.log(kv);
|
||||
}
|
||||
}
|
||||
});
|
||||
return nv;
|
||||
}
|
||||
shutdown() {
|
||||
this.objects = {};
|
||||
this.objectsByUUID = {};
|
||||
this.objectsByParent = {};
|
||||
}
|
||||
}
|
||||
exports.ObjectStoreLite = ObjectStoreLite;
|
||||
//# sourceMappingURL=ObjectStoreLite.js.map
|
||||
1
dist/classes/ObjectStoreLite.js.map
vendored
Normal file
1
dist/classes/ObjectStoreLite.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
8
dist/classes/Region.d.ts
vendored
8
dist/classes/Region.d.ts
vendored
@@ -1,18 +1,20 @@
|
||||
import { Circuit } from './Circuit';
|
||||
import { ObjectStore } from './ObjectStore';
|
||||
import { Agent } from './Agent';
|
||||
import { Caps } from './Caps';
|
||||
import { Comms } from './Comms';
|
||||
import { ClientEvents } from './ClientEvents';
|
||||
import { IObjectStore } from './interfaces/IObjectStore';
|
||||
import { BotOptionFlags } from '../enums/BotOptionFlags';
|
||||
export declare class Region {
|
||||
xCoordinate: number;
|
||||
yCoordinate: number;
|
||||
circuit: Circuit;
|
||||
objects: ObjectStore;
|
||||
objects: IObjectStore;
|
||||
caps: Caps;
|
||||
comms: Comms;
|
||||
clientEvents: ClientEvents;
|
||||
constructor(agent: Agent, clientEvents: ClientEvents);
|
||||
options: BotOptionFlags;
|
||||
constructor(agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags);
|
||||
activateCaps(seedURL: string): void;
|
||||
shutdown(): void;
|
||||
}
|
||||
|
||||
14
dist/classes/Region.js
vendored
14
dist/classes/Region.js
vendored
@@ -1,14 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Circuit_1 = require("./Circuit");
|
||||
const ObjectStore_1 = require("./ObjectStore");
|
||||
const Caps_1 = require("./Caps");
|
||||
const Comms_1 = require("./Comms");
|
||||
const ObjectStoreFull_1 = require("./ObjectStoreFull");
|
||||
const BotOptionFlags_1 = require("../enums/BotOptionFlags");
|
||||
const ObjectStoreLite_1 = require("./ObjectStoreLite");
|
||||
class Region {
|
||||
constructor(agent, clientEvents) {
|
||||
constructor(agent, clientEvents, options) {
|
||||
this.options = options;
|
||||
this.clientEvents = clientEvents;
|
||||
this.circuit = new Circuit_1.Circuit(clientEvents);
|
||||
this.objects = new ObjectStore_1.ObjectStore(this.circuit, agent, clientEvents);
|
||||
if (options & BotOptionFlags_1.BotOptionFlags.LiteObjectStore) {
|
||||
this.objects = new ObjectStoreLite_1.ObjectStoreLite(this.circuit, agent, clientEvents);
|
||||
}
|
||||
else {
|
||||
this.objects = new ObjectStoreFull_1.ObjectStoreFull(this.circuit, agent, clientEvents);
|
||||
}
|
||||
this.comms = new Comms_1.Comms(this.circuit, agent, clientEvents);
|
||||
}
|
||||
activateCaps(seedURL) {
|
||||
|
||||
2
dist/classes/Region.js.map
vendored
2
dist/classes/Region.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"Region.js","sourceRoot":"","sources":["../../lib/classes/Region.ts"],"names":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,CAAC,eAAe,CAAC,CAC7C,CAAC;YACG,IAAI,CAAC,OAAO,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CACJ,CAAC;YACG,IAAI,CAAC,OAAO,GAAG,IAAI,iCAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC;IACD,YAAY,CAAC,OAAe;QAExB,IAAI,CAAC,IAAI,GAAG,IAAI,WAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IACD,QAAQ;QAEJ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAE5B,CAAC;CACJ;AAtCD,wBAsCC"}
|
||||
2
dist/classes/commands/TeleportCommands.js
vendored
2
dist/classes/commands/TeleportCommands.js
vendored
@@ -40,7 +40,7 @@ class TeleportCommands extends CommandsBase_1.CommandsBase {
|
||||
return;
|
||||
}
|
||||
this.currentRegion.shutdown();
|
||||
const region = new Region_1.Region(this.agent, this.bot.clientEvents);
|
||||
const region = new Region_1.Region(this.agent, this.bot.clientEvents, this.currentRegion.options);
|
||||
region.circuit.circuitCode = this.currentRegion.circuit.circuitCode;
|
||||
region.circuit.secureSessionID = this.currentRegion.circuit.secureSessionID;
|
||||
region.circuit.sessionID = this.currentRegion.circuit.sessionID;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"TeleportCommands.js","sourceRo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-0,0 +1,4 @@
|
||||
export interface IGameObject {
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
}
|
||||
3
dist/classes/interfaces/IGameObject.js
vendored
Normal file
3
dist/classes/interfaces/IGameObject.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IGameObject.js.map
|
||||
1
dist/classes/interfaces/IGameObject.js.map
vendored
Normal file
1
dist/classes/interfaces/IGameObject.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IGameObject.js","sourceRoot":"","sources":["../../../lib/classes/interfaces/IGameObject.ts"],"names":[],"mappings":""}
|
||||
5
dist/classes/interfaces/IObjectStore.d.ts
vendored
Normal file
5
dist/classes/interfaces/IObjectStore.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { IGameObject } from './IGameObject';
|
||||
export interface IObjectStore {
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
shutdown(): void;
|
||||
}
|
||||
3
dist/classes/interfaces/IObjectStore.js
vendored
Normal file
3
dist/classes/interfaces/IObjectStore.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IObjectStore.js.map
|
||||
1
dist/classes/interfaces/IObjectStore.js.map
vendored
Normal file
1
dist/classes/interfaces/IObjectStore.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IObjectStore.js","sourceRoot":"","sources":["../../../lib/classes/interfaces/IObjectStore.ts"],"names":[],"mappings":""}
|
||||
4
dist/enums/BotOptionFlags.d.ts
vendored
Normal file
4
dist/enums/BotOptionFlags.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare enum BotOptionFlags {
|
||||
None = 0,
|
||||
LiteObjectStore = 1,
|
||||
}
|
||||
8
dist/enums/BotOptionFlags.js
vendored
Normal file
8
dist/enums/BotOptionFlags.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var BotOptionFlags;
|
||||
(function (BotOptionFlags) {
|
||||
BotOptionFlags[BotOptionFlags["None"] = 0] = "None";
|
||||
BotOptionFlags[BotOptionFlags["LiteObjectStore"] = 1] = "LiteObjectStore";
|
||||
})(BotOptionFlags = exports.BotOptionFlags || (exports.BotOptionFlags = {}));
|
||||
//# sourceMappingURL=BotOptionFlags.js.map
|
||||
1
dist/enums/BotOptionFlags.js.map
vendored
Normal file
1
dist/enums/BotOptionFlags.js.map
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BotOptionFlags.js","sourceRoot":"","sources":["../../lib/enums/BotOptionFlags.ts"],"names":[],"mappings":";;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IAEtB,mDAAQ,CAAA;IACR,yEAAmB,CAAA;AACvB,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
|
||||
3
dist/index.d.ts
vendored
3
dist/index.d.ts
vendored
@@ -7,4 +7,5 @@ import { HTTPAssets } from './enums/HTTPAssets';
|
||||
import { InstantMessageEventFlags } from './enums/InstantMessageEventFlags';
|
||||
import { InstantMessageEvent } from './events/InstantMessageEvent';
|
||||
import { ChatSourceType } from './enums/ChatSourceType';
|
||||
export { Bot, LoginParameters, AssetType, HTTPAssets, ClientEvents, BVH, InstantMessageEvent, InstantMessageEventFlags, ChatSourceType };
|
||||
import { BotOptionFlags } from './enums/BotOptionFlags';
|
||||
export { Bot, LoginParameters, AssetType, HTTPAssets, ClientEvents, BVH, InstantMessageEvent, InstantMessageEventFlags, ChatSourceType, BotOptionFlags };
|
||||
|
||||
2
dist/index.js
vendored
2
dist/index.js
vendored
@@ -18,4 +18,6 @@ const InstantMessageEvent_1 = require("./events/InstantMessageEvent");
|
||||
exports.InstantMessageEvent = InstantMessageEvent_1.InstantMessageEvent;
|
||||
const ChatSourceType_1 = require("./enums/ChatSourceType");
|
||||
exports.ChatSourceType = ChatSourceType_1.ChatSourceType;
|
||||
const BotOptionFlags_1 = require("./enums/BotOptionFlags");
|
||||
exports.BotOptionFlags = BotOptionFlags_1.BotOptionFlags;
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;AAAA,+BAA0B;AAetB,cAfI,SAAG,CAeJ;AAdP,+DAA0D;AAetD,0BAfI,iCAAe,CAeJ;AAdnB,yDAAoD;AAiBhD,uBAjBI,2BAAY,CAiBJ;AAhBhB,uCAAkC;AAiB9B,cAjBI,SAAG,CAiBJ;AAZP,iDAA4C;AASxC,oBATI,qBAAS,CASJ;AARb,mDAA8C;AAS1C,qBATI,uBAAU,CASJ;AARd,+EAA0E;AAYtE,mCAZI,mDAAwB,CAYJ;AAX5B,sEAAiE;AAU7D,8BAVI,yCAAmB,CAUJ;AATvB,2DAAsD;AAWlD,yBAXI,+BAAc,CAWJ"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;AAAA,+BAA0B;AAgBtB,cAhBI,SAAG,CAgBJ;AAfP,+DAA0D;AAgBtD,0BAhBI,iCAAe,CAgBJ;AAfnB,yDAAoD;AAkBhD,uBAlBI,2BAAY,CAkBJ;AAjBhB,uCAAkC;AAkB9B,cAlBI,SAAG,CAkBJ;AAbP,iDAA4C;AAUxC,oBAVI,qBAAS,CAUJ;AATb,mDAA8C;AAU1C,qBAVI,uBAAU,CAUJ;AATd,+EAA0E;AAatE,mCAbI,mDAAwB,CAaJ;AAZ5B,sEAAiE;AAW7D,8BAXI,yCAAmB,CAWJ;AAVvB,2DAAsD;AAYlD,yBAZI,+BAAc,CAYJ;AAXlB,2DAAsD;AAYlD,yBAZI,+BAAc,CAYJ"}
|
||||
@@ -2,14 +2,20 @@ const nmv = require('../dist/index');
|
||||
const loginParameters = new nmv.LoginParameters();
|
||||
|
||||
const parameters = require('./loginParameters.json');
|
||||
const fs = require('fs');
|
||||
|
||||
loginParameters.firstName = parameters.firstName;
|
||||
loginParameters.lastName = parameters.lastName;
|
||||
loginParameters.password = parameters.password;
|
||||
loginParameters.start = "last";
|
||||
|
||||
const bot = new nmv.Bot(loginParameters);
|
||||
//const options = nmv.BotOptionFlags.None;
|
||||
|
||||
// If you don't intend to use the object store (i.e you have no interest in inworld objects, textures, etc,
|
||||
// using ObjectStoreLite will drastically reduce the footprint
|
||||
//
|
||||
const options = nmv.BotOptionFlags.LiteObjectStore;
|
||||
|
||||
const bot = new nmv.Bot(loginParameters, options);
|
||||
|
||||
let isConnected = false;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import {StartPingCheckMessage} from './classes/messages/StartPingCheck';
|
||||
import {CompletePingCheckMessage} from './classes/messages/CompletePingCheck';
|
||||
import Timer = NodeJS.Timer;
|
||||
import {Subscription} from 'rxjs/Subscription';
|
||||
import {BotOptionFlags} from './enums/BotOptionFlags';
|
||||
|
||||
export class Bot
|
||||
{
|
||||
@@ -35,20 +36,23 @@ export class Bot
|
||||
private pingNumber = 0;
|
||||
private lastSuccessfulPing = 0;
|
||||
private circuitSubscription: Subscription | null = null
|
||||
private options: BotOptionFlags;
|
||||
public clientEvents: ClientEvents;
|
||||
public clientCommands: ClientCommands;
|
||||
|
||||
constructor(login: LoginParameters)
|
||||
|
||||
constructor(login: LoginParameters, options: BotOptionFlags)
|
||||
{
|
||||
this.clientEvents = new ClientEvents();
|
||||
this.loginParams = login;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
login()
|
||||
{
|
||||
return new Promise((resolve, reject) =>
|
||||
{
|
||||
const loginHandler = new LoginHandler(this.clientEvents);
|
||||
const loginHandler = new LoginHandler(this.clientEvents, this.options);
|
||||
loginHandler.Login(this.loginParams).then((response: LoginResponse) =>
|
||||
{
|
||||
this.currentRegion = response.region;
|
||||
|
||||
@@ -3,11 +3,13 @@ import * as crypto from 'crypto';
|
||||
import {LoginParameters} from './classes/LoginParameters';
|
||||
import {LoginResponse} from './classes/LoginResponse';
|
||||
import {ClientEvents} from './classes/ClientEvents';
|
||||
import {BotOptionFlags} from './enums/BotOptionFlags';
|
||||
const uuid = require('uuid');
|
||||
|
||||
export class LoginHandler
|
||||
{
|
||||
private clientEvents: ClientEvents;
|
||||
private options: BotOptionFlags;
|
||||
|
||||
static GenerateMAC(): string
|
||||
{
|
||||
@@ -26,9 +28,10 @@ export class LoginHandler
|
||||
return macAddress;
|
||||
}
|
||||
|
||||
constructor(ce: ClientEvents)
|
||||
constructor(ce: ClientEvents, options: BotOptionFlags)
|
||||
{
|
||||
this.clientEvents = ce;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
Login(params: LoginParameters): Promise<LoginResponse>
|
||||
@@ -88,7 +91,7 @@ export class LoginHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
const response = new LoginResponse(value, this.clientEvents);
|
||||
const response = new LoginResponse(value, this.clientEvents, this.options);
|
||||
resolve(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import {AgentFlags} from '../enums/AgentFlags';
|
||||
import {BuiltInAnimations} from '../enums/BuiltInAnimations';
|
||||
import * as LLSD from 'llsd';
|
||||
import {AssetType} from '../enums/AssetType';
|
||||
import {GameObject} from './Object';
|
||||
import {AgentWearablesRequestMessage} from './messages/AgentWearablesRequest';
|
||||
import {PacketFlags} from '../enums/PacketFlags';
|
||||
import {AgentWearablesUpdateMessage} from './messages/AgentWearablesUpdate';
|
||||
@@ -25,6 +24,7 @@ import {AttachmentPoint} from '../enums/AttachmentPoint';
|
||||
import {Utils} from './Utils';
|
||||
import {AgentAnimationMessage} from './messages/AgentAnimation';
|
||||
import {ClientEvents} from './ClientEvents';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
|
||||
export class Agent
|
||||
{
|
||||
@@ -208,11 +208,11 @@ export class Agent
|
||||
if (item.type === 6)
|
||||
{
|
||||
let found = false;
|
||||
wornObjects.forEach((obj: GameObject) =>
|
||||
wornObjects.forEach((obj: IGameObject) =>
|
||||
{
|
||||
if (obj.NameValue['AttachItemID'])
|
||||
if (obj.hasNameValueEntry('AttachItemID'))
|
||||
{
|
||||
if (item['item_id'].toString() === obj.NameValue['AttachItemID'].value)
|
||||
if (item['item_id'].toString() === obj.getNameValueEntry('AttachItemID'))
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ import {Quaternion} from './Quaternion';
|
||||
import {Tree} from '../enums/Tree';
|
||||
import {SoundFlags} from '../enums/SoundFlags';
|
||||
import {NameValue} from './NameValue';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
|
||||
export class GameObject
|
||||
export class GameObjectFull implements IGameObject
|
||||
{
|
||||
ID: number;
|
||||
State: number;
|
||||
@@ -71,4 +72,22 @@ export class GameObject
|
||||
this.SoundRadius = 1.0;
|
||||
this.SoundGain = 1.0;
|
||||
}
|
||||
|
||||
hasNameValueEntry(key: string): boolean
|
||||
{
|
||||
if (this.NameValue['AttachItemID'])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getNameValueEntry(key: string): string
|
||||
{
|
||||
if (this.NameValue['AttachItemID'])
|
||||
{
|
||||
return this.NameValue['AttachItemID'].value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
35
lib/classes/GameObjectLite.ts
Normal file
35
lib/classes/GameObjectLite.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import {UUID} from './UUID';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
import {NameValue} from './NameValue';
|
||||
|
||||
export class GameObjectLite implements IGameObject
|
||||
{
|
||||
ID: number;
|
||||
FullID: UUID;
|
||||
ParentID: number;
|
||||
OwnerID: UUID;
|
||||
IsAttachment: boolean;
|
||||
NameValue: {[key: string]: NameValue};
|
||||
constructor()
|
||||
{
|
||||
this.IsAttachment = false;
|
||||
}
|
||||
|
||||
hasNameValueEntry(key: string): boolean
|
||||
{
|
||||
if (this.NameValue['AttachItemID'])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getNameValueEntry(key: string): string
|
||||
{
|
||||
if (this.NameValue['AttachItemID'])
|
||||
{
|
||||
return this.NameValue['AttachItemID'].value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import {LoginFlags} from '../enums/LoginFlags';
|
||||
import {Vector3} from './Vector3';
|
||||
import Long = require('long');
|
||||
import {ClientEvents} from './ClientEvents';
|
||||
import {BotOptionFlags} from '../enums/BotOptionFlags';
|
||||
|
||||
export class LoginResponse
|
||||
{
|
||||
@@ -88,11 +89,11 @@ export class LoginResponse
|
||||
return result;
|
||||
}
|
||||
|
||||
constructor(json: any, ce: ClientEvents)
|
||||
constructor(json: any, clientEvents: ClientEvents, options: BotOptionFlags)
|
||||
{
|
||||
this.clientEvents = ce;
|
||||
this.clientEvents = clientEvents;
|
||||
this.agent = new Agent(this.clientEvents);
|
||||
this.region = new Region(this.agent, this.clientEvents);
|
||||
this.region = new Region(this.agent, this.clientEvents, options);
|
||||
Object.keys(json).forEach((key: string) =>
|
||||
{
|
||||
const val: any = json[key];
|
||||
|
||||
@@ -9,7 +9,6 @@ import {MultipleObjectUpdateMessage} from './messages/MultipleObjectUpdate';
|
||||
import {RequestMultipleObjectsMessage} from './messages/RequestMultipleObjects';
|
||||
import {Agent} from './Agent';
|
||||
import {UUID} from './UUID';
|
||||
import {GameObject} from './Object';
|
||||
import {Quaternion} from './Quaternion';
|
||||
import {Vector3} from './Vector3';
|
||||
import {CompressedFlags} from '../enums/CompressedFlags';
|
||||
@@ -19,12 +18,15 @@ import {PCode} from '../enums/PCode';
|
||||
import {NameValue} from './NameValue';
|
||||
import {ClientEvents} from './ClientEvents';
|
||||
import {KillObjectMessage} from './messages/KillObject';
|
||||
import {IObjectStore} from './interfaces/IObjectStore';
|
||||
import {GameObjectFull} from './GameObjectFull';
|
||||
import {IGameObject} from './interfaces/IGameObject';
|
||||
|
||||
export class ObjectStore
|
||||
export class ObjectStoreFull implements IObjectStore
|
||||
{
|
||||
private circuit: Circuit;
|
||||
private agent: Agent;
|
||||
private objects: { [key: number]: GameObject } = {};
|
||||
private objects: { [key: number]: GameObjectFull } = {};
|
||||
private objectsByUUID: { [key: string]: number } = {};
|
||||
private objectsByParent: { [key: number]: number[] } = {};
|
||||
private clientEvents: ClientEvents;
|
||||
@@ -70,7 +72,7 @@ export class ObjectStore
|
||||
}
|
||||
else
|
||||
{
|
||||
this.objects[localID] = new GameObject();
|
||||
this.objects[localID] = new GameObjectFull();
|
||||
}
|
||||
|
||||
const obj = this.objects[localID];
|
||||
@@ -173,7 +175,7 @@ export class ObjectStore
|
||||
if (!this.objects[localID])
|
||||
{
|
||||
newObj = true;
|
||||
this.objects[localID] = new GameObject();
|
||||
this.objects[localID] = new GameObjectFull();
|
||||
}
|
||||
const o = this.objects[localID];
|
||||
o.ID = localID;
|
||||
@@ -267,13 +269,8 @@ export class ObjectStore
|
||||
if (compressedflags & CompressedFlags.HasParticles)
|
||||
{
|
||||
// TODO: Particle system block
|
||||
//console.log("HasParticles");
|
||||
pos += 86;
|
||||
}
|
||||
else
|
||||
{
|
||||
//console.log("HasNoParticles");
|
||||
}
|
||||
|
||||
// Extra params
|
||||
pos = this.readExtraParams(buf, pos, o);
|
||||
@@ -317,7 +314,7 @@ export class ObjectStore
|
||||
pos = pos + 2;
|
||||
o.ProfileHollow = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
let textureEntryLength = buf.readUInt32LE(pos);
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
// TODO: Properly parse textureentry;
|
||||
pos = pos + textureEntryLength;
|
||||
@@ -390,7 +387,7 @@ export class ObjectStore
|
||||
}
|
||||
}
|
||||
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObject): number
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObjectFull): number
|
||||
{
|
||||
if (pos >= buf.length)
|
||||
{
|
||||
@@ -410,14 +407,14 @@ export class ObjectStore
|
||||
return pos;
|
||||
}
|
||||
|
||||
getObjectsByParent(parentID: number): GameObject[]
|
||||
getObjectsByParent(parentID: number): IGameObject[]
|
||||
{
|
||||
const list = this.objectsByParent[parentID];
|
||||
if (list === undefined)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
const result: GameObject[] = [];
|
||||
const result: IGameObject[] = [];
|
||||
list.forEach((localID) =>
|
||||
{
|
||||
result.push(this.objects[localID]);
|
||||
@@ -453,7 +450,7 @@ export class ObjectStore
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("namevalue unexpected length: " + kv.length);
|
||||
console.log('namevalue unexpected length: ' + kv.length);
|
||||
console.log(kv);
|
||||
}
|
||||
}
|
||||
395
lib/classes/ObjectStoreLite.ts
Normal file
395
lib/classes/ObjectStoreLite.ts
Normal file
@@ -0,0 +1,395 @@
|
||||
import {Circuit} from './Circuit';
|
||||
import {Packet} from './Packet';
|
||||
import {Message} from '../enums/Message';
|
||||
import {ObjectUpdateMessage} from './messages/ObjectUpdate';
|
||||
import {ObjectUpdateCachedMessage} from './messages/ObjectUpdateCached';
|
||||
import {ObjectUpdateCompressedMessage} from './messages/ObjectUpdateCompressed';
|
||||
import {ImprovedTerseObjectUpdateMessage} from './messages/ImprovedTerseObjectUpdate';
|
||||
import {MultipleObjectUpdateMessage} from './messages/MultipleObjectUpdate';
|
||||
import {RequestMultipleObjectsMessage} from './messages/RequestMultipleObjects';
|
||||
import {Agent} from './Agent';
|
||||
import {UUID} from './UUID';
|
||||
import {CompressedFlags} from '../enums/CompressedFlags';
|
||||
import {ExtraParamType} from '../enums/ExtraParamType';
|
||||
import {Utils} from './Utils';
|
||||
import {PCode} from '../enums/PCode';
|
||||
import {ClientEvents} from './ClientEvents';
|
||||
import {KillObjectMessage} from './messages/KillObject';
|
||||
import {IObjectStore} from './interfaces/IObjectStore';
|
||||
import {GameObjectLite} from './GameObjectLite';
|
||||
import {NameValue} from './NameValue';
|
||||
|
||||
export class ObjectStoreLite implements IObjectStore
|
||||
{
|
||||
private circuit: Circuit;
|
||||
private agent: Agent;
|
||||
private objects: { [key: number]: GameObjectLite } = {};
|
||||
private objectsByUUID: { [key: string]: number } = {};
|
||||
private objectsByParent: { [key: number]: number[] } = {};
|
||||
private clientEvents: ClientEvents;
|
||||
|
||||
constructor(circuit: Circuit, agent: Agent, clientEvents: ClientEvents)
|
||||
{
|
||||
this.clientEvents = clientEvents;
|
||||
this.circuit = circuit;
|
||||
this.agent = agent;
|
||||
this.circuit.subscribeToMessages([
|
||||
Message.ObjectUpdate,
|
||||
Message.ObjectUpdateCached,
|
||||
Message.ObjectUpdateCompressed,
|
||||
Message.ImprovedTerseObjectUpdate,
|
||||
Message.MultipleObjectUpdate,
|
||||
Message.KillObject
|
||||
], (packet: Packet) =>
|
||||
{
|
||||
switch (packet.message.id)
|
||||
{
|
||||
case Message.ObjectUpdate:
|
||||
const objectUpdate = packet.message as ObjectUpdateMessage;
|
||||
objectUpdate.ObjectData.forEach((objData) =>
|
||||
{
|
||||
const localID = objData.ID;
|
||||
const parentID = objData.ParentID;
|
||||
let addToParentList = true;
|
||||
|
||||
if (this.objects[localID])
|
||||
{
|
||||
if (this.objects[localID].ParentID !== parentID && this.objectsByParent[parentID])
|
||||
{
|
||||
const ind = this.objectsByParent[parentID].indexOf(localID);
|
||||
if (ind !== -1)
|
||||
{
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addToParentList = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.objects[localID] = new GameObjectLite();
|
||||
}
|
||||
|
||||
const obj = this.objects[localID];
|
||||
obj.ID = objData.ID;
|
||||
obj.FullID = objData.FullID;
|
||||
obj.ParentID = objData.ParentID;
|
||||
obj.OwnerID = objData.OwnerID;
|
||||
|
||||
this.objects[localID].NameValue = this.parseNameValues(Utils.BufferToStringSimple(objData.NameValue));
|
||||
|
||||
if (objData.PCode === PCode.Avatar && this.objects[localID].FullID.toString() === this.agent.agentID.toString())
|
||||
{
|
||||
this.agent.localID = localID;
|
||||
}
|
||||
|
||||
this.objectsByUUID[objData.FullID.toString()] = localID;
|
||||
if (!this.objectsByParent[parentID])
|
||||
{
|
||||
this.objectsByParent[parentID] = [];
|
||||
}
|
||||
if (addToParentList)
|
||||
{
|
||||
this.objectsByParent[parentID].push(localID);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case Message.ObjectUpdateCached:
|
||||
const objectUpdateCached = packet.message as ObjectUpdateCachedMessage;
|
||||
const rmo = new RequestMultipleObjectsMessage();
|
||||
rmo.AgentData = {
|
||||
AgentID: this.agent.agentID,
|
||||
SessionID: this.circuit.sessionID
|
||||
};
|
||||
rmo.ObjectData = [];
|
||||
objectUpdateCached.ObjectData.forEach((obj) =>
|
||||
{
|
||||
rmo.ObjectData.push({
|
||||
CacheMissType: 0,
|
||||
ID: obj.ID
|
||||
});
|
||||
});
|
||||
circuit.sendMessage(rmo, 0);
|
||||
break;
|
||||
case Message.ObjectUpdateCompressed:
|
||||
{
|
||||
const objectUpdateCompressed = packet.message as ObjectUpdateCompressedMessage;
|
||||
objectUpdateCompressed.ObjectData.forEach((obj) =>
|
||||
{
|
||||
const flags = obj.UpdateFlags;
|
||||
const buf = obj.Data;
|
||||
let pos = 0;
|
||||
|
||||
const fullID = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
const localID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
const pcode = buf.readUInt8(pos++);
|
||||
let newObj = false;
|
||||
if (!this.objects[localID])
|
||||
{
|
||||
newObj = true;
|
||||
this.objects[localID] = new GameObjectLite();
|
||||
}
|
||||
const o = this.objects[localID];
|
||||
o.ID = localID;
|
||||
this.objectsByUUID[fullID.toString()] = localID;
|
||||
o.FullID = fullID;
|
||||
|
||||
|
||||
pos++;
|
||||
|
||||
pos = pos + 4;
|
||||
pos++;
|
||||
pos++;
|
||||
|
||||
pos = pos + 12;
|
||||
|
||||
pos = pos + 12;
|
||||
|
||||
pos = pos + 12;
|
||||
const compressedflags: CompressedFlags = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
o.OwnerID = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
|
||||
if (compressedflags & CompressedFlags.HasAngularVelocity)
|
||||
{
|
||||
pos = pos + 12;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.HasParent)
|
||||
{
|
||||
const newParentID = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
let add = true;
|
||||
if (!newObj)
|
||||
{
|
||||
if (newParentID !== o.ParentID)
|
||||
{
|
||||
const index = this.objectsByParent[o.ParentID].indexOf(localID);
|
||||
if (index !== -1)
|
||||
{
|
||||
this.objectsByParent[o.ParentID].splice(index, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add = false;
|
||||
}
|
||||
}
|
||||
if (add)
|
||||
{
|
||||
if (!this.objectsByParent[newParentID])
|
||||
{
|
||||
this.objectsByParent[newParentID] = [];
|
||||
}
|
||||
this.objectsByParent[newParentID].push(localID);
|
||||
}
|
||||
o.ParentID = newParentID;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.Tree)
|
||||
{
|
||||
pos++;
|
||||
}
|
||||
else if (compressedflags & CompressedFlags.ScratchPad)
|
||||
{
|
||||
const scratchPadSize = buf.readUInt8(pos++);
|
||||
// Ignore this data
|
||||
pos = pos + scratchPadSize;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.HasText)
|
||||
{
|
||||
// Read null terminated string
|
||||
const result = Utils.BufferToString(buf, pos);
|
||||
|
||||
pos += result.readLength;
|
||||
pos = pos + 4;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.MediaURL)
|
||||
{
|
||||
const result = Utils.BufferToString(buf, pos);
|
||||
|
||||
pos += result.readLength;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.HasParticles)
|
||||
{
|
||||
// TODO: Particle system block
|
||||
pos += 86;
|
||||
}
|
||||
|
||||
// Extra params
|
||||
pos = this.readExtraParams(buf, pos, o);
|
||||
|
||||
if (compressedflags & CompressedFlags.HasSound)
|
||||
{
|
||||
pos = pos + 16;
|
||||
pos += 4;
|
||||
pos++;
|
||||
pos = pos + 4;
|
||||
}
|
||||
if (compressedflags & CompressedFlags.HasNameValues)
|
||||
{
|
||||
const result = Utils.BufferToString(buf, pos);
|
||||
o.NameValue = this.parseNameValues(result.result);
|
||||
pos += result.readLength;
|
||||
}
|
||||
pos++;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
pos = pos + 12;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
pos = pos + 2;
|
||||
const textureEntryLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
// TODO: Properly parse textureentry;
|
||||
pos = pos + textureEntryLength;
|
||||
|
||||
if (compressedflags & CompressedFlags.TextureAnimation)
|
||||
{
|
||||
// TODO: Properly parse textureAnim
|
||||
pos = pos + 4;
|
||||
}
|
||||
|
||||
o.IsAttachment = (compressedflags & CompressedFlags.HasNameValues) !== 0 && o.ParentID !== 0;
|
||||
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
case Message.ImprovedTerseObjectUpdate:
|
||||
const objectUpdateTerse = packet.message as ImprovedTerseObjectUpdateMessage;
|
||||
// TODO: ImprovedTerseObjectUPdate
|
||||
break;
|
||||
case Message.MultipleObjectUpdate:
|
||||
const multipleObjectUpdate = packet.message as MultipleObjectUpdateMessage;
|
||||
// TODO: multipleObjectUpdate
|
||||
console.error('TODO: MultipleObjectUpdate');
|
||||
break;
|
||||
case Message.KillObject:
|
||||
const killObj = packet.message as KillObjectMessage;
|
||||
killObj.ObjectData.forEach((obj) =>
|
||||
{
|
||||
const objectID = obj.ID;
|
||||
this.deleteObject(objectID);
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
deleteObject(objectID: number)
|
||||
{
|
||||
if (this.objects[objectID])
|
||||
{
|
||||
// First, kill all children
|
||||
if (this.objectsByParent[objectID])
|
||||
{
|
||||
this.objectsByParent[objectID].forEach((childObjID) =>
|
||||
{
|
||||
this.deleteObject(childObjID);
|
||||
});
|
||||
}
|
||||
delete this.objectsByParent[objectID];
|
||||
|
||||
// Now delete this object
|
||||
const objct = this.objects[objectID];
|
||||
const uuid = objct.FullID.toString();
|
||||
|
||||
if (this.objectsByUUID[uuid])
|
||||
{
|
||||
delete this.objectsByUUID[uuid];
|
||||
}
|
||||
const parentID = objct.ParentID;
|
||||
if (this.objectsByParent[parentID])
|
||||
{
|
||||
const ind = this.objectsByParent[parentID].indexOf(objectID);
|
||||
if (ind !== -1)
|
||||
{
|
||||
this.objectsByParent[parentID].splice(ind, 1);
|
||||
}
|
||||
}
|
||||
delete this.objects[objectID];
|
||||
}
|
||||
}
|
||||
|
||||
readExtraParams(buf: Buffer, pos: number, o: GameObjectLite): number
|
||||
{
|
||||
if (pos >= buf.length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const extraParamCount = buf.readUInt8(pos++);
|
||||
for (let k = 0; k < extraParamCount; k++)
|
||||
{
|
||||
const type: ExtraParamType = buf.readUInt16LE(pos);
|
||||
pos = pos + 2;
|
||||
const paramLength = buf.readUInt32LE(pos);
|
||||
pos = pos + 4;
|
||||
|
||||
// TODO: Read extra param data
|
||||
pos += paramLength;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
getObjectsByParent(parentID: number): GameObjectLite[]
|
||||
{
|
||||
const list = this.objectsByParent[parentID];
|
||||
if (list === undefined)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
const result: GameObjectLite[] = [];
|
||||
list.forEach((localID) =>
|
||||
{
|
||||
result.push(this.objects[localID]);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
parseNameValues(str: string): { [key: string]: NameValue }
|
||||
{
|
||||
const nv: { [key: string]: NameValue } = {};
|
||||
const lines = str.split('\n');
|
||||
lines.forEach((line) =>
|
||||
{
|
||||
if (line.length > 0)
|
||||
{
|
||||
let kv = line.split(/[\t ]/);
|
||||
if (kv.length > 5)
|
||||
{
|
||||
for (let x = 5; x < kv.length; x++)
|
||||
{
|
||||
kv[4] += ' ' + kv[x];
|
||||
}
|
||||
kv = kv.slice(0, 5);
|
||||
}
|
||||
if (kv.length === 5)
|
||||
{
|
||||
const namevalue = new NameValue();
|
||||
namevalue.type = kv[1];
|
||||
namevalue.class = kv[2];
|
||||
namevalue.sendTo = kv[3];
|
||||
namevalue.value = kv[4];
|
||||
nv[kv[0]] = namevalue;
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('namevalue unexpected length: ' + kv.length);
|
||||
console.log(kv);
|
||||
}
|
||||
}
|
||||
});
|
||||
return nv;
|
||||
}
|
||||
|
||||
shutdown()
|
||||
{
|
||||
this.objects = {};
|
||||
this.objectsByUUID = {};
|
||||
this.objectsByParent = {};
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,37 @@
|
||||
import {Circuit} from './Circuit';
|
||||
import {ObjectStore} from './ObjectStore';
|
||||
import {Agent} from './Agent';
|
||||
import {Caps} from './Caps';
|
||||
import {Comms} from './Comms';
|
||||
import {ClientEvents} from './ClientEvents';
|
||||
import {IObjectStore} from './interfaces/IObjectStore';
|
||||
import {ObjectStoreFull} from './ObjectStoreFull';
|
||||
import {BotOptionFlags} from '../enums/BotOptionFlags';
|
||||
import {ObjectStoreLite} from './ObjectStoreLite';
|
||||
|
||||
export class Region
|
||||
{
|
||||
xCoordinate: number;
|
||||
yCoordinate: number;
|
||||
circuit: Circuit;
|
||||
objects: ObjectStore;
|
||||
objects: IObjectStore;
|
||||
caps: Caps;
|
||||
comms: Comms;
|
||||
clientEvents: ClientEvents;
|
||||
options: BotOptionFlags;
|
||||
|
||||
constructor(agent: Agent, clientEvents: ClientEvents)
|
||||
constructor(agent: Agent, clientEvents: ClientEvents, options: BotOptionFlags)
|
||||
{
|
||||
this.options = options;
|
||||
this.clientEvents = clientEvents;
|
||||
this.circuit = new Circuit(clientEvents);
|
||||
this.objects = new ObjectStore(this.circuit, agent, clientEvents);
|
||||
if (options & BotOptionFlags.LiteObjectStore)
|
||||
{
|
||||
this.objects = new ObjectStoreLite(this.circuit, agent, clientEvents);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.objects = new ObjectStoreFull(this.circuit, agent, clientEvents);
|
||||
}
|
||||
this.comms = new Comms(this.circuit, agent, clientEvents);
|
||||
}
|
||||
activateCaps(seedURL: string)
|
||||
|
||||
@@ -56,7 +56,7 @@ export class TeleportCommands extends CommandsBase
|
||||
|
||||
// Successful teleport! First, rip apart circuit
|
||||
this.currentRegion.shutdown();
|
||||
const region: Region = new Region(this.agent, this.bot.clientEvents);
|
||||
const region: Region = new Region(this.agent, this.bot.clientEvents, this.currentRegion.options);
|
||||
region.circuit.circuitCode = this.currentRegion.circuit.circuitCode;
|
||||
region.circuit.secureSessionID = this.currentRegion.circuit.secureSessionID;
|
||||
region.circuit.sessionID = this.currentRegion.circuit.sessionID;
|
||||
|
||||
5
lib/classes/interfaces/IGameObject.ts
Normal file
5
lib/classes/interfaces/IGameObject.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface IGameObject
|
||||
{
|
||||
hasNameValueEntry(key: string): boolean;
|
||||
getNameValueEntry(key: string): string;
|
||||
}
|
||||
7
lib/classes/interfaces/IObjectStore.ts
Normal file
7
lib/classes/interfaces/IObjectStore.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import {IGameObject} from './IGameObject';
|
||||
|
||||
export interface IObjectStore
|
||||
{
|
||||
getObjectsByParent(parentID: number): IGameObject[];
|
||||
shutdown(): void;
|
||||
}
|
||||
5
lib/enums/BotOptionFlags.ts
Normal file
5
lib/enums/BotOptionFlags.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export enum BotOptionFlags
|
||||
{
|
||||
None = 0,
|
||||
LiteObjectStore = 1
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {HTTPAssets} from './enums/HTTPAssets';
|
||||
import {InstantMessageEventFlags} from './enums/InstantMessageEventFlags';
|
||||
import {InstantMessageEvent} from './events/InstantMessageEvent';
|
||||
import {ChatSourceType} from './enums/ChatSourceType';
|
||||
import {BotOptionFlags} from './enums/BotOptionFlags';
|
||||
|
||||
export {
|
||||
Bot,
|
||||
@@ -21,5 +22,6 @@ export {
|
||||
BVH,
|
||||
InstantMessageEvent,
|
||||
InstantMessageEventFlags,
|
||||
ChatSourceType
|
||||
ChatSourceType,
|
||||
BotOptionFlags
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user