コード例 #1
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;
        }
コード例 #2
0
        public override async Task PerformAction()
        {
            await wowProcess.KeyPress(ConsoleKey.F9, 100); // stand

            await stopMoving.Stop();

            if (await AmIBeingTargetted())
            {
                return;
            }

            var healthAtStartOfLooting = playerReader.HealthPercent;

            var outOfCombat = !playerReader.PlayerBitValues.PlayerInCombat;

            bool searchForMobs = playerReader.PlayerBitValues.PlayerInCombat;
            var  lootAttempt   = 0;

            while (lootAttempt < 10)
            {
                if (await CheckIfEnterredCombat())
                {
                    return;
                }

                Log(searchForMobs ? "Searching for mobs" : $"Looting (attempt: {lootAttempt + 1}.");
                var foundSomething = await lootWheel.Loot(searchForMobs, doExtendedLootSearch || foundAddWhileLooting);

                if (foundSomething && lootWheel.Classification == Cursor.CursorClassification.Kill)
                {
                    await AquireTarget();

                    return;
                }

                if (!foundSomething && !searchForMobs)
                {
                    lootAttempt          = 10;
                    foundAddWhileLooting = false;
                    doExtendedLootSearch = false;
                }
                else
                {
                    doExtendedLootSearch = false;
                    if (searchForMobs)
                    {
                        searchForMobs = false;
                    }
                    else
                    {
                        if (lootWheel.Classification == Cursor.CursorClassification.Kill)
                        {
                            foundAddWhileLooting = true;
                            await this.TapInteractKey("LootAction");

                            Log($"Kill something !");
                            return;
                        }
                        else
                        {
                            if (healthAtStartOfLooting > playerReader.HealthPercent && playerReader.PlayerBitValues.PlayerInCombat)
                            {
                                Log($"Losing health and still in combat !");
                                return;
                            }

                            Log($"Looted {lootWheel.Classification}");
                        }
                    }
                }

                lootAttempt++;
            }

            SendActionEvent(new ActionEventArgs(GoapKey.shouldloot, false));
            SendActionEvent(new ActionEventArgs(GoapKey.postloot, true));
        }