narrat 0.9.4 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +30 -30
- package/lib/components/Skills.vue.d.ts +4 -0
- package/lib/demo/bitsy/bitsy.d.ts +27 -0
- package/lib/dialog-box.vue.d.ts +1 -0
- package/lib/display.d.ts +2 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.esm.js +1302 -903
- package/lib/index.js +1303 -901
- package/lib/plugins/NarratPlugin.d.ts +11 -0
- package/lib/plugins.d.ts +22 -0
- package/lib/utils/error-handling.d.ts +1 -1
- package/lib/utils/logger.d.ts +9 -5
- package/lib/utils/skillchecks.d.ts +18 -0
- package/lib/vm/commands/add.d.ts +3 -0
- package/lib/vm/commands/add_level.d.ts +2 -0
- package/lib/vm/commands/add_stat.d.ts +3 -0
- package/lib/vm/commands/add_xp.d.ts +2 -0
- package/lib/vm/commands/choice.d.ts +6 -0
- package/lib/vm/commands/clear_dialog.d.ts +3 -0
- package/lib/vm/commands/command-plugin.d.ts +22 -0
- package/lib/vm/commands/if.d.ts +2 -0
- package/lib/vm/commands/index.d.ts +2 -0
- package/lib/vm/commands/jump.d.ts +2 -0
- package/lib/vm/commands/notify.d.ts +2 -0
- package/lib/vm/commands/pause.d.ts +2 -0
- package/lib/vm/commands/play.d.ts +3 -0
- package/lib/vm/commands/set.d.ts +2 -0
- package/lib/vm/commands/set_button.d.ts +2 -0
- package/lib/vm/commands/set_screen.d.ts +3 -0
- package/lib/vm/commands/set_stat.d.ts +3 -0
- package/lib/vm/commands/stop.d.ts +2 -0
- package/lib/vm/commands/talk.d.ts +2 -0
- package/lib/vm/commands/text.d.ts +2 -0
- package/lib/vm/commands/wait.d.ts +2 -0
- package/lib/vm/vm-helpers.d.ts +17 -0
- package/lib/vm/vm-parser.d.ts +9 -0
- package/lib/vm/vm.d.ts +20 -0
- package/package.json +85 -84
- package/CHANGELOG.md +0 -255
package/lib/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Version: 0.
|
|
1
|
+
// Version: 0.11.1 - June 15, 2022 15:34:03
|
|
2
2
|
import 'es6-promise/auto';
|
|
3
|
-
import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, createBlock, Transition, withCtx,
|
|
3
|
+
import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, normalizeClass, createBlock, Transition, withCtx, renderSlot, createTextVNode, resolveComponent, withDirectives, vModelText, toDisplayString, TransitionGroup, createVNode, createApp } from 'vue';
|
|
4
4
|
import { createLogger, createStore } from 'vuex';
|
|
5
5
|
|
|
6
6
|
function styleInject(css, ref) {
|
|
@@ -30,7 +30,7 @@ function styleInject(css, ref) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
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}\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@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";
|
|
33
|
+
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";
|
|
34
34
|
styleInject(css_248z);
|
|
35
35
|
|
|
36
36
|
const f=ref([]),v=ref(null),m=ref(null),g=ref(null),h=reactive({current:""}),y=[],b=ref(!1),k=readonly(f),w=readonly(v),M=readonly(m),q=readonly(g),x=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;}};
|
|
@@ -135,7 +135,7 @@ var script = defineComponent({
|
|
|
135
135
|
dialogBoxStyle() {
|
|
136
136
|
const style = getCharacterStyle(this.options.styleId);
|
|
137
137
|
const css = {
|
|
138
|
-
opacity: this.options.old ? '0.
|
|
138
|
+
opacity: this.options.old ? '0.7' : '1',
|
|
139
139
|
};
|
|
140
140
|
if (!this.options.title) {
|
|
141
141
|
css.marginTop = '-20px';
|
|
@@ -158,7 +158,10 @@ var script = defineComponent({
|
|
|
158
158
|
return undefined;
|
|
159
159
|
},
|
|
160
160
|
canInteract() {
|
|
161
|
-
return this.active &&
|
|
161
|
+
return (this.active &&
|
|
162
|
+
!this.passed &&
|
|
163
|
+
this.options.interactive &&
|
|
164
|
+
!this.$store.state.paused);
|
|
162
165
|
},
|
|
163
166
|
},
|
|
164
167
|
methods: {
|
|
@@ -174,6 +177,11 @@ var script = defineComponent({
|
|
|
174
177
|
}
|
|
175
178
|
return style;
|
|
176
179
|
},
|
|
180
|
+
dialogClass(choice) {
|
|
181
|
+
if (!choice.allowed) {
|
|
182
|
+
return 'strike-anim';
|
|
183
|
+
}
|
|
184
|
+
},
|
|
177
185
|
},
|
|
178
186
|
});
|
|
179
187
|
|
|
@@ -221,10 +229,10 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
221
229
|
return (openBlock(), createElementBlock("p", {
|
|
222
230
|
key: index,
|
|
223
231
|
style: normalizeStyle(_ctx.dialogStyle(choice)),
|
|
232
|
+
class: normalizeClass([_ctx.dialogClass(choice), "dialog-choice override"]),
|
|
224
233
|
onClick: $event => (_ctx.chooseOption(choice)),
|
|
225
|
-
class: "dialog-choice override",
|
|
226
234
|
innerHTML: `${index + 1}. – ${choice.choice}`
|
|
227
|
-
}, null,
|
|
235
|
+
}, null, 14, _hoisted_6))
|
|
228
236
|
}), 128))
|
|
229
237
|
]))
|
|
230
238
|
: (_ctx.canInteract)
|
|
@@ -239,7 +247,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
239
247
|
], 4))
|
|
240
248
|
}
|
|
241
249
|
|
|
242
|
-
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:
|
|
250
|
+
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";
|
|
243
251
|
styleInject(css_248z$1);
|
|
244
252
|
|
|
245
253
|
script.render = render;
|
|
@@ -275,6 +283,9 @@ const defaultConfig = {
|
|
|
275
283
|
},
|
|
276
284
|
buttons: {},
|
|
277
285
|
skills: {},
|
|
286
|
+
skillOptions: {
|
|
287
|
+
xpPerLevel: 10,
|
|
288
|
+
},
|
|
278
289
|
skillChecks: {
|
|
279
290
|
rollRange: 100,
|
|
280
291
|
skillMultiplier: 10,
|
|
@@ -319,8 +330,22 @@ function setConfig(conf) {
|
|
|
319
330
|
}
|
|
320
331
|
function getConfig() {
|
|
321
332
|
return config$1;
|
|
333
|
+
}
|
|
334
|
+
function getSkillConfig(commit, id) {
|
|
335
|
+
const skill = config$1.skills[id];
|
|
336
|
+
if (!skill) {
|
|
337
|
+
error(commit, `Skill config for skill ${id} doesn't exist`);
|
|
338
|
+
}
|
|
339
|
+
return skill;
|
|
322
340
|
}
|
|
323
341
|
|
|
342
|
+
var config$2 = /*#__PURE__*/Object.freeze({
|
|
343
|
+
__proto__: null,
|
|
344
|
+
setConfig: setConfig,
|
|
345
|
+
getConfig: getConfig,
|
|
346
|
+
getSkillConfig: getSkillConfig
|
|
347
|
+
});
|
|
348
|
+
|
|
324
349
|
var script$1 = defineComponent({
|
|
325
350
|
props: {
|
|
326
351
|
pictureUrl: String,
|
|
@@ -362,26 +387,25 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
362
387
|
], 4))
|
|
363
388
|
}
|
|
364
389
|
|
|
365
|
-
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";
|
|
390
|
+
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";
|
|
366
391
|
styleInject(css_248z$2);
|
|
367
392
|
|
|
368
393
|
script$1.render = render$1;
|
|
369
394
|
|
|
370
|
-
class
|
|
395
|
+
class LogManager {
|
|
371
396
|
debug;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
|
|
397
|
+
logger = {
|
|
398
|
+
log: () => { },
|
|
399
|
+
};
|
|
400
|
+
setupDebugger(debug) {
|
|
376
401
|
this.debug = debug;
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (this.debug) {
|
|
380
|
-
console.log(...args);
|
|
402
|
+
if (debug) {
|
|
403
|
+
this.logger.log = console.log.bind(window.console);
|
|
381
404
|
}
|
|
382
405
|
}
|
|
383
406
|
}
|
|
384
|
-
const
|
|
407
|
+
const logManager = new LogManager();
|
|
408
|
+
const logger = logManager.logger;
|
|
385
409
|
|
|
386
410
|
function getPlayTime(startedAt, previousTime) {
|
|
387
411
|
return Date.now() - startedAt + previousTime;
|
|
@@ -452,7 +476,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
452
476
|
}))
|
|
453
477
|
}
|
|
454
478
|
|
|
455
|
-
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";
|
|
479
|
+
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";
|
|
456
480
|
styleInject(css_248z$3);
|
|
457
481
|
|
|
458
482
|
script$2.render = render$2;
|
|
@@ -2695,7 +2719,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2695
2719
|
]))
|
|
2696
2720
|
}
|
|
2697
2721
|
|
|
2698
|
-
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";
|
|
2722
|
+
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";
|
|
2699
2723
|
styleInject(css_248z$4);
|
|
2700
2724
|
|
|
2701
2725
|
script$3.render = render$3;
|
|
@@ -5999,7 +6023,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
5999
6023
|
]))
|
|
6000
6024
|
}
|
|
6001
6025
|
|
|
6002
|
-
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";
|
|
6026
|
+
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";
|
|
6003
6027
|
styleInject(css_248z$5);
|
|
6004
6028
|
|
|
6005
6029
|
script$4.render = render$4;
|
|
@@ -6055,7 +6079,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6055
6079
|
], 4))
|
|
6056
6080
|
}
|
|
6057
6081
|
|
|
6058
|
-
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";
|
|
6082
|
+
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";
|
|
6059
6083
|
styleInject(css_248z$6);
|
|
6060
6084
|
|
|
6061
6085
|
script$5.render = render$5;
|
|
@@ -6092,7 +6116,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6092
6116
|
]))
|
|
6093
6117
|
}
|
|
6094
6118
|
|
|
6095
|
-
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";
|
|
6119
|
+
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";
|
|
6096
6120
|
styleInject(css_248z$7);
|
|
6097
6121
|
|
|
6098
6122
|
script$6.render = render$6;
|
|
@@ -6127,7 +6151,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6127
6151
|
}))
|
|
6128
6152
|
}
|
|
6129
6153
|
|
|
6130
|
-
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";
|
|
6154
|
+
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";
|
|
6131
6155
|
styleInject(css_248z$8);
|
|
6132
6156
|
|
|
6133
6157
|
script$7.render = render$7;
|
|
@@ -6349,18 +6373,12 @@ function stopAudio(commit, key) {
|
|
|
6349
6373
|
if (sound) {
|
|
6350
6374
|
sound.stop();
|
|
6351
6375
|
}
|
|
6352
|
-
else {
|
|
6353
|
-
error(commit, `Sound effect ${key} not found!`);
|
|
6354
|
-
}
|
|
6355
6376
|
}
|
|
6356
6377
|
function pauseAudio(commit, key) {
|
|
6357
6378
|
const sound = getAudio(key);
|
|
6358
6379
|
if (sound) {
|
|
6359
6380
|
sound.pause();
|
|
6360
6381
|
}
|
|
6361
|
-
else {
|
|
6362
|
-
error(commit, `Sound effect ${key} not found!`);
|
|
6363
|
-
}
|
|
6364
6382
|
}
|
|
6365
6383
|
|
|
6366
6384
|
function debounce(func, waitMilliseconds = 50, options = {}) {
|
|
@@ -6415,122 +6433,439 @@ function debounce(func, waitMilliseconds = 50, options = {}) {
|
|
|
6415
6433
|
return debouncedFunction;
|
|
6416
6434
|
}
|
|
6417
6435
|
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6436
|
+
function createSkillCheckState() {
|
|
6437
|
+
const skillCheck = {
|
|
6438
|
+
passed: false,
|
|
6439
|
+
available: true,
|
|
6440
|
+
};
|
|
6441
|
+
return skillCheck;
|
|
6442
|
+
}
|
|
6443
|
+
function getSkillCheckState(ctx, skillCheckId) {
|
|
6444
|
+
let skillCheck = ctx.state.skillChecks[skillCheckId];
|
|
6445
|
+
if (!skillCheck) {
|
|
6446
|
+
skillCheck = createSkillCheckState();
|
|
6447
|
+
ctx.commit('setupSkillCheck', {
|
|
6448
|
+
skillCheck,
|
|
6449
|
+
skillCheckId,
|
|
6432
6450
|
});
|
|
6433
|
-
}
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
showSkills() {
|
|
6450
|
-
if (Object.entries(getConfig().skills).length > 0) {
|
|
6451
|
-
return true;
|
|
6451
|
+
}
|
|
6452
|
+
return skillCheck;
|
|
6453
|
+
}
|
|
6454
|
+
function getSkillCheckDifficultyScore(value, level) {
|
|
6455
|
+
return value - level * getConfig().skillChecks.skillMultiplier;
|
|
6456
|
+
}
|
|
6457
|
+
function getSkillCheckDifficultyText(value, level) {
|
|
6458
|
+
const difficultyScore = getSkillCheckDifficultyScore(value, level);
|
|
6459
|
+
const checks = getConfig().skillChecks;
|
|
6460
|
+
let found = false;
|
|
6461
|
+
let i = 0;
|
|
6462
|
+
let checkText = checks.difficultyText[0][1];
|
|
6463
|
+
while (!found) {
|
|
6464
|
+
if (checks.difficultyText.length > i) {
|
|
6465
|
+
if (difficultyScore >= checks.difficultyText[i][0]) {
|
|
6466
|
+
checkText = checks.difficultyText[i][1];
|
|
6452
6467
|
}
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
}
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6468
|
+
else {
|
|
6469
|
+
found = true;
|
|
6470
|
+
}
|
|
6471
|
+
}
|
|
6472
|
+
else {
|
|
6473
|
+
found = true;
|
|
6474
|
+
}
|
|
6475
|
+
i++;
|
|
6476
|
+
}
|
|
6477
|
+
return checkText;
|
|
6478
|
+
}
|
|
6479
|
+
function getSkillCheckText({ context, skill, skillCheckId, value, }) {
|
|
6480
|
+
const skillCheckState = getSkillCheckState(context, skillCheckId);
|
|
6481
|
+
const skillConfig = getSkillConfig(context.commit, skill);
|
|
6482
|
+
const level = context.state.skills[skill].level;
|
|
6483
|
+
const difficultyText = getSkillCheckDifficultyText(value, level);
|
|
6484
|
+
let allowed = true;
|
|
6485
|
+
let text = `<span class='skill-check'>[<span class='skill-check-name'>${skillConfig.name}</span> - `;
|
|
6486
|
+
if (skillCheckState.available) {
|
|
6487
|
+
text += ` <span class='skill-check-difficulty'>${difficultyText}</span>]</span>`;
|
|
6488
|
+
}
|
|
6489
|
+
else if (skillCheckState.passed) {
|
|
6490
|
+
text = '';
|
|
6491
|
+
}
|
|
6492
|
+
else {
|
|
6493
|
+
allowed = false;
|
|
6494
|
+
text += ` <span class='skill-check-difficulty'>${difficultyText}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`;
|
|
6495
|
+
}
|
|
6496
|
+
return {
|
|
6497
|
+
difficultyText: text,
|
|
6498
|
+
allowed,
|
|
6499
|
+
};
|
|
6500
|
+
}
|
|
6501
|
+
function getPassiveSkillCheckText(ctx, success, params) {
|
|
6502
|
+
const skillConf = getSkillConfig(ctx.commit, params.skill);
|
|
6503
|
+
const difficultyText = getSkillCheckDifficultyText(params.value, ctx.state.skills[params.skill].level);
|
|
6504
|
+
return `<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${skillConf.name}</span> - <span class='skill-check-difficulty'>${difficultyText}</span> - ${success
|
|
6505
|
+
? '<span class="skill-check-success">Success</span>'
|
|
6506
|
+
: '<span class="skill-check-failed">Failure</span>'}]</span>`;
|
|
6507
|
+
}
|
|
6508
|
+
function calculateSkillCheckRoll(state, skill) {
|
|
6509
|
+
const { skillChecks } = getConfig();
|
|
6510
|
+
const unmodifiedRoll = Math.floor(Math.random() * skillChecks.rollRange);
|
|
6511
|
+
const rollModifier = state.skills[skill].level * skillChecks.skillMultiplier;
|
|
6512
|
+
const roll = unmodifiedRoll + rollModifier;
|
|
6513
|
+
logger.log(`[SKILL CHECK] Roll: ${roll}. (Base roll: ${unmodifiedRoll}, modifier: ${rollModifier} - Skill level: ${state.skills[skill].level})`);
|
|
6514
|
+
return {
|
|
6515
|
+
roll,
|
|
6516
|
+
unmodifiedRoll,
|
|
6517
|
+
};
|
|
6518
|
+
}
|
|
6519
|
+
function resolveSkillCheck(state, params) {
|
|
6520
|
+
const { skills, skillChecks } = getConfig();
|
|
6521
|
+
let success = true;
|
|
6522
|
+
const { roll } = calculateSkillCheckRoll(state, params.skill);
|
|
6523
|
+
if (roll <= skillChecks.failureChance - 1) {
|
|
6524
|
+
success = false;
|
|
6525
|
+
}
|
|
6526
|
+
const skill = skills[params.skill];
|
|
6527
|
+
if (roll < params.value) {
|
|
6528
|
+
success = false;
|
|
6529
|
+
}
|
|
6530
|
+
logger.log(`[SKILL CHECK ${skill.name}]: ${success ? '✅' : '❌'}`, `(${params.id}) - ${roll}/${params.value}`);
|
|
6531
|
+
return success;
|
|
6476
6532
|
}
|
|
6477
6533
|
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6534
|
+
function processSkillCheck(ctx, skillcheck) {
|
|
6535
|
+
return runSkillCheck(ctx, {
|
|
6536
|
+
skill: skillcheck.skill,
|
|
6537
|
+
value: skillcheck.value,
|
|
6538
|
+
id: skillcheck.id,
|
|
6539
|
+
success: skillcheck.success.text,
|
|
6540
|
+
failure: skillcheck.failure.text,
|
|
6541
|
+
});
|
|
6542
|
+
}
|
|
6543
|
+
function runSkillCheck(ctx, params) {
|
|
6544
|
+
const { state } = ctx;
|
|
6545
|
+
const success = resolveSkillCheck(state, params);
|
|
6546
|
+
writeText(ctx, getPassiveSkillCheckText(ctx, success, params));
|
|
6547
|
+
if (success) {
|
|
6548
|
+
ctx.commit('passSkillCheck', params.id);
|
|
6549
|
+
return true;
|
|
6550
|
+
}
|
|
6551
|
+
ctx.commit('failSkillCheck', params.id);
|
|
6552
|
+
return false;
|
|
6553
|
+
}
|
|
6554
|
+
function runConditionCommand(ctx, command) {
|
|
6555
|
+
const options = command.options;
|
|
6556
|
+
const result = runCondition(ctx, options.condition);
|
|
6557
|
+
logger.log(result);
|
|
6558
|
+
if (result) {
|
|
6559
|
+
return options.success;
|
|
6560
|
+
}
|
|
6561
|
+
if (!result && options.failure) {
|
|
6562
|
+
return options.failure;
|
|
6563
|
+
}
|
|
6564
|
+
return undefined;
|
|
6565
|
+
}
|
|
6566
|
+
function writeText(ctx, text) {
|
|
6567
|
+
const dialog = {
|
|
6568
|
+
speaker: 'game',
|
|
6569
|
+
text,
|
|
6570
|
+
interactive: false,
|
|
6571
|
+
};
|
|
6572
|
+
ctx.commit('addDialog', {
|
|
6573
|
+
dialog,
|
|
6574
|
+
});
|
|
6575
|
+
}
|
|
6576
|
+
function runCondition(ctx, condition) {
|
|
6577
|
+
return conditionFunction(ctx, condition);
|
|
6578
|
+
}
|
|
6579
|
+
function conditionFunction(ctx, condition) {
|
|
6580
|
+
const { state } = ctx;
|
|
6581
|
+
const context = {
|
|
6582
|
+
data: state.machine.data,
|
|
6583
|
+
skills: state.skills,
|
|
6584
|
+
skillChecks: state.skillChecks,
|
|
6585
|
+
stats: state.hudStats,
|
|
6586
|
+
roll: (checkId, skill, value) => {
|
|
6587
|
+
const skillCheckState = getSkillCheckState(ctx, checkId);
|
|
6588
|
+
if (skillCheckState) {
|
|
6589
|
+
if (skillCheckState.passed) {
|
|
6590
|
+
return true;
|
|
6591
|
+
}
|
|
6592
|
+
if (!skillCheckState.available) {
|
|
6593
|
+
return false;
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
return runSkillCheck(ctx, {
|
|
6597
|
+
skill,
|
|
6598
|
+
value,
|
|
6599
|
+
id: checkId,
|
|
6600
|
+
});
|
|
6507
6601
|
},
|
|
6508
|
-
}
|
|
6509
|
-
|
|
6510
|
-
}
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6602
|
+
};
|
|
6603
|
+
return evalInContext(`(${condition})`, context);
|
|
6604
|
+
}
|
|
6605
|
+
function evalInContext(script, context) {
|
|
6606
|
+
// # Return the results of the in-line anonymous function we .call with the passed context
|
|
6607
|
+
return function () {
|
|
6608
|
+
return eval(script);
|
|
6609
|
+
}.call(context);
|
|
6610
|
+
}
|
|
6611
|
+
async function textCommand(commit, dialog) {
|
|
6612
|
+
commit('addDialog', {
|
|
6613
|
+
dialog,
|
|
6614
|
+
});
|
|
6615
|
+
}
|
|
6616
|
+
function getLine(lines, index) {
|
|
6617
|
+
if (index < lines.length)
|
|
6618
|
+
return lines[index];
|
|
6619
|
+
}
|
|
6518
6620
|
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6621
|
+
async function runLine(context) {
|
|
6622
|
+
const cmd = context.getters.currentLine;
|
|
6623
|
+
await runCommand(context, cmd);
|
|
6624
|
+
}
|
|
6625
|
+
class VM$1 {
|
|
6626
|
+
plugins = [];
|
|
6627
|
+
commands = {};
|
|
6628
|
+
addCommand(command) {
|
|
6629
|
+
this.commands[command.keyword] = command;
|
|
6630
|
+
}
|
|
6631
|
+
addPlugin(plugin) {
|
|
6632
|
+
this.plugins.push(plugin);
|
|
6633
|
+
if (plugin.customCommands) {
|
|
6634
|
+
for (const command of plugin.customCommands) {
|
|
6635
|
+
this.addCommand(command);
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
callHook(hookName, ...args) {
|
|
6640
|
+
for (const plugin of this.plugins) {
|
|
6641
|
+
if (typeof plugin[hookName] === 'function') {
|
|
6642
|
+
plugin[hookName](...args);
|
|
6643
|
+
}
|
|
6644
|
+
}
|
|
6645
|
+
}
|
|
6646
|
+
}
|
|
6647
|
+
const vm$1 = new VM$1();
|
|
6648
|
+
async function runCommand(context, cmd, choices) {
|
|
6649
|
+
const { state, commit } = context;
|
|
6650
|
+
try {
|
|
6651
|
+
const commandPlugin = vm$1.commands[cmd.commandType];
|
|
6652
|
+
if (commandPlugin) {
|
|
6653
|
+
commandPlugin.runner(context, cmd, choices);
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
catch (err) {
|
|
6657
|
+
logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
|
|
6658
|
+
console.error(err);
|
|
6659
|
+
error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
|
|
6660
|
+
<b>${err}</b>
|
|
6661
|
+
Script: ${cmd.code}
|
|
6662
|
+
Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
async function playerAnswered(context, choiceIndex) {
|
|
6666
|
+
const { commit, dispatch } = context;
|
|
6667
|
+
const cmd = context.getters.currentLine;
|
|
6668
|
+
switch (cmd.commandType) {
|
|
6669
|
+
case 'choice':
|
|
6670
|
+
const options = cmd.options;
|
|
6671
|
+
const choice = options.choices[choiceIndex];
|
|
6672
|
+
let playerText = choice.choice;
|
|
6673
|
+
let newBranch;
|
|
6674
|
+
const skillcheck = choice.skillCheck;
|
|
6675
|
+
if (skillcheck) {
|
|
6676
|
+
const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
|
|
6677
|
+
if (skillCheckState.passed) {
|
|
6678
|
+
newBranch = skillcheck.success.branch;
|
|
6679
|
+
playerText = skillcheck.success.text;
|
|
6680
|
+
}
|
|
6681
|
+
else {
|
|
6682
|
+
const result = processSkillCheck(context, skillcheck);
|
|
6683
|
+
const winner = result ? skillcheck.success : skillcheck.failure;
|
|
6684
|
+
newBranch = winner.branch;
|
|
6685
|
+
playerText = undefined;
|
|
6686
|
+
}
|
|
6687
|
+
}
|
|
6688
|
+
else {
|
|
6689
|
+
newBranch = choice.branch;
|
|
6690
|
+
}
|
|
6691
|
+
if (playerText) {
|
|
6692
|
+
// If the choice involves printing a player dialog, show it
|
|
6693
|
+
const dialog = {
|
|
6694
|
+
speaker: 'player',
|
|
6695
|
+
text: playerText,
|
|
6696
|
+
interactive: false,
|
|
6697
|
+
};
|
|
6698
|
+
commit('addDialog', { dialog });
|
|
6699
|
+
}
|
|
6700
|
+
if (newBranch) {
|
|
6701
|
+
const newStack = {
|
|
6702
|
+
currentIndex: 0,
|
|
6703
|
+
branch: newBranch,
|
|
6704
|
+
};
|
|
6705
|
+
commit('addStack', newStack);
|
|
6706
|
+
dispatch('runLine');
|
|
6707
|
+
}
|
|
6708
|
+
else {
|
|
6709
|
+
dispatch('nextLine');
|
|
6710
|
+
}
|
|
6711
|
+
break;
|
|
6712
|
+
default:
|
|
6713
|
+
dispatch('nextLine');
|
|
6714
|
+
}
|
|
6715
|
+
}
|
|
6716
|
+
async function nextLine(ctx) {
|
|
6717
|
+
const { state, getters, dispatch, commit } = ctx;
|
|
6718
|
+
if (state.machine.stack.length === 0) {
|
|
6719
|
+
finishGame(ctx);
|
|
6720
|
+
return;
|
|
6721
|
+
}
|
|
6722
|
+
const machineHead = getters.machineHead;
|
|
6723
|
+
if (machineHead.currentIndex < machineHead.branch.length - 1) {
|
|
6724
|
+
commit('nextLine');
|
|
6725
|
+
}
|
|
6726
|
+
else {
|
|
6727
|
+
// This branch is finished, go back to previous stack
|
|
6728
|
+
commit('previousStack');
|
|
6729
|
+
return dispatch('nextLine');
|
|
6730
|
+
}
|
|
6731
|
+
if (state.machine.stack.length === 0) {
|
|
6732
|
+
finishGame(ctx);
|
|
6733
|
+
}
|
|
6734
|
+
else {
|
|
6735
|
+
return dispatch('runLine');
|
|
6736
|
+
}
|
|
6737
|
+
}
|
|
6738
|
+
function finishGame({ commit, state }) {
|
|
6739
|
+
if (state.options.debug) {
|
|
6740
|
+
commit('addDialog', {
|
|
6741
|
+
dialog: {
|
|
6742
|
+
speaker: 'game',
|
|
6743
|
+
text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
|
|
6744
|
+
},
|
|
6745
|
+
});
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
var script$8 = defineComponent({
|
|
6750
|
+
components: {},
|
|
6751
|
+
props: {},
|
|
6752
|
+
data() {
|
|
6753
|
+
return {
|
|
6754
|
+
activeMenu: false,
|
|
6755
|
+
};
|
|
6756
|
+
},
|
|
6757
|
+
mounted() {
|
|
6758
|
+
document.addEventListener('keydown', (event) => {
|
|
6759
|
+
const key = event.key;
|
|
6760
|
+
if (key === 'Escape') {
|
|
6761
|
+
this.toggleMenu();
|
|
6762
|
+
}
|
|
6763
|
+
});
|
|
6764
|
+
vm$1.callHook('onGameMounted');
|
|
6765
|
+
},
|
|
6766
|
+
unmounted() {
|
|
6767
|
+
vm$1.callHook('onGameUnmounted');
|
|
6768
|
+
},
|
|
6769
|
+
methods: {
|
|
6770
|
+
openMenu() {
|
|
6771
|
+
this.$store.commit('openModal', 'menu');
|
|
6772
|
+
},
|
|
6773
|
+
openSkills() {
|
|
6774
|
+
this.$store.commit('openModal', 'skills');
|
|
6775
|
+
},
|
|
6776
|
+
closeMenu() {
|
|
6777
|
+
this.$store.commit('closeModal');
|
|
6778
|
+
},
|
|
6779
|
+
toggleMenu() {
|
|
6780
|
+
this.$store.commit('toggleMenu');
|
|
6781
|
+
},
|
|
6782
|
+
},
|
|
6783
|
+
computed: {
|
|
6784
|
+
showSkills() {
|
|
6785
|
+
if (Object.entries(getConfig().skills).length > 0) {
|
|
6786
|
+
return true;
|
|
6787
|
+
}
|
|
6788
|
+
return false;
|
|
6789
|
+
},
|
|
6790
|
+
},
|
|
6791
|
+
});
|
|
6792
|
+
|
|
6793
|
+
const _hoisted_1$7 = { class: "menu-container" };
|
|
6794
|
+
|
|
6795
|
+
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6796
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
6797
|
+
createElementVNode("button", {
|
|
6798
|
+
class: "button menu-toggle-button",
|
|
6799
|
+
id: "menu-button",
|
|
6800
|
+
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.openMenu && _ctx.openMenu(...args)))
|
|
6801
|
+
}, " Menu "),
|
|
6802
|
+
(_ctx.showSkills)
|
|
6803
|
+
? (openBlock(), createElementBlock("button", {
|
|
6804
|
+
key: 0,
|
|
6805
|
+
class: "button menu-toggle-button",
|
|
6806
|
+
id: "skills-menu-button",
|
|
6807
|
+
onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.openSkills && _ctx.openSkills(...args)))
|
|
6808
|
+
}, " Skills "))
|
|
6809
|
+
: createCommentVNode("", true)
|
|
6810
|
+
]))
|
|
6811
|
+
}
|
|
6812
|
+
|
|
6813
|
+
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";
|
|
6814
|
+
styleInject(css_248z$9);
|
|
6815
|
+
|
|
6816
|
+
script$8.render = render$8;
|
|
6817
|
+
|
|
6818
|
+
var script$9 = defineComponent({
|
|
6819
|
+
components: {
|
|
6820
|
+
Modal: script$2,
|
|
6821
|
+
VolumeControls: script$4,
|
|
6822
|
+
},
|
|
6823
|
+
props: {},
|
|
6824
|
+
data() { },
|
|
6825
|
+
mounted() { },
|
|
6826
|
+
methods: {
|
|
6827
|
+
quit() {
|
|
6828
|
+
window.close();
|
|
6829
|
+
// quit
|
|
6830
|
+
},
|
|
6831
|
+
close() {
|
|
6832
|
+
this.$emit('close');
|
|
6833
|
+
},
|
|
6834
|
+
mainMenu() {
|
|
6835
|
+
this.$store.dispatch('menuReturn');
|
|
6836
|
+
this.$store.commit('setFlowState', 'menu');
|
|
6837
|
+
this.close();
|
|
6838
|
+
},
|
|
6839
|
+
getPlayTimeString() {
|
|
6840
|
+
const time = getPlayTime(this.$store.state.playTime.start, this.$store.state.playTime.previousPlaytime);
|
|
6841
|
+
return toHHMMSS(time / 1000);
|
|
6842
|
+
},
|
|
6843
|
+
},
|
|
6844
|
+
computed: {},
|
|
6845
|
+
});
|
|
6846
|
+
|
|
6847
|
+
const _hoisted_1$8 = /*#__PURE__*/createElementVNode("h3", { class: "title" }, "Menu", -1);
|
|
6848
|
+
const _hoisted_2$6 = { class: "menu-content" };
|
|
6849
|
+
|
|
6850
|
+
function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6851
|
+
const _component_VolumeControls = resolveComponent("VolumeControls");
|
|
6852
|
+
const _component_modal = resolveComponent("modal");
|
|
6853
|
+
|
|
6854
|
+
return (openBlock(), createBlock(_component_modal, {
|
|
6855
|
+
class: "menu",
|
|
6856
|
+
onClose: _ctx.close,
|
|
6857
|
+
containerCssClass: "menu-modal"
|
|
6858
|
+
}, {
|
|
6859
|
+
header: withCtx(() => [
|
|
6860
|
+
_hoisted_1$8
|
|
6861
|
+
]),
|
|
6862
|
+
body: withCtx(() => [
|
|
6863
|
+
createElementVNode("div", _hoisted_2$6, [
|
|
6864
|
+
createElementVNode("h3", null, "Play time: " + toDisplayString(_ctx.getPlayTimeString()), 1),
|
|
6865
|
+
createVNode(_component_VolumeControls),
|
|
6866
|
+
createElementVNode("button", {
|
|
6867
|
+
class: "button title quit-button",
|
|
6868
|
+
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.mainMenu && _ctx.mainMenu(...args)))
|
|
6534
6869
|
}, " Main Menu "),
|
|
6535
6870
|
createElementVNode("button", {
|
|
6536
6871
|
class: "button title quit-button",
|
|
@@ -6542,7 +6877,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6542
6877
|
}, 8, ["onClose"]))
|
|
6543
6878
|
}
|
|
6544
6879
|
|
|
6545
|
-
var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\n";
|
|
6880
|
+
var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\r\n";
|
|
6546
6881
|
styleInject(css_248z$a);
|
|
6547
6882
|
|
|
6548
6883
|
script$9.render = render$9;
|
|
@@ -6576,6 +6911,11 @@ var script$a = defineComponent({
|
|
|
6576
6911
|
closeSkill() {
|
|
6577
6912
|
this.chosenSkill = false;
|
|
6578
6913
|
},
|
|
6914
|
+
xpBarWidth(xp) {
|
|
6915
|
+
return {
|
|
6916
|
+
width: `${Math.floor((xp / this.xpPerLevel) * 100)}%`,
|
|
6917
|
+
};
|
|
6918
|
+
},
|
|
6579
6919
|
},
|
|
6580
6920
|
computed: {
|
|
6581
6921
|
skillsToDisplay() {
|
|
@@ -6595,6 +6935,9 @@ var script$a = defineComponent({
|
|
|
6595
6935
|
skillConf() {
|
|
6596
6936
|
return getConfig().skills;
|
|
6597
6937
|
},
|
|
6938
|
+
xpPerLevel() {
|
|
6939
|
+
return getConfig().skillOptions.xpPerLevel;
|
|
6940
|
+
},
|
|
6598
6941
|
},
|
|
6599
6942
|
});
|
|
6600
6943
|
|
|
@@ -6606,14 +6949,16 @@ const _hoisted_3$4 = {
|
|
|
6606
6949
|
};
|
|
6607
6950
|
const _hoisted_4$3 = ["onClick"];
|
|
6608
6951
|
const _hoisted_5$3 = { class: "skill-title" };
|
|
6609
|
-
const _hoisted_6$3 = { class: "skill-
|
|
6610
|
-
const _hoisted_7$2 = {
|
|
6952
|
+
const _hoisted_6$3 = { class: "skill-xp-container" };
|
|
6953
|
+
const _hoisted_7$2 = { class: "skill-xp-text" };
|
|
6954
|
+
const _hoisted_8$1 = { class: "skill-level" };
|
|
6955
|
+
const _hoisted_9$1 = {
|
|
6611
6956
|
key: 1,
|
|
6612
6957
|
class: "flex flex-row skill-description-container"
|
|
6613
6958
|
};
|
|
6614
|
-
const
|
|
6615
|
-
const
|
|
6616
|
-
const
|
|
6959
|
+
const _hoisted_10$1 = { class: "flex skill-left" };
|
|
6960
|
+
const _hoisted_11$1 = { class: "flex skill-right" };
|
|
6961
|
+
const _hoisted_12$1 = /*#__PURE__*/createElementVNode("hr", { class: "hr-solid" }, null, -1);
|
|
6617
6962
|
|
|
6618
6963
|
function render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6619
6964
|
const _component_modal = resolveComponent("modal");
|
|
@@ -6634,16 +6979,24 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6634
6979
|
return (openBlock(), createElementBlock("button", {
|
|
6635
6980
|
onClick: () => _ctx.clickSkill(key),
|
|
6636
6981
|
class: "skill-display",
|
|
6637
|
-
style: normalizeStyle(_ctx.getSkillStyle(key))
|
|
6982
|
+
style: normalizeStyle(_ctx.getSkillStyle(key)),
|
|
6983
|
+
key: key
|
|
6638
6984
|
}, [
|
|
6639
6985
|
createElementVNode("h3", _hoisted_5$3, toDisplayString(_ctx.getSkillName(key)), 1),
|
|
6640
|
-
createElementVNode("
|
|
6986
|
+
createElementVNode("div", _hoisted_6$3, [
|
|
6987
|
+
createElementVNode("div", {
|
|
6988
|
+
class: "skill-xp-bar",
|
|
6989
|
+
style: normalizeStyle(_ctx.xpBarWidth(skill.xp))
|
|
6990
|
+
}, null, 4),
|
|
6991
|
+
createElementVNode("h3", _hoisted_7$2, toDisplayString(skill.xp) + " / " + toDisplayString(_ctx.xpPerLevel) + " XP ", 1)
|
|
6992
|
+
]),
|
|
6993
|
+
createElementVNode("h3", _hoisted_8$1, toDisplayString(skill.level), 1)
|
|
6641
6994
|
], 12, _hoisted_4$3))
|
|
6642
|
-
}),
|
|
6995
|
+
}), 128))
|
|
6643
6996
|
]))
|
|
6644
6997
|
: (typeof _ctx.chosenSkill === 'string')
|
|
6645
|
-
? (openBlock(), createElementBlock("div",
|
|
6646
|
-
createElementVNode("div",
|
|
6998
|
+
? (openBlock(), createElementBlock("div", _hoisted_9$1, [
|
|
6999
|
+
createElementVNode("div", _hoisted_10$1, [
|
|
6647
7000
|
createElementVNode("button", {
|
|
6648
7001
|
class: "button",
|
|
6649
7002
|
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.closeSkill && _ctx.closeSkill(...args)))
|
|
@@ -6653,9 +7006,9 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6653
7006
|
style: normalizeStyle(_ctx.getSkillStyle(_ctx.chosenSkill))
|
|
6654
7007
|
}, null, 4)
|
|
6655
7008
|
]),
|
|
6656
|
-
createElementVNode("div",
|
|
7009
|
+
createElementVNode("div", _hoisted_11$1, [
|
|
6657
7010
|
createElementVNode("h2", null, toDisplayString(_ctx.getSkillName(_ctx.chosenSkill)), 1),
|
|
6658
|
-
|
|
7011
|
+
_hoisted_12$1,
|
|
6659
7012
|
createElementVNode("h3", null, "Level: " + toDisplayString(_ctx.skills[_ctx.chosenSkill].level), 1),
|
|
6660
7013
|
createElementVNode("p", null, toDisplayString(_ctx.skillConf[_ctx.chosenSkill].description), 1)
|
|
6661
7014
|
])
|
|
@@ -6667,7 +7020,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6667
7020
|
}, 8, ["onClose"]))
|
|
6668
7021
|
}
|
|
6669
7022
|
|
|
6670
|
-
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:
|
|
7023
|
+
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";
|
|
6671
7024
|
styleInject(css_248z$b);
|
|
6672
7025
|
|
|
6673
7026
|
script$a.render = render$a;
|
|
@@ -6703,6 +7056,7 @@ var script$b = defineComponent({
|
|
|
6703
7056
|
options: Object,
|
|
6704
7057
|
},
|
|
6705
7058
|
async mounted() {
|
|
7059
|
+
vm$1.callHook('onAppMounted');
|
|
6706
7060
|
this.loadingStep = 'Characters';
|
|
6707
7061
|
const charsFile = await getFile('data/characters.json');
|
|
6708
7062
|
await setCharactersConfig(JSON.parse(charsFile));
|
|
@@ -6714,9 +7068,11 @@ var script$b = defineComponent({
|
|
|
6714
7068
|
this.loadingPercentage = 0.7;
|
|
6715
7069
|
this.loadingStep = 'Audio';
|
|
6716
7070
|
await loadAudioAssets(getConfig());
|
|
7071
|
+
vm$1.callHook('onAssetsLoaded');
|
|
6717
7072
|
this.loadingPercentage = 0.95;
|
|
6718
7073
|
this.loadingStep = 'Starting...';
|
|
6719
7074
|
await this.setupMachine();
|
|
7075
|
+
vm$1.callHook('onGameSetup');
|
|
6720
7076
|
this.loadingPercentage = 0.1;
|
|
6721
7077
|
this.gameLoaded = true;
|
|
6722
7078
|
const save = this.getSaveFile();
|
|
@@ -7044,7 +7400,8 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7044
7400
|
createElementVNode("canvas", {
|
|
7045
7401
|
width: _ctx.layoutWidth,
|
|
7046
7402
|
height: _ctx.layoutHeight,
|
|
7047
|
-
id: "background-canvas"
|
|
7403
|
+
id: "background-canvas",
|
|
7404
|
+
class: "narrat-canvas"
|
|
7048
7405
|
}, null, 8, _hoisted_1$a)
|
|
7049
7406
|
], 4))
|
|
7050
7407
|
: createCommentVNode("", true),
|
|
@@ -7108,655 +7465,37 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7108
7465
|
], 4))
|
|
7109
7466
|
}
|
|
7110
7467
|
|
|
7111
|
-
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";
|
|
7468
|
+
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";
|
|
7112
7469
|
styleInject(css_248z$c);
|
|
7113
7470
|
|
|
7114
7471
|
script$b.render = render$b;
|
|
7115
7472
|
|
|
7116
|
-
function
|
|
7117
|
-
const
|
|
7118
|
-
|
|
7119
|
-
|
|
7473
|
+
function parseScript(errorHandler, code, fileName) {
|
|
7474
|
+
const ctx = {
|
|
7475
|
+
fileName,
|
|
7476
|
+
error: (line, text) => errorHandler(ctx, line, text),
|
|
7477
|
+
processCommandsFunction: processCommands,
|
|
7478
|
+
indentSize: 0, // Will be overriden soon
|
|
7120
7479
|
};
|
|
7121
|
-
|
|
7480
|
+
ctx.indentSize = detectIndentation(ctx, code);
|
|
7481
|
+
const lines = findLines(ctx, code);
|
|
7482
|
+
logger.log(lines);
|
|
7483
|
+
const script = {};
|
|
7484
|
+
for (const line of lines) {
|
|
7485
|
+
if (line.code.search(':') === -1) {
|
|
7486
|
+
ctx.error(line.line, `First indentation level should only be used to specify labels`);
|
|
7487
|
+
}
|
|
7488
|
+
const labelName = line.code.replace(':', '');
|
|
7489
|
+
if (!line.branch) {
|
|
7490
|
+
ctx.error(line.line, `This line should have a branch but doesn't`);
|
|
7491
|
+
}
|
|
7492
|
+
script[labelName] = processCommands(ctx, line.branch, undefined);
|
|
7493
|
+
}
|
|
7494
|
+
return script;
|
|
7122
7495
|
}
|
|
7123
|
-
function
|
|
7124
|
-
let skillCheck = ctx.state.skillChecks[skillCheckId];
|
|
7125
|
-
if (!skillCheck) {
|
|
7126
|
-
skillCheck = createSkillCheckState();
|
|
7127
|
-
ctx.commit('setupSkillCheck', {
|
|
7128
|
-
skillCheck,
|
|
7129
|
-
skillCheckId,
|
|
7130
|
-
});
|
|
7131
|
-
}
|
|
7132
|
-
return skillCheck;
|
|
7133
|
-
}
|
|
7134
|
-
|
|
7135
|
-
function processSkillCheck(ctx, skillcheck) {
|
|
7136
|
-
return runSkillCheck(ctx, {
|
|
7137
|
-
skill: skillcheck.skill,
|
|
7138
|
-
value: skillcheck.value,
|
|
7139
|
-
id: skillcheck.id,
|
|
7140
|
-
success: skillcheck.success.text,
|
|
7141
|
-
failure: skillcheck.failure.text,
|
|
7142
|
-
});
|
|
7143
|
-
}
|
|
7144
|
-
function runSkillCheck(ctx, params) {
|
|
7145
|
-
const { state } = ctx;
|
|
7146
|
-
const { skills, skillChecks } = getConfig();
|
|
7147
|
-
let success = true;
|
|
7148
|
-
let roll = Math.floor(Math.random() * skillChecks.rollRange);
|
|
7149
|
-
if (roll <= skillChecks.failureChance - 1) {
|
|
7150
|
-
success = false;
|
|
7151
|
-
}
|
|
7152
|
-
roll += state.skills[params.skill].level * skillChecks.skillMultiplier;
|
|
7153
|
-
const skill = skills[params.skill];
|
|
7154
|
-
logger.log(`roll `, roll, params.value);
|
|
7155
|
-
if (roll < params.value) {
|
|
7156
|
-
success = false;
|
|
7157
|
-
}
|
|
7158
|
-
if (success) {
|
|
7159
|
-
ctx.commit('passSkillCheck', params.id);
|
|
7160
|
-
writeText(ctx, `[${skill.name} - Success] ${params.success || ''}`);
|
|
7161
|
-
return true;
|
|
7162
|
-
}
|
|
7163
|
-
ctx.commit('failSkillCheck', params.id);
|
|
7164
|
-
writeText(ctx, `[${skill.name} - Failure] ${params.failure || ''}`);
|
|
7165
|
-
return false;
|
|
7166
|
-
}
|
|
7167
|
-
function runConditionCommand(ctx, command) {
|
|
7168
|
-
const options = command.options;
|
|
7169
|
-
const result = runCondition(ctx, options.condition);
|
|
7170
|
-
logger.log(result);
|
|
7171
|
-
if (result) {
|
|
7172
|
-
return options.success;
|
|
7173
|
-
}
|
|
7174
|
-
if (!result && options.failure) {
|
|
7175
|
-
return options.failure;
|
|
7176
|
-
}
|
|
7177
|
-
return undefined;
|
|
7178
|
-
}
|
|
7179
|
-
function writeText(ctx, text) {
|
|
7180
|
-
const dialog = {
|
|
7181
|
-
speaker: 'game',
|
|
7182
|
-
text,
|
|
7183
|
-
interactive: false,
|
|
7184
|
-
};
|
|
7185
|
-
ctx.commit('addDialog', {
|
|
7186
|
-
dialog,
|
|
7187
|
-
});
|
|
7188
|
-
}
|
|
7189
|
-
function runCondition(ctx, condition) {
|
|
7190
|
-
return conditionFunction(ctx, condition);
|
|
7191
|
-
}
|
|
7192
|
-
function conditionFunction(ctx, condition) {
|
|
7193
|
-
const { state } = ctx;
|
|
7194
|
-
const context = {
|
|
7195
|
-
data: state.machine.data,
|
|
7196
|
-
skills: state.skills,
|
|
7197
|
-
skillChecks: state.skillChecks,
|
|
7198
|
-
stats: state.hudStats,
|
|
7199
|
-
roll: (checkId, skill, value) => {
|
|
7200
|
-
const skillCheckState = getSkillCheckState(ctx, checkId);
|
|
7201
|
-
if (skillCheckState) {
|
|
7202
|
-
if (skillCheckState.passed) {
|
|
7203
|
-
return true;
|
|
7204
|
-
}
|
|
7205
|
-
if (!skillCheckState.available) {
|
|
7206
|
-
return false;
|
|
7207
|
-
}
|
|
7208
|
-
}
|
|
7209
|
-
return runSkillCheck(ctx, {
|
|
7210
|
-
skill,
|
|
7211
|
-
value,
|
|
7212
|
-
id: checkId,
|
|
7213
|
-
});
|
|
7214
|
-
},
|
|
7215
|
-
};
|
|
7216
|
-
return evalInContext(`(${condition})`, context);
|
|
7217
|
-
}
|
|
7218
|
-
function evalInContext(script, context) {
|
|
7219
|
-
// # Return the results of the in-line anonymous function we .call with the passed context
|
|
7220
|
-
return function () {
|
|
7221
|
-
return eval(script);
|
|
7222
|
-
}.call(context);
|
|
7223
|
-
}
|
|
7224
|
-
|
|
7225
|
-
async function runLine(context) {
|
|
7226
|
-
const cmd = context.getters.currentLine;
|
|
7227
|
-
await runCommand(context, cmd);
|
|
7228
|
-
}
|
|
7229
|
-
async function runCommand(context, cmd, choices) {
|
|
7230
|
-
const { state, commit, dispatch } = context;
|
|
7231
|
-
try {
|
|
7232
|
-
switch (cmd.commandType) {
|
|
7233
|
-
case 'jump':
|
|
7234
|
-
const branch = cmd.args[0];
|
|
7235
|
-
const newStack = {
|
|
7236
|
-
branch: state.machine.script[branch],
|
|
7237
|
-
label: branch,
|
|
7238
|
-
currentIndex: 0,
|
|
7239
|
-
};
|
|
7240
|
-
commit('setStack', newStack);
|
|
7241
|
-
await dispatch('saveGame');
|
|
7242
|
-
await dispatch('runLine');
|
|
7243
|
-
break;
|
|
7244
|
-
case 'text':
|
|
7245
|
-
await textCommand(commit, {
|
|
7246
|
-
speaker: 'game',
|
|
7247
|
-
text: cmd.options.text,
|
|
7248
|
-
choices,
|
|
7249
|
-
interactive: true,
|
|
7250
|
-
});
|
|
7251
|
-
break;
|
|
7252
|
-
case 'set':
|
|
7253
|
-
const key = cmd.args[0];
|
|
7254
|
-
const value = cmd.args[1];
|
|
7255
|
-
commit('setData', { path: key, value });
|
|
7256
|
-
return dispatch('nextLine');
|
|
7257
|
-
case 'add':
|
|
7258
|
-
const addKey = cmd.args[0];
|
|
7259
|
-
const addValue = cmd.args[1];
|
|
7260
|
-
commit('addInstruction', { path: addKey, value: addValue });
|
|
7261
|
-
return dispatch('nextLine');
|
|
7262
|
-
case 'if':
|
|
7263
|
-
const newBranch = runConditionCommand(context, cmd);
|
|
7264
|
-
if (newBranch) {
|
|
7265
|
-
const newStack = {
|
|
7266
|
-
branch: newBranch,
|
|
7267
|
-
currentIndex: 0,
|
|
7268
|
-
};
|
|
7269
|
-
commit('addStack', newStack);
|
|
7270
|
-
return dispatch('runLine');
|
|
7271
|
-
}
|
|
7272
|
-
return dispatch('nextLine');
|
|
7273
|
-
case 'talk':
|
|
7274
|
-
await textCommand(commit, {
|
|
7275
|
-
speaker: cmd.args[0],
|
|
7276
|
-
pose: cmd.args[1],
|
|
7277
|
-
text: `"${cmd.args[2]}"`,
|
|
7278
|
-
choices,
|
|
7279
|
-
interactive: true,
|
|
7280
|
-
});
|
|
7281
|
-
break;
|
|
7282
|
-
case 'choice':
|
|
7283
|
-
await runChoice(context, cmd);
|
|
7284
|
-
break;
|
|
7285
|
-
case 'set_screen':
|
|
7286
|
-
commit('setScreen', cmd.options.screen);
|
|
7287
|
-
return dispatch('nextLine');
|
|
7288
|
-
case 'clear_dialog':
|
|
7289
|
-
commit('clearDialog');
|
|
7290
|
-
return dispatch('nextLine');
|
|
7291
|
-
case 'set_button':
|
|
7292
|
-
commit('changeButton', {
|
|
7293
|
-
button: cmd.args[0],
|
|
7294
|
-
enabled: cmd.args[1],
|
|
7295
|
-
});
|
|
7296
|
-
return dispatch('nextLine');
|
|
7297
|
-
case 'play':
|
|
7298
|
-
const playOptions = cmd.options;
|
|
7299
|
-
if (playOptions.mode === 'music') {
|
|
7300
|
-
changeMusic(context, playOptions.audio);
|
|
7301
|
-
}
|
|
7302
|
-
else {
|
|
7303
|
-
playAudio(context.commit, playOptions.audio);
|
|
7304
|
-
}
|
|
7305
|
-
return dispatch('nextLine');
|
|
7306
|
-
case 'stop':
|
|
7307
|
-
const stopOptions = cmd.options;
|
|
7308
|
-
if (stopOptions.mode === 'music') {
|
|
7309
|
-
stopAudio(commit, context.state.audio.currentMusic);
|
|
7310
|
-
}
|
|
7311
|
-
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
7312
|
-
stopAudio(commit, stopOptions.audio);
|
|
7313
|
-
}
|
|
7314
|
-
else {
|
|
7315
|
-
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.`);
|
|
7316
|
-
}
|
|
7317
|
-
return dispatch('nextLine');
|
|
7318
|
-
case 'pause':
|
|
7319
|
-
const pauseOptions = cmd.options;
|
|
7320
|
-
if (pauseOptions.mode === 'music') {
|
|
7321
|
-
pauseAudio(commit, context.state.audio.currentMusic);
|
|
7322
|
-
}
|
|
7323
|
-
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
7324
|
-
pauseAudio(commit, stopOptions.audio);
|
|
7325
|
-
}
|
|
7326
|
-
else {
|
|
7327
|
-
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.`);
|
|
7328
|
-
}
|
|
7329
|
-
return dispatch('nextLine');
|
|
7330
|
-
case 'wait':
|
|
7331
|
-
await timeout(cmd.options.duration);
|
|
7332
|
-
return dispatch('nextLine');
|
|
7333
|
-
case 'add_level':
|
|
7334
|
-
const skillKey = cmd.args[0];
|
|
7335
|
-
const levelToAdd = cmd.args[1];
|
|
7336
|
-
if (!skillKey || !levelToAdd) {
|
|
7337
|
-
error(commit, `add_level command needs a skill id and a value as parameters`);
|
|
7338
|
-
}
|
|
7339
|
-
commit('incrementSkill', {
|
|
7340
|
-
skill: skillKey,
|
|
7341
|
-
amount: levelToAdd,
|
|
7342
|
-
});
|
|
7343
|
-
const skillName = getConfig().skills[skillKey].name;
|
|
7344
|
-
const skillLevel = state.skills[skillKey].level;
|
|
7345
|
-
dispatch('addNotification', `Your skill in ${skillName} is now level ${skillLevel}`);
|
|
7346
|
-
return dispatch('nextLine');
|
|
7347
|
-
case 'add_stat':
|
|
7348
|
-
const statKey = cmd.args[0];
|
|
7349
|
-
const amountToAdd = cmd.args[1];
|
|
7350
|
-
if (!statKey || !amountToAdd) {
|
|
7351
|
-
error(commit, `add_stat command needs a stat id and a value as parameters`);
|
|
7352
|
-
}
|
|
7353
|
-
commit('addStat', {
|
|
7354
|
-
stat: statKey,
|
|
7355
|
-
amount: amountToAdd,
|
|
7356
|
-
});
|
|
7357
|
-
return dispatch('nextLine');
|
|
7358
|
-
case 'set_stat':
|
|
7359
|
-
const setStatKey = cmd.args[0];
|
|
7360
|
-
const setAmount = cmd.args[1];
|
|
7361
|
-
if (!setStatKey || !setAmount) {
|
|
7362
|
-
error(commit, `set_stat command needs a stat id and a value as parameters`);
|
|
7363
|
-
}
|
|
7364
|
-
commit('setStat', {
|
|
7365
|
-
stat: setStatKey,
|
|
7366
|
-
amount: setAmount,
|
|
7367
|
-
});
|
|
7368
|
-
return dispatch('nextLine');
|
|
7369
|
-
case 'notify':
|
|
7370
|
-
const text = cmd.args[0];
|
|
7371
|
-
dispatch('addNotification', text);
|
|
7372
|
-
return dispatch('nextLine');
|
|
7373
|
-
default:
|
|
7374
|
-
break;
|
|
7375
|
-
}
|
|
7376
|
-
}
|
|
7377
|
-
catch (err) {
|
|
7378
|
-
logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
|
|
7379
|
-
console.error(err);
|
|
7380
|
-
error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
|
|
7381
|
-
<b>${err}</b>
|
|
7382
|
-
Script: ${cmd.code}
|
|
7383
|
-
Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
|
|
7384
|
-
}
|
|
7385
|
-
}
|
|
7386
|
-
async function playerAnswered(context, choiceIndex) {
|
|
7387
|
-
const { commit, dispatch } = context;
|
|
7388
|
-
const cmd = context.getters.currentLine;
|
|
7389
|
-
switch (cmd.commandType) {
|
|
7390
|
-
case 'choice':
|
|
7391
|
-
const options = cmd.options;
|
|
7392
|
-
const choice = options.choices[choiceIndex];
|
|
7393
|
-
let playerText = choice.choice;
|
|
7394
|
-
let newBranch;
|
|
7395
|
-
const skillcheck = choice.skillCheck;
|
|
7396
|
-
if (skillcheck) {
|
|
7397
|
-
const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
|
|
7398
|
-
if (skillCheckState.passed) {
|
|
7399
|
-
newBranch = skillcheck.success.branch;
|
|
7400
|
-
playerText = skillcheck.success.text;
|
|
7401
|
-
}
|
|
7402
|
-
else {
|
|
7403
|
-
const result = processSkillCheck(context, skillcheck);
|
|
7404
|
-
const winner = result ? skillcheck.success : skillcheck.failure;
|
|
7405
|
-
newBranch = winner.branch;
|
|
7406
|
-
playerText = undefined;
|
|
7407
|
-
}
|
|
7408
|
-
}
|
|
7409
|
-
else {
|
|
7410
|
-
newBranch = choice.branch;
|
|
7411
|
-
}
|
|
7412
|
-
if (playerText) {
|
|
7413
|
-
// If the choice involves printing a player dialog, show it
|
|
7414
|
-
const dialog = {
|
|
7415
|
-
speaker: 'player',
|
|
7416
|
-
text: playerText,
|
|
7417
|
-
interactive: false,
|
|
7418
|
-
};
|
|
7419
|
-
commit('addDialog', { dialog });
|
|
7420
|
-
}
|
|
7421
|
-
if (newBranch) {
|
|
7422
|
-
const newStack = {
|
|
7423
|
-
currentIndex: 0,
|
|
7424
|
-
branch: newBranch,
|
|
7425
|
-
};
|
|
7426
|
-
commit('addStack', newStack);
|
|
7427
|
-
dispatch('runLine');
|
|
7428
|
-
}
|
|
7429
|
-
else {
|
|
7430
|
-
dispatch('nextLine');
|
|
7431
|
-
}
|
|
7432
|
-
break;
|
|
7433
|
-
default:
|
|
7434
|
-
dispatch('nextLine');
|
|
7435
|
-
}
|
|
7436
|
-
}
|
|
7437
|
-
async function runChoice(context, cmd) {
|
|
7438
|
-
const options = cmd.options;
|
|
7439
|
-
const prompt = options.prompt;
|
|
7440
|
-
const choices = options.choices
|
|
7441
|
-
.filter((choice) => {
|
|
7442
|
-
// Delete the choice if it fails a condition
|
|
7443
|
-
if (choice.condition) {
|
|
7444
|
-
return runCondition(context, choice.condition);
|
|
7445
|
-
}
|
|
7446
|
-
return true;
|
|
7447
|
-
})
|
|
7448
|
-
.map((choice) => {
|
|
7449
|
-
let text = choice.choice;
|
|
7450
|
-
let choiceAllowed = true;
|
|
7451
|
-
if (choice.skillCheck) {
|
|
7452
|
-
const check = choice.skillCheck;
|
|
7453
|
-
const config = getConfig();
|
|
7454
|
-
const skill = config.skills[check.skill];
|
|
7455
|
-
const level = context.state.skills[check.skill].level;
|
|
7456
|
-
const difficultyScore = check.value - level * config.skillChecks.skillMultiplier;
|
|
7457
|
-
const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
|
|
7458
|
-
let found = false;
|
|
7459
|
-
let i = 0;
|
|
7460
|
-
let checkText = config.skillChecks.difficultyText[0][1];
|
|
7461
|
-
while (!found) {
|
|
7462
|
-
if (config.skillChecks.difficultyText.length > i) {
|
|
7463
|
-
if (difficultyScore >= config.skillChecks.difficultyText[i][0]) {
|
|
7464
|
-
checkText = config.skillChecks.difficultyText[i][1];
|
|
7465
|
-
}
|
|
7466
|
-
else {
|
|
7467
|
-
found = true;
|
|
7468
|
-
}
|
|
7469
|
-
}
|
|
7470
|
-
else {
|
|
7471
|
-
found = true;
|
|
7472
|
-
}
|
|
7473
|
-
i++;
|
|
7474
|
-
}
|
|
7475
|
-
if (!skillCheckState.available) {
|
|
7476
|
-
choiceAllowed = false;
|
|
7477
|
-
text = `[${skill.name} - Failed] ${text}`;
|
|
7478
|
-
}
|
|
7479
|
-
else if (!skillCheckState.passed) {
|
|
7480
|
-
text = `[${skill.name} - ${checkText}] ${text}`;
|
|
7481
|
-
}
|
|
7482
|
-
}
|
|
7483
|
-
const result = {
|
|
7484
|
-
choice: text,
|
|
7485
|
-
originalIndex: choice.index,
|
|
7486
|
-
allowed: choiceAllowed,
|
|
7487
|
-
};
|
|
7488
|
-
return result;
|
|
7489
|
-
});
|
|
7490
|
-
runCommand(context, prompt, choices);
|
|
7491
|
-
}
|
|
7492
|
-
async function textCommand(commit, dialog) {
|
|
7493
|
-
commit('addDialog', {
|
|
7494
|
-
dialog,
|
|
7495
|
-
});
|
|
7496
|
-
}
|
|
7497
|
-
async function nextLine(ctx) {
|
|
7498
|
-
const { state, getters, dispatch, commit } = ctx;
|
|
7499
|
-
if (state.machine.stack.length === 0) {
|
|
7500
|
-
finishGame(ctx);
|
|
7501
|
-
return;
|
|
7502
|
-
}
|
|
7503
|
-
const machineHead = getters.machineHead;
|
|
7504
|
-
if (machineHead.currentIndex < machineHead.branch.length - 1) {
|
|
7505
|
-
commit('nextLine');
|
|
7506
|
-
}
|
|
7507
|
-
else {
|
|
7508
|
-
// This branch is finished, go back to previous stack
|
|
7509
|
-
commit('previousStack');
|
|
7510
|
-
return dispatch('nextLine');
|
|
7511
|
-
}
|
|
7512
|
-
if (state.machine.stack.length === 0) {
|
|
7513
|
-
finishGame(ctx);
|
|
7514
|
-
}
|
|
7515
|
-
else {
|
|
7516
|
-
return dispatch('runLine');
|
|
7517
|
-
}
|
|
7518
|
-
}
|
|
7519
|
-
function finishGame({ commit, state }) {
|
|
7520
|
-
if (state.options.debug) {
|
|
7521
|
-
commit('addDialog', {
|
|
7522
|
-
dialog: {
|
|
7523
|
-
speaker: 'game',
|
|
7524
|
-
text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
|
|
7525
|
-
},
|
|
7526
|
-
});
|
|
7527
|
-
}
|
|
7528
|
-
}
|
|
7529
|
-
|
|
7530
|
-
function jump(ctx) {
|
|
7531
|
-
ctx.command.commandType = 'jump';
|
|
7532
|
-
ctx.currentLine++;
|
|
7533
|
-
}
|
|
7534
|
-
function choice(ctx) {
|
|
7535
|
-
const { line, command } = ctx;
|
|
7536
|
-
if (!line.branch || line.branch.length < 2) {
|
|
7537
|
-
ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
|
|
7538
|
-
}
|
|
7539
|
-
const prompt = line.branch[0];
|
|
7540
|
-
const choices = line.branch.slice(1);
|
|
7541
|
-
const prompts = choices.map((choice, index) => {
|
|
7542
|
-
if (!choice.branch) {
|
|
7543
|
-
ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
|
|
7544
|
-
}
|
|
7545
|
-
return parseChoiceOption(ctx, choice, index);
|
|
7546
|
-
});
|
|
7547
|
-
command.options = {
|
|
7548
|
-
prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
|
|
7549
|
-
choices: prompts,
|
|
7550
|
-
};
|
|
7551
|
-
command.commandType = 'choice';
|
|
7552
|
-
ctx.currentLine++;
|
|
7553
|
-
}
|
|
7554
|
-
function set(ctx) {
|
|
7555
|
-
ctx.command.commandType = 'set';
|
|
7556
|
-
ctx.currentLine++;
|
|
7557
|
-
}
|
|
7558
|
-
// eslint-disable-next-line camelcase
|
|
7559
|
-
function add_level(ctx) {
|
|
7560
|
-
ctx.command.commandType = 'add_level';
|
|
7561
|
-
ctx.currentLine++;
|
|
7562
|
-
}
|
|
7563
|
-
function set_stat(ctx) {
|
|
7564
|
-
ctx.command.commandType = 'set_stat';
|
|
7565
|
-
ctx.currentLine++;
|
|
7566
|
-
}
|
|
7567
|
-
function add_stat(ctx) {
|
|
7568
|
-
ctx.command.commandType = 'add_stat';
|
|
7569
|
-
ctx.currentLine++;
|
|
7570
|
-
}
|
|
7571
|
-
function add(ctx) {
|
|
7572
|
-
ctx.command.commandType = 'add';
|
|
7573
|
-
ctx.currentLine++;
|
|
7574
|
-
}
|
|
7575
|
-
function talk(ctx) {
|
|
7576
|
-
const { command, line } = ctx;
|
|
7577
|
-
command.commandType = 'talk';
|
|
7578
|
-
if (command.args.length < 3) {
|
|
7579
|
-
ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
|
|
7580
|
-
}
|
|
7581
|
-
ctx.currentLine++;
|
|
7582
|
-
}
|
|
7583
|
-
function ifCommand(ctx) {
|
|
7584
|
-
const { command, lines, currentLine, line } = ctx;
|
|
7585
|
-
command.commandType = 'if';
|
|
7586
|
-
let failure;
|
|
7587
|
-
const nextLine = getLine(lines, currentLine + 1);
|
|
7588
|
-
if (nextLine && nextLine.operator === 'else') {
|
|
7589
|
-
failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
|
|
7590
|
-
ctx.currentLine++;
|
|
7591
|
-
}
|
|
7592
|
-
command.options = {
|
|
7593
|
-
condition: command.args[0],
|
|
7594
|
-
success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
|
|
7595
|
-
failure,
|
|
7596
|
-
};
|
|
7597
|
-
ctx.currentLine++;
|
|
7598
|
-
}
|
|
7599
|
-
function setScreen(ctx) {
|
|
7600
|
-
const { command } = ctx;
|
|
7601
|
-
command.commandType = 'set_screen';
|
|
7602
|
-
command.options = {
|
|
7603
|
-
screen: command.args[0],
|
|
7604
|
-
};
|
|
7605
|
-
ctx.currentLine++;
|
|
7606
|
-
}
|
|
7607
|
-
function setButton(ctx) {
|
|
7608
|
-
const { command, line } = ctx;
|
|
7609
|
-
command.commandType = 'set_button';
|
|
7610
|
-
if (command.args.length !== 2) {
|
|
7611
|
-
ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
|
|
7612
|
-
}
|
|
7613
|
-
ctx.currentLine++;
|
|
7614
|
-
}
|
|
7615
|
-
function clearDialog(ctx) {
|
|
7616
|
-
const { command } = ctx;
|
|
7617
|
-
command.commandType = 'clear_dialog';
|
|
7618
|
-
ctx.currentLine++;
|
|
7619
|
-
}
|
|
7620
|
-
function play(ctx) {
|
|
7621
|
-
const { command } = ctx;
|
|
7622
|
-
command.commandType = 'play';
|
|
7623
|
-
command.options = {
|
|
7624
|
-
mode: command.args[0],
|
|
7625
|
-
audio: command.args[1],
|
|
7626
|
-
};
|
|
7627
|
-
ctx.currentLine++;
|
|
7628
|
-
}
|
|
7629
|
-
function stop(ctx) {
|
|
7630
|
-
const { command } = ctx;
|
|
7631
|
-
command.commandType = 'stop';
|
|
7632
|
-
command.options = {
|
|
7633
|
-
mode: command.args[0],
|
|
7634
|
-
audio: command.args[1],
|
|
7635
|
-
};
|
|
7636
|
-
ctx.currentLine++;
|
|
7637
|
-
}
|
|
7638
|
-
function pause(ctx) {
|
|
7639
|
-
const { command } = ctx;
|
|
7640
|
-
command.commandType = 'pause';
|
|
7641
|
-
command.options = {
|
|
7642
|
-
mode: command.args[0],
|
|
7643
|
-
audio: command.args[1],
|
|
7644
|
-
};
|
|
7645
|
-
ctx.currentLine++;
|
|
7646
|
-
}
|
|
7647
|
-
function wait(ctx) {
|
|
7648
|
-
const { command } = ctx;
|
|
7649
|
-
command.commandType = 'wait';
|
|
7650
|
-
command.options = {
|
|
7651
|
-
duration: parseInt(command.args[0], 10),
|
|
7652
|
-
};
|
|
7653
|
-
ctx.currentLine++;
|
|
7654
|
-
}
|
|
7655
|
-
function text(ctx) {
|
|
7656
|
-
const { command, line } = ctx;
|
|
7657
|
-
command.commandType = 'text';
|
|
7658
|
-
command.options = {
|
|
7659
|
-
text: line.operator,
|
|
7660
|
-
};
|
|
7661
|
-
ctx.currentLine++;
|
|
7662
|
-
}
|
|
7663
|
-
function notify(ctx) {
|
|
7664
|
-
ctx.command.commandType = 'notify';
|
|
7665
|
-
ctx.currentLine++;
|
|
7666
|
-
}
|
|
7667
|
-
const parserFunctions = {
|
|
7668
|
-
jump,
|
|
7669
|
-
choice,
|
|
7670
|
-
set,
|
|
7671
|
-
add,
|
|
7672
|
-
talk,
|
|
7673
|
-
if: ifCommand,
|
|
7674
|
-
set_screen: setScreen,
|
|
7675
|
-
set_button: setButton,
|
|
7676
|
-
clear_dialog: clearDialog,
|
|
7677
|
-
play,
|
|
7678
|
-
stop,
|
|
7679
|
-
pause,
|
|
7680
|
-
wait,
|
|
7681
|
-
text,
|
|
7682
|
-
add_level,
|
|
7683
|
-
notify,
|
|
7684
|
-
set_stat,
|
|
7685
|
-
add_stat,
|
|
7686
|
-
};
|
|
7687
|
-
function getLine(lines, index) {
|
|
7688
|
-
if (index < lines.length)
|
|
7689
|
-
return lines[index];
|
|
7690
|
-
}
|
|
7691
|
-
function parseChoiceOption(ctx, choice, index) {
|
|
7692
|
-
let choiceText = choice.operator;
|
|
7693
|
-
let condition;
|
|
7694
|
-
let skillCheck;
|
|
7695
|
-
if (choice.operator === 'roll') {
|
|
7696
|
-
if (choice.args.length < 4) {
|
|
7697
|
-
ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
|
|
7698
|
-
}
|
|
7699
|
-
choiceText = choice.args[3];
|
|
7700
|
-
const successBranch = choice.branch[0];
|
|
7701
|
-
const failureBranch = choice.branch[1];
|
|
7702
|
-
const success = {
|
|
7703
|
-
text: successBranch.args[0],
|
|
7704
|
-
branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
|
|
7705
|
-
};
|
|
7706
|
-
let failedBranch;
|
|
7707
|
-
if (failureBranch.branch) {
|
|
7708
|
-
failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
|
|
7709
|
-
}
|
|
7710
|
-
const failure = {
|
|
7711
|
-
text: failureBranch.args[0],
|
|
7712
|
-
branch: failedBranch,
|
|
7713
|
-
};
|
|
7714
|
-
skillCheck = {
|
|
7715
|
-
id: choice.args[0],
|
|
7716
|
-
skill: choice.args[1],
|
|
7717
|
-
value: choice.args[2],
|
|
7718
|
-
success,
|
|
7719
|
-
failure,
|
|
7720
|
-
};
|
|
7721
|
-
}
|
|
7722
|
-
if (choice.args[0] === 'if') {
|
|
7723
|
-
condition = choice.args[1];
|
|
7724
|
-
}
|
|
7725
|
-
return {
|
|
7726
|
-
choice: choiceText,
|
|
7727
|
-
condition,
|
|
7728
|
-
skillCheck,
|
|
7729
|
-
branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
|
|
7730
|
-
index,
|
|
7731
|
-
};
|
|
7732
|
-
}
|
|
7733
|
-
|
|
7734
|
-
function parseRenpyScript(errorHandler, code, fileName) {
|
|
7735
|
-
const ctx = {
|
|
7736
|
-
fileName,
|
|
7737
|
-
error: (line, text) => errorHandler(ctx, line, text),
|
|
7738
|
-
processCommandsFunction: processRenpyCommands,
|
|
7739
|
-
indentSize: 0, // Will be overriden soon
|
|
7740
|
-
};
|
|
7741
|
-
ctx.indentSize = detectIndentation(ctx, code);
|
|
7742
|
-
const lines = findRenpyLines(ctx, code);
|
|
7743
|
-
logger.log(lines);
|
|
7744
|
-
const script = {};
|
|
7745
|
-
for (const line of lines) {
|
|
7746
|
-
if (line.code.search(':') === -1) {
|
|
7747
|
-
ctx.error(line.line, `First indentation level should only be used to specify labels`);
|
|
7748
|
-
}
|
|
7749
|
-
const labelName = line.code.replace(':', '');
|
|
7750
|
-
if (!line.branch) {
|
|
7751
|
-
ctx.error(line.line, `This line should have a branch but doesn't`);
|
|
7752
|
-
}
|
|
7753
|
-
script[labelName] = processRenpyCommands(ctx, line.branch, undefined);
|
|
7754
|
-
}
|
|
7755
|
-
return script;
|
|
7756
|
-
}
|
|
7757
|
-
function processRenpyCommands(ctx, lines, parentLine) {
|
|
7496
|
+
function processCommands(ctx, lines, parentLine) {
|
|
7758
7497
|
const branchContext = {
|
|
7759
|
-
processCommandsFunction:
|
|
7498
|
+
processCommandsFunction: processCommands,
|
|
7760
7499
|
parserContext: ctx,
|
|
7761
7500
|
lines,
|
|
7762
7501
|
currentLine: 0,
|
|
@@ -7783,10 +7522,11 @@ function processRenpyCommands(ctx, lines, parentLine) {
|
|
|
7783
7522
|
};
|
|
7784
7523
|
branchContext.line = line;
|
|
7785
7524
|
branchContext.command = command;
|
|
7786
|
-
|
|
7525
|
+
const commandPlugin = vm$1.commands[operator];
|
|
7526
|
+
let parseFunction = commandPlugin?.parser;
|
|
7787
7527
|
if (!parseFunction) {
|
|
7788
7528
|
// default to text function
|
|
7789
|
-
parseFunction =
|
|
7529
|
+
parseFunction = vm$1.commands.text.parser;
|
|
7790
7530
|
}
|
|
7791
7531
|
parseFunction(branchContext);
|
|
7792
7532
|
branch.push(command);
|
|
@@ -7851,7 +7591,7 @@ function parseCodeLine(codeToProcess) {
|
|
|
7851
7591
|
words.forEach((word, index) => (words[index] = parseValue(word)));
|
|
7852
7592
|
return words;
|
|
7853
7593
|
}
|
|
7854
|
-
function
|
|
7594
|
+
function findLines(ctx, data) {
|
|
7855
7595
|
const code = data.split(/\r?\n|$/).map((line) => {
|
|
7856
7596
|
const commentIndex = line.search(/ *\/\//g);
|
|
7857
7597
|
if (commentIndex !== -1) {
|
|
@@ -7859,10 +7599,10 @@ function findRenpyLines(ctx, data) {
|
|
|
7859
7599
|
}
|
|
7860
7600
|
return line;
|
|
7861
7601
|
});
|
|
7862
|
-
const lines =
|
|
7602
|
+
const lines = findBranches(ctx, code, 0, 0);
|
|
7863
7603
|
return lines.lines;
|
|
7864
7604
|
}
|
|
7865
|
-
function
|
|
7605
|
+
function findBranches(ctx, code, startLine, indentLevel) {
|
|
7866
7606
|
let stillInBranch = true;
|
|
7867
7607
|
let currentLine = startLine;
|
|
7868
7608
|
const lines = [];
|
|
@@ -7885,7 +7625,7 @@ function findRenpyBranches(ctx, code, startLine, indentLevel) {
|
|
|
7885
7625
|
if (lines.length === 0 || lineIndent - indentLevel !== 1) {
|
|
7886
7626
|
ctx.error(currentLine, `Wrong double indentation`);
|
|
7887
7627
|
}
|
|
7888
|
-
const branchLines =
|
|
7628
|
+
const branchLines = findBranches(ctx, code, currentLine, lineIndent);
|
|
7889
7629
|
lines[lines.length - 1].branch = branchLines.lines;
|
|
7890
7630
|
currentLine = branchLines.endLine;
|
|
7891
7631
|
}
|
|
@@ -7930,6 +7670,138 @@ function randomId() {
|
|
|
7930
7670
|
return `${Date.now() - Math.floor(Math.random() * 99999999)}`;
|
|
7931
7671
|
}
|
|
7932
7672
|
|
|
7673
|
+
var isMergeableObject = function isMergeableObject(value) {
|
|
7674
|
+
return isNonNullObject(value)
|
|
7675
|
+
&& !isSpecial(value)
|
|
7676
|
+
};
|
|
7677
|
+
|
|
7678
|
+
function isNonNullObject(value) {
|
|
7679
|
+
return !!value && typeof value === 'object'
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
function isSpecial(value) {
|
|
7683
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
7684
|
+
|
|
7685
|
+
return stringValue === '[object RegExp]'
|
|
7686
|
+
|| stringValue === '[object Date]'
|
|
7687
|
+
|| isReactElement(value)
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
7691
|
+
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
7692
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
7693
|
+
|
|
7694
|
+
function isReactElement(value) {
|
|
7695
|
+
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7698
|
+
function emptyTarget(val) {
|
|
7699
|
+
return Array.isArray(val) ? [] : {}
|
|
7700
|
+
}
|
|
7701
|
+
|
|
7702
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
7703
|
+
return (options.clone !== false && options.isMergeableObject(value))
|
|
7704
|
+
? deepmerge(emptyTarget(value), value, options)
|
|
7705
|
+
: value
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7708
|
+
function defaultArrayMerge(target, source, options) {
|
|
7709
|
+
return target.concat(source).map(function(element) {
|
|
7710
|
+
return cloneUnlessOtherwiseSpecified(element, options)
|
|
7711
|
+
})
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
function getMergeFunction(key, options) {
|
|
7715
|
+
if (!options.customMerge) {
|
|
7716
|
+
return deepmerge
|
|
7717
|
+
}
|
|
7718
|
+
var customMerge = options.customMerge(key);
|
|
7719
|
+
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
7720
|
+
}
|
|
7721
|
+
|
|
7722
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
7723
|
+
return Object.getOwnPropertySymbols
|
|
7724
|
+
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
7725
|
+
return target.propertyIsEnumerable(symbol)
|
|
7726
|
+
})
|
|
7727
|
+
: []
|
|
7728
|
+
}
|
|
7729
|
+
|
|
7730
|
+
function getKeys(target) {
|
|
7731
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
7732
|
+
}
|
|
7733
|
+
|
|
7734
|
+
function propertyIsOnObject(object, property) {
|
|
7735
|
+
try {
|
|
7736
|
+
return property in object
|
|
7737
|
+
} catch(_) {
|
|
7738
|
+
return false
|
|
7739
|
+
}
|
|
7740
|
+
}
|
|
7741
|
+
|
|
7742
|
+
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
7743
|
+
function propertyIsUnsafe(target, key) {
|
|
7744
|
+
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
7745
|
+
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
7746
|
+
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
7747
|
+
}
|
|
7748
|
+
|
|
7749
|
+
function mergeObject(target, source, options) {
|
|
7750
|
+
var destination = {};
|
|
7751
|
+
if (options.isMergeableObject(target)) {
|
|
7752
|
+
getKeys(target).forEach(function(key) {
|
|
7753
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
7754
|
+
});
|
|
7755
|
+
}
|
|
7756
|
+
getKeys(source).forEach(function(key) {
|
|
7757
|
+
if (propertyIsUnsafe(target, key)) {
|
|
7758
|
+
return
|
|
7759
|
+
}
|
|
7760
|
+
|
|
7761
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
7762
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
7763
|
+
} else {
|
|
7764
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
7765
|
+
}
|
|
7766
|
+
});
|
|
7767
|
+
return destination
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7770
|
+
function deepmerge(target, source, options) {
|
|
7771
|
+
options = options || {};
|
|
7772
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
7773
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
7774
|
+
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
7775
|
+
// implementations can use it. The caller may not replace it.
|
|
7776
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
7777
|
+
|
|
7778
|
+
var sourceIsArray = Array.isArray(source);
|
|
7779
|
+
var targetIsArray = Array.isArray(target);
|
|
7780
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
7781
|
+
|
|
7782
|
+
if (!sourceAndTargetTypesMatch) {
|
|
7783
|
+
return cloneUnlessOtherwiseSpecified(source, options)
|
|
7784
|
+
} else if (sourceIsArray) {
|
|
7785
|
+
return options.arrayMerge(target, source, options)
|
|
7786
|
+
} else {
|
|
7787
|
+
return mergeObject(target, source, options)
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
|
|
7791
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
7792
|
+
if (!Array.isArray(array)) {
|
|
7793
|
+
throw new Error('first argument should be an array')
|
|
7794
|
+
}
|
|
7795
|
+
|
|
7796
|
+
return array.reduce(function(prev, next) {
|
|
7797
|
+
return deepmerge(prev, next, options)
|
|
7798
|
+
}, {})
|
|
7799
|
+
};
|
|
7800
|
+
|
|
7801
|
+
var deepmerge_1 = deepmerge;
|
|
7802
|
+
|
|
7803
|
+
var cjs = deepmerge_1;
|
|
7804
|
+
|
|
7933
7805
|
let key = Symbol('Store Injection Key');
|
|
7934
7806
|
let store;
|
|
7935
7807
|
function setupStore(options) {
|
|
@@ -7940,7 +7812,6 @@ function setupStore(options) {
|
|
|
7940
7812
|
}
|
|
7941
7813
|
// define injection key
|
|
7942
7814
|
key = Symbol('Store Injection Key');
|
|
7943
|
-
logger.setDebug(options.debug);
|
|
7944
7815
|
logger.log('setup store');
|
|
7945
7816
|
store = createStore({
|
|
7946
7817
|
state: {
|
|
@@ -7981,6 +7852,7 @@ function setupStore(options) {
|
|
|
7981
7852
|
options,
|
|
7982
7853
|
flowState: 'menu',
|
|
7983
7854
|
openModal: false,
|
|
7855
|
+
paused: false,
|
|
7984
7856
|
},
|
|
7985
7857
|
getters: {
|
|
7986
7858
|
machineHead(state) {
|
|
@@ -8013,7 +7885,7 @@ function setupStore(options) {
|
|
|
8013
7885
|
const file = files[index];
|
|
8014
7886
|
scripts = {
|
|
8015
7887
|
...scripts,
|
|
8016
|
-
...
|
|
7888
|
+
...parseScript((ctx, line, error) => parserError(commit, ctx, line, error), file, scriptPaths[index]),
|
|
8017
7889
|
};
|
|
8018
7890
|
}
|
|
8019
7891
|
const end = Date.now();
|
|
@@ -8035,6 +7907,7 @@ function setupStore(options) {
|
|
|
8035
7907
|
];
|
|
8036
7908
|
state.ready = true;
|
|
8037
7909
|
commit('startPlaying');
|
|
7910
|
+
vm$1.callHook('onGameStart');
|
|
8038
7911
|
},
|
|
8039
7912
|
runLabel({ state, commit }, label) {
|
|
8040
7913
|
const branch = state.machine.script[label];
|
|
@@ -8099,26 +7972,48 @@ function setupStore(options) {
|
|
|
8099
7972
|
changeMusic(ctx, getConfig().audioOptions.defaultMusic);
|
|
8100
7973
|
}
|
|
8101
7974
|
},
|
|
8102
|
-
async addNotification(
|
|
7975
|
+
async addNotification(ctx, text) {
|
|
7976
|
+
const { commit } = ctx;
|
|
8103
7977
|
const id = `${Date.now()}-${Math.random() * 10000}`;
|
|
8104
7978
|
const notification = {
|
|
8105
7979
|
text,
|
|
8106
7980
|
};
|
|
8107
7981
|
commit('addNotification', { id, notification });
|
|
7982
|
+
if (getConfig().notifications.alsoPrintInDialogue) {
|
|
7983
|
+
writeText(ctx, `[NOTIFICATION] ${text}`);
|
|
7984
|
+
}
|
|
8108
7985
|
await timeout(getConfig().notifications.timeOnScreen * 1000);
|
|
8109
7986
|
commit('deleteNotification', id);
|
|
8110
7987
|
},
|
|
7988
|
+
incrementSkill({ dispatch, state }, { skill, amount }) {
|
|
7989
|
+
state.skills[skill].level += amount;
|
|
7990
|
+
dispatch('levelledUp', skill);
|
|
7991
|
+
},
|
|
7992
|
+
levelledUp({ dispatch, state }, skill) {
|
|
7993
|
+
const skillName = getConfig().skills[skill].name;
|
|
7994
|
+
const skillLevel = state.skills[skill].level;
|
|
7995
|
+
dispatch('addNotification', `Your skill in ${skillName} is now level ${skillLevel}`);
|
|
7996
|
+
},
|
|
7997
|
+
addXp({ state, dispatch }, { skill, amount }) {
|
|
7998
|
+
const skillState = state.skills[skill];
|
|
7999
|
+
skillState.xp += amount;
|
|
8000
|
+
if (skillState.xp > getConfig().skillOptions.xpPerLevel) {
|
|
8001
|
+
skillState.level += 1;
|
|
8002
|
+
skillState.xp = 0;
|
|
8003
|
+
dispatch('levelledUp', skill);
|
|
8004
|
+
}
|
|
8005
|
+
},
|
|
8111
8006
|
},
|
|
8112
8007
|
mutations: {
|
|
8113
8008
|
setLoadedData(state, save) {
|
|
8114
8009
|
state.machine.data = save.data;
|
|
8115
|
-
state.skills = save.skills;
|
|
8010
|
+
state.skills = cjs(state.skillChecks, save.skills);
|
|
8116
8011
|
state.dialog = save.dialog;
|
|
8117
|
-
state.buttons = save.buttons;
|
|
8012
|
+
state.buttons = cjs(state.buttons, save.buttons);
|
|
8118
8013
|
state.lastLabel = save.lastLabel;
|
|
8119
|
-
state.skillChecks = save.skillChecks;
|
|
8014
|
+
state.skillChecks = cjs(state.skillChecks, save.skillChecks);
|
|
8120
8015
|
state.playTime.previousPlaytime = save.playTime;
|
|
8121
|
-
state.hudStats = save.hudStats;
|
|
8016
|
+
state.hudStats = cjs(state.hudStats, save.hudStats);
|
|
8122
8017
|
state.currentScreen = save.currentScreen;
|
|
8123
8018
|
state.audio.currentMusic = save.audio.currentMusic;
|
|
8124
8019
|
},
|
|
@@ -8156,6 +8051,7 @@ function setupStore(options) {
|
|
|
8156
8051
|
for (const skill in skills) {
|
|
8157
8052
|
state.skills[skill] = {
|
|
8158
8053
|
level: skills[skill].startingLevel || 0,
|
|
8054
|
+
xp: 0,
|
|
8159
8055
|
};
|
|
8160
8056
|
}
|
|
8161
8057
|
},
|
|
@@ -8164,9 +8060,6 @@ function setupStore(options) {
|
|
|
8164
8060
|
state.hudStats[stat] = stats[stat].startingValue;
|
|
8165
8061
|
}
|
|
8166
8062
|
},
|
|
8167
|
-
incrementSkill(state, { skill, amount }) {
|
|
8168
|
-
state.skills[skill].level += amount;
|
|
8169
|
-
},
|
|
8170
8063
|
setStat(state, { stat, amount }) {
|
|
8171
8064
|
state.hudStats[stat] = amount;
|
|
8172
8065
|
},
|
|
@@ -8280,112 +8173,607 @@ function setupStore(options) {
|
|
|
8280
8173
|
state.openModal = 'menu';
|
|
8281
8174
|
}
|
|
8282
8175
|
},
|
|
8176
|
+
pause(state) {
|
|
8177
|
+
state.paused = true;
|
|
8178
|
+
},
|
|
8179
|
+
unpause(state) {
|
|
8180
|
+
state.paused = false;
|
|
8181
|
+
},
|
|
8283
8182
|
},
|
|
8284
8183
|
plugins,
|
|
8285
8184
|
});
|
|
8286
8185
|
return {
|
|
8287
|
-
store,
|
|
8288
|
-
key,
|
|
8186
|
+
store,
|
|
8187
|
+
key,
|
|
8188
|
+
};
|
|
8189
|
+
}
|
|
8190
|
+
|
|
8191
|
+
let canvas;
|
|
8192
|
+
let ctx;
|
|
8193
|
+
let store$1;
|
|
8194
|
+
const mousePos = {
|
|
8195
|
+
x: 0,
|
|
8196
|
+
y: 0,
|
|
8197
|
+
};
|
|
8198
|
+
function startGameLoop(appStore) {
|
|
8199
|
+
store$1 = appStore;
|
|
8200
|
+
document.addEventListener('mousemove', (e) => {
|
|
8201
|
+
mousePos.x = e.clientX;
|
|
8202
|
+
mousePos.y = e.clientY;
|
|
8203
|
+
});
|
|
8204
|
+
document.addEventListener('click', debounce(mouseclick, 100, { maxWait: 200 }));
|
|
8205
|
+
gameLoop();
|
|
8206
|
+
}
|
|
8207
|
+
function gameLoop() {
|
|
8208
|
+
if (store$1.state.playing) {
|
|
8209
|
+
if (!canvas) {
|
|
8210
|
+
canvas = document.querySelector('#background-canvas');
|
|
8211
|
+
if (canvas && !ctx) {
|
|
8212
|
+
ctx = canvas.getContext('2d');
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8215
|
+
else {
|
|
8216
|
+
ctx.fillStyle = 'white';
|
|
8217
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
8218
|
+
const currentScreen = store$1.state.currentScreen;
|
|
8219
|
+
const screen = getConfig().screens[currentScreen];
|
|
8220
|
+
const bg = screen.background;
|
|
8221
|
+
ctx.drawImage(images[bg], 0, 0);
|
|
8222
|
+
let foundCollision = false;
|
|
8223
|
+
const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
|
|
8224
|
+
if (screen.buttons) {
|
|
8225
|
+
for (const buttonName of screen.buttons) {
|
|
8226
|
+
if (store$1.state.buttons[buttonName].enabled) {
|
|
8227
|
+
const button = getConfig().buttons[buttonName];
|
|
8228
|
+
const image = images[button.background];
|
|
8229
|
+
ctx.drawImage(image, button.position.left, button.position.top);
|
|
8230
|
+
if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
|
|
8231
|
+
foundCollision = true;
|
|
8232
|
+
}
|
|
8233
|
+
}
|
|
8234
|
+
}
|
|
8235
|
+
}
|
|
8236
|
+
if (foundCollision) {
|
|
8237
|
+
document.body.style.cursor = 'pointer';
|
|
8238
|
+
}
|
|
8239
|
+
else {
|
|
8240
|
+
document.body.style.cursor = 'default';
|
|
8241
|
+
}
|
|
8242
|
+
ctx.fillStyle = 'black';
|
|
8243
|
+
ctx.textAlign = 'left';
|
|
8244
|
+
// ctx.fillText(`x: ${scaledMousePos.x}, y: ${scaledMousePos.y}`, 0, 20);
|
|
8245
|
+
}
|
|
8246
|
+
}
|
|
8247
|
+
else {
|
|
8248
|
+
canvas = undefined;
|
|
8249
|
+
ctx = undefined;
|
|
8250
|
+
}
|
|
8251
|
+
window.requestAnimationFrame(gameLoop);
|
|
8252
|
+
}
|
|
8253
|
+
function mouseclick(e) {
|
|
8254
|
+
if (!canvas) {
|
|
8255
|
+
return;
|
|
8256
|
+
}
|
|
8257
|
+
mousePos.x = e.clientX;
|
|
8258
|
+
mousePos.y = e.clientY;
|
|
8259
|
+
const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
|
|
8260
|
+
const currentScreen = store$1.state.currentScreen;
|
|
8261
|
+
const screen = getConfig().screens[currentScreen];
|
|
8262
|
+
if (screen.buttons) {
|
|
8263
|
+
for (const buttonName of screen.buttons) {
|
|
8264
|
+
if (store$1.state.buttons[buttonName].enabled) {
|
|
8265
|
+
const button = getConfig().buttons[buttonName];
|
|
8266
|
+
if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
|
|
8267
|
+
// clicked button
|
|
8268
|
+
const scriptToRun = button.action;
|
|
8269
|
+
const newStack = {
|
|
8270
|
+
branch: store$1.state.machine.script[scriptToRun],
|
|
8271
|
+
currentIndex: 0,
|
|
8272
|
+
label: scriptToRun,
|
|
8273
|
+
};
|
|
8274
|
+
store$1.commit('setStack', newStack);
|
|
8275
|
+
store$1.dispatch('runLine');
|
|
8276
|
+
}
|
|
8277
|
+
}
|
|
8278
|
+
}
|
|
8279
|
+
}
|
|
8280
|
+
}
|
|
8281
|
+
|
|
8282
|
+
class CommandPlugin {
|
|
8283
|
+
keyword;
|
|
8284
|
+
runner;
|
|
8285
|
+
parser;
|
|
8286
|
+
constructor(keyword, runner, parser) {
|
|
8287
|
+
this.keyword = keyword;
|
|
8288
|
+
this.runner = runner;
|
|
8289
|
+
this.parser = parser;
|
|
8290
|
+
}
|
|
8291
|
+
}
|
|
8292
|
+
function generateParser(keyword) {
|
|
8293
|
+
return (ctx) => {
|
|
8294
|
+
ctx.command.commandType = keyword;
|
|
8295
|
+
ctx.currentLine++;
|
|
8296
|
+
};
|
|
8297
|
+
}
|
|
8298
|
+
|
|
8299
|
+
const add = async (context, cmd, choices) => {
|
|
8300
|
+
const { commit, dispatch } = context;
|
|
8301
|
+
const addKey = cmd.args[0];
|
|
8302
|
+
const addValue = cmd.args[1];
|
|
8303
|
+
commit('addInstruction', { path: addKey, value: addValue });
|
|
8304
|
+
return dispatch('nextLine');
|
|
8305
|
+
};
|
|
8306
|
+
const addPlugin = new CommandPlugin('add', add, generateParser('add'));
|
|
8307
|
+
|
|
8308
|
+
const addLevelRunner = async (context, cmd) => {
|
|
8309
|
+
const { commit, dispatch } = context;
|
|
8310
|
+
const skillKey = cmd.args[0];
|
|
8311
|
+
const levelToAdd = cmd.args[1];
|
|
8312
|
+
if (!skillKey || !levelToAdd) {
|
|
8313
|
+
error(commit, `add_level command needs a skill id and a value as parameters`);
|
|
8314
|
+
}
|
|
8315
|
+
dispatch('incrementSkill', {
|
|
8316
|
+
skill: skillKey,
|
|
8317
|
+
amount: levelToAdd,
|
|
8318
|
+
});
|
|
8319
|
+
return dispatch('nextLine');
|
|
8320
|
+
};
|
|
8321
|
+
const addLevelParser = (ctx) => {
|
|
8322
|
+
ctx.command.commandType = 'add_level';
|
|
8323
|
+
ctx.currentLine++;
|
|
8324
|
+
};
|
|
8325
|
+
const addLevelPlugin = new CommandPlugin('add_level', addLevelRunner, addLevelParser);
|
|
8326
|
+
|
|
8327
|
+
const addStatRunner = async (context, cmd) => {
|
|
8328
|
+
const { commit, dispatch } = context;
|
|
8329
|
+
const statKey = cmd.args[0];
|
|
8330
|
+
const amountToAdd = cmd.args[1];
|
|
8331
|
+
if (!statKey || !amountToAdd) {
|
|
8332
|
+
error(commit, `add_stat command needs a stat id and a value as parameters`);
|
|
8333
|
+
}
|
|
8334
|
+
commit('addStat', {
|
|
8335
|
+
stat: statKey,
|
|
8336
|
+
amount: amountToAdd,
|
|
8337
|
+
});
|
|
8338
|
+
return dispatch('nextLine');
|
|
8339
|
+
};
|
|
8340
|
+
const addStatParser = (ctx) => {
|
|
8341
|
+
ctx.command.commandType = 'add_stat';
|
|
8342
|
+
ctx.currentLine++;
|
|
8343
|
+
};
|
|
8344
|
+
const addStatPlugin = new CommandPlugin('add_stat', addStatRunner, addStatParser);
|
|
8345
|
+
|
|
8346
|
+
const addXp = async (context, cmd) => {
|
|
8347
|
+
const { commit, dispatch } = context;
|
|
8348
|
+
const xpKey = cmd.args[0];
|
|
8349
|
+
const xpToAdd = cmd.args[1];
|
|
8350
|
+
if (!xpKey || !xpToAdd) {
|
|
8351
|
+
error(commit, `add_xp command needs a skill id and a value as parameters`);
|
|
8352
|
+
}
|
|
8353
|
+
dispatch('addXp', {
|
|
8354
|
+
skill: xpKey,
|
|
8355
|
+
amount: xpToAdd,
|
|
8356
|
+
});
|
|
8357
|
+
return dispatch('nextLine');
|
|
8358
|
+
};
|
|
8359
|
+
const addXpPlugin = new CommandPlugin('add_xp', addXp, generateParser('add_xp'));
|
|
8360
|
+
|
|
8361
|
+
const choice = async (context, cmd) => {
|
|
8362
|
+
await runChoice(context, cmd);
|
|
8363
|
+
};
|
|
8364
|
+
async function runChoice(context, cmd) {
|
|
8365
|
+
const options = cmd.options;
|
|
8366
|
+
const prompt = options.prompt;
|
|
8367
|
+
const choices = options.choices
|
|
8368
|
+
.filter((choice) => {
|
|
8369
|
+
// Delete the choice if it fails a condition
|
|
8370
|
+
if (choice.condition) {
|
|
8371
|
+
return runCondition(context, choice.condition);
|
|
8372
|
+
}
|
|
8373
|
+
if (choice.skillCheck) {
|
|
8374
|
+
if (!getSkillCheckState(context, choice.skillCheck.id).available &&
|
|
8375
|
+
choice.skillCheck.hideAfterRoll) {
|
|
8376
|
+
return false;
|
|
8377
|
+
}
|
|
8378
|
+
}
|
|
8379
|
+
return true;
|
|
8380
|
+
})
|
|
8381
|
+
.map((choice) => {
|
|
8382
|
+
let text = choice.choice;
|
|
8383
|
+
let choiceAllowed = true;
|
|
8384
|
+
if (choice.skillCheck) {
|
|
8385
|
+
const check = choice.skillCheck;
|
|
8386
|
+
const { difficultyText, allowed } = getSkillCheckText({
|
|
8387
|
+
context,
|
|
8388
|
+
skill: check.skill,
|
|
8389
|
+
skillCheckId: check.id,
|
|
8390
|
+
value: check.value,
|
|
8391
|
+
});
|
|
8392
|
+
text = `${difficultyText} ${text}`;
|
|
8393
|
+
choiceAllowed = allowed;
|
|
8394
|
+
}
|
|
8395
|
+
const result = {
|
|
8396
|
+
choice: text,
|
|
8397
|
+
originalIndex: choice.index,
|
|
8398
|
+
allowed: choiceAllowed,
|
|
8399
|
+
};
|
|
8400
|
+
return result;
|
|
8401
|
+
});
|
|
8402
|
+
runCommand(context, prompt, choices);
|
|
8403
|
+
}
|
|
8404
|
+
const choiceParser = (ctx) => {
|
|
8405
|
+
const { line, command } = ctx;
|
|
8406
|
+
if (!line.branch || line.branch.length < 2) {
|
|
8407
|
+
ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
|
|
8408
|
+
}
|
|
8409
|
+
const prompt = line.branch[0];
|
|
8410
|
+
const choices = line.branch.slice(1);
|
|
8411
|
+
const prompts = choices.map((choice, index) => {
|
|
8412
|
+
if (!choice.branch) {
|
|
8413
|
+
ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
|
|
8414
|
+
}
|
|
8415
|
+
return parseChoiceOption(ctx, choice, index);
|
|
8416
|
+
});
|
|
8417
|
+
command.options = {
|
|
8418
|
+
prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
|
|
8419
|
+
choices: prompts,
|
|
8420
|
+
};
|
|
8421
|
+
command.commandType = 'choice';
|
|
8422
|
+
ctx.currentLine++;
|
|
8423
|
+
};
|
|
8424
|
+
function parseChoiceOption(ctx, choice, index) {
|
|
8425
|
+
let choiceText = choice.operator;
|
|
8426
|
+
let condition;
|
|
8427
|
+
let skillCheck;
|
|
8428
|
+
if (choice.operator === 'roll') {
|
|
8429
|
+
if (choice.args.length < 4) {
|
|
8430
|
+
ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
|
|
8431
|
+
}
|
|
8432
|
+
choiceText = choice.args[3];
|
|
8433
|
+
const hideAfterRoll = choice.args.length >= 5;
|
|
8434
|
+
const successBranch = choice.branch[0];
|
|
8435
|
+
const failureBranch = choice.branch[1];
|
|
8436
|
+
const success = {
|
|
8437
|
+
text: successBranch.args[0],
|
|
8438
|
+
branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
|
|
8439
|
+
};
|
|
8440
|
+
let failedBranch;
|
|
8441
|
+
if (failureBranch.branch) {
|
|
8442
|
+
failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
|
|
8443
|
+
}
|
|
8444
|
+
const failure = {
|
|
8445
|
+
text: failureBranch.args[0],
|
|
8446
|
+
branch: failedBranch,
|
|
8447
|
+
};
|
|
8448
|
+
skillCheck = {
|
|
8449
|
+
id: choice.args[0],
|
|
8450
|
+
skill: choice.args[1],
|
|
8451
|
+
value: choice.args[2],
|
|
8452
|
+
hideAfterRoll,
|
|
8453
|
+
success,
|
|
8454
|
+
failure,
|
|
8455
|
+
};
|
|
8456
|
+
}
|
|
8457
|
+
if (choice.args[0] === 'if') {
|
|
8458
|
+
condition = choice.args[1];
|
|
8459
|
+
}
|
|
8460
|
+
return {
|
|
8461
|
+
choice: choiceText,
|
|
8462
|
+
condition,
|
|
8463
|
+
skillCheck,
|
|
8464
|
+
branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
|
|
8465
|
+
index,
|
|
8289
8466
|
};
|
|
8290
|
-
}
|
|
8467
|
+
}
|
|
8468
|
+
const choicePlugin = new CommandPlugin('choice', choice, choiceParser);
|
|
8291
8469
|
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
x: 0,
|
|
8297
|
-
y: 0,
|
|
8470
|
+
const clearDialog = async (context, cmd) => {
|
|
8471
|
+
const { commit, dispatch } = context;
|
|
8472
|
+
commit('clearDialog');
|
|
8473
|
+
return dispatch('nextLine');
|
|
8298
8474
|
};
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8475
|
+
const clearDialogPlugin = new CommandPlugin('clear_dialog', clearDialog, generateParser('clear_dialog'));
|
|
8476
|
+
|
|
8477
|
+
const ifFunction = async (context, cmd) => {
|
|
8478
|
+
const { commit, dispatch } = context;
|
|
8479
|
+
const newBranch = runConditionCommand(context, cmd);
|
|
8480
|
+
if (newBranch) {
|
|
8481
|
+
const newStack = {
|
|
8482
|
+
branch: newBranch,
|
|
8483
|
+
currentIndex: 0,
|
|
8484
|
+
};
|
|
8485
|
+
commit('addStack', newStack);
|
|
8486
|
+
return dispatch('runLine');
|
|
8487
|
+
}
|
|
8488
|
+
return dispatch('nextLine');
|
|
8489
|
+
};
|
|
8490
|
+
const ifParser = (ctx) => {
|
|
8491
|
+
const { command, lines, currentLine, line } = ctx;
|
|
8492
|
+
command.commandType = 'if';
|
|
8493
|
+
let failure;
|
|
8494
|
+
const nextLine = getLine(lines, currentLine + 1);
|
|
8495
|
+
if (nextLine && nextLine.operator === 'else') {
|
|
8496
|
+
failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
|
|
8497
|
+
ctx.currentLine++;
|
|
8498
|
+
}
|
|
8499
|
+
command.options = {
|
|
8500
|
+
condition: command.args[0],
|
|
8501
|
+
success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
|
|
8502
|
+
failure,
|
|
8503
|
+
};
|
|
8504
|
+
ctx.currentLine++;
|
|
8505
|
+
};
|
|
8506
|
+
const ifCommand = new CommandPlugin('if', ifFunction, ifParser);
|
|
8507
|
+
|
|
8508
|
+
const jump = async (context, cmd, choices) => {
|
|
8509
|
+
const { state, commit, dispatch } = context;
|
|
8510
|
+
const branch = cmd.args[0];
|
|
8511
|
+
const newStack = {
|
|
8512
|
+
branch: state.machine.script[branch],
|
|
8513
|
+
label: branch,
|
|
8514
|
+
currentIndex: 0,
|
|
8515
|
+
};
|
|
8516
|
+
commit('setStack', newStack);
|
|
8517
|
+
await dispatch('saveGame');
|
|
8518
|
+
await dispatch('runLine');
|
|
8519
|
+
};
|
|
8520
|
+
const jumpCommand = new CommandPlugin('jump', jump, generateParser('jump'));
|
|
8521
|
+
|
|
8522
|
+
const notify = async (context, cmd) => {
|
|
8523
|
+
const { dispatch } = context;
|
|
8524
|
+
const text = cmd.args[0];
|
|
8525
|
+
dispatch('addNotification', text);
|
|
8526
|
+
return dispatch('nextLine');
|
|
8527
|
+
};
|
|
8528
|
+
const notifyPlugin = new CommandPlugin('notify', notify, generateParser('notify'));
|
|
8529
|
+
|
|
8530
|
+
const pause = async (context, cmd) => {
|
|
8531
|
+
const { commit, dispatch } = context;
|
|
8532
|
+
const pauseOptions = cmd.options;
|
|
8533
|
+
if (pauseOptions.mode === 'music') {
|
|
8534
|
+
pauseAudio(commit, context.state.audio.currentMusic);
|
|
8535
|
+
}
|
|
8536
|
+
else if (pauseOptions.mode === 'sound' && pauseOptions.audio) {
|
|
8537
|
+
pauseAudio(commit, pauseOptions.audio);
|
|
8347
8538
|
}
|
|
8348
8539
|
else {
|
|
8349
|
-
|
|
8350
|
-
ctx = undefined;
|
|
8540
|
+
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.`);
|
|
8351
8541
|
}
|
|
8352
|
-
|
|
8353
|
-
}
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8542
|
+
return dispatch('nextLine');
|
|
8543
|
+
};
|
|
8544
|
+
const pauseParser = (ctx) => {
|
|
8545
|
+
const { command } = ctx;
|
|
8546
|
+
command.commandType = 'pause';
|
|
8547
|
+
command.options = {
|
|
8548
|
+
mode: command.args[0],
|
|
8549
|
+
audio: command.args[1],
|
|
8550
|
+
};
|
|
8551
|
+
ctx.currentLine++;
|
|
8552
|
+
};
|
|
8553
|
+
const pauseCommand = new CommandPlugin('pause', pause, pauseParser);
|
|
8554
|
+
|
|
8555
|
+
const play = async (context, cmd) => {
|
|
8556
|
+
const { dispatch } = context;
|
|
8557
|
+
const playOptions = cmd.options;
|
|
8558
|
+
if (playOptions.mode === 'music') {
|
|
8559
|
+
changeMusic(context, playOptions.audio);
|
|
8357
8560
|
}
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8561
|
+
else {
|
|
8562
|
+
playAudio(context.commit, playOptions.audio);
|
|
8563
|
+
}
|
|
8564
|
+
return dispatch('nextLine');
|
|
8565
|
+
};
|
|
8566
|
+
const playParser = (ctx) => {
|
|
8567
|
+
const { command } = ctx;
|
|
8568
|
+
command.commandType = 'play';
|
|
8569
|
+
command.options = {
|
|
8570
|
+
mode: command.args[0],
|
|
8571
|
+
audio: command.args[1],
|
|
8572
|
+
};
|
|
8573
|
+
ctx.currentLine++;
|
|
8574
|
+
};
|
|
8575
|
+
const playCommand = new CommandPlugin('play', play, playParser);
|
|
8576
|
+
|
|
8577
|
+
const set = async (context, cmd, choices) => {
|
|
8578
|
+
const { commit, dispatch } = context;
|
|
8579
|
+
const key = cmd.args[0];
|
|
8580
|
+
const value = cmd.args[1];
|
|
8581
|
+
commit('setData', { path: key, value });
|
|
8582
|
+
return dispatch('nextLine');
|
|
8583
|
+
};
|
|
8584
|
+
const setCommand = new CommandPlugin('set', set, generateParser('set'));
|
|
8585
|
+
|
|
8586
|
+
const setButton = async (context, cmd) => {
|
|
8587
|
+
const { commit, dispatch } = context;
|
|
8588
|
+
commit('changeButton', {
|
|
8589
|
+
button: cmd.args[0],
|
|
8590
|
+
enabled: cmd.args[1],
|
|
8591
|
+
});
|
|
8592
|
+
return dispatch('nextLine');
|
|
8593
|
+
};
|
|
8594
|
+
const setButtonParser = (ctx) => {
|
|
8595
|
+
const { command, line } = ctx;
|
|
8596
|
+
command.commandType = 'set_button';
|
|
8597
|
+
if (command.args.length !== 2) {
|
|
8598
|
+
ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
|
|
8599
|
+
}
|
|
8600
|
+
ctx.currentLine++;
|
|
8601
|
+
};
|
|
8602
|
+
const setButtonCommand = new CommandPlugin('set_button', setButton, setButtonParser);
|
|
8603
|
+
|
|
8604
|
+
const setScreen = async (context, cmd) => {
|
|
8605
|
+
const { commit, dispatch } = context;
|
|
8606
|
+
commit('setScreen', cmd.options.screen);
|
|
8607
|
+
return dispatch('nextLine');
|
|
8608
|
+
};
|
|
8609
|
+
const setScreenParser = (ctx) => {
|
|
8610
|
+
const { command } = ctx;
|
|
8611
|
+
command.commandType = 'set_screen';
|
|
8612
|
+
command.options = {
|
|
8613
|
+
screen: command.args[0],
|
|
8614
|
+
};
|
|
8615
|
+
ctx.currentLine++;
|
|
8616
|
+
};
|
|
8617
|
+
const setScreenCommand = new CommandPlugin('set_screen', setScreen, setScreenParser);
|
|
8618
|
+
|
|
8619
|
+
const setStat = async (context, cmd) => {
|
|
8620
|
+
const { commit, dispatch } = context;
|
|
8621
|
+
const setStatKey = cmd.args[0];
|
|
8622
|
+
const setAmount = cmd.args[1];
|
|
8623
|
+
if (!setStatKey || !setAmount) {
|
|
8624
|
+
error(commit, `set_stat command needs a stat id and a value as parameters`);
|
|
8625
|
+
}
|
|
8626
|
+
commit('setStat', {
|
|
8627
|
+
stat: setStatKey,
|
|
8628
|
+
amount: setAmount,
|
|
8629
|
+
});
|
|
8630
|
+
return dispatch('nextLine');
|
|
8631
|
+
};
|
|
8632
|
+
const setStatCommand = new CommandPlugin('set_stat', setStat, generateParser('set_stat'));
|
|
8633
|
+
|
|
8634
|
+
const stop = async (context, cmd) => {
|
|
8635
|
+
const { commit, dispatch } = context;
|
|
8636
|
+
const stopOptions = cmd.options;
|
|
8637
|
+
if (stopOptions.mode === 'music') {
|
|
8638
|
+
stopAudio(commit, context.state.audio.currentMusic);
|
|
8639
|
+
}
|
|
8640
|
+
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
8641
|
+
stopAudio(commit, stopOptions.audio);
|
|
8642
|
+
}
|
|
8643
|
+
else {
|
|
8644
|
+
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.`);
|
|
8645
|
+
}
|
|
8646
|
+
return dispatch('nextLine');
|
|
8647
|
+
};
|
|
8648
|
+
const stopParser = (ctx) => {
|
|
8649
|
+
const { command } = ctx;
|
|
8650
|
+
command.commandType = 'stop';
|
|
8651
|
+
command.options = {
|
|
8652
|
+
mode: command.args[0],
|
|
8653
|
+
audio: command.args[1],
|
|
8654
|
+
};
|
|
8655
|
+
ctx.currentLine++;
|
|
8656
|
+
};
|
|
8657
|
+
const stopCommand = new CommandPlugin('stop', stop, stopParser);
|
|
8658
|
+
|
|
8659
|
+
const talk = async (context, cmd, choices) => {
|
|
8660
|
+
const { commit } = context;
|
|
8661
|
+
await textCommand(commit, {
|
|
8662
|
+
speaker: cmd.args[0],
|
|
8663
|
+
pose: cmd.args[1],
|
|
8664
|
+
text: `"${cmd.args[2]}"`,
|
|
8665
|
+
choices,
|
|
8666
|
+
interactive: true,
|
|
8667
|
+
});
|
|
8668
|
+
};
|
|
8669
|
+
const talkParser = (ctx) => {
|
|
8670
|
+
const { command, line } = ctx;
|
|
8671
|
+
command.commandType = 'talk';
|
|
8672
|
+
if (command.args.length < 3) {
|
|
8673
|
+
ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
|
|
8380
8674
|
}
|
|
8675
|
+
ctx.currentLine++;
|
|
8676
|
+
};
|
|
8677
|
+
const talkCommand = new CommandPlugin('talk', talk, talkParser);
|
|
8678
|
+
|
|
8679
|
+
const text = async (context, cmd, choices) => {
|
|
8680
|
+
const { commit } = context;
|
|
8681
|
+
await textCommand(commit, {
|
|
8682
|
+
speaker: 'game',
|
|
8683
|
+
text: cmd.options.text,
|
|
8684
|
+
choices,
|
|
8685
|
+
interactive: true,
|
|
8686
|
+
});
|
|
8687
|
+
};
|
|
8688
|
+
const textParser = (ctx) => {
|
|
8689
|
+
const { command, line } = ctx;
|
|
8690
|
+
command.commandType = 'text';
|
|
8691
|
+
command.options = {
|
|
8692
|
+
text: line.operator,
|
|
8693
|
+
};
|
|
8694
|
+
ctx.currentLine++;
|
|
8695
|
+
};
|
|
8696
|
+
const textCommandPlugin = new CommandPlugin('text', text, textParser);
|
|
8697
|
+
|
|
8698
|
+
const wait = async (context, cmd) => {
|
|
8699
|
+
const { dispatch } = context;
|
|
8700
|
+
await timeout(cmd.options.duration);
|
|
8701
|
+
return dispatch('nextLine');
|
|
8702
|
+
};
|
|
8703
|
+
const waitParser = (ctx) => {
|
|
8704
|
+
const { command } = ctx;
|
|
8705
|
+
command.commandType = 'wait';
|
|
8706
|
+
command.options = {
|
|
8707
|
+
duration: parseInt(command.args[0], 10),
|
|
8708
|
+
};
|
|
8709
|
+
ctx.currentLine++;
|
|
8710
|
+
};
|
|
8711
|
+
const waitCommand = new CommandPlugin('wait', wait, waitParser);
|
|
8712
|
+
|
|
8713
|
+
function registerBaseCommands(vm) {
|
|
8714
|
+
vm.addCommand(addLevelPlugin);
|
|
8715
|
+
vm.addCommand(addStatPlugin);
|
|
8716
|
+
vm.addCommand(addXpPlugin);
|
|
8717
|
+
vm.addCommand(addPlugin);
|
|
8718
|
+
vm.addCommand(choicePlugin);
|
|
8719
|
+
vm.addCommand(clearDialogPlugin);
|
|
8720
|
+
vm.addCommand(ifCommand);
|
|
8721
|
+
vm.addCommand(jumpCommand);
|
|
8722
|
+
vm.addCommand(notifyPlugin);
|
|
8723
|
+
vm.addCommand(pauseCommand);
|
|
8724
|
+
vm.addCommand(playCommand);
|
|
8725
|
+
vm.addCommand(setButtonCommand);
|
|
8726
|
+
vm.addCommand(setScreenCommand);
|
|
8727
|
+
vm.addCommand(setStatCommand);
|
|
8728
|
+
vm.addCommand(setCommand);
|
|
8729
|
+
vm.addCommand(stopCommand);
|
|
8730
|
+
vm.addCommand(talkCommand);
|
|
8731
|
+
vm.addCommand(textCommandPlugin);
|
|
8732
|
+
vm.addCommand(waitCommand);
|
|
8733
|
+
}
|
|
8734
|
+
|
|
8735
|
+
class NarratPlugin {
|
|
8736
|
+
onPageLoaded() { }
|
|
8737
|
+
onNarratSetup() { }
|
|
8738
|
+
onAppMounted() { }
|
|
8739
|
+
onAssetsLoaded() { }
|
|
8740
|
+
onGameSetup() { }
|
|
8741
|
+
onGameStart() { }
|
|
8742
|
+
onGameMounted() { }
|
|
8743
|
+
onGameDismounted() { }
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8746
|
+
function registerPlugin(plugin) {
|
|
8747
|
+
vm$1.addPlugin(plugin);
|
|
8748
|
+
}
|
|
8749
|
+
function addCommand(command) {
|
|
8750
|
+
vm$1.addCommand(command);
|
|
8381
8751
|
}
|
|
8382
8752
|
|
|
8753
|
+
var plugins = /*#__PURE__*/Object.freeze({
|
|
8754
|
+
__proto__: null,
|
|
8755
|
+
CommandPlugin: CommandPlugin,
|
|
8756
|
+
NarratPlugin: NarratPlugin,
|
|
8757
|
+
registerPlugin: registerPlugin,
|
|
8758
|
+
addCommand: addCommand,
|
|
8759
|
+
generateParser: generateParser
|
|
8760
|
+
});
|
|
8761
|
+
|
|
8762
|
+
var display = /*#__PURE__*/Object.freeze({
|
|
8763
|
+
__proto__: null,
|
|
8764
|
+
aspectRatioFit: aspectRatioFit
|
|
8765
|
+
});
|
|
8766
|
+
|
|
8383
8767
|
let app;
|
|
8384
8768
|
let store$2;
|
|
8769
|
+
vm$1.callHook('onPageLoaded');
|
|
8385
8770
|
async function startApp(config, options) {
|
|
8771
|
+
registerBaseCommands(vm$1);
|
|
8772
|
+
logManager.setupDebugger(options.debug);
|
|
8386
8773
|
const configFile = await getFile('data/config.json');
|
|
8387
8774
|
setConfig(JSON.parse(configFile));
|
|
8388
|
-
console.log('%c Narrat game engine – 0.
|
|
8775
|
+
console.log('%c Narrat game engine – 0.11.1 - June 15, 2022 15:34:03', 'background: #222; color: #bada55');
|
|
8776
|
+
vm$1.callHook('onNarratSetup');
|
|
8389
8777
|
const storeSetup = setupStore(options);
|
|
8390
8778
|
store$2 = storeSetup.store;
|
|
8391
8779
|
app = createApp(script$b, {
|
|
@@ -8407,6 +8795,10 @@ async function startApp(config, options) {
|
|
|
8407
8795
|
store: store$2,
|
|
8408
8796
|
app,
|
|
8409
8797
|
state: store$2.state,
|
|
8798
|
+
vm: vm$1,
|
|
8799
|
+
jump: (label) => {
|
|
8800
|
+
store$2.dispatch('runLabel', label);
|
|
8801
|
+
},
|
|
8410
8802
|
};
|
|
8411
8803
|
window.narrat = narrat;
|
|
8412
8804
|
}
|
|
@@ -8419,7 +8811,14 @@ async function startApp(config, options) {
|
|
|
8419
8811
|
});
|
|
8420
8812
|
}
|
|
8421
8813
|
startGameLoop(store$2);
|
|
8422
|
-
}
|
|
8814
|
+
}
|
|
8815
|
+
var index = {
|
|
8816
|
+
startApp,
|
|
8817
|
+
plugins,
|
|
8818
|
+
display,
|
|
8819
|
+
config: config$2,
|
|
8820
|
+
};
|
|
8423
8821
|
|
|
8424
|
-
export
|
|
8822
|
+
export default index;
|
|
8823
|
+
export { config$2 as config, display, plugins, startApp };
|
|
8425
8824
|
//# sourceMappingURL=index.esm.js.map
|