pages/assets/public_kronos_docs_milestones.md.3197e6a0.js

16 lines
5.5 KiB
JavaScript
Raw Normal View History

import{_ as s,o as e,c as n,Q as a}from"./chunks/framework.1169fbc9.js";const E=JSON.parse('{"title":"Milestones","description":"","frontmatter":{},"headers":[],"relativePath":"public/kronos/docs/milestones.md","filePath":"public/kronos/docs/milestones.md","lastUpdated":1701136977000}'),o={name:"public/kronos/docs/milestones.md"},t=a(`<h1 id="milestones" tabindex="-1">Milestones <a class="header-anchor" href="#milestones" aria-label="Permalink to &quot;Milestones&quot;"></a></h1><p>Milestones are awarded to the player when they meet a certain goal, and give some benefit. Milestones should be formatted like this:</p><div class="language-js vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">js</span><pre class="shiki github-dark vp-code-dark"><code><span class="line"><span style="color:#B392F0;">milestones</span><span style="color:#E1E4E8;">: {</span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#79B8FF;">0</span><span style="color:#E1E4E8;">: {</span></span>
<span class="line"><span style="color:#E1E4E8;"> requirementDescription: </span><span style="color:#9ECBFF;">&quot;123 waffles&quot;</span><span style="color:#E1E4E8;">,</span></span>
<span class="line"><span style="color:#E1E4E8;"> effectDescription: </span><span style="color:#9ECBFF;">&quot;blah&quot;</span><span style="color:#E1E4E8;">,</span></span>
<span class="line"><span style="color:#E1E4E8;"> </span><span style="color:#B392F0;">done</span><span style="color:#E1E4E8;">() { </span><span style="color:#F97583;">return</span><span style="color:#E1E4E8;"> player.w.points.</span><span style="color:#B392F0;">gte</span><span style="color:#E1E4E8;">(</span><span style="color:#79B8FF;">123</span><span style="color:#E1E4E8;">) }</span></span>
<span class="line"><span style="color:#E1E4E8;"> }</span></span>
<span class="line"><span style="color:#E1E4E8;"> etc</span></span>
<span class="line"><span style="color:#E1E4E8;">}</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">milestones</span><span style="color:#24292E;">: {</span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#005CC5;">0</span><span style="color:#24292E;">: {</span></span>
<span class="line"><span style="color:#24292E;"> requirementDescription: </span><span style="color:#032F62;">&quot;123 waffles&quot;</span><span style="color:#24292E;">,</span></span>
<span class="line"><span style="color:#24292E;"> effectDescription: </span><span style="color:#032F62;">&quot;blah&quot;</span><span style="color:#24292E;">,</span></span>
<span class="line"><span style="color:#24292E;"> </span><span style="color:#6F42C1;">done</span><span style="color:#24292E;">() { </span><span style="color:#D73A49;">return</span><span style="color:#24292E;"> player.w.points.</span><span style="color:#6F42C1;">gte</span><span style="color:#24292E;">(</span><span style="color:#005CC5;">123</span><span style="color:#24292E;">) }</span></span>
<span class="line"><span style="color:#24292E;"> }</span></span>
<span class="line"><span style="color:#24292E;"> etc</span></span>
<span class="line"><span style="color:#24292E;">}</span></span></code></pre></div><p>You can use <code>hasMilestone(layer, id)</code> to determine if the player has a given milestone</p><p>Milestone features:</p><ul><li><p>requirementDescription: A string describing the requirement for unlocking this milestone. Suggestion: Use a &quot;total&quot;. It can also be a function that returns updating text. Can use basic HTML.</p></li><li><p>effectDescription: A string describing the reward for having the milestone. <em>You will have to implement the reward elsewhere.</em> It can also be a function that returns updating text. Can use basic HTML.</p></li><li><p>done(): A function returning a boolean to determine if the milestone should be awarded.</p></li><li><p>toggles: <strong>optional</strong>. Creates toggle buttons that appear on the milestone when it is unlocked. The toggles can toggle a given boolean value in a layer. It is defined as an array of paired items, one pair per toggle. The first is the internal name of the layer the value being toggled is stored in, and the second is the internal name of the variable to toggle. (e.g. [[&quot;b&quot;, &quot;auto&quot;], [&quot;g&quot;, &quot;auto&quot;])</p><p><strong>Tip:</strong> Toggles are not de-set if the milestone becomes locked! In this case, you should also check if the player has the milestone.</p></li><li><p>style: <strong>optional</strong>. Applies CSS to this milestone, in the form of an object where the keys are CSS attributes, and the values are the values for those attributes (both as strings).</p></li><li><p>unlocked(): <strong>optional</strong>. A function returning a boolean to determine if the milestone should be shown. If absent, it is always shown.</p></li><li><p>layer: <strong>assigned automagically</strong>. It&#39;s the same value as the name of this layer, so you can do <code>player[this.layer].points</code> or similar.</p></li><li><p>id: <strong>assigned automagically</strong>. It&#39;s the &quot;key&quot; which the milestone was stored under, for convenient access. The milestone in the example&#39;s id is 0.</p></li></ul><p>Disaable milestone popups by adding <code>milestonePopups: false</code> to the layer.</p>`,7),l=[t];function p(i,r,c,u,d,h){return e(),n("div",null,l)}const g=s(o,[["render",p]]);export{E as __pageData,g as default};