public async Task <bool> Run() { if (!_shouldAssign) { return(false); } GlobalLog.Debug("[AssignMoveSkillTask] Now going to assign the Move skill to the skillbar. It must be bound to anything except left mouse button."); var emptySlot = FirstEmptySkillSlot; if (emptySlot == -1) { GlobalLog.Error("[AssignMoveSkillTask] Cannot assign the Move skill. There are no free slots on the skillbar."); BotManager.Stop(); return(true); } var moveSkill = Skillbar.Skills.FirstOrDefault(s => s != null && s.InternalName == "Move"); if (moveSkill == null) { GlobalLog.Error("[AssignMoveSkillTask] Unknown error. Cannot find the Move skill on the skillbar."); BotManager.Stop(); return(true); } var err = Skillbar.SetSlot(emptySlot, moveSkill); if (err != LokiPoe.InGameState.SetSlotResult.None) { GlobalLog.Error($"[AssignMoveSkillTask] Fail to assign the Move skill to slot {emptySlot}. Error: \"{err}\"."); ErrorManager.ReportError(); await Wait.SleepSafe(500); return(true); } if (!await Wait.For(() => Skillbar.Slot(emptySlot)?.InternalName == "Move", "skill slot changing")) { ErrorManager.ReportError(); return(true); } GlobalLog.Debug($"[AssignMoveSkillTask] Move skill has been successfully assigned to slot {emptySlot}."); _shouldAssign = false; return(false); }
private static async Task SetAuraToSlot(Skill aura, int slot) { string name = aura.Name; GlobalLog.Debug($"[CastAuraTask] Now setting \"{name}\" to slot {slot}."); var isSet = SkillBar.SetSlot(slot, aura); if (isSet != LokiPoe.InGameState.SetSlotResult.None) { GlobalLog.Error($"[CastAuraTask] Fail to set \"{name}\" to slot {slot}. Error: \"{isSet}\"."); return; } await Wait.For(() => IsInSlot(slot, name), "aura slot changing"); await Wait.SleepSafe(100); }