Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        private static async Task ApplyAura(Skill aura)
        {
            string name = aura.Name;

            GlobalLog.Debug($"[CastAuraTask] Now casting \"{name}\".");
            var used = SkillBar.Use(aura.Slot, false);

            if (used != LokiPoe.InGameState.UseResult.None)
            {
                GlobalLog.Error($"[CastAuraTask] Fail to cast \"{name}\". Error: \"{used}\".");
                return;
            }
            await Wait.For(() => !LokiPoe.Me.HasCurrentAction && PlayerHasAura(name), "aura applying");

            await Wait.SleepSafe(100);
        }
Example #4
0
        public async Task <bool> Run()
        {
            var area = World.CurrentArea;

            if (!area.IsHideoutArea && !area.IsMapRoom)
            {
                return(false);
            }

            await Coroutines.CloseBlockingWindows();

            var golemSkill = SkillBar.Skills.FirstOrDefault(s => s.IsOnSkillBar && s.SkillTags.Contains("golem"));

            if (golemSkill != null)
            {
                var golemObj = golemSkill.DeployedObjects.FirstOrDefault() as Monster;
                if (golemObj == null || golemObj.HealthPercent < MinGolemHpPercent)
                {
                    GlobalLog.Debug($"[CastAuraTask] Now summoning \"{golemSkill.Name}\".");
                    SkillBar.Use(golemSkill.Slot, false);
                    await Wait.SleepSafe(100);

                    await Coroutines.FinishCurrentAction();

                    await Wait.SleepSafe(100);
                }
            }
            var auras = GetAurasForCast();

            if (auras.Count > 0 && AllAuras.Any(a => a.IsOnSkillBar))
            {
                GlobalLog.Info($"[CastAuraTask] Found {auras.Count} aura(s) for casting.");
                await CastAuras(auras);
            }
            return(false);
        }
Example #5
0
        private static bool IsInSlot(int slot, string name)
        {
            var skill = SkillBar.Slot(slot);

            return(skill != null && skill.Name == name);
        }