@caspertech/node-metaverse 0.7.40 → 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.
Files changed (459) hide show
  1. package/dist/examples/Camera/Camera.js +3 -14
  2. package/dist/examples/Camera/Camera.js.map +1 -1
  3. package/dist/examples/ExampleBot.js +66 -87
  4. package/dist/examples/ExampleBot.js.map +1 -1
  5. package/dist/examples/Friends/Friends.js +29 -44
  6. package/dist/examples/Friends/Friends.js.map +1 -1
  7. package/dist/examples/Grid/Name2Key.js +25 -36
  8. package/dist/examples/Grid/Name2Key.js.map +1 -1
  9. package/dist/examples/Groups/Group.js +42 -55
  10. package/dist/examples/Groups/Group.js.map +1 -1
  11. package/dist/examples/Groups/GroupChat.js +55 -68
  12. package/dist/examples/Groups/GroupChat.js.map +1 -1
  13. package/dist/examples/InstantMessages/InstantMessages.js +8 -21
  14. package/dist/examples/InstantMessages/InstantMessages.js.map +1 -1
  15. package/dist/examples/Inventory/Inventory.js +80 -97
  16. package/dist/examples/Inventory/Inventory.js.map +1 -1
  17. package/dist/examples/MFA/MFA.js +24 -40
  18. package/dist/examples/MFA/MFA.js.map +1 -1
  19. package/dist/examples/Money/Money.js +28 -41
  20. package/dist/examples/Money/Money.js.map +1 -1
  21. package/dist/examples/Objects/TaskInventory.js +13 -24
  22. package/dist/examples/Objects/TaskInventory.js.map +1 -1
  23. package/dist/examples/Region/Agents.js +6 -17
  24. package/dist/examples/Region/Agents.js.map +1 -1
  25. package/dist/examples/Region/Estate.js +9 -20
  26. package/dist/examples/Region/Estate.js.map +1 -1
  27. package/dist/examples/Region/Parcels.js +12 -23
  28. package/dist/examples/Region/Parcels.js.map +1 -1
  29. package/dist/examples/Region/Region.js +2 -13
  30. package/dist/examples/Region/Region.js.map +1 -1
  31. package/dist/examples/Region/Settings.js +15 -0
  32. package/dist/examples/Region/Settings.js.map +1 -0
  33. package/dist/examples/Teleports/Teleports.js +22 -35
  34. package/dist/examples/Teleports/Teleports.js.map +1 -1
  35. package/dist/lib/Bot.d.ts +14 -14
  36. package/dist/lib/Bot.js +217 -231
  37. package/dist/lib/Bot.js.map +1 -1
  38. package/dist/lib/LoginHandler.d.ts +3 -3
  39. package/dist/lib/LoginHandler.js +106 -116
  40. package/dist/lib/LoginHandler.js.map +1 -1
  41. package/dist/lib/classes/Agent.d.ts +23 -35
  42. package/dist/lib/classes/Agent.js +96 -108
  43. package/dist/lib/classes/Agent.js.map +1 -1
  44. package/dist/lib/classes/AssetMap.d.ts +18 -95
  45. package/dist/lib/classes/AssetMap.js +86 -16
  46. package/dist/lib/classes/AssetMap.js.map +1 -1
  47. package/dist/lib/classes/AssetRegistry.d.ts +31 -0
  48. package/dist/lib/classes/AssetRegistry.js +26 -0
  49. package/dist/lib/classes/AssetRegistry.js.map +1 -0
  50. package/dist/lib/classes/AssetTypeRegistry.d.ts +21 -0
  51. package/dist/lib/classes/AssetTypeRegistry.js +81 -0
  52. package/dist/lib/classes/AssetTypeRegistry.js.map +1 -0
  53. package/dist/lib/classes/BVH.js.map +1 -1
  54. package/dist/lib/classes/BVHJoint.js.map +1 -1
  55. package/dist/lib/classes/BVHJointKeyframe.d.ts +1 -1
  56. package/dist/lib/classes/BatchQueue.d.ts +2 -2
  57. package/dist/lib/classes/BatchQueue.js +66 -80
  58. package/dist/lib/classes/BatchQueue.js.map +1 -1
  59. package/dist/lib/classes/BatchQueue.spec.js +17 -26
  60. package/dist/lib/classes/BatchQueue.spec.js.map +1 -1
  61. package/dist/lib/classes/BinaryReader.d.ts +66 -0
  62. package/dist/lib/classes/BinaryReader.js +304 -0
  63. package/dist/lib/classes/BinaryReader.js.map +1 -0
  64. package/dist/lib/classes/BinaryReader.spec.d.ts +1 -0
  65. package/dist/lib/classes/BinaryReader.spec.js +241 -0
  66. package/dist/lib/classes/BinaryReader.spec.js.map +1 -0
  67. package/dist/lib/classes/BinaryWriter.d.ts +34 -0
  68. package/dist/lib/classes/BinaryWriter.js +192 -0
  69. package/dist/lib/classes/BinaryWriter.js.map +1 -0
  70. package/dist/lib/classes/BinaryWriter.spec.d.ts +1 -0
  71. package/dist/lib/classes/BinaryWriter.spec.js +328 -0
  72. package/dist/lib/classes/BinaryWriter.spec.js.map +1 -0
  73. package/dist/lib/classes/BitPack.d.ts +2 -2
  74. package/dist/lib/classes/BitPack.js +1 -1
  75. package/dist/lib/classes/BitPack.js.map +1 -1
  76. package/dist/lib/classes/BuildMap.d.ts +6 -6
  77. package/dist/lib/classes/BuildMap.js.map +1 -1
  78. package/dist/lib/classes/Caps.d.ts +18 -24
  79. package/dist/lib/classes/Caps.js +278 -297
  80. package/dist/lib/classes/Caps.js.map +1 -1
  81. package/dist/lib/classes/Circuit.d.ts +20 -28
  82. package/dist/lib/classes/Circuit.js +104 -91
  83. package/dist/lib/classes/Circuit.js.map +1 -1
  84. package/dist/lib/classes/ClientCommands.d.ts +3 -3
  85. package/dist/lib/classes/ClientCommands.js.map +1 -1
  86. package/dist/lib/classes/ClientEvents.d.ts +41 -32
  87. package/dist/lib/classes/ClientEvents.js +65 -0
  88. package/dist/lib/classes/ClientEvents.js.map +1 -1
  89. package/dist/lib/classes/CoalescedGameObject.d.ts +2 -2
  90. package/dist/lib/classes/CoalescedGameObject.js +37 -49
  91. package/dist/lib/classes/CoalescedGameObject.js.map +1 -1
  92. package/dist/lib/classes/Color4.d.ts +2 -2
  93. package/dist/lib/classes/Color4.js +42 -42
  94. package/dist/lib/classes/Color4.js.map +1 -1
  95. package/dist/lib/classes/Comms.d.ts +3 -3
  96. package/dist/lib/classes/Comms.js +236 -236
  97. package/dist/lib/classes/Comms.js.map +1 -1
  98. package/dist/lib/classes/ConcurrentQueue.d.ts +3 -3
  99. package/dist/lib/classes/ConcurrentQueue.js +16 -11
  100. package/dist/lib/classes/ConcurrentQueue.js.map +1 -1
  101. package/dist/lib/classes/EventQueueClient.d.ts +6 -6
  102. package/dist/lib/classes/EventQueueClient.js +189 -201
  103. package/dist/lib/classes/EventQueueClient.js.map +1 -1
  104. package/dist/lib/classes/GroupBan.d.ts +3 -3
  105. package/dist/lib/classes/GroupBan.js.map +1 -1
  106. package/dist/lib/classes/GroupMember.d.ts +2 -2
  107. package/dist/lib/classes/GroupRole.d.ts +2 -2
  108. package/dist/lib/classes/IPAddress.d.ts +3 -2
  109. package/dist/lib/classes/IPAddress.js +14 -13
  110. package/dist/lib/classes/IPAddress.js.map +1 -1
  111. package/dist/lib/classes/Inventory.d.ts +7 -15
  112. package/dist/lib/classes/Inventory.js +69 -80
  113. package/dist/lib/classes/Inventory.js.map +1 -1
  114. package/dist/lib/classes/InventoryFolder.d.ts +11 -11
  115. package/dist/lib/classes/InventoryFolder.js +544 -626
  116. package/dist/lib/classes/InventoryFolder.js.map +1 -1
  117. package/dist/lib/classes/InventoryItem.d.ts +15 -11
  118. package/dist/lib/classes/InventoryItem.js +494 -486
  119. package/dist/lib/classes/InventoryItem.js.map +1 -1
  120. package/dist/lib/classes/InventoryTypeRegistry.d.ts +19 -0
  121. package/dist/lib/classes/InventoryTypeRegistry.js +69 -0
  122. package/dist/lib/classes/InventoryTypeRegistry.js.map +1 -0
  123. package/dist/lib/classes/LLGLTFMaterial.d.ts +1 -1
  124. package/dist/lib/classes/LLGLTFMaterial.js +2 -2
  125. package/dist/lib/classes/LLGLTFMaterial.js.map +1 -1
  126. package/dist/lib/classes/LLGLTFMaterial.spec.js +17 -18
  127. package/dist/lib/classes/LLGLTFMaterial.spec.js.map +1 -1
  128. package/dist/lib/classes/LLGLTFMaterialOverride.d.ts +1 -1
  129. package/dist/lib/classes/LLGLTFMaterialOverride.js +119 -118
  130. package/dist/lib/classes/LLGLTFMaterialOverride.js.map +1 -1
  131. package/dist/lib/classes/LLGLTFMaterialOverride.spec.js +70 -71
  132. package/dist/lib/classes/LLGLTFMaterialOverride.spec.js.map +1 -1
  133. package/dist/lib/classes/LLGesture.d.ts +1 -1
  134. package/dist/lib/classes/LLGesture.js +1 -1
  135. package/dist/lib/classes/LLGesture.js.map +1 -1
  136. package/dist/lib/classes/LLGestureAnimationStep.d.ts +1 -1
  137. package/dist/lib/classes/LLGestureAnimationStep.js.map +1 -1
  138. package/dist/lib/classes/LLGestureChatStep.js.map +1 -1
  139. package/dist/lib/classes/LLGestureSoundStep.d.ts +1 -1
  140. package/dist/lib/classes/LLGestureSoundStep.js.map +1 -1
  141. package/dist/lib/classes/LLGestureStep.d.ts +1 -1
  142. package/dist/lib/classes/LLGestureWaitStep.js.map +1 -1
  143. package/dist/lib/classes/LLLindenText.d.ts +2 -4
  144. package/dist/lib/classes/LLLindenText.js +12 -8
  145. package/dist/lib/classes/LLLindenText.js.map +1 -1
  146. package/dist/lib/classes/LLSettings.d.ts +98 -83
  147. package/dist/lib/classes/LLSettings.js +240 -83
  148. package/dist/lib/classes/LLSettings.js.map +1 -1
  149. package/dist/lib/classes/LLSettings.spec.d.ts +1 -0
  150. package/dist/lib/classes/LLSettings.spec.js +27 -0
  151. package/dist/lib/classes/LLSettings.spec.js.map +1 -0
  152. package/dist/lib/classes/LLWearable.d.ts +4 -8
  153. package/dist/lib/classes/LLWearable.js +1 -1
  154. package/dist/lib/classes/LLWearable.js.map +1 -1
  155. package/dist/lib/classes/Logger.d.ts +3 -3
  156. package/dist/lib/classes/Logger.js +1 -1
  157. package/dist/lib/classes/Logger.js.map +1 -1
  158. package/dist/lib/classes/LoginParameters.js.map +1 -1
  159. package/dist/lib/classes/LoginResponse.d.ts +4 -9
  160. package/dist/lib/classes/LoginResponse.js +120 -113
  161. package/dist/lib/classes/LoginResponse.js.map +1 -1
  162. package/dist/lib/classes/MapBlock.d.ts +2 -2
  163. package/dist/lib/classes/MessageBase.d.ts +5 -5
  164. package/dist/lib/classes/MessageClasses.js.map +1 -1
  165. package/dist/lib/classes/ObjectResolver.d.ts +6 -6
  166. package/dist/lib/classes/ObjectResolver.js +127 -152
  167. package/dist/lib/classes/ObjectResolver.js.map +1 -1
  168. package/dist/lib/classes/ObjectStoreFull.d.ts +9 -9
  169. package/dist/lib/classes/ObjectStoreFull.js +176 -192
  170. package/dist/lib/classes/ObjectStoreFull.js.map +1 -1
  171. package/dist/lib/classes/ObjectStoreLite.d.ts +29 -31
  172. package/dist/lib/classes/ObjectStoreLite.js +485 -494
  173. package/dist/lib/classes/ObjectStoreLite.js.map +1 -1
  174. package/dist/lib/classes/Packet.d.ts +2 -2
  175. package/dist/lib/classes/Packet.js +2 -2
  176. package/dist/lib/classes/Packet.js.map +1 -1
  177. package/dist/lib/classes/ParticleSystem.js +1 -1
  178. package/dist/lib/classes/ParticleSystem.js.map +1 -1
  179. package/dist/lib/classes/PrimFacesHelper.d.ts +14 -0
  180. package/dist/lib/classes/PrimFacesHelper.js +75 -0
  181. package/dist/lib/classes/PrimFacesHelper.js.map +1 -0
  182. package/dist/lib/classes/Quaternion.d.ts +31 -6
  183. package/dist/lib/classes/Quaternion.js +236 -48
  184. package/dist/lib/classes/Quaternion.js.map +1 -1
  185. package/dist/lib/classes/Region.d.ts +23 -22
  186. package/dist/lib/classes/Region.js +453 -515
  187. package/dist/lib/classes/Region.js.map +1 -1
  188. package/dist/lib/classes/TarArchive.d.ts +1 -1
  189. package/dist/lib/classes/TarArchive.js.map +1 -1
  190. package/dist/lib/classes/TarFile.js +1 -1
  191. package/dist/lib/classes/TarFile.js.map +1 -1
  192. package/dist/lib/classes/TarReader.d.ts +1 -2
  193. package/dist/lib/classes/TarReader.js +15 -17
  194. package/dist/lib/classes/TarReader.js.map +1 -1
  195. package/dist/lib/classes/TarWriter.d.ts +1 -1
  196. package/dist/lib/classes/TarWriter.js +51 -68
  197. package/dist/lib/classes/TarWriter.js.map +1 -1
  198. package/dist/lib/classes/TextureEntry.d.ts +2 -3
  199. package/dist/lib/classes/TextureEntry.js +12 -12
  200. package/dist/lib/classes/TextureEntry.js.map +1 -1
  201. package/dist/lib/classes/TextureEntryFace.d.ts +4 -4
  202. package/dist/lib/classes/TextureEntryFace.js.map +1 -1
  203. package/dist/lib/classes/UUID.d.ts +2 -2
  204. package/dist/lib/classes/UUID.js +28 -28
  205. package/dist/lib/classes/UUID.js.map +1 -1
  206. package/dist/lib/classes/Utils.d.ts +2 -11
  207. package/dist/lib/classes/Utils.js +72 -328
  208. package/dist/lib/classes/Utils.js.map +1 -1
  209. package/dist/lib/classes/Vector2.d.ts +35 -6
  210. package/dist/lib/classes/Vector2.js +192 -28
  211. package/dist/lib/classes/Vector2.js.map +1 -1
  212. package/dist/lib/classes/Vector3.d.ts +38 -6
  213. package/dist/lib/classes/Vector3.js +229 -48
  214. package/dist/lib/classes/Vector3.js.map +1 -1
  215. package/dist/lib/classes/Vector4.d.ts +36 -6
  216. package/dist/lib/classes/Vector4.js +225 -21
  217. package/dist/lib/classes/Vector4.js.map +1 -1
  218. package/dist/lib/classes/Wearable.d.ts +1 -1
  219. package/dist/lib/classes/Zerocoder.js +2 -2
  220. package/dist/lib/classes/Zerocoder.js.map +1 -1
  221. package/dist/lib/classes/commands/AgentCommands.d.ts +7 -5
  222. package/dist/lib/classes/commands/AgentCommands.js +60 -76
  223. package/dist/lib/classes/commands/AgentCommands.js.map +1 -1
  224. package/dist/lib/classes/commands/AssetCommands.d.ts +5 -10
  225. package/dist/lib/classes/commands/AssetCommands.js +176 -179
  226. package/dist/lib/classes/commands/AssetCommands.js.map +1 -1
  227. package/dist/lib/classes/commands/CommandsBase.d.ts +4 -4
  228. package/dist/lib/classes/commands/CommandsBase.js.map +1 -1
  229. package/dist/lib/classes/commands/CommunicationsCommands.d.ts +3 -3
  230. package/dist/lib/classes/commands/CommunicationsCommands.js +350 -426
  231. package/dist/lib/classes/commands/CommunicationsCommands.js.map +1 -1
  232. package/dist/lib/classes/commands/FriendCommands.d.ts +9 -10
  233. package/dist/lib/classes/commands/FriendCommands.js +238 -236
  234. package/dist/lib/classes/commands/FriendCommands.js.map +1 -1
  235. package/dist/lib/classes/commands/GridCommands.d.ts +3 -3
  236. package/dist/lib/classes/commands/GridCommands.js +299 -336
  237. package/dist/lib/classes/commands/GridCommands.js.map +1 -1
  238. package/dist/lib/classes/commands/GroupCommands.d.ts +2 -2
  239. package/dist/lib/classes/commands/GroupCommands.js +293 -336
  240. package/dist/lib/classes/commands/GroupCommands.js.map +1 -1
  241. package/dist/lib/classes/commands/InventoryCommands.d.ts +4 -4
  242. package/dist/lib/classes/commands/InventoryCommands.js +54 -69
  243. package/dist/lib/classes/commands/InventoryCommands.js.map +1 -1
  244. package/dist/lib/classes/commands/MovementCommands.d.ts +2 -2
  245. package/dist/lib/classes/commands/MovementCommands.js +23 -38
  246. package/dist/lib/classes/commands/MovementCommands.js.map +1 -1
  247. package/dist/lib/classes/commands/NetworkCommands.js +35 -46
  248. package/dist/lib/classes/commands/NetworkCommands.js.map +1 -1
  249. package/dist/lib/classes/commands/ParcelCommands.d.ts +4 -4
  250. package/dist/lib/classes/commands/ParcelCommands.js +64 -77
  251. package/dist/lib/classes/commands/ParcelCommands.js.map +1 -1
  252. package/dist/lib/classes/commands/RegionCommands.d.ts +11 -10
  253. package/dist/lib/classes/commands/RegionCommands.js +1126 -1211
  254. package/dist/lib/classes/commands/RegionCommands.js.map +1 -1
  255. package/dist/lib/classes/commands/TeleportCommands.d.ts +8 -8
  256. package/dist/lib/classes/commands/TeleportCommands.js +58 -58
  257. package/dist/lib/classes/commands/TeleportCommands.js.map +1 -1
  258. package/dist/lib/classes/interfaces/IGameObjectData.d.ts +18 -20
  259. package/dist/lib/classes/interfaces/ILandBlock.d.ts +2 -2
  260. package/dist/lib/classes/interfaces/IObjectStore.d.ts +12 -12
  261. package/dist/lib/classes/interfaces/IResolveJob.d.ts +2 -2
  262. package/dist/lib/classes/interfaces/ITreeBoundingBox.d.ts +2 -2
  263. package/dist/lib/classes/llsd/LLSD.d.ts +12 -0
  264. package/dist/lib/classes/llsd/LLSD.js +128 -0
  265. package/dist/lib/classes/llsd/LLSD.js.map +1 -0
  266. package/dist/lib/classes/llsd/LLSD.spec.d.ts +1 -0
  267. package/dist/lib/classes/llsd/LLSD.spec.js +249 -0
  268. package/dist/lib/classes/llsd/LLSD.spec.js.map +1 -0
  269. package/dist/lib/classes/llsd/LLSDArray.d.ts +26 -3
  270. package/dist/lib/classes/llsd/LLSDArray.js +182 -6
  271. package/dist/lib/classes/llsd/LLSDArray.js.map +1 -1
  272. package/dist/lib/classes/llsd/LLSDBinary.d.ts +7 -0
  273. package/dist/lib/classes/llsd/LLSDBinary.js +114 -0
  274. package/dist/lib/classes/llsd/LLSDBinary.js.map +1 -0
  275. package/dist/lib/classes/llsd/LLSDInteger.d.ts +9 -0
  276. package/dist/lib/classes/llsd/LLSDInteger.js +25 -0
  277. package/dist/lib/classes/llsd/LLSDInteger.js.map +1 -0
  278. package/dist/lib/classes/llsd/LLSDMap.d.ts +16 -5
  279. package/dist/lib/classes/llsd/LLSDMap.js +197 -16
  280. package/dist/lib/classes/llsd/LLSDMap.js.map +1 -1
  281. package/dist/lib/classes/llsd/LLSDNotation.d.ts +11 -0
  282. package/dist/lib/classes/llsd/LLSDNotation.js +271 -0
  283. package/dist/lib/classes/llsd/LLSDNotation.js.map +1 -0
  284. package/dist/lib/classes/llsd/LLSDReal.d.ts +10 -0
  285. package/dist/lib/classes/llsd/LLSDReal.js +71 -0
  286. package/dist/lib/classes/llsd/LLSDReal.js.map +1 -0
  287. package/dist/lib/classes/llsd/LLSDToken.d.ts +1 -1
  288. package/dist/lib/classes/llsd/LLSDTokenContainer.d.ts +2 -2
  289. package/dist/lib/classes/llsd/LLSDTokenGenerator.d.ts +1 -1
  290. package/dist/lib/classes/llsd/LLSDTokenSpec.d.ts +1 -1
  291. package/dist/lib/classes/llsd/LLSDTokenType.d.ts +18 -18
  292. package/dist/lib/classes/llsd/LLSDTokenType.js +18 -18
  293. package/dist/lib/classes/llsd/LLSDTokenType.js.map +1 -1
  294. package/dist/lib/classes/llsd/LLSDType.d.ts +6 -3
  295. package/dist/lib/classes/llsd/LLSDURI.d.ts +7 -0
  296. package/dist/lib/classes/llsd/LLSDURI.js +19 -0
  297. package/dist/lib/classes/llsd/LLSDURI.js.map +1 -0
  298. package/dist/lib/classes/llsd/LLSDXML.d.ts +5 -0
  299. package/dist/lib/classes/llsd/LLSDXML.js +245 -0
  300. package/dist/lib/classes/llsd/LLSDXML.js.map +1 -0
  301. package/dist/lib/classes/messages/ObjectUpdate.d.ts +4 -5
  302. package/dist/lib/classes/messages/ObjectUpdate.js +115 -115
  303. package/dist/lib/classes/messages/ObjectUpdate.js.map +1 -1
  304. package/dist/lib/classes/messages/SimStats.d.ts +3 -2
  305. package/dist/lib/classes/messages/SimStats.js +17 -17
  306. package/dist/lib/classes/messages/SimStats.js.map +1 -1
  307. package/dist/lib/classes/public/Avatar.d.ts +4 -4
  308. package/dist/lib/classes/public/Avatar.js +39 -33
  309. package/dist/lib/classes/public/Avatar.js.map +1 -1
  310. package/dist/lib/classes/public/AvatarQueryResult.d.ts +4 -4
  311. package/dist/lib/classes/public/AvatarQueryResult.js.map +1 -1
  312. package/dist/lib/classes/public/ExtendedMeshData.d.ts +1 -1
  313. package/dist/lib/classes/public/ExtendedMeshData.js.map +1 -1
  314. package/dist/lib/classes/public/ExtraParams.d.ts +6 -6
  315. package/dist/lib/classes/public/ExtraParams.js +36 -39
  316. package/dist/lib/classes/public/ExtraParams.js.map +1 -1
  317. package/dist/lib/classes/public/ExtraParams.spec.js +2 -11
  318. package/dist/lib/classes/public/ExtraParams.spec.js.map +1 -1
  319. package/dist/lib/classes/public/FlexibleData.js.map +1 -1
  320. package/dist/lib/classes/public/Friend.js.map +1 -1
  321. package/dist/lib/classes/public/GameObject.d.ts +23 -21
  322. package/dist/lib/classes/public/GameObject.js +1294 -1306
  323. package/dist/lib/classes/public/GameObject.js.map +1 -1
  324. package/dist/lib/classes/public/GameObject.spec.js +8 -18
  325. package/dist/lib/classes/public/GameObject.spec.js.map +1 -1
  326. package/dist/lib/classes/public/LLMesh.d.ts +5 -7
  327. package/dist/lib/classes/public/LLMesh.js +194 -216
  328. package/dist/lib/classes/public/LLMesh.js.map +1 -1
  329. package/dist/lib/classes/public/LightData.js.map +1 -1
  330. package/dist/lib/classes/public/LightImageData.js.map +1 -1
  331. package/dist/lib/classes/public/Material.js +45 -56
  332. package/dist/lib/classes/public/Material.js.map +1 -1
  333. package/dist/lib/classes/public/MeshData.js.map +1 -1
  334. package/dist/lib/classes/public/Parcel.d.ts +4 -4
  335. package/dist/lib/classes/public/Parcel.js +1 -2
  336. package/dist/lib/classes/public/Parcel.js.map +1 -1
  337. package/dist/lib/classes/public/ReflectionProbeData.d.ts +1 -1
  338. package/dist/lib/classes/public/ReflectionProbeData.js.map +1 -1
  339. package/dist/lib/classes/public/RegionEnvironment.d.ts +14 -13
  340. package/dist/lib/classes/public/RegionEnvironment.js +94 -53
  341. package/dist/lib/classes/public/RegionEnvironment.js.map +1 -1
  342. package/dist/lib/classes/public/RegionEnvironmentSky.d.ts +2 -0
  343. package/dist/lib/classes/public/RegionEnvironmentSky.js +7 -0
  344. package/dist/lib/classes/public/RegionEnvironmentSky.js.map +1 -0
  345. package/dist/lib/classes/public/RegionEnvironmentWater.d.ts +2 -0
  346. package/dist/lib/classes/public/RegionEnvironmentWater.js +7 -0
  347. package/dist/lib/classes/public/RegionEnvironmentWater.js.map +1 -0
  348. package/dist/lib/classes/public/RenderMaterialData.js.map +1 -1
  349. package/dist/lib/classes/public/RenderMaterialParam.d.ts +1 -1
  350. package/dist/lib/classes/public/SculptData.js.map +1 -1
  351. package/dist/lib/classes/public/TextureAnim.js +2 -1
  352. package/dist/lib/classes/public/TextureAnim.js.map +1 -1
  353. package/dist/lib/classes/public/interfaces/GlobalPosition.d.ts +1 -1
  354. package/dist/lib/classes/public/interfaces/LLPhysicsConvex.d.ts +1 -1
  355. package/dist/lib/classes/public/interfaces/LLSkin.d.ts +1 -1
  356. package/dist/lib/classes/public/interfaces/LLSubMesh.d.ts +3 -5
  357. package/dist/lib/classes/public/interfaces/MapLocation.d.ts +3 -3
  358. package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.d.ts +26 -0
  359. package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.js +3 -0
  360. package/dist/lib/classes/public/interfaces/RegionEnvironmentSkyLLSD.js.map +1 -0
  361. package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.d.ts +15 -0
  362. package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.js +3 -0
  363. package/dist/lib/classes/public/interfaces/RegionEnvironmentWaterLLSD.js.map +1 -0
  364. package/dist/lib/classes/public/interfaces/SkyPreset.d.ts +3 -3
  365. package/dist/lib/classes/public/interfaces/WaterPreset.d.ts +4 -4
  366. package/dist/lib/deviceToken.json +1 -0
  367. package/dist/lib/enums/AssetType.d.ts +6 -4
  368. package/dist/lib/enums/AssetType.js +5 -3
  369. package/dist/lib/enums/AssetType.js.map +1 -1
  370. package/dist/lib/enums/AttachmentPoint.d.ts +0 -1
  371. package/dist/lib/enums/AttachmentPoint.js +0 -1
  372. package/dist/lib/enums/AttachmentPoint.js.map +1 -1
  373. package/dist/lib/enums/InventoryType.d.ts +3 -5
  374. package/dist/lib/enums/InventoryType.js +2 -4
  375. package/dist/lib/enums/InventoryType.js.map +1 -1
  376. package/dist/lib/enums/LayerType.d.ts +1 -1
  377. package/dist/lib/enums/LayerType.js +1 -1
  378. package/dist/lib/events/AvatarPropertiesReplyEvent.d.ts +1 -1
  379. package/dist/lib/events/BalanceUpdatedEvent.d.ts +2 -2
  380. package/dist/lib/events/BulkUpdateInventoryEvent.d.ts +2 -2
  381. package/dist/lib/events/BulkUpdateInventoryEvent.js.map +1 -1
  382. package/dist/lib/events/ChatEvent.d.ts +5 -5
  383. package/dist/lib/events/FriendOnlineEvent.d.ts +1 -1
  384. package/dist/lib/events/FriendRemovedEvent.d.ts +1 -1
  385. package/dist/lib/events/FriendRequestEvent.d.ts +1 -1
  386. package/dist/lib/events/FriendResponseEvent.d.ts +1 -1
  387. package/dist/lib/events/FriendRightsEvent.d.ts +2 -2
  388. package/dist/lib/events/GroupChatClosedEvent.d.ts +1 -1
  389. package/dist/lib/events/GroupChatEvent.d.ts +1 -1
  390. package/dist/lib/events/GroupChatSessionAgentListEvent.d.ts +1 -1
  391. package/dist/lib/events/GroupChatSessionJoinEvent.d.ts +1 -1
  392. package/dist/lib/events/GroupInviteEvent.d.ts +1 -1
  393. package/dist/lib/events/GroupNoticeEvent.d.ts +1 -1
  394. package/dist/lib/events/GroupProfileReplyEvent.d.ts +2 -2
  395. package/dist/lib/events/InstantMessageEvent.d.ts +3 -3
  396. package/dist/lib/events/InventoryOfferedEvent.d.ts +3 -3
  397. package/dist/lib/events/InventoryResponseEvent.d.ts +1 -1
  398. package/dist/lib/events/LandStatsEvent.d.ts +4 -4
  399. package/dist/lib/events/LandStatsEvent.js.map +1 -1
  400. package/dist/lib/events/LureEvent.d.ts +2 -2
  401. package/dist/lib/events/MapInfoRangeReplyEvent.d.ts +1 -1
  402. package/dist/lib/events/MapInfoReplyEvent.d.ts +2 -2
  403. package/dist/lib/events/NewObjectEvent.d.ts +2 -2
  404. package/dist/lib/events/ObjectKilledEvent.d.ts +2 -2
  405. package/dist/lib/events/ObjectPhysicsDataEvent.d.ts +1 -1
  406. package/dist/lib/events/ObjectResolvedEvent.d.ts +1 -1
  407. package/dist/lib/events/ObjectUpdatedEvent.d.ts +2 -2
  408. package/dist/lib/events/ParcelInfoReplyEvent.d.ts +3 -3
  409. package/dist/lib/events/ParcelPropertiesEvent.d.ts +3 -3
  410. package/dist/lib/events/RegionInfoReplyEvent.d.ts +2 -2
  411. package/dist/lib/events/ScriptDialogEvent.d.ts +1 -1
  412. package/dist/lib/events/SelectedObjectEvent.d.ts +1 -1
  413. package/dist/lib/events/TeleportEvent.d.ts +1 -1
  414. package/dist/lib/index.d.ts +6 -8
  415. package/dist/lib/index.js +4 -7
  416. package/dist/lib/index.js.map +1 -1
  417. package/dist/lib/tsm/common.d.ts +1 -1
  418. package/dist/lib/tsm/common.js +3 -1
  419. package/dist/lib/tsm/common.js.map +1 -1
  420. package/dist/lib/tsm/mat2.d.ts +8 -8
  421. package/dist/lib/tsm/mat2.js +8 -7
  422. package/dist/lib/tsm/mat2.js.map +1 -1
  423. package/dist/lib/tsm/mat3.d.ts +7 -7
  424. package/dist/lib/tsm/mat3.js +8 -7
  425. package/dist/lib/tsm/mat3.js.map +1 -1
  426. package/dist/lib/tsm/mat4.d.ts +9 -9
  427. package/dist/lib/tsm/mat4.js +8 -7
  428. package/dist/lib/tsm/mat4.js.map +1 -1
  429. package/dist/lib/tsm/quat.d.ts +19 -19
  430. package/dist/lib/tsm/quat.js +69 -68
  431. package/dist/lib/tsm/quat.js.map +1 -1
  432. package/dist/lib/tsm/vec2.d.ts +13 -13
  433. package/dist/lib/tsm/vec2.js +30 -29
  434. package/dist/lib/tsm/vec2.js.map +1 -1
  435. package/dist/lib/tsm/vec3.d.ts +16 -16
  436. package/dist/lib/tsm/vec3.js +48 -47
  437. package/dist/lib/tsm/vec3.js.map +1 -1
  438. package/dist/lib/tsm/vec4.d.ts +22 -22
  439. package/dist/lib/tsm/vec4.js +94 -93
  440. package/dist/lib/tsm/vec4.js.map +1 -1
  441. package/eslint.config.mjs +104 -0
  442. package/examples/Inventory/Inventory.ts +4 -2
  443. package/examples/Money/Money.ts +6 -6
  444. package/examples/Objects/TaskInventory.ts +4 -3
  445. package/examples/Region/Settings.ts +19 -0
  446. package/package.json +10 -9
  447. package/.eslintrc +0 -224
  448. package/dist/lib/classes/llsd/LLSDNotationParser.d.ts +0 -9
  449. package/dist/lib/classes/llsd/LLSDNotationParser.js +0 -177
  450. package/dist/lib/classes/llsd/LLSDNotationParser.js.map +0 -1
  451. package/dist/lib/classes/llsd/LLSDNotationParser.spec.js +0 -167
  452. package/dist/lib/classes/llsd/LLSDNotationParser.spec.js.map +0 -1
  453. package/dist/lib/enums/AssetTypeLL.d.ts +0 -27
  454. package/dist/lib/enums/AssetTypeLL.js +0 -32
  455. package/dist/lib/enums/AssetTypeLL.js.map +0 -1
  456. package/dist/lib/enums/HTTPAssets.d.ts +0 -24
  457. package/dist/lib/enums/HTTPAssets.js +0 -29
  458. package/dist/lib/enums/HTTPAssets.js.map +0 -1
  459. /package/dist/{lib/classes/llsd/LLSDNotationParser.spec.d.ts → examples/Region/Settings.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.Region = void 0;
13
4
  const Circuit_1 = require("./Circuit");
@@ -22,15 +13,12 @@ const MapNameRequest_1 = require("./messages/MapNameRequest");
22
13
  const GridLayerType_1 = require("../enums/GridLayerType");
23
14
  const FilterResponse_1 = require("../enums/FilterResponse");
24
15
  const LayerType_1 = require("../enums/LayerType");
16
+ const rxjs_1 = require("rxjs");
25
17
  const BitPack_1 = require("./BitPack");
26
18
  const builder = require("xmlbuilder");
27
19
  const SimAccessFlags_1 = require("../enums/SimAccessFlags");
28
- const rxjs_1 = require("rxjs");
29
20
  const ParcelDwellRequest_1 = require("./messages/ParcelDwellRequest");
30
21
  const Parcel_1 = require("./public/Parcel");
31
- const RegionEnvironment_1 = require("./public/RegionEnvironment");
32
- const Color4_1 = require("./Color4");
33
- const Vector4_1 = require("./Vector4");
34
22
  const LandFlags_1 = require("../enums/LandFlags");
35
23
  const ParcelPropertiesRequest_1 = require("./messages/ParcelPropertiesRequest");
36
24
  const UUID_1 = require("./UUID");
@@ -38,117 +26,16 @@ const RegionFlags_1 = require("../enums/RegionFlags");
38
26
  const BotOptionFlags_1 = require("../enums/BotOptionFlags");
39
27
  const PacketFlags_1 = require("../enums/PacketFlags");
40
28
  const Vector3_1 = require("./Vector3");
41
- const Vector2_1 = require("./Vector2");
42
29
  const ObjectResolver_1 = require("./ObjectResolver");
43
30
  const SimStatsEvent_1 = require("../events/SimStatsEvent");
44
31
  const StatID_1 = require("../enums/StatID");
45
32
  const Avatar_1 = require("./public/Avatar");
46
33
  const BalanceUpdatedEvent_1 = require("../events/BalanceUpdatedEvent");
47
34
  const Logger_1 = require("./Logger");
35
+ const EconomyDataRequest_1 = require("./messages/EconomyDataRequest");
36
+ const RegionEnvironment_1 = require("./public/RegionEnvironment");
37
+ const LLSD_1 = require("./llsd/LLSD");
48
38
  class Region {
49
- static IDCTColumn16(linein, lineout, column) {
50
- let total;
51
- let usize;
52
- for (let n = 0; n < 16; n++) {
53
- total = this.OO_SQRT_2 * linein[column];
54
- for (let u = 1; u < 16; u++) {
55
- usize = u * 16;
56
- total += linein[usize + column] * this.CosineTable16[usize + n];
57
- }
58
- lineout[16 * n + column] = total;
59
- }
60
- }
61
- static IDCTLine16(linein, lineout, line) {
62
- const oosob = 2.0 / 16.0;
63
- const lineSize = line * 16;
64
- let total = 0;
65
- for (let n = 0; n < 16; n++) {
66
- total = this.OO_SQRT_2 * linein[lineSize];
67
- for (let u = 1; u < 16; u++) {
68
- total += linein[lineSize + u] * this.CosineTable16[u * 16 + n];
69
- }
70
- lineout[lineSize + n] = total * oosob;
71
- }
72
- }
73
- static InitialSetup() {
74
- {
75
- let diag = false;
76
- let right = true;
77
- let i = 0;
78
- let j = 0;
79
- let count = 0;
80
- for (let x = 0; x < 16 * 16; x++) {
81
- this.CopyMatrix16.push(0);
82
- this.DequantizeTable16.push(0);
83
- this.CosineTable16.push(0);
84
- }
85
- while (i < 16 && j < 16) {
86
- this.CopyMatrix16[j * 16 + i] = count++;
87
- if (!diag) {
88
- if (right) {
89
- if (i < 16 - 1) {
90
- i++;
91
- }
92
- else {
93
- j++;
94
- }
95
- right = false;
96
- diag = true;
97
- }
98
- else {
99
- if (j < 16 - 1) {
100
- j++;
101
- }
102
- else {
103
- i++;
104
- }
105
- right = true;
106
- diag = true;
107
- }
108
- }
109
- else {
110
- if (right) {
111
- i++;
112
- j--;
113
- if (i === 16 - 1 || j === 0) {
114
- diag = false;
115
- }
116
- }
117
- else {
118
- i--;
119
- j++;
120
- if (j === 16 - 1 || i === 0) {
121
- diag = false;
122
- }
123
- }
124
- }
125
- }
126
- }
127
- {
128
- for (let j = 0; j < 16; j++) {
129
- for (let i = 0; i < 16; i++) {
130
- this.DequantizeTable16[j * 16 + i] = 1.0 + 2.0 * (i + j);
131
- }
132
- }
133
- }
134
- {
135
- const hposz = Math.PI * 0.5 / 16.0;
136
- for (let u = 0; u < 16; u++) {
137
- for (let n = 0; n < 16; n++) {
138
- this.CosineTable16[u * 16 + n] = Math.cos((2.0 * n + 1.0) * u * hposz);
139
- }
140
- }
141
- }
142
- this.setup = true;
143
- }
144
- static doesBitmapContainCoordinate(bitmap, x, y) {
145
- const mapBlockX = Math.floor(x / 4);
146
- const mapBlockY = Math.floor(y / 4);
147
- let index = (mapBlockY * 64) + mapBlockX;
148
- const bit = index % 8;
149
- index >>= 3;
150
- return ((bitmap[index] & (1 << bit)) !== 0);
151
- }
152
39
  constructor(agent, clientEvents, options) {
153
40
  this.regionSizeX = 256;
154
41
  this.regionSizeY = 256;
@@ -166,10 +53,11 @@ class Region {
166
53
  this.parcels = {};
167
54
  this.parcelsByUUID = {};
168
55
  this.parcelMap = [];
56
+ this.textures = {};
169
57
  this.parcelCoordinates = [];
170
58
  this.timeOffset = 0;
171
59
  this.resolver = new ObjectResolver_1.ObjectResolver(this);
172
- this.agents = {};
60
+ this.agents = new Map();
173
61
  this.parcelOverlayReceived = {};
174
62
  if (!Region.setup) {
175
63
  Region.InitialSetup();
@@ -197,9 +85,10 @@ class Region {
197
85
  this.objects = new ObjectStoreFull_1.ObjectStoreFull(this.circuit, agent, clientEvents, options);
198
86
  }
199
87
  this.comms = new Comms_1.Comms(this.circuit, agent, clientEvents);
200
- this.parcelPropertiesSubscription = this.clientEvents.onParcelPropertiesEvent.subscribe((parcelProperties) => __awaiter(this, void 0, void 0, function* () {
201
- yield this.resolveParcel(parcelProperties);
202
- }));
88
+ this.parcelPropertiesSubscription = this.clientEvents.onParcelPropertiesEvent.subscribe((parcelProperties) => {
89
+ this.resolveParcel(parcelProperties).catch((_e) => {
90
+ });
91
+ });
203
92
  this.messageSubscription = this.circuit.subscribeToMessages([
204
93
  Message_1.Message.ParcelOverlay,
205
94
  Message_1.Message.LayerData,
@@ -207,7 +96,7 @@ class Region {
207
96
  Message_1.Message.SimStats,
208
97
  Message_1.Message.CoarseLocationUpdate,
209
98
  Message_1.Message.MoneyBalanceReply
210
- ], (packet) => __awaiter(this, void 0, void 0, function* () {
99
+ ], async (packet) => {
211
100
  switch (packet.message.id) {
212
101
  case Message_1.Message.MoneyBalanceReply:
213
102
  {
@@ -239,28 +128,29 @@ class Region {
239
128
  const location = locations.Location[x];
240
129
  const newPosition = new Vector3_1.Vector3([location.X, location.Y, location.Z * 4]);
241
130
  foundAgents[agentData.AgentID.toString()] = newPosition;
242
- if (this.agents[agentData.AgentID.toString()] === undefined) {
243
- let resolved = yield this.clientCommands.grid.avatarKey2Name(agentData.AgentID);
131
+ const foundAgent = this.agents.get(agentData.AgentID.toString());
132
+ if (foundAgent === undefined) {
133
+ let resolved = await this.clientCommands.grid.avatarKey2Name(agentData.AgentID);
244
134
  if (Array.isArray(resolved)) {
245
135
  resolved = resolved[0];
246
136
  }
247
- if (this.agents[agentData.AgentID.toString()] === undefined) {
248
- this.agents[agentData.AgentID.toString()] = new Avatar_1.Avatar(agentData.AgentID, resolved.getFirstName(), resolved.getLastName());
249
- this.clientEvents.onAvatarEnteredRegion.next(this.agents[agentData.AgentID.toString()]);
250
- }
251
- else {
252
- this.agents[agentData.AgentID.toString()].coarsePosition = newPosition;
253
- }
137
+ const ag = new Avatar_1.Avatar(agentData.AgentID, resolved.getFirstName(), resolved.getLastName());
138
+ ag.coarsePosition = newPosition;
139
+ this.agents.set(agentData.AgentID.toString(), ag);
140
+ this.clientEvents.onAvatarEnteredRegion.next(ag);
254
141
  }
255
142
  else {
256
- this.agents[agentData.AgentID.toString()].coarsePosition = newPosition;
143
+ foundAgent.coarsePosition = newPosition;
257
144
  }
258
145
  }
259
- const keys = Object.keys(this.agents);
146
+ const keys = this.agents.keys();
260
147
  for (const agentID of keys) {
261
148
  if (foundAgents[agentID] === undefined) {
262
- this.agents[agentID].coarseLeftRegion();
263
- delete this.agents[agentID];
149
+ const foundAgent = this.agents.get(agentID);
150
+ if (foundAgent !== undefined) {
151
+ foundAgent.coarseLeftRegion();
152
+ this.agents.delete(agentID);
153
+ }
264
154
  }
265
155
  }
266
156
  break;
@@ -467,100 +357,104 @@ class Region {
467
357
  const headerLayerType = nibbler.UnpackBits(8);
468
358
  switch (type) {
469
359
  case LayerType_1.LayerType.Land:
470
- if (headerLayerType === type) {
471
- let x = 0;
472
- let y = 0;
473
- const patches = [];
474
- for (let xi = 0; xi < 32 * 32; xi++) {
475
- patches.push(0);
476
- }
477
- while (true) {
478
- const quantWBits = nibbler.UnpackBits(8);
479
- if (quantWBits === 97) {
480
- break;
481
- }
482
- const dcOffset = nibbler.UnpackFloat();
483
- const range = nibbler.UnpackBits(16);
484
- const patchIDs = nibbler.UnpackBits(10);
485
- const wordBits = (quantWBits & 0x0f) + 2;
486
- x = patchIDs >> 5;
487
- y = patchIDs & 0x1F;
488
- if (x >= 16 || y >= 16) {
489
- console.error('Invalid land packet. x: ' + x + ', y: ' + y + ', patchSize: ' + patchSize);
490
- return;
360
+ {
361
+ if (headerLayerType === type) {
362
+ let x = 0;
363
+ let y = 0;
364
+ const patches = [];
365
+ for (let xi = 0; xi < 32 * 32; xi++) {
366
+ patches.push(0);
491
367
  }
492
- else {
493
- let temp = 0;
494
- for (let n = 0; n < patchSize * patchSize; n++) {
495
- temp = nibbler.UnpackBits(1);
496
- if (temp !== 0) {
368
+ while (true) {
369
+ const quantWBits = nibbler.UnpackBits(8);
370
+ if (quantWBits === 97) {
371
+ break;
372
+ }
373
+ const dcOffset = nibbler.UnpackFloat();
374
+ const range = nibbler.UnpackBits(16);
375
+ const patchIDs = nibbler.UnpackBits(10);
376
+ const wordBits = (quantWBits & 0x0f) + 2;
377
+ x = patchIDs >> 5;
378
+ y = patchIDs & 0x1F;
379
+ if (x >= 16 || y >= 16) {
380
+ console.error('Invalid land packet. x: ' + x + ', y: ' + y + ', patchSize: ' + patchSize);
381
+ return;
382
+ }
383
+ else {
384
+ let temp = 0;
385
+ for (let n = 0; n < patchSize * patchSize; n++) {
497
386
  temp = nibbler.UnpackBits(1);
498
387
  if (temp !== 0) {
499
388
  temp = nibbler.UnpackBits(1);
500
389
  if (temp !== 0) {
501
- temp = nibbler.UnpackBits(wordBits);
502
- patches[n] = temp * -1;
390
+ temp = nibbler.UnpackBits(1);
391
+ if (temp !== 0) {
392
+ temp = nibbler.UnpackBits(wordBits);
393
+ patches[n] = temp * -1;
394
+ }
395
+ else {
396
+ temp = nibbler.UnpackBits(wordBits);
397
+ patches[n] = temp;
398
+ }
503
399
  }
504
400
  else {
505
- temp = nibbler.UnpackBits(wordBits);
506
- patches[n] = temp;
401
+ for (let o = n; o < patchSize * patchSize; o++) {
402
+ patches[o] = 0;
403
+ }
404
+ break;
507
405
  }
508
406
  }
509
407
  else {
510
- for (let o = n; o < patchSize * patchSize; o++) {
511
- patches[o] = 0;
512
- }
513
- break;
408
+ patches[n] = 0;
514
409
  }
515
410
  }
516
- else {
517
- patches[n] = 0;
518
- }
519
- }
520
- const block = [];
521
- const output = [];
522
- const prequant = (quantWBits >> 4) + 2;
523
- const quantize = 1 << prequant;
524
- const ooq = 1.0 / quantize;
525
- const mult = ooq * range;
526
- const addVal = mult * (1 << (prequant - 1)) + dcOffset;
527
- if (patchSize === 16) {
528
- for (let n = 0; n < 16 * 16; n++) {
529
- block.push(patches[Region.CopyMatrix16[n]] * Region.DequantizeTable16[n]);
530
- }
531
- const ftemp = [];
532
- for (let o = 0; o < 16 * 16; o++) {
533
- ftemp.push(o);
411
+ const block = [];
412
+ const output = [];
413
+ const prequant = (quantWBits >> 4) + 2;
414
+ const quantize = 1 << prequant;
415
+ const ooq = 1.0 / quantize;
416
+ const mult = ooq * range;
417
+ const addVal = mult * (1 << (prequant - 1)) + dcOffset;
418
+ if (patchSize === 16) {
419
+ for (let n = 0; n < 16 * 16; n++) {
420
+ block.push(patches[Region.CopyMatrix16[n]] * Region.DequantizeTable16[n]);
421
+ }
422
+ const ftemp = [];
423
+ for (let o = 0; o < 16 * 16; o++) {
424
+ ftemp.push(o);
425
+ }
426
+ for (let o = 0; o < 16; o++) {
427
+ Region.IDCTColumn16(block, ftemp, o);
428
+ }
429
+ for (let o = 0; o < 16; o++) {
430
+ Region.IDCTLine16(ftemp, block, o);
431
+ }
534
432
  }
535
- for (let o = 0; o < 16; o++) {
536
- Region.IDCTColumn16(block, ftemp, o);
433
+ else {
434
+ throw new Error('IDCTPatchLarge not implemented');
537
435
  }
538
- for (let o = 0; o < 16; o++) {
539
- Region.IDCTLine16(ftemp, block, o);
436
+ for (const bl of block) {
437
+ output.push(bl * mult + addVal);
540
438
  }
541
- }
542
- else {
543
- throw new Error('IDCTPatchLarge not implemented');
544
- }
545
- for (let j = 0; j < block.length; j++) {
546
- output.push(block[j] * mult + addVal);
547
- }
548
- let outputIndex = 0;
549
- for (let yPoint = y * 16; yPoint < (y + 1) * 16; yPoint++) {
550
- for (let xPoint = x * 16; xPoint < (x + 1) * 16; xPoint++) {
551
- if (this.terrain[yPoint][xPoint] === -1) {
552
- this.tilesReceived++;
439
+ let outputIndex = 0;
440
+ for (let yPoint = y * 16; yPoint < (y + 1) * 16; yPoint++) {
441
+ for (let xPoint = x * 16; xPoint < (x + 1) * 16; xPoint++) {
442
+ if (this.terrain[yPoint][xPoint] === -1) {
443
+ this.tilesReceived++;
444
+ }
445
+ this.terrain[yPoint][xPoint] = output[outputIndex++];
553
446
  }
554
- this.terrain[yPoint][xPoint] = output[outputIndex++];
555
447
  }
556
- }
557
- if (this.tilesReceived === 65536) {
558
- this.terrainComplete = true;
559
- this.terrainCompleteEvent.next();
448
+ if (this.tilesReceived === 65536) {
449
+ this.terrainComplete = true;
450
+ this.terrainCompleteEvent.next();
451
+ }
560
452
  }
561
453
  }
562
454
  }
455
+ break;
563
456
  }
457
+ default:
564
458
  break;
565
459
  }
566
460
  break;
@@ -572,146 +466,119 @@ class Region {
572
466
  this.timeOffset = (new Date().getTime() / 1000) - timeStamp;
573
467
  break;
574
468
  }
469
+ default:
470
+ break;
575
471
  }
576
- }));
472
+ });
577
473
  }
578
- resolveParcel(parcelProperties) {
579
- return __awaiter(this, void 0, void 0, function* () {
580
- const msg = new ParcelDwellRequest_1.ParcelDwellRequestMessage();
581
- msg.AgentData = {
582
- AgentID: this.agent.agentID,
583
- SessionID: this.circuit.sessionID
584
- };
585
- msg.Data = {
586
- LocalID: parcelProperties.LocalID,
587
- ParcelID: UUID_1.UUID.zero()
588
- };
589
- this.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
590
- const dwellReply = yield this.circuit.waitForMessage(Message_1.Message.ParcelDwellReply, 10000, (message) => {
591
- if (message.Data.LocalID === parcelProperties.LocalID) {
592
- return FilterResponse_1.FilterResponse.Finish;
474
+ static IDCTColumn16(linein, lineout, column) {
475
+ let total = 0;
476
+ let usize = 0;
477
+ for (let n = 0; n < 16; n++) {
478
+ total = this.OO_SQRT_2 * linein[column];
479
+ for (let u = 1; u < 16; u++) {
480
+ usize = u * 16;
481
+ total += linein[usize + column] * this.CosineTable16[usize + n];
482
+ }
483
+ lineout[16 * n + column] = total;
484
+ }
485
+ }
486
+ static IDCTLine16(linein, lineout, line) {
487
+ const oosob = 2.0 / 16.0;
488
+ const lineSize = line * 16;
489
+ let total = 0;
490
+ for (let n = 0; n < 16; n++) {
491
+ total = this.OO_SQRT_2 * linein[lineSize];
492
+ for (let u = 1; u < 16; u++) {
493
+ total += linein[lineSize + u] * this.CosineTable16[u * 16 + n];
494
+ }
495
+ lineout[lineSize + n] = total * oosob;
496
+ }
497
+ }
498
+ static InitialSetup() {
499
+ {
500
+ let diag = false;
501
+ let right = true;
502
+ let i = 0;
503
+ let j = 0;
504
+ let count = 0;
505
+ for (let x = 0; x < 16 * 16; x++) {
506
+ this.CopyMatrix16.push(0);
507
+ this.DequantizeTable16.push(0);
508
+ this.CosineTable16.push(0);
509
+ }
510
+ while (i < 16 && j < 16) {
511
+ this.CopyMatrix16[j * 16 + i] = count++;
512
+ if (!diag) {
513
+ if (right) {
514
+ if (i < 16 - 1) {
515
+ i++;
516
+ }
517
+ else {
518
+ j++;
519
+ }
520
+ right = false;
521
+ diag = true;
522
+ }
523
+ else {
524
+ if (j < 16 - 1) {
525
+ j++;
526
+ }
527
+ else {
528
+ i++;
529
+ }
530
+ right = true;
531
+ diag = true;
532
+ }
593
533
  }
594
534
  else {
595
- return FilterResponse_1.FilterResponse.NoMatch;
596
- }
597
- });
598
- const parcelID = dwellReply.Data.ParcelID.toString();
599
- let parcel = new Parcel_1.Parcel(this);
600
- if (this.parcelsByUUID[parcelID]) {
601
- parcel = this.parcelsByUUID[parcelID];
602
- }
603
- parcel.LocalID = parcelProperties.LocalID;
604
- parcel.ParcelID = new UUID_1.UUID(dwellReply.Data.ParcelID.toString());
605
- parcel.RegionDenyAgeUnverified = parcelProperties.RegionDenyTransacted;
606
- parcel.MediaDesc = parcelProperties.MediaDesc;
607
- parcel.MediaHeight = parcelProperties.MediaHeight;
608
- parcel.MediaLoop = parcelProperties.MediaLoop;
609
- parcel.MediaType = parcelProperties.MediaType;
610
- parcel.MediaWidth = parcelProperties.MediaWidth;
611
- parcel.ObscureMedia = parcelProperties.ObscureMedia;
612
- parcel.ObscureMusic = parcelProperties.ObscureMusic;
613
- parcel.AABBMax = parcelProperties.AABBMax;
614
- parcel.AABBMin = parcelProperties.AABBMin;
615
- parcel.AnyAVSounds = parcelProperties.AnyAVSounds;
616
- parcel.Area = parcelProperties.Area;
617
- parcel.AuctionID = parcelProperties.AuctionID;
618
- parcel.AuthBuyerID = new UUID_1.UUID(parcelProperties.AuthBuyerID.toString());
619
- parcel.Bitmap = parcelProperties.Bitmap;
620
- parcel.Category = parcelProperties.Category;
621
- parcel.ClaimDate = parcelProperties.ClaimDate;
622
- parcel.ClaimPrice = parcelProperties.ClaimPrice;
623
- parcel.Desc = parcelProperties.Desc;
624
- parcel.Dwell = dwellReply.Data.Dwell;
625
- parcel.GroupAVSounds = parcelProperties.GroupAVSounds;
626
- parcel.GroupID = new UUID_1.UUID(parcelProperties.GroupID.toString());
627
- parcel.GroupPrims = parcelProperties.GroupPrims;
628
- parcel.IsGroupOwned = parcelProperties.IsGroupOwned;
629
- parcel.LandingType = parcelProperties.LandingType;
630
- parcel.MaxPrims = parcelProperties.MaxPrims;
631
- parcel.MediaAutoScale = parcelProperties.MediaAutoScale;
632
- parcel.MediaID = new UUID_1.UUID(parcelProperties.MediaID.toString());
633
- parcel.MediaURL = parcelProperties.MediaURL;
634
- parcel.MusicURL = parcelProperties.MusicURL;
635
- parcel.Name = parcelProperties.Name;
636
- parcel.OtherCleanTime = parcelProperties.OtherCleanTime;
637
- parcel.OtherCount = parcelProperties.OtherCount;
638
- parcel.OtherPrims = parcelProperties.OtherPrims;
639
- parcel.OwnerID = new UUID_1.UUID(parcelProperties.OwnerID.toString());
640
- parcel.OwnerPrims = parcelProperties.OwnerPrims;
641
- parcel.ParcelFlags = parcelProperties.ParcelFlags;
642
- parcel.ParcelPrimBonus = parcelProperties.ParcelPrimBonus;
643
- parcel.PassHours = parcelProperties.PassHours;
644
- parcel.PassPrice = parcelProperties.PassPrice;
645
- parcel.PublicCount = parcelProperties.PublicCount;
646
- parcel.RegionDenyAnonymous = parcelProperties.RegionDenyAnonymous;
647
- parcel.RegionDenyIdentified = parcelProperties.RegionDenyIdentified;
648
- parcel.RegionPushOverride = parcelProperties.RegionPushOverride;
649
- parcel.RegionDenyTransacted = parcelProperties.RegionDenyTransacted;
650
- parcel.RentPrice = parcelProperties.RentPrice;
651
- parcel.RequestResult = parcelProperties.RequestResult;
652
- parcel.SalePrice = parcelProperties.SalePrice;
653
- parcel.SeeAvs = parcelProperties.SeeAvs;
654
- parcel.SelectedPrims = parcelProperties.SelectedPrims;
655
- parcel.SelfCount = parcelProperties.SelfCount;
656
- parcel.SequenceID = parcelProperties.SequenceID;
657
- parcel.SimWideMaxPrims = parcelProperties.SimWideMaxPrims;
658
- parcel.SimWideTotalPrims = parcelProperties.SimWideTotalPrims;
659
- parcel.SnapSelection = parcelProperties.SnapSelection;
660
- parcel.SnapshotID = new UUID_1.UUID(parcelProperties.SnapshotID.toString());
661
- parcel.Status = parcelProperties.Status;
662
- parcel.TotalPrims = parcelProperties.TotalPrims;
663
- parcel.UserLocation = parcelProperties.UserLocation;
664
- parcel.UserLookAt = parcelProperties.UserLookAt;
665
- parcel.RegionAllowAccessOverride = parcelProperties.RegionAllowAccessOverride;
666
- this.parcels[parcelProperties.LocalID] = parcel;
667
- let foundEmpty = false;
668
- for (let y = 0; y < 64; y++) {
669
- for (let x = 0; x < 64; x++) {
670
- if (Region.doesBitmapContainCoordinate(parcel.Bitmap, x * 4, y * 4)) {
671
- this.parcelMap[y][x] = parcel.LocalID;
535
+ if (right) {
536
+ i++;
537
+ j--;
538
+ if (i === 16 - 1 || j === 0) {
539
+ diag = false;
540
+ }
672
541
  }
673
542
  else {
674
- if (this.parcelMap[y][x] === 0) {
675
- foundEmpty = true;
543
+ i--;
544
+ j++;
545
+ if (j === 16 - 1 || i === 0) {
546
+ diag = false;
676
547
  }
677
548
  }
678
549
  }
679
550
  }
680
- if (!foundEmpty) {
681
- if (!this.parcelsComplete) {
682
- this.parcelsComplete = true;
683
- this.parcelsCompleteEvent.next();
551
+ }
552
+ {
553
+ for (let j = 0; j < 16; j++) {
554
+ for (let i = 0; i < 16; i++) {
555
+ this.DequantizeTable16[j * 16 + i] = 1.0 + 2.0 * (i + j);
684
556
  }
685
557
  }
686
- else if (this.parcelsComplete) {
687
- this.parcelsComplete = false;
688
- }
689
- return parcel;
690
- });
691
- }
692
- fillParcel(parcelID, x, y) {
693
- if (x < 0 || y < 0 || x > 63 || y > 63) {
694
- return;
695
- }
696
- if (this.parcelOverlay[(y * 64) + x].parcelID !== -1) {
697
- return;
698
- }
699
- this.parcelOverlay[(y * 64) + x].parcelID = parcelID;
700
- const flags = this.parcelOverlay[(y * 64) + x].landFlags;
701
- if (!(flags & LandFlags_1.LandFlags.BorderSouth)) {
702
- this.fillParcel(parcelID, x, y - 1);
703
558
  }
704
- if (!(flags & LandFlags_1.LandFlags.BorderWest)) {
705
- this.fillParcel(parcelID, x - 1, y);
706
- }
707
- if (x < 63 && !(this.parcelOverlay[(y * 64) + (x + 1)].landFlags & LandFlags_1.LandFlags.BorderWest)) {
708
- this.fillParcel(parcelID, x + 1, y);
559
+ {
560
+ const hposz = Math.PI * 0.5 / 16.0;
561
+ for (let u = 0; u < 16; u++) {
562
+ for (let n = 0; n < 16; n++) {
563
+ this.CosineTable16[u * 16 + n] = Math.cos((2.0 * n + 1.0) * u * hposz);
564
+ }
565
+ }
709
566
  }
710
- if (y < 63 && !(this.parcelOverlay[((y + 1) * 64) + x].landFlags & LandFlags_1.LandFlags.BorderSouth)) {
711
- this.fillParcel(parcelID, x, y + 1);
567
+ this.setup = true;
568
+ }
569
+ async getUploadCost() {
570
+ if (this.uploadCost !== undefined) {
571
+ return this.uploadCost;
712
572
  }
573
+ const msg = new EconomyDataRequest_1.EconomyDataRequestMessage();
574
+ this.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
575
+ const economyReply = await this.circuit.waitForMessage(Message_1.Message.EconomyData, 10000, (_message) => {
576
+ return FilterResponse_1.FilterResponse.Finish;
577
+ });
578
+ this.uploadCost = economyReply.Info.PriceUpload;
579
+ return this.uploadCost;
713
580
  }
714
- getParcelProperties(x, y) {
581
+ async getParcelProperties(x, y) {
715
582
  return new Promise((resolve, reject) => {
716
583
  const request = new ParcelPropertiesRequest_1.ParcelPropertiesRequestMessage();
717
584
  request.AgentData = {
@@ -729,7 +596,7 @@ class Region {
729
596
  this.circuit.sendMessage(request, PacketFlags_1.PacketFlags.Reliable);
730
597
  let messageAwait = undefined;
731
598
  let messageWaitTimer = undefined;
732
- messageAwait = this.clientEvents.onParcelPropertiesEvent.subscribe((parcelProperties) => __awaiter(this, void 0, void 0, function* () {
599
+ messageAwait = this.clientEvents.onParcelPropertiesEvent.subscribe((parcelProperties) => {
733
600
  if (Region.doesBitmapContainCoordinate(parcelProperties.Bitmap, x, y)) {
734
601
  if (messageAwait !== undefined) {
735
602
  messageAwait.unsubscribe();
@@ -739,9 +606,13 @@ class Region {
739
606
  clearTimeout(messageWaitTimer);
740
607
  messageWaitTimer = undefined;
741
608
  }
742
- resolve(yield this.resolveParcel(parcelProperties));
609
+ this.resolveParcel(parcelProperties).then((value) => {
610
+ resolve(value);
611
+ }).catch((e) => {
612
+ reject(e);
613
+ });
743
614
  }
744
- }));
615
+ });
745
616
  messageWaitTimer = setTimeout(() => {
746
617
  if (messageAwait !== undefined) {
747
618
  messageAwait.unsubscribe();
@@ -755,20 +626,18 @@ class Region {
755
626
  }, 10000);
756
627
  });
757
628
  }
758
- getParcels() {
759
- return __awaiter(this, void 0, void 0, function* () {
760
- yield this.waitForParcelOverlay();
761
- const parcels = [];
762
- for (const parcel of this.parcelCoordinates) {
763
- try {
764
- parcels.push(yield this.getParcelProperties(parcel.x * 4.0, parcel.y * 4.0));
765
- }
766
- catch (error) {
767
- console.error(error);
768
- }
629
+ async getParcels() {
630
+ await this.waitForParcelOverlay();
631
+ const parcels = [];
632
+ for (const parcel of this.parcelCoordinates) {
633
+ try {
634
+ parcels.push(await this.getParcelProperties(parcel.x * 4.0, parcel.y * 4.0));
769
635
  }
770
- return parcels;
771
- });
636
+ catch (error) {
637
+ console.error(error);
638
+ }
639
+ }
640
+ return parcels;
772
641
  }
773
642
  resetParcels() {
774
643
  this.parcelMap = [];
@@ -782,7 +651,7 @@ class Region {
782
651
  this.parcelsByUUID = {};
783
652
  this.parcelsComplete = false;
784
653
  }
785
- waitForParcelOverlay() {
654
+ async waitForParcelOverlay() {
786
655
  return new Promise((resolve, reject) => {
787
656
  if (this.parcelOverlayComplete) {
788
657
  resolve();
@@ -803,7 +672,7 @@ class Region {
803
672
  }
804
673
  });
805
674
  }
806
- waitForParcels() {
675
+ async waitForParcels() {
807
676
  return new Promise((resolve, reject) => {
808
677
  if (this.parcelsComplete) {
809
678
  resolve();
@@ -824,7 +693,7 @@ class Region {
824
693
  }
825
694
  });
826
695
  }
827
- waitForTerrain() {
696
+ async waitForTerrain() {
828
697
  return new Promise((resolve, reject) => {
829
698
  if (this.terrainComplete) {
830
699
  resolve();
@@ -892,7 +761,10 @@ class Region {
892
761
  terrain.ele('UseEstateSun', (this.useEstateSun) ? 'True' : 'False');
893
762
  terrain.ele('FixedSun', (this.regionFlags & RegionFlags_1.RegionFlags.SunFixed) ? 'True' : 'False');
894
763
  terrain.ele('SunPosition', this.sunHour);
895
- this.environment.getXML(document);
764
+ if (this.environment) {
765
+ const env = document.ele('Environment');
766
+ env.ele('data', this.environment.toNotation());
767
+ }
896
768
  return document.end({ pretty: true, allowEmpty: true });
897
769
  }
898
770
  activateCaps(seedURL) {
@@ -901,171 +773,95 @@ class Region {
901
773
  }
902
774
  this.caps = new Caps_1.Caps(this.agent, seedURL, this.clientEvents);
903
775
  }
904
- handshake(handshake) {
905
- return __awaiter(this, void 0, void 0, function* () {
906
- this.regionName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo.SimName);
907
- this.simAccess = handshake.RegionInfo.SimAccess;
908
- this.regionFlags = handshake.RegionInfo.RegionFlags;
909
- this.regionOwner = handshake.RegionInfo.SimOwner;
910
- this.agent.setIsEstateManager(handshake.RegionInfo.IsEstateManager);
911
- this.waterHeight = handshake.RegionInfo.WaterHeight;
912
- this.billableFactor = handshake.RegionInfo.BillableFactor;
913
- this.cacheID = handshake.RegionInfo.CacheID;
914
- this.terrainBase0 = handshake.RegionInfo.TerrainBase0;
915
- this.terrainBase1 = handshake.RegionInfo.TerrainBase1;
916
- this.terrainBase2 = handshake.RegionInfo.TerrainBase2;
917
- this.terrainBase3 = handshake.RegionInfo.TerrainBase3;
918
- this.terrainDetail0 = handshake.RegionInfo.TerrainDetail0;
919
- this.terrainDetail1 = handshake.RegionInfo.TerrainDetail1;
920
- this.terrainDetail2 = handshake.RegionInfo.TerrainDetail2;
921
- this.terrainDetail3 = handshake.RegionInfo.TerrainDetail3;
922
- this.terrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00;
923
- this.terrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01;
924
- this.terrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10;
925
- this.terrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11;
926
- this.terrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00;
927
- this.terrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01;
928
- this.terrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10;
929
- this.terrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11;
930
- this.regionID = handshake.RegionInfo2.RegionID;
931
- this.cpuClassID = handshake.RegionInfo3.CPUClassID;
932
- this.cpuRatio = handshake.RegionInfo3.CPURatio;
933
- this.coloName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ColoName);
934
- this.productSKU = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ProductSKU);
935
- this.productName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ProductName);
936
- const request = new RequestRegionInfo_1.RequestRegionInfoMessage();
937
- request.AgentData = {
938
- AgentID: this.agent.agentID,
939
- SessionID: this.circuit.sessionID
940
- };
941
- this.circuit.sendMessage(request, PacketFlags_1.PacketFlags.Reliable);
942
- const regionInfo = yield this.circuit.waitForMessage(Message_1.Message.RegionInfo, 10000);
943
- this.estateID = regionInfo.RegionInfo.EstateID;
944
- this.parentEstateID = regionInfo.RegionInfo.ParentEstateID;
945
- this.maxAgents = regionInfo.RegionInfo.MaxAgents;
946
- this.objectBonusFactor = regionInfo.RegionInfo.ObjectBonusFactor;
947
- this.terrainRaiseLimit = regionInfo.RegionInfo.TerrainRaiseLimit;
948
- this.terrainLowerLimit = regionInfo.RegionInfo.TerrainLowerLimit;
949
- this.pricePerMeter = regionInfo.RegionInfo.PricePerMeter;
950
- this.redirectGridX = regionInfo.RegionInfo.RedirectGridX;
951
- this.redirectGridY = regionInfo.RegionInfo.RedirectGridY;
952
- this.useEstateSun = regionInfo.RegionInfo.UseEstateSun;
953
- this.sunHour = regionInfo.RegionInfo.SunHour;
954
- this.maxAgents32 = regionInfo.RegionInfo2.MaxAgents32;
955
- this.hardMaxAgents = regionInfo.RegionInfo2.HardMaxAgents;
956
- this.hardMaxObjects = regionInfo.RegionInfo2.HardMaxObjects;
957
- const msg = new MapNameRequest_1.MapNameRequestMessage();
958
- msg.AgentData = {
959
- AgentID: this.agent.agentID,
960
- SessionID: this.circuit.sessionID,
961
- Flags: GridLayerType_1.GridLayerType.Objects,
962
- EstateID: 0,
963
- Godlike: false
964
- };
965
- msg.NameData = {
966
- Name: handshake.RegionInfo.SimName
967
- };
968
- this.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
969
- yield this.circuit.waitForMessage(Message_1.Message.MapBlockReply, 10000, (filterMsg) => {
970
- for (const region of filterMsg.Data) {
971
- const name = Utils_1.Utils.BufferToStringSimple(region.Name);
972
- if (name.trim().toLowerCase() === this.regionName.trim().toLowerCase()) {
973
- this.xCoordinate = region.X;
974
- this.yCoordinate = region.Y;
975
- this.mapImage = region.MapImageID;
976
- const globalPos = Utils_1.Utils.RegionCoordinatesToHandle(this.xCoordinate, this.yCoordinate);
977
- this.regionHandle = globalPos.regionHandle;
978
- return FilterResponse_1.FilterResponse.Finish;
979
- }
980
- }
981
- return FilterResponse_1.FilterResponse.NoMatch;
982
- });
983
- this.environment = new RegionEnvironment_1.RegionEnvironment();
984
- this.environment.dayCycleKeyframes = [];
985
- this.environment.skyPresets = {};
986
- this.environment.water = {
987
- blurMultiplier: 0,
988
- fresnelOffset: 0,
989
- fresnelScale: 0,
990
- normalScale: Vector3_1.Vector3.getZero(),
991
- normalMap: UUID_1.UUID.zero(),
992
- scaleAbove: 0,
993
- scaleBelow: 0,
994
- underWaterFogMod: 0,
995
- waterFogColor: Color4_1.Color4.white,
996
- waterFogDensity: 0,
997
- wave1Dir: Vector2_1.Vector2.getZero(),
998
- wave2Dir: Vector2_1.Vector2.getZero()
999
- };
1000
- yield this.caps.waitForSeedCapability();
1001
- try {
1002
- const response = yield this.caps.capsGetXML('EnvironmentSettings');
1003
- if (response.length >= 4) {
1004
- if (Array.isArray(response[1]) && typeof response[2] === 'object' && typeof response[3] === 'object') {
1005
- for (const kf of response[1]) {
1006
- this.environment.dayCycleKeyframes.push({
1007
- time: kf[0],
1008
- preset: kf[1]
1009
- });
1010
- }
1011
- for (const presetKey of Object.keys(response[2])) {
1012
- const preset = response[2][presetKey];
1013
- this.environment.skyPresets[presetKey] = new class {
1014
- constructor() {
1015
- this.ambient = new Vector4_1.Vector4(preset['ambient']);
1016
- this.blueDensity = new Vector4_1.Vector4(preset['blue_density']);
1017
- this.blueHorizon = new Vector4_1.Vector4(preset['blue_horizon']);
1018
- this.cloudColor = new Color4_1.Color4(preset['cloud_color']);
1019
- this.cloudPosDensity1 = new Vector4_1.Vector4(preset['cloud_pos_density1']);
1020
- this.cloudPosDensity2 = new Vector4_1.Vector4(preset['cloud_pos_density2']);
1021
- this.cloudScale = new Vector4_1.Vector4(preset['cloud_scale']);
1022
- this.cloudScrollRate = new Vector2_1.Vector2(preset['cloud_scroll_rate']);
1023
- this.cloudShadow = new Vector4_1.Vector4(preset['cloud_shadow']);
1024
- this.densityMultiplier = new Vector4_1.Vector4(preset['density_multiplier']);
1025
- this.distanceMultiplier = new Vector4_1.Vector4(preset['distance_multiplier']);
1026
- this.eastAngle = preset['east_angle'];
1027
- this.enableCloudScroll = {
1028
- x: preset['enable_cloud_scroll'][0],
1029
- y: preset['enable_cloud_scroll'][1]
1030
- };
1031
- this.gamma = new Vector4_1.Vector4(preset['gamma']);
1032
- this.glow = new Vector4_1.Vector4(preset['glow']);
1033
- this.hazeDensity = new Vector4_1.Vector4(preset['haze_density']);
1034
- this.hazeHorizon = new Vector4_1.Vector4(preset['haze_horizon']);
1035
- this.lightNormal = new Vector4_1.Vector4(preset['lightnorm']);
1036
- this.maxY = new Vector4_1.Vector4(preset['max_y']);
1037
- this.starBrightness = preset['start_brightness'];
1038
- this.sunAngle = preset['sun_angle'];
1039
- this.sunlightColor = new Color4_1.Color4(preset['sunlight_color']);
1040
- }
1041
- };
1042
- }
1043
- const wat = response[3];
1044
- this.environment.water = new class {
1045
- constructor() {
1046
- this.blurMultiplier = wat['blurMultiplier'];
1047
- this.fresnelOffset = wat['fresnelOffset'];
1048
- this.fresnelScale = wat['fresnelScale'];
1049
- this.normalScale = new Vector3_1.Vector3(wat['normScale']);
1050
- this.normalMap = new UUID_1.UUID(wat['normalMap'].toString());
1051
- this.scaleAbove = wat['scaleAbove'];
1052
- this.scaleBelow = wat['scaleBelow'];
1053
- this.underWaterFogMod = wat['underWaterFogMod'];
1054
- this.waterFogColor = new Color4_1.Color4(wat['waterFogColor']);
1055
- this.waterFogDensity = wat['waterFogDensity'];
1056
- this.wave1Dir = new Vector2_1.Vector2(wat['wave1Dir']);
1057
- this.wave2Dir = new Vector2_1.Vector2(wat['wave2Dir']);
1058
- }
1059
- };
1060
- }
776
+ async handshake(handshake) {
777
+ this.regionName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo.SimName);
778
+ this.simAccess = handshake.RegionInfo.SimAccess;
779
+ this.regionFlags = handshake.RegionInfo.RegionFlags;
780
+ this.regionOwner = handshake.RegionInfo.SimOwner;
781
+ this.agent.setIsEstateManager(handshake.RegionInfo.IsEstateManager);
782
+ this.waterHeight = handshake.RegionInfo.WaterHeight;
783
+ this.billableFactor = handshake.RegionInfo.BillableFactor;
784
+ this.cacheID = handshake.RegionInfo.CacheID;
785
+ this.terrainBase0 = handshake.RegionInfo.TerrainBase0;
786
+ this.terrainBase1 = handshake.RegionInfo.TerrainBase1;
787
+ this.terrainBase2 = handshake.RegionInfo.TerrainBase2;
788
+ this.terrainBase3 = handshake.RegionInfo.TerrainBase3;
789
+ this.terrainDetail0 = handshake.RegionInfo.TerrainDetail0;
790
+ this.terrainDetail1 = handshake.RegionInfo.TerrainDetail1;
791
+ this.terrainDetail2 = handshake.RegionInfo.TerrainDetail2;
792
+ this.terrainDetail3 = handshake.RegionInfo.TerrainDetail3;
793
+ this.terrainStartHeight00 = handshake.RegionInfo.TerrainStartHeight00;
794
+ this.terrainStartHeight01 = handshake.RegionInfo.TerrainStartHeight01;
795
+ this.terrainStartHeight10 = handshake.RegionInfo.TerrainStartHeight10;
796
+ this.terrainStartHeight11 = handshake.RegionInfo.TerrainStartHeight11;
797
+ this.terrainHeightRange00 = handshake.RegionInfo.TerrainHeightRange00;
798
+ this.terrainHeightRange01 = handshake.RegionInfo.TerrainHeightRange01;
799
+ this.terrainHeightRange10 = handshake.RegionInfo.TerrainHeightRange10;
800
+ this.terrainHeightRange11 = handshake.RegionInfo.TerrainHeightRange11;
801
+ this.regionID = handshake.RegionInfo2.RegionID;
802
+ this.cpuClassID = handshake.RegionInfo3.CPUClassID;
803
+ this.cpuRatio = handshake.RegionInfo3.CPURatio;
804
+ this.coloName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ColoName);
805
+ this.productSKU = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ProductSKU);
806
+ this.productName = Utils_1.Utils.BufferToStringSimple(handshake.RegionInfo3.ProductName);
807
+ const request = new RequestRegionInfo_1.RequestRegionInfoMessage();
808
+ request.AgentData = {
809
+ AgentID: this.agent.agentID,
810
+ SessionID: this.circuit.sessionID
811
+ };
812
+ this.circuit.sendMessage(request, PacketFlags_1.PacketFlags.Reliable);
813
+ const regionInfo = await this.circuit.waitForMessage(Message_1.Message.RegionInfo, 30000);
814
+ this.estateID = regionInfo.RegionInfo.EstateID;
815
+ this.parentEstateID = regionInfo.RegionInfo.ParentEstateID;
816
+ this.maxAgents = regionInfo.RegionInfo.MaxAgents;
817
+ this.objectBonusFactor = regionInfo.RegionInfo.ObjectBonusFactor;
818
+ this.terrainRaiseLimit = regionInfo.RegionInfo.TerrainRaiseLimit;
819
+ this.terrainLowerLimit = regionInfo.RegionInfo.TerrainLowerLimit;
820
+ this.pricePerMeter = regionInfo.RegionInfo.PricePerMeter;
821
+ this.redirectGridX = regionInfo.RegionInfo.RedirectGridX;
822
+ this.redirectGridY = regionInfo.RegionInfo.RedirectGridY;
823
+ this.useEstateSun = regionInfo.RegionInfo.UseEstateSun;
824
+ this.sunHour = regionInfo.RegionInfo.SunHour;
825
+ this.maxAgents32 = regionInfo.RegionInfo2.MaxAgents32;
826
+ this.hardMaxAgents = regionInfo.RegionInfo2.HardMaxAgents;
827
+ this.hardMaxObjects = regionInfo.RegionInfo2.HardMaxObjects;
828
+ const msg = new MapNameRequest_1.MapNameRequestMessage();
829
+ msg.AgentData = {
830
+ AgentID: this.agent.agentID,
831
+ SessionID: this.circuit.sessionID,
832
+ Flags: GridLayerType_1.GridLayerType.Objects,
833
+ EstateID: 0,
834
+ Godlike: false
835
+ };
836
+ msg.NameData = {
837
+ Name: handshake.RegionInfo.SimName
838
+ };
839
+ this.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
840
+ await this.circuit.waitForMessage(Message_1.Message.MapBlockReply, 30000, (filterMsg) => {
841
+ for (const region of filterMsg.Data) {
842
+ const name = Utils_1.Utils.BufferToStringSimple(region.Name);
843
+ if (name.trim().toLowerCase() === this.regionName.trim().toLowerCase()) {
844
+ this.xCoordinate = region.X;
845
+ this.yCoordinate = region.Y;
846
+ this.mapImage = region.MapImageID;
847
+ const globalPos = Utils_1.Utils.RegionCoordinatesToHandle(this.xCoordinate, this.yCoordinate);
848
+ this.regionHandle = globalPos.regionHandle;
849
+ return FilterResponse_1.FilterResponse.Finish;
1061
850
  }
1062
851
  }
1063
- catch (e) {
1064
- Logger_1.Logger.Warn('Unable to get environment settings from region');
1065
- }
1066
- this.handshakeComplete = true;
1067
- this.handshakeCompleteEvent.next();
852
+ return FilterResponse_1.FilterResponse.NoMatch;
1068
853
  });
854
+ await this.caps.waitForSeedCapability();
855
+ try {
856
+ const extResponse = await this.caps.capsGetString('ExtEnvironment');
857
+ this.environment = new RegionEnvironment_1.RegionEnvironment(LLSD_1.LLSD.parseXML(extResponse));
858
+ }
859
+ catch (e) {
860
+ Logger_1.Logger.Error(e);
861
+ Logger_1.Logger.Warn('Unable to get environment settings from region');
862
+ }
863
+ this.handshakeComplete = true;
864
+ this.handshakeCompleteEvent.next();
1069
865
  }
1070
866
  shutdown() {
1071
867
  this.parcelPropertiesSubscription.unsubscribe();
@@ -1076,11 +872,153 @@ class Region {
1076
872
  this.resolver.shutdown();
1077
873
  this.circuit.shutdown();
1078
874
  }
875
+ static doesBitmapContainCoordinate(bitmap, x, y) {
876
+ const mapBlockX = Math.floor(x / 4);
877
+ const mapBlockY = Math.floor(y / 4);
878
+ let index = (mapBlockY * 64) + mapBlockX;
879
+ const bit = index % 8;
880
+ index >>= 3;
881
+ return ((bitmap[index] & (1 << bit)) !== 0);
882
+ }
883
+ async resolveParcel(parcelProperties) {
884
+ const msg = new ParcelDwellRequest_1.ParcelDwellRequestMessage();
885
+ msg.AgentData = {
886
+ AgentID: this.agent.agentID,
887
+ SessionID: this.circuit.sessionID
888
+ };
889
+ msg.Data = {
890
+ LocalID: parcelProperties.LocalID,
891
+ ParcelID: UUID_1.UUID.zero()
892
+ };
893
+ this.circuit.sendMessage(msg, PacketFlags_1.PacketFlags.Reliable);
894
+ const dwellReply = await this.circuit.waitForMessage(Message_1.Message.ParcelDwellReply, 10000, (message) => {
895
+ if (message.Data.LocalID === parcelProperties.LocalID) {
896
+ return FilterResponse_1.FilterResponse.Finish;
897
+ }
898
+ else {
899
+ return FilterResponse_1.FilterResponse.NoMatch;
900
+ }
901
+ });
902
+ const parcelID = dwellReply.Data.ParcelID.toString();
903
+ let parcel = new Parcel_1.Parcel(this);
904
+ if (this.parcelsByUUID[parcelID]) {
905
+ parcel = this.parcelsByUUID[parcelID];
906
+ }
907
+ parcel.LocalID = parcelProperties.LocalID;
908
+ parcel.ParcelID = new UUID_1.UUID(dwellReply.Data.ParcelID.toString());
909
+ parcel.RegionDenyAgeUnverified = parcelProperties.RegionDenyTransacted;
910
+ parcel.MediaDesc = parcelProperties.MediaDesc;
911
+ parcel.MediaHeight = parcelProperties.MediaHeight;
912
+ parcel.MediaLoop = parcelProperties.MediaLoop;
913
+ parcel.MediaType = parcelProperties.MediaType;
914
+ parcel.MediaWidth = parcelProperties.MediaWidth;
915
+ parcel.ObscureMedia = parcelProperties.ObscureMedia;
916
+ parcel.ObscureMusic = parcelProperties.ObscureMusic;
917
+ parcel.AABBMax = parcelProperties.AABBMax;
918
+ parcel.AABBMin = parcelProperties.AABBMin;
919
+ parcel.AnyAVSounds = parcelProperties.AnyAVSounds;
920
+ parcel.Area = parcelProperties.Area;
921
+ parcel.AuctionID = parcelProperties.AuctionID;
922
+ parcel.AuthBuyerID = new UUID_1.UUID(parcelProperties.AuthBuyerID.toString());
923
+ parcel.Bitmap = parcelProperties.Bitmap;
924
+ parcel.Category = parcelProperties.Category;
925
+ parcel.ClaimDate = parcelProperties.ClaimDate;
926
+ parcel.ClaimPrice = parcelProperties.ClaimPrice;
927
+ parcel.Desc = parcelProperties.Desc;
928
+ parcel.Dwell = dwellReply.Data.Dwell;
929
+ parcel.GroupAVSounds = parcelProperties.GroupAVSounds;
930
+ parcel.GroupID = new UUID_1.UUID(parcelProperties.GroupID.toString());
931
+ parcel.GroupPrims = parcelProperties.GroupPrims;
932
+ parcel.IsGroupOwned = parcelProperties.IsGroupOwned;
933
+ parcel.LandingType = parcelProperties.LandingType;
934
+ parcel.MaxPrims = parcelProperties.MaxPrims;
935
+ parcel.MediaAutoScale = parcelProperties.MediaAutoScale;
936
+ parcel.MediaID = new UUID_1.UUID(parcelProperties.MediaID.toString());
937
+ parcel.MediaURL = parcelProperties.MediaURL;
938
+ parcel.MusicURL = parcelProperties.MusicURL;
939
+ parcel.Name = parcelProperties.Name;
940
+ parcel.OtherCleanTime = parcelProperties.OtherCleanTime;
941
+ parcel.OtherCount = parcelProperties.OtherCount;
942
+ parcel.OtherPrims = parcelProperties.OtherPrims;
943
+ parcel.OwnerID = new UUID_1.UUID(parcelProperties.OwnerID.toString());
944
+ parcel.OwnerPrims = parcelProperties.OwnerPrims;
945
+ parcel.ParcelFlags = parcelProperties.ParcelFlags;
946
+ parcel.ParcelPrimBonus = parcelProperties.ParcelPrimBonus;
947
+ parcel.PassHours = parcelProperties.PassHours;
948
+ parcel.PassPrice = parcelProperties.PassPrice;
949
+ parcel.PublicCount = parcelProperties.PublicCount;
950
+ parcel.RegionDenyAnonymous = parcelProperties.RegionDenyAnonymous;
951
+ parcel.RegionDenyIdentified = parcelProperties.RegionDenyIdentified;
952
+ parcel.RegionPushOverride = parcelProperties.RegionPushOverride;
953
+ parcel.RegionDenyTransacted = parcelProperties.RegionDenyTransacted;
954
+ parcel.RentPrice = parcelProperties.RentPrice;
955
+ parcel.RequestResult = parcelProperties.RequestResult;
956
+ parcel.SalePrice = parcelProperties.SalePrice;
957
+ parcel.SeeAvs = parcelProperties.SeeAvs;
958
+ parcel.SelectedPrims = parcelProperties.SelectedPrims;
959
+ parcel.SelfCount = parcelProperties.SelfCount;
960
+ parcel.SequenceID = parcelProperties.SequenceID;
961
+ parcel.SimWideMaxPrims = parcelProperties.SimWideMaxPrims;
962
+ parcel.SimWideTotalPrims = parcelProperties.SimWideTotalPrims;
963
+ parcel.SnapSelection = parcelProperties.SnapSelection;
964
+ parcel.SnapshotID = new UUID_1.UUID(parcelProperties.SnapshotID.toString());
965
+ parcel.Status = parcelProperties.Status;
966
+ parcel.TotalPrims = parcelProperties.TotalPrims;
967
+ parcel.UserLocation = parcelProperties.UserLocation;
968
+ parcel.UserLookAt = parcelProperties.UserLookAt;
969
+ parcel.RegionAllowAccessOverride = parcelProperties.RegionAllowAccessOverride;
970
+ this.parcels[parcelProperties.LocalID] = parcel;
971
+ let foundEmpty = false;
972
+ for (let y = 0; y < 64; y++) {
973
+ for (let x = 0; x < 64; x++) {
974
+ if (Region.doesBitmapContainCoordinate(parcel.Bitmap, x * 4, y * 4)) {
975
+ this.parcelMap[y][x] = parcel.LocalID;
976
+ }
977
+ else {
978
+ if (this.parcelMap[y][x] === 0) {
979
+ foundEmpty = true;
980
+ }
981
+ }
982
+ }
983
+ }
984
+ if (!foundEmpty) {
985
+ if (!this.parcelsComplete) {
986
+ this.parcelsComplete = true;
987
+ this.parcelsCompleteEvent.next();
988
+ }
989
+ }
990
+ else if (this.parcelsComplete) {
991
+ this.parcelsComplete = false;
992
+ }
993
+ return parcel;
994
+ }
995
+ fillParcel(parcelID, x, y) {
996
+ if (x < 0 || y < 0 || x > 63 || y > 63) {
997
+ return;
998
+ }
999
+ if (this.parcelOverlay[(y * 64) + x].parcelID !== -1) {
1000
+ return;
1001
+ }
1002
+ this.parcelOverlay[(y * 64) + x].parcelID = parcelID;
1003
+ const flags = this.parcelOverlay[(y * 64) + x].landFlags;
1004
+ if (!(flags & LandFlags_1.LandFlags.BorderSouth)) {
1005
+ this.fillParcel(parcelID, x, y - 1);
1006
+ }
1007
+ if (!(flags & LandFlags_1.LandFlags.BorderWest)) {
1008
+ this.fillParcel(parcelID, x - 1, y);
1009
+ }
1010
+ if (x < 63 && !(this.parcelOverlay[(y * 64) + (x + 1)].landFlags & LandFlags_1.LandFlags.BorderWest)) {
1011
+ this.fillParcel(parcelID, x + 1, y);
1012
+ }
1013
+ if (y < 63 && !(this.parcelOverlay[((y + 1) * 64) + x].landFlags & LandFlags_1.LandFlags.BorderSouth)) {
1014
+ this.fillParcel(parcelID, x, y + 1);
1015
+ }
1016
+ }
1079
1017
  }
1080
1018
  exports.Region = Region;
1081
1019
  Region.CopyMatrix16 = [];
1082
1020
  Region.CosineTable16 = [];
1083
1021
  Region.DequantizeTable16 = [];
1084
1022
  Region.setup = false;
1085
- Region.OO_SQRT_2 = 0.7071067811865475244008443621049;
1023
+ Region.OO_SQRT_2 = 0.707106781186547;
1086
1024
  //# sourceMappingURL=Region.js.map