narrat 0.11.2 → 0.11.5
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 +2 -1
- package/lib/components/Skills.vue.d.ts +2 -2
- package/lib/components/debug/debug-menu.vue.d.ts +2 -2
- package/lib/components/hud.vue.d.ts +2 -2
- package/lib/components/notification-toast.vue.d.ts +1 -1
- package/lib/config.d.ts +101 -2
- package/lib/defaultConfig.d.ts +1 -1
- package/lib/dialog-box.vue.d.ts +1 -1
- package/lib/exports/config.d.ts +1 -0
- package/lib/exports/display.d.ts +2 -0
- package/lib/exports/plugins.d.ts +22 -0
- package/lib/index.d.ts +6 -6
- package/lib/index.esm.js +3 -3
- package/lib/index.js +3 -3
- package/lib/plugins/NarratPlugin.d.ts +1 -1
- package/lib/store.d.ts +1 -1
- package/lib/types/app-types.d.ts +4 -0
- package/lib/types/character-types.d.ts +27 -0
- package/lib/types/dialog-box-types.d.ts +9 -0
- package/lib/types/game-save.d.ts +17 -0
- package/lib/types/parser.d.ts +76 -0
- package/lib/types/state.d.ts +99 -0
- package/lib/utils/audio-loader.d.ts +1 -1
- package/lib/utils/data-helpers.d.ts +3 -3
- package/lib/utils/images-loader.d.ts +1 -1
- package/lib/utils/skillchecks.d.ts +1 -1
- package/lib/vm/commands/choice.d.ts +1 -0
- package/lib/vm/commands/command-plugin.d.ts +3 -3
- package/lib/vm/vm-helpers.d.ts +1 -0
- package/lib/vm/vm-parser.d.ts +1 -0
- package/lib/vm/vm.d.ts +3 -2
- package/package.json +1 -1
package/lib/app.vue.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { DialogKey } from './types/
|
|
2
|
+
import { DialogKey } from './types/state';
|
|
3
3
|
import { DialogBoxParameters } from './types/dialog-box-types';
|
|
4
4
|
import { GameConfig } from './types/app-types';
|
|
5
5
|
import { AppOptions } from '.';
|
|
6
|
+
import { Parser } from './types/parser';
|
|
6
7
|
declare const _default: import("vue").DefineComponent<{
|
|
7
8
|
config: PropType<GameConfig>;
|
|
8
9
|
options: PropType<AppOptions>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SkillCheckState, SkillsState } from '@/types/
|
|
2
|
-
import {
|
|
1
|
+
import { ErrorState, SkillCheckState, SkillsState } from '@/types/state';
|
|
2
|
+
import { Parser } from '@/types/parser';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{}, {}, {
|
|
4
4
|
showDebug: boolean;
|
|
5
5
|
jumping: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HudStatConfig } from '@/
|
|
2
|
-
import { HudStatsState } from '
|
|
1
|
+
import { HudStatConfig } from '@/config';
|
|
2
|
+
import { HudStatsState } from '@/types/state';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{}, {}, void, {
|
|
4
4
|
statsConfig(): {
|
|
5
5
|
[key: string]: HudStatConfig;
|
package/lib/config.d.ts
CHANGED
|
@@ -1,5 +1,104 @@
|
|
|
1
1
|
import { Commit } from 'vuex';
|
|
2
|
-
import { Config } from './types/config';
|
|
3
2
|
export declare function setConfig(conf: Config): void;
|
|
4
3
|
export declare function getConfig(): Config;
|
|
5
|
-
export declare function getSkillConfig(commit: Commit, id: string):
|
|
4
|
+
export declare function getSkillConfig(commit: Commit, id: string): SkillData;
|
|
5
|
+
export interface Config {
|
|
6
|
+
gameTitle: string;
|
|
7
|
+
images: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
layout: {
|
|
11
|
+
backgrounds: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
dialogBottomPadding: number;
|
|
16
|
+
minTextWidth: number;
|
|
17
|
+
mobileDialogHeightPercentage: number;
|
|
18
|
+
verticalLayoutThreshold: number;
|
|
19
|
+
portraits: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
screens: {
|
|
25
|
+
[key: string]: {
|
|
26
|
+
background: string;
|
|
27
|
+
buttons: string[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
buttons: {
|
|
31
|
+
[key: string]: ButtonConfig;
|
|
32
|
+
};
|
|
33
|
+
skills: {
|
|
34
|
+
[key: string]: SkillData;
|
|
35
|
+
};
|
|
36
|
+
skillOptions: {
|
|
37
|
+
xpPerLevel: number;
|
|
38
|
+
};
|
|
39
|
+
skillChecks: {
|
|
40
|
+
rollRange: number;
|
|
41
|
+
skillMultiplier: number;
|
|
42
|
+
failureChance: number;
|
|
43
|
+
difficultyText: Array<[number, string]>;
|
|
44
|
+
};
|
|
45
|
+
scripts: string[];
|
|
46
|
+
audio: {
|
|
47
|
+
[key: string]: AudioConfig;
|
|
48
|
+
};
|
|
49
|
+
audioOptions: {
|
|
50
|
+
volume: number;
|
|
51
|
+
defaultMusic?: string;
|
|
52
|
+
musicFadeInTime: number;
|
|
53
|
+
musicFadeInDelay: number;
|
|
54
|
+
musicFadeOutTime: number;
|
|
55
|
+
};
|
|
56
|
+
sound?: {
|
|
57
|
+
[key: string]: AudioConfig;
|
|
58
|
+
};
|
|
59
|
+
music?: {
|
|
60
|
+
[key: string]: AudioConfig;
|
|
61
|
+
};
|
|
62
|
+
notifications: {
|
|
63
|
+
timeOnScreen: number;
|
|
64
|
+
alsoPrintInDialogue?: boolean;
|
|
65
|
+
};
|
|
66
|
+
hudStats: {
|
|
67
|
+
[key: string]: HudStatConfig;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface HudStatConfig {
|
|
71
|
+
name: string;
|
|
72
|
+
icon: string;
|
|
73
|
+
startingValue: number;
|
|
74
|
+
minValue?: number;
|
|
75
|
+
maxValue?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface AudioConfig {
|
|
78
|
+
src: string;
|
|
79
|
+
path?: string;
|
|
80
|
+
volume?: number;
|
|
81
|
+
rate?: number;
|
|
82
|
+
html5?: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface MusicConfig extends AudioConfig {
|
|
85
|
+
loop?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface ButtonConfig {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
background: string;
|
|
90
|
+
position: {
|
|
91
|
+
left: number;
|
|
92
|
+
top: number;
|
|
93
|
+
width: number;
|
|
94
|
+
height: number;
|
|
95
|
+
};
|
|
96
|
+
action: string;
|
|
97
|
+
}
|
|
98
|
+
export interface SkillData {
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
startingLevel: number;
|
|
102
|
+
hidden?: boolean;
|
|
103
|
+
icon: string;
|
|
104
|
+
}
|
package/lib/defaultConfig.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Config } from './
|
|
1
|
+
import { Config } from './config';
|
|
2
2
|
export declare const defaultConfig: Config;
|
package/lib/dialog-box.vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { DialogStyle } from './types/character-types';
|
|
3
3
|
import { DialogBoxParameters } from './types/dialog-box-types';
|
|
4
|
-
import { DialogChoice } from './types/
|
|
4
|
+
import { DialogChoice } from './types/state';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
options: {
|
|
7
7
|
type: PropType<DialogBoxParameters>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getConfig } from '../config';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ActionContext } from 'vuex';
|
|
2
|
+
import { NarratPlugin } from '../plugins/NarratPlugin';
|
|
3
|
+
import { CommandPlugin, generateParser } from '../vm/commands/command-plugin';
|
|
4
|
+
import type { CommandRunner } from '../vm/commands/command-plugin';
|
|
5
|
+
import { NarratState } from '@/types/state';
|
|
6
|
+
export declare type NarratLifecycleHook = <T extends [...any[]]>(...args: T) => void;
|
|
7
|
+
declare type NarratPluginObject = {
|
|
8
|
+
onPageLoaded?: NarratLifecycleHook;
|
|
9
|
+
onNarratSetup?: NarratLifecycleHook;
|
|
10
|
+
onAppMounted?: NarratLifecycleHook;
|
|
11
|
+
onAssetsLoaded?: NarratLifecycleHook;
|
|
12
|
+
onGameSetup?: NarratLifecycleHook;
|
|
13
|
+
onGameStart?: NarratLifecycleHook;
|
|
14
|
+
onGameMounted?: NarratLifecycleHook;
|
|
15
|
+
onGameUnmounted?: NarratLifecycleHook;
|
|
16
|
+
customCommands?: CommandPlugin[];
|
|
17
|
+
};
|
|
18
|
+
declare function registerPlugin(plugin: NarratPluginObject): void;
|
|
19
|
+
declare function addCommand(command: CommandPlugin): void;
|
|
20
|
+
export declare type NarratActionContext = ActionContext<NarratState, NarratState>;
|
|
21
|
+
export { CommandRunner };
|
|
22
|
+
export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import 'es6-promise/auto';
|
|
2
2
|
import './/sass/main.css';
|
|
3
|
-
import { App
|
|
4
|
-
import './lib';
|
|
3
|
+
import { App } from 'vue';
|
|
5
4
|
import { GameConfig } from './types/app-types';
|
|
6
5
|
import { Store } from 'vuex';
|
|
6
|
+
import { NarratState } from './types/state';
|
|
7
7
|
export interface AppOptions {
|
|
8
8
|
logging: boolean;
|
|
9
9
|
debug: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
|
|
12
12
|
export declare type Narrat = {
|
|
13
|
-
store: Store<
|
|
13
|
+
store: Store<NarratState>;
|
|
14
14
|
app: App;
|
|
15
|
-
state:
|
|
15
|
+
state: NarratState;
|
|
16
16
|
};
|
|
17
17
|
declare global {
|
|
18
18
|
export interface Window {
|
|
19
19
|
narrat: Narrat;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export * from './plugins';
|
|
23
|
-
export * from './display';
|
|
22
|
+
export * from './exports/plugins';
|
|
23
|
+
export * from './exports/display';
|
|
24
24
|
export * from './config';
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.11.
|
|
1
|
+
// Version: 0.11.5 - June 15, 2022 16:55:24
|
|
2
2
|
import 'es6-promise/auto';
|
|
3
3
|
import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, normalizeClass, createBlock, Transition, withCtx, renderSlot, createTextVNode, resolveComponent, withDirectives, vModelText, toDisplayString, TransitionGroup, createVNode, createApp } from 'vue';
|
|
4
4
|
import { createLogger, createStore } from 'vuex';
|
|
@@ -8000,7 +8000,7 @@ function setupStore(options) {
|
|
|
8000
8000
|
mutations: {
|
|
8001
8001
|
setLoadedData(state, save) {
|
|
8002
8002
|
state.machine.data = save.data;
|
|
8003
|
-
state.skills = cjs(state.
|
|
8003
|
+
state.skills = cjs(state.skills, save.skills);
|
|
8004
8004
|
state.dialog = save.dialog;
|
|
8005
8005
|
state.buttons = cjs(state.buttons, save.buttons);
|
|
8006
8006
|
state.lastLabel = save.lastLabel;
|
|
@@ -8751,7 +8751,7 @@ async function startApp(config, options) {
|
|
|
8751
8751
|
logManager.setupDebugger(options.debug);
|
|
8752
8752
|
const configFile = await getFile('data/config.json');
|
|
8753
8753
|
setConfig(JSON.parse(configFile));
|
|
8754
|
-
console.log('%c Narrat game engine – 0.11.
|
|
8754
|
+
console.log('%c Narrat game engine – 0.11.5 - June 15, 2022 16:55:24', 'background: #222; color: #bada55');
|
|
8755
8755
|
vm$1.callHook('onNarratSetup');
|
|
8756
8756
|
const storeSetup = setupStore(options);
|
|
8757
8757
|
store$2 = storeSetup.store;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.11.
|
|
1
|
+
// Version: 0.11.5 - June 15, 2022 16:55:24
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -8004,7 +8004,7 @@ function setupStore(options) {
|
|
|
8004
8004
|
mutations: {
|
|
8005
8005
|
setLoadedData(state, save) {
|
|
8006
8006
|
state.machine.data = save.data;
|
|
8007
|
-
state.skills = cjs(state.
|
|
8007
|
+
state.skills = cjs(state.skills, save.skills);
|
|
8008
8008
|
state.dialog = save.dialog;
|
|
8009
8009
|
state.buttons = cjs(state.buttons, save.buttons);
|
|
8010
8010
|
state.lastLabel = save.lastLabel;
|
|
@@ -8755,7 +8755,7 @@ async function startApp(config, options) {
|
|
|
8755
8755
|
logManager.setupDebugger(options.debug);
|
|
8756
8756
|
const configFile = await getFile('data/config.json');
|
|
8757
8757
|
setConfig(JSON.parse(configFile));
|
|
8758
|
-
console.log('%c Narrat game engine – 0.11.
|
|
8758
|
+
console.log('%c Narrat game engine – 0.11.5 - June 15, 2022 16:55:24', 'background: #222; color: #bada55');
|
|
8759
8759
|
vm$1.callHook('onNarratSetup');
|
|
8760
8760
|
const storeSetup = setupStore(options);
|
|
8761
8761
|
store$2 = storeSetup.store;
|
package/lib/store.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InjectionKey, State } from 'vue';
|
|
2
2
|
import { Store } from 'vuex';
|
|
3
|
-
import { DialogKey, MachineStack } from './types/vuex';
|
|
4
3
|
import { AppOptions } from '.';
|
|
4
|
+
import { DialogKey, MachineStack } from './types/state';
|
|
5
5
|
export declare type AddDialogParams = Omit<DialogKey, 'id'>;
|
|
6
6
|
export interface SetupStoreResult {
|
|
7
7
|
store: Store<State>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface CharactersConfigFile {
|
|
2
|
+
config: {
|
|
3
|
+
imagesPath: string;
|
|
4
|
+
};
|
|
5
|
+
characters: {
|
|
6
|
+
[key: string]: CharacterData;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface CharacterData {
|
|
10
|
+
sprites?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
name: string;
|
|
14
|
+
style?: DialogStyle;
|
|
15
|
+
}
|
|
16
|
+
export interface DialogStyle {
|
|
17
|
+
color?: string;
|
|
18
|
+
boxCss?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
nameCss?: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
textCss?: {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export declare namespace Parser {
|
|
2
|
+
interface IfOptions {
|
|
3
|
+
condition: string;
|
|
4
|
+
success: Branch;
|
|
5
|
+
failure?: Branch;
|
|
6
|
+
}
|
|
7
|
+
interface ChoiceOptions {
|
|
8
|
+
prompt: Command;
|
|
9
|
+
choices: ChoicePrompt[];
|
|
10
|
+
}
|
|
11
|
+
interface ChoicePrompt {
|
|
12
|
+
choice: string;
|
|
13
|
+
branch: Branch;
|
|
14
|
+
condition?: string;
|
|
15
|
+
skillCheck?: SkillCheckOptions;
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
18
|
+
interface PlayOptions {
|
|
19
|
+
mode: 'sound' | 'music';
|
|
20
|
+
audio: string;
|
|
21
|
+
}
|
|
22
|
+
interface StopOptions {
|
|
23
|
+
mode: 'sound' | 'music';
|
|
24
|
+
audio?: string;
|
|
25
|
+
}
|
|
26
|
+
interface SkillCheckOptions {
|
|
27
|
+
id: string;
|
|
28
|
+
skill: string;
|
|
29
|
+
value: number;
|
|
30
|
+
hideAfterRoll: boolean;
|
|
31
|
+
success: {
|
|
32
|
+
text: string;
|
|
33
|
+
branch: Branch;
|
|
34
|
+
};
|
|
35
|
+
failure: {
|
|
36
|
+
text: string;
|
|
37
|
+
branch?: Branch;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface JumpOptions {
|
|
41
|
+
label: string;
|
|
42
|
+
}
|
|
43
|
+
interface WaitOptions {
|
|
44
|
+
duration: number;
|
|
45
|
+
}
|
|
46
|
+
interface TextOptions {
|
|
47
|
+
text: string;
|
|
48
|
+
}
|
|
49
|
+
interface SetScreenOption {
|
|
50
|
+
screen: string;
|
|
51
|
+
}
|
|
52
|
+
interface EmptyOptions {
|
|
53
|
+
}
|
|
54
|
+
type CommandOptions = IfOptions | JumpOptions | EmptyOptions | TextOptions | ChoiceOptions | SetScreenOption | PlayOptions | StopOptions | WaitOptions;
|
|
55
|
+
interface Command {
|
|
56
|
+
code: string;
|
|
57
|
+
args: string[];
|
|
58
|
+
operator: string;
|
|
59
|
+
commandType: string;
|
|
60
|
+
options: CommandOptions;
|
|
61
|
+
fileName: string;
|
|
62
|
+
line: number;
|
|
63
|
+
}
|
|
64
|
+
type Branch = Command[];
|
|
65
|
+
interface ParsedScript {
|
|
66
|
+
[key: string]: Parser.Branch;
|
|
67
|
+
}
|
|
68
|
+
interface Line {
|
|
69
|
+
code: string;
|
|
70
|
+
indentation: number;
|
|
71
|
+
line: number;
|
|
72
|
+
operator: string;
|
|
73
|
+
args: any[];
|
|
74
|
+
branch?: Line[];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
export interface Vue {
|
|
37
|
+
$mq: 'sm' | 'md' | 'lg';
|
|
38
|
+
}
|
|
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
|
+
}
|
|
@@ -3,7 +3,7 @@ export declare function findDataHelper<T>(sourceObj: any, path: string): [T, str
|
|
|
3
3
|
export declare function setDataHelper<T>(sourceObj: any, path: string, value: T): void;
|
|
4
4
|
export declare function addDataHelper<T>(sourceObj: any, path: string, value: T): void;
|
|
5
5
|
export declare function getModifiableData(state: State): {
|
|
6
|
-
data: import("../types/
|
|
7
|
-
skills: import("../types/
|
|
8
|
-
buttons: import("
|
|
6
|
+
data: import("../types/state").DataState;
|
|
7
|
+
skills: import("../types/state").SkillsState;
|
|
8
|
+
buttons: import("../types/state").ButtonsState;
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SkillCheckParams } from '@/vm/vm-helpers';
|
|
2
|
-
import { SkillCheckState } from '@/types/
|
|
2
|
+
import { SkillCheckState } from '@/types/state';
|
|
3
3
|
import { State } from 'vue';
|
|
4
4
|
import { ActionContext } from 'vuex';
|
|
5
5
|
export declare function createSkillCheckState(): SkillCheckState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { State } from 'vue';
|
|
2
2
|
import { ActionContext } from 'vuex';
|
|
3
3
|
import { CommandPlugin, CommandRunner } from './command-plugin';
|
|
4
|
+
import { Parser } from '@/types/parser';
|
|
4
5
|
export declare const choice: CommandRunner;
|
|
5
6
|
export declare function runChoice(context: ActionContext<State, State>, cmd: Parser.Command): Promise<void>;
|
|
6
7
|
export declare const choicePlugin: CommandPlugin;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Parser } from '../../types/parser';
|
|
2
|
+
import { DialogChoice, NarratState } from '../../types/state';
|
|
3
3
|
import { ActionContext } from 'vuex';
|
|
4
4
|
import { ParserContext } from '../vm-parser';
|
|
5
|
-
export declare type CommandRunner = (context: ActionContext<
|
|
5
|
+
export declare type CommandRunner = (context: ActionContext<NarratState, NarratState>, cmd: Parser.Command, choices?: DialogChoice[]) => Promise<void>;
|
|
6
6
|
export declare type CommandParserFunction = (ctx: CommandParsingContext) => void;
|
|
7
7
|
export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
|
|
8
8
|
export interface CommandParsingContext {
|
package/lib/vm/vm-helpers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AddDialogParams } from '@/store';
|
|
2
|
+
import { Parser } from '@/types/parser';
|
|
2
3
|
import { State } from 'vue';
|
|
3
4
|
import { ActionContext, Commit } from 'vuex';
|
|
4
5
|
export declare function processSkillCheck(ctx: ActionContext<State, State>, skillcheck: Parser.SkillCheckOptions): boolean;
|
package/lib/vm/vm-parser.d.ts
CHANGED
package/lib/vm/vm.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionContext } from 'vuex';
|
|
2
2
|
import { State } from 'vue';
|
|
3
|
-
import { DialogChoice } from '@/types/
|
|
3
|
+
import { DialogChoice } from '@/types/state';
|
|
4
4
|
import { CommandPlugin } from './commands/command-plugin';
|
|
5
|
-
import { NarratPluginObject } from '@/plugins';
|
|
5
|
+
import { NarratPluginObject } from '@/exports/plugins';
|
|
6
|
+
import { Parser } from '@/types/parser';
|
|
6
7
|
export declare function runLine(context: ActionContext<State, State>): Promise<void>;
|
|
7
8
|
export declare class VM {
|
|
8
9
|
plugins: NarratPluginObject[];
|