public FollowRouteGoal(ILogger logger, ConfigurableInput input, Wait wait, AddonReader addonReader, IPlayerDirection playerDirection, List <WowPoint> points, StopMoving stopMoving, NpcNameFinder npcNameFinder, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, MountHandler mountHandler, TargetFinder targetFinder)
        {
            this.logger = logger;
            this.input  = input;

            this.wait            = wait;
            this.addonReader     = addonReader;
            this.playerReader    = addonReader.PlayerReader;
            this.playerDirection = playerDirection;
            this.stopMoving      = stopMoving;

            this.pointsList = points;

            this.npcNameFinder = npcNameFinder;

            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;
            this.mountHandler       = mountHandler;
            this.targetFinder       = targetFinder;

            MinDistance = !(pather is RemotePathingAPIV3) ? 15 : 8;

            if (classConfiguration.Mode != Mode.AttendedGather)
            {
                AddPrecondition(GoapKey.incombat, false);
                AddPrecondition(GoapKey.producedcorpse, false);
                AddPrecondition(GoapKey.consumecorpse, false);
            }
        }
        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();
        }
Example #3
0
        public AdhocNPCGoal(ILogger logger, ConfigurableInput input, AddonReader addonReader, IPlayerDirection playerDirection, StopMoving stopMoving, NpcNameTargeting npcNameTargeting, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key, IBlacklist blacklist, MountHandler mountHandler, Wait wait, ExecGameCommand exec)
        {
            this.logger           = logger;
            this.input            = input;
            this.addonReader      = addonReader;
            this.playerReader     = addonReader.PlayerReader;
            this.playerDirection  = playerDirection;
            this.stopMoving       = stopMoving;
            this.npcNameTargeting = npcNameTargeting;

            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;
            this.key          = key;
            this.blacklist    = blacklist;
            this.mountHandler = mountHandler;

            this.wait            = wait;
            this.execGameCommand = exec;
            this.gossipReader    = addonReader.GossipReader;

            if (key.InCombat == "false")
            {
                AddPrecondition(GoapKey.incombat, false);
            }
            else if (key.InCombat == "true")
            {
                AddPrecondition(GoapKey.incombat, true);
            }

            this.Keys.Add(key);
        }
Example #4
0
        public AdhocNPCGoal(ILogger logger, ConfigurableInput input, PlayerReader playerReader, IPlayerDirection playerDirection, StopMoving stopMoving, NpcNameFinder npcNameFinder, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key, IBlacklist blacklist)
        {
            this.logger          = logger;
            this.input           = input;
            this.playerReader    = playerReader;
            this.playerDirection = playerDirection;
            this.stopMoving      = stopMoving;
            this.npcNameFinder   = npcNameFinder;

            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;
            this.key       = key;
            this.blacklist = blacklist;

            if (key.InCombat == "false")
            {
                AddPrecondition(GoapKey.incombat, false);
            }
            else if (key.InCombat == "true")
            {
                AddPrecondition(GoapKey.incombat, true);
            }

            this.Keys.Add(key);
        }
Example #5
0
 public GoalFactory(AddonReader addonReader, ILogger logger, WowProcess wowProcess, NpcNameFinder npcNameFinder, IPPather pather)
 {
     this.logger        = logger;
     this.addonReader   = addonReader;
     this.NpcNameFinder = npcNameFinder;
     this.wowProcess    = wowProcess;
     this.pather        = pather;
 }
Example #6
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;
 }
        public NPCGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, BagReader bagReader)
        {
            this.playerReader    = playerReader;
            this.wowProcess      = wowProcess;
            this.playerDirection = playerDirection;
            this.stopMoving      = stopMoving;
            this.bagReader       = bagReader;

            this.logger             = logger;
            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;
        }
        public WalkToCorpseGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, List <WowPoint> spiritWalker, List <WowPoint> routePoints, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, IPPather pather)
        {
            this.playerReader     = playerReader;
            this.wowProcess       = wowProcess;
            this.playerDirection  = playerDirection;
            this.stopMoving       = stopMoving;
            this.routePoints      = routePoints.ToList();
            this.spiritWalkerPath = spiritWalker.ToList();
            this.logger           = logger;
            this.stuckDetector    = stuckDetector;
            this.pather           = pather;

            AddPrecondition(GoapKey.isdead, true);
        }
        public WalkToCorpseGoal(ILogger logger, ConfigurableInput input, PlayerReader playerReader, IPlayerDirection playerDirection, List <WowPoint> spiritWalker, List <WowPoint> routePoints, StopMoving stopMoving, StuckDetector stuckDetector, IPPather pather)
        {
            this.logger = logger;
            this.input  = input;

            this.playerReader     = playerReader;
            this.playerDirection  = playerDirection;
            this.stopMoving       = stopMoving;
            this.routePoints      = routePoints.ToList();
            this.spiritWalkerPath = spiritWalker.ToList();

            this.stuckDetector = stuckDetector;
            this.pather        = pather;

            AddPrecondition(GoapKey.isdead, true);
        }
Example #11
0
        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();
        }
Example #12
0
        public FollowRouteGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, List <WowPoint> points, StopMoving stopMoving, NpcNameFinder npcNameFinder, IBlacklist blacklist, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather)
        {
            this.playerReader    = playerReader;
            this.wowProcess      = wowProcess;
            this.playerDirection = playerDirection;
            this.stopMoving      = stopMoving;

            this.pointsList = points;

            this.npcNameFinder      = npcNameFinder;
            this.blacklist          = blacklist;
            this.logger             = logger;
            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;

            if (classConfiguration.Mode != Mode.AttendedGather)
            {
                AddPrecondition(GoapKey.incombat, false);
            }
        }
Example #13
0
        public AdhocNPCGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, KeyAction key)
        {
            this.playerReader       = playerReader;
            this.wowProcess         = wowProcess;
            this.playerDirection    = playerDirection;
            this.stopMoving         = stopMoving;
            this.logger             = logger;
            this.stuckDetector      = stuckDetector;
            this.classConfiguration = classConfiguration;
            this.pather             = pather;
            this.key = key;

            if (key.InCombat == "false")
            {
                AddPrecondition(GoapKey.incombat, false);
            }
            else if (key.InCombat == "true")
            {
                AddPrecondition(GoapKey.incombat, true);
            }

            this.Keys.Add(key);
        }
        public VendorGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, BagReader bagReader)
            : base(playerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfiguration, pather, bagReader)
        {
            AddPrecondition(GoapKey.incombat, false);

            var action = new KeyAction();

            this.Keys.Add(action);

            action.RequirementObjects.Add(
                new Requirement
            {
                HasRequirement = () => this.bagReader.BagItems.Count >= this.classConfiguration.VendorItemThreshold,
                LogMessage     = () => $"Bag items {this.bagReader.BagItems.Count} >= {this.classConfiguration.VendorItemThreshold}"
            }
                );
        }
 public RepairGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration, IPPather pather, BagReader bagReader)
     : base(playerReader, wowProcess, playerDirection, stopMoving, logger, stuckDetector, classConfiguration, pather, bagReader)
 {
     AddPrecondition(GoapKey.incombat, false);
     AddPrecondition(GoapKey.itemsbroken, true);
 }