Static Data Models

This section documents the static data models used for parsing game files and army links.

StaticData

class coc.StaticData

Represents static game data loaded from game files.

This class loads and organizes all static game data from the game’s data files. It provides access to all available game items at all levels, useful for looking up item information, max levels, and statistics.

buildings

List of all available buildings.

Type:

List[Building]

capital_house_parts

List of all available clan capital house parts.

Type:

List[ClanCapitalHousePart]

decorations

List of all available decorations.

Type:

List[Decoration]

equipment

List of all available equipment.

Type:

List[Equipment]

guardians

List of all available guardians.

Type:

List[Guardian]

helpers

List of all available helpers.

Type:

List[Helper]

heroes

List of all available heroes.

Type:

List[Hero]

obstacles

List of all available obstacles.

Type:

List[Obstacle]

pets

List of all available pets.

Type:

List[Pet]

sceneries

List of all available sceneries.

Type:

List[Scenery]

skins

List of all available skins.

Type:

List[Skin]

spells

List of all available spells.

Type:

List[Spell]

traps

List of all available traps.

Type:

List[Trap]

troops

List of all available troops & siege machines.

Type:

List[Troop]

AccountData

class coc.AccountData

Represents player account data parsed from game files.

Parses raw account data from game files and creates game objects representing the player’s village state, including buildings, troops, heroes, ongoing upgrades, and active boosts. This provides a complete snapshot of a player’s account.

townhall_level

The player’s current townhall level.

Type:

int

buildings

Player’s buildings as tuples of (building, quantity). Buildings can have multiple instances (e.g., multiple cannons).

Type:

List[Tuple[Building, int]]

capital_house_parts

Player’s unlocked clan capital house parts.

Type:

List[ClanCapitalHousePart]

decorations

Player’s decorations as tuples of (decoration, quantity).

Type:

List[Tuple[Decoration, int]]

equipment

Player’s equipment with their current levels.

Type:

List[Equipment]

guardians

Player’s guardians with their current levels.

Type:

List[Guardian]

helpers

Player’s helpers with their current levels.

Type:

List[Helper]

heroes

Player’s heroes with their current levels.

Type:

List[Hero]

obstacles

Player’s obstacles as tuples of (obstacle, quantity).

Type:

List[Tuple[Obstacle, int]]

pets

Player’s pets with their current levels.

Type:

List[Pet]

sceneries

Player’s unlocked base sceneries.

Type:

List[Scenery]

skins

Player’s unlocked hero skins.

Type:

List[Skin]

spells

Player’s unlocked spells with their current levels.

Type:

List[Spell]

traps

Player’s traps as tuples of (trap, quantity).

Type:

List[Tuple[Trap, int]]

troops

Player’s unlocked troops with their current levels.

Type:

List[Troop]

upgrades

Currently ongoing upgrades (buildings, troops, spells, heroes, etc.).

Type:

List[Upgrade]

boosts

Active boosts and cooldowns (builder boost, lab boost, clock tower, etc.).

Type:

Boosts

Upgrade

class coc.Upgrade

Represents an ongoing upgrade.

is_goblin

Whether this is a goblin builder upgrade.

Type:

bool

target

The target item being upgraded.

Type:

LeveledUnit

timer

The time remaining for the upgrade.

Type:

TimeDelta

helper_timer

The time remaining for the helper boost.

Type:

Optional[TimeDelta]

recurrent_helper

Whether the helper is recurrent.

Type:

bool

Boosts

class coc.Boosts

Represents active boosts and cooldowns.

builder_boost

The time remaining for the builder potion boost.

Type:

TimeDelta

lab_boost

The time remaining for the research potion boost.

Type:

TimeDelta

clocktower_boost

The time remaining for the clock tower boost.

Type:

TimeDelta

clocktower_cooldown

The cooldown time for the clock tower.

Type:

TimeDelta

builder_consumable

The time remaining for the builder bite snack.

Type:

TimeDelta

lab_consumable

The time remaining for the study soup snack.

Type:

TimeDelta

helper_cooldown

The global cooldown timer for helpers.

Type:

TimeDelta

ArmyRecipe

class coc.ArmyRecipe

Represents an army composition parsed from an army link.

The army link string.

Type:

str

heroes_loadout

The list of hero loadouts.

Type:

List[HeroLoadout]

troops

The list of troops with their quantities.

Type:

List[Tuple[Troop, int]]

spells

The list of spells with their quantities.

Type:

List[Tuple[Spell, int]]

clan_castle_troops

The list of clan castle troops with their quantities.

Type:

List[Tuple[Troop, int]]

clan_castle_spells

The list of clan castle spells with their quantities.

Type:

List[Tuple[Spell, int]]

_parse_items(match_str: str, base_id: int, item_class, target_list: list)

Helper to parse troops or spells from army link.

HeroLoadout

class coc.HeroLoadout

Represents a hero loadout from an army link.

hero

The hero in this loadout.

Type:

Hero

pet

The pet assigned to this hero.

Type:

Optional[Pet]

equipment

The list of equipment assigned to this hero.

Type:

List[Equipment]