@rpgjs/client 5.0.0-alpha.9 → 5.0.0-beta.10

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 (347) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +19 -0
  3. package/dist/Game/AnimationManager.d.ts +8 -0
  4. package/dist/Game/AnimationManager.js +35 -0
  5. package/dist/Game/AnimationManager.js.map +1 -0
  6. package/dist/Game/AnimationManager.spec.d.ts +1 -0
  7. package/dist/Game/Event.d.ts +1 -1
  8. package/dist/Game/Event.js +12 -0
  9. package/dist/Game/Event.js.map +1 -0
  10. package/dist/Game/Map.d.ts +31 -2
  11. package/dist/Game/Map.js +138 -0
  12. package/dist/Game/Map.js.map +1 -0
  13. package/dist/Game/Object.d.ts +189 -0
  14. package/dist/Game/Object.js +255 -0
  15. package/dist/Game/Object.js.map +1 -0
  16. package/dist/Game/Player.d.ts +1 -1
  17. package/dist/Game/Player.js +12 -0
  18. package/dist/Game/Player.js.map +1 -0
  19. package/dist/Gui/Gui.d.ts +192 -7
  20. package/dist/Gui/Gui.js +475 -0
  21. package/dist/Gui/Gui.js.map +1 -0
  22. package/dist/Gui/Gui.spec.d.ts +1 -0
  23. package/dist/Gui/NotificationManager.d.ts +23 -0
  24. package/dist/Gui/NotificationManager.js +49 -0
  25. package/dist/Gui/NotificationManager.js.map +1 -0
  26. package/dist/Resource.d.ts +97 -0
  27. package/dist/Resource.js +133 -0
  28. package/dist/Resource.js.map +1 -0
  29. package/dist/RpgClient.d.ts +295 -13
  30. package/dist/RpgClientEngine.d.ts +671 -15
  31. package/dist/RpgClientEngine.js +1442 -0
  32. package/dist/RpgClientEngine.js.map +1 -0
  33. package/dist/Sound.d.ts +199 -0
  34. package/dist/Sound.js +167 -0
  35. package/dist/Sound.js.map +1 -0
  36. package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js +9 -0
  37. package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorateMetadata.js +6 -0
  38. package/dist/components/animations/animation.ce.js +23 -0
  39. package/dist/components/animations/animation.ce.js.map +1 -0
  40. package/dist/components/animations/hit.ce.js +64 -0
  41. package/dist/components/animations/hit.ce.js.map +1 -0
  42. package/dist/components/animations/index.d.ts +4 -0
  43. package/dist/components/animations/index.js +11 -0
  44. package/dist/components/animations/index.js.map +1 -0
  45. package/dist/components/character.ce.js +572 -0
  46. package/dist/components/character.ce.js.map +1 -0
  47. package/dist/components/dynamics/bar.ce.js +96 -0
  48. package/dist/components/dynamics/bar.ce.js.map +1 -0
  49. package/dist/components/dynamics/image.ce.js +23 -0
  50. package/dist/components/dynamics/image.ce.js.map +1 -0
  51. package/dist/components/dynamics/parse-value.d.ts +4 -0
  52. package/dist/components/dynamics/parse-value.js +63 -0
  53. package/dist/components/dynamics/parse-value.js.map +1 -0
  54. package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
  55. package/dist/components/dynamics/shape-utils.d.ts +16 -0
  56. package/dist/components/dynamics/shape-utils.js +73 -0
  57. package/dist/components/dynamics/shape-utils.js.map +1 -0
  58. package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
  59. package/dist/components/dynamics/shape.ce.js +83 -0
  60. package/dist/components/dynamics/shape.ce.js.map +1 -0
  61. package/dist/components/dynamics/text.ce.js +50 -0
  62. package/dist/components/dynamics/text.ce.js.map +1 -0
  63. package/dist/components/gui/box.ce.js +26 -0
  64. package/dist/components/gui/box.ce.js.map +1 -0
  65. package/dist/components/gui/dialogbox/index.ce.js +198 -0
  66. package/dist/components/gui/dialogbox/index.ce.js.map +1 -0
  67. package/dist/components/gui/gameover.ce.js +169 -0
  68. package/dist/components/gui/gameover.ce.js.map +1 -0
  69. package/dist/components/gui/hud/hud.ce.js +83 -0
  70. package/dist/components/gui/hud/hud.ce.js.map +1 -0
  71. package/dist/components/gui/index.d.ts +15 -3
  72. package/dist/components/gui/index.js +14 -0
  73. package/dist/components/gui/menu/equip-menu.ce.js +427 -0
  74. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -0
  75. package/dist/components/gui/menu/exit-menu.ce.js +55 -0
  76. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -0
  77. package/dist/components/gui/menu/items-menu.ce.js +326 -0
  78. package/dist/components/gui/menu/items-menu.ce.js.map +1 -0
  79. package/dist/components/gui/menu/main-menu.ce.js +399 -0
  80. package/dist/components/gui/menu/main-menu.ce.js.map +1 -0
  81. package/dist/components/gui/menu/options-menu.ce.js +49 -0
  82. package/dist/components/gui/menu/options-menu.ce.js.map +1 -0
  83. package/dist/components/gui/menu/skills-menu.ce.js +102 -0
  84. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -0
  85. package/dist/components/gui/mobile/index.d.ts +8 -0
  86. package/dist/components/gui/mobile/index.js +21 -0
  87. package/dist/components/gui/mobile/index.js.map +1 -0
  88. package/dist/components/gui/mobile/mobile.ce.js +79 -0
  89. package/dist/components/gui/mobile/mobile.ce.js.map +1 -0
  90. package/dist/components/gui/notification/notification.ce.js +62 -0
  91. package/dist/components/gui/notification/notification.ce.js.map +1 -0
  92. package/dist/components/gui/save-load.ce.js +211 -0
  93. package/dist/components/gui/save-load.ce.js.map +1 -0
  94. package/dist/components/gui/shop/shop.ce.js +614 -0
  95. package/dist/components/gui/shop/shop.ce.js.map +1 -0
  96. package/dist/components/gui/title-screen.ce.js +164 -0
  97. package/dist/components/gui/title-screen.ce.js.map +1 -0
  98. package/dist/components/index.d.ts +1 -0
  99. package/dist/components/index.js +4 -0
  100. package/dist/components/player-components-utils.d.ts +67 -0
  101. package/dist/components/player-components-utils.js +162 -0
  102. package/dist/components/player-components-utils.js.map +1 -0
  103. package/dist/components/player-components-utils.spec.d.ts +1 -0
  104. package/dist/components/player-components.ce.js +188 -0
  105. package/dist/components/player-components.ce.js.map +1 -0
  106. package/dist/components/prebuilt/hp-bar.ce.js +113 -0
  107. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -0
  108. package/dist/components/prebuilt/index.d.ts +19 -0
  109. package/dist/components/prebuilt/index.js +2 -0
  110. package/dist/components/prebuilt/light-halo.ce.js +70 -0
  111. package/dist/components/prebuilt/light-halo.ce.js.map +1 -0
  112. package/dist/components/scenes/canvas.ce.js +196 -0
  113. package/dist/components/scenes/canvas.ce.js.map +1 -0
  114. package/dist/components/scenes/draw-map.ce.js +79 -0
  115. package/dist/components/scenes/draw-map.ce.js.map +1 -0
  116. package/dist/components/scenes/event-layer.ce.js +29 -0
  117. package/dist/components/scenes/event-layer.ce.js.map +1 -0
  118. package/dist/core/inject.js +18 -0
  119. package/dist/core/inject.js.map +1 -0
  120. package/dist/core/setup.js +16 -0
  121. package/dist/core/setup.js.map +1 -0
  122. package/dist/decorators/spritesheet.d.ts +1 -0
  123. package/dist/decorators/spritesheet.js +11 -0
  124. package/dist/decorators/spritesheet.js.map +1 -0
  125. package/dist/index.d.ts +16 -1
  126. package/dist/index.js +45 -14
  127. package/dist/module.d.ts +43 -4
  128. package/dist/module.js +179 -0
  129. package/dist/module.js.map +1 -0
  130. package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js +167 -0
  131. package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js.map +1 -0
  132. package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js +239 -0
  133. package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js.map +1 -0
  134. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
  135. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
  136. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js +696 -0
  137. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js.map +1 -0
  138. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js +44 -0
  139. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js.map +1 -0
  140. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js +241 -0
  141. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js.map +1 -0
  142. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js +115 -0
  143. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -0
  144. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +401 -0
  145. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -0
  146. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
  147. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3756 -0
  148. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -0
  149. package/dist/presets/animation.d.ts +31 -0
  150. package/dist/presets/animation.js +39 -0
  151. package/dist/presets/animation.js.map +1 -0
  152. package/dist/presets/faceset.d.ts +30 -0
  153. package/dist/presets/faceset.js +51 -0
  154. package/dist/presets/faceset.js.map +1 -0
  155. package/dist/presets/icon.d.ts +20 -0
  156. package/dist/presets/icon.js +15 -0
  157. package/dist/presets/icon.js.map +1 -0
  158. package/dist/presets/index.d.ts +123 -0
  159. package/dist/presets/index.js +17 -0
  160. package/dist/presets/index.js.map +1 -0
  161. package/dist/presets/lpc.d.ts +89 -0
  162. package/dist/presets/lpc.js +98 -0
  163. package/dist/presets/lpc.js.map +1 -0
  164. package/dist/presets/rmspritesheet.js +42 -0
  165. package/dist/presets/rmspritesheet.js.map +1 -0
  166. package/dist/services/AbstractSocket.d.ts +9 -5
  167. package/dist/services/AbstractSocket.js +11 -0
  168. package/dist/services/AbstractSocket.js.map +1 -0
  169. package/dist/services/keyboardControls.d.ts +15 -0
  170. package/dist/services/keyboardControls.js +23 -0
  171. package/dist/services/keyboardControls.js.map +1 -0
  172. package/dist/services/loadMap.d.ts +6 -0
  173. package/dist/services/loadMap.js +123 -0
  174. package/dist/services/loadMap.js.map +1 -0
  175. package/dist/services/mmorpg.d.ts +21 -9
  176. package/dist/services/mmorpg.js +136 -0
  177. package/dist/services/mmorpg.js.map +1 -0
  178. package/dist/services/save.d.ts +19 -0
  179. package/dist/services/save.js +77 -0
  180. package/dist/services/save.js.map +1 -0
  181. package/dist/services/save.spec.d.ts +1 -0
  182. package/dist/services/standalone.d.ts +67 -7
  183. package/dist/services/standalone.js +168 -0
  184. package/dist/services/standalone.js.map +1 -0
  185. package/dist/utils/getEntityProp.d.ts +39 -0
  186. package/dist/utils/getEntityProp.js +53 -0
  187. package/dist/utils/getEntityProp.js.map +1 -0
  188. package/dist/utils/getEntityProp.spec.d.ts +1 -0
  189. package/dist/utils/readPropValue.d.ts +2 -0
  190. package/dist/utils/readPropValue.js +13 -0
  191. package/dist/utils/readPropValue.js.map +1 -0
  192. package/package.json +14 -11
  193. package/src/Game/AnimationManager.spec.ts +30 -0
  194. package/src/Game/AnimationManager.ts +33 -0
  195. package/src/Game/Event.ts +1 -1
  196. package/src/Game/Map.ts +184 -3
  197. package/src/Game/Object.ts +409 -14
  198. package/src/Game/Player.ts +1 -1
  199. package/src/Gui/Gui.spec.ts +273 -0
  200. package/src/Gui/Gui.ts +566 -23
  201. package/src/Gui/NotificationManager.ts +69 -0
  202. package/src/Resource.ts +149 -0
  203. package/src/RpgClient.ts +309 -14
  204. package/src/RpgClientEngine.ts +1790 -63
  205. package/src/Sound.ts +253 -0
  206. package/src/components/{effects → animations}/animation.ce +3 -6
  207. package/src/components/{effects → animations}/index.ts +1 -1
  208. package/src/components/character.ce +801 -59
  209. package/src/components/dynamics/bar.ce +87 -0
  210. package/src/components/dynamics/image.ce +20 -0
  211. package/src/components/dynamics/parse-value.spec.ts +83 -0
  212. package/src/components/dynamics/parse-value.ts +154 -0
  213. package/src/components/dynamics/shape-utils.spec.ts +46 -0
  214. package/src/components/dynamics/shape-utils.ts +61 -0
  215. package/src/components/dynamics/shape.ce +89 -0
  216. package/src/components/dynamics/text.ce +68 -0
  217. package/src/components/gui/box.ce +17 -0
  218. package/src/components/gui/dialogbox/index.ce +213 -187
  219. package/src/components/gui/gameover.ce +158 -0
  220. package/src/components/gui/hud/hud.ce +61 -0
  221. package/src/components/gui/index.ts +30 -4
  222. package/src/components/gui/menu/equip-menu.ce +410 -0
  223. package/src/components/gui/menu/exit-menu.ce +41 -0
  224. package/src/components/gui/menu/items-menu.ce +317 -0
  225. package/src/components/gui/menu/main-menu.ce +294 -0
  226. package/src/components/gui/menu/options-menu.ce +35 -0
  227. package/src/components/gui/menu/skills-menu.ce +83 -0
  228. package/src/components/gui/mobile/index.ts +24 -0
  229. package/src/components/gui/mobile/mobile.ce +80 -0
  230. package/src/components/gui/notification/notification.ce +51 -0
  231. package/src/components/gui/save-load.ce +208 -0
  232. package/src/components/gui/shop/shop.ce +493 -0
  233. package/src/components/gui/title-screen.ce +163 -0
  234. package/src/components/index.ts +3 -0
  235. package/src/components/player-components-utils.spec.ts +109 -0
  236. package/src/components/player-components-utils.ts +205 -0
  237. package/src/components/player-components.ce +221 -0
  238. package/src/components/prebuilt/hp-bar.ce +255 -0
  239. package/src/components/prebuilt/index.ts +24 -0
  240. package/src/components/prebuilt/light-halo.ce +148 -0
  241. package/src/components/scenes/canvas.ce +185 -21
  242. package/src/components/scenes/draw-map.ce +55 -21
  243. package/src/components/scenes/event-layer.ce +8 -2
  244. package/src/components/scenes/transition.ce +60 -0
  245. package/src/core/setup.ts +2 -2
  246. package/src/decorators/spritesheet.ts +8 -0
  247. package/src/index.ts +17 -2
  248. package/src/module.ts +132 -10
  249. package/src/presets/animation.ts +46 -0
  250. package/src/presets/faceset.ts +60 -0
  251. package/src/presets/icon.ts +17 -0
  252. package/src/presets/index.ts +9 -1
  253. package/src/presets/lpc.ts +108 -0
  254. package/src/services/AbstractSocket.ts +10 -2
  255. package/src/services/keyboardControls.ts +20 -0
  256. package/src/services/loadMap.ts +3 -1
  257. package/src/services/mmorpg.ts +106 -12
  258. package/src/services/save.spec.ts +127 -0
  259. package/src/services/save.ts +103 -0
  260. package/src/services/standalone.ts +110 -18
  261. package/src/utils/getEntityProp.spec.ts +96 -0
  262. package/src/utils/getEntityProp.ts +88 -0
  263. package/src/utils/readPropValue.ts +16 -0
  264. package/vite.config.ts +4 -2
  265. package/dist/Game/EffectManager.d.ts +0 -5
  266. package/dist/components/effects/index.d.ts +0 -4
  267. package/dist/index.js.map +0 -1
  268. package/dist/index10.js +0 -8
  269. package/dist/index10.js.map +0 -1
  270. package/dist/index11.js +0 -10
  271. package/dist/index11.js.map +0 -1
  272. package/dist/index12.js +0 -8
  273. package/dist/index12.js.map +0 -1
  274. package/dist/index13.js +0 -17
  275. package/dist/index13.js.map +0 -1
  276. package/dist/index14.js +0 -107
  277. package/dist/index14.js.map +0 -1
  278. package/dist/index15.js +0 -50
  279. package/dist/index15.js.map +0 -1
  280. package/dist/index16.js +0 -191
  281. package/dist/index16.js.map +0 -1
  282. package/dist/index17.js +0 -9
  283. package/dist/index17.js.map +0 -1
  284. package/dist/index18.js +0 -387
  285. package/dist/index18.js.map +0 -1
  286. package/dist/index19.js +0 -31
  287. package/dist/index19.js.map +0 -1
  288. package/dist/index2.js +0 -181
  289. package/dist/index2.js.map +0 -1
  290. package/dist/index20.js +0 -24
  291. package/dist/index20.js.map +0 -1
  292. package/dist/index21.js +0 -2421
  293. package/dist/index21.js.map +0 -1
  294. package/dist/index22.js +0 -114
  295. package/dist/index22.js.map +0 -1
  296. package/dist/index23.js +0 -109
  297. package/dist/index23.js.map +0 -1
  298. package/dist/index24.js +0 -71
  299. package/dist/index24.js.map +0 -1
  300. package/dist/index25.js +0 -21
  301. package/dist/index25.js.map +0 -1
  302. package/dist/index26.js +0 -41
  303. package/dist/index26.js.map +0 -1
  304. package/dist/index27.js +0 -5
  305. package/dist/index27.js.map +0 -1
  306. package/dist/index28.js +0 -322
  307. package/dist/index28.js.map +0 -1
  308. package/dist/index29.js +0 -27
  309. package/dist/index29.js.map +0 -1
  310. package/dist/index3.js +0 -87
  311. package/dist/index3.js.map +0 -1
  312. package/dist/index30.js +0 -11
  313. package/dist/index30.js.map +0 -1
  314. package/dist/index31.js +0 -11
  315. package/dist/index31.js.map +0 -1
  316. package/dist/index32.js +0 -174
  317. package/dist/index32.js.map +0 -1
  318. package/dist/index33.js +0 -501
  319. package/dist/index33.js.map +0 -1
  320. package/dist/index34.js +0 -12
  321. package/dist/index34.js.map +0 -1
  322. package/dist/index35.js +0 -4403
  323. package/dist/index35.js.map +0 -1
  324. package/dist/index36.js +0 -316
  325. package/dist/index36.js.map +0 -1
  326. package/dist/index37.js +0 -61
  327. package/dist/index37.js.map +0 -1
  328. package/dist/index38.js +0 -20
  329. package/dist/index38.js.map +0 -1
  330. package/dist/index39.js +0 -20
  331. package/dist/index39.js.map +0 -1
  332. package/dist/index4.js +0 -67
  333. package/dist/index4.js.map +0 -1
  334. package/dist/index5.js +0 -16
  335. package/dist/index5.js.map +0 -1
  336. package/dist/index6.js +0 -17
  337. package/dist/index6.js.map +0 -1
  338. package/dist/index7.js +0 -39
  339. package/dist/index7.js.map +0 -1
  340. package/dist/index8.js +0 -108
  341. package/dist/index8.js.map +0 -1
  342. package/dist/index9.js +0 -76
  343. package/dist/index9.js.map +0 -1
  344. package/src/Game/EffectManager.ts +0 -20
  345. package/src/components/gui/dialogbox/itemMenu.ce +0 -23
  346. package/src/components/gui/dialogbox/selection.ce +0 -67
  347. /package/src/components/{effects → animations}/hit.ce +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # @rpgjs/client
2
+
3
+ ## 5.0.0-beta.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix current-player control binding and canMove reads when values are provided by synced or reactive state.
8
+
9
+ Fix Vue GUI rendering for hidden fixed GUIs while keeping attached GUI targets updated.
10
+
11
+ - @rpgjs/server@5.0.0-beta.10
12
+
13
+ ## 5.0.0-beta.9
14
+
15
+ ### Major Changes
16
+
17
+ - c456d25: beta.9
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [c456d25]
22
+ - @rpgjs/common@5.0.0-beta.9
23
+ - @rpgjs/server@5.0.0-beta.9
24
+ - @rpgjs/ui-css@5.0.0-beta.9
25
+
26
+ ## 5.0.0-beta.8
27
+
28
+ ### Major Changes
29
+
30
+ - 35e7fa4: beta.8
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [35e7fa4]
35
+ - @rpgjs/common@5.0.0-beta.8
36
+ - @rpgjs/server@5.0.0-beta.8
37
+ - @rpgjs/ui-css@5.0.0-beta.8
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2026 by Samuel Ronce
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ import { RpgCommonPlayer } from '@rpgjs/common';
2
+ export declare class AnimationManager {
3
+ current: import('canvasengine').WritableArraySignal<any[]>;
4
+ displayEffect(params: any, player: RpgCommonPlayer | {
5
+ x: number;
6
+ y: number;
7
+ }): Promise<void>;
8
+ }
@@ -0,0 +1,35 @@
1
+ import { signal } from "canvasengine";
2
+ import { generateUID } from "@rpgjs/common";
3
+ //#region src/Game/AnimationManager.ts
4
+ var AnimationManager = class {
5
+ constructor() {
6
+ this.current = signal([]);
7
+ }
8
+ displayEffect(params, player) {
9
+ const id = generateUID();
10
+ const effectParams = params ?? {};
11
+ return new Promise((resolve) => {
12
+ let finished = false;
13
+ const finish = (data) => {
14
+ if (finished) return;
15
+ finished = true;
16
+ const index = this.current().findIndex((value) => value.id === id);
17
+ if (index !== -1) this.current().splice(index, 1);
18
+ effectParams.onFinish?.(data);
19
+ resolve();
20
+ };
21
+ this.current().push({
22
+ ...effectParams,
23
+ id,
24
+ x: player.x,
25
+ y: player.y,
26
+ object: player,
27
+ onFinish: finish
28
+ });
29
+ });
30
+ }
31
+ };
32
+ //#endregion
33
+ export { AnimationManager };
34
+
35
+ //# sourceMappingURL=AnimationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimationManager.js","names":[],"sources":["../../src/Game/AnimationManager.ts"],"sourcesContent":["import { generateUID, RpgCommonPlayer } from \"@rpgjs/common\";\nimport { signal } from \"canvasengine\";\n\nexport class AnimationManager {\n current = signal<any[]>([]);\n\n displayEffect(params: any, player: RpgCommonPlayer | { x: number, y: number }): Promise<void> {\n const id = generateUID();\n const effectParams = params ?? {};\n return new Promise<void>((resolve) => {\n let finished = false;\n const finish = (data?: any) => {\n if (finished) return;\n finished = true;\n const index = this.current().findIndex((value) => value.id === id);\n if (index !== -1) {\n this.current().splice(index, 1);\n }\n effectParams.onFinish?.(data);\n resolve();\n };\n\n this.current().push({\n ...effectParams,\n id,\n x: player.x,\n y: player.y,\n object: player,\n onFinish: finish,\n });\n });\n }\n}\n"],"mappings":";;;AAGA,IAAa,mBAAb,MAA8B;;iBAClB,OAAc,CAAC,CAAC;;CAE1B,cAAc,QAAa,QAAmE;EAC5F,MAAM,KAAK,YAAY;EACvB,MAAM,eAAe,UAAU,CAAC;EAChC,OAAO,IAAI,SAAe,YAAY;GACpC,IAAI,WAAW;GACf,MAAM,UAAU,SAAe;IAC7B,IAAI,UAAU;IACd,WAAW;IACX,MAAM,QAAQ,KAAK,QAAQ,EAAE,WAAW,UAAU,MAAM,OAAO,EAAE;IACjE,IAAI,UAAU,IACZ,KAAK,QAAQ,EAAE,OAAO,OAAO,CAAC;IAEhC,aAAa,WAAW,IAAI;IAC5B,QAAQ;GACV;GAEA,KAAK,QAAQ,EAAE,KAAK;IAClB,GAAG;IACH;IACA,GAAG,OAAO;IACV,GAAG,OAAO;IACV,QAAQ;IACR,UAAU;GACZ,CAAC;EACH,CAAC;CACH;AACF"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { RpgClientObject } from './Object';
2
2
  export declare class RpgClientEvent extends RpgClientObject {
3
- type: string;
3
+ _type: string;
4
4
  }
@@ -0,0 +1,12 @@
1
+ import { RpgClientObject } from "./Object.js";
2
+ //#region src/Game/Event.ts
3
+ var RpgClientEvent = class extends RpgClientObject {
4
+ constructor(..._args) {
5
+ super(..._args);
6
+ this._type = "event";
7
+ }
8
+ };
9
+ //#endregion
10
+ export { RpgClientEvent };
11
+
12
+ //# sourceMappingURL=Event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Event.js","names":[],"sources":["../../src/Game/Event.ts"],"sourcesContent":["import { RpgClientObject } from \"./Object\"; \n\nexport class RpgClientEvent extends RpgClientObject {\n _type = 'event'\n} "],"mappings":";;AAEA,IAAa,iBAAb,cAAoC,gBAAgB;;;eACxC;;AACZ"}
@@ -1,7 +1,36 @@
1
- import { RpgCommonMap } from '@rpgjs/common';
1
+ import { RpgCommonMap, LightSpot, LightingState, WeatherState, MapPhysicsInitContext, MapPhysicsEntityContext } from '@rpgjs/common';
2
2
  import { RpgClientPlayer } from './Player';
3
3
  import { RpgClientEvent } from './Event';
4
- export declare class RpgClientMap extends RpgCommonMap<RpgClientPlayer> {
4
+ import { RpgClientEngine } from '../RpgClientEngine';
5
+ export declare class RpgClientMap extends RpgCommonMap<any> {
6
+ engine: RpgClientEngine;
5
7
  players: import('canvasengine').WritableObjectSignal<Record<string, RpgClientPlayer>>;
6
8
  events: import('canvasengine').WritableObjectSignal<Record<string, RpgClientEvent>>;
9
+ currentPlayer: import('canvasengine').ComputedSignal<RpgClientPlayer>;
10
+ weatherState: import('canvasengine').WritableSignal<WeatherState | null>;
11
+ localWeatherOverride: import('canvasengine').WritableSignal<WeatherState | null>;
12
+ lightingState: import('canvasengine').WritableSignal<LightingState | null>;
13
+ localLightSpots: import('canvasengine').WritableObjectSignal<Record<string, LightSpot>>;
14
+ weather: import('canvasengine').ComputedSignal<WeatherState | null>;
15
+ lighting: import('canvasengine').ComputedSignal<LightingState | null>;
16
+ private manualClientPhysicsTick;
17
+ private readonly isTestEnvironment;
18
+ constructor();
19
+ configureClientPrediction(enabled: boolean): void;
20
+ getCurrentPlayer(): RpgClientPlayer;
21
+ reset(force?: boolean): void;
22
+ getWeather(): WeatherState | null;
23
+ setLocalWeather(next: WeatherState | null): void;
24
+ clearLocalWeather(): void;
25
+ getLighting(): LightingState | null;
26
+ addLightSpot(id: string, spot: LightSpot): void;
27
+ patchLightSpot(id: string, patch: Partial<LightSpot>): void;
28
+ removeLightSpot(id: string): void;
29
+ clearLightSpots(): void;
30
+ stepClientPhysics(deltaMs: number): number;
31
+ stepPredictionTick(): void;
32
+ protected emitPhysicsInit(context: MapPhysicsInitContext): void;
33
+ protected emitPhysicsEntityAdd(context: MapPhysicsEntityContext): void;
34
+ protected emitPhysicsEntityRemove(context: MapPhysicsEntityContext): void;
35
+ protected emitPhysicsReset(): void;
7
36
  }
@@ -0,0 +1,138 @@
1
+ import { inject } from "../core/inject.js";
2
+ import { sync, users } from "../node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js";
3
+ import { RpgClientPlayer } from "./Player.js";
4
+ import { RpgClientEvent } from "./Event.js";
5
+ import { __decorateMetadata } from "../_virtual/_@oxc-project_runtime@0.130.0/helpers/decorateMetadata.js";
6
+ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js";
7
+ import { RpgClientEngine } from "../RpgClientEngine.js";
8
+ import { computed, signal } from "canvasengine";
9
+ import { RpgCommonMap, cloneLightingState, normalizeLightingState } from "@rpgjs/common";
10
+ //#region src/Game/Map.ts
11
+ var RpgClientMap = class extends RpgCommonMap {
12
+ constructor() {
13
+ super();
14
+ this.engine = inject(RpgClientEngine);
15
+ this.players = signal({});
16
+ this.events = signal({});
17
+ this.currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()]);
18
+ this.weatherState = signal(null);
19
+ this.localWeatherOverride = signal(null);
20
+ this.lightingState = signal(null);
21
+ this.localLightSpots = signal({});
22
+ this.weather = computed(() => {
23
+ const local = this.localWeatherOverride();
24
+ const state = this.weatherState();
25
+ return local ?? state;
26
+ });
27
+ this.lighting = computed(() => {
28
+ const state = cloneLightingState(this.lightingState());
29
+ const localSpots = Object.entries(this.localLightSpots()).map(([id, spot]) => ({
30
+ ...spot,
31
+ id: spot.id ?? id
32
+ }));
33
+ if (!state && localSpots.length === 0) return null;
34
+ const next = { ...state ?? {} };
35
+ if (!state?.ambient) delete next.ambient;
36
+ next.spots = [...state?.spots ?? [], ...localSpots];
37
+ return next;
38
+ });
39
+ this.manualClientPhysicsTick = false;
40
+ const testGlobal = globalThis;
41
+ const isTest = testGlobal.process?.env?.TEST === "true" || testGlobal.__RPGJS_TEST__ === true;
42
+ this.isTestEnvironment = isTest;
43
+ if (isTest) this.autoTickEnabled = false;
44
+ }
45
+ configureClientPrediction(enabled) {
46
+ this.manualClientPhysicsTick = enabled;
47
+ this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;
48
+ }
49
+ getCurrentPlayer() {
50
+ return this.currentPlayer();
51
+ }
52
+ reset(force = false) {
53
+ const currentPlayerId = this.engine.playerIdSignal();
54
+ const currentPlayer = !force && currentPlayerId ? this.players()[currentPlayerId] : void 0;
55
+ this.players.set(currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {});
56
+ this.events.set({});
57
+ this.weatherState.set(null);
58
+ this.localWeatherOverride.set(null);
59
+ this.lightingState.set(null);
60
+ this.localLightSpots.set({});
61
+ this.clearPhysic();
62
+ }
63
+ getWeather() {
64
+ return this.weather();
65
+ }
66
+ setLocalWeather(next) {
67
+ this.localWeatherOverride.set(next);
68
+ }
69
+ clearLocalWeather() {
70
+ this.localWeatherOverride.set(null);
71
+ }
72
+ getLighting() {
73
+ return this.lighting();
74
+ }
75
+ addLightSpot(id, spot) {
76
+ const nextSpot = normalizeLightingState({ spots: [{
77
+ ...spot,
78
+ id
79
+ }] })?.spots?.[0];
80
+ if (!nextSpot) return;
81
+ this.localLightSpots.update((spots) => ({
82
+ ...spots,
83
+ [id]: nextSpot
84
+ }));
85
+ }
86
+ patchLightSpot(id, patch) {
87
+ this.localLightSpots.update((spots) => {
88
+ const current = spots[id];
89
+ if (!current) return spots;
90
+ return {
91
+ ...spots,
92
+ [id]: {
93
+ ...current,
94
+ ...patch,
95
+ id,
96
+ x: patch.x ?? current.x,
97
+ y: patch.y ?? current.y
98
+ }
99
+ };
100
+ });
101
+ }
102
+ removeLightSpot(id) {
103
+ this.localLightSpots.update((spots) => {
104
+ if (!(id in spots)) return spots;
105
+ const next = { ...spots };
106
+ delete next[id];
107
+ return next;
108
+ });
109
+ }
110
+ clearLightSpots() {
111
+ this.localLightSpots.set({});
112
+ }
113
+ stepClientPhysics(deltaMs) {
114
+ if (!this.manualClientPhysicsTick) return 0;
115
+ return this.nextTick(deltaMs);
116
+ }
117
+ stepPredictionTick() {
118
+ this.forceSingleTick();
119
+ }
120
+ emitPhysicsInit(context) {
121
+ this.engine?.emitSceneMapHook?.("onPhysicsInit", this, context);
122
+ }
123
+ emitPhysicsEntityAdd(context) {
124
+ this.engine?.emitSceneMapHook?.("onPhysicsEntityAdd", this, context);
125
+ }
126
+ emitPhysicsEntityRemove(context) {
127
+ this.engine?.emitSceneMapHook?.("onPhysicsEntityRemove", this, context);
128
+ }
129
+ emitPhysicsReset() {
130
+ this.engine?.emitSceneMapHook?.("onPhysicsReset", this);
131
+ }
132
+ };
133
+ __decorate([users(RpgClientPlayer), __decorateMetadata("design:type", Object)], RpgClientMap.prototype, "players", void 0);
134
+ __decorate([sync(RpgClientEvent), __decorateMetadata("design:type", Object)], RpgClientMap.prototype, "events", void 0);
135
+ //#endregion
136
+ export { RpgClientMap };
137
+
138
+ //# sourceMappingURL=Map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Map.js","names":[],"sources":["../../src/Game/Map.ts"],"sourcesContent":["import {\n RpgCommonMap,\n cloneLightingState,\n normalizeLightingState,\n type LightSpot,\n type LightingState,\n type WeatherState,\n type MapPhysicsInitContext,\n type MapPhysicsEntityContext,\n} from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed, effect } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\ntype TestGlobalScope = typeof globalThis & {\n process?: {\n env?: {\n TEST?: string;\n };\n };\n __RPGJS_TEST__?: boolean;\n};\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n weatherState = signal<WeatherState | null>(null);\n localWeatherOverride = signal<WeatherState | null>(null);\n lightingState = signal<LightingState | null>(null);\n localLightSpots = signal<Record<string, LightSpot>>({});\n weather = computed<WeatherState | null>(() => {\n const local = this.localWeatherOverride() \n const state = this.weatherState()\n return local ?? state\n });\n lighting = computed<LightingState | null>(() => {\n const state = cloneLightingState(this.lightingState());\n const localSpots = Object.entries(this.localLightSpots()).map(([id, spot]) => ({\n ...spot,\n id: spot.id ?? id,\n }));\n\n if (!state && localSpots.length === 0) {\n return null;\n }\n\n const next: LightingState = { ...(state ?? {}) };\n if (!state?.ambient) {\n delete next.ambient;\n }\n next.spots = [\n ...(state?.spots ?? []),\n ...localSpots,\n ];\n return next;\n });\n private manualClientPhysicsTick = false;\n private readonly isTestEnvironment: boolean;\n\n constructor() {\n super();\n // Détecter l'environnement de test\n const testGlobal = globalThis as TestGlobalScope;\n const isTest = testGlobal.process?.env?.TEST === 'true'\n || testGlobal.__RPGJS_TEST__ === true;\n this.isTestEnvironment = isTest;\n if (isTest) {\n this.autoTickEnabled = false;\n }\n }\n\n configureClientPrediction(enabled: boolean): void {\n this.manualClientPhysicsTick = enabled;\n this.autoTickEnabled = enabled ? false : !this.isTestEnvironment;\n }\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset(force = false) {\n const currentPlayerId = this.engine.playerIdSignal();\n const currentPlayer = !force && currentPlayerId\n ? this.players()[currentPlayerId]\n : undefined;\n\n this.players.set(\n currentPlayerId && currentPlayer ? { [currentPlayerId]: currentPlayer } : {}\n );\n this.events.set({})\n this.weatherState.set(null);\n this.localWeatherOverride.set(null);\n this.lightingState.set(null);\n this.localLightSpots.set({});\n this.clearPhysic()\n }\n\n getWeather(): WeatherState | null {\n return this.weather();\n }\n\n setLocalWeather(next: WeatherState | null): void {\n this.localWeatherOverride.set(next);\n }\n\n clearLocalWeather(): void {\n this.localWeatherOverride.set(null);\n }\n\n getLighting(): LightingState | null {\n return this.lighting();\n }\n\n addLightSpot(id: string, spot: LightSpot): void {\n const normalized = normalizeLightingState({ spots: [{ ...spot, id }] });\n const nextSpot = normalized?.spots?.[0];\n if (!nextSpot) {\n return;\n }\n this.localLightSpots.update((spots) => ({\n ...spots,\n [id]: nextSpot,\n }));\n }\n\n patchLightSpot(id: string, patch: Partial<LightSpot>): void {\n this.localLightSpots.update((spots) => {\n const current = spots[id];\n if (!current) {\n return spots;\n }\n return {\n ...spots,\n [id]: {\n ...current,\n ...patch,\n id,\n x: patch.x ?? current.x,\n y: patch.y ?? current.y,\n },\n };\n });\n }\n\n removeLightSpot(id: string): void {\n this.localLightSpots.update((spots) => {\n if (!(id in spots)) {\n return spots;\n }\n const next = { ...spots };\n delete next[id];\n return next;\n });\n }\n\n clearLightSpots(): void {\n this.localLightSpots.set({});\n }\n\n stepClientPhysics(deltaMs: number): number {\n if (!this.manualClientPhysicsTick) {\n return 0;\n }\n return this.nextTick(deltaMs);\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n\n protected emitPhysicsInit(context: MapPhysicsInitContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsInit\", this, context);\n }\n\n protected emitPhysicsEntityAdd(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityAdd\", this, context);\n }\n\n protected emitPhysicsEntityRemove(context: MapPhysicsEntityContext): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsEntityRemove\", this, context);\n }\n\n protected emitPhysicsReset(): void {\n this.engine?.emitSceneMapHook?.(\"onPhysicsReset\", this);\n }\n}\n"],"mappings":";;;;;;;;;;AA0BA,IAAa,eAAb,cAAkC,aAAkB;CAsClD,cAAc;EACZ,MAAM;gBAtCkB,OAAO,eAAe;iBACd,OAAwC,CAAC,CAAC;gBAC7C,OAAuC,CAAC,CAAC;uBACxD,eAAe,KAAK,QAAQ,EAAE,KAAK,OAAO,eAAe,EAAG;sBAC7D,OAA4B,IAAI;8BACxB,OAA4B,IAAI;uBACvC,OAA6B,IAAI;yBAC/B,OAAkC,CAAC,CAAC;iBAC5C,eAAoC;GAC5C,MAAM,QAAQ,KAAK,qBAAqB;GACxC,MAAM,QAAQ,KAAK,aAAa;GAChC,OAAO,SAAS;EAClB,CAAC;kBACU,eAAqC;GAC9C,MAAM,QAAQ,mBAAmB,KAAK,cAAc,CAAC;GACrD,MAAM,aAAa,OAAO,QAAQ,KAAK,gBAAgB,CAAC,EAAE,KAAK,CAAC,IAAI,WAAW;IAC7E,GAAG;IACH,IAAI,KAAK,MAAM;GACjB,EAAE;GAEF,IAAI,CAAC,SAAS,WAAW,WAAW,GAClC,OAAO;GAGT,MAAM,OAAsB,EAAE,GAAI,SAAS,CAAC,EAAG;GAC/C,IAAI,CAAC,OAAO,SACV,OAAO,KAAK;GAEd,KAAK,QAAQ,CACX,GAAI,OAAO,SAAS,CAAC,GACrB,GAAG,UACL;GACA,OAAO;EACT,CAAC;iCACiC;EAMhC,MAAM,aAAa;EACnB,MAAM,SAAS,WAAW,SAAS,KAAK,SAAS,UAC5C,WAAW,mBAAmB;EACnC,KAAK,oBAAoB;EACzB,IAAI,QACF,KAAK,kBAAkB;CAE3B;CAEA,0BAA0B,SAAwB;EAChD,KAAK,0BAA0B;EAC/B,KAAK,kBAAkB,UAAU,QAAQ,CAAC,KAAK;CACjD;CAEA,mBAAmB;EACjB,OAAO,KAAK,cAAc;CAC5B;CAEA,MAAM,QAAQ,OAAO;EACnB,MAAM,kBAAkB,KAAK,OAAO,eAAe;EACnD,MAAM,gBAAgB,CAAC,SAAS,kBAC5B,KAAK,QAAQ,EAAE,mBACf,KAAA;EAEJ,KAAK,QAAQ,IACX,mBAAmB,gBAAgB,GAAG,kBAAkB,cAAc,IAAI,CAAC,CAC7E;EACA,KAAK,OAAO,IAAI,CAAC,CAAC;EAClB,KAAK,aAAa,IAAI,IAAI;EAC1B,KAAK,qBAAqB,IAAI,IAAI;EAClC,KAAK,cAAc,IAAI,IAAI;EAC3B,KAAK,gBAAgB,IAAI,CAAC,CAAC;EAC3B,KAAK,YAAY;CACnB;CAEA,aAAkC;EAChC,OAAO,KAAK,QAAQ;CACtB;CAEA,gBAAgB,MAAiC;EAC/C,KAAK,qBAAqB,IAAI,IAAI;CACpC;CAEA,oBAA0B;EACxB,KAAK,qBAAqB,IAAI,IAAI;CACpC;CAEA,cAAoC;EAClC,OAAO,KAAK,SAAS;CACvB;CAEA,aAAa,IAAY,MAAuB;EAE9C,MAAM,WADa,uBAAuB,EAAE,OAAO,CAAC;GAAE,GAAG;GAAM;EAAG,CAAC,EAAE,CACpD,GAAY,QAAQ;EACrC,IAAI,CAAC,UACH;EAEF,KAAK,gBAAgB,QAAQ,WAAW;GACtC,GAAG;IACF,KAAK;EACR,EAAE;CACJ;CAEA,eAAe,IAAY,OAAiC;EAC1D,KAAK,gBAAgB,QAAQ,UAAU;GACrC,MAAM,UAAU,MAAM;GACtB,IAAI,CAAC,SACH,OAAO;GAET,OAAO;IACL,GAAG;KACF,KAAK;KACJ,GAAG;KACH,GAAG;KACH;KACA,GAAG,MAAM,KAAK,QAAQ;KACtB,GAAG,MAAM,KAAK,QAAQ;IACxB;GACF;EACF,CAAC;CACH;CAEA,gBAAgB,IAAkB;EAChC,KAAK,gBAAgB,QAAQ,UAAU;GACrC,IAAI,EAAE,MAAM,QACV,OAAO;GAET,MAAM,OAAO,EAAE,GAAG,MAAM;GACxB,OAAO,KAAK;GACZ,OAAO;EACT,CAAC;CACH;CAEA,kBAAwB;EACtB,KAAK,gBAAgB,IAAI,CAAC,CAAC;CAC7B;CAEA,kBAAkB,SAAyB;EACzC,IAAI,CAAC,KAAK,yBACR,OAAO;EAET,OAAO,KAAK,SAAS,OAAO;CAC9B;CAEA,qBAA2B;EACzB,KAAK,gBAAgB;CACvB;CAEA,gBAA0B,SAAsC;EAC9D,KAAK,QAAQ,mBAAmB,iBAAiB,MAAM,OAAO;CAChE;CAEA,qBAA+B,SAAwC;EACrE,KAAK,QAAQ,mBAAmB,sBAAsB,MAAM,OAAO;CACrE;CAEA,wBAAkC,SAAwC;EACxE,KAAK,QAAQ,mBAAmB,yBAAyB,MAAM,OAAO;CACxE;CAEA,mBAAmC;EACjC,KAAK,QAAQ,mBAAmB,kBAAkB,IAAI;CACxD;AACF;YAlKG,MAAM,eAAe,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,aAAA,WAAA,WAAA,KAAA,CAAA;YACrB,KAAK,cAAc,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,aAAA,WAAA,UAAA,KAAA,CAAA"}
@@ -0,0 +1,189 @@
1
+ import { Hooks, RpgCommonPlayer } from '@rpgjs/common';
2
+ import { Trigger } from 'canvasengine';
3
+ import { RpgClientEngine } from '../RpgClientEngine';
4
+ type Frame = {
5
+ x: number;
6
+ y: number;
7
+ ts: number;
8
+ };
9
+ type AnimationRestoreOptions = {
10
+ restoreAnimationName?: string;
11
+ restoreGraphics?: any[];
12
+ timeoutMs?: number;
13
+ };
14
+ type FlashType = 'alpha' | 'tint' | 'both';
15
+ type FlashOptions = {
16
+ type?: FlashType;
17
+ duration?: number;
18
+ cycles?: number;
19
+ alpha?: number;
20
+ tint?: number | string;
21
+ };
22
+ type FlashTriggerOptions = Omit<FlashOptions, "tint"> & {
23
+ tint: number;
24
+ };
25
+ type ConfigurableTrigger<T> = Omit<Trigger<T>, "start"> & {
26
+ start(config?: T): Promise<void>;
27
+ };
28
+ export declare abstract class RpgClientObject extends RpgCommonPlayer {
29
+ abstract _type: string;
30
+ emitParticleTrigger: Trigger<any>;
31
+ particleName: import('canvasengine').WritableSignal<string>;
32
+ animationCurrentIndex: import('canvasengine').WritableSignal<number>;
33
+ animationIsPlaying: import('canvasengine').WritableSignal<boolean>;
34
+ _param: import('canvasengine').WritableObjectSignal<{}>;
35
+ frames: Frame[];
36
+ graphicsSignals: import('canvasengine').WritableArraySignal<any[]>;
37
+ flashTrigger: ConfigurableTrigger<FlashTriggerOptions>;
38
+ private animationRestoreState?;
39
+ constructor();
40
+ /**
41
+ * Access the shared client hook registry.
42
+ *
43
+ * @returns The hook service used to register and trigger client-side hooks.
44
+ */
45
+ get hooks(): Hooks;
46
+ /**
47
+ * Access the current client engine instance.
48
+ *
49
+ * @returns The active {@link RpgClientEngine} instance.
50
+ */
51
+ get engine(): RpgClientEngine<unknown>;
52
+ private animationSubscription?;
53
+ private animationResetTimeout?;
54
+ private animationWaitResolve?;
55
+ private clearAnimationControls;
56
+ private resolveAnimationWait;
57
+ private finishTemporaryAnimation;
58
+ /**
59
+ * Trigger a flash animation on this sprite
60
+ *
61
+ * This method triggers a flash effect using CanvasEngine's flash directive.
62
+ * The flash can be configured with various options including type (alpha, tint, or both),
63
+ * duration, cycles, and color.
64
+ *
65
+ * ## Design
66
+ *
67
+ * The flash uses a trigger system that is connected to the flash directive in the
68
+ * character component. This allows for flexible configuration and can be triggered
69
+ * from both server events and client-side code.
70
+ *
71
+ * @param options - Flash configuration options
72
+ * @param options.type - Type of flash effect: 'alpha' (opacity), 'tint' (color), or 'both' (default: 'alpha')
73
+ * @param options.duration - Duration of the flash animation in milliseconds (default: 300)
74
+ * @param options.cycles - Number of flash cycles (flash on/off) (default: 1)
75
+ * @param options.alpha - Alpha value when flashing, from 0 to 1 (default: 0.3)
76
+ * @param options.tint - Tint color when flashing as hex value or color name (default: 0xffffff - white)
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * // Simple flash with default settings (alpha flash)
81
+ * player.flash();
82
+ *
83
+ * // Flash with red tint
84
+ * player.flash({ type: 'tint', tint: 0xff0000 });
85
+ *
86
+ * // Flash with both alpha and tint
87
+ * player.flash({
88
+ * type: 'both',
89
+ * alpha: 0.5,
90
+ * tint: 0xff0000,
91
+ * duration: 200,
92
+ * cycles: 2
93
+ * });
94
+ *
95
+ * // Quick damage flash
96
+ * player.flash({
97
+ * type: 'tint',
98
+ * tint: 0xff0000,
99
+ * duration: 150,
100
+ * cycles: 1
101
+ * });
102
+ * ```
103
+ */
104
+ flash(options?: FlashOptions): void;
105
+ /**
106
+ * Reset animation state when animation changes externally
107
+ *
108
+ * This method should be called when the animation changes due to movement
109
+ * or other external factors to ensure the animation system doesn't get stuck
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * // Reset when player starts moving
114
+ * player.resetAnimationState();
115
+ * ```
116
+ */
117
+ resetAnimationState(): void;
118
+ /**
119
+ * Set a custom animation for a specific number of times
120
+ *
121
+ * Plays a custom animation for the specified number of repetitions.
122
+ * The animation system prevents overlapping animations and automatically
123
+ * returns to the previous animation when complete.
124
+ *
125
+ * @param animationName - Name of the animation to play
126
+ * @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
127
+ * @param options - Restore and timeout options
128
+ * @returns A promise resolved when a finite animation finishes, is interrupted, or times out
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * // Play attack animation 3 times
133
+ * await player.setAnimation('attack', 3);
134
+ *
135
+ * // Play continuous spell animation
136
+ * player.setAnimation('spell');
137
+ * ```
138
+ */
139
+ setAnimation(animationName: string, nbTimes?: number, options?: AnimationRestoreOptions): Promise<void>;
140
+ /**
141
+ * Set a custom animation with temporary graphic change
142
+ *
143
+ * Plays a custom animation for the specified number of repetitions and temporarily
144
+ * changes the player's graphic (sprite sheet) during the animation. The graphic
145
+ * is automatically reset when the animation finishes.
146
+ *
147
+ * @param animationName - Name of the animation to play
148
+ * @param graphic - The graphic(s) to temporarily use during the animation
149
+ * @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
150
+ * @param options - Restore and timeout options
151
+ * @returns A promise resolved when a finite animation finishes, is interrupted, or times out
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * // Play attack animation with temporary graphic change
156
+ * await player.setAnimation('attack', 'hero_attack', 3);
157
+ * ```
158
+ */
159
+ setAnimation(animationName: string, graphic?: string | string[], nbTimes?: number, options?: AnimationRestoreOptions): Promise<void>;
160
+ /**
161
+ * Display a registered component animation effect on this object.
162
+ *
163
+ * @param id - Identifier of the component animation to play.
164
+ * @param params - Parameters forwarded to the animation effect.
165
+ * @returns A promise resolved when the animation component calls `onFinish`.
166
+ */
167
+ showComponentAnimation(id: string, params: any): Promise<void>;
168
+ /**
169
+ * Display a registered spritesheet animation effect on this object.
170
+ *
171
+ * @param graphic - Identifier of the spritesheet to use.
172
+ * @param animationName - Name of the animation inside the spritesheet.
173
+ * @returns A promise resolved when the animation component calls `onFinish`.
174
+ */
175
+ showAnimation(graphic: string, animationName?: string): Promise<void>;
176
+ /**
177
+ * Check whether this client object represents an event.
178
+ *
179
+ * @returns `true` if the object type is `event`, otherwise `false`.
180
+ */
181
+ isEvent(): boolean;
182
+ /**
183
+ * Check whether this client object represents a player.
184
+ *
185
+ * @returns `true` if the object type is `player`, otherwise `false`.
186
+ */
187
+ isPlayer(): boolean;
188
+ }
189
+ export {};