Skip to content

API Raw game access

Alexandre 'kidev' Poumaroux edited this page Oct 21, 2026 · 4 revisions

Raw game access

Import from proleak import advanced

Raw access to the game, for what the event API does not cover.

Classes

Class
Patch A Harmony patch owned by the plugin.

Functions

Returns Function
Patch patch(target: str, pre: Callable | None = None, post: Callable | None = None) Patch "Namespace.Type:Method" with a Python prefix and/or postfix.
object type(name: str) The .NET class name (for example "Assets.Api.UnitApi"), to call game APIs directly.

Detailed description

patch needs the actions capability, so it works on local servers only, and refuses the types of ProLeak and its mod loader. type hands out raw game classes and also works on local servers only. Names follow the game and change between game versions.

Function documentation

patch

patch(target: str, pre: Callable | None = None, post: Callable | None = None) -> Patch

Patch "Namespace.Type:Method" with a Python prefix and/or postfix.

pre(instance, args) may return False to skip the original; post(instance, args, result) sees the return value.

type

type(name: str) -> object

The .NET class name (for example "Assets.Api.UnitApi"), to call game APIs directly.

Local servers only; raises NotAllowedHere elsewhere.

Patch class

A Harmony patch owned by the plugin. Removed on unload or with remove.

Returns Method
None remove() Remove the patch now.

Method documentation

remove

remove() -> None

Remove the patch now.


Previous: Plugin settings | Next: Server kinds

Clone this wiki locally