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,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic affix plugin loader with VM sandbox
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="49ef7f3f-d389-511c-a830-73f13be55a30")}catch(e){}}();
|
|
6
|
+
import { createContext, Script } from 'vm';
|
|
7
|
+
import { readdir, readFile, stat, watch } from 'fs/promises';
|
|
8
|
+
import { join, extname } from 'path';
|
|
9
|
+
import { getAffixRegistry } from './AffixRegistry.js';
|
|
10
|
+
import { Sentry } from '../instrument.js';
|
|
11
|
+
const DEFAULT_CONFIG = {
|
|
12
|
+
pluginDir: './affixes',
|
|
13
|
+
watchForChanges: true,
|
|
14
|
+
timeout: 100,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a sandboxed context for plugin execution
|
|
18
|
+
*/
|
|
19
|
+
function createSandbox() {
|
|
20
|
+
return {
|
|
21
|
+
// Only expose safe globals
|
|
22
|
+
console: {
|
|
23
|
+
log: (...args) => console.log('[Plugin]', ...args),
|
|
24
|
+
warn: (...args) => console.warn('[Plugin]', ...args),
|
|
25
|
+
error: (...args) => console.error('[Plugin]', ...args),
|
|
26
|
+
},
|
|
27
|
+
// Math functions
|
|
28
|
+
Math: Object.freeze({ ...Math }),
|
|
29
|
+
// Safe built-ins
|
|
30
|
+
JSON: Object.freeze({
|
|
31
|
+
parse: JSON.parse,
|
|
32
|
+
stringify: JSON.stringify,
|
|
33
|
+
}),
|
|
34
|
+
// Array and Object methods (frozen)
|
|
35
|
+
Array: Object.freeze({
|
|
36
|
+
isArray: Array.isArray,
|
|
37
|
+
from: Array.from,
|
|
38
|
+
of: Array.of,
|
|
39
|
+
}),
|
|
40
|
+
Object: Object.freeze({
|
|
41
|
+
keys: Object.keys,
|
|
42
|
+
values: Object.values,
|
|
43
|
+
entries: Object.entries,
|
|
44
|
+
assign: Object.assign,
|
|
45
|
+
freeze: Object.freeze,
|
|
46
|
+
}),
|
|
47
|
+
// Type checking
|
|
48
|
+
typeof: (x) => typeof x,
|
|
49
|
+
isNaN: isNaN,
|
|
50
|
+
isFinite: isFinite,
|
|
51
|
+
parseInt: parseInt,
|
|
52
|
+
parseFloat: parseFloat,
|
|
53
|
+
// Prevent access to dangerous APIs
|
|
54
|
+
require: undefined,
|
|
55
|
+
process: undefined,
|
|
56
|
+
global: undefined,
|
|
57
|
+
globalThis: undefined,
|
|
58
|
+
Buffer: undefined,
|
|
59
|
+
__dirname: undefined,
|
|
60
|
+
__filename: undefined,
|
|
61
|
+
module: undefined,
|
|
62
|
+
exports: undefined,
|
|
63
|
+
import: undefined,
|
|
64
|
+
eval: undefined,
|
|
65
|
+
Function: undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Plugin Loader class
|
|
70
|
+
*/
|
|
71
|
+
export class PluginLoader {
|
|
72
|
+
config;
|
|
73
|
+
loadedPlugins = new Map();
|
|
74
|
+
watcher = null;
|
|
75
|
+
constructor(config = {}) {
|
|
76
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Load all plugins from the configured directory
|
|
80
|
+
*/
|
|
81
|
+
async loadAll() {
|
|
82
|
+
const results = [];
|
|
83
|
+
try {
|
|
84
|
+
const files = await this.getPluginFiles();
|
|
85
|
+
for (const file of files) {
|
|
86
|
+
const result = await this.loadPlugin(file);
|
|
87
|
+
results.push(result);
|
|
88
|
+
}
|
|
89
|
+
console.log(`[PluginLoader] Loaded ${results.filter(r => r.success).length}/${files.length} plugins`);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error('[PluginLoader] Failed to scan plugin directory:', error);
|
|
93
|
+
// Report plugin directory scan failure to Sentry
|
|
94
|
+
Sentry.captureException(error, {
|
|
95
|
+
tags: { operation: 'plugin_scan', fallback: true },
|
|
96
|
+
extra: { pluginDir: this.config.pluginDir },
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return results;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get list of plugin files
|
|
103
|
+
*/
|
|
104
|
+
async getPluginFiles() {
|
|
105
|
+
const files = [];
|
|
106
|
+
try {
|
|
107
|
+
const entries = await readdir(this.config.pluginDir);
|
|
108
|
+
for (const entry of entries) {
|
|
109
|
+
const ext = extname(entry);
|
|
110
|
+
if (ext === '.js' || ext === '.mjs') {
|
|
111
|
+
files.push(join(this.config.pluginDir, entry));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
// Directory might not exist yet
|
|
117
|
+
console.log('[PluginLoader] Plugin directory not found, skipping');
|
|
118
|
+
}
|
|
119
|
+
return files;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Load a single plugin file
|
|
123
|
+
*/
|
|
124
|
+
async loadPlugin(filePath) {
|
|
125
|
+
const warnings = [];
|
|
126
|
+
try {
|
|
127
|
+
// Read file
|
|
128
|
+
const code = await readFile(filePath, 'utf-8');
|
|
129
|
+
const fileStat = await stat(filePath);
|
|
130
|
+
// Check if already loaded and unchanged
|
|
131
|
+
const existing = this.loadedPlugins.get(filePath);
|
|
132
|
+
if (existing && existing.mtime >= fileStat.mtimeMs) {
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
affixId: existing.path,
|
|
136
|
+
warnings: ['Already loaded (unchanged)'],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// Parse and execute in sandbox
|
|
140
|
+
const affix = await this.executeInSandbox(code, filePath);
|
|
141
|
+
if (!affix) {
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: 'Plugin did not export a valid affix definition',
|
|
145
|
+
warnings,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// Register with the affix registry
|
|
149
|
+
const registry = getAffixRegistry();
|
|
150
|
+
const validation = registry.register(affix, false, filePath);
|
|
151
|
+
if (!validation.isValid) {
|
|
152
|
+
return {
|
|
153
|
+
success: false,
|
|
154
|
+
error: validation.errors.join('; '),
|
|
155
|
+
warnings: validation.warnings,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
// Track loaded plugin
|
|
159
|
+
this.loadedPlugins.set(filePath, {
|
|
160
|
+
path: affix.id,
|
|
161
|
+
mtime: fileStat.mtimeMs,
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
success: true,
|
|
165
|
+
affixId: affix.id,
|
|
166
|
+
warnings: validation.warnings,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
// Report plugin load failure to Sentry
|
|
171
|
+
Sentry.captureException(error, {
|
|
172
|
+
tags: { operation: 'plugin_load', fallback: true },
|
|
173
|
+
extra: { filePath },
|
|
174
|
+
});
|
|
175
|
+
return {
|
|
176
|
+
success: false,
|
|
177
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
178
|
+
warnings,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Execute plugin code in a sandboxed VM context
|
|
184
|
+
*/
|
|
185
|
+
async executeInSandbox(code, filePath) {
|
|
186
|
+
const sandbox = createSandbox();
|
|
187
|
+
// Create a context with a way to export the affix
|
|
188
|
+
const exportContainer = {};
|
|
189
|
+
const context = createContext({
|
|
190
|
+
...sandbox,
|
|
191
|
+
__export__: (affix) => {
|
|
192
|
+
exportContainer.default = affix;
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
// Wrap the code to capture exports
|
|
196
|
+
// Handle both ES module style and CommonJS style
|
|
197
|
+
const wrappedCode = `
|
|
198
|
+
(function() {
|
|
199
|
+
const module = { exports: {} };
|
|
200
|
+
const exports = module.exports;
|
|
201
|
+
|
|
202
|
+
${code}
|
|
203
|
+
|
|
204
|
+
// Try to get the affix from various export styles
|
|
205
|
+
if (module.exports && module.exports.default) {
|
|
206
|
+
__export__(module.exports.default);
|
|
207
|
+
} else if (module.exports && module.exports.id) {
|
|
208
|
+
__export__(module.exports);
|
|
209
|
+
} else if (typeof exports === 'object' && exports.id) {
|
|
210
|
+
__export__(exports);
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
213
|
+
`;
|
|
214
|
+
try {
|
|
215
|
+
const script = new Script(wrappedCode, {
|
|
216
|
+
filename: filePath,
|
|
217
|
+
});
|
|
218
|
+
script.runInContext(context, {
|
|
219
|
+
timeout: this.config.timeout,
|
|
220
|
+
displayErrors: true,
|
|
221
|
+
});
|
|
222
|
+
return exportContainer.default || null;
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
if (error instanceof Error && error.message.includes('Script execution timed out')) {
|
|
226
|
+
throw new Error('Plugin execution timed out (possible infinite loop)');
|
|
227
|
+
}
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Reload a specific plugin
|
|
233
|
+
*/
|
|
234
|
+
async reloadPlugin(filePath) {
|
|
235
|
+
// Unload first if exists
|
|
236
|
+
const existing = this.loadedPlugins.get(filePath);
|
|
237
|
+
if (existing) {
|
|
238
|
+
const registry = getAffixRegistry();
|
|
239
|
+
registry.unregister(existing.path);
|
|
240
|
+
this.loadedPlugins.delete(filePath);
|
|
241
|
+
}
|
|
242
|
+
return this.loadPlugin(filePath);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Unload a plugin
|
|
246
|
+
*/
|
|
247
|
+
unloadPlugin(filePath) {
|
|
248
|
+
const existing = this.loadedPlugins.get(filePath);
|
|
249
|
+
if (!existing)
|
|
250
|
+
return false;
|
|
251
|
+
const registry = getAffixRegistry();
|
|
252
|
+
registry.unregister(existing.path);
|
|
253
|
+
this.loadedPlugins.delete(filePath);
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Start watching for plugin changes
|
|
258
|
+
*/
|
|
259
|
+
async startWatching() {
|
|
260
|
+
if (!this.config.watchForChanges)
|
|
261
|
+
return;
|
|
262
|
+
try {
|
|
263
|
+
const watcher = watch(this.config.pluginDir, { recursive: false });
|
|
264
|
+
console.log('[PluginLoader] Watching for plugin changes...');
|
|
265
|
+
for await (const event of watcher) {
|
|
266
|
+
if (event.filename) {
|
|
267
|
+
const ext = extname(event.filename);
|
|
268
|
+
if (ext === '.js' || ext === '.mjs') {
|
|
269
|
+
const filePath = join(this.config.pluginDir, event.filename);
|
|
270
|
+
console.log(`[PluginLoader] Plugin changed: ${event.filename}`);
|
|
271
|
+
const result = await this.reloadPlugin(filePath);
|
|
272
|
+
if (result.success) {
|
|
273
|
+
console.log(`[PluginLoader] Reloaded: ${result.affixId}`);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
console.error(`[PluginLoader] Failed to reload: ${result.error}`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
console.error('[PluginLoader] Failed to start watcher:', error);
|
|
284
|
+
// Report watcher failure to Sentry
|
|
285
|
+
Sentry.captureException(error, {
|
|
286
|
+
tags: { operation: 'plugin_watcher', fallback: true },
|
|
287
|
+
extra: { pluginDir: this.config.pluginDir },
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Stop watching for changes
|
|
293
|
+
*/
|
|
294
|
+
stopWatching() {
|
|
295
|
+
// Watcher cleanup handled by async generator
|
|
296
|
+
console.log('[PluginLoader] Stopped watching for changes');
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get list of loaded plugins
|
|
300
|
+
*/
|
|
301
|
+
getLoadedPlugins() {
|
|
302
|
+
return Array.from(this.loadedPlugins.values()).map(p => p.path);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
// Singleton instance
|
|
306
|
+
let loaderInstance = null;
|
|
307
|
+
export function getPluginLoader(config) {
|
|
308
|
+
if (!loaderInstance) {
|
|
309
|
+
loaderInstance = new PluginLoader(config);
|
|
310
|
+
}
|
|
311
|
+
return loaderInstance;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Initialize the plugin system
|
|
315
|
+
*/
|
|
316
|
+
export async function initializePlugins(pluginDir) {
|
|
317
|
+
const loader = getPluginLoader(pluginDir ? { pluginDir } : undefined);
|
|
318
|
+
await loader.loadAll();
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=PluginLoader.js.map
|
|
321
|
+
//# debugId=49ef7f3f-d389-511c-a830-73f13be55a30
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginLoader.js","sources":["affix/PluginLoader.ts"],"sourceRoot":"/","sourcesContent":["/**\r\n * Dynamic affix plugin loader with VM sandbox\r\n */\r\n\r\nimport { createContext, runInContext, Script } from 'vm';\r\nimport { readdir, readFile, stat, watch } from 'fs/promises';\r\nimport { join, extname } from 'path';\r\nimport type { AffixPlugin, AffixValidationResult } from './types.js';\r\nimport { getAffixRegistry } from './AffixRegistry.js';\r\nimport { Sentry } from '../instrument.js';\r\n\r\ninterface LoadResult {\r\n success: boolean;\r\n affixId?: string;\r\n error?: string;\r\n warnings: string[];\r\n}\r\n\r\ninterface PluginLoaderConfig {\r\n pluginDir: string;\r\n watchForChanges: boolean;\r\n timeout: number; // Max execution time in ms\r\n}\r\n\r\nconst DEFAULT_CONFIG: PluginLoaderConfig = {\r\n pluginDir: './affixes',\r\n watchForChanges: true,\r\n timeout: 100,\r\n};\r\n\r\n/**\r\n * Create a sandboxed context for plugin execution\r\n */\r\nfunction createSandbox(): object {\r\n return {\r\n // Only expose safe globals\r\n console: {\r\n log: (...args: unknown[]) => console.log('[Plugin]', ...args),\r\n warn: (...args: unknown[]) => console.warn('[Plugin]', ...args),\r\n error: (...args: unknown[]) => console.error('[Plugin]', ...args),\r\n },\r\n\r\n // Math functions\r\n Math: Object.freeze({ ...Math }),\r\n\r\n // Safe built-ins\r\n JSON: Object.freeze({\r\n parse: JSON.parse,\r\n stringify: JSON.stringify,\r\n }),\r\n\r\n // Array and Object methods (frozen)\r\n Array: Object.freeze({\r\n isArray: Array.isArray,\r\n from: Array.from,\r\n of: Array.of,\r\n }),\r\n\r\n Object: Object.freeze({\r\n keys: Object.keys,\r\n values: Object.values,\r\n entries: Object.entries,\r\n assign: Object.assign,\r\n freeze: Object.freeze,\r\n }),\r\n\r\n // Type checking\r\n typeof: (x: unknown) => typeof x,\r\n isNaN: isNaN,\r\n isFinite: isFinite,\r\n parseInt: parseInt,\r\n parseFloat: parseFloat,\r\n\r\n // Prevent access to dangerous APIs\r\n require: undefined,\r\n process: undefined,\r\n global: undefined,\r\n globalThis: undefined,\r\n Buffer: undefined,\r\n __dirname: undefined,\r\n __filename: undefined,\r\n module: undefined,\r\n exports: undefined,\r\n import: undefined,\r\n eval: undefined,\r\n Function: undefined,\r\n };\r\n}\r\n\r\n/**\r\n * Plugin Loader class\r\n */\r\nexport class PluginLoader {\r\n private config: PluginLoaderConfig;\r\n private loadedPlugins: Map<string, { path: string; mtime: number }> = new Map();\r\n private watcher: AsyncGenerator<unknown> | null = null;\r\n\r\n constructor(config: Partial<PluginLoaderConfig> = {}) {\r\n this.config = { ...DEFAULT_CONFIG, ...config };\r\n }\r\n\r\n /**\r\n * Load all plugins from the configured directory\r\n */\r\n async loadAll(): Promise<LoadResult[]> {\r\n const results: LoadResult[] = [];\r\n\r\n try {\r\n const files = await this.getPluginFiles();\r\n \r\n for (const file of files) {\r\n const result = await this.loadPlugin(file);\r\n results.push(result);\r\n }\r\n\r\n console.log(`[PluginLoader] Loaded ${results.filter(r => r.success).length}/${files.length} plugins`);\r\n } catch (error) {\r\n console.error('[PluginLoader] Failed to scan plugin directory:', error);\r\n // Report plugin directory scan failure to Sentry\r\n Sentry.captureException(error, {\r\n tags: { operation: 'plugin_scan', fallback: true },\r\n extra: { pluginDir: this.config.pluginDir },\r\n });\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Get list of plugin files\r\n */\r\n private async getPluginFiles(): Promise<string[]> {\r\n const files: string[] = [];\r\n\r\n try {\r\n const entries = await readdir(this.config.pluginDir);\r\n\r\n for (const entry of entries) {\r\n const ext = extname(entry);\r\n if (ext === '.js' || ext === '.mjs') {\r\n files.push(join(this.config.pluginDir, entry));\r\n }\r\n }\r\n } catch (error) {\r\n // Directory might not exist yet\r\n console.log('[PluginLoader] Plugin directory not found, skipping');\r\n }\r\n\r\n return files;\r\n }\r\n\r\n /**\r\n * Load a single plugin file\r\n */\r\n async loadPlugin(filePath: string): Promise<LoadResult> {\r\n const warnings: string[] = [];\r\n\r\n try {\r\n // Read file\r\n const code = await readFile(filePath, 'utf-8');\r\n const fileStat = await stat(filePath);\r\n\r\n // Check if already loaded and unchanged\r\n const existing = this.loadedPlugins.get(filePath);\r\n if (existing && existing.mtime >= fileStat.mtimeMs) {\r\n return {\r\n success: true,\r\n affixId: existing.path,\r\n warnings: ['Already loaded (unchanged)'],\r\n };\r\n }\r\n\r\n // Parse and execute in sandbox\r\n const affix = await this.executeInSandbox(code, filePath);\r\n\r\n if (!affix) {\r\n return {\r\n success: false,\r\n error: 'Plugin did not export a valid affix definition',\r\n warnings,\r\n };\r\n }\r\n\r\n // Register with the affix registry\r\n const registry = getAffixRegistry();\r\n const validation = registry.register(affix, false, filePath);\r\n\r\n if (!validation.isValid) {\r\n return {\r\n success: false,\r\n error: validation.errors.join('; '),\r\n warnings: validation.warnings,\r\n };\r\n }\r\n\r\n // Track loaded plugin\r\n this.loadedPlugins.set(filePath, {\r\n path: affix.id,\r\n mtime: fileStat.mtimeMs,\r\n });\r\n\r\n return {\r\n success: true,\r\n affixId: affix.id,\r\n warnings: validation.warnings,\r\n };\r\n } catch (error) {\r\n // Report plugin load failure to Sentry\r\n Sentry.captureException(error, {\r\n tags: { operation: 'plugin_load', fallback: true },\r\n extra: { filePath },\r\n });\r\n return {\r\n success: false,\r\n error: error instanceof Error ? error.message : 'Unknown error',\r\n warnings,\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Execute plugin code in a sandboxed VM context\r\n */\r\n private async executeInSandbox(code: string, filePath: string): Promise<AffixPlugin | null> {\r\n const sandbox = createSandbox();\r\n \r\n // Create a context with a way to export the affix\r\n const exportContainer: { default?: AffixPlugin } = {};\r\n const context = createContext({\r\n ...sandbox,\r\n __export__: (affix: AffixPlugin) => {\r\n exportContainer.default = affix;\r\n },\r\n });\r\n\r\n // Wrap the code to capture exports\r\n // Handle both ES module style and CommonJS style\r\n const wrappedCode = `\r\n (function() {\r\n const module = { exports: {} };\r\n const exports = module.exports;\r\n \r\n ${code}\r\n \r\n // Try to get the affix from various export styles\r\n if (module.exports && module.exports.default) {\r\n __export__(module.exports.default);\r\n } else if (module.exports && module.exports.id) {\r\n __export__(module.exports);\r\n } else if (typeof exports === 'object' && exports.id) {\r\n __export__(exports);\r\n }\r\n })();\r\n `;\r\n\r\n try {\r\n const script = new Script(wrappedCode, {\r\n filename: filePath,\r\n });\r\n\r\n script.runInContext(context, {\r\n timeout: this.config.timeout,\r\n displayErrors: true,\r\n });\r\n\r\n return exportContainer.default || null;\r\n } catch (error) {\r\n if (error instanceof Error && error.message.includes('Script execution timed out')) {\r\n throw new Error('Plugin execution timed out (possible infinite loop)');\r\n }\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Reload a specific plugin\r\n */\r\n async reloadPlugin(filePath: string): Promise<LoadResult> {\r\n // Unload first if exists\r\n const existing = this.loadedPlugins.get(filePath);\r\n if (existing) {\r\n const registry = getAffixRegistry();\r\n registry.unregister(existing.path);\r\n this.loadedPlugins.delete(filePath);\r\n }\r\n\r\n return this.loadPlugin(filePath);\r\n }\r\n\r\n /**\r\n * Unload a plugin\r\n */\r\n unloadPlugin(filePath: string): boolean {\r\n const existing = this.loadedPlugins.get(filePath);\r\n if (!existing) return false;\r\n\r\n const registry = getAffixRegistry();\r\n registry.unregister(existing.path);\r\n this.loadedPlugins.delete(filePath);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Start watching for plugin changes\r\n */\r\n async startWatching(): Promise<void> {\r\n if (!this.config.watchForChanges) return;\r\n\r\n try {\r\n const watcher = watch(this.config.pluginDir, { recursive: false });\r\n \r\n console.log('[PluginLoader] Watching for plugin changes...');\r\n\r\n for await (const event of watcher) {\r\n if (event.filename) {\r\n const ext = extname(event.filename);\r\n if (ext === '.js' || ext === '.mjs') {\r\n const filePath = join(this.config.pluginDir, event.filename);\r\n console.log(`[PluginLoader] Plugin changed: ${event.filename}`);\r\n \r\n const result = await this.reloadPlugin(filePath);\r\n if (result.success) {\r\n console.log(`[PluginLoader] Reloaded: ${result.affixId}`);\r\n } else {\r\n console.error(`[PluginLoader] Failed to reload: ${result.error}`);\r\n }\r\n }\r\n }\r\n }\r\n } catch (error) {\r\n console.error('[PluginLoader] Failed to start watcher:', error);\r\n // Report watcher failure to Sentry\r\n Sentry.captureException(error, {\r\n tags: { operation: 'plugin_watcher', fallback: true },\r\n extra: { pluginDir: this.config.pluginDir },\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Stop watching for changes\r\n */\r\n stopWatching(): void {\r\n // Watcher cleanup handled by async generator\r\n console.log('[PluginLoader] Stopped watching for changes');\r\n }\r\n\r\n /**\r\n * Get list of loaded plugins\r\n */\r\n getLoadedPlugins(): string[] {\r\n return Array.from(this.loadedPlugins.values()).map(p => p.path);\r\n }\r\n}\r\n\r\n// Singleton instance\r\nlet loaderInstance: PluginLoader | null = null;\r\n\r\nexport function getPluginLoader(config?: Partial<PluginLoaderConfig>): PluginLoader {\r\n if (!loaderInstance) {\r\n loaderInstance = new PluginLoader(config);\r\n }\r\n return loaderInstance;\r\n}\r\n\r\n/**\r\n * Initialize the plugin system\r\n */\r\nexport async function initializePlugins(pluginDir?: string): Promise<void> {\r\n const loader = getPluginLoader(pluginDir ? { pluginDir } : undefined);\r\n await loader.loadAll();\r\n}\r\n"],"names":[],"mappings":"AAAA;;GAEG;;;AAEH,OAAO,EAAE,aAAa,EAAgB,MAAM,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAe1C,MAAM,cAAc,GAAuB;IACzC,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,IAAI;IACrB,OAAO,EAAE,GAAG;CACb,CAAC;AAEF;;GAEG;AACH,SAAS,aAAa;IACpB,OAAO;QACL,2BAA2B;QAC3B,OAAO,EAAE;YACP,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,MAAM,UAAU,eAAe,CAAC,MAAoC;IAClE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,SAAkB;IACxD,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;AACzB,CAAC","debug_id":"49ef7f3f-d389-511c-a830-73f13be55a30"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.d.ts","sourceRoot":"/","sources":["affix/builtin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,cAAc,EAAE,WAAW,EAmUvC,CAAC"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in affix definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="912f3d25-d901-54e4-9757-ecfc51d83e2a")}catch(e){}}();
|
|
6
|
+
export const builtInAffixes = [
|
|
7
|
+
// =========================================================================
|
|
8
|
+
// PREFIX AFFIXES - Affect base stats
|
|
9
|
+
// =========================================================================
|
|
10
|
+
{
|
|
11
|
+
id: 'sharp',
|
|
12
|
+
name: 'Sharp',
|
|
13
|
+
description: 'Increased attack power',
|
|
14
|
+
type: 'prefix',
|
|
15
|
+
rarity: 'common',
|
|
16
|
+
statModifiers: {
|
|
17
|
+
attack: 5,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'sturdy',
|
|
22
|
+
name: 'Sturdy',
|
|
23
|
+
description: 'Increased durability',
|
|
24
|
+
type: 'prefix',
|
|
25
|
+
rarity: 'common',
|
|
26
|
+
statModifiers: {
|
|
27
|
+
defense: 3,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'swift',
|
|
32
|
+
name: 'Swift',
|
|
33
|
+
description: 'Increased attack speed',
|
|
34
|
+
type: 'prefix',
|
|
35
|
+
rarity: 'common',
|
|
36
|
+
statModifiers: {
|
|
37
|
+
speed: 5,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'heavy',
|
|
42
|
+
name: 'Heavy',
|
|
43
|
+
description: 'Greatly increased attack, but slower',
|
|
44
|
+
type: 'prefix',
|
|
45
|
+
rarity: 'uncommon',
|
|
46
|
+
statModifiers: {
|
|
47
|
+
attack: 15,
|
|
48
|
+
speed: -5,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'deadly',
|
|
53
|
+
name: 'Deadly',
|
|
54
|
+
description: 'Increased critical hit chance',
|
|
55
|
+
type: 'prefix',
|
|
56
|
+
rarity: 'rare',
|
|
57
|
+
statModifiers: {
|
|
58
|
+
critChance: 0.15,
|
|
59
|
+
critDamage: 0.25,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'vampiric',
|
|
64
|
+
name: 'Vampiric',
|
|
65
|
+
description: 'Steals life on hit',
|
|
66
|
+
type: 'prefix',
|
|
67
|
+
rarity: 'rare',
|
|
68
|
+
statModifiers: {
|
|
69
|
+
lifesteal: 0.1,
|
|
70
|
+
},
|
|
71
|
+
onHitEffects: [
|
|
72
|
+
{
|
|
73
|
+
type: 'heal',
|
|
74
|
+
value: 5,
|
|
75
|
+
chance: 1,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'ancient',
|
|
81
|
+
name: 'Ancient',
|
|
82
|
+
description: 'A weapon from a forgotten age, powerful but mysterious',
|
|
83
|
+
type: 'prefix',
|
|
84
|
+
rarity: 'epic',
|
|
85
|
+
statModifiers: {
|
|
86
|
+
attack: 20,
|
|
87
|
+
defense: 5,
|
|
88
|
+
critChance: 0.1,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
// =========================================================================
|
|
92
|
+
// SUFFIX AFFIXES - Add elemental or special effects
|
|
93
|
+
// =========================================================================
|
|
94
|
+
{
|
|
95
|
+
id: 'of_flames',
|
|
96
|
+
name: 'of Flames',
|
|
97
|
+
description: 'Adds fire damage and can burn enemies',
|
|
98
|
+
type: 'suffix',
|
|
99
|
+
rarity: 'uncommon',
|
|
100
|
+
onHitEffects: [
|
|
101
|
+
{
|
|
102
|
+
type: 'damage',
|
|
103
|
+
element: 'fire',
|
|
104
|
+
value: 8,
|
|
105
|
+
chance: 1,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: 'status',
|
|
109
|
+
element: 'fire',
|
|
110
|
+
value: 3,
|
|
111
|
+
chance: 0.3,
|
|
112
|
+
duration: 3,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
incompatibleWith: ['of_frost', 'of_ice'],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 'of_frost',
|
|
119
|
+
name: 'of Frost',
|
|
120
|
+
description: 'Adds ice damage and can slow enemies',
|
|
121
|
+
type: 'suffix',
|
|
122
|
+
rarity: 'uncommon',
|
|
123
|
+
onHitEffects: [
|
|
124
|
+
{
|
|
125
|
+
type: 'damage',
|
|
126
|
+
element: 'ice',
|
|
127
|
+
value: 6,
|
|
128
|
+
chance: 1,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'status',
|
|
132
|
+
element: 'ice',
|
|
133
|
+
value: 2,
|
|
134
|
+
chance: 0.25,
|
|
135
|
+
duration: 2,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
incompatibleWith: ['of_flames', 'of_fire'],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'of_thunder',
|
|
142
|
+
name: 'of Thunder',
|
|
143
|
+
description: 'Adds lightning damage with chance to stun',
|
|
144
|
+
type: 'suffix',
|
|
145
|
+
rarity: 'rare',
|
|
146
|
+
onHitEffects: [
|
|
147
|
+
{
|
|
148
|
+
type: 'damage',
|
|
149
|
+
element: 'lightning',
|
|
150
|
+
value: 12,
|
|
151
|
+
chance: 1,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'status',
|
|
155
|
+
element: 'lightning',
|
|
156
|
+
value: 1,
|
|
157
|
+
chance: 0.15,
|
|
158
|
+
duration: 1,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: 'of_venom',
|
|
164
|
+
name: 'of Venom',
|
|
165
|
+
description: 'Adds poison damage over time',
|
|
166
|
+
type: 'suffix',
|
|
167
|
+
rarity: 'uncommon',
|
|
168
|
+
onHitEffects: [
|
|
169
|
+
{
|
|
170
|
+
type: 'status',
|
|
171
|
+
element: 'poison',
|
|
172
|
+
value: 4,
|
|
173
|
+
chance: 0.5,
|
|
174
|
+
duration: 5,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 'of_the_night',
|
|
180
|
+
name: 'of the Night',
|
|
181
|
+
description: 'Dark energy adds bonus damage',
|
|
182
|
+
type: 'suffix',
|
|
183
|
+
rarity: 'rare',
|
|
184
|
+
onHitEffects: [
|
|
185
|
+
{
|
|
186
|
+
type: 'damage',
|
|
187
|
+
element: 'dark',
|
|
188
|
+
value: 15,
|
|
189
|
+
chance: 0.5,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
statModifiers: {
|
|
193
|
+
attack: 5,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'of_light',
|
|
198
|
+
name: 'of Light',
|
|
199
|
+
description: 'Holy damage effective against undead',
|
|
200
|
+
type: 'suffix',
|
|
201
|
+
rarity: 'rare',
|
|
202
|
+
onHitEffects: [
|
|
203
|
+
{
|
|
204
|
+
type: 'damage',
|
|
205
|
+
element: 'holy',
|
|
206
|
+
value: 10,
|
|
207
|
+
chance: 1,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
incompatibleWith: ['of_the_night'],
|
|
211
|
+
},
|
|
212
|
+
// =========================================================================
|
|
213
|
+
// LEGENDARY AFFIXES - Unique, game-changing effects
|
|
214
|
+
// =========================================================================
|
|
215
|
+
{
|
|
216
|
+
id: 'time_rift',
|
|
217
|
+
name: 'Time Rift',
|
|
218
|
+
description: 'Has a chance to skip enemy turns',
|
|
219
|
+
type: 'legendary',
|
|
220
|
+
rarity: 'legendary',
|
|
221
|
+
requiresLevel: 5,
|
|
222
|
+
passiveEffects: [
|
|
223
|
+
{
|
|
224
|
+
type: 'trigger',
|
|
225
|
+
description: '5% chance to skip enemy turn',
|
|
226
|
+
value: 0.05,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
apply(context) {
|
|
230
|
+
return {
|
|
231
|
+
extraEffects: ['Time distortion active'],
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: 'soul_drinker',
|
|
237
|
+
name: 'Soul Drinker',
|
|
238
|
+
description: 'Heals for a portion of damage dealt, but costs HP per attack',
|
|
239
|
+
type: 'legendary',
|
|
240
|
+
rarity: 'legendary',
|
|
241
|
+
requiresLevel: 7,
|
|
242
|
+
statModifiers: {
|
|
243
|
+
lifesteal: 0.25,
|
|
244
|
+
attack: 25,
|
|
245
|
+
},
|
|
246
|
+
passiveEffects: [
|
|
247
|
+
{
|
|
248
|
+
type: 'trigger',
|
|
249
|
+
description: 'Costs 5 HP per attack',
|
|
250
|
+
value: -5,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: 'mirror_blade',
|
|
256
|
+
name: 'Mirror Blade',
|
|
257
|
+
description: 'Summons a mirror image that attacks alongside you',
|
|
258
|
+
type: 'legendary',
|
|
259
|
+
rarity: 'legendary',
|
|
260
|
+
requiresLevel: 10,
|
|
261
|
+
passiveEffects: [
|
|
262
|
+
{
|
|
263
|
+
type: 'aura',
|
|
264
|
+
description: 'Mirror image deals 50% of your damage',
|
|
265
|
+
value: 0.5,
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
apply(context) {
|
|
269
|
+
return {
|
|
270
|
+
damageModifier: {
|
|
271
|
+
physical: context.weapon.baseAttack * 0.5,
|
|
272
|
+
},
|
|
273
|
+
extraEffects: ['Mirror image attacks!'],
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: 'berserker_rage',
|
|
279
|
+
name: 'Berserker Rage',
|
|
280
|
+
description: 'Attack increases as HP decreases',
|
|
281
|
+
type: 'legendary',
|
|
282
|
+
rarity: 'legendary',
|
|
283
|
+
requiresLevel: 8,
|
|
284
|
+
apply(context) {
|
|
285
|
+
const hpRatio = context.player.hp / context.player.maxHp;
|
|
286
|
+
const bonusAttack = Math.floor((1 - hpRatio) * 50);
|
|
287
|
+
return {
|
|
288
|
+
damageModifier: {
|
|
289
|
+
physical: bonusAttack,
|
|
290
|
+
},
|
|
291
|
+
extraEffects: hpRatio < 0.3 ? ['BERSERKER RAGE ACTIVE!'] : [],
|
|
292
|
+
};
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: 'executioner',
|
|
297
|
+
name: 'Executioner',
|
|
298
|
+
description: 'Massive damage bonus against low HP enemies',
|
|
299
|
+
type: 'legendary',
|
|
300
|
+
rarity: 'legendary',
|
|
301
|
+
requiresLevel: 6,
|
|
302
|
+
onHit(context) {
|
|
303
|
+
const targetHpRatio = context.target.hp / context.target.maxHp;
|
|
304
|
+
if (targetHpRatio < 0.2) {
|
|
305
|
+
context.dealBonusDamage(context.damage * 2, 'physical');
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
];
|
|
310
|
+
//# sourceMappingURL=builtin.js.map
|
|
311
|
+
//# debugId=912f3d25-d901-54e4-9757-ecfc51d83e2a
|