Skills and generals¶
client.commanders covers the generals you own, which you assign to commanders,
and client.player the player's own skill trees.
Generals¶
for general in client.commanders.get_generals():
print(general.general_id, general.star_level, general.ability_ids)
Give a commander a general, or take it away with general=None, then choose
the general's abilities as (slot_id, ability) pairs, None to clear a slot. A general's selected_abilities are its slots, each a
SelectedAbility whose ability_id is a GeneralAbility, or None when empty:
from empire_core.commanders import General, GeneralAbility
client.commanders.assign_general(commander_id=3, general=General.TORIL)
client.commanders.set_general_abilities(
General.TORIL, [(1, GeneralAbility.POWER_SURGE_L1), (2, GeneralAbility.POWER_SURGE_L2)]
)
unlock_general_skill, reset_general_skills and add_general_xp change a general's skill tree the
same way. General, ability and skill ids differ between client releases, so
look them up by name. The general calls take the game data row itself, or one of
get_generals():
data = client.load_game_data()
toril = data.general("Toril")
if toril is not None:
client.commanders.assign_general(commander_id=3, general=toril)
See Lookups by name for the rest.
Unlocking generals and their stars¶
A general is unlocked with its own shards, and gains a star at every tenth level with its own or the
universal shards. Both check the shards you hold first and raise ValueError when the client would not
offer the action:
from empire_core.gamedata import Currency, General
client.commanders.unlock_general(General.TORIL)
toril = next(g for g in client.commanders.get_generals() if g.general_id == General.TORIL)
client.commanders.upgrade_general_stars(toril, Currency.UNIVERSAL_GENERAL_SHARD)
The generals hub's characters spin a tombola for shards, for an offering or for free:
from empire_core.gamedata import GeneralsHubCharacter
for character in client.commanders.get_generals_hub():
print(character.character_id, character.free_spins, character.cooldown_ends_at)
spin = client.commanders.spin_generals_hub(GeneralsHubCharacter.FAT_KING, Currency.OFFERING_TO_LUDWIG, free=True)
Player skills¶
skills = client.player.get_skills()
print(skills.legendary_skill_ids, skills.total_points, skills.reset_count)
legendary_skill_ids are LegendarySkill members and sceat_skill_ids SceatSkill
members, as is the skill_id of each sceat skill still being activated
(activating); a general's skill_ids are GeneralSkill members.
The login data carries the list too, and state keeps the last one the server
sent, so client.player.skills reads it without a request (None before
the login data).
The server sends the skill list again after every change. To follow it, register
a callback; it runs for the reply to get_skills() too:
Remove it with client.player.on_skill_list.remove(callback).
Spending and resetting Legendary skill points¶
from empire_core.gamedata import LegendarySkill
client.player.add_legendary_skill_point(LegendarySkill.GATE_REDUCTION_T0_G1_L1)
print(client.player.available_skill_points)
print(client.player.spent_skill_points)
client.player.reset_skills()
add_legendary_skill_point buys one level, the next of a skill you hold or the first
of one you don't, and swaps it into client.player.skills. A refusal (tier
locked, a missing skill, too few points) raises CommandError.
reset_skills is free once its 15-day cooldown has run out. Inside it the
reset costs rubies, so it raises ValueError with the price unless you pass
spend_rubies=True. Sceat skills, which cost tokens or rubies, are not bought here.