I am writing a plugin that rerolls links sockets and link colors to what the user wants. However it is closing the stash all the time. Is there a way to prevent CloseBlockingWindows from being called by the bot?
public void Tick()
{
if (!LokiPoe.IsInGame || !LokiPoe.Me.IsInTown)
return;
Vector2i v = new Vector2i(0, 0);
if (_rollSockets)
{
if (Helpers.hasItem(_itemName).SocketCount < _socketCount)
{
Helpers.UseOrbOnItem(v, "Jeweller's Orb");
}
}
if (_rollLinks)
{
foreach (SocketColor[] a in Helpers.hasItem(_itemName).LinkedSocketColors)
{
if (a.Length >= _socketCount)
{
_linksDone = true;
}
}
if (!_linksDone)
{
Log.Debug("need to roll links");
Helpers.UseOrbOnItem(v, "Orb of Fusing");
}
}
}
This is correct, async loop whatever you are trying to do in your task.There's no task for that, the Tasks are calling Loki.Bot.Logic.Bots.OldGrindBot.Coroutines.CloseBlockingWindows() function.
I would suggest doing a loop here instead of tick and don't return until you are done with your stuff or stop the bot.
This currently is my tick function in my main class.Code:public void Tick() { if (!LokiPoe.IsInGame || !LokiPoe.Me.IsInTown) return; Vector2i v = new Vector2i(0, 0); if (_rollSockets) { if (Helpers.hasItem(_itemName).SocketCount < _socketCount) { Helpers.UseOrbOnItem(v, "Jeweller's Orb"); } } if (_rollLinks) { foreach (SocketColor[] a in Helpers.hasItem(_itemName).LinkedSocketColors) { if (a.Length >= _socketCount) { _linksDone = true; } } if (!_linksDone) { Log.Debug("need to roll links"); Helpers.UseOrbOnItem(v, "Orb of Fusing"); } } }
Is there a list of tasks. I have removed multiple tasks (thanks QuestPlugin) however, I am not finding a CloseBlockingWindows or CloseBlockingWindowsTask.
Also thanks for the help this is a solid community!
There's no task for that, the Tasks are calling Loki.Bot.Logic.Bots.OldGrindBot.Coroutines.CloseBlockingWindows() function.
I would suggest doing a loop here instead of tick and don't return until you are done with your stuff or stop the bot.
Don't ever do a loop in tick(). You will freeze the game and Bot.As tormiasz says, it's a pretty bad idea to process in tick for that kind of things. Make your own task, and loop in it...
public async Task<bool> Logic(string type, params dynamic[] param)
{
private static async Task YOURTASKNAME()
{
if (!LokiPoe.IsInGame || !LokiPoe.Me.IsInTown)
return;
while(true)
{
Vector2i v = new Vector2i(0, 0);
if (_rollSockets)
{
if (Helpers.hasItem(_itemName).SocketCount < _socketCount)
{
Helpers.UseOrbOnItem(v, "Jeweller's Orb");
}
}
if (_rollLinks)
{
foreach (SocketColor[] a in Helpers.hasItem(_itemName).LinkedSocketColors)
{
if (a.Length >= _socketCount)
{
_linksDone = true;
break;
}
}
if (!_linksDone)
{
Log.Debug("need to roll links");
Helpers.UseOrbOnItem(v, "Orb of Fusing");
}
}
}
}
So i don't fully understand this Logic Task
Is it same as Tick but it gives you option to use async code inside?
Im working on currency logger thing that show me currency from each of my bot in one place.
For now i save currency data into file each x time. Code is inside Tick.
Everything is working as intended but if i wanna add functionality there is one problem.
I want to send post request to my server but i wanna do it asynchronously so it won't block main loop/freeze bot when request will timeout for some reason.
Is there way to solve this using Logic Task?
For example in AlterterReleoded plugin every mobile notify request can freeze bot and i wanna avoid that.