@strixit/storyscript 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/.env +1 -0
  2. package/CodeSnippets/StoryScriptSnippets.code-snippets +573 -0
  3. package/LICENSE.txt +21 -0
  4. package/LiveTemplates/StoryScript.xml +271 -0
  5. package/README.md +9 -2
  6. package/baseViteConfig.js +112 -0
  7. package/clientFiles/currentGameName.js +1 -0
  8. package/clientFiles/gitignore +12 -0
  9. package/clientFiles/tsconfig.json +34 -0
  10. package/clientFiles/vite.config.ts +14 -0
  11. package/clientFiles/vitest.config.ts +29 -0
  12. package/dist/src/Engine/Actions/index.d.ts +2 -0
  13. package/dist/src/Engine/Actions/open.d.ts +6 -0
  14. package/dist/src/Engine/Actions/openWithKey.d.ts +7 -0
  15. package/dist/src/Engine/EntityCreatorFunctions.d.ts +18 -0
  16. package/dist/src/Engine/Interfaces/action.d.ts +37 -0
  17. package/dist/src/Engine/Interfaces/autoplayStep.d.ts +11 -0
  18. package/dist/src/Engine/Interfaces/barrier.d.ts +16 -0
  19. package/dist/src/Engine/Interfaces/barrierAction.d.ts +19 -0
  20. package/dist/src/Engine/Interfaces/character.d.ts +48 -0
  21. package/dist/src/Engine/Interfaces/combatSetup.d.ts +9 -0
  22. package/dist/src/Engine/Interfaces/combatTurn.d.ts +37 -0
  23. package/dist/src/Engine/Interfaces/combatWinnings.d.ts +6 -0
  24. package/dist/src/Engine/Interfaces/combinations/activeCombination.d.ts +14 -0
  25. package/dist/src/Engine/Interfaces/combinations/combinable.d.ts +18 -0
  26. package/dist/src/Engine/Interfaces/combinations/combinationAction.d.ts +41 -0
  27. package/dist/src/Engine/Interfaces/combinations/combinationMatchResult.d.ts +14 -0
  28. package/dist/src/Engine/Interfaces/combinations/combinations.d.ts +17 -0
  29. package/dist/src/Engine/Interfaces/combinations/combine.d.ts +22 -0
  30. package/dist/src/Engine/Interfaces/combinations/combineResult.d.ts +18 -0
  31. package/dist/src/Engine/Interfaces/combinations/gameCombinations.d.ts +40 -0
  32. package/dist/src/Engine/Interfaces/compiledLocation.d.ts +33 -0
  33. package/dist/src/Engine/Interfaces/conversations/conversation.d.ts +44 -0
  34. package/dist/src/Engine/Interfaces/conversations/conversationLogEntry.d.ts +13 -0
  35. package/dist/src/Engine/Interfaces/conversations/conversationNode.d.ts +22 -0
  36. package/dist/src/Engine/Interfaces/conversations/conversationReply.d.ts +49 -0
  37. package/dist/src/Engine/Interfaces/createCharacter/createCharacter.d.ts +20 -0
  38. package/dist/src/Engine/Interfaces/createCharacter/createCharacterAttribute.d.ts +18 -0
  39. package/dist/src/Engine/Interfaces/createCharacter/createCharacterAttributeEntry.d.ts +18 -0
  40. package/dist/src/Engine/Interfaces/createCharacter/createCharacterQuestion.d.ts +18 -0
  41. package/dist/src/Engine/Interfaces/createCharacter/createCharacterQuestionEntry.d.ts +22 -0
  42. package/dist/src/Engine/Interfaces/createCharacter/createCharacterStep.d.ts +40 -0
  43. package/dist/src/Engine/Interfaces/customCursor.d.ts +8 -0
  44. package/dist/src/Engine/Interfaces/defaultEquipment.d.ts +19 -0
  45. package/dist/src/Engine/Interfaces/definitions.d.ts +40 -0
  46. package/dist/src/Engine/Interfaces/destination.d.ts +31 -0
  47. package/dist/src/Engine/Interfaces/dynamicStyle.d.ts +10 -0
  48. package/dist/src/Engine/Interfaces/enemy.d.ts +46 -0
  49. package/dist/src/Engine/Interfaces/enumerations/actionStatus.d.ts +18 -0
  50. package/dist/src/Engine/Interfaces/enumerations/actionType.d.ts +9 -0
  51. package/dist/src/Engine/Interfaces/enumerations/equipmentType.d.ts +51 -0
  52. package/dist/src/Engine/Interfaces/enumerations/gameState.d.ts +11 -0
  53. package/dist/src/Engine/Interfaces/enumerations/playState.d.ts +10 -0
  54. package/dist/src/Engine/Interfaces/enumerations/targetType.d.ts +9 -0
  55. package/dist/src/Engine/Interfaces/equipment.d.ts +43 -0
  56. package/dist/src/Engine/Interfaces/feature.d.ts +37 -0
  57. package/dist/src/Engine/Interfaces/featureCollection.d.ts +7 -0
  58. package/dist/src/Engine/Interfaces/game.d.ts +148 -0
  59. package/dist/src/Engine/Interfaces/gameEvents.d.ts +7 -0
  60. package/dist/src/Engine/Interfaces/groupableItem.d.ts +32 -0
  61. package/dist/src/Engine/Interfaces/helpers.d.ts +50 -0
  62. package/dist/src/Engine/Interfaces/index.d.ts +78 -0
  63. package/dist/src/Engine/Interfaces/interfaceTexts.d.ts +140 -0
  64. package/dist/src/Engine/Interfaces/item.d.ts +96 -0
  65. package/dist/src/Engine/Interfaces/key.d.ts +16 -0
  66. package/dist/src/Engine/Interfaces/location.d.ts +78 -0
  67. package/dist/src/Engine/Interfaces/maps/map.d.ts +45 -0
  68. package/dist/src/Engine/Interfaces/maps/mapLocation.d.ts +23 -0
  69. package/dist/src/Engine/Interfaces/party.d.ts +33 -0
  70. package/dist/src/Engine/Interfaces/person.d.ts +25 -0
  71. package/dist/src/Engine/Interfaces/quest.d.ts +51 -0
  72. package/dist/src/Engine/Interfaces/rules/characterRules.d.ts +84 -0
  73. package/dist/src/Engine/Interfaces/rules/combatRules.d.ts +46 -0
  74. package/dist/src/Engine/Interfaces/rules/combinationRules.d.ts +15 -0
  75. package/dist/src/Engine/Interfaces/rules/demoMode.d.ts +15 -0
  76. package/dist/src/Engine/Interfaces/rules/encounterRules.d.ts +4 -0
  77. package/dist/src/Engine/Interfaces/rules/explorationRules.d.ts +42 -0
  78. package/dist/src/Engine/Interfaces/rules/generalRules.d.ts +62 -0
  79. package/dist/src/Engine/Interfaces/rules/rules.d.ts +31 -0
  80. package/dist/src/Engine/Interfaces/rules/setupRules.d.ts +56 -0
  81. package/dist/src/Engine/Interfaces/rules/titleScreen.d.ts +16 -0
  82. package/dist/src/Engine/Interfaces/saveGame.d.ts +33 -0
  83. package/dist/src/Engine/Interfaces/scoreEntry.d.ts +13 -0
  84. package/dist/src/Engine/Interfaces/services/autoplayService.d.ts +19 -0
  85. package/dist/src/Engine/Interfaces/services/characterService.d.ts +17 -0
  86. package/dist/src/Engine/Interfaces/services/combatService.d.ts +26 -0
  87. package/dist/src/Engine/Interfaces/services/combinationService.d.ts +9 -0
  88. package/dist/src/Engine/Interfaces/services/commandService.d.ts +64 -0
  89. package/dist/src/Engine/Interfaces/services/conversationService.d.ts +5 -0
  90. package/dist/src/Engine/Interfaces/services/dataSerializer.d.ts +4 -0
  91. package/dist/src/Engine/Interfaces/services/dataService.d.ts +33 -0
  92. package/dist/src/Engine/Interfaces/services/dataSynchronizer.d.ts +3 -0
  93. package/dist/src/Engine/Interfaces/services/gameService.d.ts +10 -0
  94. package/dist/src/Engine/Interfaces/services/index.d.ts +16 -0
  95. package/dist/src/Engine/Interfaces/services/itemService.d.ts +14 -0
  96. package/dist/src/Engine/Interfaces/services/localStorageService.d.ts +6 -0
  97. package/dist/src/Engine/Interfaces/services/locationService.d.ts +8 -0
  98. package/dist/src/Engine/Interfaces/services/soundService.d.ts +5 -0
  99. package/dist/src/Engine/Interfaces/services/tradeService.d.ts +9 -0
  100. package/dist/src/Engine/Interfaces/soundPlayer.d.ts +30 -0
  101. package/dist/src/Engine/Interfaces/sprite.d.ts +23 -0
  102. package/dist/src/Engine/Interfaces/stateList.d.ts +9 -0
  103. package/dist/src/Engine/Interfaces/statistics.d.ts +13 -0
  104. package/dist/src/Engine/Interfaces/stock.d.ts +39 -0
  105. package/dist/src/Engine/Interfaces/trade.d.ts +62 -0
  106. package/dist/src/Engine/ServiceFactory.d.ts +52 -0
  107. package/dist/src/Engine/Services/AutoplayService.d.ts +11 -0
  108. package/dist/src/Engine/Services/CharacterService.d.ts +21 -0
  109. package/dist/src/Engine/Services/CombatService.d.ts +16 -0
  110. package/dist/src/Engine/Services/CombinationService.d.ts +15 -0
  111. package/dist/src/Engine/Services/CommandService.d.ts +24 -0
  112. package/dist/src/Engine/Services/ConversationService.d.ts +26 -0
  113. package/dist/src/Engine/Services/DataSerializer.d.ts +17 -0
  114. package/dist/src/Engine/Services/DataService.d.ts +16 -0
  115. package/dist/src/Engine/Services/DataSynchronizer.d.ts +12 -0
  116. package/dist/src/Engine/Services/GameService.d.ts +28 -0
  117. package/dist/src/Engine/Services/HelperService.d.ts +18 -0
  118. package/dist/src/Engine/Services/ItemService.d.ts +21 -0
  119. package/dist/src/Engine/Services/LocalStorageService.d.ts +7 -0
  120. package/dist/src/Engine/Services/LocationService.d.ts +25 -0
  121. package/dist/src/Engine/Services/SoundService.d.ts +13 -0
  122. package/dist/src/Engine/Services/TradeService.d.ts +17 -0
  123. package/dist/src/Engine/Services/index.d.ts +17 -0
  124. package/dist/src/Engine/Services/serializationData.d.ts +8 -0
  125. package/dist/src/Engine/Services/sharedFunctions.d.ts +21 -0
  126. package/dist/src/Engine/arrayAndFunctionExtensions.d.ts +3 -0
  127. package/dist/src/Engine/defaultTexts.d.ts +7 -0
  128. package/dist/src/Engine/gameEvents.d.ts +10 -0
  129. package/dist/src/Engine/index.d.ts +8 -0
  130. package/dist/src/Engine/stateProperties.d.ts +6 -0
  131. package/dist/src/Engine/utilityFunctions.d.ts +25 -0
  132. package/dist/src/UI/Composables/CustomCursor.d.ts +2 -0
  133. package/dist/src/UI/Composables/LocationMap.d.ts +26 -0
  134. package/dist/src/UI/Composables/Sound.d.ts +7 -0
  135. package/dist/src/UI/Composables/TextFeatures.d.ts +8 -0
  136. package/dist/src/UI/Composables/VisualFeatures.d.ts +7 -0
  137. package/dist/src/UI/Composables/index.d.ts +7 -0
  138. package/dist/src/UI/Composables/playStateWatch.d.ts +2 -0
  139. package/dist/src/UI/StateStore.d.ts +14256 -0
  140. package/dist/src/UI/error.d.ts +6 -0
  141. package/dist/src/UI/helpers.d.ts +3 -0
  142. package/dist/src/UI/index.d.ts +6 -0
  143. package/dist/src/UI/main.d.ts +1 -0
  144. package/dist/src/UI/startup.d.ts +2 -0
  145. package/dist/src/constants.d.ts +17 -0
  146. package/dist/src/index.d.ts +3 -0
  147. package/dist/storyscript.css +9566 -0
  148. package/dist/storyscript.js +9659 -0
  149. package/dist/storyscript.js.map +1 -0
  150. package/dist/storyscript.mjs +9569 -0
  151. package/dist/storyscript.mjs.map +1 -0
  152. package/electron.cjs +44 -0
  153. package/index.html +14 -0
  154. package/package.json +118 -4
  155. package/scripts/cli.js +268 -0
  156. package/scripts/createAsset.js +117 -0
  157. package/scripts/createGame.js +40 -0
  158. package/scripts/helpers.js +21 -0
  159. package/scripts/postbuild.js +179 -0
  160. package/scripts/setupTesting.js +17 -0
  161. package/shims-vue.d.ts +1 -0
  162. package/src/Engine/Actions/index.ts +2 -0
  163. package/src/Engine/Actions/open.ts +12 -0
  164. package/src/Engine/Actions/openWithKey.ts +23 -0
  165. package/src/Engine/EntityCreatorFunctions.ts +602 -0
  166. package/src/Engine/Interfaces/action.ts +43 -0
  167. package/src/Engine/Interfaces/autoplayStep.ts +13 -0
  168. package/src/Engine/Interfaces/barrier.ts +18 -0
  169. package/src/Engine/Interfaces/barrierAction.ts +21 -0
  170. package/src/Engine/Interfaces/character.ts +58 -0
  171. package/src/Engine/Interfaces/combatSetup.ts +10 -0
  172. package/src/Engine/Interfaces/combatTurn.ts +45 -0
  173. package/src/Engine/Interfaces/combatWinnings.ts +7 -0
  174. package/src/Engine/Interfaces/combinations/activeCombination.ts +16 -0
  175. package/src/Engine/Interfaces/combinations/combinable.ts +21 -0
  176. package/src/Engine/Interfaces/combinations/combinationAction.ts +45 -0
  177. package/src/Engine/Interfaces/combinations/combinationMatchResult.ts +16 -0
  178. package/src/Engine/Interfaces/combinations/combinations.ts +19 -0
  179. package/src/Engine/Interfaces/combinations/combine.ts +25 -0
  180. package/src/Engine/Interfaces/combinations/combineResult.ts +21 -0
  181. package/src/Engine/Interfaces/combinations/gameCombinations.ts +48 -0
  182. package/src/Engine/Interfaces/compiledLocation.ts +37 -0
  183. package/src/Engine/Interfaces/conversations/conversation.ts +47 -0
  184. package/src/Engine/Interfaces/conversations/conversationLogEntry.ts +14 -0
  185. package/src/Engine/Interfaces/conversations/conversationNode.ts +26 -0
  186. package/src/Engine/Interfaces/conversations/conversationReply.ts +59 -0
  187. package/src/Engine/Interfaces/createCharacter/createCharacter.ts +23 -0
  188. package/src/Engine/Interfaces/createCharacter/createCharacterAttribute.ts +21 -0
  189. package/src/Engine/Interfaces/createCharacter/createCharacterAttributeEntry.ts +21 -0
  190. package/src/Engine/Interfaces/createCharacter/createCharacterQuestion.ts +21 -0
  191. package/src/Engine/Interfaces/createCharacter/createCharacterQuestionEntry.ts +25 -0
  192. package/src/Engine/Interfaces/createCharacter/createCharacterStep.ts +47 -0
  193. package/src/Engine/Interfaces/customCursor.ts +5 -0
  194. package/src/Engine/Interfaces/defaultEquipment.ts +32 -0
  195. package/src/Engine/Interfaces/definitions.ts +48 -0
  196. package/src/Engine/Interfaces/destination.ts +37 -0
  197. package/src/Engine/Interfaces/dynamicStyle.ts +11 -0
  198. package/src/Engine/Interfaces/enemy.ts +54 -0
  199. package/src/Engine/Interfaces/enumerations/actionStatus.ts +20 -0
  200. package/src/Engine/Interfaces/enumerations/actionType.ts +9 -0
  201. package/src/Engine/Interfaces/enumerations/equipmentType.ts +61 -0
  202. package/src/Engine/Interfaces/enumerations/gameState.ts +11 -0
  203. package/src/Engine/Interfaces/enumerations/playState.ts +10 -0
  204. package/src/Engine/Interfaces/enumerations/targetType.ts +9 -0
  205. package/src/Engine/Interfaces/equipment.ts +44 -0
  206. package/src/Engine/Interfaces/feature.ts +43 -0
  207. package/src/Engine/Interfaces/featureCollection.ts +8 -0
  208. package/src/Engine/Interfaces/game.ts +201 -0
  209. package/src/Engine/Interfaces/gameEvents.ts +11 -0
  210. package/src/Engine/Interfaces/groupableItem.ts +37 -0
  211. package/src/Engine/Interfaces/helpers.ts +55 -0
  212. package/src/Engine/Interfaces/index.ts +158 -0
  213. package/src/Engine/Interfaces/interfaceTexts.ts +142 -0
  214. package/src/Engine/Interfaces/item.ts +111 -0
  215. package/src/Engine/Interfaces/key.ts +18 -0
  216. package/src/Engine/Interfaces/location.ts +92 -0
  217. package/src/Engine/Interfaces/maps/map.ts +55 -0
  218. package/src/Engine/Interfaces/maps/mapLocation.ts +28 -0
  219. package/src/Engine/Interfaces/party.ts +40 -0
  220. package/src/Engine/Interfaces/person.ts +29 -0
  221. package/src/Engine/Interfaces/quest.ts +60 -0
  222. package/src/Engine/Interfaces/rules/characterRules.ts +96 -0
  223. package/src/Engine/Interfaces/rules/combatRules.ts +52 -0
  224. package/src/Engine/Interfaces/rules/combinationRules.ts +17 -0
  225. package/src/Engine/Interfaces/rules/demoMode.ts +18 -0
  226. package/src/Engine/Interfaces/rules/encounterRules.ts +5 -0
  227. package/src/Engine/Interfaces/rules/explorationRules.ts +47 -0
  228. package/src/Engine/Interfaces/rules/generalRules.ts +80 -0
  229. package/src/Engine/Interfaces/rules/rules.ts +46 -0
  230. package/src/Engine/Interfaces/rules/setupRules.ts +65 -0
  231. package/src/Engine/Interfaces/rules/titleScreen.ts +19 -0
  232. package/src/Engine/Interfaces/saveGame.ts +39 -0
  233. package/src/Engine/Interfaces/scoreEntry.ts +14 -0
  234. package/src/Engine/Interfaces/services/autoplayService.ts +23 -0
  235. package/src/Engine/Interfaces/services/characterService.ts +35 -0
  236. package/src/Engine/Interfaces/services/combatService.ts +30 -0
  237. package/src/Engine/Interfaces/services/combinationService.ts +10 -0
  238. package/src/Engine/Interfaces/services/commandService.ts +75 -0
  239. package/src/Engine/Interfaces/services/conversationService.ts +7 -0
  240. package/src/Engine/Interfaces/services/dataSerializer.ts +4 -0
  241. package/src/Engine/Interfaces/services/dataService.ts +39 -0
  242. package/src/Engine/Interfaces/services/dataSynchronizer.ts +9 -0
  243. package/src/Engine/Interfaces/services/gameService.ts +17 -0
  244. package/src/Engine/Interfaces/services/index.ts +33 -0
  245. package/src/Engine/Interfaces/services/itemService.ts +25 -0
  246. package/src/Engine/Interfaces/services/localStorageService.ts +6 -0
  247. package/src/Engine/Interfaces/services/locationService.ts +13 -0
  248. package/src/Engine/Interfaces/services/soundService.ts +7 -0
  249. package/src/Engine/Interfaces/services/tradeService.ts +15 -0
  250. package/src/Engine/Interfaces/soundPlayer.ts +30 -0
  251. package/src/Engine/Interfaces/sprite.ts +27 -0
  252. package/src/Engine/Interfaces/stateList.ts +13 -0
  253. package/src/Engine/Interfaces/statistics.ts +14 -0
  254. package/src/Engine/Interfaces/stock.ts +46 -0
  255. package/src/Engine/Interfaces/trade.ts +72 -0
  256. package/src/Engine/ServiceFactory.ts +167 -0
  257. package/src/Engine/Services/AutoplayService.ts +59 -0
  258. package/src/Engine/Services/CharacterService.ts +291 -0
  259. package/src/Engine/Services/CombatService.ts +266 -0
  260. package/src/Engine/Services/CombinationService.ts +197 -0
  261. package/src/Engine/Services/CommandService.ts +197 -0
  262. package/src/Engine/Services/ConversationService.ts +406 -0
  263. package/src/Engine/Services/DataSerializer.ts +326 -0
  264. package/src/Engine/Services/DataService.ts +93 -0
  265. package/src/Engine/Services/DataSynchronizer.ts +216 -0
  266. package/src/Engine/Services/GameService.ts +554 -0
  267. package/src/Engine/Services/HelperService.ts +94 -0
  268. package/src/Engine/Services/ItemService.ts +294 -0
  269. package/src/Engine/Services/LocalStorageService.ts +24 -0
  270. package/src/Engine/Services/LocationService.ts +380 -0
  271. package/src/Engine/Services/SoundService.ts +54 -0
  272. package/src/Engine/Services/TradeService.ts +176 -0
  273. package/src/Engine/Services/index.ts +17 -0
  274. package/src/Engine/Services/serializationData.ts +8 -0
  275. package/src/Engine/Services/sharedFunctions.ts +296 -0
  276. package/src/Engine/arrayAndFunctionExtensions.ts +269 -0
  277. package/src/Engine/defaultTexts.ts +162 -0
  278. package/src/Engine/gameEvents.ts +51 -0
  279. package/src/Engine/index.ts +9 -0
  280. package/src/Engine/stateProperties.ts +9 -0
  281. package/src/Engine/utilityFunctions.ts +238 -0
  282. package/src/Games/_GameTemplate/character.ts +31 -0
  283. package/src/Games/_GameTemplate/customTexts.ts +8 -0
  284. package/src/Games/_GameTemplate/interfaces/action.ts +5 -0
  285. package/src/Games/_GameTemplate/interfaces/combatSetup.ts +7 -0
  286. package/src/Games/_GameTemplate/interfaces/combatTurn.ts +8 -0
  287. package/src/Games/_GameTemplate/interfaces/destination.ts +5 -0
  288. package/src/Games/_GameTemplate/interfaces/enemy.ts +11 -0
  289. package/src/Games/_GameTemplate/interfaces/equipment.ts +5 -0
  290. package/src/Games/_GameTemplate/interfaces/feature.ts +9 -0
  291. package/src/Games/_GameTemplate/interfaces/game.ts +22 -0
  292. package/src/Games/_GameTemplate/interfaces/interfaceTexts.ts +5 -0
  293. package/src/Games/_GameTemplate/interfaces/item.ts +18 -0
  294. package/src/Games/_GameTemplate/interfaces/key.ts +10 -0
  295. package/src/Games/_GameTemplate/interfaces/location.ts +22 -0
  296. package/src/Games/_GameTemplate/interfaces/map.ts +16 -0
  297. package/src/Games/_GameTemplate/interfaces/party.ts +8 -0
  298. package/src/Games/_GameTemplate/interfaces/person.ts +11 -0
  299. package/src/Games/_GameTemplate/interfaces/quest.ts +9 -0
  300. package/src/Games/_GameTemplate/locations/Start.html +5 -0
  301. package/src/Games/_GameTemplate/locations/start.ts +12 -0
  302. package/src/Games/_GameTemplate/rules.ts +60 -0
  303. package/src/Games/_GameTemplate/types.ts +55 -0
  304. package/src/Games/_GameTemplate/ui/styles/game.css +3 -0
  305. package/src/Games/_GameTemplate/webroot/favicon.ico +0 -0
  306. package/src/Games/_GameTemplate/webroot/gameinfo.json +10 -0
  307. package/src/Games/_GameTemplate/webroot/logo192.png +0 -0
  308. package/src/Games/_GameTemplate/webroot/logo512.png +0 -0
  309. package/src/Tests/Games/_GameTemplate/specs/rules.test.ts +9 -0
  310. package/src/UI/Components/AppShell.vue +43 -0
  311. package/src/UI/Components/Autoplay.vue +32 -0
  312. package/src/UI/Components/Combinations.vue +37 -0
  313. package/src/UI/Components/Common/Collapsible.vue +50 -0
  314. package/src/UI/Components/Common/ModalDialog.vue +54 -0
  315. package/src/UI/Components/Common/Sprite.vue +53 -0
  316. package/src/UI/Components/Description.vue +23 -0
  317. package/src/UI/Components/Encounter/Combat/Combat.vue +89 -0
  318. package/src/UI/Components/Encounter/Combat/CombatActions.vue +26 -0
  319. package/src/UI/Components/Encounter/Combat/CombatParticipant.vue +22 -0
  320. package/src/UI/Components/Encounter/Combat/CombatTargetSelect.vue +55 -0
  321. package/src/UI/Components/Encounter/Combat/CombatWin.vue +33 -0
  322. package/src/UI/Components/Encounter/Conversation.vue +66 -0
  323. package/src/UI/Components/Encounter/Encounter.vue +39 -0
  324. package/src/UI/Components/Encounter/Enemy.vue +30 -0
  325. package/src/UI/Components/Encounter/Trade/Stock.vue +58 -0
  326. package/src/UI/Components/Encounter/Trade/Trade.vue +24 -0
  327. package/src/UI/Components/Exploration/ActionLog.vue +17 -0
  328. package/src/UI/Components/Exploration/Destination.vue +66 -0
  329. package/src/UI/Components/Exploration/Exploration.vue +67 -0
  330. package/src/UI/Components/Exploration/Ground.vue +22 -0
  331. package/src/UI/Components/Exploration/LocationMap.vue +42 -0
  332. package/src/UI/Components/Exploration/LocationText.vue +39 -0
  333. package/src/UI/Components/Exploration/LocationVisual.vue +38 -0
  334. package/src/UI/Components/GameContainer.vue +49 -0
  335. package/src/UI/Components/GameMenu.vue +111 -0
  336. package/src/UI/Components/GameState/GameOver.vue +20 -0
  337. package/src/UI/Components/GameState/HighScores.vue +22 -0
  338. package/src/UI/Components/GameState/Intro.vue +17 -0
  339. package/src/UI/Components/GameState/TitleScreen.vue +42 -0
  340. package/src/UI/Components/GameState/Victory.vue +28 -0
  341. package/src/UI/Components/Navigation.vue +94 -0
  342. package/src/UI/Components/Party/Backpack.vue +68 -0
  343. package/src/UI/Components/Party/BuildCharacter.vue +64 -0
  344. package/src/UI/Components/Party/CharacterSheet.vue +57 -0
  345. package/src/UI/Components/Party/CreateCharacter.vue +46 -0
  346. package/src/UI/Components/Party/Equipment.vue +48 -0
  347. package/src/UI/Components/Party/EquipmentSlot.vue +31 -0
  348. package/src/UI/Components/Party/LevelUp.vue +27 -0
  349. package/src/UI/Components/Party/Party.vue +29 -0
  350. package/src/UI/Components/Party/Quests.vue +48 -0
  351. package/src/UI/Components/Sound.vue +42 -0
  352. package/src/UI/Composables/CustomCursor.ts +60 -0
  353. package/src/UI/Composables/LocationMap.ts +315 -0
  354. package/src/UI/Composables/Sound.ts +111 -0
  355. package/src/UI/Composables/TextFeatures.ts +148 -0
  356. package/src/UI/Composables/VisualFeatures.ts +220 -0
  357. package/src/UI/Composables/index.ts +15 -0
  358. package/src/UI/Composables/playStateWatch.ts +31 -0
  359. package/src/UI/StateStore.ts +237 -0
  360. package/src/UI/error.ts +6 -0
  361. package/src/UI/helpers.ts +62 -0
  362. package/src/UI/index.ts +13 -0
  363. package/src/UI/main.ts +62 -0
  364. package/src/UI/startup.ts +58 -0
  365. package/src/UI/styles/bootstrap-storyscript.scss +31 -0
  366. package/src/UI/styles/empty.css +3 -0
  367. package/src/UI/styles/lookinglass.png +0 -0
  368. package/src/UI/styles/storyscript.css +735 -0
  369. package/typeExtensions.d.ts +25 -0
  370. package/vite-env.d.ts +1 -0
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div v-if="stock">{{ stock.text }}</div>
3
+ <p v-if="stock.items?.length === 0" class="trade-empty">{{ stock.emptyText }}</p>
4
+ <ul v-if="stock.items?.length > 0 && !confirm" class="list-unstyled">
5
+ <li v-for="item of stock.items" class="inline">
6
+ <button :disabled="!tradeService.canPay(item, buyer, seller)"
7
+ class="btn btn-success"
8
+ type="button"
9
+ @click="buyOrSell(item)">
10
+ {{ tradeService.displayPrice(item, tradeService.actualPrice(item, buyer, seller)) }}
11
+ </button>
12
+ </li>
13
+ </ul>
14
+
15
+ <div v-if="confirm">
16
+ <p v-html="texts.format(stock.confirmationText, [confirm.name, tradeService.actualPrice(confirm, buyer, seller).toString(), texts.currency])"></p>
17
+ <ul class="list-unstyled">
18
+ <li class="inline">
19
+ <button class="btn btn-primary" type="button" @click="cancel()">{{ texts.cancelBuy }}</button>
20
+ <button class="btn btn-warning" type="button" @click="buyOrSell(confirm)">
21
+ {{ texts.confirmBuy }}
22
+ </button>
23
+ </li>
24
+ </ul>
25
+ </div>
26
+ </template>
27
+ <script lang="ts" setup>
28
+ import {storeToRefs} from "pinia";
29
+ import {ICharacter, IItem, IStock, ITrade, useStateStore} from 'storyScript';
30
+ import {ref} from "vue";
31
+
32
+ const store = useStateStore();
33
+ const {game} = storeToRefs(store);
34
+ const {texts, tradeService} = store.services;
35
+
36
+ const {stock, buyer, seller} = defineProps<{
37
+ buyer: ITrade | ICharacter,
38
+ seller: ITrade | ICharacter,
39
+ stock: IStock
40
+ }>();
41
+
42
+ const confirm = ref<IItem>(null);
43
+
44
+ const cancel = (): void => confirm.value = null;
45
+
46
+ const buyOrSell = (item: IItem): boolean => {
47
+ const actualPrice = tradeService.actualPrice(item, buyer, seller);
48
+
49
+ if (actualPrice > 0 && !confirm.value) {
50
+ confirm.value = item;
51
+ return true;
52
+ }
53
+
54
+ confirm.value = null;
55
+ return buyer === game.value.activeCharacter ? tradeService.buy(item, seller) : tradeService.sell(item, buyer);
56
+ }
57
+
58
+ </script>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <modal-dialog :canClose="true"
3
+ :closeButton="true"
4
+ :openState="PlayState.Trade"
5
+ :title="game.trade.name">
6
+ <div id="trade">
7
+ <p class="trade-description">{{ game.trade.text }}</p>
8
+ <stock :buyer="game.activeCharacter" :seller="game.trade" :stock="game.trade.buy"></stock>
9
+ <stock :buyer="game.trade" :seller="game.activeCharacter" :stock="game.trade.sell"></stock>
10
+ <p v-if="game.trade.currency !== undefined">
11
+ {{ texts.format(texts.traderCurrency, [game.trade.currency.toString(), texts.currency]) }}
12
+ </p>
13
+ </div>
14
+ </modal-dialog>
15
+ </template>
16
+ <script lang="ts" setup>
17
+ import {PlayState, useStateStore} from 'storyScript';
18
+ import {storeToRefs} from "pinia";
19
+
20
+ const store = useStateStore();
21
+ const {game} = storeToRefs(store);
22
+ const {texts} = store.services;
23
+
24
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div id="action-log" class="box-container">
3
+ <div class="box-title">{{ texts.messages }}</div>
4
+ <ul class="action-log list-unstyled">
5
+ <li v-for="message of game.actionLog" v-html="message"></li>
6
+ </ul>
7
+ </div>
8
+ </template>
9
+ <script lang="ts" setup>
10
+ import {useStateStore} from 'storyScript';
11
+ import {storeToRefs} from "pinia";
12
+
13
+ const store = useStateStore();
14
+ const {game} = storeToRefs(store);
15
+ const {texts} = store.services;
16
+
17
+ </script>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div v-for="barrier of destination.barriers" class="barrier">
3
+ <button v-if="!barrier[1].actions?.length" class="btn btn-outline-primary">{{ barrier[1].name }}</button>
4
+ <div v-else class="dropdown">
5
+ <button :aria-expanded="dropDownExpanded"
6
+ class="btn btn-outline-primary dropdown-toggle"
7
+ type="button" @click="dropDownExpanded = !dropDownExpanded"
8
+ @focusout="dropDownLoseFocus">
9
+ {{ barrier[1].name }}
10
+ </button>
11
+ <ul
12
+ v-if="dropDownExpanded"
13
+ :class="dropDownMenuActive"
14
+ class="dropdown-menu action-select"
15
+ @mouseleave="mouseOverDropDown = false"
16
+ @mouseover="mouseOverDropDown = true">
17
+ <li v-for="action of barrier[1].actions">
18
+ <a class="dropdown-item" href="#" @click="executeBarrierAction(barrier, action, destination)">
19
+ {{ action[1].text }}
20
+ </a>
21
+ </li>
22
+ </ul>
23
+ </div>
24
+ </div>
25
+ <button :class="destination.style"
26
+ :disabled="!destination.target || destination.barriers?.length > 0"
27
+ class="btn btn-info"
28
+ type="button"
29
+ @click="game.commands.go(destination.target)">
30
+ <span v-if="(<any>destination).isPreviousLocation" class="back-label">{{ texts.back }}</span>
31
+ {{ destination.name }}
32
+ </button>
33
+ </template>
34
+ <script lang="ts" setup>
35
+ import {storeToRefs} from "pinia";
36
+ import {computed, ref} from "vue";
37
+ import {IBarrier, IBarrierAction, IDestination, useStateStore} from 'storyScript';
38
+
39
+ const store = useStateStore();
40
+ const {game} = storeToRefs(store);
41
+ const {texts, commandService} = store.services;
42
+
43
+ const {destination} = defineProps<{
44
+ destination: IDestination
45
+ }>();
46
+
47
+ const dropDownExpanded = ref(false);
48
+ const mouseOverDropDown = ref(false);
49
+ const dropDownMenuActive = computed(() => dropDownExpanded.value ? 'dropdown-menu-active' : '');
50
+
51
+ const dropDownLoseFocus = () => {
52
+ if (!mouseOverDropDown.value) {
53
+ dropDownExpanded.value = false;
54
+ }
55
+ }
56
+
57
+ const executeBarrierAction = (barrier: [string, IBarrier], action: [string, IBarrierAction], destination: IDestination): void => {
58
+ if (game.value.combinations.tryCombine(barrier[1]).success || game.value.combinations.activeCombination) {
59
+ return;
60
+ }
61
+
62
+ commandService.useBarrierAction(destination, barrier, action);
63
+ dropDownExpanded.value = false;
64
+ }
65
+
66
+ </script>
@@ -0,0 +1,67 @@
1
+ <template>
2
+ <div v-if="!enemiesPresent" id="exploration">
3
+ <div v-if="activeActions.length > 0" id="exploration-actions" class="box-container">
4
+ <div class="box-title">{{ texts.actions }}</div>
5
+ <ul v-if="!confirmAction" class="list-unstyled">
6
+ <li v-for="action of activeActions.filter(a => !checkStatus(a, Status.Unavailable))" class="inline">
7
+ <button :class="store.getButtonClass(action)"
8
+ :disabled="checkStatus(action, Status.Disabled)"
9
+ class="btn"
10
+ type="button"
11
+ @click="execute(action)">
12
+ {{ action[1].text }}
13
+ </button>
14
+ </li>
15
+ </ul>
16
+ <div v-else>
17
+ <p v-html="confirmAction[1].confirmationText"></p>
18
+ <ul class="list-unstyled">
19
+ <li class="inline">
20
+ <button class="btn btn-primary" type="button" @click="confirmAction = null">
21
+ {{ texts.cancelAction }}
22
+ </button>
23
+ <button class="btn btn-warning" type="button" @click="execute(confirmAction)">
24
+ {{ texts.confirmAction }}
25
+ </button>
26
+ </li>
27
+ </ul>
28
+ </div>
29
+ </div>
30
+ <div id="exploration-destinations" class="box-container">
31
+ <div class="box-title">{{ texts.destinations }}</div>
32
+ <ul class="list-unstyled">
33
+ <li v-for="destination of activeDestinations" :class="`inline ${destination.visited ? '' : 'not-'}visited`">
34
+ <destination :destination="destination"></destination>
35
+ </li>
36
+ </ul>
37
+ </div>
38
+ </div>
39
+ </template>
40
+ <script lang="ts" setup>
41
+ import {storeToRefs} from "pinia";
42
+ import {ActionStatus, IAction, useStateStore} from 'storyScript';
43
+ import {ref} from "vue";
44
+
45
+ const Status = ActionStatus;
46
+ const store = useStateStore();
47
+ const {game, enemiesPresent, activeActions, activeDestinations} = storeToRefs(store);
48
+ const {commandService, texts} = store.services;
49
+
50
+ const confirmAction = ref<[string, IAction]>(null);
51
+
52
+ const checkStatus = (action: [string, IAction], status: ActionStatus) =>
53
+ typeof action[1].status === 'function'
54
+ ? action[1].status(game.value) == status
55
+ : action[1].status === undefined ? false : action[1].status == status;
56
+
57
+ const execute = (action: [string, IAction]): void => {
58
+ if (action[1].confirmationText && !confirmAction.value) {
59
+ confirmAction.value = action;
60
+ return;
61
+ }
62
+
63
+ confirmAction.value = undefined;
64
+ commandService.useAction(action);
65
+ }
66
+
67
+ </script>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div v-if="!enemiesPresent && activeItems.length > 0" id="exploration-onground" class="box-container">
3
+ <div class="box-title">{{ texts.onTheGround }}</div>
4
+ <ul class="list-unstyled">
5
+ <li v-for="item of activeItems"
6
+ :class="game.combinations.getCombineClass(item)"
7
+ @click="itemService.pickupItem(game.activeCharacter, item)">
8
+ {{ itemService.getItemName(item) }}
9
+ </li>
10
+ </ul>
11
+ </div>
12
+ </template>
13
+ <script lang="ts" setup>
14
+ import {useStateStore} from 'storyScript';
15
+ import {storeToRefs} from "pinia";
16
+
17
+ const store = useStateStore();
18
+ const {game, useGround, enemiesPresent, activeItems} = storeToRefs(store);
19
+ const {texts, itemService} = store.services;
20
+ useGround.value = true;
21
+
22
+ </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div v-if="map" class="box-container map-container" tabindex="0">
3
+ <div class="map-name">
4
+ <div class="float-left">
5
+ {{ map.name }}
6
+ <span v-if="markerKey" class="show-marker-instructions" @click="toggleTouchMarkersVisible()">
7
+ {{ isTouchDevice ? texts.touchToShowMarkers : texts.format(texts.pressToShowMarkers, [markerKey]) }}
8
+ </span>
9
+ </div>
10
+ <div v-if="map.toggleFullScreen"
11
+ class="map-full-screen-toggle"
12
+ @click="toggleFullScreen()">
13
+ {{ texts.openFullScreenMap }}
14
+ </div>
15
+ </div>
16
+ <img ref="map-element" :alt="map.name" :src="`resources/${map.mapImage}`" class="map-image" @load="showMap()">
17
+ <img v-if="map.avatarImage" :alt="map.name" :src="`resources/${map.avatarImage}`" class="avatar-image"
18
+ style="visibility: hidden;">
19
+ </div>
20
+ <dialog ref="map-dialog" class="map-dialog">
21
+ </dialog>
22
+ </template>
23
+ <script lang="ts" setup>
24
+ import {useTemplateRef} from "vue";
25
+ import {isTouchDevice, useLocationMap, useStateStore} from 'storyScript';
26
+
27
+ const store = useStateStore();
28
+ const {texts} = store.services;
29
+ const {
30
+ map,
31
+ showMap,
32
+ toggleFullScreen,
33
+ toggleTouchMarkersVisible
34
+ } = useLocationMap(useTemplateRef('map-element'), useTemplateRef('map-dialog'));
35
+
36
+ const markerKey = map.value.showMarkersOnKeyPress ?
37
+ // When an empty value is specified use the space key. Use the key specified otherwise.
38
+ map.value.showMarkersOnKeyPress.trim()
39
+ ? map.value.showMarkersOnKeyPress : 'space'
40
+ : null;
41
+
42
+ </script>
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <div v-if="show" id="location" class="box-container">
3
+ <div class="box-title" v-html="texts.format(texts.youAreHere, [game.currentLocation.name])"></div>
4
+ <img v-if="game.currentLocation.picture"
5
+ :alt="game.currentLocation.name"
6
+ :src="game.currentLocation.picture"
7
+ class="location-picture"/>
8
+ <div ref="description"
9
+ @click="event => click(event)"
10
+ @mouseout="event => mouseOut(event)"
11
+ @mouseover="event => mouseOver(event)"
12
+ v-html="descriptionToShow"></div>
13
+ <ul id="location-log" class="list-unstyled">
14
+ <li v-for="message in game.currentLocation.log" v-html="message"></li>
15
+ </ul>
16
+ </div>
17
+ </template>
18
+ <script lang="ts" setup>
19
+ import {computed, onMounted, ref, useTemplateRef, watch} from "vue";
20
+ import {checkAutoplay, useStateStore, useTextFeatures} from 'storyScript';
21
+ import {storeToRefs} from "pinia";
22
+
23
+ const store = useStateStore();
24
+ const {game} = storeToRefs(store);
25
+ const {texts} = store.services;
26
+ const {click, mouseOver, mouseOut, refreshFeatures} = useTextFeatures(useTemplateRef('description'));
27
+
28
+ const show = computed(() => game.value.currentLocation.description || !game.value.currentLocation.features?.collectionPicture);
29
+ const descriptionToShow = ref<string>(null);
30
+
31
+ watch(() => game.value.currentLocation.description, async (newValue) => {
32
+ descriptionToShow.value = checkAutoplay(game.value, newValue);
33
+ }, {immediate: true});
34
+
35
+ onMounted(() => {
36
+ refreshFeatures();
37
+ });
38
+
39
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div v-if="location?.features?.collectionPicture" id="location-visual" class="box-container">
3
+ <div class="box-title" v-html="texts.format(texts.youAreHere, [location.name])"></div>
4
+ <div id="visual-features" ref="location-features">
5
+ <img :alt="location.name" :src="`resources/${location.features.collectionPicture}`" :usemap="'#' + location.id"
6
+ @load="initFeatures()">
7
+ <map :name="location.id">
8
+ <area v-for="feature of location.features" :id="`feature-area-${feature.id}`" :alt="feature.name"
9
+ :class="getFeatureClass(feature)" :coords="feature.coords"
10
+ :shape="feature.shape" href="#" @click="game.combinations.tryCombine(feature)"/>
11
+ </map>
12
+ <div v-for="feature of location.features">
13
+ <img v-if="feature.picture" :id="`feature-${feature.id}`" :alt="feature.name"
14
+ :src="`resources/${feature.picture}`" class="feature-picture feature-cursor"
15
+ @click="game.combinations.tryCombine(feature)"/>
16
+ <sprite v-if="feature.animation" :id="`feature-${feature.id}`" :alt="feature.name"
17
+ :class="getFeatureClass(feature)" :factor="factor" :spriteSettings="feature.animation"
18
+ class="feature-picture"
19
+ @click="game.combinations.tryCombine(feature)"></sprite>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </template>
24
+ <script lang="ts" setup>
25
+ import {computed, useTemplateRef} from "vue";
26
+ import {storeToRefs} from "pinia";
27
+ import {IFeature, useStateStore, useVisualFeatures} from 'storyScript';
28
+
29
+ const store = useStateStore();
30
+ const {game} = storeToRefs(store);
31
+ const {texts} = store.services;
32
+ const location = computed(() => game.value.currentLocation);
33
+
34
+ const {initFeatures, factor} = useVisualFeatures(useTemplateRef('location-features'));
35
+
36
+ const getFeatureClass = (feature: IFeature) => feature.interactive === false ? '' : 'feature-cursor';
37
+
38
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="container-fluid body-content">
3
+ <div class="row">
4
+ <div v-if="game.state === 'Play'" id="party-container" :class="{ 'col-4': showCharacterPane }">
5
+ <party></party>
6
+ </div>
7
+ <div id="location-container"
8
+ :class="{ 'col-8': game.state === 'Play' && showCharacterPane, 'col-12': game.state !== 'Play' || !showCharacterPane }">
9
+ <div v-if="!game.state">
10
+ {{ texts.loading }}
11
+ </div>
12
+
13
+ <div v-if="game.state === 'Play'">
14
+ <encounter></encounter>
15
+ <location-text></location-text>
16
+ <location-visual></location-visual>
17
+ <action-log></action-log>
18
+ <ground></ground>
19
+ <exploration></exploration>
20
+ <enemy></enemy>
21
+ </div>
22
+
23
+ <intro></intro>
24
+ <create-character></create-character>
25
+ <level-up></level-up>
26
+ <game-over></game-over>
27
+ <victory></victory>
28
+ </div>
29
+ </div>
30
+ <div v-if="game.state === 'Play'" class="row">
31
+ <div class="col-12">
32
+ <combinations></combinations>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script lang="ts" setup>
39
+ import {useStateStore} from 'storyScript';
40
+ import {storeToRefs} from "pinia";
41
+ import {computed} from "vue";
42
+
43
+ const store = useStateStore();
44
+ const {game, useEquipment, useBackpack, useQuests, useCharacterSheet} = storeToRefs(store);
45
+ const {texts} = store.services;
46
+
47
+ const showCharacterPane = computed(() => useCharacterSheet.value || useEquipment.value || useBackpack.value || useQuests.value);
48
+
49
+ </script>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <modal-dialog :canClose="true"
3
+ :closeButton="false"
4
+ :openState="PlayState.Menu"
5
+ :title="texts.mainMenu">
6
+ <div id="mainmenu">
7
+ <button v-if="game.state !== GameState.CreateCharacter" class="btn btn-outline-dark btn-lg" type="button"
8
+ @click="save()">{{ texts.saveGame }}
9
+ </button>
10
+ <button class="btn btn-outline-dark btn-lg" type="button" @click="load()">{{ texts.loadGame }}</button>
11
+ <button class="btn btn-outline-danger btn-lg" type="button" @click="restart()">{{ texts.startOver }}</button>
12
+ </div>
13
+
14
+ <div v-if="menuState === 'ConfirmRestart'" id="confirmrestart">
15
+ <h4>
16
+ {{ texts.confirmRestart }}
17
+ </h4>
18
+ <button class="btn btn-outline-dark btn-lg" type="button" @click="cancel()">{{ texts.restartCancelled }}</button>
19
+ <button class="btn btn-outline-danger btn-lg" type="button" @click="restartConfirmed()">{{
20
+ texts.restartConfirmed
21
+ }}
22
+ </button>
23
+ </div>
24
+
25
+ <div v-if="menuState === 'Save' || menuState === 'Load'">
26
+ <div class="row">
27
+ <div id="save-game" class="col-12">
28
+ <p>{{ texts.existingSaveGames }}</p>
29
+ <ul class="list-unstyled">
30
+ <li v-for="key of saveKeys">
31
+ <span @click="setSelected(key)">{{ key }}</span>
32
+ </li>
33
+ </ul>
34
+ <div v-if="menuState === 'Save'">
35
+ <p>{{ texts.newSaveGame }}</p>
36
+ <input v-model="selectedGame" class="col-md-8 question-input" type="text"/>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <div class="row">
41
+ <div class="col-12">
42
+ <p v-if="menuState === 'Save' && overwriteSelected()" class="alert alert-danger">
43
+ {{ texts.format(texts.overwriteSaveGame, [selectedGame]) }}</p>
44
+ <p v-if="menuState === 'Load' && selectedGame" class="alert alert-success">
45
+ {{ texts.format(texts.loadSaveGame, [selectedGame]) }}</p>
46
+ <button v-if="menuState === 'Save'" :disabled="!selectedGame" class="btn btn-primary save-button"
47
+ type="button"
48
+ @click="saveGame()">{{ texts.save }}
49
+ </button>
50
+ <button v-if="menuState === 'Load'" :disabled="!selectedGame" class="btn btn-primary save-button"
51
+ type="button"
52
+ @click="loadGame()">{{ texts.load }}
53
+ </button>
54
+ <button class="btn btn-primary save-button" type="button" @click="cancel()">{{ texts.cancel }}</button>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </modal-dialog>
59
+ </template>
60
+ <script lang="ts" setup>
61
+ import {storeToRefs} from "pinia";
62
+ import {GameState, PlayState, useStateStore} from 'storyScript';
63
+ import {computed, ref} from "vue";
64
+
65
+ const store = useStateStore();
66
+ const {game} = storeToRefs(store);
67
+ const {texts, dataService, gameService} = store.services;
68
+
69
+ const internalState = ref<string>(PlayState.Menu);
70
+ const selectedGame = ref<string>(null);
71
+ const saveKeys = ref<string[]>([]);
72
+ const menuState = computed(() => game.value.playState === PlayState.Menu ? internalState.value ?? PlayState.Menu : null);
73
+
74
+ const restart = (): string => internalState.value = 'ConfirmRestart';
75
+
76
+ const setSelected = (name: string) => selectedGame.value = name;
77
+
78
+ const overwriteSelected = (): boolean => dataService.getSaveKeys().indexOf(selectedGame.value) > -1;
79
+
80
+ const cancel = (): void => {
81
+ setSelected(null);
82
+ internalState.value = null;
83
+ game.value.playState = null;
84
+ }
85
+
86
+ const restartConfirmed = (): void => {
87
+ gameService.restart();
88
+ cancel();
89
+ }
90
+
91
+ const save = (): void => {
92
+ saveKeys.value = dataService.getSaveKeys();
93
+ internalState.value = 'Save';
94
+ }
95
+
96
+ const load = (): void => {
97
+ saveKeys.value = dataService.getSaveKeys();
98
+ internalState.value = 'Load';
99
+ }
100
+
101
+ const saveGame = (): void => {
102
+ dataService.saveGame(game.value, selectedGame.value);
103
+ cancel();
104
+ }
105
+
106
+ const loadGame = (): void => {
107
+ gameService.loadGame(selectedGame.value);
108
+ cancel();
109
+ }
110
+
111
+ </script>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div v-if="game.state === GameState.GameOver" id="game-over" class="container-fluid">
3
+ <div class="col-12">
4
+ <h2>{{ texts.youLost }}</h2>
5
+ <p>{{ texts.questFailed }}</p>
6
+ <div>{{ texts.finalScore }}{{ game.party.score }}</div>
7
+ <button class="btn btn-primary restart" type="button" @click="gameService.restart()">{{ texts.tryAgain }}</button>
8
+ <high-scores v-if="game.party.score > 0" :scores="game.highScores"></high-scores>
9
+ </div>
10
+ </div>
11
+ </template>
12
+ <script lang="ts" setup>
13
+ import {storeToRefs} from "pinia";
14
+ import {GameState, useStateStore} from 'storyScript';
15
+
16
+ const store = useStateStore();
17
+ const {game} = storeToRefs(store);
18
+ const {texts, gameService} = store.services;
19
+
20
+ </script>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div id="highscores">
3
+ <h3>{{ texts.highScores }}</h3>
4
+ <table>
5
+ <tr v-for="score of scores">
6
+ <td>{{ score.name }}</td>
7
+ <td>{{ score.score }}</td>
8
+ </tr>
9
+ </table>
10
+ </div>
11
+ </template>
12
+ <script lang="ts" setup>
13
+ import {useStateStore} from 'storyScript';
14
+
15
+ const store = useStateStore();
16
+ const {texts} = store.services;
17
+
18
+ const {scores} = defineProps<{
19
+ scores: { name: string, score: number }[];
20
+ }>();
21
+
22
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div v-if="game.state === GameState.Intro" id="intro" class="box-container">
3
+ <h2>Game introduction</h2>
4
+ <p>Please copy the IntroComponent.html file to your game and add your introduction here.</p>
5
+ <button class="btn btn-primary" type="button" @click="gameService.restart()">{{ texts.skipIntro }}</button>
6
+ </div>
7
+ </template>
8
+ <script lang="ts" setup>
9
+
10
+ import {storeToRefs} from "pinia";
11
+ import {GameState, useStateStore} from 'storyScript';
12
+
13
+ const store = useStateStore();
14
+ const {game} = storeToRefs(store);
15
+ const {texts, gameService} = store.services;
16
+
17
+ </script>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div v-if="showTitleScreen" id="title-screen" ref="title-screen">
3
+ <h1>{{ texts.gameName }}</h1>
4
+ </div>
5
+ <div v-if="showTitleScreen" id="title-screen-start">
6
+ <button id="start-game" class="btn btn-primary" type="button" @click="startGame()">{{ hasProgress ? texts.continueGame : texts.startGame }}</button>
7
+ </div>
8
+ </template>
9
+ <script lang="ts" setup>
10
+
11
+ import {useStateStore} from 'storyScript';
12
+ import {storeToRefs} from "pinia";
13
+ import {computed, onMounted, useTemplateRef, watch} from "vue";
14
+
15
+ const store = useStateStore();
16
+ const {game} = storeToRefs(store);
17
+ const {rules, texts, gameService, dataService, autoplayService} = store.services;
18
+ const hasProgress = dataService.hasGameState()
19
+
20
+ const titleScreen = useTemplateRef('title-screen');
21
+ const transitionDelay = rules.setup?.titleScreen?.transitionDelay ?? 1;
22
+ const showTitleScreen = computed(() => rules.setup?.titleScreen?.showTitleScreen && !game.value.started);
23
+
24
+ const startGame = () => {
25
+ autoplayService.stop();
26
+ game.value.playState = null;
27
+ gameService.init();
28
+ }
29
+
30
+ onMounted(() => {
31
+ if (titleScreen.value) {
32
+ titleScreen.value.style = `transition: opacity ${transitionDelay}s ease-out;`;
33
+ }
34
+ });
35
+
36
+ watch(() => game.value.autoplaying, (newVal) => {
37
+ if (titleScreen.value) {
38
+ titleScreen.value.style.opacity = newVal ? '0' : '1';
39
+ }
40
+ });
41
+
42
+ </script>