public async Task Execute()
        {
            wowProcessInput.SetForegroundWindow();

            wowProcessInput.SetCursorPosition(new Point(25, 25));
            await Task.Delay(500);

            wowProcessInput.SetCursorPosition(new Point(50, 50));
            await Task.Delay(500);

            await Task.Delay(500);

            var p = new Point(120, 120);
            await wowProcessInput.LeftClickMouse(p);

            await Task.Delay(500);

            await wowProcessInput.RightClickMouse(p);

            await Task.Delay(500);

            await wowProcessInput.RightClickMouse(p);

            wowScreen.GetRectangle(out var rect);
            p = new Point(rect.Width / 3, rect.Height / 5);

            await Task.Delay(500);

            await wowProcessInput.RightClickMouse(p);

            await Task.Delay(500);

            await wowProcessInput.RightClickMouse(p);

            logger.LogInformation("Finished");
        }
Exemplo n.º 2
0
        private async Task <bool> CheckForLoot(Point mousePosition, bool searchForMobs, bool ignoreMobs)
        {
            var inCombat = this.playerReader.PlayerBitValues.PlayerInCombat;

            Classification = CursorClassification.None;
            await Task.Delay(30);

            CursorClassifier.Classify(out var cls).Dispose();

            if (searchForMobs)
            {
                if (cls == CursorClassification.Kill)
                {
                    await Task.Delay(100);

                    CursorClassifier.Classify(out cls).Dispose();
                }
            }
            else
            {
                // found something, lets give the cursor a chance to update.
                if (cls == CursorClassification.Loot || cls == CursorClassification.Kill || cls == CursorClassification.Skin)
                {
                    await Task.Delay(200);

                    CursorClassifier.Classify(out cls).Dispose();
                }
            }

            if (cls == CursorClassification.Loot && !searchForMobs)
            {
                Log("Found: " + cls.ToString());
                await input.RightClickMouse(mousePosition);

                Classification = cls;
                await Task.Delay(500);
                await Wait(2000, inCombat);
            }

            if (cls == CursorClassification.Skin && !searchForMobs)
            {
                Log("Found: " + cls.ToString());
                await input.RightClickMouse(mousePosition);

                Classification = cls;
                await Task.Delay(1000);
                await Wait(6000, inCombat);
            }

            if (cls == CursorClassification.Kill && !ignoreMobs)
            {
                Log("Found: " + cls.ToString());
                await input.RightClickMouse(mousePosition);

                Classification = cls;
            }

            if (cls == CursorClassification.Loot || cls == CursorClassification.Skin)
            {
                lastLootFoundAt = mousePosition;
                logger.LogInformation($"Loot found at {this.lastLootFoundAt.X},{this.lastLootFoundAt.Y}");
            }

            if (searchForMobs)
            {
                return(cls == CursorClassification.Kill);
            }

            return(cls == CursorClassification.Loot || cls == CursorClassification.Skin || cls == CursorClassification.Kill);
        }