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
¶
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 |
get_movements |
Request army movements from server. |
recall |
Recall one of your movements ( |
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 |
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 |
tracked |
list[Movement]
|
All tracked movements (stale ones pruned first). |
announced_attacks |
list[Movement]
|
The attacks |
occupations |
list[Movement]
|
The occupations |
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.
announced_attacks
property
¶
The attacks on_incoming_attack announced that are still on their way, in the order announced.
occupations
property
¶
The occupations on_occupation_started announced that have not ended, in the order announced.
incoming_attacks
property
¶
The attacks heading for you, as the movement pushes left them; nothing is sent.
incoming_movements
property
¶
Every movement heading for you, as the movement pushes left them; nothing is sent.
outgoing_movements
property
¶
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 |
Client: OptionsDialogOptions.toggleMapMarketBarrows, toggleMapPVPAttacks and
toggleMapPvPAttacksAlliance (bundle lines 379324-379353), MVFCommand.executeCommand
(bundle line 652365)
movement
¶
a tracked movement by its Movement.movement_id, as client.movements.get_movements() lists it.
get_movements
¶
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 |
5.0
|
Returns:
| Type | Description |
|---|---|
list[Movement]
|
List of Movement objects, read from state after the response has |
list[Movement]
|
been applied. With |
list[Movement]
|
right now, which is not yet the answer to this request. |
Raises:
| Type | Description |
|---|---|
CommandError
|
|
EmpireTimeoutError
|
|
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 ( |
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
|
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
|
|
ValueError
|
The horse or slowdown costs rubies and |
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]
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: |
required |
target_x
|
int
|
Target X coordinate |
required |
target_y
|
int
|
Target Y coordinate |
required |
units
|
WodAmountMapping | Sequence[WodAmount]
|
The units: |
required |
commander_id
|
int
|
Commander to lead the support, a |
required |
wait_time
|
int
|
Station duration in hours (0-12, default: 12) |
12
|
use_premium_commander
|
bool
|
Lead with the premium commander ( |
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 |
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 |
ValueError
|
The horse or slowdown costs rubies and |
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: |
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: |
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: |
required |
commander_id
|
int
|
Commander to lead them, a |
required |
kingdom_id
|
Kingdom
|
The kingdom both areas sit in |
GREEN
|
use_premium_commander
|
bool
|
Lead with the premium commander ( |
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 |
ValueError
|
The horse or slowdown costs rubies and |
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, |
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, |
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
|
|
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 |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnsendableGoodsError
|
The goods fail one of the checks of |
ValueError
|
The source castle sits in the target kingdom or in Berimond, or no castle of yours sits in the target kingdom |
UnknownCastleError
|
|
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
|
|
required |
minute_skip
|
Currency | str
|
The minute skip to use, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
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 |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnsendableGoodsError
|
The goods fail one of the checks of |
ValueError
|
The source castle sits in Berimond |
UnknownCastleError
|
|
CommandError
|
The server refused the transfer, |
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, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The source castle sits in Berimond |
UnknownCastleError
|
|
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
|
|
required |
spend_rubies
|
bool
|
Allow the rubies the skip costs |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
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
|
|
required |
minute_skip
|
Currency | str
|
The minute skip used, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
No running season event has this map, or |
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
|
|
required |
spend_rubies
|
bool
|
Allow spending the rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
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, |
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:
-
wood(int) -
stone(int) -
food(int) -
coal(int) -
oil(int) -
glass(int) -
iron(int) -
aquamarine(int) -
honey(int) -
mead(int) -
beef(int)
model_config
class-attribute
¶
model_config: ConfigDict = ConfigDict(extra='ignore', populate_by_name=True)
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:
-
movement_id(int) -
movement_type(EnumOrInt[MovementType]) -
progress_time(int) -
total_time(int) -
direction(int) -
target_id(int) -
kingdom(Kingdom) -
source_id(int) -
owner_id(int) -
horse_booster(EnumOrInt[Horse] | None) -
target_area(MovementArea | None) -
source_area(MovementArea | None) -
target_area_id(int) -
source_area_id(int) -
target_x(int) -
target_y(int) -
source_x(int) -
source_y(int) -
target_type(EnumOrInt[MapItemType]) -
local_player_id(int) -
units(WodAmounts) -
estimated_size(int) -
resources(MovementResources) -
target_name(str) -
source_name(str) -
target_player_name(str) -
source_player_name(str) -
target_alliance_name(str) -
source_alliance_name(str) -
created_at(float) -
last_updated(float) -
commander(Commander | None) -
wait_total(int) -
wait_passed(int) -
force_cancelable(bool) -
spy(MovementSpy | None) -
owner(MovementOwner | None) -
target_owner(MovementOwner | None) -
attack_type(int | None) -
is_shadow(bool) -
support_tools(SupportToolSlots) -
auto_skip_cooldown_type(EnumOrInt[AutoSkipCooldownType]) -
advisor_type(EnumOrInt[AttackAdvisorType]) -
advisor_movement_count(int) -
advisor_movement_number(int) -
advisor_is_last(bool) -
market_carriages(int) -
goods(CollectableRows)
Validators:
-
_horse→horse_booster -
_kingdom→kingdom -
_readable_area→target_area,source_area
model_config
class-attribute
¶
model_config: ConfigDict = ConfigDict(extra='ignore', populate_by_name=True)
movement_type
pydantic-field
¶
movement_type: EnumOrInt[MovementType] = MovementType.ATTACK
Wire key T
The movement's type
direction
pydantic-field
¶
direction: int = 0
Wire key D
1 = returning home, 0 = heading to the target
kingdom
pydantic-field
¶
Wire key KID
The kingdom the movement is in
horse_booster
pydantic-field
¶
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_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
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
commander
pydantic-field
¶
commander: Commander | None = None
The commander leading the army, as the UM block sends it; None when there is none
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
target_owner
pydantic-field
¶
target_owner: MovementOwner | None = None
Owner record of the target's owner
support_tools
pydantic-field
¶
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
¶
advisor_type: EnumOrInt[AttackAdvisorType] = AttackAdvisorType.NONE
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
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.
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_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_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.
unit_count
property
¶
unit_count: int
Total number of units in this movement (includes all unit types).
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 |
MovementRecord |
The movement itself: the |
MovementArmy |
A visible army: three flanks plus the courtyard wave, each |
MovementUnitInfo |
Commander and wait details: a wrapper's |
MovementMarket |
A market transport's cargo: a wrapper's |
MovementSpy |
A spy mission's details: a wrapper's |
MovementWrapper |
One entry of |
MovementOwner |
An owner record: one entry of |
GetMovementsResponse |
Response containing active movements. |
SetMovementFilterRequest |
Show or hide one kind of movement on the map; the server answers with the filters as an |
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 |
NO_HORSE
module-attribute
¶
The horse a movement request names when it takes none, or pays for its horse with feathers.
HorseBoosterId
module-attribute
¶
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
item
pydantic-field
¶
item: MapAreaItem | None = None
The row as its area type's parser reads it; None when it cannot be read
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:
-
movement_id(int) -
movement_type(EnumOrInt[MovementType]) -
progress_time(ClientInt) -
total_time(ClientInt) -
direction(ClientInt) -
target_id(ClientInt) -
kingdom_id(Kingdom) -
source_id(ClientInt) -
owner_id(ClientInt) -
horse_booster(EnumOrInt['Horse'] | None) -
target_area(MovementArea | None) -
source_area(MovementArea | None)
Validators:
-
_areas_in_the_movements_kingdom -
_type→movement_type -
_kingdom→kingdom_id -
_readable_area→target_area,source_area -
_horse→horse_booster
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
direction
pydantic-field
¶
direction: ClientInt = 0
Wire key D
1 = returning home, 0 = heading to the target
kingdom_id
pydantic-field
¶
Wire key KID
The kingdom the movement is in
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
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:
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:
-
commander(Commander | None) -
wait_passed(int) -
wait_total(int) -
advisor_type(EnumOrInt[AttackAdvisorType]) -
advisor_movement_count(int) -
advisor_movement_number(int) -
advisor_is_last(int)
Validators:
-
_readable_commander→commander
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
advisor_type
pydantic-field
¶
advisor_type: EnumOrInt[AttackAdvisorType] = AttackAdvisorType.NONE
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
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:
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:
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:
-
movement(MovementRecord) -
full_army(MovementArmy | None) -
army(MovementArmy | None) -
army_size(ClientInt | None) -
unit_info(MovementUnitInfo | None) -
attack_type(EnumOrInt[AttackType] | None) -
is_shadow(bool) -
force_cancelable(bool) -
support_tools(SupportToolSlots) -
auto_skip_cooldown_type(EnumOrInt[AutoSkipCooldownType]) -
travel_units(WodAmounts) -
travel_goods(CollectableRows) -
traded_units(WodAmounts) -
market(MovementMarket | None) -
spy(MovementSpy | None)
Validators:
-
_no_spy_details→spy -
_auto_skip→auto_skip_cooldown_type -
_parsed_attack_type→attack_type -
_truthy_flag→is_shadow,force_cancelable -
_block_on_its_own
full_army
pydantic-field
¶
full_army: MovementArmy | None = None
Wire key FA
The full army, preferred over 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
force_cancelable
pydantic-field
¶
force_cancelable: bool = False
Wire key FC
The movement can be force-cancelled
support_tools
pydantic-field
¶
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
¶
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
¶
Wire key TRU
Units an Oasis Settlement trade brings back, among travel_units
MovementOwner
pydantic-model
¶
Bases: BasePayload
An owner record: one entry of O in gam, abr and asr.
Client: WorldMapOwnerInfoVO.fillFromParamObject.
Fields:
-
player_id(int) -
name(str) -
crest(OwnerCrest | None) -
level(int) -
legendary_level(int) -
beginner_protection_seconds(int) -
honor(int) -
might(int) -
top_x(int) -
is_ruin(bool) -
alliance_id(int) -
alliance_rank(int) -
alliance_name(str) -
is_searching_alliance(bool) -
peace_seconds(int) -
castle_positions(OwnerPositions) -
village_positions(OwnerPositions) -
has_premium(bool) -
has_vip(bool) -
is_dummy(bool) -
achievement_points(int) -
relocation_seconds(int) -
faction(OwnerFaction | None) -
title_prefix_id(EnumOrInt['Title'] | None) -
title_suffix_id(EnumOrInt['Title'] | None) -
via_refer_a_friend(bool)
Validators:
-
_title→title_prefix_id,title_suffix_id -
_truthy_flag→is_searching_alliance,has_premium,has_vip -
_parsed_one_flag→is_ruin -
_one_flag→is_dummy -
_parsed_truthy_flag→via_refer_a_friend
beginner_protection_seconds
pydantic-field
¶
beginner_protection_seconds: int = -1
Wire key RNP
-1 when not protected
village_positions
pydantic-field
¶
village_positions: OwnerPositions
Wire key VP
The player's villages
relocation_seconds
pydantic-field
¶
relocation_seconds: int = 0
Wire key RRD
Seconds until a relocation ends
title_prefix_id
pydantic-field
¶
title_prefix_id: EnumOrInt['Title'] | None = None
Wire key PRE
The title shown before the name; None for none
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:
-
error_code(int) -
movements(list[MovementWrapper]) -
owners(list[MovementOwner]) -
unreadable_movements(tuple[str, ...])
Validators:
-
_movements_one_by_one -
_readable_owners→owners
owners
pydantic-field
¶
owners: list[MovementOwner]
Wire key O
Owner records for every player the movements name
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:
-
error_code(int) -
movement_id(int | None)
Validators:
-
_as_sent→movement_id
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:
-
error_code(int) -
movement_id(int | None)
Validators:
-
_as_sent→movement_id
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:
-
error_code(int) -
owner(MovementOwner | None) -
movement(MovementWrapper | None)
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:
-
error_code(int) -
owner(MovementOwner | None) -
movement(MovementWrapper | None)
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:
-
error_code(int) -
owner(MovementOwner | None) -
movement(MovementWrapper | None)
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:
-
error_code(int) -
active_filters(tuple[EnumOrInt[MovementFilter], ...])
Validators:
-
_numbers→active_filters
active_filters
pydantic-field
¶
active_filters: tuple[EnumOrInt[MovementFilter], ...] = ()
Wire key AFS
The kinds of movement the map shows
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(MovementFilter) -
show(bool)
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:
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:
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
movement
pydantic-field
¶
movement: MovementWrapper | None = None
Wire key A
The new movement; None when the reply has none
owners
pydantic-field
¶
owners: list[MovementOwner]
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
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. |
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(Kingdom) -
source_castle_id(int) -
target_x(int) -
target_y(int) -
horse_booster_id(HorseBoosterId) -
feathers(int) -
slowdown(int) -
goods(ResourceAmounts)
kingdom_id
pydantic-field
¶
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()
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
goods
pydantic-field
¶
goods: ResourceAmounts
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:
-
error_code(int) -
currencies(CurrencyBlock) -
resources(CastleResources | None)
Validators:
-
_block→resources
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
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:
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:
-
error_code(int) -
castles(list[MarketCastle])
Validators:
-
_castles→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 |
TravelUnits |
Your units and tools at the source, the |
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(int) -
target_x(int) -
target_y(int) -
commander_id(int) -
wait_time(int) -
horse_booster_id(HorseBoosterId) -
use_premium_commander(int) -
feathers(int) -
slowdown(int) -
units(WodAmountSlots)
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()
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
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
accepts_reply
¶
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
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:
-
source_castle_id(int) -
target_x(int) -
target_y(int) -
commander_id(int) -
wait_time(int) -
horse_booster_id(HorseBoosterId) -
use_premium_commander(int) -
feathers(int) -
slowdown(int) -
units(WodAmountSlots)
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
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:
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
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(int) -
source_y(int) -
target_x(int) -
target_y(int) -
kingdom_id(Kingdom) -
commander_id(int) -
wait_time(int) -
horse_booster_id(HorseBoosterId) -
use_premium_commander(int) -
feathers(int) -
slowdown(int) -
units(WodAmountSlots)
kingdom_id
pydantic-field
¶
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
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
units
pydantic-field
¶
Wire key A
The units, then any tools, one pair per filled slot
accepts_reply
¶
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:
-
error_code(int) -
movement(MovementWrapper | None) -
owners(list[MovementOwner]) -
currencies(CurrencyBlock)
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:
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
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(WodAmounts) -
stronghold(WodAmounts)
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:
-
error_code(int) -
source_castle_id(int) -
kingdom_id(Kingdom) -
target_area(TravelTargetArea) -
units(TravelUnits) -
area_effects(CommanderEffects)
source_castle_id
pydantic-field
¶
source_castle_id: int = 0
Wire key SCID
The castle the troops would leave from
kingdom_id
pydantic-field
¶
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
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(int) -
source_kingdom_id(Kingdom) -
target_kingdom_id(Kingdom) -
target_castle_id(int) -
units(WodAmountSlots)
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
¶
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
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:
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(int) -
source_kingdom_id(Kingdom) -
target_kingdom_id(Kingdom) -
goods(ResourceAmounts)
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
¶
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
¶
goods: ResourceAmounts
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:
-
error_code(int) -
currencies(CurrencyBlock) -
resources(CastleResources | None)
Validators:
-
_block→resources
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(EnumOrStr['Currency']) -
kingdom_id(Kingdom) -
transfer_type(KingdomTransferType)
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
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:
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:
-
error_code(int) -
currencies(CurrencyBlock) -
resources(CastleResources | None)
Validators:
-
_block→resources
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 |
travel_time_with_horse |
Seconds to cover |
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 ( |
support_travel_time |
Seconds a defence support ( |
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 |
trade_capacity |
What |
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 |
|
|
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 ( |
|
SPY_TRAVEL_SPEED |
The speed of spies ( |
|
SABOTAGE_TRAVEL_SPEED |
The speed of saboteurs ( |
|
RESOURCES_PER_CARRIAGE |
What a carriage carries before boosts ( |
TRAVEL_BOOST_TUTORIAL
module-attribute
¶
The speed factor of an attack on an NPC up to TUTORIAL_END_LEVEL.
MARKET_TRAVEL_SPEED
module-attribute
¶
The speed of a trader's carriages (MarketConst.MARKET_TRAVEL_SPEED).
SPY_TRAVEL_SPEED
module-attribute
¶
The speed of spies (SpyConst.TRAVELSPEED_SPY).
SABOTAGE_TRAVEL_SPEED
module-attribute
¶
The speed of saboteurs (SpyConst.TRAVELSPEED_SABOTAGE).
RESOURCES_PER_CARRIAGE
module-attribute
¶
What a carriage carries before boosts (MarketConst.RESOURCES_PER_CARRIAGE).
travel_time
¶
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
¶
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 |
required |
distance
|
float
|
fields to the target as the client measures them ( |
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 |
None
|
commander_bonus
|
int
|
the commander's equipment |
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' |
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)