Skip to content
On this page

Module: data/common

Interfaces

LayerTreeNodeOptions

LayerTreeNodeOptions: Object

An object that configures a LayerTreeNode

NameTypeDescription
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.
colorComputable<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.
layerIDstringThe 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) => voidA function that is called when the tree node is clicked.
onHold?VoidFunctionA function that is called when the tree node is held down.
reset?GenericResetA 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

NameTypeDescription
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.
conversionGenericConversionThe 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) => voidA function that is called when the clickable is clicked.
onHold?VoidFunctionA 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?booleanToggles a smaller design for the feature.
style?Computable<StyleValue>CSS to apply to this feature.
treeGenericTreeThe tree this reset button is apart of
treeNodeGenericTreeNodeThe 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. *

NameTypeDescription
base?Computable<DecimalSource>The base value being modified. *
baseText?Computable<CoercableComponent>The label to call the base amount. Defaults to "Base". *
modifierWithRequired<Modifier, "description">The modifier to be displaying in this section. *
smallerIsBetter?booleanDetermines 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. *
titleComputable<string>The header for this modifier. *
unit?stringThe 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

NameType
Textends 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

NameType
Textends 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
NameTypeDefault valueDescription
textToColorstringundefinedThe content to change the color of
colorstring"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
NameTypeDescription
achievementsRecord<string, GenericAchievement>A dictionary of the achievements to display, inserted in the order from easiest to hardest
Returns

Object

NameType
collapseAchievementsPersistent<boolean>
displayJSXFunction

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
NameTypeDescription
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
NameTypeDefault valueDescription
formulaGenericFormulaundefinedThe formula to display the result of.
showPreviewComputable<boolean>undefinedWhether or not to preview how the formula's result will change.
previewAmountComputable<DecimalSource>1The amount to add to the current formula's variable amount to preview the change in result.
Returns

JSXFunction

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
NameType
Textends LayerTreeNodeOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T>A function that returns the options object for this tree node.
Returns

LayerTreeNode<T>

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
NameType
Textends ClickableOptions & ResetButtonOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<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
NameTypeDescription
resourceResource<DecimalSource>The resource that will be increasing over time.
rateComputable<DecimalSource>The rate at which the resource is increasing.
targetComputable<DecimalSource>The target amount of the resource to estimate the duration until.
Returns

ComputedRef<string>

Defined in

profectus/src/data/common.tsx:428