Skip to content

Movements

Army movements, and the sends that start them, behind client.movements.

movements.service

The army movements the state tracks, and the sends that start them: support, troops, market goods, kingdom transfers and transfers to a season's treasure map.

Classes:

Name Description
MovementsService

Army movements: listing them, recalling your own, and sending support, troops, goods and

MovementsService

MovementsService(client: 'EmpireClient')

Bases: BaseService

Army movements: listing them, recalling your own, and sending support, troops, goods and kingdom transfers.

Reached as client.movements.

Methods:

Name Description
set_map_filter

Show or hide one kind of movement on the map, as the options dialog's map checkboxes do.

movement

a tracked movement by its Movement.movement_id, as client.movements.get_movements() lists it.

get_movements

Request army movements from server.

recall

Recall one of your movements (mcm), as the client's retreat and "send home" buttons do.

send_resources

Send resources from one of your castles to a castle on the map, by carriage.

get_market_info

List every castle's market carriages, those not on the road, and its resources.

send_support

Send support troops from a castle to a target location and return the server's reply.

send_township_support

Send support troops from a castle to a daimyo township and return the server's reply.

send_troops

Send troops from one of your areas to another of your own, where they stay.

get_travel_info

Get the pre-calculation of troops sent from one of your areas to another, before send_troops.

transfer_units_to_kingdom

Send units from one of your castles to another kingdom.

transfer_goods_to_kingdom

Send goods from one of your castles to your castle in another kingdom.

skip_kingdom_transfer_time

Shorten the units or goods on their way to a kingdom with a minute skip item.

transfer_goods_to_treasure_map

Send wood, stone and food from one of your castles to a season's treasure map camp.

transfer_units_to_treasure_map

Send units from one of your castles to a season's treasure map camp.

skip_treasure_map_transfer

Let the units or goods on their way to a season's treasure map arrive at once, for rubies.

skip_treasure_map_transfer_time

Shorten the units or goods on their way to a season's treasure map with a minute skip item.

skip_kingdom_transfer

Finish the units or goods on their way to a kingdom at once, for rubies.

Attributes:

Name Type Description
map_filter MovementFilterResponse | None

The map's movement filters, from the login data or the last mvf push; None until one arrived.

tracked list[Movement]

All tracked movements (stale ones pruned first).

announced_attacks list[Movement]

The attacks on_incoming_attack announced that are still on their way, in the order announced.

occupations list[Movement]

The occupations on_occupation_started announced that have not ended, in the order announced.

incoming_attacks list[Movement]

The attacks heading for you, as the movement pushes left them; nothing is sent.

incoming_movements list[Movement]

Every movement heading for you, as the movement pushes left them; nothing is sent.

outgoing_movements list[Movement]

Your movements on their way, as the movement pushes left them; nothing is sent.

map_filter property

map_filter: MovementFilterResponse | None

The map's movement filters, from the login data or the last mvf push; None until one arrived.

tracked property

tracked: list[Movement]

All tracked movements (stale ones pruned first).

announced_attacks property

announced_attacks: list[Movement]

The attacks on_incoming_attack announced that are still on their way, in the order announced.

occupations property

occupations: list[Movement]

The occupations on_occupation_started announced that have not ended, in the order announced.

incoming_attacks property

incoming_attacks: list[Movement]

The attacks heading for you, as the movement pushes left them; nothing is sent.

incoming_movements property

incoming_movements: list[Movement]

Every movement heading for you, as the movement pushes left them; nothing is sent.

outgoing_movements property

outgoing_movements: list[Movement]

Your movements on their way, as the movement pushes left them; nothing is sent.

set_map_filter

set_map_filter(kind: MovementFilter, show: bool, *, timeout: float = 5.0) -> MovementFilterResponse

Show or hide one kind of movement on the map, as the options dialog's map checkboxes do.

The reply is kept in map_filter, and the movement list is asked for again, as after every mvf. Unlike the client, which drops its map movements before it sends, the movements already tracked stay until they arrive.

Parameters:

Name Type Description Default
kind MovementFilter

The kind of movement

required
show bool

Show it, or hide it

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
MovementFilterResponse

The map's movement filters after the change

Raises:

Type Description
CommandError / EmpireTimeoutError / ConnectionClosedError

see EmpireClient.send

Client: OptionsDialogOptions.toggleMapMarketBarrows, toggleMapPVPAttacks and toggleMapPvPAttacksAlliance (bundle lines 379324-379353), MVFCommand.executeCommand (bundle line 652365)

movement

movement(movement_id: int) -> Movement | None

a tracked movement by its Movement.movement_id, as client.movements.get_movements() lists it.

get_movements

get_movements(wait: bool = True, *, timeout: float = 5.0) -> list[Movement]

Request army movements from server.

Parameters:

Name Type Description Default
wait bool

If True, wait for response before returning

True
timeout float

Timeout in seconds when waiting; with wait=False, how long to wait for a gam request in flight before sending, and how long the reply is kept from other gam requests at most

5.0

Returns:

Type Description
list[Movement]

List of Movement objects, read from state after the response has

list[Movement]

been applied. With wait=False this is whatever state holds

list[Movement]

right now, which is not yet the answer to this request.

Raises:

Type Description
CommandError

wait=True and the server rejected 'gam'

EmpireTimeoutError

wait=True and no response within timeout, or wait=False and a gam request in flight for all of timeout

recall

recall(movement_id: int, *, timeout: float = 5.0) -> MovementWrapper

Recall one of your movements (mcm), as the client's retreat and "send home" buttons do.

Which movements the client lets you recall is listed on CancelMovementRequest: in short, your own that are still heading to their target (attacks only within 600 seconds of leaving, with exceptions) and your supports in either direction. The reply also updates state and fires GameState.on_movement_recalled.

Parameters:

Name Type Description Default
movement_id int

The movement to recall (Movement.movement_id)

required
timeout float

Timeout in seconds

5.0

Returns:

Type Description
MovementWrapper

The movement as the reply has it now, normally on its way home

Raises:

Type Description
CommandError

The server refused the recall, such as INVALID_STARTAREA_FOR_CANCEL_MOVEMENT (189)

Client: CastleAskRetreatDialog.onClick (bundle line 33234), MCMCommand.executeCommand (bundle line 126041)

send_resources

send_resources(source_castle_id: int, target_x: int, target_y: int, goods: dict[Resource, int], *, horse_booster_id: Horse | None = None, feathers: bool = False, slowdown: int = 0, spend_rubies: bool = False, timeout: float = 5.0) -> None

Send resources from one of your castles to a castle on the map, by carriage.

A horse that costs rubies, unless paid with feathers, and a slowdown spend rubies; see "Spending rubies" in the guides.

Nothing is sent when the goods fail a check the client makes before sending: an amount that is not a positive int (the client drops zeros and refuses a send of nothing; this raises on a zero instead), goods from more than one of the dialog's tabs (classic, kingdom, mead), or, once the player is known and has no Legendary level, anything but wood, stone and food (the client then shows only that tab). The client sends one tab's goods per send, and the server refuses a send that mixes tabs with INVALID_PARAMETER_VALUE (seen live for wood with coal and coal with honey).

Not checked, since they depend on the target or on data this call does not have: the target owner's level for kingdom resources and legend level for mead goods, at most 2 goods (wood and stone) to a monument or laboratory, the carriage capacity and the castle's stock.

Parameters:

Name Type Description Default
source_castle_id int

The castle the carriages leave from, one of yours

required
target_x int

Map x of the target castle

required
target_y int

Map y of the target castle

required
goods dict[Resource, int]

Amount per resource, all from one tab, such as {Resource.WOOD: 1000, Resource.STONE: 500} or {Resource.COAL: 500, Resource.OIL: 500}

required
horse_booster_id Horse | None

The horse, None for none; sent as none whenever feathers are used, as the client does

None
feathers bool

Pay for the horse with feathers

False
slowdown int

Seconds to delay the arrival by; costs rubies

0
spend_rubies bool

Allow a horse or slowdown that costs rubies

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
UnsendableGoodsError

The goods fail one of the checks above

UnknownCastleError

source_castle_id is not in your castle list

ValueError

The horse or slowdown costs rubies and spend_rubies is False

GameDataNotLoadedError

A horse is picked without feathers and the game data cannot be loaded

Client: CastlePostSendGoodsDialog.sendGoods (bundle line 33378), which sends castleList.getKingdomIdByCastleId of the source castle as KID; CastleSendGoodsDialog.sendGoodsCastle (bundle line 27202), which refuses a zero sum; CollectableParser._createGoodsList (bundle line 40530), which drops zero amounts; CastleSendGoodsComponent.rewardList (bundle line 44340), which sends one tab's goods, and setTabVisibility (bundle line 44261), which shows the kingdom and mead tabs only to a legend. Not mirrored: applySpecialLevelRestrictions (bundle line 44289) and isBoosterArea (bundle line 44356).

get_market_info

get_market_info(*, timeout: float = 5.0) -> list[MarketCastle]

List every castle's market carriages, those not on the road, and its resources.

Example
for castle in client.movements.get_market_info():
    print(castle.castle_id, castle.available_carriages, "/", castle.total_carriages)

send_support

send_support(source_castle_id: int, target_x: int, target_y: int, units: WodAmountMapping | Sequence[WodAmount], commander_id: int, wait_time: int = 12, use_premium_commander: bool = False, horse_booster_id: Horse | None = None, feathers: bool = False, slowdown: int = 0, *, alliance_tower: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> SendSupportResponse

Send support troops from a castle to a target location and return the server's reply.

The server refuses a support to your own area with NO_SELF_DESTRUCTION (92); move troops between your own areas with send_troops, and support a daimyo township with send_township_support.

A support led by the premium commander is refused before sending when it may cost rubies, unless spend_rubies is True; see client.commanders.premium_send. So is a horse that costs rubies, unless paid with feathers, and a slowdown; see "Spending rubies" in the guides.

Parameters:

Name Type Description Default
source_castle_id int

The castle the troops leave from, one of yours: CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

required
target_x int

Target X coordinate

required
target_y int

Target Y coordinate

required
units WodAmountMapping | Sequence[WodAmount]

The units: {Unit.X: 100}, or pairs one per slot; the client sends no tools

required
commander_id int

Commander to lead the support, a Commander.commander_id from client.commanders.get_commanders(). There is no default: 0 is a real commander (the free starting one), and the client never sends a support without a commander (with none picked it leads with the premium one, -14)

required
wait_time int

Station duration in hours (0-12, default: 12)

12
use_premium_commander bool

Lead with the premium commander (commander_id -14). It uses one of your free premium commanders, or costs rubies when none is left and no premium account runs

False
horse_booster_id Horse | None

The horse, None for none; sent as none whenever feathers are used, as the client does

None
feathers bool

Pay for the movement with feathers

False
slowdown int

Movement slowdown modifier (0 = none, default: 0); costs rubies

0
alliance_tower bool

The target is a Beyond the Horizon tower: sent as tde, as the client does for that target, and answered with a SendTowerSupportResponse

False
timeout float

Timeout in seconds

5.0
spend_rubies bool

Send even when the premium commander, the horse or the slowdown costs rubies

False

Raises:

Type Description
PremiumCommanderCostError

The premium commander leads, may cost rubies, and spend_rubies is False

ValueError

The horse or slowdown costs rubies and spend_rubies is False

GameDataNotLoadedError

The premium commander leads, VIP time runs and the game data cannot be loaded; or a horse is picked without feathers before it was called

CommandError

The server refused the support

Client: CastleAttackData.sendSupport (bundle line 133904) sends tde when the target's area type is AREA_TYPE_ALLIANCE_BATTLE_GROUND_TOWER, else cds

send_township_support

send_township_support(source_castle_id: int, target_x: int, target_y: int, units: WodAmountMapping | Sequence[WodAmount], *, timeout: float = 5.0) -> SendTownshipSupportResponse

Send support troops from a castle to a daimyo township and return the server's reply.

The client sends no commander, horse, wait time or slowdown with it.

Parameters:

Name Type Description Default
source_castle_id int

The castle the troops leave from, one of yours: CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

required
target_x int

The township's map x

required
target_y int

The township's map y

required
units WodAmountMapping | Sequence[WodAmount]

The units: {Unit.X: 100}, or pairs one per slot

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

No units are given, which the client refuses

CommandError

The server refused the support

Client: CastleSupportDefenceDialog.closeScreen (bundle line 122483) refuses an empty army and picks ACTION_TYPE_SUPPORTDEFENSE_TOWNSHIP for an AREA_TYPE_DAIMYO_TOWNSHIP, which OpenPostAttackDialogCommand.execute (bundle line 99685) sends as cdd

send_troops

send_troops(source_x: int, source_y: int, target_x: int, target_y: int, units: WodAmountMapping | Sequence[WodAmount], commander_id: int, *, kingdom_id: Kingdom = GREEN, use_premium_commander: bool = False, spend_rubies: bool = False, horse_booster_id: Horse | None = None, feathers: bool = False, slowdown: int = 0, timeout: float = 5.0) -> None

Send troops from one of your areas to another of your own, where they stay.

This is how the client moves troops between your own areas; a support (send_support) to your own area is refused with NO_SELF_DESTRUCTION (92). While the troops are heading out they can be recalled with client.movements.recall.

Targets the client offers: your castle (main or kingdom castle), your outposts not under conquer control, your villages and resource islands, your royal towers, monuments and laboratories, and your Berimond camps. Sources: your castles and outposts (not occupied ones), villages, resource islands, royal towers, monuments and laboratories. Both must sit in the same kingdom; to move troops between kingdoms use transfer_units_to_kingdom.

Rubies as for send_support: the premium commander, a horse that costs rubies unless paid with feathers, and a slowdown need spend_rubies.

Client: CastleTroopSupportData.sendTroops (bundle line 38420); the targets from the canBeTroupsSended overrides (CastleMapobjectVO bundle line 18917, OutpostMapobjectVO 18819, KingstowerMapobjectVO 19075, FactionCampMapobjectVO 21530, VillageMapobjectVO 22673, UpgradableLandmarkMapobjectVO 42648), the sources from CastleStartAttackDialog.fillCastleList (bundle line 14725)

Parameters:

Name Type Description Default
source_x int

Map x of the area the troops leave from

required
source_y int

Map y of the area the troops leave from

required
target_x int

Map x of the area they go to

required
target_y int

Map y of the area they go to

required
units WodAmountMapping | Sequence[WodAmount]

The units, then any tools: {Unit.X: 100}, or pairs one per slot

required
commander_id int

Commander to lead them, a Commander.commander_id from client.commanders.get_commanders(); 0 is the free starting one

required
kingdom_id Kingdom

The kingdom both areas sit in

GREEN
use_premium_commander bool

Lead with the premium commander (commander_id -14). It uses one of your free premium commanders, or costs rubies when none is left and no premium account runs

False
spend_rubies bool

Send even when the premium commander, the horse or the slowdown costs rubies

False
horse_booster_id Horse | None

The horse, None for none; sent as none whenever feathers are used, as the client does

None
feathers bool

Pay for the horse with feathers

False
slowdown int

Seconds to delay the arrival by; costs rubies

0
timeout float

Timeout in seconds

5.0

Raises:

Type Description
PremiumCommanderCostError

The premium commander leads, may cost rubies, and spend_rubies is False; see client.commanders.premium_send

ValueError

The horse or slowdown costs rubies and spend_rubies is False

GameDataNotLoadedError

The premium commander leads, VIP time runs and the game data cannot be loaded; or a horse is picked without feathers before it was called

get_travel_info

get_travel_info(source_x: int, source_y: int, target_x: int, target_y: int, *, kingdom_id: Kingdom = GREEN, timeout: float = 5.0) -> GetTravelInfoResponse

Get the pre-calculation of troops sent from one of your areas to another, before send_troops.

This is what the client asks for when it opens the dialog to send troops: the target's map row and owner, and your units and tools at the source. The commanders it carries update client.state. The travel time and cost are not in the reply; the client works them out from the units picked.

Parameters:

Name Type Description Default
source_x int

Map x of the area the troops would leave from

required
source_y int

Map y of the area the troops would leave from

required
target_x int

Map x of the area they would go to

required
target_y int

Map y of the area they would go to

required
kingdom_id Kingdom

The kingdom both areas sit in

GREEN
timeout float

Timeout in seconds

5.0

Raises:

Type Description
CommandError

The server refused it, NOT_IN_OWNED_CASTLE when the source is not one of your areas

Client: C2STroopSupportInfoVO (bundle line 72087), sent by CastleStartAttackDialog (bundle line 14831); STICommand (bundle line 129095)

transfer_units_to_kingdom

transfer_units_to_kingdom(source_castle_id: int, target_kingdom_id: Kingdom, units: WodAmountMapping | Sequence[WodAmount], *, target_castle_id: int = -1, timeout: float = 5.0) -> None

Send units from one of your castles to another kingdom.

Parameters:

Name Type Description Default
source_castle_id int

The castle the units leave from, one of yours

required
target_kingdom_id Kingdom

The kingdom to send them to

required
units WodAmountMapping | Sequence[WodAmount]

The units, {Unit.X: 100}

required
target_castle_id int

Object id of a picked target castle, -1 for none

-1
timeout float

Timeout in seconds

5.0

Raises:

Type Description
UnknownCastleError

source_castle_id is not in your castle list

Client: CastleTransferTroopsToKingdomProperties.getUnitTransferCommand (bundle line 37448) sends the source castle's kingdomID as SKID

transfer_goods_to_kingdom

transfer_goods_to_kingdom(source_castle_id: int, target_kingdom_id: Kingdom, goods: dict[Resource, int], *, timeout: float = 5.0) -> None

Send goods from one of your castles to your castle in another kingdom.

The goods pass the checks of send_resources, since the client sends them from the same send component: positive amounts, one tab per send, classic goods only below Legendary level. The source castle may not sit in the target kingdom or in Berimond, which the client leaves out of its castle picker, and the target kingdom must hold a castle of yours, which the client sends the goods to. The travel tax and the target's storage are left to the server.

Parameters:

Name Type Description Default
source_castle_id int

The castle the goods leave from, one of yours

required
target_kingdom_id Kingdom

The kingdom to send them to

required
goods dict[Resource, int]

Amount per resource, all from one tab, such as {Resource.WOOD: 1000}

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
UnsendableGoodsError

The goods fail one of the checks of send_resources

ValueError

The source castle sits in the target kingdom or in Berimond, or no castle of yours sits in the target kingdom

UnknownCastleError

source_castle_id is not in your castle list

Client: CastleTransferResourcesDialog.sendResources (bundle line 38082) sends the picked castle's kingdomID as SKID; its castle picker leaves out CastleTransferResToKingdomProperties.exceptingKingdomIDs (bundle line 55533), and targetInitialized (bundle line 55553) needs getMainCastleByKingdomID of the target kingdom; CastleSendGoodsComponent.setTabVisibility (bundle line 44261)

skip_kingdom_transfer_time

skip_kingdom_transfer_time(kingdom_id: Kingdom, transfer_type: KingdomTransferType, minute_skip: Currency | str, *, timeout: float = 5.0) -> None

Shorten the units or goods on their way to a kingdom with a minute skip item.

Each kingdom has at most one units transfer and one goods transfer on the way; client.state.get_kingdoms() lists them. skip_kingdom_transfer finishes one at once for rubies.

Parameters:

Name Type Description Default
kingdom_id Kingdom

The kingdom the transfer goes to

required
transfer_type KingdomTransferType

KingdomTransferType.UNITS or GOODS

required
minute_skip Currency | str

The minute skip to use, Currency.SKIP_1_MINUTE to SKIP_24_HOURS; its key ("MS1") also works, for a skip newer than the generated enum

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

minute_skip is no minute skip, or the special currencies hold none of it

Client: KingdomUnitsTravelMinuteSkipProperties.getMinuteSkipCommand (bundle line 37497), KingdomGoodsTravelMinuteSkipProperties.getMinuteSkipCommand (bundle line 55567); CastleMinuteSkipDialog.showLoaded (bundle line 7671); MSKCommand (bundle line 125795)

transfer_goods_to_treasure_map

transfer_goods_to_treasure_map(map_id: TreasureMapId | int, source_castle_id: int, goods: dict[Resource, int], *, timeout: float = 5.0) -> None

Send wood, stone and food from one of your castles to a season's treasure map camp.

The goods pass the checks of send_resources, and only the classic goods go: the client hides the other tabs, and the camp stores only those. The source castle may not sit in Berimond, which the client leaves out of its castle picker. The camp's free storage, the travel tax and the season's time left are left to the server. client.map.treasure_maps shows the goods on their way.

Parameters:

Name Type Description Default
map_id TreasureMapId | int

The season's treasure map

required
source_castle_id int

The castle the goods leave from, one of yours

required
goods dict[Resource, int]

Amount per resource, such as {Resource.WOOD: 1000}

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
UnsendableGoodsError

The goods fail one of the checks of send_resources, or hold more than wood, stone and food

ValueError

The source castle sits in Berimond

UnknownCastleError

source_castle_id is not in your castle list

CommandError

The server refused the transfer, NOT_ENOUGH_RESOURCES among others

Client: CastleTransferResToSeasonProperties (bundle lines 99566-99588): exceptingKingdomIDs, hideTabs, getSendResourcesCommand; TreasureMapVO.parseStorage (bundle line 140575); TGTCommand (bundle line 129068)

transfer_units_to_treasure_map

transfer_units_to_treasure_map(map_id: TreasureMapId | int, source_castle_id: int, units: WodAmountMapping | Sequence[WodAmount], *, timeout: float = 5.0) -> None

Send units from one of your castles to a season's treasure map camp.

The source castle may not sit in Berimond, which the client leaves out of its castle picker. The camp's free unit slots (TreasureMapStorage.free_unit_slots) and the season's time left are left to the server. client.map.treasure_maps shows the units on their way.

Parameters:

Name Type Description Default
map_id TreasureMapId | int

The season's treasure map

required
source_castle_id int

The castle the units leave from, one of yours

required
units WodAmountMapping | Sequence[WodAmount]

The units, {Unit.X: 100}

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

The source castle sits in Berimond

UnknownCastleError

source_castle_id is not in your castle list

CommandError

The server refused the transfer

Client: CastleTransferTroopsToSeasonProperties (bundle lines 55367-55392): exceptingKingdomID, getUnitTransferCommand; TUTCommand (bundle line 129118)

skip_treasure_map_transfer

skip_treasure_map_transfer(map_id: TreasureMapId | int, transfer_type: KingdomTransferType, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Let the units or goods on their way to a season's treasure map arrive at once, for rubies.

The request names the season event the map belongs to, taken from the running events.

Parameters:

Name Type Description Default
map_id TreasureMapId | int

The season's treasure map

required
transfer_type KingdomTransferType

KingdomTransferType.UNITS or GOODS

required
spend_rubies bool

Allow the rubies the skip costs

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

spend_rubies is False, or no running season event has this map

CommandError

The server refused the skip

Client: CastleStartSeasonEventDialogSupport.onMouseUp (bundle lines 99541, 99543) sends the season's eventId; the skip costs the map's skipCostC2 rubies (bundle line 99514); TKTCommand (bundle line 129088)

skip_treasure_map_transfer_time

skip_treasure_map_transfer_time(map_id: TreasureMapId | int, transfer_type: KingdomTransferType, minute_skip: Currency | str, *, timeout: float = 5.0) -> None

Shorten the units or goods on their way to a season's treasure map with a minute skip item.

Parameters:

Name Type Description Default
map_id TreasureMapId | int

The season's treasure map

required
transfer_type KingdomTransferType

KingdomTransferType.UNITS or GOODS

required
minute_skip Currency | str

The minute skip used, Currency.SKIP_1_MINUTE to SKIP_24_HOURS

required
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

No running season event has this map, or minute_skip is no minute skip you hold

CommandError

The server refused the skip

Client: SeasonTravelGoodsMinuteSkipProperties.getMinuteSkipCommand and SeasonTravelUnitsMinuteSkipProperties.getMinuteSkipCommand (bundle lines 99612, 99644); MSMCommand (bundle line 125852)

skip_kingdom_transfer

skip_kingdom_transfer(kingdom_id: Kingdom, transfer_type: KingdomTransferType, *, spend_rubies: bool = False, timeout: float = 5.0) -> None

Finish the units or goods on their way to a kingdom at once, for rubies.

The price is the kingdom's skipUnitTravelC2Cost or skipResourceTravelC2Cost in the items kingdoms table, less any ruby discount. Once a kpi is known, the transfer must be on its way there with a second left at least, as the client offers it only then.

Parameters:

Name Type Description Default
kingdom_id Kingdom

The kingdom the transfer goes to

required
transfer_type KingdomTransferType

KingdomTransferType.UNITS or GOODS

required
spend_rubies bool

Allow spending the rubies

False
timeout float

Timeout in seconds

5.0

Raises:

Type Description
ValueError

spend_rubies is False, or no such transfer is on its way

CommandError

The server refused

Client: CastleHandleKingdomDialogSupport.onClick (bundle lines 98420, 98422) sends C2SKingdomSkipTransferVO while remainingTimeInSeconds >= 1, its button priced with skipUnitTravelC2Cost / skipResourceTravelC2Cost (bundle line 98398); KSTCommand (bundle line 124755)

movements.tracked

A tracked army movement, with its timing and troops.

Classes:

Name Description
MovementResources

Resources a movement carries: the goods among its market goods or travel loot, added up.

Movement

A live army movement (Attack, Support, Transport, ...) tracked in state.

Attributes:

Name Type Description
logger
DUNGEON_OWNER_IDS

Owner ids the game counts as dungeon owners. Robber barons, kingdom dungeons,

logger module-attribute

logger = logging.getLogger(__name__)

DUNGEON_OWNER_IDS module-attribute

DUNGEON_OWNER_IDS = frozenset({*(NPCOwner.ROBBER_BARON - i for i in range(13)), *(NPCOwner.DESERT_DUNGEON - i for i in range(5)), NPCOwner.DESERT_BOSS_DUNGEON, NPCOwner.ICE_BOSS_DUNGEON, NPCOwner.VOLCANO_BOSS_DUNGEON, *range(NPCOwner.ISLAND_VILLAGE, NPCOwner.ISLAND_VILLAGE + 5), NPCOwner.URSIDAE_KING, NPCOwner.GERBRANDT_KING, NPCOwner.ROYAL_TOWER, NPCOwner.MONUMENT, NPCOwner.CLASSIC_LABORATORY, NPCOwner.ICE_LABORATORY, NPCOwner.DESERT_LABORATORY, NPCOwner.VOLCANO_LABORATORY, NPCOwner.RANDOM_DUNGEON_EVENT, NPCOwner.APRIL_DUNGEON_EVENT, NPCOwner.ST_PATRICKS_DAY_DUNGEON_EVENT, NPCOwner.EASTER_DUNGEON_EVENT, *(NPCOwner.NOMAD_CAMP - i for i in range(4)), NPCOwner.SAMURAI_CAMP, NPCOwner.TUTORIAL_DUNGEON, NPCOwner.THORN_KING_DUNGEON, NPCOwner.THORN_KING_VILLAGE, NPCOwner.THORN_KING_COW_DUNGEON, NPCOwner.BLADE_COAST_DUNGEON, NPCOwner.BLADE_COAST_SHIPS, NPCOwner.TREASURE_HUNT_DUNGEON, NPCOwner.UNDERWORLD_DUNGEON, NPCOwner.UNDERWORLD_VILLAGE, NPCOwner.ALLIANCE_NOMAD_CAMP, NPCOwner.DAIMYO_CASTLE, NPCOwner.ALIEN_INVASION, NPCOwner.BLOODCROW_INVASION, *(owner for owner in NPCOwner if owner.name.startswith('COLLECTOR_')), NPCOwner.WOLFGARD, NPCOwner.ARE_PORTAL, NPCOwner.UNKNOWN_EVENT_OWNER})

Owner ids the game counts as dungeon owners. Robber barons, kingdom dungeons, villages and nomad camps are runs of ids (see NPCOwner).

MovementResources pydantic-model

Bases: EmpireModel

Resources a movement carries: the goods among its market goods or travel loot, added up.

Keys are the client's collectable server keys (CollectableItem*VO.SERVER_KEY). Goods sent as an old-style amounts list count as well; coins, rubies and currencies are in Movement.goods only.

Fields:

model_config class-attribute

model_config: ConfigDict = ConfigDict(extra='ignore', populate_by_name=True)

wood pydantic-field

wood: int = 0

Wire key W

stone pydantic-field

stone: int = 0

Wire key S

food pydantic-field

food: int = 0

Wire key F

coal pydantic-field

coal: int = 0

Wire key C

oil pydantic-field

oil: int = 0

Wire key O

glass pydantic-field

glass: int = 0

Wire key G

iron pydantic-field

iron: int = 0

Wire key I

aquamarine pydantic-field

aquamarine: int = 0

Wire key A

honey pydantic-field

honey: int = 0

Wire key HONEY

mead pydantic-field

mead: int = 0

Wire key MEAD

beef pydantic-field

beef: int = 0

Wire key BEEF

total property

total: int

Total resources in transport.

is_empty property

is_empty: bool

Check if no resources are being transported.

Movement pydantic-model

Bases: EmpireModel

A live army movement (Attack, Support, Transport, ...) tracked in state.

This is the movement type the client returns from get_movements and passes to on_incoming_attack callbacks, and the one exported as empire_core.Movement.

The raw gam reply is modelled as empire_core.movements.GetMovementsResponse: a list of MovementWrapper entries, each holding a MovementRecord. Use those only when parsing packets by hand.

Whether a movement is yours or aimed at you depends on the local player's id, which state stamps on every movement as local_player_id.

Client: BasicMapmovementVO, ArmyAttackMapmovementVO.

Fields are snake_case with the wire key as the alias (movement_id is MID), so a raw gam record validates unchanged and either name works when building one.

Fields:

Validators:

model_config class-attribute

model_config: ConfigDict = ConfigDict(extra='ignore', populate_by_name=True)

movement_id pydantic-field

movement_id: int = -1

Wire key MID

Movement id

movement_type pydantic-field

movement_type: EnumOrInt[MovementType] = MovementType.ATTACK

Wire key T

The movement's type

progress_time pydantic-field

progress_time: int = 0

Wire key PT

Seconds travelled at last_updated

total_time pydantic-field

total_time: int = 0

Wire key TT

Seconds the trip takes

direction pydantic-field

direction: int = 0

Wire key D

1 = returning home, 0 = heading to the target

target_id pydantic-field

target_id: int = -1

Wire key TID

Player id owning the target area

kingdom pydantic-field

kingdom: Kingdom = Kingdom.GREEN

Wire key KID

The kingdom the movement is in

source_id pydantic-field

source_id: int = -1

Wire key SID

Player id owning the source area

owner_id pydantic-field

owner_id: int = -1

Wire key OID

Player id owning the movement

horse_booster pydantic-field

horse_booster: EnumOrInt[Horse] | None = None

Wire key HBW

The horse booster; None for none or when paid with feathers

target_area pydantic-field

target_area: MovementArea | None = None

Wire key TA

Target area row; None when there is none

source_area pydantic-field

source_area: MovementArea | None = None

Wire key SA

Source area row; None when there is none

target_area_id pydantic-field

target_area_id: int = -1

Target area id

source_area_id pydantic-field

source_area_id: int = -1

Source area id

target_x pydantic-field

target_x: int = -1

Target x

target_y pydantic-field

target_y: int = -1

Target y

source_x pydantic-field

source_x: int = -1

Source x

source_y pydantic-field

source_y: int = -1

Source y

target_type pydantic-field

target_type: EnumOrInt[MapItemType] = -1

Target area type, -1 for no target area

local_player_id pydantic-field

local_player_id: int = -1

Player id of the receiving account, -1 if unknown

units pydantic-field

units: WodAmounts

Units and tools, by how many

estimated_size pydantic-field

estimated_size: int = 0

Army size estimate when the army is hidden

resources pydantic-field

resources: MovementResources

Goods carried

target_name pydantic-field

target_name: str = ''

Target area name

source_name pydantic-field

source_name: str = ''

Source area name

target_player_name pydantic-field

target_player_name: str = ''

Name of the target's owner

source_player_name pydantic-field

source_player_name: str = ''

Name of the movement's owner

target_alliance_name pydantic-field

target_alliance_name: str = ''

Alliance name of the target's owner

source_alliance_name pydantic-field

source_alliance_name: str = ''

Alliance name of the movement's owner

created_at pydantic-field

created_at: float

When state first saw this movement

last_updated pydantic-field

last_updated: float

When the last packet for it was applied

commander pydantic-field

commander: Commander | None = None

The commander leading the army, as the UM block sends it; None when there is none

wait_total pydantic-field

wait_total: int = 0

Seconds the army stays at its target

wait_passed pydantic-field

wait_passed: int = 0

Seconds of that wait already passed

force_cancelable pydantic-field

force_cancelable: bool = False

The movement can be force-cancelled

spy pydantic-field

spy: MovementSpy | None = None

A spy mission's type, accuracy or damage, spy count and risk; None for any other

owner pydantic-field

owner: MovementOwner | None = None

Owner record of the movement's owner

target_owner pydantic-field

target_owner: MovementOwner | None = None

Owner record of the target's owner

attack_type pydantic-field

attack_type: int | None = None

AttackType value

is_shadow pydantic-field

is_shadow: bool = False

Shadow movement

support_tools pydantic-field

support_tools: SupportToolSlots = ()

Support tools sent along, as the attack sent them; None for an empty slot

auto_skip_cooldown_type pydantic-field

auto_skip_cooldown_type: EnumOrInt[AutoSkipCooldownType] = AutoSkipCooldownType.OFF

How the target's cooldown is skipped on arrival

advisor_type pydantic-field

The attack advisor that sent the attack

advisor_movement_count pydantic-field

advisor_movement_count: int = 0

Attacks in the advisor series

advisor_movement_number pydantic-field

advisor_movement_number: int = 0

This attack's place in the series

advisor_is_last pydantic-field

advisor_is_last: bool = False

Last attack of the series

market_carriages pydantic-field

market_carriages: int = 0

Carriages of a market transport

goods pydantic-field

goods: CollectableRows = ()

Goods a market transport carries, or loot

movement_type_name property

movement_type_name: str

Get the name of the movement type.

time_remaining property

time_remaining: int

Seconds until arrival, advancing with wall-clock time.

Extrapolated from the last packet snapshot (total_time - progress_time at last_updated), so it keeps counting down between updates.

progress_percent property

progress_percent: float

estimated_arrival property

estimated_arrival: float

When the army reaches its target (Unix time).

estimated_end property

estimated_end: float

When the movement is over: arrival plus whatever wait at the target is left.

Client: BasicMapmovementVO._endWaitTimeStamp.

owner_alliance_id property

owner_alliance_id: int

Alliance of the movement's owner, -1 if none or unknown.

target_alliance_id property

target_alliance_id: int

Alliance of the target's owner, -1 if none or unknown.

battle_time property

battle_time: float

When the battle starts (Unix time): arrival plus the wait at the target.

Client: BasicMapmovementVO.parseUnitMovement.

is_stationed property

is_stationed: bool

The army has arrived and is waiting at its target, as a support does.

Client: SupportDefenceMapmovementVO.isStationed.

is_returning property

is_returning: bool

The army is on its way home, whatever its type.

is_mine property

is_mine: bool

The local player owns this movement.

is_outgoing property

is_outgoing: bool

One of the local player's armies heading to its target.

is_incoming property

is_incoming: bool

Another player's army heading to one of the local player's areas.

The daimyo township counts as yours, as in the client, except for an alien attack, which comes only at you. Armies moving between your own areas count as outgoing, not incoming, and so does no occupation (is_occupation): the forces holding an area are not on their way to it.

Client: ArmyAttackMapmovementVO.isAttackingMovement (bundle line 14389), AlienAttackMovementVO.isAttackingMovement (bundle line 33073). An occupation is a SiegeMapmovementVO, which keeps BasicMapmovementVO.isAttackingMovement (bundle line 19438, always false); the movement overview's attack category (FilterAttack, dialog_moveOverview_catAttack, bundle line 67996) adds one on your area by a clause of its own, and lists it as "Occupying forces" (RenderSiege, bundle line 67408), not as an attack under way.

is_attack property

is_attack: bool

Any attack type, including NPC, alien, faction and event attacks.

is_support property

is_support: bool

A support (defence) army.

is_occupation property

is_occupation: bool

An occupation: the forces holding an area a capture attack won, until it is captured or they are driven off.

is_transport property

is_transport: bool

A market transport of resources. Troops moved between own castles are is_travel.

is_travel property

is_travel: bool

Troops moved between the owner's own areas.

An army's way home also arrives as a new TRAVEL movement, with D == 1.

is_spy property

is_spy: bool

A spy mission.

unit_count property

unit_count: int

Total number of units in this movement (includes all unit types).

troop_count property

troop_count: int

Count of actual troops only (excludes equipment/tools).

Note: without loaded game data, the first access loads it through GameData.load (blocking HTTP unless cached on disk). If that fails, all units are counted and the load is retried after a cooldown.

has_arrived

has_arrived() -> bool

Check if movement has arrived (time remaining <= 0).

format_time_remaining

format_time_remaining() -> str

Format time remaining as human-readable string.

movements.models.movement

Army movement models: gam, the recall (mcm), and the movement wrappers pushed with abr and asr.

Classes:

Name Description
GetMovementsRequest

Get all active troop movements.

MovementArea

A movement's TA or SA area row, read as a map row.

MovementRecord

The movement itself: the M inside each gam wrapper.

MovementArmy

A visible army: three flanks plus the courtyard wave, each {Unit or Tool: amount}.

MovementUnitInfo

Commander and wait details: a wrapper's UM.

MovementMarket

A market transport's cargo: a wrapper's MM.

MovementSpy

A spy mission's details: a wrapper's S.

MovementWrapper

One entry of gam's M list, and the A of an abr/asr push or an mcm reply.

MovementOwner

An owner record: one entry of O in gam, abr and asr.

GetMovementsResponse

Response containing active movements.

SetMovementFilterRequest

Show or hide one kind of movement on the map; the server answers with the filters as an mvf.

CancelMovementRequest

Recall one of your movements, turning it back home.

CancelMovementResponse

The reply to a recall: the movement as it now stands.

SentMovementResponse

The reply to a movement you send: the new movement, its owners and your coins and rubies after.

Functions:

Name Description
names_a_movement

Whether a movement slot holds one: a wrapper whose M is an object with an MID.

logger module-attribute

logger = logging.getLogger(__name__)

NO_HORSE module-attribute

NO_HORSE = -1

The horse a movement request names when it takes none, or pays for its horse with feathers.

HorseBoosterId module-attribute

HorseBoosterId = Annotated[Literal[-1] | EnumOrInt['Horse'], Field(union_mode='left_to_right')]

A movement request's HBW: a Horse, or NO_HORSE.

Client: BasicMapmovementVO (bundle lines 19383, 15445) reads -1 as no horse

GetMovementsRequest pydantic-model

Bases: BaseRequest

Get all active troop movements.

Command: gam Payload: {}

Client: C2SGetAllMovementsVO (bundle line 129713, no fields)

MovementArea pydantic-model

Bases: BasePayload

A movement's TA or SA area row, read as a map row.

area_type, x and y are the first three positions, which every area type has; item is the whole row read by the area type's own parser, None when the client reads no row of that type, or (with a warning) when a value is of the wrong kind. The row carries no kingdom of its own, so it is read in the movement's KID: build one from {"row": [...], "kingdom": KID}, or from the bare row, read in the green kingdom.

Client: BasicMapmovementVO.loadFromParamObject reads SA and TA with WorldmapObjectFactory.parseWorldMapArea (bundle lines 19383, 5343), as the map reads its rows

Fields:

Validators:

  • _from_row

area_type pydantic-field

area_type: int

Area type

x pydantic-field

x: int

Map x

y pydantic-field

y: int

Map y

item pydantic-field

item: MapAreaItem | None = None

The row as its area type's parser reads it; None when it cannot be read

position property

position: Position

object_id property

object_id: int | None

The map object's id, as the area type's row gives it; None when it gives none.

owner_id property

owner_id: int | None

The owner the row names; None when it names none.

name property

name: str

The object's name; empty when the row has none.

MovementRecord pydantic-model

Bases: BasePayload

The movement itself: the M inside each gam wrapper.

Client: MapmovementFactory.parseMapMovement (split.js line 667779) reads T with int(); BasicMapmovementVO.loadFromParamObject (split.js line 87574) keeps MID as sent, reads the other numbers with int() and the areas with WorldmapObjectFactory.parseWorldMapArea (split.js line 30594), which gives no area for a falsy row

Fields:

Validators:

movement_id pydantic-field

movement_id: int

Wire key MID

Movement id

movement_type pydantic-field

movement_type: EnumOrInt[MovementType] = MovementType.ATTACK

Wire key T

The movement's type

progress_time pydantic-field

progress_time: ClientInt = 0

Wire key PT

Seconds travelled when the reply was sent

total_time pydantic-field

total_time: ClientInt = 0

Wire key TT

Seconds the trip takes

direction pydantic-field

direction: ClientInt = 0

Wire key D

1 = returning home, 0 = heading to the target

target_id pydantic-field

target_id: ClientInt = -1

Wire key TID

Player id owning the target area

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

The kingdom the movement is in

source_id pydantic-field

source_id: ClientInt = -1

Wire key SID

Player id owning the source area

owner_id pydantic-field

owner_id: ClientInt = -1

Wire key OID

Player id owning the movement

horse_booster pydantic-field

horse_booster: EnumOrInt['Horse'] | None = None

Wire key HBW

The horse booster; None for none or when paid with feathers

target_area pydantic-field

target_area: MovementArea | None = None

Wire key TA

Target area; None when there is none or it cannot be read

source_area pydantic-field

source_area: MovementArea | None = None

Wire key SA

Source area; None when there is none or it cannot be read

is_returning property

is_returning: bool

Client: BasicMapmovementVO.isReturnHome.

MovementArmy pydantic-model

Bases: BasePayload

A visible army: three flanks plus the courtyard wave, each {Unit or Tool: amount}.

Client: CastleCompactArmyVO.parseSimpleArmy / parseYardWave (bundle lines 67525, 67529) read each into a UnitInventoryDictionary, which adds up an id sent twice.

Fields:

left pydantic-field

left: WodAmounts

Wire key L

Left flank

middle pydantic-field

middle: WodAmounts

Wire key M

Middle

right pydantic-field

right: WodAmounts

Wire key R

Right flank

courtyard pydantic-field

courtyard: WodAmounts

Wire key RW

Courtyard (yard) wave

MovementUnitInfo pydantic-model

Bases: BasePayload

Commander and wait details: a wrapper's UM.

Client: BasicMapmovementVO.parseUnitMovement (bundle line 19385), which hands L to LordFactory.createLord (bundle line 26399).

Fields:

Validators:

commander pydantic-field

commander: Commander | None = None

Wire key L

Commander leading the army; None when there is none

wait_passed pydantic-field

wait_passed: int = 0

Wire key PWD

Seconds of the wait at the target already passed

wait_total pydantic-field

wait_total: int = 0

Wire key TWD

Seconds the army waits at its target

advisor_type pydantic-field

Wire key AAT

The attack advisor that sent the attack

advisor_movement_count pydantic-field

advisor_movement_count: int = 0

Wire key AAC

Attacks in the advisor series

advisor_movement_number pydantic-field

advisor_movement_number: int = 0

Wire key AAN

This attack's place in the series

advisor_is_last pydantic-field

advisor_is_last: int = 0

Wire key AAL

1 on the series' last attack

MovementMarket pydantic-model

Bases: BasePayload

A market transport's cargo: a wrapper's MM.

Client: MarketMapmovementVO.parse_MM (bundle line 43706), which reads G with CollectableParserS2CParamList.createList (bundle line 40560)

Fields:

carriages pydantic-field

carriages: int = 0

Wire key C

Market carriages used

goods pydantic-field

goods: CollectableRows = ()

Wire key G

Goods carried

MovementSpy pydantic-model

Bases: BasePayload

A spy mission's details: a wrapper's S.

Client: SpyMapmovementVO.parseSpyInfo (bundle line 43748), which reads each through int().

Fields:

spy_type pydantic-field

spy_type: ClientInt = 0

Wire key ST

Kind of spy mission, a SpyType value

accuracy_or_damage pydantic-field

accuracy_or_damage: ClientInt = 0

Wire key SA

Accuracy percent, or damage percent for sabotage

spy_count pydantic-field

spy_count: ClientInt = 0

Wire key SC

Spies sent

risk pydantic-field

risk: ClientInt = 0

Wire key SR

Risk of being caught, percent

spy_type_enum property

spy_type_enum: SpyType | None

spy_type as a SpyType, None for a value the client does not define.

is_sabotage property

is_sabotage: bool

MovementWrapper pydantic-model

Bases: BasePayload

One entry of gam's M list, and the A of an abr/asr push or an mcm reply.

Which of the optional blocks are present depends on the movement type and on what the receiving player may see. A block that cannot be read reads as not sent, so it costs only itself. Keys this model does not name are kept, as on every payload.

Client: MapmovementFactory.parseMapMovement (split.js line 667779) and the loadFromParamObject of each movement class: ArmyAttackMapmovementVO (split.js line 77036), ArmyTravelMapMovementVO (split.js line 114881), TradeMapmovementVO (split.js line 310791), MarketMapmovementVO (split.js line 225968) and SpyMapmovementVO (split.js line 226172)

Fields:

Validators:

movement pydantic-field

movement: MovementRecord

Wire key M

The movement record

full_army pydantic-field

full_army: MovementArmy | None = None

Wire key FA

The full army, preferred over army

army pydantic-field

army: MovementArmy | None = None

Wire key GA

Army

army_size pydantic-field

army_size: ClientInt | None = None

Wire key GS

Estimated army size when the army is hidden

unit_info pydantic-field

unit_info: MovementUnitInfo | None = None

Wire key UM

Commander and wait details

attack_type pydantic-field

attack_type: EnumOrInt[AttackType] | None = None

Wire key ATT

The kind of attack; None for no attack

is_shadow pydantic-field

is_shadow: bool = False

Wire key SM

Shadow movement

force_cancelable pydantic-field

force_cancelable: bool = False

Wire key FC

The movement can be force-cancelled

support_tools pydantic-field

support_tools: SupportToolSlots = ()

Wire key AST

Support tools sent along, as the attack sent them; None for an empty slot

auto_skip_cooldown_type pydantic-field

auto_skip_cooldown_type: EnumOrInt[AutoSkipCooldownType] = AutoSkipCooldownType.OFF

Wire key ASCT

How the target's cooldown is skipped on arrival

travel_units pydantic-field

travel_units: WodAmounts

Wire key A

Units and tools of a travel movement

travel_goods pydantic-field

travel_goods: CollectableRows = ()

Wire key G

Loot a travel movement carries

traded_units pydantic-field

traded_units: WodAmounts

Wire key TRU

Units an Oasis Settlement trade brings back, among travel_units

market pydantic-field

market: MovementMarket | None = None

Wire key MM

Market transport cargo

spy pydantic-field

spy: MovementSpy | None = None

Wire key S

Spy mission details

visible_army property

visible_army: MovementArmy | None

FA if sent, else GA, as the client picks.

MovementOwner pydantic-model

Bases: BasePayload

An owner record: one entry of O in gam, abr and asr.

Client: WorldMapOwnerInfoVO.fillFromParamObject.

Fields:

Validators:

player_id pydantic-field

player_id: int

Wire key OID

Player id

name pydantic-field

name: str = ''

Wire key N

crest pydantic-field

crest: OwnerCrest | None = None

Wire key E

level pydantic-field

level: int = 0

Wire key L

legendary_level pydantic-field

legendary_level: int = 0

Wire key LL

Legendary level

beginner_protection_seconds pydantic-field

beginner_protection_seconds: int = -1

Wire key RNP

-1 when not protected

honor pydantic-field

honor: int = 0

Wire key H

might pydantic-field

might: int = 0

Wire key MP

top_x pydantic-field

top_x: int = -1

Wire key TOPX

Top-ranking placement, -1 for none

is_ruin pydantic-field

is_ruin: bool = False

Wire key R

The owner record is flagged as a ruin

alliance_id pydantic-field

alliance_id: int = -1

Wire key AID

-1 for no alliance

alliance_rank pydantic-field

alliance_rank: int = 0

Wire key AR

alliance_name pydantic-field

alliance_name: str = ''

Wire key AN

is_searching_alliance pydantic-field

is_searching_alliance: bool = False

Wire key SA

peace_seconds pydantic-field

peace_seconds: int = 0

Wire key RPT

Remaining peace time

castle_positions pydantic-field

castle_positions: OwnerPositions

Wire key AP

The player's castles

village_positions pydantic-field

village_positions: OwnerPositions

Wire key VP

The player's villages

has_premium pydantic-field

has_premium: bool = False

Wire key PF

has_vip pydantic-field

has_vip: bool = False

Wire key VF

is_dummy pydantic-field

is_dummy: bool = False

Wire key DUM

The owner record is a dummy

achievement_points pydantic-field

achievement_points: int = 0

Wire key AVP

relocation_seconds pydantic-field

relocation_seconds: int = 0

Wire key RRD

Seconds until a relocation ends

faction pydantic-field

faction: OwnerFaction | None = None

Wire key FN

title_prefix_id pydantic-field

title_prefix_id: EnumOrInt['Title'] | None = None

Wire key PRE

The title shown before the name; None for none

title_suffix_id pydantic-field

title_suffix_id: EnumOrInt['Title'] | None = None

Wire key SUF

The title shown after the name; None for none

via_refer_a_friend pydantic-field

via_refer_a_friend: bool = False

Wire key IRF

GetMovementsResponse pydantic-model

Bases: BaseResponse

Response containing active movements.

Command: gam Payload: {"M": [wrapper, ...], "O": [owner record, ...]}

Each entry is read on its own: one that names no movement (see names_a_movement) is skipped, and one that cannot be read is left out and its reason kept in unreadable_movements. An owner record without an OID is skipped, as the client skips it.

Client: GAMCommand.executeCommand (split.js line 638976) hands O to CastleOtherPlayerData.parseOwnerInfoArray (split.js line 693182), whose parseOwnerInfo (split.js line 693159) reads nothing without an OID, then the reply to CastleArmyData.parse_GAM (split.js line 667215), which hands M to parseMapMovementArray (split.js line 667169)

Fields:

Validators:

  • _movements_one_by_one
  • _readable_owners → owners

movements pydantic-field

movements: list[MovementWrapper]

Wire key M

Movement wrappers

owners pydantic-field

Wire key O

Owner records for every player the movements name

unreadable_movements pydantic-field

unreadable_movements: tuple[str, ...] = ()

Why each movement left out of movements could not be read

MovementRemovedResponse pydantic-model

Bases: BaseResponse

The server removing a movement: it arrived, was recalled home or was cancelled.

Command: mrm, a push.

Client: MRMCommand.executeCommand (bundle line 126109) hands MID as sent to CastleArmyData.parse_MRM (bundle line 133682) and removeArmyMovementById (bundle line 133726), whose map lookup finds only a number

Fields:

Validators:

movement_id pydantic-field

movement_id: int | None = None

Wire key MID

The movement removed; None when the server sent no whole number, which names none

MovementForceCancelableResponse pydantic-model

Bases: BaseResponse

A movement of yours can now be force-cancelled.

Command: mfc, a push.

Client: MFCCommand.executeCommand (bundle line 126094), CastleArmyData.parse_MFC (bundle line 133683), which looks MID up as sent and sets isForceCancelable on the movement found

Fields:

Validators:

movement_id pydantic-field

movement_id: int | None = None

Wire key MID

The movement; None when the server sent no whole number, which names none

ArmyRadiusPush pydantic-model

Bases: BaseResponse

An army within a radius of its target: its owner's record and the movement, read as a gam entry.

The base of the abr and asr pushes, which read the same keys.

Client: ABRCommand.executeCommand (split.js line 638456) and ASRCommand.executeCommand (split.js line 638501) hand O to CastleOtherPlayerData.parseOwnerInfo (split.js line 693159), which reads nothing without an object carrying an OID, then the push to CastleArmyData.parse_ABR or parse_ASR (split.js lines 667221, 667218), which hand [A] to parseMapMovementArray (split.js line 667169). For your own record the client also reads its AR as your alliance rank, which the library leaves to gal

Fields:

Validators:

owner pydantic-field

owner: MovementOwner | None = None

Wire key O

The record of the army's owner; None without an object carrying an OID, or when it cannot be read

movement pydantic-field

movement: MovementWrapper | None = None

Wire key A

The movement; None when the push names none

ArmyInBigRadiusResponse pydantic-model

Bases: ArmyRadiusPush

An army has come within the big radius of its target: the movement, now with its details.

Command: abr, a push.

Client: ABRCommand.executeCommand (bundle line 125907), CastleArmyData.parse_ABR (bundle line 133688)

Fields:

Validators:

ArmyInSmallRadiusResponse pydantic-model

Bases: ArmyRadiusPush

An army has come within the small radius of its target.

Command: asr, a push.

Client: ASRCommand.executeCommand (bundle line 125922), CastleArmyData.parse_ASR (bundle line 133687)

Fields:

Validators:

MovementFilterResponse pydantic-model

Bases: BaseResponse

The map's movement filters: which kinds of movement the map shows.

The client asks for the movement list (gam) again after each push, and so does EmpireClient.

Command: mvf, as a login section of gbd, a push and the reply to a SetMovementFilterRequest.

Client: MVFCommand.executeCommand (bundle line 652365), CastleSettingsData.parse_MVF (bundle line 695800), which tests CommKeys.ACTIVE_FILTERS (AFS, dll) for 0, 1 and 2 with indexOf; the options dialog pairs them with toggleMapPVPAttacks, toggleMapPvPAttacksAlliance and toggleMapMarketBarrows

Fields:

Validators:

active_filters pydantic-field

active_filters: tuple[EnumOrInt[MovementFilter], ...] = ()

Wire key AFS

The kinds of movement the map shows

shows

shows(kind: MovementFilter) -> bool

Whether the map shows that kind of movement.

SetMovementFilterRequest pydantic-model

Bases: BaseRequest

Show or hide one kind of movement on the map; the server answers with the filters as an mvf.

Command: mvf Payload: {"FID": filter, "ACT": 0 or 1}

Client: C2SMovementFilterOptionEvent (bundle line 379381), which sends ACT as 1 or 0, built by OptionsDialogOptions.toggleMapMarketBarrows, toggleMapPVPAttacks and toggleMapPvPAttacksAlliance (bundle lines 379324-379353) with MovementFilterConst (dll)

Fields:

kind pydantic-field

Wire key FID

The kind of movement

show pydantic-field

show: bool

Wire key ACT

Show that kind of movement, or hide it

CancelMovementRequest pydantic-model

Bases: BaseRequest

Recall one of your movements, turning it back home.

Command: mcm Payload: {"MID": movement_id}

The client sends it from its retreat dialog, from "send home" for your supports stationed at an area (one per support), and from the attack advisor's cancel dialog (one per advisor attack). The retreat button is enabled only where the movement's class allows it:

  • attacks (every attack type but alien attacks, which never): your own, heading to the target, from level 5, and no more than 600 seconds after leaving, unless the movement is force-cancelable (FC), attacks nomads while the alliance nomad invasion is not running, or attacks a Berimond watchtower
  • supports: your own, in either direction
  • travel between your areas: your own, heading to the target, from a source area that is still yours
  • spies, market transports and occupations: your own, heading to the target
  • treasure hunts and plague doctors: never

The movement list also disables it while the source area is under conquer control. The advisor's overview cancels every advisor attack that is not the series' last, returning ones too, without these checks. The server's refusals include INVALID_STARTAREA_FOR_CANCEL_MOVEMENT (189); the client handles none itself and shows its generic server error.

Client: C2SCancelMovementVO (bundle line 33049); sent by CastleAskRetreatDialog.onClick (bundle line 33234), SupportOverviewDialog.onClickRetreat (bundle line 33984) and AdvisorAttackOverviewCancelDialog.cancelAttacks (bundle line 21965), fed by AdvisorAttackOverviewDialog.getCancellableAdvisorMovements (bundle line 57303); canBeRetreated on ArmyAttackMapmovementVO (bundle line 14379), ArmyTravelMapMovementVO (bundle line 26818), SupportDefenceMapmovementVO (bundle line 43782), SpyMapmovementVO (bundle line 43759), MarketMapmovementVO (bundle line 43707), SiegeMapmovementVO (bundle line 33183) and the always-false ones (bundle lines 33079, 43733, 43805); ArmyAttackMapmovementVO.tooLateToBeRetreated (bundle line 14382) with TravelConst.MAX_FALLBACK_TIME (ggs.dll line 19828); ClientConstLevelRestrictions.MIN_LEVEL_RETREAT_MOVEMENTS (bundle line 2139) through CastleUserData.hasLevelFor (bundle line 10027); AMovementRenderStrategy.initRetreatButton (bundle line 14347); MapmovementFactory.parseMapMovement (bundle line 133793)

Fields:

movement_id pydantic-field

movement_id: int

Wire key MID

The movement to recall

accepts_reply

accepts_reply(payload: Any) -> bool

Whether an mcm reply is the movement this recalled: its A.M.MID, when sent, is MID.

Client: MCMCommand.executeCommand (bundle line 126041) reads the recalled movement from A.

CancelMovementResponse pydantic-model

Bases: BaseResponse

The reply to a recall: the movement as it now stands.

Command: mcm Payload: {"A": wrapper}

A is read as one gam entry, replacing the tracked movement. The client reads it unconditionally, so a reply without one is malformed.

Client: MCMCommand.executeCommand (bundle line 126041), which hands [A] to CastleArmyData.parseMapMovementArray (bundle line 133626)

Fields:

movement pydantic-field

movement: MovementWrapper

Wire key A

The recalled movement

SentMovementResponse pydantic-model

Bases: BaseResponse

The reply to a movement you send: the new movement, its owners and your coins and rubies after.

Payload: {"gcu": {...}, "O": [owner record, ...], "A": wrapper}

A is read as one gam entry and O skips a record without an OID. The send replies that share this shape subclass it with their command.

Client: CDSCommand.executeCommand (bundle line 125973) and its siblings hand i.gcu to CurrencyData.parseGCU, i.O to CastleOtherPlayerData.parseOwnerInfoArray and [i.A] to CastleArmyData.parseMapMovementArray

Fields:

movement pydantic-field

movement: MovementWrapper | None = None

Wire key A

The new movement; None when the reply has none

owners pydantic-field

Wire key O

Owner records for the movement's areas

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after the send; None when the reply has none

movement_id property

movement_id: int | None

The new movement's id, or None when the reply has no movement.

names_a_movement

names_a_movement(value: Any) -> bool

Whether a movement slot holds one: a wrapper whose M is an object with an MID.

Anything else names no movement and is skipped without a warning.

movements.models.market

Sending resources between castles, and the market overview.

Commands:

  • crm: Send resources to a castle
  • cmi: List your castles' carriages and resources

Classes:

Name Description
CreateMarketMovementRequest

Send resources from one of your castles to a castle on the map, by carriage.

CreateMarketMovementResponse

The carriage on its way.

MarketInfoRequest

List your castles' market carriages and resources.

MarketCastle

One castle in the market overview.

MarketInfoResponse

Your castles' market carriages and resources.

logger module-attribute

logger = logging.getLogger(__name__)

ResourceAmounts module-attribute

ResourceAmounts = Annotated[dict[Resource, int], BeforeValidator(_resource_rows), PlainSerializer(lambda amounts: [[resource.value, amount] for resource, amount in amounts.items()])]

Resources by amount, sent as [[resource_key, amount], ...] in insertion order.

Client: CollectableParserC2SCosts.createCostsListForServer (bundle line 62921) adds up a repeated item (combineDuplicatedItems) and then writes [itemType.serverKey, amount] per item

CreateMarketMovementRequest pydantic-model

Bases: BaseRequest

Send resources from one of your castles to a castle on the map, by carriage.

Command: crm Payload: {"KID": kingdom_id, "SID": source_castle_id, "TX": x, "TY": y, "HBW": horse, "PTT": 0 or 1, "SD": slowdown, "G": [[resource_key, amount], ...]}

Keys follow the client's order: the constructor initialises KID to SD and sets G after them. KID is the source castle's kingdom. A horse paid with feathers is sent as HBW -1 with PTT 1. The client merges repeated resources in G into one entry each.

Client: C2SCreateMarketMovementVO (bundle line 68348), sent by CastlePostSendGoodsDialog.sendGoods (bundle line 33377); G is built by CollectableParserC2SCosts.createCostsListForServer (bundle line 62921)

Fields:

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

The source castle's kingdom

source_castle_id pydantic-field

source_castle_id: int

Wire key SID

One of your castles, CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

target_x pydantic-field

target_x: int

Wire key TX

Map x of the target castle

target_y pydantic-field

target_y: int

Wire key TY

Map y of the target castle

horse_booster_id pydantic-field

horse_booster_id: HorseBoosterId = NO_HORSE

Wire key HBW

The horse booster, NO_HORSE for none or when paid with feathers

feathers pydantic-field

feathers: int = 0

Wire key PTT

1 when the horse is paid with feathers

slowdown pydantic-field

slowdown: int = 0

Wire key SD

Seconds the arrival is delayed by

goods pydantic-field

Wire key G

The amount of each resource to send, sent as [key, amount] pairs such as ['W', 1000]

CreateMarketMovementResponse pydantic-model

Bases: BaseResponse

The carriage on its way.

Command: crm Payload: {"gcu": {...}, "grc": {...}, "O": [owner, ...], "A": movement}

O (the owners involved) and A (the new movement) are kept as sent.

Client: CRMCommand.executeCommand (bundle line 125981)

Fields:

Validators:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after

resources pydantic-field

resources: CastleResources | None = None

Wire key grc

The joined castle's resources after

MarketInfoRequest pydantic-model

Bases: BaseRequest

List your castles' market carriages and resources.

Command: cmi Payload: {"S": scope, "KID": kingdom_id}

The client always sends {"S": 1, "KID": -1}: every kingdom.

Client: C2SMarketInfoVO (bundle line 27012)

Fields:

scope pydantic-field

scope: MarketScope = MarketScope.ALL_KINGDOMS

Wire key S

Which castles to list

kingdom_id pydantic-field

kingdom_id: int = -1

Wire key KID

The kingdom to list, -1 with ALL_KINGDOMS

MarketCastle pydantic-model

Bases: BasePayload

One castle in the market overview.

AE (the castle's area effects) is kept as sent.

Client: CastleTradeVO.fillFromParamObject (bundle line 140345), which reads every number through int()

Fields:

kingdom_id pydantic-field

kingdom_id: ClientInt = 0

Wire key KID

The castle's kingdom

castle_id pydantic-field

castle_id: ClientInt = 0

Wire key CID

The castle's object id

total_carriages pydantic-field

total_carriages: ClientInt = 0

Wire key TC

The castle's market carriages

available_carriages pydantic-field

available_carriages: ClientInt = 0

Wire key AC

Carriages not on the road

wood pydantic-field

wood: ClientInt = 0

Wire key W

Wood in stock

stone pydantic-field

stone: ClientInt = 0

Wire key S

Stone in stock

food pydantic-field

food: ClientInt = 0

Wire key F

Food in stock

coal pydantic-field

coal: ClientInt = 0

Wire key C

Coal in stock

oil pydantic-field

oil: ClientInt = 0

Wire key O

Oil in stock

glass pydantic-field

glass: ClientInt = 0

Wire key G

Glass in stock

iron pydantic-field

iron: ClientInt = 0

Wire key I

Iron in stock

honey pydantic-field

honey: ClientInt = 0

Wire key HONEY

Honey in stock

mead pydantic-field

mead: ClientInt = 0

Wire key MEAD

Mead in stock

beef pydantic-field

beef: ClientInt = 0

Wire key BEEF

Beef in stock

MarketInfoResponse pydantic-model

Bases: BaseResponse

Your castles' market carriages and resources.

Command: cmi Payload: {"C": [{"KID": .., "CID": .., "TC": .., "AC": .., "W": .., ...}, ...]}

Client: CMICommand.executeCommand (bundle line 128944), CastleTradeInfoVO.fillCastleList (bundle line 140325)

Fields:

Validators:

castles pydantic-field

castles: list[MarketCastle]

Wire key C

Each of your castles

movements.models.support

Sending support to a castle, and troops between your own areas.

Commands:

  • cds: Send support
  • tde: Send support to a Beyond the Horizon tower
  • cdd: Send support to a daimyo township
  • cat: Send troops to another of your own areas
  • sti: Travel pre-calculation for troops sent to another of your own areas

Classes:

Name Description
SendSupportRequest

Send support troops to a castle.

SendSupportResponse

The support on its way.

SendTowerSupportRequest

Send support troops to a Beyond the Horizon tower.

SendTowerSupportResponse

The support on its way to a Beyond the Horizon tower.

SendTownshipSupportRequest

Send support troops to a daimyo township.

SendTownshipSupportResponse

The support on its way to a daimyo township.

SiegeMovementResponse

A siege movement the server created.

SendTroopsRequest

Send troops from one of your areas to another of your own areas, where they stay.

SendTroopsResponse

The troops on their way.

GetTravelInfoRequest

Ask for the pre-calculation of troops sent from one of your areas to another of your own.

TravelTargetArea

The target's map row and its owner, the gaa block of an sti reply.

TravelUnits

Your units and tools at the source, the gui block of an sti reply.

GetTravelInfoResponse

The pre-calculation of troops sent between your own areas.

SendSupportRequest pydantic-model

Bases: BaseRequest

Send support troops to a castle.

Command: cds Payload: { "SID": source_castle_id, "TX": target_x, "TY": target_y, "LID": commander_id, "WT": wait_time, "HBW": horse_booster_id (-1 when PTT is set), "BPC": use_premium_commander, "PTT": feathers, "SD": slowdown, "A": [[unit_id, count], ...] }

The client sends no kingdom id. Fields follow its key order. BPC is 1 only when the premium commander (LID -14, TravelConst.COMMANDER_PREMIUM) leads the army, which uses one of the player's premium commanders or, when none are left, costs rubies (CastlePostAttackDialog.startAttack sends sendMovement(0) for any other commander). PTT 1 pays for the movement with feathers.

A carries units only: CastleSupportDefenceVO.getArmy sends the filled slots of its one container, whose slots are all soldier slots.

Client: C2SCreateDefenceSupportMovementVO (bundle line 133942), built by CastleAttackData.sendSupport (bundle line 133904) from CastleSupportDefenceVO.getArmy (bundle line 140121); its ITEM_TYPES (bundle line 140167) are all ToolUnitVO.SLOTTYPE_SOLDIER (bundle line 6661)

Fields:

source_castle_id pydantic-field

source_castle_id: int

Wire key SID

One of your castles, CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

target_x pydantic-field

target_x: int

Wire key TX

target_y pydantic-field

target_y: int

Wire key TY

commander_id pydantic-field

commander_id: int

Wire key LID

A Commander.commander_id from client.commanders.get_commanders(); 0 is the free starting commander, -14 the premium one

wait_time pydantic-field

wait_time: int = 12

Wire key WT

horse_booster_id pydantic-field

horse_booster_id: HorseBoosterId = NO_HORSE

Wire key HBW

The horse booster, NO_HORSE for none or when paid with feathers

use_premium_commander pydantic-field

use_premium_commander: int = 0

Wire key BPC

1 when the premium commander leads

feathers pydantic-field

feathers: int = 0

Wire key PTT

1 when the horse is paid with feathers

slowdown pydantic-field

slowdown: int = 0

Wire key SD

Seconds the arrival is delayed by

units pydantic-field

units: WodAmountSlots

Wire key A

The units, one pair per filled slot

accepts_reply

accepts_reply(payload: Any) -> bool

Whether a cds reply is the movement this sent: its target area (A.M.TA) is TX/TY.

Client: CDSCommand (bundle line 125939) reads the new movement from A, whose TA is the target area (BasicMapmovementVO). An army heading home targets your own castle and is not taken.

SendSupportResponse pydantic-model

Bases: SentMovementResponse

The support on its way.

Command: cds Payload: {"gcu": {...}, "O": [owner, ...], "A": movement}

Client: CDSCommand.executeCommand (bundle line 125973)

Fields:

SendTowerSupportRequest pydantic-model

Bases: SendSupportRequest

Send support troops to a Beyond the Horizon tower.

Command: tde Payload: {"SID": source_castle_id, "TX": target_x, "TY": target_y, "LID": commander_id, "WT": wait_time, "HBW": horse_booster_id, "BPC": use_premium_commander, "PTT": feathers, "SD": slowdown, "A": [[unit_id, count], ...]}

The client builds it with the same arguments as a cds, in the same key order, when the target's area type is AREA_TYPE_ALLIANCE_BATTLE_GROUND_TOWER.

Client: C2SCreateAllianceTowerSupportMovementVO (bundle line 133968), built by CastleAttackData.sendSupport (bundle line 133904)

Fields:

SendTowerSupportResponse pydantic-model

Bases: SendSupportResponse

The support on its way to a Beyond the Horizon tower.

Command: tde Payload: {"gcu": {...}, "O": [owner, ...], "A": movement}

Client: TDECommand.executeCommand (bundle line 126120)

Fields:

SendTownshipSupportRequest pydantic-model

Bases: BaseRequest

Send support troops to a daimyo township.

Command: cdd Payload: {"SID": source_castle_id, "TX": target_x, "TY": target_y, "A": [[unit_id, count], ...]}

The client sends no commander, horse, wait time or slowdown: it sends this straight from the support screen when the target's area type is AREA_TYPE_DAIMYO_TOWNSHIP, without the travel dialog.

Client: C2SCreateDaimyoDefenseMovementVO (bundle line 99735), sent by OpenPostAttackDialogCommand.execute (bundle line 99685) for ACTION_TYPE_SUPPORTDEFENSE_TOWNSHIP, which CastleSupportDefenceDialog.closeScreen (bundle line 122483) picks; the army from CastleSupportDefenceVO.getArmy (bundle line 140121)

Fields:

source_castle_id pydantic-field

source_castle_id: int

Wire key SID

One of your castles, CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

target_x pydantic-field

target_x: int

Wire key TX

The township's map x

target_y pydantic-field

target_y: int

Wire key TY

The township's map y

units pydantic-field

units: WodAmountSlots

Wire key A

The units, one pair per filled slot

accepts_reply

accepts_reply(payload: Any) -> bool

Whether a cdd reply is the movement this sent: its target area (A.M.TA) is TX/TY.

Client: CDDCommand (bundle line 128264) reads the new movement from A.

SendTownshipSupportResponse pydantic-model

Bases: SentMovementResponse

The support on its way to a daimyo township.

Command: cdd Payload: {"gcu": {...}, "O": [owner, ...], "A": movement}

Client: CDDCommand.executeCommand (bundle line 128264)

Fields:

SiegeMovementResponse pydantic-model

Bases: SentMovementResponse

A siege movement the server created.

Command: css Payload: {"gcu": {...}, "O": [owner, ...], "A": movement}

The client has no request that sends css; it only reads this reply.

Client: CSSCommand.executeCommand (bundle line 126045)

Fields:

SendTroopsRequest pydantic-model

Bases: BaseRequest

Send troops from one of your areas to another of your own areas, where they stay.

Command: cat Payload: { "SX": source_x, "SY": source_y, "TX": target_x, "TY": target_y, "KID": kingdom_id, "LID": commander_id, "WT": 0, "HBW": horse_booster_id (-1 when PTT is set), "BPC": use_premium_commander, "PTT": feathers, "SD": slowdown, "A": [[wod_id, amount], ...] }

Fields follow the client's key order: the constructor initialises SX to SD and sets A after them. The source is named by its map position, not its id. KID is the target's kingdom, and the source must sit in the same one. A lists the units, then the tools. The client always sends WT 0: only a support sets a wait time. A support (cds) to your own area is refused with NO_SELF_DESTRUCTION (92); this is the command the client uses for it.

Client: C2SCreateArmyTravelMovementVO (bundle line 99772), built by CastleTroopSupportData.sendTroops (bundle line 38420) from CastlePostAttackDialog.sendTroops (bundle line 38373); the army from CastleTroopSupportVO.getArmy (bundle line 99737)

Fields:

source_x pydantic-field

source_x: int

Wire key SX

Map x of the area the troops leave from

source_y pydantic-field

source_y: int

Wire key SY

Map y of the area the troops leave from

target_x pydantic-field

target_x: int

Wire key TX

Map x of the area they go to

target_y pydantic-field

target_y: int

Wire key TY

Map y of the area they go to

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

The kingdom both areas sit in

commander_id pydantic-field

commander_id: int

Wire key LID

A Commander.commander_id from client.commanders.get_commanders(); 0 is the free starting commander, -14 the premium one

wait_time pydantic-field

wait_time: int = 0

Wire key WT

Wait time at the target

horse_booster_id pydantic-field

horse_booster_id: HorseBoosterId = NO_HORSE

Wire key HBW

The horse booster, NO_HORSE for none or when paid with feathers

use_premium_commander pydantic-field

use_premium_commander: int = 0

Wire key BPC

1 when the premium commander leads

feathers pydantic-field

feathers: int = 0

Wire key PTT

1 when the horse is paid with feathers

slowdown pydantic-field

slowdown: int = 0

Wire key SD

Seconds the arrival is delayed by

units pydantic-field

units: WodAmountSlots

Wire key A

The units, then any tools, one pair per filled slot

accepts_reply

accepts_reply(payload: Any) -> bool

Whether a cat reply is the movement this sent: its target area (A.M.TA) is TX/TY.

Client: CATCommand (bundle line 125924) reads the new movement from A, whose TA is the target area (BasicMapmovementVO). An army heading home targets its source and is not taken.

SendTroopsResponse pydantic-model

Bases: SentMovementResponse

The troops on their way.

Command: cat Payload: {"O": [owner, ...], "A": movement, "gcu": {...}}

Client: CATCommand.executeCommand (bundle line 125958)

Fields:

GetTravelInfoRequest pydantic-model

Bases: BaseRequest

Ask for the pre-calculation of troops sent from one of your areas to another of your own.

Command: sti Payload: {"SX": source_x, "SY": source_y, "TX": target_x, "TY": target_y, "KID": kingdom_id}

Keys follow the client's order: the constructor initialises SX, SY, TX, TY and KID, though it takes the target first. KID is the target's kingdom.

Client: C2STroopSupportInfoVO (bundle line 72087), sent by CastleStartAttackDialog (bundle line 14831)

Fields:

source_x pydantic-field

source_x: int

Wire key SX

Map x of the area the troops would leave from

source_y pydantic-field

source_y: int

Wire key SY

Map y of the area the troops would leave from

target_x pydantic-field

target_x: int

Wire key TX

Map x of the area they would go to

target_y pydantic-field

target_y: int

Wire key TY

Map y of the area they would go to

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

The kingdom both areas sit in

TravelTargetArea pydantic-model

Bases: BasePayload

The target's map row and its owner, the gaa block of an sti reply.

Unlike an attack pre-calculation's, OI is one owner record, not a list: the client reads it with parseOwnerInfo, which takes no record without an OID.

Client: CastleTroopSupportVO.fillFromParamObject (bundle line 99736), CastleOtherPlayerData.parseOwnerInfo (bundle line 138996)

Fields:

Validators:

  • _owner_record → owner

area pydantic-field

area: TargetRow = None

Wire key AI

The target's map row

owner pydantic-field

owner: MapObject | None = None

Wire key OI

The target's owner; None when not named

TravelUnits pydantic-model

Bases: BasePayload

Your units and tools at the source, the gui block of an sti reply.

Client: CastleTroopSupportVO.fillFromParamObject (bundle line 99736) reads I into a UnitInventoryDictionary and SHI into a StrongholdUnitInventory

Fields:

units pydantic-field

units: WodAmounts

Wire key I

Units and tools at the source

stronghold pydantic-field

stronghold: WodAmounts

Wire key SHI

Units stored in its stronghold

GetTravelInfoResponse pydantic-model

Bases: BaseResponse

The pre-calculation of troops sent between your own areas.

Command: sti Payload:

{"SCID": source_castle_id, "KID": ..,
 "gaa": {"AI": [target map row], "OI": {owner record}},
 "gui": {"I": [[wod_id, count], ...], "SHI": [[wod_id, count], ...]},
 "AE": [[effect_id, [value], source_tag], ...],
 "gli": {"C": [...], "B": [...]}}

gli (your commanders) updates client.state; AE, the area effects on the movement, is read as an attack pre-calculation's is. The reply carries no travel time or cost: the client works them out from the distance and the units picked. A source that is not one of your castles is refused with NOT_IN_OWNED_CASTLE.

Client: STICommand.executeCommand (bundle line 129099), which passes gli to CastleLordData.parse_GLI; CastleTroopSupportData.parse_STI (bundle line 38417); CastleTroopSupportVO.fillFromParamObject (bundle line 99736), whose base CastleFightScreenVO.fillFromParamObject reads AE (bundle line 30501)

Fields:

source_castle_id pydantic-field

source_castle_id: int = 0

Wire key SCID

The castle the troops would leave from

kingdom_id pydantic-field

kingdom_id: Kingdom = Kingdom.GREEN

Wire key KID

The source castle's kingdom

target_area pydantic-field

target_area: TravelTargetArea

Wire key gaa

The target's map row and owner

units pydantic-field

units: TravelUnits

Wire key gui

Your units and tools at the source

area_effects pydantic-field

area_effects: CommanderEffects

Wire key AE

Area effects on the movement

movements.models.transfers

Moving units and goods to another kingdom.

Commands:

  • kut: Transfer units from a castle to another kingdom
  • kgt: Transfer goods from a castle to another kingdom
  • msk: Shorten a transfer to another kingdom with a minute skip
  • kst: Finish a transfer to another kingdom at once, for rubies

Classes:

Name Description
KingdomUnitTransferRequest

Send units from one of your castles to another kingdom.

KingdomUnitTransferResponse

The transfer's result.

KingdomGoodsTransferRequest

Send goods from one of your castles to your castle in another kingdom.

KingdomGoodsTransferResponse

The transfer's result.

MinuteSkipKingdomTransferRequest

Shorten the units or goods on their way to a kingdom with a minute skip.

MinuteSkipKingdomTransferResponse

The transfers after a minute skip.

KingdomSkipTransferRequest

Finish the units or goods on their way to a kingdom at once, for rubies.

KingdomSkipTransferResponse

The transfers after a full skip.

KingdomUnitTransferRequest pydantic-model

Bases: BaseRequest

Send units from one of your castles to another kingdom.

Command: kut Payload: {"SCID": source_castle_id, "SKID": source_kingdom, "TKID": target_kingdom, "CID": target_castle_id, "A": [[wod_id, amount], ...]}

Keys follow the client's order: the constructor initialises SCID, SKID, TKID and CID before it sets A. CID is the picked target castle's object id, -1 when none is picked.

Client: C2SKingdomUnitTransferVO (bundle line 95305), built by CastleTransferTroopsToKingdomProperties.getUnitTransferCommand (bundle line 37448) with the units as getAsWodAmountArray pairs

Fields:

source_castle_id pydantic-field

source_castle_id: int

Wire key SCID

One of your castles, CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

source_kingdom_id pydantic-field

source_kingdom_id: Kingdom = Kingdom.GREEN

Wire key SKID

The source castle's kingdom

target_kingdom_id pydantic-field

target_kingdom_id: Kingdom

Wire key TKID

The kingdom to send the units to

target_castle_id pydantic-field

target_castle_id: int = -1

Wire key CID

Object id of a picked target castle, -1 for none

units pydantic-field

units: WodAmountSlots

Wire key A

The units, one pair per unit

KingdomUnitTransferResponse pydantic-model

Bases: BaseResponse

The transfer's result.

Command: kut Payload: {"gcu": {...}, "gui": {...}, "kpi": {...}}

gui (the source castle's units after) is kept as sent; kpi updates client.state.get_kingdoms().

Client: KUTCommand.executeCommand (bundle line 124732)

Fields:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after

KingdomGoodsTransferRequest pydantic-model

Bases: BaseRequest

Send goods from one of your castles to your castle in another kingdom.

Command: kgt Payload: {"SCID": source_castle_id, "SKID": source_kingdom, "TKID": target_kingdom, "G": [[resource_key, amount], ...]}

Keys follow the client's order: the constructor initialises SCID, SKID and TKID before it sets G. G is built as the market's is, a repeated resource merged into one entry.

Client: C2SKingdomGoodsTransferVO (bundle line 98402), built by CastleTransferResToKingdomProperties.getSendResourcesCommand (bundle line 55548) from CastleTransferResourcesDialog.sendResources (bundle line 38082), which builds G with createCostsListForServer (bundle line 38086)

Fields:

source_castle_id pydantic-field

source_castle_id: int

Wire key SCID

One of your castles, CastleInfo.castle_id from client.castle.get_all() or Castle.id from client.state.get_castles()

source_kingdom_id pydantic-field

source_kingdom_id: Kingdom = Kingdom.GREEN

Wire key SKID

The source castle's kingdom

target_kingdom_id pydantic-field

target_kingdom_id: Kingdom

Wire key TKID

The kingdom to send the goods to

goods pydantic-field

Wire key G

The amount of each resource to send, sent as [key, amount] pairs such as ['W', 1000]

KingdomGoodsTransferResponse pydantic-model

Bases: BaseResponse

The transfer's result.

Command: kgt Payload: {"gcu": {...}, "grc": {...}, "kpi": {...}}

gcu and kpi update client.state (client.state.get_kingdoms() lists the goods on their way); grc is the joined castle's resources after, kept here.

Client: KGTCommand.executeCommand (bundle line 124658)

Fields:

Validators:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after

resources pydantic-field

resources: CastleResources | None = None

Wire key grc

The joined castle's resources after

MinuteSkipKingdomTransferRequest pydantic-model

Bases: BaseRequest

Shorten the units or goods on their way to a kingdom with a minute skip.

Command: msk Payload: {"MST": minute_skip, "KID": "kingdom_id", "TT": "transfer_type"}

Keys follow the client's order. KID is the kingdom the transfer goes to; the client sends KID and TT through toString().

Client: C2SMinuteSkipKingdomTransferVO (bundle line 54609), built by KingdomUnitsTravelMinuteSkipProperties.getMinuteSkipCommand (bundle line 37497) and KingdomGoodsTravelMinuteSkipProperties.getMinuteSkipCommand (bundle line 55567); CastleMinuteSkipDialog.onScrollItemClick passes the currency's jsonKey (bundle line 7722)

Fields:

minute_skip pydantic-field

minute_skip: EnumOrStr['Currency']

Wire key MST

The minute skip used, Currency.SKIP_1_MINUTE to SKIP_24_HOURS; sent as its key

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key KID

The kingdom the transfer goes to

transfer_type pydantic-field

transfer_type: KingdomTransferType

Wire key TT

Whether the transfer carries units or goods

MinuteSkipKingdomTransferResponse pydantic-model

Bases: BaseResponse

The transfers after a minute skip.

Command: msk Payload: {"kpi": {...}}

kpi updates client.state.get_kingdoms().

Client: MSKCommand.executeCommand (bundle line 125799)

Fields:

KingdomSkipTransferRequest pydantic-model

Bases: BaseRequest

Finish the units or goods on their way to a kingdom at once, for rubies.

Command: kst Payload: {"KID": kingdom_id, "TT": transfer_type}

Keys follow the client's order; both are sent as numbers.

Client: C2SKingdomSkipTransferVO (bundle line 24292), sent by KingdomUnitsTravelMinuteSkipProperties.getFullSkipCommand (bundle line 37508), KingdomGoodsTravelMinuteSkipProperties.getFullSkipCommand (bundle line 55591), CastleHandleKingdomDialogSupport.onClick (bundle lines 98420, 98422) and FactionEventOverviewSublayer.onClickRubySkipTroops (bundle line 95297)

Fields:

kingdom_id pydantic-field

kingdom_id: Kingdom

Wire key KID

The kingdom the transfer goes to

transfer_type pydantic-field

transfer_type: KingdomTransferType

Wire key TT

Whether the transfer carries units or goods

KingdomSkipTransferResponse pydantic-model

Bases: BaseResponse

The transfers after a full skip.

Command: kst Payload: {"gcu": {...}, "grc": {...}, "gui": {...}, "kpi": {...}}

gcu, grc and kpi update client.state; gui, the joined castle's units, is not kept.

Client: KSTCommand.executeCommand (bundle line 124755)

Fields:

Validators:

currencies pydantic-field

currencies: CurrencyBlock = None

Wire key gcu

Coins and rubies after

resources pydantic-field

resources: CastleResources | None = None

Wire key grc

The joined castle's resources after

movements.travel

Travel time and carriage capacity, worked out as the game client works them out.

The server sends no travel time before a send: the client computes it from the slowest troop, the distance, the horse and the speed bonuses, and so does this module. Nothing here sends a request. Bonuses that come from the player's effects (commander equipment, research, titles, global effects, alliance buffs) are inputs, summed in percent the way the client's code for each action sums them.

Client: TravelConst (ggs.dll.js), CastleAttackInfoVO.calculateTravelTime (bundle line 160159), CastleTroopSupportVO.getBoostedTravelTime (bundle line 512667), CastleSupportDefenceVO.getBoostedTravelTime (bundle line 697495), CastlePostSendGoodsDialog.getBoostedTravelTime (bundle line 174648), CastlePostSpyDialog.getBoostedTravelTime (bundle line 201005), CastleTradeVO.getMaxCapacityForCurrentLevel (bundle line 698512)

Functions:

Name Description
travel_time

Seconds to cover distance fields at speed without a horse.

travel_time_with_horse

Seconds to cover distance fields at speed with a horse's boost in percent.

low_level_boost

The speed factor a player below level 25 gets on top, in hundredths: 4 at level 1, 0 from 25 on.

corrected_attack_distance

The distance an attack travels: clamped to 6-144 fields for a capital or trading metropolis, 50 for a portal.

troop_speed

A unit's or tool's travel speed.

lowest_travel_speed

The speed of the slowest troop, which the whole army travels at.

attack_travel_time

Seconds an attack takes to reach its target.

station_travel_time

Seconds troops sent to one of the player's own castles take (sti).

support_travel_time

Seconds a defence support (sdi) takes; 0 to a daimyo township without a horse.

trade_travel_time

Seconds a trader's carriages take.

spy_travel_time

Seconds spies take: saboteurs travel at 50, other spies at 450.

resources_per_carriage

What one carriage carries with the caravan overloader at caravan_overloader_level.

trade_capacity

What carriages carriages carry together: resources_per_carriage times their number.

Attributes:

Name Type Description
BASIC_FIELD_TRAVEL_TIME
HORSE_BOOST_FIELDS
LOW_DISTANCE_BOOST_FIELDS
TRAVEL_BOOST_TUTORIAL

The speed factor of an attack on an NPC up to TUTORIAL_END_LEVEL.

TUTORIAL_END_LEVEL
MAX_LEVEL_FOR_LOW_LEVEL_TRAVEL_BOOST
CAPITAL_MIN_ATTACK_DISTANCE
CAPITAL_MAX_ATTACK_DISTANCE
METROPOLIS_MIN_ATTACK_DISTANCE
METROPOLIS_MAX_ATTACK_DISTANCE
ALLIANCE_RAID_PORTAL_TRAVEL_DISTANCE
MARKET_TRAVEL_SPEED

The speed of a trader's carriages (MarketConst.MARKET_TRAVEL_SPEED).

SPY_TRAVEL_SPEED

The speed of spies (SpyConst.TRAVELSPEED_SPY).

SABOTAGE_TRAVEL_SPEED

The speed of saboteurs (SpyConst.TRAVELSPEED_SABOTAGE).

RESOURCES_PER_CARRIAGE

What a carriage carries before boosts (MarketConst.RESOURCES_PER_CARRIAGE).

BASIC_FIELD_TRAVEL_TIME module-attribute

BASIC_FIELD_TRAVEL_TIME = 600

HORSE_BOOST_FIELDS module-attribute

HORSE_BOOST_FIELDS = 10

LOW_DISTANCE_BOOST_FIELDS module-attribute

LOW_DISTANCE_BOOST_FIELDS = 100

TRAVEL_BOOST_TUTORIAL module-attribute

TRAVEL_BOOST_TUTORIAL = 20

The speed factor of an attack on an NPC up to TUTORIAL_END_LEVEL.

TUTORIAL_END_LEVEL module-attribute

TUTORIAL_END_LEVEL = 5

MAX_LEVEL_FOR_LOW_LEVEL_TRAVEL_BOOST module-attribute

MAX_LEVEL_FOR_LOW_LEVEL_TRAVEL_BOOST = 25

CAPITAL_MIN_ATTACK_DISTANCE module-attribute

CAPITAL_MIN_ATTACK_DISTANCE = 6

CAPITAL_MAX_ATTACK_DISTANCE module-attribute

CAPITAL_MAX_ATTACK_DISTANCE = 144

METROPOLIS_MIN_ATTACK_DISTANCE module-attribute

METROPOLIS_MIN_ATTACK_DISTANCE = 6

METROPOLIS_MAX_ATTACK_DISTANCE module-attribute

METROPOLIS_MAX_ATTACK_DISTANCE = 144

ALLIANCE_RAID_PORTAL_TRAVEL_DISTANCE module-attribute

ALLIANCE_RAID_PORTAL_TRAVEL_DISTANCE = 50

MARKET_TRAVEL_SPEED module-attribute

MARKET_TRAVEL_SPEED = 50

The speed of a trader's carriages (MarketConst.MARKET_TRAVEL_SPEED).

SPY_TRAVEL_SPEED module-attribute

SPY_TRAVEL_SPEED = 450

The speed of spies (SpyConst.TRAVELSPEED_SPY).

SABOTAGE_TRAVEL_SPEED module-attribute

SABOTAGE_TRAVEL_SPEED = 50

The speed of saboteurs (SpyConst.TRAVELSPEED_SABOTAGE).

RESOURCES_PER_CARRIAGE module-attribute

RESOURCES_PER_CARRIAGE = 100

What a carriage carries before boosts (MarketConst.RESOURCES_PER_CARRIAGE).

travel_time

travel_time(speed: float, distance: float, speed_factor: float, area_bonus: float = 0) -> int

Seconds to cover distance fields at speed without a horse.

Client: TravelConst.getTravelTime and getTravelTimeAsFloat (ggs.dll.js)

travel_time_with_horse

travel_time_with_horse(speed: float, distance: float, speed_factor: float, horse_boost: float = 0, area_bonus: float = 0) -> int

Seconds to cover distance fields at speed with a horse's boost in percent.

Below LOW_DISTANCE_BOOST_FIELDS the horse's boost grows with the log of the distance; from there it grows with the distance, and a horse saves the first 10 fields.

Client: TravelConst.getTravelTimeWithHorse (ggs.dll.js); every call site passes the distance as both its second and its sixth argument

low_level_boost

low_level_boost(level: int, *, on_special_server: bool = False) -> float

The speed factor a player below level 25 gets on top, in hundredths: 4 at level 1, 0 from 25 on.

Client: TravelConst.calculateLowLevelBoost (ggs.dll.js)

corrected_attack_distance

corrected_attack_distance(distance: float, area_type: MapItemType) -> float

The distance an attack travels: clamped to 6-144 fields for a capital or trading metropolis, 50 for a portal.

Client: CastleAttackInfoVO.getCorrectedAttackDistance (bundle line 160226)

troop_speed

troop_speed(troop: UnitStats | ToolStats, *, research_bonus: int = 0, commander_boost: float = 0) -> int

A unit's or tool's travel speed.

research_bonus is the research UNIT_SPEED_BONUS for it, added to its speed; commander_boost the commander's SPEED_BOOST_UNIT for it, in percent.

Client: BasicUnitVO.unitSpeed (bundle line 103194), CastleFightItemContainer.getLowestTravelSpeed (bundle line 93268)

lowest_travel_speed

lowest_travel_speed(troops: Iterable[UnitStats | ToolStats], *, research_bonuses: Mapping[UnitOrTool, int] | None = None, commander_boosts: Mapping[UnitOrTool, float] | None = None) -> int

The speed of the slowest troop, which the whole army travels at.

research_bonuses and commander_boosts hold troop_speed's bonuses by unit or tool.

Raises:

Type Description
ValueError

no troops; the client gives an army without troops no travel time.

Client: CastleFightItemContainer.getLowestTravelSpeed (bundle line 93268)

attack_travel_time

attack_travel_time(speed: int, distance: float, target_area_type: MapItemType, *, player_level: int, horse: HorseStats | None = None, commander_bonus: int = 0, vip_level: VipLevelDef | None = None, target_is_npc: bool = False, legend_travel_boost: float = 0, on_special_server: bool = False, on_crusade_map: bool = False, outer_realms_rank_swap: bool = False) -> int

Seconds an attack takes to reach its target.

A conquest's army is slower still (CastleConquerInfoVO.getLowestTravelSpeed), which is not ported.

Parameters:

Name Type Description Default
speed int

the army's lowest_travel_speed.

required
distance float

fields to the target as the client measures them (MapHelper.getDistanceByMapobjects, which gives some camps and towers fixed distances), before corrected_attack_distance.

required
target_area_type MapItemType

the target's area type.

required
player_level int

the attacking player's level.

required
horse HorseStats | None

the horse sent along; its unit_boost counts.

None
commander_bonus int

the commander's equipment SPEED_BONUS and SPEED_BONUS_PVP in percent, each truncated to an int.

0
vip_level VipLevelDef | None

the active VIP level, None while VIP time does not run.

None
target_is_npc bool

the target's owner is an NPC (player id below 0).

False
legend_travel_boost float

the legend skills' TRAVEL_ATTACK_BOOST in percent, given when the target's owner is a legend; 0 otherwise.

0
on_special_server bool

the player is on a special server, which drops the low-level boost.

False
on_crusade_map bool

the target is on a crusade treasure map, where the VIP bonus does not count.

False
outer_realms_rank_swap bool

an Outer Realms rank swap attack, which drops the low-level boost.

False

The King's Market return speed booster is left out: no call site in the client applies it.

Client: CastleAttackInfoVO.calculateTravelTime (bundle line 160159), CastleFightScreenVO.getActionTravelTimeBonusForAreaType (bundle line 159369), CastlePostAttackDialog.getTravelBoost (bundle line 200671)

station_travel_time

station_travel_time(speed: int, distance: float, *, player_level: int, horse: HorseStats | None = None, commander_bonus: int = 0, on_special_server: bool = False) -> int

Seconds troops sent to one of the player's own castles take (sti).

commander_bonus is the commander's equipment SPEED_BONUS plus STATIONING_SPEED_BONUS, in percent.

Client: CastleTroopSupportVO.getBoostedTravelTime (bundle line 512667)

support_travel_time

support_travel_time(speed: int, distance: float, target_area_type: MapItemType, *, horse: HorseStats | None = None, commander_bonus: int = 0) -> int

Seconds a defence support (sdi) takes; 0 to a daimyo township without a horse.

commander_bonus is the commander's equipment SPEED_BONUS plus SUPPORT_SPEED_BONUS, in percent. With a horse the client takes the township's time from getBoostedTravelTime, which has no township case.

Client: CastleSupportDefenceVO.getTravelTime and getBoostedTravelTime (bundle lines 697490, 697495)

trade_travel_time

trade_travel_time(distance: float, *, market_bonus: float = 0, subscription_bonus: float = 0, global_bonus: float = 0, area_bonus: float = 0, title_bonus: float = 0, horse: HorseStats | None = None) -> int

Seconds a trader's carriages take.

The bonuses are percents, added in the client's order: market_bonus the research MARKET_SPEED_BONUS to the player's own castle, or the alliance's market speed buff to another's; the subscription's MARKET_SPEED_BONUS; the global SPEED_BONUS; the trading castle's area MARKET_SPEED_BONUS; the titles' MARKET_SPEED_BONUS and SPEED_BONUS.

Client: CastlePostSendGoodsDialog.getBoostedTravelTime (bundle line 174648), CastleSendGoodsDialog.getTravelTime (bundle line 142678)

spy_travel_time

spy_travel_time(distance: float, spy_type: SpyType, *, research_bonus: float = 0, construction_bonus: float = 0, title_bonus: float = 0, global_bonus: float = 0, horse: HorseStats | None = None) -> int

Seconds spies take: saboteurs travel at 50, other spies at 450.

The bonuses are percents, added in the client's order: the research ESPIONAGE_SPEED_BOOST, the construction items' espionage speed boost, the titles' SPEED_BONUS and the global SPEED_BONUS.

Client: CastlePostSpyDialog.getBoostedTravelTime (bundle line 201005), CastleStartSpyVO.getTravelTime (bundle line 697197)

resources_per_carriage

resources_per_carriage(caravan_overloader_level: int, *, capacity_boost: float = 0, capacity_bonus: float = 0, game_data: GameData | None = None) -> int

What one carriage carries with the caravan overloader at caravan_overloader_level.

capacity_boost is the trading castle's area MARKET_CARRIAGE_CAPACITY_BOOST in percent; capacity_bonus its baron's and its area's MARKET_CARRIAGE_CAPACITY_BONUS, added per carriage.

Raises:

Type Description
KeyError

the items have no caravan overloader row for the level.

Client: CastlePremiumBoostData.getResourcesTransportablePerCarriage (bundle line 81705), CastleTradeVO.getCapacityBoost and getCapacityBonus (bundle lines 698525, 698532)

trade_capacity

trade_capacity(carriages: int, caravan_overloader_level: int, *, capacity_boost: float = 0, capacity_bonus: float = 0, game_data: GameData | None = None) -> int

What carriages carriages carry together: resources_per_carriage times their number.

Client: CastleTradeVO.getMaxCapacityForCurrentLevel (bundle line 698512)