DPB2Class · Bots, plugins and tasks

Coroutines

Asynchronous helpers for timing, interaction and common game actions. Await these helpers within the bot workflow.

Namespace: DreamPoeBot.Loki.Bot

public static class CoroutinesView DPB1 version →

Examples

Imports used by these examples
using System;
using System.Linq;
using DreamPoeBot.Loki.Game;
using DreamPoeBot.Loki.Game.Objects;
using DreamPoeBot.Loki.Bot;
using DreamPoeBot.Loki.Bot.Pathfinding;
using DreamPoeBot.Loki.Common;

Yield to the normal interaction timing

if (!LokiPoe.IsInGame)
    return;

await Coroutines.FinishCurrentAction();
await Coroutines.LatencyWait();

Use inside the bot's asynchronous workflow. Do not block the bot thread with Thread.Sleep.

Members and overloads

19 results

CloseBlockingWindows

MethodLink ↗
public static Task Coroutines.CloseBlockingWindows()

Close ALL the game Ui windows. you usually call this before to interact with some world object (npc, loot, moster, areatransation etc etc)

Returns: An asynchronous operation. Await it before reading the result or continuing the workflow.

ExInteractWith

MethodLink ↗
public static Task<Vector2i> Coroutines.ExInteractWith(NetworkObject obj, bool holdCtrl = false, int timeout = 1000)

Attempts to interact with a game object and reports the resulting interaction position. The character may move into range first.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.
timeoutint
The maximum time, in milliseconds, allowed for the interaction.

Returns: The reported interaction position, or DreamPoeBot.Common.Vector2i.Zero when the attempt fails.

ExInteractWith

MethodLink ↗
public static Task<Vector2i> Coroutines.ExInteractWith<T>(NetworkObject obj, bool holdCtrl, int timeout)

Attempts to interact with a game object of the requested type and reports the resulting interaction position. The character may move into range first.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.
timeoutint
The maximum time, in milliseconds, allowed for the interaction.

Returns: The reported interaction position, or DreamPoeBot.Common.Vector2i.Zero when the attempt fails.

ExInteractWith

MethodLink ↗
public static Task<Vector2i> Coroutines.ExInteractWith<T>(NetworkObject obj, bool holdCtrl = false, int timeout = 1000, bool autoEquip = true)

Attempts to interact with a game object of the requested type and reports the resulting interaction position. The character may move into range first. For collectible items, autoEquip set to true allows the game to equip the collected item automatically when permitted; false collects it without requesting automatic equipment.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.
timeoutint
The maximum time, in milliseconds, allowed for the interaction.
autoEquipbool
Whether automatic equipment may be requested for a collected item; ignored for other supported objects.

Returns: The reported interaction position, or DreamPoeBot.Common.Vector2i.Zero when the attempt fails.

FinishCurrentAction

MethodLink ↗
public static Task Coroutines.FinishCurrentAction(bool resetInput = true)

This function make sure we are not actually performing another action, and if so, it wait till the end of that action, or the default timeout (5000ms). You usually call this to make sure a previous action you performed (cast a non instant skill, MoveToward etc etc) run to completition, before to perform another one.

resetInputbool
True, if you want to reset all key state after the current action completed.

Returns: An asynchronous operation. Await it before reading the result or continuing the workflow.

FinishCurrentMoveAction

MethodLink ↗
public static Task Coroutines.FinishCurrentMoveAction(bool resetInput = true)

This function make sure we are not actually performing another move action, and if so, it wait till the end of that move action, or the default timeout (5000ms). You usually call this to make sure a previous move action you performed run to completition, before to perform another one.

resetInputbool
True, if you want to reset all key state after the current action completed.

Returns: An asynchronous operation. Await it before reading the result or continuing the workflow.

InteractWith

MethodLink ↗
public static Task<bool> Coroutines.InteractWith(NetworkObject obj, bool holdCtrl = false)

Attempts to interact with a game object, such as an item, portal, NPC, chest, or area transition. The character may move into interaction range first.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.

Returns: True when the interaction was performed; otherwise false.

InteractWith

MethodLink ↗
public static Task<bool> Coroutines.InteractWith<T>(NetworkObject obj, bool holdCtrl)

Attempts to interact with a game object of the requested type. The character may move into interaction range first.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.

Returns: True when the interaction was performed; otherwise false.

InteractWith

MethodLink ↗
public static Task<bool> Coroutines.InteractWith<T>(NetworkObject obj, bool holdCtrl = false, bool autoEquip = true)

Attempts to interact with a game object of the requested type. The character may move into interaction range first. For collectible items, autoEquip set to true allows the game to equip the collected item automatically when permitted; false collects it without requesting automatic equipment.

objNetworkObject
The game object to interact with.
holdCtrlbool
Whether to hold the Control key during the interaction.
autoEquipbool
Whether automatic equipment may be requested for a collected item; ignored for other supported objects.

Returns: True when the interaction was performed; otherwise false.

LatencyWait

MethodLink ↗
public static Task<int> Coroutines.LatencyWait()

This is a convenient method to pause The bot execution for a number of ms equal to your actual average latency multiplied for the LatencyFactor. Usually used after the execution of an action, this make sure the game has time to send the current action to the server and recieve an answer.

Returns: The number of ms the bot paused for.

LatencyWait

MethodLink ↗
public static Task<int> Coroutines.LatencyWait(float factor)

This is a convenient method to pause The bot execution for a number of ms equal to your actual average latency multiplied for the factor parameter. Usually used after the execution of an action, this make sure the game has time to send the current action to the server and recieve an answer.

factorfloat
Specifies factor.

Returns: An asynchronous operation. Await it before reading the result or continuing the workflow.

Loot

MethodLink ↗
public static Task<LootResult> Coroutines.Loot(NetworkObject obj, bool shouldMove, int tmeout)

Attempts to collect a world item. When shouldMove is true, the character may move into interaction range first.

objNetworkObject
The world item to collect.
shouldMovebool
Whether the character may move into interaction range.
tmeoutint
The maximum time, in milliseconds, allowed for the interaction.

Returns: A result describing whether the item was collected or why the attempt failed.

Loot

MethodLink ↗
public static Task<LootResult> Coroutines.Loot(NetworkObject obj, bool shouldMove = true, int tmeout = 250, bool autoEquip = true)

Attempts to collect a world item. When shouldMove is true, the character may move into interaction range first. Setting autoEquip to true allows the game to equip the collected item automatically when permitted; false collects it without requesting automatic equipment.

objNetworkObject
The world item to collect.
shouldMovebool
Whether the character may move into interaction range.
tmeoutint
The maximum time, in milliseconds, allowed for the interaction.
autoEquipbool
Whether automatic equipment may be requested for the collected item.

Returns: A result describing whether the item was collected or why the attempt failed.

ReactionWait

MethodLink ↗
public static Task<int> Coroutines.ReactionWait()

Executes the reaction wait operation.

Returns: An asynchronous operation. Await it before reading the result or continuing the workflow.

FinishCurrentActionTimeout

PropertyLink ↗
public static int Coroutines.FinishCurrentActionTimeout { get; set; }

Get or Set the `FinishCurrentAction` Timeout value. Default value is 5000ms.

FinishCurrentMoveActionTimeout

PropertyLink ↗
public static int Coroutines.FinishCurrentMoveActionTimeout { get; set; }

Get or Set the `FinishCurrentMoveAction` Timeout value. Default value is 5000ms.

LatencyFactor

PropertyLink ↗
public static float Coroutines.LatencyFactor { get; set; }

Get or Set the Factor we multiply the actual latency for, in LatencyWait().

ReactionMaxSleepDelay

PropertyLink ↗
public static int Coroutines.ReactionMaxSleepDelay { get; set; }

Get or Set the Max sleep value for ReactionWait.

ReactionMinSleepDelay

PropertyLink ↗
public static int Coroutines.ReactionMinSleepDelay { get; set; }

Get or Set the Min sleep value for ReactionWait.

DPB2 0.4.5.88 · Reference reviewed 2026-10-02. Descriptions use source summaries where available, otherwise concise signature-based descriptions. Examples illustrate usage; they are not a live-game test.