narrat 2.3.0 → 2.3.1
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/LICENSE +21 -21
- package/README.md +128 -128
- package/dist/app.vue.d.ts +94 -91
- package/dist/components/MainMenu.vue.d.ts +12 -12
- package/dist/components/{SkillsWindow.vue.d.ts → Skills.vue.d.ts} +22 -22
- package/dist/components/StartMenu.vue.d.ts +46 -46
- package/dist/components/debug/debug-menu.vue.d.ts +48 -48
- package/dist/components/dialog-picture.vue.d.ts +9 -11
- package/dist/components/engine-splash/engine-splash.vue.d.ts +54 -54
- package/dist/components/game-dialog.vue.d.ts +65 -65
- package/dist/components/game-splash/game-splash.vue.d.ts +46 -46
- package/dist/components/hud.vue.d.ts +14 -14
- package/dist/components/in-game.vue.d.ts +46 -46
- package/dist/components/inventory-ui.vue.d.ts +30 -30
- package/dist/components/loading-bar.vue.d.ts +10 -10
- package/dist/components/menu-buttons.vue.d.ts +26 -54
- package/dist/components/notification-toast.vue.d.ts +6 -6
- package/dist/components/quests-ui.vue.d.ts +20 -20
- package/dist/components/save-slots.vue.d.ts +79 -79
- package/dist/components/saves/save-slot.vue.d.ts +108 -108
- package/dist/components/screen-layer.vue.d.ts +76 -76
- package/dist/components/screens.vue.d.ts +46 -46
- package/dist/components/transitions/NarratTransition.vue.d.ts +101 -101
- package/dist/components/utils/alert-modal.vue.d.ts +82 -82
- package/dist/components/utils/{modal-window.vue.d.ts → modal.vue.d.ts} +18 -18
- package/dist/components/utils/yes-no.vue.d.ts +106 -106
- package/dist/components/volume-controls.vue.d.ts +18 -18
- package/dist/config.d.ts +181 -194
- package/dist/constants.d.ts +8 -10
- package/dist/defaultConfig.d.ts +2 -2
- package/dist/demo/demo.d.ts +1 -1
- package/dist/dialog-box.vue.d.ts +41 -41
- package/dist/exports/config.d.ts +1 -1
- package/dist/exports/display.d.ts +2 -2
- package/dist/exports/plugins.d.ts +20 -38
- package/dist/favicon.svg +30 -30
- package/dist/lib.d.ts +14 -18
- package/dist/main.d.ts +6 -7
- package/dist/narrat.es.js +8419 -8981
- package/dist/narrat.es.js.map +1 -1
- package/dist/narrat.umd.js +73 -73
- package/dist/narrat.umd.js.map +1 -1
- package/dist/plugins/NarratPlugin.d.ts +11 -11
- package/dist/stores/audio-store.d.ts +48 -48
- package/dist/stores/dialog-store.d.ts +32 -32
- package/dist/stores/hud-stats-store.d.ts +22 -22
- package/dist/stores/inventory-store.d.ts +37 -37
- package/dist/stores/main-store.d.ts +822 -813
- package/dist/stores/notification-store.d.ts +15 -15
- package/dist/stores/quest-log.d.ts +39 -39
- package/dist/stores/rendering-store.d.ts +13 -13
- package/dist/stores/screens-store.d.ts +35 -35
- package/dist/stores/skills.d.ts +40 -40
- package/dist/stores/vm-store.d.ts +180 -180
- package/dist/style.css +1 -1
- package/dist/types/app-types.d.ts +5 -9
- package/dist/types/character-types.d.ts +27 -27
- package/dist/types/dialog-box-types.d.ts +11 -11
- package/dist/types/game-save.d.ts +36 -36
- package/dist/types/parser.d.ts +93 -93
- package/dist/types/state.d.ts +3 -3
- package/dist/utils/InputsListener.d.ts +9 -9
- package/dist/utils/ajax.d.ts +1 -1
- package/dist/utils/audio-loader.d.ts +10 -10
- package/dist/utils/characters.d.ts +5 -5
- package/dist/utils/data-helpers.d.ts +25 -28
- package/dist/utils/debounce.d.ts +14 -14
- package/dist/utils/error-handling.d.ts +3 -3
- package/dist/utils/helpers.d.ts +6 -6
- package/dist/utils/images-loader.d.ts +6 -6
- package/dist/utils/logger.d.ts +11 -11
- package/dist/utils/object-iterators.d.ts +8 -8
- package/dist/utils/promises.d.ts +1 -1
- package/dist/utils/randomId.d.ts +1 -1
- package/dist/utils/save-helpers.d.ts +18 -18
- package/dist/utils/skillchecks.d.ts +17 -17
- package/dist/utils/string-helpers.d.ts +3 -3
- package/dist/utils/time-helpers.d.ts +2 -2
- package/dist/utils/transition.d.ts +15 -15
- package/dist/utils/type-utils.d.ts +1 -2
- package/dist/utils/typed-emitter.d.ts +18 -18
- package/dist/vm/commands/arithmetic-commands.d.ts +23 -23
- package/dist/vm/commands/audio-commands.d.ts +15 -15
- package/dist/vm/commands/choice.d.ts +37 -37
- package/dist/vm/commands/clear_dialog.d.ts +2 -2
- package/dist/vm/commands/command-helpers.d.ts +3 -3
- package/dist/vm/commands/command-plugin.d.ts +43 -43
- package/dist/vm/commands/flow-commands.d.ts +24 -24
- package/dist/vm/commands/if.d.ts +10 -10
- package/dist/vm/commands/index.d.ts +2 -2
- package/dist/vm/commands/inventory-commands.d.ts +15 -15
- package/dist/vm/commands/logic-command.d.ts +42 -42
- package/dist/vm/commands/math-commands.d.ts +30 -30
- package/dist/vm/commands/notify.d.ts +6 -6
- package/dist/vm/commands/quest-commands.d.ts +30 -30
- package/dist/vm/commands/random-commands.d.ts +10 -10
- package/dist/vm/commands/screen-commands.d.ts +15 -15
- package/dist/vm/commands/set.d.ts +6 -6
- package/dist/vm/commands/skill-commands.d.ts +30 -30
- package/dist/vm/commands/stats-commands.d.ts +12 -12
- package/dist/vm/commands/string-commands.d.ts +9 -9
- package/dist/vm/commands/text-field.d.ts +7 -7
- package/dist/vm/commands/text.d.ts +14 -14
- package/dist/vm/commands/wait.d.ts +4 -4
- package/dist/vm/vm-helpers.d.ts +18 -18
- package/dist/vm/vm-parser.d.ts +19 -19
- package/dist/vm/vm-parser.test.d.ts +1 -1
- package/dist/vm/vm.d.ts +18 -21
- package/package.json +1 -1
- package/dist/exports/components.d.ts +0 -2
- package/dist/exports/events.d.ts +0 -1
- package/dist/exports/others.d.ts +0 -1
- package/dist/exports/stores.d.ts +0 -11
- package/dist/menu-buttons/menu-buttons.d.ts +0 -4
- package/dist/stores/menu-store.d.ts +0 -36
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare class LogManager {
|
|
2
|
-
debug: boolean;
|
|
3
|
-
logger: {
|
|
4
|
-
[key: string]: (...args: any[]) => void;
|
|
5
|
-
};
|
|
6
|
-
setupDebugger(debug: boolean): void;
|
|
7
|
-
}
|
|
8
|
-
export declare const logManager: LogManager;
|
|
9
|
-
export declare const logger: {
|
|
10
|
-
[key: string]: (...args: any[]) => void;
|
|
11
|
-
};
|
|
1
|
+
export declare class LogManager {
|
|
2
|
+
debug: boolean;
|
|
3
|
+
logger: {
|
|
4
|
+
[key: string]: (...args: any[]) => void;
|
|
5
|
+
};
|
|
6
|
+
setupDebugger(debug: boolean): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const logManager: LogManager;
|
|
9
|
+
export declare const logger: {
|
|
10
|
+
[key: string]: (...args: any[]) => void;
|
|
11
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const everyObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => boolean;
|
|
2
|
-
export declare const someObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => true | undefined;
|
|
3
|
-
export declare const mapObject: <T, U>(object: T, mapper: (value: T[keyof T]) => U) => {
|
|
4
|
-
[key: string]: U;
|
|
5
|
-
};
|
|
6
|
-
export declare const filterObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => {
|
|
7
|
-
[key: string]: T[keyof T];
|
|
8
|
-
};
|
|
1
|
+
export declare const everyObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => boolean;
|
|
2
|
+
export declare const someObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => true | undefined;
|
|
3
|
+
export declare const mapObject: <T, U>(object: T, mapper: (value: T[keyof T]) => U) => {
|
|
4
|
+
[key: string]: U;
|
|
5
|
+
};
|
|
6
|
+
export declare const filterObject: <T>(object: T, predicate: (value: T[keyof T]) => boolean) => {
|
|
7
|
+
[key: string]: T[keyof T];
|
|
8
|
+
};
|
package/dist/utils/promises.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function timeout(durationMs: number): Promise<unknown>;
|
|
1
|
+
export declare function timeout(durationMs: number): Promise<unknown>;
|
package/dist/utils/randomId.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function randomId(): string;
|
|
1
|
+
export declare function randomId(): string;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { GameSave, SaveFile, SaveSlotMetadata } from '../types/game-save';
|
|
2
|
-
export declare const CURRENT_SAVE_VERSION = "1.3.0";
|
|
3
|
-
export declare function getSaveFile(): SaveFile;
|
|
4
|
-
export declare function saveSlot(saveData: GameSave, slot: string): void;
|
|
5
|
-
export declare function setSaveSlot(slot: string): void;
|
|
6
|
-
export declare function save(): void;
|
|
7
|
-
export declare function getFreeSlot(): string;
|
|
8
|
-
export declare function getSlotIndex(slotId: string): number;
|
|
9
|
-
export declare function getSaveSlot(slotId: string): GameSave | undefined;
|
|
10
|
-
export declare function findAutoSave(): GameSave | undefined;
|
|
11
|
-
export declare function deleteSave(id: string): void;
|
|
12
|
-
export declare function renameSave(id: string, newName: string): void;
|
|
13
|
-
export declare function migrateSaveSlot(save: GameSave | null, index: number): void;
|
|
14
|
-
export declare function generateMetadata(): SaveSlotMetadata;
|
|
15
|
-
export declare type ChosenSlot = {
|
|
16
|
-
saveData: GameSave | null;
|
|
17
|
-
slotId: string;
|
|
18
|
-
};
|
|
1
|
+
import { GameSave, SaveFile, SaveSlotMetadata } from '../types/game-save';
|
|
2
|
+
export declare const CURRENT_SAVE_VERSION = "1.3.0";
|
|
3
|
+
export declare function getSaveFile(): SaveFile;
|
|
4
|
+
export declare function saveSlot(saveData: GameSave, slot: string): void;
|
|
5
|
+
export declare function setSaveSlot(slot: string): void;
|
|
6
|
+
export declare function save(): void;
|
|
7
|
+
export declare function getFreeSlot(): string;
|
|
8
|
+
export declare function getSlotIndex(slotId: string): number;
|
|
9
|
+
export declare function getSaveSlot(slotId: string): GameSave | undefined;
|
|
10
|
+
export declare function findAutoSave(): GameSave | undefined;
|
|
11
|
+
export declare function deleteSave(id: string): void;
|
|
12
|
+
export declare function renameSave(id: string, newName: string): void;
|
|
13
|
+
export declare function migrateSaveSlot(save: GameSave | null, index: number): void;
|
|
14
|
+
export declare function generateMetadata(): SaveSlotMetadata;
|
|
15
|
+
export declare type ChosenSlot = {
|
|
16
|
+
saveData: GameSave | null;
|
|
17
|
+
slotId: string;
|
|
18
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SkillCheckParams } from '../vm/vm-helpers';
|
|
2
|
-
export declare function getSkillCheckDifficultyScore(value: number, level: number): number;
|
|
3
|
-
export declare function getSkillCheckDifficultyText(value: number, level: number): string;
|
|
4
|
-
export declare function getSkillCheckText({ skill, skillCheckId, value, }: {
|
|
5
|
-
skill: string;
|
|
6
|
-
skillCheckId: string;
|
|
7
|
-
value: number;
|
|
8
|
-
}): {
|
|
9
|
-
difficultyText: string;
|
|
10
|
-
allowed: boolean;
|
|
11
|
-
};
|
|
12
|
-
export declare function getPassiveSkillCheckText(success: boolean, params: SkillCheckParams): string;
|
|
13
|
-
export declare function calculateSkillCheckRoll(skill: string): {
|
|
14
|
-
roll: number;
|
|
15
|
-
unmodifiedRoll: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function resolveSkillCheck(params: SkillCheckParams): boolean;
|
|
1
|
+
import { SkillCheckParams } from '../vm/vm-helpers';
|
|
2
|
+
export declare function getSkillCheckDifficultyScore(value: number, level: number): number;
|
|
3
|
+
export declare function getSkillCheckDifficultyText(value: number, level: number): string;
|
|
4
|
+
export declare function getSkillCheckText({ skill, skillCheckId, value, }: {
|
|
5
|
+
skill: string;
|
|
6
|
+
skillCheckId: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}): {
|
|
9
|
+
difficultyText: string;
|
|
10
|
+
allowed: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function getPassiveSkillCheckText(success: boolean, params: SkillCheckParams): string;
|
|
13
|
+
export declare function calculateSkillCheckRoll(skill: string): {
|
|
14
|
+
roll: number;
|
|
15
|
+
unmodifiedRoll: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function resolveSkillCheck(params: SkillCheckParams): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function processText(text: string): string;
|
|
2
|
-
export declare const stringRegex: RegExp;
|
|
3
|
-
export declare const isParsedTokenString: (arg: any) => boolean;
|
|
1
|
+
export declare function processText(text: string): string;
|
|
2
|
+
export declare const stringRegex: RegExp;
|
|
3
|
+
export declare const isParsedTokenString: (arg: any) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getPlayTime(startedAt: number, previousTime: number): number;
|
|
2
|
-
export declare function toHHMMSS(time: number | string): string;
|
|
1
|
+
export declare function getPlayTime(startedAt: number, previousTime: number): number;
|
|
2
|
+
export declare function toHHMMSS(time: number | string): string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare type TransitionMode = 'screen' | 'button';
|
|
2
|
-
export declare function isTransitionMode(mode: any): mode is TransitionMode;
|
|
3
|
-
export interface TransitionSettings {
|
|
4
|
-
delay?: number;
|
|
5
|
-
duration?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const transitionSettings: {
|
|
8
|
-
[key: string]: TransitionSettings;
|
|
9
|
-
};
|
|
10
|
-
export declare function getTransitionSettings(name: string): TransitionSettings;
|
|
11
|
-
export declare type AddTransition = {
|
|
12
|
-
transition: string;
|
|
13
|
-
duration?: number;
|
|
14
|
-
delay?: number;
|
|
15
|
-
};
|
|
1
|
+
export declare type TransitionMode = 'screen' | 'button';
|
|
2
|
+
export declare function isTransitionMode(mode: any): mode is TransitionMode;
|
|
3
|
+
export interface TransitionSettings {
|
|
4
|
+
delay?: number;
|
|
5
|
+
duration?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const transitionSettings: {
|
|
8
|
+
[key: string]: TransitionSettings;
|
|
9
|
+
};
|
|
10
|
+
export declare function getTransitionSettings(name: string): TransitionSettings;
|
|
11
|
+
export declare type AddTransition = {
|
|
12
|
+
transition: string;
|
|
13
|
+
duration?: number;
|
|
14
|
+
delay?: number;
|
|
15
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export declare const generateObjectFromList: <T extends readonly string[]>(list: T) => { [K in T[number]]: K; };
|
|
2
|
-
export declare const isPromise: <T>(value: any) => value is Promise<T>;
|
|
1
|
+
export declare const generateObjectFromList: <T extends readonly string[]>(list: T) => { [K in T[number]]: K; };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export interface InputEvents {
|
|
2
|
-
keydown: (event: KeyboardEvent) => void;
|
|
3
|
-
}
|
|
4
|
-
export declare type EventsList<List> = {
|
|
5
|
-
[key in keyof List]: (...args: any[]) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare type EventsMap<List extends EventsList<List>> = {
|
|
8
|
-
[key in keyof List]: Set<List[key]>;
|
|
9
|
-
};
|
|
10
|
-
export declare class TypedEmitter<List extends EventsList<List>> {
|
|
11
|
-
listeners: EventsMap<List>;
|
|
12
|
-
on<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
13
|
-
off<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
14
|
-
once<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
15
|
-
emit<Event extends keyof List>(event: Event, ...args: any[]): void;
|
|
16
|
-
clear(): void;
|
|
17
|
-
private addEventToMap;
|
|
18
|
-
}
|
|
1
|
+
export interface InputEvents {
|
|
2
|
+
keydown: (event: KeyboardEvent) => void;
|
|
3
|
+
}
|
|
4
|
+
export declare type EventsList<List> = {
|
|
5
|
+
[key in keyof List]: (...args: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare type EventsMap<List extends EventsList<List>> = {
|
|
8
|
+
[key in keyof List]: Set<List[key]>;
|
|
9
|
+
};
|
|
10
|
+
export declare class TypedEmitter<List extends EventsList<List>> {
|
|
11
|
+
listeners: EventsMap<List>;
|
|
12
|
+
on<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
13
|
+
off<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
14
|
+
once<Event extends keyof List>(event: Event, listener: List[Event]): List[Event];
|
|
15
|
+
emit<Event extends keyof List>(event: Event, ...args: any[]): void;
|
|
16
|
+
clear(): void;
|
|
17
|
+
private addEventToMap;
|
|
18
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
export declare const additionPlugin: CommandPlugin<{
|
|
3
|
-
a: number;
|
|
4
|
-
b: number;
|
|
5
|
-
}, {}>;
|
|
6
|
-
export declare const substractionPlugin: CommandPlugin<{
|
|
7
|
-
a: number;
|
|
8
|
-
b: number;
|
|
9
|
-
}, {}>;
|
|
10
|
-
export declare const negPlugin: CommandPlugin<{
|
|
11
|
-
a: number;
|
|
12
|
-
}, {}>;
|
|
13
|
-
export declare const absPlugin: CommandPlugin<{
|
|
14
|
-
a: number;
|
|
15
|
-
}, {}>;
|
|
16
|
-
export declare const multiplicationPlugin: CommandPlugin<{
|
|
17
|
-
a: number;
|
|
18
|
-
b: number;
|
|
19
|
-
}, {}>;
|
|
20
|
-
export declare const divisionPlugin: CommandPlugin<{
|
|
21
|
-
a: number;
|
|
22
|
-
b: number;
|
|
23
|
-
}, {}>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
export declare const additionPlugin: CommandPlugin<{
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
}, {}>;
|
|
6
|
+
export declare const substractionPlugin: CommandPlugin<{
|
|
7
|
+
a: number;
|
|
8
|
+
b: number;
|
|
9
|
+
}, {}>;
|
|
10
|
+
export declare const negPlugin: CommandPlugin<{
|
|
11
|
+
a: number;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export declare const absPlugin: CommandPlugin<{
|
|
14
|
+
a: number;
|
|
15
|
+
}, {}>;
|
|
16
|
+
export declare const multiplicationPlugin: CommandPlugin<{
|
|
17
|
+
a: number;
|
|
18
|
+
b: number;
|
|
19
|
+
}, {}>;
|
|
20
|
+
export declare const divisionPlugin: CommandPlugin<{
|
|
21
|
+
a: number;
|
|
22
|
+
b: number;
|
|
23
|
+
}, {}>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
export interface PlayCommandArgs {
|
|
3
|
-
mode: string;
|
|
4
|
-
audio: string;
|
|
5
|
-
channel?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const playCommand: CommandPlugin<PlayCommandArgs, {}>;
|
|
8
|
-
export declare const pauseCommand: CommandPlugin<{
|
|
9
|
-
mode: string;
|
|
10
|
-
channel?: number | undefined;
|
|
11
|
-
}, {}>;
|
|
12
|
-
export declare const stopCommand: CommandPlugin<{
|
|
13
|
-
mode: string;
|
|
14
|
-
channel?: number | undefined;
|
|
15
|
-
}, {}>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
export interface PlayCommandArgs {
|
|
3
|
+
mode: string;
|
|
4
|
+
audio: string;
|
|
5
|
+
channel?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const playCommand: CommandPlugin<PlayCommandArgs, {}>;
|
|
8
|
+
export declare const pauseCommand: CommandPlugin<{
|
|
9
|
+
mode: string;
|
|
10
|
+
channel?: number | undefined;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export declare const stopCommand: CommandPlugin<{
|
|
13
|
+
mode: string;
|
|
14
|
+
channel?: number | undefined;
|
|
15
|
+
}, {}>;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { CommandParserFunction, CommandParsingContext, CommandPlugin, CommandRunner } from './command-plugin';
|
|
2
|
-
import { Parser } from '../../types/parser';
|
|
3
|
-
export declare const runChoice: CommandRunner<ChoiceOptions, StaticChoiceOptions>;
|
|
4
|
-
export declare function parseChoiceOption(ctx: CommandParsingContext, choice: Parser.Line): BranchingChoiceInfo;
|
|
5
|
-
export interface BranchingChoiceInfo {
|
|
6
|
-
prompt: Parser.ParsedExpression;
|
|
7
|
-
branch?: Parser.Branch;
|
|
8
|
-
skillBranches?: {
|
|
9
|
-
success: Parser.Branch;
|
|
10
|
-
failure: Parser.Branch;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface StaticChoiceOptions {
|
|
14
|
-
choices: BranchingChoiceInfo[];
|
|
15
|
-
prompt: Parser.ParsedExpression;
|
|
16
|
-
}
|
|
17
|
-
export interface ChoiceOptions {
|
|
18
|
-
}
|
|
19
|
-
export declare const choiceParser: CommandParserFunction<ChoiceOptions, StaticChoiceOptions>;
|
|
20
|
-
export declare const choicePlugin: CommandPlugin<ChoiceOptions, StaticChoiceOptions>;
|
|
21
|
-
export interface ChoicePromptOptions {
|
|
22
|
-
promptText: string;
|
|
23
|
-
condition: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface ChoicePromptReturnValue {
|
|
26
|
-
text: string | null;
|
|
27
|
-
skillCheck?: {
|
|
28
|
-
allowed: boolean;
|
|
29
|
-
skillId: string;
|
|
30
|
-
skillCheckId: string;
|
|
31
|
-
difficulty: number;
|
|
32
|
-
hideAfterRoll: boolean;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export declare type ChoicePromptReturn = ChoicePromptReturnValue;
|
|
36
|
-
/** Custom "fake" instruction generated on choice prompts to process their optional conditions */
|
|
37
|
-
export declare const choicePromptCommandPlugin: CommandPlugin<ChoicePromptOptions, {}>;
|
|
1
|
+
import { CommandParserFunction, CommandParsingContext, CommandPlugin, CommandRunner } from './command-plugin';
|
|
2
|
+
import { Parser } from '../../types/parser';
|
|
3
|
+
export declare const runChoice: CommandRunner<ChoiceOptions, StaticChoiceOptions>;
|
|
4
|
+
export declare function parseChoiceOption(ctx: CommandParsingContext, choice: Parser.Line): BranchingChoiceInfo;
|
|
5
|
+
export interface BranchingChoiceInfo {
|
|
6
|
+
prompt: Parser.ParsedExpression;
|
|
7
|
+
branch?: Parser.Branch;
|
|
8
|
+
skillBranches?: {
|
|
9
|
+
success: Parser.Branch;
|
|
10
|
+
failure: Parser.Branch;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface StaticChoiceOptions {
|
|
14
|
+
choices: BranchingChoiceInfo[];
|
|
15
|
+
prompt: Parser.ParsedExpression;
|
|
16
|
+
}
|
|
17
|
+
export interface ChoiceOptions {
|
|
18
|
+
}
|
|
19
|
+
export declare const choiceParser: CommandParserFunction<ChoiceOptions, StaticChoiceOptions>;
|
|
20
|
+
export declare const choicePlugin: CommandPlugin<ChoiceOptions, StaticChoiceOptions>;
|
|
21
|
+
export interface ChoicePromptOptions {
|
|
22
|
+
promptText: string;
|
|
23
|
+
condition: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ChoicePromptReturnValue {
|
|
26
|
+
text: string | null;
|
|
27
|
+
skillCheck?: {
|
|
28
|
+
allowed: boolean;
|
|
29
|
+
skillId: string;
|
|
30
|
+
skillCheckId: string;
|
|
31
|
+
difficulty: number;
|
|
32
|
+
hideAfterRoll: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare type ChoicePromptReturn = ChoicePromptReturnValue;
|
|
36
|
+
/** Custom "fake" instruction generated on choice prompts to process their optional conditions */
|
|
37
|
+
export declare const choicePromptCommandPlugin: CommandPlugin<ChoicePromptOptions, {}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
export declare const clearDialogPlugin: CommandPlugin<{}, {}>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
export declare const clearDialogPlugin: CommandPlugin<{}, {}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Parser } from '../../types/parser';
|
|
2
|
-
export declare function commandRuntimeError(cmd: Parser.Command<any, any>, errorText: string): void;
|
|
3
|
-
export declare function commandLog(cmd: Parser.Command<any, any>, ...log: any[]): void;
|
|
1
|
+
import { Parser } from '../../types/parser';
|
|
2
|
+
export declare function commandRuntimeError(cmd: Parser.Command<any, any>, errorText: string): void;
|
|
3
|
+
export declare function commandLog(cmd: Parser.Command<any, any>, ...log: any[]): void;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { Parser } from '../../types/parser';
|
|
2
|
-
import { ParserContext } from '../vm-parser';
|
|
3
|
-
import { DialogChoice } from '../../stores/dialog-store';
|
|
4
|
-
export declare type CommandRunner<Options, StaticOptions = {}> = (cmd: Parser.Command<Options, StaticOptions>, choices?: DialogChoice[]) => Promise<any>;
|
|
5
|
-
export declare type CommandParserFunction<Options, StaticOptions = {}> = (ctx: CommandParsingContext, command: Parser.ParsedExpression<Options, StaticOptions>) => {
|
|
6
|
-
newLine: number;
|
|
7
|
-
};
|
|
8
|
-
export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
|
|
9
|
-
export interface CommandParsingContext {
|
|
10
|
-
parserContext: ParserContext;
|
|
11
|
-
processCommandsFunction: ProcessCommandsFunction;
|
|
12
|
-
line: Parser.Line;
|
|
13
|
-
lines: Parser.Line[];
|
|
14
|
-
currentLine: number;
|
|
15
|
-
}
|
|
16
|
-
export declare type OnPlayerAnswered<Options, StaticOptions> = (cmd: Parser.Command<Options, StaticOptions>, choice: number | string) => Promise<any>;
|
|
17
|
-
export interface CommandPluginOptions<Options, StaticOptions = {}> {
|
|
18
|
-
keyword: string;
|
|
19
|
-
argTypes: ArgTypes;
|
|
20
|
-
runner: CommandRunner<Options, StaticOptions>;
|
|
21
|
-
parser?: CommandParserFunction<Options, StaticOptions>;
|
|
22
|
-
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
23
|
-
returnAfterPlayerAnswer?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export declare class CommandPlugin<Options, StaticOptions = {}> {
|
|
26
|
-
keyword: string;
|
|
27
|
-
runner: CommandRunner<Options, StaticOptions>;
|
|
28
|
-
argTypes: ArgTypes;
|
|
29
|
-
parser: CommandParserFunction<Options, StaticOptions>;
|
|
30
|
-
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
31
|
-
returnAfterPlayerAnswer: boolean;
|
|
32
|
-
constructor(keyword: string, argTypes: ArgTypes, runner: CommandRunner<Options, StaticOptions>, parser?: CommandParserFunction<Options, StaticOptions>);
|
|
33
|
-
run(cmd: Parser.Command<Options, StaticOptions>, choices?: DialogChoice[]): Promise<any>;
|
|
34
|
-
processPlayerAnswer(cmd: Parser.Command<Options, StaticOptions>, choice: number | string): Promise<any>;
|
|
35
|
-
static FromOptions<Options, StaticOptions = {}>(options: CommandPluginOptions<Options, StaticOptions>): CommandPlugin<Options, StaticOptions>;
|
|
36
|
-
}
|
|
37
|
-
export declare type ArgTypes = ArgumentDescription[] | 'any';
|
|
38
|
-
export interface ArgumentDescription {
|
|
39
|
-
name: string;
|
|
40
|
-
type: 'string' | 'number' | 'boolean' | 'any';
|
|
41
|
-
optional?: boolean;
|
|
42
|
-
}
|
|
43
|
-
export declare function generateParser<Options, StaticOptions = {}>(keyword: string, argTypes: ArgTypes): CommandParserFunction<Options, StaticOptions>;
|
|
1
|
+
import { Parser } from '../../types/parser';
|
|
2
|
+
import { ParserContext } from '../vm-parser';
|
|
3
|
+
import { DialogChoice } from '../../stores/dialog-store';
|
|
4
|
+
export declare type CommandRunner<Options, StaticOptions = {}> = (cmd: Parser.Command<Options, StaticOptions>, choices?: DialogChoice[]) => Promise<any>;
|
|
5
|
+
export declare type CommandParserFunction<Options, StaticOptions = {}> = (ctx: CommandParsingContext, command: Parser.ParsedExpression<Options, StaticOptions>) => {
|
|
6
|
+
newLine: number;
|
|
7
|
+
};
|
|
8
|
+
export declare type ProcessCommandsFunction = (ctx: ParserContext, lines: Parser.Line[], parentLine: Parser.Line | undefined) => Parser.Branch;
|
|
9
|
+
export interface CommandParsingContext {
|
|
10
|
+
parserContext: ParserContext;
|
|
11
|
+
processCommandsFunction: ProcessCommandsFunction;
|
|
12
|
+
line: Parser.Line;
|
|
13
|
+
lines: Parser.Line[];
|
|
14
|
+
currentLine: number;
|
|
15
|
+
}
|
|
16
|
+
export declare type OnPlayerAnswered<Options, StaticOptions> = (cmd: Parser.Command<Options, StaticOptions>, choice: number | string) => Promise<any>;
|
|
17
|
+
export interface CommandPluginOptions<Options, StaticOptions = {}> {
|
|
18
|
+
keyword: string;
|
|
19
|
+
argTypes: ArgTypes;
|
|
20
|
+
runner: CommandRunner<Options, StaticOptions>;
|
|
21
|
+
parser?: CommandParserFunction<Options, StaticOptions>;
|
|
22
|
+
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
23
|
+
returnAfterPlayerAnswer?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare class CommandPlugin<Options, StaticOptions = {}> {
|
|
26
|
+
keyword: string;
|
|
27
|
+
runner: CommandRunner<Options, StaticOptions>;
|
|
28
|
+
argTypes: ArgTypes;
|
|
29
|
+
parser: CommandParserFunction<Options, StaticOptions>;
|
|
30
|
+
onPlayerAnswered?: OnPlayerAnswered<Options, StaticOptions>;
|
|
31
|
+
returnAfterPlayerAnswer: boolean;
|
|
32
|
+
constructor(keyword: string, argTypes: ArgTypes, runner: CommandRunner<Options, StaticOptions>, parser?: CommandParserFunction<Options, StaticOptions>);
|
|
33
|
+
run(cmd: Parser.Command<Options, StaticOptions>, choices?: DialogChoice[]): Promise<any>;
|
|
34
|
+
processPlayerAnswer(cmd: Parser.Command<Options, StaticOptions>, choice: number | string): Promise<any>;
|
|
35
|
+
static FromOptions<Options, StaticOptions = {}>(options: CommandPluginOptions<Options, StaticOptions>): CommandPlugin<Options, StaticOptions>;
|
|
36
|
+
}
|
|
37
|
+
export declare type ArgTypes = ArgumentDescription[] | 'any';
|
|
38
|
+
export interface ArgumentDescription {
|
|
39
|
+
name: string;
|
|
40
|
+
type: 'string' | 'number' | 'boolean' | 'any';
|
|
41
|
+
optional?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function generateParser<Options, StaticOptions = {}>(keyword: string, argTypes: ArgTypes): CommandParserFunction<Options, StaticOptions>;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
export declare const jumpCommand: CommandPlugin<{
|
|
3
|
-
label: string;
|
|
4
|
-
}, {}>;
|
|
5
|
-
export declare const runLabelPlugin: CommandPlugin<{
|
|
6
|
-
label: string;
|
|
7
|
-
}, {}>;
|
|
8
|
-
export declare const defineVariablePlugin: CommandPlugin<{
|
|
9
|
-
name: string;
|
|
10
|
-
value: any;
|
|
11
|
-
}, {}>;
|
|
12
|
-
export declare const returnPlugin: CommandPlugin<{
|
|
13
|
-
value: any;
|
|
14
|
-
}, {}>;
|
|
15
|
-
export declare const logPlugin: CommandPlugin<{
|
|
16
|
-
value: any;
|
|
17
|
-
}, {}>;
|
|
18
|
-
export declare const returnMainMenuPlugin: CommandPlugin<{}, {}>;
|
|
19
|
-
export declare const savePlugin: CommandPlugin<{
|
|
20
|
-
name?: string | undefined;
|
|
21
|
-
}, {}>;
|
|
22
|
-
export declare const savePromptPlugin: CommandPlugin<{
|
|
23
|
-
name?: string | undefined;
|
|
24
|
-
}, {}>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
export declare const jumpCommand: CommandPlugin<{
|
|
3
|
+
label: string;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare const runLabelPlugin: CommandPlugin<{
|
|
6
|
+
label: string;
|
|
7
|
+
}, {}>;
|
|
8
|
+
export declare const defineVariablePlugin: CommandPlugin<{
|
|
9
|
+
name: string;
|
|
10
|
+
value: any;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export declare const returnPlugin: CommandPlugin<{
|
|
13
|
+
value: any;
|
|
14
|
+
}, {}>;
|
|
15
|
+
export declare const logPlugin: CommandPlugin<{
|
|
16
|
+
value: any;
|
|
17
|
+
}, {}>;
|
|
18
|
+
export declare const returnMainMenuPlugin: CommandPlugin<{}, {}>;
|
|
19
|
+
export declare const savePlugin: CommandPlugin<{
|
|
20
|
+
name?: string | undefined;
|
|
21
|
+
}, {}>;
|
|
22
|
+
export declare const savePromptPlugin: CommandPlugin<{
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
}, {}>;
|
package/dist/vm/commands/if.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
import { Parser } from '../../types/parser';
|
|
3
|
-
export interface IfOptions {
|
|
4
|
-
condition: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface IfStaticOptions {
|
|
7
|
-
success: Parser.Branch;
|
|
8
|
-
failure?: Parser.Branch;
|
|
9
|
-
}
|
|
10
|
-
export declare const ifCommand: CommandPlugin<IfOptions, IfStaticOptions>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
import { Parser } from '../../types/parser';
|
|
3
|
+
export interface IfOptions {
|
|
4
|
+
condition: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IfStaticOptions {
|
|
7
|
+
success: Parser.Branch;
|
|
8
|
+
failure?: Parser.Branch;
|
|
9
|
+
}
|
|
10
|
+
export declare const ifCommand: CommandPlugin<IfOptions, IfStaticOptions>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { VM } from '../vm';
|
|
2
|
-
export declare function registerBaseCommands(vm: VM): void;
|
|
1
|
+
import { VM } from '../vm';
|
|
2
|
+
export declare function registerBaseCommands(vm: VM): void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { CommandPlugin } from './command-plugin';
|
|
2
|
-
export interface InventoryChangeArgs {
|
|
3
|
-
id: string;
|
|
4
|
-
amount: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const addItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
7
|
-
export declare const removeItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
8
|
-
export declare const hasItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
9
|
-
export declare const itemAmountPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
10
|
-
export declare const enableInteractionPlugin: CommandPlugin<{
|
|
11
|
-
tag: string;
|
|
12
|
-
}, {}>;
|
|
13
|
-
export declare const disableInteractionPlugin: CommandPlugin<{
|
|
14
|
-
tag: string;
|
|
15
|
-
}, {}>;
|
|
1
|
+
import { CommandPlugin } from './command-plugin';
|
|
2
|
+
export interface InventoryChangeArgs {
|
|
3
|
+
id: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const addItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
7
|
+
export declare const removeItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
8
|
+
export declare const hasItemPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
9
|
+
export declare const itemAmountPlugin: CommandPlugin<InventoryChangeArgs, {}>;
|
|
10
|
+
export declare const enableInteractionPlugin: CommandPlugin<{
|
|
11
|
+
tag: string;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export declare const disableInteractionPlugin: CommandPlugin<{
|
|
14
|
+
tag: string;
|
|
15
|
+
}, {}>;
|