narrat 0.11.2 → 0.11.3
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/components/Skills.vue.d.ts +1 -1
- package/lib/components/hud.vue.d.ts +1 -1
- package/lib/config.d.ts +101 -2
- package/lib/defaultConfig.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 +2 -3
- package/lib/index.esm.js +2 -2
- package/lib/index.js +2 -2
- package/lib/plugins/NarratPlugin.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 +18 -0
- package/lib/types/parser.d.ts +79 -0
- package/lib/utils/audio-loader.d.ts +1 -1
- package/lib/utils/images-loader.d.ts +1 -1
- package/lib/vm/vm.d.ts +1 -1
- package/package.json +1 -1
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;
|
|
@@ -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,7 +1,6 @@
|
|
|
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
6
|
export interface AppOptions {
|
|
@@ -19,6 +18,6 @@ declare global {
|
|
|
19
18
|
narrat: Narrat;
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
|
-
export * from './plugins';
|
|
23
|
-
export * from './display';
|
|
21
|
+
export * from './exports/plugins';
|
|
22
|
+
export * from './exports/display';
|
|
24
23
|
export * from './config';
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.11.
|
|
1
|
+
// Version: 0.11.3 - June 15, 2022 16:22:12
|
|
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';
|
|
@@ -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.3 - June 15, 2022 16:22:12', '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.3 - June 15, 2022 16:22:12
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -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.3 - June 15, 2022 16:22:12', 'background: #222; color: #bada55');
|
|
8759
8759
|
vm$1.callHook('onNarratSetup');
|
|
8760
8760
|
const storeSetup = setupStore(options);
|
|
8761
8761
|
store$2 = storeSetup.store;
|
|
@@ -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,18 @@
|
|
|
1
|
+
import { ButtonsState, HudStatsState } from 'vue';
|
|
2
|
+
import { DataState, DialogKey, SkillCheckState, SkillsState } from './vuex';
|
|
3
|
+
export interface GameSave {
|
|
4
|
+
data: DataState;
|
|
5
|
+
skills: SkillsState;
|
|
6
|
+
dialog: DialogKey[];
|
|
7
|
+
lastLabel: string;
|
|
8
|
+
buttons: ButtonsState;
|
|
9
|
+
skillChecks: {
|
|
10
|
+
[key: string]: SkillCheckState;
|
|
11
|
+
};
|
|
12
|
+
playTime: number;
|
|
13
|
+
hudStats: HudStatsState;
|
|
14
|
+
audio: {
|
|
15
|
+
currentMusic?: string;
|
|
16
|
+
};
|
|
17
|
+
currentScreen: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
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 IfOptions {
|
|
47
|
+
branch: Branch;
|
|
48
|
+
}
|
|
49
|
+
interface TextOptions {
|
|
50
|
+
text: string;
|
|
51
|
+
}
|
|
52
|
+
interface SetScreenOption {
|
|
53
|
+
screen: string;
|
|
54
|
+
}
|
|
55
|
+
interface EmptyOptions {
|
|
56
|
+
}
|
|
57
|
+
type CommandOptions = IfOptions | JumpOptions | EmptyOptions | TextOptions | ChoiceOptions | SetScreenOption | PlayOptions | StopOptions | WaitOptions;
|
|
58
|
+
interface Command {
|
|
59
|
+
code: string;
|
|
60
|
+
args: string[];
|
|
61
|
+
operator: string;
|
|
62
|
+
commandType: string;
|
|
63
|
+
options: CommandOptions;
|
|
64
|
+
fileName: string;
|
|
65
|
+
line: number;
|
|
66
|
+
}
|
|
67
|
+
type Branch = Command[];
|
|
68
|
+
interface ParsedScript {
|
|
69
|
+
[key: string]: Parser.Branch;
|
|
70
|
+
}
|
|
71
|
+
interface Line {
|
|
72
|
+
code: string;
|
|
73
|
+
indentation: number;
|
|
74
|
+
line: number;
|
|
75
|
+
operator: string;
|
|
76
|
+
args: any[];
|
|
77
|
+
branch?: Line[];
|
|
78
|
+
}
|
|
79
|
+
}
|
package/lib/vm/vm.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ActionContext } from 'vuex';
|
|
|
2
2
|
import { State } from 'vue';
|
|
3
3
|
import { DialogChoice } from '@/types/vuex';
|
|
4
4
|
import { CommandPlugin } from './commands/command-plugin';
|
|
5
|
-
import { NarratPluginObject } from '@/plugins';
|
|
5
|
+
import { NarratPluginObject } from '@/exports/plugins';
|
|
6
6
|
export declare function runLine(context: ActionContext<State, State>): Promise<void>;
|
|
7
7
|
export declare class VM {
|
|
8
8
|
plugins: NarratPluginObject[];
|