Commanders¶
Commanders, castellans, equipment and generals behind client.commanders and client.equipment.
commanders.service¶
Commanders and castellans, their generals, and their equipment.
- CommandersService reads and renames the player's commanders and castellans, says whether the premium commander leads for free, and changes generals: assigning one to a commander, choosing its abilities, unlocking and resetting its skills, feeding it xp items, unlocking it and raising its stars with shards, and spinning the generals hub for them. A general's skills widen the flanks whatever the target is.
- EquipmentService reads the equipment inventory, moves items on and off commanders and castellans, sells items and gems, sets gems in worn items and takes them out, crafts and enchants items, relics and gems, and reads and sets the auto-sell rules.
Modules:
| Name | Description |
|---|---|
equipment |
Equipment, gems and relics: the inventory, crafting, enchanting and selling. |
generals |
Generals: assigning them, their abilities, skills and stars, and the generals hub. |
Classes:
| Name | Description |
|---|---|
EquipmentService |
The equipment inventory: putting items on and off commanders and castellans, selling items and gems, |
CommandersService |
Your commanders and castellans, renaming them, and their generals. |
EquipmentService
¶
Bases: BaseService
The equipment inventory: putting items on and off commanders and castellans, selling items and gems, setting gems and taking them out, crafting and enchanting, and the auto-sell rules.
Reached as client.equipment. What a leader
wears comes with client.commanders (gli EQ).
Methods:
| Name | Description |
|---|---|
get_inventory |
The items in the player's inventory, the ones no leader wears. |
equip |
Put an item on a commander or castellan. |
unequip |
Take an item off a commander or castellan. |
sell_equipment |
Sell an item for coins. |
sell_gem |
Sell a gem, or a relic gem, for coins. |
bind_gem |
Set a gem in an item a commander or castellan wears. |
get_auto_sell |
The auto-sell rules: which new equipment and gems the server sells as they drop. |
set_auto_sell |
Replace the auto-sell rules, the equipment ones and then the gem ones, as the client saves them. |
get_gems |
The gems and relic gems in your inventory; the reply also reaches |
get_inventory_space |
The equipment and gem inventory space; the reply also reaches |
get_new_relics |
The relic items and relic gems you have not seen yet. |
craft_equipment |
Craft a new item from inventory items. The items are used up, and so are their gems unless |
enchant_equipment |
Enchant an item one level, for coins or, with |
enchant_relic |
Enchant a relic item or relic gem one level, for relic fragments and coins or, with |
craft_gem |
Craft a gem a level up from a gem and gems around it. The gems around it are used up. |
extract_gem |
Take the gem out of an item, back into the inventory. |
Attributes:
| Name | Type | Description |
|---|---|---|
gems |
GemInventoryResponse | None
|
The gems and relic gems in your inventory; None until a |
inventory_space |
InventorySpace | None
|
The equipment and gem inventory space, from the last |
new_relics |
NewRelicsResponse
|
Whether new relics wait to be seen, from the last |
gems
property
¶
gems: GemInventoryResponse | None
The gems and relic gems in your inventory; None until a ggm or gec arrived.
inventory_space
property
¶
inventory_space: InventorySpace | None
The equipment and gem inventory space, from the last esl; None until one arrived.
new_relics
property
¶
new_relics: NewRelicsResponse
Whether new relics wait to be seen, from the last nrf.
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought it |
get_inventory
¶
The items in the player's inventory, the ones no leader wears.
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
equip
¶
Put an item on a commander or castellan.
The client moves an item between leaders by taking it off the first
and then putting it on the second. The reply carries no data; re-read
client.commanders.get_all() to see the change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment_id
|
int
|
An item in the inventory, its |
required |
commander_id
|
int
|
The leader's |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
unequip
¶
Take an item off a commander or castellan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment_id
|
int
|
An item the leader wears, the |
required |
commander_id
|
int
|
The leader's |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
sell_equipment
¶
Sell an item for coins.
The reply's commanders, coins and inventory space reach client.state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment_id
|
int
|
An item in the inventory, its |
required |
commander_id
|
int | None
|
The commander wearing a relic sold straight off it, as the relic enchanter sells
one ( |
None
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
sell_gem
¶
Sell a gem, or a relic gem, for coins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gem
|
Gem | GemStack | RelicGem
|
A gem, a |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
bind_gem
¶
bind_gem(gem: Gem | GemStack | RelicGem, equipment_id: int, commander_id: int, *, timeout: float = 5.0) -> None
Set a gem in an item a commander or castellan wears.
A gem already set in the item is not taken back: the client shows it broken
(CastleReplaceSocketDialog.renderIcons, bundle line 42224). Taking it back costs rubies or
relic fragments and is not offered here. Setting a gem costs coins: the gem level's
insertCostC1, or RelicItemConst.INSERT_RELIC_GEM_C1_COST (95000, dll line 19669) for a
relic gem (ACastleSocketDialog.getCosts, bundle line 32488).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gem
|
Gem | GemStack | RelicGem
|
A gem, a |
required |
equipment_id
|
int
|
The worn item's |
required |
commander_id
|
int
|
The |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
get_auto_sell
¶
get_auto_sell(*, timeout: float = 5.0) -> AutoSellRules
The auto-sell rules: which new equipment and gems the server sells as they drop.
The client asks for them only while the auto-sell subscription effect runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
AutoSellRules
|
The rules, from the |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
set_auto_sell
¶
set_auto_sell(rules: AutoSellRules, *, timeout: float = 5.0) -> None
Replace the auto-sell rules, the equipment ones and then the gem ones, as the client saves them.
Every gem colour is sent, 0 for one rules.gems leaves out.
Client: AutoSellVO.sendConfigToServer (bundle line 120132)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rules
|
AutoSellRules
|
The rules; the equipment from |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
A rule the auto-sell dialog cannot set, or a gem colour the game data lacks |
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
get_gems
¶
get_gems(*, timeout: float = 5.0) -> GemInventoryResponse
The gems and relic gems in your inventory; the reply also reaches gems.
Client: CastleEquipmentSublayer.updateEquipmentData (bundle line 25717)
get_inventory_space
¶
get_inventory_space(*, timeout: float = 5.0) -> InventorySpace
The equipment and gem inventory space; the reply also reaches inventory_space.
Raises:
| Type | Description |
|---|---|
PacketError
|
The reply could not be read |
Client: AMerchantBuyDialog.onInventorySpaceData (bundle line 41333), ESLCommand (bundle line 123933)
get_new_relics
¶
get_new_relics(*, timeout: float = 5.0) -> NewRelicItemsResponse
The relic items and relic gems you have not seen yet.
Client: the equipment dialog's showLoaded (bundle line 8801)
craft_equipment
¶
craft_equipment(equipment_ids: Sequence[int], *, extract_gems: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> Equipment
Craft a new item from inventory items. The items are used up, and so are their gems unless
extract_gems takes them back first.
Taking a gem back costs its level's rubies, a relic gem relic fragments, so extract_gems
needs spend_rubies. The reply's inventory space reaches inventory_space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment_ids
|
Sequence[int]
|
The inventory items used up, their |
required |
extract_gems
|
bool
|
Take the items' gems back into the inventory first |
False
|
spend_rubies
|
bool
|
Allow the rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
Equipment
|
The crafted item |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused |
Client: CraftingEquipmentClickHandler.onClick and extractGems (bundle lines 74125, 74129),
CastleExtractGemsDialog.calculateRemovalCostsForGems (bundle line 74260)
enchant_equipment
¶
enchant_equipment(equipment_id: int, *, pay_with_rubies: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> Equipment
Enchant an item one level, for coins or, with pay_with_rubies, rubies.
Returns:
| Type | Description |
|---|---|
Equipment
|
The item after |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused; |
Client: the enchant dialog's pay buttons (bundle lines 59446-59448), EQECommand (bundle line 123900)
enchant_relic
¶
enchant_relic(relic: Equipment | RelicGem, *, pay_with_rubies: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> Equipment | RelicGem
Enchant a relic item or relic gem one level, for relic fragments and coins or, with
pay_with_rubies, rubies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relic
|
Equipment | RelicGem
|
A relic item ( |
required |
pay_with_rubies
|
bool
|
Pay in rubies instead of coins |
False
|
spend_rubies
|
bool
|
Allow those rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
Equipment | RelicGem
|
The relic item or relic gem after |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused; |
PacketError
|
The reply carries no relic |
Client: RelicUpgradeDialog.onBuyButtonClicked (bundle line 29490),
RelicUpgradeDialogPayment.getCosts (bundle line 86002)
craft_gem
¶
craft_gem(gem: Gem | GemStack, used_gems: Sequence[Gem | GemStack], *, pay_with_rubies: bool = False, spend_rubies: bool = False, timeout: float = 5.0) -> CraftGemResponse
Craft a gem a level up from a gem and gems around it. The gems around it are used up.
The craft can fail; its reply says whether it worked (CraftGemResponse.crafted). The ruby craft,
pay_with_rubies, needs spend_rubies. The reply's inventory space reaches inventory_space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gem
|
Gem | GemStack
|
The centre gem, crafted a level up |
required |
used_gems
|
Sequence[Gem | GemStack]
|
The gems in the outer slots, used up |
required |
pay_with_rubies
|
bool
|
The ruby craft |
False
|
spend_rubies
|
bool
|
Allow its rubies |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
|
CommandError
|
The server refused |
Client: CastleGemData.craftGem (bundle line 144476), CraftingGemClickHandler.handleDialogClick
(bundle lines 73941-73943)
extract_gem
¶
extract_gem(equipment: Equipment, *, commander_id: int | None = None, spend_rubies: bool = False, timeout: float = 5.0) -> None
Take the gem out of an item, back into the inventory.
A gem costs its level's rubies, so it needs spend_rubies; a relic gem costs relic fragments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
equipment
|
Equipment
|
An inventory item, or one a commander wears, with a gem |
required |
commander_id
|
int | None
|
The commander or castellan wearing it; None for an inventory item |
None
|
spend_rubies
|
bool
|
Allow the rubies a gem costs |
False
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The item has no gem, or a gem without |
CommandError
|
The server refused |
Client: CastleGemData.extractGem (bundle line 144483), CastleExtractSocketDialog.getCosts
(bundle line 65738)
CommandersService
¶
CommandersService(client: EmpireClient)
Bases: GeneralsMixin, BaseService
Your commanders and castellans, renaming them, and their generals.
Reached as client.commanders.
Methods:
| Name | Description |
|---|---|
get_all |
Get commanders and castellans in one request. |
get_commanders |
Get every commander, whether or not it leads an army now. |
get_castellans |
Get all available castellans. |
rename |
Rename a commander or castellan. |
free_premium_commanders |
How many more times today the premium commander ( |
premium_commander_is_free |
Whether leading with the premium commander now costs no rubies: a premium account |
premium_send |
Run |
get_generals |
Every general the player owns, with the skills each has unlocked. |
assign_general |
Assign a general to a commander; |
set_general_abilities |
Choose a general's abilities. |
unlock_general_skill |
Unlock a general skill; the skill id names the general. |
reset_general_skills |
Reset a general's skill tree. |
add_general_xp |
Feed a general xp items. |
unlock_general |
Unlock a general with its shards. |
upgrade_general_stars |
Raise a general's star level with one of its shards. |
clear_general_flags |
Clear a general's new and level-up flags; the next |
get_generals_hub |
The generals hub's characters: their free spins, and when the next free spin comes. |
spin_generals_hub |
Spin a hub character's tombola with an offering, free or paid. |
Attributes:
| Name | Type | Description |
|---|---|---|
roster |
CommanderRoster
|
Your commanders and castellans as the last |
travelling_commanders |
list[Commander]
|
The commanders leading one of your movements in state, returning ones included; nothing is sent. |
idle_commanders |
list[Commander]
|
The commanders free to lead an army: those not in |
roster
property
¶
roster: CommanderRoster
Your commanders and castellans as the last gli listed them.
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought it |
travelling_commanders
property
¶
The commanders leading one of your movements in state, returning ones included; nothing is sent.
Availability follows the locally tracked movements, including any server-provided waiting duration. After a return expires, the commander remains listed for one second to mitigate the server still considering it busy. Outbound attacks also get one second to bridge the return packet; other outbound movements add no hold.
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought the roster |
Client: LordVO.isAvailableForMovement (bundle line 26656), false while any map movement
that isMyMovement (BasicMapmovementVO, bundle line 19436) has the lord as its lordVO,
whichever way it travels. CastleArmyData.updateMapmovements removes an expired
movement without an additional commander hold. The one-second margin is
library policy beyond the client.
idle_commanders
property
¶
The commanders free to lead an army: those not in travelling_commanders; nothing is sent.
Returning commanders become idle one second after their estimated return end.
This remains a local estimate. The server may still reject a send
with GGEError.LORD_IS_USED; the send surfaces that error to the caller.
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought the roster |
get_all
¶
get_all(*, timeout: float = 5.0) -> GetCommandersResponse
Get commanders and castellans in one request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
GetCommandersResponse
|
The full gli response |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
get_commanders
¶
Get every commander, whether or not it leads an army now.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
list[Commander]
|
List of Commander objects |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
get_castellans
¶
Get all available castellans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
list[Castellan]
|
List of Castellan objects |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
rename
¶
rename(commander_id: int, name: str, *, timeout: float = 5.0) -> CommanderRoster
Rename a commander or castellan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commander_id
|
int
|
The leader's |
required |
name
|
str
|
The new name; the game's dialog allows 3 to 15 characters |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
CommanderRoster
|
Your commanders and castellans after the rename, from the |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
free_premium_commanders
¶
How many more times today the premium commander (PREMIUM_COMMANDER_ID) can lead for free.
Your VIP level's free_premium_commanders_per_day less those used today, and 0
while no VIP time runs. It comes from state, kept current by the login data's
vip and every vip the server pushes. A premium send this client made
(premium_send) counts as used until the next vip arrives.
A premium account makes the premium commander free on top of this:
premium_commander_is_free counts both.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
now
|
float | None
|
Wall-clock time to measure the VIP time left at, |
None
|
Returns:
| Type | Description |
|---|---|
int | None
|
The count, 0 at least, or None before the login data brought your VIP |
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
VIP time runs and the game data cannot be loaded |
Client: CastleVIPData.remainingPremiumCommanders (bundle line 47554), the
freePremiumCommandersPerDay of currentActiveVIPLevel (bundle line 47546), which
is a level with none unless vipModeActive (bundle line 47550); parse_VIP
(bundle line 47527) reads UPG, from GBDCommand (bundle line 129381),
VIPCommand (bundle line 129941) and SBPCommand (bundle line 128320)
premium_commander_is_free
¶
premium_commander_is_free() -> bool
Whether leading with the premium commander now costs no rubies: a premium account
runs, or free_premium_commanders is 1 or more.
False when neither is known yet.
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
No premium account runs, VIP time does, and the game data cannot be loaded |
Client: CastlePostAttackDialog.startAttack (bundle line 38360), which sends with a
free premium commander left and otherwise asks for
getFinalCostsC2(TravelConst.TRAVEL_PREMIUM_COMMANDER_COSTS_C2) rubies, 0 while
premiumAccountVO.isActive; TRAVEL_PREMIUM_COMMANDER_COSTS_C2 is 125 (dll line 19872)
premium_send
¶
premium_send(commander_id: int, use_premium_commander: bool, send: Callable[[], _Sent], *, spend_rubies: bool = False) -> _Sent
Run send and return what it returns, refusing it first when the premium commander leads and may cost
rubies, unless spend_rubies.
The army sends go through this: client.movements.send_support,
client.movements.send_troops, client.attack.send_attack and
client.attack.send_treasure_hunt_attack. The premium commander
leads when use_premium_commander is set or commander_id is PREMIUM_COMMANDER_ID;
the client always sends the two together.
Library policy, not client behaviour: the server sends no vip with the send's
reply (CRACommand, bundle line 125954; CDSCommand, bundle line 125939; CATCommand,
bundle line 125924), so a
premium send that the server accepts while no premium account runs counts as one
used in free_premium_commanders until the next vip arrives. The check and the
send hold one lock, so two premium sends at once cannot both take the last free one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commander_id
|
int
|
The leader's |
required |
use_premium_commander
|
bool
|
The send's |
required |
send
|
Callable[[], _Sent]
|
Sends the request and raises when the server refuses it |
required |
spend_rubies
|
bool
|
Send even when the premium commander may cost rubies |
False
|
Raises:
| Type | Description |
|---|---|
PremiumCommanderCostError
|
The premium commander leads, |
GameDataNotLoadedError
|
See |
Client: CastlePostAttackDialog.startAttack (bundle line 38360) sends BPC 1
exactly when the selected commander is TravelConst.COMMANDER_PREMIUM
get_generals
¶
get_generals(*, timeout: float = 5.0) -> list[OwnedGeneral]
Every general the player owns, with the skills each has unlocked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
list[OwnedGeneral]
|
Your generals, from the |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
assign_general
¶
assign_general(commander_id: int, general: AnyGeneral | None, *, timeout: float = 5.0) -> CommanderRoster
Assign a general to a commander; general=None takes its general away (the client sends -1,
CastleLordData.assignGeneral, bundle line 38679).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commander_id
|
int
|
A |
required |
general
|
AnyGeneral | None
|
The general: one of |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
CommanderRoster
|
Your commanders and castellans after the change, from the |
Raises:
| Type | Description |
|---|---|
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
set_general_abilities
¶
set_general_abilities(general: AnyGeneral, abilities: Iterable[tuple[int, GeneralAbility | None]], *, timeout: float = 5.0) -> None
Choose a general's abilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
AnyGeneral
|
The general: one of |
required |
abilities
|
Iterable[tuple[int, GeneralAbility | None]]
|
|
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
unlock_general_skill
¶
unlock_general_skill(skill_id: GeneralSkill, *, timeout: float = 5.0) -> None
Unlock a general skill; the skill id names the general.
The general's new skills arrive with the next gie.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skill_id
|
GeneralSkill
|
The skill level's |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
reset_general_skills
¶
reset_general_skills(general: AnyGeneral, *, timeout: float = 5.0) -> None
Reset a general's skill tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
AnyGeneral
|
The general: one of |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
add_general_xp
¶
add_general_xp(general: AnyGeneral, currency_id: CurrencyId, amount: int, *, timeout: float = 5.0) -> None
Feed a general xp items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
AnyGeneral
|
The general: one of |
required |
currency_id
|
CurrencyId
|
The xp item's |
required |
amount
|
int
|
How many of the item to use |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
unlock_general
¶
Unlock a general with its shards.
The general must be out (not a preview) and you must hold the unlock_cost of its rarity in its
unlock_currency_id shards (PlayerService.currencies). Whether it is already unlocked is
not checked here, as only a gie lists the unlocked generals; the server refuses that.
Client: GeneralsOverviewDialog.updateUnlockButton (bundle line 15833) shows the button, which sends
gue (bundle line 15851), while GeneralVO.canBeUnlocked (bundle line 26751)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
General
|
The general, from |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The game data lacks the general or its rarity, it is a preview, or too few shards are held |
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
upgrade_general_stars
¶
upgrade_general_stars(general: OwnedGeneral, currency: Currency, *, timeout: float = 5.0) -> None
Raise a general's star level with one of its shards.
A star comes at every tenth level: the general's level must be a multiple of 10, above 0, with
fewer stars than its tenths and fewer than its max_star_level. The level is the general's
fixed_level when it has one, else the level its rarity gives its xp. currency must be one of
its upgrade_currency_ids, held (PlayerService.currencies). The client lists any held shard
and does not compare the amount with the cost, GeneralRarityDef.star_upgrade_cost(star_level);
neither does this.
Client: GeneralsLevelUpDialogListItem.onClick (bundle line 74481) sends gsue for an unlocked
general; GeneralVO.isStarLevelUpgradeable (bundle line 26777), whose trailing || !isUnlocked
only switches the dialog to unlocking, and GeneralsLevelUPDialog.updateItems (bundle line 46889)
lists the held upgradeCurrencyIDs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
OwnedGeneral
|
The general, an |
required |
currency
|
Currency
|
The shard to spend |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
The game data lacks the general or its rarity, it has no star to earn, the shard is not one of its own, or none is held |
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
clear_general_flags
¶
Clear a general's new and level-up flags; the next gie lists it without them.
Client: GeneralVO.resetFlags (bundle line 26789), which also clears them on its own copy
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
general
|
General
|
The general, an |
required |
timeout
|
float
|
Timeout in seconds |
5.0
|
get_generals_hub
¶
get_generals_hub(*, timeout: float = 5.0) -> list[GeneralsHubCharacterStatus]
The generals hub's characters: their free spins, and when the next free spin comes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
list[GeneralsHubCharacterStatus]
|
Each character, from the |
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
spin_generals_hub
¶
spin_generals_hub(character: GeneralsHubCharacter, offering: Currency, *, free: bool = False, amount: int = 1, timeout: float = 5.0) -> SpinGeneralsHubResponse
Spin a hub character's tombola with an offering, free or paid.
offering must be one the character takes (GeneralsHubCharacterDef.offering_currency_ids).
A free spin is one spin; a paid one spends amount offerings, which must be held
(PlayerService.currencies). Whether a free spin waits is not checked here
(get_generals_hub says); the server refuses one that does not. Reward ids in the reply are
resolved through the game data.
Client: GeneralsHubQuestComponent.onFreeQuest and onPaidQuest (bundle lines 75148-75149),
GeneralsHubRewardsComponent.onClick (bundle line 74904) and onCurrenciesUpdated (bundle line
74903), which caps the amount at the offerings held
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
character
|
GeneralsHubCharacter
|
The character |
required |
offering
|
Currency
|
The offering to spin with |
required |
free
|
bool
|
Take a free spin |
False
|
amount
|
int
|
Offerings to spend on a paid spin |
1
|
timeout
|
float
|
Timeout in seconds |
5.0
|
Returns:
| Type | Description |
|---|---|
SpinGeneralsHubResponse
|
The draws, and the character's spins after it |
Raises:
| Type | Description |
|---|---|
ValueError
|
The game data lacks the character, it takes no such offering, a free spin is asked for more than one, or fewer offerings are held than spent |
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
The request failed |
commanders.models.auto_sell¶
The auto-sell rules: which new equipment and gems the server sells as they drop.
Commands:
- asg: the rules
- aes: set the equipment rules
- ags: set the gem rules
Classes:
| Name | Description |
|---|---|
AutoSellEquipment |
One kind of equipment the server sells as it drops: a slot and a rarity. |
AutoSellRules |
Which new equipment and gems the server sells as they drop. |
GetAutoSellRequest |
Request the auto-sell rules. |
GetAutoSellResponse |
The auto-sell rules. |
SetAutoSellEquipmentRequest |
Set the equipment the server sells as it drops. |
SetAutoSellGemsRequest |
Set, per gem colour, the level up to which the server sells gems as they drop. |
Attributes:
| Name | Type | Description |
|---|---|---|
AUTO_SELL_SLOTS |
The slots the auto-sell dialog offers: |
|
AUTO_SELL_RARENESSES |
The rarities it offers in each, the hero's too: |
|
MAX_GEM_LEVEL |
The highest gem level a gem rule takes: |
AUTO_SELL_SLOTS
module-attribute
¶
AUTO_SELL_SLOTS = (EquipmentSlot.HERO, EquipmentSlot.HELMET, EquipmentSlot.ARMOR, EquipmentSlot.WEAPON, EquipmentSlot.ARTIFACT)
The slots the auto-sell dialog offers: AutoSellEquipmentsVO.SLOT_ORDER (bundle line 46722).
AUTO_SELL_RARENESSES
module-attribute
¶
The rarities it offers in each, the hero's too: AutoSellEquipmentsVO.RARITY_ORDER (bundle line 46722).
MAX_GEM_LEVEL
module-attribute
¶
The highest gem level a gem rule takes: GemConst.MAX_GEM_LEVEL (dll line 19382).
AutoSellEquipment
pydantic-model
¶
Bases: BasePayload
One kind of equipment the server sells as it drops: a slot and a rarity.
The rarity is the base one for every slot; on the wire a hero item's is in the hero range,
Rareness.HERO_COMMON - 1 above it.
Client: C2SSetAutoSellEquipmentConditionsEventVO (bundle line 73734) and
AutoSellEquipmentsVO.parseASG (bundle line 46681)
Fields:
from_wire
classmethod
¶
from_wire(row: Any) -> AutoSellEquipment | None
An ECS row [slot, rarity]; None for one the dialog has no box for, which the client ignores.
AutoSellRules
pydantic-model
¶
Bases: BasePayload
Which new equipment and gems the server sells as they drop.
gems holds, per gem colour, the level up to which its gems are sold; 0 sells none.
Client: AutoSellVO (bundle line 120130), AutoSellGemsVO (bundle line 120147), whose slider runs
from 0 to GemConst.MAX_GEM_LEVEL (AutoSellDialogGemsItem.init, bundle line 73837)
Fields:
Validators:
GetAutoSellRequest
pydantic-model
¶
Bases: BaseRequest
Request the auto-sell rules.
Command: asg Payload: {}
The client asks only while the auto-sell subscription effect runs.
Client: C2SGetAutoSellConditionsEventVO (bundle line 120114), SubscriptionData.parseSIE
(bundle lines 119994, 120002)
GetAutoSellResponse
pydantic-model
¶
Bases: BaseResponse, AutoSellRules
The auto-sell rules.
Command: asg Payload: {"ECS": [[slot, rarity], ..], "GCS": [[level, gem colour], ..]}
Client: ASGCommand (bundle line 128666), AutoSellVO.parseASG (bundle line 120131)
Fields:
-
equipment(tuple[AutoSellEquipment, ...]) -
gems(dict[EnumOrInt['GemColor'], int]) -
error_code(int)
Validators:
SetAutoSellEquipmentRequest
pydantic-model
¶
Bases: BaseRequest
Set the equipment the server sells as it drops.
Command: aes Payload: {"ECS": [[slot, rarity], ..]}
The server replies with no body.
Client: C2SSetAutoSellEquipmentConditionsEventVO (bundle line 73725), AESCommand (bundle line 128625)
Fields:
-
equipment(tuple[AutoSellEquipment, ...])
equipment
pydantic-field
¶
equipment: tuple[AutoSellEquipment, ...]
Wire key ECS
The kinds of equipment sold; sent as [slot, rarity] rows
SetAutoSellGemsRequest
pydantic-model
¶
Bases: BaseRequest
Set, per gem colour, the level up to which the server sells gems as they drop.
Command: ags Payload: {"GCS": [[level, gem colour], ..]}
The client sends every gem colour. The server replies with no body.
Client: C2SSetAutoSellGemConditionsEventVO (bundle line 120180), AGSCommand (bundle line 128638)
Fields:
commanders.models.equipment¶
Equipment models and equipment inventory commands.
Commands:
- gei: Get Equipment Inventory - the items no commander or castellan wears
- eeq: Equip Equipment - put an item on a commander or castellan, or take it off
- seq: sell an item
- sge: sell a gem or relic gem
- bge: set a gem in a worn item
Classes:
| Name | Description |
|---|---|
EquipmentBonus |
One bonus of an item that is not a relic: |
RelicBonus |
One bonus of a relic item: |
RelicGem |
The gem set in a relic item: |
RelicInfo |
What a relic item carries at index 12: |
Equipment |
An equipment item worn by a commander or castellan. |
GetEquipmentInventoryRequest |
Request the player's equipment inventory. |
GetEquipmentInventoryResponse |
The player's equipment inventory. |
EquipEquipmentRequest |
Put an item on a commander or castellan ( |
SellEquipmentRequest |
Sell an item for coins. |
SellGemRequest |
Sell a gem or relic gem for coins. |
BindGemRequest |
Set a gem or relic gem in an item a commander or castellan wears. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
|
NO_GEM_ID |
|
EquipmentBonus
pydantic-model
¶
Bases: BasePayload
One bonus of an item that is not a relic: [effect_id, values].
Client: BasicEquipmentVO.parseBonuses (bundle line 7135), which wraps a
value that is not an array into one; EquipmentXml.getEquippableEffectByEquipmentEffect
(bundle line 144242) reads the id as an equipment effect, and as a plain effect when no
equipment effect has it.
Fields:
Validators:
-
_from_row
RelicBonus
pydantic-model
¶
Bases: BasePayload
One bonus of a relic item: [relic_effect_id, power, values].
Client: RelicItemInfoVO.parseRelicBoni (bundle line 33743),
RelicBonusVO.parseRelicFromValueArray (bundle line 45132), which looks the
id up in the relic effect table and parses row[2].toString(), so a value
and a one-value array read the same.
Fields:
Validators:
-
_from_row
RelicGem
pydantic-model
¶
Bases: BasePayload
The gem set in a relic item: [gem_id, relic_type_id, relic_category_id, might, bonuses, enchantment_level].
Client: RelicGemVO.parseServerObject (bundle line 22222)
Fields:
-
gem_id(int) -
relic_type_id(int) -
relic_category_id(int) -
might(int | float) -
bonuses(list[RelicBonus]) -
enchantment_level(ClientInt)
Validators:
-
_from_row
RelicInfo
pydantic-model
¶
Bases: BasePayload
What a relic item carries at index 12: [relic_type_id, relic_category_id, might, gem].
Client: RelicEquipmentVO.parseEquipFromArray (bundle line 25039)
Fields:
-
relic_type_id(int) -
relic_category_id(int) -
might(int | float) -
gem(RelicGem | None)
Validators:
-
_from_row -
_gem_or_none→gem
Equipment
pydantic-model
¶
Bases: BasePayload
An equipment item worn by a commander or castellan.
Parsed from a positional EQ entry: [id, slot, wearer, rarity, graphic, bonuses, unique_id, set_id, enchantment_level, duration_seconds, gem_id, equipment_type] Entries are truncated by the server when trailing fields do not apply.
Index 5 holds the bonuses: a relic item (index 11 is 3) lists them as
relic_bonuses ([relic_effect_id, power, values]), any other item as
bonuses ([effect_id, values]). A hero item (slot 6, not a relic)
also keeps index 11 as alien_string, which the client matches against the
unique heroes (CastleEquipmentData.getUniqueHerosByAlienString, bundle
line 143843); the type is still read from it through int().
Client: BasicEquipmentVO.parseEquipFromArray (bundle line 7115),
CastleEquipmentFactory.createEquipmentVO (bundle line 18134),
RelicEquipmentVO.parseEquipFromArray (bundle line 25039),
CastleHeroVO.parseEquipFromArray (bundle line 40585),
BasicEquipmentVO.hasSetbonus (bundle line 7213).
Fields:
-
equipment_id(int) -
slot(int) -
wearer_type(int) -
rarity_id(ClientInt) -
graphic(int | str) -
bonuses(list[EquipmentBonus]) -
relic_bonuses(list[RelicBonus]) -
unique_id(ClientInt) -
set_id(ClientInt) -
enchantment_level(ClientInt) -
duration_seconds(int | float) -
gem_id(EnumOrInt['Gem'] | None) -
equipment_type(ClientInt) -
relic_info(RelicInfo | None) -
alien_string(str | None)
Validators:
-
_relic_info_or_none→relic_info -
_gem→gem_id -
_alien_text→alien_string -
_from_row
set_id
pydantic-field
¶
set_id: ClientInt = 0
Equipment set id, -1 for none; 0, which no set uses, when the row has none
duration_seconds
pydantic-field
¶
Seconds until the item expires; below 1 it is permanent
equipment_type
pydantic-field
¶
equipment_type: ClientInt = EquipmentType.GENERATED
EquipmentType value
relic_info
pydantic-field
¶
relic_info: RelicInfo | None = None
A relic item's type, category, might and gem; None for other items
alien_string
pydantic-field
¶
alien_string: str | None = None
A hero item's alien string, "effect_id&value" pairs joined by ","; None for other items. A number the server sends there is kept as its text
is_permanent
property
¶
is_permanent: bool
True when the item does not expire (the server sends -1).
is_relic
property
¶
is_relic: bool
True for a relic item, whose bonuses index the relic effect table.
GetEquipmentInventoryRequest
pydantic-model
¶
Bases: BaseRequest
Request the player's equipment inventory.
Command: gei
Payload: {}
Client: C2SGetEquipmentInventory (bundle line 19854)
GetEquipmentInventoryResponse
pydantic-model
¶
Bases: BaseResponse
The player's equipment inventory.
Command: gei
Payload: {"I": [EQ entry, ...]}, each entry laid out as a gli EQ entry.
Client: CastleEquipmentData.parse_GEI (bundle line 143731), which builds every
entry with CastleEquipmentFactory.createEquipmentVO (bundle line 18134).
Fields:
-
error_code(int) -
items(list[Equipment])
Validators:
-
_readable_items→items
EquipEquipmentRequest
pydantic-model
¶
Bases: BaseRequest
Put an item on a commander or castellan (equip=1), or take it off (equip=0).
Moving an item between two leaders takes two requests: the client takes it off the first, then puts it on the second. The reply has no body.
Command: eeq
Payload: {"EID": equipment_id, "LID": commander_id, "E": 0 or 1}
Client: C2SEquipEquipmentVO (bundle line 143914) sends E as int(n?1:0);
CastleEquipmentData.startDrag (bundle line 143801) sends 0 when an item is
lifted off a leader's slot, stopDrag (bundle line 143807) sends 1 when it is
dropped on one, and EquipmentEquipmentClickHandler.init (bundle line 65626)
handles the 0 reply as an unequip.
Fields:
-
equipment_id(int) -
commander_id(int) -
equip(int)
Validators:
-
_as_flag→equip
equipment_id
pydantic-field
¶
equipment_id: int
Wire key EID
Equipment.equipment_id: of an inventory item from client.equipment.get_inventory() to equip, of a worn one from client.commanders.get_all() to take off
SellEquipmentRequest
pydantic-model
¶
Bases: BaseRequest
Sell an item for coins.
Command: seq Payload: {"EID": equipment_id, "LID": commander_id, "EX": 0, "LFID": lost_and_found_id}
LID is -1 but for a relic sold straight off the commander who wears it, LFID -1 but for an
item in the lost and found; EX is 0, the client never sets it. The reply's gli, gcu and
esl update the commanders, coins and inventory space in client.state.
Client: C2SSellEquipmentVO (bundle line 143923), CastleEquipmentData.sell (bundle line 143798);
RelicUpgradeDialogStatus.confirmSellCallback (bundle line 36757) passes the commander,
LostAndFoundListItem (bundle line 107164) the lost and found id; SEQCommand (bundle line 124024)
Fields:
-
equipment_id(int) -
commander_id(int) -
extract(int) -
lost_and_found_id(int)
SellGemRequest
pydantic-model
¶
Bases: BaseRequest
Sell a gem or relic gem for coins.
Command: sge Payload: {"GID": gem_id, "RGEM": 1 or 0, "LFID": lost_and_found_id}
The server replies with no body.
Client: C2SSellGemVO (bundle line 144479), CastleGemData.sell (bundle line 144376), which sends
RGEM 1 for a RelicGemVO; SGECommand (bundle line 124034)
Fields:
BindGemRequest
pydantic-model
¶
Bases: BaseRequest
Set a gem or relic gem in an item a commander or castellan wears.
Command: bge Payload: {"GID": gem_id, "EID": equipment_id, "LID": commander_id, "M": 0, "RGEM": 1 or 0}
M 1 takes the gem already set back into the inventory, for rubies or relic fragments
(CastleReplaceSocketDialog.getRemovalCosts, bundle line 42226), and is not sent here. The server
replies with no body.
Client: C2SBindGem (bundle line 144452), CastleGemData.bindGem (bundle line 144353);
BGECommand (bundle line 123713)
Fields:
-
gem_id(int) -
equipment_id(int) -
commander_id(int) -
keep_old_gem(int) -
relic_gem(bool)
commanders.models.generals¶
Generals progression: unlocking a general, raising its stars, and the generals hub's spins.
Commands:
- gue: unlock a general with its shards
- gsue: raise a general's star level with shards
- grf: clear a general's new and level-up flags
- gcs: the generals hub's characters, their free spins and cooldowns
- sct: spin a hub character's tombola with an offering
Classes:
| Name | Description |
|---|---|
UnlockGeneralRequest |
Unlock a general with its shards. |
UpgradeGeneralStarsRequest |
Raise a general's star level with one of its shards. |
ClearGeneralFlagsRequest |
Clear a general's new and level-up flags. |
GetGeneralsHubRequest |
Request the generals hub's characters. |
GeneralsHubCharacterStatus |
One character of the generals hub: its free spins and when the last was taken. |
GetGeneralsHubResponse |
The generals hub's characters. |
SpinGeneralsHubRequest |
Spin a hub character's tombola with an offering. |
GeneralsHubReward |
One draw of a spin: rows of collectables ( |
SpinGeneralsHubResponse |
What a spin gave, and the character's spins after it. |
UnlockGeneralRequest
pydantic-model
¶
Bases: BaseRequest
Unlock a general with its shards.
Command: gue Payload: {"GID": general_id}
The server replies with no body.
Client: C2SGeneralUnlockVO (bundle line 41682), GUECommand (bundle line 124266)
Fields:
-
general_id(EnumOrInt['General'])
UpgradeGeneralStarsRequest
pydantic-model
¶
Bases: BaseRequest
Raise a general's star level with one of its shards.
Command: gsue Payload: {"GID": general_id, "CID": currency_id}
The server replies with no body.
Client: C2SGeneralStarUpgradeVO (bundle line 74516), GSUECommand (bundle line 124253)
Fields:
-
general_id(EnumOrInt['General']) -
currency_id(EnumOrInt['CurrencyId'])
ClearGeneralFlagsRequest
pydantic-model
¶
Bases: BaseRequest
Clear a general's new and level-up flags.
Command: grf Payload: {"GID": general_id}
The server replies with no body.
Client: C2SGeneralResetFlagsVO (bundle line 67451), GRFCommand (bundle line 124229)
Fields:
-
general_id(EnumOrInt['General'])
GetGeneralsHubRequest
pydantic-model
¶
Bases: BaseRequest
Request the generals hub's characters.
Command: gcs Payload: {}
Client: C2SGeneralsHUBStatusVO (bundle line 113160, no fields)
GeneralsHubCharacterStatus
pydantic-model
¶
Bases: BasePayload
One character of the generals hub: its free spins and when the last was taken.
Client: GeneralsHubQuestVO.parseServerObject (bundle line 47009)
Fields:
-
character_id(EnumOrInt['GeneralsHubCharacter']) -
free_spins(ClientInt) -
last_free_spin(ClientNumber) -
cooldown_ends_at(int | float | None)
character_id
pydantic-field
¶
character_id: EnumOrInt['GeneralsHubCharacter']
Wire key CID
The character
last_free_spin
pydantic-field
¶
last_free_spin: ClientNumber = 0
Wire key LFO
When the last free spin was taken, in epoch seconds
GetGeneralsHubResponse
pydantic-model
¶
Bases: BaseResponse
The generals hub's characters.
Command: gcs Payload: {"CHR": [{"CID": character, "FOA": free spins, "LFO": last free spin}, ..]}
Client: GCSCommand (bundle line 124187), GeneralsData.parse_GCS (bundle line 113080)
Fields:
Validators:
-
_readable→characters
characters
pydantic-field
¶
characters: list[GeneralsHubCharacterStatus]
Wire key CHR
Each character's spins
SpinGeneralsHubRequest
pydantic-model
¶
Bases: BaseRequest
Spin a hub character's tombola with an offering.
Command: sct Payload: {"CID": character, "OID": offering, "IF": 1 or 0, "AMT": amount}
A free spin is one, sent with IF 1; a paid one spends AMT of the offering.
Client: C2SSpinCharacterTombolaVO (bundle line 46994), GeneralsHubQuestComponent.onFreeQuest and
onPaidQuest (bundle lines 75148-75149), GeneralsHubRewardsComponent.onClick (bundle line 74904)
Fields:
-
character_id(EnumOrInt['GeneralsHubCharacter']) -
offering_id(EnumOrInt['CurrencyId']) -
free(bool) -
amount(int)
GeneralsHubReward
pydantic-model
¶
Bases: BasePayload
One draw of a spin: rows of collectables (RR) or reward ids (RW), given count times.
client.commanders.spin_generals_hub resolves reward ids into rewards through the game data.
Client: GeneralsHubRewardsComponent.onRewardsGained (bundle line 74934) reads RR over RW and
adds the list A times, once when A is unset
Fields:
-
rarity(ClientInt) -
rewards(tuple[Collectable, ...]) -
reward_ids(tuple[RewardId, ...]) -
count(int)
Validators:
-
_rows→rewards -
_ids→reward_ids -
_count→count -
_rows_over_ids
SpinGeneralsHubResponse
pydantic-model
¶
Bases: BaseResponse
What a spin gave, and the character's spins after it.
Command: sct Payload: {"CH": {"CID": .., "FOA": .., "LFO": ..}, "LTR": [{"R": rarity, "RR": rows | "RW": ids, "A": count}, ..]}
Client: SCTCommand (bundle line 124303), GeneralsData.parse_SCT (bundle line 113073)
Fields:
Validators:
-
_readable→rewards
character
pydantic-field
¶
character: GeneralsHubCharacterStatus
Wire key CH
The character after the spin
commanders.models.inventory¶
The equipment and gem inventory, as the login data and its pushes send it.
Commands:
- ggm: the gems and relic gems you hold (gec: a change to the gems)
- esl: the equipment and gem inventory space
- nrf: whether new relics wait to be seen
Classes:
| Name | Description |
|---|---|
GemStack |
How many of one gem you hold. |
GetGemsRequest |
Ask for the gems and relic gems in your inventory. |
GemInventoryResponse |
The gems and relic gems in your inventory, not set in any equipment. |
GetInventorySpaceRequest |
Ask for the equipment and gem inventory space. |
InventorySpace |
Free and total space in the equipment and gem inventory. |
NewRelicsResponse |
Whether new relic equipment waits to be seen. |
GemStack
pydantic-model
¶
GemChange
pydantic-model
¶
Bases: BasePayload
One [gem_id, amount] row of a gec: gems added, or taken away for a negative amount.
Fields:
Validators:
-
_from_row
GemsChangedResponse
pydantic-model
¶
Bases: BaseResponse
Gems added to or taken from your inventory.
Command: gec, a push.
Client: GECCommand.executeCommand (bundle line 123969), CastleGemData.parse_GEC (bundle line
144432) and updateInventory (bundle line 144440), which read each row's id and amount through
int(); a row that is no pair is skipped here
Fields:
-
error_code(int) -
changes(tuple[GemChange, ...])
GetGemsRequest
pydantic-model
¶
Bases: BaseRequest
Ask for the gems and relic gems in your inventory.
Command: ggm Payload: {}
Client: C2SGetGemInventory (bundle line 22746), sent when the equipment screen updates
(CastleEquipmentSublayer.updateEquipmentData, bundle line 25717)
GemInventoryResponse
pydantic-model
¶
Bases: BaseResponse
The gems and relic gems in your inventory, not set in any equipment.
Command: ggm, as a login section of gbd and a reply. A gec push changes the gems;
client.state.get_gems() applies it with changed.
Client: GGMCommand (bundle line 123957), CastleGemData.parseGGM, updateInventory and
updateRelicInventory (bundle lines 144327, 144334, 144427); GECCommand (bundle line 123969) and
parse_GEC (bundle line 144432). The client keeps one entry per gem and takes a negative amount
off from the first entry of that gem on; here the gems are counted per id.
Fields:
-
error_code(int) -
gems(tuple[GemStack, ...]) -
relic_gems(tuple[RelicGem, ...])
Validators:
-
_gems→gems
relic_gems
pydantic-field
¶
Wire key RGEM
The relic gems you hold
changed
¶
changed(change: GemsChangedResponse) -> GemInventoryResponse
This inventory after a gec: each change adds its amount, a negative one takes away.
GetInventorySpaceRequest
pydantic-model
¶
Bases: BaseRequest
Ask for the equipment and gem inventory space.
Command: esl Payload: {}
The reply is read into client.state: its E is the equipment space, not an error code.
Client: C2SEquipmentSpaceLeftVO (bundle line 41423), sent by AMerchantBuyDialog.onInventorySpaceData
(bundle line 41333)
InventorySpace
pydantic-model
¶
Bases: BasePayload
Free and total space in the equipment and gem inventory.
Not a response model: its E is the equipment space, not an error code.
Command: esl, as a login section of gbd, a push and a reply, and inside the bgm, ceq,
cge, frc and seq replies.
Client: ESLCommand (bundle line 123895), CastleEquipmentData.parse_ESL (bundle line 143746) and
CastleGemData.parse_ESL (bundle line 144410). The client recounts the free gem space from the total
and the gems it holds whenever they change (updateInventorySpace, bundle line 144417); gem_space
is the value the server sent. The equipment inventory counts as full at equipment_space 0 or
less, and holds equipment_total_space - equipment_space items (isInventoryFull and
filledInventorySpace, bundle lines 143839, 143841).
Fields:
NewRelicsResponse
pydantic-model
¶
Bases: BaseResponse
Whether new relic equipment waits to be seen.
Command: nrf, as a login section of gbd and a push.
Client: NRFCommand (bundle line 124002), CastleEquipmentData.parseNRF (bundle line 143756)
Fields:
Validators:
-
_flag→has_new_relics
commanders.models.roster¶
Commander protocol models.
Commands:
- gli: Get Lords Info - the server name for the commander/castellan list
- arl: rename a commander or castellan
Classes:
| Name | Description |
|---|---|
CommanderEffect |
One entry of a commander's |
SelectedAbility |
One ability slot of a general: a |
AlienEquipment |
Alien ( |
LeaderBase |
Fields shared by every gli entry. |
Commander |
A commander - the leader assigned to an attack or support movement. |
Castellan |
A castellan - the defensive counterpart of a commander ( |
GetCommandersRequest |
Request the commander and castellan list. |
CommanderRoster |
A player's commanders and castellans, the |
GetCommandersResponse |
Response containing commanders (C) and castellans (B). |
RenameCommanderRequest |
Rename a commander or castellan. |
RenameCommanderResponse |
Reply to a rename: the full commander and castellan list. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
|
CommanderEffects |
|
|
PICTURE_BERIMOND_CASTELLAN |
|
|
PICTURE_STORM_ISLANDS_CASTELLAN |
|
|
BERIMOND_BARON_ID |
|
|
PREMIUM_COMMANDER_ID |
|
|
CASTELLAN_PICTURE_ORDER |
|
CommanderEffects
module-attribute
¶
CommanderEffects = Annotated[list[CommanderEffect], BeforeValidator(partial(readable_list, CommanderEffect))]
[effect_id, values, source] rows; unreadable entries are skipped, as the client skips
effects it cannot resolve (LordVO.parseRawEffects, bundle line 26483).
PICTURE_BERIMOND_CASTELLAN
module-attribute
¶
EquipmentConst.PICK_BARON_FACTION (dll line 19249)
PICTURE_STORM_ISLANDS_CASTELLAN
module-attribute
¶
EquipmentConst.PICK_BARON_ISLAND (dll line 19249)
PREMIUM_COMMANDER_ID
module-attribute
¶
TravelConst.COMMANDER_PREMIUM (dll line 19872): the premium commander's commander_id;
the client offers it from ClientConstLevelRestrictions.MIN_LEVEL_SELECT_PREMIUM_COMMANDER, level 10
(bundle line 2139)
CASTELLAN_PICTURE_ORDER
module-attribute
¶
BaronVO.PIC_ID_ORDER (bundle line 43551): castellans are listed in this portrait order
CommanderEffect
pydantic-model
¶
Bases: BasePayload
One entry of a commander's E or AE: [effect_id, values, source].
Client: LordVO.parseRawEffects (bundle line 26483), BonusVO.parseFromValueArray
(bundle line 5707).
Fields:
Validators:
-
_source_key→source -
_from_row
SelectedAbility
pydantic-model
¶
Bases: BasePayload
One ability slot of a general: a [slot_id, ability_id] pair, as GASAIDS sends it and SAIDS takes it.
It serializes back to the pair, with -1 for an empty slot.
Client: GeneralVO.parseData (bundle line 26666) keeps the pairs, and
GeneralVO.getSelectedAbilities (bundle lines 26769-26771) reads [0] as the
slot and [1] as the ability, counting it only above 0; GeneralsAbilityDialog.onSave
(bundle line 27850) sends -1 for a cleared slot.
Fields:
-
slot_id(int) -
ability_id(EnumOrInt['GeneralAbility'] | None)
Validators:
-
_from_row -
_empty_slot→ability_id
AlienEquipment
pydantic-model
¶
Bases: BasePayload
Alien (AIE) or temporary (TAE) equipment: [effect_id, values] rows, or
[hero_rows, equipment_rows] when it carries a hero.
The block is split in two when it has two entries that are each empty or start with an array; otherwise every row is an equipment bonus.
Client: LordVO.parseLord (bundle lines 26471-26477), AlienLordHeroVO.parseAlienBoniData
(bundle line 67502), AlienLordEquipmentVO.parseAlienBoniData (bundle line 67479)
Fields:
-
hero_bonuses(tuple[EquipmentBonus, ...]) -
bonuses(tuple[EquipmentBonus, ...])
Validators:
-
_split -
_rows→hero_bonuses,bonuses
LeaderBase
pydantic-model
¶
Bases: BasePayload
Fields shared by every gli entry.
The wire protocol calls both kinds "lords" (command gli, field LID
on movement commands); the game UI says commander and castellan.
AIE (alien) or TAE (temporary) equipment stands in for EQ: the
client reads the first of them that is present, and only when EQ is
empty. See alien_bonuses.
A spied castellan is built without any of it: LordFactory.createLord(e, true, true)
(bundle line 26448) makes LordVO.parseLord (bundle line 26500) skip EQ, AIE and
TAE, and takes a default commander from the lords table copy that has no effects
(CastleLordData.getDefaultLordWithoutEquipmentByID, bundle line 38629). The attack
pre-calculation, the treasure node pre-calculation, the spy report and the support defense
info build theirs that way, so E and AE carry all they grant; see without_equipment.
Client: LordFactory.createLord (bundle line 26448), LordVO.parseLord (bundle line 26500),
LordVO.parseGeneral (bundle line 26529) and GeneralVO.parseData (bundle line 26715) for
ST, L and the general's XP, OXP, IN, LU, SIDS and GASAIDS. The
client reads those six only when the entry names a general above 0 and is a default commander
or was created with LordFactory.createLord(e, true), as a battle log's are. An entry cannot
tell the second case, so they are None unless sent, or filled with the client's defaults for a
default commander with a general; elsewhere the client ignores them.
Fields:
-
commander_id(int) -
wearer_id(ClientInt | None) -
picture_id(ClientInt) -
name(str) -
wins(ClientInt) -
defeats(ClientInt) -
win_spree(ClientInt) -
effects(CommanderEffects) -
area_effects(CommanderEffects) -
equipment(list[Equipment]) -
alien_equipment(AlienEquipment | None) -
temporary_equipment(AlienEquipment | None) -
alien_gem_ids(tuple[EnumOrInt['Gem'], ...]) -
without_equipment(bool) -
general_id(Annotated[Literal[-1, 0] | EnumOrInt['General'], Field(union_mode='left_to_right'), BeforeValidator(js_int)] | None) -
star_level(ClientInt) -
level(ClientInt) -
general_xp(ClientInt | None) -
general_old_xp(ClientInt | None) -
general_is_new(bool | None) -
general_has_level_up(bool | None) -
general_skill_ids(tuple[EnumOrInt['GeneralSkill'], ...] | None) -
general_selected_abilities(tuple[SelectedAbility, ...] | None)
Validators:
-
_xp_or_zero→general_xp,general_old_xp -
_one_flag→general_is_new,general_has_level_up -
_skill_list→general_skill_ids -
_readable_slots→general_selected_abilities -
_default_commander_general -
_id_as_the_client_reads_it -
_alien_block→alien_equipment,temporary_equipment -
_gem_list→alien_gem_ids -
_note_raw_equipment -
_readable_equipment→equipment
commander_id
pydantic-field
¶
commander_id: int
Wire key ID
Commander id; for a default commander, its default-commander id
wearer_id
pydantic-field
¶
wearer_id: ClientInt | None = None
Wire key WID
2 for a commander, 1 for a castellan
alien_equipment
pydantic-field
¶
alien_equipment: AlienEquipment | None = None
Wire key AIE
Alien equipment; applies when equipment is empty
temporary_equipment
pydantic-field
¶
temporary_equipment: AlienEquipment | None = None
Wire key TAE
Temporary equipment; applies when equipment is empty and alien_equipment absent
alien_gem_ids
pydantic-field
¶
Wire key GEM
The gems added to the alien or temporary equipment
without_equipment
pydantic-field
¶
without_equipment: bool = False
Built as the client builds a spied castellan, with no item, alien equipment, gem, set or lords-table effect counted; the payload that carries the entry sets it
general_id
pydantic-field
¶
general_id: Annotated[Literal[-1, 0] | EnumOrInt['General'], Field(union_mode='left_to_right'), BeforeValidator(js_int)] | None = None
Wire key GID
The assigned general; -1, 0 or None for none
star_level
pydantic-field
¶
star_level: ClientInt = 0
Wire key ST
The general's star level when the entry doubles as its general: a default commander with a general_id above 0
level
pydantic-field
¶
level: ClientInt = 0
Wire key L
The general's level when the entry doubles as its general: a default commander with a general_id above 0
general_xp
pydantic-field
¶
general_xp: ClientInt | None = None
Wire key XP
The general's experience; None when the entry does not carry it
general_old_xp
pydantic-field
¶
general_old_xp: ClientInt | None = None
Wire key OXP
The general's experience before the battle; None when the entry does not carry it
general_is_new
pydantic-field
¶
general_is_new: bool | None = None
Wire key IN
The general is newly unlocked; None when the entry does not say
general_has_level_up
pydantic-field
¶
general_has_level_up: bool | None = None
Wire key LU
The general gained a level; None when the entry does not say
general_skill_ids
pydantic-field
¶
Wire key SIDS
The general's unlocked skills; None when the entry has none
general_selected_abilities
pydantic-field
¶
general_selected_abilities: tuple[SelectedAbility, ...] | None = None
Wire key GASAIDS
The general's ability slots, filled or empty; None when the entry has none
uses_alien_equipment
property
¶
uses_alien_equipment: bool
Whether AIE/TAE stand in for an empty EQ, as LordVO.parseLord decides.
active_alien_equipment
property
¶
active_alien_equipment: AlienEquipment | None
The alien or temporary equipment standing in for an empty EQ, None when none does.
alien_hero_bonuses
property
¶
alien_hero_bonuses: list[EquipmentBonus]
The hero bonuses of the active alien or temporary equipment.
alien_bonuses
property
¶
alien_bonuses: list[EquipmentBonus]
The equipment bonuses of the active alien or temporary equipment, empty when EQ has items.
worn_items
¶
The items the client puts in the commander's slots, in slot order.
LordVO.parseLord (bundle line 26451) creates the helmet, armor, weapon,
artifact, skin and hero slots in that order and puts each EQ item in
its slot by row[1], so a later item replaces an earlier one and an item
for any other slot is not worn.
Commander
pydantic-model
¶
Bases: LeaderBase
A commander - the leader assigned to an attack or support movement.
Client: CommanderVO, built by LordFactory.createLord (bundle line 26399)
Fields:
-
commander_id(int) -
wearer_id(ClientInt | None) -
picture_id(ClientInt) -
name(str) -
wins(ClientInt) -
defeats(ClientInt) -
win_spree(ClientInt) -
effects(CommanderEffects) -
area_effects(CommanderEffects) -
equipment(list[Equipment]) -
alien_equipment(AlienEquipment | None) -
temporary_equipment(AlienEquipment | None) -
alien_gem_ids(tuple[EnumOrInt['Gem'], ...]) -
without_equipment(bool) -
general_id(Annotated[Literal[-1, 0] | EnumOrInt['General'], Field(union_mode='left_to_right'), BeforeValidator(js_int)] | None) -
star_level(ClientInt) -
level(ClientInt) -
general_xp(ClientInt | None) -
general_old_xp(ClientInt | None) -
general_is_new(bool | None) -
general_has_level_up(bool | None) -
general_skill_ids(tuple[EnumOrInt['GeneralSkill'], ...] | None) -
general_selected_abilities(tuple[SelectedAbility, ...] | None)
Validators:
-
_xp_or_zero→general_xp,general_old_xp -
_one_flag→general_is_new,general_has_level_up -
_skill_list→general_skill_ids -
_readable_slots→general_selected_abilities -
_default_commander_general -
_id_as_the_client_reads_it -
_alien_block→alien_equipment,temporary_equipment -
_gem_list→alien_gem_ids -
_note_raw_equipment -
_readable_equipment→equipment
Castellan
pydantic-model
¶
Bases: LeaderBase
A castellan - the defensive counterpart of a commander (BaronVO).
Client: BaronVO.parseLord (bundle line 43534)
Fields:
-
commander_id(int) -
wearer_id(ClientInt | None) -
picture_id(ClientInt) -
name(str) -
wins(ClientInt) -
defeats(ClientInt) -
win_spree(ClientInt) -
effects(CommanderEffects) -
area_effects(CommanderEffects) -
equipment(list[Equipment]) -
alien_equipment(AlienEquipment | None) -
temporary_equipment(AlienEquipment | None) -
alien_gem_ids(tuple[EnumOrInt['Gem'], ...]) -
without_equipment(bool) -
general_id(Annotated[Literal[-1, 0] | EnumOrInt['General'], Field(union_mode='left_to_right'), BeforeValidator(js_int)] | None) -
star_level(ClientInt) -
level(ClientInt) -
general_xp(ClientInt | None) -
general_old_xp(ClientInt | None) -
general_is_new(bool | None) -
general_has_level_up(bool | None) -
general_skill_ids(tuple[EnumOrInt['GeneralSkill'], ...] | None) -
general_selected_abilities(tuple[SelectedAbility, ...] | None) -
locked_in_castle_id(ClientInt)
Validators:
-
_xp_or_zero→general_xp,general_old_xp -
_one_flag→general_is_new,general_has_level_up -
_skill_list→general_skill_ids -
_readable_slots→general_selected_abilities -
_default_commander_general -
_id_as_the_client_reads_it -
_alien_block→alien_equipment,temporary_equipment -
_gem_list→alien_gem_ids -
_note_raw_equipment -
_readable_equipment→equipment
locked_in_castle_id
pydantic-field
¶
locked_in_castle_id: ClientInt = 0
Wire key LICID
Castle the castellan is locked in, -1 for none; 0 when the entry has none
is_locked_in_castle
property
¶
is_locked_in_castle: bool
True when locked_in_castle_id is 0 or more.
is_available_for_movement
¶
Whether the client offers this castellan for a movement in kingdom_id.
Not when it is locked in a castle. A faction-portrait castellan (VIS 5) is
compared with FactionConst.BARON_ID (-16), not a kingdom id, so it is never
available in a real kingdom; an island-portrait one (VIS 13) only in the
storm islands (4). The client also refuses a castellan that already leads one of
the player's movements, which this model cannot see.
Client: BaronVO.isAvailableForMovement (bundle line 43535),
LordVO.isAvailableForMovement (bundle line 26607)
GetCommandersRequest
pydantic-model
¶
Bases: BaseRequest
Request the commander and castellan list.
Command: gli Payload: {}
Client: C2SGetLordsInfoVO (bundle line 32779, no fields)
CommanderRoster
pydantic-model
¶
Bases: BasePayload
A player's commanders and castellans, the gli block.
The lists are in the client's order: commanders by commander_id, castellans
by their portrait's place in CASTELLAN_PICTURE_ORDER, an unlisted portrait first.
Client: CastleLordData.parse_GLI (bundle line 38553), onSortLord and onSortBaron
(bundle lines 38572-38573), BaronVO.parseLord (bundle line 43534)
Fields:
Validators:
-
_no_block -
_readable_entries→commanders,castellans -
_client_order
GetCommandersResponse
pydantic-model
¶
Bases: BaseResponse, CommanderRoster
Response containing commanders (C) and castellans (B).
Command: gli
Client: GLICommand.executeCommand (bundle line 123976) hands it to
CastleLordData.parse_GLI
Fields:
-
commanders(list[Commander]) -
castellans(list[Castellan]) -
error_code(int)
Validators:
-
_no_block -
_readable_entries→commanders,castellans -
_client_order
RenameCommanderRequest
pydantic-model
¶
Bases: BaseRequest
Rename a commander or castellan.
Command: arl Payload: {"LID": commander_id, "N": name}
The game's dialog allows 3 to 15 characters (EquipmentConst.LORD_NAME_MIN_LENGTH
and LORD_NAME_MAX_LENGTH, dll line 19249); the server's own rules were not traced.
Client: C2SRenameLordVO (bundle line 65748), sent by CastleRenameLordDialog.sendCommand
(bundle line 65738)
Fields:
-
commander_id(int) -
name(str)
RenameCommanderResponse
pydantic-model
¶
Bases: BaseResponse
Reply to a rename: the full commander and castellan list.
Command: arl
Client: ARLCommand.executeCommand (bundle line 123657), which passes gli to
CastleLordData.parse_GLI
Fields:
commander_roster
pydantic-field
¶
commander_roster: CommanderRoster
Wire key gli
Commanders and castellans after the rename
commanders.models.skills¶
Generals and Legendary skills: the two attacker-side inputs that size a wave.
A general's unlocked skills widen the flanks; the player's Legendary skills widen them further and add waves, but only in a legendary fight. Both are read with their own command and neither arrives with the commander list.
Classes:
| Name | Description |
|---|---|
SelectedAbility |
One ability slot of a general: a |
GetGeneralsRequest |
Request every general the player owns. |
OwnedGeneral |
One general, as |
AssignGeneralRequest |
Assign a general to a commander, or take the commander's general away. |
AssignGeneralResponse |
Reply to a general assignment: the full commander list. |
SetGeneralAbilitiesRequest |
Choose a general's abilities, one per slot. |
UnlockGeneralSkillRequest |
Unlock a general skill. The skill id names the general, so none is sent. |
ResetGeneralSkillsRequest |
Reset a general's skill tree. |
AddGeneralXpRequest |
Feed a general xp items. |
GetGeneralsResponse |
Response listing the player's generals. |
GetSkillsRequest |
Request the player's own skill lists. |
ActivatingSceatSkill |
A Hall of Legends sceat skill still being activated, an entry of |
SkillList |
The player's Legendary and sceat skills, the |
GetSkillsResponse |
Response listing the player's Legendary and sceat skills. |
AddSkillPointRequest |
Buy a Legendary skill level with skill points. |
AddSkillPointResponse |
The Legendary skill levels bought. |
BuySceatSkillRequest |
Buy a sceat skill level with sceat tokens or imperial ducats. |
BuySceatSkillResponse |
The acknowledgement of a |
SkipSceatSkillActivationRequest |
Finish the activation of the sceat skill being activated in one Hall of Legends tab, for rubies. |
SkipSceatSkillActivationResponse |
The acknowledgement of an |
ResetSkillsRequest |
Take back every Legendary skill point. |
ResetSkillsResponse |
The acknowledgement of an |
ObjectUpdateEvent |
An object update pushed by the server. |
SelectedAbility
pydantic-model
¶
Bases: BasePayload
One ability slot of a general: a [slot_id, ability_id] pair, as GASAIDS sends it and SAIDS takes it.
It serializes back to the pair, with -1 for an empty slot.
Client: GeneralVO.parseData (bundle line 26666) keeps the pairs, and
GeneralVO.getSelectedAbilities (bundle lines 26769-26771) reads [0] as the
slot and [1] as the ability, counting it only above 0; GeneralsAbilityDialog.onSave
(bundle line 27850) sends -1 for a cleared slot.
Fields:
-
slot_id(int) -
ability_id(EnumOrInt['GeneralAbility'] | None)
Validators:
-
_from_row -
_empty_slot→ability_id
GetGeneralsRequest
pydantic-model
¶
Bases: BaseRequest
Request every general the player owns.
Command: gie Payload: {}
Client: C2SGetGeneralsInfoVO (bundle line 56405, no fields)
OwnedGeneral
pydantic-model
¶
Bases: BasePayload
One general, as GeneralVO.parseData reads it.
skill_ids is the useful part: the skills it has unlocked, which is what
the attack dialog accumulates for the flank and front unit bonuses.
Client: GeneralVO.parseData (bundle line 26666)
Fields:
-
general_id(Literal[-1] | EnumOrInt['General']) -
experience(int) -
star_level(int) -
is_new(bool) -
has_level_up(bool) -
skill_ids(tuple[EnumOrInt['GeneralSkill'], ...]) -
selected_abilities(list[SelectedAbility]) -
fixed_level(int) -
old_experience(int) -
wins(int) -
defeats(int)
Validators:
-
_skill_ids→skill_ids -
_zero_when_missing→experience,old_experience,wins,defeats,star_level -
_no_fixed_level→fixed_level -
_one_flag→is_new,has_level_up -
_skip_malformed_slots→selected_abilities -
_star_level_from_fixed_level
star_level
pydantic-field
¶
star_level: int = 0
Wire key ST
Star level; when none is set, derived from fixed_level if that is a multiple of 10
skill_ids
pydantic-field
¶
Wire key SIDS
Unlocked skills
selected_abilities
pydantic-field
¶
selected_abilities: list[SelectedAbility]
Wire key GASAIDS
The general's ability slots, filled or empty
ability_ids
property
¶
The abilities this general has selected, one id per filled slot, from either side.
Client: GeneralVO.getSelectedAbilities (bundle line 26769) skips a slot whose ability id is not above 0.
attack_ability_ids
¶
attack_ability_ids(general_def: GeneralDef) -> list[int]
The abilities selected in this general's attack slots.
Client: GeneralVO.getSelectedAbilities(true) (bundle line 26769)
defense_ability_ids
¶
defense_ability_ids(general_def: GeneralDef) -> list[int]
The abilities selected in this general's defense slots.
Client: GeneralVO.getSelectedAbilities(false) (bundle line 26769)
AssignGeneralRequest
pydantic-model
¶
Bases: BaseRequest
Assign a general to a commander, or take the commander's general away.
Command: gla Payload: {"LID": commander_id, "GID": general_id}
Client: C2SGeneralAssignLord (bundle line 101985)
Fields:
-
commander_id(int) -
general_id(Literal[-1] | EnumOrInt['General'])
AssignGeneralResponse
pydantic-model
¶
Bases: BaseResponse
Reply to a general assignment: the full commander list.
Command: gla Payload: {"gli": {"C": [..], "B": [..]}}
Client: GLACommand.executeCommand (bundle line 124218) passes gli to parse_GLI.
Fields:
commander_roster
pydantic-field
¶
commander_roster: CommanderRoster
Wire key gli
The commanders and castellans after the change
SetGeneralAbilitiesRequest
pydantic-model
¶
Bases: BaseRequest
Choose a general's abilities, one per slot.
Command: gaae Payload: {"GID": general_id, "SAIDS": [[slot_id, ability_id], ..]}
The ability dialog sends every slot it shows, with -1 for a cleared one. The server replies with no body.
Client: C2SGeneralSelectAbilities (bundle line 70767),
GeneralsAbilityDialog.onSave (bundle line 27846)
Fields:
-
general_id(EnumOrInt['General']) -
abilities(list[SelectedAbility])
general_id
pydantic-field
¶
general_id: EnumOrInt['General']
Wire key GID
The general whose abilities are chosen, an OwnedGeneral.general_id from client.commanders.get_generals()
abilities
pydantic-field
¶
abilities: list[SelectedAbility]
Wire key SAIDS
Every slot the dialog shows, each sent as [slot_id, ability_id], -1 for none
UnlockGeneralSkillRequest
pydantic-model
¶
Bases: BaseRequest
Unlock a general skill. The skill id names the general, so none is sent.
Command: guse Payload: {"ID": skill_id}
The server replies with no body.
Client: C2SGeneralUnlockSkillVO (bundle line 67469), GUSECommand (bundle line 124280)
Fields:
ResetGeneralSkillsRequest
pydantic-model
¶
Bases: BaseRequest
Reset a general's skill tree.
Command: grs Payload: {"GID": general_id}
The server replies with no body.
Client: C2SGeneralResetSkills (bundle line 67460), GRSCommand (bundle line 124242)
Fields:
-
general_id(EnumOrInt['General'])
AddGeneralXpRequest
pydantic-model
¶
Bases: BaseRequest
Feed a general xp items.
Command: gaxp Payload: {"GID": general_id, "CID": currency_id, "AMT": amount}
The server replies with no body.
Client: C2SGeneralAddXpVO (bundle line 74507), GAXPCommand (bundle line 124176)
Fields:
-
general_id(EnumOrInt['General']) -
currency_id(EnumOrInt['CurrencyId']) -
amount(int)
GetGeneralsResponse
pydantic-model
¶
Bases: BaseResponse
Response listing the player's generals.
Command: gie Payload: {"G": [{"GID": .., "SIDS": [skill ids], ..}, ..]}
Client: GIECommand.executeCommand (bundle line 124204) hands it to
GeneralsData.parse_GIE (bundle line 113069), which updates each general by GID.
Fields:
Validators:
-
_readable_generals→generals
GetSkillsRequest
pydantic-model
¶
Bases: BaseRequest
Request the player's own skill lists.
Command: skl Payload: {}
Client: C2SGetSkillListVO (bundle line 112219, no fields)
ActivatingSceatSkill
pydantic-model
¶
Bases: BasePayload
A Hall of Legends sceat skill still being activated, an entry of SSA.
Client: CastleLegendSkillData.parse_SKL (bundle line 112051)
Fields:
-
skill_id(EnumOrInt['SceatSkill'] | None) -
remaining_seconds(ClientInt)
SkillList
pydantic-model
¶
Bases: BasePayload
The player's Legendary and sceat skills, the skl block.
SID are the Legendary skills, which apply only in a legendary fight, and
SIDS the Hall of Legends sceat skills, which always apply.
Client: CastleLegendSkillData.parse_SKL (bundle line 112051)
Fields:
-
legendary_skill_ids(tuple[EnumOrInt['LegendarySkill'], ...]) -
sceat_skill_ids(tuple[EnumOrInt['SceatSkill'], ...]) -
total_points(ClientInt) -
seconds_until_reset(int | float) -
reset_count(ClientInt) -
activating(list[ActivatingSceatSkill])
Validators:
-
_seconds→seconds_until_reset -
_skill_ids→legendary_skill_ids,sceat_skill_ids -
_readable_entries→activating
legendary_skill_ids
pydantic-field
¶
Wire key SID
Legendary skills, which apply only in a legendary fight
sceat_skill_ids
pydantic-field
¶
Wire key SIDS
Hall of Legends sceat skills, which always apply
seconds_until_reset
pydantic-field
¶
Wire key RS
Seconds until the skills can be reset, fractions included
reset_count
pydantic-field
¶
reset_count: ClientInt = 0
Wire key RC
How many times the skills have been reset
activating
pydantic-field
¶
activating: list[ActivatingSceatSkill]
Wire key SSA
Sceat skills still being activated
spent_points
¶
The skill points the held Legendary skills cost, each level counted with those below it.
Client: CastleLegendSkillData.getSpentPoints (bundle line 112097)
GetSkillsResponse
pydantic-model
¶
Bases: BaseResponse, SkillList
Response listing the player's Legendary and sceat skills.
Command: skl Payload: {"SID": [Legendary skill ids], "SIDS": [sceat skill ids], "SP": total_points, "RS": seconds_until_reset, "RC": reset_count, "SSA": [{"ID": .., "RS": ..}, ..]}
Client: SKLCommand.executeCommand (bundle line 129742)
Fields:
-
legendary_skill_ids(tuple[EnumOrInt['LegendarySkill'], ...]) -
sceat_skill_ids(tuple[EnumOrInt['SceatSkill'], ...]) -
total_points(ClientInt) -
seconds_until_reset(int | float) -
reset_count(ClientInt) -
activating(list[ActivatingSceatSkill]) -
error_code(int)
Validators:
-
_seconds→seconds_until_reset -
_skill_ids→legendary_skill_ids,sceat_skill_ids -
_readable_entries→activating
AddSkillPointRequest
pydantic-model
¶
Bases: BaseRequest
Buy a Legendary skill level with skill points.
Command: skp Payload: {"ID": skill_id}
The client sends the next level of a skill held, or the first of one not held, once
CastleLegendSkillItem.canBuy passes: the skill is not at its last level, its tier and node
are unlocked, the points are there, and no sceat skill is being activated.
Client: C2SAddSkillPointVO (bundle line 78767), CastleLegendSkillItem.onClick and
canBuy (bundle lines 35643, 35652)
Fields:
AddSkillPointResponse
pydantic-model
¶
Bases: BaseResponse
The Legendary skill levels bought.
Command: skp Payload: {"IDS": [skill_id, ..]}
Client: SKPCommand.executeCommand (bundle line 129756) hands it to
CastleLegendSkillData.parse_SKP (bundle line 112073), which reads IDS only when it is set
Fields:
-
error_code(int) -
skill_ids(tuple[EnumOrInt['LegendarySkill'], ...])
Validators:
-
_skill_ids→skill_ids
BuySceatSkillRequest
pydantic-model
¶
Bases: BaseRequest
Buy a sceat skill level with sceat tokens or imperial ducats.
Command: bss Payload: {"ID": skill_id}
The client sends the next level of a skill held, or the first of one not held, from its buy dialog once
CastleLegendSkillItem.canBuy passes.
Client: C2SBuySceatSkillVO (split.js line 408751), sent by CastleSceatSkillVO.buySkill (split.js line
121683) from CastleSceatSkillBuyDialog.onClick (split.js line 409120); CastleLegendSkillItem.onClick
and canBuy (split.js lines 186511, 186593)
Fields:
BuySceatSkillResponse
pydantic-model
¶
Bases: BaseResponse
The acknowledgement of a bss; it carries nothing.
Command: bss
Client: BSSCommand.executeCommand (split.js line 642034)
Fields:
SkipSceatSkillActivationRequest
pydantic-model
¶
Bases: BaseRequest
Finish the activation of the sceat skill being activated in one Hall of Legends tab, for rubies.
Command: ssa Payload: {"TID": tab}
Client: C2SSkipSceatSkillActivationVO (split.js line 409893) sends the sublayer id less 1, the tab's
tabID; sent by CastleLegendSkillSceatBottomMenu.onClick (split.js line 409833), priced by
CastleSceatSkillVO.getSkipCosts (split.js line 121688)
Fields:
SkipSceatSkillActivationResponse
pydantic-model
¶
Bases: BaseResponse
The acknowledgement of an ssa; it carries nothing.
Command: ssa
Client: SSACommand.executeCommand (split.js line 642076)
Fields:
ResetSkillsRequest
pydantic-model
¶
Bases: BaseRequest
Take back every Legendary skill point.
Command: skr Payload: {}
Free once the reset cooldown has run out; inside it the same request spends rubies. The server replies with no body, and the client then asks for the skill list again.
Client: C2SSkillsResetVO (bundle line 112227), CastleLegendSkillData.requestSkillReset
and resetSkills (bundle lines 112137, 112104), SKRCommand (bundle line 129767)
ResetSkillsResponse
pydantic-model
¶
Bases: BaseResponse
The acknowledgement of an skr; it carries nothing.
Command: skr
Client: SKRCommand.executeCommand (split.js line 652567), which then calls
CastleLegendSkillData.resetSkills (split.js line 576751)
Fields:
ObjectUpdateEvent
pydantic-model
¶
Bases: BaseResponse
An object update pushed by the server.
Only the skill list is read here; the joined castle's part of the same payload is
BuildingChanged.
Command: ego
Client: EGOCommand.executeCommand (split.js line 628214)
Fields:
-
error_code(int) -
skills(SkillList | None)
Validators:
-
_no_skills→skills