public ActionBarPopulator(ILogger logger, ClassConfiguration config, AddonReader addonReader, ExecGameCommand execGameCommand)
 {
     this.logger          = logger;
     this.config          = config;
     this.addonReader     = addonReader;
     this.execGameCommand = execGameCommand;
 }
 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;
 }
Exemple #3
0
        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);

            ExecGameCommand = new ExecGameCommand(logger, WowProcessInput);

            GrindSessionHandler = new LocalGrindSessionHandler(dataConfig.History);
            GrindSession        = new GrindSession(this, GrindSessionHandler);


            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.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.Class))
            {
                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.Race} {AddonReader.PlayerReader.Class}.");

            npcNameFinder    = new NpcNameFinder(logger, WowScreen);
            npcNameTargeting = new NpcNameTargeting(logger, npcNameFinder, WowProcessInput);
            WowScreen.AddDrawAction(npcNameFinder.ShowNames);
            WowScreen.AddDrawAction(npcNameTargeting.ShowClickPositions);

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

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