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