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.
- package/lib/app.vue.d.ts +83 -17
- package/lib/components/MainMenu.vue.d.ts +8 -49
- package/lib/components/Skills.vue.d.ts +6 -7
- package/lib/components/debug/debug-menu.vue.d.ts +18 -8
- package/lib/components/dialog-picture.vue.d.ts +4 -5
- package/lib/components/hud.vue.d.ts +4 -2
- package/lib/components/loading-bar.vue.d.ts +4 -7
- package/lib/components/menu.vue.d.ts +2 -48
- package/lib/components/notification-toast.vue.d.ts +3 -4
- package/lib/components/utils/modal.vue.d.ts +3 -5
- package/lib/components/volume-controls.vue.d.ts +1 -1
- package/lib/config.d.ts +1 -2
- package/lib/dialog-box.vue.d.ts +9 -8
- package/lib/exports/plugins.d.ts +0 -3
- package/lib/gameloop.d.ts +1 -3
- package/lib/index.d.ts +0 -4
- package/lib/index.esm.js +7310 -7157
- package/lib/index.js +7309 -7156
- package/lib/stores/audio-store.d.ts +11 -0
- package/lib/stores/dialog-store.d.ts +27 -0
- package/lib/stores/hud-stats-store.d.ts +20 -0
- package/lib/stores/main-store.d.ts +256 -0
- package/lib/stores/notification-store.d.ts +12 -0
- package/lib/stores/rendering-store.d.ts +13 -0
- package/lib/stores/screens-store.d.ts +23 -0
- package/lib/stores/skills.d.ts +32 -0
- package/lib/stores/vm-store.d.ts +151 -0
- package/lib/types/dialog-box-types.d.ts +1 -1
- package/lib/types/game-save.d.ts +17 -17
- package/lib/types/state.d.ts +0 -96
- package/lib/utils/audio-loader.d.ts +4 -6
- package/lib/utils/data-helpers.d.ts +4 -5
- package/lib/utils/error-handling.d.ts +2 -3
- package/lib/utils/skillchecks.d.ts +6 -9
- package/lib/utils/string-helpers.d.ts +1 -3
- package/lib/vm/commands/choice.d.ts +1 -3
- package/lib/vm/commands/command-plugin.d.ts +2 -3
- package/lib/vm/vm-helpers.d.ts +7 -9
- package/lib/vm/vm.d.ts +4 -8
- package/package.json +5 -5
package/lib/types/state.d.ts
CHANGED
|
@@ -1,99 +1,3 @@
|
|
|
1
|
-
import { AppOptions } from '..';
|
|
2
|
-
import { Parser } from './parser';
|
|
3
|
-
export declare type DialogCallback = (choice: number) => void;
|
|
4
|
-
export interface MachineStack {
|
|
5
|
-
currentIndex: number;
|
|
6
|
-
branch: Parser.Branch;
|
|
7
|
-
label: string;
|
|
8
|
-
}
|
|
9
|
-
export interface DialogKey {
|
|
10
|
-
speaker: string;
|
|
11
|
-
text: string;
|
|
12
|
-
pose?: string;
|
|
13
|
-
choices?: DialogChoice[];
|
|
14
|
-
interactive: boolean;
|
|
15
|
-
id: string;
|
|
16
|
-
}
|
|
17
|
-
export interface DialogChoice {
|
|
18
|
-
choice: string;
|
|
19
|
-
originalIndex: number;
|
|
20
|
-
allowed: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface SkillState {
|
|
23
|
-
level: number;
|
|
24
|
-
xp: number;
|
|
25
|
-
}
|
|
26
|
-
export interface SkillsState {
|
|
27
|
-
[key: string]: SkillState;
|
|
28
|
-
}
|
|
29
|
-
export interface DataState {
|
|
30
|
-
[key: string]: any;
|
|
31
|
-
}
|
|
32
|
-
export interface SkillCheckState {
|
|
33
|
-
passed: boolean;
|
|
34
|
-
available: boolean;
|
|
35
|
-
}
|
|
36
1
|
export interface Vue {
|
|
37
2
|
$mq: 'sm' | 'md' | 'lg';
|
|
38
3
|
}
|
|
39
|
-
export interface NarratState {
|
|
40
|
-
machine: {
|
|
41
|
-
stack: MachineStack[];
|
|
42
|
-
script: Parser.ParsedScript;
|
|
43
|
-
data: DataState;
|
|
44
|
-
};
|
|
45
|
-
skillChecks: {
|
|
46
|
-
[key: string]: SkillCheckState;
|
|
47
|
-
};
|
|
48
|
-
buttons: ButtonsState;
|
|
49
|
-
dialog: DialogKey[];
|
|
50
|
-
count: number;
|
|
51
|
-
ready: boolean;
|
|
52
|
-
skills: SkillsState;
|
|
53
|
-
lastLabel: string;
|
|
54
|
-
playing: boolean;
|
|
55
|
-
currentScreen: string;
|
|
56
|
-
rendering: RenderingState;
|
|
57
|
-
hudStats: HudStatsState;
|
|
58
|
-
audio: {
|
|
59
|
-
currentMusic?: string;
|
|
60
|
-
musicHowlId?: number;
|
|
61
|
-
};
|
|
62
|
-
errors: ErrorState[];
|
|
63
|
-
playTime: {
|
|
64
|
-
start: number;
|
|
65
|
-
previousPlaytime: number;
|
|
66
|
-
};
|
|
67
|
-
notifications: {
|
|
68
|
-
[key: string]: NotificationState;
|
|
69
|
-
};
|
|
70
|
-
options: AppOptions;
|
|
71
|
-
flowState: 'menu' | 'playing';
|
|
72
|
-
openModal: string | false;
|
|
73
|
-
paused: boolean;
|
|
74
|
-
}
|
|
75
|
-
export interface HudStatsState {
|
|
76
|
-
[key: string]: HudStat;
|
|
77
|
-
}
|
|
78
|
-
export declare type HudStat = number;
|
|
79
|
-
export interface NotificationState {
|
|
80
|
-
text: string;
|
|
81
|
-
}
|
|
82
|
-
export interface ButtonsState {
|
|
83
|
-
[key: string]: {
|
|
84
|
-
enabled: boolean;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
export interface RenderingState {
|
|
88
|
-
screenWidth: number;
|
|
89
|
-
screenHeight: number;
|
|
90
|
-
canvasWidth: number;
|
|
91
|
-
canvasHeight: number;
|
|
92
|
-
renderRatio: number;
|
|
93
|
-
topOffset: number;
|
|
94
|
-
leftOffset: number;
|
|
95
|
-
layoutMode: 'horizontal' | 'vertical';
|
|
96
|
-
}
|
|
97
|
-
export interface ErrorState {
|
|
98
|
-
text: string;
|
|
99
|
-
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Config, MusicConfig, AudioConfig } from '../config';
|
|
2
2
|
import { Howl } from 'howler';
|
|
3
|
-
import { State } from 'vue';
|
|
4
|
-
import { ActionContext, Commit } from 'vuex';
|
|
5
3
|
export declare const audio: {
|
|
6
4
|
[key: string]: Howl;
|
|
7
5
|
};
|
|
8
6
|
export declare function loadAudioAssets(config: Config): Promise<void[]>;
|
|
9
7
|
export declare function loadAudio(key: string, config: AudioConfig | MusicConfig): Promise<void>;
|
|
10
|
-
export declare function changeMusic(
|
|
11
|
-
export declare function playAudio(
|
|
8
|
+
export declare function changeMusic(newMusic: string): Promise<void>;
|
|
9
|
+
export declare function playAudio(key: string): number;
|
|
12
10
|
export declare function getAudio(key: string): Howl | undefined;
|
|
13
|
-
export declare function stopAudio(
|
|
14
|
-
export declare function pauseAudio(
|
|
11
|
+
export declare function stopAudio(key: string): void;
|
|
12
|
+
export declare function pauseAudio(key: string): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { State } from 'vue';
|
|
2
1
|
export declare function findDataHelper<T>(sourceObj: any, path: string): [T, string];
|
|
3
2
|
export declare function setDataHelper<T>(sourceObj: any, path: string, value: T): void;
|
|
4
3
|
export declare function addDataHelper<T>(sourceObj: any, path: string, value: T): void;
|
|
5
|
-
export declare function
|
|
6
|
-
data: import("
|
|
7
|
-
skills: import("
|
|
8
|
-
buttons: import("
|
|
4
|
+
export declare function getModifiableDataPinia(): {
|
|
5
|
+
data: import("@/stores/vm-store").DataState;
|
|
6
|
+
skills: import("@/stores/skills").SkillsState;
|
|
7
|
+
buttons: import("@/stores/screens-store").ButtonsState;
|
|
9
8
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ParserContext } from '@/vm/vm-parser';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function error(commit: Commit, text: string): void;
|
|
2
|
+
export declare function parserError(ctx: ParserContext, line: number, text: string): void;
|
|
3
|
+
export declare function error(text: string): void;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { SkillCheckParams } from '@/vm/vm-helpers';
|
|
2
|
-
import { SkillCheckState } from '@/
|
|
3
|
-
import { State } from 'vue';
|
|
4
|
-
import { ActionContext } from 'vuex';
|
|
2
|
+
import { SkillCheckState } from '@/stores/skills';
|
|
5
3
|
export declare function createSkillCheckState(): SkillCheckState;
|
|
6
|
-
export declare function getSkillCheckState(
|
|
4
|
+
export declare function getSkillCheckState(skillCheckId: string): SkillCheckState;
|
|
7
5
|
export declare function getSkillCheckDifficultyScore(value: number, level: number): number;
|
|
8
6
|
export declare function getSkillCheckDifficultyText(value: number, level: number): string;
|
|
9
|
-
export declare function getSkillCheckText({
|
|
10
|
-
context: ActionContext<State, State>;
|
|
7
|
+
export declare function getSkillCheckText({ skill, skillCheckId, value, }: {
|
|
11
8
|
skill: string;
|
|
12
9
|
skillCheckId: string;
|
|
13
10
|
value: number;
|
|
@@ -15,9 +12,9 @@ export declare function getSkillCheckText({ context, skill, skillCheckId, value,
|
|
|
15
12
|
difficultyText: string;
|
|
16
13
|
allowed: boolean;
|
|
17
14
|
};
|
|
18
|
-
export declare function getPassiveSkillCheckText(
|
|
19
|
-
export declare function calculateSkillCheckRoll(
|
|
15
|
+
export declare function getPassiveSkillCheckText(success: boolean, params: SkillCheckParams): string;
|
|
16
|
+
export declare function calculateSkillCheckRoll(skill: string): {
|
|
20
17
|
roll: number;
|
|
21
18
|
unmodifiedRoll: number;
|
|
22
19
|
};
|
|
23
|
-
export declare function resolveSkillCheck(
|
|
20
|
+
export declare function resolveSkillCheck(params: SkillCheckParams): boolean;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { State } from 'vue';
|
|
2
|
-
import { ActionContext } from 'vuex';
|
|
3
1
|
import { CommandPlugin, CommandRunner } from './command-plugin';
|
|
4
2
|
import { Parser } from '@/types/parser';
|
|
5
3
|
export declare const choice: CommandRunner;
|
|
6
|
-
export declare function runChoice(
|
|
4
|
+
export declare function runChoice(cmd: Parser.Command): Promise<void>;
|
|
7
5
|
export declare const choicePlugin: CommandPlugin;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Parser } from '../../types/parser';
|
|
2
|
-
import { DialogChoice, NarratState } from '../../types/state';
|
|
3
|
-
import { ActionContext } from 'vuex';
|
|
4
2
|
import { ParserContext } from '../vm-parser';
|
|
5
|
-
|
|
3
|
+
import { DialogChoice } from '@/stores/dialog-store';
|
|
4
|
+
export declare type CommandRunner = (cmd: Parser.Command, choices?: DialogChoice[]) => Promise<void>;
|
|
6
5
|
export declare type CommandParserFunction = (ctx: CommandParsingContext) => void;
|
|
7
6
|
export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
|
|
8
7
|
export interface CommandParsingContext {
|
package/lib/vm/vm-helpers.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { AddDialogParams } from '@/store';
|
|
1
|
+
import { AddDialogParams } from '@/stores/dialog-store';
|
|
2
2
|
import { Parser } from '@/types/parser';
|
|
3
|
-
|
|
4
|
-
import { ActionContext, Commit } from 'vuex';
|
|
5
|
-
export declare function processSkillCheck(ctx: ActionContext<State, State>, skillcheck: Parser.SkillCheckOptions): boolean;
|
|
3
|
+
export declare function processSkillCheck(skillcheck: Parser.SkillCheckOptions): boolean;
|
|
6
4
|
export interface SkillCheckParams {
|
|
7
5
|
skill: string;
|
|
8
6
|
value: number;
|
|
@@ -10,9 +8,9 @@ export interface SkillCheckParams {
|
|
|
10
8
|
success?: string;
|
|
11
9
|
failure?: string;
|
|
12
10
|
}
|
|
13
|
-
export declare function runSkillCheck(
|
|
14
|
-
export declare function runConditionCommand(
|
|
15
|
-
export declare function writeText(
|
|
16
|
-
export declare function runCondition(
|
|
17
|
-
export declare function textCommand(
|
|
11
|
+
export declare function runSkillCheck(params: SkillCheckParams): boolean;
|
|
12
|
+
export declare function runConditionCommand(command: Parser.Command): Parser.Branch | undefined;
|
|
13
|
+
export declare function writeText(text: string): void;
|
|
14
|
+
export declare function runCondition(condition: string): boolean;
|
|
15
|
+
export declare function textCommand(dialog: AddDialogParams): Promise<void>;
|
|
18
16
|
export declare function getLine(lines: Parser.Line[], index: number): Parser.Line;
|
package/lib/vm/vm.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { ActionContext } from 'vuex';
|
|
2
|
-
import { State } from 'vue';
|
|
3
|
-
import { DialogChoice } from '@/types/state';
|
|
4
1
|
import { CommandPlugin } from './commands/command-plugin';
|
|
5
2
|
import { NarratPluginObject } from '@/exports/plugins';
|
|
6
3
|
import { Parser } from '@/types/parser';
|
|
7
|
-
|
|
4
|
+
import { DialogChoice } from '@/stores/dialog-store';
|
|
8
5
|
export declare class VM {
|
|
9
6
|
plugins: NarratPluginObject[];
|
|
10
7
|
commands: {
|
|
@@ -15,7 +12,6 @@ export declare class VM {
|
|
|
15
12
|
callHook(hookName: string, ...args: any[]): void;
|
|
16
13
|
}
|
|
17
14
|
export declare const vm: VM;
|
|
18
|
-
export declare function runCommand(
|
|
19
|
-
export declare function playerAnswered(
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function finishGame({ commit, state }: ActionContext<State, State>): void;
|
|
15
|
+
export declare function runCommand(cmd: Parser.Command, choices?: DialogChoice[]): Promise<void>;
|
|
16
|
+
export declare function playerAnswered(choiceIndex: number): Promise<void>;
|
|
17
|
+
export declare function finishGame(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "narrat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "narrat narrative engine",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"snowpack": "^3.8.6",
|
|
67
67
|
"tailwindcss": "^2.0.2",
|
|
68
68
|
"typescript": "^4.2.3",
|
|
69
|
-
"vue": "^3.2.
|
|
70
|
-
"
|
|
69
|
+
"vue": "^3.2.37",
|
|
70
|
+
"pinia": "^2.0.14"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"es6-promise": "^4.2.8",
|
|
74
|
-
"vue": "^3.
|
|
75
|
-
"
|
|
74
|
+
"vue": "^3.2.37",
|
|
75
|
+
"pinia": "^2.0.14"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"autoprefixer": "^10.2.6",
|