narrat 2.0.7 → 2.0.8

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +785 -0
  2. package/LICENSE +21 -21
  3. package/README.md +105 -38
  4. package/dist/.DS_Store +0 -0
  5. package/dist/app.vue.d.ts +96 -106
  6. package/dist/components/MainMenu.vue.d.ts +12 -12
  7. package/dist/components/Skills.vue.d.ts +22 -22
  8. package/dist/components/debug/debug-menu.vue.d.ts +48 -48
  9. package/dist/components/dialog-picture.vue.d.ts +9 -9
  10. package/dist/components/game-dialog.vue.d.ts +65 -65
  11. package/dist/components/hud.vue.d.ts +12 -12
  12. package/dist/components/inventory-ui.vue.d.ts +30 -30
  13. package/dist/components/loading-bar.vue.d.ts +10 -10
  14. package/dist/components/menu-buttons.vue.d.ts +26 -26
  15. package/dist/components/notification-toast.vue.d.ts +6 -6
  16. package/dist/components/quests-ui.vue.d.ts +20 -20
  17. package/dist/components/utils/modal.vue.d.ts +6 -6
  18. package/dist/components/volume-controls.vue.d.ts +7 -7
  19. package/dist/config.d.ts +151 -151
  20. package/dist/constants.d.ts +1 -1
  21. package/dist/data/characters.json +62 -62
  22. package/dist/data/config.json +182 -182
  23. package/dist/data/example.rpy +363 -360
  24. package/dist/data/refactor.rpy +30 -30
  25. package/dist/defaultConfig.d.ts +2 -2
  26. package/dist/demo/demo.d.ts +1 -1
  27. package/dist/dialog-box.vue.d.ts +37 -37
  28. package/dist/exports/config.d.ts +1 -1
  29. package/dist/exports/display.d.ts +2 -2
  30. package/dist/exports/plugins.d.ts +20 -20
  31. package/dist/fonts/OpenDyslexic.ttf.svg +2326 -2326
  32. package/dist/gameloop.d.ts +3 -3
  33. package/dist/img/.DS_Store +0 -0
  34. package/dist/lib/lib.d.ts +15 -15
  35. package/dist/main.d.ts +5 -5
  36. package/dist/music/.DS_Store +0 -0
  37. package/dist/narrat.es.js +11 -80
  38. package/dist/narrat.es.js.map +1 -1
  39. package/dist/narrat.umd.js +77 -77
  40. package/dist/narrat.umd.js.map +1 -1
  41. package/dist/plugins/NarratPlugin.d.ts +11 -11
  42. package/dist/sounds/.DS_Store +0 -0
  43. package/dist/stores/audio-store.d.ts +12 -12
  44. package/dist/stores/dialog-store.d.ts +31 -31
  45. package/dist/stores/hud-stats-store.d.ts +22 -22
  46. package/dist/stores/inventory-store.d.ts +37 -37
  47. package/dist/stores/main-store.d.ts +276 -276
  48. package/dist/stores/notification-store.d.ts +12 -12
  49. package/dist/stores/quest-log.d.ts +39 -39
  50. package/dist/stores/rendering-store.d.ts +13 -13
  51. package/dist/stores/screens-store.d.ts +23 -23
  52. package/dist/stores/skills.d.ts +36 -36
  53. package/dist/stores/vm-store.d.ts +148 -148
  54. package/dist/types/app-types.d.ts +4 -4
  55. package/dist/types/character-types.d.ts +27 -27
  56. package/dist/types/dialog-box-types.d.ts +10 -10
  57. package/dist/types/game-save.d.ts +21 -21
  58. package/dist/types/parser.d.ts +92 -92
  59. package/dist/types/state.d.ts +3 -3
  60. package/dist/utils/ajax.d.ts +1 -1
  61. package/dist/utils/audio-loader.d.ts +13 -13
  62. package/dist/utils/characters.d.ts +5 -5
  63. package/dist/utils/data-helpers.d.ts +19 -19
  64. package/dist/utils/debounce.d.ts +14 -14
  65. package/dist/utils/error-handling.d.ts +3 -3
  66. package/dist/utils/helpers.d.ts +6 -6
  67. package/dist/utils/images-loader.d.ts +6 -6
  68. package/dist/utils/logger.d.ts +11 -11
  69. package/dist/utils/object-iterators.d.ts +8 -8
  70. package/dist/utils/promises.d.ts +1 -1
  71. package/dist/utils/randomId.d.ts +1 -1
  72. package/dist/utils/save-helpers.d.ts +3 -3
  73. package/dist/utils/skillchecks.d.ts +17 -17
  74. package/dist/utils/string-helpers.d.ts +3 -3
  75. package/dist/utils/time-helpers.d.ts +2 -2
  76. package/dist/vm/commands/arithmetic-commands.d.ts +17 -17
  77. package/dist/vm/commands/audio-commands.d.ts +8 -8
  78. package/dist/vm/commands/choice.d.ts +37 -37
  79. package/dist/vm/commands/clear_dialog.d.ts +2 -2
  80. package/dist/vm/commands/command-helpers.d.ts +2 -2
  81. package/dist/vm/commands/command-plugin.d.ts +30 -30
  82. package/dist/vm/commands/flow-commands.d.ts +14 -14
  83. package/dist/vm/commands/if.d.ts +10 -10
  84. package/dist/vm/commands/index.d.ts +2 -2
  85. package/dist/vm/commands/inventory-commands.d.ts +15 -15
  86. package/dist/vm/commands/logic-command.d.ts +42 -42
  87. package/dist/vm/commands/notify.d.ts +4 -4
  88. package/dist/vm/commands/quest-commands.d.ts +30 -30
  89. package/dist/vm/commands/screen-commands.d.ts +8 -8
  90. package/dist/vm/commands/set.d.ts +6 -6
  91. package/dist/vm/commands/skill-commands.d.ts +33 -33
  92. package/dist/vm/commands/stats-commands.d.ts +12 -12
  93. package/dist/vm/commands/string-commands.d.ts +9 -9
  94. package/dist/vm/commands/text-field.d.ts +7 -7
  95. package/dist/vm/commands/text.d.ts +13 -13
  96. package/dist/vm/commands/wait.d.ts +4 -4
  97. package/dist/vm/vm-helpers.d.ts +16 -16
  98. package/dist/vm/vm-parser.d.ts +19 -19
  99. package/dist/vm/vm-parser.test.d.ts +1 -1
  100. package/dist/vm/vm.d.ts +19 -19
  101. package/package.json +79 -79
@@ -1,3 +1,3 @@
1
- export declare function startGameLoop(): void;
2
- export declare function gameLoop(): void;
3
- export declare function mouseclick(e: MouseEvent): void;
1
+ export declare function startGameLoop(): void;
2
+ export declare function gameLoop(): void;
3
+ export declare function mouseclick(e: MouseEvent): void;
Binary file
package/dist/lib/lib.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { App } from 'vue';
2
- import 'es6-promise/auto';
3
- import './/../sass/main.css';
4
- export * from '../main';
5
- export declare type Narrat = {
6
- app: App;
7
- };
8
- declare global {
9
- export interface Window {
10
- narrat: Narrat;
11
- }
12
- }
13
- export * from '../exports/plugins';
14
- export * from '../exports/display';
15
- export * from '../exports/config';
1
+ import { App } from 'vue';
2
+ import 'es6-promise/auto';
3
+ import './/../sass/main.css';
4
+ export * from '../main';
5
+ export declare type Narrat = {
6
+ app: App;
7
+ };
8
+ declare global {
9
+ export interface Window {
10
+ narrat: Narrat;
11
+ }
12
+ }
13
+ export * from '../exports/plugins';
14
+ export * from '../exports/display';
15
+ export * from '../exports/config';
package/dist/main.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import "es6-promise/auto";
2
- import ".//sass/main.css";
3
- import { GameConfig } from "./types/app-types";
4
- import { AppOptions } from "./config";
5
- export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
1
+ import "es6-promise/auto";
2
+ import ".//sass/main.css";
3
+ import { GameConfig } from "./types/app-types";
4
+ import { AppOptions } from "./config";
5
+ export declare function startApp(config: GameConfig, options: AppOptions): Promise<void>;
Binary file
package/dist/narrat.es.js CHANGED
@@ -39801,6 +39801,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39801
39801
  const stack = computed(() => vmStore.stack);
39802
39802
  const dialogStore = useDialogStore();
39803
39803
  const dialog = computed(() => dialogStore.dialog);
39804
+ const dialogRef = ref(null);
39804
39805
  const dialogContainerStyle = computed(() => {
39805
39806
  if (props.layoutMode === "vertical") {
39806
39807
  return {};
@@ -39866,6 +39867,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39866
39867
  const result = i2 === dialogStore.dialog.length - 1 && stack.value.length > 0;
39867
39868
  return result;
39868
39869
  }
39870
+ watch(dialog.value, (newValue) => {
39871
+ if (dialogRef.value) {
39872
+ const dialog2 = dialogRef.value;
39873
+ dialog2.scrollTop = dialog2.scrollHeight + 1e8;
39874
+ }
39875
+ });
39869
39876
  return (_ctx, _cache) => {
39870
39877
  return openBlock(), createElementBlock(Fragment, null, [
39871
39878
  createVNode(Transition, { name: "fade" }, {
@@ -39880,8 +39887,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
39880
39887
  __props.inGame ? (openBlock(), createElementBlock("div", {
39881
39888
  key: 0,
39882
39889
  class: "dialog override",
39883
- ref_key: "dialog",
39884
- ref: dialog,
39890
+ ref_key: "dialogRef",
39891
+ ref: dialogRef,
39885
39892
  style: normalizeStyle(unref(dialogStyle))
39886
39893
  }, [
39887
39894
  createVNode(TransitionGroup, {
@@ -40223,14 +40230,6 @@ const _sfc_main = defineComponent({
40223
40230
  this.updateScreenSize();
40224
40231
  }, 50);
40225
40232
  },
40226
- watch: {
40227
- dialogLength(newCount, oldCount) {
40228
- if (this.$refs.dialog) {
40229
- const dialog = this.$refs.dialog;
40230
- dialog.scrollTop = dialog.scrollHeight + 1e8;
40231
- }
40232
- }
40233
- },
40234
40233
  computed: {
40235
40234
  ...mapState(useRenderingStore, [
40236
40235
  "screenWidth",
@@ -40242,21 +40241,6 @@ const _sfc_main = defineComponent({
40242
40241
  "layoutMode"
40243
40242
  ]),
40244
40243
  ...mapState(useVM, ["currentLine"]),
40245
- dialogLength() {
40246
- return this.dialog.length;
40247
- },
40248
- lastDialog() {
40249
- if (this.dialog.length > 0) {
40250
- return this.dialog[this.dialog.length - 1];
40251
- }
40252
- return void 0;
40253
- },
40254
- picture() {
40255
- if (this.lastDialog) {
40256
- return getCharacterPictureUrl(this.lastDialog.speaker, this.lastDialog.pose);
40257
- }
40258
- return void 0;
40259
- },
40260
40244
  backgroundStyle() {
40261
40245
  let height;
40262
40246
  if (this.layoutMode === "vertical") {
@@ -40287,23 +40271,6 @@ const _sfc_main = defineComponent({
40287
40271
  left: this.leftOffset
40288
40272
  };
40289
40273
  },
40290
- dialogWidth() {
40291
- const width = getConfig().layout.minTextWidth;
40292
- this.mq;
40293
- return width;
40294
- },
40295
- dialogStyle() {
40296
- let transform;
40297
- const height = "100%";
40298
- if (this.layoutMode === "horizontal")
40299
- ;
40300
- return {
40301
- width: this.layoutMode === "horizontal" ? `${this.dialogWidth}px` : "100%",
40302
- height,
40303
- transform,
40304
- transformOrigin: "right"
40305
- };
40306
- },
40307
40274
  gameWidth() {
40308
40275
  const config2 = getConfig();
40309
40276
  if (this.layoutMode === "vertical") {
@@ -40346,15 +40313,6 @@ const _sfc_main = defineComponent({
40346
40313
  const baseWidth = config2.layout.minTextWidth + config2.layout.backgrounds.width;
40347
40314
  const widthRatio = this.screenWidth / baseWidth;
40348
40315
  return widthRatio;
40349
- },
40350
- dialogContainerStyle() {
40351
- if (this.layoutMode === "vertical") {
40352
- return {};
40353
- } else {
40354
- return {
40355
- paddingBottom: `${getConfig().layout.dialogBottomPadding}px`
40356
- };
40357
- }
40358
40316
  }
40359
40317
  },
40360
40318
  methods: {
@@ -40374,10 +40332,6 @@ const _sfc_main = defineComponent({
40374
40332
  audioEvent("onPressStart");
40375
40333
  useMain().loadGame(this.getSaveFile());
40376
40334
  },
40377
- isDialogActive(i2) {
40378
- const result = i2 === this.dialog.length - 1 && this.stack.length > 0;
40379
- return result;
40380
- },
40381
40335
  nextLine() {
40382
40336
  useVM().nextLine();
40383
40337
  },
@@ -40386,29 +40340,6 @@ const _sfc_main = defineComponent({
40386
40340
  },
40387
40341
  closeModal() {
40388
40342
  useMain().closeModal();
40389
- },
40390
- getDialogBoxOptions(dialogKey, index) {
40391
- const info = getCharacterInfo(dialogKey.speaker);
40392
- let title = info.name;
40393
- if (index >= 1) {
40394
- const previousDialog = this.dialog[index - 1];
40395
- if (previousDialog.speaker === dialogKey.speaker) {
40396
- title = void 0;
40397
- }
40398
- }
40399
- if (dialogKey.choices) {
40400
- dialogKey.choices.forEach((choice) => {
40401
- choice.choice = processText(choice.choice);
40402
- });
40403
- }
40404
- return {
40405
- title: title != null ? title : "",
40406
- text: dialogKey.text,
40407
- styleId: dialogKey.speaker,
40408
- choices: dialogKey.choices,
40409
- old: index < this.dialog.length - 1,
40410
- interactive: dialogKey.interactive
40411
- };
40412
40343
  }
40413
40344
  }
40414
40345
  });
@@ -40710,7 +40641,7 @@ const addStatPlugin = new CommandPlugin("add_stat", [
40710
40641
  { name: "amountToAdd", type: "number" }
40711
40642
  ], async (cmd) => {
40712
40643
  const { statKey, amountToAdd } = cmd.options;
40713
- if (!statKey || !amountToAdd) {
40644
+ if (!statKey || typeof amountToAdd !== "number") {
40714
40645
  commandRuntimeError(cmd, `add_stat command needs a stat id and a value as parameters`);
40715
40646
  }
40716
40647
  const hud = useHud();
@@ -40722,7 +40653,7 @@ const setStatPlugin = new CommandPlugin("set_stat", [
40722
40653
  { name: "value", type: "number" }
40723
40654
  ], async (cmd) => {
40724
40655
  const { statKey, value } = cmd.options;
40725
- if (!statKey || !value) {
40656
+ if (!statKey || typeof value !== "number") {
40726
40657
  commandRuntimeError(cmd, `set_stat command needs a stat id and a value as parameters`);
40727
40658
  }
40728
40659
  const hud = useHud();