Beispiel #1
0
        public async Task <GoapGoal?> GetAction()
        {
            if (playerReader.HealthPercent > 1 && blacklist.IsTargetBlacklisted())
            {
                logger.LogInformation("Target is blacklisted");
                await new WowProcess(logger).KeyPress(ConsoleKey.F3, 400);
                UpdateWorldState();
            }

            var goal = new HashSet <KeyValuePair <GoapKey, GoapPreCondition> >();

            //Plan
            Queue <GoapGoal> plan = planner.Plan(AvailableGoals, WorldState, goal);

            if (plan != null && plan.Count > 0)
            {
                CurrentGoal = plan.Peek();
            }
            else
            {
                logger.LogInformation($"Target Health: {playerReader.TargetHealth}, max {playerReader.TargetMaxHealth}, dead {playerReader.PlayerBitValues.TargetIsDead}");

                if (this.classConfiguration.Mode != Mode.AttendedGrind)
                {
                    await new WowProcess(logger).KeyPress(ConsoleKey.Tab, 420);
                }
            }

            return(CurrentGoal);
        }
Beispiel #2
0
        private async Task <bool> LookForTarget()
        {
            if (this.playerReader.HasTarget && !blacklist.IsTargetBlacklisted())
            {
                return(true);
            }
            else
            {
                await this.wowProcess.KeyPress(ConsoleKey.Tab, 300);

                await Task.Delay(300);

                if (!playerReader.HasTarget)
                {
                    await this.npcNameFinder.FindAndClickNpc(0);

                    //await Task.Delay(300);
                }
            }

            if (this.playerReader.HasTarget && !blacklist.IsTargetBlacklisted())
            {
                if (playerReader.PlayerBitValues.IsMounted)
                {
                    await wowProcess.Dismount();
                }
                await this.TapInteractKey("FollowRouteAction 4");

                return(true);
            }
            return(false);
        }
Beispiel #3
0
        private async Task <bool> LookForTarget(string source, CancellationToken cancellationToken)
        {
            if (playerReader.HasTarget && !playerReader.Bits.TargetIsDead && !blacklist.IsTargetBlacklisted())
            {
                return(true);
            }
            else
            {
                if (!cancellationToken.IsCancellationRequested)
                {
                    npcNameTargeting.ChangeNpcType(NpcNameToFind);
                    await input.TapNearestTarget(source);
                }
                if (!classConfig.KeyboardOnly)
                {
                    if (!playerReader.HasTarget && !cancellationToken.IsCancellationRequested)
                    {
                        npcNameTargeting.ChangeNpcType(NpcNameToFind);
                        if (npcNameTargeting.NpcCount > 0 && !cancellationToken.IsCancellationRequested)
                        {
                            await npcNameTargeting.TargetingAndClickNpc(true, cancellationToken);

                            if (!cancellationToken.IsCancellationRequested)
                            {
                                await wait.Update(1);
                            }
                        }
                    }
                }
            }

            return(!cancellationToken.IsCancellationRequested && playerReader.HasTarget && !blacklist.IsTargetBlacklisted());
        }
Beispiel #4
0
        private async Task <bool> LookForTarget()
        {
            if (this.playerReader.HasTarget && !this.playerReader.PlayerBitValues.TargetIsDead && !blacklist.IsTargetBlacklisted())
            {
                return(true);
            }
            else
            {
                await input.TapNearestTarget();

                if (!playerReader.HasTarget)
                {
                    npcNameFinder.ChangeNpcType(NpcNameFinder.NPCType.Enemy);
                    if (npcNameFinder.NpcCount > 0)
                    {
                        await this.npcNameFinder.FindAndClickNpc(0, true);
                    }
                }
            }

            if (this.playerReader.HasTarget && !blacklist.IsTargetBlacklisted())
            {
                if (playerReader.PlayerBitValues.IsMounted)
                {
                    //await wowProcess.Dismount();
                }
                await input.TapInteractKey("FollowRouteAction 4");

                return(true);
            }
            return(false);
        }
        public async Task <GoapGoal?> GetAction()
        {
            if (playerReader.HealthPercent > 1 && blacklist.IsTargetBlacklisted())
            {
                logger.LogWarning($"{GetType().Name}: Target is blacklisted - StopAttack & ClearTarget");
                await input.TapStopAttack("");

                await input.TapClearTarget("");

                UpdateWorldState();
            }

            var goal = new HashSet <KeyValuePair <GoapKey, GoapPreCondition> >();

            //Plan
            Queue <GoapGoal> plan = planner.Plan(AvailableGoals, WorldState, goal);

            if (plan != null && plan.Count > 0)
            {
                if (CurrentGoal == plan.Peek() && !CurrentGoal.Repeatable)
                {
                    logger.LogInformation($"Plan= {CurrentGoal.GetType().Name} is not Repeatable!");
                    CurrentGoal = null;
                }
                else
                {
                    CurrentGoal = plan.Peek();
                }
            }
            else
            {
                if (CurrentGoal != null && !CurrentGoal.Repeatable)
                {
                    logger.LogInformation($"Plan= {CurrentGoal.GetType().Name} is not Repeatable!");
                    CurrentGoal = null;

                    await stopMoving.Stop();
                }
            }

            return(CurrentGoal);
        }