Slay the Spire 2 run parsing#

Parsing of Slay the Spire 2 run history and savefile.

class Player(data: dict, parser: FileParser)[source]#

Bases: object

Hold game information for one player.

property character: str#

Which character we’re playing.

property id: int#
property relics: list[RelicData]#

The relics at run end/current node.

property deck#

The deck at run end/current node.

property badges#
class FileParser(data: dict)[source]#

Bases: object

Hold a single run (ongoing or not) data.

game_version: int = 2#

Which version of the game we care about.

done: bool = False#

Whether the run is over.

has_activemods = False#

Whether we know which mods are enabled.

set_index(index: int | None)[source]#

Force a specific player index to be considered.

get_main_player()[source]#

Return the player we care about, AKA the streamer.

get_player_index()[source]#

Return the main player index.

This is such that FP.players[FP.get_player_index()] == FP.get_main_player().

get_char_portrait()[source]#
property won: bool#

Whether or not we won the run.

property seed: str#
property is_seeded: bool#
property character#
property deck#
property relics#
property relics_bare: list[Relic]#
property badges#
property ascension_level: int#

Which Ascension level the run was played at.

property players#

Read-only list of all players in this game (host first).

property current_hp_counts#
property max_hp_counts#
property gold_counts#
property removals: Generator[ItemFloor, None, None]#

Every (name, floor) tuple of removed card and their floor.

get_removals() Generator[CardData, None, None][source]#

Yield each removed card with no repetition, with count.

property has_removals#
get_cards() Generator[CardData, None, None][source]#

Yield each card with no repetition, with count.

property cards: Generator[str, None, None]#

All the cards in the deck, with upgrade.

master_deck_as_html()[source]#

Return the cards from the deck suitable for the website.

removals_as_html()[source]#

Return the removed cards suitable for the website.

property path: list[PathNode]#

The path taken through the Spire.

property epoch: int#

Time in seconds since Jan 1, 1970.

property timestamp: datetime#

Time when the run finished, as UTC.

property timedelta: timedelta#

Difference between now and the run.

property modded#
property modifiers#
class Badge(data: dict[str, str])[source]#

Bases: object

Run badges.

property name#
property rarity#
as_html()[source]#
class RelicData(data: dict[str, str], parser: FileParser)[source]#

Bases: object

View relics and their information.

property name#
property mod: str#
property image: str#
description()[source]#
escaped_description() str[source]#

Escape the description for HTML display.

class CardData(card: str | SingleCard, cards_list: list[str])[source]#

Bases: object

as_cards()[source]#
property color: str#
property type: str#
property type_safe: str#
property rarity: str#
property rarity_safe: str | None#
property count: int#
property name: str#
property display_name: str#
class PathNode(parser: FileParser, data: dict, floor: int, act_name: str = None)[source]#

Bases: object

property end_of_act: bool#
property all_potions_received: list[Potion]#

All potions which were received on this floor.

property all_potions_dropped: list[Potion]#

All potions which were used or discarded this floor.

ancient_desc()[source]#

Ancient-specific description.

description()[source]#
get_description()[source]#
escaped_description() str[source]#
get_rest_action(action: str) str[source]#
property map_icon#

The current page/run history map icon.