Game Objects

Troops, spells, heroes, pets, equipment, and parsed army-link models.

Static Unit

struct clashy.StaticUnit

StaticUnit contains normalized static-data fields shared by troops, spells, heroes, pets, and hero equipment.

Name

string

Name is the unit or equipment display name.

Level

int

Level is the selected level for this static lookup.

MaxLevel

int

MaxLevel is the maximum level found in static data.

Village

string

Village identifies the village this object belongs to.

UpgradeCost

int

UpgradeCost is the cost for the selected level when static data includes it.

UpgradeTime

time.Duration

UpgradeTime is the upgrade duration for the selected level when static data includes it.

Troop

struct clashy.Troop

Troop is a player troop or static troop lookup result.

Name

string json: name

Name is the troop display name.

Level

int json: level

Level is the player's current level or the selected static level.

MaxLevel

int json: maxLevel

MaxLevel is the maximum level available for the player's Town Hall or in static data.

Village

string json: village

Village identifies home or Builder Base troops.

SuperTroopIsActive

bool json: superTroopIsActive

SuperTroopIsActive reports whether a super troop boost is active.

StaticUnit

StaticUnit

Spell

struct clashy.Spell

Spell is a player spell or static spell lookup result.

Name

string json: name

Name is the spell display name.

Level

int json: level

Level is the player's current level or the selected static level.

MaxLevel

int json: maxLevel

MaxLevel is the maximum level available for the player or in static data.

Village

string json: village

Village identifies the spell's village when static data provides one.

StaticUnit

StaticUnit

Hero

struct clashy.Hero

Hero is a player hero or static hero lookup result.

Name

string json: name

Name is the hero display name.

Level

int json: level

Level is the player's current level or the selected static level.

MaxLevel

int json: maxLevel

MaxLevel is the maximum level available for the player or in static data.

Village

string json: village

Village identifies the hero's village.

Equipment

[]Equipment json: equipment

Equipment contains equipment currently assigned to this hero when the API includes loadout data.

StaticUnit

StaticUnit

Pet

struct clashy.Pet

Pet is a hero pet from a player response or static lookup.

Name

string json: name

Name is the pet display name.

Level

int json: level

Level is the player's current level or the selected static level.

MaxLevel

int json: maxLevel

MaxLevel is the maximum level available for the player or in static data.

Village

string json: village

Village identifies the pet's village.

StaticUnit

StaticUnit

Equipment

struct clashy.Equipment

Equipment is hero equipment from a player response or static lookup.

Name

string json: name

Name is the equipment display name.

Level

int json: level

Level is the player's current level or the selected static level.

MaxLevel

int json: maxLevel

MaxLevel is the maximum level available for the player or in static data.

Village

string json: village

Village identifies the equipment's village.

Rarity

string json: rarity

Rarity is the equipment rarity when static data includes it.

StaticUnit

StaticUnit

Hero Loadout

struct clashy.HeroLoadout

HeroLoadout is one hero, pet, and equipment grouping parsed from an army link.

Hero

Hero

Hero is the hero selected in the army link.

Pet

*Pet

Pet is the assigned pet when the link includes one.

Equipment

[]Equipment

Equipment is the selected hero equipment in link order.

Army Recipe

struct clashy.ArmyRecipe

ArmyRecipe is the normalized representation of a Clash army link.

HeroesLoadout

[]HeroLoadout

HeroesLoadout contains heroes, pets, and equipment from the link.

Troops

[]TroopCount

Troops contains home-army troops from the link.

Spells

[]SpellCount

Spells contains home-army spells from the link.

ClanCastleTroops

[]TroopCount

ClanCastleTroops contains requested Clan Castle troops.

ClanCastleSpells

[]SpellCount

ClanCastleSpells contains requested Clan Castle spells.

Troop Count

struct clashy.TroopCount

TroopCount pairs a troop with a quantity from an army link.

Troop

Troop

Troop is the parsed troop.

Quantity

int

Quantity is the requested troop count.

Spell Count

struct clashy.SpellCount

SpellCount pairs a spell with a quantity from an army link.

Spell

Spell

Spell is the parsed spell.

Quantity

int

Quantity is the requested spell count.

Account Data

struct clashy.AccountData

AccountData is a thin wrapper around arbitrary account-link data.

Raw

map[string]any

Raw contains the original account-link payload.

Troop Methods

clashy.Troop.IsBuilderBase() -> bool

IsBuilderBase reports whether the troop belongs to Builder Base.

Return type:
bool

clashy.Troop.IsHomeBase() -> bool

IsHomeBase reports whether the troop belongs to the home village.

Return type:
bool

clashy.Troop.IsSuperTroop() -> bool

IsSuperTroop reports whether the troop name is one of the known super troops.

Return type:
bool

clashy.Troop.Static(c: *Client) -> *Troop

Static returns the embedded static-data record matching this troop's name, village, and level.

Parameters:

c (*Client)

Return type:
*Troop

Spell Methods

clashy.Spell.Static(c: *Client) -> *Spell

Static returns the embedded static-data record matching this spell's name and level.

Parameters:

c (*Client)

Return type:
*Spell

Hero Methods

clashy.Hero.Static(c: *Client) -> *Hero

Static returns the embedded static-data record matching this hero's name and level.

Parameters:

c (*Client)

Return type:
*Hero

Pet Methods

clashy.Pet.Static(c: *Client) -> *Pet

Static returns the embedded static-data record matching this pet's name and level.

Parameters:

c (*Client)

Return type:
*Pet

Equipment Methods

clashy.Equipment.Static(c: *Client) -> *Equipment

Static returns the embedded static-data record matching this equipment's name and level.

Parameters:

c (*Client)

Return type:
*Equipment

Functions

clashy.ParseArmyRecipe(static: *StaticData, link: string) -> ArmyRecipe

ParseArmyRecipe parses a full Clash army link or raw army payload into a structured recipe using embedded static data for names and villages.

Parameters:

static (*StaticData)

link (string)

Return type:
ArmyRecipe

clashy.ParseAccountData(data: map[string]any) -> AccountData

ParseAccountData wraps account-link data without mutating it.

Parameters:

data (map[string]any)

Return type:
AccountData