you're the best man!
Make sure to post your pp donation address when you're done with the plugin!
edit: oh i actually have a question. How fast will the plugin convert the currency (like delay between the purchases?) and when will he execute the task (everytime he visits the stash+vendor?)?
It's sleeping Average Latency * 2 after every purchase to avoid mistakes. Still it's not 100% accurate if you lag spike. There is no function to wait until the item is purchased, I could build it myself... Maybe later.
I didn't test if not using this sleep will change anything.
Task is executed everytime the bot is in town/hideout after vendoring and stashing everything.
EDIT: Ok I was bored and made a function that wait's until the item is appeared in the inventory. So it's buying as fast as possible.
Code:
public static async Task<bool> WaitForCurrencyToBeBought(string itemname, int currentAmount, int timeout = 1000)
{
var deadlock = Stopwatch.StartNew();
while (deadlock.ElapsedMilliseconds < timeout)
{
var newAmount = Inventory.MainInventory.Items.Where(itemC => itemC.Name == itemname).Sum(b => b.StackCount);
if (newAmount > currentAmount)
{
StashBuddy.Log.DebugFormat("[WaitForCurrencyToBeBought] \"{0}\" bought after {1} miliseconds.", itemname, deadlock.ElapsedMilliseconds);
return true;
}
await Coroutine.Sleep(20);
}
StashBuddy.Log.ErrorFormat("[WaitForCurrencyToBeBought] Timeout.");
return false;
}
Last edited: