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
@@ -0,0 +1,669 @@
1
+ /**
2
+ * Map Section - Visual map with two rendering modes:
3
+ * 1. Dungeon: Tile-based grid (classic roguelike style)
4
+ * 2. Town: Node-link diagram with box-drawing characters
5
+ */
6
+
7
+ !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]="fbdefc1f-3be2-522e-b408-c468135e7ae5")}catch(e){}}();
8
+ import { BaseSection } from '../core/BaseSection.js';
9
+ import { ANSI } from '../Screen.js';
10
+ // Box-drawing characters for town map
11
+ const BOX = {
12
+ H: '─', // horizontal
13
+ V: '│', // vertical
14
+ TL: '┌', // top-left
15
+ TR: '┐', // top-right
16
+ BL: '└', // bottom-left
17
+ BR: '┘', // bottom-right
18
+ T: '┬', // T down
19
+ B: '┴', // T up
20
+ L: '├', // T right
21
+ R: '┤', // T left
22
+ X: '┼', // cross
23
+ };
24
+ // Dungeon tile characters
25
+ const TILES = {
26
+ WALL: '#',
27
+ FLOOR: '.',
28
+ PLAYER: '@',
29
+ DOOR: '+',
30
+ CORRIDOR: '·',
31
+ UNKNOWN: ' ',
32
+ ENEMY: '!',
33
+ TREASURE: '$',
34
+ STAIRS: '>',
35
+ BOSS: 'B',
36
+ };
37
+ /**
38
+ * Map Section - Shows current location and connected rooms
39
+ */
40
+ export class MapSection extends BaseSection {
41
+ state_data = null;
42
+ onTravel;
43
+ // Travel state for showing player movement on map
44
+ travelState = null;
45
+ // Zoom and pan state - using data-centric approach like mapscii
46
+ zoom = 1.0;
47
+ // Center in data coordinates (room position space)
48
+ // Use null to indicate uninitialized state
49
+ centerX = null;
50
+ centerY = null;
51
+ MIN_ZOOM = 0.5;
52
+ MAX_ZOOM = 2.5;
53
+ ZOOM_STEP = 0.25;
54
+ // Pan step is in data coordinates, scaled by zoom
55
+ BASE_PAN_STEP = 0.5;
56
+ constructor() {
57
+ const config = {
58
+ id: 'map',
59
+ title: 'Map',
60
+ canEnter: true,
61
+ hints: {
62
+ focused: '+/-: zoom WASD: pan R: reset Enter: select destination',
63
+ entered: '↑↓: select room Enter: travel R: reset view Esc: back',
64
+ },
65
+ };
66
+ super(config);
67
+ }
68
+ setOnTravel(callback) {
69
+ this.onTravel = callback;
70
+ }
71
+ update(state) {
72
+ this.state_data = state;
73
+ }
74
+ /**
75
+ * Set travel state for showing player movement on map
76
+ */
77
+ setTravelState(state) {
78
+ this.travelState = state;
79
+ }
80
+ /**
81
+ * Get map rendering mode from GameMap type
82
+ */
83
+ getMapMode() {
84
+ if (!this.state_data)
85
+ return 'town';
86
+ return this.state_data.currentMap.type;
87
+ }
88
+ renderContent(ctx) {
89
+ if (!this.state_data)
90
+ return;
91
+ const mode = this.getMapMode();
92
+ if (mode === 'dungeon') {
93
+ this.renderDungeonMap(ctx);
94
+ }
95
+ else {
96
+ this.renderTownMap(ctx);
97
+ }
98
+ }
99
+ // ===========================================================================
100
+ // DUNGEON MAP - Box-based rooms (clearer visualization)
101
+ // ===========================================================================
102
+ renderDungeonMap(ctx) {
103
+ const { screen, bounds } = ctx;
104
+ const { x, y, width, height } = bounds;
105
+ const mapX = x + 1;
106
+ const mapY = y + 1;
107
+ const mapWidth = width - 2;
108
+ const mapHeight = height - 3;
109
+ const rooms = Array.from(this.state_data.currentMap.rooms.values());
110
+ const currentRoom = this.state_data.currentRoom;
111
+ const connections = currentRoom.connections;
112
+ // Calculate room bounds for positioning
113
+ const gridBounds = this.calculateRoomBounds(rooms);
114
+ // Box dimensions for dungeon rooms (smaller than town)
115
+ const boxWidth = 8;
116
+ const boxHeight = 3;
117
+ const hSpacing = 10; // horizontal spacing between room centers
118
+ const vSpacing = 5; // vertical spacing between room centers
119
+ // Initialize center to player position if not set
120
+ if (this.centerX === null || this.centerY === null) {
121
+ this.centerX = currentRoom.position.x;
122
+ this.centerY = currentRoom.position.y;
123
+ }
124
+ // Apply zoom
125
+ const scale = this.zoom;
126
+ const scaledHSpacing = Math.round(hSpacing * scale);
127
+ const scaledVSpacing = Math.round(vSpacing * scale);
128
+ // Calculate the center of the map area
129
+ const mapCenterX = mapX + Math.floor(mapWidth / 2);
130
+ const mapCenterY = mapY + Math.floor(mapHeight / 2);
131
+ // Function to convert room position to screen position
132
+ const roomToScreen = (room) => {
133
+ const offsetX = (room.position.x - this.centerX) * scaledHSpacing;
134
+ const offsetY = (room.position.y - this.centerY) * scaledVSpacing;
135
+ return {
136
+ x: mapCenterX + offsetX,
137
+ y: mapCenterY + offsetY,
138
+ };
139
+ };
140
+ // First pass: draw connections
141
+ for (const room of rooms) {
142
+ const pos = roomToScreen(room);
143
+ for (const connId of room.connections) {
144
+ const connRoom = this.state_data.currentMap.rooms.get(connId);
145
+ if (!connRoom)
146
+ continue;
147
+ const connPos = roomToScreen(connRoom);
148
+ // Only draw if target is to the right or below (avoid double-drawing)
149
+ if (connPos.x < pos.x || (connPos.x === pos.x && connPos.y < pos.y))
150
+ continue;
151
+ // Draw connection line
152
+ const startX = pos.x + Math.floor(boxWidth / 2);
153
+ const startY = pos.y + 1;
154
+ const endX = connPos.x + Math.floor(boxWidth / 2);
155
+ const endY = connPos.y + 1;
156
+ // Simple L-shaped or straight connection
157
+ if (startY === endY) {
158
+ // Horizontal connection
159
+ for (let cx = Math.min(startX, endX) + 1; cx < Math.max(startX, endX); cx++) {
160
+ if (cx >= mapX && cx < mapX + mapWidth && startY >= mapY && startY < mapY + mapHeight) {
161
+ screen.write(cx, startY, '-', ANSI.fg.gray);
162
+ }
163
+ }
164
+ }
165
+ else if (startX === endX) {
166
+ // Vertical connection
167
+ for (let cy = Math.min(startY, endY) + 1; cy < Math.max(startY, endY); cy++) {
168
+ if (startX >= mapX && startX < mapX + mapWidth && cy >= mapY && cy < mapY + mapHeight) {
169
+ screen.write(startX, cy, '|', ANSI.fg.gray);
170
+ }
171
+ }
172
+ }
173
+ else {
174
+ // L-shaped connection (horizontal first, then vertical)
175
+ const midX = endX;
176
+ // Horizontal segment
177
+ for (let cx = Math.min(startX, midX) + 1; cx < Math.max(startX, midX); cx++) {
178
+ if (cx >= mapX && cx < mapX + mapWidth && startY >= mapY && startY < mapY + mapHeight) {
179
+ screen.write(cx, startY, '-', ANSI.fg.gray);
180
+ }
181
+ }
182
+ // Vertical segment
183
+ for (let cy = Math.min(startY, endY); cy <= Math.max(startY, endY); cy++) {
184
+ if (midX >= mapX && midX < mapX + mapWidth && cy >= mapY && cy < mapY + mapHeight) {
185
+ screen.write(midX, cy, '|', ANSI.fg.gray);
186
+ }
187
+ }
188
+ // Corner
189
+ if (midX >= mapX && midX < mapX + mapWidth && startY >= mapY && startY < mapY + mapHeight) {
190
+ screen.write(midX, startY, '+', ANSI.fg.gray);
191
+ }
192
+ }
193
+ }
194
+ }
195
+ // Second pass: draw room boxes
196
+ for (const room of rooms) {
197
+ const pos = roomToScreen(room);
198
+ const boxX = pos.x;
199
+ const boxY = pos.y;
200
+ // Check if room box is within visible area
201
+ if (boxX + boxWidth < mapX || boxX >= mapX + mapWidth ||
202
+ boxY + boxHeight < mapY || boxY >= mapY + mapHeight) {
203
+ continue;
204
+ }
205
+ const isCurrentRoom = room.id === currentRoom.id;
206
+ const isConnected = connections.includes(room.id);
207
+ const connIdx = isConnected ? connections.indexOf(room.id) : -1;
208
+ const isSelected = this.state.entered && connIdx === this.state.selectedIndex;
209
+ // Determine room color and symbol based on type
210
+ let borderFg = ANSI.fg.gray;
211
+ let contentFg = ANSI.fg.white;
212
+ let icon = '?';
213
+ if (room.type === 'combat') {
214
+ borderFg = ANSI.fg.red;
215
+ icon = '!';
216
+ }
217
+ else if (room.type === 'treasure') {
218
+ borderFg = ANSI.fg.yellow;
219
+ icon = '$';
220
+ }
221
+ else if (room.type === 'dungeon_entrance') {
222
+ borderFg = ANSI.fg.cyan;
223
+ icon = '>';
224
+ }
225
+ else if (room.type === 'rest') {
226
+ borderFg = ANSI.fg.blue;
227
+ icon = 'R';
228
+ }
229
+ else if (room.type === 'event') {
230
+ borderFg = ANSI.fg.magenta;
231
+ icon = '?';
232
+ }
233
+ else if (room.type === 'shop') {
234
+ borderFg = ANSI.fg.green;
235
+ icon = 'S';
236
+ }
237
+ else if (room.type === 'empty') {
238
+ borderFg = ANSI.fg.gray;
239
+ icon = '.';
240
+ }
241
+ if (isCurrentRoom) {
242
+ borderFg = ANSI.fg.brightGreen;
243
+ icon = '@';
244
+ }
245
+ if (isSelected) {
246
+ borderFg = ANSI.fg.brightCyan;
247
+ }
248
+ // Draw room box (3 lines)
249
+ const top = '+' + '-'.repeat(boxWidth - 2) + '+';
250
+ const bottom = '+' + '-'.repeat(boxWidth - 2) + '+';
251
+ // Room label: icon + short type
252
+ let label = icon;
253
+ if (isConnected && connIdx >= 0) {
254
+ label = `${connIdx + 1}${icon}`;
255
+ }
256
+ const middle = '|' + label.padStart(Math.floor((boxWidth - 2 + label.length) / 2)).padEnd(boxWidth - 2) + '|';
257
+ // Clip and draw each line
258
+ for (let row = 0; row < boxHeight; row++) {
259
+ const lineY = boxY + row;
260
+ if (lineY < mapY || lineY >= mapY + mapHeight)
261
+ continue;
262
+ let line;
263
+ if (row === 0)
264
+ line = top;
265
+ else if (row === boxHeight - 1)
266
+ line = bottom;
267
+ else
268
+ line = middle;
269
+ // Calculate visible portion
270
+ const startCol = Math.max(0, mapX - boxX);
271
+ const endCol = Math.min(boxWidth, mapX + mapWidth - boxX);
272
+ if (startCol < endCol) {
273
+ const visiblePart = line.slice(startCol, endCol);
274
+ const drawX = Math.max(boxX, mapX);
275
+ screen.write(drawX, lineY, visiblePart, borderFg);
276
+ }
277
+ }
278
+ }
279
+ // Legend at bottom
280
+ const legendY = y + height - 2;
281
+ screen.write(x + 2, legendY, '@:You !:Enemy $:Loot >:Exit R:Rest ?:Event', ANSI.fg.gray);
282
+ }
283
+ drawCorridor(buffer, colorBuffer, x1, y1, x2, y2, gridWidth, gridHeight) {
284
+ // Only draw if target is to the right or below (avoid double-drawing)
285
+ if (x2 < x1 || (x2 === x1 && y2 < y1))
286
+ return;
287
+ // Horizontal first, then vertical
288
+ const midX = x2;
289
+ const midY = y1;
290
+ // Horizontal segment
291
+ const hStart = Math.min(x1, midX);
292
+ const hEnd = Math.max(x1, midX);
293
+ for (let cx = hStart + 1; cx < hEnd; cx++) {
294
+ if (cx >= 0 && cx < gridWidth && y1 >= 0 && y1 < gridHeight) {
295
+ if (buffer[y1][cx] === TILES.UNKNOWN) {
296
+ buffer[y1][cx] = TILES.CORRIDOR;
297
+ colorBuffer[y1][cx] = { fg: ANSI.fg.gray };
298
+ }
299
+ }
300
+ }
301
+ // Vertical segment
302
+ const vStart = Math.min(midY, y2);
303
+ const vEnd = Math.max(midY, y2);
304
+ for (let cy = vStart + 1; cy < vEnd; cy++) {
305
+ if (midX >= 0 && midX < gridWidth && cy >= 0 && cy < gridHeight) {
306
+ if (buffer[cy][midX] === TILES.UNKNOWN) {
307
+ buffer[cy][midX] = TILES.CORRIDOR;
308
+ colorBuffer[cy][midX] = { fg: ANSI.fg.gray };
309
+ }
310
+ }
311
+ }
312
+ }
313
+ // ===========================================================================
314
+ // TOWN MAP - Node-link diagram with box-drawing characters
315
+ // ===========================================================================
316
+ renderTownMap(ctx) {
317
+ const { screen, bounds } = ctx;
318
+ const { x, y, width, height } = bounds;
319
+ // Viewport bounds (inside the box border)
320
+ const mapX = x + 1;
321
+ const mapY = y + 1;
322
+ const mapWidth = width - 2;
323
+ const mapHeight = height - 3;
324
+ const rooms = Array.from(this.state_data.currentMap.rooms.values());
325
+ const currentRoom = this.state_data.currentRoom;
326
+ const connections = currentRoom.connections;
327
+ // Calculate data bounds
328
+ const roomBounds = this.calculateRoomBounds(rooms);
329
+ // Initialize center to current room position if not set (first render or after reset)
330
+ // This ensures the player's room is always visible initially
331
+ if (this.centerX === null || this.centerY === null) {
332
+ this.centerX = currentRoom.position.x;
333
+ this.centerY = currentRoom.position.y;
334
+ }
335
+ // Node spacing in screen pixels - scales with zoom
336
+ const baseNodeWidth = 12;
337
+ const baseNodeHeight = 4;
338
+ const nodeWidth = Math.round(baseNodeWidth * this.zoom);
339
+ const nodeHeight = Math.round(baseNodeHeight * this.zoom);
340
+ // Screen center coordinates
341
+ const screenCenterX = mapX + Math.floor(mapWidth / 2);
342
+ const screenCenterY = mapY + Math.floor(mapHeight / 2);
343
+ // Helper to convert room data position to screen position
344
+ // centerX and centerY are guaranteed to be initialized at this point
345
+ const cx = this.centerX;
346
+ const cy = this.centerY;
347
+ const roomToScreen = (room) => {
348
+ // Position relative to the view center, scaled by nodeWidth/Height
349
+ const dx = (room.position.x - cx) * nodeWidth;
350
+ const dy = (room.position.y - cy) * nodeHeight;
351
+ return {
352
+ x: Math.round(screenCenterX + dx),
353
+ y: Math.round(screenCenterY + dy),
354
+ };
355
+ };
356
+ // First pass: Draw connections with box-drawing characters
357
+ for (const room of rooms) {
358
+ const fromPos = roomToScreen(room);
359
+ for (const connId of room.connections) {
360
+ const connRoom = this.state_data.currentMap.rooms.get(connId);
361
+ if (!connRoom)
362
+ continue;
363
+ // Avoid double-drawing
364
+ if (connRoom.position.x < room.position.x ||
365
+ (connRoom.position.x === room.position.x && connRoom.position.y < room.position.y)) {
366
+ continue;
367
+ }
368
+ const toPos = roomToScreen(connRoom);
369
+ this.drawBoxConnection(screen, fromPos.x, fromPos.y, toPos.x, toPos.y, mapX, mapY, mapWidth, mapHeight);
370
+ }
371
+ }
372
+ // Second pass: Draw room nodes
373
+ for (const room of rooms) {
374
+ const pos = roomToScreen(room);
375
+ const isCurrentRoom = room.id === currentRoom.id;
376
+ const isConnected = connections.includes(room.id);
377
+ const connIdx = isConnected ? connections.indexOf(room.id) : -1;
378
+ const isSelected = this.state.entered && connIdx === this.state.selectedIndex;
379
+ // Determine style
380
+ let fg = ANSI.fg.gray;
381
+ let bg;
382
+ let borderFg = ANSI.fg.gray;
383
+ if (isCurrentRoom) {
384
+ fg = ANSI.fg.brightGreen;
385
+ borderFg = ANSI.fg.green;
386
+ }
387
+ else if (isSelected) {
388
+ fg = ANSI.fg.black;
389
+ bg = ANSI.bg.cyan;
390
+ borderFg = ANSI.fg.cyan;
391
+ }
392
+ else if (isConnected) {
393
+ fg = ANSI.fg.white;
394
+ borderFg = ANSI.fg.white;
395
+ }
396
+ // Draw node box - size adapts slightly with zoom
397
+ const boxWidth = Math.min(10, room.name.length + 2);
398
+ const boxX = pos.x - Math.floor(boxWidth / 2);
399
+ const boxY = pos.y - 1;
400
+ // Check if any part of the box is visible (not just top-left corner)
401
+ const boxVisible = boxX + boxWidth > mapX && boxX < mapX + mapWidth &&
402
+ boxY + 2 >= mapY && boxY < mapY + mapHeight;
403
+ if (!boxVisible)
404
+ continue;
405
+ // Top border - render if row is visible
406
+ if (boxY >= mapY && boxY < mapY + mapHeight) {
407
+ const top = BOX.TL + BOX.H.repeat(boxWidth - 2) + BOX.TR;
408
+ const startX = Math.max(mapX, boxX);
409
+ const endX = Math.min(mapX + mapWidth, boxX + boxWidth);
410
+ if (startX < endX) {
411
+ const sliceStart = startX - boxX;
412
+ const sliceEnd = endX - boxX;
413
+ screen.write(startX, boxY, top.slice(sliceStart, sliceEnd), borderFg);
414
+ }
415
+ }
416
+ // Middle with name - render if row is visible
417
+ if (pos.y >= mapY && pos.y < mapY + mapHeight) {
418
+ const symbol = isCurrentRoom ? '@' : this.getRoomSymbol(room);
419
+ const label = `${symbol}${room.name}`.slice(0, boxWidth - 2);
420
+ const padded = label.padEnd(boxWidth - 2);
421
+ // Draw left border if visible
422
+ if (boxX >= mapX && boxX < mapX + mapWidth) {
423
+ screen.write(boxX, pos.y, BOX.V, borderFg);
424
+ }
425
+ // Draw right border if visible
426
+ if (boxX + boxWidth - 1 >= mapX && boxX + boxWidth - 1 < mapX + mapWidth) {
427
+ screen.write(boxX + boxWidth - 1, pos.y, BOX.V, borderFg);
428
+ }
429
+ // Draw content
430
+ const contentStartX = Math.max(mapX, boxX + 1);
431
+ const contentEndX = Math.min(mapX + mapWidth, boxX + boxWidth - 1);
432
+ if (contentStartX < contentEndX) {
433
+ const sliceStart = contentStartX - (boxX + 1);
434
+ const sliceEnd = contentEndX - (boxX + 1);
435
+ screen.write(contentStartX, pos.y, padded.slice(sliceStart, sliceEnd), fg, bg);
436
+ }
437
+ }
438
+ // Bottom border - render if row is visible
439
+ if (boxY + 2 >= mapY && boxY + 2 < mapY + mapHeight) {
440
+ const bottom = BOX.BL + BOX.H.repeat(boxWidth - 2) + BOX.BR;
441
+ const startX = Math.max(mapX, boxX);
442
+ const endX = Math.min(mapX + mapWidth, boxX + boxWidth);
443
+ if (startX < endX) {
444
+ const sliceStart = startX - boxX;
445
+ const sliceEnd = endX - boxX;
446
+ screen.write(startX, boxY + 2, bottom.slice(sliceStart, sliceEnd), borderFg);
447
+ }
448
+ }
449
+ // Selection number
450
+ if (isConnected && connIdx >= 0) {
451
+ const numX = pos.x + Math.floor(boxWidth / 2);
452
+ if (numX >= mapX && numX < mapX + mapWidth && pos.y >= mapY && pos.y < mapY + mapHeight) {
453
+ screen.write(numX, pos.y, String(connIdx + 1), ANSI.fg.yellow);
454
+ }
455
+ }
456
+ }
457
+ // Render traveling player icon when in travel state
458
+ if (this.travelState) {
459
+ const fromRoom = this.state_data.currentMap.rooms.get(this.travelState.fromRoomId);
460
+ const toRoom = this.state_data.currentMap.rooms.get(this.travelState.toRoomId);
461
+ if (fromRoom && toRoom) {
462
+ const fromPos = roomToScreen(fromRoom);
463
+ const toPos = roomToScreen(toRoom);
464
+ // Linear interpolation for current position
465
+ const progress = this.travelState.progress;
466
+ const currentX = Math.round(fromPos.x + (toPos.x - fromPos.x) * progress);
467
+ const currentY = Math.round(fromPos.y + (toPos.y - fromPos.y) * progress);
468
+ // Check if within visible bounds
469
+ if (currentX >= mapX && currentX < mapX + mapWidth &&
470
+ currentY >= mapY && currentY < mapY + mapHeight) {
471
+ // Draw player icon with blinking effect
472
+ const blink = Math.floor(Date.now() / 300) % 2 === 0;
473
+ const icon = blink ? '*' : '@';
474
+ screen.write(currentX, currentY, icon, ANSI.fg.brightYellow);
475
+ }
476
+ }
477
+ }
478
+ // Zoom and pan indicator - show in the map area, not the border
479
+ const zoomText = `Zoom:${Math.round(this.zoom * 100)}%`;
480
+ screen.write(mapX + 1, mapY, zoomText, ANSI.fg.gray);
481
+ // Display selected/current room info in the bottom-right corner
482
+ let selectedRoom = null;
483
+ if (this.state.entered && this.state.selectedIndex < connections.length) {
484
+ // Show selected connected room when entered
485
+ const selectedId = connections[this.state.selectedIndex];
486
+ selectedRoom = this.state_data.currentMap.rooms.get(selectedId) || null;
487
+ }
488
+ else {
489
+ // Show current room when just focused
490
+ selectedRoom = currentRoom;
491
+ }
492
+ if (selectedRoom) {
493
+ const symbol = selectedRoom.id === currentRoom.id ? '@' : this.getRoomSymbol(selectedRoom);
494
+ const roomInfo = `${symbol} ${selectedRoom.name} (${selectedRoom.type})`;
495
+ const infoX = x + width - roomInfo.length - 2;
496
+ const infoY = y + height - 2;
497
+ const infoColor = selectedRoom.id === currentRoom.id ? ANSI.fg.brightGreen : ANSI.fg.cyan;
498
+ screen.write(Math.max(x + 2, infoX), infoY, roomInfo.slice(0, width - 4), infoColor);
499
+ }
500
+ // Legend - left side
501
+ const legendY = y + height - 1;
502
+ screen.write(x + 2, legendY, `+/-:Zoom WASD:Pan R:Reset`, ANSI.fg.gray);
503
+ }
504
+ drawBoxConnection(screen, x1, y1, x2, y2, mapX, mapY, mapWidth, mapHeight) {
505
+ // Orthogonal connection: horizontal then vertical
506
+ const midX = x2;
507
+ const midY = y1;
508
+ // Horizontal segment
509
+ const hStart = Math.min(x1, midX) + 1;
510
+ const hEnd = Math.max(x1, midX);
511
+ for (let cx = hStart; cx < hEnd; cx++) {
512
+ if (this.isInBounds(cx, y1, mapX, mapY, mapWidth, mapHeight)) {
513
+ screen.write(cx, y1, BOX.H, ANSI.fg.gray);
514
+ }
515
+ }
516
+ // Corner
517
+ if (y1 !== y2 && this.isInBounds(midX, midY, mapX, mapY, mapWidth, mapHeight)) {
518
+ const corner = y2 > y1 ? (x2 > x1 ? BOX.TL : BOX.TR) : (x2 > x1 ? BOX.BL : BOX.BR);
519
+ screen.write(midX, midY, corner, ANSI.fg.gray);
520
+ }
521
+ // Vertical segment
522
+ const vStart = Math.min(midY, y2) + 1;
523
+ const vEnd = Math.max(midY, y2);
524
+ for (let cy = vStart; cy < vEnd; cy++) {
525
+ if (this.isInBounds(midX, cy, mapX, mapY, mapWidth, mapHeight)) {
526
+ screen.write(midX, cy, BOX.V, ANSI.fg.gray);
527
+ }
528
+ }
529
+ }
530
+ // ===========================================================================
531
+ // COMMON HELPERS
532
+ // ===========================================================================
533
+ calculateRoomBounds(rooms) {
534
+ if (rooms.length === 0) {
535
+ return { minX: 0, maxX: 0, minY: 0, maxY: 0 };
536
+ }
537
+ let minX = Infinity, maxX = -Infinity;
538
+ let minY = Infinity, maxY = -Infinity;
539
+ for (const room of rooms) {
540
+ minX = Math.min(minX, room.position.x);
541
+ maxX = Math.max(maxX, room.position.x);
542
+ minY = Math.min(minY, room.position.y);
543
+ maxY = Math.max(maxY, room.position.y);
544
+ }
545
+ return { minX, maxX, minY, maxY };
546
+ }
547
+ isInBounds(px, py, mapX, mapY, mapWidth, mapHeight) {
548
+ return px >= mapX && px < mapX + mapWidth && py >= mapY && py < mapY + mapHeight;
549
+ }
550
+ getRoomSymbol(room) {
551
+ const symbols = {
552
+ safe: '♦',
553
+ shop: 'S',
554
+ exit: '→',
555
+ start: '○',
556
+ enemy: '!',
557
+ boss: 'B',
558
+ treasure: '$',
559
+ trap: '^',
560
+ event: '?',
561
+ empty: '·',
562
+ };
563
+ return symbols[room.type] || '·';
564
+ }
565
+ getItemCount() {
566
+ return this.state_data?.currentRoom.connections.length || 0;
567
+ }
568
+ activateItem() {
569
+ if (!this.state_data)
570
+ return false;
571
+ const connections = this.state_data.currentRoom.connections;
572
+ if (this.state.selectedIndex < connections.length) {
573
+ this.onTravel?.(this.state.selectedIndex);
574
+ this.exit();
575
+ return true;
576
+ }
577
+ return false;
578
+ }
579
+ getMaxVisibleItems() {
580
+ return this.state_data?.currentRoom.connections.length || 0;
581
+ }
582
+ /**
583
+ * Helper to check if a key matches a character (checks both raw and name)
584
+ */
585
+ isKey(key, ...chars) {
586
+ const raw = key.raw?.toLowerCase();
587
+ const name = key.name?.toLowerCase();
588
+ for (const char of chars) {
589
+ const c = char.toLowerCase();
590
+ if (raw === c || name === c)
591
+ return true;
592
+ }
593
+ return false;
594
+ }
595
+ /**
596
+ * Handle zoom/pan controls - works when focused (not just entered)
597
+ * Pan moves the center in data coordinates (like mapscii)
598
+ */
599
+ handleZoomPan(key) {
600
+ // Pan step scales inversely with zoom (faster pan when zoomed out)
601
+ const panStep = this.BASE_PAN_STEP / this.zoom;
602
+ // Zoom controls - check both raw characters
603
+ if (key.raw === '+' || key.raw === '=' || key.sequence === '+') {
604
+ this.zoom = Math.min(this.MAX_ZOOM, this.zoom + this.ZOOM_STEP);
605
+ return true;
606
+ }
607
+ if (key.raw === '-' || key.raw === '_' || key.sequence === '-') {
608
+ this.zoom = Math.max(this.MIN_ZOOM, this.zoom - this.ZOOM_STEP);
609
+ return true;
610
+ }
611
+ // Initialize center if null (before any pan operation)
612
+ // This can happen if handleZoomPan is called before first render
613
+ if (this.centerX === null)
614
+ this.centerX = 0;
615
+ if (this.centerY === null)
616
+ this.centerY = 0;
617
+ // Pan controls (WASD) - move center in data coordinates
618
+ // Use isKey helper to check both key.raw and key.name
619
+ // W = up = decrease Y (move view up = center moves up in data space)
620
+ if (this.isKey(key, 'w')) {
621
+ this.centerY -= panStep;
622
+ return true;
623
+ }
624
+ // S = down = increase Y
625
+ if (this.isKey(key, 's')) {
626
+ this.centerY += panStep;
627
+ return true;
628
+ }
629
+ // A = left = decrease X
630
+ if (this.isKey(key, 'a')) {
631
+ this.centerX -= panStep;
632
+ return true;
633
+ }
634
+ // D = right = increase X
635
+ if (this.isKey(key, 'd')) {
636
+ this.centerX += panStep;
637
+ return true;
638
+ }
639
+ // Reset view - reset center to null (will be recalculated on next render)
640
+ if (this.isKey(key, 'r', '0')) {
641
+ this.zoom = 1.0;
642
+ this.centerX = null;
643
+ this.centerY = null;
644
+ return true;
645
+ }
646
+ return false;
647
+ }
648
+ handleCustomKey(key) {
649
+ return this.handleZoomPan(key);
650
+ }
651
+ /**
652
+ * Override handleKey to allow zoom/pan when focused OR entered
653
+ */
654
+ handleKey(key) {
655
+ // Always try zoom/pan first when focused or entered
656
+ if ((this.focused || this.state.entered) && this.handleZoomPan(key)) {
657
+ return true;
658
+ }
659
+ // For other keys, use default behavior (requires entered state)
660
+ return super.handleKey(key);
661
+ }
662
+ resetView() {
663
+ this.zoom = 1.0;
664
+ this.centerX = null;
665
+ this.centerY = null;
666
+ }
667
+ }
668
+ //# sourceMappingURL=MapSection.js.map
669
+ //# debugId=fbdefc1f-3be2-522e-b408-c468135e7ae5