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(); }
public ManagedAmeisenBot(WowProcess wowProcess, WowAccount wowAccount, AmeisenBot ameisenBot) { WowProcess = wowProcess; WowAccount = wowAccount; AmeisenBot = ameisenBot; StartState = BotStartState.None; }
public override void Enter() { WowProcess = Process.Start(Config.PathToWowExe); WowProcess.WaitForInputIdle(); Thread.Sleep(1000); XMemory.Attach(WowProcess); }
public AddonConfigurator(ILogger logger, AddonConfig addonConfig) { this.logger = logger; this.addonConfig = addonConfig; this.wowProcess = new WowProcess(); }
private static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(new FileStream("log4net.config", FileMode.Open)); int strikeValue = 7; var pixelClassifier = new PixelClassifier(); if (args.Contains("blue")) { Console.WriteLine("Blue mode"); pixelClassifier.Mode = PixelClassifier.ClassifierMode.Blue; } pixelClassifier.SetConfiguration(WowProcess.IsWowClassic()); var bobberFinder = new SearchBobberFinder(pixelClassifier); var biteWatcher = new PositionBiteWatcher(strikeValue); var bot = new FishingBot(bobberFinder, biteWatcher, ConsoleKey.D4, new List <ConsoleKey> { ConsoleKey.D5 }); bot.FishingEventHandler += (b, e) => LogManager.GetLogger("Fishbot").Info(e); WowProcess.PressKey(ConsoleKey.Spacebar); System.Threading.Thread.Sleep(1500); bot.Start(); }
public ActionThread(PlayerReader playerReader, WowProcess wowProcess, GoapAgent goapAgent, ILogger logger) { this.playerReader = playerReader; this.wowProcess = wowProcess; this.goapAgent = goapAgent; this.logger = logger; }
static void Main(string[] args) { int port = 9050; Parser.Default.ParseArguments <Options>(args) .WithParsed(o => { if (o.Port != 0) { port = o.Port; } }); CreateLogger(); WaitForProcess(); var wowProcess = new WowProcess(); var wowScreen = new WowScreen(logger, wowProcess); if (!DataFrameConfiguration.Exists()) { Log.Logger.Error("DataFrameConfiguration not exists"); CreateConfig(wowScreen); } else { var frames = DataFrameConfiguration.LoadFrames(); IDataProvider provider = new DataProvider(logger, wowScreen, frames); Server server = new Server(logger, port, provider); server.ListenServer(); } }
/// <summary> /// Check if you are logged into the WoW game /// </summary> public static bool CheckInGame() { try { WowProcess.ReadUInt(WowProcess.ReadUInt(WowProcess.ReadUInt( DataManager.CurWoWVersion.Globals.GameOffset) + DataManager.CurWoWVersion.Globals.PlayerBaseOffset1) + DataManager.CurWoWVersion.Globals.PlayerBaseOffset2); // Read successful. Check if we need initialize if ((_gstatus != GameStatuses.INITIALIZED) && (_gstatus != GameStatuses.DISCONNECTED)) { GameStatus = GameStatuses.ENTERING_WORLD; InitializeBot(); } // Means no exception, we might be actually not in game yet or already initialized return(true); } catch (Exception ex) { if (InGame) { Error("char", "CheckInGame() - caugth exception. See error log for details."); Error("errors", "CheckInGame() - ", ex); GameStatus = GameStatuses.DISCONNECTED; } return(false); } }
public TargetDeadGoal(WowProcess wowProcess, ILogger logger) { this.wowProcess = wowProcess; this.logger = logger; AddPrecondition(GoapKey.hastarget, true); AddPrecondition(GoapKey.targetisalive, false); }
public ActionBarPopulator(ILogger logger, WowProcess wowProcess, WowProcessInput wowProcessInput, ClassConfiguration config, AddonReader addonReader) { this.logger = logger; this.wowProcess = wowProcess; this.wowProcessInput = wowProcessInput; this.config = config; this.addonReader = addonReader; }
internal static float AngleHorizontal(WowProcess process, WowPoint point) { WoWPlayerMe me = ObjectMgr.Pulse(process); var angle = Convert.ToSingle(Math.Atan2(Convert.ToDouble(point.Y) - Convert.ToDouble(me.Location.Y), Convert.ToDouble(point.X) - Convert.ToDouble(me.Location.X))); angle = NegativeAngle(angle); return(angle); }
private static void WaitForProcess() { while (WowProcess.Get() == null) { Log.Information("Unable to find the Wow process is it running ?"); Thread.Sleep(1000); } }
public WowView(WowProcess process) { WowProcess = process; InitializeComponent(); UpdateView(); }
public Test_MouseClicks(ILogger logger) { this.logger = logger; wowProcess = new WowProcess(); wowScreen = new WowScreen(logger, wowProcess); wowProcessInput = new WowProcessInput(logger, wowProcess); }
private static void TrayContextMenu_PluginClicked(IPlugin plugin) { comboBoxWowPlugins.SelectedIndex = PluginManager.Plugins.IndexOf(plugin); if (!WoWManager.Hooked && WowProcess.GetAllWowProcesses().Count != 1) { Activate(); } SwitchWoWPlugin(); }
internal WowObject(IntPtr address, WowProcess wow) : base(wow) { Address = address; var inf = memory.Read <WoWObjectsInfo>(Address); GUID = inf.GUID; Bobbing = inf.Bobbing == 1; Location = inf.Location; }
public CastingHandler(WowProcess wowProcess, PlayerReader playerReader, ILogger logger, ClassConfiguration classConfiguration, IPlayerDirection direction, NpcNameFinder npcNameFinder) { this.wowProcess = wowProcess; this.playerReader = playerReader; this.logger = logger; this.classConfiguration = classConfiguration; this.direction = direction; this.npcNameFinder = npcNameFinder; }
public WrongZoneAction(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration) { this.playerReader = playerReader; this.wowProcess = wowProcess; this.playerDirection = playerDirection; this.logger = logger; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; AddPrecondition(GoapKey.incombat, false); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false);; var proc = Process.GetProcessesByName("wow").FirstOrDefault(); var wowProc = new WowProcess(proc); Application.Run(new Main(wowProc)); }
public LootGoal(WowProcess wowProcess, PlayerReader playerReader, BagReader bagReader, StopMoving stopMoving, ILogger logger, ClassConfiguration classConfiguration) { this.wowProcess = wowProcess; this.playerReader = playerReader; this.stopMoving = stopMoving; this.bagReader = bagReader; this.logger = logger; this.classConfiguration = classConfiguration; lootWheel = new LootWheel(wowProcess, playerReader, logger); }
public TargetDeadAction(WowProcess wowProcess, PlayerReader playerReader, NpcNameFinder npcFinder, ILogger logger) { this.wowProcess = wowProcess; this.playerReader = playerReader; this.npcFinder = npcFinder; this.logger = logger; lootWheel = new LootWheel(wowProcess, playerReader, logger); AddPrecondition(GoapKey.hastarget, true); AddPrecondition(GoapKey.targetisalive, false); }
private static bool TryGetNextObject(WowProcess wow, IntPtr address, out IntPtr nextAddress) { nextAddress = wow.Memory.Read <IntPtr>(address + WowBuildInfoX64.ObjectManagerNextObject); if (IsWin10) { return(nextAddress != IntPtr.Zero && (ulong)nextAddress < 0xFF00000000000000); } else { return(nextAddress != IntPtr.Zero && (ulong)nextAddress < (ulong)uint.MaxValue * 2); } }
public ParallelGoal(WowProcess wowProcess, PlayerReader playerReader, StopMoving stopMoving, List<KeyAction> keysConfig, CastingHandler castingHandler, ILogger logger) { this.wowProcess = wowProcess; this.stopMoving = stopMoving; this.playerReader = playerReader; this.logger = logger; this.castingHandler = castingHandler; AddPrecondition(GoapKey.incombat, false); keysConfig.ForEach(key => this.Keys.Add(key)); }
public CorpseRunGoal(PlayerReader playerReader, WowProcess wowProcess, IPlayerDirection playerDirection, List <WowPoint> spiritWalker, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector) { this.playerReader = playerReader; this.wowProcess = wowProcess; this.playerDirection = playerDirection; this.stopMoving = stopMoving; this.spiritWalkerPath = spiritWalker.ToList(); this.logger = logger; this.stuckDetector = stuckDetector; AddPrecondition(GoapKey.isdead, true); }
public ApproachTargetGoal(WowProcess wowProcess, PlayerReader playerReader, StopMoving stopMoving, ILogger logger, StuckDetector stuckDetector, ClassConfiguration classConfiguration) { this.wowProcess = wowProcess; this.playerReader = playerReader; this.stopMoving = stopMoving; this.logger = logger; this.stuckDetector = stuckDetector; this.classConfiguration = classConfiguration; AddPrecondition(GoapKey.incombatrange, false); AddPrecondition(GoapKey.targetisalive, true); }
public LootWheel(WowProcess wowProcess, PlayerReader playerReader, ILogger logger) { this.wowProcess = wowProcess; this.playerReader = playerReader; this.logger = logger; var rect = wowProcess.GetWindowRect(); centre = new Point((int)(rect.right / 2f), (int)((rect.bottom / 5) * 3f)); radiusLarge = rect.bottom / 6; dtheta = (float)(2 * Math.PI / num_theta); }
internal static void FaceHorizontalWithTimer(WowProcess process, float radius, Keys key, bool moving) { if (radius < 0.1f) { return; } var turnTime = moving ? 1328 : 980; NativeMethods.SendMessage(process.MainWindowHandle, Win32Consts.WM_KEYDOWN, (IntPtr)key, IntPtr.Zero); Thread.Sleep((int)(radius * turnTime * Math.PI / 10)); NativeMethods.SendMessage(process.MainWindowHandle, Win32Consts.WM_KEYUP, (IntPtr)key, IntPtr.Zero); }
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 GoapAgent(ILogger logger, WowProcess wowProcess, ConfigurableInput input, PlayerReader playerReader, HashSet <GoapGoal> availableGoals, IBlacklist blacklist, ClassConfiguration classConfiguration, BagReader bagReader) { this.logger = logger; this.wowProcess = wowProcess; this.input = input; this.playerReader = playerReader; this.AvailableGoals = availableGoals.OrderBy(a => a.CostOfPerformingAction); this.blacklist = blacklist; this.planner = new GoapPlanner(logger); this.classConfiguration = classConfiguration; this.bagReader = bagReader; }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { var logger = new SerilogLoggerProvider(Log.Logger).CreateLogger(nameof(Program)); services.AddSingleton(logger); var wowProcess = new WowProcess(); var wowScreen = new WowScreen(logger, wowProcess); wowScreen.GetRectangle(out var rect); var addonConfig = AddonConfig.Load(); var addonConfigurator = new AddonConfigurator(logger, addonConfig); if (!addonConfig.IsDefault() && !addonConfigurator.Installed()) { // At this point the webpage never loads so fallback to configuration page AddonConfig.Delete(); DataFrameConfiguration.RemoveConfiguration(); } if (DataFrameConfiguration.Exists() && !DataFrameConfiguration.IsValid(rect, addonConfigurator.GetInstalledVersion())) { // At this point the webpage never loads so fallback to configuration page DataFrameConfiguration.RemoveConfiguration(); } if (AddonConfig.Exists() && DataFrameConfiguration.Exists()) { var dataConfig = DataConfig.Load(); var pather = GetPather(logger, dataConfig); var botController = new BotController(logger, pather, dataConfig, Configuration); services.AddSingleton <IBotController>(botController); services.AddSingleton <IGrindSessionHandler>(botController.GrindSessionHandler); services.AddSingleton <IGrindSession>(botController.GrindSession); services.AddSingleton <IAddonReader>(botController.AddonReader); services.AddMatBlazor(); } else { services.AddSingleton <IBotController>(new ConfigBotController()); services.AddSingleton <IAddonReader>(new ConfigAddonReader()); } services.AddRazorPages(); services.AddServerSideBlazor(); services.AddBlazorTable(); }