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('
• BaseUpgrade: Object
The properties that are added onto a processed UpgradeOptions to create an Upgrade.
Name | Type | Description |
---|---|---|
[Component] | GenericComponent | The Vue component used to render this feature. |
[GatherProps] | () => Record <string , unknown > | A function to gather the props the vue component requires for this feature. |
bought | Persistent <boolean > | Whether or not this upgrade has been purchased. |
canPurchase | Ref <boolean > | Whether or not the upgrade can currently be purchased. |
id | string | An auto-generated ID for identifying features that appear in the DOM. Will not persist between refreshes or updates. |
purchase | VoidFunction | Purchase the upgrade |
type | typeof UpgradeType | A symbol that helps identify features of the same type. |
profectus/src/features/upgrades/upgrade.ts:75
• UpgradeOptions: Object
An object that configures a Upgrade.
Name | Type | Description |
---|---|---|
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? | VoidFunction | A function that is called when the upgrade is purchased. |
requirements | Requirements | The requirements to purchase this upgrade. |
style? | Computable <StyleValue > | CSS to apply to this feature. |
visibility? | Computable <boolean | Visibility > | Whether this clickable should be visible. |
profectus/src/features/upgrades/upgrade.ts:45
Ƭ GenericUpgrade: Replace
<Upgrade
<UpgradeOptions
>, { visibility
: ProcessedComputable
<Visibility
| boolean
> }>
A type that matches any valid Upgrade object.
profectus/src/features/upgrades/upgrade.ts:106
Ƭ 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.
Name | Type |
---|---|
T | extends UpgradeOptions |
profectus/src/features/upgrades/upgrade.ts:93
• Const
UpgradeType: typeof UpgradeType
A symbol used to identify Upgrade features.
profectus/src/features/upgrades/upgrade.ts:40
▸ createUpgrade<T
>(optionsFunc
): Upgrade
<T
>
Lazily creates an upgrade with the given options.
Name | Type |
---|---|
T | extends UpgradeOptions |
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T , BaseUpgrade , GenericUpgrade > | Upgrade options. |
Upgrade
<T
>
profectus/src/features/upgrades/upgrade.ts:117
▸ setupAutoPurchase(layer
, autoActive
, upgrades?
): void
Utility to auto purchase a list of upgrades whenever they're affordable.
Name | Type | Default value | Description |
---|---|---|---|
layer | GenericLayer | undefined | The layer the upgrades are apart of |
autoActive | Computable <boolean > | undefined | Whether or not the upgrades should currently be auto-purchasing |
upgrades | GenericUpgrade [] | [] | The specific upgrades to upgrade. If unspecified, uses all upgrades on the layer. |
void
profectus/src/features/upgrades/upgrade.ts:190
Name | Type |
---|---|
display * | processedPropType<UnwrapRef<GenericUpgrade["display"]>>(String, Object, Function) |
visibility * | processedPropType<Visibility | boolean>(Number, Boolean) |
style | processedPropType<StyleValue>(String, Object, Array) |
classes | processedPropType<Record<string, boolean>>(Object) |
requirements * | Requirements |
canPurchase * | processedPropType<boolean>(Boolean) |
bought * | processedPropType<boolean>(Boolean) |
mark | processedPropType<boolean | string>(Boolean, String) |
id * | string |
purchase * | VoidFunction |