@caspertech/node-metaverse 0.7.50 → 0.7.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/Camera/Camera.js +3 -14
- package/dist/examples/Camera/Camera.js.map +1 -1
- package/dist/examples/ExampleBot.js +66 -87
- package/dist/examples/ExampleBot.js.map +1 -1
- package/dist/examples/Friends/Friends.js +29 -44
- package/dist/examples/Friends/Friends.js.map +1 -1
- package/dist/examples/Grid/Name2Key.js +25 -36
- package/dist/examples/Grid/Name2Key.js.map +1 -1
- package/dist/examples/Groups/Group.js +42 -55
- package/dist/examples/Groups/Group.js.map +1 -1
- package/dist/examples/Groups/GroupChat.js +55 -68
- package/dist/examples/Groups/GroupChat.js.map +1 -1
- package/dist/examples/InstantMessages/InstantMessages.js +8 -21
- package/dist/examples/InstantMessages/InstantMessages.js.map +1 -1
- package/dist/examples/Inventory/Inventory.js +80 -97
- package/dist/examples/Inventory/Inventory.js.map +1 -1
- package/dist/examples/MFA/MFA.js +24 -40
- package/dist/examples/MFA/MFA.js.map +1 -1
- package/dist/examples/Money/Money.js +28 -41
- package/dist/examples/Money/Money.js.map +1 -1
- package/dist/examples/Objects/TaskInventory.js +13 -24
- package/dist/examples/Objects/TaskInventory.js.map +1 -1
- package/dist/examples/Region/Agents.js +6 -17
- package/dist/examples/Region/Agents.js.map +1 -1
- package/dist/examples/Region/Estate.js +9 -20
- package/dist/examples/Region/Estate.js.map +1 -1
- package/dist/examples/Region/Parcels.js +12 -23
- package/dist/examples/Region/Parcels.js.map +1 -1
- package/dist/examples/Region/Region.js +2 -13
- package/dist/examples/Region/Region.js.map +1 -1
- package/dist/examples/Region/Settings.js +15 -0
- package/dist/examples/Region/Settings.js.map +1 -0
- package/dist/examples/Teleports/Teleports.js +22 -35
- package/dist/examples/Teleports/Teleports.js.map +1 -1
- package/dist/lib/Bot.d.ts +14 -14
- package/dist/lib/Bot.js +217 -231
- package/dist/lib/Bot.js.map +1 -1
- package/dist/lib/LoginHandler.d.ts +3 -3
- package/dist/lib/LoginHandler.js +106 -116
- package/dist/lib/LoginHandler.js.map +1 -1
- package/dist/lib/classes/Agent.d.ts +23 -35
- package/dist/lib/classes/Agent.js +96 -108
- package/dist/lib/classes/Agent.js.map +1 -1
- package/dist/lib/classes/AssetMap.d.ts +18 -95
- package/dist/lib/classes/AssetMap.js +86 -16
- package/dist/lib/classes/AssetMap.js.map +1 -1
- package/dist/lib/classes/AssetRegistry.d.ts +31 -0
- package/dist/lib/classes/AssetRegistry.js +26 -0
- package/dist/lib/classes/AssetRegistry.js.map +1 -0
- package/dist/lib/classes/AssetTypeRegistry.d.ts +21 -0
- package/dist/lib/classes/AssetTypeRegistry.js +81 -0
- package/dist/lib/classes/AssetTypeRegistry.js.map +1 -0
- package/dist/lib/classes/BVH.js.map +1 -1
- package/dist/lib/classes/BVHJoint.js.map +1 -1
- package/dist/lib/classes/BVHJointKeyframe.d.ts +1 -1
- package/dist/lib/classes/BatchQueue.d.ts +2 -2
- package/dist/lib/classes/BatchQueue.js +66 -80
- package/dist/lib/classes/BatchQueue.js.map +1 -1
- package/dist/lib/classes/BatchQueue.spec.js +17 -26
- package/dist/lib/classes/BatchQueue.spec.js.map +1 -1
- package/dist/lib/classes/BinaryReader.d.ts +66 -0
- package/dist/lib/classes/BinaryReader.js +304 -0
- package/dist/lib/classes/BinaryReader.js.map +1 -0
- package/dist/lib/classes/BinaryReader.spec.js +241 -0
- package/dist/lib/classes/BinaryReader.spec.js.map +1 -0
- package/dist/lib/classes/BinaryWriter.d.ts +34 -0
- package/dist/lib/classes/BinaryWriter.js +192 -0
- package/dist/lib/classes/BinaryWriter.js.map +1 -0
- package/dist/lib/classes/BinaryWriter.spec.d.ts +1 -0
- package/dist/lib/classes/BinaryWriter.spec.js +328 -0
- package/dist/lib/classes/BinaryWriter.spec.js.map +1 -0
- package/dist/lib/classes/BitPack.d.ts +2 -2
- package/dist/lib/classes/BitPack.js +1 -1
- package/dist/lib/classes/BitPack.js.map +1 -1
- package/dist/lib/classes/BuildMap.d.ts +6 -6
- package/dist/lib/classes/BuildMap.js.map +1 -1
- package/dist/lib/classes/Caps.d.ts +18 -24
- package/dist/lib/classes/Caps.js +278 -297
- package/dist/lib/classes/Caps.js.map +1 -1
- package/dist/lib/classes/Circuit.d.ts +20 -28
- package/dist/lib/classes/Circuit.js +104 -91
- package/dist/lib/classes/Circuit.js.map +1 -1
- package/dist/lib/classes/ClientCommands.d.ts +3 -3
- package/dist/lib/classes/ClientCommands.js.map +1 -1
- package/dist/lib/classes/ClientEvents.d.ts +41 -32
- package/dist/lib/classes/ClientEvents.js +65 -0
- package/dist/lib/classes/ClientEvents.js.map +1 -1
- package/dist/lib/classes/CoalescedGameObject.d.ts +2 -2
- package/dist/lib/classes/CoalescedGameObject.js +37 -49
- package/dist/lib/classes/CoalescedGameObject.js.map +1 -1
- package/dist/lib/classes/Color4.d.ts +2 -2
- package/dist/lib/classes/Color4.js +42 -42
- package/dist/lib/classes/Color4.js.map +1 -1
- package/dist/lib/classes/Comms.d.ts +3 -3
- package/dist/lib/classes/Comms.js +236 -236
- package/dist/lib/classes/Comms.js.map +1 -1
- package/dist/lib/classes/ConcurrentQueue.d.ts +3 -3
- package/dist/lib/classes/ConcurrentQueue.js +16 -11
- package/dist/lib/classes/ConcurrentQueue.js.map +1 -1
- package/dist/lib/classes/EventQueueClient.d.ts +6 -6
- package/dist/lib/classes/EventQueueClient.js +189 -201
- package/dist/lib/classes/EventQueueClient.js.map +1 -1
- package/dist/lib/classes/GroupBan.d.ts +3 -3
- package/dist/lib/classes/GroupBan.js.map +1 -1
- package/dist/lib/classes/GroupMember.d.ts +2 -2
- package/dist/lib/classes/GroupRole.d.ts +2 -2
- package/dist/lib/classes/IPAddress.d.ts +3 -2
- package/dist/lib/classes/IPAddress.js +14 -13
- package/dist/lib/classes/IPAddress.js.map +1 -1
- package/dist/lib/classes/Inventory.d.ts +7 -15
- package/dist/lib/classes/Inventory.js +69 -80
- package/dist/lib/classes/Inventory.js.map +1 -1
- package/dist/lib/classes/InventoryFolder.d.ts +11 -11
- package/dist/lib/classes/InventoryFolder.js +539 -601
- package/dist/lib/classes/InventoryFolder.js.map +1 -1
- package/dist/lib/classes/InventoryItem.d.ts +15 -11
- package/dist/lib/classes/InventoryItem.js +494 -486
- package/dist/lib/classes/InventoryItem.js.map +1 -1
- package/dist/lib/classes/InventoryTypeRegistry.d.ts +19 -0
- package/dist/lib/classes/InventoryTypeRegistry.js +69 -0
- package/dist/lib/classes/InventoryTypeRegistry.js.map +1 -0
- package/dist/lib/classes/LLGLTFMaterial.d.ts +1 -1
- package/dist/lib/classes/LLGLTFMaterial.js +2 -2
- package/dist/lib/classes/LLGLTFMaterial.js.map +1 -1
- package/dist/lib/classes/LLGLTFMaterial.spec.js +17 -18
- package/dist/lib/classes/LLGLTFMaterial.spec.js.map +1 -1
- package/dist/lib/classes/LLGLTFMaterialOverride.d.ts +1 -1
- package/dist/lib/classes/LLGLTFMaterialOverride.js +119 -118
- package/dist/lib/classes/LLGLTFMaterialOverride.js.map +1 -1
- package/dist/lib/classes/LLGLTFMaterialOverride.spec.js +70 -71
- package/dist/lib/classes/LLGLTFMaterialOverride.spec.js.map +1 -1
- package/dist/lib/classes/LLGesture.d.ts +1 -1
- package/dist/lib/classes/LLGesture.js +1 -1
- package/dist/lib/classes/LLGesture.js.map +1 -1
- package/dist/lib/classes/LLGestureAnimationStep.d.ts +1 -1
- package/dist/lib/classes/LLGestureAnimationStep.js.map +1 -1
- package/dist/lib/classes/LLGestureChatStep.js.map +1 -1
- package/dist/lib/classes/LLGestureSoundStep.d.ts +1 -1
- package/dist/lib/classes/LLGestureSoundStep.js.map +1 -1
- package/dist/lib/classes/LLGestureStep.d.ts +1 -1
- package/dist/lib/classes/LLGestureWaitStep.js.map +1 -1
- package/dist/lib/classes/LLLindenText.d.ts +2 -4
- package/dist/lib/classes/LLLindenText.js +12 -8
- package/dist/lib/classes/LLLindenText.js.map +1 -1
- package/dist/lib/classes/LLSettings.d.ts +98 -83
- package/dist/lib/classes/LLSettings.js +240 -83
- package/dist/lib/classes/LLSettings.js.map +1 -1
- package/dist/lib/classes/LLSettings.spec.d.ts +1 -0
- package/dist/lib/classes/LLSettings.spec.js +27 -0
- package/dist/lib/classes/LLSettings.spec.js.map +1 -0
- package/dist/lib/classes/LLWearable.d.ts +4 -8
- package/dist/lib/classes/LLWearable.js +1 -1
- package/dist/lib/classes/LLWearable.js.map +1 -1
- package/dist/lib/classes/Logger.d.ts +3 -3
- package/dist/lib/classes/Logger.js +1 -1
- package/dist/lib/classes/Logger.js.map +1 -1
- package/dist/lib/classes/LoginParameters.js.map +1 -1
- package/dist/lib/classes/LoginResponse.d.ts +4 -9
- package/dist/lib/classes/LoginResponse.js +120 -113
- package/dist/lib/classes/LoginResponse.js.map +1 -1
- package/dist/lib/classes/MapBlock.d.ts +2 -2
- package/dist/lib/classes/MessageBase.d.ts +5 -5
- package/dist/lib/classes/MessageClasses.js.map +1 -1
- package/dist/lib/classes/ObjectResolver.d.ts +6 -6
- package/dist/lib/classes/ObjectResolver.js +127 -152
- package/dist/lib/classes/ObjectResolver.js.map +1 -1
- package/dist/lib/classes/ObjectStoreFull.d.ts +9 -9
- package/dist/lib/classes/ObjectStoreFull.js +176 -192
- package/dist/lib/classes/ObjectStoreFull.js.map +1 -1
- package/dist/lib/classes/ObjectStoreLite.d.ts +29 -31
- package/dist/lib/classes/ObjectStoreLite.js +485 -494
- package/dist/lib/classes/ObjectStoreLite.js.map +1 -1
- package/dist/lib/classes/Packet.d.ts +2 -2
- package/dist/lib/classes/Packet.js +2 -2
- package/dist/lib/classes/Packet.js.map +1 -1
- package/dist/lib/classes/ParticleSystem.js +1 -1
- package/dist/lib/classes/ParticleSystem.js.map +1 -1
- package/dist/lib/classes/PrimFacesHelper.d.ts +14 -0
- package/dist/lib/classes/PrimFacesHelper.js +75 -0
- package/dist/lib/classes/PrimFacesHelper.js.map +1 -0
- package/dist/lib/classes/Quaternion.d.ts +31 -6
- package/dist/lib/classes/Quaternion.js +236 -48
- package/dist/lib/classes/Quaternion.js.map +1 -1
- package/dist/lib/classes/Region.d.ts +22 -22
- package/dist/lib/classes/Region.js +449 -526
- package/dist/lib/classes/Region.js.map +1 -1
- package/dist/lib/classes/TarArchive.d.ts +1 -1
- package/dist/lib/classes/TarArchive.js.map +1 -1
- package/dist/lib/classes/TarFile.js +1 -1
- package/dist/lib/classes/TarFile.js.map +1 -1
- package/dist/lib/classes/TarReader.d.ts +1 -2
- package/dist/lib/classes/TarReader.js +15 -17
- package/dist/lib/classes/TarReader.js.map +1 -1
- package/dist/lib/classes/TarWriter.d.ts +1 -1
- package/dist/lib/classes/TarWriter.js +51 -68
- package/dist/lib/classes/TarWriter.js.map +1 -1
- package/dist/lib/classes/TextureEntry.d.ts +2 -3
- package/dist/lib/classes/TextureEntry.js +12 -12
- package/dist/lib/classes/TextureEntry.js.map +1 -1
- package/dist/lib/classes/TextureEntryFace.d.ts +4 -4
- package/dist/lib/classes/TextureEntryFace.js.map +1 -1
- package/dist/lib/classes/UUID.d.ts +2 -2
- package/dist/lib/classes/UUID.js +28 -28
- package/dist/lib/classes/UUID.js.map +1 -1
- package/dist/lib/classes/Utils.d.ts +2 -11
- package/dist/lib/classes/Utils.js +72 -328
- package/dist/lib/classes/Utils.js.map +1 -1
- package/dist/lib/classes/Vector2.d.ts +35 -6
- package/dist/lib/classes/Vector2.js +192 -28
- package/dist/lib/classes/Vector2.js.map +1 -1
- package/dist/lib/classes/Vector3.d.ts +38 -6
- package/dist/lib/classes/Vector3.js +229 -48
- package/dist/lib/classes/Vector3.js.map +1 -1
- package/dist/lib/classes/Vector4.d.ts +36 -6
- package/dist/lib/classes/Vector4.js +225 -21
- package/dist/lib/classes/Vector4.js.map +1 -1
- package/dist/lib/classes/Wearable.d.ts +1 -1
- package/dist/lib/classes/Zerocoder.js +2 -2
- package/dist/lib/classes/Zerocoder.js.map +1 -1
- package/dist/lib/classes/commands/AgentCommands.d.ts +7 -5
- package/dist/lib/classes/commands/AgentCommands.js +60 -76
- package/dist/lib/classes/commands/AgentCommands.js.map +1 -1
- package/dist/lib/classes/commands/AssetCommands.d.ts +5 -10
- package/dist/lib/classes/commands/AssetCommands.js +176 -179
- package/dist/lib/classes/commands/AssetCommands.js.map +1 -1
- package/dist/lib/classes/commands/CommandsBase.d.ts +4 -4
- package/dist/lib/classes/commands/CommandsBase.js.map +1 -1
- package/dist/lib/classes/commands/CommunicationsCommands.d.ts +3 -3
- package/dist/lib/classes/commands/CommunicationsCommands.js +350 -426
- package/dist/lib/classes/commands/CommunicationsCommands.js.map +1 -1
- package/dist/lib/classes/commands/FriendCommands.d.ts +9 -10
- package/dist/lib/classes/commands/FriendCommands.js +238 -236
- package/dist/lib/classes/commands/FriendCommands.js.map +1 -1
- package/dist/lib/classes/commands/GridCommands.d.ts +3 -3
- package/dist/lib/classes/commands/GridCommands.js +299 -336
- package/dist/lib/classes/commands/GridCommands.js.map +1 -1
- package/dist/lib/classes/commands/GroupCommands.d.ts +2 -2
- package/dist/lib/classes/commands/GroupCommands.js +293 -336
- package/dist/lib/classes/commands/GroupCommands.js.map +1 -1
- package/dist/lib/classes/commands/InventoryCommands.d.ts +4 -4
- package/dist/lib/classes/commands/InventoryCommands.js +54 -69
- package/dist/lib/classes/commands/InventoryCommands.js.map +1 -1
- package/dist/lib/classes/commands/MovementCommands.d.ts +2 -2
- package/dist/lib/classes/commands/MovementCommands.js +23 -38
- package/dist/lib/classes/commands/MovementCommands.js.map +1 -1
- package/dist/lib/classes/commands/NetworkCommands.js +35 -46
- package/dist/lib/classes/commands/NetworkCommands.js.map +1 -1
- package/dist/lib/classes/commands/ParcelCommands.d.ts +4 -4
- package/dist/lib/classes/commands/ParcelCommands.js +64 -77
- package/dist/lib/classes/commands/ParcelCommands.js.map +1 -1
- package/dist/lib/classes/commands/RegionCommands.d.ts +11 -10
- package/dist/lib/classes/commands/RegionCommands.js +1126 -1211
- package/dist/lib/classes/commands/RegionCommands.js.map +1 -1
- package/dist/lib/classes/commands/TeleportCommands.d.ts +8 -8
- package/dist/lib/classes/commands/TeleportCommands.js +58 -58
- package/dist/lib/classes/commands/TeleportCommands.js.map +1 -1
- package/dist/lib/classes/interfaces/IGameObjectData.d.ts +18 -20
- package/dist/lib/classes/interfaces/ILandBlock.d.ts +2 -2
- package/dist/lib/classes/interfaces/IObjectStore.d.ts +12 -12
- package/dist/lib/classes/interfaces/IResolveJob.d.ts +2 -2
- package/dist/lib/classes/interfaces/ITreeBoundingBox.d.ts +2 -2
- package/dist/lib/classes/llsd/LLSD.d.ts +12 -0
- package/dist/lib/classes/llsd/LLSD.js +128 -0
- package/dist/lib/classes/llsd/LLSD.js.map +1 -0
- package/dist/lib/classes/llsd/LLSD.spec.d.ts +1 -0
- package/dist/lib/classes/llsd/LLSD.spec.js +249 -0
- package/dist/lib/classes/llsd/LLSD.spec.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDArray.d.ts +26 -3
- package/dist/lib/classes/llsd/LLSDArray.js +182 -6
- package/dist/lib/classes/llsd/LLSDArray.js.map +1 -1
- package/dist/lib/classes/llsd/LLSDBinary.d.ts +7 -0
- package/dist/lib/classes/llsd/LLSDBinary.js +114 -0
- package/dist/lib/classes/llsd/LLSDBinary.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDInteger.d.ts +9 -0
- package/dist/lib/classes/llsd/LLSDInteger.js +25 -0
- package/dist/lib/classes/llsd/LLSDInteger.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDMap.d.ts +16 -5
- package/dist/lib/classes/llsd/LLSDMap.js +197 -16
- package/dist/lib/classes/llsd/LLSDMap.js.map +1 -1
- package/dist/lib/classes/llsd/LLSDNotation.d.ts +11 -0
- package/dist/lib/classes/llsd/LLSDNotation.js +271 -0
- package/dist/lib/classes/llsd/LLSDNotation.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDReal.d.ts +10 -0
- package/dist/lib/classes/llsd/LLSDReal.js +71 -0
- package/dist/lib/classes/llsd/LLSDReal.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDToken.d.ts +1 -1
- package/dist/lib/classes/llsd/LLSDTokenContainer.d.ts +2 -2
- package/dist/lib/classes/llsd/LLSDTokenGenerator.d.ts +1 -1
- package/dist/lib/classes/llsd/LLSDTokenSpec.d.ts +1 -1
- package/dist/lib/classes/llsd/LLSDTokenType.d.ts +18 -18
- package/dist/lib/classes/llsd/LLSDTokenType.js +18 -18
- package/dist/lib/classes/llsd/LLSDTokenType.js.map +1 -1
- package/dist/lib/classes/llsd/LLSDType.d.ts +6 -3
- package/dist/lib/classes/llsd/LLSDURI.d.ts +7 -0
- package/dist/lib/classes/llsd/LLSDURI.js +19 -0
- package/dist/lib/classes/llsd/LLSDURI.js.map +1 -0
- package/dist/lib/classes/llsd/LLSDXML.d.ts +5 -0
- package/dist/lib/classes/llsd/LLSDXML.js +245 -0
- package/dist/lib/classes/llsd/LLSDXML.js.map +1 -0
- package/dist/lib/classes/messages/ObjectUpdate.d.ts +4 -5
- package/dist/lib/classes/messages/ObjectUpdate.js +115 -115
- package/dist/lib/classes/messages/ObjectUpdate.js.map +1 -1
- package/dist/lib/classes/messages/SimStats.d.ts +3 -2
- package/dist/lib/classes/messages/SimStats.js +17 -17
- package/dist/lib/classes/messages/SimStats.js.map +1 -1
- package/dist/lib/classes/public/Avatar.d.ts +4 -4
- package/dist/lib/classes/public/Avatar.js +39 -33
- package/dist/lib/classes/public/Avatar.js.map +1 -1
- package/dist/lib/classes/public/AvatarQueryResult.d.ts +4 -4
- package/dist/lib/classes/public/AvatarQueryResult.js.map +1 -1
- package/dist/lib/classes/public/ExtendedMeshData.d.ts +1 -1
- package/dist/lib/classes/public/ExtendedMeshData.js.map +1 -1
- package/dist/lib/classes/public/ExtraParams.d.ts +6 -6
- package/dist/lib/classes/public/ExtraParams.js +36 -39
- package/dist/lib/classes/public/ExtraParams.js.map +1 -1
- package/dist/lib/classes/public/ExtraParams.spec.js +2 -11
- package/dist/lib/classes/public/ExtraParams.spec.js.map +1 -1
- package/dist/lib/classes/public/FlexibleData.js.map +1 -1
- package/dist/lib/classes/public/Friend.js.map +1 -1
- package/dist/lib/classes/public/GameObject.d.ts +23 -21
- package/dist/lib/classes/public/GameObject.js +1294 -1306
- package/dist/lib/classes/public/GameObject.js.map +1 -1
- package/dist/lib/classes/public/GameObject.spec.js +8 -18
- package/dist/lib/classes/public/GameObject.spec.js.map +1 -1
- package/dist/lib/classes/public/LLMesh.d.ts +5 -7
- package/dist/lib/classes/public/LLMesh.js +194 -213
- package/dist/lib/classes/public/LLMesh.js.map +1 -1
- package/dist/lib/classes/public/LightData.js.map +1 -1
- package/dist/lib/classes/public/LightImageData.js.map +1 -1
- package/dist/lib/classes/public/Material.js +45 -56
- package/dist/lib/classes/public/Material.js.map +1 -1
- package/dist/lib/classes/public/MeshData.js.map +1 -1
- package/dist/lib/classes/public/Parcel.d.ts +4 -4
- package/dist/lib/classes/public/Parcel.js +1 -2
- package/dist/lib/classes/public/Parcel.js.map +1 -1
- package/dist/lib/classes/public/ReflectionProbeData.d.ts +1 -1
- package/dist/lib/classes/public/ReflectionProbeData.js.map +1 -1
- package/dist/lib/classes/public/RegionEnvironment.d.ts +14 -13
- package/dist/lib/classes/public/RegionEnvironment.js +94 -53
- package/dist/lib/classes/public/RegionEnvironment.js.map +1 -1
- package/dist/lib/classes/public/RegionEnvironmentSky.d.ts +2 -0
- package/dist/lib/classes/public/RegionEnvironmentSky.js +7 -0
- package/dist/lib/classes/public/RegionEnvironmentSky.js.map +1 -0
- package/dist/lib/classes/public/RegionEnvironmentWater.d.ts +2 -0
- package/dist/lib/classes/public/RegionEnvironmentWater.js +7 -0
- package/dist/lib/classes/public/RegionEnvironmentWater.js.map +1 -0
- package/dist/lib/classes/public/RenderMaterialData.js.map +1 -1
- package/dist/lib/classes/public/RenderMaterialParam.d.ts +1 -1
- package/dist/lib/classes/public/SculptData.js.map +1 -1
- package/dist/lib/classes/public/TextureAnim.js +2 -1
- package/dist/lib/classes/public/TextureAnim.js.map +1 -1
- package/dist/lib/classes/public/interfaces/GlobalPosition.d.ts +1 -1
- package/dist/lib/classes/public/interfaces/LLPhysicsConvex.d.ts +1 -1
- package/dist/lib/classes/public/interfaces/LLSkin.d.ts +1 -1
- package/dist/lib/classes/public/interfaces/LLSubMesh.d.ts +3 -5
- package/dist/lib/classes/public/interfaces/MapLocation.d.ts +3 -3
- package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.d.ts +26 -0
- package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.js +3 -0
- package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.js.map +1 -0
- package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.d.ts +15 -0
- package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.js +3 -0
- package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.js.map +1 -0
- package/dist/lib/classes/public/interfaces/SkyPreset.d.ts +3 -3
- package/dist/lib/classes/public/interfaces/WaterPreset.d.ts +4 -4
- package/dist/lib/deviceToken.json +1 -0
- package/dist/lib/enums/AssetType.d.ts +6 -4
- package/dist/lib/enums/AssetType.js +5 -3
- package/dist/lib/enums/AssetType.js.map +1 -1
- package/dist/lib/enums/AttachmentPoint.d.ts +0 -1
- package/dist/lib/enums/AttachmentPoint.js +0 -1
- package/dist/lib/enums/AttachmentPoint.js.map +1 -1
- package/dist/lib/enums/InventoryType.d.ts +3 -5
- package/dist/lib/enums/InventoryType.js +2 -4
- package/dist/lib/enums/InventoryType.js.map +1 -1
- package/dist/lib/enums/LayerType.d.ts +1 -1
- package/dist/lib/enums/LayerType.js +1 -1
- package/dist/lib/events/AvatarPropertiesReplyEvent.d.ts +1 -1
- package/dist/lib/events/BalanceUpdatedEvent.d.ts +2 -2
- package/dist/lib/events/BulkUpdateInventoryEvent.d.ts +2 -2
- package/dist/lib/events/BulkUpdateInventoryEvent.js.map +1 -1
- package/dist/lib/events/ChatEvent.d.ts +5 -5
- package/dist/lib/events/FriendOnlineEvent.d.ts +1 -1
- package/dist/lib/events/FriendRemovedEvent.d.ts +1 -1
- package/dist/lib/events/FriendRequestEvent.d.ts +1 -1
- package/dist/lib/events/FriendResponseEvent.d.ts +1 -1
- package/dist/lib/events/FriendRightsEvent.d.ts +2 -2
- package/dist/lib/events/GroupChatClosedEvent.d.ts +1 -1
- package/dist/lib/events/GroupChatEvent.d.ts +1 -1
- package/dist/lib/events/GroupChatSessionAgentListEvent.d.ts +1 -1
- package/dist/lib/events/GroupChatSessionJoinEvent.d.ts +1 -1
- package/dist/lib/events/GroupInviteEvent.d.ts +1 -1
- package/dist/lib/events/GroupNoticeEvent.d.ts +1 -1
- package/dist/lib/events/GroupProfileReplyEvent.d.ts +2 -2
- package/dist/lib/events/InstantMessageEvent.d.ts +3 -3
- package/dist/lib/events/InventoryOfferedEvent.d.ts +3 -3
- package/dist/lib/events/InventoryResponseEvent.d.ts +1 -1
- package/dist/lib/events/LandStatsEvent.d.ts +4 -4
- package/dist/lib/events/LandStatsEvent.js.map +1 -1
- package/dist/lib/events/LureEvent.d.ts +2 -2
- package/dist/lib/events/MapInfoRangeReplyEvent.d.ts +1 -1
- package/dist/lib/events/MapInfoReplyEvent.d.ts +2 -2
- package/dist/lib/events/NewObjectEvent.d.ts +2 -2
- package/dist/lib/events/ObjectKilledEvent.d.ts +2 -2
- package/dist/lib/events/ObjectPhysicsDataEvent.d.ts +1 -1
- package/dist/lib/events/ObjectResolvedEvent.d.ts +1 -1
- package/dist/lib/events/ObjectUpdatedEvent.d.ts +2 -2
- package/dist/lib/events/ParcelInfoReplyEvent.d.ts +3 -3
- package/dist/lib/events/ParcelPropertiesEvent.d.ts +3 -3
- package/dist/lib/events/RegionInfoReplyEvent.d.ts +2 -2
- package/dist/lib/events/ScriptDialogEvent.d.ts +1 -1
- package/dist/lib/events/SelectedObjectEvent.d.ts +1 -1
- package/dist/lib/events/TeleportEvent.d.ts +1 -1
- package/dist/lib/index.d.ts +6 -8
- package/dist/lib/index.js +4 -7
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/tsm/common.d.ts +1 -1
- package/dist/lib/tsm/common.js +3 -1
- package/dist/lib/tsm/common.js.map +1 -1
- package/dist/lib/tsm/mat2.d.ts +8 -8
- package/dist/lib/tsm/mat2.js +8 -7
- package/dist/lib/tsm/mat2.js.map +1 -1
- package/dist/lib/tsm/mat3.d.ts +7 -7
- package/dist/lib/tsm/mat3.js +8 -7
- package/dist/lib/tsm/mat3.js.map +1 -1
- package/dist/lib/tsm/mat4.d.ts +9 -9
- package/dist/lib/tsm/mat4.js +8 -7
- package/dist/lib/tsm/mat4.js.map +1 -1
- package/dist/lib/tsm/quat.d.ts +19 -19
- package/dist/lib/tsm/quat.js +69 -68
- package/dist/lib/tsm/quat.js.map +1 -1
- package/dist/lib/tsm/vec2.d.ts +13 -13
- package/dist/lib/tsm/vec2.js +30 -29
- package/dist/lib/tsm/vec2.js.map +1 -1
- package/dist/lib/tsm/vec3.d.ts +16 -16
- package/dist/lib/tsm/vec3.js +48 -47
- package/dist/lib/tsm/vec3.js.map +1 -1
- package/dist/lib/tsm/vec4.d.ts +22 -22
- package/dist/lib/tsm/vec4.js +94 -93
- package/dist/lib/tsm/vec4.js.map +1 -1
- package/eslint.config.mjs +104 -0
- package/examples/Inventory/Inventory.ts +4 -2
- package/examples/Money/Money.ts +6 -6
- package/examples/Objects/TaskInventory.ts +4 -3
- package/examples/Region/Settings.ts +19 -0
- package/package.json +10 -9
- package/.eslintrc +0 -224
- package/dist/lib/classes/llsd/LLSDNotationParser.d.ts +0 -9
- package/dist/lib/classes/llsd/LLSDNotationParser.js +0 -177
- package/dist/lib/classes/llsd/LLSDNotationParser.js.map +0 -1
- package/dist/lib/classes/llsd/LLSDNotationParser.spec.js +0 -167
- package/dist/lib/classes/llsd/LLSDNotationParser.spec.js.map +0 -1
- package/dist/lib/enums/AssetTypeLL.d.ts +0 -27
- package/dist/lib/enums/AssetTypeLL.js +0 -32
- package/dist/lib/enums/AssetTypeLL.js.map +0 -1
- package/dist/lib/enums/HTTPAssets.d.ts +0 -24
- package/dist/lib/enums/HTTPAssets.js +0 -29
- package/dist/lib/enums/HTTPAssets.js.map +0 -1
- package/dist/lib/tsm/test.js +0 -11
- package/dist/lib/tsm/test.js.map +0 -1
- /package/dist/{lib/classes/llsd/LLSDNotationParser.spec.d.ts → examples/Region/Settings.d.ts} +0 -0
- /package/dist/lib/{tsm/test.d.ts → classes/BinaryReader.spec.d.ts} +0 -0
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.GameObject = void 0;
|
|
13
4
|
const Vector3_1 = require("../Vector3");
|
|
@@ -37,7 +28,6 @@ const ProfileShape_1 = require("../../enums/ProfileShape");
|
|
|
37
28
|
const HoleType_1 = require("../../enums/HoleType");
|
|
38
29
|
const SculptType_1 = require("../../enums/SculptType");
|
|
39
30
|
const PacketFlags_1 = require("../../enums/PacketFlags");
|
|
40
|
-
const HTTPAssets_1 = require("../../enums/HTTPAssets");
|
|
41
31
|
const PCode_1 = require("../../enums/PCode");
|
|
42
32
|
const DeRezObject_1 = require("../messages/DeRezObject");
|
|
43
33
|
const DeRezDestination_1 = require("../../enums/DeRezDestination");
|
|
@@ -54,109 +44,1036 @@ const RezScript_1 = require("../messages/RezScript");
|
|
|
54
44
|
const PermissionMask_1 = require("../../enums/PermissionMask");
|
|
55
45
|
const AssetType_1 = require("../../enums/AssetType");
|
|
56
46
|
const LLGLTFMaterialOverride_1 = require("../LLGLTFMaterialOverride");
|
|
47
|
+
const RemoveTaskInventory_1 = require("../messages/RemoveTaskInventory");
|
|
57
48
|
const uuid = require("uuid");
|
|
58
49
|
const Logger_1 = require("../Logger");
|
|
50
|
+
const InventoryTypeRegistry_1 = require("../InventoryTypeRegistry");
|
|
51
|
+
const AssetTypeRegistry_1 = require("../AssetTypeRegistry");
|
|
59
52
|
class GameObject {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
get OwnerID() {
|
|
54
|
+
return this._ownerID;
|
|
55
|
+
}
|
|
56
|
+
set OwnerID(owner) {
|
|
57
|
+
this._ownerID = owner;
|
|
58
|
+
}
|
|
59
|
+
constructor() {
|
|
60
|
+
this.deleted = false;
|
|
61
|
+
this.resolvedInventory = false;
|
|
62
|
+
this.ID = 0;
|
|
63
|
+
this.FullID = UUID_1.UUID.random();
|
|
64
|
+
this._ownerID = UUID_1.UUID.zero();
|
|
65
|
+
this.IsAttachment = false;
|
|
66
|
+
this.NameValue = new Map();
|
|
67
|
+
this.PCode = PCode_1.PCode.None;
|
|
68
|
+
this.attachmentPoint = AttachmentPoint_1.AttachmentPoint.Default;
|
|
69
|
+
this.inventory = [];
|
|
70
|
+
this.resolveAttempts = 0;
|
|
71
|
+
this.childrenPopulated = false;
|
|
72
|
+
this.claimedForBuild = false;
|
|
73
|
+
this.createdSelected = false;
|
|
74
|
+
this.isMarkedRoot = false;
|
|
75
|
+
this.onTextureUpdate = new rxjs_1.Subject();
|
|
76
|
+
this.Position = Vector3_1.Vector3.getZero();
|
|
77
|
+
this.Rotation = Quaternion_1.Quaternion.getIdentity();
|
|
78
|
+
this.AngularVelocity = Vector3_1.Vector3.getZero();
|
|
79
|
+
this.TreeSpecies = 0;
|
|
80
|
+
this.SoundFlags = 0;
|
|
81
|
+
this.SoundRadius = 1.0;
|
|
82
|
+
this.SoundGain = 1.0;
|
|
83
|
+
}
|
|
84
|
+
static async fromXML(xml) {
|
|
85
|
+
let result = null;
|
|
86
|
+
if (typeof xml === 'string') {
|
|
87
|
+
const parsed = await Utils_1.Utils.parseXML(xml);
|
|
88
|
+
if (parsed.SceneObjectGroup === undefined) {
|
|
89
|
+
throw new Error('SceneObjectGroup not found');
|
|
90
|
+
}
|
|
91
|
+
result = parsed.SceneObjectGroup;
|
|
66
92
|
}
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
else {
|
|
94
|
+
result = xml;
|
|
69
95
|
}
|
|
70
|
-
|
|
71
|
-
|
|
96
|
+
let rootPartXML = null;
|
|
97
|
+
if (result.SceneObjectPart !== undefined) {
|
|
98
|
+
rootPartXML = result.SceneObjectPart;
|
|
72
99
|
}
|
|
73
|
-
if (
|
|
74
|
-
|
|
100
|
+
else if (result.RootPart?.[0]?.SceneObjectPart !== undefined) {
|
|
101
|
+
rootPartXML = result.RootPart[0].SceneObjectPart;
|
|
75
102
|
}
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
else {
|
|
104
|
+
throw new Error('Root part not found');
|
|
78
105
|
}
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
const rootPart = GameObject.partFromXMLJS(rootPartXML[0], true);
|
|
107
|
+
rootPart.children = [];
|
|
108
|
+
rootPart.totalChildren = 0;
|
|
109
|
+
if (result.OtherParts !== undefined && Array.isArray(result.OtherParts) && result.OtherParts.length > 0) {
|
|
110
|
+
const [obj] = result.OtherParts;
|
|
111
|
+
if (obj.SceneObjectPart !== undefined || obj.Part !== undefined) {
|
|
112
|
+
if (obj.Part !== undefined) {
|
|
113
|
+
for (const part of obj.Part) {
|
|
114
|
+
rootPart.children.push(GameObject.partFromXMLJS(part.SceneObjectPart[0], false));
|
|
115
|
+
rootPart.totalChildren++;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
for (const part of obj.SceneObjectPart) {
|
|
120
|
+
rootPart.children.push(GameObject.partFromXMLJS(part, false));
|
|
121
|
+
rootPart.totalChildren++;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
81
125
|
}
|
|
82
|
-
|
|
83
|
-
|
|
126
|
+
return rootPart;
|
|
127
|
+
}
|
|
128
|
+
static async deRezObjects(region, objects, destination, transactionID, destFolder) {
|
|
129
|
+
const msg = new DeRezObject_1.DeRezObjectMessage();
|
|
130
|
+
msg.AgentData = {
|
|
131
|
+
AgentID: region.agent.agentID,
|
|
132
|
+
SessionID: region.circuit.sessionID
|
|
133
|
+
};
|
|
134
|
+
msg.AgentBlock = {
|
|
135
|
+
GroupID: UUID_1.UUID.zero(),
|
|
136
|
+
Destination: destination,
|
|
137
|
+
DestinationID: destFolder,
|
|
138
|
+
TransactionID: transactionID,
|
|
139
|
+
PacketCount: 1,
|
|
140
|
+
PacketNumber: 1
|
|
141
|
+
};
|
|
142
|
+
msg.ObjectData = [];
|
|
143
|
+
for (const obj of objects) {
|
|
144
|
+
msg.ObjectData.push({
|
|
145
|
+
ObjectLocalID: obj.ID
|
|
146
|
+
});
|
|
84
147
|
}
|
|
85
|
-
|
|
86
|
-
|
|
148
|
+
const ack = region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
149
|
+
return region.circuit.waitForAck(ack, 10000);
|
|
150
|
+
}
|
|
151
|
+
static async takeManyToInventory(region, objects, folder) {
|
|
152
|
+
const transactionID = UUID_1.UUID.random();
|
|
153
|
+
let enforceFolder = true;
|
|
154
|
+
if (folder === undefined) {
|
|
155
|
+
enforceFolder = false;
|
|
156
|
+
folder = region.agent.inventory.getRootFolderMain();
|
|
87
157
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
158
|
+
if (folder !== undefined) {
|
|
159
|
+
void GameObject.deRezObjects(region, objects, DeRezDestination_1.DeRezDestination.AgentInventoryTake, transactionID, folder.folderID);
|
|
160
|
+
const createInventoryMsg = await region.circuit.waitForMessage(Message_1.Message.UpdateCreateInventoryItem, 20000, (message) => {
|
|
161
|
+
for (const inv of message.InventoryData) {
|
|
162
|
+
const name = Utils_1.Utils.BufferToStringSimple(inv.Name);
|
|
163
|
+
if (name === objects[0].name) {
|
|
164
|
+
return FilterResponse_1.FilterResponse.Finish;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return FilterResponse_1.FilterResponse.NoMatch;
|
|
168
|
+
});
|
|
169
|
+
for (const inv of createInventoryMsg.InventoryData) {
|
|
170
|
+
const name = Utils_1.Utils.BufferToStringSimple(inv.Name);
|
|
171
|
+
if (name === objects[0].name) {
|
|
172
|
+
const itemID = inv.ItemID;
|
|
173
|
+
const item = await region.agent.inventory.fetchInventoryItem(itemID);
|
|
174
|
+
if (item === null) {
|
|
175
|
+
throw new Error('Inventory item was unable to be retrieved after take to inventory');
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
if (enforceFolder && !item.parentID.equals(folder.folderID)) {
|
|
179
|
+
await item.moveToFolder(folder);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return item;
|
|
183
|
+
}
|
|
91
184
|
}
|
|
92
185
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
186
|
+
throw new Error('Failed to take object');
|
|
187
|
+
}
|
|
188
|
+
async waitForTextureUpdate(timeout) {
|
|
189
|
+
await Utils_1.Utils.waitOrTimeOut(this.onTextureUpdate, timeout);
|
|
190
|
+
}
|
|
191
|
+
async rezScript(name, description, perms = 532480) {
|
|
192
|
+
const rezScriptMsg = new RezScript_1.RezScriptMessage();
|
|
193
|
+
rezScriptMsg.AgentData = {
|
|
194
|
+
AgentID: this.region.agent.agentID,
|
|
195
|
+
SessionID: this.region.circuit.sessionID,
|
|
196
|
+
GroupID: this.region.agent.activeGroupID
|
|
197
|
+
};
|
|
198
|
+
rezScriptMsg.UpdateBlock = {
|
|
199
|
+
ObjectLocalID: this.ID,
|
|
200
|
+
Enabled: true
|
|
201
|
+
};
|
|
202
|
+
const tmpName = uuid.v4();
|
|
203
|
+
const invItem = new InventoryItem_1.InventoryItem(this);
|
|
204
|
+
invItem.itemID = UUID_1.UUID.zero();
|
|
205
|
+
invItem.parentID = this.FullID;
|
|
206
|
+
invItem.permissions.creator = this.region.agent.agentID;
|
|
207
|
+
invItem.permissions.group = UUID_1.UUID.zero();
|
|
208
|
+
invItem.permissions.baseMask = PermissionMask_1.PermissionMask.All;
|
|
209
|
+
invItem.permissions.ownerMask = PermissionMask_1.PermissionMask.All;
|
|
210
|
+
invItem.permissions.groupMask = 0;
|
|
211
|
+
invItem.permissions.everyoneMask = 0;
|
|
212
|
+
invItem.permissions.nextOwnerMask = perms;
|
|
213
|
+
invItem.permissions.groupOwned = false;
|
|
214
|
+
invItem.type = AssetType_1.AssetType.LSLText;
|
|
215
|
+
invItem.inventoryType = InventoryType_1.InventoryType.LSL;
|
|
216
|
+
invItem.flags = 0;
|
|
217
|
+
invItem.salePrice = this.salePrice ?? 10;
|
|
218
|
+
invItem.saleType = this.saleType ?? 0;
|
|
219
|
+
invItem.name = tmpName;
|
|
220
|
+
invItem.description = description;
|
|
221
|
+
invItem.created = new Date();
|
|
222
|
+
rezScriptMsg.InventoryBlock = {
|
|
223
|
+
ItemID: UUID_1.UUID.zero(),
|
|
224
|
+
FolderID: this.FullID,
|
|
225
|
+
CreatorID: this.region.agent.agentID,
|
|
226
|
+
OwnerID: this.region.agent.agentID,
|
|
227
|
+
GroupID: UUID_1.UUID.zero(),
|
|
228
|
+
BaseMask: PermissionMask_1.PermissionMask.All,
|
|
229
|
+
OwnerMask: PermissionMask_1.PermissionMask.All,
|
|
230
|
+
GroupMask: 0,
|
|
231
|
+
EveryoneMask: 0,
|
|
232
|
+
NextOwnerMask: perms,
|
|
233
|
+
GroupOwned: false,
|
|
234
|
+
TransactionID: UUID_1.UUID.zero(),
|
|
235
|
+
Type: AssetType_1.AssetType.LSLText,
|
|
236
|
+
InvType: InventoryType_1.InventoryType.LSL,
|
|
237
|
+
Flags: 0,
|
|
238
|
+
SaleType: this.saleType ?? 0,
|
|
239
|
+
SalePrice: this.salePrice ?? 10,
|
|
240
|
+
Name: Utils_1.Utils.StringToBuffer(tmpName),
|
|
241
|
+
Description: Utils_1.Utils.StringToBuffer(description),
|
|
242
|
+
CreationDate: Math.floor(invItem.created.getTime() / 1000),
|
|
243
|
+
CRC: invItem.getCRC()
|
|
244
|
+
};
|
|
245
|
+
await this.region.circuit.waitForAck(this.region.circuit.sendMessage(rezScriptMsg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
246
|
+
await this.updateInventory();
|
|
247
|
+
for (const item of this.inventory) {
|
|
248
|
+
if (item.name === tmpName) {
|
|
249
|
+
void item.rename(name);
|
|
250
|
+
try {
|
|
251
|
+
await this.waitForInventoryUpdate();
|
|
252
|
+
}
|
|
253
|
+
catch (_error) {
|
|
254
|
+
}
|
|
255
|
+
await this.updateInventory();
|
|
256
|
+
for (const newItem of this.inventory) {
|
|
257
|
+
if (newItem.itemID.equals(item.itemID)) {
|
|
258
|
+
return newItem;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return item;
|
|
96
262
|
}
|
|
97
263
|
}
|
|
98
|
-
|
|
99
|
-
|
|
264
|
+
throw new Error('Failed to add script to object');
|
|
265
|
+
}
|
|
266
|
+
async updateInventory() {
|
|
267
|
+
if (this.PCode === PCode_1.PCode.Avatar) {
|
|
268
|
+
return;
|
|
100
269
|
}
|
|
101
|
-
|
|
102
|
-
|
|
270
|
+
try {
|
|
271
|
+
const capURL = await this.region.caps.getCapability('RequestTaskInventory');
|
|
272
|
+
const result = await this.region.caps.capsPerformXMLGet(capURL + '?task_id=' + this.FullID.toString());
|
|
273
|
+
if (result.contents) {
|
|
274
|
+
this.inventory = [];
|
|
275
|
+
for (const item of result.contents) {
|
|
276
|
+
const invItem = new InventoryItem_1.InventoryItem(this, this.region.agent);
|
|
277
|
+
invItem.assetID = new UUID_1.UUID(item.asset_id);
|
|
278
|
+
invItem.created = new Date((item.created_at ?? 0) * 1000);
|
|
279
|
+
invItem.description = item.desc ?? '';
|
|
280
|
+
invItem.flags = item.flags ?? 0;
|
|
281
|
+
const invType = InventoryTypeRegistry_1.InventoryTypeRegistry.getTypeFromTypeName(item.inv_type ?? '');
|
|
282
|
+
if (invType) {
|
|
283
|
+
invItem.inventoryType = invType.type;
|
|
284
|
+
}
|
|
285
|
+
const type = AssetTypeRegistry_1.AssetTypeRegistry.getTypeFromTypeName(item.type ?? '');
|
|
286
|
+
if (type !== undefined) {
|
|
287
|
+
invItem.type = type.type;
|
|
288
|
+
}
|
|
289
|
+
invItem.itemID = new UUID_1.UUID(item.item_id);
|
|
290
|
+
invItem.name = item.name ?? '';
|
|
291
|
+
invItem.parentID = new UUID_1.UUID(item.parent_id);
|
|
292
|
+
invItem.permissions = {
|
|
293
|
+
baseMask: item.permissions?.base_mask ?? 0,
|
|
294
|
+
creator: new UUID_1.UUID(item.permissions?.creator_id),
|
|
295
|
+
everyoneMask: item.permissions?.everyone_mask ?? 0,
|
|
296
|
+
group: new UUID_1.UUID(item.permissions?.group_id),
|
|
297
|
+
groupMask: item.permissions?.group_mask ?? 0,
|
|
298
|
+
groupOwned: item.permissions?.is_owner_group ?? false,
|
|
299
|
+
lastOwner: new UUID_1.UUID(item.permissions?.last_owner_id),
|
|
300
|
+
nextOwnerMask: item.permissions?.next_owner_mask ?? 0,
|
|
301
|
+
owner: new UUID_1.UUID(item.permissions?.owner_id),
|
|
302
|
+
ownerMask: item.permissions?.owner_mask ?? 0
|
|
303
|
+
};
|
|
304
|
+
invItem.salePrice = item.sale_info?.sale_price ?? 0;
|
|
305
|
+
switch (item.sale_info?.sale_type) {
|
|
306
|
+
case 'not':
|
|
307
|
+
invItem.saleType = 0;
|
|
308
|
+
break;
|
|
309
|
+
case 'orig':
|
|
310
|
+
invItem.saleType = 1;
|
|
311
|
+
break;
|
|
312
|
+
case 'copy':
|
|
313
|
+
invItem.saleType = 2;
|
|
314
|
+
break;
|
|
315
|
+
case 'cntn':
|
|
316
|
+
invItem.saleType = 3;
|
|
317
|
+
break;
|
|
318
|
+
case undefined:
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
this.inventory.push(invItem);
|
|
322
|
+
}
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
103
325
|
}
|
|
104
|
-
|
|
105
|
-
go.AngularVelocity = prop;
|
|
326
|
+
catch (_e) {
|
|
106
327
|
}
|
|
107
|
-
|
|
108
|
-
|
|
328
|
+
const req = new RequestTaskInventory_1.RequestTaskInventoryMessage();
|
|
329
|
+
req.AgentData = {
|
|
330
|
+
AgentID: this.region.agent.agentID,
|
|
331
|
+
SessionID: this.region.circuit.sessionID
|
|
332
|
+
};
|
|
333
|
+
req.InventoryData = {
|
|
334
|
+
LocalID: this.ID
|
|
335
|
+
};
|
|
336
|
+
this.region.circuit.sendMessage(req, PacketFlags_1.PacketFlags.Reliable);
|
|
337
|
+
return this.waitForTaskInventory();
|
|
338
|
+
}
|
|
339
|
+
hasNameValueEntry(key) {
|
|
340
|
+
return this.NameValue.has(key);
|
|
341
|
+
}
|
|
342
|
+
getNameValueEntry(key) {
|
|
343
|
+
const entry = this.NameValue.get(key);
|
|
344
|
+
if (entry !== undefined) {
|
|
345
|
+
return entry.value;
|
|
109
346
|
}
|
|
110
|
-
|
|
111
|
-
|
|
347
|
+
return '';
|
|
348
|
+
}
|
|
349
|
+
setIfDefined(def, v) {
|
|
350
|
+
if (def === undefined) {
|
|
351
|
+
def = 0;
|
|
112
352
|
}
|
|
113
|
-
if (
|
|
114
|
-
|
|
353
|
+
if (v === undefined) {
|
|
354
|
+
return def;
|
|
115
355
|
}
|
|
116
|
-
|
|
117
|
-
|
|
356
|
+
else {
|
|
357
|
+
return v;
|
|
118
358
|
}
|
|
119
|
-
|
|
120
|
-
|
|
359
|
+
}
|
|
360
|
+
async setShape(PathCurve, ProfileCurve, PathBegin, PathEnd, PathScaleX, PathScaleY, PathShearX, PathShearY, PathTwist, PathTwistBegin, PathRadiusOffset, PathTaperX, PathTaperY, PathRevolutions, PathSkew, ProfileBegin, ProfileEnd, ProfileHollow) {
|
|
361
|
+
this.PathCurve = this.setIfDefined(this.PathCurve, PathCurve);
|
|
362
|
+
this.ProfileCurve = this.setIfDefined(this.ProfileCurve, ProfileCurve);
|
|
363
|
+
this.PathBegin = this.setIfDefined(this.PathBegin, PathBegin);
|
|
364
|
+
this.PathEnd = this.setIfDefined(this.PathEnd, PathEnd);
|
|
365
|
+
this.PathScaleX = this.setIfDefined(this.PathScaleX, PathScaleX);
|
|
366
|
+
this.PathScaleY = this.setIfDefined(this.PathScaleY, PathScaleY);
|
|
367
|
+
this.PathShearX = this.setIfDefined(this.PathShearX, PathShearX);
|
|
368
|
+
this.PathShearY = this.setIfDefined(this.PathShearY, PathShearY);
|
|
369
|
+
this.PathTwist = this.setIfDefined(this.PathTwist, PathTwist);
|
|
370
|
+
this.PathTwistBegin = this.setIfDefined(this.PathTwistBegin, PathTwistBegin);
|
|
371
|
+
this.PathRadiusOffset = this.setIfDefined(this.PathRadiusOffset, PathRadiusOffset);
|
|
372
|
+
this.PathTaperX = this.setIfDefined(this.PathTaperX, PathTaperX);
|
|
373
|
+
this.PathTaperY = this.setIfDefined(this.PathTaperY, PathTaperY);
|
|
374
|
+
this.PathRevolutions = this.setIfDefined(this.PathRevolutions, PathRevolutions);
|
|
375
|
+
this.PathSkew = this.setIfDefined(this.PathSkew, PathSkew);
|
|
376
|
+
this.ProfileBegin = this.setIfDefined(this.ProfileBegin, ProfileBegin);
|
|
377
|
+
this.ProfileEnd = this.setIfDefined(this.ProfileEnd, ProfileEnd);
|
|
378
|
+
this.ProfileHollow = this.setIfDefined(this.ProfileHollow, ProfileHollow);
|
|
379
|
+
if (this.region === undefined) {
|
|
380
|
+
return;
|
|
121
381
|
}
|
|
122
|
-
|
|
123
|
-
|
|
382
|
+
const msg = new ObjectShape_1.ObjectShapeMessage();
|
|
383
|
+
msg.AgentData = {
|
|
384
|
+
AgentID: this.region.agent.agentID,
|
|
385
|
+
SessionID: this.region.circuit.sessionID
|
|
386
|
+
};
|
|
387
|
+
msg.ObjectData = [
|
|
388
|
+
{
|
|
389
|
+
ObjectLocalID: this.ID,
|
|
390
|
+
PathCurve: this.PathCurve,
|
|
391
|
+
ProfileCurve: this.ProfileCurve,
|
|
392
|
+
PathBegin: Utils_1.Utils.packBeginCut(this.PathBegin),
|
|
393
|
+
PathEnd: Utils_1.Utils.packEndCut(this.PathEnd),
|
|
394
|
+
PathScaleX: Utils_1.Utils.packPathScale(this.PathScaleX),
|
|
395
|
+
PathScaleY: Utils_1.Utils.packPathScale(this.PathScaleY),
|
|
396
|
+
PathShearX: Utils_1.Utils.packPathShear(this.PathShearX),
|
|
397
|
+
PathShearY: Utils_1.Utils.packPathShear(this.PathShearY),
|
|
398
|
+
PathTwist: Utils_1.Utils.packPathTwist(this.PathTwist),
|
|
399
|
+
PathTwistBegin: Utils_1.Utils.packPathTwist(this.PathTwistBegin),
|
|
400
|
+
PathRadiusOffset: Utils_1.Utils.packPathTwist(this.PathRadiusOffset),
|
|
401
|
+
PathTaperX: Utils_1.Utils.packPathTaper(this.PathTaperX),
|
|
402
|
+
PathTaperY: Utils_1.Utils.packPathTaper(this.PathTaperY),
|
|
403
|
+
PathRevolutions: Utils_1.Utils.packPathRevolutions(this.PathRevolutions),
|
|
404
|
+
PathSkew: Utils_1.Utils.packPathTwist(this.PathSkew),
|
|
405
|
+
ProfileBegin: Utils_1.Utils.packBeginCut(this.ProfileBegin),
|
|
406
|
+
ProfileEnd: Utils_1.Utils.packEndCut(this.ProfileEnd),
|
|
407
|
+
ProfileHollow: Utils_1.Utils.packProfileHollow(this.ProfileHollow)
|
|
408
|
+
}
|
|
409
|
+
];
|
|
410
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
411
|
+
}
|
|
412
|
+
async setName(name) {
|
|
413
|
+
this.name = name;
|
|
414
|
+
if (this.region === undefined) {
|
|
415
|
+
return;
|
|
124
416
|
}
|
|
125
|
-
|
|
126
|
-
|
|
417
|
+
const msg = new ObjectName_1.ObjectNameMessage();
|
|
418
|
+
msg.AgentData = {
|
|
419
|
+
AgentID: this.region.agent.agentID,
|
|
420
|
+
SessionID: this.region.circuit.sessionID
|
|
421
|
+
};
|
|
422
|
+
msg.ObjectData = [
|
|
423
|
+
{
|
|
424
|
+
LocalID: this.ID,
|
|
425
|
+
Name: Utils_1.Utils.StringToBuffer(name)
|
|
426
|
+
}
|
|
427
|
+
];
|
|
428
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
429
|
+
}
|
|
430
|
+
async setGeometry(pos, rot, scale, wholeLinkset = false) {
|
|
431
|
+
const data = [];
|
|
432
|
+
const linked = (wholeLinkset) ? UpdateType_1.UpdateType.Linked : 0;
|
|
433
|
+
if (pos !== undefined) {
|
|
434
|
+
this.Position = pos;
|
|
435
|
+
data.push({
|
|
436
|
+
ObjectLocalID: this.ID,
|
|
437
|
+
Type: UpdateType_1.UpdateType.Position | linked,
|
|
438
|
+
Data: pos.getBuffer()
|
|
439
|
+
});
|
|
127
440
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
441
|
+
if (rot !== undefined) {
|
|
442
|
+
this.Rotation = rot;
|
|
443
|
+
data.push({
|
|
444
|
+
ObjectLocalID: this.ID,
|
|
445
|
+
Type: UpdateType_1.UpdateType.Rotation | linked,
|
|
446
|
+
Data: rot.getBuffer()
|
|
447
|
+
});
|
|
130
448
|
}
|
|
131
|
-
if (
|
|
132
|
-
|
|
449
|
+
if (scale !== undefined) {
|
|
450
|
+
this.Scale = scale;
|
|
451
|
+
data.push({
|
|
452
|
+
ObjectLocalID: this.ID,
|
|
453
|
+
Type: UpdateType_1.UpdateType.Scale | linked,
|
|
454
|
+
Data: scale.getBuffer()
|
|
455
|
+
});
|
|
133
456
|
}
|
|
134
|
-
if (
|
|
135
|
-
|
|
457
|
+
if (this.region === undefined || data.length === 0) {
|
|
458
|
+
return;
|
|
136
459
|
}
|
|
137
|
-
|
|
138
|
-
|
|
460
|
+
const msg = new MultipleObjectUpdate_1.MultipleObjectUpdateMessage();
|
|
461
|
+
msg.AgentData = {
|
|
462
|
+
AgentID: this.region.agent.agentID,
|
|
463
|
+
SessionID: this.region.circuit.sessionID
|
|
464
|
+
};
|
|
465
|
+
msg.ObjectData = data;
|
|
466
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 30000);
|
|
467
|
+
}
|
|
468
|
+
async linkTo(rootObj) {
|
|
469
|
+
const msg = new ObjectLink_1.ObjectLinkMessage();
|
|
470
|
+
msg.AgentData = {
|
|
471
|
+
AgentID: this.region.agent.agentID,
|
|
472
|
+
SessionID: this.region.circuit.sessionID
|
|
473
|
+
};
|
|
474
|
+
msg.ObjectData = [
|
|
475
|
+
{
|
|
476
|
+
ObjectLocalID: rootObj.ID
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
ObjectLocalID: this.ID
|
|
480
|
+
}
|
|
481
|
+
];
|
|
482
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 30000);
|
|
483
|
+
}
|
|
484
|
+
async linkFrom(objects) {
|
|
485
|
+
if (objects.length === 0) {
|
|
486
|
+
return;
|
|
139
487
|
}
|
|
140
|
-
|
|
141
|
-
|
|
488
|
+
const primsExpectingUpdate = new Map();
|
|
489
|
+
const msg = new ObjectLink_1.ObjectLinkMessage();
|
|
490
|
+
msg.AgentData = {
|
|
491
|
+
AgentID: this.region.agent.agentID,
|
|
492
|
+
SessionID: this.region.circuit.sessionID
|
|
493
|
+
};
|
|
494
|
+
msg.ObjectData = [
|
|
495
|
+
{
|
|
496
|
+
ObjectLocalID: this.ID
|
|
497
|
+
}
|
|
498
|
+
];
|
|
499
|
+
primsExpectingUpdate.set(this.ID, this);
|
|
500
|
+
for (const obj of objects) {
|
|
501
|
+
msg.ObjectData.push({
|
|
502
|
+
ObjectLocalID: obj.ID
|
|
503
|
+
});
|
|
504
|
+
primsExpectingUpdate.set(obj.ID, obj);
|
|
142
505
|
}
|
|
143
|
-
|
|
144
|
-
|
|
506
|
+
await this.region.circuit.sendAndWaitForMessage(msg, PacketFlags_1.PacketFlags.Reliable, Message_1.Message.ObjectUpdate, 10000, (message) => {
|
|
507
|
+
let match = false;
|
|
508
|
+
for (const obj of message.ObjectData) {
|
|
509
|
+
const num = obj.ID;
|
|
510
|
+
if (primsExpectingUpdate.has(num)) {
|
|
511
|
+
primsExpectingUpdate.delete(num);
|
|
512
|
+
match = true;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (match) {
|
|
516
|
+
if (primsExpectingUpdate.size === 0) {
|
|
517
|
+
return FilterResponse_1.FilterResponse.Finish;
|
|
518
|
+
}
|
|
519
|
+
return FilterResponse_1.FilterResponse.Match;
|
|
520
|
+
}
|
|
521
|
+
return FilterResponse_1.FilterResponse.NoMatch;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
async setDescription(desc) {
|
|
525
|
+
this.description = desc;
|
|
526
|
+
if (this.region === undefined) {
|
|
527
|
+
return;
|
|
145
528
|
}
|
|
146
|
-
|
|
147
|
-
|
|
529
|
+
const msg = new ObjectDescription_1.ObjectDescriptionMessage();
|
|
530
|
+
msg.AgentData = {
|
|
531
|
+
AgentID: this.region.agent.agentID,
|
|
532
|
+
SessionID: this.region.circuit.sessionID
|
|
533
|
+
};
|
|
534
|
+
msg.ObjectData = [
|
|
535
|
+
{
|
|
536
|
+
LocalID: this.ID,
|
|
537
|
+
Description: Utils_1.Utils.StringToBuffer(desc)
|
|
538
|
+
}
|
|
539
|
+
];
|
|
540
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
541
|
+
}
|
|
542
|
+
async setTextureEntry(e) {
|
|
543
|
+
this.TextureEntry = e;
|
|
544
|
+
if (this.region === undefined) {
|
|
545
|
+
return;
|
|
148
546
|
}
|
|
149
|
-
|
|
150
|
-
|
|
547
|
+
return this.setTextureAndMediaURL();
|
|
548
|
+
}
|
|
549
|
+
async setTextureAndMediaURL() {
|
|
550
|
+
const msg = new ObjectImage_1.ObjectImageMessage();
|
|
551
|
+
msg.AgentData = {
|
|
552
|
+
AgentID: this.region.agent.agentID,
|
|
553
|
+
SessionID: this.region.circuit.sessionID
|
|
554
|
+
};
|
|
555
|
+
if (this.MediaURL === undefined) {
|
|
556
|
+
this.MediaURL = '';
|
|
151
557
|
}
|
|
152
|
-
if (
|
|
153
|
-
|
|
558
|
+
if (this.TextureEntry === undefined) {
|
|
559
|
+
this.TextureEntry = new TextureEntry_1.TextureEntry();
|
|
154
560
|
}
|
|
155
|
-
|
|
156
|
-
|
|
561
|
+
msg.ObjectData = [
|
|
562
|
+
{
|
|
563
|
+
ObjectLocalID: this.ID,
|
|
564
|
+
TextureEntry: this.TextureEntry.toBuffer(),
|
|
565
|
+
MediaURL: Utils_1.Utils.StringToBuffer(this.MediaURL)
|
|
566
|
+
}
|
|
567
|
+
];
|
|
568
|
+
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
569
|
+
}
|
|
570
|
+
async setExtraParams(ex) {
|
|
571
|
+
this.extraParams = ex;
|
|
572
|
+
if (this.region === undefined) {
|
|
573
|
+
return;
|
|
157
574
|
}
|
|
158
|
-
|
|
159
|
-
|
|
575
|
+
const msg = new ObjectExtraParams_1.ObjectExtraParamsMessage();
|
|
576
|
+
msg.AgentData = {
|
|
577
|
+
AgentID: this.region.agent.agentID,
|
|
578
|
+
SessionID: this.region.circuit.sessionID
|
|
579
|
+
};
|
|
580
|
+
msg.ObjectData = [];
|
|
581
|
+
let params = 0;
|
|
582
|
+
if (ex.lightData !== null) {
|
|
583
|
+
params++;
|
|
584
|
+
const data = ex.lightData.getBuffer();
|
|
585
|
+
msg.ObjectData.push({
|
|
586
|
+
ObjectLocalID: this.ID,
|
|
587
|
+
ParamType: ExtraParamType_1.ExtraParamType.Light,
|
|
588
|
+
ParamInUse: (ex.lightData.Intensity !== 0.0),
|
|
589
|
+
ParamData: data,
|
|
590
|
+
ParamSize: data.length
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
if (ex.flexibleData !== null) {
|
|
594
|
+
params++;
|
|
595
|
+
const data = ex.flexibleData.getBuffer();
|
|
596
|
+
msg.ObjectData.push({
|
|
597
|
+
ObjectLocalID: this.ID,
|
|
598
|
+
ParamType: ExtraParamType_1.ExtraParamType.Flexible,
|
|
599
|
+
ParamInUse: true,
|
|
600
|
+
ParamData: data,
|
|
601
|
+
ParamSize: data.length
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
if (ex.lightImageData !== null) {
|
|
605
|
+
params++;
|
|
606
|
+
const data = ex.lightImageData.getBuffer();
|
|
607
|
+
msg.ObjectData.push({
|
|
608
|
+
ObjectLocalID: this.ID,
|
|
609
|
+
ParamType: ExtraParamType_1.ExtraParamType.LightImage,
|
|
610
|
+
ParamInUse: true,
|
|
611
|
+
ParamData: data,
|
|
612
|
+
ParamSize: data.length
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
if (ex.sculptData !== null) {
|
|
616
|
+
params++;
|
|
617
|
+
const data = ex.sculptData.getBuffer();
|
|
618
|
+
msg.ObjectData.push({
|
|
619
|
+
ObjectLocalID: this.ID,
|
|
620
|
+
ParamType: ExtraParamType_1.ExtraParamType.Sculpt,
|
|
621
|
+
ParamInUse: true,
|
|
622
|
+
ParamData: data,
|
|
623
|
+
ParamSize: data.length
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
if (ex.meshData !== null) {
|
|
627
|
+
params++;
|
|
628
|
+
const data = ex.meshData.getBuffer();
|
|
629
|
+
msg.ObjectData.push({
|
|
630
|
+
ObjectLocalID: this.ID,
|
|
631
|
+
ParamType: ExtraParamType_1.ExtraParamType.Mesh,
|
|
632
|
+
ParamInUse: true,
|
|
633
|
+
ParamData: data,
|
|
634
|
+
ParamSize: data.length
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
if (ex.reflectionProbeData != null) {
|
|
638
|
+
params++;
|
|
639
|
+
const data = ex.reflectionProbeData.getBuffer();
|
|
640
|
+
msg.ObjectData.push({
|
|
641
|
+
ObjectLocalID: this.ID,
|
|
642
|
+
ParamType: ExtraParamType_1.ExtraParamType.ReflectionProbe,
|
|
643
|
+
ParamInUse: true,
|
|
644
|
+
ParamData: data,
|
|
645
|
+
ParamSize: data.length
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
if (ex.renderMaterialData != null) {
|
|
649
|
+
params++;
|
|
650
|
+
const data = ex.renderMaterialData.getBuffer();
|
|
651
|
+
msg.ObjectData.push({
|
|
652
|
+
ObjectLocalID: this.ID,
|
|
653
|
+
ParamType: ExtraParamType_1.ExtraParamType.RenderMaterial,
|
|
654
|
+
ParamInUse: true,
|
|
655
|
+
ParamData: data,
|
|
656
|
+
ParamSize: data.length
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
if (params > 0) {
|
|
660
|
+
const ack = this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
661
|
+
await this.region.circuit.waitForAck(ack, 10000);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
populateChildren() {
|
|
665
|
+
this.region.objects.populateChildren(this);
|
|
666
|
+
}
|
|
667
|
+
async exportXMLElement(rootNode, skipInventory = false, skipResolve = false) {
|
|
668
|
+
const document = builder.create('SceneObjectGroup');
|
|
669
|
+
let linkNum = 1;
|
|
670
|
+
await this.getXML(document, this, linkNum, rootNode, skipInventory, skipResolve);
|
|
671
|
+
if (this.children && this.children.length > 0) {
|
|
672
|
+
const otherParts = document.ele('OtherParts');
|
|
673
|
+
for (const child of this.children) {
|
|
674
|
+
await child.getXML(otherParts, this, ++linkNum, (rootNode !== undefined) ? 'Part' : undefined, skipInventory, skipResolve);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
return document;
|
|
678
|
+
}
|
|
679
|
+
async exportXML(rootNode, skipInventory = false, skipResolve = false) {
|
|
680
|
+
return (await this.exportXMLElement(rootNode, skipInventory, skipResolve)).end({ pretty: true, allowEmpty: true });
|
|
681
|
+
}
|
|
682
|
+
toJSON() {
|
|
683
|
+
return {
|
|
684
|
+
deleted: this.deleted,
|
|
685
|
+
creatorID: this.creatorID,
|
|
686
|
+
creationDate: this.creationDate,
|
|
687
|
+
baseMask: this.baseMask,
|
|
688
|
+
ownerMask: this.ownerMask,
|
|
689
|
+
groupMask: this.groupMask,
|
|
690
|
+
everyoneMask: this.everyoneMask,
|
|
691
|
+
nextOwnerMask: this.nextOwnerMask,
|
|
692
|
+
ownershipCost: this.ownershipCost,
|
|
693
|
+
saleType: this.saleType,
|
|
694
|
+
salePrice: this.salePrice,
|
|
695
|
+
aggregatePerms: this.aggregatePerms,
|
|
696
|
+
aggregatePermTextures: this.aggregatePermTextures,
|
|
697
|
+
aggregatePermTexturesOwner: this.aggregatePermTexturesOwner,
|
|
698
|
+
category: this.category,
|
|
699
|
+
inventorySerial: this.inventorySerial,
|
|
700
|
+
itemID: this.itemID,
|
|
701
|
+
folderID: this.folderID,
|
|
702
|
+
fromTaskID: this.fromTaskID,
|
|
703
|
+
lastOwnerID: this.lastOwnerID,
|
|
704
|
+
name: this.name,
|
|
705
|
+
description: this.description,
|
|
706
|
+
touchName: this.touchName,
|
|
707
|
+
sitName: this.sitName,
|
|
708
|
+
resolvedAt: this.resolvedAt,
|
|
709
|
+
resolvedInventory: this.resolvedInventory,
|
|
710
|
+
totalChildren: this.totalChildren,
|
|
711
|
+
landImpact: this.landImpact,
|
|
712
|
+
calculatedLandImpact: this.calculatedLandImpact,
|
|
713
|
+
physicaImpact: this.physicaImpact,
|
|
714
|
+
resourceImpact: this.resourceImpact,
|
|
715
|
+
linkResourceImpact: this.linkResourceImpact,
|
|
716
|
+
linkPhysicsImpact: this.linkPhysicsImpact,
|
|
717
|
+
limitingType: this.limitingType,
|
|
718
|
+
children: this.children,
|
|
719
|
+
ID: this.ID,
|
|
720
|
+
FullID: this.FullID,
|
|
721
|
+
ParentID: this.ParentID,
|
|
722
|
+
OwnerID: this.OwnerID,
|
|
723
|
+
IsAttachment: this.IsAttachment,
|
|
724
|
+
NameValue: this.NameValue,
|
|
725
|
+
PCode: this.PCode,
|
|
726
|
+
State: this.State,
|
|
727
|
+
CRC: this.CRC,
|
|
728
|
+
Material: this.Material,
|
|
729
|
+
ClickAction: this.ClickAction,
|
|
730
|
+
Scale: this.Scale,
|
|
731
|
+
Flags: this.Flags,
|
|
732
|
+
PathCurve: this.PathCurve,
|
|
733
|
+
ProfileCurve: this.ProfileCurve,
|
|
734
|
+
PathBegin: this.PathBegin,
|
|
735
|
+
PathEnd: this.PathEnd,
|
|
736
|
+
PathScaleX: this.PathScaleX,
|
|
737
|
+
PathScaleY: this.PathScaleY,
|
|
738
|
+
PathShearX: this.PathShearX,
|
|
739
|
+
PathShearY: this.PathShearY,
|
|
740
|
+
PathTwist: this.PathTwist,
|
|
741
|
+
PathTwistBegin: this.PathTwistBegin,
|
|
742
|
+
PathRadiusOffset: this.PathRadiusOffset,
|
|
743
|
+
PathTaperX: this.PathTaperX,
|
|
744
|
+
PathTaperY: this.PathTaperY,
|
|
745
|
+
PathRevolutions: this.PathRevolutions,
|
|
746
|
+
PathSkew: this.PathSkew,
|
|
747
|
+
ProfileBegin: this.ProfileBegin,
|
|
748
|
+
ProfileEnd: this.ProfileEnd,
|
|
749
|
+
ProfileHollow: this.ProfileHollow,
|
|
750
|
+
TextureEntry: this.TextureEntry,
|
|
751
|
+
Text: this.Text,
|
|
752
|
+
TextColor: this.TextColor,
|
|
753
|
+
MediaURL: this.MediaURL,
|
|
754
|
+
JointType: this.JointType,
|
|
755
|
+
JointPivot: this.JointPivot,
|
|
756
|
+
JointAxisOrAnchor: this.JointAxisOrAnchor,
|
|
757
|
+
Position: this.Position,
|
|
758
|
+
Rotation: this.Rotation,
|
|
759
|
+
CollisionPlane: this.CollisionPlane,
|
|
760
|
+
Velocity: this.Velocity,
|
|
761
|
+
Acceleration: this.Acceleration,
|
|
762
|
+
AngularVelocity: this.AngularVelocity,
|
|
763
|
+
TreeSpecies: this.TreeSpecies,
|
|
764
|
+
Sound: this.Sound,
|
|
765
|
+
SoundGain: this.SoundGain,
|
|
766
|
+
SoundFlags: this.SoundFlags,
|
|
767
|
+
SoundRadius: this.SoundRadius,
|
|
768
|
+
Particles: this.Particles,
|
|
769
|
+
density: this.density,
|
|
770
|
+
friction: this.friction,
|
|
771
|
+
gravityMultiplier: this.gravityMultiplier,
|
|
772
|
+
physicsShapeType: this.physicsShapeType,
|
|
773
|
+
restitution: this.restitution
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
setObjectData(data) {
|
|
777
|
+
let dataPos = 0;
|
|
778
|
+
switch (data.length) {
|
|
779
|
+
case 76:
|
|
780
|
+
this.CollisionPlane = new Vector4_1.Vector4(data, dataPos);
|
|
781
|
+
dataPos += 16;
|
|
782
|
+
case 60:
|
|
783
|
+
this.Position = new Vector3_1.Vector3(data, dataPos);
|
|
784
|
+
dataPos += 12;
|
|
785
|
+
this.Velocity = new Vector3_1.Vector3(data, dataPos);
|
|
786
|
+
dataPos += 12;
|
|
787
|
+
this.Acceleration = new Vector3_1.Vector3(data, dataPos);
|
|
788
|
+
dataPos += 12;
|
|
789
|
+
this.Rotation = new Quaternion_1.Quaternion(data, dataPos);
|
|
790
|
+
dataPos += 12;
|
|
791
|
+
this.AngularVelocity = new Vector3_1.Vector3(data, dataPos);
|
|
792
|
+
dataPos += 12;
|
|
793
|
+
break;
|
|
794
|
+
case 48:
|
|
795
|
+
this.CollisionPlane = new Vector4_1.Vector4(data, dataPos);
|
|
796
|
+
dataPos += 16;
|
|
797
|
+
case 32:
|
|
798
|
+
this.Position = new Vector3_1.Vector3([
|
|
799
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -0.5 * 256.0, 1.5 * 256.0),
|
|
800
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -0.5 * 256.0, 1.5 * 256.0),
|
|
801
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 3.0 * 256.0)
|
|
802
|
+
]);
|
|
803
|
+
dataPos += 6;
|
|
804
|
+
this.Velocity = new Vector3_1.Vector3([
|
|
805
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
806
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
807
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
808
|
+
]);
|
|
809
|
+
dataPos += 6;
|
|
810
|
+
this.Acceleration = new Vector3_1.Vector3([
|
|
811
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
812
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
813
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
814
|
+
]);
|
|
815
|
+
dataPos += 6;
|
|
816
|
+
this.Rotation = new Quaternion_1.Quaternion([
|
|
817
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -1.0, 1.0),
|
|
818
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -1.0, 1.0),
|
|
819
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -1.0, 1.0),
|
|
820
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -1.0, 1.0)
|
|
821
|
+
]);
|
|
822
|
+
dataPos += 8;
|
|
823
|
+
this.AngularVelocity = new Vector3_1.Vector3([
|
|
824
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
825
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
826
|
+
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
827
|
+
]);
|
|
828
|
+
dataPos += 6;
|
|
829
|
+
break;
|
|
830
|
+
case 16:
|
|
831
|
+
this.Position = new Vector3_1.Vector3([
|
|
832
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
833
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
834
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
835
|
+
]);
|
|
836
|
+
this.Velocity = new Vector3_1.Vector3([
|
|
837
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
838
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
839
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
840
|
+
]);
|
|
841
|
+
this.Acceleration = new Vector3_1.Vector3([
|
|
842
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
843
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
844
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
845
|
+
]);
|
|
846
|
+
this.Rotation = new Quaternion_1.Quaternion([
|
|
847
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
848
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
849
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
850
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0)
|
|
851
|
+
]);
|
|
852
|
+
this.AngularVelocity = new Vector3_1.Vector3([
|
|
853
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
854
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
855
|
+
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
856
|
+
]);
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
async deRezObject(destination, transactionID, destFolder) {
|
|
861
|
+
return GameObject.deRezObjects(this.region, [this], destination, transactionID, destFolder);
|
|
862
|
+
}
|
|
863
|
+
async takeToInventory(folder) {
|
|
864
|
+
return GameObject.takeManyToInventory(this.region, [this], folder);
|
|
865
|
+
}
|
|
866
|
+
async dropInventoryIntoContents(inventoryItem) {
|
|
867
|
+
const transactionID = UUID_1.UUID.zero();
|
|
868
|
+
if (inventoryItem instanceof UUID_1.UUID) {
|
|
869
|
+
const item = await this.region.agent.inventory.fetchInventoryItem(inventoryItem);
|
|
870
|
+
if (item === null) {
|
|
871
|
+
throw new Error('Failed to drop inventory into object contents - Inventory item ' + inventoryItem.toString() + ' not found');
|
|
872
|
+
}
|
|
873
|
+
inventoryItem = item;
|
|
874
|
+
}
|
|
875
|
+
const msg = new UpdateTaskInventory_1.UpdateTaskInventoryMessage();
|
|
876
|
+
msg.AgentData = {
|
|
877
|
+
AgentID: this.region.agent.agentID,
|
|
878
|
+
SessionID: this.region.circuit.sessionID
|
|
879
|
+
};
|
|
880
|
+
msg.UpdateData = {
|
|
881
|
+
Key: 0,
|
|
882
|
+
LocalID: this.ID
|
|
883
|
+
};
|
|
884
|
+
msg.InventoryData = {
|
|
885
|
+
ItemID: inventoryItem.itemID,
|
|
886
|
+
FolderID: inventoryItem.parentID,
|
|
887
|
+
CreatorID: inventoryItem.permissions.creator,
|
|
888
|
+
OwnerID: this.region.agent.agentID,
|
|
889
|
+
GroupID: inventoryItem.permissions.group,
|
|
890
|
+
BaseMask: inventoryItem.permissions.baseMask,
|
|
891
|
+
OwnerMask: inventoryItem.permissions.ownerMask,
|
|
892
|
+
GroupMask: inventoryItem.permissions.groupMask,
|
|
893
|
+
EveryoneMask: inventoryItem.permissions.everyoneMask,
|
|
894
|
+
NextOwnerMask: inventoryItem.permissions.nextOwnerMask,
|
|
895
|
+
GroupOwned: inventoryItem.permissions.groupOwned ?? false,
|
|
896
|
+
TransactionID: transactionID,
|
|
897
|
+
Type: inventoryItem.type,
|
|
898
|
+
InvType: inventoryItem.inventoryType,
|
|
899
|
+
Flags: inventoryItem.flags,
|
|
900
|
+
SaleType: inventoryItem.saleType,
|
|
901
|
+
SalePrice: inventoryItem.salePrice,
|
|
902
|
+
Name: Utils_1.Utils.StringToBuffer(inventoryItem.name),
|
|
903
|
+
Description: Utils_1.Utils.StringToBuffer(inventoryItem.description),
|
|
904
|
+
CreationDate: inventoryItem.created.getTime() / 1000,
|
|
905
|
+
CRC: inventoryItem.getCRC()
|
|
906
|
+
};
|
|
907
|
+
const serial = this.inventorySerial;
|
|
908
|
+
this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
909
|
+
return this.waitForInventoryUpdate(serial);
|
|
910
|
+
}
|
|
911
|
+
async waitForInventoryUpdate(inventorySerial) {
|
|
912
|
+
await this.deselect();
|
|
913
|
+
void this.select();
|
|
914
|
+
await this.region.circuit.waitForMessage(Message_1.Message.ObjectProperties, 10000, (message) => {
|
|
915
|
+
for (const obj of message.ObjectData) {
|
|
916
|
+
if (obj.ObjectID.equals(this.FullID)) {
|
|
917
|
+
if (inventorySerial === undefined) {
|
|
918
|
+
inventorySerial = this.inventorySerial;
|
|
919
|
+
}
|
|
920
|
+
if (obj.InventorySerial > inventorySerial) {
|
|
921
|
+
return FilterResponse_1.FilterResponse.Finish;
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
return FilterResponse_1.FilterResponse.NoMatch;
|
|
926
|
+
});
|
|
927
|
+
await this.deselect();
|
|
928
|
+
}
|
|
929
|
+
async select() {
|
|
930
|
+
const selectObject = new ObjectSelect_1.ObjectSelectMessage();
|
|
931
|
+
selectObject.AgentData = {
|
|
932
|
+
AgentID: this.region.agent.agentID,
|
|
933
|
+
SessionID: this.region.circuit.sessionID
|
|
934
|
+
};
|
|
935
|
+
selectObject.ObjectData = [{
|
|
936
|
+
ObjectLocalID: this.ID
|
|
937
|
+
}];
|
|
938
|
+
const ack = this.region.circuit.sendMessage(selectObject, PacketFlags_1.PacketFlags.Reliable);
|
|
939
|
+
return this.region.circuit.waitForAck(ack, 10000);
|
|
940
|
+
}
|
|
941
|
+
async deselect() {
|
|
942
|
+
const deselectObject = new ObjectDeselect_1.ObjectDeselectMessage();
|
|
943
|
+
deselectObject.AgentData = {
|
|
944
|
+
AgentID: this.region.agent.agentID,
|
|
945
|
+
SessionID: this.region.circuit.sessionID
|
|
946
|
+
};
|
|
947
|
+
deselectObject.ObjectData = [{
|
|
948
|
+
ObjectLocalID: this.ID
|
|
949
|
+
}];
|
|
950
|
+
const ack = this.region.circuit.sendMessage(deselectObject, PacketFlags_1.PacketFlags.Reliable);
|
|
951
|
+
return this.region.circuit.waitForAck(ack, 10000);
|
|
952
|
+
}
|
|
953
|
+
async removeTaskInventory(item) {
|
|
954
|
+
if (typeof item === 'string') {
|
|
955
|
+
for (const invItem of this.inventory) {
|
|
956
|
+
if (invItem.name === item) {
|
|
957
|
+
item = invItem.itemID;
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (typeof item === 'string') {
|
|
963
|
+
throw new Error('Task inventory item not found');
|
|
964
|
+
}
|
|
965
|
+
const msg = new RemoveTaskInventory_1.RemoveTaskInventoryMessage();
|
|
966
|
+
msg.AgentData = {
|
|
967
|
+
AgentID: this.region.agent.agentID,
|
|
968
|
+
SessionID: this.region.circuit.sessionID
|
|
969
|
+
};
|
|
970
|
+
msg.InventoryData = {
|
|
971
|
+
LocalID: this.ID,
|
|
972
|
+
ItemID: item
|
|
973
|
+
};
|
|
974
|
+
this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
975
|
+
await this.waitForInventoryUpdate(this.inventorySerial);
|
|
976
|
+
}
|
|
977
|
+
static partFromXMLJS(obj, isRoot) {
|
|
978
|
+
const go = new GameObject();
|
|
979
|
+
go.Flags = 0;
|
|
980
|
+
let prop = '';
|
|
981
|
+
if (Utils_1.Utils.getFromXMLJS(obj, 'AllowedDrop') !== undefined) {
|
|
982
|
+
go.Flags = go.Flags | PrimFlags_1.PrimFlags.AllowInventoryDrop;
|
|
983
|
+
}
|
|
984
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'CreatorID')) !== undefined) {
|
|
985
|
+
go.creatorID = prop;
|
|
986
|
+
}
|
|
987
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'FolderID')) !== undefined) {
|
|
988
|
+
go.folderID = prop;
|
|
989
|
+
}
|
|
990
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'InventorySerial')) !== undefined) {
|
|
991
|
+
go.inventorySerial = prop;
|
|
992
|
+
}
|
|
993
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'UUID')) !== undefined) {
|
|
994
|
+
go.FullID = prop;
|
|
995
|
+
}
|
|
996
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'LocalId')) !== undefined) {
|
|
997
|
+
go.ID = prop;
|
|
998
|
+
}
|
|
999
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'Name')) !== undefined) {
|
|
1000
|
+
go.name = String(prop);
|
|
1001
|
+
}
|
|
1002
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'Material')) !== undefined) {
|
|
1003
|
+
go.Material = prop;
|
|
1004
|
+
}
|
|
1005
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'GroupPosition')) !== undefined) {
|
|
1006
|
+
if (isRoot) {
|
|
1007
|
+
go.Position = prop;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'OffsetPosition')) !== undefined) {
|
|
1011
|
+
if (!isRoot) {
|
|
1012
|
+
go.Position = prop;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if ((prop = Quaternion_1.Quaternion.fromXMLJS(obj, 'RotationOffset')) !== undefined) {
|
|
1016
|
+
go.Rotation = prop;
|
|
1017
|
+
}
|
|
1018
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'Velocity')) !== undefined) {
|
|
1019
|
+
go.Velocity = prop;
|
|
1020
|
+
}
|
|
1021
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'AngularVelocity')) !== undefined) {
|
|
1022
|
+
go.AngularVelocity = prop;
|
|
1023
|
+
}
|
|
1024
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'Acceleration')) !== undefined) {
|
|
1025
|
+
go.Acceleration = prop;
|
|
1026
|
+
}
|
|
1027
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'Description')) !== undefined) {
|
|
1028
|
+
go.description = String(prop);
|
|
1029
|
+
}
|
|
1030
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'Text')) !== undefined) {
|
|
1031
|
+
go.Text = String(prop);
|
|
1032
|
+
}
|
|
1033
|
+
if ((prop = Color4_1.Color4.fromXMLJS(obj, 'Color')) !== undefined) {
|
|
1034
|
+
go.TextColor = prop;
|
|
1035
|
+
}
|
|
1036
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'SitName')) !== undefined) {
|
|
1037
|
+
go.sitName = String(prop);
|
|
1038
|
+
}
|
|
1039
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'TouchName')) !== undefined) {
|
|
1040
|
+
go.touchName = String(prop);
|
|
1041
|
+
}
|
|
1042
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'ClickAction')) !== undefined) {
|
|
1043
|
+
go.ClickAction = prop;
|
|
1044
|
+
}
|
|
1045
|
+
if ((prop = Vector3_1.Vector3.fromXMLJS(obj, 'Scale')) !== undefined) {
|
|
1046
|
+
go.Scale = prop;
|
|
1047
|
+
}
|
|
1048
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'ParentID')) !== undefined) {
|
|
1049
|
+
go.ParentID = prop;
|
|
1050
|
+
}
|
|
1051
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'Category')) !== undefined) {
|
|
1052
|
+
go.category = prop;
|
|
1053
|
+
}
|
|
1054
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'SalePrice')) !== undefined) {
|
|
1055
|
+
go.salePrice = prop;
|
|
1056
|
+
}
|
|
1057
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'ObjectSaleType')) !== undefined) {
|
|
1058
|
+
go.saleType = prop;
|
|
1059
|
+
}
|
|
1060
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'OwnershipCost')) !== undefined) {
|
|
1061
|
+
go.ownershipCost = prop;
|
|
1062
|
+
}
|
|
1063
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'GroupID')) !== undefined) {
|
|
1064
|
+
go.groupID = prop;
|
|
1065
|
+
}
|
|
1066
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'OwnerID')) !== undefined) {
|
|
1067
|
+
go.OwnerID = prop;
|
|
1068
|
+
}
|
|
1069
|
+
if ((prop = UUID_1.UUID.fromXMLJS(obj, 'LastOwnerID')) !== undefined) {
|
|
1070
|
+
go.lastOwnerID = prop;
|
|
1071
|
+
}
|
|
1072
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'BaseMask')) !== undefined) {
|
|
1073
|
+
go.baseMask = prop;
|
|
1074
|
+
}
|
|
1075
|
+
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'OwnerMask')) !== undefined) {
|
|
1076
|
+
go.ownerMask = prop;
|
|
160
1077
|
}
|
|
161
1078
|
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'GroupMask')) !== undefined) {
|
|
162
1079
|
go.groupMask = prop;
|
|
@@ -212,15 +1129,15 @@ class GameObject {
|
|
|
212
1129
|
const buf = Buffer.from(prop, 'base64');
|
|
213
1130
|
go.TextureEntry = TextureEntry_1.TextureEntry.from(buf);
|
|
214
1131
|
}
|
|
215
|
-
if (go.TextureEntry && shape
|
|
216
|
-
const tex = Buffer.from(shape
|
|
1132
|
+
if (go.TextureEntry && shape.MatOvrd !== undefined && Array.isArray(shape.MatOvrd) && shape.MatOvrd.length > 0) {
|
|
1133
|
+
const tex = Buffer.from(shape.MatOvrd[0], 'base64');
|
|
217
1134
|
let pos = 0;
|
|
218
1135
|
const entryCount = tex.readUInt8(pos++);
|
|
219
1136
|
for (let x = 0; x < entryCount; x++) {
|
|
220
1137
|
const te_index = tex.readUInt8(pos++);
|
|
221
1138
|
const len = tex.readUInt16LE(pos++);
|
|
222
1139
|
pos++;
|
|
223
|
-
const json = tex.
|
|
1140
|
+
const json = tex.subarray(pos, pos + len).toString('utf-8');
|
|
224
1141
|
pos = pos + len;
|
|
225
1142
|
go.TextureEntry.gltfMaterialOverrides.set(te_index, LLGLTFMaterialOverride_1.LLGLTFMaterialOverride.fromFullMaterialJSON(json));
|
|
226
1143
|
}
|
|
@@ -285,13 +1202,13 @@ class GameObject {
|
|
|
285
1202
|
go.State = (((prop & mask) >>> 4) | ((prop & ~mask) << 4)) >>> 0;
|
|
286
1203
|
}
|
|
287
1204
|
if ((prop = Utils_1.Utils.getFromXMLJS(shape, 'ProfileShape')) !== undefined) {
|
|
288
|
-
if (
|
|
1205
|
+
if (go.ProfileCurve === undefined) {
|
|
289
1206
|
go.ProfileCurve = 0;
|
|
290
1207
|
}
|
|
291
1208
|
go.ProfileCurve = go.ProfileCurve | parseInt(ProfileShape_1.ProfileShape[prop], 10);
|
|
292
1209
|
}
|
|
293
1210
|
if ((prop = Utils_1.Utils.getFromXMLJS(shape, 'HollowShape')) !== undefined) {
|
|
294
|
-
if (
|
|
1211
|
+
if (go.ProfileCurve === undefined) {
|
|
295
1212
|
go.ProfileCurve = 0;
|
|
296
1213
|
}
|
|
297
1214
|
go.ProfileCurve = go.ProfileCurve | parseInt(HoleType_1.HoleType[prop], 10);
|
|
@@ -301,7 +1218,7 @@ class GameObject {
|
|
|
301
1218
|
if (type !== false && type !== undefined) {
|
|
302
1219
|
const id = UUID_1.UUID.fromXMLJS(shape, 'SculptTexture');
|
|
303
1220
|
if (id instanceof UUID_1.UUID) {
|
|
304
|
-
if (
|
|
1221
|
+
if (go.extraParams === undefined) {
|
|
305
1222
|
go.extraParams = new ExtraParams_1.ExtraParams();
|
|
306
1223
|
}
|
|
307
1224
|
if (type & SculptType_1.SculptType.Mesh) {
|
|
@@ -324,13 +1241,13 @@ class GameObject {
|
|
|
324
1241
|
const flexiForceZ = Utils_1.Utils.getFromXMLJS(shape, 'FlexiForceZ');
|
|
325
1242
|
if (flexiSoftness !== false &&
|
|
326
1243
|
flexiTension !== false &&
|
|
327
|
-
flexiDrag
|
|
1244
|
+
flexiDrag !== false &&
|
|
328
1245
|
flexiGravity !== false &&
|
|
329
1246
|
flexiWind !== false &&
|
|
330
1247
|
flexiForceX !== false &&
|
|
331
1248
|
flexiForceY !== false &&
|
|
332
1249
|
flexiForceZ !== false) {
|
|
333
|
-
if (
|
|
1250
|
+
if (go.extraParams === undefined) {
|
|
334
1251
|
go.extraParams = new ExtraParams_1.ExtraParams();
|
|
335
1252
|
}
|
|
336
1253
|
go.extraParams.setFlexiData(flexiSoftness, flexiTension, flexiDrag, flexiGravity, flexiWind, new Vector3_1.Vector3([flexiForceX, flexiForceY, flexiForceZ]));
|
|
@@ -353,7 +1270,7 @@ class GameObject {
|
|
|
353
1270
|
lightCutoff !== false &&
|
|
354
1271
|
lightFalloff !== false &&
|
|
355
1272
|
lightIntensity !== false) {
|
|
356
|
-
if (
|
|
1273
|
+
if (go.extraParams === undefined) {
|
|
357
1274
|
go.extraParams = new ExtraParams_1.ExtraParams();
|
|
358
1275
|
}
|
|
359
1276
|
go.extraParams.setLightData(new Color4_1.Color4(lightColorR, lightColorG, lightColorB, lightColorA), lightRadius, lightCutoff, lightFalloff, lightIntensity);
|
|
@@ -365,10 +1282,10 @@ class GameObject {
|
|
|
365
1282
|
}
|
|
366
1283
|
}
|
|
367
1284
|
if ((prop = Utils_1.Utils.getFromXMLJS(obj, 'TaskInventory')) !== undefined) {
|
|
368
|
-
if (prop.TaskInventoryItem) {
|
|
1285
|
+
if (prop.TaskInventoryItem !== undefined) {
|
|
369
1286
|
for (const invItemXML of prop.TaskInventoryItem) {
|
|
370
1287
|
const invItem = new InventoryItem_1.InventoryItem(go);
|
|
371
|
-
let subProp;
|
|
1288
|
+
let subProp = '';
|
|
372
1289
|
if ((subProp = UUID_1.UUID.fromXMLJS(invItemXML, 'AssetID')) !== undefined) {
|
|
373
1290
|
invItem.assetID = subProp;
|
|
374
1291
|
}
|
|
@@ -429,1264 +1346,335 @@ class GameObject {
|
|
|
429
1346
|
if ((subProp = UUID_1.UUID.fromXMLJS(invItemXML, 'PermsGranter')) !== undefined) {
|
|
430
1347
|
invItem.permsGranter = subProp;
|
|
431
1348
|
}
|
|
1349
|
+
if ((subProp = Utils_1.Utils.getFromXMLJS(invItemXML, 'ScriptRunning')) !== undefined) {
|
|
1350
|
+
invItem.scriptRunning = subProp === true;
|
|
1351
|
+
}
|
|
1352
|
+
if ((subProp = Utils_1.Utils.getFromXMLJS(invItemXML, 'ScriptMono')) !== undefined) {
|
|
1353
|
+
invItem.scriptMono = subProp === true;
|
|
1354
|
+
}
|
|
432
1355
|
go.inventory.push(invItem);
|
|
433
1356
|
}
|
|
434
1357
|
}
|
|
435
1358
|
}
|
|
436
1359
|
return go;
|
|
437
1360
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
const parsed = yield Utils_1.Utils.parseXML(xml);
|
|
443
|
-
if (!parsed['SceneObjectGroup']) {
|
|
444
|
-
throw new Error('SceneObjectGroup not found');
|
|
445
|
-
}
|
|
446
|
-
result = parsed['SceneObjectGroup'];
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
result = xml;
|
|
450
|
-
}
|
|
451
|
-
let rootPartXML;
|
|
452
|
-
if (result['SceneObjectPart']) {
|
|
453
|
-
rootPartXML = result['SceneObjectPart'];
|
|
454
|
-
}
|
|
455
|
-
else if (result['RootPart'] && result['RootPart'][0] && result['RootPart'][0]['SceneObjectPart']) {
|
|
456
|
-
rootPartXML = result['RootPart'][0]['SceneObjectPart'];
|
|
1361
|
+
async waitForTaskInventory() {
|
|
1362
|
+
const inventory = await this.region.circuit.waitForMessage(Message_1.Message.ReplyTaskInventory, 10000, (message) => {
|
|
1363
|
+
if (message.InventoryData.TaskID.equals(this.FullID)) {
|
|
1364
|
+
return FilterResponse_1.FilterResponse.Finish;
|
|
457
1365
|
}
|
|
458
1366
|
else {
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
const rootPart = GameObject.partFromXMLJS(rootPartXML[0], true);
|
|
462
|
-
rootPart.children = [];
|
|
463
|
-
rootPart.totalChildren = 0;
|
|
464
|
-
if (result['OtherParts'] && Array.isArray(result['OtherParts']) && result['OtherParts'].length > 0) {
|
|
465
|
-
const obj = result['OtherParts'][0];
|
|
466
|
-
if (obj['SceneObjectPart'] || obj['Part']) {
|
|
467
|
-
if (obj['Part']) {
|
|
468
|
-
for (const part of obj['Part']) {
|
|
469
|
-
rootPart.children.push(GameObject.partFromXMLJS(part['SceneObjectPart'][0], false));
|
|
470
|
-
rootPart.totalChildren++;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
for (const part of obj['SceneObjectPart']) {
|
|
475
|
-
rootPart.children.push(GameObject.partFromXMLJS(part, false));
|
|
476
|
-
rootPart.totalChildren++;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
1367
|
+
return FilterResponse_1.FilterResponse.Match;
|
|
480
1368
|
}
|
|
481
|
-
return rootPart;
|
|
482
1369
|
});
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
msg.AgentData = {
|
|
488
|
-
AgentID: region.agent.agentID,
|
|
489
|
-
SessionID: region.circuit.sessionID
|
|
490
|
-
};
|
|
491
|
-
msg.AgentBlock = {
|
|
492
|
-
GroupID: UUID_1.UUID.zero(),
|
|
493
|
-
Destination: destination,
|
|
494
|
-
DestinationID: destFolder,
|
|
495
|
-
TransactionID: transactionID,
|
|
496
|
-
PacketCount: 1,
|
|
497
|
-
PacketNumber: 1
|
|
498
|
-
};
|
|
499
|
-
msg.ObjectData = [];
|
|
500
|
-
for (const obj of objects) {
|
|
501
|
-
msg.ObjectData.push({
|
|
502
|
-
ObjectLocalID: obj.ID
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
const ack = region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
506
|
-
return region.circuit.waitForAck(ack, 10000);
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
static takeManyToInventory(region, objects, folder) {
|
|
510
|
-
const transactionID = UUID_1.UUID.random();
|
|
511
|
-
let enforceFolder = true;
|
|
512
|
-
if (folder === undefined) {
|
|
513
|
-
enforceFolder = false;
|
|
514
|
-
folder = region.agent.inventory.getRootFolderMain();
|
|
1370
|
+
if (inventory.InventoryData.Filename.length === 0) {
|
|
1371
|
+
this.inventory = [];
|
|
1372
|
+
this.resolvedInventory = true;
|
|
1373
|
+
return;
|
|
515
1374
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
for (const inv of message.InventoryData) {
|
|
519
|
-
const name = Utils_1.Utils.BufferToStringSimple(inv.Name);
|
|
520
|
-
if (name === objects[0].name) {
|
|
521
|
-
return FilterResponse_1.FilterResponse.Finish;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
return FilterResponse_1.FilterResponse.NoMatch;
|
|
525
|
-
}).then((createInventoryMsg) => {
|
|
526
|
-
for (const inv of createInventoryMsg.InventoryData) {
|
|
527
|
-
const name = Utils_1.Utils.BufferToStringSimple(inv.Name);
|
|
528
|
-
if (name === objects[0].name) {
|
|
529
|
-
const itemID = inv.ItemID;
|
|
530
|
-
region.agent.inventory.fetchInventoryItem(itemID).then((item) => {
|
|
531
|
-
if (item === null) {
|
|
532
|
-
reject(new Error('Inventory item was unable to be retrieved after take to inventory'));
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
if (enforceFolder && folder !== undefined && !item.parentID.equals(folder.folderID)) {
|
|
536
|
-
item.moveToFolder(folder).then(() => {
|
|
537
|
-
resolve(item);
|
|
538
|
-
}).catch((err) => {
|
|
539
|
-
console.error('Error moving item to correct folder');
|
|
540
|
-
console.error(err);
|
|
541
|
-
resolve(item);
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
resolve(item);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}).catch((err) => {
|
|
549
|
-
reject(err);
|
|
550
|
-
});
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}).catch(() => {
|
|
555
|
-
reject(new Error('Timed out waiting for UpdateCreateInventoryItem'));
|
|
556
|
-
});
|
|
557
|
-
if (folder !== undefined) {
|
|
558
|
-
GameObject.deRezObjects(region, objects, DeRezDestination_1.DeRezDestination.AgentInventoryTake, transactionID, folder.folderID).then(() => {
|
|
559
|
-
}).catch((err) => {
|
|
560
|
-
console.error(err);
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
constructor() {
|
|
566
|
-
this.deleted = false;
|
|
567
|
-
this.resolvedInventory = false;
|
|
568
|
-
this.ID = 0;
|
|
569
|
-
this.FullID = UUID_1.UUID.random();
|
|
570
|
-
this.OwnerID = UUID_1.UUID.zero();
|
|
571
|
-
this.IsAttachment = false;
|
|
572
|
-
this.NameValue = {};
|
|
573
|
-
this.PCode = PCode_1.PCode.None;
|
|
574
|
-
this.attachmentPoint = AttachmentPoint_1.AttachmentPoint.Default;
|
|
1375
|
+
const fileName = Utils_1.Utils.BufferToStringSimple(inventory.InventoryData.Filename);
|
|
1376
|
+
const file = await this.region.circuit.XferFileDown(fileName, true, false, UUID_1.UUID.zero(), AssetType_1.AssetType.Unknown, true);
|
|
575
1377
|
this.inventory = [];
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.createdSelected = false;
|
|
580
|
-
this.isMarkedRoot = false;
|
|
581
|
-
this.onTextureUpdate = new rxjs_1.Subject();
|
|
582
|
-
this.Position = Vector3_1.Vector3.getZero();
|
|
583
|
-
this.Rotation = Quaternion_1.Quaternion.getIdentity();
|
|
584
|
-
this.AngularVelocity = Vector3_1.Vector3.getZero();
|
|
585
|
-
this.TreeSpecies = 0;
|
|
586
|
-
this.SoundFlags = 0;
|
|
587
|
-
this.SoundRadius = 1.0;
|
|
588
|
-
this.SoundGain = 1.0;
|
|
589
|
-
}
|
|
590
|
-
waitForTextureUpdate(timeout) {
|
|
591
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
592
|
-
return Utils_1.Utils.waitOrTimeOut(this.onTextureUpdate, timeout);
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
rezScript(name_1, description_1) {
|
|
596
|
-
return __awaiter(this, arguments, void 0, function* (name, description, perms = 532480) {
|
|
597
|
-
const rezScriptMsg = new RezScript_1.RezScriptMessage();
|
|
598
|
-
rezScriptMsg.AgentData = {
|
|
599
|
-
AgentID: this.region.agent.agentID,
|
|
600
|
-
SessionID: this.region.circuit.sessionID,
|
|
601
|
-
GroupID: this.region.agent.activeGroupID
|
|
602
|
-
};
|
|
603
|
-
rezScriptMsg.UpdateBlock = {
|
|
604
|
-
ObjectLocalID: this.ID,
|
|
605
|
-
Enabled: true
|
|
606
|
-
};
|
|
607
|
-
const tmpName = uuid.v4();
|
|
608
|
-
const invItem = new InventoryItem_1.InventoryItem(this);
|
|
609
|
-
invItem.itemID = UUID_1.UUID.zero();
|
|
610
|
-
invItem.parentID = this.FullID;
|
|
611
|
-
invItem.permissions.creator = this.region.agent.agentID;
|
|
612
|
-
invItem.permissions.group = UUID_1.UUID.zero();
|
|
613
|
-
invItem.permissions.baseMask = PermissionMask_1.PermissionMask.All;
|
|
614
|
-
invItem.permissions.ownerMask = PermissionMask_1.PermissionMask.All;
|
|
615
|
-
invItem.permissions.groupMask = 0;
|
|
616
|
-
invItem.permissions.everyoneMask = 0;
|
|
617
|
-
invItem.permissions.nextOwnerMask = perms;
|
|
618
|
-
invItem.permissions.groupOwned = false;
|
|
619
|
-
invItem.type = AssetType_1.AssetType.LSLText;
|
|
620
|
-
invItem.inventoryType = InventoryType_1.InventoryType.LSL;
|
|
621
|
-
invItem.flags = 0;
|
|
622
|
-
invItem.salePrice = this.salePrice || 10;
|
|
623
|
-
invItem.saleType = this.saleType || 0;
|
|
624
|
-
invItem.name = tmpName;
|
|
625
|
-
invItem.description = description;
|
|
626
|
-
invItem.created = new Date();
|
|
627
|
-
rezScriptMsg.InventoryBlock = {
|
|
628
|
-
ItemID: UUID_1.UUID.zero(),
|
|
629
|
-
FolderID: this.FullID,
|
|
630
|
-
CreatorID: this.region.agent.agentID,
|
|
631
|
-
OwnerID: this.region.agent.agentID,
|
|
632
|
-
GroupID: UUID_1.UUID.zero(),
|
|
633
|
-
BaseMask: PermissionMask_1.PermissionMask.All,
|
|
634
|
-
OwnerMask: PermissionMask_1.PermissionMask.All,
|
|
635
|
-
GroupMask: 0,
|
|
636
|
-
EveryoneMask: 0,
|
|
637
|
-
NextOwnerMask: perms,
|
|
638
|
-
GroupOwned: false,
|
|
639
|
-
TransactionID: UUID_1.UUID.zero(),
|
|
640
|
-
Type: AssetType_1.AssetType.LSLText,
|
|
641
|
-
InvType: InventoryType_1.InventoryType.LSL,
|
|
642
|
-
Flags: 0,
|
|
643
|
-
SaleType: this.saleType || 0,
|
|
644
|
-
SalePrice: this.salePrice || 10,
|
|
645
|
-
Name: Utils_1.Utils.StringToBuffer(tmpName),
|
|
646
|
-
Description: Utils_1.Utils.StringToBuffer(description),
|
|
647
|
-
CreationDate: Math.floor(invItem.created.getTime() / 1000),
|
|
648
|
-
CRC: invItem.getCRC()
|
|
649
|
-
};
|
|
650
|
-
yield this.region.circuit.waitForAck(this.region.circuit.sendMessage(rezScriptMsg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
651
|
-
yield this.updateInventory();
|
|
652
|
-
for (const item of this.inventory) {
|
|
653
|
-
if (item.name === tmpName) {
|
|
654
|
-
item.renameInTask(this, name).then(() => {
|
|
655
|
-
}).catch(() => {
|
|
656
|
-
});
|
|
657
|
-
try {
|
|
658
|
-
yield this.waitForInventoryUpdate();
|
|
659
|
-
}
|
|
660
|
-
catch (error) {
|
|
661
|
-
}
|
|
662
|
-
yield this.updateInventory();
|
|
663
|
-
for (const newItem of this.inventory) {
|
|
664
|
-
if (newItem.itemID.equals(item.itemID)) {
|
|
665
|
-
return newItem;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
return item;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
throw new Error('Failed to add script to object');
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
updateInventory() {
|
|
675
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
676
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
677
|
-
if (this.PCode === PCode_1.PCode.Avatar) {
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
try {
|
|
681
|
-
const capURL = yield this.region.caps.getCapability('RequestTaskInventory');
|
|
682
|
-
const result = yield this.region.caps.capsPerformXMLGet(capURL + '?task_id=' + this.FullID);
|
|
683
|
-
if (result.contents) {
|
|
684
|
-
this.inventory = [];
|
|
685
|
-
for (const item of result.contents) {
|
|
686
|
-
const invItem = new InventoryItem_1.InventoryItem(this, this.region.agent);
|
|
687
|
-
invItem.assetID = new UUID_1.UUID(item.asset_id);
|
|
688
|
-
invItem.created = new Date(((_a = item.created_at) !== null && _a !== void 0 ? _a : 0) * 1000);
|
|
689
|
-
invItem.description = (_b = item.desc) !== null && _b !== void 0 ? _b : '';
|
|
690
|
-
invItem.flags = (_c = item.flags) !== null && _c !== void 0 ? _c : 0;
|
|
691
|
-
invItem.inventoryType = Utils_1.Utils.HTTPAssetTypeToInventoryType((_d = item.inv_type) !== null && _d !== void 0 ? _d : '');
|
|
692
|
-
invItem.itemID = new UUID_1.UUID(item.item_id);
|
|
693
|
-
invItem.name = (_e = item.name) !== null && _e !== void 0 ? _e : '';
|
|
694
|
-
invItem.parentID = new UUID_1.UUID(item.parent_id);
|
|
695
|
-
invItem.permissions = {
|
|
696
|
-
baseMask: (_g = (_f = item.permissions) === null || _f === void 0 ? void 0 : _f.base_mask) !== null && _g !== void 0 ? _g : 0,
|
|
697
|
-
creator: new UUID_1.UUID((_h = item.permissions) === null || _h === void 0 ? void 0 : _h.creator_id),
|
|
698
|
-
everyoneMask: (_k = (_j = item.permissions) === null || _j === void 0 ? void 0 : _j.everyone_mask) !== null && _k !== void 0 ? _k : 0,
|
|
699
|
-
group: new UUID_1.UUID((_l = item.permissions) === null || _l === void 0 ? void 0 : _l.group_id),
|
|
700
|
-
groupMask: (_o = (_m = item.permissions) === null || _m === void 0 ? void 0 : _m.group_mask) !== null && _o !== void 0 ? _o : 0,
|
|
701
|
-
groupOwned: (_q = (_p = item.permissions) === null || _p === void 0 ? void 0 : _p.is_owner_group) !== null && _q !== void 0 ? _q : false,
|
|
702
|
-
lastOwner: new UUID_1.UUID((_r = item.permissions) === null || _r === void 0 ? void 0 : _r.last_owner_id),
|
|
703
|
-
nextOwnerMask: (_t = (_s = item.permissions) === null || _s === void 0 ? void 0 : _s.next_owner_mask) !== null && _t !== void 0 ? _t : 0,
|
|
704
|
-
owner: new UUID_1.UUID((_u = item.permissions) === null || _u === void 0 ? void 0 : _u.owner_id),
|
|
705
|
-
ownerMask: (_w = (_v = item.permissions) === null || _v === void 0 ? void 0 : _v.owner_mask) !== null && _w !== void 0 ? _w : 0
|
|
706
|
-
};
|
|
707
|
-
invItem.salePrice = (_y = (_x = item.sale_info) === null || _x === void 0 ? void 0 : _x.sale_price) !== null && _y !== void 0 ? _y : 0;
|
|
708
|
-
switch ((_z = item.sale_info) === null || _z === void 0 ? void 0 : _z.sale_type) {
|
|
709
|
-
case 'not':
|
|
710
|
-
invItem.saleType = 0;
|
|
711
|
-
break;
|
|
712
|
-
case 'orig':
|
|
713
|
-
invItem.saleType = 1;
|
|
714
|
-
break;
|
|
715
|
-
case 'copy':
|
|
716
|
-
invItem.saleType = 2;
|
|
717
|
-
break;
|
|
718
|
-
case 'cntn':
|
|
719
|
-
invItem.saleType = 3;
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
invItem.type = Utils_1.Utils.capInventoryTypeToAssetType((_0 = item.inv_type) !== null && _0 !== void 0 ? _0 : '');
|
|
723
|
-
this.inventory.push(invItem);
|
|
724
|
-
}
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
catch (e) {
|
|
729
|
-
}
|
|
730
|
-
const req = new RequestTaskInventory_1.RequestTaskInventoryMessage();
|
|
731
|
-
req.AgentData = {
|
|
732
|
-
AgentID: this.region.agent.agentID,
|
|
733
|
-
SessionID: this.region.circuit.sessionID
|
|
734
|
-
};
|
|
735
|
-
req.InventoryData = {
|
|
736
|
-
LocalID: this.ID
|
|
737
|
-
};
|
|
738
|
-
this.region.circuit.sendMessage(req, PacketFlags_1.PacketFlags.Reliable);
|
|
739
|
-
return this.waitForTaskInventory();
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
waitForTaskInventory() {
|
|
743
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
744
|
-
const inventory = yield this.region.circuit.waitForMessage(Message_1.Message.ReplyTaskInventory, 10000, (message) => {
|
|
745
|
-
if (message.InventoryData.TaskID.equals(this.FullID)) {
|
|
746
|
-
return FilterResponse_1.FilterResponse.Finish;
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
return FilterResponse_1.FilterResponse.Match;
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
if (inventory.InventoryData.Filename.length === 0) {
|
|
753
|
-
this.inventory = [];
|
|
754
|
-
this.resolvedInventory = true;
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
const fileName = Utils_1.Utils.BufferToStringSimple(inventory.InventoryData.Filename);
|
|
758
|
-
const file = yield this.region.circuit.XferFileDown(fileName, true, false, UUID_1.UUID.zero(), AssetType_1.AssetType.Unknown, true);
|
|
759
|
-
this.inventory = [];
|
|
760
|
-
if (file.length === 0) {
|
|
761
|
-
if (this.Flags === undefined) {
|
|
762
|
-
this.Flags = 0;
|
|
763
|
-
}
|
|
764
|
-
this.Flags = this.Flags | PrimFlags_1.PrimFlags.InventoryEmpty;
|
|
765
|
-
}
|
|
766
|
-
else {
|
|
767
|
-
const str = file.toString('utf-8');
|
|
768
|
-
const lineObj = {
|
|
769
|
-
lines: str.replace(/\r\n/g, '\n').split('\n'),
|
|
770
|
-
lineNum: 0,
|
|
771
|
-
pos: 0
|
|
772
|
-
};
|
|
773
|
-
while (lineObj.lineNum < lineObj.lines.length) {
|
|
774
|
-
const line = Utils_1.Utils.getNotecardLine(lineObj);
|
|
775
|
-
const result = Utils_1.Utils.parseLine(line);
|
|
776
|
-
if (result.key !== null) {
|
|
777
|
-
switch (result.key) {
|
|
778
|
-
case 'inv_object':
|
|
779
|
-
break;
|
|
780
|
-
case 'inv_item':
|
|
781
|
-
this.inventory.push(InventoryItem_1.InventoryItem.fromEmbeddedAsset(lineObj, this, this.region.agent));
|
|
782
|
-
break;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
this.resolvedInventory = true;
|
|
1378
|
+
if (file.length === 0) {
|
|
1379
|
+
if (this.Flags === undefined) {
|
|
1380
|
+
this.Flags = 0;
|
|
787
1381
|
}
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
hasNameValueEntry(key) {
|
|
791
|
-
return this.NameValue[key] !== undefined;
|
|
792
|
-
}
|
|
793
|
-
getNameValueEntry(key) {
|
|
794
|
-
if (this.NameValue[key]) {
|
|
795
|
-
return this.NameValue[key].value;
|
|
796
|
-
}
|
|
797
|
-
return '';
|
|
798
|
-
}
|
|
799
|
-
setIfDefined(def, v) {
|
|
800
|
-
if (def === undefined) {
|
|
801
|
-
def = 0;
|
|
802
|
-
}
|
|
803
|
-
if (v === undefined) {
|
|
804
|
-
return def;
|
|
1382
|
+
this.Flags = this.Flags | PrimFlags_1.PrimFlags.InventoryEmpty;
|
|
805
1383
|
}
|
|
806
1384
|
else {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
this.PathCurve = this.setIfDefined(this.PathCurve, PathCurve);
|
|
813
|
-
this.ProfileCurve = this.setIfDefined(this.ProfileCurve, ProfileCurve);
|
|
814
|
-
this.PathBegin = this.setIfDefined(this.PathBegin, PathBegin);
|
|
815
|
-
this.PathEnd = this.setIfDefined(this.PathEnd, PathEnd);
|
|
816
|
-
this.PathScaleX = this.setIfDefined(this.PathScaleX, PathScaleX);
|
|
817
|
-
this.PathScaleY = this.setIfDefined(this.PathScaleY, PathScaleY);
|
|
818
|
-
this.PathShearX = this.setIfDefined(this.PathShearX, PathShearX);
|
|
819
|
-
this.PathShearY = this.setIfDefined(this.PathShearY, PathShearY);
|
|
820
|
-
this.PathTwist = this.setIfDefined(this.PathTwist, PathTwist);
|
|
821
|
-
this.PathTwistBegin = this.setIfDefined(this.PathTwistBegin, PathTwistBegin);
|
|
822
|
-
this.PathRadiusOffset = this.setIfDefined(this.PathRadiusOffset, PathRadiusOffset);
|
|
823
|
-
this.PathTaperX = this.setIfDefined(this.PathTaperX, PathTaperX);
|
|
824
|
-
this.PathTaperY = this.setIfDefined(this.PathTaperY, PathTaperY);
|
|
825
|
-
this.PathRevolutions = this.setIfDefined(this.PathRevolutions, PathRevolutions);
|
|
826
|
-
this.PathSkew = this.setIfDefined(this.PathSkew, PathSkew);
|
|
827
|
-
this.ProfileBegin = this.setIfDefined(this.ProfileBegin, ProfileBegin);
|
|
828
|
-
this.ProfileEnd = this.setIfDefined(this.ProfileEnd, ProfileEnd);
|
|
829
|
-
this.ProfileHollow = this.setIfDefined(this.ProfileHollow, ProfileHollow);
|
|
830
|
-
if (!this.region) {
|
|
831
|
-
return;
|
|
832
|
-
}
|
|
833
|
-
const msg = new ObjectShape_1.ObjectShapeMessage();
|
|
834
|
-
msg.AgentData = {
|
|
835
|
-
AgentID: this.region.agent.agentID,
|
|
836
|
-
SessionID: this.region.circuit.sessionID
|
|
837
|
-
};
|
|
838
|
-
msg.ObjectData = [
|
|
839
|
-
{
|
|
840
|
-
ObjectLocalID: this.ID,
|
|
841
|
-
PathCurve: this.PathCurve,
|
|
842
|
-
ProfileCurve: this.ProfileCurve,
|
|
843
|
-
PathBegin: Utils_1.Utils.packBeginCut(this.PathBegin),
|
|
844
|
-
PathEnd: Utils_1.Utils.packEndCut(this.PathEnd),
|
|
845
|
-
PathScaleX: Utils_1.Utils.packPathScale(this.PathScaleX),
|
|
846
|
-
PathScaleY: Utils_1.Utils.packPathScale(this.PathScaleY),
|
|
847
|
-
PathShearX: Utils_1.Utils.packPathShear(this.PathShearX),
|
|
848
|
-
PathShearY: Utils_1.Utils.packPathShear(this.PathShearY),
|
|
849
|
-
PathTwist: Utils_1.Utils.packPathTwist(this.PathTwist),
|
|
850
|
-
PathTwistBegin: Utils_1.Utils.packPathTwist(this.PathTwistBegin),
|
|
851
|
-
PathRadiusOffset: Utils_1.Utils.packPathTwist(this.PathRadiusOffset),
|
|
852
|
-
PathTaperX: Utils_1.Utils.packPathTaper(this.PathTaperX),
|
|
853
|
-
PathTaperY: Utils_1.Utils.packPathTaper(this.PathTaperY),
|
|
854
|
-
PathRevolutions: Utils_1.Utils.packPathRevolutions(this.PathRevolutions),
|
|
855
|
-
PathSkew: Utils_1.Utils.packPathTwist(this.PathSkew),
|
|
856
|
-
ProfileBegin: Utils_1.Utils.packBeginCut(this.ProfileBegin),
|
|
857
|
-
ProfileEnd: Utils_1.Utils.packEndCut(this.ProfileEnd),
|
|
858
|
-
ProfileHollow: Utils_1.Utils.packProfileHollow(this.ProfileHollow)
|
|
859
|
-
}
|
|
860
|
-
];
|
|
861
|
-
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
setName(name) {
|
|
865
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
866
|
-
this.name = name;
|
|
867
|
-
if (!this.region) {
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
870
|
-
const msg = new ObjectName_1.ObjectNameMessage();
|
|
871
|
-
msg.AgentData = {
|
|
872
|
-
AgentID: this.region.agent.agentID,
|
|
873
|
-
SessionID: this.region.circuit.sessionID
|
|
874
|
-
};
|
|
875
|
-
msg.ObjectData = [
|
|
876
|
-
{
|
|
877
|
-
LocalID: this.ID,
|
|
878
|
-
Name: Utils_1.Utils.StringToBuffer(name)
|
|
879
|
-
}
|
|
880
|
-
];
|
|
881
|
-
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
setGeometry(pos_1, rot_1, scale_1) {
|
|
885
|
-
return __awaiter(this, arguments, void 0, function* (pos, rot, scale, wholeLinkset = false) {
|
|
886
|
-
const data = [];
|
|
887
|
-
const linked = (wholeLinkset) ? UpdateType_1.UpdateType.Linked : 0;
|
|
888
|
-
if (pos !== undefined) {
|
|
889
|
-
this.Position = pos;
|
|
890
|
-
data.push({
|
|
891
|
-
ObjectLocalID: this.ID,
|
|
892
|
-
Type: UpdateType_1.UpdateType.Position | linked,
|
|
893
|
-
Data: pos.getBuffer()
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
if (rot !== undefined) {
|
|
897
|
-
this.Rotation = rot;
|
|
898
|
-
data.push({
|
|
899
|
-
ObjectLocalID: this.ID,
|
|
900
|
-
Type: UpdateType_1.UpdateType.Rotation | linked,
|
|
901
|
-
Data: rot.getBuffer()
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
if (scale !== undefined) {
|
|
905
|
-
this.Scale = scale;
|
|
906
|
-
data.push({
|
|
907
|
-
ObjectLocalID: this.ID,
|
|
908
|
-
Type: UpdateType_1.UpdateType.Scale | linked,
|
|
909
|
-
Data: scale.getBuffer()
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
if (!this.region || data.length === 0) {
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
const msg = new MultipleObjectUpdate_1.MultipleObjectUpdateMessage();
|
|
916
|
-
msg.AgentData = {
|
|
917
|
-
AgentID: this.region.agent.agentID,
|
|
918
|
-
SessionID: this.region.circuit.sessionID
|
|
1385
|
+
const str = file.toString('utf-8');
|
|
1386
|
+
const lineObj = {
|
|
1387
|
+
lines: str.replace(/\r\n/g, '\n').split('\n'),
|
|
1388
|
+
lineNum: 0,
|
|
1389
|
+
pos: 0
|
|
919
1390
|
};
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
msg.ObjectData = [
|
|
931
|
-
{
|
|
932
|
-
ObjectLocalID: rootObj.ID
|
|
933
|
-
},
|
|
934
|
-
{
|
|
935
|
-
ObjectLocalID: this.ID
|
|
936
|
-
}
|
|
937
|
-
];
|
|
938
|
-
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 30000);
|
|
939
|
-
}
|
|
940
|
-
linkFrom(objects) {
|
|
941
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
942
|
-
return new Promise((resolve, reject) => {
|
|
943
|
-
if (objects.length === 0) {
|
|
944
|
-
resolve();
|
|
945
|
-
return;
|
|
946
|
-
}
|
|
947
|
-
const primsExpectingUpdate = {};
|
|
948
|
-
const msg = new ObjectLink_1.ObjectLinkMessage();
|
|
949
|
-
msg.AgentData = {
|
|
950
|
-
AgentID: this.region.agent.agentID,
|
|
951
|
-
SessionID: this.region.circuit.sessionID
|
|
952
|
-
};
|
|
953
|
-
msg.ObjectData = [
|
|
954
|
-
{
|
|
955
|
-
ObjectLocalID: this.ID
|
|
956
|
-
}
|
|
957
|
-
];
|
|
958
|
-
primsExpectingUpdate[this.ID] = this;
|
|
959
|
-
for (const obj of objects) {
|
|
960
|
-
msg.ObjectData.push({
|
|
961
|
-
ObjectLocalID: obj.ID
|
|
962
|
-
});
|
|
963
|
-
primsExpectingUpdate[obj.ID] = obj;
|
|
964
|
-
}
|
|
965
|
-
this.region.circuit.waitForMessage(Message_1.Message.ObjectUpdate, 10000, (message) => {
|
|
966
|
-
let match = false;
|
|
967
|
-
for (const obj of message.ObjectData) {
|
|
968
|
-
const num = obj.ID;
|
|
969
|
-
if (primsExpectingUpdate[num] !== undefined) {
|
|
970
|
-
delete primsExpectingUpdate[num];
|
|
971
|
-
match = true;
|
|
972
|
-
}
|
|
1391
|
+
while (lineObj.lineNum < lineObj.lines.length) {
|
|
1392
|
+
const line = Utils_1.Utils.getNotecardLine(lineObj);
|
|
1393
|
+
const result = Utils_1.Utils.parseLine(line);
|
|
1394
|
+
if (result.key !== null) {
|
|
1395
|
+
switch (result.key) {
|
|
1396
|
+
case 'inv_object':
|
|
1397
|
+
break;
|
|
1398
|
+
case 'inv_item':
|
|
1399
|
+
this.inventory.push(InventoryItem_1.InventoryItem.fromEmbeddedAsset(lineObj, this, this.region.agent));
|
|
1400
|
+
break;
|
|
973
1401
|
}
|
|
974
|
-
if (match) {
|
|
975
|
-
if (Object.keys(primsExpectingUpdate).length === 0) {
|
|
976
|
-
return FilterResponse_1.FilterResponse.Finish;
|
|
977
|
-
}
|
|
978
|
-
return FilterResponse_1.FilterResponse.Match;
|
|
979
|
-
}
|
|
980
|
-
return FilterResponse_1.FilterResponse.NoMatch;
|
|
981
|
-
}).then(() => {
|
|
982
|
-
resolve();
|
|
983
|
-
}).catch((err) => {
|
|
984
|
-
reject(err);
|
|
985
|
-
});
|
|
986
|
-
this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
987
|
-
});
|
|
988
|
-
});
|
|
989
|
-
}
|
|
990
|
-
setDescription(desc) {
|
|
991
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
992
|
-
this.description = desc;
|
|
993
|
-
if (!this.region) {
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
const msg = new ObjectDescription_1.ObjectDescriptionMessage();
|
|
997
|
-
msg.AgentData = {
|
|
998
|
-
AgentID: this.region.agent.agentID,
|
|
999
|
-
SessionID: this.region.circuit.sessionID
|
|
1000
|
-
};
|
|
1001
|
-
msg.ObjectData = [
|
|
1002
|
-
{
|
|
1003
|
-
LocalID: this.ID,
|
|
1004
|
-
Description: Utils_1.Utils.StringToBuffer(desc)
|
|
1005
1402
|
}
|
|
1006
|
-
];
|
|
1007
|
-
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
setTextureEntry(e) {
|
|
1011
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
-
this.TextureEntry = e;
|
|
1013
|
-
if (!this.region) {
|
|
1014
|
-
return;
|
|
1015
1403
|
}
|
|
1016
|
-
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
setTextureAndMediaURL() {
|
|
1020
|
-
const msg = new ObjectImage_1.ObjectImageMessage();
|
|
1021
|
-
msg.AgentData = {
|
|
1022
|
-
AgentID: this.region.agent.agentID,
|
|
1023
|
-
SessionID: this.region.circuit.sessionID
|
|
1024
|
-
};
|
|
1025
|
-
if (this.MediaURL === undefined) {
|
|
1026
|
-
this.MediaURL = '';
|
|
1404
|
+
this.resolvedInventory = true;
|
|
1027
1405
|
}
|
|
1028
|
-
if (this.TextureEntry === undefined) {
|
|
1029
|
-
this.TextureEntry = new TextureEntry_1.TextureEntry();
|
|
1030
|
-
}
|
|
1031
|
-
msg.ObjectData = [
|
|
1032
|
-
{
|
|
1033
|
-
ObjectLocalID: this.ID,
|
|
1034
|
-
TextureEntry: this.TextureEntry.toBuffer(),
|
|
1035
|
-
MediaURL: Utils_1.Utils.StringToBuffer(this.MediaURL)
|
|
1036
|
-
}
|
|
1037
|
-
];
|
|
1038
|
-
return this.region.circuit.waitForAck(this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable), 10000);
|
|
1039
|
-
}
|
|
1040
|
-
setExtraParams(ex) {
|
|
1041
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1042
|
-
this.extraParams = ex;
|
|
1043
|
-
if (!this.region) {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
const msg = new ObjectExtraParams_1.ObjectExtraParamsMessage();
|
|
1047
|
-
msg.AgentData = {
|
|
1048
|
-
AgentID: this.region.agent.agentID,
|
|
1049
|
-
SessionID: this.region.circuit.sessionID
|
|
1050
|
-
};
|
|
1051
|
-
msg.ObjectData = [];
|
|
1052
|
-
let params = 0;
|
|
1053
|
-
if (ex.lightData !== null) {
|
|
1054
|
-
params++;
|
|
1055
|
-
const data = ex.lightData.getBuffer();
|
|
1056
|
-
msg.ObjectData.push({
|
|
1057
|
-
ObjectLocalID: this.ID,
|
|
1058
|
-
ParamType: ExtraParamType_1.ExtraParamType.Light,
|
|
1059
|
-
ParamInUse: (ex.lightData.Intensity !== 0.0),
|
|
1060
|
-
ParamData: data,
|
|
1061
|
-
ParamSize: data.length
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
if (ex.flexibleData !== null) {
|
|
1065
|
-
params++;
|
|
1066
|
-
const data = ex.flexibleData.getBuffer();
|
|
1067
|
-
msg.ObjectData.push({
|
|
1068
|
-
ObjectLocalID: this.ID,
|
|
1069
|
-
ParamType: ExtraParamType_1.ExtraParamType.Flexible,
|
|
1070
|
-
ParamInUse: true,
|
|
1071
|
-
ParamData: data,
|
|
1072
|
-
ParamSize: data.length
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
if (ex.lightImageData !== null) {
|
|
1076
|
-
params++;
|
|
1077
|
-
const data = ex.lightImageData.getBuffer();
|
|
1078
|
-
msg.ObjectData.push({
|
|
1079
|
-
ObjectLocalID: this.ID,
|
|
1080
|
-
ParamType: ExtraParamType_1.ExtraParamType.LightImage,
|
|
1081
|
-
ParamInUse: true,
|
|
1082
|
-
ParamData: data,
|
|
1083
|
-
ParamSize: data.length
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
if (ex.sculptData !== null) {
|
|
1087
|
-
params++;
|
|
1088
|
-
const data = ex.sculptData.getBuffer();
|
|
1089
|
-
msg.ObjectData.push({
|
|
1090
|
-
ObjectLocalID: this.ID,
|
|
1091
|
-
ParamType: ExtraParamType_1.ExtraParamType.Sculpt,
|
|
1092
|
-
ParamInUse: true,
|
|
1093
|
-
ParamData: data,
|
|
1094
|
-
ParamSize: data.length
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
if (ex.meshData !== null) {
|
|
1098
|
-
params++;
|
|
1099
|
-
const data = ex.meshData.getBuffer();
|
|
1100
|
-
msg.ObjectData.push({
|
|
1101
|
-
ObjectLocalID: this.ID,
|
|
1102
|
-
ParamType: ExtraParamType_1.ExtraParamType.Mesh,
|
|
1103
|
-
ParamInUse: true,
|
|
1104
|
-
ParamData: data,
|
|
1105
|
-
ParamSize: data.length
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1108
|
-
if (params > 0) {
|
|
1109
|
-
const ack = this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
1110
|
-
return this.region.circuit.waitForAck(ack, 10000);
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
1406
|
}
|
|
1114
|
-
getInventoryXML(xml, inv) {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
inv.flags = inv.flags | wearable.type;
|
|
1144
|
-
}
|
|
1145
|
-
catch (error) {
|
|
1146
|
-
console.error(error);
|
|
1147
|
-
}
|
|
1407
|
+
async getInventoryXML(xml, inv) {
|
|
1408
|
+
if (!inv.assetID.isZero() || !inv.itemID.isZero()) {
|
|
1409
|
+
const item = xml.ele('TaskInventoryItem');
|
|
1410
|
+
if (inv.inventoryType === InventoryType_1.InventoryType.Object && inv.assetID.isZero()) {
|
|
1411
|
+
inv.assetID = inv.itemID;
|
|
1412
|
+
}
|
|
1413
|
+
UUID_1.UUID.getXML(item.ele('AssetID'), inv.assetID);
|
|
1414
|
+
UUID_1.UUID.getXML(item.ele('ItemID'), inv.itemID);
|
|
1415
|
+
if (inv.permissions !== undefined) {
|
|
1416
|
+
item.ele('BasePermissions', inv.permissions.baseMask);
|
|
1417
|
+
item.ele('EveryonePermissions', inv.permissions.everyoneMask);
|
|
1418
|
+
item.ele('GroupPermissions', inv.permissions.groupMask);
|
|
1419
|
+
item.ele('NextPermissions', inv.permissions.nextOwnerMask);
|
|
1420
|
+
item.ele('CurrentPermissions', inv.permissions.ownerMask);
|
|
1421
|
+
item.ele('PermsMask', 0);
|
|
1422
|
+
UUID_1.UUID.getXML(item.ele('CreatorID'), inv.permissions.creator);
|
|
1423
|
+
UUID_1.UUID.getXML(item.ele('LastOwnerID'), inv.permissions.lastOwner);
|
|
1424
|
+
UUID_1.UUID.getXML(item.ele('OwnerID'), inv.permissions.owner);
|
|
1425
|
+
UUID_1.UUID.getXML(item.ele('GroupID'), inv.permissions.group);
|
|
1426
|
+
}
|
|
1427
|
+
item.ele('CreationDate', inv.created.getTime() / 1000);
|
|
1428
|
+
item.ele('Description', inv.description);
|
|
1429
|
+
item.ele('InvType', inv.inventoryType);
|
|
1430
|
+
if (inv.inventoryType === InventoryType_1.InventoryType.Wearable && !inv.assetID.isZero()) {
|
|
1431
|
+
try {
|
|
1432
|
+
const type = (inv.type === AssetType_1.AssetType.Clothing) ? AssetType_1.AssetType.Clothing : AssetType_1.AssetType.Bodypart;
|
|
1433
|
+
const data = await this.region.clientCommands.asset.downloadAsset(type, inv.assetID);
|
|
1434
|
+
const wearable = new LLWearable_1.LLWearable(data.toString('utf-8'));
|
|
1435
|
+
inv.flags = inv.flags | wearable.type;
|
|
1148
1436
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
UUID_1.UUID.getXML(item.ele('ParentPartID'), this.FullID);
|
|
1152
|
-
item.ele('Type', inv.type);
|
|
1153
|
-
item.ele('Name', inv.name);
|
|
1154
|
-
}
|
|
1155
|
-
});
|
|
1156
|
-
}
|
|
1157
|
-
getXML(xml_1, rootPrim_1, linkNum_1, rootNode_1) {
|
|
1158
|
-
return __awaiter(this, arguments, void 0, function* (xml, rootPrim, linkNum, rootNode, skipInventory = false, skipResolve = false) {
|
|
1159
|
-
var _a;
|
|
1160
|
-
if (!skipResolve) {
|
|
1161
|
-
const resolver = (_a = this.region) === null || _a === void 0 ? void 0 : _a.resolver;
|
|
1162
|
-
if (resolver) {
|
|
1163
|
-
if (this.resolvedAt === undefined) {
|
|
1164
|
-
try {
|
|
1165
|
-
yield resolver.resolveObjects([this], { includeTempObjects: true });
|
|
1166
|
-
}
|
|
1167
|
-
catch (e) {
|
|
1168
|
-
Logger_1.Logger.Error(e);
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
if (!this.resolvedInventory && !skipInventory) {
|
|
1172
|
-
try {
|
|
1173
|
-
yield resolver.getInventory(this);
|
|
1174
|
-
}
|
|
1175
|
-
catch (e) {
|
|
1176
|
-
Logger_1.Logger.Error(e);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
if (this.calculatedLandImpact === undefined) {
|
|
1180
|
-
try {
|
|
1181
|
-
yield resolver.getCosts([this]);
|
|
1182
|
-
}
|
|
1183
|
-
catch (e) {
|
|
1184
|
-
Logger_1.Logger.Error(e);
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1437
|
+
catch (error) {
|
|
1438
|
+
console.error(error);
|
|
1187
1439
|
}
|
|
1188
1440
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
sceneObjectPart.ele('InventorySerial', this.inventorySerial);
|
|
1198
|
-
UUID_1.UUID.getXML(sceneObjectPart.ele('UUID'), this.FullID);
|
|
1199
|
-
sceneObjectPart.ele('LocalId', this.ID);
|
|
1200
|
-
sceneObjectPart.ele('Name', this.name);
|
|
1201
|
-
sceneObjectPart.ele('Material', this.Material);
|
|
1202
|
-
if (this.region) {
|
|
1203
|
-
sceneObjectPart.ele('RegionHandle', this.region.regionHandle.toString());
|
|
1204
|
-
}
|
|
1205
|
-
Vector3_1.Vector3.getXML(sceneObjectPart.ele('GroupPosition'), rootPrim.Position);
|
|
1206
|
-
if (rootPrim === this) {
|
|
1207
|
-
Vector3_1.Vector3.getXML(sceneObjectPart.ele('OffsetPosition'), Vector3_1.Vector3.getZero());
|
|
1441
|
+
item.ele('Flags', inv.flags);
|
|
1442
|
+
UUID_1.UUID.getXML(item.ele('ParentID'), this.FullID);
|
|
1443
|
+
UUID_1.UUID.getXML(item.ele('ParentPartID'), this.FullID);
|
|
1444
|
+
item.ele('Type', inv.type);
|
|
1445
|
+
item.ele('Name', inv.name);
|
|
1446
|
+
if (inv.type === AssetType_1.AssetType.LSLText) {
|
|
1447
|
+
item.ele('ScriptRunning', inv.scriptRunning);
|
|
1448
|
+
item.ele('ScriptMono', inv.scriptMono);
|
|
1208
1449
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
}
|
|
1223
|
-
sceneObjectPart.ele('SitName', this.sitName);
|
|
1224
|
-
sceneObjectPart.ele('TouchName', this.touchName);
|
|
1225
|
-
sceneObjectPart.ele('LinkNum', linkNum);
|
|
1226
|
-
sceneObjectPart.ele('ClickAction', this.ClickAction);
|
|
1227
|
-
const shape = sceneObjectPart.ele('Shape');
|
|
1228
|
-
{
|
|
1229
|
-
shape.ele('ProfileCurve', this.ProfileCurve);
|
|
1230
|
-
if (this.TextureEntry) {
|
|
1231
|
-
shape.ele('TextureEntry', this.TextureEntry.toBase64());
|
|
1232
|
-
if (this.TextureEntry.gltfMaterialOverrides) {
|
|
1233
|
-
const overrideKeys = Array.from(this.TextureEntry.gltfMaterialOverrides.keys());
|
|
1234
|
-
const numEntries = overrideKeys.length;
|
|
1235
|
-
if (numEntries > 0) {
|
|
1236
|
-
const buf = [];
|
|
1237
|
-
const num = Buffer.allocUnsafe(1);
|
|
1238
|
-
num.writeUInt8(numEntries, 0);
|
|
1239
|
-
buf.push(num);
|
|
1240
|
-
for (const overrideKey of overrideKeys) {
|
|
1241
|
-
const override = this.TextureEntry.gltfMaterialOverrides.get(overrideKey);
|
|
1242
|
-
if (override === undefined) {
|
|
1243
|
-
continue;
|
|
1244
|
-
}
|
|
1245
|
-
const header = Buffer.allocUnsafe(3);
|
|
1246
|
-
header.writeUInt8(overrideKey, 0);
|
|
1247
|
-
const json = override.getFullMaterialJSON();
|
|
1248
|
-
header.writeUInt16LE(json.length, 1);
|
|
1249
|
-
buf.push(header);
|
|
1250
|
-
buf.push(Buffer.from(json, 'utf-8'));
|
|
1251
|
-
}
|
|
1252
|
-
shape.ele('MatOvrd', Buffer.concat(buf).toString('base64'));
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
if (this.extraParams) {
|
|
1257
|
-
shape.ele('ExtraParams', this.extraParams.toBase64());
|
|
1258
|
-
}
|
|
1259
|
-
shape.ele('PathBegin', Utils_1.Utils.packBeginCut(Utils_1.Utils.numberOrZero(this.PathBegin)));
|
|
1260
|
-
shape.ele('PathCurve', this.PathCurve);
|
|
1261
|
-
shape.ele('PathEnd', Utils_1.Utils.packEndCut(Utils_1.Utils.numberOrZero(this.PathEnd)));
|
|
1262
|
-
shape.ele('PathRadiusOffset', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathRadiusOffset)));
|
|
1263
|
-
shape.ele('PathRevolutions', Utils_1.Utils.packPathRevolutions(Utils_1.Utils.numberOrZero(this.PathRevolutions)));
|
|
1264
|
-
shape.ele('PathScaleX', Utils_1.Utils.packPathScale(Utils_1.Utils.numberOrZero(this.PathScaleX)));
|
|
1265
|
-
shape.ele('PathScaleY', Utils_1.Utils.packPathScale(Utils_1.Utils.numberOrZero(this.PathScaleY)));
|
|
1266
|
-
shape.ele('PathShearX', Utils_1.Utils.packPathShear(Utils_1.Utils.numberOrZero(this.PathShearX)));
|
|
1267
|
-
shape.ele('PathShearY', Utils_1.Utils.packPathShear(Utils_1.Utils.numberOrZero(this.PathShearY)));
|
|
1268
|
-
shape.ele('PathSkew', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathSkew)));
|
|
1269
|
-
shape.ele('PathTaperX', Utils_1.Utils.packPathTaper(Utils_1.Utils.numberOrZero(this.PathTaperX)));
|
|
1270
|
-
shape.ele('PathTaperY', Utils_1.Utils.packPathTaper(Utils_1.Utils.numberOrZero(this.PathTaperY)));
|
|
1271
|
-
shape.ele('PathTwist', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathTwist)));
|
|
1272
|
-
shape.ele('PathTwistBegin', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathTwistBegin)));
|
|
1273
|
-
shape.ele('PCode', this.PCode);
|
|
1274
|
-
shape.ele('ProfileBegin', Utils_1.Utils.packBeginCut(Utils_1.Utils.numberOrZero(this.ProfileBegin)));
|
|
1275
|
-
shape.ele('ProfileEnd', Utils_1.Utils.packEndCut(Utils_1.Utils.numberOrZero(this.ProfileEnd)));
|
|
1276
|
-
shape.ele('ProfileHollow', Utils_1.Utils.packProfileHollow(Utils_1.Utils.numberOrZero(this.ProfileHollow)));
|
|
1277
|
-
const mask = 0xf << 4 >>> 0;
|
|
1278
|
-
if (this.State === undefined) {
|
|
1279
|
-
this.State = 0;
|
|
1280
|
-
}
|
|
1281
|
-
let state = (((this.State & mask) >>> 4) | ((this.State & ~mask) << 4)) >>> 0;
|
|
1282
|
-
state = state | this.attachmentPoint;
|
|
1283
|
-
shape.ele('State', state);
|
|
1284
|
-
shape.ele('LastAttachPoint', 0);
|
|
1285
|
-
if (this.ProfileCurve) {
|
|
1286
|
-
const profileShape = this.ProfileCurve & 0x0F;
|
|
1287
|
-
const holeType = this.ProfileCurve & 0xF0;
|
|
1288
|
-
shape.ele('ProfileShape', ProfileShape_1.ProfileShape[profileShape]);
|
|
1289
|
-
shape.ele('HollowShape', HoleType_1.HoleType[holeType]);
|
|
1290
|
-
}
|
|
1291
|
-
if (this.extraParams !== undefined && this.extraParams.meshData !== null) {
|
|
1292
|
-
shape.ele('SculptType', this.extraParams.meshData.type);
|
|
1293
|
-
UUID_1.UUID.getXML(shape.ele('SculptTexture'), this.extraParams.meshData.meshData);
|
|
1294
|
-
shape.ele('SculptEntry', true);
|
|
1295
|
-
}
|
|
1296
|
-
else if (this.extraParams !== undefined && this.extraParams.sculptData !== null) {
|
|
1297
|
-
shape.ele('SculptType', this.extraParams.sculptData.type);
|
|
1298
|
-
UUID_1.UUID.getXML(shape.ele('SculptTexture'), this.extraParams.sculptData.texture);
|
|
1299
|
-
shape.ele('SculptEntry', true);
|
|
1300
|
-
}
|
|
1301
|
-
else {
|
|
1302
|
-
shape.ele('SculptEntry', false);
|
|
1303
|
-
}
|
|
1304
|
-
if (this.extraParams !== undefined && this.extraParams.flexibleData !== null) {
|
|
1305
|
-
shape.ele('FlexiSoftness', this.extraParams.flexibleData.Softness);
|
|
1306
|
-
shape.ele('FlexiTension', this.extraParams.flexibleData.Tension);
|
|
1307
|
-
shape.ele('FlexiDrag', this.extraParams.flexibleData.Drag);
|
|
1308
|
-
shape.ele('FlexiGravity', this.extraParams.flexibleData.Gravity);
|
|
1309
|
-
shape.ele('FlexiWind', this.extraParams.flexibleData.Wind);
|
|
1310
|
-
shape.ele('FlexiForceX', this.extraParams.flexibleData.Force.x);
|
|
1311
|
-
shape.ele('FlexiForceY', this.extraParams.flexibleData.Force.y);
|
|
1312
|
-
shape.ele('FlexiForceZ', this.extraParams.flexibleData.Force.z);
|
|
1313
|
-
shape.ele('FlexiEntry', true);
|
|
1314
|
-
}
|
|
1315
|
-
else {
|
|
1316
|
-
shape.ele('FlexiEntry', false);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
async getXML(xml, rootPrim, linkNum, rootNode, skipInventory = false, skipResolve = false) {
|
|
1453
|
+
if (!skipResolve) {
|
|
1454
|
+
const resolver = this.region?.resolver;
|
|
1455
|
+
if (resolver !== undefined) {
|
|
1456
|
+
if (this.resolvedAt === undefined) {
|
|
1457
|
+
try {
|
|
1458
|
+
await resolver.resolveObjects([this], { includeTempObjects: true });
|
|
1459
|
+
}
|
|
1460
|
+
catch (e) {
|
|
1461
|
+
Logger_1.Logger.Error(e);
|
|
1462
|
+
}
|
|
1317
1463
|
}
|
|
1318
|
-
if (this.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
shape.ele('LightFalloff', this.extraParams.lightData.Falloff);
|
|
1326
|
-
shape.ele('LightIntensity', this.extraParams.lightData.Intensity);
|
|
1327
|
-
shape.ele('LightEntry', true);
|
|
1464
|
+
if (!this.resolvedInventory && !skipInventory) {
|
|
1465
|
+
try {
|
|
1466
|
+
await resolver.getInventory(this);
|
|
1467
|
+
}
|
|
1468
|
+
catch (e) {
|
|
1469
|
+
Logger_1.Logger.Error(e);
|
|
1470
|
+
}
|
|
1328
1471
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1472
|
+
if (this.calculatedLandImpact === undefined) {
|
|
1473
|
+
try {
|
|
1474
|
+
await resolver.getCosts([this]);
|
|
1475
|
+
}
|
|
1476
|
+
catch (e) {
|
|
1477
|
+
Logger_1.Logger.Error(e);
|
|
1478
|
+
}
|
|
1331
1479
|
}
|
|
1332
1480
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
sceneObjectPart.ele('
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1481
|
+
}
|
|
1482
|
+
let root = xml;
|
|
1483
|
+
if (rootNode !== undefined) {
|
|
1484
|
+
root = xml.ele(rootNode);
|
|
1485
|
+
}
|
|
1486
|
+
const sceneObjectPart = root.ele('SceneObjectPart').att('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance').att('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
|
|
1487
|
+
sceneObjectPart.ele('AllowedDrop', (this.Flags !== undefined && (this.Flags & PrimFlags_1.PrimFlags.AllowInventoryDrop) === PrimFlags_1.PrimFlags.AllowInventoryDrop) ? 'true' : 'false');
|
|
1488
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('CreatorID'), this.creatorID);
|
|
1489
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('FolderID'), this.folderID);
|
|
1490
|
+
sceneObjectPart.ele('InventorySerial', this.inventorySerial);
|
|
1491
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('UUID'), this.FullID);
|
|
1492
|
+
sceneObjectPart.ele('LocalId', this.ID);
|
|
1493
|
+
sceneObjectPart.ele('Name', this.name);
|
|
1494
|
+
sceneObjectPart.ele('Material', this.Material);
|
|
1495
|
+
if (this.region !== undefined) {
|
|
1496
|
+
sceneObjectPart.ele('RegionHandle', this.region.regionHandle.toString());
|
|
1497
|
+
}
|
|
1498
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('GroupPosition'), rootPrim.Position);
|
|
1499
|
+
if (rootPrim === this) {
|
|
1500
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('OffsetPosition'), Vector3_1.Vector3.getZero());
|
|
1501
|
+
}
|
|
1502
|
+
else {
|
|
1503
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('OffsetPosition'), this.Position);
|
|
1504
|
+
}
|
|
1505
|
+
Quaternion_1.Quaternion.getXML(sceneObjectPart.ele('RotationOffset'), this.Rotation);
|
|
1506
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('Velocity'), this.Velocity);
|
|
1507
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('AngularVelocity'), this.AngularVelocity);
|
|
1508
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('Acceleration'), this.Acceleration);
|
|
1509
|
+
sceneObjectPart.ele('Description', this.description);
|
|
1510
|
+
if (this.Text !== undefined && this.Text !== '') {
|
|
1511
|
+
sceneObjectPart.ele('Text', this.Text);
|
|
1512
|
+
}
|
|
1513
|
+
if (this.TextColor !== undefined) {
|
|
1514
|
+
Color4_1.Color4.getXML(sceneObjectPart.ele('Color'), this.TextColor);
|
|
1515
|
+
}
|
|
1516
|
+
sceneObjectPart.ele('SitName', this.sitName);
|
|
1517
|
+
sceneObjectPart.ele('TouchName', this.touchName);
|
|
1518
|
+
sceneObjectPart.ele('LinkNum', linkNum);
|
|
1519
|
+
sceneObjectPart.ele('ClickAction', this.ClickAction);
|
|
1520
|
+
const shape = sceneObjectPart.ele('Shape');
|
|
1521
|
+
{
|
|
1522
|
+
shape.ele('ProfileCurve', this.ProfileCurve);
|
|
1523
|
+
if (this.TextureEntry) {
|
|
1524
|
+
shape.ele('TextureEntry', this.TextureEntry.toBase64());
|
|
1525
|
+
if (this.TextureEntry.gltfMaterialOverrides !== undefined) {
|
|
1526
|
+
const overrideKeys = Array.from(this.TextureEntry.gltfMaterialOverrides.keys());
|
|
1527
|
+
const numEntries = overrideKeys.length;
|
|
1528
|
+
if (numEntries > 0) {
|
|
1529
|
+
const buf = [];
|
|
1530
|
+
const num = Buffer.allocUnsafe(1);
|
|
1531
|
+
num.writeUInt8(numEntries, 0);
|
|
1532
|
+
buf.push(num);
|
|
1533
|
+
for (const overrideKey of overrideKeys) {
|
|
1534
|
+
const override = this.TextureEntry.gltfMaterialOverrides.get(overrideKey);
|
|
1535
|
+
if (override === undefined) {
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
const header = Buffer.allocUnsafe(3);
|
|
1539
|
+
header.writeUInt8(overrideKey, 0);
|
|
1540
|
+
const json = override.getFullMaterialJSON();
|
|
1541
|
+
header.writeUInt16LE(json.length, 1);
|
|
1542
|
+
buf.push(header);
|
|
1543
|
+
buf.push(Buffer.from(json, 'utf-8'));
|
|
1360
1544
|
}
|
|
1545
|
+
shape.ele('MatOvrd', Buffer.concat(buf).toString('base64'));
|
|
1361
1546
|
}
|
|
1362
1547
|
}
|
|
1363
1548
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1549
|
+
if (this.extraParams !== undefined) {
|
|
1550
|
+
shape.ele('ExtraParams', this.extraParams.toBase64());
|
|
1551
|
+
}
|
|
1552
|
+
shape.ele('PathBegin', Utils_1.Utils.packBeginCut(Utils_1.Utils.numberOrZero(this.PathBegin)));
|
|
1553
|
+
shape.ele('PathCurve', this.PathCurve);
|
|
1554
|
+
shape.ele('PathEnd', Utils_1.Utils.packEndCut(Utils_1.Utils.numberOrZero(this.PathEnd)));
|
|
1555
|
+
shape.ele('PathRadiusOffset', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathRadiusOffset)));
|
|
1556
|
+
shape.ele('PathRevolutions', Utils_1.Utils.packPathRevolutions(Utils_1.Utils.numberOrZero(this.PathRevolutions)));
|
|
1557
|
+
shape.ele('PathScaleX', Utils_1.Utils.packPathScale(Utils_1.Utils.numberOrZero(this.PathScaleX)));
|
|
1558
|
+
shape.ele('PathScaleY', Utils_1.Utils.packPathScale(Utils_1.Utils.numberOrZero(this.PathScaleY)));
|
|
1559
|
+
shape.ele('PathShearX', Utils_1.Utils.packPathShear(Utils_1.Utils.numberOrZero(this.PathShearX)));
|
|
1560
|
+
shape.ele('PathShearY', Utils_1.Utils.packPathShear(Utils_1.Utils.numberOrZero(this.PathShearY)));
|
|
1561
|
+
shape.ele('PathSkew', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathSkew)));
|
|
1562
|
+
shape.ele('PathTaperX', Utils_1.Utils.packPathTaper(Utils_1.Utils.numberOrZero(this.PathTaperX)));
|
|
1563
|
+
shape.ele('PathTaperY', Utils_1.Utils.packPathTaper(Utils_1.Utils.numberOrZero(this.PathTaperY)));
|
|
1564
|
+
shape.ele('PathTwist', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathTwist)));
|
|
1565
|
+
shape.ele('PathTwistBegin', Utils_1.Utils.packPathTwist(Utils_1.Utils.numberOrZero(this.PathTwistBegin)));
|
|
1566
|
+
shape.ele('PCode', this.PCode);
|
|
1567
|
+
shape.ele('ProfileBegin', Utils_1.Utils.packBeginCut(Utils_1.Utils.numberOrZero(this.ProfileBegin)));
|
|
1568
|
+
shape.ele('ProfileEnd', Utils_1.Utils.packEndCut(Utils_1.Utils.numberOrZero(this.ProfileEnd)));
|
|
1569
|
+
shape.ele('ProfileHollow', Utils_1.Utils.packProfileHollow(Utils_1.Utils.numberOrZero(this.ProfileHollow)));
|
|
1570
|
+
const mask = 0xf << 4 >>> 0;
|
|
1571
|
+
if (this.State === undefined) {
|
|
1572
|
+
this.State = 0;
|
|
1573
|
+
}
|
|
1574
|
+
let state = (((this.State & mask) >>> 4) | ((this.State & ~mask) << 4)) >>> 0;
|
|
1575
|
+
state = state | this.attachmentPoint;
|
|
1576
|
+
shape.ele('State', state);
|
|
1577
|
+
shape.ele('LastAttachPoint', 0);
|
|
1578
|
+
if (this.ProfileCurve !== undefined) {
|
|
1579
|
+
const profileShape = this.ProfileCurve & 0x0F;
|
|
1580
|
+
const holeType = this.ProfileCurve & 0xF0;
|
|
1581
|
+
shape.ele('ProfileShape', ProfileShape_1.ProfileShape[profileShape]);
|
|
1582
|
+
shape.ele('HollowShape', HoleType_1.HoleType[holeType]);
|
|
1583
|
+
}
|
|
1584
|
+
if (this.extraParams?.meshData !== null) {
|
|
1585
|
+
shape.ele('SculptType', this.extraParams.meshData.type);
|
|
1586
|
+
UUID_1.UUID.getXML(shape.ele('SculptTexture'), this.extraParams.meshData.meshData);
|
|
1587
|
+
shape.ele('SculptEntry', true);
|
|
1588
|
+
}
|
|
1589
|
+
else if (this.extraParams?.sculptData !== null) {
|
|
1590
|
+
shape.ele('SculptType', this.extraParams.sculptData.type);
|
|
1591
|
+
UUID_1.UUID.getXML(shape.ele('SculptTexture'), this.extraParams.sculptData.texture);
|
|
1592
|
+
shape.ele('SculptEntry', true);
|
|
1370
1593
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1594
|
+
else {
|
|
1595
|
+
shape.ele('SculptEntry', false);
|
|
1596
|
+
}
|
|
1597
|
+
if (this.extraParams?.flexibleData !== null) {
|
|
1598
|
+
shape.ele('FlexiSoftness', this.extraParams.flexibleData.Softness);
|
|
1599
|
+
shape.ele('FlexiTension', this.extraParams.flexibleData.Tension);
|
|
1600
|
+
shape.ele('FlexiDrag', this.extraParams.flexibleData.Drag);
|
|
1601
|
+
shape.ele('FlexiGravity', this.extraParams.flexibleData.Gravity);
|
|
1602
|
+
shape.ele('FlexiWind', this.extraParams.flexibleData.Wind);
|
|
1603
|
+
shape.ele('FlexiForceX', this.extraParams.flexibleData.Force.x);
|
|
1604
|
+
shape.ele('FlexiForceY', this.extraParams.flexibleData.Force.y);
|
|
1605
|
+
shape.ele('FlexiForceZ', this.extraParams.flexibleData.Force.z);
|
|
1606
|
+
shape.ele('FlexiEntry', true);
|
|
1373
1607
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1608
|
+
else {
|
|
1609
|
+
shape.ele('FlexiEntry', false);
|
|
1610
|
+
}
|
|
1611
|
+
if (this.extraParams?.lightData !== null) {
|
|
1612
|
+
shape.ele('LightColorR', this.extraParams.lightData.Color.red);
|
|
1613
|
+
shape.ele('LightColorG', this.extraParams.lightData.Color.green);
|
|
1614
|
+
shape.ele('LightColorB', this.extraParams.lightData.Color.blue);
|
|
1615
|
+
shape.ele('LightColorA', this.extraParams.lightData.Color.alpha);
|
|
1616
|
+
shape.ele('LightRadius', this.extraParams.lightData.Radius);
|
|
1617
|
+
shape.ele('LightCutoff', this.extraParams.lightData.Cutoff);
|
|
1618
|
+
shape.ele('LightFalloff', this.extraParams.lightData.Falloff);
|
|
1619
|
+
shape.ele('LightIntensity', this.extraParams.lightData.Intensity);
|
|
1620
|
+
shape.ele('LightEntry', true);
|
|
1380
1621
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
for (const inv of this.inventory) {
|
|
1384
|
-
yield this.getInventoryXML(inventory, inv);
|
|
1385
|
-
}
|
|
1622
|
+
else {
|
|
1623
|
+
shape.ele('LightEntry', false);
|
|
1386
1624
|
}
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1625
|
+
}
|
|
1626
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('Scale'), this.Scale);
|
|
1627
|
+
sceneObjectPart.ele('ParentID', this.ParentID);
|
|
1628
|
+
sceneObjectPart.ele('CreationDate', Math.round((new Date()).getTime() / 1000));
|
|
1629
|
+
sceneObjectPart.ele('Category', this.category);
|
|
1630
|
+
if (this.IsAttachment) {
|
|
1631
|
+
Vector3_1.Vector3.getXML(sceneObjectPart.ele('AttachPos'), this.Position);
|
|
1632
|
+
}
|
|
1633
|
+
sceneObjectPart.ele('SalePrice', this.salePrice);
|
|
1634
|
+
sceneObjectPart.ele('ObjectSaleType', this.saleType);
|
|
1635
|
+
sceneObjectPart.ele('OwnershipCost', this.ownershipCost);
|
|
1636
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('GroupID'), this.groupID);
|
|
1637
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('OwnerID'), this.OwnerID);
|
|
1638
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('LastOwnerID'), this.lastOwnerID);
|
|
1639
|
+
sceneObjectPart.ele('BaseMask', this.baseMask);
|
|
1640
|
+
sceneObjectPart.ele('OwnerMask', this.ownerMask);
|
|
1641
|
+
sceneObjectPart.ele('GroupMask', this.groupMask);
|
|
1642
|
+
sceneObjectPart.ele('EveryoneMask', this.everyoneMask);
|
|
1643
|
+
sceneObjectPart.ele('NextOwnerMask', this.nextOwnerMask);
|
|
1644
|
+
const flags = [];
|
|
1645
|
+
if (this.Flags !== undefined) {
|
|
1646
|
+
for (const flag of Object.keys(PrimFlags_1.PrimFlags)) {
|
|
1647
|
+
const fl = PrimFlags_1.PrimFlags;
|
|
1648
|
+
const flagName = flag;
|
|
1649
|
+
const flagValue = fl[flagName];
|
|
1650
|
+
if (this.Flags & flagValue) {
|
|
1651
|
+
flags.push(flagName);
|
|
1401
1652
|
}
|
|
1402
1653
|
}
|
|
1403
|
-
return document;
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
exportXML(rootNode_1) {
|
|
1407
|
-
return __awaiter(this, arguments, void 0, function* (rootNode, skipInventory = false, skipResolve = false) {
|
|
1408
|
-
return (yield this.exportXMLElement(rootNode, skipInventory, skipResolve)).end({ pretty: true, allowEmpty: true });
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
toJSON() {
|
|
1412
|
-
return {
|
|
1413
|
-
deleted: this.deleted,
|
|
1414
|
-
creatorID: this.creatorID,
|
|
1415
|
-
creationDate: this.creationDate,
|
|
1416
|
-
baseMask: this.baseMask,
|
|
1417
|
-
ownerMask: this.ownerMask,
|
|
1418
|
-
groupMask: this.groupMask,
|
|
1419
|
-
everyoneMask: this.everyoneMask,
|
|
1420
|
-
nextOwnerMask: this.nextOwnerMask,
|
|
1421
|
-
ownershipCost: this.ownershipCost,
|
|
1422
|
-
saleType: this.saleType,
|
|
1423
|
-
salePrice: this.salePrice,
|
|
1424
|
-
aggregatePerms: this.aggregatePerms,
|
|
1425
|
-
aggregatePermTextures: this.aggregatePermTextures,
|
|
1426
|
-
aggregatePermTexturesOwner: this.aggregatePermTexturesOwner,
|
|
1427
|
-
category: this.category,
|
|
1428
|
-
inventorySerial: this.inventorySerial,
|
|
1429
|
-
itemID: this.itemID,
|
|
1430
|
-
folderID: this.folderID,
|
|
1431
|
-
fromTaskID: this.fromTaskID,
|
|
1432
|
-
lastOwnerID: this.lastOwnerID,
|
|
1433
|
-
name: this.name,
|
|
1434
|
-
description: this.description,
|
|
1435
|
-
touchName: this.touchName,
|
|
1436
|
-
sitName: this.sitName,
|
|
1437
|
-
resolvedAt: this.resolvedAt,
|
|
1438
|
-
resolvedInventory: this.resolvedInventory,
|
|
1439
|
-
totalChildren: this.totalChildren,
|
|
1440
|
-
landImpact: this.landImpact,
|
|
1441
|
-
calculatedLandImpact: this.calculatedLandImpact,
|
|
1442
|
-
physicaImpact: this.physicaImpact,
|
|
1443
|
-
resourceImpact: this.resourceImpact,
|
|
1444
|
-
linkResourceImpact: this.linkResourceImpact,
|
|
1445
|
-
linkPhysicsImpact: this.linkPhysicsImpact,
|
|
1446
|
-
limitingType: this.limitingType,
|
|
1447
|
-
children: this.children,
|
|
1448
|
-
ID: this.ID,
|
|
1449
|
-
FullID: this.FullID,
|
|
1450
|
-
ParentID: this.ParentID,
|
|
1451
|
-
OwnerID: this.OwnerID,
|
|
1452
|
-
IsAttachment: this.IsAttachment,
|
|
1453
|
-
NameValue: this.NameValue,
|
|
1454
|
-
PCode: this.PCode,
|
|
1455
|
-
State: this.State,
|
|
1456
|
-
CRC: this.CRC,
|
|
1457
|
-
Material: this.Material,
|
|
1458
|
-
ClickAction: this.ClickAction,
|
|
1459
|
-
Scale: this.Scale,
|
|
1460
|
-
Flags: this.Flags,
|
|
1461
|
-
PathCurve: this.PathCurve,
|
|
1462
|
-
ProfileCurve: this.ProfileCurve,
|
|
1463
|
-
PathBegin: this.PathBegin,
|
|
1464
|
-
PathEnd: this.PathEnd,
|
|
1465
|
-
PathScaleX: this.PathScaleX,
|
|
1466
|
-
PathScaleY: this.PathScaleY,
|
|
1467
|
-
PathShearX: this.PathShearX,
|
|
1468
|
-
PathShearY: this.PathShearY,
|
|
1469
|
-
PathTwist: this.PathTwist,
|
|
1470
|
-
PathTwistBegin: this.PathTwistBegin,
|
|
1471
|
-
PathRadiusOffset: this.PathRadiusOffset,
|
|
1472
|
-
PathTaperX: this.PathTaperX,
|
|
1473
|
-
PathTaperY: this.PathTaperY,
|
|
1474
|
-
PathRevolutions: this.PathRevolutions,
|
|
1475
|
-
PathSkew: this.PathSkew,
|
|
1476
|
-
ProfileBegin: this.ProfileBegin,
|
|
1477
|
-
ProfileEnd: this.ProfileEnd,
|
|
1478
|
-
ProfileHollow: this.ProfileHollow,
|
|
1479
|
-
TextureEntry: this.TextureEntry,
|
|
1480
|
-
Text: this.Text,
|
|
1481
|
-
TextColor: this.TextColor,
|
|
1482
|
-
MediaURL: this.MediaURL,
|
|
1483
|
-
JointType: this.JointType,
|
|
1484
|
-
JointPivot: this.JointPivot,
|
|
1485
|
-
JointAxisOrAnchor: this.JointAxisOrAnchor,
|
|
1486
|
-
Position: this.Position,
|
|
1487
|
-
Rotation: this.Rotation,
|
|
1488
|
-
CollisionPlane: this.CollisionPlane,
|
|
1489
|
-
Velocity: this.Velocity,
|
|
1490
|
-
Acceleration: this.Acceleration,
|
|
1491
|
-
AngularVelocity: this.AngularVelocity,
|
|
1492
|
-
TreeSpecies: this.TreeSpecies,
|
|
1493
|
-
Sound: this.Sound,
|
|
1494
|
-
SoundGain: this.SoundGain,
|
|
1495
|
-
SoundFlags: this.SoundFlags,
|
|
1496
|
-
SoundRadius: this.SoundRadius,
|
|
1497
|
-
Particles: this.Particles,
|
|
1498
|
-
density: this.density,
|
|
1499
|
-
friction: this.friction,
|
|
1500
|
-
gravityMultiplier: this.gravityMultiplier,
|
|
1501
|
-
physicsShapeType: this.physicsShapeType,
|
|
1502
|
-
restitution: this.restitution
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
setObjectData(data) {
|
|
1506
|
-
let dataPos = 0;
|
|
1507
|
-
switch (data.length) {
|
|
1508
|
-
case 76:
|
|
1509
|
-
this.CollisionPlane = new Vector4_1.Vector4(data, dataPos);
|
|
1510
|
-
dataPos += 16;
|
|
1511
|
-
case 60:
|
|
1512
|
-
this.Position = new Vector3_1.Vector3(data, dataPos);
|
|
1513
|
-
dataPos += 12;
|
|
1514
|
-
this.Velocity = new Vector3_1.Vector3(data, dataPos);
|
|
1515
|
-
dataPos += 12;
|
|
1516
|
-
this.Acceleration = new Vector3_1.Vector3(data, dataPos);
|
|
1517
|
-
dataPos += 12;
|
|
1518
|
-
this.Rotation = new Quaternion_1.Quaternion(data, dataPos);
|
|
1519
|
-
dataPos += 12;
|
|
1520
|
-
this.AngularVelocity = new Vector3_1.Vector3(data, dataPos);
|
|
1521
|
-
dataPos += 12;
|
|
1522
|
-
break;
|
|
1523
|
-
case 48:
|
|
1524
|
-
this.CollisionPlane = new Vector4_1.Vector4(data, dataPos);
|
|
1525
|
-
dataPos += 16;
|
|
1526
|
-
case 32:
|
|
1527
|
-
this.Position = new Vector3_1.Vector3([
|
|
1528
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -0.5 * 256.0, 1.5 * 256.0),
|
|
1529
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -0.5 * 256.0, 1.5 * 256.0),
|
|
1530
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 3.0 * 256.0)
|
|
1531
|
-
]);
|
|
1532
|
-
dataPos += 6;
|
|
1533
|
-
this.Velocity = new Vector3_1.Vector3([
|
|
1534
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
1535
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
1536
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
1537
|
-
]);
|
|
1538
|
-
dataPos += 6;
|
|
1539
|
-
this.Acceleration = new Vector3_1.Vector3([
|
|
1540
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
1541
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
1542
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
1543
|
-
]);
|
|
1544
|
-
dataPos += 6;
|
|
1545
|
-
this.Rotation = new Quaternion_1.Quaternion([
|
|
1546
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -1.0, 1.0),
|
|
1547
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -1.0, 1.0),
|
|
1548
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -1.0, 1.0),
|
|
1549
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -1.0, 1.0)
|
|
1550
|
-
]);
|
|
1551
|
-
dataPos += 8;
|
|
1552
|
-
this.AngularVelocity = new Vector3_1.Vector3([
|
|
1553
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos), -256.0, 256.0),
|
|
1554
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 2), -256.0, 256.0),
|
|
1555
|
-
Utils_1.Utils.UInt16ToFloat(data.readUInt16LE(dataPos + 4), -256.0, 256.0)
|
|
1556
|
-
]);
|
|
1557
|
-
dataPos += 6;
|
|
1558
|
-
break;
|
|
1559
|
-
case 16:
|
|
1560
|
-
this.Position = new Vector3_1.Vector3([
|
|
1561
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1562
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1563
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
1564
|
-
]);
|
|
1565
|
-
this.Velocity = new Vector3_1.Vector3([
|
|
1566
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1567
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1568
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
1569
|
-
]);
|
|
1570
|
-
this.Acceleration = new Vector3_1.Vector3([
|
|
1571
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1572
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1573
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
1574
|
-
]);
|
|
1575
|
-
this.Rotation = new Quaternion_1.Quaternion([
|
|
1576
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
1577
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
1578
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0),
|
|
1579
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -1.0, 1.0)
|
|
1580
|
-
]);
|
|
1581
|
-
this.AngularVelocity = new Vector3_1.Vector3([
|
|
1582
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1583
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0),
|
|
1584
|
-
Utils_1.Utils.ByteToFloat(data.readUInt8(dataPos++), -256.0, 256.0)
|
|
1585
|
-
]);
|
|
1586
|
-
break;
|
|
1587
1654
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1655
|
+
sceneObjectPart.ele('Flags', flags.join(' '));
|
|
1656
|
+
if (this.textureAnim !== undefined) {
|
|
1657
|
+
sceneObjectPart.ele('TextureAnimation', this.textureAnim.toBase64());
|
|
1658
|
+
}
|
|
1659
|
+
if (this.Particles) {
|
|
1660
|
+
sceneObjectPart.ele('ParticleSystem', this.Particles.toBase64());
|
|
1661
|
+
}
|
|
1662
|
+
if (this.physicsShapeType != null) {
|
|
1663
|
+
sceneObjectPart.ele('PhysicsShapeType', this.physicsShapeType);
|
|
1664
|
+
}
|
|
1665
|
+
if (this.Sound && !this.Sound.isZero()) {
|
|
1666
|
+
UUID_1.UUID.getXML(sceneObjectPart.ele('SoundID'), this.Sound);
|
|
1667
|
+
sceneObjectPart.ele('SoundGain', this.SoundGain);
|
|
1668
|
+
sceneObjectPart.ele('SoundFlags', this.SoundFlags);
|
|
1669
|
+
sceneObjectPart.ele('SoundRadius', this.SoundRadius);
|
|
1670
|
+
sceneObjectPart.ele('SoundQueueing', false);
|
|
1671
|
+
}
|
|
1672
|
+
if (this.inventory !== undefined && this.inventory.length > 0) {
|
|
1673
|
+
const inventory = sceneObjectPart.ele('TaskInventory');
|
|
1674
|
+
for (const inv of this.inventory) {
|
|
1675
|
+
await this.getInventoryXML(inventory, inv);
|
|
1609
1676
|
}
|
|
1610
|
-
|
|
1611
|
-
msg.AgentData = {
|
|
1612
|
-
AgentID: this.region.agent.agentID,
|
|
1613
|
-
SessionID: this.region.circuit.sessionID
|
|
1614
|
-
};
|
|
1615
|
-
msg.UpdateData = {
|
|
1616
|
-
Key: 0,
|
|
1617
|
-
LocalID: this.ID
|
|
1618
|
-
};
|
|
1619
|
-
msg.InventoryData = {
|
|
1620
|
-
ItemID: inventoryItem.itemID,
|
|
1621
|
-
FolderID: inventoryItem.parentID,
|
|
1622
|
-
CreatorID: inventoryItem.permissions.creator,
|
|
1623
|
-
OwnerID: inventoryItem.permissions.owner,
|
|
1624
|
-
GroupID: inventoryItem.permissions.group,
|
|
1625
|
-
BaseMask: inventoryItem.permissions.baseMask,
|
|
1626
|
-
OwnerMask: inventoryItem.permissions.ownerMask,
|
|
1627
|
-
GroupMask: inventoryItem.permissions.groupMask,
|
|
1628
|
-
EveryoneMask: inventoryItem.permissions.everyoneMask,
|
|
1629
|
-
NextOwnerMask: inventoryItem.permissions.nextOwnerMask,
|
|
1630
|
-
GroupOwned: inventoryItem.permissions.groupOwned || false,
|
|
1631
|
-
TransactionID: transactionID,
|
|
1632
|
-
Type: inventoryItem.type,
|
|
1633
|
-
InvType: inventoryItem.inventoryType,
|
|
1634
|
-
Flags: inventoryItem.flags,
|
|
1635
|
-
SaleType: inventoryItem.saleType,
|
|
1636
|
-
SalePrice: inventoryItem.salePrice,
|
|
1637
|
-
Name: Utils_1.Utils.StringToBuffer(inventoryItem.name),
|
|
1638
|
-
Description: Utils_1.Utils.StringToBuffer(inventoryItem.description),
|
|
1639
|
-
CreationDate: inventoryItem.created.getTime() / 1000,
|
|
1640
|
-
CRC: inventoryItem.getCRC()
|
|
1641
|
-
};
|
|
1642
|
-
const serial = this.inventorySerial;
|
|
1643
|
-
this.region.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
|
|
1644
|
-
return this.waitForInventoryUpdate(serial);
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
waitForInventoryUpdate(inventorySerial) {
|
|
1648
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1649
|
-
yield this.deselect();
|
|
1650
|
-
this.select();
|
|
1651
|
-
yield this.region.circuit.waitForMessage(Message_1.Message.ObjectProperties, 10000, (message) => {
|
|
1652
|
-
for (const obj of message.ObjectData) {
|
|
1653
|
-
if (obj.ObjectID.equals(this.FullID)) {
|
|
1654
|
-
if (inventorySerial === undefined) {
|
|
1655
|
-
inventorySerial = this.inventorySerial;
|
|
1656
|
-
}
|
|
1657
|
-
if (obj.InventorySerial > inventorySerial) {
|
|
1658
|
-
return FilterResponse_1.FilterResponse.Finish;
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
return FilterResponse_1.FilterResponse.NoMatch;
|
|
1663
|
-
});
|
|
1664
|
-
yield this.deselect();
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
select() {
|
|
1668
|
-
const selectObject = new ObjectSelect_1.ObjectSelectMessage();
|
|
1669
|
-
selectObject.AgentData = {
|
|
1670
|
-
AgentID: this.region.agent.agentID,
|
|
1671
|
-
SessionID: this.region.circuit.sessionID
|
|
1672
|
-
};
|
|
1673
|
-
selectObject.ObjectData = [{
|
|
1674
|
-
ObjectLocalID: this.ID
|
|
1675
|
-
}];
|
|
1676
|
-
const ack = this.region.circuit.sendMessage(selectObject, PacketFlags_1.PacketFlags.Reliable);
|
|
1677
|
-
return this.region.circuit.waitForAck(ack, 10000);
|
|
1678
|
-
}
|
|
1679
|
-
deselect() {
|
|
1680
|
-
const deselectObject = new ObjectDeselect_1.ObjectDeselectMessage();
|
|
1681
|
-
deselectObject.AgentData = {
|
|
1682
|
-
AgentID: this.region.agent.agentID,
|
|
1683
|
-
SessionID: this.region.circuit.sessionID
|
|
1684
|
-
};
|
|
1685
|
-
deselectObject.ObjectData = [{
|
|
1686
|
-
ObjectLocalID: this.ID
|
|
1687
|
-
}];
|
|
1688
|
-
const ack = this.region.circuit.sendMessage(deselectObject, PacketFlags_1.PacketFlags.Reliable);
|
|
1689
|
-
return this.region.circuit.waitForAck(ack, 10000);
|
|
1677
|
+
}
|
|
1690
1678
|
}
|
|
1691
1679
|
}
|
|
1692
1680
|
exports.GameObject = GameObject;
|