Example #1
0
        public BotController(ILogger logger)
        {
            wowProcess     = new WowProcess(logger);
            this.WowScreen = new WowScreen(logger);
            this.logger    = logger;

            var frames = DataFrameConfiguration.ConfigurationExists()
                ? DataFrameConfiguration.LoadConfiguration()
                : new List <DataFrame>(); //config.CreateConfiguration(WowScreen.GetAddonBitmap());

            AddonReader = new AddonReader(WowScreen, frames, logger);

            addonThread = new Thread(AddonRefreshThread);
            addonThread.Start();

            // wait for addon to read the wow state
            while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass))
            {
                logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?");
                Thread.Sleep(100);
            }

            npcNameFinder = new NpcNameFinder(wowProcess, AddonReader.PlayerReader, logger);
            ActionFactory = new ActionFactory(AddonReader, logger, wowProcess, npcNameFinder);

            screenshotThread = new Thread(ScreenshotRefreshThread);
            screenshotThread.Start();
        }
Example #2
0
 public GoalFactory(AddonReader addonReader, ILogger logger, WowProcess wowProcess, NpcNameFinder npcNameFinder)
 {
     this.logger        = logger;
     this.addonReader   = addonReader;
     this.NpcNameFinder = npcNameFinder;
     this.wowProcess    = wowProcess;
 }
        public BotController(ILogger logger, IPPather pather)
        {
            wowProcess = new WowProcess(logger);
            wowProcess.KeyPress(ConsoleKey.F3, 400).Wait(); // clear target
            this.WowScreen = new WowScreen(logger);
            this.logger    = logger;
            this.pather    = pather;

            var frames = DataFrameConfiguration.ConfigurationExists()
                ? DataFrameConfiguration.LoadConfiguration()
                : new List <DataFrame>(); //config.CreateConfiguration(WowScreen.GetAddonBitmap());

            AddonReader = new AddonReader(WowScreen, frames, logger);

            minimapNodeFinder  = new MinimapNodeFinder(new PixelClassifier());
            MinimapImageFinder = minimapNodeFinder as IImageProvider;

            addonThread = new Thread(AddonRefreshThread);
            addonThread.Start();

            // wait for addon to read the wow state
            var sw = new Stopwatch();

            sw.Start();
            while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass))
            {
                if (sw.ElapsedMilliseconds > 5000)
                {
                    logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?");
                    sw.Restart();
                }
                Thread.Sleep(100);
            }

            logger.LogDebug($"Woohoo, I have read the player class. You are a {AddonReader.PlayerReader.PlayerClass}.");

            npcNameFinder = new NpcNameFinder(wowProcess, AddonReader.PlayerReader, logger);
            //ActionFactory = new GoalFactory(AddonReader, logger, wowProcess, npcNameFinder);

            screenshotThread = new Thread(ScreenshotRefreshThread);
            screenshotThread.Start();
        }