コード例 #1
0
        public override async Task PerformAction()
        {
            lastLoot = playerReader.LastLootTime;

            await stopMoving.Stop();

            combatUtil.Update();

            Log($"Try to find {NpcNames.Corpse}");
            await npcNameTargeting.WaitForNUpdate(1);

            int attempts = 1;

            while (attempts < 5)
            {
                if (await combatUtil.EnteredCombat())
                {
                    if (await combatUtil.AquiredTarget())
                    {
                        Log("Interrupted!");
                        return;
                    }
                }

                bool foundCursor = await npcNameTargeting.FindBy(CursorType.Skin);

                if (foundCursor)
                {
                    Log("Found corpse - interacted with right click");
                    await wait.Update(1);

                    (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved();

                    if (foundTarget)
                    {
                        Log("Interrupted!");
                        return;
                    }

                    if (moved)
                    {
                        await input.TapInteractKey($"{GetType().Name}: Had to move so interact again");

                        await wait.Update(1);
                    }

                    // wait until start casting
                    await wait.Interrupt(500, () => playerReader.IsCasting);

                    Log("Started casting...");

                    playerReader.LastUIErrorMessage = UI_ERROR.NONE;

                    await wait.Interrupt(3000, () => !playerReader.IsCasting || playerReader.LastUIErrorMessage != UI_ERROR.NONE);

                    Log("Cast finished!");

                    if (playerReader.LastUIErrorMessage != UI_ERROR.ERR_SPELL_FAILED_S)
                    {
                        playerReader.LastUIErrorMessage = UI_ERROR.NONE;
                        Log($"Skinning Successful! {playerReader.LastUIErrorMessage}");
                        await GoalExit();

                        return;
                    }
                    else
                    {
                        Log($"Skinning Failed! Retry... Attempts: {attempts}");
                        attempts++;
                    }
                }
                else
                {
                    Log($"Target is not skinnable - NPC Count: {npcNameTargeting.NpcCount}");
                    await GoalExit();

                    return;
                }
            }
        }
コード例 #2
0
        public override async Task PerformAction()
        {
            lastLoot = playerReader.LastLootTime;

            await stopMoving.Stop();

            combatUtil.Update();

            await npcNameTargeting.WaitForNUpdate(2);

            bool foundCursor = await npcNameTargeting.FindBy(CursorType.Loot);

            if (foundCursor)
            {
                Log("Found corpse - clicked");
                (bool notFoundTarget, double elapsedMs) = await wait.InterruptTask(200, () => playerReader.TargetId != 0);

                if (!notFoundTarget)
                {
                    Log($"Found target after {elapsedMs}ms");
                }

                CheckForSkinning();

                (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved();

                if (foundTarget)
                {
                    Log("Interrupted!");
                    return;
                }

                if (moved)
                {
                    await input.TapInteractKey($"{GetType().Name}: Had to move so interact again");

                    await wait.Update(1);
                }
            }
            else
            {
                await input.TapLastTargetKey($"{GetType().Name}: No corpse name found - check last dead target exists");

                await wait.Update(1);

                if (playerReader.HasTarget)
                {
                    if (playerReader.Bits.TargetIsDead)
                    {
                        CheckForSkinning();

                        await input.TapInteractKey($"{GetType().Name}: Found last dead target");

                        await wait.Update(1);

                        (bool foundTarget, bool moved) = await combatUtil.FoundTargetWhileMoved();

                        if (foundTarget)
                        {
                            Log("Goal interrupted!");
                            return;
                        }

                        if (moved)
                        {
                            await input.TapInteractKey($"{GetType().Name}: Last dead target double");
                        }
                    }
                    else
                    {
                        await input.TapClearTarget($"{GetType().Name}: Don't attack the target!");
                    }
                }
            }

            await GoalExit();
        }