Skip to content

Guides

Every service hangs off the client, built when the client is: there is nothing to wire up. Each guide below covers one of them, or one of the parts that sit beside them.

client.alliance     client.castle      client.army       client.attack
client.commanders   client.equipment   client.spy        client.map
client.movements    client.messages    client.player     client.defense
client.ranking      client.events      client.rewards     client.quests
client.shop

Services

  • Alliance


    Chat, help requests, applications, ranks and the treasury.

  • Messages


    The mailbox, reading and sending mail, battle reports.

  • Castle


    Castles, resources, buildings, the construction queue and tax.

  • Defense


    Reading and setting a castle's keep, wall and moat.

  • Army


    Units, recruitment and the hospital.

  • Commanders


    Commanders and castellans, and renaming them.

  • Skills and generals


    Generals, their abilities, and the skill trees.

  • Equipment


    The equipment inventory, equipping and unequipping.

  • Attack


    Sending an attack with waves you build yourself, and attack presets.

  • Filling waves


    Waves filled from a target's coordinates, the way the game does it.

  • Spy


    Spy missions planned for risk, and their reports.

  • Map scanning


    Kingdom scans and cheap re-scans.

  • Events


    The running events and their scoreboards.

  • Daily rewards


    The login and startup bonuses, lost and found, the activity chest, the weekly honour reward and patch note rewards.

The smaller services have no guide of their own; their API pages list every call:

  • client.player: get_player_info(player_id), get_player_details_bulk(player_ids) and search_player_by_name(name).
  • client.ranking: get_highscore(list_type, search_value) and the event leaderboards, get_ranking_list, get_own_ranking_page, get_ranking_window and search_leaderboard.
  • client.events: refresh(), get_active_events() with the events' in-game titles, league_id(event_id) for the leaderboards, get_scores(event) and get_own_points(event) for your own rank and points; the running events and their scoreboards have a guide.

Spending rubies

No call spends rubies unless you pass spend_rubies=True, the one name for that consent everywhere. Without it a call that would spend them raises ValueError (PremiumCommanderCostError for the premium commander) before anything is sent. Where the price can be known, from game data or state, only a call that costs rubies needs the flag; where it cannot, the call always does.

Rubies are spent on Calls Needs the flag
A ruby price of the item castle.build, upgrade_building, upgrade_defense, army.produce_units, heal_units, player.hold_feast when the game data prices it in rubies
Missing resources castle.build, upgrade_building, upgrade_defense, repair_building, upgrade_wishing_well, army.produce_units, player.hold_feast with the flag they are paid with rubies; without it never
Finishing at once castle.finish_construction over 240 seconds left, or a time left it cannot work out
castle.repair_all, castle.finish_research, finish_wishing_well, player.skip_sceat_skill_activation, army.skip_heal, double_production_slot, skip_production_slot, start_recruitment_loop always
Production slots army.unlock_production_slot always
Copying a queue army.copy_recruitment a target's doubling_ruby_cost above 0
army.heal_all a price above 0
Travel movements.send_resources, send_support, send_troops, attack.send_attack, the client.spy sends a horse that costs rubies (not paid with feathers), any slowdown, the premium commander when none is free
Boosters player.hire_booster, castle.bribe_tax_collector always
Your level and flag player.buy_level, player.buy_premium_flag always
The ruby wishing well's entry castle.start_wishing_well always
Time-limited campaigns events.buy_campaign_quest, buy_campaign_reward always
Event shops shop.buy_event_package a package priced in rubies; with the flag the costs you lack are paid with rubies
The rest castle.buy_expansion, rename, start_tax, castle.start_research, alliance.donate a premium expansion; a rename with no premium account; tax types 5 and 6; a ruby research; donated rubies

Pricing reads the game data, loaded on first use; the call raises GameDataNotLoadedError when it cannot be loaded. Minute skips are items, not rubies, and need no flag.

Ruby purchase confirmation

The game's confirmation setting applies above the player's chosen threshold. Passing spend_rubies=True also authorizes one confirmation if the server requests it. The SDK preserves the player's setting.

Low-level client.send(..., wait=True), client.request(...) and client.request_packet(...) accept the same keyword. Without consent, confirmation-required errors use normal error handling. Supplying ruby consent to a fire-and-forget send raises ValueError.

The SDK validates the challenge's command and echoed action fields, and requires a positive integer ruby amount. It does not impose a price limit. It then copies the server's payload into the confirmation. Both requests share a command lock and timeout budget. A repeated challenge, refusal, timeout or disconnect is not retried. After a timeout, inspect fresh state before trying again: the purchase may already have succeeded.

The echo check requires every original action field to return unchanged. A missing or reformatted field raises PacketError without confirming.

Game state and data

  • State and freshness


    What client.state holds, and how old it is.

  • Reacting to movements


    Callbacks for incoming attacks, arrivals, recalls and removals, and sending goods, support and troops.

  • Game data


    Units, buildings, researches, quests and more, as typed tables keyed by their ids.

  • Generated ids


    Game-data ids as enums, for autocomplete.

  • Game texts


    The game's own texts and error messages, in any language.

Beyond one client