narrat 0.11.1 → 0.11.4
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 +3 -12
- package/lib/index.esm.js +5 -33
- package/lib/index.js +13 -35
- 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 +2 -1
- 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 { State } from 'vue';
|
|
2
|
+
import { ActionContext } from 'vuex';
|
|
3
|
+
import { NarratPlugin } from '../plugins/NarratPlugin';
|
|
4
|
+
import { CommandPlugin, generateParser } from '../vm/commands/command-plugin';
|
|
5
|
+
import type { CommandRunner } from '../vm/commands/command-plugin';
|
|
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<State, State>;
|
|
21
|
+
export { CommandRunner };
|
|
22
|
+
export { CommandPlugin, NarratPluginObject, NarratPlugin, registerPlugin, addCommand, generateParser, };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import 'es6-promise/auto';
|
|
2
2
|
import './/sass/main.css';
|
|
3
3
|
import { App, State } from 'vue';
|
|
4
|
-
import './lib';
|
|
5
4
|
import { GameConfig } from './types/app-types';
|
|
6
5
|
import { Store } from 'vuex';
|
|
7
|
-
import * as plugins from './plugins';
|
|
8
|
-
import * as display from './display';
|
|
9
|
-
import * as config from './config';
|
|
10
6
|
export interface AppOptions {
|
|
11
7
|
logging: boolean;
|
|
12
8
|
debug: boolean;
|
|
@@ -22,11 +18,6 @@ declare global {
|
|
|
22
18
|
narrat: Narrat;
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
plugins: typeof plugins;
|
|
29
|
-
display: typeof display;
|
|
30
|
-
config: typeof config;
|
|
31
|
-
};
|
|
32
|
-
export default _default;
|
|
21
|
+
export * from './exports/plugins';
|
|
22
|
+
export * from './exports/display';
|
|
23
|
+
export * from './config';
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.11.
|
|
1
|
+
// Version: 0.11.4 - June 15, 2022 16:48:40
|
|
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';
|
|
@@ -339,13 +339,6 @@ function getSkillConfig(commit, id) {
|
|
|
339
339
|
return skill;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
var config$2 = /*#__PURE__*/Object.freeze({
|
|
343
|
-
__proto__: null,
|
|
344
|
-
setConfig: setConfig,
|
|
345
|
-
getConfig: getConfig,
|
|
346
|
-
getSkillConfig: getSkillConfig
|
|
347
|
-
});
|
|
348
|
-
|
|
349
342
|
var script$1 = defineComponent({
|
|
350
343
|
props: {
|
|
351
344
|
pictureUrl: String,
|
|
@@ -8007,7 +8000,7 @@ function setupStore(options) {
|
|
|
8007
8000
|
mutations: {
|
|
8008
8001
|
setLoadedData(state, save) {
|
|
8009
8002
|
state.machine.data = save.data;
|
|
8010
|
-
state.skills = cjs(state.
|
|
8003
|
+
state.skills = cjs(state.skills, save.skills);
|
|
8011
8004
|
state.dialog = save.dialog;
|
|
8012
8005
|
state.buttons = cjs(state.buttons, save.buttons);
|
|
8013
8006
|
state.lastLabel = save.lastLabel;
|
|
@@ -8750,20 +8743,6 @@ function addCommand(command) {
|
|
|
8750
8743
|
vm$1.addCommand(command);
|
|
8751
8744
|
}
|
|
8752
8745
|
|
|
8753
|
-
var plugins = /*#__PURE__*/Object.freeze({
|
|
8754
|
-
__proto__: null,
|
|
8755
|
-
CommandPlugin: CommandPlugin,
|
|
8756
|
-
NarratPlugin: NarratPlugin,
|
|
8757
|
-
registerPlugin: registerPlugin,
|
|
8758
|
-
addCommand: addCommand,
|
|
8759
|
-
generateParser: generateParser
|
|
8760
|
-
});
|
|
8761
|
-
|
|
8762
|
-
var display = /*#__PURE__*/Object.freeze({
|
|
8763
|
-
__proto__: null,
|
|
8764
|
-
aspectRatioFit: aspectRatioFit
|
|
8765
|
-
});
|
|
8766
|
-
|
|
8767
8746
|
let app;
|
|
8768
8747
|
let store$2;
|
|
8769
8748
|
vm$1.callHook('onPageLoaded');
|
|
@@ -8772,7 +8751,7 @@ async function startApp(config, options) {
|
|
|
8772
8751
|
logManager.setupDebugger(options.debug);
|
|
8773
8752
|
const configFile = await getFile('data/config.json');
|
|
8774
8753
|
setConfig(JSON.parse(configFile));
|
|
8775
|
-
console.log('%c Narrat game engine – 0.11.
|
|
8754
|
+
console.log('%c Narrat game engine – 0.11.4 - June 15, 2022 16:48:40', 'background: #222; color: #bada55');
|
|
8776
8755
|
vm$1.callHook('onNarratSetup');
|
|
8777
8756
|
const storeSetup = setupStore(options);
|
|
8778
8757
|
store$2 = storeSetup.store;
|
|
@@ -8811,14 +8790,7 @@ async function startApp(config, options) {
|
|
|
8811
8790
|
});
|
|
8812
8791
|
}
|
|
8813
8792
|
startGameLoop(store$2);
|
|
8814
|
-
}
|
|
8815
|
-
var index = {
|
|
8816
|
-
startApp,
|
|
8817
|
-
plugins,
|
|
8818
|
-
display,
|
|
8819
|
-
config: config$2,
|
|
8820
|
-
};
|
|
8793
|
+
}
|
|
8821
8794
|
|
|
8822
|
-
export
|
|
8823
|
-
export { config$2 as config, display, plugins, startApp };
|
|
8795
|
+
export { CommandPlugin, NarratPlugin, addCommand, aspectRatioFit, generateParser, getConfig, getSkillConfig, registerPlugin, setConfig, startApp };
|
|
8824
8796
|
//# sourceMappingURL=index.esm.js.map
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.11.
|
|
1
|
+
// Version: 0.11.4 - June 15, 2022 16:48:40
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -343,13 +343,6 @@ function getSkillConfig(commit, id) {
|
|
|
343
343
|
return skill;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
var config$2 = /*#__PURE__*/Object.freeze({
|
|
347
|
-
__proto__: null,
|
|
348
|
-
setConfig: setConfig,
|
|
349
|
-
getConfig: getConfig,
|
|
350
|
-
getSkillConfig: getSkillConfig
|
|
351
|
-
});
|
|
352
|
-
|
|
353
346
|
var script$1 = vue.defineComponent({
|
|
354
347
|
props: {
|
|
355
348
|
pictureUrl: String,
|
|
@@ -8011,7 +8004,7 @@ function setupStore(options) {
|
|
|
8011
8004
|
mutations: {
|
|
8012
8005
|
setLoadedData(state, save) {
|
|
8013
8006
|
state.machine.data = save.data;
|
|
8014
|
-
state.skills = cjs(state.
|
|
8007
|
+
state.skills = cjs(state.skills, save.skills);
|
|
8015
8008
|
state.dialog = save.dialog;
|
|
8016
8009
|
state.buttons = cjs(state.buttons, save.buttons);
|
|
8017
8010
|
state.lastLabel = save.lastLabel;
|
|
@@ -8754,20 +8747,6 @@ function addCommand(command) {
|
|
|
8754
8747
|
vm$1.addCommand(command);
|
|
8755
8748
|
}
|
|
8756
8749
|
|
|
8757
|
-
var plugins = /*#__PURE__*/Object.freeze({
|
|
8758
|
-
__proto__: null,
|
|
8759
|
-
CommandPlugin: CommandPlugin,
|
|
8760
|
-
NarratPlugin: NarratPlugin,
|
|
8761
|
-
registerPlugin: registerPlugin,
|
|
8762
|
-
addCommand: addCommand,
|
|
8763
|
-
generateParser: generateParser
|
|
8764
|
-
});
|
|
8765
|
-
|
|
8766
|
-
var display = /*#__PURE__*/Object.freeze({
|
|
8767
|
-
__proto__: null,
|
|
8768
|
-
aspectRatioFit: aspectRatioFit
|
|
8769
|
-
});
|
|
8770
|
-
|
|
8771
8750
|
let app;
|
|
8772
8751
|
let store$2;
|
|
8773
8752
|
vm$1.callHook('onPageLoaded');
|
|
@@ -8776,7 +8755,7 @@ async function startApp(config, options) {
|
|
|
8776
8755
|
logManager.setupDebugger(options.debug);
|
|
8777
8756
|
const configFile = await getFile('data/config.json');
|
|
8778
8757
|
setConfig(JSON.parse(configFile));
|
|
8779
|
-
console.log('%c Narrat game engine – 0.11.
|
|
8758
|
+
console.log('%c Narrat game engine – 0.11.4 - June 15, 2022 16:48:40', 'background: #222; color: #bada55');
|
|
8780
8759
|
vm$1.callHook('onNarratSetup');
|
|
8781
8760
|
const storeSetup = setupStore(options);
|
|
8782
8761
|
store$2 = storeSetup.store;
|
|
@@ -8815,17 +8794,16 @@ async function startApp(config, options) {
|
|
|
8815
8794
|
});
|
|
8816
8795
|
}
|
|
8817
8796
|
startGameLoop(store$2);
|
|
8818
|
-
}
|
|
8819
|
-
var index = {
|
|
8820
|
-
startApp,
|
|
8821
|
-
plugins,
|
|
8822
|
-
display,
|
|
8823
|
-
config: config$2,
|
|
8824
|
-
};
|
|
8797
|
+
}
|
|
8825
8798
|
|
|
8826
|
-
exports.
|
|
8827
|
-
exports.
|
|
8828
|
-
exports.
|
|
8829
|
-
exports.
|
|
8799
|
+
exports.CommandPlugin = CommandPlugin;
|
|
8800
|
+
exports.NarratPlugin = NarratPlugin;
|
|
8801
|
+
exports.addCommand = addCommand;
|
|
8802
|
+
exports.aspectRatioFit = aspectRatioFit;
|
|
8803
|
+
exports.generateParser = generateParser;
|
|
8804
|
+
exports.getConfig = getConfig;
|
|
8805
|
+
exports.getSkillConfig = getSkillConfig;
|
|
8806
|
+
exports.registerPlugin = registerPlugin;
|
|
8807
|
+
exports.setConfig = setConfig;
|
|
8830
8808
|
exports.startApp = startApp;
|
|
8831
8809
|
//# sourceMappingURL=index.js.map
|
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;
|
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[];
|