Took me forever to figure this out as I am clueless about any kind of coding..
But tested and working. This will drop OoS if you run into magic or higher mobs or if there are 10+ mobs within range. Adjust timer and range/mob count to your needs. Seems to be working very well for me.
No, I will not upload a file.
// Declare the variable
private int _orbOfStormsSlot = -1;
// Add the stopwatch
private readonly Stopwatch _orbbuffStopwatch = Stopwatch.StartNew();
// Get the ability
var os = LokiPoe.InGameState.SkillBarHud.Skills.FirstOrDefault(s => s.Name == "Orb of Storms");
if (IsCastableHelper(os))
{
_orbOfStormsSlot = os.Slot;
}
// Use it
if (_orbOfStormsSlot != -1 && _orbbuffStopwatch.ElapsedMilliseconds > 4000)
{
// See if we can use the skill.
var skill = LokiPoe.InGameState.SkillBarHud.Slot(_orbOfStormsSlot);
if (skill.CanUse() && (NumberOfMobsNear(LokiPoe.Me, 70) >= 10) || (cachedRarity >= Rarity.Magic))
{
await Coroutines.FinishCurrentAction();
var err1 = LokiPoe.InGameState.SkillBarHud.UseAt(_orbOfStormsSlot, true, targetPosition);
_orbbuffStopwatch.Restart();
if (err1 == LokiPoe.InGameState.UseResult.None)
{
await Coroutines.LatencyWait();
await Coroutines.FinishCurrentAction(false);
await Coroutines.LatencyWait();
return LogicResult.Provided;
}
Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
}
}