Castle¶
Castles, buildings, resources, research and the mercenary camp behind client.castle.
castle.service¶
Your castles: resources, buildings, the construction queue, research and the mercenary camp.
It covers:
- Castle management (list, join, rename, abandon)
- Resources and production
- Buildings and the construction queue
- Tax collection
- Opening and closing a castle's gate (Open Gate)
- Research and the mercenary camp's missions
- The refinery and toolsmith crafting queues, construction item crafting and the decoration fusion forge
- A monument's or laboratory's upgrade progress
- The ruby wishing well
Sending goods, support and troops from a castle is on client.movements.
Actions raise CommandError when the server refuses them.
Methods that take one of your castles send its kingdom from the castle
list the server sent at login (client.state.get_castles()), as the
client does, and raise UnknownCastleError for an id not in it.
Building methods act on the castle joined last (CastleService.join)
and name buildings by object id, a BuildingRow.object_id from
join(...).buildings; upgrade_building, upgrade_defense and
finish_construction take the castle and join it themselves. Their typed replies (BuildResponse and the
others) can be read with client.request.
Modules:
| Name | Description |
|---|---|
buildings |
Buildings, the construction queue and the building lookups. |
castles |
Your castles: the castle list, joining a castle, resources and horses. |
construction_items |
Construction items: equipping, removing, disassembling and boosting them. |
crafting |
The crafting queues and construction item crafting. |
decorations |
Decoration storage and the decoration fusion forge. |
economy |
The brewery, private resource villages and tax. |
gates |
Open Gate: open a castle's gate so attackers loot it without a battle, and close it again. |
mercenaries |
The mercenary camp's missions. |
modification |
Renaming, abandoning and relocating a castle. |
research |
Research. |
wishing_well |
The ruby wishing well in your main castle: throw in rubies and a lucky penny, collect twice the rubies later. |
Classes:
| Name | Description |
|---|---|
CastleService |
Your castles, their buildings and resources, research and the mercenary camp. |
CastleService
¶
CastleService(client: EmpireClient)
Bases: ConstructionItemsMixin, CastleModificationMixin, BuildingsMixin, CastlesMixin, DecorationsMixin, EconomyMixin, OpenGateMixin, ResearchMixin, MercenaryCampMixin, CraftingMixin, WishingWellMixin, BaseService
Your castles, their buildings and resources, research and the mercenary camp.
Reached as client.castle.
Usage
client = EmpireClient(...)
client.login()
# Get all castles
castles = client.castle.get_all()
for c in castles:
print(f"{c.castle_name} at ({c.x}, {c.y})")
# Join a castle and read its buildings
castle = client.castle.join(castle_id=12345)
# Get resources
resources = client.castle.get_resources(castle_id=12345)
Methods:
| Name | Description |
|---|---|
on_joined_area_moved |
Register a callback for the castle you have joined moving on the map ( |
on_building_finished |
Register a callback for a building in the joined castle that finished ( |
on_building_xp |
Register a callback for XP a building in the joined castle gave ( |
on_buildings_changed |
Register a callback for buildings of the joined castle that were damaged ( |
on_castle_buildings |
Register a callback for the joined castle's buildings sent whole ( |
get_construction_items |
Request all construction items in storage, including an empty inventory. |
equip_construction_item |
Join a castle and equip an item, returning the server's complete placement. |
remove_construction_item |
Join a castle and return an equipped item to storage for its coin removal cost. |
disassemble_construction_item |
Disassemble stored items and resolve their drawn rewards from game data. |
get_construction_item_space |
Ask how many more construction items fit in storage; the reply also reaches the state. |
get_construction_item_expiry |
Ask when the next of your construction items expires; the reply also reaches the state. |
get_expired_construction_items |
Request expired items across your castles. |
mark_expired_construction_items_seen |
Mark a castle's expired items as viewed, as closing their list does. |
move_construction_slot |
Move a building in its construction queue and read the resulting queue. |
boost_construction_item |
Consume one selected inventory booster on a temporary equipped item. |
rename |
Rename one of your castles. |
abandon_castle |
Start abandoning one of your castles; it is given up a day later unless cancelled. |
cancel_abandon |
Keep a castle |
relocate |
Move your main castle in the green kingdom to a new position. |
leave_area |
Leave the area you joined last, as the client does when it opens the kingdom overview. |
get_build_queue |
Get the joined castle's construction slots. |
build |
Place a new building in the joined castle. |
upgrade_building |
Upgrade a building in one of your castles. |
move_building |
Move a building in the joined castle. |
move_to_district |
Move a building of the joined castle into a district, such as a decoration district. |
remove_from_district |
Move a building out of its district onto the joined castle's grounds. |
sell_decoration |
Sell a decoration placed in the joined castle. |
destroy_building |
Start taking a building in the joined castle down. |
finish_construction |
Finish a building's running build or upgrade at once. |
skip_construction_time |
Shorten a building's running construction with a minute skip. |
upgrade_defense |
Upgrade a wall, gate or tower of one of your castles, by its object id. |
repair_building |
Repair a damaged building in the joined castle. |
repair_all |
Repair every damaged building in the joined castle at once, for rubies; see "Spending |
buy_expansion |
Buy an expansion of the joined castle's grounds, with resources (NORMAL) or rubies (PREMIUM). |
open_treasure_chest |
Open a treasure chest found on an expansion of the joined castle. |
collect_mine |
Collect what a mine in the joined castle has produced. |
collect_resource_cart |
Collect the joined castle's resource cart of one resource. |
collect_resource_citizen |
Collect what the citizen walking in the joined castle carries. |
get_upgradable_buildings |
Find your castles holding a building of one type that a prime sale can upgrade. |
get_transportation_buildings |
The main castle's buildings a castle transport to the Outer Realms takes along. |
get_feast_cost_reduction |
The discount on feasts, in percent. |
unlocks |
One of your castles' unlocked units and horses, from the last gpc that named it. |
set_hunter |
Set the joined castle's hunter to turn wood and stone production into |
judge_citizen |
Give your verdict on the open citizen judgement, which ends it. |
resource_cart |
The cart of one resource in the last |
get_kingdoms |
Ask for your kingdoms and the transfers to them; the reply also updates |
get_villages |
Ask for your villages and private resource villages; the reply also updates |
unlock_kingdom |
Unlock a kingdom with one of its prebuilt castles, e.g. |
get_all |
Get list of all player's castles. |
get_details |
Get resources and stationed units for one castle. |
get_landmark_progress |
A monument's or laboratory's upgrade points, asked for by its map row's object id. |
select |
Select/jump to a castle (makes it the active castle). |
join |
Join a castle, making it the active castle, and return its state. |
join_area |
Join an area by its position ( |
get_resources |
Get one of your castles' resources. |
get_production |
Get the joined castle's production area: production, storage, population and the rest. |
horses |
The horses one of your castles can send movements with, by wod id. |
get_decoration_storages |
Read the decoration storages; they also reach |
mark_storage_seen |
Mark a storage's new decorations as seen. |
store_decoration |
Put a decoration of the joined castle into the storage. |
sell_stored_decoration |
Sell decorations from the storage for coins; they are gone for good. |
place_stored_decoration |
Place a custom or unique decoration from the storage in the joined castle. |
get_fusion_forges |
Fusion forges' level and energy; the reply also reaches |
level_up_fusion_forge |
Level a fusion forge up for decoration dust, and return its new level. |
refill_fusion_forge |
Refill a fusion forge's energy for rubies, and return the energy added. |
convert_catalysts |
Assemble fusion catalysts, or disassemble them into decoration dust. |
get_fusion_targets |
Your areas with the placed decorations a fusion can target. |
fuse_decoration |
Fuse a stored decoration into a placed one. The stored decoration is used up. |
get_brewery_production |
Read one of your castles' brewery production. |
set_brewery_production |
Set how much of one of your castles' brewery makes mead, and the stocks at which it stops. |
set_mead_priority |
Give one of your castles' mead production priority, or take it away. |
buy_private_village |
Buy a private resource village with resource village tokens. |
upgrade_private_village |
Upgrade one of your private resource villages to the next level, with resource village tokens. |
remove_private_village |
Remove one of your private resource villages; it is gone for good, its tokens are not returned. |
get_tax_info |
Read the tax collection status. |
start_tax |
Start a tax collection. |
collect_tax |
Collect the tax. |
bribe_tax_collector |
Bribe the tax collector, a tax booster bought with rubies; see "Spending rubies" in the guides. |
open_gate_quote |
What opening one of your castles' gate would cost now, and whether the client offers it; nothing is sent. |
open_gate |
Buy an Open Gate for one of your castles: attackers loot it without a battle, so its buildings |
close_gate |
Close one of your castles' open gate; nothing is refunded. |
get_research |
Read your research; the reply also reaches |
start_research |
Start a research, paying what it costs. |
skip_research |
Shorten the running research with a minute skip from your inventory. |
finish_research |
Finish the running research now, for rubies; see "Spending rubies" in the guides. |
list_missions |
The mercenary camp's missions, and when new ones come. |
start_mission |
Start an open mercenary mission, paying its price in coins. |
collect_mission |
Collect a finished mercenary mission's rewards. |
refresh_mission |
Swap an open mercenary mission for another, for |
get_crafting_queues |
The crafting queues of the refinery and toolsmith in every castle, as the crafting dialog asks for them. |
start_crafting |
Start a recipe in a crafting queue, paying its costs. |
cancel_crafting |
Cancel the craft in one slot of a crafting queue. |
move_crafting_slot |
Move a waiting craft to another waiting slot. |
skip_crafting |
Finish the craft in one slot for rubies. |
unlock_crafting_slot |
Unlock a temporary slot of a crafting queue for coins. |
get_construction_crafting |
The construction item being crafted and the time left; both None while nothing is crafted. |
craft_construction_item |
Craft a construction item from a recipe, paying its costs; one craft runs at a time. |
skip_construction_crafting_time |
Shorten the running construction item craft with a minute skip. |
finish_construction_crafting |
Finish the running construction item craft for rubies. |
get_wishing_well |
Read the wishing well's level and time from the server; its reply also updates |
start_wishing_well |
Start the wishing well: it takes its level's entry rubies and lucky pennies, and gives twice the rubies |
finish_wishing_well |
Finish the running wishing well now, for rubies; see "Spending rubies" in the guides. Whether the |
collect_wishing_well |
Collect the rubies of a finished wishing well. |
upgrade_wishing_well |
Upgrade the wishing well to its next level, for the wood and stone that level costs. |
Attributes:
| Name | Type | Description |
|---|---|---|
construction_items |
ConstructionItemInventory | None
|
The last construction inventory received; None before the first inventory reply. |
placed_construction_items |
tuple[BuildingConstructionItems, ...] | None
|
Items on the joined castle's buildings; None before joining or after the area is lost or relocated. |
construction_item_space |
ConstructionItemSpace | None
|
Free construction storage capacity, from the last inventory or capacity push. |
expired_construction_items |
ExpiredConstructionItemsResponse | None
|
The last complete list of expired items; None before a successful read. |
construction_list |
ConstructionList | None
|
The joined castle's construction slots, as the last join, push or building reply left them; None before |
buildings |
dict[int, PlacedBuilding] | None
|
The joined castle's placed objects by object id, kept current by the server's pushes and the building |
castles |
list[Castle]
|
A snapshot of the player's castles. |
hunter |
HunterInfo | None
|
The hunter's food boost, from the last |
judgement_id |
Judgement | int | None
|
The open citizen judgement, from the last |
joined_area |
JoinedArea | None
|
The area joined, with its slum level and builder discount; |
session_location |
SessionLocation | None
|
See |
is_on_map |
bool
|
See |
is_in_own_castle |
bool
|
See |
is_in_spectated_castle |
bool
|
See |
is_in_occupied_castle |
bool
|
See |
mines |
dict[int, MineStatus]
|
The joined castle's mines by object id, as the last |
resource_carts |
list[ResourceCart]
|
The joined castle's resource carts, wood, stone and food, as the last |
laboratories |
LaboratoryListResponse | None
|
Your laboratories, from the last |
laboratory_reset |
LaboratoryResetResponse | None
|
When the laboratories reset next, from the last |
royal_towers |
RoyalTowerListResponse | None
|
Your royal towers, from the last |
monuments |
MonumentListResponse | None
|
Your monuments, from the last |
monument_reset |
MonumentResetResponse | None
|
When the monuments reset next, from the last |
villages |
VillageListResponse | None
|
Your villages and private resource villages, from the last |
tax |
TaxInfo | None
|
The tax collection, from the last |
kingdoms |
KingdomInfoResponse | None
|
Your kingdoms and the transfers to them; None until a |
construction_item_expiry |
ConstructionItemExpiryResponse | None
|
When the next construction item expires, from the last |
resource_pool |
ResourcePoolResponse | None
|
What the citizen in your castle carries, from the last |
wishing_well |
WishingWellResponse | None
|
The ruby wishing well, from the last |
research |
ResearchInfoResponse
|
Your finished and running research, from the last |
mercenary_missions |
MercenaryMissionsResponse | None
|
The mercenary camp's missions, from the last |
decoration_storages |
dict[int, DecorationStorage]
|
The decoration storages by storage id, from the last |
fusion_forges |
dict[FusionForgeId | int, FusionForge] | None
|
The fusion forges by id, as the last |
crafting_queues |
tuple[CraftingQueue, ...] | None
|
Every crafting queue known, as the last |
construction_items
property
¶
construction_items: ConstructionItemInventory | None
The last construction inventory received; None before the first inventory reply.
placed_construction_items
property
¶
placed_construction_items: tuple[BuildingConstructionItems, ...] | None
Items on the joined castle's buildings; None before joining or after the area is lost or relocated.
construction_item_space
property
¶
construction_item_space: ConstructionItemSpace | None
Free construction storage capacity, from the last inventory or capacity push.
expired_construction_items
property
¶
expired_construction_items: ExpiredConstructionItemsResponse | None
The last complete list of expired items; None before a successful read.
construction_list
property
¶
construction_list: ConstructionList | None
The joined castle's construction slots, as the last join, push or building reply left them; None before a join, after the area is lost or relocated, or when the join sent none.
buildings
property
¶
buildings: dict[int, PlacedBuilding] | None
The joined castle's placed objects by object id, kept current by the server's pushes and the building replies; None before a join and after the area is lost or relocated.
hunter
property
¶
The hunter's food boost, from the last hin or castle join that carried it; None until one did.
judgement_id
property
¶
The open citizen judgement, from the last sjc; None while none is open.
joined_area
property
¶
joined_area: JoinedArea | None
The area joined, with its slum level and builder discount; None before any join.
session_location
property
¶
session_location: SessionLocation | None
See GameState.get_session_location.
is_in_spectated_castle
property
¶
is_in_spectated_castle: bool
See GameState.is_in_spectated_castle.
mines
property
¶
mines: dict[int, MineStatus]
The joined castle's mines by object id, as the last gsm sent them.
resource_carts
property
¶
resource_carts: list[ResourceCart]
The joined castle's resource carts, wood, stone and food, as the last rci sent them.
laboratories
property
¶
Your laboratories, from the last gll; None until one arrived.
laboratory_reset
property
¶
When the laboratories reset next, from the last lrr that counted down; None until one arrived.
royal_towers
property
¶
Your royal towers, from the last gkl; None until one arrived.
monuments
property
¶
Your monuments, from the last gml; None until one arrived.
monument_reset
property
¶
When the monuments reset next, from the last mre that counted down; None until one arrived.
villages
property
¶
Your villages and private resource villages, from the last kgv; None until one arrived.
kingdoms
property
¶
kingdoms: KingdomInfoResponse | None
Your kingdoms and the transfers to them; None until a kpi arrived.
construction_item_expiry
property
¶
construction_item_expiry: ConstructionItemExpiryResponse | None
When the next construction item expires, from the last nec; None until one arrived.
resource_pool
property
¶
resource_pool: ResourcePoolResponse | None
What the citizen in your castle carries, from the last irc push; None until one arrived.
wishing_well
property
¶
wishing_well: WishingWellResponse | None
The ruby wishing well, from the last rww; None until one arrived.
research
property
¶
research: ResearchInfoResponse
Your finished and running research, from the last rei.
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought it |
mercenary_missions
property
¶
mercenary_missions: MercenaryMissionsResponse | None
The mercenary camp's missions, from the last mpe; None until one arrived.
decoration_storages
property
¶
The decoration storages by storage id, from the last sin that named each; empty until one arrived.
fusion_forges
property
¶
fusion_forges: dict[FusionForgeId | int, FusionForge] | None
The fusion forges by id, as the last ffi left them; None until one arrived.
crafting_queues
property
¶
crafting_queues: tuple[CraftingQueue, ...] | None
Every crafting queue known, as the last crin or crafting action left it; None until one arrived.
Each has every slot of its game-data row (CraftingQueue.with_definition).
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
The game data cannot be loaded |
on_joined_area_moved
¶
on_joined_area_moved(callback: Callable[[JoinedAreaMoved], object]) -> None
Register a callback for the castle you have joined moving on the map (ghw).
Called with its new position, after joined_area has it, and also when no area is
joined, which the push leaves alone. Callbacks run on the receive thread: they must not
block, and a call that waits for a reply raises ReceiveThreadError.
Client: GHWCommand.executeCommand (bundle line 129574)
Unregister a callback with on_joined_area_moved.remove(callback).
on_building_finished
¶
on_building_finished(callback: Callable[[BuildingFinished], object]) -> None
Register a callback for a building in the joined castle that finished (fbe), with the
building's object id and the XP it gave. Runs on the receive thread, as on_joined_area_moved.
Client: FBECommand.exec (bundle line 122879), AreaDataUpdater.parseCBX (bundle line 131521)
Unregister a callback with on_building_finished.remove(callback).
on_building_xp
¶
on_building_xp(callback: Callable[[BuildingXP], object]) -> None
Register a callback for XP a building in the joined castle gave (cbx). Runs on the
receive thread, as on_joined_area_moved.
Client: CBXCommand.executeCommand (bundle line 123345)
Unregister a callback with on_building_xp.remove(callback).
on_buildings_changed
¶
on_buildings_changed(callback: Callable[[DamagedBuildings], object]) -> None
Register a callback for buildings of the joined castle that were damaged (gdb) or
whose efficiency changed (gcb, a BuildingEfficiencyChanged), with their new rows, after
buildings has them. The building replies and the ego push change buildings too,
without this callback. Runs on the receive thread, as on_joined_area_moved.
Client: GDBCommand and GCBCommand (bundle lines 122998, 122968),
IsoUpdaterData.updateMultipleObjectInfos (bundle line 130259)
Unregister a callback with on_buildings_changed.remove(callback).
on_castle_buildings
¶
on_castle_buildings(callback: Callable[[CastleBuildingsPushed], object]) -> None
Register a callback for the joined castle's buildings sent whole (gca), called after
get_placed_construction_items has the construction items they carry; not called while no
castle is joined. Runs on the receive thread, as on_joined_area_moved.
Client: GCACommand.executeCommand (bundle line 122991)
Unregister a callback with on_castle_buildings.remove(callback).
get_construction_items
¶
get_construction_items(*, timeout: float = 5.0) -> ConstructionItemInventory
Request all construction items in storage, including an empty inventory.
Client: C2SGetContructionItemsInventoryVO and GIICommand
(bundle lines 28546, 123270).
equip_construction_item
¶
equip_construction_item(castle_id: int, object_id: int, construction_item_id: ConstructionItem | int, slot: int, *, mode: ConstructionItemMode = ADD, timeout: float = 5.0) -> EquipConstructionItemResponse
Join a castle and equip an item, returning the server's complete placement.
ADD fills an empty slot. REPLACE keeps the old item for its coin removal
cost; OVERWRITE discards it. A failed inventory refresh is logged and
leaves construction_items unknown after the accepted placement.
Client: AConstructionItemsActionDialog.sendReplaceCommand (bundle 28680),
CastleConstructionItemsOverwriteDialog (bundle 79306-79307).
remove_construction_item
¶
remove_construction_item(castle_id: int, object_id: int, construction_item_id: ConstructionItem | int, slot: int, *, timeout: float = 5.0) -> RemoveConstructionItemResponse
Join a castle and return an equipped item to storage for its coin removal cost.
Refusals and transport failures propagate. A failed inventory refresh is
logged and leaves construction_items unknown after the accepted removal.
Client: CastleConstructionItemsExtractDialog.onClickAccept (bundle 79277),
CRICommand.executeCommand (bundle 123255-123256).
disassemble_construction_item
¶
disassemble_construction_item(castle_id: int, construction_item_id: ConstructionItem | int, *, amount: int = 1, lost_and_found_id: int = -1, timeout: float = 5.0) -> DisassembleConstructionItemResponse
Disassemble stored items and resolve their drawn rewards from game data.
Items are consumed. lost_and_found_id=-1 selects storage. The reply
exposes the drawn reward ids and their collectables; permanent items'
recipe materials are not listed by the server. A failed inventory refresh
is logged and leaves construction_items unknown after success.
Client: C2SDisassembleConstructionItemVO (bundle 79223-79227),
onClickAccept / onDCIArrived (bundle 35727-35729),
showTempCIDisassembling (bundle 48984).
get_construction_item_space
¶
get_construction_item_space(*, timeout: float = 5.0) -> ConstructionItemSpace
Ask how many more construction items fit in storage; the reply also reaches the state.
Client: C2SConstructionItemInventorySpaceLeftVO (bundle line 41293), CSPCommand.exec
(bundle line 123855)
get_construction_item_expiry
¶
get_construction_item_expiry(*, timeout: float = 5.0) -> ConstructionItemExpiryResponse
Ask when the next of your construction items expires; the reply also reaches the state.
Client: ConstructionItemData.onCIExpiration (bundle line 22993) sends
C2SGetNextExpiringConstructionItemVO; NECCommand.executeCommand (bundle line 123336)
get_expired_construction_items
¶
get_expired_construction_items(*, timeout: float = 5.0) -> ExpiredConstructionItemsResponse
Request expired items across your castles.
Client: C2SGetAllExpiredConstructionItemsVO / AECCommand (bundle 79379 / 123264).
mark_expired_construction_items_seen
¶
mark_expired_construction_items_seen(castle_id: int, *, timeout: float = 5.0) -> MarkExpiredConstructionItemsSeenResponse
Mark a castle's expired items as viewed, as closing their list does.
This acknowledgement does not remove expired records from the cached list. Client: assign sublayer hide / switchCastle (bundle 77574 / 77583), MECCommand (123308).
move_construction_slot
¶
move_construction_slot(castle_id: int, old_position: int, new_position: int, *, timeout: float = 5.0) -> ConstructionList
Move a building in its construction queue and read the resulting queue.
Both positions must contain a building. The move acknowledgement carries no queue;
a failed follow-up read propagates after the accepted move.
Client: CastleBuildingListComponent (bundle 108280-108281), MCICommand (123383).
boost_construction_item
¶
boost_construction_item(castle_id: int, object_id: int, construction_item_id: ConstructionItem | int, slot: int, *, consumable: CurrencyId, timeout: float = 5.0) -> BoostConstructionItemResponse
Consume one selected inventory booster on a temporary equipped item.
Select currency id 2000 (rare), 2001 (epic) or 2002 (legendary).
The item must still have time remaining and the selected booster must improve its rarity.
Client: updateBoosterButton / boostConstructionItem (bundle 77588-77591 / 77624-77625),
ConstructionItemConst (dll 18989). This command has no ruby purchase branch.
rename
¶
rename(castle_id: int, new_name: str, *, is_initial_name: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> None
Rename one of your castles.
Looks the castle up in the castle list for the type and kingdom the
server needs, so this costs one extra round trip. Pass
is_initial_name=True to name a newly acquired castle, such as a
monument or laboratory, instead of renaming one. A rename costs
PlayerConst.CHANGE_CASTLE_NAME_C2 (2500) rubies unless a premium account runs;
see "Spending rubies" in the guides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, from |
required |
new_name
|
str
|
The new name |
required |
is_initial_name
|
bool
|
Name a newly acquired castle instead of renaming one, which is free |
False
|
spend_rubies
|
bool
|
Allow a rename while no premium account is known to run |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
A rename, no premium account is known to run, and |
UnknownCastleError
|
|
Client: CastleRenameCastleDialog.showLoaded and sendCommand (bundle lines 57219, 57231)
price a rename, sent with 1; CastleNameCastleDialog.sendCommand (bundle line 32589) sends
the first name with 0 and shows no price; CHANGE_CASTLE_NAME_C2 (dll line 19599)
abandon_castle
¶
abandon_castle(castle_id: int, *, timeout: float = 5.0) -> AbandonCastleResponse
Start abandoning one of your castles; it is given up a day later unless cancelled.
Looks the castle up in the castle list for its kingdom, as rename
does. Any castle may be abandoned but the kingdom's main castle; a
Battle for Berimond main camp, which the client also counts as one, is
left to the server. It is free.
The castle goes after OutpostConst.ABANDON_TIME (86400 s) and
cancel_abandon keeps it within ABANDON_CANCEL_TIME (10800 s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, from |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
UnknownCastleError
|
|
CommandError
|
The server refused, as for a castle held too briefly
( |
Client: CastleManagementDialog.setDeleteOutpostAndRelocateButton (bundle line 24592)
offers it for any castle but CastleListVO.getMainCastleByKingdomID (bundle line
13864), the kingdom's castle of type CASTLE or KINGDOM_CASTLE;
onAbandonOutpost (bundle line 24630) sends C2SAbandonOutpostStartVO;
OutpostConst (dll line 19530)
cancel_abandon
¶
Keep a castle abandon_castle started to give up.
Looks the castle up in the castle list for its kingdom. The client
offers it while CastleInfo.cancel_abandon_seconds is above 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, from |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
CommandError
|
The server refused. |
Client: CastleManagementDialog.onDeleteOutpostClick and onCancelAbandoning
(bundle lines 24624, 24629) send C2SAbandonOutpostCancelVO
relocate
¶
Move your main castle in the green kingdom to a new position.
The client offers it on the green kingdom's map, at a free position or a ruin. The first
relocation is free; the next cost RelocationConst.RELOCATION_COST_C2 (5000, 20000, then
35000 rubies each), less any ruby discount, and need spend_rubies, as does any relocation
while no gri has said how many were made. The cooldown
(client.player.relocation) is left to the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
Map x of the new position |
required |
y
|
int
|
Map y of the new position |
required |
spend_rubies
|
bool
|
Allow a relocation that costs rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The relocation costs rubies, or its price is not known, and |
CommandError
|
The server refused, as with |
Client: CastleRelocateDialog.getCost and onClick (bundle line 109656),
SwitchToRelocateWorldmapCommand.execute (bundle line 100959), RSTCommand.executeCommand
(bundle line 126855); RelocationConst.getRelocationCost (dll line 19674)
leave_area
¶
Leave the area you joined last, as the client does when it opens the kingdom overview.
The client has no handler for a reply, so none is waited for.
Client: CastleKingdomOverviewScreen.show (bundle line 108518) sends C2SLeaveAreaVO
get_build_queue
¶
get_build_queue(*, timeout: float = 5.0) -> ConstructionList
build
¶
build(wod_id: Building, x: int, y: int, rotation: int = 0, *, spend_rubies: bool = False, private_offer_id: int = -1, district_object_id: int = -1, timeout: float = 5.0) -> None
Place a new building in the joined castle.
Spends rubies when the building has a ruby price (BuildingDef.rubies_to_build at your
level), and with spend_rubies on missing resources; see "Spending rubies" in the guides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wod_id
|
Building
|
The building type |
required |
x
|
int
|
Castle grid x, -1 when placing into a district |
required |
y
|
int
|
Castle grid y, -1 when placing into a district |
required |
rotation
|
int
|
Rotation |
0
|
spend_rubies
|
bool
|
Allow a ruby price, and pay the missing resources with rubies |
False
|
private_offer_id
|
int
|
The private offer the purchase uses, -1 for none |
-1
|
district_object_id
|
int
|
Object id of the district to place into, -1 for none |
-1
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building has a ruby price, or is not in the game data, and |
GameDataNotLoadedError
|
|
Client: IsoServerCommands.buyObjectFromShop (bundle line 63766); ABasicBuildingVO.costC2
(bundle lines 17950-17953)
upgrade_building
¶
upgrade_building(castle_id: int, object_id: int, *, spend_rubies: bool = False, private_offer_id: int = -1, timeout: float = 5.0) -> None
Upgrade a building in one of your castles.
Joins the castle first, as the client is inside it, and prices the building from the
join's reply: the level it upgrades to, by BuildingDef.rubies_to_build at your level,
needs spend_rubies when it has a ruby price; see "Spending rubies" in the guides.
spend_rubies also pays missing resources with rubies.
A ruby wishing well is upgraded as upgrade_wishing_well does, without private_offer_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
object_id
|
int
|
The building's object id |
required |
spend_rubies
|
bool
|
Allow a ruby price, and pay the missing resources with rubies |
False
|
private_offer_id
|
int
|
The prime sale offer the upgrade uses, -1 for none |
-1
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The next level has a ruby price, or the building or its next level is not
known, and |
GameDataNotLoadedError
|
|
UnknownCastleError / CommandError
|
see |
Client: RingMenuButtonUpgradeBuilding.onClick (bundle line 50092),
IsoServerCommands.upgradeBuilding (split.js line 328747), which sends rww for a wishing
well; the price is the next level's
costC2, BuildingCostHelper.getUpgradeCostList (bundle lines 41106-41116) through
AShopVO.getCost (bundle line 31766) and ABasicBuildingVO.costC2 (bundle lines 17950-17953)
move_building
¶
Move a building in the joined castle.
move_to_district
¶
move_to_district(object_id: int, district_object_id: int, *, timeout: float = 5.0) -> BuildingRow | None
Move a building of the joined castle into a district, such as a decoration district.
Returns:
| Type | Description |
|---|---|
BuildingRow | None
|
The building's row as it now stands; None when the reply has none |
Client: C2SMoveToDistrictVO (bundle line 41105), MDECommand.executeCommand (bundle line 123166)
remove_from_district
¶
remove_from_district(object_id: int, x: int, y: int, rotation: int = 0, *, timeout: float = 5.0) -> BuildingRow | None
Move a building out of its district onto the joined castle's grounds.
move_building moves a building that is in no district.
Returns:
| Type | Description |
|---|---|
BuildingRow | None
|
The building's row as it now stands; None when the reply has none |
Client: IsoServerCommands.moveObject (bundle line 63799) sends C2SRemoveFromDistrictVO for a
building in a district; RDECommand.executeCommand (bundle line 123249)
sell_decoration
¶
Sell a decoration placed in the joined castle.
destroy_building
¶
Start taking a building in the joined castle down.
finish_construction
¶
finish_construction(castle_id: int, object_id: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None
Finish a building's running build or upgrade at once.
Joins the castle first, as the client is inside it, and works out the time left from the
join's reply as the client does. With at most FREE_SKIP_TIME (240) seconds left it
finishes for free, sent as a free skip; with more left, or the time left not known (a
repair or tear-down, an unknown building or player level), it costs rubies; see "Spending
rubies" in the guides. A subscription that lengthens the free time is not checked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
object_id
|
int
|
The building's object id |
required |
spend_rubies
|
bool
|
Allow finishing a construction that costs rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
More than 240 seconds are left, or the time left is not known, and
|
GameDataNotLoadedError
|
the game data cannot be loaded |
UnknownCastleError / CommandError
|
see |
Client: IsoServerCommands.fastCompleteBuilding (bundle line 63773) sends FS 1 when
CastleSpecialEventData.hasSkipForFree (bundle line 139853), which calculateSkipCosts
(bundle line 139849) decides from getTimeLeftForBuilding (bundle line 17967);
FREE_SKIP_TIME (dll line 18962)
skip_construction_time
¶
skip_construction_time(object_id: int, minute_skip: Currency | str, *, timeout: float = 5.0) -> None
Shorten a building's running construction with a minute skip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id
|
int
|
The building's object id |
required |
minute_skip
|
Currency | str
|
The minute skip to use, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: BuildingMinuteSkipProperties.getMinuteSkipCommand (bundle line 50021),
CastleMinuteSkipDialog.showLoaded (bundle line 7671)
upgrade_defense
¶
upgrade_defense(castle_id: int, object_id: int, *, spend_rubies: bool = False, private_offer_id: int = -1, timeout: float = 5.0) -> None
Upgrade a wall, gate or tower of one of your castles, by its object id.
Joins the castle first, as the client is inside it, and prices the building from the
join's reply: the level it upgrades to, by BuildingDef.rubies_to_build at your level,
needs spend_rubies when it has a ruby price; see "Spending rubies" in the guides.
spend_rubies also pays missing resources with rubies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
object_id
|
int
|
The wall's, gate's or tower's object id |
required |
spend_rubies
|
bool
|
Allow a ruby price, and pay the missing resources with rubies |
False
|
private_offer_id
|
int
|
The private offer the upgrade uses, -1 for none |
-1
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The next level has a ruby price, or the object or its next level is not
known, and |
GameDataNotLoadedError
|
|
UnknownCastleError / CommandError
|
see |
Client: C2SIsoUpgradeDefenceVO, sent with PWR 1 by
CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35220); the price
as for upgrade_building
repair_building
¶
repair_building(object_id: int, *, spend_rubies: bool = False, private_offer_id: int = -1, timeout: float = 5.0) -> None
Repair a damaged building in the joined castle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_id
|
int
|
The building's object id |
required |
spend_rubies
|
bool
|
Pay the missing resources with rubies; see "Spending rubies" in the guides |
False
|
private_offer_id
|
int
|
The private offer the repair uses, -1 for none |
-1
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Client: IsoServerCommands.repairBuilding (bundle line 63770); with rubies,
CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35221)
repair_all
¶
Repair every damaged building in the joined castle at once, for rubies; see "Spending rubies" in the guides.
The price follows the damage's total repair time and is not worked out here, so this
always needs spend_rubies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Allow the rubies it costs; without it nothing is sent |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleRepairTipDialog (bundle lines 97414, 97430) prices it with
AreaData.getTotalRepairCostC2 (bundle line 131460), ConstructionConst.getRepairAllCostsC2
(dll lines 18966-18969)
buy_expansion
¶
buy_expansion(x: int, y: int, rotation: int = 0, expansion_type: ExpansionType = NORMAL, *, spend_rubies: bool = False, timeout: float = 5.0) -> None
Buy an expansion of the joined castle's grounds, with resources (NORMAL) or rubies (PREMIUM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
Castle grid x of the expansion |
required |
y
|
int
|
Castle grid y of the expansion |
required |
rotation
|
int
|
Rotation |
0
|
expansion_type
|
ExpansionType
|
NORMAL or PREMIUM; PREMIUM costs rubies, see "Spending rubies" in the guides |
NORMAL
|
spend_rubies
|
bool
|
Allow a PREMIUM expansion |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleExpansionVE (bundle line 86849) needs userHasC2ForBuy for a premium
expansion before sendBuyRequestToServer (bundle line 86854)
open_treasure_chest
¶
Open a treasure chest found on an expansion of the joined castle.
collect_mine
¶
Collect what a mine in the joined castle has produced.
collect_resource_cart
¶
collect_resource_cart(cart_type: ResourceCartType, *, timeout: float = 5.0) -> None
Collect the joined castle's resource cart of one resource.
collect_resource_citizen
¶
collect_resource_citizen(*, timeout: float = 5.0) -> ResourcePoolResponse
Collect what the citizen walking in the joined castle carries.
Returns:
| Type | Description |
|---|---|
ResourcePoolResponse
|
The |
Client: IsoServerCommands.collectResourcePool (bundle line 63801) sends C2SIsoResourceCitizenVO;
IRCCommand.executeCommand (bundle line 123132)
get_upgradable_buildings
¶
get_upgradable_buildings(wod_id: Building, *, prime_sale_upgrade: bool = True, timeout: float = 5.0) -> ShowUpgradableBuildingsResponse
Find your castles holding a building of one type that a prime sale can upgrade.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wod_id
|
Building
|
The building type the sale is for |
required |
prime_sale_upgrade
|
bool
|
The sale discounts the upgrade of every level, as the client sends by default |
True
|
Client: CastlePrimeSaleDialog.onOkButton (bundle line 37771) sends C2SShowMeUpgradeBuildingsVO;
SUBCommand.executeCommand (bundle line 129862)
get_transportation_buildings
¶
The main castle's buildings a castle transport to the Outer Realms takes along.
Client: CastleSpecialServerPreBuildCastleSelectionDialog.showLoaded (bundle line 27960) sends
C2SGetCastleTransportationBuildingsVO; GCTBCommand.executeCommand (bundle line 128860)
get_feast_cost_reduction
¶
The discount on feasts, in percent.
Client: CastleFestivalDialog.showLoaded (bundle line 65030) sends C2SGetFeastCostReductionVO;
CastleFestivalDialog.onFCEArrived (bundle line 65044) reads FRM
unlocks
¶
unlocks(castle_id: int) -> PermanentCastle | None
One of your castles' unlocked units and horses, from the last gpc that named it.
set_hunter
¶
Set the joined castle's hunter to turn wood and stone production into food_boost more food.
Raises:
| Type | Description |
|---|---|
CommandError
|
The server refused, e.g. a boost above the hunter's maximum |
Client: CastleHunterDialog.onClick (bundle line 51530) sends C2SHunterInfoVO with a value from 0 to
the hunter building's hunterMax; HINCommand.executeCommand (bundle line 124591)
judge_citizen
¶
judge_citizen(option: JudgementOption, *, timeout: float = 5.0) -> None
Give your verdict on the open citizen judgement, which ends it.
Raises:
| Type | Description |
|---|---|
CommandError
|
The server refused, e.g. no judgement is open or the verdict's requirements are unmet |
Client: CastleJudgementChooseOptionDialog.onClick (bundle lines 95550-95552),
JJCCommand.executeCommand (bundle line 124666)
resource_cart
¶
resource_cart(cart_type: ResourceCartType) -> ResourceCart | None
The cart of one resource in the last rci; None before any.
get_kingdoms
¶
get_kingdoms(*, timeout: float = 5.0) -> KingdomInfoResponse
Ask for your kingdoms and the transfers to them; the reply also updates kingdoms.
It lists the kingdoms the server sends, which kingdoms merges over those known.
Client: CastleHandleKingdomDialog.showLoaded (bundle line 55406) sends C2SKingdomPayInfoVO
get_villages
¶
get_villages(*, timeout: float = 5.0) -> VillageListResponse
Ask for your villages and private resource villages; the reply also updates villages.
Client: CastleListVillagesOverviewDialog.getData (bundle line 108009) sends
C2SKingdomGetVillageListVO
unlock_kingdom
¶
unlock_kingdom(castle: PrebuiltCastle, direction: KingdomDirection | None = None, *, ruby_price: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> None
Unlock a kingdom with one of its prebuilt castles, e.g. PrebuiltCastle.ICE_KNIGHTLY_CASTLE.
The castle names its kingdom and price. One whose only price is rubies is bought with them; one
priced in resources is bought with those, or with ruby_price at its ruby price, as the client's
two buttons offer. Rubies spent need spend_rubies; buying with resources, spend_rubies pays
any missing ones with rubies. A Storm Islands castle is priced by the islands' castle selection
alone and asks for no level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle
|
PrebuiltCastle
|
The prebuilt castle |
required |
direction
|
KingdomDirection | None
|
The side of the map to place the castle on; None for the Storm Islands, which take none |
None
|
ruby_price
|
bool
|
Buy the castle at its ruby price |
False
|
spend_rubies
|
bool
|
Allow spending rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The castle starts no kingdom (Battle for Berimond's camps join with
|
GameDataNotLoadedError
|
The game data cannot be loaded |
StateNotLoadedError
|
Outside the Storm Islands, no login has brought your level |
CommandError
|
The server refused |
Client: AUnlockPrebuiltCastle.buyPrebuiltCastle (bundle line 55479) sends the castle's first space
and asks the direction (CastleKingdomChooseLocalizationDialog), offering only a castle your level
reaches (PrebuiltCastleSelector.validateSelection, bundle line 54604); UnlockPrebuiltCastleForRubies
(bundle line 55514) sets OC2 for the castle CastleKingdomCastleDetails.getSublayerForCastle
(bundle line 97911) shows as premium; the Storm Islands castle selection, which checks no level, always
sends a direction of 0 and OC2 when its costs hold rubies
(CastleSpecialServerPreBuildCastleSelectionDialog.onConfirmed, bundle line 27956);
CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35239) sends PWR
get_all
¶
get_all(*, timeout: float = 5.0) -> list[CastleInfo]
get_details
¶
get_details(castle_id: int, *, timeout: float = 5.0) -> DetailedCastleInfo
Get resources and stationed units for one castle.
The server answers with every castle of yours; the one asked for is picked out here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, from |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
The reply lists no castle with that id |
get_landmark_progress
¶
get_landmark_progress(landmark: MapAreaItem, *, timeout: float = 5.0) -> LandmarkProgress
A monument's or laboratory's upgrade points, asked for by its map row's object id.
A laboratory is asked with glp, a monument with gmp, as their upgrade dialogs ask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
landmark
|
MapAreaItem
|
The landmark's map row, e.g. from |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The row is neither a monument nor a laboratory |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
see |
Client: CastleUpgradeLaboratoryDialogProperties.progressCommandVO and
CastleUpgradeLandmarkDialogProperties.progressCommandVO (bundle lines 51665, 51709)
select
¶
Select/jump to a castle (makes it the active castle).
Use join for the castle's state the server sends back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
Client: C2SJoinCastleVO sent with the castle's objectId and
kingdomID (JoinAreaAndSavePositionCommand.execute, bundle line 100892)
join
¶
join(castle_id: int, *, timeout: float = 5.0) -> SelectCastleResponse
Join a castle, making it the active castle, and return its state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
CommandError
|
The server refused the join. |
Client: C2SJoinCastleVO sent with the castle's objectId and
kingdomID (JoinAreaAndSavePositionCommand.execute, bundle line 100892)
join_area
¶
join_area(x: int, y: int, kingdom_id: Kingdom = GREEN, *, timeout: float = 5.0) -> SelectCastleResponse
Join an area by its position (jaa), making it the active area, and return its state.
The client joins this way the objects it may visit that are not
castles: outposts, capitals, metropolises and Berimond camps that are
not destroyed, and a kingdom castle just after its first naming. It
joins main and kingdom castles otherwise by id, as join does.
It never joins anything else (see JoinAreaRequest).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
Map x of the area |
required |
y
|
int
|
Map y of the area |
required |
kingdom_id
|
Kingdom
|
The kingdom it lies in |
GREEN
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
CommandError
|
The server refused the join; a live server answered INVALID_POSITION (6) for objects the client never joins, such as NPC camps and royal towers |
Client: JoinAreaAndSavePositionCommand.execute (bundle line 100892),
JAACommand.executeCommand (bundle line 130190)
get_resources
¶
get_resources(castle_id: int, *, timeout: float = 5.0) -> CastleResources
Get one of your castles' resources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
Client: C2SGetCastleResourcesVO sent with the castle's objectId and
kingdomID (CastleTransferResourcesDialog.onSelectCastle, bundle line 38076)
get_production
¶
get_production(*, timeout: float = 5.0) -> CastleProductionArea
horses
¶
horses(castle_id: int) -> list[HorseStats] | None
The horses one of your castles can send movements with, by wod id.
Read from the login data's gpc section and its pushes; nothing is
sent. A horse whose is_instant_spy_horse is set can be paid with
rubies or, sent as feathers=True, with feathers; the client shows it
twice, once per payment. An id missing from the game data is left out,
as the client leaves it out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, |
required |
Returns:
| Type | Description |
|---|---|
list[HorseStats] | None
|
The horses sorted by wod id, or None when no |
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
the game data cannot be loaded |
UnknownCastleError
|
|
Client: CastleHorsesVO.parseParamObject (bundle line 139177),
CastlePermanentCastleData.getCastleByWorldAreaId (bundle line 139145)
get_decoration_storages
¶
Read the decoration storages; they also reach decoration_storages.
Client: CastleDecoShopPanel.show (bundle line 9302) sends C2SShowInventoryVO with no
parameter; SINCommand.exec (bundle line 124638)
mark_storage_seen
¶
mark_storage_seen(storage_id: DecorationStorageKey, *, timeout: float = 5.0) -> None
Mark a storage's new decorations as seen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
storage_id
|
DecorationStorageKey
|
A |
required |
Client: SendMarkedBuildingsInStorage.execute (bundle line 101099) sends
C2SMarkBuildingInStorageVO for each storage shown
store_decoration
¶
Put a decoration of the joined castle into the storage.
Returns:
| Type | Description |
|---|---|
StoreBuildingResponse
|
The stored object's id and the storages after, which also reach |
Client: IsoServerCommands.storeBuildingToLocalInventory (bundle line 63795) sends
C2SIsoStoreObjectVO; SOBCommand.executeCommand (bundle line 124651)
sell_stored_decoration
¶
sell_stored_decoration(wod_id: Building, amount: int = 1, *, unique_id: int = -1, timeout: float = 5.0) -> SellStoredDecorationResponse
Sell decorations from the storage for coins; they are gone for good.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wod_id
|
Building
|
The decoration's type, a stored decoration's |
required |
amount
|
int
|
How many to sell |
1
|
unique_id
|
int
|
A unique decoration's |
-1
|
Returns:
| Type | Description |
|---|---|
SellStoredDecorationResponse
|
Coins and rubies, and the storages after, which also reach |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleConstructionSellDialog.onClick (bundle line 28636) sends C2SellStoredDeco;
SDSCommand.executeCommand (bundle line 131786)
place_stored_decoration
¶
place_stored_decoration(decoration_id: int, x: int, y: int, rotation: int = 0, *, timeout: float = 5.0) -> PlaceStoredDecorationResponse
Place a custom or unique decoration from the storage in the joined castle.
A regular stored decoration is placed with build of its type, as the client does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decoration_id
|
int
|
A stored |
required |
Returns:
| Type | Description |
|---|---|
PlaceStoredDecorationResponse
|
The placed decoration and the storages after, which also reach |
Client: IsoServerCommands.placeCustomInventoryObject (bundle line 63790), sent for a decoration
with a uniqueBuildingId (bundle line 64041); PIOCommand.executeCommand (bundle line 123181)
get_fusion_forges
¶
get_fusion_forges(forge_ids: Sequence[FusionForgeId] = (DECORATIONS,), *, timeout: float = 5.0) -> tuple[FusionForge, ...]
Fusion forges' level and energy; the reply also reaches fusion_forges.
Client: FusionForgeData.onGbdArrived (bundle line 142012), FusionForgeVO.requestDataFromServer
(bundle line 142199)
level_up_fusion_forge
¶
level_up_fusion_forge(forge_id: FusionForgeId = DECORATIONS, *, timeout: float = 5.0) -> int
Level a fusion forge up for decoration dust, and return its new level.
Client: DecorationForgeUpgradeDialog.onLevelUpButtonClicked (bundle line 78274),
FusionForgeVO.getCostForForgeLevelUp (bundle line 142209)
refill_fusion_forge
¶
refill_fusion_forge(forge_id: FusionForgeId = DECORATIONS, *, spend_rubies: bool = False, timeout: float = 5.0) -> int
Refill a fusion forge's energy for rubies, and return the energy added.
The price rises with each refill (FusionForge.used_ruby_refills) by the forge's
GameData.fusion_systems row (refill_cost_rubies, refill_cost_factor).
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: DecorationForgeRechargeEnergyDialog (bundle line 35619),
FusionForgeVO.getC2PriceForEnergyPremiumSkip (bundle line 142206)
convert_catalysts
¶
convert_catalysts(catalyst_id: CurrencyId | int, amount: int, direction: CatalystConversion, forge_id: FusionForgeId = DECORATIONS, *, timeout: float = 5.0) -> ConvertCatalystResponse
Assemble fusion catalysts, or disassemble them into decoration dust.
Client: ADecorationForgeCatalystConversionDialogInfoBox.onConfirmButtonClicked (bundle line 48367)
get_fusion_targets
¶
Your areas with the placed decorations a fusion can target.
Client: DecoStorageData.requestGTD (bundle line 141447)
fuse_decoration
¶
fuse_decoration(source_wod_id: Building, source_unique_id: int, target_area: FusionTargetArea, target: FusionDecoration, catalyst_id: CurrencyId | int, *, pay_with_rubies: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> FuseDecorationResponse
Fuse a stored decoration into a placed one. The stored decoration is used up.
The fusion spends the forge's energy and the catalyst, and the fusion currency, or rubies with
pay_with_rubies (the premium fusion).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_wod_id
|
Building
|
The stored decoration's building type |
required |
source_unique_id
|
int
|
The stored decoration's unique id |
required |
target_area
|
FusionTargetArea
|
The area of |
required |
target
|
FusionDecoration
|
One of |
required |
catalyst_id
|
CurrencyId | int
|
The catalyst used, a currency |
required |
pay_with_rubies
|
bool
|
The premium fusion |
False
|
spend_rubies
|
bool
|
Allow the premium fusion's rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: DecorationForgeMainDialog.onFuseButtonClicked (bundle line 35455)
get_brewery_production
¶
get_brewery_production(castle_id: int, brewery: BuildingRow, *, timeout: float = 5.0) -> BreweryProductionResponse
Read one of your castles' brewery production.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
brewery
|
BuildingRow
|
The brewery's row, from |
required |
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
Client: CastleBreweryShortageDialog.showLoaded (bundle line 138227) sends
C2SGetAreaBuildingProductionVO; ABPICommand.executeCommand (bundle line 122711)
set_brewery_production
¶
set_brewery_production(castle_id: int, brewery: BuildingRow, mead_percent: int, *, stop_at_food: int = 0, stop_at_honey: int = 0, timeout: float = 5.0) -> BreweryProductionResponse
Set how much of one of your castles' brewery makes mead, and the stocks at which it stops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
brewery
|
BuildingRow
|
The brewery's row, from |
required |
mead_percent
|
int
|
The share of the brewery producing mead, in percent |
required |
stop_at_food
|
int
|
Food left at which production stops |
0
|
stop_at_honey
|
int
|
Honey left at which production stops |
0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
Client: the brewery dialog's save button (bundle line 36458) sends C2SSetBreweryProductionVO;
ABPICommand.executeCommand (bundle line 122711)
set_mead_priority
¶
Give one of your castles' mead production priority, or take it away.
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
Client: the brewery dialog's priority checkbox (bundle line 36462) sends C2SSetMeadPrioVO
for the active castle; BFLCommand.executeCommand (bundle line 122726)
buy_private_village
¶
buy_private_village(village_type_id: PrivateVillageType, *, timeout: float = 5.0) -> None
Buy a private resource village with resource village tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
village_type_id
|
PrivateVillageType
|
The village, e.g. |
required |
Client: PrivateResourceVillageBuyDialog.onConfirm (bundle line 81673) sends
C2SBuyPrivateResourceVillageVO once APrivateResourceVillageActionDialog.onClick (bundle line
36219) found the tokens; BPVCommand.exec (bundle line 126459)
upgrade_private_village
¶
upgrade_private_village(village: PrivateVillage, *, timeout: float = 5.0) -> None
Upgrade one of your private resource villages to the next level, with resource village tokens.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
village
|
PrivateVillage
|
The village, a row of |
required |
Client: PrivateResourceVillageUpgradeDialog.onConfirm (bundle line 81600) sends
C2SUpgradePrivateResourceVillageVO; UPVCommand.exec (bundle line 126489)
remove_private_village
¶
remove_private_village(village: PrivateVillage, *, timeout: float = 5.0) -> None
Remove one of your private resource villages; it is gone for good, its tokens are not returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
village
|
PrivateVillage
|
The village, a row of |
required |
Client: PrivateResourceVillageDestroyDialog.onConfirm (bundle line 81568) sends
C2SRemovePrivateResourceVillageVO; RPVCommand.exec (bundle line 126474)
get_tax_info
¶
start_tax
¶
start_tax(tax_type: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> StartTaxResponse
Start a tax collection.
Tax types 0 to 6 collect for TAX_DURATIONS[tax_type] seconds. Type 0
is free and types 1 to 4 cost a tenth of their income in coins. Types 5
and 6 cost TAX_RUBY_COSTS rubies unless a premium account, a VIP
level or the tax research waives it; this method refuses them unless
spend_rubies is True, and does not check for a waiver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tax_type
|
int
|
The tax type, 0 to 6 |
required |
spend_rubies
|
bool
|
Allow types 5 and 6, which may spend rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
StartTaxResponse
|
The reply: coins and rubies after, and the tax status. |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
see |
Client: C2SStartCollectTaxVO (bundle line 91088), sent by
CastleCollectTaxElement.onStartTaxCollection (bundle line 91069), which
shows a ruby cost when CollectTaxElementVO.hasC2CostWithoutPremium
(bundle line 91050); TaxConst (dll lines 19771-19790)
collect_tax
¶
collect_tax(*, timeout: float = 5.0) -> CollectTaxResponse
Collect the tax.
Collecting while the collection runs brings the share of its income earned so far; the client asks first when that is nothing.
Returns:
| Type | Description |
|---|---|
CollectTaxResponse
|
The reply: the coins collected, coins and rubies after, and the tax status. |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
see |
Client: C2SCollectTaxVO (bundle line 41083), sent by
CastleCollectTaxDialog.collectTax (bundle line 91027) after
onCollectTaxClick (bundle line 91015); TaxConst.getCollectedMoney
(dll line 19784); TXCCommand (bundle line 128747)
bribe_tax_collector
¶
bribe_tax_collector(*, spend_rubies: bool = False, private_offer_id: int = -1, timeout: float = 5.0) -> BribeTaxCollectorResponse
Bribe the tax collector, a tax booster bought with rubies; see "Spending rubies" in the guides.
Its price comes with the boosters and is not worked out here, so this always needs spend_rubies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Allow the rubies it costs; without it nothing is sent |
False
|
private_offer_id
|
int
|
The booster sale the bribe uses, -1 for none |
-1
|
Returns:
| Type | Description |
|---|---|
BribeTaxCollectorResponse
|
Coins and rubies, and the tax status after; the booster reaches |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleBribeDialog.onClick (bundle line 90878) sends it once the rubies are there, with
CastleBoosterSaleData.getOfferId (bundle line 9696); BTXCommand.executeCommand (bundle line 128770)
open_gate_quote
¶
open_gate_quote(castle_id: int) -> OpenGateQuote
What opening one of your castles' gate would cost now, and whether the client offers it; nothing is sent.
The open time and opening count come from the castle list and the mos replies since, the
prices before ruby discounts from that count, as the client's start dialog shows them.
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
StateNotLoadedError
|
No login has brought the player |
Client: CastleStartOpenGateDialog.updateCosts (bundle line 35144) and getCastleList
(bundle line 35133); CastleOpenGatePremiumShopVO.canBeBought (bundle line 76693)
open_gate
¶
open_gate(castle_id: int, duration: OpenGateDuration, *, spend_rubies: bool = False, timeout: float = 5.0) -> OpenGateResponse
Buy an Open Gate for one of your castles: attackers loot it without a battle, so its buildings
take no damage and it loses no units, for duration. On an open gate it extends it, as the
client's extend button does. Each opening this week raises the castle's next price.
The reply updates the castle's Open Gate and your rubies in state. A timeout is not retried:
the purchase may still have gone through, so read open_gate_quote before trying again.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles, a |
required |
duration
|
OpenGateDuration
|
How long |
required |
spend_rubies
|
bool
|
Allow the rubies it costs; |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
UnknownCastleError
|
|
StateNotLoadedError
|
No login has brought the player |
CommandError
|
The server refused it; |
EmpireTimeoutError / ConnectionClosedError
|
see |
Client: CastleStartOpenGateDialog.onClick (bundle line 35154); MOSCommand.executeCommand
(bundle line 125119) shows error_openGate_eilandProtection for INVALID_PARAMETER_VALUE
close_gate
¶
Close one of your castles' open gate; nothing is refunded.
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
see |
Client: CastleManagementDialog.cancelOpenGateMode (bundle line 24683) sends C2SOpenGateStartVO with -1
get_research
¶
get_research(*, timeout: float = 5.0) -> ResearchInfoResponse
Read your research; the reply also reaches research.
Client: CastleResearchDialog.showLoaded (bundle line 16731) sends C2SResearchInfoVO;
REICommand.executeCommand (bundle line 126899)
start_research
¶
start_research(research: Research | int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None
Start a research, paying what it costs.
Missing resources are never paid with rubies: the request sends PWR 0, as the research
dialog does. Some researches cost rubies themselves (ResearchDef.cost_rubies), and the
client sends the same request for them; this method refuses those unless spend_rubies is
True. Other costs, legendary tokens included, are a normal game currency and are paid. The
reply's research reaches client.state.get_research().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
research
|
Research | int
|
The research to start |
required |
spend_rubies
|
bool
|
Allow a research that costs rubies, on either kind of server |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
the game data cannot be loaded |
ValueError
|
The game data has no such research, or it costs rubies and |
Client: ResearchInfo.buyResearch (bundle line 79704) sends C2SResearchStartVO whatever the
costs; updateBuyArea shows the ruby overlay when getFinalCosts holds rubies (bundle lines
79679-79680), and AResearchVO.getBaseCosts takes the Outer Realms' costs there (bundle
line 61530); RESCommand (bundle line 126872)
skip_research
¶
Shorten the running research with a minute skip from your inventory.
The reply's research reaches client.state.get_research().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
minute_skip
|
Currency | str
|
The minute skip to use, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: ResearchMinuteSkipProperties.getMinuteSkipCommand (bundle line 79784),
CastleMinuteSkipDialog.showLoaded (bundle line 7671), MSRCommand (bundle line 125825)
finish_research
¶
Finish the running research now, for rubies; see "Spending rubies" in the guides.
The price follows the time left and is not worked out here, so this always needs spend_rubies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Allow the rubies it costs; without it nothing is sent |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused, |
Client: ResearchProgressInfo.buyResearchInstant (bundle line 413633), priced by
ResearchConst.getFastCompleteCostC2 (ResearchMinuteSkipProperties.getSkipCost, bundle line
413787); RFICommand.executeCommand (bundle line 641922)
list_missions
¶
list_missions(*, timeout: float = 5.0) -> MercenaryMissionsResponse
The mercenary camp's missions, and when new ones come.
Sends mpe with MID -1, as the client does when it opens the camp and when new missions
are due; the reply also reaches client.state.get_mercenary_missions().
Client: CastleMercenaryOverviewDialog.showLoaded and CastleMercenaryData.onNewMissions
(bundle lines 51996, 28851)
start_mission
¶
Start an open mercenary mission, paying its price in coins.
Lists the missions first and decides from that reply, as the client decides from its mission state: only an open mission starts, and only while no mission runs or waits to be collected. While one runs the client would first finish it for rubies; that is left out.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mission_id
|
int
|
A |
required |
timeout
|
float
|
Timeout in seconds, for each request |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The missions list no such mission, it is not open, or another mission runs or waits to be collected |
Client: CastleMercenaryMissionItem.startMission, showStartAndRefreshButton and
startMissionCallback (bundle lines 87377, 87361, 87379)
collect_mission
¶
Collect a finished mercenary mission's rewards.
The collect is the same mpe as the ruby skip of a running mission, which costs
ceil(remaining seconds / 60 * 5) rubies. So this lists the missions first and sends the
collect only for one the server lists as collectable, as started with no RD (finished for
the client, and a skip of it would cost 0 rubies), or as started with its time run out at
least two seconds ago, since RD is rounded. A started mission whose RD still counts
down is refused. Another session can still change the mission between the list and the
send; that window is not closed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mission_id
|
int
|
A |
required |
timeout
|
float
|
Timeout in seconds, for each request |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The missions list no such mission, or it is not collectable by that rule |
Client: CastleMercenaryMissionItem.showCollectButton and collectMissionRewards
(bundle lines 87365, 87382); CastleMercenaryMissionItemVO.fillFromParamObject sets no end
time without RD (bundle line 81134); CastleMercenarySkipMissionDialog.confirmSkip (bundle
line 87459) sends the same id, MercenaryConst.getSkipC2Cost (dll line 19508)
refresh_mission
¶
Swap an open mercenary mission for another, for REFRESH_MISSION_COST (240) rubies; see
"Spending rubies" in the guides.
Lists the missions first and decides from that reply, as the client decides from its mission state: only an open mission is swapped, and only while no mission waits to be collected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mission_id
|
int
|
A |
required |
spend_rubies
|
bool
|
Allow the rubies it costs; without it nothing is sent |
False
|
timeout
|
float
|
Timeout in seconds, for each request |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
Client: CastleMercenaryMissionItem.updateButtons and showStartAndRefreshButton (bundle lines
87390, 87396), refreshMissionCallback (bundle line 87416); RMMCommand.executeCommand (bundle
line 125166); MercenaryConst.REFRESH_MISSION_COST (dll line 19511)
get_crafting_queues
¶
The crafting queues of the refinery and toolsmith in every castle, as the crafting dialog asks for them.
Each has every slot of its game-data row (CraftingQueue.with_definition). The reply also
reaches crafting_queues.
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
The game data cannot be loaded |
Client: CastleCraftingData.getCraftingInfo (bundle line 111423), from
CastleRefineryToolsmithDialog.showLoaded (bundle line 29337)
start_crafting
¶
start_crafting(queue: CraftingQueue, recipe_id: CraftingRecipeId, *, timeout: float = 5.0) -> CraftingQueue
Start a recipe in a crafting queue, paying its costs.
The recipe must be one the queue's building crafts, with a free unlocked slot; the queue after
reaches crafting_queues.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queue
|
CraftingQueue
|
A queue of |
required |
recipe_id
|
CraftingRecipeId
|
The crafting recipe, a key of |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building is not working ( |
CommandError
|
The server refused, |
Client: CastleCraftingData.startCrafting (bundle line 111424)
cancel_crafting
¶
cancel_crafting(queue: CraftingQueue, slot: CraftingSlot, *, timeout: float = 5.0) -> CraftingQueue
Cancel the craft in one slot of a crafting queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queue
|
CraftingQueue
|
A queue of |
required |
slot
|
CraftingSlot
|
One of its |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building is not working ( |
Client: CastleCraftingData.cancelCrafting (bundle line 111426)
move_crafting_slot
¶
move_crafting_slot(queue: CraftingQueue, slot: CraftingSlot, to_index: int, *, timeout: float = 5.0) -> CraftingQueue
Move a waiting craft to another waiting slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queue
|
CraftingQueue
|
A queue of |
required |
slot
|
CraftingSlot
|
One of its |
required |
to_index
|
int
|
Where the craft goes, from 0 |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building is not working ( |
Client: CastleCraftingData.moveQueueSlot (bundle line 111433)
skip_crafting
¶
skip_crafting(queue: CraftingQueue, slot: CraftingSlot, price: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> CraftingQueue
Finish the craft in one slot for rubies.
The client prices the skip as the recipe's skipCostC2 times the share of its time left, rounded
up, and sends that price; the game data here has no crafting recipes to price it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queue
|
CraftingQueue
|
A queue of |
required |
slot
|
CraftingSlot
|
One of its |
required |
price
|
int
|
The rubies the skip costs |
required |
spend_rubies
|
bool
|
Allow spending them |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building is not working, or |
Client: CastleCraftingData.skipCrafting (bundle line 111428), CraftingSlotVO.getAdjustedSkipCostC2
(bundle line 17012)
unlock_crafting_slot
¶
unlock_crafting_slot(queue: CraftingQueue, slot: CraftingSlot, *, timeout: float = 5.0) -> CraftingQueue
Unlock a temporary slot of a crafting queue for coins.
Every locked slot right before it is unlocked with it, as the client buys them
(CraftingQueue.unlock_indices).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
queue
|
CraftingQueue
|
A queue of |
required |
slot
|
CraftingSlot
|
One of its locked temporary slots |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The building is not working ( |
Client: CastleCraftingData.buySlot (bundle line 111430), CraftingSlotVO.getUnlockCostC1
(bundle line 17009)
get_construction_crafting
¶
get_construction_crafting(*, timeout: float = 5.0) -> ConstructionCraftingResponse
The construction item being crafted and the time left; both None while nothing is crafted.
Client: CastleConstructionItemsCraftingSublayer.onGCCArrived (bundle line 79577)
craft_construction_item
¶
craft_construction_item(castle_id: int, recipe_id: ConstructionItemRecipeId, *, timeout: float = 5.0) -> None
Craft a construction item from a recipe, paying its costs; one craft runs at a time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
One of your castles; the client crafts in the joined castle, else the kingdom's main castle |
required |
recipe_id
|
ConstructionItemRecipeId
|
The recipe, a key of |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
UnknownCastleError
|
|
CommandError
|
The server refused |
Client: CastleConstructionItemsCraftingSublayerProgress.onClick (bundle line 79926)
skip_construction_crafting_time
¶
skip_construction_crafting_time(castle_id: int, minute_skip: Currency | str, *, timeout: float = 5.0) -> None
Shorten the running construction item craft with a minute skip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
castle_id
|
int
|
The castle the craft runs in |
required |
minute_skip
|
Currency | str
|
The minute skip to use, |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
UnknownCastleError
|
|
Client: ConstructionItemCraftingMinuteSkipProperties.getMinuteSkipCommand (bundle line 79954)
finish_construction_crafting
¶
finish_construction_crafting(castle_id: int, *, spend_rubies: bool = False, timeout: float = 5.0) -> None
Finish the running construction item craft for rubies.
The price falls with the time left (ConstructionConst.getFastCompleteCostC2) and is not checked
here, so the call always needs spend_rubies.
Raises:
| Type | Description |
|---|---|
ValueError
|
|
UnknownCastleError
|
|
Client: CastleConstructionItemsCraftingSublayerProgress.onClick (bundle line 79930),
craftingTimer (bundle line 79907)
get_wishing_well
¶
get_wishing_well(*, timeout: float = 5.0) -> WishingWellResponse
Read the wishing well's level and time from the server; its reply also updates wishing_well.
Client: CastleRubyWishingWellData.requestFreshWishingWellData (split.js line 110510)
start_wishing_well
¶
start_wishing_well(*, spend_rubies: bool = False, timeout: float = 5.0) -> WishingWellResponse
Start the wishing well: it takes its level's entry rubies and lucky pennies, and gives twice the rubies once its waiting time has passed. See "Spending rubies" in the guides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Allow the entry rubies; without it nothing is sent |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused, |
Client: RubyWishingWellDialog.updateArrow and onClick (split.js lines 266174, 266334), the entry
rubies and lucky pennies from CastleRubyWishingWellVO.parseXML (split.js line 328993); the dialog's
dialog_rubyWishingWell_desc_general text asks to throw in that many rubies and a lucky penny
finish_wishing_well
¶
finish_wishing_well(*, spend_rubies: bool = False, timeout: float = 5.0) -> WishingWellResponse
Finish the running wishing well now, for rubies; see "Spending rubies" in the guides. Whether the
rubies still need collect_wishing_well after is the server's to say; read the reply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Allow the rubies it costs, |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused |
Client: RubyWishingWellDialog.updateArrow and onClick (split.js lines 266174, 266334)
collect_wishing_well
¶
collect_wishing_well(*, timeout: float = 5.0) -> WishingWellResponse
Collect the rubies of a finished wishing well.
Client: RubyWishingWellFixedPositionBuildingVE.onMouseClick (split.js line 444996) and
RubyWishingWellDialog.onClick (split.js line 266334)
upgrade_wishing_well
¶
upgrade_wishing_well(*, spend_rubies: bool = False, timeout: float = 5.0) -> WishingWellResponse
Upgrade the wishing well to its next level, for the wood and stone that level costs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spend_rubies
|
bool
|
Pay the resources you lack with rubies, as the client's resource dialog does; see "Spending rubies" in the guides |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
CommandError
|
The server refused, |
Client: IsoServerCommands.upgradeBuilding (split.js line 328747) sends it for wod ids 601 to 611;
with rubies, CastleResourceWaitDialogProperties.getResourceSkipCommand (split.js line 183792)
castle.models.actions¶
Castle actions.
Commands:
- jca: Join a castle (answered as jaa)
- jaa: Join an area by its position
- arc: Rename castle
- mas: Abandon a castle
- mac: Cancel abandoning a castle
- rst: Relocate castle
- laa: Leave the joined area
- gtwara: The joined area is gone, back to the world map
Classes:
| Name | Description |
|---|---|
SelectCastleRequest |
Join a castle, making it the session's active castle. |
JoinAreaRequest |
Join an area by its position rather than by castle id. |
SelectCastleResponse |
The joined area's state, the |
RenameCastleRequest |
Rename a castle. |
RenameCastleResponse |
Response to castle rename. |
AbandonCastleRequest |
Start abandoning one of your castles. |
AbandonCastleResponse |
The castle being abandoned and its timers. |
CancelAbandonCastleRequest |
Cancel abandoning one of your castles. |
CancelAbandonCastleResponse |
The castle kept; the client sets both its abandon timers to -1. |
RelocateCastleRequest |
Start a relocation to a new position. |
RelocateCastleResponse |
The relocation started. |
LeaveAreaRequest |
Leave the area you joined last. |
LeftRemovedAreaResponse |
The area you were in is gone, and the client goes back to the world map. |
SelectCastleRequest
pydantic-model
¶
Bases: BaseRequest
Join a castle, making it the session's active castle.
Command: jca (answered as 'jaa') Payload: {"CID": castle_id, "KID": kingdom_id}
Castle-scoped reads such as gui answer for the joined castle.
Client: C2SJoinCastleVO (bundle line 5841); its MY_CASTLE is -1
Fields:
JoinAreaRequest
pydantic-model
¶
Bases: BaseRequest
Join an area by its position rather than by castle id.
Command: jaa Payload: {"PX": x, "PY": y, "KID": kingdom_id}
The client joins a map object this way only when it may visit it and it
is not a castle: JoinAreaAndSavePositionCommand sends jca for a
CastleMapobjectVO (main and kingdom castles) and jaa for anything
else. Its callers pass either your own areas from the castle lists or,
from a double click on the world map or the ring menu's visit button,
an object whose canBeVisited is true: outposts, capitals and
metropolises, and Berimond camps that are not destroyed. Every other
object (NPC camps, dungeons, royal towers, villages, monuments and the
rest) says false, and the client never joins it; a live server answered
INVALID_POSITION (6) for NPC camps and a royal tower. ARCCommand
also joins a kingdom castle by position after its first naming, and a
live server accepted that too. Joining another
player's outpost is what the client allows; whether the server accepts it
is unverified.
Client: C2SJoinAreaVO (bundle line 56128), whose key order the fields
follow; sent by JoinAreaAndSavePositionCommand.execute (bundle line
100892) and ARCCommand.executeCommand (bundle line 124969);
CastleWorldMapScreen.onDoubleClickCastle (bundle line 39601) and
ButtonVisitCastleComponent (bundle line 110159) check
canBeVisited, on InteractiveMapobjectVO (bundle line 3678),
OutpostMapobjectVO (bundle line 18829), CastleMapobjectVO
(bundle line 18924) and FactionCampMapobjectVO (bundle line 21538)
Fields:
accepts_reply
¶
Whether a jaa reply is for this area: its KID and, when sent, the joined area's row position.
Client: JAACommand (bundle line 130190) switches to the reply's KID;
AreaFactory.parseAreaInfo (bundle line 130226) reads the area from
gca.A with WorldmapObjectFactory.parseWorldMapArea (bundle line
5343), whose parser for every area type takes the position from A[1]
and A[2] (BasicMapobjectVO, InteractiveMapobjectVO,
CapitalMapobjectVO, MetropolMapobjectVO, FactionCampMapobjectVO
and the rest, bundle lines 3631-76548). A treasure camp (T 8) is the
exception: its area is not read from A, so its reply is not checked
for position.
SelectCastleResponse
pydantic-model
¶
Bases: BaseResponse
The joined area's state, the jaa the server answers a join with.
Command: jaa, the answer to both jca and a jaa by position; the
client reads both with the same code.
Payload: {"KID": kingdom, "T": area_type, "gca": {...}, "grc": {...}, "gpa": {...}, ...}
A block that cannot be read is None, so it does not cost the rest. The
other blocks (spl0 to spl3, gui, uap) are kept as sent.
Client: JAACommand.executeCommand (split.js line 654202),
AreaFactory.parseAreaInfo (split.js line 654365), which reads the gca block's A as a
world map row and a truthy O as its owner, AreaDataUpdater.parseJAA (split.js line 658985),
CastleCraftingData.parseAllQueueData (split.js line 574193) for a truthy crai
Fields:
-
error_code(int) -
kingdom(Kingdom | None) -
area_type(MapItemType | None) -
buildings(CastleBuildings | None) -
resources(CastleResources | None) -
production_area(CastleProductionArea | None) -
slum_level(SlumLevel | None) -
area_booster(AreaBooster | None) -
mines(MineStatusList | None) -
resource_carts(ResourceCartInfo | None) -
brewery(BreweryProductionResponse | None) -
storages(DecorationStorages) -
crafting_queues(CraftingQueues | None) -
hunter(HunterInfo | None) -
area(PlayerCastle | None) -
owner(MapObject | None)
Validators:
-
_area_info -
_area_type→area_type -
_kingdom→kingdom -
_buildings→buildings -
_resources→resources -
_production_area→production_area -
_slum_level→slum_level -
_area_booster→area_booster -
_mines→mines -
_resource_carts→resource_carts -
_brewery→brewery -
_crafting_queues→crafting_queues -
_hunter→hunter
kingdom
pydantic-field
¶
Wire key KID
The joined area's kingdom; None for one Kingdom lacks
area_type
pydantic-field
¶
area_type: MapItemType | None = None
Wire key T
The joined area's type; None for one MapItemType lacks
buildings
pydantic-field
¶
buildings: CastleBuildings | None = None
Wire key gca
The area's buildings; None when the reply has none
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The area's resources; None when the reply has none
production_area
pydantic-field
¶
production_area: CastleProductionArea | None = None
Wire key gpa
The area's production area; None when the reply has none
slum_level
pydantic-field
¶
slum_level: SlumLevel | None = None
Wire key csl
The area's slum level; None when the reply has none
area_booster
pydantic-field
¶
area_booster: AreaBooster | None = None
Wire key gab
The area's builder discount; None when the reply has none
mines
pydantic-field
¶
mines: MineStatusList | None = None
Wire key gsm
The area's mines; None when the reply has none
resource_carts
pydantic-field
¶
resource_carts: ResourceCartInfo | None = None
Wire key rci
The area's resource carts; None when the reply has none
brewery
pydantic-field
¶
Wire key abpi
The castle's brewery production; None when the reply has none
storages
pydantic-field
¶
Wire key sin
The decoration storages the reply names
crafting_queues
pydantic-field
¶
Wire key crai
Every castle's crafting queues; None when the reply has no crafting areas
hunter
pydantic-field
¶
Wire key hin
The hunter's values; None when the reply has none
area
pydantic-field
¶
area: PlayerCastle | None = None
The joined area's map row, the gca block's A; None when the reply has none or it cannot be read
RenameCastleRequest
pydantic-model
¶
Bases: BaseRequest
Rename a castle.
Command: arc Payload: {"CID": castle_id, "P": 0 or 1, "KID": kingdom_id, "AT": area_type, "N": name}
The keys follow the client's order: the constructor initialises CID, P, KID and AT before it sets N, which it encodes as it encodes any text it sends.
Client: C2SRenameCastleVO (bundle line 42424)
Fields:
RenameCastleResponse
pydantic-model
¶
Bases: BaseResponse
Response to castle rename.
Command: arc Payload: {"CID": castle_id, "KID": kingdom_id, "P": 0 or 1}
Client: ARCCommand.executeCommand (bundle line 124966), which looks the
castle up by CID and KID, and joins a kingdom castle's area again after a
first naming (P 0)
Fields:
-
error_code(int) -
castle_id(int) -
kingdom_id(Kingdom) -
is_rename(int)
AbandonCastleRequest
pydantic-model
¶
Bases: BaseRequest
Start abandoning one of your castles.
Command: mas Payload: {"CID": castle_id, "KID": kingdom_id}
The castle is given up after OutpostConst.ABANDON_TIME (86400 s),
and the abandon may be cancelled within ABANDON_CANCEL_TIME (10800 s).
Client: C2SAbandonOutpostStartVO (bundle line 104735), sent by
CastleManagementDialog.onAbandonOutpost (bundle line 24630);
OutpostConst (dll line 19530)
Fields:
AbandonCastleResponse
pydantic-model
¶
Bases: BaseResponse
The castle being abandoned and its timers.
Command: mas Payload: {"CID": castle_id, "KID": kingdom_id, "AOT": seconds, "CAT": seconds}
Client: MASCommand.executeCommand (split.js line 635734),
CastleUserData.parse_MAS (split.js line 54139), which reads AOT and CAT through int()
Fields:
CancelAbandonCastleRequest
pydantic-model
¶
Bases: BaseRequest
Cancel abandoning one of your castles.
Command: mac Payload: {"CID": castle_id, "KID": kingdom_id}
The client offers it only while the castle's CAT is above 0.
Client: C2SAbandonOutpostCancelVO (bundle line 104726), sent by
CastleManagementDialog.onCancelAbandoning (bundle line 24629)
Fields:
CancelAbandonCastleResponse
pydantic-model
¶
Bases: BaseResponse
The castle kept; the client sets both its abandon timers to -1.
Command: mac Payload: {"CID": castle_id, "KID": kingdom_id}
Client: MACCommand.executeCommand (split.js line 635691),
CastleUserData.parse_MAC (split.js line 54146)
Fields:
-
error_code(int) -
castle_id(int) -
kingdom_id(Kingdom)
RelocateCastleRequest
pydantic-model
¶
Bases: BaseRequest
Start a relocation to a new position.
Command: rst Payload: {"PX": x, "PY": y}
The client sends only the position: no castle id and no kingdom. It relocates the main castle in the green kingdom.
Client: C2SStartRelocationVO (bundle line 109671), sent by
CastleRelocateDialog.onClick (bundle line 109656)
Fields:
RelocateCastleResponse
pydantic-model
¶
Bases: BaseResponse
The relocation started.
Command: rst
Client: RSTCommand.executeCommand (bundle line 126855) reads nothing from the reply
Fields:
LeaveAreaRequest
pydantic-model
¶
Bases: BaseRequest
Leave the area you joined last.
Command: laa Payload: {}
The client registers no handler for an laa reply.
Client: C2SLeaveAreaVO (bundle line 108588), sent by CastleKingdomOverviewScreen.show
(bundle line 108518)
LeftRemovedAreaResponse
pydantic-model
¶
Bases: BaseResponse
The area you were in is gone, and the client goes back to the world map.
Command: gtwara, pushed
Client: GTWARACommand.executeCommand (bundle line 127296) reads nothing and runs
SwitchToWorldmapCommand
Fields:
castle.models.buildings¶
Building commands.
Every command acts on the castle joined with jca (client.castle.select)
and names a building by its object id, a BuildingRow.object_id from the
castle's CastleBuildings (client.castle.join).
Commands:
- ebu: Build
- eup: Upgrade a building
- emo: Move a building
- sbd: Sell a decoration
- edo: Take a building down
- fco: Finish a construction at once
- msb: Shorten a construction with a minute skip
- eud: Upgrade the wall, gate or a tower
- rbu: Repair a building
- ira: Repair every building
- ebe: Buy a castle expansion
- etc: Open an expansion's treasure chest
Classes:
| Name | Description |
|---|---|
BuildRequest |
Place a new building in the joined castle. |
BuildResponse |
The new building. |
UpgradeBuildingRequest |
Upgrade a building in the joined castle. |
UpgradeBuildingResponse |
The upgraded buildings. |
MoveBuildingRequest |
Move a building in the joined castle. |
MoveBuildingResponse |
The moved building. |
SellBuildingRequest |
Sell a decoration placed in the joined castle. |
SellBuildingResponse |
The sold decoration. |
DestroyBuildingRequest |
Start taking a building in the joined castle down. |
DestroyBuildingResponse |
The building being taken down. |
FastCompleteRequest |
Finish a building's running construction at once: for free with |
FastCompleteResponse |
The finished building. |
TimeSkipBuildingRequest |
Shorten a building's running construction with a minute skip. |
TimeSkipBuildingResponse |
The construction slots after a minute skip. |
UpgradeWallRequest |
Upgrade the joined castle's wall, gate or one of its towers. |
UpgradeWallResponse |
The upgraded wall, gate or tower. |
RepairBuildingRequest |
Repair a damaged building in the joined castle. |
RepairBuildingResponse |
The building being repaired. |
RepairAllRequest |
Repair every damaged building in the joined castle at once. |
RepairAllResponse |
The repaired buildings. |
BuyExtensionRequest |
Buy an expansion of the joined castle's grounds. |
BuyExtensionResponse |
The castle after the expansion. |
CollectExtensionGiftRequest |
Open a treasure chest found on an expansion of the joined castle. |
CollectExtensionGiftResponse |
The opened chest. |
BuildRequest
pydantic-model
¶
Bases: BaseRequest
Place a new building in the joined castle.
Command: ebu Payload: {"WID": wod_id, "X": x, "Y": y, "R": rotation, "PWR": 0 or 1, "PO": offer_id, "DOID": district_id}
Keys follow the client's order: the constructor initialises PWR before PO. To place a building into a district the client sends X and Y as -1 and the district's object id as DOID.
Client: C2SIsoBuyObjectVO (bundle line 31942), sent by
IsoServerCommands.buyObjectFromShop (bundle line 63766)
Fields:
-
wod_id(EnumOrInt['Building']) -
x(int) -
y(int) -
rotation(int) -
pay_with_rubies(bool) -
private_offer_id(int) -
district_object_id(int)
BuildResponse
pydantic-model
¶
Bases: _BuildingReply
The new building.
Command: ebu Payload: {"NO": row, "grc": {..}, "scl": {..}, "gcu": {..}, "sin": [..], "fbe": ..}
fbe is kept as sent.
Client: EBUCommand.executeCommand (bundle line 122760),
AreaDataUpdater.parseEBU (bundle line 131512)
Fields:
-
error_code(int) -
building(BuildingRow | None) -
resources(CastleResources | None) -
construction_list(ConstructionList | None) -
currencies(CurrencyBlock) -
storages(DecorationStorages)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
UpgradeBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Upgrade a building in the joined castle.
Command: eup Payload: {"OID": object_id, "PWR": 0 or 1, "PO": offer_id}
Keys follow the client's order: the constructor initialises PWR before PO.
Client: C2SIsoUpgradeObjectVO (bundle line 31971)
Fields:
UpgradeBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The upgraded buildings.
Command: eup Payload: {"O": [row, ...], "grc": {..}, "scl": {..}, "gcu": {..}}
Client: EUPCommand.executeCommand (bundle line 122860),
AreaDataUpdater.parseEUP (bundle line 131516)
Fields:
-
error_code(int) -
buildings(list[BuildingRow]) -
resources(CastleResources | None) -
construction_list(ConstructionList | None) -
currencies(CurrencyBlock)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
MoveBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Move a building in the joined castle.
Command: emo Payload: {"OID": object_id, "X": x, "Y": y, "R": rotation}
Client: C2SIsoMoveObjectVO (bundle line 63796), sent by
IsoServerCommands.moveObject (bundle line 63776) for a building outside
a district
Fields:
MoveBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The moved building.
Command: emo Payload: {"MO": row}
Client: EMOCommand.executeCommand (bundle line 122815), which also
reads the reply to a failed move, AreaDataUpdater.parseEMO (bundle line 131518)
Fields:
-
error_code(int) -
building(BuildingRow | None)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
building
pydantic-field
¶
building: BuildingRow | None = None
Wire key MO
The building where it now stands
SellBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Sell a decoration placed in the joined castle.
Command: sbd Payload: {"OID": object_id}
Client: C2SellBuildingDeco (bundle line 77740), sent from the sell
dialog of a placed decoration (bundle line 28587)
Fields:
SellBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The sold decoration.
Command: sbd Payload: {"OID": object_id, "gcu": {..}}
Client: SBDCommand.executeCommand (bundle line 131722),
AreaDataUpdater.parseSBD (bundle line 131522)
Fields:
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
DestroyBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Start taking a building in the joined castle down.
Command: edo Payload: {"OID": object_id}
Client: C2SIsoDisassembleObjectVO (bundle line 41065)
Fields:
DestroyBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The building being taken down.
Command: edo Payload: {"O": row, "scl": {..}}
Client: EDOCommand.executeCommand (bundle line 122781),
AreaDataUpdater.parseEDO (bundle line 131513), which reads the reply
itself as the row
Fields:
-
error_code(int) -
building(BuildingRow | None) -
construction_list(ConstructionList | None)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
FastCompleteRequest
pydantic-model
¶
Bases: BaseRequest
Finish a building's running construction at once: for free with FS 1, else for rubies.
Command: fco Payload: {"OID": object_id, "FS": 0 or 1}
Client: C2SIsoFastCompleteObjectVO (bundle line 31951), sent by
IsoServerCommands.fastCompleteBuilding (bundle line 63773) with FS 1 when
CastleSpecialEventData.hasSkipForFree (bundle line 139853)
Fields:
FastCompleteResponse
pydantic-model
¶
Bases: _BuildingReply
The finished building.
Command: fco Payload: {"O": row, "gcu": {..}}
Client: FCOCommand.executeCommand (bundle line 122908),
AreaDataUpdater.parseFCO (bundle line 131519)
Fields:
-
error_code(int) -
building(BuildingRow | None) -
currencies(CurrencyBlock)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
TimeSkipBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Shorten a building's running construction with a minute skip.
Command: msb Payload: {"OID": object_id, "MST": minute_skip}
Keys follow the client's order: the constructor initialises OID and sets MST after it.
Client: C2SMinuteSkipBuildingVO (bundle line 81363), built by
BuildingMinuteSkipProperties.getMinuteSkipCommand (bundle line 50021);
CastleMinuteSkipDialog.onScrollItemClick passes the currency's
jsonKey (bundle line 7722)
Fields:
-
object_id(int) -
minute_skip(EnumOrStr['Currency'])
TimeSkipBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The construction slots after a minute skip.
Command: msb Payload: {"scl": {..}}
Client: MSBCommand.executeCommand (bundle line 125767)
Fields:
-
error_code(int) -
construction_list(ConstructionList | None)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
UpgradeWallRequest
pydantic-model
¶
Bases: BaseRequest
Upgrade the joined castle's wall, gate or one of its towers.
Command: eud Payload: {"OID": object_id, "PO": offer_id, "PWR": 0 or 1}
Client: C2SIsoUpgradeDefenceVO (bundle line 41075)
Fields:
UpgradeWallResponse
pydantic-model
¶
Bases: _BuildingReply
The upgraded wall, gate or tower.
Command: eud Payload: {"N": row, "grc": {..}, "gcu": {..}}
Client: EUDCommand.executeCommand (bundle line 122845),
AreaDataUpdater.parseEUD (bundle line 131515)
Fields:
-
error_code(int) -
building(BuildingRow | None) -
resources(CastleResources | None) -
currencies(CurrencyBlock)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
RepairBuildingRequest
pydantic-model
¶
Bases: BaseRequest
Repair a damaged building in the joined castle.
Command: rbu Payload: {"OID": object_id, "PO": offer_id, "PWR": 0 or 1}
Client: C2SIsoRepairBuildingVO (bundle line 31961)
Fields:
RepairBuildingResponse
pydantic-model
¶
Bases: _BuildingReply
The building being repaired.
Command: rbu Payload: {"O": row, "scl": {..}, "grc": {..}, "gcu": {..}}
Client: RBUCommand.executeCommand (bundle line 123162),
AreaDataUpdater.parseRBU (bundle line 131507)
Fields:
-
error_code(int) -
building(BuildingRow | None) -
construction_list(ConstructionList | None) -
resources(CastleResources | None) -
currencies(CurrencyBlock)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
RepairAllRequest
pydantic-model
¶
Bases: BaseRequest
Repair every damaged building in the joined castle at once.
Command: ira Payload: {}
Client: C2SIsoRepairAllVO (bundle line 37983)
RepairAllResponse
pydantic-model
¶
Bases: _BuildingReply
The repaired buildings.
Command: ira Payload: {"gpa": {..}, "B": [row, ...], "gcu": {..}}
Client: IRACommand.executeCommand (bundle line 123079),
AreaDataUpdater.parseIRA (bundle line 131508)
Fields:
-
error_code(int) -
production_area(CastleProductionArea | None) -
buildings(list[BuildingRow]) -
currencies(CurrencyBlock)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
production_area
pydantic-field
¶
production_area: CastleProductionArea | None = None
Wire key gpa
The castle's production area after
BuyExtensionRequest
pydantic-model
¶
Bases: BaseRequest
Buy an expansion of the joined castle's grounds.
Command: ebe Payload: {"X": x, "Y": y, "R": rotation, "CT": expansion_type}
Client: C2SIsoBuyExpansionVO (bundle line 63787), sent by
IsoServerCommands.buyExpansion (bundle line 63769) with the
expansion's IsoExpansionEnum id
Fields:
-
x(int) -
y(int) -
rotation(int) -
expansion_type(ExpansionType)
expansion_type
pydantic-field
¶
expansion_type: ExpansionType = ExpansionType.NORMAL
Wire key CT
Pay with resources (NORMAL) or rubies (PREMIUM)
BuyExtensionResponse
pydantic-model
¶
Bases: _BuildingReply
The castle after the expansion.
Command: ebe Payload: {"gca": {..}, "grc": {..}, "scl": {..}, "gcu": {..}, "sin": [..]}
Client: EBECommand.executeCommand (bundle line 122743),
AreaDataUpdater.parseEBE (bundle line 131511)
Fields:
-
error_code(int) -
castle_buildings(CastleBuildings | None) -
resources(CastleResources | None) -
construction_list(ConstructionList | None) -
currencies(CurrencyBlock) -
storages(DecorationStorages)
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
castle_buildings
pydantic-field
¶
castle_buildings: CastleBuildings | None = None
Wire key gca
The castle's buildings after
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after
CollectExtensionGiftRequest
pydantic-model
¶
Bases: BaseRequest
Open a treasure chest found on an expansion of the joined castle.
Command: etc Payload: {"OID": object_id}
Client: C2SExtensionTreasureChestVO (bundle line 86720), sent by
CastleTreasureChestBuildingDialog (bundle line 86704)
Fields:
CollectExtensionGiftResponse
pydantic-model
¶
Bases: _BuildingReply
The opened chest.
Command: etc Payload: {"RID": reward_id, "OID": object_id}
Client: AreaDataUpdater.parseETC (bundle line 131517);
CastleTreasureChestBuildingDialog.onEtcArrived (bundle line 86706)
reads RID through int()
Fields:
Validators:
-
_resources -
_production_area -
_castle_buildings -
_construction_list -
_row -
_rows
castle.models.castles¶
The player's castle list.
Commands:
- gcl: Get castles list
Classes:
| Name | Description |
|---|---|
PlayerCastle |
One row of a castle list's |
GetCastlesRequest |
Get a player's castle list. |
CastleInfo |
One of the player's locations: a castle list entry and its map row. |
GetCastlesResponse |
The player's castle list. |
PlayerCastle
pydantic-model
¶
Bases: BasePayload
One row of a castle list's AI entries, read by field position as its
area type's client parser reads it.
- Castles, outposts, kingdom castles and Berimond camps
(
InteractiveMapobjectVO.parseAreaInfo): object id 3, owner 4, keep, wall, gate, tower and moat 5 to 9 throughint()with keep, wall and gate at least 1, name 10, attack cooldown 11, sabotage cooldown 12, seconds since the last spy 13, outpost type 14, occupier 15, kingdom 16, equipment skin 17 and temporary sabotage protection 19 (on when it is 1); 11 to 19 throughint(), so one the row lacks reads as 0. - Capitals and metropolises: as above, but the levels as sent, 13 as sent, the occupier at 14 and the skin at 15, both as sent, and no outpost type.
- Royal towers: object id 3, owner 4, kingdom 5, seconds since the last spy 6, name 7.
- Monuments: object id 3, owner 4, monument type 5, level 6, kingdom 7, seconds since the last spy 8, name 9.
- Laboratories: object id 3, owner 4, level 5, kingdom 6, seconds since the last spy 7, name 8.
- Berimond capitals: owner 3, and no object id, name or kingdom.
The client stores the row's kingdom as sent; one that is not a Kingdom
reads as the kingdom the row is listed under. An occupier the row lacks
reads as -1 here, where the client's int() would read 0: a
deliberate leniency, so a short row does not look occupied.
Client: WorldmapObjectFactory.parseWorldMapArea (bundle line 5343),
InteractiveMapobjectVO.parseAreaInfo (bundle line 3631),
CastleMapobjectVO.parseAreaInfo (bundle line 18910),
FactionCampMapobjectVO.parseAreaInfo (bundle line 21526),
CapitalMapobjectVO.parseAreaInfo (bundle line 18729),
MetropolMapobjectVO.parseAreaInfo (bundle line 21609),
KingstowerMapobjectVO.parseAreaInfo (bundle line 19055),
MonumentMapobjectVO.parseAreaInfo (bundle line 21652),
LaboratoryMapobjectVO.parseAreaInfo (bundle line 25900),
FactionCapitalMapobjectVO.parseAreaInfo (bundle line 22764)
Fields:
-
kingdom(Kingdom) -
location_id(int | None) -
x(int) -
y(int) -
castle_type(MapItemType) -
owner_id(int) -
name(str | None) -
occupier_id(int) -
keep_level(int | None) -
wall_level(int | None) -
gate_level(int | None) -
tower_level(int | None) -
moat_level(int | None) -
landmark_level(int | None) -
monument_type(int | None) -
attack_cooldown_seconds(int | None) -
sabotage_cooldown_seconds(int | None) -
seconds_since_spy(int | None) -
outpost_type(int | None) -
equipment_skin_id(int | None) -
has_sabotage_protection(bool)
location_id
pydantic-field
¶
location_id: int | None = None
The castle's object id; None for a type with none
landmark_level
pydantic-field
¶
landmark_level: int | None = None
A monument's or laboratory's level; None for any other type
monument_type
pydantic-field
¶
monument_type: int | None = None
A monument's type; None for any other type
attack_cooldown_seconds
pydantic-field
¶
attack_cooldown_seconds: int | None = None
Seconds until it can be attacked again; None for a type with none
sabotage_cooldown_seconds
pydantic-field
¶
sabotage_cooldown_seconds: int | None = None
Seconds until it can be sabotaged again; None for a type with none
seconds_since_spy
pydantic-field
¶
seconds_since_spy: int | None = None
Seconds since it was last spied on; None for a type with none
outpost_type
pydantic-field
¶
outpost_type: int | None = None
The outpost type; None for a type with none
equipment_skin_id
pydantic-field
¶
equipment_skin_id: int | None = None
Unique id of the castle skin equipped; None for a type with none
has_sabotage_protection
pydantic-field
¶
has_sabotage_protection: bool = False
Whether a temporary sabotage protection is on
is_occupied
property
¶
is_occupied: bool
Whether someone occupies this castle; the client's isOccupied is an occupier id above -1.
from_list
classmethod
¶
Read a gcl.C[].AI[].AI row; kingdom is the block it is listed under.
Raises:
| Type | Description |
|---|---|
ValueError
|
The row is not a list, its area type is not one a
castle list holds, or it is too short for its type's layout.
|
GetCastlesRequest
pydantic-model
¶
Bases: BaseRequest
Get a player's castle list.
Command: gcl Payload: {"PID": player_id}
The client always sends the logged-in player's id. Without one the
payload is {}, which the server answers with your castle list.
Client: C2SGetCastleListVO (bundle line 60768); its
MY_CASTLELIST is -1, but no caller sends it
Fields:
CastleInfo
pydantic-model
¶
Bases: BasePayload
One of the player's locations: a castle list entry and its map row.
Entry: {"AI": [row], "OGT": .., "OGC": .., "AOT": .., "CAT": .., "TA": ..}
The row's values are read by its area type's layout, the field positions
PlayerCastle lists. OGT, OGC, AOT, CAT and TA
are the entry's keys, read through int() (OGT and OGC only when
they are not 0), so one the entry lacks reads as 0. KID is the row's own
kingdom when it carries one (InteractiveMapobjectVO.parseAreaInfo, bundle
line 3637), else the block the entry is listed under. A Berimond capital's row carries no object
id, so it has no CastleInfo.
Client: CastleListVO.parseCastleList (bundle line 13698), which reads
the row with WorldmapObjectFactory.parseWorldMapArea
Fields:
-
castle_id(int) -
castle_name(str) -
x(int) -
y(int) -
kingdom_id(Kingdom) -
castle_type(MapItemType) -
owner_id(int) -
occupier_id(int) -
keep_level(int | None) -
wall_level(int | None) -
gate_level(int | None) -
tower_level(int | None) -
moat_level(int | None) -
landmark_level(int | None) -
monument_type(int | None) -
attack_cooldown_seconds(int | None) -
sabotage_cooldown_seconds(int | None) -
seconds_since_spy(int | None) -
outpost_type(int | None) -
equipment_skin_id(int | None) -
has_sabotage_protection(bool) -
open_gate_seconds(int) -
open_gate_counter(int) -
abandon_outpost_seconds(int) -
cancel_abandon_seconds(int) -
no_abandon_seconds(int)
kingdom_id
pydantic-field
¶
Wire key KID
The castle's kingdom: the row's own, else the block it is listed under
landmark_level
pydantic-field
¶
landmark_level: int | None = None
A monument's or laboratory's level; None for any other type
monument_type
pydantic-field
¶
monument_type: int | None = None
A monument's type; None for any other type
attack_cooldown_seconds
pydantic-field
¶
attack_cooldown_seconds: int | None = None
Seconds until it can be attacked again; None for a type with none
sabotage_cooldown_seconds
pydantic-field
¶
sabotage_cooldown_seconds: int | None = None
Seconds until it can be sabotaged again; None for a type with none
seconds_since_spy
pydantic-field
¶
seconds_since_spy: int | None = None
Seconds since it was last spied on; None for a type with none
outpost_type
pydantic-field
¶
outpost_type: int | None = None
The outpost type; None for a type with none
equipment_skin_id
pydantic-field
¶
equipment_skin_id: int | None = None
Unique id of the castle skin equipped; None for a type with none
has_sabotage_protection
pydantic-field
¶
has_sabotage_protection: bool = False
Whether a temporary sabotage protection is on
open_gate_seconds
pydantic-field
¶
open_gate_seconds: int = 0
Wire key OGT
Seconds the gate stays open
open_gate_counter
pydantic-field
¶
open_gate_counter: int = 0
Wire key OGC
How often the gate has been opened
abandon_outpost_seconds
pydantic-field
¶
abandon_outpost_seconds: int = 0
Wire key AOT
Seconds until the castle is abandoned; not positive when it is not
cancel_abandon_seconds
pydantic-field
¶
cancel_abandon_seconds: int = 0
Wire key CAT
Seconds left to cancel abandoning the castle; not positive when it cannot be
no_abandon_seconds
pydantic-field
¶
no_abandon_seconds: int = 0
Wire key TA
Seconds until the castle has been held long enough to abandon
is_occupied
property
¶
is_occupied: bool
Whether someone occupies it; the client's isOccupied is an occupier id above -1.
from_entry
classmethod
¶
from_entry(entry: dict[str, Any], kingdom: Kingdom = GREEN) -> CastleInfo | None
Parse a gcl.C[].AI[] entry; its AI row is read by its area type (see PlayerCastle).
None for a row the client reads but that names no castle: a faction capital, which has no object id, or a Berimond camp that is not on the map.
GetCastlesResponse
pydantic-model
¶
Bases: BaseResponse
The player's castle list.
Command: gcl Payload: {"PID": player_id, "C": [{"KID": kingdom, "AI": [{"AI": [row...], "AOT": .., "TA": ..}, ...]}, ...]}
Entries are flattened across kingdoms into castles. A row that cannot be read is skipped and
counted, so one bad row costs only itself; a C that is no list counts as one such row, where
the client would read it as no castles at all.
Client: CastleListVO.parseCastleList (split.js line 73142), which gdi uses for its gcl
block too; it reads OGT and OGC through int() when they are truthy (split.js line 73151)
Fields:
-
error_code(int) -
player_id(int) -
castles(list[CastleInfo]) -
unreadable_rows(int)
Validators:
-
_flatten_kingdoms
castles
pydantic-field
¶
castles: list[CastleInfo]
The castles of every kingdom, from C; empty when C was not sent
NameCastleInvitationResponse
pydantic-model
¶
Bases: BaseResponse
Your castle lists after taking a castle or outpost, and the castle the client invites you to name.
Each list that is sent replaces the one held, as its own section does.
Command: mir, a push, and inside the fjf reply.
Client: MIRCommand.executeCommand (bundle line 125107), which parses whatever the status;
CastleUserData.parse_MIR (bundle line 9884) applies each of gcl, gkl, gml and gll
that is truthy; parse_MIR_openDialog (bundle line 9885) finds the castle to name by CID and
KID as sent
Fields:
-
error_code(int) -
castles(GetCastlesResponse | None) -
royal_towers(RoyalTowerListResponse | None) -
monuments(MonumentListResponse | None) -
laboratories(LaboratoryListResponse | None) -
castle_id(int | None) -
kingdom_id(EnumOrInt[Kingdom] | None)
Validators:
-
_section→castles,royal_towers,monuments,laboratories -
_as_sent→castle_id,kingdom_id
royal_towers
pydantic-field
¶
Wire key gkl
Your royal towers
monuments
pydantic-field
¶
Wire key gml
Your monuments
laboratories
pydantic-field
¶
Wire key gll
Your laboratories
castle.models.collect¶
Mines and resource carts, and collecting from them.
Commands:
- cmr: Collect a mine
- gsm: The joined castle's mines (pushed)
- rcc: Collect a resource cart
- rci: The joined castle's resource carts (pushed)
Classes:
| Name | Description |
|---|---|
CollectMineResourcesRequest |
Collect what a mine in the joined castle has produced. |
MineStatus |
One mine's state, an entry of the |
MineStatusList |
The joined castle's mines: the |
CollectMineResourcesResponse |
The mines after collecting. |
CollectResourceCartRequest |
Collect the joined castle's resource cart of one resource. |
ResourceCart |
One resource cart, an entry of the |
ResourceCartInfo |
The joined castle's resource carts, wood, stone and food: the |
CollectResourceCartResponse |
The collected cart. |
CollectMineResourcesRequest
pydantic-model
¶
Bases: BaseRequest
Collect what a mine in the joined castle has produced.
Command: cmr Payload: {"OID": object_id}
Client: C2SCollectMineResources (bundle line 84598), sent by
AMineBuildingVE.onMouseClick (bundle line 51410)
Fields:
MineStatus
pydantic-model
¶
Bases: BasePayload
One mine's state, an entry of the gsm block's M.
Client: CastleMineData.parse_GSM (bundle line 50363) and
triggerInfoFlash (bundle line 50371)
Fields:
-
object_id(int) -
remaining_collection_amount(int) -
next_collect_seconds(int) -
coins(int | None) -
rubies(int | None)
MineStatusList
pydantic-model
¶
Bases: BaseResponse
The joined castle's mines: the gsm push, and the block of that name in
the cmr and jaa replies.
Command: gsm Payload: {"M": [{"OID": .., "RC": .., "NC": ..}, ...]}
Client: GSMCommand.executeCommand (bundle line 125752),
CastleMineData.parse_GSM (bundle line 50363)
Fields:
-
error_code(int) -
mines(list[MineStatus])
Validators:
-
_mines→mines
CollectMineResourcesResponse
pydantic-model
¶
Bases: BaseResponse
The mines after collecting.
Command: cmr Payload: {"gsm": {"M": [{"OID": .., "RC": .., "NC": .., "C1": ..}, ...]}, "gcu": {...}}
Client: CMRCommand.executeCommand (bundle line 125737)
Fields:
-
error_code(int) -
mines(MineStatusList | None) -
currencies(CurrencyBlock)
Validators:
-
_block→mines
CollectResourceCartRequest
pydantic-model
¶
Bases: BaseRequest
Collect the joined castle's resource cart of one resource.
Command: rcc Payload: {"RT": cart_type}
Client: C2SIsoResourceCartCollectVO (bundle line 87566), sent by
ResourceCartSurroundingsVE.onMouseClick (bundle line 87542)
Fields:
ResourceCart
pydantic-model
¶
Bases: BasePayload
One resource cart, an entry of the rci block's RC.
Client: ResourceCartData.parseRciItem (bundle line 81053)
Fields:
-
cart_type(ResourceCartType | None) -
amount(int) -
remaining_seconds(int | float | None)
cart_type
pydantic-field
¶
cart_type: ResourceCartType | None = None
Wire key RT
The cart's resource; None for an unknown index
ResourceCartInfo
pydantic-model
¶
Bases: BaseResponse
The joined castle's resource carts, wood, stone and food: the rci push,
and the block of that name in the rcc and jaa replies.
Command: rci Payload: {"RC": [{"RT": .., "A": .., "RS": ..}, ...]}
The client reads the first three entries, one cart each.
Client: RCICommand.executeCommand (bundle line 123196),
CastleResourceCartsData.parse_RCI (bundle line 28798)
Fields:
-
error_code(int) -
carts(list[ResourceCart])
Validators:
-
_carts→carts
CollectResourceCartResponse
pydantic-model
¶
Bases: BaseResponse
The collected cart.
Command: rcc Payload: {"RT": cart_type, "A": amount, "grc": {...}, "rci": {"RC": [...]}}
Client: RCCCommand.executeCommand (bundle line 123181),
CastleResourceCartsData.parse_RCC (bundle line 28796)
Fields:
-
error_code(int) -
cart_type(ResourceCartType | None) -
amount(int) -
resources(CastleResources | None) -
carts(ResourceCartInfo | None)
Validators:
cart_type
pydantic-field
¶
cart_type: ResourceCartType | None = None
Wire key RT
The collected cart's resource; None for an unknown index
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The castle's resources after
castle.models.construction_items¶
Construction items in storage and the actions that place or disassemble them.
Classes:
| Name | Description |
|---|---|
ConstructionItemStack |
One inventory row, |
GetConstructionItemsRequest |
Request the construction inventory. |
ConstructionItemInventory |
The construction items in storage, replaced in full by each inventory reply. |
ConstructionItemPlacement |
The complete item placement for the joined castle. |
EquipConstructionItemRequest |
Equip or replace an item on a building. |
EquipConstructionItemResponse |
Items on the joined castle's buildings after equipping. |
RemoveConstructionItemRequest |
Remove an equipped item into storage for its coin removal cost. |
RemoveConstructionItemResponse |
Items on the joined castle's buildings after removing an item. |
DisassembleConstructionItemRequest |
Disassemble items from storage or lost and found. |
DisassembleConstructionItemResponse |
Disassembled amount and the rewards drawn for temporary items. |
ConstructionItemSpaceRequest |
Request the free construction inventory capacity. |
ConstructionItemSpace |
Free construction inventory capacity, which may be negative. |
ExpiredConstructionItem |
A construction item that expired on a building. |
ExpiredConstructionItemArea |
The expired construction items in one castle. |
GetExpiredConstructionItemsRequest |
Request expired items across your castles. |
ExpiredConstructionItemsResponse |
The complete list of castles with expired construction items. |
MarkExpiredConstructionItemsSeenRequest |
Mark the expired item list for a castle as viewed. |
MarkExpiredConstructionItemsSeenResponse |
Acknowledgement that expired items were marked as viewed. |
MoveConstructionSlotRequest |
Move an occupied building queue slot, within the joined castle. |
MoveConstructionSlotResponse |
Queue move acknowledgement; the queue itself is delivered by scl. |
BoostConstructionItemRequest |
Consume one explicitly selected inventory booster on a temporary construction item. |
BoostConstructionItemResponse |
The complete placement after consuming the booster. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
|
INVENTORY_SOFTCAP |
How many construction items fit in storage before it counts as full. |
INVENTORY_SOFTCAP
module-attribute
¶
How many construction items fit in storage before it counts as full.
Client: ConstructionItemConst.INVENTORY_SOFTCAP (dll, 5e3), read by ConstructionItemData.updateInventory
(split.js line 120812)
ConstructionItemStack
pydantic-model
¶
Bases: BasePayload
One inventory row, [construction item id, amount].
Client: ConstructionItemData.updateInventory (bundle lines 22947-22952),
CollectableItemConstructionItemVO (bundle line 12252),
ACollectableItemVO.amount (bundle line 3575).
Fields:
-
construction_item_id(EnumOrInt['ConstructionItem']) -
amount(int)
Validators:
-
_amount→amount -
_row
GetConstructionItemsRequest
pydantic-model
¶
Bases: BaseRequest
Request the construction inventory.
Client: C2SGetContructionItemsInventoryVO (bundle lines 28546-28550).
ConstructionItemInventory
pydantic-model
¶
Bases: BaseResponse
The construction items in storage, replaced in full by each inventory reply.
Client: GIICommand.executeCommand (split.js line 629668), ConstructionItemData.updateInventory
(split.js line 120812), which counts the space left as INVENTORY_SOFTCAP less the amounts as sent
Fields:
-
error_code(int) -
items(tuple[ConstructionItemStack, ...]) -
space_left(int | None)
Validators:
-
_space_left -
_items→items
ConstructionItemPlacement
pydantic-model
¶
Bases: BasePayload
The complete item placement for the joined castle.
Client: AreaDataConstructionItems.updateConstructionItems (bundle line 131114),
ABasicBuildingVO.parseConstructionItems (bundle lines 18000-18010).
Fields:
-
items(tuple[BuildingConstructionItems, ...])
Validators:
-
_items→items
items
pydantic-field
¶
items: tuple[BuildingConstructionItems, ...]
Wire key CI
Items on each building
EquipConstructionItemRequest
pydantic-model
¶
Bases: BaseRequest
Equip or replace an item on a building.
Client: C2SReplaceConstructionItemVO (bundle lines 79234-79236).
Fields:
-
object_id(int) -
construction_item_id(EnumOrInt['ConstructionItem']) -
slot(int) -
mode(ConstructionItemMode) -
kingdom_id(Kingdom) -
castle_id(int)
construction_item_id
pydantic-field
¶
construction_item_id: EnumOrInt['ConstructionItem']
Wire key CID
The item to equip
mode
pydantic-field
¶
mode: ConstructionItemMode = ConstructionItemMode.ADD
Wire key M
How to replace an existing item
EquipConstructionItemResponse
pydantic-model
¶
Bases: ConstructionItemPlacement, BaseResponse
Items on the joined castle's buildings after equipping.
Client: RPCCommand.executeCommand (bundle lines 123313-123314).
Fields:
-
error_code(int) -
items(tuple[BuildingConstructionItems, ...])
Validators:
-
_items→items
RemoveConstructionItemRequest
pydantic-model
¶
Bases: BaseRequest
Remove an equipped item into storage for its coin removal cost.
Client: C2SRemoveConstructionItemVO (bundle lines 79282-79284),
CastleConstructionItemsExtractDialog (bundle lines 79267-79277).
Fields:
-
object_id(int) -
construction_item_id(EnumOrInt['ConstructionItem']) -
slot(int) -
kingdom_id(Kingdom) -
castle_id(int)
RemoveConstructionItemResponse
pydantic-model
¶
Bases: ConstructionItemPlacement, BaseResponse
Items on the joined castle's buildings after removing an item.
Client: CRICommand.executeCommand (bundle lines 123255-123256).
Fields:
-
error_code(int) -
items(tuple[BuildingConstructionItems, ...])
Validators:
-
_items→items
DisassembleConstructionItemRequest
pydantic-model
¶
Bases: BaseRequest
Disassemble items from storage or lost and found.
Client: C2SDisassembleConstructionItemVO (bundle lines 79223-79227),
ConstructionItemsActionProperties (bundle line 35689, LFID defaults to -1).
Fields:
-
construction_item_id(EnumOrInt['ConstructionItem']) -
kingdom_id(Kingdom) -
castle_id(int) -
lost_and_found_id(int) -
amount(int)
DisassembleConstructionItemResponse
pydantic-model
¶
Bases: BaseResponse
Disassembled amount and the rewards drawn for temporary items.
Permanent items' material yield is defined by the recipe, not this reply. Unknown reward ids remain available even if no game-data row resolves them.
Client: CastleConstructionItemsDisassembleDialog.onDCIArrived (bundle line 35729),
CastleConstructionItemsDisassembledDialog.showTempCIDisassembling and
selectedAmountForResources (bundle lines 48984, 49000).
Fields:
-
error_code(int) -
amount(int | None) -
reward_ids(tuple[RewardId, ...]) -
rewards(tuple[Collectable, ...])
rewards
pydantic-field
¶
rewards: tuple[Collectable, ...] = ()
Collectables resolved from the rewards drawn
ConstructionItemSpaceRequest
pydantic-model
¶
Bases: BaseRequest
Request the free construction inventory capacity.
Client: C2SConstructionItemInventorySpaceLeftVO (bundle line 41293), sent by
LostAndFoundDialog.showLoaded (bundle line 107119)
ConstructionItemSpace
pydantic-model
¶
Bases: BaseResponse
Free construction inventory capacity, which may be negative.
Client: CSPCommand.exec / ConstructionItemData.parse_CSP
(bundle 123841-123843 / 22960).
Fields:
-
error_code(int) -
space_left(int)
Validators:
-
_space→space_left
ExpiredConstructionItem
pydantic-model
¶
Bases: BasePayload
A construction item that expired on a building.
Client: ConstructionItemExpiredVO.parseParams (bundle 77661).
Fields:
-
construction_item_id(EnumOrInt['ConstructionItem']) -
building_id(EnumOrInt['Building']) -
object_id(int)
ExpiredConstructionItemArea
pydantic-model
¶
Bases: BasePayload
The expired construction items in one castle.
Client: ConstructionItemExpiredAreaVO.parseParams (bundle 47886-47890).
Fields:
-
castle_id(int) -
kingdom_id(Kingdom) -
items(tuple[ExpiredConstructionItem, ...])
GetExpiredConstructionItemsRequest
pydantic-model
¶
Bases: BaseRequest
Request expired items across your castles.
Client: C2SGetAllExpiredConstructionItemsVO (bundle 79379-79381).
ExpiredConstructionItemsResponse
pydantic-model
¶
Bases: BaseResponse
The complete list of castles with expired construction items.
Client: AECCommand.executeCommand / ConstructionItemData.parse_AEC
(bundle 123264-123266 / 22985-22989). The wire body is a list.
Fields:
-
error_code(int) -
areas(tuple[ExpiredConstructionItemArea, ...])
Validators:
-
_areas
MarkExpiredConstructionItemsSeenRequest
pydantic-model
¶
Bases: BaseRequest
Mark the expired item list for a castle as viewed.
Client: C2SMarkExpiredConstructionItemVO / assign sublayer hide / switchCastle
(bundle 79370-79372 / 77574 / 77583).
Fields:
MarkExpiredConstructionItemsSeenResponse
pydantic-model
¶
Bases: BaseResponse
Acknowledgement that expired items were marked as viewed.
Client: MECCommand.executeCommand (bundle 123308), which reads no fields.
Fields:
MoveConstructionSlotRequest
pydantic-model
¶
Bases: BaseRequest
Move an occupied building queue slot, within the joined castle.
Client: C2SMoveConstructionItemVO / CastleBuildingListComponent.requestMoveFromServer
(bundle 108290-108292 / 108280-108281).
Fields:
-
object_id(int) -
new_position(int)
MoveConstructionSlotResponse
pydantic-model
¶
Bases: BaseResponse
Queue move acknowledgement; the queue itself is delivered by scl.
Client: MCICommand.executeCommand (bundle 123383).
Fields:
Validators:
-
_body
BoostConstructionItemRequest
pydantic-model
¶
Bases: BaseRequest
Consume one explicitly selected inventory booster on a temporary construction item.
Client: C2SUseBoosterConsumableOnConstructionItemVO (bundle 79457-79459).
Fields:
-
object_id(int) -
consumable_id(CurrencyId) -
slot(int) -
kingdom_id(Kingdom) -
castle_id(int) -
construction_item_id(EnumOrInt['ConstructionItem'])
consumable_id
pydantic-field
¶
consumable_id: CurrencyId
Wire key SUC
The inventory booster to consume
BoostConstructionItemResponse
pydantic-model
¶
Bases: ConstructionItemPlacement, BaseResponse
The complete placement after consuming the booster.
Client: UBCCommand.executeCommand (bundle 123350-123352).
Fields:
-
error_code(int) -
items(tuple[BuildingConstructionItems, ...])
Validators:
-
_items→items -
_placement
castle.models.details¶
Detailed castle info and the production area block.
Commands:
- dcl: Get detailed castle info
Classes:
| Name | Description |
|---|---|
GetDetailedCastleRequest |
Get resources, units and production data for every castle the player owns. |
ResourceProduction |
Hourly production per resource; the client reads |
StorageCapacity |
Storage capacity per resource ( |
ProductionBonus |
Production bonus per resource in percent ( |
SafeAmount |
The block's |
CastleProductionArea |
A castle's production area, the |
DetailedCastleInfo |
One castle's entry in the detailed castle list. |
GetDetailedCastleResponse |
Detail for every castle the player owns. |
GetDetailedCastleRequest
pydantic-model
¶
Bases: BaseRequest
Get resources, units and production data for every castle the player owns.
Command: dcl Payload: {"CD": 1}
The client's constructor defaults CD to 1, and some dialogs send 0;
what it selects is not traced, so this sends the default.
Client: C2SGetDetailedCastleListVO (bundle line 7922)
Fields:
ResourceProduction
pydantic-model
¶
StorageCapacity
pydantic-model
¶
Bases: _ProductionAreaSection
Storage capacity per resource (MR<key>), a number as sent; anything else reads as 0.
Fields:
-
wood(int | float) -
stone(int | float) -
food(int | float) -
coal(int | float) -
oil(int | float) -
glass(int | float) -
iron(int | float) -
aquamarine(int | float) -
honey(int | float) -
mead(int | float) -
beef(int | float)
Validators:
ProductionBonus
pydantic-model
¶
SafeAmount
pydantic-model
¶
Bases: _ProductionAreaSection
The block's SAFE_<key> amounts per resource.
The server sends them, but the client never reads them, so what they measure is not confirmed.
Fields:
-
wood(float) -
stone(float) -
food(float) -
coal(float) -
oil(float) -
glass(float) -
iron(float) -
aquamarine(float) -
honey(float) -
mead(float) -
beef(float)
Validators:
CastleProductionArea
pydantic-model
¶
Bases: BasePayload
A castle's production area, the gpa block.
The per-resource sections are aliased key by key and validated from the
same block, so each wire key appears once in this module. The whole-number
fields are read through int(), as the client reads them; the other
numbers read anything that is not a number as 0, as the client's
arithmetic does (MP is 0 unless it is truthy).
Client: AreaDataUpdater.parseGPA (bundle line 131506),
AreaDataCommonInfo.parseGPA (bundle line 130993),
AreaDataStorageItem.parseGPA (bundle line 131380),
AreaDataMorality.parseGPA (bundle line 131272),
DetailedCastleVO.parseGpaData (bundle line 140979)
Fields:
-
population(int) -
neutral_deco_points(int) -
sickness(int) -
riot(int) -
guards(int) -
build_speed_percent(int) -
metropolis_food_bonus(float) -
unit_capacity(int) -
auxiliary_capacity(int) -
morale(int) -
faction_buff(float) -
food_consumption_delta(float) -
food_consumption_reduction_percent(int) -
mead_consumption_delta(float) -
mead_consumption_reduction_percent(int) -
beef_consumption_delta(float) -
beef_consumption_reduction_percent(int) -
barracks_speed(float) -
workshop_speed(float) -
defense_workshop_speed(float) -
hospital_speed(float) -
production(ResourceProduction) -
storage_capacity(StorageCapacity) -
production_bonus_percent(ProductionBonus) -
safe_amount(SafeAmount)
Validators:
-
_number→faction_buff,food_consumption_delta,mead_consumption_delta,beef_consumption_delta,barracks_speed,workshop_speed,defense_workshop_speed,hospital_speed -
_truthy_number→metropolis_food_bonus -
_sections_see_the_whole_block
build_speed_percent
pydantic-field
¶
build_speed_percent: int = 100
Wire key BDB
Construction speed in percent
metropolis_food_bonus
pydantic-field
¶
metropolis_food_bonus: float = 0.0
Wire key MP
A metropolis's food production bonus
auxiliary_capacity
pydantic-field
¶
auxiliary_capacity: int = 0
Wire key AUS
How many auxiliaries the castle holds
faction_buff
pydantic-field
¶
faction_buff: float = 0.0
Wire key RFPPA
Faction strength balance, 0 to 1: below 0.5 boosts Gerbrandt morale, above 0.5 Ursidae
food_consumption_delta
pydantic-field
¶
food_consumption_delta: float = 0.0
Wire key DFC
Food consumption per hour, times 10
food_consumption_reduction_percent
pydantic-field
¶
food_consumption_reduction_percent: int = 100
Wire key FCR
Food consumption in percent of the base
mead_consumption_delta
pydantic-field
¶
mead_consumption_delta: float = 0.0
Wire key DMEADC
Mead consumption per hour, times 10
mead_consumption_reduction_percent
pydantic-field
¶
mead_consumption_reduction_percent: int = 100
Wire key MEADCR
Mead consumption in percent of the base
beef_consumption_delta
pydantic-field
¶
beef_consumption_delta: float = 0.0
Wire key DBEEFC
Beef consumption per hour, times 10
beef_consumption_reduction_percent
pydantic-field
¶
beef_consumption_reduction_percent: int = 100
Wire key BEEFCR
Beef consumption in percent of the base
workshop_speed
pydantic-field
¶
workshop_speed: float = 0.0
Wire key RS2
Siege workshop production speed
defense_workshop_speed
pydantic-field
¶
defense_workshop_speed: float = 0.0
Wire key RS3
Defense workshop production speed
production_bonus_percent
pydantic-field
¶
production_bonus_percent: ProductionBonus
Production bonus in percent, 100 for none
DetailedCastleInfo
pydantic-model
¶
Bases: BasePayload
One castle's entry in the detailed castle list.
The client reads AID, D, the 11 resources (through int()
wherever it uses them), MC, AC, SHI, gpa and the flags
B, WS, DW and H (through Boolean()); KID is the
kingdom block the entry is listed under. The server also sends OGT,
AOT, HI and TU, which the client does not read from this reply:
it reads hospital and travelling units from gui (CastleMilitaryData.parse_GUI,
bundle line 138833). Each unit array reads as an inventory: an id sent twice adds up
(UnitInventoryDictionary, bundle lines 5533-5538).
Client: CastleUserCastleListDetailed.parseData (bundle line 140906),
DetailedCastleVO.parseData (bundle line 140973)
Fields:
-
castle_id(int) -
kingdom_id(int) -
wood(int) -
stone(int) -
food(int) -
coal(int) -
oil(int) -
glass(int) -
iron(int) -
aquamarine(int) -
honey(int) -
mead(int) -
beef(int) -
defense_value(int) -
has_barracks(bool) -
has_siege_workshop(bool) -
has_defense_workshop(bool) -
has_hospital(bool) -
market_carriages(int) -
open_gate_seconds(int) -
abandon_outpost_seconds(int) -
units(WodAmounts) -
stronghold_units(WodAmounts) -
hospital_units(WodAmounts) -
travelling_units(WodAmounts) -
production_area(CastleProductionArea | None)
Validators:
-
_area→production_area
has_siege_workshop
pydantic-field
¶
has_siege_workshop: bool = False
Wire key WS
Whether it has a siege workshop
has_defense_workshop
pydantic-field
¶
has_defense_workshop: bool = False
Wire key DW
Whether it has a defense workshop
market_carriages
pydantic-field
¶
market_carriages: int = 0
Wire key MC
The castle's market carriages
open_gate_seconds
pydantic-field
¶
open_gate_seconds: int = 0
Wire key OGT
Seconds the gate stays open
abandon_outpost_seconds
pydantic-field
¶
abandon_outpost_seconds: int = -1
Wire key AOT
Seconds until the castle is abandoned, -1 when it is not
stronghold_units
pydantic-field
¶
Wire key SHI
Units in the stronghold (safe house)
hospital_units
pydantic-field
¶
Wire key HI
Wounded units in the hospital; the client reads them from gui, not from this reply
travelling_units
pydantic-field
¶
Wire key TU
Units on their way in (gui's in_production); the client reads them from gui, not from this reply
production_area
pydantic-field
¶
production_area: CastleProductionArea | None = None
Wire key gpa
The castle's production area; None when the entry has none
GetDetailedCastleResponse
pydantic-model
¶
Bases: BaseResponse
Detail for every castle the player owns.
Command: dcl Payload: {"PID": player_id, "C": [{"KID": kingdom, "AI": [{"AID": castle_id, "W": .., "AC": [..], "gpa": {..}}]}]}
Client: DCLCommand.executeCommand (split.js line 650927), CastleUserCastleListDetailed.parseData
(split.js line 700798), which reads each C entry's AI under its KID; it does not read PID
Fields:
Validators:
-
_flatten_kingdoms
castles
pydantic-field
¶
castles: list[DetailedCastleInfo]
Every listed castle's details, each with the kingdom it is listed under
castle
¶
castle(castle_id: int) -> DetailedCastleInfo | None
The listed castle with this id, or None.
castle.models.kingdoms¶
Your kingdoms: which are unlocked, unlocking one, and the units and goods on their way to one.
Commands:
- kpi: kingdom info, a login section of
gbd, a reply, and inside the transfer replies - ksc: Unlock a kingdom with one of its prebuilt castles
Classes:
| Name | Description |
|---|---|
KingdomUnlock |
One kingdom's unlock, warehouse and slum, an entry of a |
KingdomTransfer |
Units or goods on their way to a kingdom, an entry of a |
KingdomInfoRequest |
Ask for your kingdoms and the transfers to them. |
KingdomInfoResponse |
Your kingdoms' unlocks, and the units and goods on their way to them. |
SelectKingdomCastleRequest |
Unlock a kingdom with one of its prebuilt castles. |
SelectKingdomCastleResponse |
The kingdom unlocked. |
KingdomUnlock
pydantic-model
¶
Bases: TimedPayload
One kingdom's unlock, warehouse and slum, an entry of a kpi's UL.
Client: CastleKingdomVO.parseUnlockInfo (bundle line 134696); hasContor read at bundle line 50209
Fields:
-
received_at(float) -
kingdom_id(EnumOrInt[Kingdom]) -
is_unlocked(bool) -
has_warehouse(bool) -
slum_level(ClientInt) -
paid_wood(ClientNumber) -
paid_stone(ClientNumber) -
paid_food(ClientNumber) -
paid_coins(ClientNumber) -
reset_seconds(ClientNumber) -
reward_set(ClientNumber)
Validators:
-
_kingdom→kingdom_id -
_flag→is_unlocked,has_warehouse
kingdom_id
pydantic-field
¶
Wire key KID
The kingdom; -1 when not sent
has_warehouse
pydantic-field
¶
has_warehouse: bool = False
Wire key C
Whether the kingdom has a warehouse, which its resource villages need
paid_wood
pydantic-field
¶
paid_wood: ClientNumber = 0
Wire key SPW
Wood paid towards the next slum level
paid_stone
pydantic-field
¶
paid_stone: ClientNumber = 0
Wire key SPS
Stone paid towards the next slum level
paid_food
pydantic-field
¶
paid_food: ClientNumber = 0
Wire key SPF
Food paid towards the next slum level
paid_coins
pydantic-field
¶
paid_coins: ClientNumber = 0
Wire key SPC1
Coins paid towards the next slum level
reset_seconds
pydantic-field
¶
reset_seconds: ClientNumber = 0
Wire key KRS
Seconds until the kingdom resets when the values were read; 0 for none
reward_set
pydantic-field
¶
reward_set: ClientNumber = 0
Wire key CRS
The kingdom's reward set; 0 for none
KingdomTransfer
pydantic-model
¶
Bases: TimedPayload
Units or goods on their way to a kingdom, an entry of a kpi's UT or RT.
The units come as [wod_id, amount] rows, which the client keeps as they are and names by
their unit (toolTipText); here each is a UNITS collectable, its item the unit or tool.
Client: CastleKingdomUnitTransferVO.fillFromParamObject and toolTipText (bundle lines 134663,
134675), CastleKingdomGoodsTransferVO.fillFromParamObject (bundle line 134640), which reads the
goods with CollectableParserS2CParamList
Fields:
-
received_at(float) -
kingdom_id(EnumOrInt[Kingdom]) -
seconds(ClientInt) -
units(tuple[Collectable, ...]) -
goods(CollectableRows)
Validators:
-
_kingdom→kingdom_id -
_units→units
KingdomInfoRequest
pydantic-model
¶
Bases: BaseRequest
Ask for your kingdoms and the transfers to them.
Command: kpi Payload: {}
Client: C2SKingdomPayInfoVO (bundle line 55424), sent by CastleHandleKingdomDialog.showLoaded
(bundle line 55406) and after a Storm Islands reset (IKRCommand.executeCommand, bundle line 127728)
KingdomInfoResponse
pydantic-model
¶
Bases: BaseResponse
Your kingdoms' unlocks, and the units and goods on their way to them.
A kpi updates only the kingdoms it lists; the client keeps the others as they were, and
client.state.get_kingdoms() does the same. The transfers are replaced whole. The Berimond
faction block (fki) belongs to the Battle for Berimond and is not read here.
Command: kpi, as a login section of gbd, a reply, and inside the kgt, kst, kut, msk
and fjf replies.
Client: KPICommand (bundle line 124684), CastleKingdomData.parse_KPI (bundle line 134539)
Fields:
-
error_code(int) -
kingdoms(tuple[KingdomUnlock, ...]) -
unit_transfers(tuple[KingdomTransfer, ...]) -
goods_transfers(tuple[KingdomTransfer, ...])
Validators:
-
_kingdoms→kingdoms
kingdoms
pydantic-field
¶
kingdoms: tuple[KingdomUnlock, ...] = ()
Wire key UL
The kingdoms this packet lists
unit_transfers
pydantic-field
¶
unit_transfers: tuple[KingdomTransfer, ...] = ()
Wire key UT
Units on their way to another kingdom
goods_transfers
pydantic-field
¶
goods_transfers: tuple[KingdomTransfer, ...] = ()
Wire key RT
Goods on their way to another kingdom
kingdom
¶
kingdom(kingdom_id: Kingdom | int) -> KingdomUnlock | None
One kingdom, None when it is not listed.
SelectKingdomCastleRequest
pydantic-model
¶
Bases: BaseRequest
Unlock a kingdom with one of its prebuilt castles.
Command: ksc Payload: {"ID": prebuilt_castle_id, "D": direction, "PWR": 0 or 1, "OC2": 0 or 1, "SID": kingdom_id}
Keys follow the client's order. OC2 buys the castle at its ruby price; PWR pays the missing
resources with rubies, which the client sends only from its resource wait dialog. The Storm Islands
castle choice sends a direction of 0.
Client: C2SSelectKingdomCastleVO (bundle line 34224), sent by AUnlockPrebuiltCastle.buyPrebuiltCastle
(bundle line 55479), CastleSpecialServerPreBuildCastleSelectionDialog.onConfirmed (bundle line 27956)
and CastleResourceWaitDialogProperties.getResourceSkipCommand (bundle line 35239)
Fields:
-
prebuilt_castle_id(EnumOrInt['PrebuiltCastle']) -
direction(EnumOrInt[KingdomDirection]) -
pay_with_rubies(bool) -
ruby_castle(bool) -
kingdom_id(Kingdom)
prebuilt_castle_id
pydantic-field
¶
prebuilt_castle_id: EnumOrInt['PrebuiltCastle']
Wire key ID
The prebuilt castle
direction
pydantic-field
¶
direction: EnumOrInt[KingdomDirection] = 0
Wire key D
The side of the map the castle is placed on; 0 for none
pay_with_rubies
pydantic-field
¶
pay_with_rubies: bool = False
Wire key PWR
Pay the missing resources with rubies
SelectKingdomCastleResponse
pydantic-model
¶
Bases: BaseResponse
The kingdom unlocked.
Command: ksc
Client: KSCCommand.executeCommand (bundle line 124741) reads nothing from the reply
Fields:
castle.models.mercenaries¶
The mercenary camp's missions.
Commands:
- mpe: the mercenary missions, a login section of
gbdand a reply; also the request that lists, starts and collects them
Classes:
| Name | Description |
|---|---|
MercenaryMission |
One mercenary mission, an entry of an |
MercenaryMissionsResponse |
The mercenary camp's missions and when new ones come. |
MercenaryPackageRequest |
List the mercenary missions, or start or collect one. |
RefreshMercenaryMissionRequest |
Swap an open mercenary mission for another, for |
RefreshMercenaryMissionResponse |
The mission was swapped; the client reads nothing from the reply. |
NEXT_MISSIONS_DELAY
module-attribute
¶
CastleMercenaryData.NEXT_MISSIONS_TIMER_DELAY (bundle line 28881): seconds the client waits past NM
MercenaryMission
pydantic-model
¶
Bases: TimedPayload
One mercenary mission, an entry of an mpe's M.
Client: CastleMercenaryMissionItemVO.fillFromParamObject and remainingTime (bundle lines 81134-81135)
Fields:
-
received_at(float) -
mission_id(ClientInt) -
rewards(CollectableRows) -
duration_seconds(ClientNumber) -
price(ClientNumber) -
quality(EnumOrInt[MercenaryMissionRarity]) -
state(EnumOrInt[MercenaryMissionState]) -
seconds(ClientNumber)
duration_seconds
pydantic-field
¶
duration_seconds: ClientNumber = 0
Wire key D
How long the mission takes
quality
pydantic-field
¶
quality: EnumOrInt[MercenaryMissionRarity] = MercenaryMissionRarity.FREE
Wire key Q
The mission's rarity
state
pydantic-field
¶
state: EnumOrInt[MercenaryMissionState] = MercenaryMissionState.OPEN
Wire key S
Where the mission stood when the values were read
seconds
pydantic-field
¶
seconds: ClientNumber = 0
Wire key RD
Seconds the running mission still takes when the values were read
remaining_seconds
¶
Seconds the mission still takes, 0 at least.
seconds_past_end
¶
Seconds since the mission's time ran out, below 0 while it still runs.
Client: CastleMercenaryMissionItemVO.remainingTime (bundle line 81135), negated and not clamped
current_state
¶
current_state(now: float | None = None) -> MercenaryMissionState | int
Where the mission stands now: a started mission whose time has run out is collectable.
Client: CastleMercenaryData.parse_MPE and onMissionFinished (bundle lines 28829-28830, 28850)
MercenaryMissionsResponse
pydantic-model
¶
Bases: TimedResponse
The mercenary camp's missions and when new ones come.
Command: mpe, as a login section of gbd and a reply.
Client: MPECommand (bundle line 125109), CastleMercenaryData.parse_MPE (bundle line 28824),
which drops collected missions (state 3 and up)
Fields:
-
received_at(float) -
error_code(int) -
next_missions_seconds(ClientNumber) -
missions(tuple[MercenaryMission, ...])
Validators:
-
_missions→missions
next_missions_seconds
pydantic-field
¶
next_missions_seconds: ClientNumber = 0
Wire key NM
Seconds until new missions come when the values were read
missions
pydantic-field
¶
missions: tuple[MercenaryMission, ...] = ()
Wire key M
The missions not collected
remaining_next_missions_seconds
¶
Seconds until the client asks for new missions, 0 at least.
get_mission
¶
get_mission(mission_id: int) -> MercenaryMission | None
The mission with this id; None when the reply does not list it.
current_mission_state
¶
current_mission_state(now: float | None = None) -> MercenaryMissionState | int
The furthest any mission stands now: OPEN while none runs or waits to be collected.
Client: CastleMercenaryData.currentMissionState (bundle line 28853), the highest state
parse_MPE read (bundle line 28829), collectable once onMissionFinished fired (bundle line 28850)
MercenaryPackageRequest
pydantic-model
¶
Bases: BaseRequest
List the mercenary missions, or start or collect one.
Command: mpe Payload: {"MID": mission_id}
MID -1 lists the missions. A mission's id starts an open mission, collects a collectable one, and
finishes a running one at once for rubies (CastleMercenarySkipMissionDialog.confirmSkip, bundle
line 87459); client.castle.start_mission and collect_mission send it only for the first two.
Client: C2SMercenaryPackageVO (bundle line 28889); -1 from CastleMercenaryData.onNewMissions
and CastleMercenaryOverviewDialog.showLoaded (bundle lines 28851, 51996), a mission's id from
CastleMercenaryMissionItem.startMissionCallback and collectMissionRewards (bundle lines 87379, 87382)
Fields:
RefreshMercenaryMissionRequest
pydantic-model
¶
Bases: BaseRequest
Swap an open mercenary mission for another, for MercenaryConst.REFRESH_MISSION_COST (240) rubies.
Command: rmm Payload: {"MID": mission_id}
Client: C2SRefreshMercenaryMissionVO (bundle line 87437), sent by
CastleMercenaryMissionItem.refreshMissionCallback (bundle line 87416) after
CastleMercenaryRefreshMissionDialog (bundle line 87464); REFRESH_MISSION_COST (dll line 19511)
Fields:
RefreshMercenaryMissionResponse
pydantic-model
¶
Bases: BaseResponse
The mission was swapped; the client reads nothing from the reply.
Command: rmm
Client: RMMCommand.executeCommand (bundle line 125166)
Fields:
castle.models.objects¶
A castle's buildings and its construction queue.
Commands:
- scl: Show the construction list
Classes:
| Name | Description |
|---|---|
BuildingRow |
One placed object in a castle: a building, wall, gate, tower, ground or |
ConstructionList |
A castle's construction slots, the |
FieldEfficiency |
Resource field efficiency per resource ( |
PlacedConstructionItem |
A construction item on a building: one |
BuildingConstructionItems |
The construction items on one building: one |
CastleBuildings |
A castle's buildings, the |
ShowConstructionListRequest |
Get the joined castle's construction slots. |
ShowConstructionListResponse |
The joined castle's construction slots. |
Functions:
| Name | Description |
|---|---|
building_or_none |
A reply's building row, or None when it has none or it cannot be read. |
building_rows |
Each readable row of a list of building rows. |
Attributes:
| Name | Type | Description |
|---|---|---|
FREE_SLOT |
|
|
LOCKED_SLOT |
|
BuildingRow
pydantic-model
¶
Bases: BasePayload
One placed object in a castle: a building, wall, gate, tower, ground or fixed object, read by field position.
- 0 wod id, 1 object id, 2 x, 3 y, 4 rotation (1 for a building inside a
district); each through
int() - 5 seconds of the running construction done, 6 state, 7 hit points, 8 the construction boost at the start, times 100, 9 efficiency, 10 damage type (0 when absent)
- 11 onwards: values the building's type reads, such as a unit-producing building's production speed
- 14 the district the building sits in, 15 its slot there
- 16 the upgrade target's wod id, -1 when absent
A row may come wrapped as {"O": [...]}. Where the client reads an
absent 1 to 4, 14 or 15 as 0, so does this. Fields 5 to 10 are read only
by the building classes (ABasicBuildingVO), which the client picks by
the wod id's group and name; this reads them whenever the row reaches
index 5 and leaves them None otherwise, which is not verified to match
the client's class for every wod id.
Client: IsoHelperData.createIsoObjectVOByServer (bundle line 63049),
AVisualVO.parseServerObject (bundle line 17801),
AIsoObjectVO.parseServerObject (bundle line 11265),
ABasicBuildingVO.parseServerObject (bundle lines 17866-17868, index 5 is _constructionCompletionInSec),
AUnitProductionBuildingVO.parseServerObject (bundle line 36254)
Fields:
-
wod_id(EnumOrInt['Building']) -
object_id(int) -
x(int) -
y(int) -
rotation(int) -
construction_completed_seconds(int | None) -
state(BuildingState | None) -
hit_points(int | None) -
construction_boost_at_start(float | None) -
efficiency(int | None) -
damage_type(int | None) -
district_id(int) -
district_slot_id(int) -
upgrade_target_wod_id(Literal[-1, 0] | EnumOrInt['Building'])
object_id
pydantic-field
¶
object_id: int = 0
The object's id in its castle, which building commands name
construction_completed_seconds
pydantic-field
¶
construction_completed_seconds: int | None = None
Seconds of the running construction done when the row was sent
construction_boost_at_start
pydantic-field
¶
construction_boost_at_start: float | None = None
The construction speed boost when the construction started, as a factor
district_id
pydantic-field
¶
district_id: int = 0
Object id of the district the building sits in, 0 for none
upgrade_target_wod_id
pydantic-field
¶
from_list
classmethod
¶
from_list(data: Any) -> BuildingRow
Read a building row, bare or wrapped as {"O": [...]}.
Raises:
| Type | Description |
|---|---|
ValueError
|
It is not a row. |
ConstructionSlot
pydantic-model
¶
Bases: BasePayload
One construction slot of a castle.
Client: ConstructionSlotVO (bundle lines 131242-131250), filled by
AreaDataConstructionList.parseList (bundle line 131170)
Fields:
object_id
pydantic-field
¶
object_id: int
Object id of the building under construction there; FREE_SLOT (-1) or LOCKED_SLOT (-2)
is_waiting
pydantic-field
¶
is_waiting: bool = False
A waiting slot: its position is at or past the castle's construction slots
ConstructionList
pydantic-model
¶
Bases: BasePayload
A castle's construction slots, the scl block.
Client: AreaDataConstructionList.parseSCL / parseList (bundle
lines 131173, 131166), which read each OIDL entry through int()
into a ConstructionSlotVO at its position
Fields:
-
slots(tuple[ConstructionSlot, ...]) -
slot_count(int | float)
Validators:
-
_slots
FieldEfficiency
pydantic-model
¶
PlacedConstructionItem
pydantic-model
¶
Bases: BasePayload
A construction item on a building: one CIL entry.
Client: ABasicBuildingVO.parseConstructionItems (bundle lines 18005-18010), which puts the item at
its slot type's first index plus int(S) and gives a temporary item the RS seconds left
Fields:
-
construction_item_id(EnumOrInt['ConstructionItem']) -
slot(ClientInt) -
remaining_seconds(ClientNumber)
construction_item_id
pydantic-field
¶
construction_item_id: EnumOrInt['ConstructionItem']
Wire key CID
The construction item
slot
pydantic-field
¶
slot: ClientInt = 0
Wire key S
Its slot among the slots of its item's slot type
remaining_seconds
pydantic-field
¶
remaining_seconds: ClientNumber = 0
Wire key RS
Seconds a temporary item has left; 0 for a permanent one
BuildingConstructionItems
pydantic-model
¶
Bases: BasePayload
The construction items on one building: one CI entry.
Client: ABasicBuildingVO.parseConstructionItems (bundle lines 18000-18006), which takes the entry
whose OID is the building's
Fields:
-
object_id(ClientInt) -
items(tuple[PlacedConstructionItem, ...])
Validators:
-
_readable→items
items
pydantic-field
¶
items: tuple[PlacedConstructionItem, ...]
Wire key CIL
Its construction items
CastleBuildings
pydantic-model
¶
Bases: BasePayload
A castle's buildings, the gca block.
The block's A (the castle's map row) and O (its owner) are kept as sent.
Client: AreaDataUpdater.parseGCA (bundle line 131497),
IsoDataObjectGroupInnerBuilding.parseGCA (bundle line 80810),
IsoDataObjectGroupDefence.parseGCA (bundle line 80220),
IsoDataObjectGroupGround.parseGCA (bundle line 80771),
IsoDataObjectGroupFixedPosition.parseGCA (bundle line 80743),
AreaDataStorageItem.parseGCA (bundle line 131381), AreaDataUpdater.parseConstructionItems
(bundle line 131524)
Fields:
-
buildings(list[BuildingRow]) -
walls(list[BuildingRow]) -
gates(list[BuildingRow]) -
towers(list[BuildingRow]) -
grounds(list[BuildingRow]) -
fixed_positions(list[BuildingRow]) -
construction_list(ConstructionList | None) -
construction_items(tuple[BuildingConstructionItems, ...]) -
field_efficiency(FieldEfficiency)
Validators:
-
_rows -
_construction_list→construction_list -
_construction_items→construction_items -
_efficiency_sees_the_block
fixed_positions
pydantic-field
¶
fixed_positions: list[BuildingRow]
Wire key FP
Objects at fixed positions
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots; None when the block has none
construction_items
pydantic-field
¶
construction_items: tuple[BuildingConstructionItems, ...] = ()
Wire key CI
The construction items on each building that has any
field_efficiency
pydantic-field
¶
field_efficiency: FieldEfficiency
Resource field efficiency per resource
CarriedCastleBuildings
pydantic-model
¶
Bases: BasePayload
The castle's buildings a push or reply carries under gca.
Client: AreaDataUpdater.parseGCA and parseEBE (split.js lines 658993, 659095), handed the ebe
reply and, by GCACommand.executeCommand (split.js line 628685), the gca push
Fields:
-
buildings(CastleBuildings | None)
Validators:
-
_buildings→buildings
buildings
pydantic-field
¶
buildings: CastleBuildings | None = None
Wire key gca
The castle's buildings; None when not sent or unreadable
ShowConstructionListRequest
pydantic-model
¶
Bases: BaseRequest
Get the joined castle's construction slots.
Command: scl Payload: {}
Client: C2SShowConstructionListVO (bundle line 63754)
ShowConstructionListResponse
pydantic-model
¶
Bases: ConstructionList, BaseResponse
The joined castle's construction slots.
Command: scl Payload: {"OIDL": [object_id, ...], "SSC": slot_count}
Client: SCLCommand.executeCommand (bundle line 123374)
Fields:
-
error_code(int) -
slots(tuple[ConstructionSlot, ...]) -
slot_count(int | float)
Validators:
-
_slots
block_or_none
¶
A reply's block read as model, or None when it is not an object or cannot be read.
building_or_none
¶
building_or_none(value: Any) -> BuildingRow | None
A reply's building row, or None when it has none or it cannot be read.
building_rows
¶
building_rows(value: Any) -> list[BuildingRow]
Each readable row of a list of building rows.
The client throws on a null or malformed entry; here one costs only itself.
castle.models.permanent¶
What each castle has unlocked: its units and its horses.
Commands:
- gpc: Permanent castle data, a login section and a push
Classes:
| Name | Description |
|---|---|
CastleUnitUnlocks |
The units and tools a castle can recruit, and those it has still locked. |
PermanentCastle |
One castle's unlocked units and horses. |
PermanentCastleDataResponse |
Every castle's unlocked units and horses. |
CastleUnitUnlocks
pydantic-model
¶
Bases: EmpireModel
The units and tools a castle can recruit, and those it has still locked.
Client: CastleUnitsVO.parseParamObject (bundle lines 139200-139207) looks each id up among
the units rows and keeps the soldiers, auxiliaries and tools
Fields:
-
unlocked_units(tuple[UnitOrTool, ...]) -
locked_units(tuple[UnitOrTool, ...])
Validators:
-
_ids→unlocked_units,locked_units
PermanentCastle
pydantic-model
¶
Bases: EmpireModel
One castle's unlocked units and horses.
Client: CastlePermanentCastleVO.parseParamObject (bundle line 139158),
CastleHorsesVO.parseParamObject (bundle line 139177)
Fields:
-
castle_id(ClientInt) -
kingdom_id(Kingdom) -
units(CastleUnitUnlocks) -
horse_ids(list[EnumOrInt['Horse']])
Validators:
-
_kingdom→kingdom_id -
_units→units -
_horses→horse_ids
units
pydantic-field
¶
units: CastleUnitUnlocks
Wire key U
Units and tools unlocked and locked there
PermanentCastleDataResponse
pydantic-model
¶
Bases: BaseResponse
Every castle's unlocked units and horses.
Command: gpc, as a login section of gbd and as a push
Payload: {"A": [{"AID": castle_id, "KID": kingdom, "U": {"U": [wod_id, ...], "L": [wod_id, ...]},
"UH": [wod_id, ...]}, ...]}
The client never asks for it: there is no C2S constant for gpc. An
update names only the castles it changes; castles it leaves out keep
what they had.
Client: GPCCommand.executeCommand (bundle line 123044),
CastlePermanentCastleData.parseGPC (bundle line 139128), read from
gbd (bundle line 129381)
Fields:
Validators:
-
_castles→castles
castle.models.research¶
Your research, starting it and shortening it with a minute skip.
Commands:
- rei: read your research; also a login section of
gbd, a push, and inside theresandmsrreplies - res: start a research
- msr: shorten the running research with a minute skip
Finishing a research at once for rubies (C2SResearchFinishInstantVO, bundle line 49093) is left out.
Classes:
| Name | Description |
|---|---|
ResearchInfoRequest |
Read your research. |
ResearchInfoResponse |
Your research: what is finished and what runs now. |
StartResearchRequest |
Start a research, paying what it costs: resources and coins, or rubies for a research that costs them. |
StartResearchResponse |
Your research, coins and rubies, and the joined castle's resources after starting a research. |
SkipResearchRequest |
Shorten the running research with a minute skip. |
SkipResearchResponse |
Your research after a minute skip. |
FinishResearchRequest |
Finish the running research now, for rubies. |
FinishResearchResponse |
The acknowledgement of an |
ResearchInfoRequest
pydantic-model
¶
Bases: BaseRequest
Read your research.
Command: rei Payload: {}
Client: C2SResearchInfoVO (bundle line 79687), sent by CastleResearchDialog.showLoaded
(bundle line 16731)
ResearchInfoResponse
pydantic-model
¶
Bases: TimedResponse
Your research: what is finished and what runs now.
Command: rei, as a login section of gbd, a push, and inside the res and msr replies.
Client: CastleResearchData.parse_REI (bundle line 139330), remainingResearchTimeInSeconds
and isSomeResearchActive (bundle lines 139337-139338)
Fields:
-
received_at(float) -
error_code(int) -
bought_research_ids(tuple[EnumOrInt['Research'], ...]) -
current_research_id(Literal[-1, 0] | EnumOrInt['Research']) -
research_seconds(ClientNumber)
bought_research_ids
pydantic-field
¶
Wire key BR
Finished researches
research_seconds
pydantic-field
¶
research_seconds: ClientNumber = 0
Wire key ARRT
Seconds left on the running research when the values were read
remaining_research_seconds
¶
Whole seconds left on the running research, 0 when none runs.
StartResearchRequest
pydantic-model
¶
Bases: BaseRequest
Start a research, paying what it costs: resources and coins, or rubies for a research that costs them.
Command: res Payload: {"RID": research_id, "PO": -1, "PWR": 0}
PWR 1 would pay missing resources with rubies (CastleResourceWaitDialogProperties.getResourceSkipCommand,
bundle line 35216); this request always sends 0. A research whose own costs hold rubies
(ResearchDef.cost_rubies) is sent the same way and spends them; client.castle.start_research
refuses it unless asked to spend rubies.
Client: C2SResearchStartVO (bundle line 47697), sent by ResearchInfo.buyResearch (bundle line 79704)
with the private offer -1 and PWR 0
Fields:
-
research_id(EnumOrInt['Research']) -
private_offer_id(int) -
pay_with_rubies(Literal[0])
StartResearchResponse
pydantic-model
¶
Bases: BaseResponse
Your research, coins and rubies, and the joined castle's resources after starting a research.
Command: res Payload: {"rei": {..}, "gcu": {..}, "grc": {..}}
Client: RESCommand.executeCommand (bundle line 126876), which parses all three
Fields:
-
error_code(int) -
research(ResearchInfoResponse | None) -
currencies(CurrencyBlock) -
resources(CastleResources | None)
research
pydantic-field
¶
research: ResearchInfoResponse | None = None
Wire key rei
Your research after
resources
pydantic-field
¶
resources: CastleResources | None = None
Wire key grc
The joined castle's resources after
SkipResearchRequest
pydantic-model
¶
Bases: BaseRequest
Shorten the running research with a minute skip.
Command: msr Payload: {"MST": minute_skip}
Client: C2SMinuteSkipResearchVO (bundle line 79810), built by
ResearchMinuteSkipProperties.getMinuteSkipCommand (bundle line 79784); CastleMinuteSkipDialog
passes the currency's jsonKey (bundle line 7722)
Fields:
-
minute_skip(EnumOrStr['Currency'])
SkipResearchResponse
pydantic-model
¶
Bases: BaseResponse
Your research after a minute skip.
Command: msr Payload: {"rei": {..}}
Client: MSRCommand.executeCommand (bundle line 125829)
Fields:
-
error_code(int) -
research(ResearchInfoResponse | None)
research
pydantic-field
¶
research: ResearchInfoResponse | None = None
Wire key rei
Your research after
FinishResearchRequest
pydantic-model
¶
Bases: BaseRequest
Finish the running research now, for rubies.
Command: rfi Payload: {}
Client: C2SResearchFinishInstantVO (bundle line 252949), sent by
ResearchProgressInfo.buyResearchInstant (bundle line 413633) and the minute skip dialog's full skip,
ResearchMinuteSkipProperties.getFullSkipCommand (bundle line 413731)
FinishResearchResponse
pydantic-model
¶
Bases: BaseResponse
The acknowledgement of an rfi; it carries nothing.
Command: rfi
Client: RFICommand.executeCommand (bundle line 641922), which also takes NOTHING_TO_SKIP
without an error dialog
Fields:
castle.models.resources¶
A castle's resources and production.
Commands:
- grc: Get a castle's resources
- gpa: Get the joined castle's production area
Classes:
| Name | Description |
|---|---|
CastleResources |
A castle's resources, the |
GetResourcesRequest |
Get one of your castles' resources. |
GetResourcesResponse |
A castle's resources. |
GetProductionRequest |
Get the joined castle's production area. |
GetProductionResponse |
The joined castle's production area. |
CastleResources
pydantic-model
¶
Bases: BasePayload
A castle's resources, the grc block.
Client: CastleResourcesVO.parseGRC (bundle line 131537), which reads
AID and KID through int(); AreaDataStorageItem.parseGRC
(bundle line 131382) reads each amount through int()
Fields:
-
castle_id(ClientInt) -
kingdom_id(ClientInt) -
wood(ClientInt) -
stone(ClientInt) -
food(ClientInt) -
coal(ClientInt) -
oil(ClientInt) -
glass(ClientInt) -
iron(ClientInt) -
aquamarine(ClientInt) -
honey(ClientInt) -
mead(ClientInt) -
beef(ClientInt)
GetResourcesRequest
pydantic-model
¶
Bases: BaseRequest
Get one of your castles' resources.
Command: grc Payload: {"AID": castle_id, "KID": kingdom_id}
Client: C2SGetCastleResourcesVO (bundle line 19925), sent for a
castle picked in the resource transfer dialog (bundle line 38076)
Fields:
GetResourcesResponse
pydantic-model
¶
Bases: CastleResources, BaseResponse
A castle's resources.
Command: grc Payload: {"AID": castle_id, "KID": kingdom_id, "W": .., "S": .., "F": .., ...}
Client: GRCCommand.exec (bundle line 123063), which hands the reply to
AreaDataUpdater.parseGRC (bundle line 131501)
Fields:
-
error_code(int) -
castle_id(ClientInt) -
kingdom_id(ClientInt) -
wood(ClientInt) -
stone(ClientInt) -
food(ClientInt) -
coal(ClientInt) -
oil(ClientInt) -
glass(ClientInt) -
iron(ClientInt) -
aquamarine(ClientInt) -
honey(ClientInt) -
mead(ClientInt) -
beef(ClientInt)
GetProductionRequest
pydantic-model
¶
Bases: BaseRequest
Get the joined castle's production area.
Command: gpa Payload: {}
The server answers for the castle joined with jca.
Client: C2SGetCastleProductionDataVO (bundle line 25082)
GetProductionResponse
pydantic-model
¶
Bases: CastleProductionArea, BaseResponse
The joined castle's production area.
Command: gpa
Client: GPACommand.exec (bundle line 123031), which hands the reply to
AreaDataUpdater.parseGPA (bundle line 131506)
Fields:
-
error_code(int) -
population(int) -
neutral_deco_points(int) -
sickness(int) -
riot(int) -
guards(int) -
build_speed_percent(int) -
metropolis_food_bonus(float) -
unit_capacity(int) -
auxiliary_capacity(int) -
morale(int) -
faction_buff(float) -
food_consumption_delta(float) -
food_consumption_reduction_percent(int) -
mead_consumption_delta(float) -
mead_consumption_reduction_percent(int) -
beef_consumption_delta(float) -
beef_consumption_reduction_percent(int) -
barracks_speed(float) -
workshop_speed(float) -
defense_workshop_speed(float) -
hospital_speed(float) -
production(ResourceProduction) -
storage_capacity(StorageCapacity) -
production_bonus_percent(ProductionBonus) -
safe_amount(SafeAmount)
Validators:
-
_number→faction_buff,food_consumption_delta,mead_consumption_delta,beef_consumption_delta,barracks_speed,workshop_speed,defense_workshop_speed,hospital_speed -
_truthy_number→metropolis_food_bonus -
_sections_see_the_whole_block
castle.models.tax¶
Tax collection.
Commands:
- txi: Read the tax collection status
- txs: Start a tax collection
- txc: Collect the tax
- btx: Bribe the tax collector
Classes:
| Name | Description |
|---|---|
TaxInfo |
The tax collection status, the |
GetTaxInfoRequest |
Read the tax collection status. |
TaxInfoResponse |
The tax collection status: the |
StartTaxRequest |
Start a tax collection of one tax type. |
StartTaxResponse |
The tax status after starting a collection. |
CollectTaxRequest |
Collect the tax, also cutting a running collection short. |
CollectTaxResponse |
The collected tax. |
BribeTaxCollectorRequest |
Bribe the tax collector: a tax booster, bought with rubies. |
BribeTaxCollectorResponse |
The tax status after the bribe; its booster ( |
Attributes:
| Name | Type | Description |
|---|---|---|
TAX_DURATIONS |
tuple[int, ...]
|
Seconds each tax type collects for, by tax type 0 to 6. |
TAX_RUBY_COSTS |
tuple[int, ...]
|
Rubies each tax type costs to start before any waiver, by tax type. |
TAX_DURATIONS
module-attribute
¶
Seconds each tax type collects for, by tax type 0 to 6.
Client: TaxConst.COLLECTOR_DURATION (dll line 19772)
TAX_RUBY_COSTS
module-attribute
¶
Rubies each tax type costs to start before any waiver, by tax type.
Types 5 and 6 cost rubies unless a premium account, a VIP level or the tax research waives it; types 1 to 4 cost a tenth of their income in coins and type 0 is free.
Client: TaxConst.START_COST_C2, START_COST_C1_PERC,
getCollectorC2Costs (dll lines 19773-19779)
TaxInfo
pydantic-model
¶
Bases: BasePayload
The tax collection status, the TX of a txi block.
Client: TaxInfoVO.fillFromParamObject (bundle line 29538)
Fields:
-
tax_type(int) -
remaining_seconds(int) -
expected_income(int) -
population(int) -
is_boosted(bool) -
vip_bonus(int)
Validators:
-
_boosted→is_boosted
tax_type
pydantic-field
¶
tax_type: int = 0
Wire key TT
The running or finished collection's tax type, 0 to 6; -1 for none
remaining_seconds
pydantic-field
¶
remaining_seconds: int = 0
Wire key RT
Seconds until the collection is done, as of the reply
expected_income
pydantic-field
¶
expected_income: int = 0
Wire key EM
Coins the collection brings before boosts
status
property
¶
status: TaxStatus
Whether a collection runs or waits to be collected, as of the reply.
The client keeps the end time, the reply's time plus RT, and counts down to it: a
collection is collecting while the remaining time is 0 or more, so one with RT 0 is
still collecting as of the reply, and ready to collect once the end time has passed.
Client: TaxInfoVO.taxState and remainingCollectionTimeInSeconds (bundle lines
29542, 29544), fillFromParamObject (bundle line 29540)
GetTaxInfoRequest
pydantic-model
¶
Bases: BaseRequest
Read the tax collection status.
Command: txi Payload: {}
Client: C2SGetTaxInfoVO (bundle line 37186), sent by
CastleCollectTaxStartDialog.showLoaded (bundle line 52962) and
CastleCollectTaxDialog.showLoaded (bundle line 91005)
TaxInfoResponse
pydantic-model
¶
Bases: BaseResponse
The tax collection status: the txi reply, also nested in txs and txc.
Command: txi Payload: {"TX": {"TT": .., "RT": .., "EM": .., "PO": .., "IB": .., "VB": ..}}
Client: TXICommand.executeCommand (bundle line 128792),
CastleTaxData.parse_TXI (bundle line 112797)
Fields:
-
error_code(int) -
tax(TaxInfo)
StartTaxRequest
pydantic-model
¶
Bases: BaseRequest
Start a tax collection of one tax type.
Command: txs Payload: {"TT": tax_type, "TX": 3}
Client: C2SStartCollectTaxVO (bundle line 91088), sent by
CastleCollectTaxElement.onStartTaxCollection (bundle line 91069)
Fields:
StartTaxResponse
pydantic-model
¶
Bases: BaseResponse
The tax status after starting a collection.
Command: txs Payload: {"gcu": {...}, "txi": {"TX": {...}}}
Client: TXSCommand.executeCommand (bundle line 128807)
Fields:
-
error_code(int) -
currencies(CurrencyBlock) -
tax_info(TaxInfoResponse | None)
currencies
pydantic-field
¶
currencies: CurrencyBlock = None
Wire key gcu
Coins and rubies after the start
tax_info
pydantic-field
¶
tax_info: TaxInfoResponse | None = None
Wire key txi
The tax status after the start; None when the reply has none
CollectTaxRequest
pydantic-model
¶
Bases: BaseRequest
Collect the tax, also cutting a running collection short.
Command: txc Payload: {"TR": 29}
Client: C2SCollectTaxVO (bundle line 41083), sent by
IsoServerCommands.collectTax (bundle line 63777) and
CastleCollectTaxDialog.collectTax (bundle line 91027)
Fields:
CollectTaxResponse
pydantic-model
¶
Bases: BaseResponse
The collected tax.
Command: txc Payload: {"gcu": {...}, "txi": {"TX": {...}}, "CT": coins}
Client: TXCCommand.executeCommand (bundle line 128747)
Fields:
-
error_code(int) -
currencies(CurrencyBlock) -
tax_info(TaxInfoResponse | None) -
collected(int)
currencies
pydantic-field
¶
currencies: CurrencyBlock = None
Wire key gcu
Coins and rubies after collecting
tax_info
pydantic-field
¶
tax_info: TaxInfoResponse | None = None
Wire key txi
The tax status after collecting; None when the reply has none
BribeTaxCollectorRequest
pydantic-model
¶
Bases: BaseRequest
Bribe the tax collector: a tax booster, bought with rubies.
Command: btx Payload: {"PO": offer_id}
Client: CastleBribeDialog.onClick (bundle line 90878) and the booster shop (bundle line 90236)
send C2S_BRIBE_TAX_COLLECTOR with CastleBoosterSaleData.getOfferId (bundle line 9696)
Fields:
BribeTaxCollectorResponse
pydantic-model
¶
Bases: BaseResponse
The tax status after the bribe; its booster (boi) reaches client.state.
Command: btx Payload: {"gcu": {...}, "boi": {...}, "txi": {"TX": {...}}}
Client: BTXCommand.executeCommand (bundle line 128770)
Fields:
-
error_code(int) -
currencies(CurrencyBlock) -
tax_info(TaxInfoResponse | None)
currencies
pydantic-field
¶
currencies: CurrencyBlock = None
Wire key gcu
Coins and rubies after the bribe
tax_info
pydantic-field
¶
tax_info: TaxInfoResponse | None = None
Wire key txi
The tax status after the bribe; None when the reply has none
castle.models.updates¶
Castle pushes: units received, building XP, changed buildings, slum level and area booster.
Commands (all pushed by the server):
- rue: Units received in a castle
- fbe: A building finished
- cbx: A building gave XP
- gdb: Damaged buildings of the joined castle
- gcb: Buildings of the joined castle whose efficiency changed
- csl: The joined castle's slum level
- gab: The joined castle's area booster
- kik: The server's new day
- ghw: The joined castle moved on the map
- gca: The joined castle's buildings, whole
- ego: A building of the joined castle changed
Classes:
| Name | Description |
|---|---|
UnitsReceived |
Units that finished and arrived in one of your castles: the castle's new count of that unit. |
BuildingXP |
XP a building in the joined castle gave. |
BuildingFinished |
A building in the joined castle finished, and the XP it gave. |
DamagedBuildings |
Buildings of the joined castle that were damaged, as their rows are now. |
BuildingEfficiencyChanged |
Buildings of the joined castle whose efficiency changed, as their rows are now. |
SlumLevel |
The joined castle's slum level. |
AreaBooster |
The joined castle's builder discount. |
NewDay |
A new day began on the server. On a Monday the client sets every castle's open-gate counter to 0. |
JoinedAreaMoved |
The castle you have joined now stands at a new position on the map. |
CastleBuildingsPushed |
The joined castle's buildings, sent whole, and its owner. |
BuildingChanged |
A building of the joined castle changed: the building, and the castle's construction slots and builder |
UnitsReceived
pydantic-model
¶
Bases: BaseResponse
Units that finished and arrived in one of your castles: the castle's new count of that unit.
Command: rue Payload: {"AID": castle_id, "SID": kingdom_id, "WID": wod_id, "NUA": amount}
Client: RUECommand.executeCommand (bundle line 125646),
CastleUserCastleListDetailed.parse_rue (bundle line 140918),
CastleMilitaryData.parse_rue (bundle line 138834)
Fields:
-
error_code(int) -
castle_id(ClientInt) -
kingdom_id(ClientInt) -
wod_id(UnitOrTool) -
amount(ClientInt)
BuildingXP
pydantic-model
¶
Bases: BaseResponse
XP a building in the joined castle gave.
Command: cbx Payload: {"OID": object_id, "XP": xp}
Client: CBXCommand.executeCommand (bundle line 123345),
AreaDataUpdater.parseCBX (bundle line 131521),
IsoUpdaterData.onGainedBuildingPoints (bundle line 130308)
Fields:
BuildingFinished
pydantic-model
¶
Bases: BuildingXP
A building in the joined castle finished, and the XP it gave.
Command: fbe Payload: {"OID": object_id, "XP": xp}
Client: FBECommand.exec (bundle line 122879), which reads it as cbx
Fields:
DamagedBuildings
pydantic-model
¶
Bases: BaseResponse
Buildings of the joined castle that were damaged, as their rows are now.
Command: gdb Payload: {"B": [row, ...]}
Client: GDBCommand.executeCommand (bundle line 122998),
AreaDataUpdater.parseGDB (bundle line 131510),
IsoUpdaterData.updateMultipleObjectInfos (bundle line 130259)
Fields:
Validators:
-
_rows→buildings
BuildingEfficiencyChanged
pydantic-model
¶
Bases: DamagedBuildings
Buildings of the joined castle whose efficiency changed, as their rows are now.
Command: gcb Payload: {"B": [row, ...]}
Client: GCBCommand.executeCommand (bundle line 122968),
AreaDataUpdater.parseGCB (bundle line 131509)
Fields:
Validators:
-
_rows→buildings
SlumLevel
pydantic-model
¶
Bases: BaseResponse
The joined castle's slum level.
Command: csl Payload: {"SL": level}
Client: CSLCommand.executeCommand (bundle line 122715),
AreaDataSlum.parseCSL (bundle line 131305)
Fields:
-
error_code(int) -
level(int)
AreaBooster
pydantic-model
¶
Bases: BaseResponse
The joined castle's builder discount.
Command: gab Payload: {"B": discount}
Client: GABCommand.executeCommand (bundle line 122923),
AreaDataCommonInfo.parseGAB (bundle line 130992)
Fields:
-
error_code(int) -
builder_discount(int | float)
NewDay
pydantic-model
¶
Bases: BaseResponse
A new day began on the server. On a Monday the client sets every castle's open-gate counter to 0.
Command: kik Payload: {"DOW": day_of_week}
Client: KIKCommand.executeCommand (bundle line 123151)
Fields:
-
error_code(int) -
day_of_week(EnumOrInt[Weekday] | None)
Validators:
-
_whole_day→day_of_week
JoinedAreaMoved
pydantic-model
¶
Bases: BaseResponse
The castle you have joined now stands at a new position on the map.
Command: ghw Payload: {"X": x, "Y": y}
Client: GHWCommand.executeCommand (bundle line 129574), AreaDataModel.changePosOfOwnArea
(bundle line 131929)
Fields:
CastleBuildingsPushed
pydantic-model
¶
Bases: BaseResponse
The joined castle's buildings, sent whole, and its owner.
The client never sends gca (C2S_GET_CASTLE is declared but unused), so it arrives only from the server.
Command: gca Payload: {"O": owner, "gca": {"BD": [..], "D": [..], ...}}
Client: GCACommand.executeCommand (bundle line 122991), CastleOtherPlayerData.parseOwnerInfo
(bundle line 139045), AreaDataUpdater.parseGCA (bundle line 131546)
Fields:
-
error_code(int) -
owner(MapObject | None) -
buildings(CastleBuildings | None)
Validators:
-
_buildings→buildings
buildings
pydantic-field
¶
buildings: CastleBuildings | None = None
Wire key gca
The castle's buildings; None when unreadable
BuildingChanged
pydantic-model
¶
Bases: BaseResponse
A building of the joined castle changed: the building, and the castle's construction slots and builder discount after.
The skill list the same push may carry is read by ObjectUpdateEvent, the registered ego model.
Command: ego Payload: {"O": row, "scl": {..}, "gab": {..}, "skl": {..}}
Client: EGOCommand.executeCommand (split.js line 628214), AreaDataUpdater.parseEGO (split.js
line 659116), which hands the payload to IsoUpdaterData.updateObjectInfo (split.js line 654563),
whose IsoCommandPackageObjectUpdateInfo.getRealServerObject reads the row from O;
AreaDataCommonInfo.parseGAB (split.js line 656983)
Fields:
-
error_code(int) -
building(BuildingRow | None) -
construction_list(ConstructionList | None) -
area_booster(AreaBooster | None)
Validators:
-
_row→building -
_construction_list→construction_list -
_area_booster→area_booster
construction_list
pydantic-field
¶
construction_list: ConstructionList | None = None
Wire key scl
The construction slots after; None when the push has none
area_booster
pydantic-field
¶
area_booster: AreaBooster | None = None
Wire key gab
The builder discount after; None when the push has none
castle.models.upkeep¶
Pushes that keep the castle screen current: construction item expiry and the resource citizen.
Commands:
- nec: when the next construction item expires, a login section of
gbd, a push and a reply - irc: the resource the citizen in your castle carries, a push and the reply to collecting it
Classes:
| Name | Description |
|---|---|
GetConstructionItemExpiryRequest |
Ask when the next of your construction items expires. |
ConstructionItemExpiryResponse |
When the next of your construction items expires and when one last expired, and the construction |
CollectResourceCitizenRequest |
Collect what the citizen walking in the joined castle carries. |
ResourcePoolResponse |
The resource the citizen walking in your castle carries, to collect by clicking it. |
GetConstructionItemExpiryRequest
pydantic-model
¶
Bases: BaseRequest
Ask when the next of your construction items expires.
Command: nec Payload: {}
Client: C2SGetNextExpiringConstructionItemVO (bundle line 77698), sent by
ConstructionItemData.onCIExpiration (bundle line 22993)
ConstructionItemExpiryResponse
pydantic-model
¶
Bases: TimedResponse
When the next of your construction items expires and when one last expired, and the construction items on the joined castle's buildings when a push lists them.
Command: nec, as a login section of gbd and a push.
Client: NECCommand.executeCommand (split.js line 629754), which hands a truthy CI to the joined
area's parseConstructionItems; ConstructionItemData.parse_NEC (split.js line 120941) and
hasNewExpiredItems (split.js line 121010)
Fields:
-
received_at(float) -
error_code(int) -
next_expiry_seconds(ClientNumber) -
last_expired_at(ClientNumber) -
placed_items(tuple[BuildingConstructionItems, ...] | None)
Validators:
-
_placed→placed_items
next_expiry_seconds
pydantic-field
¶
next_expiry_seconds: ClientNumber = -1
Wire key NCRS
Seconds until the next construction item expires when the values were read, -1 for none
last_expired_at
pydantic-field
¶
last_expired_at: ClientNumber = -1
Wire key LECT
When a construction item last expired, the server's timestamp; -1 none
placed_items
pydantic-field
¶
placed_items: tuple[BuildingConstructionItems, ...] | None = None
Wire key CI
The construction items on each of the joined castle's buildings; None when not sent
CollectResourceCitizenRequest
pydantic-model
¶
Bases: BaseRequest
Collect what the citizen walking in the joined castle carries.
Command: irc Payload: {}
Client: C2SIsoResourceCitizenVO (bundle line 63836), sent by
IsoServerCommands.collectResourcePool (bundle line 63801)
ResourcePoolResponse
pydantic-model
¶
Bases: BaseResponse
The resource the citizen walking in your castle carries, to collect by clicking it.
Command: irc, a push and the reply to collecting the goods.
Client: IRCCommand (bundle line 123090), CastleResourcePoolData.parseIRC (bundle line 139623), which
keeps the first collectable of G and sets its amount to 1000 when EG is set. The client drops it
when you join a castle (JAACommand, bundle line 130194), as client.state does, and also when the
citizen carrying it is collected or leaves (registerNewMovementAsOwner, bundle line 139626), which
the state does not follow, so it can outlast the citizen until the next irc.
Fields:
Validators:
-
_extra→has_extra_goods
castle.models.wishing_well¶
The ruby wishing well.
Commands:
- rww: start, finish, collect, upgrade or read the wishing well; its level and time, a login section of
gbdand the reply
Classes:
| Name | Description |
|---|---|
WishingWellRequest |
Act on the ruby wishing well in your main castle. |
WishingWellResponse |
The ruby wishing well: its level and whether it can be started, runs, or waits to be collected. |
Functions:
| Name | Description |
|---|---|
wishing_well_skip_rubies |
The rubies finishing the running wishing well costs with |
WishingWellRequest
pydantic-model
¶
Bases: BaseRequest
Act on the ruby wishing well in your main castle.
Command: rww Payload: {"PWR": 0 or 1, "_PO": -1, "WOP": option}
Keys follow the client's order: the constructor sets PWR and _PO before WOP.
Client: C2SWishingWellCommandVO (split.js line 110368)
Fields:
WishingWellResponse
pydantic-model
¶
Bases: TimedResponse
The ruby wishing well: its level and whether it can be started, runs, or waits to be collected.
Command: rww, as a login section of gbd and a successful reply; a reply refused for lack of
resources is not read.
Client: RWWCommand (split.js line 641960), CastleRubyWishingWellData.parse_RWW (split.js line 110466),
isReadyToStart, isReadyToCollect, isRunning and getRemainingSecondsCalculated
(split.js lines 110440-110504)
Fields:
seconds
pydantic-field
¶
seconds: ClientNumber = -1
Wire key RT
Seconds left when the values were read: -1 ready to start, 0 ready to collect
is_ready_to_start
property
¶
is_ready_to_start: bool
Whether the wishing well can be started, as last read.
wishing_well_skip_rubies
¶
The rubies finishing the running wishing well costs with seconds left: half a ruby a whole minute,
1999 at most.
Client: WishingWellConst.calculateWishingWellSkipCost (ggs.dll.js line 237), shown by
RubyWishingWellDialog.updateArrow (split.js line 266252)