public BotController(ILogger logger, IPPather pather, DataConfig dataConfig, IConfiguration configuration)
        {
            this.logger     = logger;
            this.pather     = pather;
            this.DataConfig = dataConfig;
            this.areaDb     = new AreaDB(logger, dataConfig);

            updatePlayerPostion.Start();
            wowProcess      = new WowProcess();
            WowScreen       = new WowScreen(logger, wowProcess);
            WowProcessInput = new WowProcessInput(logger, wowProcess);

            var frames = DataFrameConfiguration.LoadFrames();

            var scad = new StartupConfigAddonData();

            configuration.GetSection(StartupConfigAddonData.Position).Bind(scad);
            if (scad.Mode == "Network")
            {
                logger.LogInformation("Using NetworkedAddonDataProvider");
                addonDataProvider = new NetworkedAddonDataProvider(logger, scad.myPort, scad.connectTo, scad.connectPort);
            }
            else
            {
                logger.LogInformation("Using AddonDataProvider");
                addonDataProvider = new AddonDataProvider(WowScreen, frames);
            }

            AddonReader = new AddonReader(logger, DataConfig, areaDb, addonDataProvider);

            minimapNodeFinder  = new MinimapNodeFinder(WowScreen, 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(logger, WowScreen, WowProcessInput);
            WowScreen.AddDrawAction(npcNameFinder.ShowNames);

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

            screenshotThread = new Thread(ScreenshotRefreshThread);
            screenshotThread.Start();
        }
Beispiel #2
0
 public GoalFactory(ILogger logger, AddonReader addonReader, ConfigurableInput input, DataConfig dataConfig, NpcNameFinder npcNameFinder, IPPather pather)
 {
     this.logger        = logger;
     this.addonReader   = addonReader;
     this.input         = input;
     this.dataConfig    = dataConfig;
     this.npcNameFinder = npcNameFinder;
     this.pather        = pather;
 }
 public GoalFactory(ILogger logger, AddonReader addonReader, ConfigurableInput input, DataConfig dataConfig, NpcNameFinder npcNameFinder, NpcNameTargeting npcNameTargeting, IPPather pather, ExecGameCommand execGameCommand)
 {
     this.logger           = logger;
     this.addonReader      = addonReader;
     this.input            = input;
     this.dataConfig       = dataConfig;
     this.npcNameFinder    = npcNameFinder;
     this.npcNameTargeting = npcNameTargeting;
     this.pather           = pather;
     this.exec             = execGameCommand;
 }