Skip to content

API Reference

calculate_upgrade_stat_values(upgrade_data, curve_data, level, ascended)

Calculates the stat values for a character or weapon at a specific level and ascension status.

Parameters:

Name Type Description Default
upgrade_data CharacterUpgrade | WeaponUpgrade

The upgrade data for the character or weapon.

required
curve_data dict[str, dict[str, dict[str, float]]]

The growth curve data.

required
level int

The target level.

required
ascended bool

Whether the character/weapon is ascended at the target level.

required

Returns:

Type Description
dict[str, float]

A dictionary mapping fight property IDs to their calculated values.

format_layout(text)

Extracts and replaces layout placeholders like {LAYOUT_MOBILE#Character Skill}.

Parameters:

Name Type Description Default
text str

The input string potentially containing layout placeholders.

required

Returns:

Type Description
str

The string with layout placeholders replaced by their content.

format_num(digits, calculation)

Formats a number to a specified number of decimal places.

Parameters:

Name Type Description Default
digits int

The number of decimal places.

required
calculation int | float

The number to format.

required

Returns:

Type Description
str

The formatted number as a string.

format_stat_values(stat_values)

Formats calculated stat values into strings, adding '%' for percentage stats.

Parameters:

Name Type Description Default
stat_values dict[str, float]

A dictionary mapping fight property IDs to their numerical values.

required

Returns:

Type Description
dict[str, str]

A dictionary mapping fight property IDs to their formatted string values.

get_params(text, param_list)

Replaces parameter placeholders in text with formatted values from a list.

Placeholders are in the format {param:}, e.g., {param1:F1P}. Formats include: F1P, F2P: Float multiplied by 100, formatted to 1 or 2 decimal places with '%'. F1, F2: Float formatted to 1 or 2 decimal places. P: Float multiplied by 100, formatted to 0 decimal places with '%'. I: Integer.

Parameters:

Name Type Description Default
text str

The input string containing parameter placeholders.

required
param_list list[int | float]

A list of numerical parameter values.

required

Returns:

Type Description
list[str]

A list of strings, typically split by '|', after parameter replacement and formatting.

get_skill_attributes(descriptions, params)

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:

Name Type Description Default
descriptions list[str]

A list of strings containing parameter placeholders, often separated by '|'.

required
params list[int | float]

A list of numerical parameter values for substitution.

required

Returns:

Type Description
str

A newline-separated string of "key: value" pairs for the skill attributes.

remove_html_tags(text)

Removes HTML tags, sprite presets, and link tags from a string.

Parameters:

Name Type Description Default
text str

The input string containing HTML tags.

required

Returns:

Type Description
str

The string with HTML tags, sprite presets, and link tags removed.

replace_fight_prop_with_name(stat_values, manual_weapon)

Replaces fight property IDs (e.g., FIGHT_PROP_HP) with their human-readable names.

Parameters:

Name Type Description Default
stat_values dict[str, Any]

A dictionary mapping fight property IDs to their values.

required
manual_weapon dict[str, str]

A dictionary mapping fight property IDs to their names.

required

Returns:

Type Description
dict[str, Any]

A dictionary mapping fight property names to their values.

replace_placeholders(string, params)

Replaces placeholders in a string with values from a dictionary.

Placeholders are in the format $[key].

Parameters:

Name Type Description Default
string str

The input string containing placeholders.

required
params dict[str, Any]

A dictionary mapping placeholder keys to their values.

required

Returns:

Type Description
str

The string with placeholders replaced and sprite presets removed.

replace_pronouns(text)

Replaces gendered pronouns in the format {F#She}/{M#He} with She/He.

Parameters:

Name Type Description Default
text str

The input string containing gendered pronouns.

required

Returns:

Type Description
str

The string with pronouns replaced.