narrat 1.1.0 → 1.2.0

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,26 @@
1
+ import { ItemData } from '..';
2
+ export interface ItemState {
3
+ amount: number;
4
+ id: string;
5
+ }
6
+ export interface InventoryState {
7
+ /** Note: Items are an object so that it's easy to access specific items in game scripts.
8
+ * One side effect of this is that the order items appear in isn't technicaclly guaranteed.
9
+ * It also means there can only be one "stack" of an item at a time */
10
+ items: {
11
+ [key: string]: ItemState;
12
+ };
13
+ }
14
+ export declare type InventorySave = InventoryState;
15
+ export declare const useInventory: import("pinia").StoreDefinition<"inventory", InventoryState, {}, {
16
+ generateSaveData(): InventorySave;
17
+ loadSaveData(save: InventorySave): void;
18
+ setupItems(items: {
19
+ [key: string]: ItemData;
20
+ }): void;
21
+ getExistingItem(id: string): ItemState | undefined;
22
+ getItemAmount(id: string): number;
23
+ add(item: ItemState): void;
24
+ remove(item: ItemState): void;
25
+ deleteItem(id: string): void;
26
+ }>;
@@ -250,6 +250,33 @@ export declare const useMain: import("pinia").StoreDefinition<"main", MainState,
250
250
  addNotification(text: string): Promise<void>;
251
251
  deleteNotification(id: string): void;
252
252
  }>;
253
+ inventory: import("pinia").Store<"inventory", import("./inventory-store").InventoryState, {}, {
254
+ generateSaveData(): import("./inventory-store").InventoryState;
255
+ loadSaveData(save: import("./inventory-store").InventoryState): void;
256
+ setupItems(items: {
257
+ [key: string]: import("..").ItemData;
258
+ }): void;
259
+ getExistingItem(id: string): import("./inventory-store").ItemState;
260
+ getItemAmount(id: string): number;
261
+ add(item: import("./inventory-store").ItemState): void;
262
+ remove(item: import("./inventory-store").ItemState): void;
263
+ deleteItem(id: string): void;
264
+ }>;
265
+ quests: import("pinia").Store<"quests", import("./quest-log").QuestLogState, {}, {
266
+ getQuest(questId: string): import("./quest-log").QuestState;
267
+ getObjective(quest: string, objectiveId: string): import("./quest-log").ObjectiveState;
268
+ setupQuests(quests: {
269
+ [key: string]: import("..").QuestData;
270
+ }): void;
271
+ startQuest(questId: string): void;
272
+ startObjective(questId: string, objectiveId: string): void;
273
+ completeObjective(questId: string, objectiveId: string): void;
274
+ completeQuest(questId: string, ending?: string): void;
275
+ isQuestCompleted(questId: string): boolean;
276
+ removeQuest(id: string): void;
277
+ generateSaveData(): import("./quest-log").QuestLogState;
278
+ loadSaveData(data: import("./quest-log").QuestLogState): void;
279
+ }>;
253
280
  };
254
281
  overrideStates(override: any): void;
255
282
  }>;
@@ -0,0 +1,36 @@
1
+ import { QuestData } from '..';
2
+ export interface QuestLogState {
3
+ quests: {
4
+ [key: string]: QuestState;
5
+ };
6
+ }
7
+ export interface QuestState {
8
+ id: string;
9
+ state: 'hidden' | 'unlocked' | 'completed';
10
+ ending?: string;
11
+ /** Note: Objectives are an object so that it's easy to access specific objectives in game scripts.
12
+ * One side effect of this is that the order objectives appear in isn't technicaclly guaranteed. */
13
+ objectives: {
14
+ [key: string]: ObjectiveState;
15
+ };
16
+ }
17
+ export interface ObjectiveState {
18
+ id: string;
19
+ state: 'hidden' | 'unlocked' | 'completed';
20
+ }
21
+ export declare type QuestLogSave = QuestLogState;
22
+ export declare const useQuests: import("pinia").StoreDefinition<"quests", QuestLogState, {}, {
23
+ getQuest(questId: string): QuestState;
24
+ getObjective(quest: string, objectiveId: string): ObjectiveState;
25
+ setupQuests(quests: {
26
+ [key: string]: QuestData;
27
+ }): void;
28
+ startQuest(questId: string): void;
29
+ startObjective(questId: string, objectiveId: string): void;
30
+ completeObjective(questId: string, objectiveId: string): void;
31
+ completeQuest(questId: string, ending?: string): void;
32
+ isQuestCompleted(questId: string): boolean;
33
+ removeQuest(id: string): void;
34
+ generateSaveData(): QuestLogSave;
35
+ loadSaveData(data: QuestLogSave): void;
36
+ }>;
@@ -1,7 +1,9 @@
1
1
  import { AudioSave } from '@/stores/audio-store';
2
2
  import { DialogSave } from '@/stores/dialog-store';
3
3
  import { HudSave } from '@/stores/hud-stats-store';
4
+ import { InventorySave } from '@/stores/inventory-store';
4
5
  import { MainSaveData } from '@/stores/main-store';
6
+ import { QuestLogSave } from '@/stores/quest-log';
5
7
  import { ScreenSave } from '@/stores/screens-store';
6
8
  import { SkillsSave } from '@/stores/skills';
7
9
  import { VMSave } from '@/stores/vm-store';
@@ -14,4 +16,6 @@ export declare type GameSave = {
14
16
  vm: VMSave;
15
17
  audio: AudioSave;
16
18
  hud: HudSave;
19
+ inventory: InventorySave;
20
+ quests: QuestLogSave;
17
21
  };
@@ -5,4 +5,10 @@ export declare function getModifiableDataPinia(): {
5
5
  data: import("@/stores/vm-store").DataState;
6
6
  skills: import("@/stores/skills").SkillsState;
7
7
  buttons: import("@/stores/screens-store").ButtonsState;
8
+ items: {
9
+ [key: string]: import("@/stores/inventory-store").ItemState;
10
+ };
11
+ quests: {
12
+ [key: string]: import("@/stores/quest-log").QuestState;
13
+ };
8
14
  };
@@ -0,0 +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) => boolean;
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
+ };
@@ -0,0 +1,2 @@
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const addItemPlugin: CommandPlugin;
@@ -0,0 +1,5 @@
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const startQuestPlugin: CommandPlugin;
3
+ export declare const startObjectivePlugin: CommandPlugin;
4
+ export declare const completeObjectivePlugin: CommandPlugin;
5
+ export declare const completeQuestPlugin: CommandPlugin;
@@ -0,0 +1,2 @@
1
+ import { CommandPlugin } from './command-plugin';
2
+ export declare const removeItemPlugin: CommandPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",