Repository navigation
API World
| Import | from proleak import world |
The game world as live objects: players, teams, units and areas. Read-only. Main thread only.
| Class | |
|---|---|
Area |
A rectangle of the map, such as a player's lane. |
Unit |
One unit on the map. |
Player |
A player in the game. |
Team |
A team: its players and its king. |
| Returns | Function | |
|---|---|---|
list[Player] |
players() |
Every playing player. |
Player | None |
player(slot: int | None = ...) |
The Player in slot, or None. |
list[Team] |
teams() |
Every team. |
Unit | None |
unit(unit_id: int) |
The Unit with this id now, or None. |
list[Unit] |
units(kind: str | None = None, type: str | None = None, name: str | None = None, legion: str | None = None, tier: int | None = None, role: str | None = None, spell: str | None = None, buff: str | None = None, attack_type: str | None = None, armor_type: str | None = None, owner: Player | int | None = None, wave: bool | None = None, near: tuple[float, float, float] | None = None, where: Callable[[Unit], bool] | None = None) |
Every unit matching the filters. |
| Type | Value | |
|---|---|---|
int |
wave read-only
|
The wave being played or built for; 0 outside a game. |
str |
phase read-only
|
"build" or "fight"; "none" outside a game. |
WaveInfo | None |
wave_info read-only
|
The WaveInfo of wave, or None. |
Values are read once per frame and cached (and read again when a unit appears or dies within the frame), so loops over many units cost one read. A Unit handle follows one unit: once that unit dies or a new unit takes its id, reading it raises UnitGone.
players() -> list[Player]
Every playing player.
player(slot: int | None = ...) -> Player | None
The Player in slot, or None.
Without a slot, the player this client controls (None outside a game).
teams() -> list[Team]
Every team.
unit(unit_id: int) -> Unit | None
The Unit with this id now, or None.
units(kind: str | None = None, type: str | None = None, name: str | None = None, legion: str | None = None, tier: int | None = None, role: str | None = None, spell: str | None = None, buff: str | None = None, attack_type: str | None = None, armor_type: str | None = None, owner: Player | int | None = None, wave: bool | None = None, near: tuple[float, float, float] | None = None, where: Callable[[Unit], bool] | None = None) -> list[Unit]
Every unit matching the filters.
owner takes a Player or a slot; wave=True keeps this wave's units (as kind="wave");
near=(x, z, radius); where any predicate. Name-like filters ignore case and take the
display name or the id.
wave: int [read-only]
The wave being played or built for; 0 outside a game.
phase: str [read-only]
"build" or "fight"; "none" outside a game.
wave_info: WaveInfo | None [read-only]
The WaveInfo of wave, or None.
A rectangle of the map, such as a player's lane.
| Type | Property | |
|---|---|---|
str |
name |
Its name, such as lane 1. |
Player | None |
owner |
The player it belongs to, or None. |
| Returns | Method | |
|---|---|---|
bool |
contains(x: float, z: float) |
True when map point (x, z) is inside. |
list[Unit] |
units(**filters) |
The units standing in this area; filters are those of units. |
name: str
Its name, such as lane 1.
owner: Player | None
The player it belongs to, or None.
contains(x: float, z: float) -> bool
True when map point (x, z) is inside.
units(**filters) -> list[Unit]
The units standing in this area; filters are those of units.
One unit on the map. Members read this frame's values.
| Type | Property | |
|---|---|---|
int |
id |
Its id; a new unit may take it once this one is gone. |
bool |
valid read-only
|
False once the unit died or a new unit took its id. |
str |
type read-only
|
The unit type id, for example peewee_unit_id. |
str |
kind read-only
|
fighter, wave_fighter, worker, king, mercenary, wave or other. |
UnitInfo | None |
info read-only
|
The UnitInfo of the unit's type. |
str |
name read-only
|
Display name, for example Peewee. |
str |
legion read-only
|
Legion name, for example Element (empty for units without one). |
int |
tier read-only
|
Fighter tier, 1 to 6; 0 for a unit with none. |
str |
role read-only
|
The game's inforole field of its type; empty when the game sets none. |
str |
attack_type read-only
|
Attack type, such as atk_magic. |
str |
armor_type read-only
|
Armor type, such as arm_heavy. |
list[UnitInfo] |
evolves_to read-only
|
The unit types this unit can upgrade into. |
Player | None |
owner read-only
|
The owning Player, or None for units no player owns (wave units, kings). |
float |
hp read-only
|
Health now. |
float |
max_hp read-only
|
Maximum health. |
float |
mana read-only
|
Mana now. |
float |
max_mana read-only
|
Maximum mana. |
float |
x read-only
|
Map x position. |
float |
z read-only
|
Map z position. |
bool |
alive read-only
|
True while the unit is alive. |
bool |
hidden read-only
|
True for a placed fighter the game hides while its wave fighter fights. |
list[str] |
upgrades read-only
|
Upgrade ids bought for this unit. |
list[str] |
researches read-only
|
Research ids that apply to this unit. |
list[str] |
abilities read-only
|
Extra abilities on the unit, such as the one a legion spell grants. |
dict[str, int] |
buffs read-only
|
{buff_type: stacks} on the unit now. |
SpellInfo | None |
spell read-only
|
The SpellInfo of the legion spell placed on this fighter, or None. |
Unit | None |
target read-only
|
The unit this one attacks, or None. |
list[Unit] |
targeted_by read-only
|
The units attacking this one. |
Unit | None |
placed read-only
|
For a wave fighter, the placed fighter it fights for; else None. |
Unit | None |
wave_fighter read-only
|
For a placed fighter, the unit that fights for it during a wave; else None. |
Area | None |
area read-only
|
The lane the unit stands in, or None. |
id: int
Its id; a new unit may take it once this one is gone.
valid: bool [read-only]
False once the unit died or a new unit took its id.
type: str [read-only]
The unit type id, for example peewee_unit_id.
kind: str [read-only]
fighter, wave_fighter, worker, king, mercenary, wave or other.
info: UnitInfo | None [read-only]
The UnitInfo of the unit's type.
name: str [read-only]
Display name, for example Peewee.
legion: str [read-only]
Legion name, for example Element (empty for units without one).
tier: int [read-only]
Fighter tier, 1 to 6; 0 for a unit with none.
role: str [read-only]
The game's inforole field of its type; empty when the game sets none.
attack_type: str [read-only]
Attack type, such as atk_magic.
armor_type: str [read-only]
Armor type, such as arm_heavy.
evolves_to: list[UnitInfo] [read-only]
The unit types this unit can upgrade into.
owner: Player | None [read-only]
The owning Player, or None for units no player owns (wave units, kings).
hp: float [read-only]
Health now.
max_hp: float [read-only]
Maximum health.
mana: float [read-only]
Mana now.
max_mana: float [read-only]
Maximum mana.
x: float [read-only]
Map x position.
z: float [read-only]
Map z position.
alive: bool [read-only]
True while the unit is alive.
hidden: bool [read-only]
True for a placed fighter the game hides while its wave fighter fights.
upgrades: list[str] [read-only]
Upgrade ids bought for this unit.
researches: list[str] [read-only]
Research ids that apply to this unit.
abilities: list[str] [read-only]
Extra abilities on the unit, such as the one a legion spell grants.
buffs: dict[str, int] [read-only]
{buff_type: stacks} on the unit now.
spell: SpellInfo | None [read-only]
The SpellInfo of the legion spell placed on this fighter, or None.
target: Unit | None [read-only]
The unit this one attacks, or None.
targeted_by: list[Unit] [read-only]
The units attacking this one.
placed: Unit | None [read-only]
For a wave fighter, the placed fighter it fights for; else None.
wave_fighter: Unit | None [read-only]
For a placed fighter, the unit that fights for it during a wave; else None.
area: Area | None [read-only]
The lane the unit stands in, or None.
A player in the game. Members read this frame's values.
| Type | Property | |
|---|---|---|
int |
slot |
Its slot, 1 to 8. |
str |
name read-only
|
Display name. |
bool |
is_local read-only
|
True for the player this client controls. |
Team | None |
team read-only
|
The player's Team. |
list[Player] |
teammates read-only
|
The other players of the team. |
Player | None |
attacking read-only
|
The player this one sends to. |
Player | None |
defending read-only
|
The player sending to this one. |
int |
gold read-only
|
Gold now. |
int |
mythium read-only
|
Mythium now. |
int |
income read-only
|
Income. |
float |
workers read-only
|
Worker count (fractional while one trains). |
int |
food read-only
|
Food used. |
int |
food_cap read-only
|
Food available. |
int |
value read-only
|
Fighter value. |
bool |
connected read-only
|
True while connected. |
bool |
afk read-only
|
True when marked away from keyboard. |
LegionInfo | None |
legion read-only
|
The LegionInfo of the chosen legion, or None. |
MastermindInfo | None |
mastermind read-only
|
The MastermindInfo of the playstyle, or None. |
SpellInfo | None |
spell read-only
|
The SpellInfo of the chosen legion spell, or None. |
list[UnitInfo] |
rolls read-only
|
The fighters this player can build (a Mastermind roll). |
dict[str, int] |
king_upgrades read-only
|
{"attack": n, "regen": n, "spell": n} levels bought. |
Area |
lane read-only
|
The player's lane as an Area. |
| Returns | Method | |
|---|---|---|
list[Unit] |
units(**filters) |
The player's units; filters are those of units. |
list[Unit] |
fighters(**filters) |
The player's placed fighters. |
list[Unit] |
workers_units() |
The player's worker units. |
list[UnitInfo] |
mercenaries_sent(wave: int | None = None) |
The types of the mercenaries this player sent, in one wave or in every wave. |
list[UnitInfo] |
mercenaries_received(wave: int | None = None) |
The types of the mercenaries sent at this player, in one wave or in every wave. |
float |
leaked(wave: int | None = None) |
Leaked percent for a wave (the current one by default). |
list[Unit] |
selected() |
The units this player has selected; empty for other players (the game keeps only yours). |
slot: int
Its slot, 1 to 8.
name: str [read-only]
Display name.
is_local: bool [read-only]
True for the player this client controls.
team: Team | None [read-only]
The player's Team.
teammates: list[Player] [read-only]
The other players of the team.
attacking: Player | None [read-only]
The player this one sends to.
defending: Player | None [read-only]
The player sending to this one.
gold: int [read-only]
Gold now.
mythium: int [read-only]
Mythium now.
income: int [read-only]
Income.
workers: float [read-only]
Worker count (fractional while one trains).
food: int [read-only]
Food used.
food_cap: int [read-only]
Food available.
value: int [read-only]
Fighter value.
connected: bool [read-only]
True while connected.
afk: bool [read-only]
True when marked away from keyboard.
legion: LegionInfo | None [read-only]
The LegionInfo of the chosen legion, or None.
mastermind: MastermindInfo | None [read-only]
The MastermindInfo of the playstyle, or None.
spell: SpellInfo | None [read-only]
The SpellInfo of the chosen legion spell, or None.
rolls: list[UnitInfo] [read-only]
The fighters this player can build (a Mastermind roll).
king_upgrades: dict[str, int] [read-only]
{"attack": n, "regen": n, "spell": n} levels bought.
lane: Area [read-only]
The player's lane as an Area.
units(**filters) -> list[Unit]
The player's units; filters are those of units.
fighters(**filters) -> list[Unit]
The player's placed fighters.
workers_units() -> list[Unit]
The player's worker units.
mercenaries_sent(wave: int | None = None) -> list[UnitInfo]
The types of the mercenaries this player sent, in one wave or in every wave.
mercenaries_received(wave: int | None = None) -> list[UnitInfo]
The types of the mercenaries sent at this player, in one wave or in every wave.
leaked(wave: int | None = None) -> float
Leaked percent for a wave (the current one by default).
selected() -> list[Unit]
The units this player has selected; empty for other players (the game keeps only yours).
A team: its players and its king.
| Type | Property | |
|---|---|---|
int |
id |
Its id. |
list[Player] |
players read-only
|
The team's players. |
Unit | None |
king read-only
|
The team's king as a Unit, or None. |
| Returns | Method | |
|---|---|---|
float |
leaked(wave: int | None = None) |
Sum of the players' leaked percent for a wave (the current one by default). |
id: int
Its id.
players: list[Player] [read-only]
The team's players.
king: Unit | None [read-only]
The team's king as a Unit, or None.
leaked(wave: int | None = None) -> float
Sum of the players' leaked percent for a wave (the current one by default).
Using ProLeak
Features
Tutorial
- Your first plugin
- Plugin basics
- Handling events
- Plugin settings
- User interface
- Players, units and game data
- Purchases, signals and pings
- Chat, camera, input and more
- Cosmetics
- Game modes
- Game updates
- Publishing plugins
Reference