narrat 0.10.0 → 0.11.2

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.10.0 - June 8, 2022 02:13:08
1
+ // Version: 0.11.2 - June 15, 2022 15:56:51
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -34,7 +34,7 @@ function styleInject(css, ref) {
34
34
  }
35
35
  }
36
36
 
37
- var css_248z = "/*! @import */\n\n/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */\n\n/*\nDocument\n========\n*/\n\n/**\nUse a better box model (opinionated).\n*/\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n/**\nUse a more readable tab size (opinionated).\n*/\n\n:root {\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n}\n\n/**\n1. Correct the line height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n*/\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/*\nSections\n========\n*/\n\n/**\nRemove the margin in all browsers.\n*/\n\nbody {\n margin: 0;\n}\n\n/**\nImprove consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)\n*/\n\nbody {\n font-family:\n\t\tsystem-ui,\n\t\t-apple-system, /* Firefox supports this but not yet `system-ui` */\n\t\t'Segoe UI',\n\t\tRoboto,\n\t\tHelvetica,\n\t\tArial,\n\t\tsans-serif,\n\t\t'Apple Color Emoji',\n\t\t'Segoe UI Emoji';\n}\n\n/*\nGrouping content\n================\n*/\n\n/**\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n}\n\n/*\nText-level semantics\n====================\n*/\n\n/**\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr[title] {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/**\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/**\n1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)\n2. Correct the odd 'em' font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family:\n\t\tui-monospace,\n\t\tSFMono-Regular,\n\t\tConsolas,\n\t\t'Liberation Mono',\n\t\tMenlo,\n\t\tmonospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/**\nPrevent 'sub' and 'sup' elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\nTabular data\n============\n*/\n\n/**\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n}\n\n/*\nForms\n=====\n*/\n\n/**\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\nRemove the inheritance of text transform in Edge and Firefox.\n1. Remove the inheritance of text transform in Firefox.\n*/\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\nCorrect the inability to style clickable types in iOS and Safari.\n*/\n\nbutton,\n[type='button'],\n[type='reset'] {\n -webkit-appearance: button;\n}\n\n/**\nRemove the inner border and padding in Firefox.\n*/\n\n/**\nRestore the focus styles unset by the previous rule.\n*/\n\n/**\nRemove the additional ':invalid' styles in Firefox.\nSee: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737\n*/\n\n/**\nRemove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.\n*/\n\nlegend {\n padding: 0;\n}\n\n/**\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n/**\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n/**\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to 'inherit' in Safari.\n*/\n\n/*\nInteractive\n===========\n*/\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/**\n * Manually forked from SUIT CSS Base: https://github.com/suitcss/base\n * A thin layer on top of normalize.css that provides a starting point more\n * suitable for web applications.\n */\n\n/**\n * Removes the default spacing and border for appropriate elements.\n */\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nbutton {\n background-color: transparent;\n background-image: none;\n}\n\n/**\n * Work around a Firefox/IE bug where the transparent `button` background\n * results in a loss of the default `button` focus styles.\n */\n\nbutton:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nol,\nul {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/**\n * Tailwind custom reset styles\n */\n\n/**\n * 1. Use the user's configured `sans` font-family (with Tailwind's default\n * sans-serif font stack as a fallback) as a sane default.\n * 2. Use Tailwind's default \"normal\" line-height so the user isn't forced\n * to override it to ensure consistency even when using the default theme.\n */\n\nhtml {\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 1 */\n line-height: 1.5; /* 2 */\n}\n\n/**\n * Inherit font-family and line-height from `html` so users can set them as\n * a class directly on the `html` element.\n */\n\nbody {\n font-family: inherit;\n line-height: inherit;\n}\n\n/**\n * 1. Prevent padding and border from affecting element width.\n *\n * We used to set this in the html element and inherit from\n * the parent element for everything else. This caused issues\n * in shadow-dom-enhanced elements like <details> where the content\n * is wrapped by a div with box-sizing set to `content-box`.\n *\n * https://github.com/mozdevs/cssremedy/issues/4\n *\n *\n * 2. Allow adding a border to an element by just adding a border-width.\n *\n * By default, the way the browser specifies that an element should have no\n * border is by setting it's border-style to `none` in the user-agent\n * stylesheet.\n *\n * In order to easily add borders to elements by just setting the `border-width`\n * property, we change the default border-style for all elements to `solid`, and\n * use border-width to hide them instead. This way our `border` utilities only\n * need to set the `border-width` property instead of the entire `border`\n * shorthand, making our border utilities much more straightforward to compose.\n *\n * https://github.com/tailwindcss/tailwindcss/pull/116\n */\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n/*\n * Ensure horizontal rules are visible by default\n */\n\nhr {\n border-top-width: 1px;\n}\n\n/**\n * Undo the `border-style: none` reset that Normalize applies to images so that\n * our `border-{width}` utilities have the expected effect.\n *\n * The Normalize reset is unnecessary for us since we default the border-width\n * to 0 on all elements.\n *\n * https://github.com/tailwindcss/tailwindcss/issues/362\n */\n\nimg {\n border-style: solid;\n}\n\ntextarea {\n resize: vertical;\n}\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n color: #9ca3af;\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n color: #9ca3af;\n}\n\ninput::placeholder,\ntextarea::placeholder {\n color: #9ca3af;\n}\n\nbutton {\n cursor: pointer;\n}\n\ntable {\n border-collapse: collapse;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/**\n * Reset links to optimize for opt-in styling instead of\n * opt-out.\n */\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/**\n * Reset form element properties that are easy to forget to\n * style explicitly so you don't inadvertently introduce\n * styles that deviate from your design system. These styles\n * supplement a partial reset that is already applied by\n * normalize.css.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n}\n\n/**\n * Use the configured 'mono' font family for elements that\n * are expected to be rendered with a monospace font, falling\n * back to the system monospace stack if there is no configured\n * 'mono' font family.\n */\n\npre,\ncode,\nkbd,\nsamp {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n}\n\n/**\n * Make replaced elements `display: block` by default as that's\n * the behavior you want almost all of the time. Inspired by\n * CSS Remedy, with `svg` added as well.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block;\n vertical-align: middle;\n}\n\n/**\n * Constrain images and videos to the parent width and preserve\n * their instrinsic aspect ratio.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n.container {\n width: 100%;\n}\n\n@media (min-width: 640px) {\n .container {\n max-width: 640px;\n }\n}\n\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n\n.bg-gray-800 {\n --tw-bg-opacity: 1;\n background-color: rgba(31, 41, 55, var(--tw-bg-opacity));\n}\n\n.border {\n border-width: 1px;\n}\n\n.flex {\n display: flex;\n}\n\n.table {\n display: table;\n}\n\n.grid {\n display: grid;\n}\n\n.hidden {\n display: none;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-grow {\n flex-grow: 1;\n}\n\n.flex-shrink {\n flex-shrink: 1;\n}\n\n.list-disc {\n list-style-type: disc;\n}\n\n.absolute {\n position: absolute;\n}\n\n.resize {\n resize: both;\n}\n\n* {\n --tw-shadow: 0 0 #0000;\n}\n\n* {\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgba(59, 130, 246, 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n}\n\n.table-auto {\n table-layout: auto;\n}\n\n.line-through {\n text-decoration: line-through;\n}\n\n.w-full {\n width: 100%;\n}\n\n.gap-4 {\n gap: 1rem;\n}\n\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n\n.transition {\n transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n@-webkit-keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@-webkit-keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n@-webkit-keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n\n@keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n\n@-webkit-keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n -webkit-animation-timing-function: cubic-bezier(0.8,0,1,1);\n animation-timing-function: cubic-bezier(0.8,0,1,1);\n }\n\n 50% {\n transform: none;\n -webkit-animation-timing-function: cubic-bezier(0,0,0.2,1);\n animation-timing-function: cubic-bezier(0,0,0.2,1);\n }\n}\n\n@keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n -webkit-animation-timing-function: cubic-bezier(0.8,0,1,1);\n animation-timing-function: cubic-bezier(0.8,0,1,1);\n }\n\n 50% {\n transform: none;\n -webkit-animation-timing-function: cubic-bezier(0,0,0.2,1);\n animation-timing-function: cubic-bezier(0,0,0.2,1);\n }\n}\n\n:root {\n --bg-color: #131720;\n --text-color: #d9e1f2;\n --primary: hsl(255, 30%, 55%);\n --focus: hsl(210, 90%, 50%);\n --secondary: #42b983;\n --border-color: hsla(0, 0%, 100%, 0.2);\n --light-1: hsl(210, 30%, 40%);\n --light-2: hsl(255, 30%, 50%);\n --light-background: linear-gradient(to right, var(--light-1), var(--light-2));\n --shadow-1: hsla(236, 50%, 50%, 0.3);\n --shadow-2: hsla(236, 50%, 50%, 0.4);\n --hud-background: rgba(0, 0, 0, 0.4);\n --hud-text-color: var(--text-color);\n --notifications-bg: darkslateblue;\n --skills-text-background: rgba(0, 0, 0, 0.5);\n --skills-text-color: var(--text-color);\n --skills-level-background: rgba(0, 0, 0, 0.5);\n --skills-level-color: orange;\n --skills-xp-bar-height: 40px;\n --skill-check-name-color: orange;\n --skill-check-difficulty: orange;\n --skill-check-success: green;\n --skill-check-failed: red;\n --skill-check-color: orange;\n --dialog-choice-color: orange;\n --dialog-choice-hover-color: var(--text-color);\n}\n\n.list-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.list-enter-active,\n.list-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .list-move {\n transition: transform 0.3s ease;\n} */\n\n.list-enter-from,\n.list-leave-to {\n opacity: 0;\n transform: translateX(300px);\n}\n\n.notification-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.notification-enter-active,\n.notification-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .notification-move {\n transition: transform 0.3s ease;\n} */\n\n.notification-enter-from,\n.notification-leave-to {\n opacity: 0;\n transform: translateY(-300px);\n}\n\n.fade-enter-active,\n.fade-leave-active {\n transition: opacity 0.3s ease;\n}\n\n.fade-enter-from,\n.fade-leave-to {\n opacity: 0;\n}\n\n.fade-in-enter-active {\n transition: opacity 0.1s ease;\n}\n\n.fade-in-enter-from {\n opacity: 0;\n}\n\nbody {\n padding: 0;\n margin: 0;\n font-family: Arial, sans-serif;\n background-color: black;\n}\n\n.select {\n background: var(--light-background);\n padding: 10px;\n}\n\n.option {\n background-color: var(--light-2);\n padding: 5px;\n color: var(--text-color);\n}\n\n.button {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.button:focus,\n.button:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\n.input {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.input:focus,\n.input:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\na {\n color: pink;\n text-decoration: underline;\n}\n\nth,\ntd {\n padding: 4px;\n border: 1px solid var(--text-color);\n text-align: center;\n}\n\n#game-holder {\n width: 100vw;\n height: 100vh;\n padding: 0;\n margin: 0;\n top: 0;\n left: 0;\n background-color: black;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: -webkit-fill-available;\n}\n\n.title {\n font-size: 30px;\n font-weight: 700;\n text-align: center;\n}\n\n.container {\n padding: 20px;\n}\n\nh1,\nh2,\nh3,\nh4 {\n font-weight: 700;\n}\n\nh1 {\n font-size: 30px;\n}\n\nh2 {\n font-size: 26px;\n}\n\nh3 {\n font-size: 24px;\n}\n\nhr.solid {\n border: 1px solid var(--text-color);\n margin-top: 30px;\n margin-bottom: 30px;\n}\n\n.card-1 {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.card-1:hover {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-2 {\n box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-3 {\n box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-4 {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-5 {\n box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22);\n}\n\n.dialog-choice {\n transition: 0.2s;\n}\n\n.dialog-choice:hover {\n transform: scale(1.05, 1.05);\n transform-origin: center;\n}\n\n/* Somewhat arcane CSS to force the hover color to override the child style.\nOtherwise hovering choices doesn't change the color of skill check prompts. */\n\n.dialog-choice:not(:hover) > .skill-check-name,\n.passive-skill-check > .skill-check-name {\n color: var(--skill-check-name-color);\n}\n\n.dialog-choice:not(:hover) > .skill-check-difficulty,\n.passive-skill-check > .skill-check-difficulty {\n color: var(--skill-check-difficulty);\n}\n\n.skill-check-difficulty {\n font-weight: 700;\n}\n\n.dialog-choice:not(:hover) > .skill-check-success,\n.passive-skill-check > .skill-check-success {\n color: var(--skill-check-success);\n}\n\n.dialog-choice:not(:hover) > .skill-check-failed,\n.passive-skill-check > .skill-check-failed {\n color: var(--skill-check-failed);\n}\n\n.dialog-choice:not(:hover) > .skill-check,\n.passive-skill-check.skill-check {\n color: var(--skill-check-color);\n}\n\n/* Looks ugly */\n\n/* @keyframes strike-anim {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n}\n.strike-anim {\n position: relative;\n}\n.strike-anim::after {\n content: ' ';\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n height: 1px;\n background: var(--text-color);\n animation-name: strike-anim;\n animation-duration: 0.5s;\n animation-timing-function: linear;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n} */\n\n@media (min-width: 640px) {\n}\n\n@media (min-width: 768px) {\n}\n\n@media (min-width: 1024px) {\n}\n\n@media (min-width: 1280px) {\n}\n\n@media (min-width: 1536px) {\n}\n";
37
+ var css_248z = "/*! @import */\n\n/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */\n\n/*\nDocument\n========\n*/\n\n/**\nUse a better box model (opinionated).\n*/\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n\n/**\nUse a more readable tab size (opinionated).\n*/\n\n:root {\n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n}\n\n/**\n1. Correct the line height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n*/\n\nhtml {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/*\nSections\n========\n*/\n\n/**\nRemove the margin in all browsers.\n*/\n\nbody {\n margin: 0;\n}\n\n/**\nImprove consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)\n*/\n\nbody {\n font-family:\n\t\tsystem-ui,\n\t\t-apple-system, /* Firefox supports this but not yet `system-ui` */\n\t\t'Segoe UI',\n\t\tRoboto,\n\t\tHelvetica,\n\t\tArial,\n\t\tsans-serif,\n\t\t'Apple Color Emoji',\n\t\t'Segoe UI Emoji';\n}\n\n/*\nGrouping content\n================\n*/\n\n/**\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n}\n\n/*\nText-level semantics\n====================\n*/\n\n/**\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr[title] {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/**\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/**\n1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)\n2. Correct the odd 'em' font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family:\n\t\tui-monospace,\n\t\tSFMono-Regular,\n\t\tConsolas,\n\t\t'Liberation Mono',\n\t\tMenlo,\n\t\tmonospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/**\nPrevent 'sub' and 'sup' elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\nTabular data\n============\n*/\n\n/**\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n}\n\n/*\nForms\n=====\n*/\n\n/**\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-size: 100%; /* 1 */\n line-height: 1.15; /* 1 */\n margin: 0; /* 2 */\n}\n\n/**\nRemove the inheritance of text transform in Edge and Firefox.\n1. Remove the inheritance of text transform in Firefox.\n*/\n\nbutton,\nselect { /* 1 */\n text-transform: none;\n}\n\n/**\nCorrect the inability to style clickable types in iOS and Safari.\n*/\n\nbutton,\n[type='button'],\n[type='reset'] {\n -webkit-appearance: button;\n}\n\n/**\nRemove the inner border and padding in Firefox.\n*/\n\n/**\nRestore the focus styles unset by the previous rule.\n*/\n\n/**\nRemove the additional ':invalid' styles in Firefox.\nSee: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737\n*/\n\n/**\nRemove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.\n*/\n\nlegend {\n padding: 0;\n}\n\n/**\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/**\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n/**\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n/**\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to 'inherit' in Safari.\n*/\n\n/*\nInteractive\n===========\n*/\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/**\n * Manually forked from SUIT CSS Base: https://github.com/suitcss/base\n * A thin layer on top of normalize.css that provides a starting point more\n * suitable for web applications.\n */\n\n/**\n * Removes the default spacing and border for appropriate elements.\n */\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nbutton {\n background-color: transparent;\n background-image: none;\n}\n\n/**\n * Work around a Firefox/IE bug where the transparent `button` background\n * results in a loss of the default `button` focus styles.\n */\n\nbutton:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nol,\nul {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/**\n * Tailwind custom reset styles\n */\n\n/**\n * 1. Use the user's configured `sans` font-family (with Tailwind's default\n * sans-serif font stack as a fallback) as a sane default.\n * 2. Use Tailwind's default \"normal\" line-height so the user isn't forced\n * to override it to ensure consistency even when using the default theme.\n */\n\nhtml {\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 1 */\n line-height: 1.5; /* 2 */\n}\n\n/**\n * Inherit font-family and line-height from `html` so users can set them as\n * a class directly on the `html` element.\n */\n\nbody {\n font-family: inherit;\n line-height: inherit;\n}\n\n/**\n * 1. Prevent padding and border from affecting element width.\n *\n * We used to set this in the html element and inherit from\n * the parent element for everything else. This caused issues\n * in shadow-dom-enhanced elements like <details> where the content\n * is wrapped by a div with box-sizing set to `content-box`.\n *\n * https://github.com/mozdevs/cssremedy/issues/4\n *\n *\n * 2. Allow adding a border to an element by just adding a border-width.\n *\n * By default, the way the browser specifies that an element should have no\n * border is by setting it's border-style to `none` in the user-agent\n * stylesheet.\n *\n * In order to easily add borders to elements by just setting the `border-width`\n * property, we change the default border-style for all elements to `solid`, and\n * use border-width to hide them instead. This way our `border` utilities only\n * need to set the `border-width` property instead of the entire `border`\n * shorthand, making our border utilities much more straightforward to compose.\n *\n * https://github.com/tailwindcss/tailwindcss/pull/116\n */\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n/*\n * Ensure horizontal rules are visible by default\n */\n\nhr {\n border-top-width: 1px;\n}\n\n/**\n * Undo the `border-style: none` reset that Normalize applies to images so that\n * our `border-{width}` utilities have the expected effect.\n *\n * The Normalize reset is unnecessary for us since we default the border-width\n * to 0 on all elements.\n *\n * https://github.com/tailwindcss/tailwindcss/issues/362\n */\n\nimg {\n border-style: solid;\n}\n\ntextarea {\n resize: vertical;\n}\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n color: #9ca3af;\n}\n\ninput:-ms-input-placeholder, textarea:-ms-input-placeholder {\n color: #9ca3af;\n}\n\ninput::placeholder,\ntextarea::placeholder {\n color: #9ca3af;\n}\n\nbutton {\n cursor: pointer;\n}\n\ntable {\n border-collapse: collapse;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/**\n * Reset links to optimize for opt-in styling instead of\n * opt-out.\n */\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/**\n * Reset form element properties that are easy to forget to\n * style explicitly so you don't inadvertently introduce\n * styles that deviate from your design system. These styles\n * supplement a partial reset that is already applied by\n * normalize.css.\n */\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n padding: 0;\n line-height: inherit;\n color: inherit;\n}\n\n/**\n * Use the configured 'mono' font family for elements that\n * are expected to be rendered with a monospace font, falling\n * back to the system monospace stack if there is no configured\n * 'mono' font family.\n */\n\npre,\ncode,\nkbd,\nsamp {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n}\n\n/**\n * Make replaced elements `display: block` by default as that's\n * the behavior you want almost all of the time. Inspired by\n * CSS Remedy, with `svg` added as well.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block;\n vertical-align: middle;\n}\n\n/**\n * Constrain images and videos to the parent width and preserve\n * their instrinsic aspect ratio.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n.container {\n width: 100%;\n}\n\n@media (min-width: 640px) {\n .container {\n max-width: 640px;\n }\n}\n\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n\n.bg-gray-800 {\n --tw-bg-opacity: 1;\n background-color: rgba(31, 41, 55, var(--tw-bg-opacity));\n}\n\n.border {\n border-width: 1px;\n}\n\n.flex {\n display: flex;\n}\n\n.table {\n display: table;\n}\n\n.grid {\n display: grid;\n}\n\n.hidden {\n display: none;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-grow {\n flex-grow: 1;\n}\n\n.flex-shrink {\n flex-shrink: 1;\n}\n\n.list-disc {\n list-style-type: disc;\n}\n\n.absolute {\n position: absolute;\n}\n\n.resize {\n resize: both;\n}\n\n* {\n --tw-shadow: 0 0 #0000;\n}\n\n* {\n --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgba(59, 130, 246, 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n}\n\n.table-auto {\n table-layout: auto;\n}\n\n.line-through {\n text-decoration: line-through;\n}\n\n.w-full {\n width: 100%;\n}\n\n.gap-4 {\n gap: 1rem;\n}\n\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n\n.transition {\n transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n@-webkit-keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@-webkit-keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n@-webkit-keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n\n@keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n\n@-webkit-keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n -webkit-animation-timing-function: cubic-bezier(0.8,0,1,1);\n animation-timing-function: cubic-bezier(0.8,0,1,1);\n }\n\n 50% {\n transform: none;\n -webkit-animation-timing-function: cubic-bezier(0,0,0.2,1);\n animation-timing-function: cubic-bezier(0,0,0.2,1);\n }\n}\n\n@keyframes bounce {\n 0%, 100% {\n transform: translateY(-25%);\n -webkit-animation-timing-function: cubic-bezier(0.8,0,1,1);\n animation-timing-function: cubic-bezier(0.8,0,1,1);\n }\n\n 50% {\n transform: none;\n -webkit-animation-timing-function: cubic-bezier(0,0,0.2,1);\n animation-timing-function: cubic-bezier(0,0,0.2,1);\n }\n}\n\n:root {\n --bg-color: #131720;\n --text-color: #d9e1f2;\n --primary: hsl(255, 30%, 55%);\n --focus: hsl(210, 90%, 50%);\n --secondary: #42b983;\n --border-color: hsla(0, 0%, 100%, 0.2);\n --light-1: hsl(210, 30%, 40%);\n --light-2: hsl(255, 30%, 50%);\n --light-background: linear-gradient(to right, var(--light-1), var(--light-2));\n --shadow-1: hsla(236, 50%, 50%, 0.3);\n --shadow-2: hsla(236, 50%, 50%, 0.4);\n --hud-background: rgba(0, 0, 0, 0.4);\n --hud-text-color: var(--text-color);\n --notifications-bg: darkslateblue;\n --skills-text-background: rgba(0, 0, 0, 0.5);\n --skills-text-color: var(--text-color);\n --skills-level-background: rgba(0, 0, 0, 0.5);\n --skills-level-color: orange;\n --skills-xp-bar-height: 40px;\n --skill-check-name-color: orange;\n --skill-check-difficulty: orange;\n --skill-check-success: green;\n --skill-check-failed: red;\n --skill-check-color: orange;\n --dialog-choice-color: orange;\n --dialog-choice-hover-color: var(--text-color);\n}\n\n.list-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.list-enter-active,\r\n.list-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .list-move {\r\n transition: transform 0.3s ease;\r\n} */\n\n.list-enter-from,\r\n.list-leave-to {\n opacity: 0;\n transform: translateX(300px);\n}\n\n.notification-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.notification-enter-active,\r\n.notification-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .notification-move {\r\n transition: transform 0.3s ease;\r\n} */\n\n.notification-enter-from,\r\n.notification-leave-to {\n opacity: 0;\n transform: translateY(-300px);\n}\n\n.fade-enter-active,\r\n.fade-leave-active {\n transition: opacity 0.3s ease;\n}\n\n.fade-enter-from,\r\n.fade-leave-to {\n opacity: 0;\n}\n\n.fade-in-enter-active {\n transition: opacity 0.1s ease;\n}\n\n.fade-in-enter-from {\n opacity: 0;\n}\n\nbody {\n padding: 0;\n margin: 0;\n font-family: Arial, sans-serif;\n background-color: black;\n}\n\n.select {\n background: var(--light-background);\n padding: 10px;\n}\n\n.option {\n background-color: var(--light-2);\n padding: 5px;\n color: var(--text-color);\n}\n\n.button {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.button:focus,\r\n.button:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\n.input {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.input:focus,\r\n.input:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\na {\n color: pink;\n text-decoration: underline;\n}\n\nth,\r\ntd {\n padding: 4px;\n border: 1px solid var(--text-color);\n text-align: center;\n}\n\n#game-holder {\n width: 100vw;\n height: 100vh;\n padding: 0;\n margin: 0;\n top: 0;\n left: 0;\n background-color: black;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: -webkit-fill-available;\n}\n\n.title {\n font-size: 30px;\n font-weight: 700;\n text-align: center;\n}\n\n.container {\n padding: 20px;\n}\n\nh1,\r\nh2,\r\nh3,\r\nh4 {\n font-weight: 700;\n}\n\nh1 {\n font-size: 30px;\n}\n\nh2 {\n font-size: 26px;\n}\n\nh3 {\n font-size: 24px;\n}\n\nhr.solid {\n border: 1px solid var(--text-color);\n margin-top: 30px;\n margin-bottom: 30px;\n}\n\n.card-1 {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.card-1:hover {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-2 {\n box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-3 {\n box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-4 {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-5 {\n box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22);\n}\n\n.dialog-choice {\n transition: 0.2s;\n}\n\n.dialog-choice:hover {\n transform: scale(1.05, 1.05);\n transform-origin: center;\n}\n\n/* Somewhat arcane CSS to force the hover color to override the child style.\r\nOtherwise hovering choices doesn't change the color of skill check prompts. */\n\n.dialog-choice:not(:hover) > .skill-check-name,\r\n.passive-skill-check > .skill-check-name {\n color: var(--skill-check-name-color);\n}\n\n.dialog-choice:not(:hover) > .skill-check-difficulty,\r\n.passive-skill-check > .skill-check-difficulty {\n color: var(--skill-check-difficulty);\n}\n\n.skill-check-difficulty {\n font-weight: 700;\n}\n\n.dialog-choice:not(:hover) > .skill-check-success,\r\n.passive-skill-check > .skill-check-success {\n color: var(--skill-check-success);\n}\n\n.dialog-choice:not(:hover) > .skill-check-failed,\r\n.passive-skill-check > .skill-check-failed {\n color: var(--skill-check-failed);\n}\n\n.dialog-choice:not(:hover) > .skill-check,\r\n.passive-skill-check.skill-check {\n color: var(--skill-check-color);\n}\n\n.narrat-canvas {\n position: absolute;\n height: 100%;\n top: 0;\n left: 0;\n}\n\n/* Looks ugly */\n\n/* @keyframes strike-anim {\r\n 0% {\r\n width: 0;\r\n }\r\n 100% {\r\n width: 100%;\r\n }\r\n}\r\n.strike-anim {\r\n position: relative;\r\n}\r\n.strike-anim::after {\r\n content: ' ';\r\n position: absolute;\r\n top: 50%;\r\n left: 0;\r\n width: 100%;\r\n height: 1px;\r\n background: var(--text-color);\r\n animation-name: strike-anim;\r\n animation-duration: 0.5s;\r\n animation-timing-function: linear;\r\n animation-iteration-count: 1;\r\n animation-fill-mode: forwards;\r\n} */\n\n#touchTrigger {\n pointer-events: none;\n}\n\n@media (min-width: 640px) {\n}\n\n@media (min-width: 768px) {\n}\n\n@media (min-width: 1024px) {\n}\n\n@media (min-width: 1280px) {\n}\n\n@media (min-width: 1536px) {\n}\r\n";
38
38
  styleInject(css_248z);
39
39
 
40
40
  const f=vue.ref([]),v=vue.ref(null),m=vue.ref(null),g=vue.ref(null),h=vue.reactive({current:""}),y=[],b=vue.ref(!1),k=vue.readonly(f),w=vue.readonly(v),M=vue.readonly(m),q=vue.readonly(g),x=vue.readonly(h),$=(e=w.value)=>{h.current=e;const t=k.value.findIndex((t=>t.name===e)),n=k.value.map((e=>e.name));for(let a=0;a<n.length;a++){if(a>0&&a<n.length-1){const e=n[a]+"Minus",r=n[a]+"Plus";h[e]=t<=a,h[r]=t>=a;}h[n[a]]=n[a]===e;}},V=(e=M.value)=>{h.orientation=e,h.isLandscape="landscape"===e,h.isPortrait="portrait"===e;},O=(e=q.value||"light")=>{h.theme=e,h.isDark="dark"===e,h.isLight="light"===e;};function j(e,t){if("undefined"==typeof window||!window.matchMedia)return !1;if("undefined"!=typeof window&&!window.matchMedia)return console.error("Vue3 Mq: No MatchMedia support detected in this browser. Responsive breakpoints not available."),!1;{b.value=!0;const n=window.matchMedia(e),a=({matches:e})=>{e&&t();};y.push({mql:n,cb:a});n.addEventListener&&"function"==typeof n.addEventListener?n.addEventListener("change",a):n.addListener(a),a(n);}}var L=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",bootstrap5:{xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},bootstrap4:{xs:0,sm:576,md:768,lg:992,xl:1200},bootstrap3:{xs:0,sm:768,md:992,lg:1200},vuetify:{xs:0,sm:600,md:960,lg:1264,xl:1904},tailwind:{xs:0,sm:640,md:768,lg:1024,xl:1280,xxl:1536},devices:{phone:0,tablet:768,laptop:1370,desktop:1906}});const T=e=>{if(!e||"object"!=typeof e)return !1;const t=[];for(let n in e){const a=parseFloat(e[n]);n&&"string"==typeof n?/^[^a-z]/i.test(n)||/[^a-zA-Z0-9_]/.test(n)?console.warn(`Vue3 Mq: "${n}" is an invalid breakpoint key. Breakpoint keys must start with a letter and contain only alphanumeric characters and underscores. Skipping.`):!a&&0!==a||isNaN(a)||a<0?console.warn(`Vue3 Mq: "${n}: ${e[n]}" is not a valid breakpoint. Breakpoints should be a number of zero or above. Skipping.`):t.push({name:n,min:a}):console.warn(`Vue3 Mq: Invalid or missing breakpoint key (${JSON.stringify(n)}). Skipping.`);}t.some((e=>0===e.min))||console.warn("Vue3 Mq: You have not declared a breakpoint with a minimum value of 0. There may be screen sizes to which Vue3Mq does not respond.");return new Set(t.map((e=>e.min))).size<t.length&&console.warn("Vue3 Mq: Your breakpoint configuration contains duplicate values. Behaviour may be unpredictable."),0!==t.length&&t.sort(((e,t)=>e.min-t.min))};function R({breakpoints:e,preset:t}){const n=(e=>{if("string"==typeof e&&L[e])return L[e];{const t=Object.keys(L);return console.error(`Vue3 Mq: "${e}" is not a valid preset. Available options are: ${t.join(", ")}`),!1}})(t),a=T(e);if(!1===n&&!a)throw new TypeError("Vue3 Mq: You must provide a valid preset, or valid breakpoint settings.");var r;r=a||T(n),f.value=r,function(){for(;y.length>0;){const e=y.shift();if(e&&"object"==typeof e){const{mql:t,cb:n}=e;t.addEventListener&&"function"==typeof t.addEventListener?t.removeEventListener("change",n):t.removeListener(n);}}}(),(()=>{const e=Object.keys(h);for(let t of e)delete h[t];$(),V(),O();})();const o=k.value.reduce(((e,t,n,a)=>{const r=`(min-width: ${t.min}px)`,o=n<a.length-1?`(max-width: ${a[n+1].min-1}px)`:null,i=r+(o?" and "+o:"");return Object.assign(e,{[t.name]:i})}),{});for(const i in o){j(o[i],(()=>{$(i);}));}["portrait","landscape"].forEach((e=>{j(`(orientation: ${e})`,(()=>{V(e);}));})),["light","dark"].forEach((e=>{j(`(prefers-color-scheme: ${e})`,(()=>{O(e);}));}));}var N={install:(e,{preset:t="bootstrap5",breakpoints:n,defaultBreakpoint:a,defaultOrientation:r="landscape",defaultTheme:o}={})=>{try{const l=!1===["landscape","portrait"].includes(s=r)?(console.error(`Vue3 Mq: "${s}" is not a valid default orientation. Reverting to unset value.`),null):s,u=((e=null)=>!1===["dark","light"].includes(e)&&null!==e?(console.error(`Vue3 Mq: "${e}" is not a valid default theme. Reverting to unset value.`),null):e)(o);i=a,v.value=i,(e=>{m.value=e;})(l),(e=>{g.value=e;})(u),e.provide("mq",x),e.provide("updateBreakpoints",R),R({breakpoints:n,preset:t});}catch(l){console.error(l);}var i,s;}};
@@ -162,7 +162,10 @@ var script = vue.defineComponent({
162
162
  return undefined;
163
163
  },
164
164
  canInteract() {
165
- return this.active && !this.passed && this.options.interactive;
165
+ return (this.active &&
166
+ !this.passed &&
167
+ this.options.interactive &&
168
+ !this.$store.state.paused);
166
169
  },
167
170
  },
168
171
  methods: {
@@ -248,7 +251,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
248
251
  ], 4))
249
252
  }
250
253
 
251
- var css_248z$1 = ".dialog-title {\n font-size: 20px;\n font-weight: bold;\n}\n\n.dialog-text {\n font-size: 16px;\n}\n\n.dialog-box {\n /* border-radius: 10px; */\n /* border: 1px solid #a8a8a8; */\n color: var(--text-color);\n /* background-color: #2e2e2e; */\n padding: 10px;\n padding-left: 2em;\n margin-bottom: 10px;\n}\n\n.dialog-choice {\n color: var(--dialog-choice-color);\n}\n\n.dialog-choice:hover {\n color: var(--dialog-choice-hover-color);\n cursor: pointer;\n}\n\n.buttons-container {\n width: 100%;\n padding: 10px;\n display: flex;\n justify-content: space-evenly;\n align-items: stretch;\n box-sizing: border-box;\n}\n\n.interact-button {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n height: 50px;\n color: var(--text-color);\n border: 1px solid black;\n font-weight: bold;\n font-size: 24px;\n text-align: center;\n flex-grow: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.interact-button:not(:last-child) {\n margin-right: 10px;\n}\n";
254
+ var css_248z$1 = ".dialog-title {\n font-size: 20px;\n font-weight: bold;\n}\n\n.dialog-text {\n font-size: 16px;\n}\n\n.dialog-box {\n /* border-radius: 10px; */\n /* border: 1px solid #a8a8a8; */\n color: var(--text-color);\n /* background-color: #2e2e2e; */\n padding: 10px;\n padding-left: 2em;\n margin-bottom: 10px;\n}\n\n.dialog-choice {\n color: var(--dialog-choice-color);\n}\n\n.dialog-choice:hover {\n color: var(--dialog-choice-hover-color);\n cursor: pointer;\n}\n\n.buttons-container {\n width: 100%;\n padding: 10px;\n display: flex;\n justify-content: space-evenly;\n align-items: stretch;\n box-sizing: border-box;\n}\n\n.interact-button {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n height: 50px;\n color: var(--text-color);\n border: 1px solid black;\n font-weight: bold;\n font-size: 24px;\n text-align: center;\n flex-grow: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.interact-button:not(:last-child) {\n margin-right: 10px;\n}\r\n";
252
255
  styleInject(css_248z$1);
253
256
 
254
257
  script.render = render;
@@ -381,7 +384,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
381
384
  ], 4))
382
385
  }
383
386
 
384
- var css_248z$2 = ".dialog-picture {\n position: absolute;\n width: 80px;\n height: 80px;\n border: 2px solid white;\n border-radius: 10px;\n background-color: grey;\n z-index: 99;\n}\n\n.dialog-picture img {\n width: 100%;\n height: 100%;\n}\n";
387
+ var css_248z$2 = ".dialog-picture {\n position: absolute;\n width: 80px;\n height: 80px;\n border: 2px solid white;\n border-radius: 10px;\n background-color: grey;\n z-index: 99;\n}\n\n.dialog-picture img {\n width: 100%;\n height: 100%;\n}\r\n";
385
388
  styleInject(css_248z$2);
386
389
 
387
390
  script$1.render = render$1;
@@ -470,7 +473,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
470
473
  }))
471
474
  }
472
475
 
473
- var css_248z$3 = ".modal-mask {\n position: absolute;\n z-index: 9998;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n transition: opacity 0.3s ease;\n display: flex;\n flex-direction: column;\n flex-shrink: 2 2;\n align-items: center;\n justify-content: center;\n}\n\n.modal-container {\n min-width: 300px;\n max-width: 90vw;\n max-height: 100%;\n overflow-y: hidden;\n margin: 10px auto;\n padding: 20px 30px;\n border-radius: 5px;\n transition: all 0.3s ease;\n font-family: Helvetica, Arial, sans-serif;\n background: linear-gradient(to right, hsl(210, 30%, 20%), hsl(255, 30%, 25%));\n display: flex;\n flex-direction: column;\n}\n\n.modal-header {\n position: relative;\n}\n\n.modal-header h3 {\n flex-shrink: 0;\n margin-top: 0;\n color: var(--secondary);\n}\n\n.modal-body {\n margin: 20px 0;\n overflow-y: auto;\n flex-shrink: 2;\n}\n\n.modal-default-button {\n float: right;\n}\n\n/*\n * The following styles are auto-applied to elements with\n * transition=\"modal\" when their visibility is toggled\n * by Vue.js.\n *\n * You can easily play with the modal transition by editing\n * these styles.\n */\n\n.modal-enter {\n opacity: 0;\n}\n\n.modal-leave-active {\n opacity: 0;\n}\n\n.modal-enter .modal-container,\n.modal-leave-active .modal-container {\n transform: scale(1.1);\n}\n\n.close-button {\n border: 1px solid var(--text-color);\n border-radius: 50px;\n font-size: 30px;\n font-weight: 700;\n position: absolute;\n right: -20px;\n top: -10px;\n width: 50px;\n height: 50px;\n}\n\n.close-button:hover {\n background-color: var(--focus);\n}\n";
476
+ var css_248z$3 = ".modal-mask {\n position: absolute;\n z-index: 9998;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n transition: opacity 0.3s ease;\n display: flex;\n flex-direction: column;\n flex-shrink: 2 2;\n align-items: center;\n justify-content: center;\n}\n\n.modal-container {\n min-width: 300px;\n max-width: 90vw;\n max-height: 100%;\n overflow-y: hidden;\n margin: 10px auto;\n padding: 20px 30px;\n border-radius: 5px;\n transition: all 0.3s ease;\n font-family: Helvetica, Arial, sans-serif;\n background: linear-gradient(to right, hsl(210, 30%, 20%), hsl(255, 30%, 25%));\n display: flex;\n flex-direction: column;\n}\n\n.modal-header {\n position: relative;\n}\n\n.modal-header h3 {\n flex-shrink: 0;\n margin-top: 0;\n color: var(--secondary);\n}\n\n.modal-body {\n margin: 20px 0;\n overflow-y: auto;\n flex-shrink: 2;\n}\n\n.modal-default-button {\n float: right;\n}\n\n/*\r\n * The following styles are auto-applied to elements with\r\n * transition=\"modal\" when their visibility is toggled\r\n * by Vue.js.\r\n *\r\n * You can easily play with the modal transition by editing\r\n * these styles.\r\n */\n\n.modal-enter {\n opacity: 0;\n}\n\n.modal-leave-active {\n opacity: 0;\n}\n\n.modal-enter .modal-container,\r\n.modal-leave-active .modal-container {\n transform: scale(1.1);\n}\n\n.close-button {\n border: 1px solid var(--text-color);\n border-radius: 50px;\n font-size: 30px;\n font-weight: 700;\n position: absolute;\n right: -20px;\n top: -10px;\n width: 50px;\n height: 50px;\n}\n\n.close-button:hover {\n background-color: var(--focus);\n}\r\n";
474
477
  styleInject(css_248z$3);
475
478
 
476
479
  script$2.render = render$2;
@@ -2713,7 +2716,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2713
2716
  ]))
2714
2717
  }
2715
2718
 
2716
- var css_248z$4 = ".debug-menu {\n z-index: 9999;\n}\n\n.debug-button {\n position: fixed;\n bottom: 10px;\n right: 10px;\n padding: 5px;\n}\n\n.error-message {\n color: orangered;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n\n.error-filename {\n color: grey;\n text-decoration: underline;\n}\n\n.debug-menu-container {\n width: 100%;\n}\n\n.search-result {\n border: 1px solid var(--text-color);\n padding: 10px;\n font-weight: 700;\n font-size: 20px;\n width: 100;\n}\n\n.jump-menu-container {\n width: 80%;\n}\n\n.debug-info {\n position: fixed;\n background-color: rgba(0, 0, 0, 0.6);\n border: 1px dotted var(--text-color);\n top: 0;\n left: 0;\n padding: 5px;\n}\n\n.variables-viewer {\n height: 100%;\n}\n";
2719
+ var css_248z$4 = ".debug-menu {\n z-index: 9999;\n}\n\n.debug-button {\n position: fixed;\n bottom: 10px;\n right: 10px;\n padding: 5px;\n}\n\n.error-message {\n color: orangered;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n\n.error-filename {\n color: grey;\n text-decoration: underline;\n}\n\n.debug-menu-container {\n width: 100%;\n}\n\n.search-result {\n border: 1px solid var(--text-color);\n padding: 10px;\n font-weight: 700;\n font-size: 20px;\n width: 100;\n}\n\n.jump-menu-container {\n width: 80%;\n}\n\n.debug-info {\n position: fixed;\n background-color: rgba(0, 0, 0, 0.6);\n border: 1px dotted var(--text-color);\n top: 0;\n left: 0;\n padding: 5px;\n}\n\n.variables-viewer {\n height: 100%;\n}\r\n";
2717
2720
  styleInject(css_248z$4);
2718
2721
 
2719
2722
  script$3.render = render$3;
@@ -6017,7 +6020,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
6017
6020
  ]))
6018
6021
  }
6019
6022
 
6020
- var css_248z$5 = ".volume-label {\n /* margin: 5px 20px; */\n margin-right: 10px;\n font-size: 20px;\n font-weight: 700;\n}\n\n.volume-controls {\n font-size: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 20px;\n}\n\n.volume-slider {\n width: 200px;\n background-color: blue;\n}\n";
6023
+ var css_248z$5 = ".volume-label {\n /* margin: 5px 20px; */\n margin-right: 10px;\n font-size: 20px;\n font-weight: 700;\n}\n\n.volume-controls {\n font-size: 25px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 20px;\n}\n\n.volume-slider {\n width: 200px;\n background-color: blue;\n}\r\n";
6021
6024
  styleInject(css_248z$5);
6022
6025
 
6023
6026
  script$4.render = render$4;
@@ -6073,7 +6076,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
6073
6076
  ], 4))
6074
6077
  }
6075
6078
 
6076
- var css_248z$6 = ".hud {\n position: absolute;\n right: 0;\n top: 0;\n display: flex;\n flex-direction: row-reverse;\n z-index: 3;\n}\n\n.hud-stat {\n border: 1px dotted white;\n background-color: var(--hud-background);\n color: var(--hud-text-color);\n padding: 5px;\n}\n\n.hud-icon {\n display: inline-block;\n height: 1em;\n}\n\n.hud-text {\n margin-left: 5px;\n}\n";
6079
+ var css_248z$6 = ".hud {\n position: absolute;\n right: 0;\n top: 0;\n display: flex;\n flex-direction: row-reverse;\n z-index: 3;\n}\n\n.hud-stat {\n border: 1px dotted white;\n background-color: var(--hud-background);\n color: var(--hud-text-color);\n padding: 5px;\n}\n\n.hud-icon {\n display: inline-block;\n height: 1em;\n}\n\n.hud-text {\n margin-left: 5px;\n}\r\n";
6077
6080
  styleInject(css_248z$6);
6078
6081
 
6079
6082
  script$5.render = render$5;
@@ -6110,7 +6113,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
6110
6113
  ]))
6111
6114
  }
6112
6115
 
6113
- var css_248z$7 = "#loading-bar {\n position: relative;\n width: 40vw;\n height: 100px;\n border-radius: 50px;\n background: black;\n}\n\n#inner-loading-bar {\n height: 100%;\n border-radius: 50px 0px 0px 50px;\n background: var(--light-background);\n}\n\n#loading-text {\n z-index: 99999;\n display: flex;\n align-items: center;\n justify-content: space-around;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n}\n";
6116
+ var css_248z$7 = "#loading-bar {\n position: relative;\n width: 40vw;\n height: 100px;\n border-radius: 50px;\n background: black;\n}\n\n#inner-loading-bar {\n height: 100%;\n border-radius: 50px 0px 0px 50px;\n background: var(--light-background);\n}\n\n#loading-text {\n z-index: 99999;\n display: flex;\n align-items: center;\n justify-content: space-around;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n}\r\n";
6114
6117
  styleInject(css_248z$7);
6115
6118
 
6116
6119
  script$6.render = render$6;
@@ -6145,7 +6148,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
6145
6148
  }))
6146
6149
  }
6147
6150
 
6148
- var css_248z$8 = ".notifications-holder {\n position: fixed;\n top: 0;\n left: 0;\n padding: 10px;\n display: flex;\n flex-direction: column-reverse;\n align-items: center;\n pointer-events: none;\n}\n\n.notification {\n margin-top: 10px;\n margin-bottom: 10px;\n border-radius: 10px;\n padding: 15px;\n background: var(--notifications-bg);\n width: 40vh;\n text-align: center;\n}\n";
6151
+ var css_248z$8 = ".notifications-holder {\n position: fixed;\n top: 0;\n left: 0;\n padding: 10px;\n display: flex;\n flex-direction: column-reverse;\n align-items: center;\n pointer-events: none;\n}\n\n.notification {\n margin-top: 10px;\n margin-bottom: 10px;\n border-radius: 10px;\n padding: 15px;\n background: var(--notifications-bg);\n width: 40vh;\n text-align: center;\n}\r\n";
6149
6152
  styleInject(css_248z$8);
6150
6153
 
6151
6154
  script$7.render = render$7;
@@ -6427,107 +6430,424 @@ function debounce(func, waitMilliseconds = 50, options = {}) {
6427
6430
  return debouncedFunction;
6428
6431
  }
6429
6432
 
6430
- var script$8 = vue.defineComponent({
6431
- components: {},
6432
- props: {},
6433
- data() {
6434
- return {
6435
- activeMenu: false,
6436
- };
6437
- },
6438
- mounted() {
6439
- document.addEventListener('keydown', (event) => {
6440
- const key = event.key;
6441
- if (key === 'Escape') {
6442
- this.toggleMenu();
6443
- }
6433
+ function createSkillCheckState() {
6434
+ const skillCheck = {
6435
+ passed: false,
6436
+ available: true,
6437
+ };
6438
+ return skillCheck;
6439
+ }
6440
+ function getSkillCheckState(ctx, skillCheckId) {
6441
+ let skillCheck = ctx.state.skillChecks[skillCheckId];
6442
+ if (!skillCheck) {
6443
+ skillCheck = createSkillCheckState();
6444
+ ctx.commit('setupSkillCheck', {
6445
+ skillCheck,
6446
+ skillCheckId,
6444
6447
  });
6445
- },
6446
- methods: {
6447
- openMenu() {
6448
- this.$store.commit('openModal', 'menu');
6449
- },
6450
- openSkills() {
6451
- this.$store.commit('openModal', 'skills');
6452
- },
6453
- closeMenu() {
6454
- this.$store.commit('closeModal');
6455
- },
6456
- toggleMenu() {
6457
- this.$store.commit('toggleMenu');
6458
- },
6459
- },
6460
- computed: {
6461
- showSkills() {
6462
- if (Object.entries(getConfig().skills).length > 0) {
6463
- return true;
6448
+ }
6449
+ return skillCheck;
6450
+ }
6451
+ function getSkillCheckDifficultyScore(value, level) {
6452
+ return value - level * getConfig().skillChecks.skillMultiplier;
6453
+ }
6454
+ function getSkillCheckDifficultyText(value, level) {
6455
+ const difficultyScore = getSkillCheckDifficultyScore(value, level);
6456
+ const checks = getConfig().skillChecks;
6457
+ let found = false;
6458
+ let i = 0;
6459
+ let checkText = checks.difficultyText[0][1];
6460
+ while (!found) {
6461
+ if (checks.difficultyText.length > i) {
6462
+ if (difficultyScore >= checks.difficultyText[i][0]) {
6463
+ checkText = checks.difficultyText[i][1];
6464
6464
  }
6465
- return false;
6466
- },
6467
- },
6468
- });
6469
-
6470
- const _hoisted_1$7 = { class: "menu-container" };
6471
-
6472
- function render$8(_ctx, _cache, $props, $setup, $data, $options) {
6473
- return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
6474
- vue.createElementVNode("button", {
6475
- class: "button menu-toggle-button",
6476
- id: "menu-button",
6477
- onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.openMenu && _ctx.openMenu(...args)))
6478
- }, " Menu "),
6479
- (_ctx.showSkills)
6480
- ? (vue.openBlock(), vue.createElementBlock("button", {
6481
- key: 0,
6482
- class: "button menu-toggle-button",
6483
- id: "skills-menu-button",
6484
- onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.openSkills && _ctx.openSkills(...args)))
6485
- }, " Skills "))
6486
- : vue.createCommentVNode("", true)
6487
- ]))
6465
+ else {
6466
+ found = true;
6467
+ }
6468
+ }
6469
+ else {
6470
+ found = true;
6471
+ }
6472
+ i++;
6473
+ }
6474
+ return checkText;
6475
+ }
6476
+ function getSkillCheckText({ context, skill, skillCheckId, value, }) {
6477
+ const skillCheckState = getSkillCheckState(context, skillCheckId);
6478
+ const skillConfig = getSkillConfig(context.commit, skill);
6479
+ const level = context.state.skills[skill].level;
6480
+ const difficultyText = getSkillCheckDifficultyText(value, level);
6481
+ let allowed = true;
6482
+ let text = `<span class='skill-check'>[<span class='skill-check-name'>${skillConfig.name}</span> - `;
6483
+ if (skillCheckState.available) {
6484
+ text += ` <span class='skill-check-difficulty'>${difficultyText}</span>]</span>`;
6485
+ }
6486
+ else if (skillCheckState.passed) {
6487
+ text = '';
6488
+ }
6489
+ else {
6490
+ allowed = false;
6491
+ text += ` <span class='skill-check-difficulty'>${difficultyText}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`;
6492
+ }
6493
+ return {
6494
+ difficultyText: text,
6495
+ allowed,
6496
+ };
6497
+ }
6498
+ function getPassiveSkillCheckText(ctx, success, params) {
6499
+ const skillConf = getSkillConfig(ctx.commit, params.skill);
6500
+ const difficultyText = getSkillCheckDifficultyText(params.value, ctx.state.skills[params.skill].level);
6501
+ return `<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${skillConf.name}</span> - <span class='skill-check-difficulty'>${difficultyText}</span> - ${success
6502
+ ? '<span class="skill-check-success">Success</span>'
6503
+ : '<span class="skill-check-failed">Failure</span>'}]</span>`;
6504
+ }
6505
+ function calculateSkillCheckRoll(state, skill) {
6506
+ const { skillChecks } = getConfig();
6507
+ const unmodifiedRoll = Math.floor(Math.random() * skillChecks.rollRange);
6508
+ const rollModifier = state.skills[skill].level * skillChecks.skillMultiplier;
6509
+ const roll = unmodifiedRoll + rollModifier;
6510
+ logger.log(`[SKILL CHECK] Roll: ${roll}. (Base roll: ${unmodifiedRoll}, modifier: ${rollModifier} - Skill level: ${state.skills[skill].level})`);
6511
+ return {
6512
+ roll,
6513
+ unmodifiedRoll,
6514
+ };
6515
+ }
6516
+ function resolveSkillCheck(state, params) {
6517
+ const { skills, skillChecks } = getConfig();
6518
+ let success = true;
6519
+ const { roll } = calculateSkillCheckRoll(state, params.skill);
6520
+ if (roll <= skillChecks.failureChance - 1) {
6521
+ success = false;
6522
+ }
6523
+ const skill = skills[params.skill];
6524
+ if (roll < params.value) {
6525
+ success = false;
6526
+ }
6527
+ logger.log(`[SKILL CHECK ${skill.name}]: ${success ? '✅' : '❌'}`, `(${params.id}) - ${roll}/${params.value}`);
6528
+ return success;
6488
6529
  }
6489
6530
 
6490
- var css_248z$9 = ".menu-content {\n text-align: center;\n}\n\n.menu-toggle-button {\n margin: 0;\n padding: 2px;\n border-radius: 5px;\n}\n\n.menu-toggle-button:not(:last-child) {\n margin-right: 10px;\n}\n\n.menu-modal {\n width: 500px;\n}\n";
6491
- styleInject(css_248z$9);
6492
-
6493
- script$8.render = render$8;
6494
-
6495
- var script$9 = vue.defineComponent({
6496
- components: {
6497
- Modal: script$2,
6498
- VolumeControls: script$4,
6499
- },
6500
- props: {},
6501
- data() { },
6502
- mounted() { },
6503
- methods: {
6504
- quit() {
6505
- window.close();
6506
- // quit
6507
- },
6508
- close() {
6509
- this.$emit('close');
6510
- },
6511
- mainMenu() {
6512
- this.$store.dispatch('menuReturn');
6513
- this.$store.commit('setFlowState', 'menu');
6514
- this.close();
6515
- },
6516
- getPlayTimeString() {
6517
- const time = getPlayTime(this.$store.state.playTime.start, this.$store.state.playTime.previousPlaytime);
6518
- return toHHMMSS(time / 1000);
6531
+ function processSkillCheck(ctx, skillcheck) {
6532
+ return runSkillCheck(ctx, {
6533
+ skill: skillcheck.skill,
6534
+ value: skillcheck.value,
6535
+ id: skillcheck.id,
6536
+ success: skillcheck.success.text,
6537
+ failure: skillcheck.failure.text,
6538
+ });
6539
+ }
6540
+ function runSkillCheck(ctx, params) {
6541
+ const { state } = ctx;
6542
+ const success = resolveSkillCheck(state, params);
6543
+ writeText(ctx, getPassiveSkillCheckText(ctx, success, params));
6544
+ if (success) {
6545
+ ctx.commit('passSkillCheck', params.id);
6546
+ return true;
6547
+ }
6548
+ ctx.commit('failSkillCheck', params.id);
6549
+ return false;
6550
+ }
6551
+ function runConditionCommand(ctx, command) {
6552
+ const options = command.options;
6553
+ const result = runCondition(ctx, options.condition);
6554
+ logger.log(result);
6555
+ if (result) {
6556
+ return options.success;
6557
+ }
6558
+ if (!result && options.failure) {
6559
+ return options.failure;
6560
+ }
6561
+ return undefined;
6562
+ }
6563
+ function writeText(ctx, text) {
6564
+ const dialog = {
6565
+ speaker: 'game',
6566
+ text,
6567
+ interactive: false,
6568
+ };
6569
+ ctx.commit('addDialog', {
6570
+ dialog,
6571
+ });
6572
+ }
6573
+ function runCondition(ctx, condition) {
6574
+ return conditionFunction(ctx, condition);
6575
+ }
6576
+ function conditionFunction(ctx, condition) {
6577
+ const { state } = ctx;
6578
+ const context = {
6579
+ data: state.machine.data,
6580
+ skills: state.skills,
6581
+ skillChecks: state.skillChecks,
6582
+ stats: state.hudStats,
6583
+ roll: (checkId, skill, value) => {
6584
+ const skillCheckState = getSkillCheckState(ctx, checkId);
6585
+ if (skillCheckState) {
6586
+ if (skillCheckState.passed) {
6587
+ return true;
6588
+ }
6589
+ if (!skillCheckState.available) {
6590
+ return false;
6591
+ }
6592
+ }
6593
+ return runSkillCheck(ctx, {
6594
+ skill,
6595
+ value,
6596
+ id: checkId,
6597
+ });
6519
6598
  },
6520
- },
6521
- computed: {},
6522
- });
6523
-
6524
- const _hoisted_1$8 = /*#__PURE__*/vue.createElementVNode("h3", { class: "title" }, "Menu", -1);
6525
- const _hoisted_2$6 = { class: "menu-content" };
6526
-
6527
- function render$9(_ctx, _cache, $props, $setup, $data, $options) {
6528
- const _component_VolumeControls = vue.resolveComponent("VolumeControls");
6529
- const _component_modal = vue.resolveComponent("modal");
6530
-
6599
+ };
6600
+ return evalInContext(`(${condition})`, context);
6601
+ }
6602
+ function evalInContext(script, context) {
6603
+ // # Return the results of the in-line anonymous function we .call with the passed context
6604
+ return function () {
6605
+ return eval(script);
6606
+ }.call(context);
6607
+ }
6608
+ async function textCommand(commit, dialog) {
6609
+ commit('addDialog', {
6610
+ dialog,
6611
+ });
6612
+ }
6613
+ function getLine(lines, index) {
6614
+ if (index < lines.length)
6615
+ return lines[index];
6616
+ }
6617
+
6618
+ async function runLine(context) {
6619
+ const cmd = context.getters.currentLine;
6620
+ await runCommand(context, cmd);
6621
+ }
6622
+ class VM$1 {
6623
+ plugins = [];
6624
+ commands = {};
6625
+ addCommand(command) {
6626
+ this.commands[command.keyword] = command;
6627
+ }
6628
+ addPlugin(plugin) {
6629
+ this.plugins.push(plugin);
6630
+ if (plugin.customCommands) {
6631
+ for (const command of plugin.customCommands) {
6632
+ this.addCommand(command);
6633
+ }
6634
+ }
6635
+ }
6636
+ callHook(hookName, ...args) {
6637
+ for (const plugin of this.plugins) {
6638
+ if (typeof plugin[hookName] === 'function') {
6639
+ plugin[hookName](...args);
6640
+ }
6641
+ }
6642
+ }
6643
+ }
6644
+ const vm$1 = new VM$1();
6645
+ async function runCommand(context, cmd, choices) {
6646
+ const { state, commit } = context;
6647
+ try {
6648
+ const commandPlugin = vm$1.commands[cmd.commandType];
6649
+ if (commandPlugin) {
6650
+ commandPlugin.runner(context, cmd, choices);
6651
+ }
6652
+ }
6653
+ catch (err) {
6654
+ logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
6655
+ console.error(err);
6656
+ error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
6657
+ <b>${err}</b>
6658
+ Script: ${cmd.code}
6659
+ Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
6660
+ }
6661
+ }
6662
+ async function playerAnswered(context, choiceIndex) {
6663
+ const { commit, dispatch } = context;
6664
+ const cmd = context.getters.currentLine;
6665
+ switch (cmd.commandType) {
6666
+ case 'choice':
6667
+ const options = cmd.options;
6668
+ const choice = options.choices[choiceIndex];
6669
+ let playerText = choice.choice;
6670
+ let newBranch;
6671
+ const skillcheck = choice.skillCheck;
6672
+ if (skillcheck) {
6673
+ const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
6674
+ if (skillCheckState.passed) {
6675
+ newBranch = skillcheck.success.branch;
6676
+ playerText = skillcheck.success.text;
6677
+ }
6678
+ else {
6679
+ const result = processSkillCheck(context, skillcheck);
6680
+ const winner = result ? skillcheck.success : skillcheck.failure;
6681
+ newBranch = winner.branch;
6682
+ playerText = undefined;
6683
+ }
6684
+ }
6685
+ else {
6686
+ newBranch = choice.branch;
6687
+ }
6688
+ if (playerText) {
6689
+ // If the choice involves printing a player dialog, show it
6690
+ const dialog = {
6691
+ speaker: 'player',
6692
+ text: playerText,
6693
+ interactive: false,
6694
+ };
6695
+ commit('addDialog', { dialog });
6696
+ }
6697
+ if (newBranch) {
6698
+ const newStack = {
6699
+ currentIndex: 0,
6700
+ branch: newBranch,
6701
+ };
6702
+ commit('addStack', newStack);
6703
+ dispatch('runLine');
6704
+ }
6705
+ else {
6706
+ dispatch('nextLine');
6707
+ }
6708
+ break;
6709
+ default:
6710
+ dispatch('nextLine');
6711
+ }
6712
+ }
6713
+ async function nextLine(ctx) {
6714
+ const { state, getters, dispatch, commit } = ctx;
6715
+ if (state.machine.stack.length === 0) {
6716
+ finishGame(ctx);
6717
+ return;
6718
+ }
6719
+ const machineHead = getters.machineHead;
6720
+ if (machineHead.currentIndex < machineHead.branch.length - 1) {
6721
+ commit('nextLine');
6722
+ }
6723
+ else {
6724
+ // This branch is finished, go back to previous stack
6725
+ commit('previousStack');
6726
+ return dispatch('nextLine');
6727
+ }
6728
+ if (state.machine.stack.length === 0) {
6729
+ finishGame(ctx);
6730
+ }
6731
+ else {
6732
+ return dispatch('runLine');
6733
+ }
6734
+ }
6735
+ function finishGame({ commit, state }) {
6736
+ if (state.options.debug) {
6737
+ commit('addDialog', {
6738
+ dialog: {
6739
+ speaker: 'game',
6740
+ text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
6741
+ },
6742
+ });
6743
+ }
6744
+ }
6745
+
6746
+ var script$8 = vue.defineComponent({
6747
+ components: {},
6748
+ props: {},
6749
+ data() {
6750
+ return {
6751
+ activeMenu: false,
6752
+ };
6753
+ },
6754
+ mounted() {
6755
+ document.addEventListener('keydown', (event) => {
6756
+ const key = event.key;
6757
+ if (key === 'Escape') {
6758
+ this.toggleMenu();
6759
+ }
6760
+ });
6761
+ vm$1.callHook('onGameMounted');
6762
+ },
6763
+ unmounted() {
6764
+ vm$1.callHook('onGameUnmounted');
6765
+ },
6766
+ methods: {
6767
+ openMenu() {
6768
+ this.$store.commit('openModal', 'menu');
6769
+ },
6770
+ openSkills() {
6771
+ this.$store.commit('openModal', 'skills');
6772
+ },
6773
+ closeMenu() {
6774
+ this.$store.commit('closeModal');
6775
+ },
6776
+ toggleMenu() {
6777
+ this.$store.commit('toggleMenu');
6778
+ },
6779
+ },
6780
+ computed: {
6781
+ showSkills() {
6782
+ if (Object.entries(getConfig().skills).length > 0) {
6783
+ return true;
6784
+ }
6785
+ return false;
6786
+ },
6787
+ },
6788
+ });
6789
+
6790
+ const _hoisted_1$7 = { class: "menu-container" };
6791
+
6792
+ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
6793
+ return (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
6794
+ vue.createElementVNode("button", {
6795
+ class: "button menu-toggle-button",
6796
+ id: "menu-button",
6797
+ onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.openMenu && _ctx.openMenu(...args)))
6798
+ }, " Menu "),
6799
+ (_ctx.showSkills)
6800
+ ? (vue.openBlock(), vue.createElementBlock("button", {
6801
+ key: 0,
6802
+ class: "button menu-toggle-button",
6803
+ id: "skills-menu-button",
6804
+ onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.openSkills && _ctx.openSkills(...args)))
6805
+ }, " Skills "))
6806
+ : vue.createCommentVNode("", true)
6807
+ ]))
6808
+ }
6809
+
6810
+ var css_248z$9 = ".menu-content {\n text-align: center;\n}\n\n.menu-toggle-button {\n margin: 0;\n padding: 2px;\n border-radius: 5px;\n}\n\n.menu-toggle-button:not(:last-child) {\n margin-right: 10px;\n}\n\n.menu-modal {\n width: 500px;\n}\r\n";
6811
+ styleInject(css_248z$9);
6812
+
6813
+ script$8.render = render$8;
6814
+
6815
+ var script$9 = vue.defineComponent({
6816
+ components: {
6817
+ Modal: script$2,
6818
+ VolumeControls: script$4,
6819
+ },
6820
+ props: {},
6821
+ data() { },
6822
+ mounted() { },
6823
+ methods: {
6824
+ quit() {
6825
+ window.close();
6826
+ // quit
6827
+ },
6828
+ close() {
6829
+ this.$emit('close');
6830
+ },
6831
+ mainMenu() {
6832
+ this.$store.dispatch('menuReturn');
6833
+ this.$store.commit('setFlowState', 'menu');
6834
+ this.close();
6835
+ },
6836
+ getPlayTimeString() {
6837
+ const time = getPlayTime(this.$store.state.playTime.start, this.$store.state.playTime.previousPlaytime);
6838
+ return toHHMMSS(time / 1000);
6839
+ },
6840
+ },
6841
+ computed: {},
6842
+ });
6843
+
6844
+ const _hoisted_1$8 = /*#__PURE__*/vue.createElementVNode("h3", { class: "title" }, "Menu", -1);
6845
+ const _hoisted_2$6 = { class: "menu-content" };
6846
+
6847
+ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
6848
+ const _component_VolumeControls = vue.resolveComponent("VolumeControls");
6849
+ const _component_modal = vue.resolveComponent("modal");
6850
+
6531
6851
  return (vue.openBlock(), vue.createBlock(_component_modal, {
6532
6852
  class: "menu",
6533
6853
  onClose: _ctx.close,
@@ -6554,7 +6874,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
6554
6874
  }, 8, ["onClose"]))
6555
6875
  }
6556
6876
 
6557
- var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\n";
6877
+ var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\r\n";
6558
6878
  styleInject(css_248z$a);
6559
6879
 
6560
6880
  script$9.render = render$9;
@@ -6697,7 +7017,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
6697
7017
  }, 8, ["onClose"]))
6698
7018
  }
6699
7019
 
6700
- var css_248z$b = ".skills-modal {\n width: 800px;\n}\n\n.skills-container {\n display: grid;\n grid-auto-rows: auto;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 20px 20px;\n}\n\n.skill-display {\n width: 200px;\n height: 300px;\n position: relative;\n background-size: cover;\n}\n\n.skill-title {\n position: absolute;\n bottom: 0px;\n text-align: center;\n width: 100%;\n color: var(--skills-text-color);\n background: var(--skills-text-background);\n}\n\n.skill-level {\n position: absolute;\n top: 0;\n right: 0;\n font-weight: 700;\n font-size: 25px;\n color: var(--skills-level-color);\n width: var(--skills-xp-bar-height);\n height: var(--skills-xp-bar-height);\n background-color: var(--skills-level-background);\n}\n\n.skill-description-container {\n justify-content: space-between;\n align-items: center;\n}\n\n.skill-left {\n flex-direction: column;\n}\n\n.skill-right {\n flex-direction: column;\n align-items: baseline;\n}\n\n.skill-xp-container {\n position: absolute;\n top: 0;\n left: 0;\n height: var(--skills-xp-bar-height);\n width: calc(100% - var(--skills-xp-bar-height));\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.skill-xp-bar {\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n background-color: rgba(0, 0, 250, 0.5);\n}\n\n.skill-xp-text {\n z-index: 2;\n}\n";
7020
+ var css_248z$b = ".skills-modal {\n width: 800px;\n}\n\n.skills-container {\n display: grid;\n grid-auto-rows: auto;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 20px 20px;\n}\n\n.skill-display {\n width: 200px;\n height: 300px;\n position: relative;\n background-size: cover;\n}\n\n.skill-title {\n position: absolute;\n bottom: 0px;\n text-align: center;\n width: 100%;\n color: var(--skills-text-color);\n background: var(--skills-text-background);\n}\n\n.skill-level {\n position: absolute;\n top: 0;\n right: 0;\n font-weight: 700;\n font-size: 25px;\n color: var(--skills-level-color);\n width: var(--skills-xp-bar-height);\n height: var(--skills-xp-bar-height);\n background-color: var(--skills-level-background);\n}\n\n.skill-description-container {\n justify-content: space-between;\n align-items: center;\n}\n\n.skill-left {\n flex-direction: column;\n}\n\n.skill-right {\n flex-direction: column;\n align-items: baseline;\n}\n\n.skill-xp-container {\n position: absolute;\n top: 0;\n left: 0;\n height: var(--skills-xp-bar-height);\n width: calc(100% - var(--skills-xp-bar-height));\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.skill-xp-bar {\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n background-color: rgba(0, 0, 250, 0.5);\n}\n\n.skill-xp-text {\n z-index: 2;\n}\r\n";
6701
7021
  styleInject(css_248z$b);
6702
7022
 
6703
7023
  script$a.render = render$a;
@@ -6733,6 +7053,7 @@ var script$b = vue.defineComponent({
6733
7053
  options: Object,
6734
7054
  },
6735
7055
  async mounted() {
7056
+ vm$1.callHook('onAppMounted');
6736
7057
  this.loadingStep = 'Characters';
6737
7058
  const charsFile = await getFile('data/characters.json');
6738
7059
  await setCharactersConfig(JSON.parse(charsFile));
@@ -6744,9 +7065,11 @@ var script$b = vue.defineComponent({
6744
7065
  this.loadingPercentage = 0.7;
6745
7066
  this.loadingStep = 'Audio';
6746
7067
  await loadAudioAssets(getConfig());
7068
+ vm$1.callHook('onAssetsLoaded');
6747
7069
  this.loadingPercentage = 0.95;
6748
7070
  this.loadingStep = 'Starting...';
6749
7071
  await this.setupMachine();
7072
+ vm$1.callHook('onGameSetup');
6750
7073
  this.loadingPercentage = 0.1;
6751
7074
  this.gameLoaded = true;
6752
7075
  const save = this.getSaveFile();
@@ -7074,769 +7397,85 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
7074
7397
  vue.createElementVNode("canvas", {
7075
7398
  width: _ctx.layoutWidth,
7076
7399
  height: _ctx.layoutHeight,
7077
- id: "background-canvas"
7078
- }, null, 8, _hoisted_1$a)
7079
- ], 4))
7080
- : vue.createCommentVNode("", true),
7081
- (_ctx.inGame)
7082
- ? (vue.openBlock(), vue.createElementBlock("div", {
7083
- key: 3,
7084
- class: "dialog override",
7085
- ref: "dialog",
7086
- style: vue.normalizeStyle(_ctx.dialogStyle)
7087
- }, [
7088
- vue.createVNode(vue.TransitionGroup, {
7089
- name: "list",
7090
- tag: "div",
7091
- class: "dialog-container w-full override",
7092
- style: vue.normalizeStyle(_ctx.dialogContainerStyle)
7093
- }, {
7094
- default: vue.withCtx(() => [
7095
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.dialog, (dialog, i) => {
7096
- return (vue.openBlock(), vue.createBlock(_component_DialogBox, {
7097
- key: dialog.id,
7098
- options: _ctx.getDialogBoxOptions(dialog, i),
7099
- active: _ctx.isDialogActive(i)
7100
- }, null, 8, ["options", "active"]))
7101
- }), 128))
7102
- ]),
7103
- _: 1
7104
- }, 8, ["style"]),
7105
- _hoisted_2$8
7106
- ], 4))
7107
- : vue.createCommentVNode("", true)
7108
- ], 4))
7109
- : (_ctx.gameLoaded)
7110
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
7111
- vue.createElementVNode("div", _hoisted_4$4, [
7112
- vue.createElementVNode("h1", _hoisted_5$4, vue.toDisplayString(_ctx.gameTitle), 1)
7113
- ]),
7114
- vue.createElementVNode("div", _hoisted_6$4, [
7115
- vue.createElementVNode("button", {
7116
- class: "button menu-button start-button override",
7117
- onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.startGame && _ctx.startGame(...args)))
7118
- }, " Start Game "),
7119
- (_ctx.hasSave)
7120
- ? (vue.openBlock(), vue.createElementBlock("button", {
7121
- key: 0,
7122
- class: "button menu-button continue-button override",
7123
- onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.loadGame && _ctx.loadGame(...args)))
7124
- }, " Continue Game "))
7125
- : vue.createCommentVNode("", true)
7126
- ])
7127
- ]))
7128
- : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
7129
- vue.createVNode(_component_LoadingBar, {
7130
- percentage: _ctx.loadingPercentage,
7131
- step: _ctx.loadingStep
7132
- }, null, 8, ["percentage", "step"])
7133
- ])),
7134
- (_ctx.options.debug)
7135
- ? (vue.openBlock(), vue.createBlock(_component_DebugMenu, { key: 4 }))
7136
- : vue.createCommentVNode("", true),
7137
- vue.createVNode(_component_NotificationToast)
7138
- ], 4))
7139
- }
7140
-
7141
- var css_248z$c = "#app {\n background-color: var(--bg-color);\n width: 100%;\n height: 100%;\n position: absolute;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n color: var(--text-color);\n box-sizing: border-box;\n overflow: hidden;\n transform-origin: center center;\n}\n\n.game {\n background-color: var(--bg-color);\n position: relative;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n.interact-button {\n height: 50px;\n border: 1px solid black;\n font-weight: bold;\n font-size: 20px;\n text-align: center;\n flex-grow: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.interact-button:not(:last-child) {\n margin-right: 10px;\n}\n\n.dialog-container {\n flex-shrink: 2;\n /* padding: 20px; */\n min-height: 100%;\n width: 100%;\n background-color: (var(--bg-color));\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: center;\n overflow-x: hidden;\n}\n\n.dialog {\n overflow-y: auto;\n overflow-x: hidden;\n position: relative;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n}\n\n.dialog::-webkit-scrollbar {\n display: none; /* webkit */\n}\n\n.dialog * {\n overflow-anchor: none;\n}\n\n.background {\n margin: 0;\n}\n\n#background-canvas {\n height: 100%;\n}\n\n.anchor {\n overflow-anchor: auto;\n height: 1px;\n}\n\n.menu-toggle {\n position: fixed;\n bottom: 0px;\n right: 15%;\n z-index: 2;\n}\n\n#game-title-container {\n margin-bottom: 50px;\n}\n\n#game-title-text {\n text-align: center;\n font-size: 50px;\n}\n\n.menu-button {\n font-size: 25px;\n}\n";
7142
- styleInject(css_248z$c);
7143
-
7144
- script$b.render = render$b;
7145
-
7146
- function createSkillCheckState() {
7147
- const skillCheck = {
7148
- passed: false,
7149
- available: true,
7150
- };
7151
- return skillCheck;
7152
- }
7153
- function getSkillCheckState(ctx, skillCheckId) {
7154
- let skillCheck = ctx.state.skillChecks[skillCheckId];
7155
- if (!skillCheck) {
7156
- skillCheck = createSkillCheckState();
7157
- ctx.commit('setupSkillCheck', {
7158
- skillCheck,
7159
- skillCheckId,
7160
- });
7161
- }
7162
- return skillCheck;
7163
- }
7164
- function getSkillCheckDifficultyScore(value, level) {
7165
- return value - level * getConfig().skillChecks.skillMultiplier;
7166
- }
7167
- function getSkillCheckDifficultyText(value, level) {
7168
- const difficultyScore = getSkillCheckDifficultyScore(value, level);
7169
- const checks = getConfig().skillChecks;
7170
- let found = false;
7171
- let i = 0;
7172
- let checkText = checks.difficultyText[0][1];
7173
- while (!found) {
7174
- if (checks.difficultyText.length > i) {
7175
- if (difficultyScore >= checks.difficultyText[i][0]) {
7176
- checkText = checks.difficultyText[i][1];
7177
- }
7178
- else {
7179
- found = true;
7180
- }
7181
- }
7182
- else {
7183
- found = true;
7184
- }
7185
- i++;
7186
- }
7187
- return checkText;
7188
- }
7189
- function getSkillCheckText({ context, skill, skillCheckId, value, }) {
7190
- const skillCheckState = getSkillCheckState(context, skillCheckId);
7191
- const skillConfig = getSkillConfig(context.commit, skill);
7192
- const level = context.state.skills[skill].level;
7193
- const difficultyText = getSkillCheckDifficultyText(value, level);
7194
- let allowed = true;
7195
- let text = `<span class='skill-check'>[<span class='skill-check-name'>${skillConfig.name}</span> - `;
7196
- if (skillCheckState.available) {
7197
- text += ` <span class='skill-check-difficulty'>${difficultyText}</span>]</span>`;
7198
- }
7199
- else if (skillCheckState.passed) {
7200
- text = '';
7201
- }
7202
- else {
7203
- allowed = false;
7204
- text += ` <span class='skill-check-difficulty'>${difficultyText}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`;
7205
- }
7206
- return {
7207
- difficultyText: text,
7208
- allowed,
7209
- };
7210
- }
7211
- function getPassiveSkillCheckText(ctx, success, params) {
7212
- const skillConf = getSkillConfig(ctx.commit, params.skill);
7213
- const difficultyText = getSkillCheckDifficultyText(params.value, ctx.state.skills[params.skill].level);
7214
- return `<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${skillConf.name}</span> - <span class='skill-check-difficulty'>${difficultyText}</span> - ${success
7215
- ? '<span class="skill-check-success">Success</span>'
7216
- : '<span class="skill-check-failed">Failure</span>'}]</span>`;
7217
- }
7218
- function calculateSkillCheckRoll(state, skill) {
7219
- const { skillChecks } = getConfig();
7220
- const unmodifiedRoll = Math.floor(Math.random() * skillChecks.rollRange);
7221
- const rollModifier = state.skills[skill].level * skillChecks.skillMultiplier;
7222
- const roll = unmodifiedRoll + rollModifier;
7223
- logger.log(`[SKILL CHECK] Roll: ${roll}. (Base roll: ${unmodifiedRoll}, modifier: ${rollModifier} - Skill level: ${state.skills[skill].level})`);
7224
- return {
7225
- roll,
7226
- unmodifiedRoll,
7227
- };
7228
- }
7229
- function resolveSkillCheck(state, params) {
7230
- const { skills, skillChecks } = getConfig();
7231
- let success = true;
7232
- const { roll } = calculateSkillCheckRoll(state, params.skill);
7233
- if (roll <= skillChecks.failureChance - 1) {
7234
- success = false;
7235
- }
7236
- const skill = skills[params.skill];
7237
- if (roll < params.value) {
7238
- success = false;
7239
- }
7240
- logger.log(`[SKILL CHECK ${skill.name}]: ${success ? '✅' : '❌'}`, `(${params.id}) - ${roll}/${params.value}`);
7241
- return success;
7242
- }
7243
-
7244
- function processSkillCheck(ctx, skillcheck) {
7245
- return runSkillCheck(ctx, {
7246
- skill: skillcheck.skill,
7247
- value: skillcheck.value,
7248
- id: skillcheck.id,
7249
- success: skillcheck.success.text,
7250
- failure: skillcheck.failure.text,
7251
- });
7252
- }
7253
- function runSkillCheck(ctx, params) {
7254
- const { state } = ctx;
7255
- const success = resolveSkillCheck(state, params);
7256
- writeText(ctx, getPassiveSkillCheckText(ctx, success, params));
7257
- if (success) {
7258
- ctx.commit('passSkillCheck', params.id);
7259
- return true;
7260
- }
7261
- ctx.commit('failSkillCheck', params.id);
7262
- return false;
7263
- }
7264
- function runConditionCommand(ctx, command) {
7265
- const options = command.options;
7266
- const result = runCondition(ctx, options.condition);
7267
- logger.log(result);
7268
- if (result) {
7269
- return options.success;
7270
- }
7271
- if (!result && options.failure) {
7272
- return options.failure;
7273
- }
7274
- return undefined;
7275
- }
7276
- function writeText(ctx, text) {
7277
- const dialog = {
7278
- speaker: 'game',
7279
- text,
7280
- interactive: false,
7281
- };
7282
- ctx.commit('addDialog', {
7283
- dialog,
7284
- });
7285
- }
7286
- function runCondition(ctx, condition) {
7287
- return conditionFunction(ctx, condition);
7288
- }
7289
- function conditionFunction(ctx, condition) {
7290
- const { state } = ctx;
7291
- const context = {
7292
- data: state.machine.data,
7293
- skills: state.skills,
7294
- skillChecks: state.skillChecks,
7295
- stats: state.hudStats,
7296
- roll: (checkId, skill, value) => {
7297
- const skillCheckState = getSkillCheckState(ctx, checkId);
7298
- if (skillCheckState) {
7299
- if (skillCheckState.passed) {
7300
- return true;
7301
- }
7302
- if (!skillCheckState.available) {
7303
- return false;
7304
- }
7305
- }
7306
- return runSkillCheck(ctx, {
7307
- skill,
7308
- value,
7309
- id: checkId,
7310
- });
7311
- },
7312
- };
7313
- return evalInContext(`(${condition})`, context);
7314
- }
7315
- function evalInContext(script, context) {
7316
- // # Return the results of the in-line anonymous function we .call with the passed context
7317
- return function () {
7318
- return eval(script);
7319
- }.call(context);
7320
- }
7321
-
7322
- async function runLine(context) {
7323
- const cmd = context.getters.currentLine;
7324
- await runCommand(context, cmd);
7325
- }
7326
- async function runCommand(context, cmd, choices) {
7327
- const { state, commit, dispatch } = context;
7328
- try {
7329
- switch (cmd.commandType) {
7330
- case 'jump':
7331
- const branch = cmd.args[0];
7332
- const newStack = {
7333
- branch: state.machine.script[branch],
7334
- label: branch,
7335
- currentIndex: 0,
7336
- };
7337
- commit('setStack', newStack);
7338
- await dispatch('saveGame');
7339
- await dispatch('runLine');
7340
- break;
7341
- case 'text':
7342
- await textCommand(commit, {
7343
- speaker: 'game',
7344
- text: cmd.options.text,
7345
- choices,
7346
- interactive: true,
7347
- });
7348
- break;
7349
- case 'set':
7350
- const key = cmd.args[0];
7351
- const value = cmd.args[1];
7352
- commit('setData', { path: key, value });
7353
- return dispatch('nextLine');
7354
- case 'add':
7355
- const addKey = cmd.args[0];
7356
- const addValue = cmd.args[1];
7357
- commit('addInstruction', { path: addKey, value: addValue });
7358
- return dispatch('nextLine');
7359
- case 'if':
7360
- const newBranch = runConditionCommand(context, cmd);
7361
- if (newBranch) {
7362
- const newStack = {
7363
- branch: newBranch,
7364
- currentIndex: 0,
7365
- };
7366
- commit('addStack', newStack);
7367
- return dispatch('runLine');
7368
- }
7369
- return dispatch('nextLine');
7370
- case 'talk':
7371
- await textCommand(commit, {
7372
- speaker: cmd.args[0],
7373
- pose: cmd.args[1],
7374
- text: `"${cmd.args[2]}"`,
7375
- choices,
7376
- interactive: true,
7377
- });
7378
- break;
7379
- case 'choice':
7380
- await runChoice(context, cmd);
7381
- break;
7382
- case 'set_screen':
7383
- commit('setScreen', cmd.options.screen);
7384
- return dispatch('nextLine');
7385
- case 'clear_dialog':
7386
- commit('clearDialog');
7387
- return dispatch('nextLine');
7388
- case 'set_button':
7389
- commit('changeButton', {
7390
- button: cmd.args[0],
7391
- enabled: cmd.args[1],
7392
- });
7393
- return dispatch('nextLine');
7394
- case 'play':
7395
- const playOptions = cmd.options;
7396
- if (playOptions.mode === 'music') {
7397
- changeMusic(context, playOptions.audio);
7398
- }
7399
- else {
7400
- playAudio(context.commit, playOptions.audio);
7401
- }
7402
- return dispatch('nextLine');
7403
- case 'stop':
7404
- const stopOptions = cmd.options;
7405
- if (stopOptions.mode === 'music') {
7406
- stopAudio(commit, context.state.audio.currentMusic);
7407
- }
7408
- else if (stopOptions.mode === 'sound' && stopOptions.audio) {
7409
- stopAudio(commit, stopOptions.audio);
7410
- }
7411
- else {
7412
- error(commit, `stop option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
7413
- }
7414
- return dispatch('nextLine');
7415
- case 'pause':
7416
- const pauseOptions = cmd.options;
7417
- if (pauseOptions.mode === 'music') {
7418
- pauseAudio(commit, context.state.audio.currentMusic);
7419
- }
7420
- else if (stopOptions.mode === 'sound' && stopOptions.audio) {
7421
- pauseAudio(commit, stopOptions.audio);
7422
- }
7423
- else {
7424
- error(commit, `pause first option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
7425
- }
7426
- return dispatch('nextLine');
7427
- case 'wait':
7428
- await timeout(cmd.options.duration);
7429
- return dispatch('nextLine');
7430
- case 'add_level':
7431
- const skillKey = cmd.args[0];
7432
- const levelToAdd = cmd.args[1];
7433
- if (!skillKey || !levelToAdd) {
7434
- error(commit, `add_level command needs a skill id and a value as parameters`);
7435
- }
7436
- dispatch('incrementSkill', {
7437
- skill: skillKey,
7438
- amount: levelToAdd,
7439
- });
7440
- return dispatch('nextLine');
7441
- case 'add_xp':
7442
- const xpKey = cmd.args[0];
7443
- const xpToAdd = cmd.args[1];
7444
- if (!xpKey || !xpToAdd) {
7445
- error(commit, `add_xp command needs a skill id and a value as parameters`);
7446
- }
7447
- dispatch('addXp', {
7448
- skill: xpKey,
7449
- amount: xpToAdd,
7450
- });
7451
- return dispatch('nextLine');
7452
- case 'add_stat':
7453
- const statKey = cmd.args[0];
7454
- const amountToAdd = cmd.args[1];
7455
- if (!statKey || !amountToAdd) {
7456
- error(commit, `add_stat command needs a stat id and a value as parameters`);
7457
- }
7458
- commit('addStat', {
7459
- stat: statKey,
7460
- amount: amountToAdd,
7461
- });
7462
- return dispatch('nextLine');
7463
- case 'set_stat':
7464
- const setStatKey = cmd.args[0];
7465
- const setAmount = cmd.args[1];
7466
- if (!setStatKey || !setAmount) {
7467
- error(commit, `set_stat command needs a stat id and a value as parameters`);
7468
- }
7469
- commit('setStat', {
7470
- stat: setStatKey,
7471
- amount: setAmount,
7472
- });
7473
- return dispatch('nextLine');
7474
- case 'notify':
7475
- const text = cmd.args[0];
7476
- dispatch('addNotification', text);
7477
- return dispatch('nextLine');
7478
- default:
7479
- break;
7480
- }
7481
- }
7482
- catch (err) {
7483
- logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
7484
- console.error(err);
7485
- error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
7486
- <b>${err}</b>
7487
- Script: ${cmd.code}
7488
- Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
7489
- }
7490
- }
7491
- async function playerAnswered(context, choiceIndex) {
7492
- const { commit, dispatch } = context;
7493
- const cmd = context.getters.currentLine;
7494
- switch (cmd.commandType) {
7495
- case 'choice':
7496
- const options = cmd.options;
7497
- const choice = options.choices[choiceIndex];
7498
- let playerText = choice.choice;
7499
- let newBranch;
7500
- const skillcheck = choice.skillCheck;
7501
- if (skillcheck) {
7502
- const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
7503
- if (skillCheckState.passed) {
7504
- newBranch = skillcheck.success.branch;
7505
- playerText = skillcheck.success.text;
7506
- }
7507
- else {
7508
- const result = processSkillCheck(context, skillcheck);
7509
- const winner = result ? skillcheck.success : skillcheck.failure;
7510
- newBranch = winner.branch;
7511
- playerText = undefined;
7512
- }
7513
- }
7514
- else {
7515
- newBranch = choice.branch;
7516
- }
7517
- if (playerText) {
7518
- // If the choice involves printing a player dialog, show it
7519
- const dialog = {
7520
- speaker: 'player',
7521
- text: playerText,
7522
- interactive: false,
7523
- };
7524
- commit('addDialog', { dialog });
7525
- }
7526
- if (newBranch) {
7527
- const newStack = {
7528
- currentIndex: 0,
7529
- branch: newBranch,
7530
- };
7531
- commit('addStack', newStack);
7532
- dispatch('runLine');
7533
- }
7534
- else {
7535
- dispatch('nextLine');
7536
- }
7537
- break;
7538
- default:
7539
- dispatch('nextLine');
7540
- }
7541
- }
7542
- async function runChoice(context, cmd) {
7543
- const options = cmd.options;
7544
- const prompt = options.prompt;
7545
- const choices = options.choices
7546
- .filter((choice) => {
7547
- // Delete the choice if it fails a condition
7548
- if (choice.condition) {
7549
- return runCondition(context, choice.condition);
7550
- }
7551
- if (choice.skillCheck) {
7552
- if (!getSkillCheckState(context, choice.skillCheck.id).available &&
7553
- choice.skillCheck.hideAfterRoll) {
7554
- return false;
7555
- }
7556
- }
7557
- return true;
7558
- })
7559
- .map((choice) => {
7560
- let text = choice.choice;
7561
- let choiceAllowed = true;
7562
- if (choice.skillCheck) {
7563
- const check = choice.skillCheck;
7564
- const { difficultyText, allowed } = getSkillCheckText({
7565
- context,
7566
- skill: check.skill,
7567
- skillCheckId: check.id,
7568
- value: check.value,
7569
- });
7570
- text = `${difficultyText} ${text}`;
7571
- choiceAllowed = allowed;
7572
- }
7573
- const result = {
7574
- choice: text,
7575
- originalIndex: choice.index,
7576
- allowed: choiceAllowed,
7577
- };
7578
- return result;
7579
- });
7580
- runCommand(context, prompt, choices);
7581
- }
7582
- async function textCommand(commit, dialog) {
7583
- commit('addDialog', {
7584
- dialog,
7585
- });
7586
- }
7587
- async function nextLine(ctx) {
7588
- const { state, getters, dispatch, commit } = ctx;
7589
- if (state.machine.stack.length === 0) {
7590
- finishGame(ctx);
7591
- return;
7592
- }
7593
- const machineHead = getters.machineHead;
7594
- if (machineHead.currentIndex < machineHead.branch.length - 1) {
7595
- commit('nextLine');
7596
- }
7597
- else {
7598
- // This branch is finished, go back to previous stack
7599
- commit('previousStack');
7600
- return dispatch('nextLine');
7601
- }
7602
- if (state.machine.stack.length === 0) {
7603
- finishGame(ctx);
7604
- }
7605
- else {
7606
- return dispatch('runLine');
7607
- }
7608
- }
7609
- function finishGame({ commit, state }) {
7610
- if (state.options.debug) {
7611
- commit('addDialog', {
7612
- dialog: {
7613
- speaker: 'game',
7614
- text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
7615
- },
7616
- });
7617
- }
7618
- }
7619
-
7620
- function jump(ctx) {
7621
- ctx.command.commandType = 'jump';
7622
- ctx.currentLine++;
7623
- }
7624
- function choice(ctx) {
7625
- const { line, command } = ctx;
7626
- if (!line.branch || line.branch.length < 2) {
7627
- ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
7628
- }
7629
- const prompt = line.branch[0];
7630
- const choices = line.branch.slice(1);
7631
- const prompts = choices.map((choice, index) => {
7632
- if (!choice.branch) {
7633
- ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
7634
- }
7635
- return parseChoiceOption(ctx, choice, index);
7636
- });
7637
- command.options = {
7638
- prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
7639
- choices: prompts,
7640
- };
7641
- command.commandType = 'choice';
7642
- ctx.currentLine++;
7643
- }
7644
- function set(ctx) {
7645
- ctx.command.commandType = 'set';
7646
- ctx.currentLine++;
7647
- }
7648
- // eslint-disable-next-line camelcase
7649
- function add_level(ctx) {
7650
- ctx.command.commandType = 'add_level';
7651
- ctx.currentLine++;
7652
- }
7653
- function add_xp(ctx) {
7654
- ctx.command.commandType = 'add_xp';
7655
- ctx.currentLine++;
7656
- }
7657
- function set_stat(ctx) {
7658
- ctx.command.commandType = 'set_stat';
7659
- ctx.currentLine++;
7660
- }
7661
- function add_stat(ctx) {
7662
- ctx.command.commandType = 'add_stat';
7663
- ctx.currentLine++;
7664
- }
7665
- function add(ctx) {
7666
- ctx.command.commandType = 'add';
7667
- ctx.currentLine++;
7668
- }
7669
- function talk(ctx) {
7670
- const { command, line } = ctx;
7671
- command.commandType = 'talk';
7672
- if (command.args.length < 3) {
7673
- ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
7674
- }
7675
- ctx.currentLine++;
7676
- }
7677
- function ifCommand(ctx) {
7678
- const { command, lines, currentLine, line } = ctx;
7679
- command.commandType = 'if';
7680
- let failure;
7681
- const nextLine = getLine(lines, currentLine + 1);
7682
- if (nextLine && nextLine.operator === 'else') {
7683
- failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
7684
- ctx.currentLine++;
7685
- }
7686
- command.options = {
7687
- condition: command.args[0],
7688
- success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
7689
- failure,
7690
- };
7691
- ctx.currentLine++;
7692
- }
7693
- function setScreen(ctx) {
7694
- const { command } = ctx;
7695
- command.commandType = 'set_screen';
7696
- command.options = {
7697
- screen: command.args[0],
7698
- };
7699
- ctx.currentLine++;
7700
- }
7701
- function setButton(ctx) {
7702
- const { command, line } = ctx;
7703
- command.commandType = 'set_button';
7704
- if (command.args.length !== 2) {
7705
- ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
7706
- }
7707
- ctx.currentLine++;
7708
- }
7709
- function clearDialog(ctx) {
7710
- const { command } = ctx;
7711
- command.commandType = 'clear_dialog';
7712
- ctx.currentLine++;
7713
- }
7714
- function play(ctx) {
7715
- const { command } = ctx;
7716
- command.commandType = 'play';
7717
- command.options = {
7718
- mode: command.args[0],
7719
- audio: command.args[1],
7720
- };
7721
- ctx.currentLine++;
7722
- }
7723
- function stop(ctx) {
7724
- const { command } = ctx;
7725
- command.commandType = 'stop';
7726
- command.options = {
7727
- mode: command.args[0],
7728
- audio: command.args[1],
7729
- };
7730
- ctx.currentLine++;
7731
- }
7732
- function pause(ctx) {
7733
- const { command } = ctx;
7734
- command.commandType = 'pause';
7735
- command.options = {
7736
- mode: command.args[0],
7737
- audio: command.args[1],
7738
- };
7739
- ctx.currentLine++;
7740
- }
7741
- function wait(ctx) {
7742
- const { command } = ctx;
7743
- command.commandType = 'wait';
7744
- command.options = {
7745
- duration: parseInt(command.args[0], 10),
7746
- };
7747
- ctx.currentLine++;
7748
- }
7749
- function text(ctx) {
7750
- const { command, line } = ctx;
7751
- command.commandType = 'text';
7752
- command.options = {
7753
- text: line.operator,
7754
- };
7755
- ctx.currentLine++;
7756
- }
7757
- function notify(ctx) {
7758
- ctx.command.commandType = 'notify';
7759
- ctx.currentLine++;
7760
- }
7761
- const parserFunctions = {
7762
- jump,
7763
- choice,
7764
- set,
7765
- add,
7766
- talk,
7767
- if: ifCommand,
7768
- set_screen: setScreen,
7769
- set_button: setButton,
7770
- clear_dialog: clearDialog,
7771
- play,
7772
- stop,
7773
- pause,
7774
- wait,
7775
- text,
7776
- add_level,
7777
- add_xp,
7778
- notify,
7779
- set_stat,
7780
- add_stat,
7781
- };
7782
- function getLine(lines, index) {
7783
- if (index < lines.length)
7784
- return lines[index];
7785
- }
7786
- function parseChoiceOption(ctx, choice, index) {
7787
- let choiceText = choice.operator;
7788
- let condition;
7789
- let skillCheck;
7790
- if (choice.operator === 'roll') {
7791
- if (choice.args.length < 4) {
7792
- ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
7793
- }
7794
- choiceText = choice.args[3];
7795
- const hideAfterRoll = choice.args.length >= 5;
7796
- const successBranch = choice.branch[0];
7797
- const failureBranch = choice.branch[1];
7798
- const success = {
7799
- text: successBranch.args[0],
7800
- branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
7801
- };
7802
- let failedBranch;
7803
- if (failureBranch.branch) {
7804
- failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
7805
- }
7806
- const failure = {
7807
- text: failureBranch.args[0],
7808
- branch: failedBranch,
7809
- };
7810
- skillCheck = {
7811
- id: choice.args[0],
7812
- skill: choice.args[1],
7813
- value: choice.args[2],
7814
- hideAfterRoll,
7815
- success,
7816
- failure,
7817
- };
7818
- }
7819
- if (choice.args[0] === 'if') {
7820
- condition = choice.args[1];
7821
- }
7822
- return {
7823
- choice: choiceText,
7824
- condition,
7825
- skillCheck,
7826
- branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
7827
- index,
7828
- };
7400
+ id: "background-canvas",
7401
+ class: "narrat-canvas"
7402
+ }, null, 8, _hoisted_1$a)
7403
+ ], 4))
7404
+ : vue.createCommentVNode("", true),
7405
+ (_ctx.inGame)
7406
+ ? (vue.openBlock(), vue.createElementBlock("div", {
7407
+ key: 3,
7408
+ class: "dialog override",
7409
+ ref: "dialog",
7410
+ style: vue.normalizeStyle(_ctx.dialogStyle)
7411
+ }, [
7412
+ vue.createVNode(vue.TransitionGroup, {
7413
+ name: "list",
7414
+ tag: "div",
7415
+ class: "dialog-container w-full override",
7416
+ style: vue.normalizeStyle(_ctx.dialogContainerStyle)
7417
+ }, {
7418
+ default: vue.withCtx(() => [
7419
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.dialog, (dialog, i) => {
7420
+ return (vue.openBlock(), vue.createBlock(_component_DialogBox, {
7421
+ key: dialog.id,
7422
+ options: _ctx.getDialogBoxOptions(dialog, i),
7423
+ active: _ctx.isDialogActive(i)
7424
+ }, null, 8, ["options", "active"]))
7425
+ }), 128))
7426
+ ]),
7427
+ _: 1
7428
+ }, 8, ["style"]),
7429
+ _hoisted_2$8
7430
+ ], 4))
7431
+ : vue.createCommentVNode("", true)
7432
+ ], 4))
7433
+ : (_ctx.gameLoaded)
7434
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$5, [
7435
+ vue.createElementVNode("div", _hoisted_4$4, [
7436
+ vue.createElementVNode("h1", _hoisted_5$4, vue.toDisplayString(_ctx.gameTitle), 1)
7437
+ ]),
7438
+ vue.createElementVNode("div", _hoisted_6$4, [
7439
+ vue.createElementVNode("button", {
7440
+ class: "button menu-button start-button override",
7441
+ onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.startGame && _ctx.startGame(...args)))
7442
+ }, " Start Game "),
7443
+ (_ctx.hasSave)
7444
+ ? (vue.openBlock(), vue.createElementBlock("button", {
7445
+ key: 0,
7446
+ class: "button menu-button continue-button override",
7447
+ onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.loadGame && _ctx.loadGame(...args)))
7448
+ }, " Continue Game "))
7449
+ : vue.createCommentVNode("", true)
7450
+ ])
7451
+ ]))
7452
+ : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
7453
+ vue.createVNode(_component_LoadingBar, {
7454
+ percentage: _ctx.loadingPercentage,
7455
+ step: _ctx.loadingStep
7456
+ }, null, 8, ["percentage", "step"])
7457
+ ])),
7458
+ (_ctx.options.debug)
7459
+ ? (vue.openBlock(), vue.createBlock(_component_DebugMenu, { key: 4 }))
7460
+ : vue.createCommentVNode("", true),
7461
+ vue.createVNode(_component_NotificationToast)
7462
+ ], 4))
7829
7463
  }
7830
7464
 
7831
- function parseRenpyScript(errorHandler, code, fileName) {
7465
+ var css_248z$c = "#app {\n background-color: var(--bg-color);\n width: 100%;\n height: 100%;\n position: absolute;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n color: var(--text-color);\n box-sizing: border-box;\n overflow: hidden;\n transform-origin: center center;\n}\n\n.game {\n background-color: var(--bg-color);\n position: relative;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n.interact-button {\n height: 50px;\n border: 1px solid black;\n font-weight: bold;\n font-size: 20px;\n text-align: center;\n flex-grow: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.interact-button:not(:last-child) {\n margin-right: 10px;\n}\n\n.dialog-container {\n flex-shrink: 2;\n /* padding: 20px; */\n min-height: 100%;\n width: 100%;\n background-color: (var(--bg-color));\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: center;\n overflow-x: hidden;\n}\n\n.dialog {\n overflow-y: auto;\n overflow-x: hidden;\n position: relative;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n}\n\n.dialog::-webkit-scrollbar {\n display: none; /* webkit */\n}\n\n.dialog * {\n overflow-anchor: none;\n}\n\n.background {\n margin: 0;\n}\n\n#background-canvas {\n height: 100%;\n}\n\n.anchor {\n overflow-anchor: auto;\n height: 1px;\n}\n\n.menu-toggle {\n position: fixed;\n bottom: 0px;\n right: 15%;\n z-index: 2;\n}\n\n#game-title-container {\n margin-bottom: 50px;\n}\n\n#game-title-text {\n text-align: center;\n font-size: 50px;\n}\n\n.menu-button {\n font-size: 25px;\n}\r\n";
7466
+ styleInject(css_248z$c);
7467
+
7468
+ script$b.render = render$b;
7469
+
7470
+ function parseScript(errorHandler, code, fileName) {
7832
7471
  const ctx = {
7833
7472
  fileName,
7834
7473
  error: (line, text) => errorHandler(ctx, line, text),
7835
- processCommandsFunction: processRenpyCommands,
7474
+ processCommandsFunction: processCommands,
7836
7475
  indentSize: 0, // Will be overriden soon
7837
7476
  };
7838
7477
  ctx.indentSize = detectIndentation(ctx, code);
7839
- const lines = findRenpyLines(ctx, code);
7478
+ const lines = findLines(ctx, code);
7840
7479
  logger.log(lines);
7841
7480
  const script = {};
7842
7481
  for (const line of lines) {
@@ -7847,13 +7486,13 @@ function parseRenpyScript(errorHandler, code, fileName) {
7847
7486
  if (!line.branch) {
7848
7487
  ctx.error(line.line, `This line should have a branch but doesn't`);
7849
7488
  }
7850
- script[labelName] = processRenpyCommands(ctx, line.branch, undefined);
7489
+ script[labelName] = processCommands(ctx, line.branch, undefined);
7851
7490
  }
7852
7491
  return script;
7853
7492
  }
7854
- function processRenpyCommands(ctx, lines, parentLine) {
7493
+ function processCommands(ctx, lines, parentLine) {
7855
7494
  const branchContext = {
7856
- processCommandsFunction: processRenpyCommands,
7495
+ processCommandsFunction: processCommands,
7857
7496
  parserContext: ctx,
7858
7497
  lines,
7859
7498
  currentLine: 0,
@@ -7880,10 +7519,11 @@ function processRenpyCommands(ctx, lines, parentLine) {
7880
7519
  };
7881
7520
  branchContext.line = line;
7882
7521
  branchContext.command = command;
7883
- let parseFunction = parserFunctions[operator];
7522
+ const commandPlugin = vm$1.commands[operator];
7523
+ let parseFunction = commandPlugin?.parser;
7884
7524
  if (!parseFunction) {
7885
7525
  // default to text function
7886
- parseFunction = parserFunctions.text;
7526
+ parseFunction = vm$1.commands.text.parser;
7887
7527
  }
7888
7528
  parseFunction(branchContext);
7889
7529
  branch.push(command);
@@ -7948,7 +7588,7 @@ function parseCodeLine(codeToProcess) {
7948
7588
  words.forEach((word, index) => (words[index] = parseValue(word)));
7949
7589
  return words;
7950
7590
  }
7951
- function findRenpyLines(ctx, data) {
7591
+ function findLines(ctx, data) {
7952
7592
  const code = data.split(/\r?\n|$/).map((line) => {
7953
7593
  const commentIndex = line.search(/ *\/\//g);
7954
7594
  if (commentIndex !== -1) {
@@ -7956,10 +7596,10 @@ function findRenpyLines(ctx, data) {
7956
7596
  }
7957
7597
  return line;
7958
7598
  });
7959
- const lines = findRenpyBranches(ctx, code, 0, 0);
7599
+ const lines = findBranches(ctx, code, 0, 0);
7960
7600
  return lines.lines;
7961
7601
  }
7962
- function findRenpyBranches(ctx, code, startLine, indentLevel) {
7602
+ function findBranches(ctx, code, startLine, indentLevel) {
7963
7603
  let stillInBranch = true;
7964
7604
  let currentLine = startLine;
7965
7605
  const lines = [];
@@ -7982,7 +7622,7 @@ function findRenpyBranches(ctx, code, startLine, indentLevel) {
7982
7622
  if (lines.length === 0 || lineIndent - indentLevel !== 1) {
7983
7623
  ctx.error(currentLine, `Wrong double indentation`);
7984
7624
  }
7985
- const branchLines = findRenpyBranches(ctx, code, currentLine, lineIndent);
7625
+ const branchLines = findBranches(ctx, code, currentLine, lineIndent);
7986
7626
  lines[lines.length - 1].branch = branchLines.lines;
7987
7627
  currentLine = branchLines.endLine;
7988
7628
  }
@@ -8209,6 +7849,7 @@ function setupStore(options) {
8209
7849
  options,
8210
7850
  flowState: 'menu',
8211
7851
  openModal: false,
7852
+ paused: false,
8212
7853
  },
8213
7854
  getters: {
8214
7855
  machineHead(state) {
@@ -8241,7 +7882,7 @@ function setupStore(options) {
8241
7882
  const file = files[index];
8242
7883
  scripts = {
8243
7884
  ...scripts,
8244
- ...parseRenpyScript((ctx, line, error) => parserError(commit, ctx, line, error), file, scriptPaths[index]),
7885
+ ...parseScript((ctx, line, error) => parserError(commit, ctx, line, error), file, scriptPaths[index]),
8245
7886
  };
8246
7887
  }
8247
7888
  const end = Date.now();
@@ -8263,6 +7904,7 @@ function setupStore(options) {
8263
7904
  ];
8264
7905
  state.ready = true;
8265
7906
  commit('startPlaying');
7907
+ vm$1.callHook('onGameStart');
8266
7908
  },
8267
7909
  runLabel({ state, commit }, label) {
8268
7910
  const branch = state.machine.script[label];
@@ -8528,113 +8170,593 @@ function setupStore(options) {
8528
8170
  state.openModal = 'menu';
8529
8171
  }
8530
8172
  },
8173
+ pause(state) {
8174
+ state.paused = true;
8175
+ },
8176
+ unpause(state) {
8177
+ state.paused = false;
8178
+ },
8531
8179
  },
8532
8180
  plugins,
8533
8181
  });
8534
8182
  return {
8535
- store,
8536
- key,
8183
+ store,
8184
+ key,
8185
+ };
8186
+ }
8187
+
8188
+ let canvas;
8189
+ let ctx;
8190
+ let store$1;
8191
+ const mousePos = {
8192
+ x: 0,
8193
+ y: 0,
8194
+ };
8195
+ function startGameLoop(appStore) {
8196
+ store$1 = appStore;
8197
+ document.addEventListener('mousemove', (e) => {
8198
+ mousePos.x = e.clientX;
8199
+ mousePos.y = e.clientY;
8200
+ });
8201
+ document.addEventListener('click', debounce(mouseclick, 100, { maxWait: 200 }));
8202
+ gameLoop();
8203
+ }
8204
+ function gameLoop() {
8205
+ if (store$1.state.playing) {
8206
+ if (!canvas) {
8207
+ canvas = document.querySelector('#background-canvas');
8208
+ if (canvas && !ctx) {
8209
+ ctx = canvas.getContext('2d');
8210
+ }
8211
+ }
8212
+ else {
8213
+ ctx.fillStyle = 'white';
8214
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
8215
+ const currentScreen = store$1.state.currentScreen;
8216
+ const screen = getConfig().screens[currentScreen];
8217
+ const bg = screen.background;
8218
+ ctx.drawImage(images[bg], 0, 0);
8219
+ let foundCollision = false;
8220
+ const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
8221
+ if (screen.buttons) {
8222
+ for (const buttonName of screen.buttons) {
8223
+ if (store$1.state.buttons[buttonName].enabled) {
8224
+ const button = getConfig().buttons[buttonName];
8225
+ const image = images[button.background];
8226
+ ctx.drawImage(image, button.position.left, button.position.top);
8227
+ if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
8228
+ foundCollision = true;
8229
+ }
8230
+ }
8231
+ }
8232
+ }
8233
+ if (foundCollision) {
8234
+ document.body.style.cursor = 'pointer';
8235
+ }
8236
+ else {
8237
+ document.body.style.cursor = 'default';
8238
+ }
8239
+ ctx.fillStyle = 'black';
8240
+ ctx.textAlign = 'left';
8241
+ // ctx.fillText(`x: ${scaledMousePos.x}, y: ${scaledMousePos.y}`, 0, 20);
8242
+ }
8243
+ }
8244
+ else {
8245
+ canvas = undefined;
8246
+ ctx = undefined;
8247
+ }
8248
+ window.requestAnimationFrame(gameLoop);
8249
+ }
8250
+ function mouseclick(e) {
8251
+ if (!canvas) {
8252
+ return;
8253
+ }
8254
+ mousePos.x = e.clientX;
8255
+ mousePos.y = e.clientY;
8256
+ const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
8257
+ const currentScreen = store$1.state.currentScreen;
8258
+ const screen = getConfig().screens[currentScreen];
8259
+ if (screen.buttons) {
8260
+ for (const buttonName of screen.buttons) {
8261
+ if (store$1.state.buttons[buttonName].enabled) {
8262
+ const button = getConfig().buttons[buttonName];
8263
+ if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
8264
+ // clicked button
8265
+ const scriptToRun = button.action;
8266
+ const newStack = {
8267
+ branch: store$1.state.machine.script[scriptToRun],
8268
+ currentIndex: 0,
8269
+ label: scriptToRun,
8270
+ };
8271
+ store$1.commit('setStack', newStack);
8272
+ store$1.dispatch('runLine');
8273
+ }
8274
+ }
8275
+ }
8276
+ }
8277
+ }
8278
+
8279
+ class CommandPlugin {
8280
+ keyword;
8281
+ runner;
8282
+ parser;
8283
+ constructor(keyword, runner, parser) {
8284
+ this.keyword = keyword;
8285
+ this.runner = runner;
8286
+ this.parser = parser;
8287
+ }
8288
+ }
8289
+ function generateParser(keyword) {
8290
+ return (ctx) => {
8291
+ ctx.command.commandType = keyword;
8292
+ ctx.currentLine++;
8293
+ };
8294
+ }
8295
+
8296
+ const add = async (context, cmd, choices) => {
8297
+ const { commit, dispatch } = context;
8298
+ const addKey = cmd.args[0];
8299
+ const addValue = cmd.args[1];
8300
+ commit('addInstruction', { path: addKey, value: addValue });
8301
+ return dispatch('nextLine');
8302
+ };
8303
+ const addPlugin = new CommandPlugin('add', add, generateParser('add'));
8304
+
8305
+ const addLevelRunner = async (context, cmd) => {
8306
+ const { commit, dispatch } = context;
8307
+ const skillKey = cmd.args[0];
8308
+ const levelToAdd = cmd.args[1];
8309
+ if (!skillKey || !levelToAdd) {
8310
+ error(commit, `add_level command needs a skill id and a value as parameters`);
8311
+ }
8312
+ dispatch('incrementSkill', {
8313
+ skill: skillKey,
8314
+ amount: levelToAdd,
8315
+ });
8316
+ return dispatch('nextLine');
8317
+ };
8318
+ const addLevelParser = (ctx) => {
8319
+ ctx.command.commandType = 'add_level';
8320
+ ctx.currentLine++;
8321
+ };
8322
+ const addLevelPlugin = new CommandPlugin('add_level', addLevelRunner, addLevelParser);
8323
+
8324
+ const addStatRunner = async (context, cmd) => {
8325
+ const { commit, dispatch } = context;
8326
+ const statKey = cmd.args[0];
8327
+ const amountToAdd = cmd.args[1];
8328
+ if (!statKey || !amountToAdd) {
8329
+ error(commit, `add_stat command needs a stat id and a value as parameters`);
8330
+ }
8331
+ commit('addStat', {
8332
+ stat: statKey,
8333
+ amount: amountToAdd,
8334
+ });
8335
+ return dispatch('nextLine');
8336
+ };
8337
+ const addStatParser = (ctx) => {
8338
+ ctx.command.commandType = 'add_stat';
8339
+ ctx.currentLine++;
8340
+ };
8341
+ const addStatPlugin = new CommandPlugin('add_stat', addStatRunner, addStatParser);
8342
+
8343
+ const addXp = async (context, cmd) => {
8344
+ const { commit, dispatch } = context;
8345
+ const xpKey = cmd.args[0];
8346
+ const xpToAdd = cmd.args[1];
8347
+ if (!xpKey || !xpToAdd) {
8348
+ error(commit, `add_xp command needs a skill id and a value as parameters`);
8349
+ }
8350
+ dispatch('addXp', {
8351
+ skill: xpKey,
8352
+ amount: xpToAdd,
8353
+ });
8354
+ return dispatch('nextLine');
8355
+ };
8356
+ const addXpPlugin = new CommandPlugin('add_xp', addXp, generateParser('add_xp'));
8357
+
8358
+ const choice = async (context, cmd) => {
8359
+ await runChoice(context, cmd);
8360
+ };
8361
+ async function runChoice(context, cmd) {
8362
+ const options = cmd.options;
8363
+ const prompt = options.prompt;
8364
+ const choices = options.choices
8365
+ .filter((choice) => {
8366
+ // Delete the choice if it fails a condition
8367
+ if (choice.condition) {
8368
+ return runCondition(context, choice.condition);
8369
+ }
8370
+ if (choice.skillCheck) {
8371
+ if (!getSkillCheckState(context, choice.skillCheck.id).available &&
8372
+ choice.skillCheck.hideAfterRoll) {
8373
+ return false;
8374
+ }
8375
+ }
8376
+ return true;
8377
+ })
8378
+ .map((choice) => {
8379
+ let text = choice.choice;
8380
+ let choiceAllowed = true;
8381
+ if (choice.skillCheck) {
8382
+ const check = choice.skillCheck;
8383
+ const { difficultyText, allowed } = getSkillCheckText({
8384
+ context,
8385
+ skill: check.skill,
8386
+ skillCheckId: check.id,
8387
+ value: check.value,
8388
+ });
8389
+ text = `${difficultyText} ${text}`;
8390
+ choiceAllowed = allowed;
8391
+ }
8392
+ const result = {
8393
+ choice: text,
8394
+ originalIndex: choice.index,
8395
+ allowed: choiceAllowed,
8396
+ };
8397
+ return result;
8398
+ });
8399
+ runCommand(context, prompt, choices);
8400
+ }
8401
+ const choiceParser = (ctx) => {
8402
+ const { line, command } = ctx;
8403
+ if (!line.branch || line.branch.length < 2) {
8404
+ ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
8405
+ }
8406
+ const prompt = line.branch[0];
8407
+ const choices = line.branch.slice(1);
8408
+ const prompts = choices.map((choice, index) => {
8409
+ if (!choice.branch) {
8410
+ ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
8411
+ }
8412
+ return parseChoiceOption(ctx, choice, index);
8413
+ });
8414
+ command.options = {
8415
+ prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
8416
+ choices: prompts,
8417
+ };
8418
+ command.commandType = 'choice';
8419
+ ctx.currentLine++;
8420
+ };
8421
+ function parseChoiceOption(ctx, choice, index) {
8422
+ let choiceText = choice.operator;
8423
+ let condition;
8424
+ let skillCheck;
8425
+ if (choice.operator === 'roll') {
8426
+ if (choice.args.length < 4) {
8427
+ ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
8428
+ }
8429
+ choiceText = choice.args[3];
8430
+ const hideAfterRoll = choice.args.length >= 5;
8431
+ const successBranch = choice.branch[0];
8432
+ const failureBranch = choice.branch[1];
8433
+ const success = {
8434
+ text: successBranch.args[0],
8435
+ branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
8436
+ };
8437
+ let failedBranch;
8438
+ if (failureBranch.branch) {
8439
+ failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
8440
+ }
8441
+ const failure = {
8442
+ text: failureBranch.args[0],
8443
+ branch: failedBranch,
8444
+ };
8445
+ skillCheck = {
8446
+ id: choice.args[0],
8447
+ skill: choice.args[1],
8448
+ value: choice.args[2],
8449
+ hideAfterRoll,
8450
+ success,
8451
+ failure,
8452
+ };
8453
+ }
8454
+ if (choice.args[0] === 'if') {
8455
+ condition = choice.args[1];
8456
+ }
8457
+ return {
8458
+ choice: choiceText,
8459
+ condition,
8460
+ skillCheck,
8461
+ branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
8462
+ index,
8537
8463
  };
8538
- }
8464
+ }
8465
+ const choicePlugin = new CommandPlugin('choice', choice, choiceParser);
8539
8466
 
8540
- let canvas;
8541
- let ctx;
8542
- let store$1;
8543
- const mousePos = {
8544
- x: 0,
8545
- y: 0,
8467
+ const clearDialog = async (context, cmd) => {
8468
+ const { commit, dispatch } = context;
8469
+ commit('clearDialog');
8470
+ return dispatch('nextLine');
8546
8471
  };
8547
- function startGameLoop(appStore) {
8548
- store$1 = appStore;
8549
- document.addEventListener('mousemove', (e) => {
8550
- mousePos.x = e.clientX;
8551
- mousePos.y = e.clientY;
8552
- });
8553
- document.addEventListener('click', debounce(mouseclick, 100, { maxWait: 200 }));
8554
- gameLoop();
8555
- }
8556
- function gameLoop() {
8557
- if (store$1.state.playing) {
8558
- if (!canvas) {
8559
- canvas = document.querySelector('#background-canvas');
8560
- if (canvas && !ctx) {
8561
- ctx = canvas.getContext('2d');
8562
- }
8563
- }
8564
- else {
8565
- ctx.fillStyle = 'white';
8566
- ctx.fillRect(0, 0, canvas.width, canvas.height);
8567
- const currentScreen = store$1.state.currentScreen;
8568
- const screen = getConfig().screens[currentScreen];
8569
- const bg = screen.background;
8570
- ctx.drawImage(images[bg], 0, 0);
8571
- let foundCollision = false;
8572
- const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
8573
- if (screen.buttons) {
8574
- for (const buttonName of screen.buttons) {
8575
- if (store$1.state.buttons[buttonName].enabled) {
8576
- const button = getConfig().buttons[buttonName];
8577
- const image = images[button.background];
8578
- ctx.drawImage(image, button.position.left, button.position.top);
8579
- if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
8580
- foundCollision = true;
8581
- }
8582
- }
8583
- }
8584
- }
8585
- if (foundCollision) {
8586
- document.body.style.cursor = 'pointer';
8587
- }
8588
- else {
8589
- document.body.style.cursor = 'default';
8590
- }
8591
- ctx.fillStyle = 'black';
8592
- ctx.textAlign = 'left';
8593
- // ctx.fillText(`x: ${scaledMousePos.x}, y: ${scaledMousePos.y}`, 0, 20);
8594
- }
8472
+ const clearDialogPlugin = new CommandPlugin('clear_dialog', clearDialog, generateParser('clear_dialog'));
8473
+
8474
+ const ifFunction = async (context, cmd) => {
8475
+ const { commit, dispatch } = context;
8476
+ const newBranch = runConditionCommand(context, cmd);
8477
+ if (newBranch) {
8478
+ const newStack = {
8479
+ branch: newBranch,
8480
+ currentIndex: 0,
8481
+ };
8482
+ commit('addStack', newStack);
8483
+ return dispatch('runLine');
8484
+ }
8485
+ return dispatch('nextLine');
8486
+ };
8487
+ const ifParser = (ctx) => {
8488
+ const { command, lines, currentLine, line } = ctx;
8489
+ command.commandType = 'if';
8490
+ let failure;
8491
+ const nextLine = getLine(lines, currentLine + 1);
8492
+ if (nextLine && nextLine.operator === 'else') {
8493
+ failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
8494
+ ctx.currentLine++;
8495
+ }
8496
+ command.options = {
8497
+ condition: command.args[0],
8498
+ success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
8499
+ failure,
8500
+ };
8501
+ ctx.currentLine++;
8502
+ };
8503
+ const ifCommand = new CommandPlugin('if', ifFunction, ifParser);
8504
+
8505
+ const jump = async (context, cmd, choices) => {
8506
+ const { state, commit, dispatch } = context;
8507
+ const branch = cmd.args[0];
8508
+ const newStack = {
8509
+ branch: state.machine.script[branch],
8510
+ label: branch,
8511
+ currentIndex: 0,
8512
+ };
8513
+ commit('setStack', newStack);
8514
+ await dispatch('saveGame');
8515
+ await dispatch('runLine');
8516
+ };
8517
+ const jumpCommand = new CommandPlugin('jump', jump, generateParser('jump'));
8518
+
8519
+ const notify = async (context, cmd) => {
8520
+ const { dispatch } = context;
8521
+ const text = cmd.args[0];
8522
+ dispatch('addNotification', text);
8523
+ return dispatch('nextLine');
8524
+ };
8525
+ const notifyPlugin = new CommandPlugin('notify', notify, generateParser('notify'));
8526
+
8527
+ const pause = async (context, cmd) => {
8528
+ const { commit, dispatch } = context;
8529
+ const pauseOptions = cmd.options;
8530
+ if (pauseOptions.mode === 'music') {
8531
+ pauseAudio(commit, context.state.audio.currentMusic);
8532
+ }
8533
+ else if (pauseOptions.mode === 'sound' && pauseOptions.audio) {
8534
+ pauseAudio(commit, pauseOptions.audio);
8595
8535
  }
8596
8536
  else {
8597
- canvas = undefined;
8598
- ctx = undefined;
8537
+ error(commit, `pause first option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
8599
8538
  }
8600
- window.requestAnimationFrame(gameLoop);
8601
- }
8602
- function mouseclick(e) {
8603
- if (!canvas) {
8604
- return;
8539
+ return dispatch('nextLine');
8540
+ };
8541
+ const pauseParser = (ctx) => {
8542
+ const { command } = ctx;
8543
+ command.commandType = 'pause';
8544
+ command.options = {
8545
+ mode: command.args[0],
8546
+ audio: command.args[1],
8547
+ };
8548
+ ctx.currentLine++;
8549
+ };
8550
+ const pauseCommand = new CommandPlugin('pause', pause, pauseParser);
8551
+
8552
+ const play = async (context, cmd) => {
8553
+ const { dispatch } = context;
8554
+ const playOptions = cmd.options;
8555
+ if (playOptions.mode === 'music') {
8556
+ changeMusic(context, playOptions.audio);
8605
8557
  }
8606
- mousePos.x = e.clientX;
8607
- mousePos.y = e.clientY;
8608
- const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
8609
- const currentScreen = store$1.state.currentScreen;
8610
- const screen = getConfig().screens[currentScreen];
8611
- if (screen.buttons) {
8612
- for (const buttonName of screen.buttons) {
8613
- if (store$1.state.buttons[buttonName].enabled) {
8614
- const button = getConfig().buttons[buttonName];
8615
- if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
8616
- // clicked button
8617
- const scriptToRun = button.action;
8618
- const newStack = {
8619
- branch: store$1.state.machine.script[scriptToRun],
8620
- currentIndex: 0,
8621
- label: scriptToRun,
8622
- };
8623
- store$1.commit('setStack', newStack);
8624
- store$1.dispatch('runLine');
8625
- }
8626
- }
8627
- }
8558
+ else {
8559
+ playAudio(context.commit, playOptions.audio);
8560
+ }
8561
+ return dispatch('nextLine');
8562
+ };
8563
+ const playParser = (ctx) => {
8564
+ const { command } = ctx;
8565
+ command.commandType = 'play';
8566
+ command.options = {
8567
+ mode: command.args[0],
8568
+ audio: command.args[1],
8569
+ };
8570
+ ctx.currentLine++;
8571
+ };
8572
+ const playCommand = new CommandPlugin('play', play, playParser);
8573
+
8574
+ const set = async (context, cmd, choices) => {
8575
+ const { commit, dispatch } = context;
8576
+ const key = cmd.args[0];
8577
+ const value = cmd.args[1];
8578
+ commit('setData', { path: key, value });
8579
+ return dispatch('nextLine');
8580
+ };
8581
+ const setCommand = new CommandPlugin('set', set, generateParser('set'));
8582
+
8583
+ const setButton = async (context, cmd) => {
8584
+ const { commit, dispatch } = context;
8585
+ commit('changeButton', {
8586
+ button: cmd.args[0],
8587
+ enabled: cmd.args[1],
8588
+ });
8589
+ return dispatch('nextLine');
8590
+ };
8591
+ const setButtonParser = (ctx) => {
8592
+ const { command, line } = ctx;
8593
+ command.commandType = 'set_button';
8594
+ if (command.args.length !== 2) {
8595
+ ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
8596
+ }
8597
+ ctx.currentLine++;
8598
+ };
8599
+ const setButtonCommand = new CommandPlugin('set_button', setButton, setButtonParser);
8600
+
8601
+ const setScreen = async (context, cmd) => {
8602
+ const { commit, dispatch } = context;
8603
+ commit('setScreen', cmd.options.screen);
8604
+ return dispatch('nextLine');
8605
+ };
8606
+ const setScreenParser = (ctx) => {
8607
+ const { command } = ctx;
8608
+ command.commandType = 'set_screen';
8609
+ command.options = {
8610
+ screen: command.args[0],
8611
+ };
8612
+ ctx.currentLine++;
8613
+ };
8614
+ const setScreenCommand = new CommandPlugin('set_screen', setScreen, setScreenParser);
8615
+
8616
+ const setStat = async (context, cmd) => {
8617
+ const { commit, dispatch } = context;
8618
+ const setStatKey = cmd.args[0];
8619
+ const setAmount = cmd.args[1];
8620
+ if (!setStatKey || !setAmount) {
8621
+ error(commit, `set_stat command needs a stat id and a value as parameters`);
8622
+ }
8623
+ commit('setStat', {
8624
+ stat: setStatKey,
8625
+ amount: setAmount,
8626
+ });
8627
+ return dispatch('nextLine');
8628
+ };
8629
+ const setStatCommand = new CommandPlugin('set_stat', setStat, generateParser('set_stat'));
8630
+
8631
+ const stop = async (context, cmd) => {
8632
+ const { commit, dispatch } = context;
8633
+ const stopOptions = cmd.options;
8634
+ if (stopOptions.mode === 'music') {
8635
+ stopAudio(commit, context.state.audio.currentMusic);
8636
+ }
8637
+ else if (stopOptions.mode === 'sound' && stopOptions.audio) {
8638
+ stopAudio(commit, stopOptions.audio);
8639
+ }
8640
+ else {
8641
+ error(commit, `stop option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.`);
8642
+ }
8643
+ return dispatch('nextLine');
8644
+ };
8645
+ const stopParser = (ctx) => {
8646
+ const { command } = ctx;
8647
+ command.commandType = 'stop';
8648
+ command.options = {
8649
+ mode: command.args[0],
8650
+ audio: command.args[1],
8651
+ };
8652
+ ctx.currentLine++;
8653
+ };
8654
+ const stopCommand = new CommandPlugin('stop', stop, stopParser);
8655
+
8656
+ const talk = async (context, cmd, choices) => {
8657
+ const { commit } = context;
8658
+ await textCommand(commit, {
8659
+ speaker: cmd.args[0],
8660
+ pose: cmd.args[1],
8661
+ text: `"${cmd.args[2]}"`,
8662
+ choices,
8663
+ interactive: true,
8664
+ });
8665
+ };
8666
+ const talkParser = (ctx) => {
8667
+ const { command, line } = ctx;
8668
+ command.commandType = 'talk';
8669
+ if (command.args.length < 3) {
8670
+ ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
8628
8671
  }
8672
+ ctx.currentLine++;
8673
+ };
8674
+ const talkCommand = new CommandPlugin('talk', talk, talkParser);
8675
+
8676
+ const text = async (context, cmd, choices) => {
8677
+ const { commit } = context;
8678
+ await textCommand(commit, {
8679
+ speaker: 'game',
8680
+ text: cmd.options.text,
8681
+ choices,
8682
+ interactive: true,
8683
+ });
8684
+ };
8685
+ const textParser = (ctx) => {
8686
+ const { command, line } = ctx;
8687
+ command.commandType = 'text';
8688
+ command.options = {
8689
+ text: line.operator,
8690
+ };
8691
+ ctx.currentLine++;
8692
+ };
8693
+ const textCommandPlugin = new CommandPlugin('text', text, textParser);
8694
+
8695
+ const wait = async (context, cmd) => {
8696
+ const { dispatch } = context;
8697
+ await timeout(cmd.options.duration);
8698
+ return dispatch('nextLine');
8699
+ };
8700
+ const waitParser = (ctx) => {
8701
+ const { command } = ctx;
8702
+ command.commandType = 'wait';
8703
+ command.options = {
8704
+ duration: parseInt(command.args[0], 10),
8705
+ };
8706
+ ctx.currentLine++;
8707
+ };
8708
+ const waitCommand = new CommandPlugin('wait', wait, waitParser);
8709
+
8710
+ function registerBaseCommands(vm) {
8711
+ vm.addCommand(addLevelPlugin);
8712
+ vm.addCommand(addStatPlugin);
8713
+ vm.addCommand(addXpPlugin);
8714
+ vm.addCommand(addPlugin);
8715
+ vm.addCommand(choicePlugin);
8716
+ vm.addCommand(clearDialogPlugin);
8717
+ vm.addCommand(ifCommand);
8718
+ vm.addCommand(jumpCommand);
8719
+ vm.addCommand(notifyPlugin);
8720
+ vm.addCommand(pauseCommand);
8721
+ vm.addCommand(playCommand);
8722
+ vm.addCommand(setButtonCommand);
8723
+ vm.addCommand(setScreenCommand);
8724
+ vm.addCommand(setStatCommand);
8725
+ vm.addCommand(setCommand);
8726
+ vm.addCommand(stopCommand);
8727
+ vm.addCommand(talkCommand);
8728
+ vm.addCommand(textCommandPlugin);
8729
+ vm.addCommand(waitCommand);
8730
+ }
8731
+
8732
+ class NarratPlugin {
8733
+ onPageLoaded() { }
8734
+ onNarratSetup() { }
8735
+ onAppMounted() { }
8736
+ onAssetsLoaded() { }
8737
+ onGameSetup() { }
8738
+ onGameStart() { }
8739
+ onGameMounted() { }
8740
+ onGameDismounted() { }
8741
+ }
8742
+
8743
+ function registerPlugin(plugin) {
8744
+ vm$1.addPlugin(plugin);
8745
+ }
8746
+ function addCommand(command) {
8747
+ vm$1.addCommand(command);
8629
8748
  }
8630
8749
 
8631
8750
  let app;
8632
8751
  let store$2;
8752
+ vm$1.callHook('onPageLoaded');
8633
8753
  async function startApp(config, options) {
8754
+ registerBaseCommands(vm$1);
8634
8755
  logManager.setupDebugger(options.debug);
8635
8756
  const configFile = await getFile('data/config.json');
8636
8757
  setConfig(JSON.parse(configFile));
8637
- console.log('%c Narrat game engine – 0.10.0 - June 8, 2022 02:13:08', 'background: #222; color: #bada55');
8758
+ console.log('%c Narrat game engine – 0.11.2 - June 15, 2022 15:56:51', 'background: #222; color: #bada55');
8759
+ vm$1.callHook('onNarratSetup');
8638
8760
  const storeSetup = setupStore(options);
8639
8761
  store$2 = storeSetup.store;
8640
8762
  app = vue.createApp(script$b, {
@@ -8656,6 +8778,10 @@ async function startApp(config, options) {
8656
8778
  store: store$2,
8657
8779
  app,
8658
8780
  state: store$2.state,
8781
+ vm: vm$1,
8782
+ jump: (label) => {
8783
+ store$2.dispatch('runLabel', label);
8784
+ },
8659
8785
  };
8660
8786
  window.narrat = narrat;
8661
8787
  }
@@ -8670,5 +8796,14 @@ async function startApp(config, options) {
8670
8796
  startGameLoop(store$2);
8671
8797
  }
8672
8798
 
8799
+ exports.CommandPlugin = CommandPlugin;
8800
+ exports.NarratPlugin = NarratPlugin;
8801
+ exports.addCommand = addCommand;
8802
+ exports.aspectRatioFit = aspectRatioFit;
8803
+ exports.generateParser = generateParser;
8804
+ exports.getConfig = getConfig;
8805
+ exports.getSkillConfig = getSkillConfig;
8806
+ exports.registerPlugin = registerPlugin;
8807
+ exports.setConfig = setConfig;
8673
8808
  exports.startApp = startApp;
8674
8809
  //# sourceMappingURL=index.js.map