idlerpg.sh 0.1.0

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 (478) hide show
  1. package/README.md +171 -0
  2. package/dist/affix/AffixRegistry.d.ts +68 -0
  3. package/dist/affix/AffixRegistry.d.ts.map +1 -0
  4. package/dist/affix/AffixRegistry.js +245 -0
  5. package/dist/affix/AffixRegistry.js.map +1 -0
  6. package/dist/affix/PluginLoader.d.ts +66 -0
  7. package/dist/affix/PluginLoader.d.ts.map +1 -0
  8. package/dist/affix/PluginLoader.js +321 -0
  9. package/dist/affix/PluginLoader.js.map +1 -0
  10. package/dist/affix/builtin.d.ts +6 -0
  11. package/dist/affix/builtin.d.ts.map +1 -0
  12. package/dist/affix/builtin.js +311 -0
  13. package/dist/affix/builtin.js.map +1 -0
  14. package/dist/affix/index.d.ts +8 -0
  15. package/dist/affix/index.d.ts.map +1 -0
  16. package/dist/affix/index.js +11 -0
  17. package/dist/affix/index.js.map +1 -0
  18. package/dist/affix/types.d.ts +152 -0
  19. package/dist/affix/types.d.ts.map +1 -0
  20. package/dist/affix/types.js +8 -0
  21. package/dist/affix/types.js.map +1 -0
  22. package/dist/ai/PlayKitClient.d.ts +208 -0
  23. package/dist/ai/PlayKitClient.d.ts.map +1 -0
  24. package/dist/ai/PlayKitClient.js +721 -0
  25. package/dist/ai/PlayKitClient.js.map +1 -0
  26. package/dist/ai/index.d.ts +5 -0
  27. package/dist/ai/index.d.ts.map +1 -0
  28. package/dist/ai/index.js +8 -0
  29. package/dist/ai/index.js.map +1 -0
  30. package/dist/app/App.d.ts +85 -0
  31. package/dist/app/App.d.ts.map +1 -0
  32. package/dist/app/App.js +296 -0
  33. package/dist/app/App.js.map +1 -0
  34. package/dist/app/EventBus.d.ts +222 -0
  35. package/dist/app/EventBus.d.ts.map +1 -0
  36. package/dist/app/EventBus.js +88 -0
  37. package/dist/app/EventBus.js.map +1 -0
  38. package/dist/app/Keybind.d.ts +83 -0
  39. package/dist/app/Keybind.d.ts.map +1 -0
  40. package/dist/app/Keybind.js +184 -0
  41. package/dist/app/Keybind.js.map +1 -0
  42. package/dist/app/Router.d.ts +123 -0
  43. package/dist/app/Router.d.ts.map +1 -0
  44. package/dist/app/Router.js +142 -0
  45. package/dist/app/Router.js.map +1 -0
  46. package/dist/app/ScreenManager.d.ts +97 -0
  47. package/dist/app/ScreenManager.d.ts.map +1 -0
  48. package/dist/app/ScreenManager.js +216 -0
  49. package/dist/app/ScreenManager.js.map +1 -0
  50. package/dist/app/index.d.ts +14 -0
  51. package/dist/app/index.d.ts.map +1 -0
  52. package/dist/app/index.js +19 -0
  53. package/dist/app/index.js.map +1 -0
  54. package/dist/app/screens/BaseScreen.d.ts +101 -0
  55. package/dist/app/screens/BaseScreen.d.ts.map +1 -0
  56. package/dist/app/screens/BaseScreen.js +132 -0
  57. package/dist/app/screens/BaseScreen.js.map +1 -0
  58. package/dist/app/screens/CharacterCreationScreen.d.ts +42 -0
  59. package/dist/app/screens/CharacterCreationScreen.d.ts.map +1 -0
  60. package/dist/app/screens/CharacterCreationScreen.js +467 -0
  61. package/dist/app/screens/CharacterCreationScreen.js.map +1 -0
  62. package/dist/app/screens/CombatScreen.d.ts +30 -0
  63. package/dist/app/screens/CombatScreen.d.ts.map +1 -0
  64. package/dist/app/screens/CombatScreen.js +309 -0
  65. package/dist/app/screens/CombatScreen.js.map +1 -0
  66. package/dist/app/screens/DialogScreen.d.ts +29 -0
  67. package/dist/app/screens/DialogScreen.d.ts.map +1 -0
  68. package/dist/app/screens/DialogScreen.js +295 -0
  69. package/dist/app/screens/DialogScreen.js.map +1 -0
  70. package/dist/app/screens/ExploreScreen.d.ts +50 -0
  71. package/dist/app/screens/ExploreScreen.d.ts.map +1 -0
  72. package/dist/app/screens/ExploreScreen.js +308 -0
  73. package/dist/app/screens/ExploreScreen.js.map +1 -0
  74. package/dist/app/screens/HelpScreen.d.ts +12 -0
  75. package/dist/app/screens/HelpScreen.d.ts.map +1 -0
  76. package/dist/app/screens/HelpScreen.js +155 -0
  77. package/dist/app/screens/HelpScreen.js.map +1 -0
  78. package/dist/app/screens/InventoryScreen.d.ts +27 -0
  79. package/dist/app/screens/InventoryScreen.d.ts.map +1 -0
  80. package/dist/app/screens/InventoryScreen.js +326 -0
  81. package/dist/app/screens/InventoryScreen.js.map +1 -0
  82. package/dist/app/screens/PrologueScreen.d.ts +24 -0
  83. package/dist/app/screens/PrologueScreen.d.ts.map +1 -0
  84. package/dist/app/screens/PrologueScreen.js +176 -0
  85. package/dist/app/screens/PrologueScreen.js.map +1 -0
  86. package/dist/app/screens/TitleScreen.d.ts +42 -0
  87. package/dist/app/screens/TitleScreen.d.ts.map +1 -0
  88. package/dist/app/screens/TitleScreen.js +380 -0
  89. package/dist/app/screens/TitleScreen.js.map +1 -0
  90. package/dist/app/screens/TravelScreen.d.ts +22 -0
  91. package/dist/app/screens/TravelScreen.d.ts.map +1 -0
  92. package/dist/app/screens/TravelScreen.js +122 -0
  93. package/dist/app/screens/TravelScreen.js.map +1 -0
  94. package/dist/app/screens/index.d.ts +14 -0
  95. package/dist/app/screens/index.d.ts.map +1 -0
  96. package/dist/app/screens/index.js +17 -0
  97. package/dist/app/screens/index.js.map +1 -0
  98. package/dist/commands/CommandRegistry.d.ts +91 -0
  99. package/dist/commands/CommandRegistry.d.ts.map +1 -0
  100. package/dist/commands/CommandRegistry.js +159 -0
  101. package/dist/commands/CommandRegistry.js.map +1 -0
  102. package/dist/commands/index.d.ts +7 -0
  103. package/dist/commands/index.d.ts.map +1 -0
  104. package/dist/commands/index.js +10 -0
  105. package/dist/commands/index.js.map +1 -0
  106. package/dist/core/Actor.d.ts +103 -0
  107. package/dist/core/Actor.d.ts.map +1 -0
  108. package/dist/core/Actor.js +409 -0
  109. package/dist/core/Actor.js.map +1 -0
  110. package/dist/core/Combat.d.ts +37 -0
  111. package/dist/core/Combat.d.ts.map +1 -0
  112. package/dist/core/Combat.js +294 -0
  113. package/dist/core/Combat.js.map +1 -0
  114. package/dist/core/DungeonRunner.d.ts +169 -0
  115. package/dist/core/DungeonRunner.d.ts.map +1 -0
  116. package/dist/core/DungeonRunner.js +627 -0
  117. package/dist/core/DungeonRunner.js.map +1 -0
  118. package/dist/core/Game.d.ts +133 -0
  119. package/dist/core/Game.d.ts.map +1 -0
  120. package/dist/core/Game.js +644 -0
  121. package/dist/core/Game.js.map +1 -0
  122. package/dist/core/IdleCombat.d.ts +61 -0
  123. package/dist/core/IdleCombat.d.ts.map +1 -0
  124. package/dist/core/IdleCombat.js +461 -0
  125. package/dist/core/IdleCombat.js.map +1 -0
  126. package/dist/core/IdleGameManager.d.ts +198 -0
  127. package/dist/core/IdleGameManager.d.ts.map +1 -0
  128. package/dist/core/IdleGameManager.js +688 -0
  129. package/dist/core/IdleGameManager.js.map +1 -0
  130. package/dist/core/IdleSaveManager.d.ts +109 -0
  131. package/dist/core/IdleSaveManager.d.ts.map +1 -0
  132. package/dist/core/IdleSaveManager.js +296 -0
  133. package/dist/core/IdleSaveManager.js.map +1 -0
  134. package/dist/core/NewGameFlowManager.d.ts +64 -0
  135. package/dist/core/NewGameFlowManager.d.ts.map +1 -0
  136. package/dist/core/NewGameFlowManager.js +153 -0
  137. package/dist/core/NewGameFlowManager.js.map +1 -0
  138. package/dist/core/Player.d.ts +65 -0
  139. package/dist/core/Player.d.ts.map +1 -0
  140. package/dist/core/Player.js +261 -0
  141. package/dist/core/Player.js.map +1 -0
  142. package/dist/core/RoomHandlers.d.ts +75 -0
  143. package/dist/core/RoomHandlers.d.ts.map +1 -0
  144. package/dist/core/RoomHandlers.js +383 -0
  145. package/dist/core/RoomHandlers.js.map +1 -0
  146. package/dist/core/SaveManager.d.ts +84 -0
  147. package/dist/core/SaveManager.d.ts.map +1 -0
  148. package/dist/core/SaveManager.js +281 -0
  149. package/dist/core/SaveManager.js.map +1 -0
  150. package/dist/core/SaveMigration.d.ts +69 -0
  151. package/dist/core/SaveMigration.d.ts.map +1 -0
  152. package/dist/core/SaveMigration.js +408 -0
  153. package/dist/core/SaveMigration.js.map +1 -0
  154. package/dist/core/StateAdapter.d.ts +79 -0
  155. package/dist/core/StateAdapter.d.ts.map +1 -0
  156. package/dist/core/StateAdapter.js +397 -0
  157. package/dist/core/StateAdapter.js.map +1 -0
  158. package/dist/core/Team.d.ts +145 -0
  159. package/dist/core/Team.d.ts.map +1 -0
  160. package/dist/core/Team.js +371 -0
  161. package/dist/core/Team.js.map +1 -0
  162. package/dist/core/TeamCombat.d.ts +88 -0
  163. package/dist/core/TeamCombat.d.ts.map +1 -0
  164. package/dist/core/TeamCombat.js +405 -0
  165. package/dist/core/TeamCombat.js.map +1 -0
  166. package/dist/core/TeamDungeonRunner.d.ts +186 -0
  167. package/dist/core/TeamDungeonRunner.d.ts.map +1 -0
  168. package/dist/core/TeamDungeonRunner.js +758 -0
  169. package/dist/core/TeamDungeonRunner.js.map +1 -0
  170. package/dist/core/TimeManager.d.ts +114 -0
  171. package/dist/core/TimeManager.d.ts.map +1 -0
  172. package/dist/core/TimeManager.js +318 -0
  173. package/dist/core/TimeManager.js.map +1 -0
  174. package/dist/core/index.d.ts +9 -0
  175. package/dist/core/index.d.ts.map +1 -0
  176. package/dist/core/index.js +12 -0
  177. package/dist/core/index.js.map +1 -0
  178. package/dist/core/timeConstants.d.ts +135 -0
  179. package/dist/core/timeConstants.d.ts.map +1 -0
  180. package/dist/core/timeConstants.js +157 -0
  181. package/dist/core/timeConstants.js.map +1 -0
  182. package/dist/core/types.d.ts +780 -0
  183. package/dist/core/types.d.ts.map +1 -0
  184. package/dist/core/types.js +16 -0
  185. package/dist/core/types.js.map +1 -0
  186. package/dist/data/continents/index.d.ts +163 -0
  187. package/dist/data/continents/index.d.ts.map +1 -0
  188. package/dist/data/continents/index.js +31 -0
  189. package/dist/data/continents/index.js.map +1 -0
  190. package/dist/data/continents/verdantia.d.ts +294 -0
  191. package/dist/data/continents/verdantia.d.ts.map +1 -0
  192. package/dist/data/continents/verdantia.js +327 -0
  193. package/dist/data/continents/verdantia.js.map +1 -0
  194. package/dist/handlers/DialogHandler.d.ts +95 -0
  195. package/dist/handlers/DialogHandler.d.ts.map +1 -0
  196. package/dist/handlers/DialogHandler.js +450 -0
  197. package/dist/handlers/DialogHandler.js.map +1 -0
  198. package/dist/handlers/SaveLoadHandler.d.ts +60 -0
  199. package/dist/handlers/SaveLoadHandler.d.ts.map +1 -0
  200. package/dist/handlers/SaveLoadHandler.js +187 -0
  201. package/dist/handlers/SaveLoadHandler.js.map +1 -0
  202. package/dist/handlers/TitleScreenHandler.d.ts +43 -0
  203. package/dist/handlers/TitleScreenHandler.d.ts.map +1 -0
  204. package/dist/handlers/TitleScreenHandler.js +508 -0
  205. package/dist/handlers/TitleScreenHandler.js.map +1 -0
  206. package/dist/handlers/WorkshopHandler.d.ts +75 -0
  207. package/dist/handlers/WorkshopHandler.d.ts.map +1 -0
  208. package/dist/handlers/WorkshopHandler.js +401 -0
  209. package/dist/handlers/WorkshopHandler.js.map +1 -0
  210. package/dist/handlers/index.d.ts +12 -0
  211. package/dist/handlers/index.d.ts.map +1 -0
  212. package/dist/handlers/index.js +14 -0
  213. package/dist/handlers/index.js.map +1 -0
  214. package/dist/handlers/types.d.ts +34 -0
  215. package/dist/handlers/types.d.ts.map +1 -0
  216. package/dist/handlers/types.js +8 -0
  217. package/dist/handlers/types.js.map +1 -0
  218. package/dist/i18n/en.d.ts +3 -0
  219. package/dist/i18n/en.d.ts.map +1 -0
  220. package/dist/i18n/en.js +130 -0
  221. package/dist/i18n/en.js.map +1 -0
  222. package/dist/i18n/index.d.ts +40 -0
  223. package/dist/i18n/index.d.ts.map +1 -0
  224. package/dist/i18n/index.js +105 -0
  225. package/dist/i18n/index.js.map +1 -0
  226. package/dist/i18n/types.d.ts +133 -0
  227. package/dist/i18n/types.d.ts.map +1 -0
  228. package/dist/i18n/types.js +8 -0
  229. package/dist/i18n/types.js.map +1 -0
  230. package/dist/i18n/zh.d.ts +3 -0
  231. package/dist/i18n/zh.d.ts.map +1 -0
  232. package/dist/i18n/zh.js +130 -0
  233. package/dist/i18n/zh.js.map +1 -0
  234. package/dist/instrument.d.ts +8 -0
  235. package/dist/instrument.d.ts.map +1 -0
  236. package/dist/instrument.js +33 -0
  237. package/dist/instrument.js.map +1 -0
  238. package/dist/main-new.d.ts +12 -0
  239. package/dist/main-new.d.ts.map +1 -0
  240. package/dist/main-new.js +32 -0
  241. package/dist/main-new.js.map +1 -0
  242. package/dist/main.d.ts +7 -0
  243. package/dist/main.d.ts.map +1 -0
  244. package/dist/main.js +2816 -0
  245. package/dist/main.js.map +1 -0
  246. package/dist/map/ContinentManager.d.ts +88 -0
  247. package/dist/map/ContinentManager.d.ts.map +1 -0
  248. package/dist/map/ContinentManager.js +241 -0
  249. package/dist/map/ContinentManager.js.map +1 -0
  250. package/dist/map/DungeonGenerator.d.ts +32 -0
  251. package/dist/map/DungeonGenerator.d.ts.map +1 -0
  252. package/dist/map/DungeonGenerator.js +615 -0
  253. package/dist/map/DungeonGenerator.js.map +1 -0
  254. package/dist/map/MapGenerator.d.ts +27 -0
  255. package/dist/map/MapGenerator.d.ts.map +1 -0
  256. package/dist/map/MapGenerator.js +485 -0
  257. package/dist/map/MapGenerator.js.map +1 -0
  258. package/dist/map/index.d.ts +5 -0
  259. package/dist/map/index.d.ts.map +1 -0
  260. package/dist/map/index.js +8 -0
  261. package/dist/map/index.js.map +1 -0
  262. package/dist/npc/NPCGenerator.d.ts +68 -0
  263. package/dist/npc/NPCGenerator.d.ts.map +1 -0
  264. package/dist/npc/NPCGenerator.js +468 -0
  265. package/dist/npc/NPCGenerator.js.map +1 -0
  266. package/dist/npc/NPCManager.d.ts +86 -0
  267. package/dist/npc/NPCManager.d.ts.map +1 -0
  268. package/dist/npc/NPCManager.js +217 -0
  269. package/dist/npc/NPCManager.js.map +1 -0
  270. package/dist/npc/fixedNPCs.d.ts +7 -0
  271. package/dist/npc/fixedNPCs.d.ts.map +1 -0
  272. package/dist/npc/fixedNPCs.js +196 -0
  273. package/dist/npc/fixedNPCs.js.map +1 -0
  274. package/dist/npc/index.d.ts +9 -0
  275. package/dist/npc/index.d.ts.map +1 -0
  276. package/dist/npc/index.js +12 -0
  277. package/dist/npc/index.js.map +1 -0
  278. package/dist/npc/traits.d.ts +33 -0
  279. package/dist/npc/traits.d.ts.map +1 -0
  280. package/dist/npc/traits.js +795 -0
  281. package/dist/npc/traits.js.map +1 -0
  282. package/dist/npc/types.d.ts +193 -0
  283. package/dist/npc/types.d.ts.map +1 -0
  284. package/dist/npc/types.js +9 -0
  285. package/dist/npc/types.js.map +1 -0
  286. package/dist/quest/QuestManager.d.ts +79 -0
  287. package/dist/quest/QuestManager.d.ts.map +1 -0
  288. package/dist/quest/QuestManager.js +273 -0
  289. package/dist/quest/QuestManager.js.map +1 -0
  290. package/dist/quest/index.d.ts +6 -0
  291. package/dist/quest/index.d.ts.map +1 -0
  292. package/dist/quest/index.js +9 -0
  293. package/dist/quest/index.js.map +1 -0
  294. package/dist/quest/types.d.ts +81 -0
  295. package/dist/quest/types.d.ts.map +1 -0
  296. package/dist/quest/types.js +8 -0
  297. package/dist/quest/types.js.map +1 -0
  298. package/dist/strategy/StrategyExecutor.d.ts +159 -0
  299. package/dist/strategy/StrategyExecutor.d.ts.map +1 -0
  300. package/dist/strategy/StrategyExecutor.js +479 -0
  301. package/dist/strategy/StrategyExecutor.js.map +1 -0
  302. package/dist/strategy/StrategyParser.d.ts +48 -0
  303. package/dist/strategy/StrategyParser.d.ts.map +1 -0
  304. package/dist/strategy/StrategyParser.js +321 -0
  305. package/dist/strategy/StrategyParser.js.map +1 -0
  306. package/dist/strategy/defaultStrategy.d.ts +40 -0
  307. package/dist/strategy/defaultStrategy.d.ts.map +1 -0
  308. package/dist/strategy/defaultStrategy.js +254 -0
  309. package/dist/strategy/defaultStrategy.js.map +1 -0
  310. package/dist/strategy/index.d.ts +8 -0
  311. package/dist/strategy/index.d.ts.map +1 -0
  312. package/dist/strategy/index.js +14 -0
  313. package/dist/strategy/index.js.map +1 -0
  314. package/dist/tui/ExploreMenu.d.ts +106 -0
  315. package/dist/tui/ExploreMenu.d.ts.map +1 -0
  316. package/dist/tui/ExploreMenu.js +282 -0
  317. package/dist/tui/ExploreMenu.js.map +1 -0
  318. package/dist/tui/GameUI.d.ts +313 -0
  319. package/dist/tui/GameUI.d.ts.map +1 -0
  320. package/dist/tui/GameUI.js +2116 -0
  321. package/dist/tui/GameUI.js.map +1 -0
  322. package/dist/tui/GameUIAdapter.d.ts +207 -0
  323. package/dist/tui/GameUIAdapter.d.ts.map +1 -0
  324. package/dist/tui/GameUIAdapter.js +1342 -0
  325. package/dist/tui/GameUIAdapter.js.map +1 -0
  326. package/dist/tui/Input.d.ts +139 -0
  327. package/dist/tui/Input.d.ts.map +1 -0
  328. package/dist/tui/Input.js +278 -0
  329. package/dist/tui/Input.js.map +1 -0
  330. package/dist/tui/Menu.d.ts +110 -0
  331. package/dist/tui/Menu.d.ts.map +1 -0
  332. package/dist/tui/Menu.js +365 -0
  333. package/dist/tui/Menu.js.map +1 -0
  334. package/dist/tui/Screen.d.ts +228 -0
  335. package/dist/tui/Screen.d.ts.map +1 -0
  336. package/dist/tui/Screen.js +502 -0
  337. package/dist/tui/Screen.js.map +1 -0
  338. package/dist/tui/components/Box.d.ts +36 -0
  339. package/dist/tui/components/Box.d.ts.map +1 -0
  340. package/dist/tui/components/Box.js +43 -0
  341. package/dist/tui/components/Box.js.map +1 -0
  342. package/dist/tui/components/List.d.ts +69 -0
  343. package/dist/tui/components/List.d.ts.map +1 -0
  344. package/dist/tui/components/List.js +136 -0
  345. package/dist/tui/components/List.js.map +1 -0
  346. package/dist/tui/components/ProgressBar.d.ts +42 -0
  347. package/dist/tui/components/ProgressBar.d.ts.map +1 -0
  348. package/dist/tui/components/ProgressBar.js +75 -0
  349. package/dist/tui/components/ProgressBar.js.map +1 -0
  350. package/dist/tui/components/index.d.ts +8 -0
  351. package/dist/tui/components/index.d.ts.map +1 -0
  352. package/dist/tui/components/index.js +11 -0
  353. package/dist/tui/components/index.js.map +1 -0
  354. package/dist/tui/core/BaseSection.d.ts +98 -0
  355. package/dist/tui/core/BaseSection.d.ts.map +1 -0
  356. package/dist/tui/core/BaseSection.js +174 -0
  357. package/dist/tui/core/BaseSection.js.map +1 -0
  358. package/dist/tui/core/Component.d.ts +61 -0
  359. package/dist/tui/core/Component.d.ts.map +1 -0
  360. package/dist/tui/core/Component.js +32 -0
  361. package/dist/tui/core/Component.js.map +1 -0
  362. package/dist/tui/core/Section.d.ts +101 -0
  363. package/dist/tui/core/Section.d.ts.map +1 -0
  364. package/dist/tui/core/Section.js +24 -0
  365. package/dist/tui/core/Section.js.map +1 -0
  366. package/dist/tui/core/SectionManager.d.ts +108 -0
  367. package/dist/tui/core/SectionManager.d.ts.map +1 -0
  368. package/dist/tui/core/SectionManager.js +258 -0
  369. package/dist/tui/core/SectionManager.js.map +1 -0
  370. package/dist/tui/core/index.d.ts +9 -0
  371. package/dist/tui/core/index.d.ts.map +1 -0
  372. package/dist/tui/core/index.js +12 -0
  373. package/dist/tui/core/index.js.map +1 -0
  374. package/dist/tui/index.d.ts +15 -0
  375. package/dist/tui/index.d.ts.map +1 -0
  376. package/dist/tui/index.js +23 -0
  377. package/dist/tui/index.js.map +1 -0
  378. package/dist/tui/screens/BaseScreen.d.ts +62 -0
  379. package/dist/tui/screens/BaseScreen.d.ts.map +1 -0
  380. package/dist/tui/screens/BaseScreen.js +55 -0
  381. package/dist/tui/screens/BaseScreen.js.map +1 -0
  382. package/dist/tui/screens/CombatScreen.d.ts +43 -0
  383. package/dist/tui/screens/CombatScreen.d.ts.map +1 -0
  384. package/dist/tui/screens/CombatScreen.js +125 -0
  385. package/dist/tui/screens/CombatScreen.js.map +1 -0
  386. package/dist/tui/screens/DialogScreen.d.ts +53 -0
  387. package/dist/tui/screens/DialogScreen.d.ts.map +1 -0
  388. package/dist/tui/screens/DialogScreen.js +90 -0
  389. package/dist/tui/screens/DialogScreen.js.map +1 -0
  390. package/dist/tui/screens/DungeonScreen.d.ts +80 -0
  391. package/dist/tui/screens/DungeonScreen.d.ts.map +1 -0
  392. package/dist/tui/screens/DungeonScreen.js +317 -0
  393. package/dist/tui/screens/DungeonScreen.js.map +1 -0
  394. package/dist/tui/screens/ExploreScreen.d.ts +69 -0
  395. package/dist/tui/screens/ExploreScreen.d.ts.map +1 -0
  396. package/dist/tui/screens/ExploreScreen.js +224 -0
  397. package/dist/tui/screens/ExploreScreen.js.map +1 -0
  398. package/dist/tui/screens/SectionScreen.d.ts +84 -0
  399. package/dist/tui/screens/SectionScreen.d.ts.map +1 -0
  400. package/dist/tui/screens/SectionScreen.js +156 -0
  401. package/dist/tui/screens/SectionScreen.js.map +1 -0
  402. package/dist/tui/screens/TitleScreen.d.ts +40 -0
  403. package/dist/tui/screens/TitleScreen.d.ts.map +1 -0
  404. package/dist/tui/screens/TitleScreen.js +253 -0
  405. package/dist/tui/screens/TitleScreen.js.map +1 -0
  406. package/dist/tui/screens/TownScreen.d.ts +98 -0
  407. package/dist/tui/screens/TownScreen.d.ts.map +1 -0
  408. package/dist/tui/screens/TownScreen.js +370 -0
  409. package/dist/tui/screens/TownScreen.js.map +1 -0
  410. package/dist/tui/screens/TravelScreen.d.ts +67 -0
  411. package/dist/tui/screens/TravelScreen.d.ts.map +1 -0
  412. package/dist/tui/screens/TravelScreen.js +286 -0
  413. package/dist/tui/screens/TravelScreen.js.map +1 -0
  414. package/dist/tui/screens/index.d.ts +8 -0
  415. package/dist/tui/screens/index.d.ts.map +1 -0
  416. package/dist/tui/screens/index.js +17 -0
  417. package/dist/tui/screens/index.js.map +1 -0
  418. package/dist/tui/sections/ActionsSection.d.ts +71 -0
  419. package/dist/tui/sections/ActionsSection.d.ts.map +1 -0
  420. package/dist/tui/sections/ActionsSection.js +184 -0
  421. package/dist/tui/sections/ActionsSection.js.map +1 -0
  422. package/dist/tui/sections/DungeonSection.d.ts +65 -0
  423. package/dist/tui/sections/DungeonSection.d.ts.map +1 -0
  424. package/dist/tui/sections/DungeonSection.js +144 -0
  425. package/dist/tui/sections/DungeonSection.js.map +1 -0
  426. package/dist/tui/sections/EventsSection.d.ts +50 -0
  427. package/dist/tui/sections/EventsSection.d.ts.map +1 -0
  428. package/dist/tui/sections/EventsSection.js +134 -0
  429. package/dist/tui/sections/EventsSection.js.map +1 -0
  430. package/dist/tui/sections/MapSection.d.ts +66 -0
  431. package/dist/tui/sections/MapSection.d.ts.map +1 -0
  432. package/dist/tui/sections/MapSection.js +669 -0
  433. package/dist/tui/sections/MapSection.js.map +1 -0
  434. package/dist/tui/sections/StatusSection.d.ts +47 -0
  435. package/dist/tui/sections/StatusSection.d.ts.map +1 -0
  436. package/dist/tui/sections/StatusSection.js +133 -0
  437. package/dist/tui/sections/StatusSection.js.map +1 -0
  438. package/dist/tui/sections/TeamSection.d.ts +71 -0
  439. package/dist/tui/sections/TeamSection.d.ts.map +1 -0
  440. package/dist/tui/sections/TeamSection.js +224 -0
  441. package/dist/tui/sections/TeamSection.js.map +1 -0
  442. package/dist/tui/sections/TravelingSection.d.ts +51 -0
  443. package/dist/tui/sections/TravelingSection.d.ts.map +1 -0
  444. package/dist/tui/sections/TravelingSection.js +106 -0
  445. package/dist/tui/sections/TravelingSection.js.map +1 -0
  446. package/dist/tui/sections/index.d.ts +9 -0
  447. package/dist/tui/sections/index.d.ts.map +1 -0
  448. package/dist/tui/sections/index.js +12 -0
  449. package/dist/tui/sections/index.js.map +1 -0
  450. package/dist/ui/Terminal.d.ts +68 -0
  451. package/dist/ui/Terminal.d.ts.map +1 -0
  452. package/dist/ui/Terminal.js +297 -0
  453. package/dist/ui/Terminal.js.map +1 -0
  454. package/dist/ui/index.d.ts +5 -0
  455. package/dist/ui/index.d.ts.map +1 -0
  456. package/dist/ui/index.js +8 -0
  457. package/dist/ui/index.js.map +1 -0
  458. package/dist/utils/configMigration.d.ts +14 -0
  459. package/dist/utils/configMigration.d.ts.map +1 -0
  460. package/dist/utils/configMigration.js +92 -0
  461. package/dist/utils/configMigration.js.map +1 -0
  462. package/dist/utils/errorHandler.d.ts +86 -0
  463. package/dist/utils/errorHandler.d.ts.map +1 -0
  464. package/dist/utils/errorHandler.js +224 -0
  465. package/dist/utils/errorHandler.js.map +1 -0
  466. package/dist/utils/logger.d.ts +14 -0
  467. package/dist/utils/logger.d.ts.map +1 -0
  468. package/dist/utils/logger.js +43 -0
  469. package/dist/utils/logger.js.map +1 -0
  470. package/dist/weapon/WeaponFactory.d.ts +32 -0
  471. package/dist/weapon/WeaponFactory.d.ts.map +1 -0
  472. package/dist/weapon/WeaponFactory.js +216 -0
  473. package/dist/weapon/WeaponFactory.js.map +1 -0
  474. package/dist/weapon/index.d.ts +5 -0
  475. package/dist/weapon/index.d.ts.map +1 -0
  476. package/dist/weapon/index.js +8 -0
  477. package/dist/weapon/index.js.map +1 -0
  478. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ # IDLERPG.SH
2
+
3
+ An AI-powered terminal idlerpg game with a dynamic affix system.
4
+
5
+ ## Features
6
+
7
+ - **Procedural Generation**: Every dungeon is unique, generated using BSP algorithm
8
+ - **AI-Powered Content**: Weapon names, descriptions, and NPC dialogs powered by AI
9
+ - **Dynamic Affix System**: Create and load custom weapon affixes as plugins
10
+ - **Real-Time Sync**: Game time matches real time (1:1), inspired by Idle RPG mechanics
11
+ - **Terminal UI**: Beautiful ASCII interface running in your terminal
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Install dependencies
17
+ npm install
18
+
19
+ # Run in development mode
20
+ npm run dev
21
+
22
+ # Or build and run
23
+ npm run build
24
+ npm start
25
+ ```
26
+
27
+ ## Game Controls
28
+
29
+ | Key | Action |
30
+ |-----|--------|
31
+ | M | View Map |
32
+ | T | Travel to connected location |
33
+ | I | Open Inventory |
34
+ | C | View Character |
35
+ | Q | Quest Log |
36
+ | W | Affix Workshop |
37
+ | N | Talk to NPC |
38
+ | H | Help |
39
+
40
+ ## Affix Plugin System
41
+
42
+ Create custom affixes by adding JavaScript files to the `affixes/` directory:
43
+
44
+ ```javascript
45
+ // affixes/my_custom_affix.js
46
+ module.exports = {
47
+ id: 'my_custom_affix',
48
+ name: 'of Destruction',
49
+ description: 'Deals massive damage but has a cost',
50
+ type: 'suffix',
51
+ rarity: 'epic',
52
+
53
+ statModifiers: {
54
+ attack: 25,
55
+ defense: -10,
56
+ },
57
+
58
+ onHitEffects: [
59
+ {
60
+ type: 'damage',
61
+ element: 'fire',
62
+ value: 20,
63
+ chance: 0.5,
64
+ },
65
+ ],
66
+
67
+ // Optional: dynamic effects
68
+ apply(context) {
69
+ return {
70
+ damageModifier: {
71
+ fire: context.player.level * 2,
72
+ },
73
+ };
74
+ },
75
+ };
76
+ ```
77
+
78
+ ### Plugin API
79
+
80
+ | Property | Type | Description |
81
+ |----------|------|-------------|
82
+ | `id` | string | Unique identifier (lowercase, alphanumeric + underscores) |
83
+ | `name` | string | Display name |
84
+ | `description` | string | Effect description |
85
+ | `type` | 'prefix' \| 'suffix' \| 'legendary' | Affix type |
86
+ | `rarity` | 'common' \| 'uncommon' \| 'rare' \| 'epic' \| 'legendary' | Rarity tier |
87
+ | `statModifiers` | object | Static stat bonuses |
88
+ | `onHitEffects` | array | Effects triggered on hit |
89
+ | `incompatibleWith` | string[] | IDs of incompatible affixes |
90
+ | `apply()` | function | Dynamic effect calculation |
91
+ | `onHit()` | function | Called when weapon hits enemy |
92
+
93
+ ## Project Structure
94
+
95
+ ```
96
+ src/
97
+ ├── core/ # Core game logic
98
+ │ ├── Game.ts # Main game class
99
+ │ ├── Combat.ts # Combat system
100
+ │ ├── Player.ts # Player utilities
101
+ │ └── types.ts # Type definitions
102
+ ├── map/ # Map generation
103
+ │ └── MapGenerator.ts
104
+ ├── affix/ # Affix system
105
+ │ ├── AffixRegistry.ts
106
+ │ ├── PluginLoader.ts
107
+ │ └── builtin.ts
108
+ ├── weapon/ # Weapon system
109
+ │ └── WeaponFactory.ts
110
+ ├── ai/ # AI integration
111
+ │ └── PlayKitClient.ts
112
+ ├── ui/ # Terminal UI
113
+ │ └── Terminal.ts
114
+ ├── i18n/ # Internationalization
115
+ │ ├── en.ts
116
+ │ ├── zh.ts
117
+ │ └── index.ts
118
+ └── index.ts # Entry point
119
+ ```
120
+
121
+ ## Internationalization
122
+
123
+ The game supports multiple languages. To add a new language:
124
+
125
+ 1. Create a new file in `src/i18n/` (e.g., `ja.ts`)
126
+ 2. Export a `LocaleData` object with all strings and prompts
127
+ 3. Register it in `src/i18n/index.ts`
128
+
129
+ ```typescript
130
+ import { setLanguage } from './i18n';
131
+
132
+ // Set language at runtime
133
+ setLanguage('zh'); // Chinese
134
+ setLanguage('en'); // English (default)
135
+ ```
136
+
137
+ ## AI Integration
138
+
139
+ This game uses [PlayKit SDK](https://playkit.ai) for AI features:
140
+
141
+ - **Weapon Names**: AI generates unique weapon names based on affixes
142
+ - **NPC Dialog**: Natural conversations with AI-powered NPCs
143
+ - **Event Narration**: Dynamic storytelling for game events
144
+
145
+ ### Configuration
146
+
147
+ The game credentials are configured in `src/ai/PlayKitClient.ts`:
148
+
149
+ ```typescript
150
+ const GAME_CONFIG = {
151
+ gameId: 'your-game-id',
152
+ developerToken: 'your-dev-token', // Remove for production
153
+ };
154
+ ```
155
+
156
+ ## Development
157
+
158
+ ```bash
159
+ # Watch mode
160
+ npm run watch
161
+
162
+ # Type check
163
+ npx tsc --noEmit
164
+
165
+ # Run dev
166
+ npm run dev
167
+ ```
168
+
169
+ ## License
170
+
171
+ MIT
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Affix Registry - manages all available affixes
3
+ */
4
+ import type { AffixPlugin, AffixValidationResult } from './types.js';
5
+ import type { Rarity, AffixType } from '../core/types.js';
6
+ export declare class AffixRegistry {
7
+ private affixes;
8
+ private affixesByType;
9
+ private affixesByRarity;
10
+ constructor();
11
+ /**
12
+ * Register all built-in affixes
13
+ */
14
+ private registerBuiltInAffixes;
15
+ /**
16
+ * Register an affix
17
+ */
18
+ register(definition: AffixPlugin, isBuiltIn?: boolean, pluginPath?: string): AffixValidationResult;
19
+ /**
20
+ * Unregister an affix
21
+ */
22
+ unregister(id: string): boolean;
23
+ /**
24
+ * Get an affix by ID
25
+ */
26
+ get(id: string): AffixPlugin | undefined;
27
+ /**
28
+ * Get all affixes
29
+ */
30
+ getAll(): AffixPlugin[];
31
+ /**
32
+ * Get affixes by type
33
+ */
34
+ getByType(type: AffixType): AffixPlugin[];
35
+ /**
36
+ * Get affixes by rarity
37
+ */
38
+ getByRarity(rarity: Rarity): AffixPlugin[];
39
+ /**
40
+ * Get random affixes for weapon generation
41
+ */
42
+ getRandomAffixes(options: {
43
+ count: number;
44
+ maxRarity?: Rarity;
45
+ playerLevel?: number;
46
+ excludeIds?: string[];
47
+ }): AffixPlugin[];
48
+ /**
49
+ * Check if two affixes are compatible
50
+ */
51
+ areCompatible(affixId1: string, affixId2: string): boolean;
52
+ /**
53
+ * Validate an affix definition
54
+ */
55
+ validate(definition: AffixPlugin): AffixValidationResult;
56
+ /**
57
+ * Get registry statistics
58
+ */
59
+ getStats(): {
60
+ total: number;
61
+ byType: Record<AffixType, number>;
62
+ byRarity: Record<Rarity, number>;
63
+ builtIn: number;
64
+ plugins: number;
65
+ };
66
+ }
67
+ export declare function getAffixRegistry(): AffixRegistry;
68
+ //# sourceMappingURL=AffixRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AffixRegistry.d.ts","sourceRoot":"/","sources":["affix/AffixRegistry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG1D,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAA2C;IAC1D,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,eAAe,CAAuC;;IAkB9D;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAM9B;;OAEG;IACH,QAAQ,CACN,UAAU,EAAE,WAAW,EACvB,SAAS,GAAE,OAAe,EAC1B,UAAU,CAAC,EAAE,MAAM,GAClB,qBAAqB;IAiCxB;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAW/B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC;;OAEG;IACH,MAAM,IAAI,WAAW,EAAE;IAIvB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,EAAE;IAOzC;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IAO1C;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,GAAG,WAAW,EAAE;IAuDjB;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAY1D;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,qBAAqB;IA0CxD;;OAEG;IACH,QAAQ,IAAI;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB;CA2BF;AAKD,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD"}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Affix Registry - manages all available affixes
3
+ */
4
+
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="76bd061f-841a-551a-8609-eba225c6f76c")}catch(e){}}();
6
+ import { builtInAffixes } from './builtin.js';
7
+ export class AffixRegistry {
8
+ affixes = new Map();
9
+ affixesByType = new Map();
10
+ affixesByRarity = new Map();
11
+ constructor() {
12
+ // Initialize type and rarity indexes
13
+ this.affixesByType.set('prefix', new Set());
14
+ this.affixesByType.set('suffix', new Set());
15
+ this.affixesByType.set('legendary', new Set());
16
+ this.affixesByRarity.set('common', new Set());
17
+ this.affixesByRarity.set('uncommon', new Set());
18
+ this.affixesByRarity.set('rare', new Set());
19
+ this.affixesByRarity.set('epic', new Set());
20
+ this.affixesByRarity.set('legendary', new Set());
21
+ // Register built-in affixes
22
+ this.registerBuiltInAffixes();
23
+ }
24
+ /**
25
+ * Register all built-in affixes
26
+ */
27
+ registerBuiltInAffixes() {
28
+ for (const affix of builtInAffixes) {
29
+ this.register(affix, true);
30
+ }
31
+ }
32
+ /**
33
+ * Register an affix
34
+ */
35
+ register(definition, isBuiltIn = false, pluginPath) {
36
+ // Validate the affix
37
+ const validation = this.validate(definition);
38
+ if (!validation.isValid) {
39
+ return validation;
40
+ }
41
+ // Check for duplicate
42
+ if (this.affixes.has(definition.id)) {
43
+ // If it's a plugin overriding a built-in, allow it
44
+ const existing = this.affixes.get(definition.id);
45
+ if (existing.isBuiltIn && !isBuiltIn) {
46
+ console.log(`[AffixRegistry] Plugin affix "${definition.id}" overrides built-in`);
47
+ }
48
+ else if (!existing.isBuiltIn) {
49
+ validation.warnings.push(`Affix "${definition.id}" already registered, replacing`);
50
+ }
51
+ }
52
+ // Register
53
+ const registered = {
54
+ definition,
55
+ isBuiltIn,
56
+ pluginPath,
57
+ loadedAt: Date.now(),
58
+ };
59
+ this.affixes.set(definition.id, registered);
60
+ this.affixesByType.get(definition.type)?.add(definition.id);
61
+ this.affixesByRarity.get(definition.rarity)?.add(definition.id);
62
+ return validation;
63
+ }
64
+ /**
65
+ * Unregister an affix
66
+ */
67
+ unregister(id) {
68
+ const affix = this.affixes.get(id);
69
+ if (!affix)
70
+ return false;
71
+ this.affixes.delete(id);
72
+ this.affixesByType.get(affix.definition.type)?.delete(id);
73
+ this.affixesByRarity.get(affix.definition.rarity)?.delete(id);
74
+ return true;
75
+ }
76
+ /**
77
+ * Get an affix by ID
78
+ */
79
+ get(id) {
80
+ return this.affixes.get(id)?.definition;
81
+ }
82
+ /**
83
+ * Get all affixes
84
+ */
85
+ getAll() {
86
+ return Array.from(this.affixes.values()).map(r => r.definition);
87
+ }
88
+ /**
89
+ * Get affixes by type
90
+ */
91
+ getByType(type) {
92
+ const ids = this.affixesByType.get(type) || new Set();
93
+ return Array.from(ids)
94
+ .map(id => this.get(id))
95
+ .filter((a) => a !== undefined);
96
+ }
97
+ /**
98
+ * Get affixes by rarity
99
+ */
100
+ getByRarity(rarity) {
101
+ const ids = this.affixesByRarity.get(rarity) || new Set();
102
+ return Array.from(ids)
103
+ .map(id => this.get(id))
104
+ .filter((a) => a !== undefined);
105
+ }
106
+ /**
107
+ * Get random affixes for weapon generation
108
+ */
109
+ getRandomAffixes(options) {
110
+ const { count, maxRarity = 'legendary', playerLevel = 1, excludeIds = [] } = options;
111
+ const rarityOrder = ['common', 'uncommon', 'rare', 'epic', 'legendary'];
112
+ const maxRarityIndex = rarityOrder.indexOf(maxRarity);
113
+ // Get all eligible affixes
114
+ const eligible = this.getAll().filter(affix => {
115
+ if (excludeIds.includes(affix.id))
116
+ return false;
117
+ if (affix.requiresLevel && affix.requiresLevel > playerLevel)
118
+ return false;
119
+ const rarityIndex = rarityOrder.indexOf(affix.rarity);
120
+ return rarityIndex <= maxRarityIndex;
121
+ });
122
+ // Weight by rarity (common more likely than legendary)
123
+ const weighted = eligible.map(affix => {
124
+ const rarityIndex = rarityOrder.indexOf(affix.rarity);
125
+ const weight = Math.pow(0.5, rarityIndex); // 1, 0.5, 0.25, 0.125, 0.0625
126
+ return { affix, weight };
127
+ });
128
+ // Select random affixes
129
+ const selected = [];
130
+ const used = new Set();
131
+ for (let i = 0; i < count && weighted.length > 0; i++) {
132
+ const totalWeight = weighted.reduce((sum, w) => sum + w.weight, 0);
133
+ let roll = Math.random() * totalWeight;
134
+ for (let j = 0; j < weighted.length; j++) {
135
+ roll -= weighted[j].weight;
136
+ if (roll <= 0) {
137
+ const picked = weighted[j].affix;
138
+ // Check compatibility
139
+ const isCompatible = !selected.some(s => s.incompatibleWith?.includes(picked.id) ||
140
+ picked.incompatibleWith?.includes(s.id));
141
+ if (isCompatible && !used.has(picked.id)) {
142
+ selected.push(picked);
143
+ used.add(picked.id);
144
+ }
145
+ weighted.splice(j, 1);
146
+ break;
147
+ }
148
+ }
149
+ }
150
+ return selected;
151
+ }
152
+ /**
153
+ * Check if two affixes are compatible
154
+ */
155
+ areCompatible(affixId1, affixId2) {
156
+ const affix1 = this.get(affixId1);
157
+ const affix2 = this.get(affixId2);
158
+ if (!affix1 || !affix2)
159
+ return false;
160
+ return !(affix1.incompatibleWith?.includes(affixId2) ||
161
+ affix2.incompatibleWith?.includes(affixId1));
162
+ }
163
+ /**
164
+ * Validate an affix definition
165
+ */
166
+ validate(definition) {
167
+ const errors = [];
168
+ const warnings = [];
169
+ // Required fields
170
+ if (!definition.id)
171
+ errors.push('Missing required field: id');
172
+ if (!definition.name)
173
+ errors.push('Missing required field: name');
174
+ if (!definition.description)
175
+ errors.push('Missing required field: description');
176
+ if (!definition.type)
177
+ errors.push('Missing required field: type');
178
+ if (!definition.rarity)
179
+ errors.push('Missing required field: rarity');
180
+ // ID format
181
+ if (definition.id && !/^[a-z][a-z0-9_]*$/.test(definition.id)) {
182
+ errors.push('ID must be lowercase alphanumeric with underscores, starting with a letter');
183
+ }
184
+ // Type validation
185
+ if (definition.type && !['prefix', 'suffix', 'legendary'].includes(definition.type)) {
186
+ errors.push('Type must be one of: prefix, suffix, legendary');
187
+ }
188
+ // Rarity validation
189
+ if (definition.rarity && !['common', 'uncommon', 'rare', 'epic', 'legendary'].includes(definition.rarity)) {
190
+ errors.push('Rarity must be one of: common, uncommon, rare, epic, legendary');
191
+ }
192
+ // Warnings for best practices
193
+ if (definition.description && definition.description.length > 200) {
194
+ warnings.push('Description is quite long, consider shortening');
195
+ }
196
+ if (definition.type === 'legendary' && definition.rarity !== 'legendary') {
197
+ warnings.push('Legendary type affixes usually have legendary rarity');
198
+ }
199
+ return {
200
+ isValid: errors.length === 0,
201
+ errors,
202
+ warnings,
203
+ };
204
+ }
205
+ /**
206
+ * Get registry statistics
207
+ */
208
+ getStats() {
209
+ let builtIn = 0;
210
+ let plugins = 0;
211
+ for (const registered of this.affixes.values()) {
212
+ if (registered.isBuiltIn)
213
+ builtIn++;
214
+ else
215
+ plugins++;
216
+ }
217
+ return {
218
+ total: this.affixes.size,
219
+ byType: {
220
+ prefix: this.affixesByType.get('prefix')?.size || 0,
221
+ suffix: this.affixesByType.get('suffix')?.size || 0,
222
+ legendary: this.affixesByType.get('legendary')?.size || 0,
223
+ },
224
+ byRarity: {
225
+ common: this.affixesByRarity.get('common')?.size || 0,
226
+ uncommon: this.affixesByRarity.get('uncommon')?.size || 0,
227
+ rare: this.affixesByRarity.get('rare')?.size || 0,
228
+ epic: this.affixesByRarity.get('epic')?.size || 0,
229
+ legendary: this.affixesByRarity.get('legendary')?.size || 0,
230
+ },
231
+ builtIn,
232
+ plugins,
233
+ };
234
+ }
235
+ }
236
+ // Singleton instance
237
+ let registryInstance = null;
238
+ export function getAffixRegistry() {
239
+ if (!registryInstance) {
240
+ registryInstance = new AffixRegistry();
241
+ }
242
+ return registryInstance;
243
+ }
244
+ //# sourceMappingURL=AffixRegistry.js.map
245
+ //# debugId=76bd061f-841a-551a-8609-eba225c6f76c
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AffixRegistry.js","sources":["affix/AffixRegistry.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Affix Registry - manages all available affixes\r\n */\r\n\r\nimport type { AffixPlugin, RegisteredAffix, AffixValidationResult } from './types.js';\r\nimport type { Rarity, AffixType } from '../core/types.js';\r\nimport { builtInAffixes } from './builtin.js';\r\n\r\nexport class AffixRegistry {\r\n private affixes: Map<string, RegisteredAffix> = new Map();\r\n private affixesByType: Map<AffixType, Set<string>> = new Map();\r\n private affixesByRarity: Map<Rarity, Set<string>> = new Map();\r\n\r\n constructor() {\r\n // Initialize type and rarity indexes\r\n this.affixesByType.set('prefix', new Set());\r\n this.affixesByType.set('suffix', new Set());\r\n this.affixesByType.set('legendary', new Set());\r\n\r\n this.affixesByRarity.set('common', new Set());\r\n this.affixesByRarity.set('uncommon', new Set());\r\n this.affixesByRarity.set('rare', new Set());\r\n this.affixesByRarity.set('epic', new Set());\r\n this.affixesByRarity.set('legendary', new Set());\r\n\r\n // Register built-in affixes\r\n this.registerBuiltInAffixes();\r\n }\r\n\r\n /**\r\n * Register all built-in affixes\r\n */\r\n private registerBuiltInAffixes(): void {\r\n for (const affix of builtInAffixes) {\r\n this.register(affix, true);\r\n }\r\n }\r\n\r\n /**\r\n * Register an affix\r\n */\r\n register(\r\n definition: AffixPlugin,\r\n isBuiltIn: boolean = false,\r\n pluginPath?: string\r\n ): AffixValidationResult {\r\n // Validate the affix\r\n const validation = this.validate(definition);\r\n if (!validation.isValid) {\r\n return validation;\r\n }\r\n\r\n // Check for duplicate\r\n if (this.affixes.has(definition.id)) {\r\n // If it's a plugin overriding a built-in, allow it\r\n const existing = this.affixes.get(definition.id)!;\r\n if (existing.isBuiltIn && !isBuiltIn) {\r\n console.log(`[AffixRegistry] Plugin affix \"${definition.id}\" overrides built-in`);\r\n } else if (!existing.isBuiltIn) {\r\n validation.warnings.push(`Affix \"${definition.id}\" already registered, replacing`);\r\n }\r\n }\r\n\r\n // Register\r\n const registered: RegisteredAffix = {\r\n definition,\r\n isBuiltIn,\r\n pluginPath,\r\n loadedAt: Date.now(),\r\n };\r\n\r\n this.affixes.set(definition.id, registered);\r\n this.affixesByType.get(definition.type)?.add(definition.id);\r\n this.affixesByRarity.get(definition.rarity)?.add(definition.id);\r\n\r\n return validation;\r\n }\r\n\r\n /**\r\n * Unregister an affix\r\n */\r\n unregister(id: string): boolean {\r\n const affix = this.affixes.get(id);\r\n if (!affix) return false;\r\n\r\n this.affixes.delete(id);\r\n this.affixesByType.get(affix.definition.type)?.delete(id);\r\n this.affixesByRarity.get(affix.definition.rarity)?.delete(id);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Get an affix by ID\r\n */\r\n get(id: string): AffixPlugin | undefined {\r\n return this.affixes.get(id)?.definition;\r\n }\r\n\r\n /**\r\n * Get all affixes\r\n */\r\n getAll(): AffixPlugin[] {\r\n return Array.from(this.affixes.values()).map(r => r.definition);\r\n }\r\n\r\n /**\r\n * Get affixes by type\r\n */\r\n getByType(type: AffixType): AffixPlugin[] {\r\n const ids = this.affixesByType.get(type) || new Set();\r\n return Array.from(ids)\r\n .map(id => this.get(id))\r\n .filter((a): a is AffixPlugin => a !== undefined);\r\n }\r\n\r\n /**\r\n * Get affixes by rarity\r\n */\r\n getByRarity(rarity: Rarity): AffixPlugin[] {\r\n const ids = this.affixesByRarity.get(rarity) || new Set();\r\n return Array.from(ids)\r\n .map(id => this.get(id))\r\n .filter((a): a is AffixPlugin => a !== undefined);\r\n }\r\n\r\n /**\r\n * Get random affixes for weapon generation\r\n */\r\n getRandomAffixes(options: {\r\n count: number;\r\n maxRarity?: Rarity;\r\n playerLevel?: number;\r\n excludeIds?: string[];\r\n }): AffixPlugin[] {\r\n const { count, maxRarity = 'legendary', playerLevel = 1, excludeIds = [] } = options;\r\n\r\n const rarityOrder: Rarity[] = ['common', 'uncommon', 'rare', 'epic', 'legendary'];\r\n const maxRarityIndex = rarityOrder.indexOf(maxRarity);\r\n\r\n // Get all eligible affixes\r\n const eligible = this.getAll().filter(affix => {\r\n if (excludeIds.includes(affix.id)) return false;\r\n if (affix.requiresLevel && affix.requiresLevel > playerLevel) return false;\r\n\r\n const rarityIndex = rarityOrder.indexOf(affix.rarity);\r\n return rarityIndex <= maxRarityIndex;\r\n });\r\n\r\n // Weight by rarity (common more likely than legendary)\r\n const weighted: { affix: AffixPlugin; weight: number }[] = eligible.map(affix => {\r\n const rarityIndex = rarityOrder.indexOf(affix.rarity);\r\n const weight = Math.pow(0.5, rarityIndex); // 1, 0.5, 0.25, 0.125, 0.0625\r\n return { affix, weight };\r\n });\r\n\r\n // Select random affixes\r\n const selected: AffixPlugin[] = [];\r\n const used = new Set<string>();\r\n\r\n for (let i = 0; i < count && weighted.length > 0; i++) {\r\n const totalWeight = weighted.reduce((sum, w) => sum + w.weight, 0);\r\n let roll = Math.random() * totalWeight;\r\n\r\n for (let j = 0; j < weighted.length; j++) {\r\n roll -= weighted[j].weight;\r\n if (roll <= 0) {\r\n const picked = weighted[j].affix;\r\n\r\n // Check compatibility\r\n const isCompatible = !selected.some(s => \r\n s.incompatibleWith?.includes(picked.id) ||\r\n picked.incompatibleWith?.includes(s.id)\r\n );\r\n\r\n if (isCompatible && !used.has(picked.id)) {\r\n selected.push(picked);\r\n used.add(picked.id);\r\n }\r\n\r\n weighted.splice(j, 1);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return selected;\r\n }\r\n\r\n /**\r\n * Check if two affixes are compatible\r\n */\r\n areCompatible(affixId1: string, affixId2: string): boolean {\r\n const affix1 = this.get(affixId1);\r\n const affix2 = this.get(affixId2);\r\n\r\n if (!affix1 || !affix2) return false;\r\n\r\n return !(\r\n affix1.incompatibleWith?.includes(affixId2) ||\r\n affix2.incompatibleWith?.includes(affixId1)\r\n );\r\n }\r\n\r\n /**\r\n * Validate an affix definition\r\n */\r\n validate(definition: AffixPlugin): AffixValidationResult {\r\n const errors: string[] = [];\r\n const warnings: string[] = [];\r\n\r\n // Required fields\r\n if (!definition.id) errors.push('Missing required field: id');\r\n if (!definition.name) errors.push('Missing required field: name');\r\n if (!definition.description) errors.push('Missing required field: description');\r\n if (!definition.type) errors.push('Missing required field: type');\r\n if (!definition.rarity) errors.push('Missing required field: rarity');\r\n\r\n // ID format\r\n if (definition.id && !/^[a-z][a-z0-9_]*$/.test(definition.id)) {\r\n errors.push('ID must be lowercase alphanumeric with underscores, starting with a letter');\r\n }\r\n\r\n // Type validation\r\n if (definition.type && !['prefix', 'suffix', 'legendary'].includes(definition.type)) {\r\n errors.push('Type must be one of: prefix, suffix, legendary');\r\n }\r\n\r\n // Rarity validation\r\n if (definition.rarity && !['common', 'uncommon', 'rare', 'epic', 'legendary'].includes(definition.rarity)) {\r\n errors.push('Rarity must be one of: common, uncommon, rare, epic, legendary');\r\n }\r\n\r\n // Warnings for best practices\r\n if (definition.description && definition.description.length > 200) {\r\n warnings.push('Description is quite long, consider shortening');\r\n }\r\n\r\n if (definition.type === 'legendary' && definition.rarity !== 'legendary') {\r\n warnings.push('Legendary type affixes usually have legendary rarity');\r\n }\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n warnings,\r\n };\r\n }\r\n\r\n /**\r\n * Get registry statistics\r\n */\r\n getStats(): {\r\n total: number;\r\n byType: Record<AffixType, number>;\r\n byRarity: Record<Rarity, number>;\r\n builtIn: number;\r\n plugins: number;\r\n } {\r\n let builtIn = 0;\r\n let plugins = 0;\r\n\r\n for (const registered of this.affixes.values()) {\r\n if (registered.isBuiltIn) builtIn++;\r\n else plugins++;\r\n }\r\n\r\n return {\r\n total: this.affixes.size,\r\n byType: {\r\n prefix: this.affixesByType.get('prefix')?.size || 0,\r\n suffix: this.affixesByType.get('suffix')?.size || 0,\r\n legendary: this.affixesByType.get('legendary')?.size || 0,\r\n },\r\n byRarity: {\r\n common: this.affixesByRarity.get('common')?.size || 0,\r\n uncommon: this.affixesByRarity.get('uncommon')?.size || 0,\r\n rare: this.affixesByRarity.get('rare')?.size || 0,\r\n epic: this.affixesByRarity.get('epic')?.size || 0,\r\n legendary: this.affixesByRarity.get('legendary')?.size || 0,\r\n },\r\n builtIn,\r\n plugins,\r\n };\r\n }\r\n}\r\n\r\n// Singleton instance\r\nlet registryInstance: AffixRegistry | null = null;\r\n\r\nexport function getAffixRegistry(): AffixRegistry {\r\n if (!registryInstance) {\r\n registryInstance = new AffixRegistry();\r\n }\r\n return registryInstance;\r\n}\r\n"],"names":[],"mappings":"AAAA;;GAEG;;;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,OAAO,aAAa;IAChB,OAAO,GAAiC,IAAI,GAAG,EAAE,CAAC;IAClD,aAAa,GAAgC,IAAI,GAAG,EAAE,CAAC;IACvD,eAAe,GAA6B,IAAI,GAAG,EAAE,CAAC;IAE9D;QACE,qCAAqC;QACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAEjD,4BAA4B;QAC5B,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACK,sBAAsB;QAC5B,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;YACnC,IAAI,CAAC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CAAC;AAC1B,CAAC","debug_id":"76bd061f-841a-551a-8609-eba225c6f76c"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Dynamic affix plugin loader with VM sandbox
3
+ */
4
+ interface LoadResult {
5
+ success: boolean;
6
+ affixId?: string;
7
+ error?: string;
8
+ warnings: string[];
9
+ }
10
+ interface PluginLoaderConfig {
11
+ pluginDir: string;
12
+ watchForChanges: boolean;
13
+ timeout: number;
14
+ }
15
+ /**
16
+ * Plugin Loader class
17
+ */
18
+ export declare class PluginLoader {
19
+ private config;
20
+ private loadedPlugins;
21
+ private watcher;
22
+ constructor(config?: Partial<PluginLoaderConfig>);
23
+ /**
24
+ * Load all plugins from the configured directory
25
+ */
26
+ loadAll(): Promise<LoadResult[]>;
27
+ /**
28
+ * Get list of plugin files
29
+ */
30
+ private getPluginFiles;
31
+ /**
32
+ * Load a single plugin file
33
+ */
34
+ loadPlugin(filePath: string): Promise<LoadResult>;
35
+ /**
36
+ * Execute plugin code in a sandboxed VM context
37
+ */
38
+ private executeInSandbox;
39
+ /**
40
+ * Reload a specific plugin
41
+ */
42
+ reloadPlugin(filePath: string): Promise<LoadResult>;
43
+ /**
44
+ * Unload a plugin
45
+ */
46
+ unloadPlugin(filePath: string): boolean;
47
+ /**
48
+ * Start watching for plugin changes
49
+ */
50
+ startWatching(): Promise<void>;
51
+ /**
52
+ * Stop watching for changes
53
+ */
54
+ stopWatching(): void;
55
+ /**
56
+ * Get list of loaded plugins
57
+ */
58
+ getLoadedPlugins(): string[];
59
+ }
60
+ export declare function getPluginLoader(config?: Partial<PluginLoaderConfig>): PluginLoader;
61
+ /**
62
+ * Initialize the plugin system
63
+ */
64
+ export declare function initializePlugins(pluginDir?: string): Promise<void>;
65
+ export {};
66
+ //# sourceMappingURL=PluginLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginLoader.d.ts","sourceRoot":"/","sources":["affix/PluginLoader.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,UAAU,U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