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('

Module: features/upgrades/upgrade

Interfaces

BaseUpgrade

BaseUpgrade: Object

The properties that are added onto a processed UpgradeOptions to create an Upgrade.

NameTypeDescription
[Component]GenericComponentThe Vue component used to render this feature.
[GatherProps]() => Record<string, unknown>A function to gather the props the vue component requires for this feature.
boughtPersistent<boolean>Whether or not this upgrade has been purchased.
canPurchaseRef<boolean>Whether or not the upgrade can currently be purchased.
idstringAn auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates.
purchaseVoidFunctionPurchase the upgrade
typetypeof UpgradeTypeA symbol that helps identify features of the same type.

Defined in

profectus/src/features/upgrades/upgrade.ts:75


UpgradeOptions

UpgradeOptions: Object

An object that configures a Upgrade.

NameTypeDescription
classes?Computable<Record<string, boolean>>Dictionary of CSS classes to apply to this feature.
display?Computable<CoercableComponent | { description: CoercableComponent ; effectDisplay?: CoercableComponent ; title?: CoercableComponent }>The display to use for this clickable.
mark?Computable<string | boolean>Shows a marker on the corner of the feature.
onPurchase?VoidFunctionA function that is called when the upgrade is purchased.
requirementsRequirementsThe requirements to purchase this upgrade.
style?Computable<StyleValue>CSS to apply to this feature.
visibility?Computable<boolean | Visibility>Whether this clickable should be visible.

Defined in

profectus/src/features/upgrades/upgrade.ts:45

Type Aliases

GenericUpgrade

Ƭ GenericUpgrade: Replace<Upgrade<UpgradeOptions>, { visibility: ProcessedComputable<Visibility | boolean> }>

A type that matches any valid Upgrade object.

Defined in

profectus/src/features/upgrades/upgrade.ts:106


Upgrade

Ƭ Upgrade<T>: Replace<T & BaseUpgrade, { classes: GetComputableType<T["classes"]> ; display: GetComputableType<T["display"]> ; mark: GetComputableType<T["mark"]> ; requirements: GetComputableType<T["requirements"]> ; style: GetComputableType<T["style"]> ; visibility: GetComputableTypeWithDefault<T["visibility"], Visible> }>

An object that represents a feature that can be purchased a single time.

Type parameters

NameType
Textends UpgradeOptions

Defined in

profectus/src/features/upgrades/upgrade.ts:93

Variables

UpgradeType

Const UpgradeType: typeof UpgradeType

A symbol used to identify Upgrade features.

Defined in

profectus/src/features/upgrades/upgrade.ts:40

Functions

createUpgrade

createUpgrade<T>(optionsFunc): Upgrade<T>

Lazily creates an upgrade with the given options.

Type parameters
NameType
Textends UpgradeOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T, BaseUpgrade, GenericUpgrade>Upgrade options.
Returns

Upgrade<T>

Defined in

profectus/src/features/upgrades/upgrade.ts:117


setupAutoPurchase

setupAutoPurchase(layer, autoActive, upgrades?): void

Utility to auto purchase a list of upgrades whenever they're affordable.

Parameters
NameTypeDefault valueDescription
layerGenericLayerundefinedThe layer the upgrades are apart of
autoActiveComputable<boolean>undefinedWhether or not the upgrades should currently be auto-purchasing
upgradesGenericUpgrade[][]The specific upgrades to upgrade. If unspecified, uses all upgrades on the layer.
Returns

void

Defined in

profectus/src/features/upgrades/upgrade.ts:190

Components

Upgrade Component

Props

NameType
display*processedPropType<UnwrapRef<GenericUpgrade["display"]>>(String, Object, Function)
visibility*processedPropType<Visibility | boolean>(Number, Boolean)
styleprocessedPropType<StyleValue>(String, Object, Array)
classesprocessedPropType<Record<string, boolean>>(Object)
requirements*Requirements
canPurchase*processedPropType<boolean>(Boolean)
bought*processedPropType<boolean>(Boolean)
markprocessedPropType<boolean | string>(Boolean, String)
id*string
purchase*VoidFunction
',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};