1 line
18 KiB
JavaScript
1 line
18 KiB
JavaScript
import{_ as e,c as t,o as a,N as d}from"./chunks/framework.0799945b.js";const f=JSON.parse('{"title":"Module: features/upgrades/upgrade","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/features/upgrade.md","lastUpdated":null}'),r={name:"api/modules/features/upgrade.md"},o=d('<h1 id="module-features-upgrades-upgrade" tabindex="-1">Module: features/upgrades/upgrade <a class="header-anchor" href="#module-features-upgrades-upgrade" aria-label="Permalink to "Module: features/upgrades/upgrade""></a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-label="Permalink to "Interfaces""></a></h2><h3 id="baseupgrade" tabindex="-1">BaseUpgrade <a class="header-anchor" href="#baseupgrade" aria-label="Permalink to "BaseUpgrade""></a></h3><p>• <strong>BaseUpgrade</strong>: <code>Object</code></p><p>The properties that are added onto a processed <a href="./upgrade#upgradeoptions">UpgradeOptions</a> to create an <a href="./upgrade#upgrade">Upgrade</a>.</p><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>[Component]</code></td><td style="text-align:left;"><a href="./feature#genericcomponent"><code>GenericComponent</code></a></td><td style="text-align:left;">The Vue component used to render this feature.</td></tr><tr><td style="text-align:left;"><code>[GatherProps]</code></td><td style="text-align:left;">() => <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>unknown</code>></td><td style="text-align:left;">A function to gather the props the vue component requires for this feature.</td></tr><tr><td style="text-align:left;"><code>bought</code></td><td style="text-align:left;"><a href="./../game/persistence#persistent"><code>Persistent</code></a><<code>boolean</code>></td><td style="text-align:left;">Whether or not this upgrade has been purchased.</td></tr><tr><td style="text-align:left;"><code>canPurchase</code></td><td style="text-align:left;"><code>Ref</code><<code>boolean</code>></td><td style="text-align:left;">Whether or not the upgrade can currently be purchased.</td></tr><tr><td style="text-align:left;"><code>id</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;">An auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates.</td></tr><tr><td style="text-align:left;"><code>purchase</code></td><td style="text-align:left;"><code>VoidFunction</code></td><td style="text-align:left;">Purchase the upgrade</td></tr><tr><td style="text-align:left;"><code>type</code></td><td style="text-align:left;">typeof <a href="./upgrade#upgradetype"><code>UpgradeType</code></a></td><td style="text-align:left;">A symbol that helps identify features of the same type.</td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L75" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:75</a></p><hr><h3 id="upgradeoptions" tabindex="-1">UpgradeOptions <a class="header-anchor" href="#upgradeoptions" aria-label="Permalink to "UpgradeOptions""></a></h3><p>• <strong>UpgradeOptions</strong>: <code>Object</code></p><p>An object that configures a <a href="./upgrade#upgrade">Upgrade</a>.</p><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>classes?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type" target="_blank" rel="noreferrer"><code>Record</code></a><<code>string</code>, <code>boolean</code>>></td><td style="text-align:left;">Dictionary of CSS classes to apply to this feature.</td></tr><tr><td style="text-align:left;"><code>display?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> | { <code>description</code>: <a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> ; <code>effectDisplay?</code>: <a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> ; <code>title?</code>: <a href="./feature#coercablecomponent"><code>CoercableComponent</code></a> }></td><td style="text-align:left;">The display to use for this clickable.</td></tr><tr><td style="text-align:left;"><code>mark?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<code>string</code> | <code>boolean</code>></td><td style="text-align:left;">Shows a marker on the corner of the feature.</td></tr><tr><td style="text-align:left;"><code>onPurchase?</code></td><td style="text-align:left;"><code>VoidFunction</code></td><td style="text-align:left;">A function that is called when the upgrade is purchased.</td></tr><tr><td style="text-align:left;"><code>requirements</code></td><td style="text-align:left;"><a href="./../game/requirements#requirements"><code>Requirements</code></a></td><td style="text-align:left;">The requirements to purchase this upgrade.</td></tr><tr><td style="text-align:left;"><code>style?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<a href="./feature#stylevalue"><code>StyleValue</code></a>></td><td style="text-align:left;">CSS to apply to this feature.</td></tr><tr><td style="text-align:left;"><code>visibility?</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<code>boolean</code> | <a href="./feature#visibility"><code>Visibility</code></a>></td><td style="text-align:left;">Whether this clickable should be visible.</td></tr></tbody></table><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L45" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:45</a></p><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-label="Permalink to "Type Aliases""></a></h2><h3 id="genericupgrade" tabindex="-1">GenericUpgrade <a class="header-anchor" href="#genericupgrade" aria-label="Permalink to "GenericUpgrade""></a></h3><p>Ƭ <strong>GenericUpgrade</strong>: <a href="./feature#replace"><code>Replace</code></a><<a href="./upgrade#upgrade"><code>Upgrade</code></a><<a href="./upgrade#upgradeoptions"><code>UpgradeOptions</code></a>>, { <code>visibility</code>: <a href="./../util/computed#processedcomputable"><code>ProcessedComputable</code></a><<a href="./feature#visibility"><code>Visibility</code></a> | <code>boolean</code>> }></p><p>A type that matches any valid <a href="./upgrade#upgrade">Upgrade</a> object.</p><h4 id="defined-in-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L106" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:106</a></p><hr><h3 id="upgrade" tabindex="-1">Upgrade <a class="header-anchor" href="#upgrade" aria-label="Permalink to "Upgrade""></a></h3><p>Ƭ <strong>Upgrade</strong><<code>T</code>>: <a href="./feature#replace"><code>Replace</code></a><<code>T</code> & <a href="./upgrade#baseupgrade"><code>BaseUpgrade</code></a>, { <code>classes</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"classes"</code>]> ; <code>display</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"display"</code>]> ; <code>mark</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"mark"</code>]> ; <code>requirements</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"requirements"</code>]> ; <code>style</code>: <a href="./../util/computed#getcomputabletype"><code>GetComputableType</code></a><<code>T</code>[<code>"style"</code>]> ; <code>visibility</code>: <a href="./../util/computed#getcomputabletypewithdefault"><code>GetComputableTypeWithDefault</code></a><<code>T</code>[<code>"visibility"</code>], <a href="./feature#visible"><code>Visible</code></a>> }></p><p>An object that represents a feature that can be purchased a single time.</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to "Type parameters""></a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="./upgrade#upgradeoptions"><code>UpgradeOptions</code></a></td></tr></tbody></table><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L93" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:93</a></p><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-label="Permalink to "Variables""></a></h2><h3 id="upgradetype" tabindex="-1">UpgradeType <a class="header-anchor" href="#upgradetype" aria-label="Permalink to "UpgradeType""></a></h3><p>• <code>Const</code> <strong>UpgradeType</strong>: typeof <a href="./upgrade#upgradetype"><code>UpgradeType</code></a></p><p>A symbol used to identify <a href="./upgrade#upgrade">Upgrade</a> features.</p><h4 id="defined-in-4" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-4" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L40" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:40</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to "Functions""></a></h2><h3 id="createupgrade" tabindex="-1">createUpgrade <a class="header-anchor" href="#createupgrade" aria-label="Permalink to "createUpgrade""></a></h3><p>▸ <strong>createUpgrade</strong><<code>T</code>>(<code>optionsFunc</code>): <a href="./upgrade#upgrade"><code>Upgrade</code></a><<code>T</code>></p><p>Lazily creates an upgrade with the given options.</p><h5 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-label="Permalink to "Type parameters""></a></h5><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="./upgrade#upgradeoptions"><code>UpgradeOptions</code></a></td></tr></tbody></table><h5 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to "Parameters""></a></h5><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>optionsFunc</code></td><td style="text-align:left;"><a href="./feature#optionsfunc"><code>OptionsFunc</code></a><<code>T</code>, <a href="./upgrade#baseupgrade"><code>BaseUpgrade</code></a>, <a href="./upgrade#genericupgrade"><code>GenericUpgrade</code></a>></td><td style="text-align:left;">Upgrade options.</td></tr></tbody></table><h5 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to "Returns""></a></h5><p><a href="./upgrade#upgrade"><code>Upgrade</code></a><<code>T</code>></p><h4 id="defined-in-5" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-5" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L117" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:117</a></p><hr><h3 id="setupautopurchase" tabindex="-1">setupAutoPurchase <a class="header-anchor" href="#setupautopurchase" aria-label="Permalink to "setupAutoPurchase""></a></h3><p>▸ <strong>setupAutoPurchase</strong>(<code>layer</code>, <code>autoActive</code>, <code>upgrades?</code>): <code>void</code></p><p>Utility to auto purchase a list of upgrades whenever they're affordable.</p><h5 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to "Parameters""></a></h5><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Default value</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>layer</code></td><td style="text-align:left;"><a href="./../game/layers#genericlayer"><code>GenericLayer</code></a></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The layer the upgrades are apart of</td></tr><tr><td style="text-align:left;"><code>autoActive</code></td><td style="text-align:left;"><a href="./../util/computed#computable"><code>Computable</code></a><<code>boolean</code>></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">Whether or not the upgrades should currently be auto-purchasing</td></tr><tr><td style="text-align:left;"><code>upgrades</code></td><td style="text-align:left;"><a href="./upgrade#genericupgrade"><code>GenericUpgrade</code></a>[]</td><td style="text-align:left;"><code>[]</code></td><td style="text-align:left;">The specific upgrades to upgrade. If unspecified, uses all upgrades on the layer.</td></tr></tbody></table><h5 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to "Returns""></a></h5><p><code>void</code></p><h4 id="defined-in-6" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-6" aria-label="Permalink to "Defined in""></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/8c0a0c4/src/features/upgrades/upgrade.ts#L190" target="_blank" rel="noreferrer">profectus/src/features/upgrades/upgrade.ts:190</a></p><h2 id="components" tabindex="-1">Components <a class="header-anchor" href="#components" aria-label="Permalink to "Components""></a></h2><h3 id="upgrade-component" tabindex="-1">Upgrade Component <a class="header-anchor" href="#upgrade-component" aria-label="Permalink to "Upgrade Component""></a></h3><h4 id="props" tabindex="-1">Props <a class="header-anchor" href="#props" aria-label="Permalink to "Props""></a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>display</code>*</td><td style="text-align:left;"><code>processedPropType<UnwrapRef<GenericUpgrade["display"]>>(String, Object, Function)</code></td></tr><tr><td style="text-align:left;"><code>visibility</code>*</td><td style="text-align:left;"><code>processedPropType<Visibility | boolean>(Number, Boolean)</code></td></tr><tr><td style="text-align:left;"><code>style</code></td><td style="text-align:left;"><code>processedPropType<StyleValue>(String, Object, Array)</code></td></tr><tr><td style="text-align:left;"><code>classes</code></td><td style="text-align:left;"><code>processedPropType<Record<string, boolean>>(Object)</code></td></tr><tr><td style="text-align:left;"><code>requirements</code>*</td><td style="text-align:left;"><code>Requirements</code></td></tr><tr><td style="text-align:left;"><code>canPurchase</code>*</td><td style="text-align:left;"><code>processedPropType<boolean>(Boolean)</code></td></tr><tr><td style="text-align:left;"><code>bought</code>*</td><td style="text-align:left;"><code>processedPropType<boolean>(Boolean)</code></td></tr><tr><td style="text-align:left;"><code>mark</code></td><td style="text-align:left;"><code>processedPropType<boolean | string>(Boolean, String)</code></td></tr><tr><td style="text-align:left;"><code>id</code>*</td><td style="text-align:left;"><code>string</code></td></tr><tr><td style="text-align:left;"><code>purchase</code>*</td><td style="text-align:left;"><code>VoidFunction</code></td></tr></tbody></table>',61),l=[o];function c(s,n,i,p,u,g){return a(),t("div",null,l)}const y=e(r,[["render",c]]);export{f as __pageData,y as default};
|