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
¶
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
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, |
start_recruitment_loop |
Repeat a list's queue |
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 |
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 |
skip_heal |
Finish a hospital slot now, by its |
dismiss_wounded |
Dismiss wounded units of one type instead of healing them. |
dismiss_wounded_units |
Dismiss wounded units of several types at once, as |
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 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 |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
dict[UnitOrTool, int]
|
The castle's units and tools, |
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 |
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 |
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 |
required |
Client: CastleRecruitDismissUnitsDialog.dismissUnits (bundle line 84330)
get_camp_unit_capacity
¶
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 |
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 |
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 |
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 |
-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 |
GameDataNotLoadedError
|
|
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 |
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 |
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
|
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 |
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
|
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
|
|
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 |
required |
list_id
|
ProductionListId
|
SOLDIERS, TOOLS or AUXILIARIES |
required |
position
|
int
|
0 for the slot producing now, else the slot's |
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
|
|
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, |
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 |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
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 |
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 |
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 |
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
|
|
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 |
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; |
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 |
required |
list_id
|
ProductionListId
|
The list |
required |
targets
|
Sequence[RecruitmentCopyTarget]
|
Entries from |
required |
spend_rubies
|
bool
|
Allow targets whose |
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 |
ProductionSlotsNeededError
|
The list needs more unlocked slots first |
CommandError
|
|
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 |
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 |
GameDataNotLoadedError
|
|
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 |
required |
ruby_cost
|
int
|
The price the client would show (see |
required |
spend_rubies
|
bool
|
Allow a |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleHospitalReviveAllDialog.reviveAll (bundle line 83667), with the price from
CastleRecruitDialogHospital.openReviveAllDialog (bundle lines 83509-83513)
cancel_heal
¶
Cancel a hospital slot, by its HospitalSlot.position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
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 |
required |
position
|
int
|
The slot's |
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
|
|
Client: CastleRecruitDialogHospital.skipCurrentSlot (bundle line 83504), priced in rubies
by updateSkipTooltip (bundle line 83582)
dismiss_wounded
¶
Dismiss wounded units of one type instead of healing them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
Client: CastleHospitalDismissUnitsDialog.dismissUnits (bundle line 83737)
dismiss_wounded_units
¶
Dismiss wounded units of several types at once, as {unit: amount}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
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 |
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 |
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 |
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:
-
left(SpyStacks) -
middle(SpyStacks) -
right(SpyStacks) -
keep(SpyStacks) -
stronghold(SpyStacks) -
support(SpyStacks) -
reserve(SpyStacks)
Validators:
-
_by_position
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.
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
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 |
CancelHealRequest |
Cancel a hospital slot of the joined castle. |
CancelHealResponse |
The joined castle after an |
SkipHealRequest |
Finish a hospital slot of the joined castle now, for rubies. |
SkipHealResponse |
Currencies after an |
DismissWoundedRequest |
Dismiss wounded units of one type in the joined castle. |
WoundedUnits |
One |
DismissManyWoundedRequest |
Dismiss wounded units of several types in the joined castle. |
DismissWoundedResponse |
The joined castle after an |
HealAllRequest |
Heal every wounded unit of the joined castle at once, for rubies. |
HealAllResponse |
The joined castle after an |
HospitalFlagsRequest |
Read or set the hospital flags of the joined castle. |
HospitalFlags |
The hospital flags of a castle, the |
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:
HealUnitsResponse
pydantic-model
¶
Bases: BaseResponse
The joined castle after an hru.
Command: hru
Client: HRUCommand.executeCommand (bundle line 124532)
Fields:
-
error_code(int) -
production_list(ProductionListBlock) -
currencies(CurrencyBlock) -
unit_inventory(UnitInventoryBlock)
currencies
pydantic-field
¶
currencies: CurrencyBlock = None
Wire key gcu
Coins and rubies after the change
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:
CancelHealResponse
pydantic-model
¶
Bases: BaseResponse
The joined castle after an hcs.
Command: hcs
Client: HCSCommand.executeCommand (bundle line 124454)
Fields:
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:
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:
WoundedUnits
pydantic-model
¶
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:
DismissWoundedResponse
pydantic-model
¶
Bases: BaseResponse
The joined castle after an hdu.
Command: hdu
Client: HDUCommand.executeCommand (bundle line 124470)
Fields:
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:
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:
-
error_code(int) -
currencies(CurrencyBlock) -
unit_inventory(UnitInventoryBlock) -
production_area(ProductionAreaBlock)
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:
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:
-
_client_truthy→admits_ruby_units
HospitalFlagsResponse
pydantic-model
¶
Bases: BaseResponse, HospitalFlags
The hospital flags of the joined castle.
Command: hfl
Client: HFLCommand.executeCommand (bundle line 124489)
Fields:
Validators:
-
_client_truthy→admits_ruby_units
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 |
CurrentProductionSlot |
The slot producing now, the |
HospitalSlot |
One slot of the hospital list, a positional |
ProductionList |
One production list, the |
ProduceUnitsRequest |
Produce units or tools in the joined castle. |
AddedUnit |
Units |
ProduceUnitsResponse |
The joined castle after a |
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 |
CancelProductionRequest |
Cancel a production slot of the joined castle. |
CancelProductionResponse |
The production list after an |
MoveProductionSlotRequest |
Move a slot of a production list of the joined castle to another position. |
MoveProductionSlotResponse |
The production list after an |
SetRecruitmentModeRequest |
Set the recruitment mode of a production list of the joined castle. |
SetRecruitmentModeResponse |
The server's answer to an |
SkipProductionSlotRequest |
Finish a production slot of the joined castle now, for rubies. |
SkipProductionSlotResponse |
The production list after a |
UnlockProductionSlotRequest |
Unlock another production slot of a list, for rubies. |
UnlockProductionSlotResponse |
The production list after an |
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
¶
ResourcesBlock = Annotated[CastleResources | None, BeforeValidator(object_or_none)]
UNLOCK_SLOT_RUBIES
module-attribute
¶
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:
-
position(int) -
wod_id(Literal[0] | UnitOrTool) -
amount(int) -
boost_count(int) -
received_alliance_help(bool) -
recruitment_id(int) -
remaining_seconds(int) -
production_seconds(int) -
source_recruitment_id(int) -
seconds_till_locked(int | float | str | None) -
is_vip(bool) -
is_locked(bool) -
is_free(bool)
Validators:
-
_fill_as_the_client_does
position
pydantic-field
¶
position: int = 0
Index in the queue, the position boost and cancel requests take; 0 for the slot producing now
boost_count
pydantic-field
¶
boost_count: int = 0
Wire key CBS
How often the slot's units were doubled
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 until the slot locks while it is empty, else -1; 0 means locked
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:
-
position(int) -
wod_id(Literal[0] | UnitOrTool) -
amount(int) -
boost_count(int) -
received_alliance_help(bool) -
recruitment_id(int) -
remaining_seconds(int) -
production_seconds(int) -
source_recruitment_id(int) -
seconds_till_locked(int | float | str | None) -
is_vip(bool) -
is_locked(bool) -
is_free(bool)
Validators:
-
_fill_as_the_client_does
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(int) -
wod_id(Literal[-2, -1, 0] | EnumOrInt['Unit']) -
amount(int) -
remaining_seconds(int) -
recruitment_speed(float) -
heal_time_reduction(int) -
recruitment_id(int) -
seconds_till_locked(int)
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:
-
list_id(EnumOrInt[ProductionListId] | None) -
queue(list[ProductionSlot]) -
current(CurrentProductionSlot) -
recruitment_mode(RecruitmentMode) -
remaining_seconds(int) -
hospital_slots(list[HospitalSlot]) -
active_slot_index(ParseInt)
Validators:
-
_client_ints
list_id
pydantic-field
¶
list_id: EnumOrInt[ProductionListId] | None = None
Wire key LID
The list; None when missing
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
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(ProductionListId) -
wod_id(UnitOrTool) -
amount(int) -
private_offer_id(int) -
pay_with_rubies(int) -
sk(int) -
kingdom_id(Kingdom) -
castle_id(int)
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
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:
-
error_code(int) -
production_list(ProductionListBlock) -
resources(ResourcesBlock) -
currencies(CurrencyBlock) -
unit_inventory(UnitInventoryBlock) -
added_unit(AddedUnit | None)
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
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:
accepts_reply
¶
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:
-
list_id(EnumOrInt[ProductionListId] | None) -
queue(list[ProductionSlot]) -
current(CurrentProductionSlot) -
recruitment_mode(RecruitmentMode) -
remaining_seconds(int) -
hospital_slots(list[HospitalSlot]) -
active_slot_index(ParseInt) -
error_code(int)
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:
DoubleProductionSlotResponse
pydantic-model
¶
Bases: BaseResponse
The production list after a bou.
Command: bou
Client: BOUCommand.executeCommand (bundle line 125515)
Fields:
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:
CancelProductionResponse
pydantic-model
¶
Bases: BaseResponse
The production list after an mcu.
Command: mcu
Client: MCUCommand.executeCommand (bundle line 125616)
Fields:
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:
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:
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:
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:
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:
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:
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 |
GetUnitsResponse |
The unit inventories of the castle the session is in. |
DismissUnitsRequest |
Dismiss units of the joined castle. |
DismissUnitsResponse |
The joined castle after a |
StoreSoldiersRequest |
Store soldiers of the joined castle in its stronghold. |
StoreSoldiersResponse |
The joined castle's unit inventories after an |
TakeSoldiersRequest |
Take soldiers of the joined castle out of its stronghold. |
TakeSoldiersResponse |
The joined castle's unit inventories after a |
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 |
|
BUY_UNIT_PACKAGE_SK
module-attribute
¶
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
¶
ProductionAreaBlock = Annotated[CastleProductionArea | None, BeforeValidator(object_or_none)]
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(WodAmounts) -
in_production(WodAmounts) -
stronghold(WodAmounts) -
hospital(WodAmounts)
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:
-
units(WodAmounts) -
in_production(WodAmounts) -
stronghold(WodAmounts) -
hospital(WodAmounts) -
error_code(int)
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(UnitOrTool) -
amount(int) -
from_stronghold(int)
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:
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:
-
units(WodAmounts) -
in_production(WodAmounts) -
stronghold(WodAmounts) -
hospital(WodAmounts) -
error_code(int)
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:
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:
-
units(WodAmounts) -
in_production(WodAmounts) -
stronghold(WodAmounts) -
hospital(WodAmounts) -
error_code(int)
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:
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:
-
error_code(int) -
capacity(int)
WaveFlank
pydantic-model
¶
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:
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: