Module: data/common
Interfaces
LayerTreeNodeOptions
• LayerTreeNodeOptions: Object
An object that configures a LayerTreeNode
Name | Type | Description |
---|---|---|
append? | Computable <boolean > | Whether or not to append the layer to the tabs list. If set to false, then the tree node will instead always remove all tabs to its right and then add the layer tab. Defaults to true. |
canClick? | Computable <boolean > | Whether or not this tree node can be clicked. |
classes? | Computable <Record <string , boolean >> | Dictionary of CSS classes to apply to this feature. |
color | Computable <string > | The color to display this tree node as |
display? | Computable <CoercableComponent > | The label to display on this tree node. |
glowColor? | Computable <string > | The color of the glow effect shown to notify the user there's something to do with this node. |
layerID | string | The ID of the layer this tree node is associated with |
mark? | Computable <string | boolean > | Shows a marker on the corner of the feature. |
onClick? | (e? : MouseEvent | TouchEvent ) => void | A function that is called when the tree node is clicked. |
onHold? | VoidFunction | A function that is called when the tree node is held down. |
reset? | GenericReset | A reset object attached to this node, used for propagating resets through the tree. |
style? | Computable <StyleValue > | CSS to apply to this feature. |
visibility? | Computable <boolean | Visibility > | Whether this tree node should be visible. |
Defined in
profectus/src/data/common.tsx:175
ResetButtonOptions
• ResetButtonOptions: Object
An object that configures a ResetButton
Name | Type | Description |
---|---|---|
canClick? | Computable <boolean > | Whether or not this button can currently be clicked. Defaults to checking the current gain amount is greater than minimumGain |
classes? | Computable <Record <string , boolean >> | Dictionary of CSS classes to apply to this feature. |
conversion | GenericConversion | The conversion the button uses to calculate how much resources will be gained on click |
display? | Computable <CoercableComponent > | The content to display on the button. By default, this includes the reset description, and amount of currency to be gained. |
mark? | Computable <string | boolean > | Shows a marker on the corner of the feature. |
minimumGain? | Computable <DecimalSource > | When canClick is left to its default, minimumGain is used to only enable the reset button when a sufficient amount of currency to gain is available. |
onClick? | (e? : MouseEvent | TouchEvent ) => void | A function that is called when the clickable is clicked. |
onHold? | VoidFunction | A function that is called when the clickable is held down. |
resetDescription? | Computable <string > | Text to display on low conversion amounts, describing what "resetting" is in this context. Defaults to "Reset for ". |
resetTime? | Persistent <DecimalSource > | A persistent ref to track how much time has passed since the last time this tree node was reset. |
showNextAt? | Computable <boolean > | Whether or not to show how much currency would be required to make the gain amount increase. |
small? | boolean | Toggles a smaller design for the feature. |
style? | Computable <StyleValue > | CSS to apply to this feature. |
tree | GenericTree | The tree this reset button is apart of |
treeNode | GenericTreeNode | The specific tree node associated with this reset button |
visibility? | Computable <boolean | Visibility > | Whether this clickable should be visible. |
Defined in
profectus/src/data/common.tsx:33
Section
• Section: Object
An option object for a modifier display as a single section. *
Name | Type | Description |
---|---|---|
base? | Computable <DecimalSource > | The base value being modified. * |
baseText? | Computable <CoercableComponent > | The label to call the base amount. Defaults to "Base". * |
modifier | WithRequired <Modifier , "description" > | The modifier to be displaying in this section. * |
smallerIsBetter? | boolean | Determines if numbers larger or smaller than the base should be displayed as red. |
subtitle? | Computable <string > | A subtitle for this modifier, e.g. to explain the context for the modifier. * |
title | Computable <string > | The header for this modifier. * |
unit? | string | The unit of measurement for the base. * |
visible? | Computable <boolean > | Whether or not this section should be currently visible to the player. * |
Defined in
profectus/src/data/common.tsx:233
Type Aliases
GenericLayerTreeNode
Ƭ GenericLayerTreeNode: Replace
<LayerTreeNode
<LayerTreeNodeOptions
>, { append?
: ProcessedComputable
<boolean
> ; display
: ProcessedComputable
<CoercableComponent
> }>
A type that matches any valid LayerTreeNode object.
Defined in
profectus/src/data/common.tsx:195
GenericResetButton
Ƭ GenericResetButton: Replace
<GenericClickable
& ResetButton
<ResetButtonOptions
>, { canClick
: ProcessedComputable
<boolean
> ; display
: ProcessedComputable
<CoercableComponent
> ; minimumGain
: ProcessedComputable
<DecimalSource
> ; resetDescription
: ProcessedComputable
<string
> ; showNextAt
: ProcessedComputable
<boolean
> }>
A type that matches any valid ResetButton object.
Defined in
profectus/src/data/common.tsx:83
LayerTreeNode
Ƭ LayerTreeNode<T
>: Replace
<TreeNode
<T
>, { append
: GetComputableType
<T
["append"
]> ; display
: GetComputableTypeWithDefault
<T
["display"
], T
["layerID"
]> }>
A tree node that is associated with a given layer, and which opens the layer when clicked.
Type parameters
Name | Type |
---|---|
T | extends LayerTreeNodeOptions |
Defined in
profectus/src/data/common.tsx:187
ResetButton
Ƭ ResetButton<T
>: Replace
<Clickable
<T
>, { canClick
: GetComputableTypeWithDefault
<T
["canClick"
], Ref
<boolean
>> ; display
: GetComputableTypeWithDefault
<T
["display"
], Ref
<JSX.Element
>> ; minimumGain
: GetComputableTypeWithDefault
<T
["minimumGain"
], 1
> ; onClick
: (event?
: MouseEvent
| TouchEvent
) => void
; resetDescription
: GetComputableTypeWithDefault
<T
["resetDescription"
], Ref
<string
>> ; showNextAt
: GetComputableTypeWithDefault
<T
["showNextAt"
], true
> }>
A button that is used to control a conversion. It will show how much can be converted currently, and can show when that amount will go up, as well as handle only being clickable when a sufficient amount of currency can be gained. Assumes this button is associated with a specific node on a tree, and triggers that tree's reset propagation.
Type parameters
Name | Type |
---|---|
T | extends ResetButtonOptions |
Defined in
profectus/src/data/common.tsx:70
Functions
colorText
▸ colorText(textToColor
, color?
): JSX.Element
Creates an HTML string for a span that writes some given text in a given color.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
textToColor | string | undefined | The content to change the color of |
color | string | "var(--accent2)" | The color to change the content to look like. Defaults to the current theme's accent 2 variable. |
Returns
JSX.Element
Defined in
profectus/src/data/common.tsx:376
createCollapsibleAchievements
▸ createCollapsibleAchievements(achievements
): Object
Creates a collapsible display of a list of achievements
Parameters
Name | Type | Description |
---|---|---|
achievements | Record <string , GenericAchievement > | A dictionary of the achievements to display, inserted in the order from easiest to hardest |
Returns
Object
Name | Type |
---|---|
collapseAchievements | Persistent <boolean > |
display | JSXFunction |
Defined in
profectus/src/data/common.tsx:384
createCollapsibleModifierSections
▸ createCollapsibleModifierSections(sectionsFunc
): [JSXFunction
, Persistent
<Record
<number
, boolean
>>]
Takes an array of modifier "sections", and creates a JSXFunction that can render all those sections, and allow each section to be collapsed. Also returns a list of persistent refs that are used to control which sections are currently collapsed.
Parameters
Name | Type | Description |
---|---|---|
sectionsFunc | () => Section [] | A function that returns the sections to display. |
Returns
[JSXFunction
, Persistent
<Record
<number
, boolean
>>]
Defined in
profectus/src/data/common.tsx:257
createFormulaPreview
▸ createFormulaPreview(formula
, showPreview
, previewAmount?
): JSXFunction
Utility function for displaying the result of a formula such that it will, when told to, preview how the formula's result will change. Requires a formula with a single variable inside.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
formula | GenericFormula | undefined | The formula to display the result of. |
showPreview | Computable <boolean > | undefined | Whether or not to preview how the formula's result will change. |
previewAmount | Computable <DecimalSource > | 1 | The amount to add to the current formula's variable amount to preview the change in result. |
Returns
Defined in
profectus/src/data/common.tsx:454
createLayerTreeNode
▸ createLayerTreeNode<T
>(optionsFunc
): LayerTreeNode
<T
>
Lazily creates a tree node that's associated with a specific layer, with the given options.
Type parameters
Name | Type |
---|---|
T | extends LayerTreeNodeOptions |
Parameters
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T > | A function that returns the options object for this tree node. |
Returns
Defined in
profectus/src/data/common.tsx:207
createResetButton
▸ createResetButton<T
>(optionsFunc
): ResetButton
<T
>
Lazily creates a reset button with the given options.
Type parameters
Name | Type |
---|---|
T | extends ClickableOptions & ResetButtonOptions |
Parameters
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T > | A function that returns the options object for this reset button. |
Returns
ResetButton
<T
>
Defined in
profectus/src/data/common.tsx:98
estimateTime
▸ estimateTime(resource
, rate
, target
): ComputedRef
<string
>
Utility function for getting an ETA for when a target will be reached by a resource with a known (and assumed consistent) gain.
Parameters
Name | Type | Description |
---|---|---|
resource | Resource <DecimalSource > | The resource that will be increasing over time. |
rate | Computable <DecimalSource > | The rate at which the resource is increasing. |
target | Computable <DecimalSource > | The target amount of the resource to estimate the duration until. |
Returns
ComputedRef
<string
>