API Reference
utils
Functions:
-
calculate_upgrade_stat_values–Calculates the stat values for a character or weapon at a specific level and ascension status.
-
format_layout–Extracts and replaces layout placeholders like {LAYOUT_MOBILE#Character Skill}.
-
format_num–Formats a number to a specified number of decimal places.
-
format_stat_values–Formats calculated stat values into strings, adding '%' for percentage stats.
-
get_params–Replaces parameter placeholders in text with formatted values from a list.
-
get_skill_attributes–Generates a formatted string of skill attributes from descriptions and parameters.
-
remove_html_tags–Removes HTML tags, sprite presets, and link tags from a string.
-
replace_fight_prop_with_name–Replaces fight property IDs (e.g., FIGHT_PROP_HP) with their human-readable names.
-
replace_placeholders–Replaces placeholders in a string with values from a dictionary.
-
replace_pronouns–Replaces gendered pronouns in the format {F#She}/{M#He} with She/He.
calculate_upgrade_stat_values
calculate_upgrade_stat_values(upgrade_data: CharacterUpgrade | WeaponUpgrade, curve_data: dict[str, dict[str, dict[str, float]]], level: int, ascended: bool) -> dict[str, float]
Calculates the stat values for a character or weapon at a specific level and ascension status.
Parameters:
-
(upgrade_dataCharacterUpgrade | WeaponUpgrade) –The upgrade data for the character or weapon.
-
(curve_datadict[str, dict[str, dict[str, float]]]) –The growth curve data.
-
(levelint) –The target level.
-
(ascendedbool) –Whether the character/weapon is ascended at the target level.
Returns:
format_layout
format_num
format_stat_values
get_params
Replaces parameter placeholders in text with formatted values from a list.
Placeholders are in the format {param
Parameters:
-
(textstr) –The input string containing parameter placeholders.
-
(param_listlist[int | float]) –A list of numerical parameter values.
Returns:
get_skill_attributes
Generates a formatted string of skill attributes from descriptions and parameters.
Each description is processed by get_params and expected to return a key-value pair
separated by '|'.
Parameters:
-
(descriptionslist[str]) –A list of strings containing parameter placeholders, often separated by '|'.
-
(paramslist[int | float]) –A list of numerical parameter values for substitution.
Returns:
-
str–A newline-separated string of "key: value" pairs for the skill attributes.
remove_html_tags
replace_fight_prop_with_name
replace_fight_prop_with_name(stat_values: dict[str, Any], manual_weapon: dict[str, str]) -> dict[str, Any]
replace_placeholders
Replaces placeholders in a string with values from a dictionary.
Placeholders are in the format $[key].
Parameters:
-
(stringstr) –The input string containing placeholders.
-
(paramsdict[str, Any]) –A dictionary mapping placeholder keys to their values.
Returns:
-
str–The string with placeholders replaced and sprite presets removed.