<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> respec</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">() {}, </span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">//**optional**, implement it to reset things and give back your currency.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> // Having this function makes a respec button appear</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> respecText</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// **optional**, text that appears on the respec button</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> showRespecButton</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(){} </span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">//**optional**, a function determining whether or not to show the button. Defaults to true if absent.</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> sellOneText, </span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">sellAllText</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// **optional**, text that appears on the "sell one" and "sell all" buttons respectively (if you are using them)</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span></code></pre></div><p>Features:</p><ul><li><p>title: <strong>optional</strong>, displayed at the top in a larger font It can also be a function that returns updating text.</p></li><li><p>cost(): cost for buying the next buyable. Can have an optional argument "x" to calculate the cost of the x+1th object, but needs to use "current amount" as a default value for x. (x is a Decimal). Can return an object if there are multiple currencies.</p></li><li><p>effect(): <strong>optional</strong>, A function that calculates and returns the current values of bonuses of this buyable. Can return a value or an object containing multiple values.</p></li><li><p>display(): A function returning everything that should be displayed on the buyable after the title, likely including the description, amount bought, cost, and current effect. Can use basic HTML.</p></li><li><p>unlocked(): <strong>optional</strong>, A function returning a bool to determine if the buyable is visible or not. Default is unlocked.</p></li><li><p>canAfford(): A function returning a bool to determine if you can buy one of the buyables.</p></li><li><p>buy(): A function that implements buying one of the buyable, including spending the currency.</p></li><li><p>buyMax(): <strong>optional</strong>, A function that implements buying as many of the buyable as possible.</p></li><li><p>style: <strong>Optional</strong>, Applies CSS to this buyable, 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>layer: <strong>Assigned automagically</strong>. It's the same value as the name of this layer, so you can do player[this.layer].points or similar</p></li><li><p>id: <strong>Assigned automagically</strong>. It's the "key" which the buyable was stored under, for convenient access. The buyable in the example's id is 11.</p></li></ul><p>Sell One/Sell All:</p><p>Including a sellOne or sellAll function will cause an additional button to appear beneath the buyable. They are functionally identical, but "sell one" appears above "sell all". You can also use them for other things.</p><p>sellOne/sellAll(): <strong>optional</strong>, Called when the button is pressed. The standard use would be to decrease/reset the amount of the buyable, And possibly return some currency to the player.</p><p>canSellOne/canSellAll(): <strong>optional</strong>, booleans determining whether or not to show the buttons. If "canSellOne/All" is absent but "sellOne/All" is present, the appropriate button will always show.</p></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-d4a0bba5><!--[--><!--]--><divclass="edit-info"data-v-d4a0bba5><!----><divclass="last-updated"data-v-d4a0bba5><pclass="VPLastUpdated"data-v-d4a0bba5data-v-7e05ebdb>Last updated: <timedatetime="2020-10-17T19:50:30.000Z"data-v-7e05ebdb></time></p></div></div><navclass="prev-next"aria-labelledby="doc-footer-aria-label"data-v-d4a0bba5><spanclass="visually-hidden"id="doc-footer-aria-label"data-v-d4a0bba5>Pager</span><divclass="pager"data-v-d4a0bba5><!----></div><divclass="pager"data-v-d4a0bba5><aclass="VPLink link pager-link next"href="/garden/my-projects"data-v-d4a0bba5><!--[--><spanclass="desc"data-v-d4a0bba5>Next page</span><spanclass="title"data-v-d4a0bba5>My Projects</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>