narrat 3.6.2-beta.2 → 3.7.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 (45) hide show
  1. package/dist/application/application-start.d.ts +2 -0
  2. package/dist/application/application-utils.d.ts +6 -0
  3. package/dist/application/saving.d.ts +12 -0
  4. package/dist/components/hud.vue.d.ts +12 -0
  5. package/dist/components/skills/skills-composables.d.ts +1 -1
  6. package/dist/config/common-config.d.ts +27 -0
  7. package/dist/config/config-helpers.d.ts +2 -0
  8. package/dist/config/config-input.d.ts +36 -0
  9. package/dist/config/config-output.d.ts +6 -0
  10. package/dist/config.d.ts +2 -1
  11. package/dist/data/StoreInfo.d.ts +23 -0
  12. package/dist/data/all-stores.d.ts +3691 -0
  13. package/dist/examples/default/config/index.d.ts +3 -0
  14. package/dist/examples/demo/config/index.d.ts +3 -0
  15. package/dist/examples/demo/scripts/index.d.ts +2 -0
  16. package/dist/examples/empty/config/index.d.ts +3 -0
  17. package/dist/examples/godot/config/index.d.ts +3 -0
  18. package/dist/examples/rpg/config/index.d.ts +3 -0
  19. package/dist/examples/rpg/scripts/index.d.ts +2 -0
  20. package/dist/narrat.es.js +14703 -14426
  21. package/dist/narrat.es.js.map +1 -1
  22. package/dist/narrat.umd.js +110 -110
  23. package/dist/narrat.umd.js.map +1 -1
  24. package/dist/stores/achievements-store.d.ts +5 -8
  25. package/dist/stores/config-store.d.ts +6 -8
  26. package/dist/stores/hud-stats-store.d.ts +3 -3
  27. package/dist/stores/inventory-store.d.ts +3 -6
  28. package/dist/stores/main-store.d.ts +143 -6015
  29. package/dist/stores/quest-log.d.ts +1 -1
  30. package/dist/stores/screens-store.d.ts +2 -2
  31. package/dist/stores/settings-store.d.ts +1 -1
  32. package/dist/stores/skills.d.ts +1 -1
  33. package/dist/stores/stores-management.d.ts +12 -0
  34. package/dist/stores/vm-store.d.ts +4 -5
  35. package/dist/types/app-types.d.ts +3 -1
  36. package/dist/types/game-save.d.ts +11 -3
  37. package/dist/utils/data-helpers.d.ts +24 -15
  38. package/dist/utils/save-helpers.d.ts +19 -2
  39. package/package.json +3 -3
  40. package/dist/examples/default/config/defaultGameConfig.d.ts +0 -2
  41. package/dist/examples/default/scripts/defaultGameScripts.d.ts +0 -1
  42. package/dist/examples/demo/scripts.d.ts +0 -2
  43. /package/dist/examples/{rpg → default/scripts}/scripts.d.ts +0 -0
  44. /package/dist/examples/empty/{scripts.d.ts → scripts/index.d.ts} +0 -0
  45. /package/dist/examples/godot/{scripts.d.ts → scripts/index.d.ts} +0 -0
@@ -26,7 +26,7 @@ export type QuestLogSave = QuestLogState;
26
26
  export declare const useQuests: import("pinia").StoreDefinition<"quests", QuestLogState, {}, {
27
27
  getQuest(questId: string): QuestState;
28
28
  getObjective(questId: string, objectiveId: string): ObjectiveState;
29
- setupQuests(questsConfig: QuestsConfig): void;
29
+ updateConfig(questsConfig: QuestsConfig): void;
30
30
  reset(questsConfig: QuestsConfig): void;
31
31
  startQuest(questId: string): void;
32
32
  startObjective(questId: string, objectiveId: string): void;
@@ -29,8 +29,8 @@ export declare const useScreens: import("pinia").StoreDefinition<"screens", Scre
29
29
  finishTransition(layer: number): void;
30
30
  transitionScreen(screen: string, transition: AddTransition, layer?: number): Promise<void>;
31
31
  emptyLayer(layer: number, transition?: AddTransition): Promise<void>;
32
- setButtons(config: Config): void;
33
- reset(config: Config): void;
32
+ updateConfig(config: Config['screens']): void;
33
+ reset(config: Config['screens']): void;
34
34
  changeButton(button: string, newValue: ButtonStateValue): void;
35
35
  generateSaveData(): ScreenSave;
36
36
  loadSaveData(data: ScreenSave): void;
@@ -86,7 +86,7 @@ export declare const useSettings: import("pinia").StoreDefinition<"settings", Ga
86
86
  });
87
87
  };
88
88
  setSetting(key: string, value: any): void;
89
- setupSettings(config: CommonConfig): void;
89
+ updateConfig(config: CommonConfig): void;
90
90
  addCustomSetting(key: string, schema: CustomSetting): void;
91
91
  generateSaveData(): GameUserSettingsSave;
92
92
  loadSaveData(data: GameUserSettingsSave): void;
@@ -28,7 +28,7 @@ export declare const useSkills: import("pinia").StoreDefinition<"skills", Skills
28
28
  getSkillCheck(id: string): SkillCheckState;
29
29
  createSkillCheckState(): SkillCheckState;
30
30
  loadSaveData(data: SkillsSave): void;
31
- setupSkills(skillsConfig: SkillsConfig): void;
31
+ updateConfig(skillsConfig: SkillsConfig): void;
32
32
  reset(skillsConfig: SkillsConfig): void;
33
33
  getSkill(skill: string): SkillState;
34
34
  getSkillLevel(skill: string): number;
@@ -0,0 +1,12 @@
1
+ import { StoreInfo } from '../data/StoreInfo';
2
+ import { ExtractedGameSave, GlobalGameSave } from '../types/game-save';
3
+ import { ExtractedSave } from '../utils/save-helpers';
4
+ export declare function setupAllStores(stores: any): void;
5
+ export declare function getAllStores(): {
6
+ [key: string]: StoreInfo;
7
+ };
8
+ export declare function resetAllStores(): void;
9
+ export declare function extractSaveData(): ExtractedSave;
10
+ export declare function loadSaveData(save: ExtractedGameSave): void;
11
+ export declare function loadGlobalSaveData(globalSave: GlobalGameSave): void;
12
+ export declare function loadAllSaveData(save: ExtractedSave): void;
@@ -125,11 +125,10 @@ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
125
125
  currentLine(): Parser.ParsedExpression | undefined;
126
126
  commandWaitingForAnswer(): Parser.Command<any, any> | undefined;
127
127
  }, {
128
- generateSaveData(): {
129
- vmSave: VMSave;
130
- globalData: DataState;
131
- };
132
- loadSaveData(data: VMSave, globalSave: GlobalGameSave): void;
128
+ generateSaveData(): VMSave;
129
+ generateGlobalSaveData(): Pick<GlobalGameSave, 'data'>;
130
+ loadSaveData(data: VMSave): void;
131
+ loadGlobalSaveData(globalSave: Pick<GlobalGameSave, 'data'>): void;
133
132
  findEntitiesInData(data: any): void;
134
133
  setReturnValue(value: any): void;
135
134
  waitForPlayerAnswer(cmd: Parser.Command<any, any>): void;
@@ -13,16 +13,18 @@ import { CharactersFilesConfig } from '../config/characters-config';
13
13
  import { ChoicesInputConfig } from '../config/choices-config';
14
14
  import { AnimationsConfig } from '../config/animations-config';
15
15
  export type NarratModule = {
16
- code: string;
16
+ code: any;
17
17
  fileName: string;
18
18
  id: string;
19
19
  type: 'script' | 'yaml';
20
20
  };
21
21
  export type NarratScript = NarratModule & {
22
22
  type: 'script';
23
+ code: string;
23
24
  };
24
25
  export type NarratYaml = NarratModule & {
25
26
  type: 'yaml';
27
+ code: any;
26
28
  };
27
29
  export interface ConfigFiles {
28
30
  items: ItemsInputConfig;
@@ -19,9 +19,17 @@ export interface SaveSlot {
19
19
  saveData: GameSave | null;
20
20
  slotNumber: number;
21
21
  }
22
- export type GameSave = {
23
- [key: string]: any;
22
+ export type EmptyGameSave = {
23
+ metadata: SaveSlotMetadata;
24
24
  version: string;
25
+ };
26
+ export type ExtractedGameSave = {
27
+ plugins: {
28
+ [key: string]: any;
29
+ };
30
+ customStores: {
31
+ [key: string]: any;
32
+ };
25
33
  skills: SkillsSave;
26
34
  screen: ScreenSave;
27
35
  main: MainSaveData;
@@ -31,13 +39,13 @@ export type GameSave = {
31
39
  hud: HudSave;
32
40
  inventory: InventorySave;
33
41
  quests: QuestLogSave;
34
- metadata: SaveSlotMetadata;
35
42
  screenObjects: ScreenObjectsStoreSave;
36
43
  settings: GameUserSettingsSave;
37
44
  config: ConfigStoreSave;
38
45
  choices: ChoiceTrackingSave;
39
46
  rendering: RenderingSaveData;
40
47
  };
48
+ export type GameSave = EmptyGameSave & ExtractedGameSave;
41
49
  export type GlobalGameSave = {
42
50
  achievements: AchievementsSave;
43
51
  data: {
@@ -29,7 +29,7 @@ export declare function getModifiableDataPinia(): {
29
29
  baseDataPath?: string | undefined;
30
30
  configPath?: string | undefined;
31
31
  scripts: {
32
- code: string;
32
+ code: any;
33
33
  fileName: string;
34
34
  id: string;
35
35
  type: "script";
@@ -61,13 +61,13 @@ export declare function getModifiableDataPinia(): {
61
61
  difficulty: number;
62
62
  }>;
63
63
  } | {
64
- code: string;
64
+ code: any;
65
65
  fileName: string;
66
66
  id: string;
67
67
  type: "yaml";
68
68
  } | undefined;
69
69
  skills?: string | {
70
- code: string;
70
+ code: any;
71
71
  fileName: string;
72
72
  id: string;
73
73
  type: "yaml";
@@ -85,7 +85,7 @@ export declare function getModifiableDataPinia(): {
85
85
  } | undefined;
86
86
  } | undefined;
87
87
  items?: string | {
88
- code: string;
88
+ code: any;
89
89
  fileName: string;
90
90
  id: string;
91
91
  type: "yaml";
@@ -130,7 +130,7 @@ export declare function getModifiableDataPinia(): {
130
130
  };
131
131
  }>;
132
132
  } | {
133
- code: string;
133
+ code: any;
134
134
  fileName: string;
135
135
  id: string;
136
136
  type: "yaml";
@@ -158,7 +158,7 @@ export declare function getModifiableDataPinia(): {
158
158
  }>;
159
159
  }>;
160
160
  } | {
161
- code: string;
161
+ code: any;
162
162
  fileName: string;
163
163
  id: string;
164
164
  type: "yaml";
@@ -186,7 +186,7 @@ export declare function getModifiableDataPinia(): {
186
186
  keywords: string[];
187
187
  }[];
188
188
  } | {
189
- code: string;
189
+ code: any;
190
190
  fileName: string;
191
191
  id: string;
192
192
  type: "yaml";
@@ -208,13 +208,13 @@ export declare function getModifiableDataPinia(): {
208
208
  keyframes: string | any[];
209
209
  }>;
210
210
  } | {
211
- code: string;
211
+ code: any;
212
212
  fileName: string;
213
213
  id: string;
214
214
  type: "yaml";
215
215
  } | undefined;
216
216
  achievements?: string | {
217
- code: string;
217
+ code: any;
218
218
  fileName: string;
219
219
  id: string;
220
220
  type: "yaml";
@@ -233,13 +233,13 @@ export declare function getModifiableDataPinia(): {
233
233
  }> | undefined;
234
234
  } | undefined;
235
235
  scripts?: string | string[] | {
236
- code: string;
236
+ code: any;
237
237
  fileName: string;
238
238
  id: string;
239
239
  type: "yaml";
240
240
  } | undefined;
241
241
  choices?: string | {
242
- code: string;
242
+ code: any;
243
243
  fileName: string;
244
244
  id: string;
245
245
  type: "yaml";
@@ -251,7 +251,7 @@ export declare function getModifiableDataPinia(): {
251
251
  }> | undefined;
252
252
  } | undefined;
253
253
  audio: string | {
254
- code: string;
254
+ code: any;
255
255
  fileName: string;
256
256
  id: string;
257
257
  type: "yaml";
@@ -305,13 +305,13 @@ export declare function getModifiableDataPinia(): {
305
305
  name: string;
306
306
  }>;
307
307
  } | {
308
- code: string;
308
+ code: any;
309
309
  fileName: string;
310
310
  id: string;
311
311
  type: "yaml";
312
312
  };
313
313
  screens: string | {
314
- code: string;
314
+ code: any;
315
315
  fileName: string;
316
316
  id: string;
317
317
  type: "yaml";
@@ -347,7 +347,7 @@ export declare function getModifiableDataPinia(): {
347
347
  }> | undefined;
348
348
  };
349
349
  common: {
350
- code: string;
350
+ code: any;
351
351
  fileName: string;
352
352
  id: string;
353
353
  type: "yaml";
@@ -467,6 +467,15 @@ export declare function getModifiableDataPinia(): {
467
467
  hudStats: Record<string, {
468
468
  minValue?: number | undefined;
469
469
  maxValue?: number | undefined;
470
+ decimals?: number | undefined;
471
+ prefix?: string | undefined;
472
+ suffix?: string | undefined;
473
+ hideName?: boolean | undefined;
474
+ formatting?: {
475
+ currency?: string | undefined;
476
+ unit?: string | undefined;
477
+ style: "decimal" | "currency" | "percent" | "unit";
478
+ } | undefined;
470
479
  name: string;
471
480
  icon: string;
472
481
  startingValue: number;
@@ -1,5 +1,5 @@
1
- import { GameSave, GlobalGameSave, SaveFile, SaveSlotMetadata } from '../types/game-save';
2
- export declare const CURRENT_SAVE_VERSION = "3.3.9";
1
+ import { ExtractedGameSave, GameSave, GlobalGameSave, SaveFile, SaveSlotMetadata } from '../types/game-save';
2
+ export declare const CURRENT_SAVE_VERSION = "3.4.0";
3
3
  export declare function saveFileName(): string;
4
4
  export declare function getSaveFile(): SaveFile;
5
5
  export declare function resetSave(): void;
@@ -16,3 +16,20 @@ export declare function generateMetadata(): SaveSlotMetadata;
16
16
  export type ChosenSlot = {
17
17
  slotId: string;
18
18
  };
19
+ export type ExtractedSave = {
20
+ gameSave: ExtractedGameSave;
21
+ globalSave: GlobalGameSave;
22
+ };
23
+ export type CurrentSaveData = {
24
+ saveSlot: GameSave;
25
+ global: GlobalGameSave;
26
+ };
27
+ export declare function processAutoSave({ slot, name, extractedSave, }: {
28
+ slot: string;
29
+ name?: string;
30
+ extractedSave: ExtractedSave;
31
+ }): {
32
+ saveSlot: GameSave;
33
+ global: GlobalGameSave;
34
+ };
35
+ export declare function manualSave(saveData: CurrentSaveData, playTime: number, slotId: string, name?: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "3.6.2-beta.2",
3
+ "version": "3.7.0",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "dist/narrat.umd.js",
6
6
  "module": "dist/narrat.es.js",
@@ -82,13 +82,13 @@
82
82
  "@types/jsdom": "^21.1.1",
83
83
  "@types/testing-library__jest-dom": "^5.14.5",
84
84
  "@typescript-eslint/eslint-plugin": "^5.30.0",
85
- "@typescript-eslint/parser": "^5.30.0",
85
+ "@typescript-eslint/parser": "^6.9.0",
86
86
  "@vitejs/plugin-vue": "^4.2.3",
87
87
  "chai-style": "^1.0.3",
88
88
  "cross-env": "^7.0.3",
89
89
  "es6-promise": "^4.2.8",
90
90
  "eslint": "^8.18.0",
91
- "eslint-config-prettier": "^8.5.0",
91
+ "eslint-config-prettier": "^9.0.0",
92
92
  "eslint-config-standard": "^17.0.0",
93
93
  "eslint-import-resolver-typescript": "^3.1.1",
94
94
  "eslint-plugin-import": "^2.26.0",
@@ -1,2 +0,0 @@
1
- import { ModuleConfigInput } from '../../../config/config-input';
2
- export declare const defaultGameConfigs: ModuleConfigInput;
@@ -1 +0,0 @@
1
- export declare const defaultGameScripts: any[];
@@ -1,2 +0,0 @@
1
- export declare const demoScripts: any[];
2
- export declare const demoYamls: NarratYaml[];