Skip to content

Army

Units, production and the hospital behind client.army.

army.service

Units, recruitment and the hospital of your castles.

Every command here acts on the castle the session has joined, so each method joins the castle first (jca), as the client is inside a castle before it shows the recruit or hospital dialog.

Actions raise CommandError when the server refuses them; a refused join raises before anything is sent.

Classes:

Name Description
ArmyService

Units, recruitment and the hospital of one of your castles.

ArmyService

ArmyService(client: 'EmpireClient')

Bases: BaseService

Units, recruitment and the hospital of one of your castles.

Reached as client.army.

Each method joins the castle it is given first (jca), as the client acts on the castle it is in. It joins in that castle's Castle.kingdom_id from client.state.get_castles(), and raises UnknownCastleError for a castle not listed there.

Usage
client = EmpireClient(...)

# Get units
units = client.army.get_units(castle_id=123)

# Produce 50 of wod id 620 in the soldier list
client.army.produce_units(123, ProductionListId.SOLDIERS, wod_id=Unit.SWORDMAN, amount=50)

Methods:

Name Description
get_units

Get the available unit inventory for a castle.

get_units_response

Get every unit inventory a castle reports.

dismiss_units

Dismiss units of the castle, or of its stronghold.

get_camp_unit_capacity

How many more soldiers a camp of the Berimond kingdom takes.

store_in_stronghold

Store soldiers of the castle in its stronghold, where they are hidden from attacks.

take_from_stronghold

Take soldiers of the castle out of its stronghold.

produce_units

Produce units or tools.

get_production_list

Get one production list of a castle: the slot producing now and the queue,

cancel_production

Cancel a production slot.

double_production_slot

Double the units of a production slot, for rubies; see "Spending rubies" in the guides.

skip_production_slot

Finish a production slot now, for rubies; see "Spending rubies" in the guides.

unlock_production_slot

Unlock another production slot of a list, for rubies; see "Spending rubies" in the guides.

move_production_slot

Move a queued slot to another position of its list.

set_recruitment_mode

Set the order a list works through its queue, ProductionList.recruitment_mode.

start_recruitment_loop

Repeat a list's queue loops times, for rubies; see "Spending rubies" in the guides.

get_recruitment_copy_targets

Your castles a list's queue can be copied to, with what each copy costs.

copy_recruitment

Copy a list's queue to other castles, for their RecruitmentCopyTarget costs.

heal_units

Queue wounded units for healing.

heal_all

Heal every wounded unit at once, for rubies; see "Spending rubies" in the guides.

cancel_heal

Cancel a hospital slot, by its HospitalSlot.position.

skip_heal

Finish a hospital slot now, by its HospitalSlot.position, for rubies; see "Spending

dismiss_wounded

Dismiss wounded units of one type instead of healing them.

dismiss_wounded_units

Dismiss wounded units of several types at once, as {unit: amount}.

get_hospital_flags

Get the hospital flags of a castle: whether it admits wounded ruby units.

set_hospital_flags

Set whether a castle's hospital admits wounded ruby units.

get_units

get_units(castle_id: int, *, timeout: float = 5.0) -> dict[UnitOrTool, int]

Get the available unit inventory for a castle.

Covers soldiers and tools. Units in production, in the stronghold or in the hospital are reported separately - use get_units_response() for those.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
dict[UnitOrTool, int]

The castle's units and tools, {Unit or Tool: amount}

get_units_response

get_units_response(castle_id: int, *, timeout: float = 5.0) -> GetUnitsResponse

Get every unit inventory a castle reports.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
GetUnitsResponse

The full gui response: available, in production, stronghold, hospital

Raises:

Type Description
CommandError

The server refused to join the castle, so gui would have answered for another one

dismiss_units

dismiss_units(castle_id: int, wod_id: Unit | Tool, amount: int, from_stronghold: bool = False, *, timeout: float = 5.0) -> None

Dismiss units of the castle, or of its stronghold.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: CastleRecruitDismissUnitsDialog.dismissUnits (bundle line 84330)

get_camp_unit_capacity

get_camp_unit_capacity(camp_id: int, *, timeout: float = 5.0) -> int

How many more soldiers a camp of the Berimond kingdom takes.

Your own main Berimond camp or a camp you send support to; no castle is joined first.

Parameters:

Name Type Description Default
camp_id int

The camp's area id

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
int

The soldiers the camp still takes, never below 0

Client: CastleTransferTroopsToKingdomProperties.additionalDataUpdateCommands (bundle line 37467) and CastleTroopSupportDialog.onSupportDefenceInfos (bundle line 129177) ask only for Berimond kingdom camps; the reply goes through FUCCommand (bundle line 127902)

store_in_stronghold

store_in_stronghold(castle_id: int, unit: Unit, amount: int, *, timeout: float = 5.0) -> UnitInventory

Store soldiers of the castle in its stronghold, where they are hidden from attacks.

The client offers at most the stronghold's free space or the soldiers at home, whichever is less, and nothing once the stronghold is full; the server refuses more.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
unit Unit

The soldier to store

required
amount int

How many to store

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
UnitInventory

The castle's unit inventories after the move

Client: CastleInventoryStrongholdListItemComponent.onClickUnit (bundle line 84422), capped by CastleMilitaryData.currentHiddenSoldierSpace and isStrongholdFull (bundle lines 138864-138866); the reply goes to parse_GUI (STSCommand, bundle line 125692)

take_from_stronghold

take_from_stronghold(castle_id: int, unit: Unit, amount: int, *, timeout: float = 5.0) -> UnitInventory

Take soldiers of the castle out of its stronghold.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
unit Unit

The soldier to take out

required
amount int

How many to take out

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
UnitInventory

The castle's unit inventories after the move

Client: StrongholdInventoryListItemComponent.takeSoldiers (bundle line 84462); the reply goes to parse_GUI (TASCommand, bundle line 125707)

produce_units

produce_units(castle_id: int, list_id: ProductionListId, wod_id: Unit | Tool, amount: int, *, spend_rubies: bool = False, private_offer_id: int = -1, timeout: float = 5.0) -> None

Produce units or tools.

Spends rubies when the unit or tool has a ruby price (cost_rubies or, on a temporary server, outer_realms_cost_rubies in the game data, refused on either kind of server), and with spend_rubies on missing resources; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

SOLDIERS, TOOLS or AUXILIARIES

required
wod_id Unit | Tool

The unit or tool

required
amount int

How many to produce

required
spend_rubies bool

Allow a ruby price, and pay rubies for missing resources as the client's resource wait dialog does

False
private_offer_id int

With spend_rubies, the id of the active resource merchant private offer; -1 when there is none

-1
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

The list is the hospital, or the unit has a ruby price or is not in the game data, and spend_rubies is False

GameDataNotLoadedError

spend_rubies is False and the game data cannot be loaded

Client: C2SBuyUnitPackageVO (bundle line 35277); BasicUnitVO.basicCostC2 (bundle line 19248); the ruby path is CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35218)

get_production_list

get_production_list(castle_id: int, list_id: ProductionListId, *, timeout: float = 5.0) -> ProductionList

Get one production list of a castle: the slot producing now and the queue, or the hospital slots for ProductionListId.HOSPITAL.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: C2SShowPackageListVO (bundle line 22860)

cancel_production

cancel_production(castle_id: int, list_id: ProductionListId, slot_type: SlotType, position: int, *, timeout: float = 5.0) -> None

Cancel a production slot.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
slot_type SlotType

PRODUCTION for the slot producing now, QUEUE for a queued one

required
position int

0 for the slot producing now, else the slot's ProductionSlot.position

required

Client: CastleRecruitDialogUnits.onCancelCurrentSlotConfirmed (bundle line 23655)

double_production_slot

double_production_slot(castle_id: int, list_id: ProductionListId, slot_type: SlotType, position: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Double the units of a production slot, for rubies; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
slot_type SlotType

PRODUCTION for the slot producing now, QUEUE for a queued one

required
position int

0 for the slot producing now, else the slot's ProductionSlot.position

required
spend_rubies bool

Allow the rubies it costs; without it nothing is sent

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

spend_rubies is False

Client: RecruitmentHelper.boostCurrentSlot (bundle line 23165), after CastleRecruitDialogUnits.handleBoostSlot (bundle line 23692) prices it with getUnitDoublingCosts (bundle line 23546), always in rubies

skip_production_slot

skip_production_slot(castle_id: int, list_id: ProductionListId, position: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> ProductionList | None

Finish a production slot now, for rubies; see "Spending rubies" in the guides.

The live client never sends this: its skip button is for an A/B test group it reports no account in, so the server may refuse it.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

SOLDIERS, TOOLS or AUXILIARIES

required
position int

0 for the slot producing now, else the slot's ProductionSlot.position

required
spend_rubies bool

Allow the rubies it costs; without it nothing is sent

False
timeout float

Timeout in seconds

5.0

Returns:

Type Description
ProductionList | None

The list after the skip, or None when the reply carries none

Raises:

Type Description
ValueError

spend_rubies is False, or the list is the hospital (see skip_heal)

Client: RecruitmentHelper.skipSlot (bundle line 23176) from CastleRecruitDialogUnits.boostCurrentSlot (bundle line 23661) when _useSkipButton, priced in rubies by updateSkipTooltip (bundle line 23557); _useSkipButton needs ClientConstABTests.takesPartInSkipRecruitingTest (bundle line 18700)

unlock_production_slot

unlock_production_slot(list_id: ProductionListId, *, spend_rubies: bool = False, timeout: float = 5.0) -> UnlockProductionSlotResponse

Unlock another production slot of a list, for rubies; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
list_id ProductionListId

The list to unlock a slot of

required
spend_rubies bool

Allow the rubies it costs, UNLOCK_SLOT_RUBIES before discounts; without it nothing is sent

False
timeout float

Timeout in seconds

5.0

Returns:

Type Description
UnlockProductionSlotResponse

The joined castle's list and your coins and rubies after; the slots reach client.player.boosts

Raises:

Type Description
ValueError

spend_rubies is False

CommandError

The server refused

Client: UnitBuildListComponent.buySlot (bundle line 261026) after the price dialog with getFinalCostsC2(UnitProductionConst.UNLOCK_C2); UPSCommand.executeCommand (bundle line 637946)

move_production_slot

move_production_slot(castle_id: int, list_id: ProductionListId, old_position: int, new_position: int, *, timeout: float = 5.0) -> ProductionList

Move a queued slot to another position of its list.

Positions are the queue's: a ProductionSlot.position, or a HospitalSlot.position for ProductionListId.HOSPITAL, whose slots the client lets you drag too. The slot producing now (ProductionList.current) is not in the queue and does not move. The client drags only a slot that is neither free nor locked, and never onto a locked one.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

The list the slot is in

required
old_position int

The slot's position now

required
new_position int

The position it moves to

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
ProductionList

The list after the move

Client: UnitBuildListComponent.requestMoveFromServer (bundle line 50938) sends the dragged slot's position before and after the drop, both indexes into QS (parseMilitaryList) or PIDL (parseList, bundle lines 138899, 138907); initBuildListItem and switchItemPos (bundle lines 16876, 16923) decide what drags; the reply goes to parse_SPL (MUPCommand, bundle line 125631)

set_recruitment_mode

set_recruitment_mode(castle_id: int, list_id: ProductionListId, mode: RecruitmentMode, *, timeout: float = 5.0) -> None

Set the order a list works through its queue, ProductionList.recruitment_mode.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

SOLDIERS, TOOLS or AUXILIARIES

required
mode RecruitmentMode

The mode to set

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

The list is the hospital, which has no recruitment mode

Client: CastleRecruitDialogUnits.onClick (bundle line 23686) switches the mode and sends C2SSetRecruitmentModeVO; the server answers srm (SRMCommand, registered at bundle line 120368), which the client does not read (bundle line 126787). parse_SPL reads RM only for the soldier, tool and auxiliary lists (bundle line 138830)

start_recruitment_loop

start_recruitment_loop(castle_id: int, list_id: ProductionListId, loops: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Repeat a list's queue loops times, for rubies; see "Spending rubies" in the guides.

Reads the list first (spl) and sends its queued slots, as the client sends the queue it shows. The client opens this only from an lri it never asks for, so the server may refuse it.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

SOLDIERS, TOOLS or AUXILIARIES

required
loops int

How many times to repeat the queue, at least 1

required
spend_rubies bool

Allow the loop fee, which is always in rubies; without it nothing is sent

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

spend_rubies is False, the list is the hospital, or loops is below 1

ProductionSlotsNeededError

The list needs more unlocked slots first

Client: AAutoRecruitmentPurchaseDialog.sendConfirmToServer (bundle line 60527) with the loops picked from 1 up (updateLoopSelector) and the queue from AutoRecruitmentHelper.createAutoRecruitSnapshot (bundle line 36599); the fee is AutoRecruitmentPriceData.getCosts, in rubies (bundle line 142396)

get_recruitment_copy_targets

get_recruitment_copy_targets(castle_id: int, list_id: ProductionListId, *, timeout: float = 5.0) -> list[RecruitmentCopyTarget]

Your castles a list's queue can be copied to, with what each copy costs.

Parameters:

Name Type Description Default
castle_id int

The castle whose queue would be copied, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

SOLDIERS, TOOLS or AUXILIARIES

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
list[RecruitmentCopyTarget]

One entry per castle; RecruitmentCopyTarget.can_copy is False where the copy is refused

Client: AAutoRecruitmentCopyDialog.requestDRI (bundle line 51219), opened from the recruit dialog's copy button (CastleRecruitDialogUnits.onCopyProduction, bundle line 23709)

copy_recruitment

copy_recruitment(castle_id: int, list_id: ProductionListId, targets: Sequence[RecruitmentCopyTarget], *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Copy a list's queue to other castles, for their RecruitmentCopyTarget costs.

Each copy costs the target's resources and its doubling_ruby_cost in rubies; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
castle_id int

The castle whose queue is copied, a Castle.id from client.state.get_castles()

required
list_id ProductionListId

The list targets came for

required
targets Sequence[RecruitmentCopyTarget]

Entries from get_recruitment_copy_targets

required
spend_rubies bool

Allow targets whose doubling_ruby_cost is above 0

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

No targets, a target the client would not let you pick, or rubies due without spend_rubies

ProductionSlotsNeededError

The list needs more unlocked slots first

CommandError

NOT_ENOUGH_RESOURCES and other refusals

Client: AAutoRecruitmentCopyDialog.onOkButton (bundle line 51255), enabled once a castle is picked (updateOkButton); a castle with an EID cannot be picked (AAutoRecruitmentCopyListItemVE.updateGreyOut, bundle line 36574); costs summed by AutoRecruitmentCopyCostSublayer.getCurrentCosts (bundle line 83947)

heal_units

heal_units(castle_id: int, wod_id: Unit, amount: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Queue wounded units for healing.

A unit whose UnitStats.healing_cost_rubies is above 0 heals for rubies; see "Spending rubies" in the guides. A subscription that waives it is not checked.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
wod_id Unit

The wounded unit

required
amount int

How many to heal

required
spend_rubies bool

Allow healing a unit that costs rubies

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

The unit heals for rubies, or is not in the game data, and spend_rubies is False

GameDataNotLoadedError

spend_rubies is False and the game data cannot be loaded

Client: CastleRecruitSelectedUnitComponent.onReviveClick (bundle line 51105), priced at healingCostC2 per unit (bundle line 51110)

heal_all

heal_all(castle_id: int, ruby_cost: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Heal every wounded unit at once, for rubies; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
ruby_cost int

The price the client would show (see HealAllRequest); the server refuses a price that no longer matches the hospital

required
spend_rubies bool

Allow a ruby_cost above 0

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

ruby_cost is above 0 and spend_rubies is False

Client: CastleHospitalReviveAllDialog.reviveAll (bundle line 83667), with the price from CastleRecruitDialogHospital.openReviveAllDialog (bundle lines 83509-83513)

cancel_heal

cancel_heal(castle_id: int, position: int, *, timeout: float = 5.0) -> None

Cancel a hospital slot, by its HospitalSlot.position.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: CastleRecruitDialogHospital.onCurrentSlotCancelled (bundle line 83508)

skip_heal

skip_heal(castle_id: int, position: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Finish a hospital slot now, by its HospitalSlot.position, for rubies; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
position int

The slot's HospitalSlot.position

required
spend_rubies bool

Allow the rubies it costs; without it nothing is sent

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

spend_rubies is False

Client: CastleRecruitDialogHospital.skipCurrentSlot (bundle line 83504), priced in rubies by updateSkipTooltip (bundle line 83582)

dismiss_wounded

dismiss_wounded(castle_id: int, wod_id: Unit, amount: int, *, timeout: float = 5.0) -> None

Dismiss wounded units of one type instead of healing them.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: CastleHospitalDismissUnitsDialog.dismissUnits (bundle line 83737)

dismiss_wounded_units

dismiss_wounded_units(castle_id: int, units: Mapping[Unit, int], *, timeout: float = 5.0) -> None

Dismiss wounded units of several types at once, as {unit: amount}.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: CastleRecruitDialogHospital.onConfirmDeleteAll (bundle line 83498)

get_hospital_flags

get_hospital_flags(castle_id: int, *, timeout: float = 5.0) -> HospitalFlags

Get the hospital flags of a castle: whether it admits wounded ruby units.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required

Client: CastleRecruitDialogHospital.show (bundle line 83456) sends C2SHospitalFlagsVO with HRF -1

set_hospital_flags

set_hospital_flags(castle_id: int, *, admit_ruby_units: bool, timeout: float = 5.0) -> HospitalFlags

Set whether a castle's hospital admits wounded ruby units.

Parameters:

Name Type Description Default
castle_id int

One of your castles, a Castle.id from client.state.get_castles()

required
admit_ruby_units bool

Admit wounded ruby units, the hospital dialog's checkbox

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
HospitalFlags

The flags after the change

Client: CastleRecruitDialogHospital.toggleRubyBlock (bundle line 83605)

army.spy_army

Positional army data from a spy report.

The report's S block is consumed positionally by the game client (CastleSpyArmyInfoVO.parseArmyInfo), which shifts one entry per position in this order:

left, middle, right, keep, stronghold, support, reserve (optional)

Each entry is a list of [wod_id, amount] pairs. Summing the whole block flattens the three wall flanks together with keep, stronghold, support and reserve troops — a number the game never shows and which says nothing about where a castle is actually strong.

Classes:

Name Description
SpyArmy

A spied castle's defenders, by the position they hold.

Attributes:

Name Type Description
SpyStacks

One position of a spied army: its stacks in the order sent, an id sent twice kept twice.

SpyArmyBlock

A reply's S block as a SpyArmy, None when it is missing or empty (no spy report).

SpyStacks module-attribute

SpyStacks = Annotated[tuple[WodAmount, ...], BeforeValidator(_stacks)]

One position of a spied army: its stacks in the order sent, an id sent twice kept twice.

SpyArmyBlock module-attribute

SpyArmyBlock = Annotated[SpyArmy | None, BeforeValidator(_spied)]

A reply's S block as a SpyArmy, None when it is missing or empty (no spy report).

SpyArmy pydantic-model

Bases: EmpireModel

A spied castle's defenders, by the position they hold.

Reads a report's S block: SpyArmy.model_validate(report_s). A block shorter than the full seven positions is normal (the server omits trailing ones), so a missing position is empty.

Client: CastleSpyArmyInfoVO.parseArmyInfo (bundle line 30699)

Fields:

Validators:

  • _by_position

model_config class-attribute

model_config: ConfigDict = ConfigDict(frozen=True)

left pydantic-field

left: SpyStacks = ()

Defenders on the left wall flank

middle pydantic-field

middle: SpyStacks = ()

Defenders on the middle wall flank

right pydantic-field

right: SpyStacks = ()

Defenders on the right wall flank

keep pydantic-field

keep: SpyStacks = ()

Defenders in the keep (courtyard)

stronghold pydantic-field

stronghold: SpyStacks = ()

Units in the stronghold

support pydantic-field

support: SpyStacks = ()

Alliance support, which holds every flank

reserve pydantic-field

reserve: SpyStacks = ()

The reserve, when the report lists one

from_robber_baron_camp classmethod

from_robber_baron_camp(row: DungeonDefence) -> SpyArmy

A robber baron camp's defenders from its row in the items payload, each flank's units then its tools.

A tool stack the row lists twice stays two stacks, as a spy report keeps them.

section

section(section: SpyArmySection) -> tuple[WodAmount, ...]

The stacks at one position.

sections

sections() -> list[tuple[SpyArmySection, tuple[WodAmount, ...]]]

Every position in wire order, for display.

courtyard

courtyard() -> tuple[WodAmount, ...]

The courtyard as the spy dialog lists it: the keep's stacks, then the support's.

An id in both is listed twice, not added up. The dialog shows them sorted, which takes the game data: sorted(army.courtyard(), key=game_data.unit_sort_key).

Client: CastleSpyinfoDetailsDialog.showLoaded (bundle line 60627) addAlls itemsKeep then itemsSupport into one UnitInventoryList; setCompactArmyItem (bundle line 60675) sorts it with ClientConstSort.sortByUnitSortOrder

total

total() -> int

Every defender in the castle, wherever they stand.

wall_total

wall_total() -> int

Defenders on the wall: the flanks an attack meets first.

army.models.hospital

Hospital protocol models.

Commands:

  • hru: Heal wounded units
  • hcs: Cancel a hospital slot
  • hss: Skip a hospital slot (rubies)
  • hdu: Dismiss wounded units
  • hra: Heal all wounded units (rubies)
  • hfl: Read or set the hospital flags

These act on the castle the session has joined (jca); hfl also names it.

Classes:

Name Description
HealUnitsRequest

Queue wounded units of the joined castle for healing.

HealUnitsResponse

The joined castle after an hru.

CancelHealRequest

Cancel a hospital slot of the joined castle.

CancelHealResponse

The joined castle after an hcs.

SkipHealRequest

Finish a hospital slot of the joined castle now, for rubies.

SkipHealResponse

Currencies after an hss.

DismissWoundedRequest

Dismiss wounded units of one type in the joined castle.

WoundedUnits

One UT entry of a many-type hdu.

DismissManyWoundedRequest

Dismiss wounded units of several types in the joined castle.

DismissWoundedResponse

The joined castle after an hdu.

HealAllRequest

Heal every wounded unit of the joined castle at once, for rubies.

HealAllResponse

The joined castle after an hra.

HospitalFlagsRequest

Read or set the hospital flags of the joined castle.

HospitalFlags

The hospital flags of a castle, the hfl reply.

HospitalFlagsResponse

The hospital flags of the joined castle.

HealUnitsRequest pydantic-model

Bases: BaseRequest

Queue wounded units of the joined castle for healing.

Command: hru Payload: {"U": wod_id, "A": amount}

Client: C2SReviveUnitPackageVO (bundle line 84175), built by CastleRecruitSelectedUnitComponent.onReviveClick (bundle line 51105)

Fields:

wod_id pydantic-field

wod_id: EnumOrInt['Unit']

Wire key U

The wounded unit to heal

amount pydantic-field

amount: int

Wire key A

HealUnitsResponse pydantic-model

Bases: BaseResponse

The joined castle after an hru.

Command: hru

Client: HRUCommand.executeCommand (bundle line 124532)

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

CancelHealRequest pydantic-model

Bases: BaseRequest

Cancel a hospital slot of the joined castle.

Command: hcs Payload: {"S": position}

Client: C2SCancelHospitalSlot (bundle line 83616), built by CastleRecruitDialogHospital.onCurrentSlotCancelled (bundle line 83508)

Fields:

position pydantic-field

position: int

Wire key S

The slot's index in the hospital list

CancelHealResponse pydantic-model

Bases: BaseResponse

The joined castle after an hcs.

Command: hcs

Client: HCSCommand.executeCommand (bundle line 124454)

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

SkipHealRequest pydantic-model

Bases: BaseRequest

Finish a hospital slot of the joined castle now, for rubies.

Command: hss Payload: {"S": position}

Client: C2SSkipHospitalSlot (bundle line 83625), built by CastleRecruitDialogHospital (bundle line 83504)

Fields:

position pydantic-field

position: int

Wire key S

The slot's index in the hospital list

SkipHealResponse pydantic-model

Bases: BaseResponse

Currencies after an hss.

Command: hss

Client: HSSCommand.executeCommand (bundle line 50856)

Fields:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

DismissWoundedRequest pydantic-model

Bases: BaseRequest

Dismiss wounded units of one type in the joined castle.

Command: hdu Payload: {"U": wod_id, "A": amount}

Client: C2SDismissHospitalUnits (bundle line 83748), built by CastleHospitalDismissUnitsDialog.dismissUnits (bundle line 83737)

Fields:

wod_id pydantic-field

wod_id: EnumOrInt['Unit']

Wire key U

The wounded unit to dismiss

amount pydantic-field

amount: int

Wire key A

WoundedUnits pydantic-model

Bases: BasePayload

One UT entry of a many-type hdu.

Fields:

wod_id pydantic-field

wod_id: EnumOrInt['Unit']

Wire key U

The wounded unit to dismiss

amount pydantic-field

amount: int

Wire key A

DismissManyWoundedRequest pydantic-model

Bases: BaseRequest

Dismiss wounded units of several types in the joined castle.

Command: hdu Payload: {"UT": [{"U": wod_id, "A": amount}, ...]}

Client: C2SDismissManyHospitalUnits (bundle line 83834), built by CastleRecruitDialogHospital.onConfirmDeleteAll (bundle line 83498)

Fields:

units pydantic-field

Wire key UT

DismissWoundedResponse pydantic-model

Bases: BaseResponse

The joined castle after an hdu.

Command: hdu

Client: HDUCommand.executeCommand (bundle line 124470)

Fields:

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

HealAllRequest pydantic-model

Bases: BaseRequest

Heal every wounded unit of the joined castle at once, for rubies.

Command: hra Payload: {"C2": ruby_cost}

C2 is the price the client shows: the sum over the hospital of int(amount * reviveAllCostC2), less the active prime-sales revive-all discount percent, rounded up. The server answers INVALID_AMOUNT when the hospital changed ("alert_hospital_amountOutdated").

Client: C2SReviveAllHospitalUnits (bundle line 83677), sent by CastleHospitalReviveAllDialog.reviveAll (bundle line 83667) with the price from CastleRecruitDialogHospital.openReviveAllDialog (bundle line 83509)

Fields:

ruby_cost pydantic-field

ruby_cost: int

Wire key C2

HealAllResponse pydantic-model

Bases: BaseResponse

The joined castle after an hra.

Command: hra

Client: HRACommand.executeCommand (bundle line 633575): gcu to CurrencyData.parseGCU, gui to parse_GUI, gpa to AreaDataUpdater.parseGPA

Fields:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

The units after; None when the reply has none

production_area pydantic-field

production_area: ProductionAreaBlock = None

Wire key gpa

The castle's production area after; None when the reply has none

HospitalFlagsRequest pydantic-model

Bases: BaseRequest

Read or set the hospital flags of the joined castle.

Command: hfl Payload: {"KID": kingdom_id, "AID": castle_id, "HRF": -1, 0 or 1}

HRF -1 only reads the flags, as the hospital dialog does when it opens (CastleRecruitDialogHospital.show, bundle line 83456); 0 or 1 sets whether wounded ruby units are admitted, as its checkbox does (toggleRubyBlock, bundle line 83605).

Client: C2SHospitalFlagsVO (bundle line 84184)

Fields:

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key KID

The joined castle's kingdom

castle_id pydantic-field

castle_id: int

Wire key AID

The castle the session is in, a Castle.id from client.state.get_castles(); ArmyService joins it first

admit_ruby_units pydantic-field

admit_ruby_units: int = -1

Wire key HRF

-1 to only read the flags, 1 to admit wounded ruby units, 0 not to

accepts_reply

accepts_reply(payload: Any) -> bool

Whether an hfl reply is about this castle: its KID and AID are the ones sent.

Client: CastleRecruitDialogHospital.onHospitalFlagsReceived (bundle line 83606) takes only flags for which HospitalFlagsVO.isCurrentCastle (bundle line 124502) holds.

HospitalFlags pydantic-model

Bases: BasePayload

The hospital flags of a castle, the hfl reply.

Client: HospitalFlagsVO.parse_HFL (bundle line 124501). HRF is the dialog's checkbox "Admit wounded ruby units to the hospital" (dialog_hospital_rubyUnitsFilter_desc), ticked while HRF is 1 (onHospitalFlagsReceived, bundle line 83606)

Fields:

Validators:

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

castle_id pydantic-field

castle_id: int = 0

Wire key AID

admits_ruby_units pydantic-field

admits_ruby_units: bool = False

Wire key HRF

Wounded ruby units are admitted to the hospital

HospitalFlagsResponse pydantic-model

Bases: BaseResponse, HospitalFlags

The hospital flags of the joined castle.

Command: hfl

Client: HFLCommand.executeCommand (bundle line 124489)

Fields:

Validators:

army.models.production

Unit and tool production models.

Commands:

  • bup: Produce units or tools
  • spl: Get a production list
  • bou: Double the units of a production slot
  • mcu: Cancel a production slot
  • mup: Move a queued slot to another position
  • srm: Set a list's recruitment mode
  • sou: Finish a production slot now
  • ups: Unlock another production slot

These act on the castle the session has joined (jca); bup and bou also name that castle and its kingdom.

Classes:

Name Description
ProductionSlot

One slot of a soldier, tool or auxiliary list: a QS entry or the PS block.

CurrentProductionSlot

The slot producing now, the PS block: free until the block says otherwise.

HospitalSlot

One slot of the hospital list, a positional PIDL entry.

ProductionList

One production list, the spl block.

ProduceUnitsRequest

Produce units or tools in the joined castle.

AddedUnit

Units bup put straight into the inventory, the O block.

ProduceUnitsResponse

The joined castle after a bup.

GetProductionListRequest

Get one production list of the joined castle.

GetProductionListResponse

One production list of the joined castle.

DoubleProductionSlotRequest

Double the units of a production slot, for rubies.

DoubleProductionSlotResponse

The production list after a bou.

CancelProductionRequest

Cancel a production slot of the joined castle.

CancelProductionResponse

The production list after an mcu.

MoveProductionSlotRequest

Move a slot of a production list of the joined castle to another position.

MoveProductionSlotResponse

The production list after an mup.

SetRecruitmentModeRequest

Set the recruitment mode of a production list of the joined castle.

SetRecruitmentModeResponse

The server's answer to an srm.

SkipProductionSlotRequest

Finish a production slot of the joined castle now, for rubies.

SkipProductionSlotResponse

The production list after a sou.

UnlockProductionSlotRequest

Unlock another production slot of a list, for rubies.

UnlockProductionSlotResponse

The production list after an ups; the slots it lists reach client.player.boosts.

Attributes:

Name Type Description
UNLOCK_SLOT_RUBIES

What unlocking a production slot costs before ruby discounts.

ProductionListBlock module-attribute

ProductionListBlock = Annotated[ProductionList | None, BeforeValidator(object_or_none)]

ResourcesBlock module-attribute

UNLOCK_SLOT_RUBIES module-attribute

UNLOCK_SLOT_RUBIES = 375

What unlocking a production slot costs before ruby discounts.

Client: UnitProductionConst.UNLOCK_C2 (dll), priced by getFinalCostsC2

ProductionSlot pydantic-model

Bases: BasePayload

One slot of a soldier, tool or auxiliary list: a QS entry or the PS block.

The client reads three optional parts of the same object: the top-level keys only when ICT is set, then P (which overrides the unit, amount, boosts, alliance help and recruitment id), then SI (the lock state). Numbers go through int(), RAH and VIP through !!, and RUT is kept as sent. An entry that is not an object reads as an empty slot.

Client: UnitPackageSlotVO.fillFromParamObject (bundle line 61416); PS first goes through initProductionSlot (bundle line 61417)

Fields:

Validators:

  • _fill_as_the_client_does

starts_free class-attribute

starts_free: bool = False

position pydantic-field

position: int = 0

Index in the queue, the position boost and cancel requests take; 0 for the slot producing now

wod_id pydantic-field

wod_id: Literal[0] | UnitOrTool

amount pydantic-field

amount: int = 0

Wire key TUA

Units in the slot

boost_count pydantic-field

boost_count: int = 0

Wire key CBS

How often the slot's units were doubled

received_alliance_help pydantic-field

received_alliance_help: bool = False

Wire key RAH

recruitment_id pydantic-field

recruitment_id: int = 0

Wire key PID

remaining_seconds pydantic-field

remaining_seconds: int = 0

Wire key RCT

Seconds left on the slot

production_seconds pydantic-field

production_seconds: int = 0

Wire key ICT

Total production time, in seconds

source_recruitment_id pydantic-field

source_recruitment_id: int = 0

Wire key SPID

Source recruitment id

seconds_till_locked pydantic-field

seconds_till_locked: int | float | str | None = 0

Seconds until the slot locks while it is empty, else -1; 0 means locked

is_vip pydantic-field

is_vip: bool = False

The slot is a VIP slot

is_locked pydantic-field

is_locked: bool = False

is_free pydantic-field

is_free: bool = False

Unlocked and empty

CurrentProductionSlot pydantic-model

Bases: ProductionSlot

The slot producing now, the PS block: free until the block says otherwise.

Client: UnitPackageList.parseCurrentProductionSlot (bundle line 138906)

Fields:

Validators:

  • _fill_as_the_client_does

starts_free class-attribute

starts_free: bool = True

HospitalSlot pydantic-model

Bases: BasePayload

One slot of the hospital list, a positional PIDL entry.

[wod_id, amount, remaining_seconds, speed * 100, heal_time_reduction, recruitment_id, seconds_till_locked], which the client reads in that order with no int(); here each goes through js_int so the fields are ints, and a missing value reads as 0. An entry that is not an array reads as an empty slot here, where the client would stop reading the list.

Client: UnitHealPackageSlotVO.fillFromParamArray (bundle line 138964)

Fields:

position pydantic-field

position: int = 0

Index in the hospital list, the position cancel and skip requests take

wod_id pydantic-field

wod_id: Literal[-2, -1, 0] | EnumOrInt['Unit']

amount pydantic-field

amount: int = 0

remaining_seconds pydantic-field

remaining_seconds: int = 0

recruitment_speed pydantic-field

recruitment_speed: float = 0.0

Recruitment speed

heal_time_reduction pydantic-field

heal_time_reduction: int = 0

recruitment_id pydantic-field

recruitment_id: int = 0

seconds_till_locked pydantic-field

seconds_till_locked: int = 0

is_free property

is_free: bool

ConstructionConst.SLOTSTATEUNLOCKED -1 (dll line 18983).

is_locked property

is_locked: bool

ConstructionConst.SLOTSTATELOCKED -2 (dll line 18983).

ProductionList pydantic-model

Bases: BasePayload

One production list, the spl block.

The client ignores a block without LID. The hospital list (ProductionListId.HOSPITAL) sends PIDL and ASI; every other list sends QS, PS, RM and TCT.

Client: CastleMilitaryData.parse_SPL (bundle line 138830), UnitPackageList.parseList / parseMilitaryList (bundle lines 138899, 138907); RecruitmentConst (dll line 19660) for the RM modes

Fields:

Validators:

  • _client_ints

list_id pydantic-field

list_id: EnumOrInt[ProductionListId] | None = None

Wire key LID

The list; None when missing

queue pydantic-field

Wire key QS

Queued slots, by position

current pydantic-field

Wire key PS

The slot producing now

recruitment_mode pydantic-field

recruitment_mode: RecruitmentMode = RecruitmentMode.FINISH_FIRST_STACK

Wire key RM

The order the queue is worked through; soldier, tool and auxiliary lists only

remaining_seconds pydantic-field

remaining_seconds: int = 0

Wire key TCT

Seconds until the list's production is done

hospital_slots pydantic-field

hospital_slots: list[HospitalSlot]

Wire key PIDL

Hospital list only: slots by position

active_slot_index pydantic-field

active_slot_index: ParseInt = 0

Wire key ASI

Index of the active hospital slot; hospital list only

ProduceUnitsRequest pydantic-model

Bases: BaseRequest

Produce units or tools in the joined castle.

Command: bup Payload: {"LID": list_id, "WID": wod_id, "AMT": amount, "PO": -1, "PWR": 0, "SK": 73, "SID": kingdom_id, "AID": castle_id}

PWR 1 pays rubies for missing resources: the client sends it from the resource wait dialog's skip (CastleResourceWaitDialog.skipForRubies, bundle line 32069), with PO set to the resource merchant's private offer id (CastlePrivateOfferData.getPrivateOfferMerchantID, bundle line 131979, -1 when there is none). SK is always 73 (BUY_UNIT_PACKAGE_SK).

Client: C2SBuyUnitPackageVO (bundle line 35277), built by CastleRecruitSelectedUnitComponent (bundle line 51107) and CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35218)

Fields:

list_id pydantic-field

Wire key LID

The list to produce into

wod_id pydantic-field

wod_id: UnitOrTool

Wire key WID

The unit or tool to produce

amount pydantic-field

amount: int

Wire key AMT

How many to produce

private_offer_id pydantic-field

private_offer_id: int = -1

Wire key PO

Resource merchant offer id, -1 for none

pay_with_rubies pydantic-field

pay_with_rubies: int = 0

Wire key PWR

1 to pay rubies for missing resources

sk pydantic-field

Wire key SK

Always 73

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key SID

The joined castle's kingdom

castle_id pydantic-field

castle_id: int

Wire key AID

The castle the session is in, a Castle.id from client.state.get_castles(); ArmyService joins it first

AddedUnit pydantic-model

Bases: BasePayload

Units bup put straight into the inventory, the O block.

Client: BUPCommand.executeCommand (bundle line 125531) calls unitInventory.addUnit(O.W, O.AMT) when O is set and not 0

Fields:

Validators:

  • _client_ints

wod_id pydantic-field

wod_id: Literal[0] | UnitOrTool

amount pydantic-field

amount: int = 0

Wire key AMT

ProduceUnitsResponse pydantic-model

Bases: BaseResponse

The joined castle after a bup.

Command: bup Payload: {"spl": {...}, "grc": {...}, "gcu": {...}, "gui": {...}, "O": {"W": wod_id, "AMT": amount}}

Client: BUPCommand.executeCommand (bundle line 637270): spl to parse_SPL, grc to AreaDataUpdater.parseGRC, gcu to CurrencyData.parseGCU, gui to parse_GUI, and O to unitInventory.addUnit when set and not 0

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

The production list after; None when the reply has none

resources pydantic-field

resources: ResourcesBlock = None

Wire key grc

The castle's resources after; None when the reply has none

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

The units after; None when the reply has none

added_unit pydantic-field

added_unit: AddedUnit | None = None

Wire key O

Units put straight into the inventory; None when there are none

GetProductionListRequest pydantic-model

Bases: BaseRequest

Get one production list of the joined castle.

Command: spl Payload: {"LID": list_id}

Client: C2SShowPackageListVO (bundle line 22860)

Fields:

list_id pydantic-field

Wire key LID

accepts_reply

accepts_reply(payload: Any) -> bool

Whether an spl reply is about this list: its LID is the one asked for, or it is empty.

Client: CastleMilitaryData.parse_SPL (bundle line 138830) updates the list named by the reply's LID and ignores a reply without one. The server answers {} for a list the castle cannot produce (seen live for the auxiliaries list on a castle without that building), which the client never asks for; an empty reply names no list, so it cannot be another request's.

GetProductionListResponse pydantic-model

Bases: BaseResponse, ProductionList

One production list of the joined castle.

Command: spl

Client: SPLCommand.executeCommand (bundle line 125676) hands the reply to CastleMilitaryData.parse_SPL

Fields:

Validators:

  • _client_ints

DoubleProductionSlotRequest pydantic-model

Bases: BaseRequest

Double the units of a production slot, for rubies.

Command: bou Payload: {"LID": list_id, "S": position, "AID": castle_id, "SID": kingdom_id, "ST": slot_type}

S is the slot's position: 0 for the slot producing now, its index in QS for a queued one.

Client: C2SBoostUnitPackageVO (bundle line 79040), built by RecruitmentHelper.boostCurrentSlot (bundle line 23165) from the recruit dialog's boost button (onDoubleUnitsConfirmation, bundle line 23694)

Fields:

list_id pydantic-field

Wire key LID

The list the slot belongs to

position pydantic-field

position: int

Wire key S

0 for the slot producing now, its index in QS for a queued one

castle_id pydantic-field

castle_id: int

Wire key AID

The castle the session is in, a Castle.id from client.state.get_castles(); ArmyService joins it first

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key SID

The joined castle's kingdom

slot_type pydantic-field

slot_type: SlotType

Wire key ST

Whether the slot is producing now or queued

DoubleProductionSlotResponse pydantic-model

Bases: BaseResponse

The production list after a bou.

Command: bou

Client: BOUCommand.executeCommand (bundle line 125515)

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

CancelProductionRequest pydantic-model

Bases: BaseRequest

Cancel a production slot of the joined castle.

Command: mcu Payload: {"LID": list_id, "S": position, "ST": slot_type}

Client: C2SCancelUnitPackageVO (bundle line 83843), built by CastleRecruitDialogUnits.onCancelCurrentSlotConfirmed (bundle line 23655)

Fields:

list_id pydantic-field

Wire key LID

position pydantic-field

position: int

Wire key S

0 for the slot producing now, else its index in the queue

slot_type pydantic-field

slot_type: SlotType

Wire key ST

CancelProductionResponse pydantic-model

Bases: BaseResponse

The production list after an mcu.

Command: mcu

Client: MCUCommand.executeCommand (bundle line 125616)

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

MoveProductionSlotRequest pydantic-model

Bases: BaseRequest

Move a slot of a production list of the joined castle to another position.

Command: mup Payload: {"LID": list_id, "OS": old_position, "NS": new_position}

Client: C2SMoveUnitPackageVO (bundle line 83777), built by UnitBuildListComponent.requestMoveFromServer (bundle line 50938) when a dragged slot is dropped

Fields:

list_id pydantic-field

Wire key LID

old_position pydantic-field

old_position: int

Wire key OS

The slot's position before the move

new_position pydantic-field

new_position: int

Wire key NS

The position it moves to

MoveProductionSlotResponse pydantic-model

Bases: BaseResponse

The production list after an mup.

Command: mup Payload: {"spl": {...}}

Client: MUPCommand.executeCommand (bundle line 125631) hands spl to parse_SPL

Fields:

production_list pydantic-field

production_list: ProductionList

Wire key spl

SetRecruitmentModeRequest pydantic-model

Bases: BaseRequest

Set the recruitment mode of a production list of the joined castle.

Command: srm Payload: {"LID": list_id, "SID": kingdom_id, "AID": castle_id, "RM": mode}

Client: C2SSetRecruitmentModeVO (bundle line 83852), sent by CastleRecruitDialogUnits.onClick (bundle line 23686) with the mode it switches to

Fields:

list_id pydantic-field

Wire key LID

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key SID

The joined castle's kingdom

castle_id pydantic-field

castle_id: int

Wire key AID

The castle the session is in, a Castle.id from client.state.get_castles(); ArmyService joins it first

mode pydantic-field

Wire key RM

SetRecruitmentModeResponse pydantic-model

Bases: BaseResponse

The server's answer to an srm.

Command: srm

Client: SRMCommand.executeCommand (bundle line 126787) reads nothing; the dialog has already set the mode on its list (bundle line 23686)

Fields:

SkipProductionSlotRequest pydantic-model

Bases: BaseRequest

Finish a production slot of the joined castle now, for rubies.

Command: sou Payload: {"LID": list_id, "S": position}

The client sends it only from the recruit dialog's skip button, which it shows only to the takesPartInSkipRecruitingTest group, and that getter answers false (bundle line 18700).

Client: C2SSkipUnitPackageVO (bundle line 79082), built by RecruitmentHelper.skipSlot (bundle line 23176) from CastleRecruitDialogUnits.boostCurrentSlot (bundle line 23661)

Fields:

list_id pydantic-field

Wire key LID

The list the slot belongs to

position pydantic-field

position: int

Wire key S

0 for the slot producing now, its index in QS for a queued one

SkipProductionSlotResponse pydantic-model

Bases: BaseResponse

The production list after a sou.

Command: sou Payload: {"spl": {...}, "gcu": {...}}

Client: SOUCommand.executeCommand (bundle line 125699): spl to parse_SPL, gcu to CurrencyData.parseGCU

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

UnlockProductionSlotRequest pydantic-model

Bases: BaseRequest

Unlock another production slot of a list, for rubies.

Command: ups Payload: {"LID": list_id}

Client: C2SUnlockPackageSlotVO (bundle line 120481), sent by UnitBuildListComponent.buySlot (bundle line 261026), AutoRecruitmentBuyRecruitmentSlots.buySlots (bundle line 312381) and CastleToolSlotPremiumShopVO.buySlot (bundle line 397692)

Fields:

list_id pydantic-field

Wire key LID

The list to unlock a slot of

UnlockProductionSlotResponse pydantic-model

Bases: BaseResponse

The production list after an ups; the slots it lists reach client.player.boosts.

Command: ups Payload: {"spl": {...}, "gcu": {...}, "boi": {...}}

Client: UPSCommand.executeCommand (bundle line 637946): spl to parse_SPL, gcu to CurrencyData.parseGCU, boi to CastlePremiumBoostData.parse_BOI

Fields:

production_list pydantic-field

production_list: ProductionListBlock = None

Wire key spl

The joined castle's list after; None when the reply has none

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the change

army.models.units

Unit inventory, dismissing units, and attack waves.

Commands:

  • gui: Get units inventory
  • dup: Dismiss units
  • sts: Store soldiers in the stronghold
  • tas: Take soldiers out of the stronghold
  • fuc: How many more soldiers a Berimond camp takes

AttackWave and WaveFlank are the waves a cra attack sends.

Classes:

Name Description
GetUnitsRequest

Get the unit inventories of the castle the session is in.

UnitInventory

A castle's unit inventories, the gui block.

GetUnitsResponse

The unit inventories of the castle the session is in.

DismissUnitsRequest

Dismiss units of the joined castle.

DismissUnitsResponse

The joined castle after a dup.

StoreSoldiersRequest

Store soldiers of the joined castle in its stronghold.

StoreSoldiersResponse

The joined castle's unit inventories after an sts: the whole reply is a gui block.

TakeSoldiersRequest

Take soldiers of the joined castle out of its stronghold.

TakeSoldiersResponse

The joined castle's unit inventories after a tas: the whole reply is a gui block.

GetCampUnitCapacityRequest

Ask how many more soldiers a camp of the Berimond kingdom takes.

GetCampUnitCapacityResponse

How many more soldiers a camp takes.

WaveFlank

One flank of an attack wave.

AttackWave

A single attack wave: left, right and middle flank.

Attributes:

Name Type Description
BUY_UNIT_PACKAGE_SK

SK of every bup: each client caller leaves C2SBuyUnitPackageVO's

BUY_UNIT_PACKAGE_SK module-attribute

BUY_UNIT_PACKAGE_SK = 73

SK of every bup: each client caller leaves C2SBuyUnitPackageVO's default; nothing in the client reads it or says what it means.

ProductionAreaBlock module-attribute

A reply's gpa, which the client hands to AreaDataUpdater.parseGPA (bundle line 659045).

UnitInventoryBlock module-attribute

UnitInventoryBlock = Annotated[UnitInventory | None, BeforeValidator(object_or_none)]

GetUnitsRequest pydantic-model

Bases: BaseRequest

Get the unit inventories of the castle the session is in.

Command: gui Payload: {}

The request names no castle: the server answers for the joined castle, and with NOT_IN_OWNED_CASTLE once a map scan has moved the session away.

Client: C2SGetUnitInventoryVO (no fields)

UnitInventory pydantic-model

Bases: BasePayload

A castle's unit inventories, the gui block.

Client: CastleMilitaryData.parse_GUI, which fills each inventory with AUnitInventory.fillFromWodAmountArray (bundle line 42572)

Fields:

units pydantic-field

units: WodAmounts

Wire key I

Units and tools in the castle

in_production pydantic-field

in_production: WodAmounts

Wire key TU

Units on their way in

stronghold pydantic-field

stronghold: WodAmounts

Wire key SHI

Units stored in the stronghold

hospital pydantic-field

hospital: WodAmounts

Wire key HI

Wounded units in the hospital

GetUnitsResponse pydantic-model

Bases: BaseResponse, UnitInventory

The unit inventories of the castle the session is in.

Command: gui Payload: {"I": [[wod_id, amount], ...], "TU": [...], "SHI": [...], "HI": [...]}

Client: GUICommand.exec (bundle line 125600) hands the reply to CastleMilitaryData.parse_GUI, which reads I, TU, SHI and HI and nothing else.

Fields:

DismissUnitsRequest pydantic-model

Bases: BaseRequest

Dismiss units of the joined castle.

Command: dup Payload: {"WID": wod_id, "A": amount, "S": 0 or 1}

Client: C2SDismissUnitPackageVO (bundle line 84341), built by CastleRecruitDismissUnitsDialog.dismissUnits (bundle line 84330) for an item of the inventory, whose filters list attack and defence tools too (CastleRecruitDialogInventory.onClick, bundle lines 84249-84251)

Fields:

wod_id pydantic-field

wod_id: UnitOrTool

Wire key WID

The unit or tool to dismiss; the inventory the dialog opens from lists both

amount pydantic-field

amount: int

Wire key A

from_stronghold pydantic-field

from_stronghold: int = 0

Wire key S

1 to dismiss from the stronghold

DismissUnitsResponse pydantic-model

Bases: BaseResponse

The joined castle after a dup.

Command: dup

Client: DUPCommand.executeCommand (bundle line 637536): gpa to AreaDataUpdater.parseGPA, gui to parse_GUI

Fields:

production_area pydantic-field

production_area: ProductionAreaBlock = None

Wire key gpa

The castle's production area after; None when the reply has none

unit_inventory pydantic-field

unit_inventory: UnitInventoryBlock = None

Wire key gui

The units after; None when the reply has none

StoreSoldiersRequest pydantic-model

Bases: BaseRequest

Store soldiers of the joined castle in its stronghold.

Command: sts Payload: {"WID": wod_id, "A": amount}

The client offers at most the stronghold's free space or the soldiers at home, whichever is less, and nothing once the stronghold is full (bundle lines 84422, 138864-138866).

Client: C2SStoreSoldiersVO (bundle line 84439), sent by CastleInventoryStrongholdListItemComponent.storeSoldiers (bundle line 84429)

Fields:

wod_id pydantic-field

wod_id: EnumOrInt['Unit']

Wire key WID

The soldiers to store

amount pydantic-field

amount: int

Wire key A

StoreSoldiersResponse pydantic-model

Bases: BaseResponse, UnitInventory

The joined castle's unit inventories after an sts: the whole reply is a gui block.

Command: sts

Client: STSCommand.executeCommand (bundle line 125692) hands the reply to CastleMilitaryData.parse_GUI (bundle line 138833)

Fields:

TakeSoldiersRequest pydantic-model

Bases: BaseRequest

Take soldiers of the joined castle out of its stronghold.

Command: tas Payload: {"WID": wod_id, "A": amount}

Client: C2STakeSoldiersVO (bundle line 84480), sent by StrongholdInventoryListItemComponent.takeSoldiers (bundle line 84462)

Fields:

wod_id pydantic-field

wod_id: EnumOrInt['Unit']

Wire key WID

The soldiers to take out

amount pydantic-field

amount: int

Wire key A

TakeSoldiersResponse pydantic-model

Bases: BaseResponse, UnitInventory

The joined castle's unit inventories after a tas: the whole reply is a gui block.

Command: tas

Client: TASCommand.executeCommand (bundle line 125707) hands the reply to CastleMilitaryData.parse_GUI (bundle line 138833)

Fields:

GetCampUnitCapacityRequest pydantic-model

Bases: BaseRequest

Ask how many more soldiers a camp of the Berimond kingdom takes.

Command: fuc Payload: {"CID": camp_id}

Client: C2SGetCampUnitCapacity (bundle line 54623), sent for your main Berimond camp by CastleTransferTroopsToKingdomProperties.additionalDataUpdateCommands (bundle line 37467) and for the camp a support goes to by CastleTroopSupportDialog.onSupportDefenceInfos (bundle line 129177)

Fields:

camp_id pydantic-field

camp_id: int

Wire key CID

The camp's area id

GetCampUnitCapacityResponse pydantic-model

Bases: BaseResponse

How many more soldiers a camp takes.

Command: fuc Payload: {"FUC": capacity}

Client: FUCCommand.executeCommand (bundle line 127902) passes Math.max(FUC, 0) on; the transfer and support dialogs cap the soldiers sent at it (bundle lines 24386, 129195)

Fields:

capacity pydantic-field

capacity: int = 0

Wire key FUC

Soldiers the camp still takes, never below 0

WaveFlank pydantic-model

WaveFlank(*, tools: WodAmountSlotsInput = (), units: WodAmountSlotsInput = ())

Bases: BasePayload

One flank of an attack wave.

Payload: {"T": [[tool_id, count], ...], "U": [[unit_id, count], ...]}, one pair per slot

Client: CastleAttackWaveVO.getWaveInfoObject (bundle line 99930) sends each container's getSlotList() (bundle line 20573)

Fields:

tools pydantic-field

tools: WodAmountSlots = ()

Wire key T

The tool slots, [-1, 0] for an empty one

units pydantic-field

units: WodAmountSlots = ()

Wire key U

The unit slots, [-1, 0] for an empty one

AttackWave pydantic-model

Bases: BasePayload

A single attack wave: left, right and middle flank.

Payload: {"L": flank, "R": flank, "M": flank}, in the client's key order.

Client: CastleAttackWaveVO.getWaveInfoObject (bundle line 99930)

Fields:

left pydantic-field

left: WaveFlank

Wire key L

right pydantic-field

right: WaveFlank

Wire key R

middle pydantic-field

middle: WaveFlank

Wire key M

unit_count

unit_count() -> int

Total units across all three flanks.

is_complete

is_complete() -> bool

Whether the client would send this wave.

The game drops any wave without units, tools included.