public Class134(Class144 class144_0, Class140 class140_1, Class136 class136_0, int int_4, int int_5, int int_6) : base(class140_1, int_5) { this.int_3 = class136_0.vmethod_2(); this.int_1 = int_6; for (int i = 0; i < int_6; i++) { this.int_2[i] = class144_0.vmethod_12(int_4); } int num = class144_0.vmethod_10(2); int num2 = num; if (num2 == 0) { int int_7 = class144_0.vmethod_10(4); Class138 @class = new Class138(); this.class137_0 = @class; @class.int_0 = int_7; @class.class143_0 = class136_0.vmethod_1(); @class.vmethod_0(class144_0, int_6, @class.int_0, class140_1, class136_0.vmethod_2()); Buffer.BlockCopy(this.int_2, 0, class136_0.vmethod_0(), 0, int_6 << 2); BlackMagic.CopyArrayOffset(this.int_3, class140_1.int_0 - int_6, int_6, class136_0.vmethod_0(), int_6); return; } throw new IOException("STREAM_DECODER_UNPARSEABLE_STREAM"); }
private void button1_Click(object sender, EventArgs e) { magic = new BlackMagic(); if (magic.OpenProcessAndThread(SProcess.GetProcessFromProcessName("WoW"))) { handle = FindWindow(null, "World of Warcraft"); attachLabel.Text = "Attached to WoW"; if (profileLoaded && spellsLoaded) { startButton.Show(); start = 3; } attached = true; menuButton3.Show(); newProfile = new CreateProfile(magic, pointsTextBox); // //check this profileThread = new Thread(newProfile.DoWork); profileThread.Start(); sendMsgBox.Show(); sendMsgButton.Show(); sayLabel.Show(); whisperLabel.Show(); replyLabel.Show(); partyLabel.Show(); guildLabel.Show(); //testLabel.Text = magic.ReadShort((uint)TbcOffsets.General.Cursor)+""; } else { attachLabel.Text = "World of Warcraft does not appear to be running"; } }
public void Shutdown() { try { if (injector != null) { injector.Dispose(); } injector = null; } catch (Exception ex) { Log.Error("Failed to dispose the injector", ex); } try { if (d3 != null) { d3.Close(); } d3 = null; } catch (Exception ex) { Log.Error("Failed to close the D3 process", ex); } }
public Class134(Class144 class1440, Class140 class1401, Class136 class1360, int int4, int int5, int int6) : base(class1401, int5) { _int3 = class1360.vmethod_2(); _int1 = int6; for (var i = 0; i < int6; i++) { _int2[i] = class1440.vmethod_12(int4); } var num = class1440.vmethod_10(2); var num2 = num; if (num2 == 0) { var int7 = class1440.vmethod_10(4); var @class = new Class138(); _class1370 = @class; @class.Int0 = int7; @class.Class1430 = class1360.vmethod_1(); @class.vmethod_0(class1440, int6, @class.Int0, class1401, class1360.vmethod_2()); Buffer.BlockCopy(_int2, 0, class1360.vmethod_0(), 0, int6 << 2); BlackMagic.CopyArrayOffset(_int3, class1401.Int0 - int6, int6, class1360.vmethod_0(), int6); return; } throw new IOException("STREAM_DECODER_UNPARSEABLE_STREAM"); }
/// <summary> /// Execute the given LUA command inside WoW's MainThread /// </summary> /// <param name="command">lua command to run</param> public static void LuaDoString(string command) { AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Doing string: Command [{command}]", "AmeisenCore"); uint argCC = BlackMagic.AllocateMemory(Encoding.UTF8.GetBytes(command).Length + 1); BlackMagic.WriteBytes(argCC, Encoding.UTF8.GetBytes(command)); string[] asm = new string[] { $"MOV EAX, {(argCC)}", "PUSH 0", "PUSH EAX", "PUSH EAX", $"CALL {(Offsets.luaDoString)}", "ADD ESP, 0xC", "RETN", }; HookJob hookJob = new HookJob(asm, false); AmeisenHook.AddHookJob(ref hookJob); while (!hookJob.IsFinished) { Thread.Sleep(1); } AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Command returned: Command [{command}]", "AmeisenCore"); BlackMagic.FreeMemory(argCC); }
public Main(Profile profile, Spells spells, Settings settings, BlackMagic magic, Label mobs, Label died, Label averageHealth, Label averageMana, Label loopLabel) { this.magic = magic; this.profile = profile; this.spells = spells; this.settings = settings; wayPoints = profile.GetWaypoints(); ghostPoints = profile.GetGhostpoints(); sellPoints = profile.GetSellpoints(); objectManager = new ObjectManager(magic); statistics = new Statistics(this, mobs, died, averageHealth, averageMana, loopLabel); Thread statisticsThread = new Thread(statistics.DoWork); statisticsThread.Start(); keyboardSim = new KeyboardSim(); other = new Other(this, magic, keyboardSim, objectManager, settings); combat = new Combat(this, keyboardSim, objectManager, magic, settings, spells, statistics, profile); pathing = new Pathing(this, magic, keyboardSim, objectManager, settings, profile); gathering = new Gathering(this, settings, objectManager, magic); walk = settings.GetKey("walk"); turnleft = settings.GetKey("turnleft"); turnright = settings.GetKey("turnright"); if (settings.Sell) { sell = 0; } }
public void InitMemory() { try { wow = new BlackMagic(); //Create new function to open wow process if (PId == 0) { wow.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle("World of Warcraft")); } else { wow.OpenProcessAndThread(PId); } if (wow.ProcessId != 0) { WowControl.hWnd = (uint)wow.WindowHandle; GoTo(0, 0, 0, 0, 0); } else { playerbase = 0; BgStatus = 0; IsIndoors = 0; IsMounted = 0; BattlefieldInstanceExpiration = 0; Location = ""; SubLocation = ""; LastError = ""; Speed = 0;; X = 0; Y = 0; Z = 0; LastRead = new DateTime(); PlayerForm = 0; Objects = new List <ObjectInfo>(); PlayerBuffs = new List <AURA>(); } } catch (Exception) { } }
static void Main(string[] args) { //Open the proccess wow = new BlackMagic(); wow.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle(PROCESS_WINDOW_TITLE)); //Setup Object Manager and First object base address ObjMgrAddr = wow.ReadUInt(wow.ReadUInt((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.ObjectManager.CurMgrPointer) + (uint)Constants.Const.ObjectManager.CurMgrOffset); FirstObject = new GameObject(wow.ReadUInt(ObjMgrAddr + (uint)Constants.Const.ObjectManager.FirstObject)); //Read TargetGUID from globals and find in the Object Manager //UInt64 CurrTargetGUID = wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Const.Globals.CurrentTargetGUID); UInt64 CurrTargetGUID = wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.Globals.CurrentTargetGUID); PlayerObject = new GameObject(wow.ReadUInt64((uint)wow.MainModule.BaseAddress + (uint)Constants.Const.Globals.PlayerGUID)); TargetObject = new GameObject(CurrTargetGUID); PlayerObject.Wowclass = wow.ReadByte(PlayerObject.DescriptorArrayAddress + (uint)Const.descriptors.Class8); System.Timers.Timer aTimer = new System.Timers.Timer(); aTimer.Interval = 100; if (PlayerObject.Wowclass == 9) { Console.WriteLine("Initiate Affliction Warlock DPS BOT v1.0"); aTimer.Elapsed += WarlockDPS.DpsEvent; } else if (PlayerObject.Wowclass == 11) { Console.WriteLine("Initiate Feral Druid DPS BOT v0.1"); aTimer.Elapsed += DruidDPS.DpsEvent; } aTimer.AutoReset = true; aTimer.Enabled = true; while (true) { switch (Console.ReadLine()) { case "stop": Console.WriteLine("STOP"); aTimer.Elapsed -= DruidDPS.DpsEvent; aTimer.Elapsed -= WarlockDPS.DpsEvent; aTimer.Elapsed -= PrinterEvent; break; case "printer": aTimer.Elapsed += PrinterEvent; break; case "start": if (PlayerObject.Wowclass == 9) { Console.WriteLine("Initiate Affliction Warlock DPS BOT v1.0"); aTimer.Elapsed += WarlockDPS.DpsEvent; } else if (PlayerObject.Wowclass == 11) { Console.WriteLine("Initiate Feral Druid DPS BOT v0.1"); aTimer.Elapsed += DruidDPS.DpsEvent; } break; } } }
//Initialize public override void Initialize() { BlackMagic bMagic = new BlackMagic(); base.Initialize(); }
public int avaliar(Board tabuleiro) { int mB, mP; mB = 0; mP = 0; if ((tabuleiro.vMat[0] + tabuleiro.vMat[1] > 1000)) { mB = tabuleiro.vPos[0] + dna.pPos[0][BlackMagic.index(tabuleiro.bbs[(int)tipoPeca.REI])]; mP = tabuleiro.vPos[1] + dna.pPos[1][BlackMagic.index(tabuleiro.bbs[(int)tipoPeca.KP])]; } else { mB = tabuleiro.vPos[0] + dna.pPos[0][BlackMagic.index(tabuleiro.bbs[(int)tipoPeca.REI + 2])]; mP = tabuleiro.vPos[1] + dna.pPos[1][BlackMagic.index(tabuleiro.bbs[(int)tipoPeca.KP + 2])]; } //tabuleiro.print(); if (tabuleiro.corMover == 0) { return(tabuleiro.vMat[0] + 1 - tabuleiro.vMat[1] + mB - mP); } else { return(tabuleiro.vMat[1] + 1 - tabuleiro.vMat[0] + mP - mB); } }
static void Main(string[] args) { uint dwCodeLoc; wow = new BlackMagic(); if (wow.OpenProcessAndThread(SProcess.GetProcessFromProcessName("wow"))) { Console.WriteLine(wow.GetModuleFilePath()); DateTime dt = DateTime.Now; //dwCodeLoc = SPattern.FindPattern(wow.ProcessHandle, wow.MainModule, PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION, ' '); dwCodeLoc = wow.FindPattern(PATTERN_CLIENT_CONNECTION, MASK_CLIENT_CONNECTION); Console.WriteLine("Pattern found in {0}ms", DateTime.Now.Subtract(dt).TotalMilliseconds); Console.WriteLine("Code loc: 0x{0:X08}", dwCodeLoc); Console.WriteLine("CLIENT_CONNECTION: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x16)); Console.WriteLine("CURMGR_OFFSET: 0x{0:X08}", wow.ReadUInt(dwCodeLoc + 0x1C)); } else { Console.WriteLine("World of Warcraft could not be opened for read/write."); } Console.ReadLine(); }
public void _OnGameEnter(ProxySocket Socket, uint ClientSerial, NewProxy Proxy, uint PSerial) { BlackMagic M = EnableMagic(Socket.Name, Socket); Clients[ClientSerial].Magic = M; Clients[ClientSerial].Aisling.Serial = PSerial; }
/// <summary> /// Reads all WoWObject out of WoW's ObjectManager /// </summary> /// <returns>all WoWObjects in WoW Manager</returns> public static List <WowObject> GetAllWoWObjects() { List <WowObject> objects = new List <WowObject>(); uint currentObjectManager = BlackMagic.ReadUInt(Offsets.currentClientConnection); currentObjectManager = BlackMagic.ReadUInt(currentObjectManager + Offsets.currentManagerOffset); uint activeObject = BlackMagic.ReadUInt(currentObjectManager + Offsets.firstObjectOffset); uint objectType = BlackMagic.ReadUInt(activeObject + Offsets.gameobjectTypeOffset); ulong myGUID = ReadPlayerGUID(); // loop through the objects until an object is bigger than 7 or lower than 1 to get all // Objects from manager while (objectType <= 7 && objectType > 0) { WowObject wowObject = ReadWoWObjectFromWoW(activeObject, (WowObjectType)objectType); wowObject.MapID = GetMapID(); wowObject.ZoneID = GetZoneID(); objects.Add(wowObject); activeObject = BlackMagic.ReadUInt(activeObject + Offsets.nextObjectOffset); objectType = BlackMagic.ReadUInt(activeObject + Offsets.gameobjectTypeOffset); } return(objects); }
public void majCTM(Player p, Player t, BlackMagic w) { th = new Thread(GenerathPathAsync); player = p; target = t; write = w; }
public Gathering(Main bot, Settings settings, ObjectManager objectManager, BlackMagic magic) { this.settings = settings; this.objectManager = objectManager; this.magic = magic; this.bot = bot; }
public Injector(BlackMagic d3, uint oEndScene) { this.d3 = d3; this.oEndScene = oEndScene; InstallHook(); }
public WowObject(uint baseAddress, BlackMagic blackMagic) { BaseAddress = baseAddress; BlackMagicInstance = blackMagic; Descriptor = BlackMagicInstance.ReadUInt(BaseAddress + 0x8); Guid = BlackMagicInstance.ReadUInt64(BaseAddress + 0x30); }
private void Form1_Load(object sender, EventArgs e) { application = new BlackMagic(processes[0].Id); functionManager = new FunctionManager(application); string appPath = Path.GetDirectoryName(Application.ExecutablePath); IniFile ini = new IniFile(appPath + @"\config.ini"); functionManager.LuaDoString("print(\"|cffff6060<|r|cFF00FFFFiKick|cffff6060>|r Ready !\")"); }
public Diablo3Api() { Log.OnLogMessage += LogMessageCallback; d3 = new BlackMagic(); d3.SetDebugPrivileges = false; memReader = new MemoryReader(d3); ai = new AI.AI(this); }
/// <summary> /// Get Localized Text for command /// </summary> /// <param name="command">lua command to run</param> /// <param name="variable">variable to read</param> /// <returns>localized text for the executed functions return value</returns> public static string GetLocalizedText(string command, string variable) { if (command.Length > 0 && variable.Length > 0) { uint argCCCommand = BlackMagic.AllocateMemory(Encoding.UTF8.GetBytes(command).Length + 1); BlackMagic.WriteBytes(argCCCommand, Encoding.UTF8.GetBytes(command)); string[] asmDoString = new string[] { $"MOV EAX, {(argCCCommand) }", "PUSH 0", "PUSH EAX", "PUSH EAX", $"CALL {(Offsets.luaDoString)}", "ADD ESP, 0xC", "RETN", }; uint argCC = BlackMagic.AllocateMemory(Encoding.UTF8.GetBytes(variable).Length + 1); BlackMagic.WriteBytes(argCC, Encoding.UTF8.GetBytes(variable)); uint playerBase = BlackMagic.ReadUInt(Offsets.playerBase); playerBase = BlackMagic.ReadUInt(playerBase + 0x34); playerBase = BlackMagic.ReadUInt(playerBase + 0x24); string[] asmLocalText = new string[] { $"CALL {(Offsets.clientObjectManagerGetActivePlayerObject)}", "MOV ECX, EAX", "PUSH -1", $"PUSH {(argCC)}", $"CALL {(Offsets.luaGetLocalizedText)}", "RETN", }; HookJob hookJobLocaltext = new HookJob(asmLocalText, true); ReturnHookJob hookJobDoString = new ReturnHookJob(asmDoString, false, hookJobLocaltext); AmeisenHook.AddHookJob(ref hookJobDoString); while (!hookJobDoString.IsFinished || !hookJobDoString.IsFinished) { Thread.Sleep(5); } string result = Encoding.UTF8.GetString((byte[])hookJobDoString.ReturnValue); AmeisenLogger.Instance.Log(LogLevel.VERBOSE, "DoString(" + command + "); => " + variable + " = " + result, "AmeisenCore"); BlackMagic.FreeMemory(argCCCommand); BlackMagic.FreeMemory(argCC); return(result); } return(""); }
public HookManager(BlackMagic process) { this.process = process; this.mainThreadHooked = false; this.ExecutingCode = false; this.codeCave = 0; this.injectionAddress = 0; this.returnAddress = 0; }
public KeyHelper(BlackMagic Mem) { this.Memory = Mem; KeysList = new Dictionary <string, Keys>(); bar = "Bar100"; string executableName = Application.ExecutablePath; FileInfo executableFileInfo = new FileInfo(executableName); string executableDirectoryName = executableFileInfo.DirectoryName; loadKeys(executableDirectoryName + "\\Settings\\Keys.xml"); }
/// <summary> Write the coordinates and action to the memory. </summary> <param /// name="pos">Vector3 containing the X,y & Z coordinates</param> <param name="action">CTM /// Interaction to perform</param> private static void WriteXYZToMemory(Vector3 pos, InteractionType action) { const float distance = 1.5f; AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Writing: X [{pos.X},{pos.Y},{pos.Z}] Action [{action}] Distance [{distance}]", "AmeisenCore"); BlackMagic.WriteFloat(Offsets.ctmX, (float)pos.X); BlackMagic.WriteFloat(Offsets.ctmY, (float)pos.Y); BlackMagic.WriteFloat(Offsets.ctmZ, (float)pos.Z); BlackMagic.WriteInt(Offsets.ctmAction, (int)action); BlackMagic.WriteFloat(Offsets.ctmDistance, distance); }
public GMovement(GObjectList objectList, Bot Cb) { if (objectList != null) { this.objectList = objectList; this.Memory = objectList.getMemory(); KeyHelper = new KeyHelper(Memory); } IKeepOnFollowing = true; CurrentBot = Cb; }
public Form1() { InitializeComponent(); BlackMagic application; FunctionManager functionManager; application = new BlackMagic(processes[0].Id); functionManager = new FunctionManager(application); hook.KeyPressed += new EventHandler <KeyPressedEventArgs>(hook_KeyPressed); hook.RegisterHotKey(HotKeysHandler.ModifierKeys.Alt, Keys.X); }
public bool Init() { // Open the Diablo III process int processID = SProcess.GetProcessFromProcessName(PROCESS_NAME); if (processID == 0) { Log.Error("Diablo III process not found"); return(false); } // Attempt to open the D3 process with read/write permission if (!d3.IsProcessOpen && !d3.Open(processID)) { d3 = null; Log.Error("Failed to open Diablo III process " + processID); return(false); } if (!computedHash) { // Compute the MD5 hash of the D3 executable to make sure we're working with the right version byte[] md5Bytes; using (FileStream exeStream = File.OpenRead(d3.GetModuleFilePath())) md5Bytes = new MD5CryptoServiceProvider().ComputeHash(exeStream); string md5Hash = ProcessUtils.BytesToHexString(md5Bytes); if (md5Hash != Offsets.MD5_CLIENT) { throw new Exception("MD5 checksum failed: " + md5Hash); } computedHash = true; } // Initialize the memory reader, including important global pointer addresses if (!memReader.UpdatePointers()) { return(false); } // Install our detour into the DirectX9 EndScene() method try { injector = new Injector(d3, memReader.EndSceneAddr); } catch (Exception ex) { Log.Error("Failed to inject custom code", ex); return(false); } return(true); }
/// <summary> /// Get our active Corpse position /// </summary> /// <returns>corpse position</returns> public static Vector3 GetCorpsePosition() { Vector3 corpsePosition = new Vector3 ( BlackMagic.ReadFloat(Offsets.corpseX), BlackMagic.ReadFloat(Offsets.corpseY), BlackMagic.ReadFloat(Offsets.corpseZ) ); AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Getting Corpse Position [{corpsePosition.X},{corpsePosition.Y},{corpsePosition.Z}]", "AmeisenCore"); return(corpsePosition); }
public AmeisenHook(BlackMagic blackmagic) { BlackMagic = blackmagic; Hook(); hookJobs = new ConcurrentQueue <HookJob>(); hookWorker = new Thread(new ThreadStart(DoWork)); if (isHooked) { hookWorker.Start(); } }
public OsuManager() { try { var osuProc = Process.GetProcessesByName("osu!").FirstOrDefault(); _osu = new BlackMagic(osuProc.Id); Init(); } catch (Exception ex) { Console.WriteLine(@"Exception: " + ex); } }
//Left, right, up, down public Pathing(Main bot, BlackMagic magic, KeyboardSim keyboardSim, ObjectManager objectManager, Settings settings, Profile profile) { this.magic = magic; this.keyboardSim = keyboardSim; this.objectManager = objectManager; this.settings = settings; this.profile = profile; this.bot = bot; turnleft = settings.GetKey("turnleft"); turnright = settings.GetKey("turnright"); walk = settings.GetKey("walk"); goup = settings.GetKey("goup"); godown = settings.GetKey("godown"); }