コード例 #1
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);
        }
コード例 #2
0
        public override async Task PerformAction()
        {
            if (this.Keys.Any(k => k.StopBeforeCast))
            {
                await this.stopMoving.Stop();

                if (playerReader.PlayerBitValues.IsMounted)
                {
                    await wowProcess.Dismount();
                }
                await Task.Delay(1000);
            }

            this.Keys.ForEach(async key =>
            {
                var pressed = await this.castingHandler.CastIfReady(key, this);
                key.ResetCooldown();
                key.SetClicked();
            });

            bool wasDrinkingOrEating = this.playerReader.Buffs.Drinking || this.playerReader.Buffs.Eating;

            int seconds = 0;

            while ((this.playerReader.Buffs.Drinking || this.playerReader.Buffs.Eating || this.playerReader.IsCasting) && !this.playerReader.PlayerBitValues.PlayerInCombat)
            {
                await Task.Delay(1000);
                seconds++;
                this.logger.LogInformation($"Waiting for {Name}");

                if (this.playerReader.Buffs.Drinking && this.playerReader.Buffs.Eating)
                {
                    if (this.playerReader.ManaPercentage > 98 && this.playerReader.HealthPercent > 98) { break; }
                }
                else if (this.playerReader.Buffs.Drinking)
                {
                    if (this.playerReader.ManaPercentage > 98) { break; }
                }
                else if (this.playerReader.Buffs.Eating)
                {
                    if (this.playerReader.HealthPercent > 98) { break; }
                }

                if (seconds > 25)
                {
                    this.logger.LogInformation($"Waited long enough for {Name}");
                    break;
                }
            }

            if (wasDrinkingOrEating)
            {
                await wowProcess.TapStopKey(); // stand up
            }
        }
コード例 #3
0
        public override async Task PerformAction()
        {
            if (playerReader.PlayerBitValues.IsMounted)
            {
                await wowProcess.Dismount();
            }

            if (HasPickedUpAnAdd)
            {
                logger.LogInformation($"Add on combat");
                await this.stopMoving.Stop();

                await wowProcess.TapStopKey();

                await wowProcess.KeyPress(ConsoleKey.F3, 300); // clear target

                return;
            }

            if ((DateTime.Now - lastActive).TotalSeconds > 5 && (DateTime.Now - lastPulled).TotalSeconds > 5)
            {
                logger.LogInformation("Interact and stop");
                await this.castingHandler.TapInteractKey("CombatActionBase PerformAction");

                await this.castingHandler.PressKey(ConsoleKey.UpArrow, "", 57);
            }

            await stopMoving.Stop();

            SendActionEvent(new ActionEventArgs(GoapKey.fighting, true));

            await this.castingHandler.InteractOnUIError();

            await Fight();

            lastActive = DateTime.Now;
        }
コード例 #4
0
        public override async Task PerformAction()
        {
            await this.wowProcess.KeyPress(ConsoleKey.F10, 300);

            this.playerReader.LastUIErrorMessage = UI_ERROR.NONE;

            if ((DateTime.Now - LastActive).TotalSeconds > 5)
            {
                PullStartTime = DateTime.Now;
            }
            LastActive = DateTime.Now;

            if ((DateTime.Now - PullStartTime).TotalSeconds > 30)
            {
                await wowProcess.KeyPress(ConsoleKey.F3, 300); // clear target

                await this.wowProcess.KeyPress(ConsoleKey.RightArrow, 1000, "Turn after pull timeout");

                return;
            }

            SendActionEvent(new ActionEventArgs(GoapKey.fighting, true));

            if (playerReader.PlayerBitValues.IsMounted)
            {
                logger.LogInformation($"Dismount");
                await wowProcess.Dismount();
            }

            if (ShouldStopBeforePull)
            {
                logger.LogInformation($"Stop approach");
                await this.stopMoving.Stop();
                await Interact();

                await wowProcess.TapStopKey();
            }

            bool pulled = await Pull();

            if (!pulled)
            {
                if (HasPickedUpAnAdd)
                {
                    logger.LogInformation($"Add on approach");
                    await this.stopMoving.Stop();

                    await wowProcess.TapStopKey();

                    await wowProcess.KeyPress(ConsoleKey.F3, 300); // clear target

                    return;
                }

                if (!this.stuckDetector.IsMoving())
                {
                    await this.stuckDetector.Unstick();
                }

                await Interact();

                await Task.Delay(501);
            }
            else
            {
                this.SendActionEvent(new ActionEventArgs(GoapKey.pulled, true));
                this.playerReader.LastUIErrorMessage = UI_ERROR.NONE;
            }
        }
コード例 #5
0
        public override async Task PerformAction()
        {
            if (playerReader.PlayerBitValues.IsMounted)
            {
                await wowProcess.Dismount();
            }

            if (NeedsToReset)
            {
                this.stuckDetector.ResetStuckParameters();
            }

            var location = playerReader.PlayerLocation;

            if (!playerReader.PlayerBitValues.PlayerInCombat)
            {
                playerWasInCombat = false;
            }
            else
            {
                // we are in combat
                if (!playerWasInCombat && HasPickedUpAnAdd)
                {
                    logger.LogInformation("Looks like we have an add on approach");
                    await this.stopMoving.Stop();

                    await wowProcess.TapStopKey();

                    await wowProcess.KeyPress(ConsoleKey.F3, 400); // clear target

                    return;
                }
                playerWasInCombat = true;
            }

            await this.TapInteractKey("ApproachTargetAction 1");

            await Task.Delay(500);

            var newLocation = playerReader.PlayerLocation;

            if ((location.X == newLocation.X && location.Y == newLocation.Y && SecondsSinceLastFighting > 5) || this.playerReader.LastUIErrorMessage == UI_ERROR.ERR_AUTOFOLLOW_TOO_FAR)
            {
                wowProcess.SetKeyState(ConsoleKey.UpArrow, true, false, "ApproachTargetAction");
                await Task.Delay(2000);

                await wowProcess.KeyPress(ConsoleKey.Spacebar, 498);

                this.playerReader.LastUIErrorMessage = UI_ERROR.NONE;
            }
            await RandomJump();

            int approachSeconds = (int)(this.stuckDetector.actionDurationSeconds);

            if (approachSeconds > 20)
            {
                await this.stuckDetector.Unstick();

                await this.TapInteractKey("ApproachTargetAction unstick");

                await Task.Delay(500);
            }
        }