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.
- package/README.md +171 -0
- package/dist/affix/AffixRegistry.d.ts +68 -0
- package/dist/affix/AffixRegistry.d.ts.map +1 -0
- package/dist/affix/AffixRegistry.js +245 -0
- package/dist/affix/AffixRegistry.js.map +1 -0
- package/dist/affix/PluginLoader.d.ts +66 -0
- package/dist/affix/PluginLoader.d.ts.map +1 -0
- package/dist/affix/PluginLoader.js +321 -0
- package/dist/affix/PluginLoader.js.map +1 -0
- package/dist/affix/builtin.d.ts +6 -0
- package/dist/affix/builtin.d.ts.map +1 -0
- package/dist/affix/builtin.js +311 -0
- package/dist/affix/builtin.js.map +1 -0
- package/dist/affix/index.d.ts +8 -0
- package/dist/affix/index.d.ts.map +1 -0
- package/dist/affix/index.js +11 -0
- package/dist/affix/index.js.map +1 -0
- package/dist/affix/types.d.ts +152 -0
- package/dist/affix/types.d.ts.map +1 -0
- package/dist/affix/types.js +8 -0
- package/dist/affix/types.js.map +1 -0
- package/dist/ai/PlayKitClient.d.ts +208 -0
- package/dist/ai/PlayKitClient.d.ts.map +1 -0
- package/dist/ai/PlayKitClient.js +721 -0
- package/dist/ai/PlayKitClient.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/app/App.d.ts +85 -0
- package/dist/app/App.d.ts.map +1 -0
- package/dist/app/App.js +296 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/EventBus.d.ts +222 -0
- package/dist/app/EventBus.d.ts.map +1 -0
- package/dist/app/EventBus.js +88 -0
- package/dist/app/EventBus.js.map +1 -0
- package/dist/app/Keybind.d.ts +83 -0
- package/dist/app/Keybind.d.ts.map +1 -0
- package/dist/app/Keybind.js +184 -0
- package/dist/app/Keybind.js.map +1 -0
- package/dist/app/Router.d.ts +123 -0
- package/dist/app/Router.d.ts.map +1 -0
- package/dist/app/Router.js +142 -0
- package/dist/app/Router.js.map +1 -0
- package/dist/app/ScreenManager.d.ts +97 -0
- package/dist/app/ScreenManager.d.ts.map +1 -0
- package/dist/app/ScreenManager.js +216 -0
- package/dist/app/ScreenManager.js.map +1 -0
- package/dist/app/index.d.ts +14 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +19 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/screens/BaseScreen.d.ts +101 -0
- package/dist/app/screens/BaseScreen.d.ts.map +1 -0
- package/dist/app/screens/BaseScreen.js +132 -0
- package/dist/app/screens/BaseScreen.js.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts +42 -0
- package/dist/app/screens/CharacterCreationScreen.d.ts.map +1 -0
- package/dist/app/screens/CharacterCreationScreen.js +467 -0
- package/dist/app/screens/CharacterCreationScreen.js.map +1 -0
- package/dist/app/screens/CombatScreen.d.ts +30 -0
- package/dist/app/screens/CombatScreen.d.ts.map +1 -0
- package/dist/app/screens/CombatScreen.js +309 -0
- package/dist/app/screens/CombatScreen.js.map +1 -0
- package/dist/app/screens/DialogScreen.d.ts +29 -0
- package/dist/app/screens/DialogScreen.d.ts.map +1 -0
- package/dist/app/screens/DialogScreen.js +295 -0
- package/dist/app/screens/DialogScreen.js.map +1 -0
- package/dist/app/screens/ExploreScreen.d.ts +50 -0
- package/dist/app/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/app/screens/ExploreScreen.js +308 -0
- package/dist/app/screens/ExploreScreen.js.map +1 -0
- package/dist/app/screens/HelpScreen.d.ts +12 -0
- package/dist/app/screens/HelpScreen.d.ts.map +1 -0
- package/dist/app/screens/HelpScreen.js +155 -0
- package/dist/app/screens/HelpScreen.js.map +1 -0
- package/dist/app/screens/InventoryScreen.d.ts +27 -0
- package/dist/app/screens/InventoryScreen.d.ts.map +1 -0
- package/dist/app/screens/InventoryScreen.js +326 -0
- package/dist/app/screens/InventoryScreen.js.map +1 -0
- package/dist/app/screens/PrologueScreen.d.ts +24 -0
- package/dist/app/screens/PrologueScreen.d.ts.map +1 -0
- package/dist/app/screens/PrologueScreen.js +176 -0
- package/dist/app/screens/PrologueScreen.js.map +1 -0
- package/dist/app/screens/TitleScreen.d.ts +42 -0
- package/dist/app/screens/TitleScreen.d.ts.map +1 -0
- package/dist/app/screens/TitleScreen.js +380 -0
- package/dist/app/screens/TitleScreen.js.map +1 -0
- package/dist/app/screens/TravelScreen.d.ts +22 -0
- package/dist/app/screens/TravelScreen.d.ts.map +1 -0
- package/dist/app/screens/TravelScreen.js +122 -0
- package/dist/app/screens/TravelScreen.js.map +1 -0
- package/dist/app/screens/index.d.ts +14 -0
- package/dist/app/screens/index.d.ts.map +1 -0
- package/dist/app/screens/index.js +17 -0
- package/dist/app/screens/index.js.map +1 -0
- package/dist/commands/CommandRegistry.d.ts +91 -0
- package/dist/commands/CommandRegistry.d.ts.map +1 -0
- package/dist/commands/CommandRegistry.js +159 -0
- package/dist/commands/CommandRegistry.js.map +1 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +10 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/Actor.d.ts +103 -0
- package/dist/core/Actor.d.ts.map +1 -0
- package/dist/core/Actor.js +409 -0
- package/dist/core/Actor.js.map +1 -0
- package/dist/core/Combat.d.ts +37 -0
- package/dist/core/Combat.d.ts.map +1 -0
- package/dist/core/Combat.js +294 -0
- package/dist/core/Combat.js.map +1 -0
- package/dist/core/DungeonRunner.d.ts +169 -0
- package/dist/core/DungeonRunner.d.ts.map +1 -0
- package/dist/core/DungeonRunner.js +627 -0
- package/dist/core/DungeonRunner.js.map +1 -0
- package/dist/core/Game.d.ts +133 -0
- package/dist/core/Game.d.ts.map +1 -0
- package/dist/core/Game.js +644 -0
- package/dist/core/Game.js.map +1 -0
- package/dist/core/IdleCombat.d.ts +61 -0
- package/dist/core/IdleCombat.d.ts.map +1 -0
- package/dist/core/IdleCombat.js +461 -0
- package/dist/core/IdleCombat.js.map +1 -0
- package/dist/core/IdleGameManager.d.ts +198 -0
- package/dist/core/IdleGameManager.d.ts.map +1 -0
- package/dist/core/IdleGameManager.js +688 -0
- package/dist/core/IdleGameManager.js.map +1 -0
- package/dist/core/IdleSaveManager.d.ts +109 -0
- package/dist/core/IdleSaveManager.d.ts.map +1 -0
- package/dist/core/IdleSaveManager.js +296 -0
- package/dist/core/IdleSaveManager.js.map +1 -0
- package/dist/core/NewGameFlowManager.d.ts +64 -0
- package/dist/core/NewGameFlowManager.d.ts.map +1 -0
- package/dist/core/NewGameFlowManager.js +153 -0
- package/dist/core/NewGameFlowManager.js.map +1 -0
- package/dist/core/Player.d.ts +65 -0
- package/dist/core/Player.d.ts.map +1 -0
- package/dist/core/Player.js +261 -0
- package/dist/core/Player.js.map +1 -0
- package/dist/core/RoomHandlers.d.ts +75 -0
- package/dist/core/RoomHandlers.d.ts.map +1 -0
- package/dist/core/RoomHandlers.js +383 -0
- package/dist/core/RoomHandlers.js.map +1 -0
- package/dist/core/SaveManager.d.ts +84 -0
- package/dist/core/SaveManager.d.ts.map +1 -0
- package/dist/core/SaveManager.js +281 -0
- package/dist/core/SaveManager.js.map +1 -0
- package/dist/core/SaveMigration.d.ts +69 -0
- package/dist/core/SaveMigration.d.ts.map +1 -0
- package/dist/core/SaveMigration.js +408 -0
- package/dist/core/SaveMigration.js.map +1 -0
- package/dist/core/StateAdapter.d.ts +79 -0
- package/dist/core/StateAdapter.d.ts.map +1 -0
- package/dist/core/StateAdapter.js +397 -0
- package/dist/core/StateAdapter.js.map +1 -0
- package/dist/core/Team.d.ts +145 -0
- package/dist/core/Team.d.ts.map +1 -0
- package/dist/core/Team.js +371 -0
- package/dist/core/Team.js.map +1 -0
- package/dist/core/TeamCombat.d.ts +88 -0
- package/dist/core/TeamCombat.d.ts.map +1 -0
- package/dist/core/TeamCombat.js +405 -0
- package/dist/core/TeamCombat.js.map +1 -0
- package/dist/core/TeamDungeonRunner.d.ts +186 -0
- package/dist/core/TeamDungeonRunner.d.ts.map +1 -0
- package/dist/core/TeamDungeonRunner.js +758 -0
- package/dist/core/TeamDungeonRunner.js.map +1 -0
- package/dist/core/TimeManager.d.ts +114 -0
- package/dist/core/TimeManager.d.ts.map +1 -0
- package/dist/core/TimeManager.js +318 -0
- package/dist/core/TimeManager.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/timeConstants.d.ts +135 -0
- package/dist/core/timeConstants.d.ts.map +1 -0
- package/dist/core/timeConstants.js +157 -0
- package/dist/core/timeConstants.js.map +1 -0
- package/dist/core/types.d.ts +780 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/data/continents/index.d.ts +163 -0
- package/dist/data/continents/index.d.ts.map +1 -0
- package/dist/data/continents/index.js +31 -0
- package/dist/data/continents/index.js.map +1 -0
- package/dist/data/continents/verdantia.d.ts +294 -0
- package/dist/data/continents/verdantia.d.ts.map +1 -0
- package/dist/data/continents/verdantia.js +327 -0
- package/dist/data/continents/verdantia.js.map +1 -0
- package/dist/handlers/DialogHandler.d.ts +95 -0
- package/dist/handlers/DialogHandler.d.ts.map +1 -0
- package/dist/handlers/DialogHandler.js +450 -0
- package/dist/handlers/DialogHandler.js.map +1 -0
- package/dist/handlers/SaveLoadHandler.d.ts +60 -0
- package/dist/handlers/SaveLoadHandler.d.ts.map +1 -0
- package/dist/handlers/SaveLoadHandler.js +187 -0
- package/dist/handlers/SaveLoadHandler.js.map +1 -0
- package/dist/handlers/TitleScreenHandler.d.ts +43 -0
- package/dist/handlers/TitleScreenHandler.d.ts.map +1 -0
- package/dist/handlers/TitleScreenHandler.js +508 -0
- package/dist/handlers/TitleScreenHandler.js.map +1 -0
- package/dist/handlers/WorkshopHandler.d.ts +75 -0
- package/dist/handlers/WorkshopHandler.d.ts.map +1 -0
- package/dist/handlers/WorkshopHandler.js +401 -0
- package/dist/handlers/WorkshopHandler.js.map +1 -0
- package/dist/handlers/index.d.ts +12 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +14 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/types.d.ts +34 -0
- package/dist/handlers/types.d.ts.map +1 -0
- package/dist/handlers/types.js +8 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +130 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +40 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +105 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/types.d.ts +133 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +8 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/zh.d.ts +3 -0
- package/dist/i18n/zh.d.ts.map +1 -0
- package/dist/i18n/zh.js +130 -0
- package/dist/i18n/zh.js.map +1 -0
- package/dist/instrument.d.ts +8 -0
- package/dist/instrument.d.ts.map +1 -0
- package/dist/instrument.js +33 -0
- package/dist/instrument.js.map +1 -0
- package/dist/main-new.d.ts +12 -0
- package/dist/main-new.d.ts.map +1 -0
- package/dist/main-new.js +32 -0
- package/dist/main-new.js.map +1 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +2816 -0
- package/dist/main.js.map +1 -0
- package/dist/map/ContinentManager.d.ts +88 -0
- package/dist/map/ContinentManager.d.ts.map +1 -0
- package/dist/map/ContinentManager.js +241 -0
- package/dist/map/ContinentManager.js.map +1 -0
- package/dist/map/DungeonGenerator.d.ts +32 -0
- package/dist/map/DungeonGenerator.d.ts.map +1 -0
- package/dist/map/DungeonGenerator.js +615 -0
- package/dist/map/DungeonGenerator.js.map +1 -0
- package/dist/map/MapGenerator.d.ts +27 -0
- package/dist/map/MapGenerator.d.ts.map +1 -0
- package/dist/map/MapGenerator.js +485 -0
- package/dist/map/MapGenerator.js.map +1 -0
- package/dist/map/index.d.ts +5 -0
- package/dist/map/index.d.ts.map +1 -0
- package/dist/map/index.js +8 -0
- package/dist/map/index.js.map +1 -0
- package/dist/npc/NPCGenerator.d.ts +68 -0
- package/dist/npc/NPCGenerator.d.ts.map +1 -0
- package/dist/npc/NPCGenerator.js +468 -0
- package/dist/npc/NPCGenerator.js.map +1 -0
- package/dist/npc/NPCManager.d.ts +86 -0
- package/dist/npc/NPCManager.d.ts.map +1 -0
- package/dist/npc/NPCManager.js +217 -0
- package/dist/npc/NPCManager.js.map +1 -0
- package/dist/npc/fixedNPCs.d.ts +7 -0
- package/dist/npc/fixedNPCs.d.ts.map +1 -0
- package/dist/npc/fixedNPCs.js +196 -0
- package/dist/npc/fixedNPCs.js.map +1 -0
- package/dist/npc/index.d.ts +9 -0
- package/dist/npc/index.d.ts.map +1 -0
- package/dist/npc/index.js +12 -0
- package/dist/npc/index.js.map +1 -0
- package/dist/npc/traits.d.ts +33 -0
- package/dist/npc/traits.d.ts.map +1 -0
- package/dist/npc/traits.js +795 -0
- package/dist/npc/traits.js.map +1 -0
- package/dist/npc/types.d.ts +193 -0
- package/dist/npc/types.d.ts.map +1 -0
- package/dist/npc/types.js +9 -0
- package/dist/npc/types.js.map +1 -0
- package/dist/quest/QuestManager.d.ts +79 -0
- package/dist/quest/QuestManager.d.ts.map +1 -0
- package/dist/quest/QuestManager.js +273 -0
- package/dist/quest/QuestManager.js.map +1 -0
- package/dist/quest/index.d.ts +6 -0
- package/dist/quest/index.d.ts.map +1 -0
- package/dist/quest/index.js +9 -0
- package/dist/quest/index.js.map +1 -0
- package/dist/quest/types.d.ts +81 -0
- package/dist/quest/types.d.ts.map +1 -0
- package/dist/quest/types.js +8 -0
- package/dist/quest/types.js.map +1 -0
- package/dist/strategy/StrategyExecutor.d.ts +159 -0
- package/dist/strategy/StrategyExecutor.d.ts.map +1 -0
- package/dist/strategy/StrategyExecutor.js +479 -0
- package/dist/strategy/StrategyExecutor.js.map +1 -0
- package/dist/strategy/StrategyParser.d.ts +48 -0
- package/dist/strategy/StrategyParser.d.ts.map +1 -0
- package/dist/strategy/StrategyParser.js +321 -0
- package/dist/strategy/StrategyParser.js.map +1 -0
- package/dist/strategy/defaultStrategy.d.ts +40 -0
- package/dist/strategy/defaultStrategy.d.ts.map +1 -0
- package/dist/strategy/defaultStrategy.js +254 -0
- package/dist/strategy/defaultStrategy.js.map +1 -0
- package/dist/strategy/index.d.ts +8 -0
- package/dist/strategy/index.d.ts.map +1 -0
- package/dist/strategy/index.js +14 -0
- package/dist/strategy/index.js.map +1 -0
- package/dist/tui/ExploreMenu.d.ts +106 -0
- package/dist/tui/ExploreMenu.d.ts.map +1 -0
- package/dist/tui/ExploreMenu.js +282 -0
- package/dist/tui/ExploreMenu.js.map +1 -0
- package/dist/tui/GameUI.d.ts +313 -0
- package/dist/tui/GameUI.d.ts.map +1 -0
- package/dist/tui/GameUI.js +2116 -0
- package/dist/tui/GameUI.js.map +1 -0
- package/dist/tui/GameUIAdapter.d.ts +207 -0
- package/dist/tui/GameUIAdapter.d.ts.map +1 -0
- package/dist/tui/GameUIAdapter.js +1342 -0
- package/dist/tui/GameUIAdapter.js.map +1 -0
- package/dist/tui/Input.d.ts +139 -0
- package/dist/tui/Input.d.ts.map +1 -0
- package/dist/tui/Input.js +278 -0
- package/dist/tui/Input.js.map +1 -0
- package/dist/tui/Menu.d.ts +110 -0
- package/dist/tui/Menu.d.ts.map +1 -0
- package/dist/tui/Menu.js +365 -0
- package/dist/tui/Menu.js.map +1 -0
- package/dist/tui/Screen.d.ts +228 -0
- package/dist/tui/Screen.d.ts.map +1 -0
- package/dist/tui/Screen.js +502 -0
- package/dist/tui/Screen.js.map +1 -0
- package/dist/tui/components/Box.d.ts +36 -0
- package/dist/tui/components/Box.d.ts.map +1 -0
- package/dist/tui/components/Box.js +43 -0
- package/dist/tui/components/Box.js.map +1 -0
- package/dist/tui/components/List.d.ts +69 -0
- package/dist/tui/components/List.d.ts.map +1 -0
- package/dist/tui/components/List.js +136 -0
- package/dist/tui/components/List.js.map +1 -0
- package/dist/tui/components/ProgressBar.d.ts +42 -0
- package/dist/tui/components/ProgressBar.d.ts.map +1 -0
- package/dist/tui/components/ProgressBar.js +75 -0
- package/dist/tui/components/ProgressBar.js.map +1 -0
- package/dist/tui/components/index.d.ts +8 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js +11 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/core/BaseSection.d.ts +98 -0
- package/dist/tui/core/BaseSection.d.ts.map +1 -0
- package/dist/tui/core/BaseSection.js +174 -0
- package/dist/tui/core/BaseSection.js.map +1 -0
- package/dist/tui/core/Component.d.ts +61 -0
- package/dist/tui/core/Component.d.ts.map +1 -0
- package/dist/tui/core/Component.js +32 -0
- package/dist/tui/core/Component.js.map +1 -0
- package/dist/tui/core/Section.d.ts +101 -0
- package/dist/tui/core/Section.d.ts.map +1 -0
- package/dist/tui/core/Section.js +24 -0
- package/dist/tui/core/Section.js.map +1 -0
- package/dist/tui/core/SectionManager.d.ts +108 -0
- package/dist/tui/core/SectionManager.d.ts.map +1 -0
- package/dist/tui/core/SectionManager.js +258 -0
- package/dist/tui/core/SectionManager.js.map +1 -0
- package/dist/tui/core/index.d.ts +9 -0
- package/dist/tui/core/index.d.ts.map +1 -0
- package/dist/tui/core/index.js +12 -0
- package/dist/tui/core/index.js.map +1 -0
- package/dist/tui/index.d.ts +15 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +23 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/screens/BaseScreen.d.ts +62 -0
- package/dist/tui/screens/BaseScreen.d.ts.map +1 -0
- package/dist/tui/screens/BaseScreen.js +55 -0
- package/dist/tui/screens/BaseScreen.js.map +1 -0
- package/dist/tui/screens/CombatScreen.d.ts +43 -0
- package/dist/tui/screens/CombatScreen.d.ts.map +1 -0
- package/dist/tui/screens/CombatScreen.js +125 -0
- package/dist/tui/screens/CombatScreen.js.map +1 -0
- package/dist/tui/screens/DialogScreen.d.ts +53 -0
- package/dist/tui/screens/DialogScreen.d.ts.map +1 -0
- package/dist/tui/screens/DialogScreen.js +90 -0
- package/dist/tui/screens/DialogScreen.js.map +1 -0
- package/dist/tui/screens/DungeonScreen.d.ts +80 -0
- package/dist/tui/screens/DungeonScreen.d.ts.map +1 -0
- package/dist/tui/screens/DungeonScreen.js +317 -0
- package/dist/tui/screens/DungeonScreen.js.map +1 -0
- package/dist/tui/screens/ExploreScreen.d.ts +69 -0
- package/dist/tui/screens/ExploreScreen.d.ts.map +1 -0
- package/dist/tui/screens/ExploreScreen.js +224 -0
- package/dist/tui/screens/ExploreScreen.js.map +1 -0
- package/dist/tui/screens/SectionScreen.d.ts +84 -0
- package/dist/tui/screens/SectionScreen.d.ts.map +1 -0
- package/dist/tui/screens/SectionScreen.js +156 -0
- package/dist/tui/screens/SectionScreen.js.map +1 -0
- package/dist/tui/screens/TitleScreen.d.ts +40 -0
- package/dist/tui/screens/TitleScreen.d.ts.map +1 -0
- package/dist/tui/screens/TitleScreen.js +253 -0
- package/dist/tui/screens/TitleScreen.js.map +1 -0
- package/dist/tui/screens/TownScreen.d.ts +98 -0
- package/dist/tui/screens/TownScreen.d.ts.map +1 -0
- package/dist/tui/screens/TownScreen.js +370 -0
- package/dist/tui/screens/TownScreen.js.map +1 -0
- package/dist/tui/screens/TravelScreen.d.ts +67 -0
- package/dist/tui/screens/TravelScreen.d.ts.map +1 -0
- package/dist/tui/screens/TravelScreen.js +286 -0
- package/dist/tui/screens/TravelScreen.js.map +1 -0
- package/dist/tui/screens/index.d.ts +8 -0
- package/dist/tui/screens/index.d.ts.map +1 -0
- package/dist/tui/screens/index.js +17 -0
- package/dist/tui/screens/index.js.map +1 -0
- package/dist/tui/sections/ActionsSection.d.ts +71 -0
- package/dist/tui/sections/ActionsSection.d.ts.map +1 -0
- package/dist/tui/sections/ActionsSection.js +184 -0
- package/dist/tui/sections/ActionsSection.js.map +1 -0
- package/dist/tui/sections/DungeonSection.d.ts +65 -0
- package/dist/tui/sections/DungeonSection.d.ts.map +1 -0
- package/dist/tui/sections/DungeonSection.js +144 -0
- package/dist/tui/sections/DungeonSection.js.map +1 -0
- package/dist/tui/sections/EventsSection.d.ts +50 -0
- package/dist/tui/sections/EventsSection.d.ts.map +1 -0
- package/dist/tui/sections/EventsSection.js +134 -0
- package/dist/tui/sections/EventsSection.js.map +1 -0
- package/dist/tui/sections/MapSection.d.ts +66 -0
- package/dist/tui/sections/MapSection.d.ts.map +1 -0
- package/dist/tui/sections/MapSection.js +669 -0
- package/dist/tui/sections/MapSection.js.map +1 -0
- package/dist/tui/sections/StatusSection.d.ts +47 -0
- package/dist/tui/sections/StatusSection.d.ts.map +1 -0
- package/dist/tui/sections/StatusSection.js +133 -0
- package/dist/tui/sections/StatusSection.js.map +1 -0
- package/dist/tui/sections/TeamSection.d.ts +71 -0
- package/dist/tui/sections/TeamSection.d.ts.map +1 -0
- package/dist/tui/sections/TeamSection.js +224 -0
- package/dist/tui/sections/TeamSection.js.map +1 -0
- package/dist/tui/sections/TravelingSection.d.ts +51 -0
- package/dist/tui/sections/TravelingSection.d.ts.map +1 -0
- package/dist/tui/sections/TravelingSection.js +106 -0
- package/dist/tui/sections/TravelingSection.js.map +1 -0
- package/dist/tui/sections/index.d.ts +9 -0
- package/dist/tui/sections/index.d.ts.map +1 -0
- package/dist/tui/sections/index.js +12 -0
- package/dist/tui/sections/index.js.map +1 -0
- package/dist/ui/Terminal.d.ts +68 -0
- package/dist/ui/Terminal.d.ts.map +1 -0
- package/dist/ui/Terminal.js +297 -0
- package/dist/ui/Terminal.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +8 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/utils/configMigration.d.ts +14 -0
- package/dist/utils/configMigration.d.ts.map +1 -0
- package/dist/utils/configMigration.js +92 -0
- package/dist/utils/configMigration.js.map +1 -0
- package/dist/utils/errorHandler.d.ts +86 -0
- package/dist/utils/errorHandler.d.ts.map +1 -0
- package/dist/utils/errorHandler.js +224 -0
- package/dist/utils/errorHandler.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/weapon/WeaponFactory.d.ts +32 -0
- package/dist/weapon/WeaponFactory.d.ts.map +1 -0
- package/dist/weapon/WeaponFactory.js +216 -0
- package/dist/weapon/WeaponFactory.js.map +1 -0
- package/dist/weapon/index.d.ts +5 -0
- package/dist/weapon/index.d.ts.map +1 -0
- package/dist/weapon/index.js +8 -0
- package/dist/weapon/index.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdleGameManager - Orchestrates the IdleRPG game flow
|
|
3
|
+
*
|
|
4
|
+
* Manages the game state machine:
|
|
5
|
+
* - Town phase: Player is in town, can select facilities/dungeons
|
|
6
|
+
* - Travel phase: Moving between locations
|
|
7
|
+
* - Dungeon phase: Auto-exploration via DungeonRunner
|
|
8
|
+
* - Return phase: Returning to town after dungeon
|
|
9
|
+
*
|
|
10
|
+
* Supports both legacy single-player and new team system:
|
|
11
|
+
* - Legacy: Uses Player directly with DungeonRunner
|
|
12
|
+
* - Team: Uses Team and Actors with TeamDungeonRunner
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
!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]="327a0b71-de3f-5f09-80ce-527e701e88ac")}catch(e){}}();
|
|
16
|
+
import { createDungeonRunner } from './DungeonRunner.js';
|
|
17
|
+
import { createTeamDungeonRunner } from './TeamDungeonRunner.js';
|
|
18
|
+
import { getContinentManager } from '../map/ContinentManager.js';
|
|
19
|
+
import { generateDungeon } from '../map/DungeonGenerator.js';
|
|
20
|
+
import { DEFAULT_STRATEGY } from '../strategy/defaultStrategy.js';
|
|
21
|
+
import { VERDANTIA } from '../data/continents/verdantia.js';
|
|
22
|
+
import { playerToActor } from './Actor.js';
|
|
23
|
+
import { createTeamWithActor, getActiveMembers } from './Team.js';
|
|
24
|
+
import { getTeamLeaderAsPlayer } from './StateAdapter.js';
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// IdleGameManager
|
|
27
|
+
// ============================================================================
|
|
28
|
+
export class IdleGameManager {
|
|
29
|
+
state = null;
|
|
30
|
+
callbacks = {};
|
|
31
|
+
continentManager;
|
|
32
|
+
tickInterval = null;
|
|
33
|
+
travelStartTime = 0;
|
|
34
|
+
constructor() {
|
|
35
|
+
this.continentManager = getContinentManager();
|
|
36
|
+
// Load the starting continent
|
|
37
|
+
this.continentManager.loadContinent(VERDANTIA);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Initialize game with player (legacy single-player mode)
|
|
41
|
+
*/
|
|
42
|
+
initialize(player) {
|
|
43
|
+
const startTown = this.continentManager.getTown('willowbrook');
|
|
44
|
+
if (!startTown) {
|
|
45
|
+
throw new Error('Starting town not found');
|
|
46
|
+
}
|
|
47
|
+
this.state = {
|
|
48
|
+
phase: 'in_town',
|
|
49
|
+
player,
|
|
50
|
+
currentTown: startTown,
|
|
51
|
+
currentDungeon: null,
|
|
52
|
+
dungeonRunner: null,
|
|
53
|
+
strategy: DEFAULT_STRATEGY,
|
|
54
|
+
travelProgress: 0,
|
|
55
|
+
travelDuration: 0,
|
|
56
|
+
eventLog: [],
|
|
57
|
+
statistics: {
|
|
58
|
+
dungeonsCleared: 0,
|
|
59
|
+
dungeonsAttempted: 0,
|
|
60
|
+
enemiesKilled: 0,
|
|
61
|
+
goldEarned: 0,
|
|
62
|
+
deathCount: 0,
|
|
63
|
+
totalPlayTime: 0,
|
|
64
|
+
},
|
|
65
|
+
isTeamMode: false,
|
|
66
|
+
};
|
|
67
|
+
this.startTick();
|
|
68
|
+
this.log(`Welcome to ${startTown.name}!`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Initialize game with team (new team mode)
|
|
72
|
+
*/
|
|
73
|
+
initializeWithTeam(team, actors) {
|
|
74
|
+
const startTown = this.continentManager.getTown('willowbrook');
|
|
75
|
+
if (!startTown) {
|
|
76
|
+
throw new Error('Starting town not found');
|
|
77
|
+
}
|
|
78
|
+
// Get team leader as the "player" for legacy compatibility
|
|
79
|
+
const leader = getTeamLeaderAsPlayer(team, actors);
|
|
80
|
+
if (!leader) {
|
|
81
|
+
throw new Error('Team has no leader');
|
|
82
|
+
}
|
|
83
|
+
this.state = {
|
|
84
|
+
phase: 'in_town',
|
|
85
|
+
player: leader,
|
|
86
|
+
currentTown: startTown,
|
|
87
|
+
currentDungeon: null,
|
|
88
|
+
dungeonRunner: null,
|
|
89
|
+
strategy: team.strategy,
|
|
90
|
+
travelProgress: 0,
|
|
91
|
+
travelDuration: 0,
|
|
92
|
+
eventLog: [],
|
|
93
|
+
statistics: {
|
|
94
|
+
dungeonsCleared: 0,
|
|
95
|
+
dungeonsAttempted: 0,
|
|
96
|
+
enemiesKilled: 0,
|
|
97
|
+
goldEarned: 0,
|
|
98
|
+
deathCount: 0,
|
|
99
|
+
totalPlayTime: 0,
|
|
100
|
+
},
|
|
101
|
+
// Team system fields
|
|
102
|
+
team,
|
|
103
|
+
actors,
|
|
104
|
+
teamDungeonRunner: null,
|
|
105
|
+
isTeamMode: true,
|
|
106
|
+
};
|
|
107
|
+
this.startTick();
|
|
108
|
+
this.log(`Team ${team.name} arrives at ${startTown.name}!`);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Convert current single-player game to team mode
|
|
112
|
+
* Useful for migration during gameplay
|
|
113
|
+
*/
|
|
114
|
+
convertToTeamMode() {
|
|
115
|
+
if (!this.state || this.state.isTeamMode)
|
|
116
|
+
return;
|
|
117
|
+
// Convert player to actor
|
|
118
|
+
const actor = playerToActor(this.state.player);
|
|
119
|
+
// Create team with the actor
|
|
120
|
+
const team = createTeamWithActor(actor, `${actor.name}'s Team`);
|
|
121
|
+
// Store actors
|
|
122
|
+
const actors = { [actor.id]: actor };
|
|
123
|
+
// Update state
|
|
124
|
+
this.state.team = team;
|
|
125
|
+
this.state.actors = actors;
|
|
126
|
+
this.state.isTeamMode = true;
|
|
127
|
+
this.log('Converted to team mode');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Set callbacks
|
|
131
|
+
*/
|
|
132
|
+
setCallbacks(callbacks) {
|
|
133
|
+
this.callbacks = { ...this.callbacks, ...callbacks };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Start game tick
|
|
137
|
+
*/
|
|
138
|
+
startTick() {
|
|
139
|
+
if (this.tickInterval)
|
|
140
|
+
return;
|
|
141
|
+
this.tickInterval = setInterval(() => {
|
|
142
|
+
this.tick();
|
|
143
|
+
}, 1000);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Stop game tick
|
|
147
|
+
*/
|
|
148
|
+
stopTick() {
|
|
149
|
+
if (this.tickInterval) {
|
|
150
|
+
clearInterval(this.tickInterval);
|
|
151
|
+
this.tickInterval = null;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Main game tick
|
|
156
|
+
*/
|
|
157
|
+
tick() {
|
|
158
|
+
if (!this.state)
|
|
159
|
+
return;
|
|
160
|
+
this.state.statistics.totalPlayTime++;
|
|
161
|
+
switch (this.state.phase) {
|
|
162
|
+
case 'traveling_to_dungeon':
|
|
163
|
+
case 'returning_to_town':
|
|
164
|
+
this.processTravelTick();
|
|
165
|
+
break;
|
|
166
|
+
case 'resting':
|
|
167
|
+
this.processRestTick();
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Process travel tick
|
|
173
|
+
*/
|
|
174
|
+
processTravelTick() {
|
|
175
|
+
if (!this.state)
|
|
176
|
+
return;
|
|
177
|
+
const elapsed = (Date.now() - this.travelStartTime) / 1000;
|
|
178
|
+
this.state.travelProgress = Math.min(elapsed / this.state.travelDuration, 1);
|
|
179
|
+
this.callbacks.onTravelProgress?.(this.state.travelProgress, this.state.travelDuration);
|
|
180
|
+
if (this.state.travelProgress >= 1) {
|
|
181
|
+
if (this.state.phase === 'traveling_to_dungeon') {
|
|
182
|
+
this.enterDungeon();
|
|
183
|
+
}
|
|
184
|
+
else if (this.state.phase === 'returning_to_town') {
|
|
185
|
+
this.arriveAtTown();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Process rest tick
|
|
191
|
+
*/
|
|
192
|
+
processRestTick() {
|
|
193
|
+
if (!this.state)
|
|
194
|
+
return;
|
|
195
|
+
// Heal 10% per second
|
|
196
|
+
const healRate = this.state.player.stats.maxHp * 0.1;
|
|
197
|
+
this.state.player.stats.hp = Math.min(this.state.player.stats.maxHp, this.state.player.stats.hp + healRate);
|
|
198
|
+
const manaRate = this.state.player.stats.maxMp * 0.1;
|
|
199
|
+
this.state.player.stats.mp = Math.min(this.state.player.stats.maxMp, this.state.player.stats.mp + manaRate);
|
|
200
|
+
this.callbacks.onPlayerUpdate?.(this.state.player);
|
|
201
|
+
// Check if fully healed
|
|
202
|
+
if (this.state.player.stats.hp >= this.state.player.stats.maxHp &&
|
|
203
|
+
this.state.player.stats.mp >= this.state.player.stats.maxMp) {
|
|
204
|
+
this.state.phase = 'in_town';
|
|
205
|
+
this.log('You are fully rested!');
|
|
206
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// ============================================================================
|
|
210
|
+
// Town Actions
|
|
211
|
+
// ============================================================================
|
|
212
|
+
/**
|
|
213
|
+
* Select a dungeon to enter
|
|
214
|
+
*/
|
|
215
|
+
selectDungeon(dungeonId) {
|
|
216
|
+
if (!this.state || this.state.phase !== 'in_town')
|
|
217
|
+
return false;
|
|
218
|
+
const dungeonTemplate = this.continentManager.getDungeon(dungeonId);
|
|
219
|
+
if (!dungeonTemplate) {
|
|
220
|
+
this.log('Dungeon not found!');
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
// Convert template to generator config and generate dungeon
|
|
224
|
+
const config = this.createDungeonConfig(dungeonTemplate);
|
|
225
|
+
const dungeon = generateDungeon(config);
|
|
226
|
+
this.state.currentDungeon = dungeon;
|
|
227
|
+
this.state.statistics.dungeonsAttempted++;
|
|
228
|
+
// Start travel to dungeon
|
|
229
|
+
this.state.phase = 'traveling_to_dungeon';
|
|
230
|
+
this.state.travelDuration = dungeon.travelTimeFromTown;
|
|
231
|
+
this.state.travelProgress = 0;
|
|
232
|
+
this.travelStartTime = Date.now();
|
|
233
|
+
this.log(`Traveling to ${dungeon.name}... (${Math.floor(this.state.travelDuration / 60)} min)`);
|
|
234
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Use a facility
|
|
239
|
+
*/
|
|
240
|
+
useFacility(facility) {
|
|
241
|
+
if (!this.state || this.state.phase !== 'in_town')
|
|
242
|
+
return false;
|
|
243
|
+
switch (facility.type) {
|
|
244
|
+
case 'inn':
|
|
245
|
+
this.state.phase = 'resting';
|
|
246
|
+
this.log('Resting at the inn...');
|
|
247
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
248
|
+
return true;
|
|
249
|
+
case 'shop':
|
|
250
|
+
this.log('Shop system not yet implemented');
|
|
251
|
+
return false;
|
|
252
|
+
case 'blacksmith':
|
|
253
|
+
this.log('Blacksmith system not yet implemented');
|
|
254
|
+
return false;
|
|
255
|
+
default:
|
|
256
|
+
this.log(`${facility.name} is not available yet`);
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Update strategy
|
|
262
|
+
*/
|
|
263
|
+
setStrategy(strategy) {
|
|
264
|
+
if (!this.state)
|
|
265
|
+
return;
|
|
266
|
+
this.state.strategy = strategy;
|
|
267
|
+
this.log('Strategy updated!');
|
|
268
|
+
}
|
|
269
|
+
// ============================================================================
|
|
270
|
+
// Dungeon Phase
|
|
271
|
+
// ============================================================================
|
|
272
|
+
/**
|
|
273
|
+
* Enter dungeon after travel
|
|
274
|
+
*/
|
|
275
|
+
enterDungeon() {
|
|
276
|
+
if (!this.state || !this.state.currentDungeon)
|
|
277
|
+
return;
|
|
278
|
+
this.state.phase = 'in_dungeon';
|
|
279
|
+
this.log(`Entered ${this.state.currentDungeon.name}`);
|
|
280
|
+
// Use team dungeon runner if in team mode
|
|
281
|
+
if (this.state.isTeamMode && this.state.team && this.state.actors) {
|
|
282
|
+
this.enterDungeonWithTeam();
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
this.enterDungeonLegacy();
|
|
286
|
+
}
|
|
287
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Enter dungeon with team (new team mode)
|
|
291
|
+
*/
|
|
292
|
+
enterDungeonWithTeam() {
|
|
293
|
+
if (!this.state || !this.state.currentDungeon || !this.state.team || !this.state.actors)
|
|
294
|
+
return;
|
|
295
|
+
// Create team dungeon runner
|
|
296
|
+
const runner = createTeamDungeonRunner(this.state.team, this.state.actors);
|
|
297
|
+
this.state.teamDungeonRunner = runner;
|
|
298
|
+
// Set up callbacks
|
|
299
|
+
runner.setCallbacks({
|
|
300
|
+
onPhaseChange: (phase, runnerState) => {
|
|
301
|
+
// Convert TeamDungeonState to DungeonRunnerState for compatibility
|
|
302
|
+
const compatState = this.convertTeamStateToLegacy(runnerState);
|
|
303
|
+
this.callbacks.onDungeonProgress?.(compatState, runnerState.activeCombat);
|
|
304
|
+
},
|
|
305
|
+
onRoomEnter: (room, runnerState) => {
|
|
306
|
+
this.log(`Team entered: ${room.name}`);
|
|
307
|
+
const compatState = this.convertTeamStateToLegacy(runnerState);
|
|
308
|
+
this.callbacks.onDungeonProgress?.(compatState, null);
|
|
309
|
+
},
|
|
310
|
+
onCombatStart: (enemies, runnerState) => {
|
|
311
|
+
const activeCount = getActiveMembers(this.state.team, this.state.actors).length;
|
|
312
|
+
this.log(`Combat started! ${activeCount} fighters vs ${enemies.length} enemies`);
|
|
313
|
+
},
|
|
314
|
+
onCombatTurn: (runnerState) => {
|
|
315
|
+
const compatState = this.convertTeamStateToLegacy(runnerState);
|
|
316
|
+
this.callbacks.onDungeonProgress?.(compatState, runnerState.activeCombat);
|
|
317
|
+
},
|
|
318
|
+
onCombatEnd: (result, runnerState) => {
|
|
319
|
+
if (result.victory) {
|
|
320
|
+
this.log(`Victory! Team gained +${result.rewards.exp} EXP, +${result.rewards.gold} Gold`);
|
|
321
|
+
this.state.statistics.enemiesKilled += runnerState.enemiesKilled;
|
|
322
|
+
}
|
|
323
|
+
const compatState = this.convertTeamStateToLegacy(runnerState);
|
|
324
|
+
this.callbacks.onDungeonProgress?.(compatState, null);
|
|
325
|
+
},
|
|
326
|
+
onActorDefeated: (actorId, actorName, runnerState) => {
|
|
327
|
+
this.log(`${actorName} was knocked out!`);
|
|
328
|
+
},
|
|
329
|
+
onActorLevelUp: (actorId, actorName, newLevel, runnerState) => {
|
|
330
|
+
this.log(`${actorName} leveled up to Lv${newLevel}!`);
|
|
331
|
+
},
|
|
332
|
+
onLevelComplete: (level, runnerState) => {
|
|
333
|
+
this.log(`Level ${level + 1} cleared!`);
|
|
334
|
+
},
|
|
335
|
+
onDungeonComplete: (runnerState) => {
|
|
336
|
+
this.handleTeamDungeonComplete(true, runnerState);
|
|
337
|
+
},
|
|
338
|
+
onDungeonFailed: (reason, runnerState) => {
|
|
339
|
+
this.log(`Dungeon failed: ${reason}`);
|
|
340
|
+
this.handleTeamDungeonComplete(false, runnerState);
|
|
341
|
+
},
|
|
342
|
+
onEventLog: (message) => {
|
|
343
|
+
this.log(message);
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
// Start the dungeon
|
|
347
|
+
runner.startDungeon(this.state.currentDungeon, this.state.team.strategy);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Enter dungeon with legacy single player
|
|
351
|
+
*/
|
|
352
|
+
enterDungeonLegacy() {
|
|
353
|
+
if (!this.state || !this.state.currentDungeon)
|
|
354
|
+
return;
|
|
355
|
+
// Create dungeon runner
|
|
356
|
+
const runner = createDungeonRunner(this.state.player);
|
|
357
|
+
this.state.dungeonRunner = runner;
|
|
358
|
+
// Set up callbacks
|
|
359
|
+
runner.setCallbacks({
|
|
360
|
+
onPhaseChange: (phase, runnerState) => {
|
|
361
|
+
this.callbacks.onDungeonProgress?.(runnerState, runnerState.activeCombat);
|
|
362
|
+
},
|
|
363
|
+
onRoomEnter: (room, runnerState) => {
|
|
364
|
+
this.log(`Entered: ${room.name}`);
|
|
365
|
+
this.callbacks.onDungeonProgress?.(runnerState, null);
|
|
366
|
+
},
|
|
367
|
+
onCombatStart: (enemies, runnerState) => {
|
|
368
|
+
this.log(`Combat started! ${enemies.length} enemies`);
|
|
369
|
+
},
|
|
370
|
+
onCombatTurn: (result, runnerState) => {
|
|
371
|
+
this.callbacks.onDungeonProgress?.(runnerState, runnerState.activeCombat);
|
|
372
|
+
},
|
|
373
|
+
onCombatEnd: (victory, rewards, runnerState) => {
|
|
374
|
+
if (victory) {
|
|
375
|
+
this.log(`Victory! +${rewards.exp} EXP, +${rewards.gold} Gold`);
|
|
376
|
+
this.state.statistics.enemiesKilled += runnerState.enemiesKilled;
|
|
377
|
+
}
|
|
378
|
+
this.callbacks.onDungeonProgress?.(runnerState, null);
|
|
379
|
+
},
|
|
380
|
+
onLevelComplete: (level, runnerState) => {
|
|
381
|
+
this.log(`Level ${level + 1} cleared!`);
|
|
382
|
+
},
|
|
383
|
+
onDungeonComplete: (runnerState) => {
|
|
384
|
+
this.handleDungeonComplete(true, runnerState);
|
|
385
|
+
},
|
|
386
|
+
onDungeonFailed: (reason, runnerState) => {
|
|
387
|
+
this.log(`Dungeon failed: ${reason}`);
|
|
388
|
+
this.handleDungeonComplete(false, runnerState);
|
|
389
|
+
},
|
|
390
|
+
onEventLog: (message) => {
|
|
391
|
+
this.log(message);
|
|
392
|
+
},
|
|
393
|
+
});
|
|
394
|
+
// Start the dungeon
|
|
395
|
+
runner.startDungeon(this.state.currentDungeon, this.state.strategy);
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Convert TeamDungeonState to DungeonRunnerState for UI compatibility
|
|
399
|
+
*/
|
|
400
|
+
convertTeamStateToLegacy(teamState) {
|
|
401
|
+
return {
|
|
402
|
+
phase: teamState.phase,
|
|
403
|
+
dungeon: teamState.dungeon,
|
|
404
|
+
currentLevel: teamState.currentLevel,
|
|
405
|
+
currentRoomId: teamState.currentRoomId,
|
|
406
|
+
exploredRooms: teamState.exploredRooms,
|
|
407
|
+
clearedRooms: teamState.clearedRooms,
|
|
408
|
+
strategy: teamState.strategy,
|
|
409
|
+
strategyExecutor: teamState.strategyExecutor,
|
|
410
|
+
activeCombat: teamState.activeCombat,
|
|
411
|
+
lootCollected: teamState.lootCollected,
|
|
412
|
+
goldCollected: teamState.goldCollected,
|
|
413
|
+
expGained: teamState.expGained,
|
|
414
|
+
enemiesKilled: teamState.enemiesKilled,
|
|
415
|
+
startTime: teamState.startTime,
|
|
416
|
+
eventLog: teamState.eventLog,
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Handle team dungeon completion
|
|
421
|
+
*/
|
|
422
|
+
handleTeamDungeonComplete(success, runnerState) {
|
|
423
|
+
if (!this.state || !this.state.team)
|
|
424
|
+
return;
|
|
425
|
+
// Gold is already added to team in TeamDungeonRunner
|
|
426
|
+
// Update player for UI compatibility
|
|
427
|
+
this.state.player.stats.gold = this.state.team.sharedGold;
|
|
428
|
+
const rewards = {
|
|
429
|
+
gold: runnerState.goldCollected,
|
|
430
|
+
exp: runnerState.expGained,
|
|
431
|
+
items: runnerState.lootCollected.map(i => i.name),
|
|
432
|
+
};
|
|
433
|
+
if (success) {
|
|
434
|
+
this.state.statistics.dungeonsCleared++;
|
|
435
|
+
this.state.statistics.goldEarned += runnerState.goldCollected;
|
|
436
|
+
this.log(`Dungeon cleared! Rewards: ${rewards.gold} gold, ${rewards.exp} exp`);
|
|
437
|
+
}
|
|
438
|
+
// Check for team wipe
|
|
439
|
+
const aliveActors = this.state.team.activeMembers.filter(id => {
|
|
440
|
+
const actor = this.state.actors[id];
|
|
441
|
+
return actor && actor.stats.hp > 0;
|
|
442
|
+
});
|
|
443
|
+
if (aliveActors.length === 0) {
|
|
444
|
+
this.handleTeamDeath();
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
// Convert to legacy DungeonRunnerState for callback
|
|
448
|
+
const compatState = this.convertTeamStateToLegacy(runnerState);
|
|
449
|
+
this.callbacks.onDungeonComplete?.(success, rewards);
|
|
450
|
+
// Start returning to town
|
|
451
|
+
this.startReturnToTown();
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Handle team death (all members knocked out)
|
|
455
|
+
*/
|
|
456
|
+
handleTeamDeath() {
|
|
457
|
+
if (!this.state)
|
|
458
|
+
return;
|
|
459
|
+
this.state.phase = 'dead';
|
|
460
|
+
this.state.statistics.deathCount++;
|
|
461
|
+
this.state.teamDungeonRunner = null;
|
|
462
|
+
this.state.dungeonRunner = null;
|
|
463
|
+
this.log('The entire team has been defeated...');
|
|
464
|
+
this.callbacks.onPlayerDeath?.();
|
|
465
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Handle dungeon completion
|
|
469
|
+
*/
|
|
470
|
+
handleDungeonComplete(success, runnerState) {
|
|
471
|
+
if (!this.state)
|
|
472
|
+
return;
|
|
473
|
+
// Update player with dungeon results (HP is updated via combat callbacks)
|
|
474
|
+
this.state.player.stats.gold += runnerState.goldCollected;
|
|
475
|
+
const rewards = {
|
|
476
|
+
gold: runnerState.goldCollected,
|
|
477
|
+
exp: runnerState.expGained,
|
|
478
|
+
items: runnerState.lootCollected.map(i => i.name),
|
|
479
|
+
};
|
|
480
|
+
if (success) {
|
|
481
|
+
this.state.statistics.dungeonsCleared++;
|
|
482
|
+
this.state.statistics.goldEarned += runnerState.goldCollected;
|
|
483
|
+
this.log(`Dungeon cleared! Rewards: ${rewards.gold} gold, ${rewards.exp} exp`);
|
|
484
|
+
}
|
|
485
|
+
// Check for death
|
|
486
|
+
if (this.state.player.stats.hp <= 0) {
|
|
487
|
+
this.handlePlayerDeath();
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
this.callbacks.onDungeonComplete?.(success, rewards);
|
|
491
|
+
// Start returning to town
|
|
492
|
+
this.startReturnToTown();
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Abort current dungeon run
|
|
496
|
+
*/
|
|
497
|
+
abortDungeon() {
|
|
498
|
+
if (!this.state || this.state.phase !== 'in_dungeon')
|
|
499
|
+
return;
|
|
500
|
+
this.state.dungeonRunner?.abort();
|
|
501
|
+
this.log('Retreating from dungeon...');
|
|
502
|
+
this.startReturnToTown();
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Cancel current travel and return to town immediately
|
|
506
|
+
*/
|
|
507
|
+
cancelTravel() {
|
|
508
|
+
if (!this.state)
|
|
509
|
+
return false;
|
|
510
|
+
if (this.state.phase !== 'traveling_to_dungeon' && this.state.phase !== 'returning_to_town') {
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
// Reset to town state
|
|
514
|
+
this.state.phase = 'in_town';
|
|
515
|
+
this.state.travelProgress = 0;
|
|
516
|
+
this.state.travelDuration = 0;
|
|
517
|
+
this.state.currentDungeon = null;
|
|
518
|
+
this.travelStartTime = 0;
|
|
519
|
+
this.log('Travel cancelled. Returned to town.');
|
|
520
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Pause dungeon exploration
|
|
525
|
+
*/
|
|
526
|
+
pauseDungeon() {
|
|
527
|
+
this.state?.dungeonRunner?.pause();
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Resume dungeon exploration
|
|
531
|
+
*/
|
|
532
|
+
resumeDungeon() {
|
|
533
|
+
this.state?.dungeonRunner?.resume();
|
|
534
|
+
}
|
|
535
|
+
// ============================================================================
|
|
536
|
+
// Return Phase
|
|
537
|
+
// ============================================================================
|
|
538
|
+
/**
|
|
539
|
+
* Start returning to town
|
|
540
|
+
*/
|
|
541
|
+
startReturnToTown() {
|
|
542
|
+
if (!this.state)
|
|
543
|
+
return;
|
|
544
|
+
this.state.phase = 'returning_to_town';
|
|
545
|
+
this.state.dungeonRunner = null;
|
|
546
|
+
this.state.travelDuration = 120; // 2 minutes base return time
|
|
547
|
+
this.state.travelProgress = 0;
|
|
548
|
+
this.travelStartTime = Date.now();
|
|
549
|
+
this.log('Returning to town...');
|
|
550
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Arrive at town
|
|
554
|
+
*/
|
|
555
|
+
arriveAtTown() {
|
|
556
|
+
if (!this.state)
|
|
557
|
+
return;
|
|
558
|
+
this.state.phase = 'in_town';
|
|
559
|
+
this.state.currentDungeon = null;
|
|
560
|
+
this.log(`Arrived at ${this.state.currentTown.name}`);
|
|
561
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
562
|
+
this.callbacks.onPlayerUpdate?.(this.state.player);
|
|
563
|
+
}
|
|
564
|
+
// ============================================================================
|
|
565
|
+
// Death Handling
|
|
566
|
+
// ============================================================================
|
|
567
|
+
/**
|
|
568
|
+
* Handle player death
|
|
569
|
+
*/
|
|
570
|
+
handlePlayerDeath() {
|
|
571
|
+
if (!this.state)
|
|
572
|
+
return;
|
|
573
|
+
this.state.phase = 'dead';
|
|
574
|
+
this.state.statistics.deathCount++;
|
|
575
|
+
this.state.dungeonRunner = null;
|
|
576
|
+
this.log('You have been defeated...');
|
|
577
|
+
this.callbacks.onPlayerDeath?.();
|
|
578
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Respawn player
|
|
582
|
+
*/
|
|
583
|
+
respawn() {
|
|
584
|
+
if (!this.state || this.state.phase !== 'dead')
|
|
585
|
+
return;
|
|
586
|
+
// Restore HP to 50%, lose 10% gold
|
|
587
|
+
this.state.player.stats.hp = Math.floor(this.state.player.stats.maxHp * 0.5);
|
|
588
|
+
this.state.player.stats.mp = this.state.player.stats.maxMp;
|
|
589
|
+
const goldLost = Math.floor(this.state.player.stats.gold * 0.1);
|
|
590
|
+
this.state.player.stats.gold -= goldLost;
|
|
591
|
+
this.state.phase = 'in_town';
|
|
592
|
+
this.state.currentDungeon = null;
|
|
593
|
+
this.log(`Respawned at ${this.state.currentTown.name}. Lost ${goldLost} gold.`);
|
|
594
|
+
this.callbacks.onPhaseChange?.(this.state.phase, this.state);
|
|
595
|
+
this.callbacks.onPlayerUpdate?.(this.state.player);
|
|
596
|
+
}
|
|
597
|
+
// ============================================================================
|
|
598
|
+
// Utilities
|
|
599
|
+
// ============================================================================
|
|
600
|
+
/**
|
|
601
|
+
* Create dungeon generator config from template
|
|
602
|
+
*/
|
|
603
|
+
createDungeonConfig(template) {
|
|
604
|
+
// Determine number of levels based on difficulty
|
|
605
|
+
const levelsByDifficulty = {
|
|
606
|
+
easy: 3,
|
|
607
|
+
normal: 5,
|
|
608
|
+
hard: 7,
|
|
609
|
+
nightmare: 10,
|
|
610
|
+
legendary: 15,
|
|
611
|
+
};
|
|
612
|
+
const roomsByDifficulty = {
|
|
613
|
+
easy: { min: 4, max: 6 },
|
|
614
|
+
normal: { min: 5, max: 8 },
|
|
615
|
+
hard: { min: 6, max: 10 },
|
|
616
|
+
nightmare: { min: 8, max: 12 },
|
|
617
|
+
legendary: { min: 10, max: 15 },
|
|
618
|
+
};
|
|
619
|
+
return {
|
|
620
|
+
dungeonId: template.id,
|
|
621
|
+
name: template.name,
|
|
622
|
+
description: template.description,
|
|
623
|
+
continentId: template.continentId,
|
|
624
|
+
nearestTownId: template.nearestTownId,
|
|
625
|
+
difficulty: template.difficulty,
|
|
626
|
+
recommendedLevel: template.recommendedLevel,
|
|
627
|
+
numberOfLevels: levelsByDifficulty[template.difficulty] || 5,
|
|
628
|
+
roomsPerLevel: roomsByDifficulty[template.difficulty] || { min: 5, max: 8 },
|
|
629
|
+
hasBoss: template.hasBoss,
|
|
630
|
+
bossName: template.bossName,
|
|
631
|
+
seed: Date.now(),
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Log an event
|
|
636
|
+
*/
|
|
637
|
+
log(message) {
|
|
638
|
+
if (!this.state)
|
|
639
|
+
return;
|
|
640
|
+
const timestamp = new Date().toLocaleTimeString('en-US', { hour12: false });
|
|
641
|
+
const logMessage = `[${timestamp}] ${message}`;
|
|
642
|
+
this.state.eventLog.push(logMessage);
|
|
643
|
+
if (this.state.eventLog.length > 100) {
|
|
644
|
+
this.state.eventLog.shift();
|
|
645
|
+
}
|
|
646
|
+
this.callbacks.onEventLog?.(logMessage);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Get current state
|
|
650
|
+
*/
|
|
651
|
+
getState() {
|
|
652
|
+
return this.state;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Get available dungeons from current town
|
|
656
|
+
*/
|
|
657
|
+
getAvailableDungeons() {
|
|
658
|
+
if (!this.state)
|
|
659
|
+
return [];
|
|
660
|
+
return this.continentManager.getDungeonsFromTown(this.state.currentTown.id);
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Get dungeon runner for UI updates
|
|
664
|
+
*/
|
|
665
|
+
getDungeonRunner() {
|
|
666
|
+
return this.state?.dungeonRunner ?? null;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Destroy manager
|
|
670
|
+
*/
|
|
671
|
+
destroy() {
|
|
672
|
+
this.stopTick();
|
|
673
|
+
this.state?.dungeonRunner?.abort();
|
|
674
|
+
this.state = null;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
// ============================================================================
|
|
678
|
+
// Singleton
|
|
679
|
+
// ============================================================================
|
|
680
|
+
let managerInstance = null;
|
|
681
|
+
export function getIdleGameManager() {
|
|
682
|
+
if (!managerInstance) {
|
|
683
|
+
managerInstance = new IdleGameManager();
|
|
684
|
+
}
|
|
685
|
+
return managerInstance;
|
|
686
|
+
}
|
|
687
|
+
//# sourceMappingURL=IdleGameManager.js.map
|
|
688
|
+
//# debugId=327a0b71-de3f-5f09-80ce-527e701e88ac
|