narrat 0.11.6 → 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 (40) hide show
  1. package/lib/app.vue.d.ts +83 -17
  2. package/lib/components/MainMenu.vue.d.ts +8 -49
  3. package/lib/components/Skills.vue.d.ts +6 -7
  4. package/lib/components/debug/debug-menu.vue.d.ts +18 -8
  5. package/lib/components/dialog-picture.vue.d.ts +4 -5
  6. package/lib/components/hud.vue.d.ts +4 -2
  7. package/lib/components/loading-bar.vue.d.ts +4 -7
  8. package/lib/components/menu.vue.d.ts +2 -48
  9. package/lib/components/notification-toast.vue.d.ts +3 -4
  10. package/lib/components/utils/modal.vue.d.ts +3 -5
  11. package/lib/components/volume-controls.vue.d.ts +1 -1
  12. package/lib/config.d.ts +1 -2
  13. package/lib/dialog-box.vue.d.ts +9 -8
  14. package/lib/exports/plugins.d.ts +0 -3
  15. package/lib/gameloop.d.ts +1 -3
  16. package/lib/index.d.ts +0 -4
  17. package/lib/index.esm.js +7310 -7157
  18. package/lib/index.js +7309 -7156
  19. package/lib/stores/audio-store.d.ts +11 -0
  20. package/lib/stores/dialog-store.d.ts +27 -0
  21. package/lib/stores/hud-stats-store.d.ts +20 -0
  22. package/lib/stores/main-store.d.ts +256 -0
  23. package/lib/stores/notification-store.d.ts +12 -0
  24. package/lib/stores/rendering-store.d.ts +13 -0
  25. package/lib/stores/screens-store.d.ts +23 -0
  26. package/lib/stores/skills.d.ts +32 -0
  27. package/lib/stores/vm-store.d.ts +151 -0
  28. package/lib/types/dialog-box-types.d.ts +1 -1
  29. package/lib/types/game-save.d.ts +17 -17
  30. package/lib/types/state.d.ts +0 -96
  31. package/lib/utils/audio-loader.d.ts +4 -6
  32. package/lib/utils/data-helpers.d.ts +4 -5
  33. package/lib/utils/error-handling.d.ts +2 -3
  34. package/lib/utils/skillchecks.d.ts +6 -9
  35. package/lib/utils/string-helpers.d.ts +1 -3
  36. package/lib/vm/commands/choice.d.ts +1 -3
  37. package/lib/vm/commands/command-plugin.d.ts +2 -3
  38. package/lib/vm/vm-helpers.d.ts +7 -9
  39. package/lib/vm/vm.d.ts +4 -8
  40. package/package.json +5 -5
@@ -0,0 +1,11 @@
1
+ export interface AudioState {
2
+ currentMusic?: string;
3
+ musicHowlId?: number;
4
+ }
5
+ export declare type AudioSave = Omit<AudioState, 'musicHowlId'>;
6
+ export declare const useAudio: import("pinia").StoreDefinition<"audio", AudioState, {}, {
7
+ stopMusic(): void;
8
+ setMusic(music: string, soundId: number): void;
9
+ generateSaveData(): AudioSave;
10
+ loadSaveData(data: AudioSave): void;
11
+ }>;
@@ -0,0 +1,27 @@
1
+ export declare type AddDialogParams = Omit<DialogKey, 'id' | 'interactive'> & {
2
+ interactive?: boolean;
3
+ };
4
+ export interface DialogKey {
5
+ speaker: string;
6
+ text: string;
7
+ pose?: string;
8
+ choices?: DialogChoice[];
9
+ interactive: boolean;
10
+ id: string;
11
+ }
12
+ export interface DialogChoice {
13
+ choice: string;
14
+ originalIndex: number;
15
+ allowed: boolean;
16
+ }
17
+ declare type DialogState = {
18
+ dialog: DialogKey[];
19
+ };
20
+ export declare type DialogSave = DialogState;
21
+ export declare const useDialogStore: import("pinia").StoreDefinition<"dialog", DialogState, {}, {
22
+ generateSaveData(): DialogSave;
23
+ loadSaveData(data: DialogSave): void;
24
+ addDialog(dialog: AddDialogParams): void;
25
+ clearDialog(): void;
26
+ }>;
27
+ export {};
@@ -0,0 +1,20 @@
1
+ import { HudStatConfig } from '../config';
2
+ export interface HudStatsState {
3
+ [key: string]: HudStat;
4
+ }
5
+ export interface HudStat {
6
+ value: number;
7
+ }
8
+ export interface HudState {
9
+ hudStats: HudStatsState;
10
+ }
11
+ export declare type HudSave = HudState;
12
+ export declare const useHud: import("pinia").StoreDefinition<"hud", HudState, {}, {
13
+ setupHudStats(stats: {
14
+ [key: string]: HudStatConfig;
15
+ }): void;
16
+ setStat(stat: string, value: number): void;
17
+ addStat(stat: string, value: number): void;
18
+ generateSaveData(): HudSave;
19
+ loadSaveData(data: HudSave): void;
20
+ }>;
@@ -0,0 +1,256 @@
1
+ import { GameSave } from '@/types/game-save';
2
+ import { AppOptions, Config } from '..';
3
+ export interface ErrorState {
4
+ text: string;
5
+ }
6
+ interface MainState {
7
+ ready: boolean;
8
+ playing: boolean;
9
+ errors: ErrorState[];
10
+ playTime: {
11
+ start: number;
12
+ previousPlaytime: number;
13
+ };
14
+ options: AppOptions;
15
+ flowState: 'menu' | 'playing';
16
+ modal: string | false;
17
+ paused: boolean;
18
+ }
19
+ export interface MainSaveData {
20
+ playTime: number;
21
+ }
22
+ export declare const useMain: import("pinia").StoreDefinition<"main", MainState, {}, {
23
+ setup(scriptPaths: string[], config: Config): Promise<void>;
24
+ startMachine(): void;
25
+ startGame(): Promise<void>;
26
+ loadGame(saveFile: string): Promise<void>;
27
+ playerAnswered(index: number): void;
28
+ menuReturn(): void;
29
+ createError(text: string): void;
30
+ clearErrors(): void;
31
+ setFlowState(flowState: 'menu' | 'playing'): void;
32
+ openModal(modal: string): void;
33
+ closeModal(): void;
34
+ toggleMenu(): void;
35
+ pause(): void;
36
+ unpause(): void;
37
+ setOptions(options: AppOptions): void;
38
+ startPlaying(): void;
39
+ reset(): void;
40
+ generateSaveData(): MainSaveData;
41
+ loadSaveData(data: MainSaveData): void;
42
+ saveGame(): void;
43
+ setLoadedData(save: GameSave): void;
44
+ getAllStates(): {
45
+ main: any & {
46
+ ready: boolean;
47
+ playing: boolean;
48
+ errors: {
49
+ text: string;
50
+ }[];
51
+ playTime: {
52
+ start: number;
53
+ previousPlaytime: number;
54
+ };
55
+ options: {
56
+ logging: boolean;
57
+ debug: boolean;
58
+ };
59
+ flowState: 'menu' | 'playing';
60
+ modal: string | false;
61
+ paused: boolean;
62
+ } & import("pinia")._StoreWithState<"main", MainState, {}, any> & import("pinia")._StoreWithGetters<{}> & import("pinia").PiniaCustomProperties<string, import("pinia").StateTree, import("pinia")._GettersTree<import("pinia").StateTree>, import("pinia")._ActionsTree>;
63
+ screens: import("pinia").Store<"screens", {
64
+ currentScreen: string;
65
+ buttons: import("./screens-store").ButtonsState;
66
+ }, {}, {
67
+ setScreen(screen: string): void;
68
+ setButtons(buttons: {
69
+ [key: string]: import("..").ButtonConfig;
70
+ }): void;
71
+ changeButton(button: string, newValue: boolean): void;
72
+ generateSaveData(): import("./screens-store").ScreenState;
73
+ loadSaveData(data: import("./screens-store").ScreenState): void;
74
+ }>;
75
+ skills: import("pinia").Store<"skills", import("./skills").Skills, {}, {
76
+ setupSkillCheck(skillCheck: import("./skills").SkillCheckState, id: string): void;
77
+ passSkillCheck(skillCheckId: string): void;
78
+ failSkillCheck(skillCheckId: string): void;
79
+ generateSaveData(): import("./skills").Skills;
80
+ loadSaveData(data: import("./skills").Skills): void;
81
+ setupSkills(skills: {
82
+ [key: string]: import("..").SkillData;
83
+ }): void;
84
+ addXp(skill: string, xp: number): void;
85
+ incrementSkill(skill: string, amount: number): void;
86
+ levelledUp(skill: string): void;
87
+ }>;
88
+ dialog: import("pinia").Store<"dialog", {
89
+ dialog: import("./dialog-store").DialogKey[];
90
+ }, {}, {
91
+ generateSaveData(): {
92
+ dialog: import("./dialog-store").DialogKey[];
93
+ };
94
+ loadSaveData(data: {
95
+ dialog: import("./dialog-store").DialogKey[];
96
+ }): void;
97
+ addDialog(dialog: import("./dialog-store").AddDialogParams): void;
98
+ clearDialog(): void;
99
+ }>;
100
+ vm: import("pinia").Store<"vm", import("./vm-store").VMState, {
101
+ currentStack(state: {
102
+ stack: {
103
+ currentIndex: number;
104
+ branch: {
105
+ code: string;
106
+ args: string[];
107
+ operator: string;
108
+ commandType: string;
109
+ options: import("../types/parser").Parser.EmptyOptions | {
110
+ condition: string;
111
+ success: any[];
112
+ failure?: any[];
113
+ } | {
114
+ label: string;
115
+ } | {
116
+ text: string;
117
+ } | {
118
+ prompt: any;
119
+ choices: {
120
+ choice: string;
121
+ branch: any[];
122
+ condition?: string;
123
+ skillCheck?: {
124
+ id: string;
125
+ skill: string;
126
+ value: number;
127
+ hideAfterRoll: boolean;
128
+ success: {
129
+ text: string;
130
+ branch: any[];
131
+ };
132
+ failure: {
133
+ text: string;
134
+ branch?: any[];
135
+ };
136
+ };
137
+ index: number;
138
+ }[];
139
+ } | {
140
+ screen: string;
141
+ } | {
142
+ mode: "sound" | "music";
143
+ audio: string;
144
+ } | {
145
+ mode: "sound" | "music";
146
+ audio?: string;
147
+ } | {
148
+ duration: number;
149
+ };
150
+ fileName: string;
151
+ line: number;
152
+ }[];
153
+ label: string;
154
+ }[];
155
+ script: import("../types/parser").Parser.ParsedScript;
156
+ data: import("./vm-store").DataState;
157
+ lastLabel: string;
158
+ } & import("pinia").PiniaCustomStateProperties<import("./vm-store").VMState>): {
159
+ currentIndex: number;
160
+ branch: {
161
+ code: string;
162
+ args: string[];
163
+ operator: string;
164
+ commandType: string;
165
+ options: import("../types/parser").Parser.EmptyOptions | {
166
+ condition: string;
167
+ success: any[];
168
+ failure?: any[];
169
+ } | {
170
+ label: string;
171
+ } | {
172
+ text: string;
173
+ } | {
174
+ prompt: any;
175
+ choices: {
176
+ choice: string;
177
+ branch: any[];
178
+ condition?: string;
179
+ skillCheck?: {
180
+ id: string;
181
+ skill: string;
182
+ value: number;
183
+ hideAfterRoll: boolean;
184
+ success: {
185
+ text: string;
186
+ branch: any[];
187
+ };
188
+ failure: {
189
+ text: string;
190
+ branch?: any[];
191
+ };
192
+ };
193
+ index: number;
194
+ }[];
195
+ } | {
196
+ screen: string;
197
+ } | {
198
+ mode: "sound" | "music";
199
+ audio: string;
200
+ } | {
201
+ mode: "sound" | "music";
202
+ audio?: string;
203
+ } | {
204
+ duration: number;
205
+ };
206
+ fileName: string;
207
+ line: number;
208
+ }[];
209
+ label: string;
210
+ };
211
+ currentLine(): import("../types/parser").Parser.Command;
212
+ }, {
213
+ generateSaveData(): import("./vm-store").VMSave;
214
+ loadSaveData(data: import("./vm-store").VMSave): void;
215
+ loadScripts(scriptPaths: string[]): Promise<void>;
216
+ start(): void;
217
+ setLastLabel(label: string): void;
218
+ reset(): void;
219
+ setScript(script: import("../types/parser").Parser.ParsedScript): void;
220
+ overrideData(data: import("./vm-store").DataState): void;
221
+ setStack(stack: import("./vm-store").MachineStack): void;
222
+ setData(path: string, value: any): void;
223
+ addInstruction(path: string, value: any): void;
224
+ addStack(newStack: Partial<import("./vm-store").MachineStack>): void;
225
+ nextLine(): Promise<any>;
226
+ previousStack(): void;
227
+ finishGame(): void;
228
+ runLine(): Promise<void>;
229
+ runLabel(label: string): void;
230
+ }>;
231
+ hud: import("pinia").Store<"hud", import("./hud-stats-store").HudState, {}, {
232
+ setupHudStats(stats: {
233
+ [key: string]: import("..").HudStatConfig;
234
+ }): void;
235
+ setStat(stat: string, value: number): void;
236
+ addStat(stat: string, value: number): void;
237
+ generateSaveData(): import("./hud-stats-store").HudState;
238
+ loadSaveData(data: import("./hud-stats-store").HudState): void;
239
+ }>;
240
+ audio: import("pinia").Store<"audio", import("./audio-store").AudioState, {}, {
241
+ stopMusic(): void;
242
+ setMusic(music: string, soundId: number): void;
243
+ generateSaveData(): import("./audio-store").AudioSave;
244
+ loadSaveData(data: import("./audio-store").AudioSave): void;
245
+ }>;
246
+ rendering: import("pinia").Store<"rendering", import("./rendering-store").RenderingState, {}, {
247
+ updateScreenSize(width: number, height: number, textWidth: number): void;
248
+ }>;
249
+ notifications: import("pinia").Store<"notifications", import("./notification-store").NotificationsState, {}, {
250
+ addNotification(text: string): Promise<void>;
251
+ deleteNotification(id: string): void;
252
+ }>;
253
+ };
254
+ overrideStates(override: any): void;
255
+ }>;
256
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface NotificationState {
2
+ text: string;
3
+ }
4
+ export interface NotificationsState {
5
+ notifications: {
6
+ [key: string]: NotificationState;
7
+ };
8
+ }
9
+ export declare const useNotifications: import("pinia").StoreDefinition<"notifications", NotificationsState, {}, {
10
+ addNotification(text: string): Promise<void>;
11
+ deleteNotification(id: string): void;
12
+ }>;
@@ -0,0 +1,13 @@
1
+ export interface RenderingState {
2
+ screenWidth: number;
3
+ screenHeight: number;
4
+ canvasWidth: number;
5
+ canvasHeight: number;
6
+ renderRatio: number;
7
+ topOffset: number;
8
+ leftOffset: number;
9
+ layoutMode: 'horizontal' | 'vertical';
10
+ }
11
+ export declare const useRenderingStore: import("pinia").StoreDefinition<"rendering", RenderingState, {}, {
12
+ updateScreenSize(width: number, height: number, textWidth: number): void;
13
+ }>;
@@ -0,0 +1,23 @@
1
+ import { ButtonConfig } from '..';
2
+ export interface ButtonsState {
3
+ [key: string]: {
4
+ enabled: boolean;
5
+ };
6
+ }
7
+ export interface ScreenState {
8
+ currentScreen: string;
9
+ buttons: ButtonsState;
10
+ }
11
+ export declare type ScreenSave = ScreenState;
12
+ export declare const useScreens: import("pinia").StoreDefinition<"screens", {
13
+ currentScreen: string;
14
+ buttons: ButtonsState;
15
+ }, {}, {
16
+ setScreen(screen: string): void;
17
+ setButtons(buttons: {
18
+ [key: string]: ButtonConfig;
19
+ }): void;
20
+ changeButton(button: string, newValue: boolean): void;
21
+ generateSaveData(): ScreenSave;
22
+ loadSaveData(data: ScreenSave): void;
23
+ }>;
@@ -0,0 +1,32 @@
1
+ import { SkillData } from '..';
2
+ export interface SkillState {
3
+ level: number;
4
+ xp: number;
5
+ }
6
+ export interface SkillsState {
7
+ [key: string]: SkillState;
8
+ }
9
+ export interface SkillCheckState {
10
+ passed: boolean;
11
+ available: boolean;
12
+ }
13
+ export interface Skills {
14
+ skillChecks: {
15
+ [key: string]: SkillCheckState;
16
+ };
17
+ skills: SkillsState;
18
+ }
19
+ export declare type SkillsSave = Skills;
20
+ export declare const useSkills: import("pinia").StoreDefinition<"skills", Skills, {}, {
21
+ setupSkillCheck(skillCheck: SkillCheckState, id: string): void;
22
+ passSkillCheck(skillCheckId: string): void;
23
+ failSkillCheck(skillCheckId: string): void;
24
+ generateSaveData(): SkillsSave;
25
+ loadSaveData(data: SkillsSave): void;
26
+ setupSkills(skills: {
27
+ [key: string]: SkillData;
28
+ }): void;
29
+ addXp(skill: string, xp: number): void;
30
+ incrementSkill(skill: string, amount: number): void;
31
+ levelledUp(skill: string): void;
32
+ }>;
@@ -0,0 +1,151 @@
1
+ import { Parser } from '@/types/parser';
2
+ export declare type AddStackOptions = Partial<MachineStack>;
3
+ export interface MachineStack {
4
+ currentIndex: number;
5
+ branch: Parser.Branch;
6
+ label: string;
7
+ }
8
+ export interface DataState {
9
+ [key: string]: any;
10
+ }
11
+ export interface VMState {
12
+ stack: MachineStack[];
13
+ script: Parser.ParsedScript;
14
+ data: DataState;
15
+ lastLabel: string;
16
+ }
17
+ export interface VMSave {
18
+ lastLabel: string;
19
+ data: DataState;
20
+ }
21
+ export declare const useVM: import("pinia").StoreDefinition<"vm", VMState, {
22
+ currentStack(state: {
23
+ stack: {
24
+ currentIndex: number;
25
+ branch: {
26
+ code: string;
27
+ args: string[];
28
+ operator: string;
29
+ commandType: string;
30
+ options: Parser.EmptyOptions | {
31
+ condition: string;
32
+ success: any[];
33
+ failure?: any[];
34
+ } | {
35
+ label: string;
36
+ } | {
37
+ text: string;
38
+ } | {
39
+ prompt: any;
40
+ choices: {
41
+ choice: string;
42
+ branch: any[];
43
+ condition?: string;
44
+ skillCheck?: {
45
+ id: string;
46
+ skill: string;
47
+ value: number;
48
+ hideAfterRoll: boolean;
49
+ success: {
50
+ text: string;
51
+ branch: any[];
52
+ };
53
+ failure: {
54
+ text: string;
55
+ branch?: any[];
56
+ };
57
+ };
58
+ index: number;
59
+ }[];
60
+ } | {
61
+ screen: string;
62
+ } | {
63
+ mode: "sound" | "music";
64
+ audio: string;
65
+ } | {
66
+ mode: "sound" | "music";
67
+ audio?: string;
68
+ } | {
69
+ duration: number;
70
+ };
71
+ fileName: string;
72
+ line: number;
73
+ }[];
74
+ label: string;
75
+ }[];
76
+ script: Parser.ParsedScript;
77
+ data: DataState;
78
+ lastLabel: string;
79
+ } & import("pinia").PiniaCustomStateProperties<VMState>): {
80
+ currentIndex: number;
81
+ branch: {
82
+ code: string;
83
+ args: string[];
84
+ operator: string;
85
+ commandType: string;
86
+ options: Parser.EmptyOptions | {
87
+ condition: string;
88
+ success: any[];
89
+ failure?: any[];
90
+ } | {
91
+ label: string;
92
+ } | {
93
+ text: string;
94
+ } | {
95
+ prompt: any;
96
+ choices: {
97
+ choice: string;
98
+ branch: any[];
99
+ condition?: string;
100
+ skillCheck?: {
101
+ id: string;
102
+ skill: string;
103
+ value: number;
104
+ hideAfterRoll: boolean;
105
+ success: {
106
+ text: string;
107
+ branch: any[];
108
+ };
109
+ failure: {
110
+ text: string;
111
+ branch?: any[];
112
+ };
113
+ };
114
+ index: number;
115
+ }[];
116
+ } | {
117
+ screen: string;
118
+ } | {
119
+ mode: "sound" | "music";
120
+ audio: string;
121
+ } | {
122
+ mode: "sound" | "music";
123
+ audio?: string;
124
+ } | {
125
+ duration: number;
126
+ };
127
+ fileName: string;
128
+ line: number;
129
+ }[];
130
+ label: string;
131
+ };
132
+ currentLine(): Parser.Command;
133
+ }, {
134
+ generateSaveData(): VMSave;
135
+ loadSaveData(data: VMSave): void;
136
+ loadScripts(scriptPaths: string[]): Promise<void>;
137
+ start(): void;
138
+ setLastLabel(label: string): void;
139
+ reset(): void;
140
+ setScript(script: Parser.ParsedScript): void;
141
+ overrideData(data: DataState): void;
142
+ setStack(stack: MachineStack): void;
143
+ setData(path: string, value: any): void;
144
+ addInstruction(path: string, value: any): void;
145
+ addStack(newStack: AddStackOptions): void;
146
+ nextLine(): Promise<any>;
147
+ previousStack(): void;
148
+ finishGame(): void;
149
+ runLine(): Promise<void>;
150
+ runLabel(label: string): void;
151
+ }>;
@@ -1,4 +1,4 @@
1
- import { DialogChoice } from './state';
1
+ import { DialogChoice } from '@/stores/dialog-store';
2
2
  export interface DialogBoxParameters {
3
3
  title: string;
4
4
  text: string;
@@ -1,17 +1,17 @@
1
- import { ButtonsState, HudStatsState, DataState, DialogKey, SkillCheckState, SkillsState } from './state';
2
- export interface GameSave {
3
- data: DataState;
4
- skills: SkillsState;
5
- dialog: DialogKey[];
6
- lastLabel: string;
7
- buttons: ButtonsState;
8
- skillChecks: {
9
- [key: string]: SkillCheckState;
10
- };
11
- playTime: number;
12
- hudStats: HudStatsState;
13
- audio: {
14
- currentMusic?: string;
15
- };
16
- currentScreen: string;
17
- }
1
+ import { AudioSave } from '@/stores/audio-store';
2
+ import { DialogSave } from '@/stores/dialog-store';
3
+ import { HudSave } from '@/stores/hud-stats-store';
4
+ import { MainSaveData } from '@/stores/main-store';
5
+ import { ScreenSave } from '@/stores/screens-store';
6
+ import { SkillsSave } from '@/stores/skills';
7
+ import { VMSave } from '@/stores/vm-store';
8
+ export declare type GameSave = {
9
+ version: string;
10
+ skills: SkillsSave;
11
+ screen: ScreenSave;
12
+ main: MainSaveData;
13
+ dialog: DialogSave;
14
+ vm: VMSave;
15
+ audio: AudioSave;
16
+ hud: HudSave;
17
+ };