narrat 2.7.2 → 2.8.0-rc2

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.
@@ -0,0 +1,6 @@
1
+ import { Config } from '../config/config-output';
2
+ export declare const useConfig: import("pinia").StoreDefinition<"config", {
3
+ config: Config;
4
+ }, {}, {
5
+ setConfig(config: Config): Promise<void>;
6
+ }>;
@@ -1,4 +1,4 @@
1
- import { HudStatConfig } from '../config';
1
+ import { HudStatsConfig } from '../config/common-config';
2
2
  export interface HudStatsState {
3
3
  [key: string]: HudStat;
4
4
  }
@@ -10,9 +10,7 @@ export interface HudState {
10
10
  }
11
11
  export declare type HudSave = HudState;
12
12
  export declare const useHud: import("pinia").StoreDefinition<"hud", HudState, {}, {
13
- setupHudStats(stats: {
14
- [key: string]: HudStatConfig;
15
- }): void;
13
+ setupHudStats(stats: HudStatsConfig): void;
16
14
  setStat(stat: string, value: number): void;
17
15
  addStat(stat: string, value: number): void;
18
16
  getStat(stat: string): HudStat;
@@ -1,4 +1,4 @@
1
- import { ItemData } from '../config';
1
+ import { ItemConfig } from '../config/items-config';
2
2
  export interface ItemState {
3
3
  amount: number;
4
4
  id: string;
@@ -21,7 +21,17 @@ export declare const useInventory: import("pinia").StoreDefinition<"inventory",
21
21
  generateSaveData(): InventorySave;
22
22
  loadSaveData(save: InventorySave): void;
23
23
  setupItems(items: {
24
- [key: string]: ItemData;
24
+ [key: string]: {
25
+ onUse?: {
26
+ label: string;
27
+ action: string;
28
+ } | undefined;
29
+ tag?: string | undefined;
30
+ category?: string | undefined;
31
+ description: string;
32
+ name: string;
33
+ icon: string;
34
+ };
25
35
  }): void;
26
36
  hasItem(itemId: string, amount?: number): boolean;
27
37
  getExistingItem(id: string): ItemState | undefined;
@@ -637,7 +637,7 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
637
637
  finishTransition(layer: number): void;
638
638
  transitionScreen(screen: string, transition: import("../utils/transition").AddTransition, layer?: number | undefined): Promise<void>;
639
639
  emptyLayer(layer: number, transition?: import("../utils/transition").AddTransition | undefined): Promise<void>;
640
- setButtons(config: import("../config").Config): void;
640
+ setButtons(config: import("../config/config-output").Config): void;
641
641
  changeButton(button: string, newValue: import("./screens-store").ButtonStateValue): void;
642
642
  generateSaveData(): import("./screens-store").ScreenSave;
643
643
  loadSaveData(data: import("./screens-store").ScreenSave): void;
@@ -651,8 +651,24 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
651
651
  getSkillCheck(id: string): import("./skills").SkillCheckState;
652
652
  createSkillCheckState(): import("./skills").SkillCheckState;
653
653
  loadSaveData(data: import("./skills").Skills): void;
654
- setupSkills(skills: {
655
- [key: string]: import("../config").SkillData;
654
+ setupSkills(skillsConfig: {
655
+ skills: Record<string, {
656
+ hidden?: boolean | undefined;
657
+ description: string;
658
+ name: string;
659
+ startingLevel: number;
660
+ icon: string;
661
+ }>;
662
+ skillChecks: {
663
+ rollRange: number;
664
+ skillMultiplier: number;
665
+ failureChance: number;
666
+ difficultyText: [number, string][];
667
+ };
668
+ skillOptions: {
669
+ xpPerLevel: number;
670
+ notifyLevelUp: boolean;
671
+ };
656
672
  }): void;
657
673
  getSkill(skill: string): import("./skills").SkillState;
658
674
  getSkillLevel(skill: string): number;
@@ -817,9 +833,13 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
817
833
  runThenGoBackToPreviousDialog(label: string, ...args: any[]): Promise<any>;
818
834
  }>;
819
835
  hud: import("pinia").Store<"hud", import("./hud-stats-store").HudState, {}, {
820
- setupHudStats(stats: {
821
- [key: string]: import("../config").HudStatConfig;
822
- }): void;
836
+ setupHudStats(stats: Record<string, {
837
+ name: string;
838
+ icon: string;
839
+ startingValue: number;
840
+ maxValue: number;
841
+ minValue: number;
842
+ }>): void;
823
843
  setStat(stat: string, value: number): void;
824
844
  addStat(stat: string, value: number): void;
825
845
  getStat(stat: string): import("./hud-stats-store").HudStat;
@@ -870,7 +890,17 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
870
890
  generateSaveData(): import("./inventory-store").InventoryState;
871
891
  loadSaveData(save: import("./inventory-store").InventoryState): void;
872
892
  setupItems(items: {
873
- [key: string]: import("../config").ItemData;
893
+ [key: string]: {
894
+ onUse?: {
895
+ label: string;
896
+ action: string;
897
+ } | undefined;
898
+ tag?: string | undefined;
899
+ category?: string | undefined;
900
+ description: string;
901
+ name: string;
902
+ icon: string;
903
+ };
874
904
  }): void;
875
905
  hasItem(itemId: string, amount?: number | undefined): boolean;
876
906
  getExistingItem(id: string): import("./inventory-store").ItemState | undefined;
@@ -888,8 +918,15 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
888
918
  quests: import("pinia").Store<"quests", import("./quest-log").QuestLogState, {}, {
889
919
  getQuest(questId: string): import("./quest-log").QuestState;
890
920
  getObjective(questId: string, objectiveId: string): import("./quest-log").ObjectiveState;
891
- setupQuests(quests: {
892
- [key: string]: import("../config").QuestData;
921
+ setupQuests(questsConfig: {
922
+ quests: Record<string, {
923
+ title: string;
924
+ description: string;
925
+ objectives: Record<string, {
926
+ hidden?: boolean | undefined;
927
+ description: string;
928
+ }>;
929
+ }>;
893
930
  }): void;
894
931
  startQuest(questId: string): void;
895
932
  startObjective(questId: string, objectiveId: string): void;
@@ -1,4 +1,4 @@
1
- import { QuestData } from '../config';
1
+ import { QuestsConfig } from '../config/quests-config';
2
2
  export interface QuestLogState {
3
3
  quests: {
4
4
  [key: string]: QuestState;
@@ -22,9 +22,7 @@ export declare type QuestLogSave = QuestLogState;
22
22
  export declare const useQuests: import("pinia").StoreDefinition<"quests", QuestLogState, {}, {
23
23
  getQuest(questId: string): QuestState;
24
24
  getObjective(questId: string, objectiveId: string): ObjectiveState;
25
- setupQuests(quests: {
26
- [key: string]: QuestData;
27
- }): void;
25
+ setupQuests(questsConfig: QuestsConfig): void;
28
26
  startQuest(questId: string): void;
29
27
  startObjective(questId: string, objectiveId: string): void;
30
28
  completeObjective(questId: string, objectiveId: string): void;
@@ -1,5 +1,5 @@
1
+ import { Config } from '../config/config-output';
1
2
  import { AddTransition, TransitionState } from '../utils/transition';
2
- import { Config } from '../config';
3
3
  export declare type ButtonStateValue = boolean | 'hidden' | 'greyed';
4
4
  export interface ButtonsState {
5
5
  [key: string]: {
@@ -1,4 +1,4 @@
1
- import { SkillData } from '../config';
1
+ import { SkillsConfig } from '../config/skills-config';
2
2
  export interface SkillState {
3
3
  id: string;
4
4
  level: number;
@@ -28,9 +28,7 @@ export declare const useSkills: import("pinia").StoreDefinition<"skills", Skills
28
28
  getSkillCheck(id: string): SkillCheckState;
29
29
  createSkillCheckState(): SkillCheckState;
30
30
  loadSaveData(data: SkillsSave): void;
31
- setupSkills(skills: {
32
- [key: string]: SkillData;
33
- }): void;
31
+ setupSkills(skillsConfig: SkillsConfig): void;
34
32
  getSkill(skill: string): SkillState;
35
33
  getSkillLevel(skill: string): number;
36
34
  getSkillXp(skill: string): number;
@@ -1,10 +1,10 @@
1
- import { Config, MusicConfig, AudioConfig } from '../config';
2
1
  import { Howl } from 'howler';
2
+ import { AudioConfig, AudioFileConfig } from '../config/audio-config';
3
3
  export declare const howlerMap: {
4
4
  [key: string]: Howl;
5
5
  };
6
- export declare function loadAudioAssets(config: Config): Promise<void[]>;
6
+ export declare function loadAudioAssets(config: AudioConfig): Promise<void[]>;
7
7
  export declare function audioEvent(event: string): void;
8
- export declare function loadAudio(key: string, config: AudioConfig | MusicConfig): Promise<void>;
8
+ export declare function loadAudio(key: string, config: AudioFileConfig): Promise<void>;
9
9
  export declare function stopHowlerById(musicKey: string, howlerId: number): void;
10
10
  export declare function getAudio(key: string): Howl | undefined;
@@ -16,7 +16,7 @@ export declare function getModifiableDataPinia(): {
16
16
  scope: {
17
17
  [key: string]: any;
18
18
  };
19
- config: import("../config").Config;
19
+ config: import("../config/config-output").Config;
20
20
  gameOptions: {
21
21
  baseAssetsPath: string;
22
22
  baseDataPath: string;
@@ -1,4 +1,4 @@
1
- import { Config } from '../config';
1
+ import { Config } from '../config/config-output';
2
2
  export declare const images: {
3
3
  [key: string]: HTMLImageElement | Promise<HTMLImageElement>;
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "2.7.2",
3
+ "version": "2.8.0-rc2",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "dist/narrat.umd.js",
6
6
  "module": "dist/narrat.es.js",
@@ -28,6 +28,9 @@
28
28
  "vue": "^3.2.37"
29
29
  },
30
30
  "dependencies": {
31
+ "@sinclair/typebox": "^0.24.28",
32
+ "ajv": "^8.11.0",
33
+ "ajv-formats": "^2.1.1",
31
34
  "deepmerge": "^4.2.2",
32
35
  "fuse.js": "^6.6.2",
33
36
  "howler": "^2.2.3",
@@ -1,2 +0,0 @@
1
- import { Config } from './config';
2
- export declare const defaultConfig: Config;