narrat 0.10.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +30 -30
- package/lib/demo/bitsy/bitsy.d.ts +27 -0
- package/lib/display.d.ts +2 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.esm.js +1088 -962
- package/lib/index.js +1096 -961
- 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/skillchecks.d.ts +1 -1
- 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 -85
- package/CHANGELOG.md +0 -273
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version: 0.
|
|
1
|
+
// Version: 0.11.2 - June 15, 2022 15:56:51
|
|
2
2
|
import 'es6-promise/auto';
|
|
3
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';
|
|
@@ -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 --skills-xp-bar-height: 40px;\n --skill-check-name-color: orange;\n --skill-check-difficulty: orange;\n --skill-check-success: green;\n --skill-check-failed: red;\n --skill-check-color: orange;\n --dialog-choice-color: orange;\n --dialog-choice-hover-color: var(--text-color);\n}\n\n.list-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.list-enter-active,\n.list-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .list-move {\n transition: transform 0.3s ease;\n} */\n\n.list-enter-from,\n.list-leave-to {\n opacity: 0;\n transform: translateX(300px);\n}\n\n.notification-item {\n display: inline-block;\n margin-right: 10px;\n}\n\n.notification-enter-active,\n.notification-leave-active {\n transition: all 0.3s ease;\n}\n\n/* .notification-move {\n transition: transform 0.3s ease;\n} */\n\n.notification-enter-from,\n.notification-leave-to {\n opacity: 0;\n transform: translateY(-300px);\n}\n\n.fade-enter-active,\n.fade-leave-active {\n transition: opacity 0.3s ease;\n}\n\n.fade-enter-from,\n.fade-leave-to {\n opacity: 0;\n}\n\n.fade-in-enter-active {\n transition: opacity 0.1s ease;\n}\n\n.fade-in-enter-from {\n opacity: 0;\n}\n\nbody {\n padding: 0;\n margin: 0;\n font-family: Arial, sans-serif;\n background-color: black;\n}\n\n.select {\n background: var(--light-background);\n padding: 10px;\n}\n\n.option {\n background-color: var(--light-2);\n padding: 5px;\n color: var(--text-color);\n}\n\n.button {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.button:focus,\n.button:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\n.input {\n background: var(--light-background);\n color: var(--text-color);\n box-shadow: 0.4rem 0.4rem 2.4rem 0.2rem var(--shadow-1);\n border-radius: 100px;\n padding: 10px;\n font-weight: 800;\n font-size: 16px;\n margin: 10px;\n transition: 0.2s;\n}\n\n.input:focus,\n.input:hover {\n transform: translateY(-0.2rem);\n box-shadow: 0 0 2.4rem 0.2rem var(--shadow-2);\n}\n\na {\n color: pink;\n text-decoration: underline;\n}\n\nth,\ntd {\n padding: 4px;\n border: 1px solid var(--text-color);\n text-align: center;\n}\n\n#game-holder {\n width: 100vw;\n height: 100vh;\n padding: 0;\n margin: 0;\n top: 0;\n left: 0;\n background-color: black;\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: -webkit-fill-available;\n}\n\n.title {\n font-size: 30px;\n font-weight: 700;\n text-align: center;\n}\n\n.container {\n padding: 20px;\n}\n\nh1,\nh2,\nh3,\nh4 {\n font-weight: 700;\n}\n\nh1 {\n font-size: 30px;\n}\n\nh2 {\n font-size: 26px;\n}\n\nh3 {\n font-size: 24px;\n}\n\nhr.solid {\n border: 1px solid var(--text-color);\n margin-top: 30px;\n margin-bottom: 30px;\n}\n\n.card-1 {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n.card-1:hover {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-2 {\n box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-3 {\n box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);\n}\n\n.card-4 {\n box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);\n}\n\n.card-5 {\n box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22);\n}\n\n.dialog-choice {\n transition: 0.2s;\n}\n\n.dialog-choice:hover {\n transform: scale(1.05, 1.05);\n transform-origin: center;\n}\n\n/* Somewhat arcane CSS to force the hover color to override the child style.\nOtherwise hovering choices doesn't change the color of skill check prompts. */\n\n.dialog-choice:not(:hover) > .skill-check-name,\n.passive-skill-check > .skill-check-name {\n color: var(--skill-check-name-color);\n}\n\n.dialog-choice:not(:hover) > .skill-check-difficulty,\n.passive-skill-check > .skill-check-difficulty {\n color: var(--skill-check-difficulty);\n}\n\n.skill-check-difficulty {\n font-weight: 700;\n}\n\n.dialog-choice:not(:hover) > .skill-check-success,\n.passive-skill-check > .skill-check-success {\n color: var(--skill-check-success);\n}\n\n.dialog-choice:not(:hover) > .skill-check-failed,\n.passive-skill-check > .skill-check-failed {\n color: var(--skill-check-failed);\n}\n\n.dialog-choice:not(:hover) > .skill-check,\n.passive-skill-check.skill-check {\n color: var(--skill-check-color);\n}\n\n/* Looks ugly */\n\n/* @keyframes strike-anim {\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n}\n.strike-anim {\n position: relative;\n}\n.strike-anim::after {\n content: ' ';\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n height: 1px;\n background: var(--text-color);\n animation-name: strike-anim;\n animation-duration: 0.5s;\n animation-timing-function: linear;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n} */\n\n@media (min-width: 640px) {\n}\n\n@media (min-width: 768px) {\n}\n\n@media (min-width: 1024px) {\n}\n\n@media (min-width: 1280px) {\n}\n\n@media (min-width: 1536px) {\n}\n";
|
|
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;}};
|
|
@@ -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: {
|
|
@@ -244,7 +247,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
244
247
|
], 4))
|
|
245
248
|
}
|
|
246
249
|
|
|
247
|
-
var css_248z$1 = ".dialog-title {\n font-size: 20px;\n font-weight: bold;\n}\n\n.dialog-text {\n font-size: 16px;\n}\n\n.dialog-box {\n /* border-radius: 10px; */\n /* border: 1px solid #a8a8a8; */\n color: var(--text-color);\n /* background-color: #2e2e2e; */\n padding: 10px;\n padding-left: 2em;\n margin-bottom: 10px;\n}\n\n.dialog-choice {\n color: var(--dialog-choice-color);\n}\n\n.dialog-choice:hover {\n color: var(--dialog-choice-hover-color);\n cursor: pointer;\n}\n\n.buttons-container {\n width: 100%;\n padding: 10px;\n display: flex;\n justify-content: space-evenly;\n align-items: stretch;\n box-sizing: border-box;\n}\n\n.interact-button {\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n height: 50px;\n color: var(--text-color);\n border: 1px solid black;\n font-weight: bold;\n font-size: 24px;\n text-align: center;\n flex-grow: 2;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.interact-button:not(:last-child) {\n margin-right: 10px;\n}\n";
|
|
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";
|
|
248
251
|
styleInject(css_248z$1);
|
|
249
252
|
|
|
250
253
|
script.render = render;
|
|
@@ -377,7 +380,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
377
380
|
], 4))
|
|
378
381
|
}
|
|
379
382
|
|
|
380
|
-
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";
|
|
383
|
+
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";
|
|
381
384
|
styleInject(css_248z$2);
|
|
382
385
|
|
|
383
386
|
script$1.render = render$1;
|
|
@@ -466,7 +469,7 @@ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
466
469
|
}))
|
|
467
470
|
}
|
|
468
471
|
|
|
469
|
-
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";
|
|
472
|
+
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";
|
|
470
473
|
styleInject(css_248z$3);
|
|
471
474
|
|
|
472
475
|
script$2.render = render$2;
|
|
@@ -2709,7 +2712,7 @@ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2709
2712
|
]))
|
|
2710
2713
|
}
|
|
2711
2714
|
|
|
2712
|
-
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";
|
|
2715
|
+
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";
|
|
2713
2716
|
styleInject(css_248z$4);
|
|
2714
2717
|
|
|
2715
2718
|
script$3.render = render$3;
|
|
@@ -6013,7 +6016,7 @@ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6013
6016
|
]))
|
|
6014
6017
|
}
|
|
6015
6018
|
|
|
6016
|
-
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";
|
|
6019
|
+
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";
|
|
6017
6020
|
styleInject(css_248z$5);
|
|
6018
6021
|
|
|
6019
6022
|
script$4.render = render$4;
|
|
@@ -6069,7 +6072,7 @@ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6069
6072
|
], 4))
|
|
6070
6073
|
}
|
|
6071
6074
|
|
|
6072
|
-
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";
|
|
6075
|
+
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";
|
|
6073
6076
|
styleInject(css_248z$6);
|
|
6074
6077
|
|
|
6075
6078
|
script$5.render = render$5;
|
|
@@ -6106,7 +6109,7 @@ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6106
6109
|
]))
|
|
6107
6110
|
}
|
|
6108
6111
|
|
|
6109
|
-
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";
|
|
6112
|
+
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";
|
|
6110
6113
|
styleInject(css_248z$7);
|
|
6111
6114
|
|
|
6112
6115
|
script$6.render = render$6;
|
|
@@ -6141,7 +6144,7 @@ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6141
6144
|
}))
|
|
6142
6145
|
}
|
|
6143
6146
|
|
|
6144
|
-
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";
|
|
6147
|
+
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";
|
|
6145
6148
|
styleInject(css_248z$8);
|
|
6146
6149
|
|
|
6147
6150
|
script$7.render = render$7;
|
|
@@ -6423,107 +6426,424 @@ function debounce(func, waitMilliseconds = 50, options = {}) {
|
|
|
6423
6426
|
return debouncedFunction;
|
|
6424
6427
|
}
|
|
6425
6428
|
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6429
|
+
function createSkillCheckState() {
|
|
6430
|
+
const skillCheck = {
|
|
6431
|
+
passed: false,
|
|
6432
|
+
available: true,
|
|
6433
|
+
};
|
|
6434
|
+
return skillCheck;
|
|
6435
|
+
}
|
|
6436
|
+
function getSkillCheckState(ctx, skillCheckId) {
|
|
6437
|
+
let skillCheck = ctx.state.skillChecks[skillCheckId];
|
|
6438
|
+
if (!skillCheck) {
|
|
6439
|
+
skillCheck = createSkillCheckState();
|
|
6440
|
+
ctx.commit('setupSkillCheck', {
|
|
6441
|
+
skillCheck,
|
|
6442
|
+
skillCheckId,
|
|
6440
6443
|
});
|
|
6441
|
-
}
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
showSkills() {
|
|
6458
|
-
if (Object.entries(getConfig().skills).length > 0) {
|
|
6459
|
-
return true;
|
|
6444
|
+
}
|
|
6445
|
+
return skillCheck;
|
|
6446
|
+
}
|
|
6447
|
+
function getSkillCheckDifficultyScore(value, level) {
|
|
6448
|
+
return value - level * getConfig().skillChecks.skillMultiplier;
|
|
6449
|
+
}
|
|
6450
|
+
function getSkillCheckDifficultyText(value, level) {
|
|
6451
|
+
const difficultyScore = getSkillCheckDifficultyScore(value, level);
|
|
6452
|
+
const checks = getConfig().skillChecks;
|
|
6453
|
+
let found = false;
|
|
6454
|
+
let i = 0;
|
|
6455
|
+
let checkText = checks.difficultyText[0][1];
|
|
6456
|
+
while (!found) {
|
|
6457
|
+
if (checks.difficultyText.length > i) {
|
|
6458
|
+
if (difficultyScore >= checks.difficultyText[i][0]) {
|
|
6459
|
+
checkText = checks.difficultyText[i][1];
|
|
6460
6460
|
}
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
}
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6461
|
+
else {
|
|
6462
|
+
found = true;
|
|
6463
|
+
}
|
|
6464
|
+
}
|
|
6465
|
+
else {
|
|
6466
|
+
found = true;
|
|
6467
|
+
}
|
|
6468
|
+
i++;
|
|
6469
|
+
}
|
|
6470
|
+
return checkText;
|
|
6471
|
+
}
|
|
6472
|
+
function getSkillCheckText({ context, skill, skillCheckId, value, }) {
|
|
6473
|
+
const skillCheckState = getSkillCheckState(context, skillCheckId);
|
|
6474
|
+
const skillConfig = getSkillConfig(context.commit, skill);
|
|
6475
|
+
const level = context.state.skills[skill].level;
|
|
6476
|
+
const difficultyText = getSkillCheckDifficultyText(value, level);
|
|
6477
|
+
let allowed = true;
|
|
6478
|
+
let text = `<span class='skill-check'>[<span class='skill-check-name'>${skillConfig.name}</span> - `;
|
|
6479
|
+
if (skillCheckState.available) {
|
|
6480
|
+
text += ` <span class='skill-check-difficulty'>${difficultyText}</span>]</span>`;
|
|
6481
|
+
}
|
|
6482
|
+
else if (skillCheckState.passed) {
|
|
6483
|
+
text = '';
|
|
6484
|
+
}
|
|
6485
|
+
else {
|
|
6486
|
+
allowed = false;
|
|
6487
|
+
text += ` <span class='skill-check-difficulty'>${difficultyText}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`;
|
|
6488
|
+
}
|
|
6489
|
+
return {
|
|
6490
|
+
difficultyText: text,
|
|
6491
|
+
allowed,
|
|
6492
|
+
};
|
|
6493
|
+
}
|
|
6494
|
+
function getPassiveSkillCheckText(ctx, success, params) {
|
|
6495
|
+
const skillConf = getSkillConfig(ctx.commit, params.skill);
|
|
6496
|
+
const difficultyText = getSkillCheckDifficultyText(params.value, ctx.state.skills[params.skill].level);
|
|
6497
|
+
return `<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${skillConf.name}</span> - <span class='skill-check-difficulty'>${difficultyText}</span> - ${success
|
|
6498
|
+
? '<span class="skill-check-success">Success</span>'
|
|
6499
|
+
: '<span class="skill-check-failed">Failure</span>'}]</span>`;
|
|
6500
|
+
}
|
|
6501
|
+
function calculateSkillCheckRoll(state, skill) {
|
|
6502
|
+
const { skillChecks } = getConfig();
|
|
6503
|
+
const unmodifiedRoll = Math.floor(Math.random() * skillChecks.rollRange);
|
|
6504
|
+
const rollModifier = state.skills[skill].level * skillChecks.skillMultiplier;
|
|
6505
|
+
const roll = unmodifiedRoll + rollModifier;
|
|
6506
|
+
logger.log(`[SKILL CHECK] Roll: ${roll}. (Base roll: ${unmodifiedRoll}, modifier: ${rollModifier} - Skill level: ${state.skills[skill].level})`);
|
|
6507
|
+
return {
|
|
6508
|
+
roll,
|
|
6509
|
+
unmodifiedRoll,
|
|
6510
|
+
};
|
|
6511
|
+
}
|
|
6512
|
+
function resolveSkillCheck(state, params) {
|
|
6513
|
+
const { skills, skillChecks } = getConfig();
|
|
6514
|
+
let success = true;
|
|
6515
|
+
const { roll } = calculateSkillCheckRoll(state, params.skill);
|
|
6516
|
+
if (roll <= skillChecks.failureChance - 1) {
|
|
6517
|
+
success = false;
|
|
6518
|
+
}
|
|
6519
|
+
const skill = skills[params.skill];
|
|
6520
|
+
if (roll < params.value) {
|
|
6521
|
+
success = false;
|
|
6522
|
+
}
|
|
6523
|
+
logger.log(`[SKILL CHECK ${skill.name}]: ${success ? '✅' : '❌'}`, `(${params.id}) - ${roll}/${params.value}`);
|
|
6524
|
+
return success;
|
|
6484
6525
|
}
|
|
6485
6526
|
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6527
|
+
function processSkillCheck(ctx, skillcheck) {
|
|
6528
|
+
return runSkillCheck(ctx, {
|
|
6529
|
+
skill: skillcheck.skill,
|
|
6530
|
+
value: skillcheck.value,
|
|
6531
|
+
id: skillcheck.id,
|
|
6532
|
+
success: skillcheck.success.text,
|
|
6533
|
+
failure: skillcheck.failure.text,
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
function runSkillCheck(ctx, params) {
|
|
6537
|
+
const { state } = ctx;
|
|
6538
|
+
const success = resolveSkillCheck(state, params);
|
|
6539
|
+
writeText(ctx, getPassiveSkillCheckText(ctx, success, params));
|
|
6540
|
+
if (success) {
|
|
6541
|
+
ctx.commit('passSkillCheck', params.id);
|
|
6542
|
+
return true;
|
|
6543
|
+
}
|
|
6544
|
+
ctx.commit('failSkillCheck', params.id);
|
|
6545
|
+
return false;
|
|
6546
|
+
}
|
|
6547
|
+
function runConditionCommand(ctx, command) {
|
|
6548
|
+
const options = command.options;
|
|
6549
|
+
const result = runCondition(ctx, options.condition);
|
|
6550
|
+
logger.log(result);
|
|
6551
|
+
if (result) {
|
|
6552
|
+
return options.success;
|
|
6553
|
+
}
|
|
6554
|
+
if (!result && options.failure) {
|
|
6555
|
+
return options.failure;
|
|
6556
|
+
}
|
|
6557
|
+
return undefined;
|
|
6558
|
+
}
|
|
6559
|
+
function writeText(ctx, text) {
|
|
6560
|
+
const dialog = {
|
|
6561
|
+
speaker: 'game',
|
|
6562
|
+
text,
|
|
6563
|
+
interactive: false,
|
|
6564
|
+
};
|
|
6565
|
+
ctx.commit('addDialog', {
|
|
6566
|
+
dialog,
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6569
|
+
function runCondition(ctx, condition) {
|
|
6570
|
+
return conditionFunction(ctx, condition);
|
|
6571
|
+
}
|
|
6572
|
+
function conditionFunction(ctx, condition) {
|
|
6573
|
+
const { state } = ctx;
|
|
6574
|
+
const context = {
|
|
6575
|
+
data: state.machine.data,
|
|
6576
|
+
skills: state.skills,
|
|
6577
|
+
skillChecks: state.skillChecks,
|
|
6578
|
+
stats: state.hudStats,
|
|
6579
|
+
roll: (checkId, skill, value) => {
|
|
6580
|
+
const skillCheckState = getSkillCheckState(ctx, checkId);
|
|
6581
|
+
if (skillCheckState) {
|
|
6582
|
+
if (skillCheckState.passed) {
|
|
6583
|
+
return true;
|
|
6584
|
+
}
|
|
6585
|
+
if (!skillCheckState.available) {
|
|
6586
|
+
return false;
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
return runSkillCheck(ctx, {
|
|
6590
|
+
skill,
|
|
6591
|
+
value,
|
|
6592
|
+
id: checkId,
|
|
6593
|
+
});
|
|
6515
6594
|
},
|
|
6516
|
-
}
|
|
6517
|
-
|
|
6518
|
-
}
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6595
|
+
};
|
|
6596
|
+
return evalInContext(`(${condition})`, context);
|
|
6597
|
+
}
|
|
6598
|
+
function evalInContext(script, context) {
|
|
6599
|
+
// # Return the results of the in-line anonymous function we .call with the passed context
|
|
6600
|
+
return function () {
|
|
6601
|
+
return eval(script);
|
|
6602
|
+
}.call(context);
|
|
6603
|
+
}
|
|
6604
|
+
async function textCommand(commit, dialog) {
|
|
6605
|
+
commit('addDialog', {
|
|
6606
|
+
dialog,
|
|
6607
|
+
});
|
|
6608
|
+
}
|
|
6609
|
+
function getLine(lines, index) {
|
|
6610
|
+
if (index < lines.length)
|
|
6611
|
+
return lines[index];
|
|
6612
|
+
}
|
|
6613
|
+
|
|
6614
|
+
async function runLine(context) {
|
|
6615
|
+
const cmd = context.getters.currentLine;
|
|
6616
|
+
await runCommand(context, cmd);
|
|
6617
|
+
}
|
|
6618
|
+
class VM$1 {
|
|
6619
|
+
plugins = [];
|
|
6620
|
+
commands = {};
|
|
6621
|
+
addCommand(command) {
|
|
6622
|
+
this.commands[command.keyword] = command;
|
|
6623
|
+
}
|
|
6624
|
+
addPlugin(plugin) {
|
|
6625
|
+
this.plugins.push(plugin);
|
|
6626
|
+
if (plugin.customCommands) {
|
|
6627
|
+
for (const command of plugin.customCommands) {
|
|
6628
|
+
this.addCommand(command);
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
}
|
|
6632
|
+
callHook(hookName, ...args) {
|
|
6633
|
+
for (const plugin of this.plugins) {
|
|
6634
|
+
if (typeof plugin[hookName] === 'function') {
|
|
6635
|
+
plugin[hookName](...args);
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
const vm$1 = new VM$1();
|
|
6641
|
+
async function runCommand(context, cmd, choices) {
|
|
6642
|
+
const { state, commit } = context;
|
|
6643
|
+
try {
|
|
6644
|
+
const commandPlugin = vm$1.commands[cmd.commandType];
|
|
6645
|
+
if (commandPlugin) {
|
|
6646
|
+
commandPlugin.runner(context, cmd, choices);
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
catch (err) {
|
|
6650
|
+
logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
|
|
6651
|
+
console.error(err);
|
|
6652
|
+
error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
|
|
6653
|
+
<b>${err}</b>
|
|
6654
|
+
Script: ${cmd.code}
|
|
6655
|
+
Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
|
|
6656
|
+
}
|
|
6657
|
+
}
|
|
6658
|
+
async function playerAnswered(context, choiceIndex) {
|
|
6659
|
+
const { commit, dispatch } = context;
|
|
6660
|
+
const cmd = context.getters.currentLine;
|
|
6661
|
+
switch (cmd.commandType) {
|
|
6662
|
+
case 'choice':
|
|
6663
|
+
const options = cmd.options;
|
|
6664
|
+
const choice = options.choices[choiceIndex];
|
|
6665
|
+
let playerText = choice.choice;
|
|
6666
|
+
let newBranch;
|
|
6667
|
+
const skillcheck = choice.skillCheck;
|
|
6668
|
+
if (skillcheck) {
|
|
6669
|
+
const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
|
|
6670
|
+
if (skillCheckState.passed) {
|
|
6671
|
+
newBranch = skillcheck.success.branch;
|
|
6672
|
+
playerText = skillcheck.success.text;
|
|
6673
|
+
}
|
|
6674
|
+
else {
|
|
6675
|
+
const result = processSkillCheck(context, skillcheck);
|
|
6676
|
+
const winner = result ? skillcheck.success : skillcheck.failure;
|
|
6677
|
+
newBranch = winner.branch;
|
|
6678
|
+
playerText = undefined;
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
else {
|
|
6682
|
+
newBranch = choice.branch;
|
|
6683
|
+
}
|
|
6684
|
+
if (playerText) {
|
|
6685
|
+
// If the choice involves printing a player dialog, show it
|
|
6686
|
+
const dialog = {
|
|
6687
|
+
speaker: 'player',
|
|
6688
|
+
text: playerText,
|
|
6689
|
+
interactive: false,
|
|
6690
|
+
};
|
|
6691
|
+
commit('addDialog', { dialog });
|
|
6692
|
+
}
|
|
6693
|
+
if (newBranch) {
|
|
6694
|
+
const newStack = {
|
|
6695
|
+
currentIndex: 0,
|
|
6696
|
+
branch: newBranch,
|
|
6697
|
+
};
|
|
6698
|
+
commit('addStack', newStack);
|
|
6699
|
+
dispatch('runLine');
|
|
6700
|
+
}
|
|
6701
|
+
else {
|
|
6702
|
+
dispatch('nextLine');
|
|
6703
|
+
}
|
|
6704
|
+
break;
|
|
6705
|
+
default:
|
|
6706
|
+
dispatch('nextLine');
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
async function nextLine(ctx) {
|
|
6710
|
+
const { state, getters, dispatch, commit } = ctx;
|
|
6711
|
+
if (state.machine.stack.length === 0) {
|
|
6712
|
+
finishGame(ctx);
|
|
6713
|
+
return;
|
|
6714
|
+
}
|
|
6715
|
+
const machineHead = getters.machineHead;
|
|
6716
|
+
if (machineHead.currentIndex < machineHead.branch.length - 1) {
|
|
6717
|
+
commit('nextLine');
|
|
6718
|
+
}
|
|
6719
|
+
else {
|
|
6720
|
+
// This branch is finished, go back to previous stack
|
|
6721
|
+
commit('previousStack');
|
|
6722
|
+
return dispatch('nextLine');
|
|
6723
|
+
}
|
|
6724
|
+
if (state.machine.stack.length === 0) {
|
|
6725
|
+
finishGame(ctx);
|
|
6726
|
+
}
|
|
6727
|
+
else {
|
|
6728
|
+
return dispatch('runLine');
|
|
6729
|
+
}
|
|
6730
|
+
}
|
|
6731
|
+
function finishGame({ commit, state }) {
|
|
6732
|
+
if (state.options.debug) {
|
|
6733
|
+
commit('addDialog', {
|
|
6734
|
+
dialog: {
|
|
6735
|
+
speaker: 'game',
|
|
6736
|
+
text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
|
|
6737
|
+
},
|
|
6738
|
+
});
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
|
|
6742
|
+
var script$8 = defineComponent({
|
|
6743
|
+
components: {},
|
|
6744
|
+
props: {},
|
|
6745
|
+
data() {
|
|
6746
|
+
return {
|
|
6747
|
+
activeMenu: false,
|
|
6748
|
+
};
|
|
6749
|
+
},
|
|
6750
|
+
mounted() {
|
|
6751
|
+
document.addEventListener('keydown', (event) => {
|
|
6752
|
+
const key = event.key;
|
|
6753
|
+
if (key === 'Escape') {
|
|
6754
|
+
this.toggleMenu();
|
|
6755
|
+
}
|
|
6756
|
+
});
|
|
6757
|
+
vm$1.callHook('onGameMounted');
|
|
6758
|
+
},
|
|
6759
|
+
unmounted() {
|
|
6760
|
+
vm$1.callHook('onGameUnmounted');
|
|
6761
|
+
},
|
|
6762
|
+
methods: {
|
|
6763
|
+
openMenu() {
|
|
6764
|
+
this.$store.commit('openModal', 'menu');
|
|
6765
|
+
},
|
|
6766
|
+
openSkills() {
|
|
6767
|
+
this.$store.commit('openModal', 'skills');
|
|
6768
|
+
},
|
|
6769
|
+
closeMenu() {
|
|
6770
|
+
this.$store.commit('closeModal');
|
|
6771
|
+
},
|
|
6772
|
+
toggleMenu() {
|
|
6773
|
+
this.$store.commit('toggleMenu');
|
|
6774
|
+
},
|
|
6775
|
+
},
|
|
6776
|
+
computed: {
|
|
6777
|
+
showSkills() {
|
|
6778
|
+
if (Object.entries(getConfig().skills).length > 0) {
|
|
6779
|
+
return true;
|
|
6780
|
+
}
|
|
6781
|
+
return false;
|
|
6782
|
+
},
|
|
6783
|
+
},
|
|
6784
|
+
});
|
|
6785
|
+
|
|
6786
|
+
const _hoisted_1$7 = { class: "menu-container" };
|
|
6787
|
+
|
|
6788
|
+
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6789
|
+
return (openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
6790
|
+
createElementVNode("button", {
|
|
6791
|
+
class: "button menu-toggle-button",
|
|
6792
|
+
id: "menu-button",
|
|
6793
|
+
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.openMenu && _ctx.openMenu(...args)))
|
|
6794
|
+
}, " Menu "),
|
|
6795
|
+
(_ctx.showSkills)
|
|
6796
|
+
? (openBlock(), createElementBlock("button", {
|
|
6797
|
+
key: 0,
|
|
6798
|
+
class: "button menu-toggle-button",
|
|
6799
|
+
id: "skills-menu-button",
|
|
6800
|
+
onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.openSkills && _ctx.openSkills(...args)))
|
|
6801
|
+
}, " Skills "))
|
|
6802
|
+
: createCommentVNode("", true)
|
|
6803
|
+
]))
|
|
6804
|
+
}
|
|
6805
|
+
|
|
6806
|
+
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";
|
|
6807
|
+
styleInject(css_248z$9);
|
|
6808
|
+
|
|
6809
|
+
script$8.render = render$8;
|
|
6810
|
+
|
|
6811
|
+
var script$9 = defineComponent({
|
|
6812
|
+
components: {
|
|
6813
|
+
Modal: script$2,
|
|
6814
|
+
VolumeControls: script$4,
|
|
6815
|
+
},
|
|
6816
|
+
props: {},
|
|
6817
|
+
data() { },
|
|
6818
|
+
mounted() { },
|
|
6819
|
+
methods: {
|
|
6820
|
+
quit() {
|
|
6821
|
+
window.close();
|
|
6822
|
+
// quit
|
|
6823
|
+
},
|
|
6824
|
+
close() {
|
|
6825
|
+
this.$emit('close');
|
|
6826
|
+
},
|
|
6827
|
+
mainMenu() {
|
|
6828
|
+
this.$store.dispatch('menuReturn');
|
|
6829
|
+
this.$store.commit('setFlowState', 'menu');
|
|
6830
|
+
this.close();
|
|
6831
|
+
},
|
|
6832
|
+
getPlayTimeString() {
|
|
6833
|
+
const time = getPlayTime(this.$store.state.playTime.start, this.$store.state.playTime.previousPlaytime);
|
|
6834
|
+
return toHHMMSS(time / 1000);
|
|
6835
|
+
},
|
|
6836
|
+
},
|
|
6837
|
+
computed: {},
|
|
6838
|
+
});
|
|
6839
|
+
|
|
6840
|
+
const _hoisted_1$8 = /*#__PURE__*/createElementVNode("h3", { class: "title" }, "Menu", -1);
|
|
6841
|
+
const _hoisted_2$6 = { class: "menu-content" };
|
|
6842
|
+
|
|
6843
|
+
function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6844
|
+
const _component_VolumeControls = resolveComponent("VolumeControls");
|
|
6845
|
+
const _component_modal = resolveComponent("modal");
|
|
6846
|
+
|
|
6527
6847
|
return (openBlock(), createBlock(_component_modal, {
|
|
6528
6848
|
class: "menu",
|
|
6529
6849
|
onClose: _ctx.close,
|
|
@@ -6550,7 +6870,7 @@ function render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6550
6870
|
}, 8, ["onClose"]))
|
|
6551
6871
|
}
|
|
6552
6872
|
|
|
6553
|
-
var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\n";
|
|
6873
|
+
var css_248z$a = ".quit-button {\n margin: 20px;\n text-align: center;\n}\r\n";
|
|
6554
6874
|
styleInject(css_248z$a);
|
|
6555
6875
|
|
|
6556
6876
|
script$9.render = render$9;
|
|
@@ -6693,7 +7013,7 @@ function render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
6693
7013
|
}, 8, ["onClose"]))
|
|
6694
7014
|
}
|
|
6695
7015
|
|
|
6696
|
-
var css_248z$b = ".skills-modal {\n width: 800px;\n}\n\n.skills-container {\n display: grid;\n grid-auto-rows: auto;\n grid-template-columns: repeat(3, 1fr);\n grid-gap: 20px 20px;\n}\n\n.skill-display {\n width: 200px;\n height: 300px;\n position: relative;\n background-size: cover;\n}\n\n.skill-title {\n position: absolute;\n bottom: 0px;\n text-align: center;\n width: 100%;\n color: var(--skills-text-color);\n background: var(--skills-text-background);\n}\n\n.skill-level {\n position: absolute;\n top: 0;\n right: 0;\n font-weight: 700;\n font-size: 25px;\n color: var(--skills-level-color);\n width: var(--skills-xp-bar-height);\n height: var(--skills-xp-bar-height);\n background-color: var(--skills-level-background);\n}\n\n.skill-description-container {\n justify-content: space-between;\n align-items: center;\n}\n\n.skill-left {\n flex-direction: column;\n}\n\n.skill-right {\n flex-direction: column;\n align-items: baseline;\n}\n\n.skill-xp-container {\n position: absolute;\n top: 0;\n left: 0;\n height: var(--skills-xp-bar-height);\n width: calc(100% - var(--skills-xp-bar-height));\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.skill-xp-bar {\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n height: 100%;\n background-color: rgba(0, 0, 250, 0.5);\n}\n\n.skill-xp-text {\n z-index: 2;\n}\n";
|
|
7016
|
+
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";
|
|
6697
7017
|
styleInject(css_248z$b);
|
|
6698
7018
|
|
|
6699
7019
|
script$a.render = render$a;
|
|
@@ -6729,6 +7049,7 @@ var script$b = defineComponent({
|
|
|
6729
7049
|
options: Object,
|
|
6730
7050
|
},
|
|
6731
7051
|
async mounted() {
|
|
7052
|
+
vm$1.callHook('onAppMounted');
|
|
6732
7053
|
this.loadingStep = 'Characters';
|
|
6733
7054
|
const charsFile = await getFile('data/characters.json');
|
|
6734
7055
|
await setCharactersConfig(JSON.parse(charsFile));
|
|
@@ -6740,9 +7061,11 @@ var script$b = defineComponent({
|
|
|
6740
7061
|
this.loadingPercentage = 0.7;
|
|
6741
7062
|
this.loadingStep = 'Audio';
|
|
6742
7063
|
await loadAudioAssets(getConfig());
|
|
7064
|
+
vm$1.callHook('onAssetsLoaded');
|
|
6743
7065
|
this.loadingPercentage = 0.95;
|
|
6744
7066
|
this.loadingStep = 'Starting...';
|
|
6745
7067
|
await this.setupMachine();
|
|
7068
|
+
vm$1.callHook('onGameSetup');
|
|
6746
7069
|
this.loadingPercentage = 0.1;
|
|
6747
7070
|
this.gameLoaded = true;
|
|
6748
7071
|
const save = this.getSaveFile();
|
|
@@ -7070,769 +7393,85 @@ function render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7070
7393
|
createElementVNode("canvas", {
|
|
7071
7394
|
width: _ctx.layoutWidth,
|
|
7072
7395
|
height: _ctx.layoutHeight,
|
|
7073
|
-
id: "background-canvas"
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
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";
|
|
7138
|
-
styleInject(css_248z$c);
|
|
7139
|
-
|
|
7140
|
-
script$b.render = render$b;
|
|
7141
|
-
|
|
7142
|
-
function createSkillCheckState() {
|
|
7143
|
-
const skillCheck = {
|
|
7144
|
-
passed: false,
|
|
7145
|
-
available: true,
|
|
7146
|
-
};
|
|
7147
|
-
return skillCheck;
|
|
7148
|
-
}
|
|
7149
|
-
function getSkillCheckState(ctx, skillCheckId) {
|
|
7150
|
-
let skillCheck = ctx.state.skillChecks[skillCheckId];
|
|
7151
|
-
if (!skillCheck) {
|
|
7152
|
-
skillCheck = createSkillCheckState();
|
|
7153
|
-
ctx.commit('setupSkillCheck', {
|
|
7154
|
-
skillCheck,
|
|
7155
|
-
skillCheckId,
|
|
7156
|
-
});
|
|
7157
|
-
}
|
|
7158
|
-
return skillCheck;
|
|
7159
|
-
}
|
|
7160
|
-
function getSkillCheckDifficultyScore(value, level) {
|
|
7161
|
-
return value - level * getConfig().skillChecks.skillMultiplier;
|
|
7162
|
-
}
|
|
7163
|
-
function getSkillCheckDifficultyText(value, level) {
|
|
7164
|
-
const difficultyScore = getSkillCheckDifficultyScore(value, level);
|
|
7165
|
-
const checks = getConfig().skillChecks;
|
|
7166
|
-
let found = false;
|
|
7167
|
-
let i = 0;
|
|
7168
|
-
let checkText = checks.difficultyText[0][1];
|
|
7169
|
-
while (!found) {
|
|
7170
|
-
if (checks.difficultyText.length > i) {
|
|
7171
|
-
if (difficultyScore >= checks.difficultyText[i][0]) {
|
|
7172
|
-
checkText = checks.difficultyText[i][1];
|
|
7173
|
-
}
|
|
7174
|
-
else {
|
|
7175
|
-
found = true;
|
|
7176
|
-
}
|
|
7177
|
-
}
|
|
7178
|
-
else {
|
|
7179
|
-
found = true;
|
|
7180
|
-
}
|
|
7181
|
-
i++;
|
|
7182
|
-
}
|
|
7183
|
-
return checkText;
|
|
7184
|
-
}
|
|
7185
|
-
function getSkillCheckText({ context, skill, skillCheckId, value, }) {
|
|
7186
|
-
const skillCheckState = getSkillCheckState(context, skillCheckId);
|
|
7187
|
-
const skillConfig = getSkillConfig(context.commit, skill);
|
|
7188
|
-
const level = context.state.skills[skill].level;
|
|
7189
|
-
const difficultyText = getSkillCheckDifficultyText(value, level);
|
|
7190
|
-
let allowed = true;
|
|
7191
|
-
let text = `<span class='skill-check'>[<span class='skill-check-name'>${skillConfig.name}</span> - `;
|
|
7192
|
-
if (skillCheckState.available) {
|
|
7193
|
-
text += ` <span class='skill-check-difficulty'>${difficultyText}</span>]</span>`;
|
|
7194
|
-
}
|
|
7195
|
-
else if (skillCheckState.passed) {
|
|
7196
|
-
text = '';
|
|
7197
|
-
}
|
|
7198
|
-
else {
|
|
7199
|
-
allowed = false;
|
|
7200
|
-
text += ` <span class='skill-check-difficulty'>${difficultyText}</span> - <span class='skill-check-failed'>FAILED</span>]</span>`;
|
|
7201
|
-
}
|
|
7202
|
-
return {
|
|
7203
|
-
difficultyText: text,
|
|
7204
|
-
allowed,
|
|
7205
|
-
};
|
|
7206
|
-
}
|
|
7207
|
-
function getPassiveSkillCheckText(ctx, success, params) {
|
|
7208
|
-
const skillConf = getSkillConfig(ctx.commit, params.skill);
|
|
7209
|
-
const difficultyText = getSkillCheckDifficultyText(params.value, ctx.state.skills[params.skill].level);
|
|
7210
|
-
return `<span class='passive-skill-check skill-check'>[<span class='skill-check-name'>${skillConf.name}</span> - <span class='skill-check-difficulty'>${difficultyText}</span> - ${success
|
|
7211
|
-
? '<span class="skill-check-success">Success</span>'
|
|
7212
|
-
: '<span class="skill-check-failed">Failure</span>'}]</span>`;
|
|
7213
|
-
}
|
|
7214
|
-
function calculateSkillCheckRoll(state, skill) {
|
|
7215
|
-
const { skillChecks } = getConfig();
|
|
7216
|
-
const unmodifiedRoll = Math.floor(Math.random() * skillChecks.rollRange);
|
|
7217
|
-
const rollModifier = state.skills[skill].level * skillChecks.skillMultiplier;
|
|
7218
|
-
const roll = unmodifiedRoll + rollModifier;
|
|
7219
|
-
logger.log(`[SKILL CHECK] Roll: ${roll}. (Base roll: ${unmodifiedRoll}, modifier: ${rollModifier} - Skill level: ${state.skills[skill].level})`);
|
|
7220
|
-
return {
|
|
7221
|
-
roll,
|
|
7222
|
-
unmodifiedRoll,
|
|
7223
|
-
};
|
|
7224
|
-
}
|
|
7225
|
-
function resolveSkillCheck(state, params) {
|
|
7226
|
-
const { skills, skillChecks } = getConfig();
|
|
7227
|
-
let success = true;
|
|
7228
|
-
const { roll } = calculateSkillCheckRoll(state, params.skill);
|
|
7229
|
-
if (roll <= skillChecks.failureChance - 1) {
|
|
7230
|
-
success = false;
|
|
7231
|
-
}
|
|
7232
|
-
const skill = skills[params.skill];
|
|
7233
|
-
if (roll < params.value) {
|
|
7234
|
-
success = false;
|
|
7235
|
-
}
|
|
7236
|
-
logger.log(`[SKILL CHECK ${skill.name}]: ${success ? '✅' : '❌'}`, `(${params.id}) - ${roll}/${params.value}`);
|
|
7237
|
-
return success;
|
|
7238
|
-
}
|
|
7239
|
-
|
|
7240
|
-
function processSkillCheck(ctx, skillcheck) {
|
|
7241
|
-
return runSkillCheck(ctx, {
|
|
7242
|
-
skill: skillcheck.skill,
|
|
7243
|
-
value: skillcheck.value,
|
|
7244
|
-
id: skillcheck.id,
|
|
7245
|
-
success: skillcheck.success.text,
|
|
7246
|
-
failure: skillcheck.failure.text,
|
|
7247
|
-
});
|
|
7248
|
-
}
|
|
7249
|
-
function runSkillCheck(ctx, params) {
|
|
7250
|
-
const { state } = ctx;
|
|
7251
|
-
const success = resolveSkillCheck(state, params);
|
|
7252
|
-
writeText(ctx, getPassiveSkillCheckText(ctx, success, params));
|
|
7253
|
-
if (success) {
|
|
7254
|
-
ctx.commit('passSkillCheck', params.id);
|
|
7255
|
-
return true;
|
|
7256
|
-
}
|
|
7257
|
-
ctx.commit('failSkillCheck', params.id);
|
|
7258
|
-
return false;
|
|
7259
|
-
}
|
|
7260
|
-
function runConditionCommand(ctx, command) {
|
|
7261
|
-
const options = command.options;
|
|
7262
|
-
const result = runCondition(ctx, options.condition);
|
|
7263
|
-
logger.log(result);
|
|
7264
|
-
if (result) {
|
|
7265
|
-
return options.success;
|
|
7266
|
-
}
|
|
7267
|
-
if (!result && options.failure) {
|
|
7268
|
-
return options.failure;
|
|
7269
|
-
}
|
|
7270
|
-
return undefined;
|
|
7271
|
-
}
|
|
7272
|
-
function writeText(ctx, text) {
|
|
7273
|
-
const dialog = {
|
|
7274
|
-
speaker: 'game',
|
|
7275
|
-
text,
|
|
7276
|
-
interactive: false,
|
|
7277
|
-
};
|
|
7278
|
-
ctx.commit('addDialog', {
|
|
7279
|
-
dialog,
|
|
7280
|
-
});
|
|
7281
|
-
}
|
|
7282
|
-
function runCondition(ctx, condition) {
|
|
7283
|
-
return conditionFunction(ctx, condition);
|
|
7284
|
-
}
|
|
7285
|
-
function conditionFunction(ctx, condition) {
|
|
7286
|
-
const { state } = ctx;
|
|
7287
|
-
const context = {
|
|
7288
|
-
data: state.machine.data,
|
|
7289
|
-
skills: state.skills,
|
|
7290
|
-
skillChecks: state.skillChecks,
|
|
7291
|
-
stats: state.hudStats,
|
|
7292
|
-
roll: (checkId, skill, value) => {
|
|
7293
|
-
const skillCheckState = getSkillCheckState(ctx, checkId);
|
|
7294
|
-
if (skillCheckState) {
|
|
7295
|
-
if (skillCheckState.passed) {
|
|
7296
|
-
return true;
|
|
7297
|
-
}
|
|
7298
|
-
if (!skillCheckState.available) {
|
|
7299
|
-
return false;
|
|
7300
|
-
}
|
|
7301
|
-
}
|
|
7302
|
-
return runSkillCheck(ctx, {
|
|
7303
|
-
skill,
|
|
7304
|
-
value,
|
|
7305
|
-
id: checkId,
|
|
7306
|
-
});
|
|
7307
|
-
},
|
|
7308
|
-
};
|
|
7309
|
-
return evalInContext(`(${condition})`, context);
|
|
7310
|
-
}
|
|
7311
|
-
function evalInContext(script, context) {
|
|
7312
|
-
// # Return the results of the in-line anonymous function we .call with the passed context
|
|
7313
|
-
return function () {
|
|
7314
|
-
return eval(script);
|
|
7315
|
-
}.call(context);
|
|
7316
|
-
}
|
|
7317
|
-
|
|
7318
|
-
async function runLine(context) {
|
|
7319
|
-
const cmd = context.getters.currentLine;
|
|
7320
|
-
await runCommand(context, cmd);
|
|
7321
|
-
}
|
|
7322
|
-
async function runCommand(context, cmd, choices) {
|
|
7323
|
-
const { state, commit, dispatch } = context;
|
|
7324
|
-
try {
|
|
7325
|
-
switch (cmd.commandType) {
|
|
7326
|
-
case 'jump':
|
|
7327
|
-
const branch = cmd.args[0];
|
|
7328
|
-
const newStack = {
|
|
7329
|
-
branch: state.machine.script[branch],
|
|
7330
|
-
label: branch,
|
|
7331
|
-
currentIndex: 0,
|
|
7332
|
-
};
|
|
7333
|
-
commit('setStack', newStack);
|
|
7334
|
-
await dispatch('saveGame');
|
|
7335
|
-
await dispatch('runLine');
|
|
7336
|
-
break;
|
|
7337
|
-
case 'text':
|
|
7338
|
-
await textCommand(commit, {
|
|
7339
|
-
speaker: 'game',
|
|
7340
|
-
text: cmd.options.text,
|
|
7341
|
-
choices,
|
|
7342
|
-
interactive: true,
|
|
7343
|
-
});
|
|
7344
|
-
break;
|
|
7345
|
-
case 'set':
|
|
7346
|
-
const key = cmd.args[0];
|
|
7347
|
-
const value = cmd.args[1];
|
|
7348
|
-
commit('setData', { path: key, value });
|
|
7349
|
-
return dispatch('nextLine');
|
|
7350
|
-
case 'add':
|
|
7351
|
-
const addKey = cmd.args[0];
|
|
7352
|
-
const addValue = cmd.args[1];
|
|
7353
|
-
commit('addInstruction', { path: addKey, value: addValue });
|
|
7354
|
-
return dispatch('nextLine');
|
|
7355
|
-
case 'if':
|
|
7356
|
-
const newBranch = runConditionCommand(context, cmd);
|
|
7357
|
-
if (newBranch) {
|
|
7358
|
-
const newStack = {
|
|
7359
|
-
branch: newBranch,
|
|
7360
|
-
currentIndex: 0,
|
|
7361
|
-
};
|
|
7362
|
-
commit('addStack', newStack);
|
|
7363
|
-
return dispatch('runLine');
|
|
7364
|
-
}
|
|
7365
|
-
return dispatch('nextLine');
|
|
7366
|
-
case 'talk':
|
|
7367
|
-
await textCommand(commit, {
|
|
7368
|
-
speaker: cmd.args[0],
|
|
7369
|
-
pose: cmd.args[1],
|
|
7370
|
-
text: `"${cmd.args[2]}"`,
|
|
7371
|
-
choices,
|
|
7372
|
-
interactive: true,
|
|
7373
|
-
});
|
|
7374
|
-
break;
|
|
7375
|
-
case 'choice':
|
|
7376
|
-
await runChoice(context, cmd);
|
|
7377
|
-
break;
|
|
7378
|
-
case 'set_screen':
|
|
7379
|
-
commit('setScreen', cmd.options.screen);
|
|
7380
|
-
return dispatch('nextLine');
|
|
7381
|
-
case 'clear_dialog':
|
|
7382
|
-
commit('clearDialog');
|
|
7383
|
-
return dispatch('nextLine');
|
|
7384
|
-
case 'set_button':
|
|
7385
|
-
commit('changeButton', {
|
|
7386
|
-
button: cmd.args[0],
|
|
7387
|
-
enabled: cmd.args[1],
|
|
7388
|
-
});
|
|
7389
|
-
return dispatch('nextLine');
|
|
7390
|
-
case 'play':
|
|
7391
|
-
const playOptions = cmd.options;
|
|
7392
|
-
if (playOptions.mode === 'music') {
|
|
7393
|
-
changeMusic(context, playOptions.audio);
|
|
7394
|
-
}
|
|
7395
|
-
else {
|
|
7396
|
-
playAudio(context.commit, playOptions.audio);
|
|
7397
|
-
}
|
|
7398
|
-
return dispatch('nextLine');
|
|
7399
|
-
case 'stop':
|
|
7400
|
-
const stopOptions = cmd.options;
|
|
7401
|
-
if (stopOptions.mode === 'music') {
|
|
7402
|
-
stopAudio(commit, context.state.audio.currentMusic);
|
|
7403
|
-
}
|
|
7404
|
-
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
7405
|
-
stopAudio(commit, stopOptions.audio);
|
|
7406
|
-
}
|
|
7407
|
-
else {
|
|
7408
|
-
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.`);
|
|
7409
|
-
}
|
|
7410
|
-
return dispatch('nextLine');
|
|
7411
|
-
case 'pause':
|
|
7412
|
-
const pauseOptions = cmd.options;
|
|
7413
|
-
if (pauseOptions.mode === 'music') {
|
|
7414
|
-
pauseAudio(commit, context.state.audio.currentMusic);
|
|
7415
|
-
}
|
|
7416
|
-
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
7417
|
-
pauseAudio(commit, stopOptions.audio);
|
|
7418
|
-
}
|
|
7419
|
-
else {
|
|
7420
|
-
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.`);
|
|
7421
|
-
}
|
|
7422
|
-
return dispatch('nextLine');
|
|
7423
|
-
case 'wait':
|
|
7424
|
-
await timeout(cmd.options.duration);
|
|
7425
|
-
return dispatch('nextLine');
|
|
7426
|
-
case 'add_level':
|
|
7427
|
-
const skillKey = cmd.args[0];
|
|
7428
|
-
const levelToAdd = cmd.args[1];
|
|
7429
|
-
if (!skillKey || !levelToAdd) {
|
|
7430
|
-
error(commit, `add_level command needs a skill id and a value as parameters`);
|
|
7431
|
-
}
|
|
7432
|
-
dispatch('incrementSkill', {
|
|
7433
|
-
skill: skillKey,
|
|
7434
|
-
amount: levelToAdd,
|
|
7435
|
-
});
|
|
7436
|
-
return dispatch('nextLine');
|
|
7437
|
-
case 'add_xp':
|
|
7438
|
-
const xpKey = cmd.args[0];
|
|
7439
|
-
const xpToAdd = cmd.args[1];
|
|
7440
|
-
if (!xpKey || !xpToAdd) {
|
|
7441
|
-
error(commit, `add_xp command needs a skill id and a value as parameters`);
|
|
7442
|
-
}
|
|
7443
|
-
dispatch('addXp', {
|
|
7444
|
-
skill: xpKey,
|
|
7445
|
-
amount: xpToAdd,
|
|
7446
|
-
});
|
|
7447
|
-
return dispatch('nextLine');
|
|
7448
|
-
case 'add_stat':
|
|
7449
|
-
const statKey = cmd.args[0];
|
|
7450
|
-
const amountToAdd = cmd.args[1];
|
|
7451
|
-
if (!statKey || !amountToAdd) {
|
|
7452
|
-
error(commit, `add_stat command needs a stat id and a value as parameters`);
|
|
7453
|
-
}
|
|
7454
|
-
commit('addStat', {
|
|
7455
|
-
stat: statKey,
|
|
7456
|
-
amount: amountToAdd,
|
|
7457
|
-
});
|
|
7458
|
-
return dispatch('nextLine');
|
|
7459
|
-
case 'set_stat':
|
|
7460
|
-
const setStatKey = cmd.args[0];
|
|
7461
|
-
const setAmount = cmd.args[1];
|
|
7462
|
-
if (!setStatKey || !setAmount) {
|
|
7463
|
-
error(commit, `set_stat command needs a stat id and a value as parameters`);
|
|
7464
|
-
}
|
|
7465
|
-
commit('setStat', {
|
|
7466
|
-
stat: setStatKey,
|
|
7467
|
-
amount: setAmount,
|
|
7468
|
-
});
|
|
7469
|
-
return dispatch('nextLine');
|
|
7470
|
-
case 'notify':
|
|
7471
|
-
const text = cmd.args[0];
|
|
7472
|
-
dispatch('addNotification', text);
|
|
7473
|
-
return dispatch('nextLine');
|
|
7474
|
-
default:
|
|
7475
|
-
break;
|
|
7476
|
-
}
|
|
7477
|
-
}
|
|
7478
|
-
catch (err) {
|
|
7479
|
-
logger.log(`Error at: `, state.machine.stack[state.machine.stack.length - 1].label);
|
|
7480
|
-
console.error(err);
|
|
7481
|
-
error(commit, `Narrat script runtime error at <span class="error-filename">${cmd.fileName}:${cmd.line + 1}</span>
|
|
7482
|
-
<b>${err}</b>
|
|
7483
|
-
Script: ${cmd.code}
|
|
7484
|
-
Label: ${state.machine.stack[state.machine.stack.length - 1].label}`);
|
|
7485
|
-
}
|
|
7486
|
-
}
|
|
7487
|
-
async function playerAnswered(context, choiceIndex) {
|
|
7488
|
-
const { commit, dispatch } = context;
|
|
7489
|
-
const cmd = context.getters.currentLine;
|
|
7490
|
-
switch (cmd.commandType) {
|
|
7491
|
-
case 'choice':
|
|
7492
|
-
const options = cmd.options;
|
|
7493
|
-
const choice = options.choices[choiceIndex];
|
|
7494
|
-
let playerText = choice.choice;
|
|
7495
|
-
let newBranch;
|
|
7496
|
-
const skillcheck = choice.skillCheck;
|
|
7497
|
-
if (skillcheck) {
|
|
7498
|
-
const skillCheckState = getSkillCheckState(context, choice.skillCheck.id);
|
|
7499
|
-
if (skillCheckState.passed) {
|
|
7500
|
-
newBranch = skillcheck.success.branch;
|
|
7501
|
-
playerText = skillcheck.success.text;
|
|
7502
|
-
}
|
|
7503
|
-
else {
|
|
7504
|
-
const result = processSkillCheck(context, skillcheck);
|
|
7505
|
-
const winner = result ? skillcheck.success : skillcheck.failure;
|
|
7506
|
-
newBranch = winner.branch;
|
|
7507
|
-
playerText = undefined;
|
|
7508
|
-
}
|
|
7509
|
-
}
|
|
7510
|
-
else {
|
|
7511
|
-
newBranch = choice.branch;
|
|
7512
|
-
}
|
|
7513
|
-
if (playerText) {
|
|
7514
|
-
// If the choice involves printing a player dialog, show it
|
|
7515
|
-
const dialog = {
|
|
7516
|
-
speaker: 'player',
|
|
7517
|
-
text: playerText,
|
|
7518
|
-
interactive: false,
|
|
7519
|
-
};
|
|
7520
|
-
commit('addDialog', { dialog });
|
|
7521
|
-
}
|
|
7522
|
-
if (newBranch) {
|
|
7523
|
-
const newStack = {
|
|
7524
|
-
currentIndex: 0,
|
|
7525
|
-
branch: newBranch,
|
|
7526
|
-
};
|
|
7527
|
-
commit('addStack', newStack);
|
|
7528
|
-
dispatch('runLine');
|
|
7529
|
-
}
|
|
7530
|
-
else {
|
|
7531
|
-
dispatch('nextLine');
|
|
7532
|
-
}
|
|
7533
|
-
break;
|
|
7534
|
-
default:
|
|
7535
|
-
dispatch('nextLine');
|
|
7536
|
-
}
|
|
7537
|
-
}
|
|
7538
|
-
async function runChoice(context, cmd) {
|
|
7539
|
-
const options = cmd.options;
|
|
7540
|
-
const prompt = options.prompt;
|
|
7541
|
-
const choices = options.choices
|
|
7542
|
-
.filter((choice) => {
|
|
7543
|
-
// Delete the choice if it fails a condition
|
|
7544
|
-
if (choice.condition) {
|
|
7545
|
-
return runCondition(context, choice.condition);
|
|
7546
|
-
}
|
|
7547
|
-
if (choice.skillCheck) {
|
|
7548
|
-
if (!getSkillCheckState(context, choice.skillCheck.id).available &&
|
|
7549
|
-
choice.skillCheck.hideAfterRoll) {
|
|
7550
|
-
return false;
|
|
7551
|
-
}
|
|
7552
|
-
}
|
|
7553
|
-
return true;
|
|
7554
|
-
})
|
|
7555
|
-
.map((choice) => {
|
|
7556
|
-
let text = choice.choice;
|
|
7557
|
-
let choiceAllowed = true;
|
|
7558
|
-
if (choice.skillCheck) {
|
|
7559
|
-
const check = choice.skillCheck;
|
|
7560
|
-
const { difficultyText, allowed } = getSkillCheckText({
|
|
7561
|
-
context,
|
|
7562
|
-
skill: check.skill,
|
|
7563
|
-
skillCheckId: check.id,
|
|
7564
|
-
value: check.value,
|
|
7565
|
-
});
|
|
7566
|
-
text = `${difficultyText} ${text}`;
|
|
7567
|
-
choiceAllowed = allowed;
|
|
7568
|
-
}
|
|
7569
|
-
const result = {
|
|
7570
|
-
choice: text,
|
|
7571
|
-
originalIndex: choice.index,
|
|
7572
|
-
allowed: choiceAllowed,
|
|
7573
|
-
};
|
|
7574
|
-
return result;
|
|
7575
|
-
});
|
|
7576
|
-
runCommand(context, prompt, choices);
|
|
7577
|
-
}
|
|
7578
|
-
async function textCommand(commit, dialog) {
|
|
7579
|
-
commit('addDialog', {
|
|
7580
|
-
dialog,
|
|
7581
|
-
});
|
|
7582
|
-
}
|
|
7583
|
-
async function nextLine(ctx) {
|
|
7584
|
-
const { state, getters, dispatch, commit } = ctx;
|
|
7585
|
-
if (state.machine.stack.length === 0) {
|
|
7586
|
-
finishGame(ctx);
|
|
7587
|
-
return;
|
|
7588
|
-
}
|
|
7589
|
-
const machineHead = getters.machineHead;
|
|
7590
|
-
if (machineHead.currentIndex < machineHead.branch.length - 1) {
|
|
7591
|
-
commit('nextLine');
|
|
7592
|
-
}
|
|
7593
|
-
else {
|
|
7594
|
-
// This branch is finished, go back to previous stack
|
|
7595
|
-
commit('previousStack');
|
|
7596
|
-
return dispatch('nextLine');
|
|
7597
|
-
}
|
|
7598
|
-
if (state.machine.stack.length === 0) {
|
|
7599
|
-
finishGame(ctx);
|
|
7600
|
-
}
|
|
7601
|
-
else {
|
|
7602
|
-
return dispatch('runLine');
|
|
7603
|
-
}
|
|
7604
|
-
}
|
|
7605
|
-
function finishGame({ commit, state }) {
|
|
7606
|
-
if (state.options.debug) {
|
|
7607
|
-
commit('addDialog', {
|
|
7608
|
-
dialog: {
|
|
7609
|
-
speaker: 'game',
|
|
7610
|
-
text: '[DEBUG] Game Script is finished. This is the end of the game flow. This message only appears in debug mode.',
|
|
7611
|
-
},
|
|
7612
|
-
});
|
|
7613
|
-
}
|
|
7614
|
-
}
|
|
7615
|
-
|
|
7616
|
-
function jump(ctx) {
|
|
7617
|
-
ctx.command.commandType = 'jump';
|
|
7618
|
-
ctx.currentLine++;
|
|
7619
|
-
}
|
|
7620
|
-
function choice(ctx) {
|
|
7621
|
-
const { line, command } = ctx;
|
|
7622
|
-
if (!line.branch || line.branch.length < 2) {
|
|
7623
|
-
ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
|
|
7624
|
-
}
|
|
7625
|
-
const prompt = line.branch[0];
|
|
7626
|
-
const choices = line.branch.slice(1);
|
|
7627
|
-
const prompts = choices.map((choice, index) => {
|
|
7628
|
-
if (!choice.branch) {
|
|
7629
|
-
ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
|
|
7630
|
-
}
|
|
7631
|
-
return parseChoiceOption(ctx, choice, index);
|
|
7632
|
-
});
|
|
7633
|
-
command.options = {
|
|
7634
|
-
prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
|
|
7635
|
-
choices: prompts,
|
|
7636
|
-
};
|
|
7637
|
-
command.commandType = 'choice';
|
|
7638
|
-
ctx.currentLine++;
|
|
7639
|
-
}
|
|
7640
|
-
function set(ctx) {
|
|
7641
|
-
ctx.command.commandType = 'set';
|
|
7642
|
-
ctx.currentLine++;
|
|
7643
|
-
}
|
|
7644
|
-
// eslint-disable-next-line camelcase
|
|
7645
|
-
function add_level(ctx) {
|
|
7646
|
-
ctx.command.commandType = 'add_level';
|
|
7647
|
-
ctx.currentLine++;
|
|
7648
|
-
}
|
|
7649
|
-
function add_xp(ctx) {
|
|
7650
|
-
ctx.command.commandType = 'add_xp';
|
|
7651
|
-
ctx.currentLine++;
|
|
7652
|
-
}
|
|
7653
|
-
function set_stat(ctx) {
|
|
7654
|
-
ctx.command.commandType = 'set_stat';
|
|
7655
|
-
ctx.currentLine++;
|
|
7656
|
-
}
|
|
7657
|
-
function add_stat(ctx) {
|
|
7658
|
-
ctx.command.commandType = 'add_stat';
|
|
7659
|
-
ctx.currentLine++;
|
|
7660
|
-
}
|
|
7661
|
-
function add(ctx) {
|
|
7662
|
-
ctx.command.commandType = 'add';
|
|
7663
|
-
ctx.currentLine++;
|
|
7664
|
-
}
|
|
7665
|
-
function talk(ctx) {
|
|
7666
|
-
const { command, line } = ctx;
|
|
7667
|
-
command.commandType = 'talk';
|
|
7668
|
-
if (command.args.length < 3) {
|
|
7669
|
-
ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
|
|
7670
|
-
}
|
|
7671
|
-
ctx.currentLine++;
|
|
7672
|
-
}
|
|
7673
|
-
function ifCommand(ctx) {
|
|
7674
|
-
const { command, lines, currentLine, line } = ctx;
|
|
7675
|
-
command.commandType = 'if';
|
|
7676
|
-
let failure;
|
|
7677
|
-
const nextLine = getLine(lines, currentLine + 1);
|
|
7678
|
-
if (nextLine && nextLine.operator === 'else') {
|
|
7679
|
-
failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
|
|
7680
|
-
ctx.currentLine++;
|
|
7681
|
-
}
|
|
7682
|
-
command.options = {
|
|
7683
|
-
condition: command.args[0],
|
|
7684
|
-
success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
|
|
7685
|
-
failure,
|
|
7686
|
-
};
|
|
7687
|
-
ctx.currentLine++;
|
|
7688
|
-
}
|
|
7689
|
-
function setScreen(ctx) {
|
|
7690
|
-
const { command } = ctx;
|
|
7691
|
-
command.commandType = 'set_screen';
|
|
7692
|
-
command.options = {
|
|
7693
|
-
screen: command.args[0],
|
|
7694
|
-
};
|
|
7695
|
-
ctx.currentLine++;
|
|
7696
|
-
}
|
|
7697
|
-
function setButton(ctx) {
|
|
7698
|
-
const { command, line } = ctx;
|
|
7699
|
-
command.commandType = 'set_button';
|
|
7700
|
-
if (command.args.length !== 2) {
|
|
7701
|
-
ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
|
|
7702
|
-
}
|
|
7703
|
-
ctx.currentLine++;
|
|
7704
|
-
}
|
|
7705
|
-
function clearDialog(ctx) {
|
|
7706
|
-
const { command } = ctx;
|
|
7707
|
-
command.commandType = 'clear_dialog';
|
|
7708
|
-
ctx.currentLine++;
|
|
7709
|
-
}
|
|
7710
|
-
function play(ctx) {
|
|
7711
|
-
const { command } = ctx;
|
|
7712
|
-
command.commandType = 'play';
|
|
7713
|
-
command.options = {
|
|
7714
|
-
mode: command.args[0],
|
|
7715
|
-
audio: command.args[1],
|
|
7716
|
-
};
|
|
7717
|
-
ctx.currentLine++;
|
|
7718
|
-
}
|
|
7719
|
-
function stop(ctx) {
|
|
7720
|
-
const { command } = ctx;
|
|
7721
|
-
command.commandType = 'stop';
|
|
7722
|
-
command.options = {
|
|
7723
|
-
mode: command.args[0],
|
|
7724
|
-
audio: command.args[1],
|
|
7725
|
-
};
|
|
7726
|
-
ctx.currentLine++;
|
|
7727
|
-
}
|
|
7728
|
-
function pause(ctx) {
|
|
7729
|
-
const { command } = ctx;
|
|
7730
|
-
command.commandType = 'pause';
|
|
7731
|
-
command.options = {
|
|
7732
|
-
mode: command.args[0],
|
|
7733
|
-
audio: command.args[1],
|
|
7734
|
-
};
|
|
7735
|
-
ctx.currentLine++;
|
|
7736
|
-
}
|
|
7737
|
-
function wait(ctx) {
|
|
7738
|
-
const { command } = ctx;
|
|
7739
|
-
command.commandType = 'wait';
|
|
7740
|
-
command.options = {
|
|
7741
|
-
duration: parseInt(command.args[0], 10),
|
|
7742
|
-
};
|
|
7743
|
-
ctx.currentLine++;
|
|
7744
|
-
}
|
|
7745
|
-
function text(ctx) {
|
|
7746
|
-
const { command, line } = ctx;
|
|
7747
|
-
command.commandType = 'text';
|
|
7748
|
-
command.options = {
|
|
7749
|
-
text: line.operator,
|
|
7750
|
-
};
|
|
7751
|
-
ctx.currentLine++;
|
|
7752
|
-
}
|
|
7753
|
-
function notify(ctx) {
|
|
7754
|
-
ctx.command.commandType = 'notify';
|
|
7755
|
-
ctx.currentLine++;
|
|
7756
|
-
}
|
|
7757
|
-
const parserFunctions = {
|
|
7758
|
-
jump,
|
|
7759
|
-
choice,
|
|
7760
|
-
set,
|
|
7761
|
-
add,
|
|
7762
|
-
talk,
|
|
7763
|
-
if: ifCommand,
|
|
7764
|
-
set_screen: setScreen,
|
|
7765
|
-
set_button: setButton,
|
|
7766
|
-
clear_dialog: clearDialog,
|
|
7767
|
-
play,
|
|
7768
|
-
stop,
|
|
7769
|
-
pause,
|
|
7770
|
-
wait,
|
|
7771
|
-
text,
|
|
7772
|
-
add_level,
|
|
7773
|
-
add_xp,
|
|
7774
|
-
notify,
|
|
7775
|
-
set_stat,
|
|
7776
|
-
add_stat,
|
|
7777
|
-
};
|
|
7778
|
-
function getLine(lines, index) {
|
|
7779
|
-
if (index < lines.length)
|
|
7780
|
-
return lines[index];
|
|
7781
|
-
}
|
|
7782
|
-
function parseChoiceOption(ctx, choice, index) {
|
|
7783
|
-
let choiceText = choice.operator;
|
|
7784
|
-
let condition;
|
|
7785
|
-
let skillCheck;
|
|
7786
|
-
if (choice.operator === 'roll') {
|
|
7787
|
-
if (choice.args.length < 4) {
|
|
7788
|
-
ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
|
|
7789
|
-
}
|
|
7790
|
-
choiceText = choice.args[3];
|
|
7791
|
-
const hideAfterRoll = choice.args.length >= 5;
|
|
7792
|
-
const successBranch = choice.branch[0];
|
|
7793
|
-
const failureBranch = choice.branch[1];
|
|
7794
|
-
const success = {
|
|
7795
|
-
text: successBranch.args[0],
|
|
7796
|
-
branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
|
|
7797
|
-
};
|
|
7798
|
-
let failedBranch;
|
|
7799
|
-
if (failureBranch.branch) {
|
|
7800
|
-
failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
|
|
7801
|
-
}
|
|
7802
|
-
const failure = {
|
|
7803
|
-
text: failureBranch.args[0],
|
|
7804
|
-
branch: failedBranch,
|
|
7805
|
-
};
|
|
7806
|
-
skillCheck = {
|
|
7807
|
-
id: choice.args[0],
|
|
7808
|
-
skill: choice.args[1],
|
|
7809
|
-
value: choice.args[2],
|
|
7810
|
-
hideAfterRoll,
|
|
7811
|
-
success,
|
|
7812
|
-
failure,
|
|
7813
|
-
};
|
|
7814
|
-
}
|
|
7815
|
-
if (choice.args[0] === 'if') {
|
|
7816
|
-
condition = choice.args[1];
|
|
7817
|
-
}
|
|
7818
|
-
return {
|
|
7819
|
-
choice: choiceText,
|
|
7820
|
-
condition,
|
|
7821
|
-
skillCheck,
|
|
7822
|
-
branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
|
|
7823
|
-
index,
|
|
7824
|
-
};
|
|
7396
|
+
id: "background-canvas",
|
|
7397
|
+
class: "narrat-canvas"
|
|
7398
|
+
}, null, 8, _hoisted_1$a)
|
|
7399
|
+
], 4))
|
|
7400
|
+
: createCommentVNode("", true),
|
|
7401
|
+
(_ctx.inGame)
|
|
7402
|
+
? (openBlock(), createElementBlock("div", {
|
|
7403
|
+
key: 3,
|
|
7404
|
+
class: "dialog override",
|
|
7405
|
+
ref: "dialog",
|
|
7406
|
+
style: normalizeStyle(_ctx.dialogStyle)
|
|
7407
|
+
}, [
|
|
7408
|
+
createVNode(TransitionGroup, {
|
|
7409
|
+
name: "list",
|
|
7410
|
+
tag: "div",
|
|
7411
|
+
class: "dialog-container w-full override",
|
|
7412
|
+
style: normalizeStyle(_ctx.dialogContainerStyle)
|
|
7413
|
+
}, {
|
|
7414
|
+
default: withCtx(() => [
|
|
7415
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dialog, (dialog, i) => {
|
|
7416
|
+
return (openBlock(), createBlock(_component_DialogBox, {
|
|
7417
|
+
key: dialog.id,
|
|
7418
|
+
options: _ctx.getDialogBoxOptions(dialog, i),
|
|
7419
|
+
active: _ctx.isDialogActive(i)
|
|
7420
|
+
}, null, 8, ["options", "active"]))
|
|
7421
|
+
}), 128))
|
|
7422
|
+
]),
|
|
7423
|
+
_: 1
|
|
7424
|
+
}, 8, ["style"]),
|
|
7425
|
+
_hoisted_2$8
|
|
7426
|
+
], 4))
|
|
7427
|
+
: createCommentVNode("", true)
|
|
7428
|
+
], 4))
|
|
7429
|
+
: (_ctx.gameLoaded)
|
|
7430
|
+
? (openBlock(), createElementBlock("div", _hoisted_3$5, [
|
|
7431
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
7432
|
+
createElementVNode("h1", _hoisted_5$4, toDisplayString(_ctx.gameTitle), 1)
|
|
7433
|
+
]),
|
|
7434
|
+
createElementVNode("div", _hoisted_6$4, [
|
|
7435
|
+
createElementVNode("button", {
|
|
7436
|
+
class: "button menu-button start-button override",
|
|
7437
|
+
onClick: _cache[0] || (_cache[0] = (...args) => (_ctx.startGame && _ctx.startGame(...args)))
|
|
7438
|
+
}, " Start Game "),
|
|
7439
|
+
(_ctx.hasSave)
|
|
7440
|
+
? (openBlock(), createElementBlock("button", {
|
|
7441
|
+
key: 0,
|
|
7442
|
+
class: "button menu-button continue-button override",
|
|
7443
|
+
onClick: _cache[1] || (_cache[1] = (...args) => (_ctx.loadGame && _ctx.loadGame(...args)))
|
|
7444
|
+
}, " Continue Game "))
|
|
7445
|
+
: createCommentVNode("", true)
|
|
7446
|
+
])
|
|
7447
|
+
]))
|
|
7448
|
+
: (openBlock(), createElementBlock("div", _hoisted_7$3, [
|
|
7449
|
+
createVNode(_component_LoadingBar, {
|
|
7450
|
+
percentage: _ctx.loadingPercentage,
|
|
7451
|
+
step: _ctx.loadingStep
|
|
7452
|
+
}, null, 8, ["percentage", "step"])
|
|
7453
|
+
])),
|
|
7454
|
+
(_ctx.options.debug)
|
|
7455
|
+
? (openBlock(), createBlock(_component_DebugMenu, { key: 4 }))
|
|
7456
|
+
: createCommentVNode("", true),
|
|
7457
|
+
createVNode(_component_NotificationToast)
|
|
7458
|
+
], 4))
|
|
7825
7459
|
}
|
|
7826
7460
|
|
|
7827
|
-
|
|
7461
|
+
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";
|
|
7462
|
+
styleInject(css_248z$c);
|
|
7463
|
+
|
|
7464
|
+
script$b.render = render$b;
|
|
7465
|
+
|
|
7466
|
+
function parseScript(errorHandler, code, fileName) {
|
|
7828
7467
|
const ctx = {
|
|
7829
7468
|
fileName,
|
|
7830
7469
|
error: (line, text) => errorHandler(ctx, line, text),
|
|
7831
|
-
processCommandsFunction:
|
|
7470
|
+
processCommandsFunction: processCommands,
|
|
7832
7471
|
indentSize: 0, // Will be overriden soon
|
|
7833
7472
|
};
|
|
7834
7473
|
ctx.indentSize = detectIndentation(ctx, code);
|
|
7835
|
-
const lines =
|
|
7474
|
+
const lines = findLines(ctx, code);
|
|
7836
7475
|
logger.log(lines);
|
|
7837
7476
|
const script = {};
|
|
7838
7477
|
for (const line of lines) {
|
|
@@ -7843,13 +7482,13 @@ function parseRenpyScript(errorHandler, code, fileName) {
|
|
|
7843
7482
|
if (!line.branch) {
|
|
7844
7483
|
ctx.error(line.line, `This line should have a branch but doesn't`);
|
|
7845
7484
|
}
|
|
7846
|
-
script[labelName] =
|
|
7485
|
+
script[labelName] = processCommands(ctx, line.branch, undefined);
|
|
7847
7486
|
}
|
|
7848
7487
|
return script;
|
|
7849
7488
|
}
|
|
7850
|
-
function
|
|
7489
|
+
function processCommands(ctx, lines, parentLine) {
|
|
7851
7490
|
const branchContext = {
|
|
7852
|
-
processCommandsFunction:
|
|
7491
|
+
processCommandsFunction: processCommands,
|
|
7853
7492
|
parserContext: ctx,
|
|
7854
7493
|
lines,
|
|
7855
7494
|
currentLine: 0,
|
|
@@ -7876,10 +7515,11 @@ function processRenpyCommands(ctx, lines, parentLine) {
|
|
|
7876
7515
|
};
|
|
7877
7516
|
branchContext.line = line;
|
|
7878
7517
|
branchContext.command = command;
|
|
7879
|
-
|
|
7518
|
+
const commandPlugin = vm$1.commands[operator];
|
|
7519
|
+
let parseFunction = commandPlugin?.parser;
|
|
7880
7520
|
if (!parseFunction) {
|
|
7881
7521
|
// default to text function
|
|
7882
|
-
parseFunction =
|
|
7522
|
+
parseFunction = vm$1.commands.text.parser;
|
|
7883
7523
|
}
|
|
7884
7524
|
parseFunction(branchContext);
|
|
7885
7525
|
branch.push(command);
|
|
@@ -7944,7 +7584,7 @@ function parseCodeLine(codeToProcess) {
|
|
|
7944
7584
|
words.forEach((word, index) => (words[index] = parseValue(word)));
|
|
7945
7585
|
return words;
|
|
7946
7586
|
}
|
|
7947
|
-
function
|
|
7587
|
+
function findLines(ctx, data) {
|
|
7948
7588
|
const code = data.split(/\r?\n|$/).map((line) => {
|
|
7949
7589
|
const commentIndex = line.search(/ *\/\//g);
|
|
7950
7590
|
if (commentIndex !== -1) {
|
|
@@ -7952,10 +7592,10 @@ function findRenpyLines(ctx, data) {
|
|
|
7952
7592
|
}
|
|
7953
7593
|
return line;
|
|
7954
7594
|
});
|
|
7955
|
-
const lines =
|
|
7595
|
+
const lines = findBranches(ctx, code, 0, 0);
|
|
7956
7596
|
return lines.lines;
|
|
7957
7597
|
}
|
|
7958
|
-
function
|
|
7598
|
+
function findBranches(ctx, code, startLine, indentLevel) {
|
|
7959
7599
|
let stillInBranch = true;
|
|
7960
7600
|
let currentLine = startLine;
|
|
7961
7601
|
const lines = [];
|
|
@@ -7978,7 +7618,7 @@ function findRenpyBranches(ctx, code, startLine, indentLevel) {
|
|
|
7978
7618
|
if (lines.length === 0 || lineIndent - indentLevel !== 1) {
|
|
7979
7619
|
ctx.error(currentLine, `Wrong double indentation`);
|
|
7980
7620
|
}
|
|
7981
|
-
const branchLines =
|
|
7621
|
+
const branchLines = findBranches(ctx, code, currentLine, lineIndent);
|
|
7982
7622
|
lines[lines.length - 1].branch = branchLines.lines;
|
|
7983
7623
|
currentLine = branchLines.endLine;
|
|
7984
7624
|
}
|
|
@@ -8205,6 +7845,7 @@ function setupStore(options) {
|
|
|
8205
7845
|
options,
|
|
8206
7846
|
flowState: 'menu',
|
|
8207
7847
|
openModal: false,
|
|
7848
|
+
paused: false,
|
|
8208
7849
|
},
|
|
8209
7850
|
getters: {
|
|
8210
7851
|
machineHead(state) {
|
|
@@ -8237,7 +7878,7 @@ function setupStore(options) {
|
|
|
8237
7878
|
const file = files[index];
|
|
8238
7879
|
scripts = {
|
|
8239
7880
|
...scripts,
|
|
8240
|
-
...
|
|
7881
|
+
...parseScript((ctx, line, error) => parserError(commit, ctx, line, error), file, scriptPaths[index]),
|
|
8241
7882
|
};
|
|
8242
7883
|
}
|
|
8243
7884
|
const end = Date.now();
|
|
@@ -8259,6 +7900,7 @@ function setupStore(options) {
|
|
|
8259
7900
|
];
|
|
8260
7901
|
state.ready = true;
|
|
8261
7902
|
commit('startPlaying');
|
|
7903
|
+
vm$1.callHook('onGameStart');
|
|
8262
7904
|
},
|
|
8263
7905
|
runLabel({ state, commit }, label) {
|
|
8264
7906
|
const branch = state.machine.script[label];
|
|
@@ -8524,113 +8166,593 @@ function setupStore(options) {
|
|
|
8524
8166
|
state.openModal = 'menu';
|
|
8525
8167
|
}
|
|
8526
8168
|
},
|
|
8169
|
+
pause(state) {
|
|
8170
|
+
state.paused = true;
|
|
8171
|
+
},
|
|
8172
|
+
unpause(state) {
|
|
8173
|
+
state.paused = false;
|
|
8174
|
+
},
|
|
8527
8175
|
},
|
|
8528
8176
|
plugins,
|
|
8529
8177
|
});
|
|
8530
8178
|
return {
|
|
8531
|
-
store,
|
|
8532
|
-
key,
|
|
8179
|
+
store,
|
|
8180
|
+
key,
|
|
8181
|
+
};
|
|
8182
|
+
}
|
|
8183
|
+
|
|
8184
|
+
let canvas;
|
|
8185
|
+
let ctx;
|
|
8186
|
+
let store$1;
|
|
8187
|
+
const mousePos = {
|
|
8188
|
+
x: 0,
|
|
8189
|
+
y: 0,
|
|
8190
|
+
};
|
|
8191
|
+
function startGameLoop(appStore) {
|
|
8192
|
+
store$1 = appStore;
|
|
8193
|
+
document.addEventListener('mousemove', (e) => {
|
|
8194
|
+
mousePos.x = e.clientX;
|
|
8195
|
+
mousePos.y = e.clientY;
|
|
8196
|
+
});
|
|
8197
|
+
document.addEventListener('click', debounce(mouseclick, 100, { maxWait: 200 }));
|
|
8198
|
+
gameLoop();
|
|
8199
|
+
}
|
|
8200
|
+
function gameLoop() {
|
|
8201
|
+
if (store$1.state.playing) {
|
|
8202
|
+
if (!canvas) {
|
|
8203
|
+
canvas = document.querySelector('#background-canvas');
|
|
8204
|
+
if (canvas && !ctx) {
|
|
8205
|
+
ctx = canvas.getContext('2d');
|
|
8206
|
+
}
|
|
8207
|
+
}
|
|
8208
|
+
else {
|
|
8209
|
+
ctx.fillStyle = 'white';
|
|
8210
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
8211
|
+
const currentScreen = store$1.state.currentScreen;
|
|
8212
|
+
const screen = getConfig().screens[currentScreen];
|
|
8213
|
+
const bg = screen.background;
|
|
8214
|
+
ctx.drawImage(images[bg], 0, 0);
|
|
8215
|
+
let foundCollision = false;
|
|
8216
|
+
const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
|
|
8217
|
+
if (screen.buttons) {
|
|
8218
|
+
for (const buttonName of screen.buttons) {
|
|
8219
|
+
if (store$1.state.buttons[buttonName].enabled) {
|
|
8220
|
+
const button = getConfig().buttons[buttonName];
|
|
8221
|
+
const image = images[button.background];
|
|
8222
|
+
ctx.drawImage(image, button.position.left, button.position.top);
|
|
8223
|
+
if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
|
|
8224
|
+
foundCollision = true;
|
|
8225
|
+
}
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
}
|
|
8229
|
+
if (foundCollision) {
|
|
8230
|
+
document.body.style.cursor = 'pointer';
|
|
8231
|
+
}
|
|
8232
|
+
else {
|
|
8233
|
+
document.body.style.cursor = 'default';
|
|
8234
|
+
}
|
|
8235
|
+
ctx.fillStyle = 'black';
|
|
8236
|
+
ctx.textAlign = 'left';
|
|
8237
|
+
// ctx.fillText(`x: ${scaledMousePos.x}, y: ${scaledMousePos.y}`, 0, 20);
|
|
8238
|
+
}
|
|
8239
|
+
}
|
|
8240
|
+
else {
|
|
8241
|
+
canvas = undefined;
|
|
8242
|
+
ctx = undefined;
|
|
8243
|
+
}
|
|
8244
|
+
window.requestAnimationFrame(gameLoop);
|
|
8245
|
+
}
|
|
8246
|
+
function mouseclick(e) {
|
|
8247
|
+
if (!canvas) {
|
|
8248
|
+
return;
|
|
8249
|
+
}
|
|
8250
|
+
mousePos.x = e.clientX;
|
|
8251
|
+
mousePos.y = e.clientY;
|
|
8252
|
+
const scaledMousePos = screenToCanvas(mousePos.x, mousePos.y, canvas);
|
|
8253
|
+
const currentScreen = store$1.state.currentScreen;
|
|
8254
|
+
const screen = getConfig().screens[currentScreen];
|
|
8255
|
+
if (screen.buttons) {
|
|
8256
|
+
for (const buttonName of screen.buttons) {
|
|
8257
|
+
if (store$1.state.buttons[buttonName].enabled) {
|
|
8258
|
+
const button = getConfig().buttons[buttonName];
|
|
8259
|
+
if (aabb(scaledMousePos.x, scaledMousePos.y, 1, 1, button.position.left, button.position.top, button.position.width, button.position.height)) {
|
|
8260
|
+
// clicked button
|
|
8261
|
+
const scriptToRun = button.action;
|
|
8262
|
+
const newStack = {
|
|
8263
|
+
branch: store$1.state.machine.script[scriptToRun],
|
|
8264
|
+
currentIndex: 0,
|
|
8265
|
+
label: scriptToRun,
|
|
8266
|
+
};
|
|
8267
|
+
store$1.commit('setStack', newStack);
|
|
8268
|
+
store$1.dispatch('runLine');
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
}
|
|
8274
|
+
|
|
8275
|
+
class CommandPlugin {
|
|
8276
|
+
keyword;
|
|
8277
|
+
runner;
|
|
8278
|
+
parser;
|
|
8279
|
+
constructor(keyword, runner, parser) {
|
|
8280
|
+
this.keyword = keyword;
|
|
8281
|
+
this.runner = runner;
|
|
8282
|
+
this.parser = parser;
|
|
8283
|
+
}
|
|
8284
|
+
}
|
|
8285
|
+
function generateParser(keyword) {
|
|
8286
|
+
return (ctx) => {
|
|
8287
|
+
ctx.command.commandType = keyword;
|
|
8288
|
+
ctx.currentLine++;
|
|
8289
|
+
};
|
|
8290
|
+
}
|
|
8291
|
+
|
|
8292
|
+
const add = async (context, cmd, choices) => {
|
|
8293
|
+
const { commit, dispatch } = context;
|
|
8294
|
+
const addKey = cmd.args[0];
|
|
8295
|
+
const addValue = cmd.args[1];
|
|
8296
|
+
commit('addInstruction', { path: addKey, value: addValue });
|
|
8297
|
+
return dispatch('nextLine');
|
|
8298
|
+
};
|
|
8299
|
+
const addPlugin = new CommandPlugin('add', add, generateParser('add'));
|
|
8300
|
+
|
|
8301
|
+
const addLevelRunner = async (context, cmd) => {
|
|
8302
|
+
const { commit, dispatch } = context;
|
|
8303
|
+
const skillKey = cmd.args[0];
|
|
8304
|
+
const levelToAdd = cmd.args[1];
|
|
8305
|
+
if (!skillKey || !levelToAdd) {
|
|
8306
|
+
error(commit, `add_level command needs a skill id and a value as parameters`);
|
|
8307
|
+
}
|
|
8308
|
+
dispatch('incrementSkill', {
|
|
8309
|
+
skill: skillKey,
|
|
8310
|
+
amount: levelToAdd,
|
|
8311
|
+
});
|
|
8312
|
+
return dispatch('nextLine');
|
|
8313
|
+
};
|
|
8314
|
+
const addLevelParser = (ctx) => {
|
|
8315
|
+
ctx.command.commandType = 'add_level';
|
|
8316
|
+
ctx.currentLine++;
|
|
8317
|
+
};
|
|
8318
|
+
const addLevelPlugin = new CommandPlugin('add_level', addLevelRunner, addLevelParser);
|
|
8319
|
+
|
|
8320
|
+
const addStatRunner = async (context, cmd) => {
|
|
8321
|
+
const { commit, dispatch } = context;
|
|
8322
|
+
const statKey = cmd.args[0];
|
|
8323
|
+
const amountToAdd = cmd.args[1];
|
|
8324
|
+
if (!statKey || !amountToAdd) {
|
|
8325
|
+
error(commit, `add_stat command needs a stat id and a value as parameters`);
|
|
8326
|
+
}
|
|
8327
|
+
commit('addStat', {
|
|
8328
|
+
stat: statKey,
|
|
8329
|
+
amount: amountToAdd,
|
|
8330
|
+
});
|
|
8331
|
+
return dispatch('nextLine');
|
|
8332
|
+
};
|
|
8333
|
+
const addStatParser = (ctx) => {
|
|
8334
|
+
ctx.command.commandType = 'add_stat';
|
|
8335
|
+
ctx.currentLine++;
|
|
8336
|
+
};
|
|
8337
|
+
const addStatPlugin = new CommandPlugin('add_stat', addStatRunner, addStatParser);
|
|
8338
|
+
|
|
8339
|
+
const addXp = async (context, cmd) => {
|
|
8340
|
+
const { commit, dispatch } = context;
|
|
8341
|
+
const xpKey = cmd.args[0];
|
|
8342
|
+
const xpToAdd = cmd.args[1];
|
|
8343
|
+
if (!xpKey || !xpToAdd) {
|
|
8344
|
+
error(commit, `add_xp command needs a skill id and a value as parameters`);
|
|
8345
|
+
}
|
|
8346
|
+
dispatch('addXp', {
|
|
8347
|
+
skill: xpKey,
|
|
8348
|
+
amount: xpToAdd,
|
|
8349
|
+
});
|
|
8350
|
+
return dispatch('nextLine');
|
|
8351
|
+
};
|
|
8352
|
+
const addXpPlugin = new CommandPlugin('add_xp', addXp, generateParser('add_xp'));
|
|
8353
|
+
|
|
8354
|
+
const choice = async (context, cmd) => {
|
|
8355
|
+
await runChoice(context, cmd);
|
|
8356
|
+
};
|
|
8357
|
+
async function runChoice(context, cmd) {
|
|
8358
|
+
const options = cmd.options;
|
|
8359
|
+
const prompt = options.prompt;
|
|
8360
|
+
const choices = options.choices
|
|
8361
|
+
.filter((choice) => {
|
|
8362
|
+
// Delete the choice if it fails a condition
|
|
8363
|
+
if (choice.condition) {
|
|
8364
|
+
return runCondition(context, choice.condition);
|
|
8365
|
+
}
|
|
8366
|
+
if (choice.skillCheck) {
|
|
8367
|
+
if (!getSkillCheckState(context, choice.skillCheck.id).available &&
|
|
8368
|
+
choice.skillCheck.hideAfterRoll) {
|
|
8369
|
+
return false;
|
|
8370
|
+
}
|
|
8371
|
+
}
|
|
8372
|
+
return true;
|
|
8373
|
+
})
|
|
8374
|
+
.map((choice) => {
|
|
8375
|
+
let text = choice.choice;
|
|
8376
|
+
let choiceAllowed = true;
|
|
8377
|
+
if (choice.skillCheck) {
|
|
8378
|
+
const check = choice.skillCheck;
|
|
8379
|
+
const { difficultyText, allowed } = getSkillCheckText({
|
|
8380
|
+
context,
|
|
8381
|
+
skill: check.skill,
|
|
8382
|
+
skillCheckId: check.id,
|
|
8383
|
+
value: check.value,
|
|
8384
|
+
});
|
|
8385
|
+
text = `${difficultyText} ${text}`;
|
|
8386
|
+
choiceAllowed = allowed;
|
|
8387
|
+
}
|
|
8388
|
+
const result = {
|
|
8389
|
+
choice: text,
|
|
8390
|
+
originalIndex: choice.index,
|
|
8391
|
+
allowed: choiceAllowed,
|
|
8392
|
+
};
|
|
8393
|
+
return result;
|
|
8394
|
+
});
|
|
8395
|
+
runCommand(context, prompt, choices);
|
|
8396
|
+
}
|
|
8397
|
+
const choiceParser = (ctx) => {
|
|
8398
|
+
const { line, command } = ctx;
|
|
8399
|
+
if (!line.branch || line.branch.length < 2) {
|
|
8400
|
+
ctx.parserContext.error(line.line, `Choice menu needs to have at least one option`);
|
|
8401
|
+
}
|
|
8402
|
+
const prompt = line.branch[0];
|
|
8403
|
+
const choices = line.branch.slice(1);
|
|
8404
|
+
const prompts = choices.map((choice, index) => {
|
|
8405
|
+
if (!choice.branch) {
|
|
8406
|
+
ctx.parserContext.error(choice.line, `Choice option doesn't have any branch to go to (${choice.code})`);
|
|
8407
|
+
}
|
|
8408
|
+
return parseChoiceOption(ctx, choice, index);
|
|
8409
|
+
});
|
|
8410
|
+
command.options = {
|
|
8411
|
+
prompt: ctx.processCommandsFunction(ctx.parserContext, [prompt], line)[0],
|
|
8412
|
+
choices: prompts,
|
|
8413
|
+
};
|
|
8414
|
+
command.commandType = 'choice';
|
|
8415
|
+
ctx.currentLine++;
|
|
8416
|
+
};
|
|
8417
|
+
function parseChoiceOption(ctx, choice, index) {
|
|
8418
|
+
let choiceText = choice.operator;
|
|
8419
|
+
let condition;
|
|
8420
|
+
let skillCheck;
|
|
8421
|
+
if (choice.operator === 'roll') {
|
|
8422
|
+
if (choice.args.length < 4) {
|
|
8423
|
+
ctx.parserContext.error(choice.line, `Skillchecks need 4 arguments!`);
|
|
8424
|
+
}
|
|
8425
|
+
choiceText = choice.args[3];
|
|
8426
|
+
const hideAfterRoll = choice.args.length >= 5;
|
|
8427
|
+
const successBranch = choice.branch[0];
|
|
8428
|
+
const failureBranch = choice.branch[1];
|
|
8429
|
+
const success = {
|
|
8430
|
+
text: successBranch.args[0],
|
|
8431
|
+
branch: ctx.processCommandsFunction(ctx.parserContext, successBranch.branch, choice),
|
|
8432
|
+
};
|
|
8433
|
+
let failedBranch;
|
|
8434
|
+
if (failureBranch.branch) {
|
|
8435
|
+
failedBranch = ctx.processCommandsFunction(ctx.parserContext, failureBranch.branch, choice);
|
|
8436
|
+
}
|
|
8437
|
+
const failure = {
|
|
8438
|
+
text: failureBranch.args[0],
|
|
8439
|
+
branch: failedBranch,
|
|
8440
|
+
};
|
|
8441
|
+
skillCheck = {
|
|
8442
|
+
id: choice.args[0],
|
|
8443
|
+
skill: choice.args[1],
|
|
8444
|
+
value: choice.args[2],
|
|
8445
|
+
hideAfterRoll,
|
|
8446
|
+
success,
|
|
8447
|
+
failure,
|
|
8448
|
+
};
|
|
8449
|
+
}
|
|
8450
|
+
if (choice.args[0] === 'if') {
|
|
8451
|
+
condition = choice.args[1];
|
|
8452
|
+
}
|
|
8453
|
+
return {
|
|
8454
|
+
choice: choiceText,
|
|
8455
|
+
condition,
|
|
8456
|
+
skillCheck,
|
|
8457
|
+
branch: ctx.processCommandsFunction(ctx.parserContext, choice.branch, choice),
|
|
8458
|
+
index,
|
|
8533
8459
|
};
|
|
8534
|
-
}
|
|
8460
|
+
}
|
|
8461
|
+
const choicePlugin = new CommandPlugin('choice', choice, choiceParser);
|
|
8535
8462
|
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
x: 0,
|
|
8541
|
-
y: 0,
|
|
8463
|
+
const clearDialog = async (context, cmd) => {
|
|
8464
|
+
const { commit, dispatch } = context;
|
|
8465
|
+
commit('clearDialog');
|
|
8466
|
+
return dispatch('nextLine');
|
|
8542
8467
|
};
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8468
|
+
const clearDialogPlugin = new CommandPlugin('clear_dialog', clearDialog, generateParser('clear_dialog'));
|
|
8469
|
+
|
|
8470
|
+
const ifFunction = async (context, cmd) => {
|
|
8471
|
+
const { commit, dispatch } = context;
|
|
8472
|
+
const newBranch = runConditionCommand(context, cmd);
|
|
8473
|
+
if (newBranch) {
|
|
8474
|
+
const newStack = {
|
|
8475
|
+
branch: newBranch,
|
|
8476
|
+
currentIndex: 0,
|
|
8477
|
+
};
|
|
8478
|
+
commit('addStack', newStack);
|
|
8479
|
+
return dispatch('runLine');
|
|
8480
|
+
}
|
|
8481
|
+
return dispatch('nextLine');
|
|
8482
|
+
};
|
|
8483
|
+
const ifParser = (ctx) => {
|
|
8484
|
+
const { command, lines, currentLine, line } = ctx;
|
|
8485
|
+
command.commandType = 'if';
|
|
8486
|
+
let failure;
|
|
8487
|
+
const nextLine = getLine(lines, currentLine + 1);
|
|
8488
|
+
if (nextLine && nextLine.operator === 'else') {
|
|
8489
|
+
failure = ctx.processCommandsFunction(ctx.parserContext, nextLine.branch, line);
|
|
8490
|
+
ctx.currentLine++;
|
|
8491
|
+
}
|
|
8492
|
+
command.options = {
|
|
8493
|
+
condition: command.args[0],
|
|
8494
|
+
success: ctx.processCommandsFunction(ctx.parserContext, line.branch, line),
|
|
8495
|
+
failure,
|
|
8496
|
+
};
|
|
8497
|
+
ctx.currentLine++;
|
|
8498
|
+
};
|
|
8499
|
+
const ifCommand = new CommandPlugin('if', ifFunction, ifParser);
|
|
8500
|
+
|
|
8501
|
+
const jump = async (context, cmd, choices) => {
|
|
8502
|
+
const { state, commit, dispatch } = context;
|
|
8503
|
+
const branch = cmd.args[0];
|
|
8504
|
+
const newStack = {
|
|
8505
|
+
branch: state.machine.script[branch],
|
|
8506
|
+
label: branch,
|
|
8507
|
+
currentIndex: 0,
|
|
8508
|
+
};
|
|
8509
|
+
commit('setStack', newStack);
|
|
8510
|
+
await dispatch('saveGame');
|
|
8511
|
+
await dispatch('runLine');
|
|
8512
|
+
};
|
|
8513
|
+
const jumpCommand = new CommandPlugin('jump', jump, generateParser('jump'));
|
|
8514
|
+
|
|
8515
|
+
const notify = async (context, cmd) => {
|
|
8516
|
+
const { dispatch } = context;
|
|
8517
|
+
const text = cmd.args[0];
|
|
8518
|
+
dispatch('addNotification', text);
|
|
8519
|
+
return dispatch('nextLine');
|
|
8520
|
+
};
|
|
8521
|
+
const notifyPlugin = new CommandPlugin('notify', notify, generateParser('notify'));
|
|
8522
|
+
|
|
8523
|
+
const pause = async (context, cmd) => {
|
|
8524
|
+
const { commit, dispatch } = context;
|
|
8525
|
+
const pauseOptions = cmd.options;
|
|
8526
|
+
if (pauseOptions.mode === 'music') {
|
|
8527
|
+
pauseAudio(commit, context.state.audio.currentMusic);
|
|
8528
|
+
}
|
|
8529
|
+
else if (pauseOptions.mode === 'sound' && pauseOptions.audio) {
|
|
8530
|
+
pauseAudio(commit, pauseOptions.audio);
|
|
8591
8531
|
}
|
|
8592
8532
|
else {
|
|
8593
|
-
|
|
8594
|
-
ctx = undefined;
|
|
8533
|
+
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.`);
|
|
8595
8534
|
}
|
|
8596
|
-
|
|
8597
|
-
}
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8535
|
+
return dispatch('nextLine');
|
|
8536
|
+
};
|
|
8537
|
+
const pauseParser = (ctx) => {
|
|
8538
|
+
const { command } = ctx;
|
|
8539
|
+
command.commandType = 'pause';
|
|
8540
|
+
command.options = {
|
|
8541
|
+
mode: command.args[0],
|
|
8542
|
+
audio: command.args[1],
|
|
8543
|
+
};
|
|
8544
|
+
ctx.currentLine++;
|
|
8545
|
+
};
|
|
8546
|
+
const pauseCommand = new CommandPlugin('pause', pause, pauseParser);
|
|
8547
|
+
|
|
8548
|
+
const play = async (context, cmd) => {
|
|
8549
|
+
const { dispatch } = context;
|
|
8550
|
+
const playOptions = cmd.options;
|
|
8551
|
+
if (playOptions.mode === 'music') {
|
|
8552
|
+
changeMusic(context, playOptions.audio);
|
|
8601
8553
|
}
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8554
|
+
else {
|
|
8555
|
+
playAudio(context.commit, playOptions.audio);
|
|
8556
|
+
}
|
|
8557
|
+
return dispatch('nextLine');
|
|
8558
|
+
};
|
|
8559
|
+
const playParser = (ctx) => {
|
|
8560
|
+
const { command } = ctx;
|
|
8561
|
+
command.commandType = 'play';
|
|
8562
|
+
command.options = {
|
|
8563
|
+
mode: command.args[0],
|
|
8564
|
+
audio: command.args[1],
|
|
8565
|
+
};
|
|
8566
|
+
ctx.currentLine++;
|
|
8567
|
+
};
|
|
8568
|
+
const playCommand = new CommandPlugin('play', play, playParser);
|
|
8569
|
+
|
|
8570
|
+
const set = async (context, cmd, choices) => {
|
|
8571
|
+
const { commit, dispatch } = context;
|
|
8572
|
+
const key = cmd.args[0];
|
|
8573
|
+
const value = cmd.args[1];
|
|
8574
|
+
commit('setData', { path: key, value });
|
|
8575
|
+
return dispatch('nextLine');
|
|
8576
|
+
};
|
|
8577
|
+
const setCommand = new CommandPlugin('set', set, generateParser('set'));
|
|
8578
|
+
|
|
8579
|
+
const setButton = async (context, cmd) => {
|
|
8580
|
+
const { commit, dispatch } = context;
|
|
8581
|
+
commit('changeButton', {
|
|
8582
|
+
button: cmd.args[0],
|
|
8583
|
+
enabled: cmd.args[1],
|
|
8584
|
+
});
|
|
8585
|
+
return dispatch('nextLine');
|
|
8586
|
+
};
|
|
8587
|
+
const setButtonParser = (ctx) => {
|
|
8588
|
+
const { command, line } = ctx;
|
|
8589
|
+
command.commandType = 'set_button';
|
|
8590
|
+
if (command.args.length !== 2) {
|
|
8591
|
+
ctx.parserContext.error(line.line, `set_button command should have 2 arguments`);
|
|
8592
|
+
}
|
|
8593
|
+
ctx.currentLine++;
|
|
8594
|
+
};
|
|
8595
|
+
const setButtonCommand = new CommandPlugin('set_button', setButton, setButtonParser);
|
|
8596
|
+
|
|
8597
|
+
const setScreen = async (context, cmd) => {
|
|
8598
|
+
const { commit, dispatch } = context;
|
|
8599
|
+
commit('setScreen', cmd.options.screen);
|
|
8600
|
+
return dispatch('nextLine');
|
|
8601
|
+
};
|
|
8602
|
+
const setScreenParser = (ctx) => {
|
|
8603
|
+
const { command } = ctx;
|
|
8604
|
+
command.commandType = 'set_screen';
|
|
8605
|
+
command.options = {
|
|
8606
|
+
screen: command.args[0],
|
|
8607
|
+
};
|
|
8608
|
+
ctx.currentLine++;
|
|
8609
|
+
};
|
|
8610
|
+
const setScreenCommand = new CommandPlugin('set_screen', setScreen, setScreenParser);
|
|
8611
|
+
|
|
8612
|
+
const setStat = async (context, cmd) => {
|
|
8613
|
+
const { commit, dispatch } = context;
|
|
8614
|
+
const setStatKey = cmd.args[0];
|
|
8615
|
+
const setAmount = cmd.args[1];
|
|
8616
|
+
if (!setStatKey || !setAmount) {
|
|
8617
|
+
error(commit, `set_stat command needs a stat id and a value as parameters`);
|
|
8618
|
+
}
|
|
8619
|
+
commit('setStat', {
|
|
8620
|
+
stat: setStatKey,
|
|
8621
|
+
amount: setAmount,
|
|
8622
|
+
});
|
|
8623
|
+
return dispatch('nextLine');
|
|
8624
|
+
};
|
|
8625
|
+
const setStatCommand = new CommandPlugin('set_stat', setStat, generateParser('set_stat'));
|
|
8626
|
+
|
|
8627
|
+
const stop = async (context, cmd) => {
|
|
8628
|
+
const { commit, dispatch } = context;
|
|
8629
|
+
const stopOptions = cmd.options;
|
|
8630
|
+
if (stopOptions.mode === 'music') {
|
|
8631
|
+
stopAudio(commit, context.state.audio.currentMusic);
|
|
8632
|
+
}
|
|
8633
|
+
else if (stopOptions.mode === 'sound' && stopOptions.audio) {
|
|
8634
|
+
stopAudio(commit, stopOptions.audio);
|
|
8635
|
+
}
|
|
8636
|
+
else {
|
|
8637
|
+
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.`);
|
|
8638
|
+
}
|
|
8639
|
+
return dispatch('nextLine');
|
|
8640
|
+
};
|
|
8641
|
+
const stopParser = (ctx) => {
|
|
8642
|
+
const { command } = ctx;
|
|
8643
|
+
command.commandType = 'stop';
|
|
8644
|
+
command.options = {
|
|
8645
|
+
mode: command.args[0],
|
|
8646
|
+
audio: command.args[1],
|
|
8647
|
+
};
|
|
8648
|
+
ctx.currentLine++;
|
|
8649
|
+
};
|
|
8650
|
+
const stopCommand = new CommandPlugin('stop', stop, stopParser);
|
|
8651
|
+
|
|
8652
|
+
const talk = async (context, cmd, choices) => {
|
|
8653
|
+
const { commit } = context;
|
|
8654
|
+
await textCommand(commit, {
|
|
8655
|
+
speaker: cmd.args[0],
|
|
8656
|
+
pose: cmd.args[1],
|
|
8657
|
+
text: `"${cmd.args[2]}"`,
|
|
8658
|
+
choices,
|
|
8659
|
+
interactive: true,
|
|
8660
|
+
});
|
|
8661
|
+
};
|
|
8662
|
+
const talkParser = (ctx) => {
|
|
8663
|
+
const { command, line } = ctx;
|
|
8664
|
+
command.commandType = 'talk';
|
|
8665
|
+
if (command.args.length < 3) {
|
|
8666
|
+
ctx.parserContext.error(line.line, `Talk command needs 3 arguments!`);
|
|
8624
8667
|
}
|
|
8668
|
+
ctx.currentLine++;
|
|
8669
|
+
};
|
|
8670
|
+
const talkCommand = new CommandPlugin('talk', talk, talkParser);
|
|
8671
|
+
|
|
8672
|
+
const text = async (context, cmd, choices) => {
|
|
8673
|
+
const { commit } = context;
|
|
8674
|
+
await textCommand(commit, {
|
|
8675
|
+
speaker: 'game',
|
|
8676
|
+
text: cmd.options.text,
|
|
8677
|
+
choices,
|
|
8678
|
+
interactive: true,
|
|
8679
|
+
});
|
|
8680
|
+
};
|
|
8681
|
+
const textParser = (ctx) => {
|
|
8682
|
+
const { command, line } = ctx;
|
|
8683
|
+
command.commandType = 'text';
|
|
8684
|
+
command.options = {
|
|
8685
|
+
text: line.operator,
|
|
8686
|
+
};
|
|
8687
|
+
ctx.currentLine++;
|
|
8688
|
+
};
|
|
8689
|
+
const textCommandPlugin = new CommandPlugin('text', text, textParser);
|
|
8690
|
+
|
|
8691
|
+
const wait = async (context, cmd) => {
|
|
8692
|
+
const { dispatch } = context;
|
|
8693
|
+
await timeout(cmd.options.duration);
|
|
8694
|
+
return dispatch('nextLine');
|
|
8695
|
+
};
|
|
8696
|
+
const waitParser = (ctx) => {
|
|
8697
|
+
const { command } = ctx;
|
|
8698
|
+
command.commandType = 'wait';
|
|
8699
|
+
command.options = {
|
|
8700
|
+
duration: parseInt(command.args[0], 10),
|
|
8701
|
+
};
|
|
8702
|
+
ctx.currentLine++;
|
|
8703
|
+
};
|
|
8704
|
+
const waitCommand = new CommandPlugin('wait', wait, waitParser);
|
|
8705
|
+
|
|
8706
|
+
function registerBaseCommands(vm) {
|
|
8707
|
+
vm.addCommand(addLevelPlugin);
|
|
8708
|
+
vm.addCommand(addStatPlugin);
|
|
8709
|
+
vm.addCommand(addXpPlugin);
|
|
8710
|
+
vm.addCommand(addPlugin);
|
|
8711
|
+
vm.addCommand(choicePlugin);
|
|
8712
|
+
vm.addCommand(clearDialogPlugin);
|
|
8713
|
+
vm.addCommand(ifCommand);
|
|
8714
|
+
vm.addCommand(jumpCommand);
|
|
8715
|
+
vm.addCommand(notifyPlugin);
|
|
8716
|
+
vm.addCommand(pauseCommand);
|
|
8717
|
+
vm.addCommand(playCommand);
|
|
8718
|
+
vm.addCommand(setButtonCommand);
|
|
8719
|
+
vm.addCommand(setScreenCommand);
|
|
8720
|
+
vm.addCommand(setStatCommand);
|
|
8721
|
+
vm.addCommand(setCommand);
|
|
8722
|
+
vm.addCommand(stopCommand);
|
|
8723
|
+
vm.addCommand(talkCommand);
|
|
8724
|
+
vm.addCommand(textCommandPlugin);
|
|
8725
|
+
vm.addCommand(waitCommand);
|
|
8726
|
+
}
|
|
8727
|
+
|
|
8728
|
+
class NarratPlugin {
|
|
8729
|
+
onPageLoaded() { }
|
|
8730
|
+
onNarratSetup() { }
|
|
8731
|
+
onAppMounted() { }
|
|
8732
|
+
onAssetsLoaded() { }
|
|
8733
|
+
onGameSetup() { }
|
|
8734
|
+
onGameStart() { }
|
|
8735
|
+
onGameMounted() { }
|
|
8736
|
+
onGameDismounted() { }
|
|
8737
|
+
}
|
|
8738
|
+
|
|
8739
|
+
function registerPlugin(plugin) {
|
|
8740
|
+
vm$1.addPlugin(plugin);
|
|
8741
|
+
}
|
|
8742
|
+
function addCommand(command) {
|
|
8743
|
+
vm$1.addCommand(command);
|
|
8625
8744
|
}
|
|
8626
8745
|
|
|
8627
8746
|
let app;
|
|
8628
8747
|
let store$2;
|
|
8748
|
+
vm$1.callHook('onPageLoaded');
|
|
8629
8749
|
async function startApp(config, options) {
|
|
8750
|
+
registerBaseCommands(vm$1);
|
|
8630
8751
|
logManager.setupDebugger(options.debug);
|
|
8631
8752
|
const configFile = await getFile('data/config.json');
|
|
8632
8753
|
setConfig(JSON.parse(configFile));
|
|
8633
|
-
console.log('%c Narrat game engine – 0.
|
|
8754
|
+
console.log('%c Narrat game engine – 0.11.2 - June 15, 2022 15:56:51', 'background: #222; color: #bada55');
|
|
8755
|
+
vm$1.callHook('onNarratSetup');
|
|
8634
8756
|
const storeSetup = setupStore(options);
|
|
8635
8757
|
store$2 = storeSetup.store;
|
|
8636
8758
|
app = createApp(script$b, {
|
|
@@ -8652,6 +8774,10 @@ async function startApp(config, options) {
|
|
|
8652
8774
|
store: store$2,
|
|
8653
8775
|
app,
|
|
8654
8776
|
state: store$2.state,
|
|
8777
|
+
vm: vm$1,
|
|
8778
|
+
jump: (label) => {
|
|
8779
|
+
store$2.dispatch('runLabel', label);
|
|
8780
|
+
},
|
|
8655
8781
|
};
|
|
8656
8782
|
window.narrat = narrat;
|
|
8657
8783
|
}
|
|
@@ -8666,5 +8792,5 @@ async function startApp(config, options) {
|
|
|
8666
8792
|
startGameLoop(store$2);
|
|
8667
8793
|
}
|
|
8668
8794
|
|
|
8669
|
-
export { startApp };
|
|
8795
|
+
export { CommandPlugin, NarratPlugin, addCommand, aspectRatioFit, generateParser, getConfig, getSkillConfig, registerPlugin, setConfig, startApp };
|
|
8670
8796
|
//# sourceMappingURL=index.esm.js.map
|