/// <summary> /// This function is used to Populate the lists. /// </summary> /// <remarks> /// When framework is done this should (hopefully) be the only class that uses /// curObj and nextObj besides the refresh framework /// </remarks> private GObject PopulateObject(ulong GUID) { try { curObj = getFirstObject(); nextObj = curObj; while (curObj != 0 && (curObj & 1) == 0) { if (Memory.ReadUInt64(curObj + GuidOffset) == GUID) { return(new GObject(this, curObj)); } nextObj = this.getNextObject(curObj); if (nextObj == curObj) { break; } else { curObj = nextObj; } } return(null); } catch { return(null); } }
public bool tryAttach(int dwProcessId) { try { //Lets Open wow for manipulation tempMem.OpenProcessAndThread(dwProcessId); //Lets find the Pattern - Shynd dwCodeLoc = SPattern.FindPattern(tempMem.ProcessHandle, tempMem.MainModule, PatternClientConnection, MaskClientConnection, ' '); //Lets find the s_curMgr g_clientConnection = tempMem.ReadUInt(dwCodeLoc + 0x16); clientConnection = tempMem.ReadUInt(g_clientConnection); curMgrOffset = tempMem.ReadUInt(dwCodeLoc + 0x1C); //Lets find the CurMgr Offset curMgr = tempMem.ReadUInt(clientConnection + curMgrOffset); //clientConnection + CurMgrOffest = Win getDescriptors = new Descriptors(tempMem); localPlayerObject = getObjectByGUID(tempMem.ReadUInt64(curMgr + LocalGuidOffset)); if (XP != -10) { return(true); } } catch { return(false); } return(false); }
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; } } }
public WowObject(uint baseAddress, BlackMagic blackMagic) { BaseAddress = baseAddress; BlackMagicInstance = blackMagic; Descriptor = BlackMagicInstance.ReadUInt(BaseAddress + 0x8); Guid = BlackMagicInstance.ReadUInt64(BaseAddress + 0x30); }
public UInt64 GetObjectGuid(uint curObject) { try { return(Memory.ReadUInt64(curObject + GuidOffset)); } catch { return(0); } }
public List <AURA> getAuras(uint unit) { List <AURA> result = new List <AURA>(); AURA A = new AURA(); uint auraTable = unit + AURA_TABLE_1; //aura list & count has 2 possible locations uint auraCount = wow.ReadUInt(unit + AURA_COUNT_1); if (auraCount > 80) { auraTable = wow.ReadUInt(unit + AURA_TABLE_2); //and the second one auraCount = wow.ReadUInt(unit + AURA_COUNT_2); } for (uint i = 0; i < auraCount; i++) { uint spellId = wow.ReadUInt(auraTable + AURA_SIZE * i + AURA_SPELL_ID); if (spellId > 0) { UInt64 creatorGUID = wow.ReadUInt64(auraTable + AURA_SIZE * i); A.auraId = spellId; A.creatorGuid = creatorGUID; result.Add(A); } } return(result); }
private Boolean LoadAddresses() { ClientConnection = WowReader.ReadUInt((uint)ClientOffsets.StaticClientConnection); ObjectManager = WowReader.ReadUInt((uint)(ClientConnection + ClientOffsets.ObjectManagerOffset)); FirstObject = WowReader.ReadUInt((uint)(ObjectManager + ClientOffsets.FirstObjectOffset)); LocalTarget.Guid = WowReader.ReadUInt64((uint)(ClientOffsets.LocalTargetGUID)); LocalPlayer.Guid = WowReader.ReadUInt64((uint)(ObjectManager + ClientOffsets.LocalGuidOffset)); // if the local guid is zero it means that something failed. if (LocalPlayer.Guid == 0) { return(false); } else { return(true); } }
public GObject(GObjectList objectList, uint ObjectPointer) { this.objectList = objectList; curMgr = objectList.getCurMgr(); Memory = objectList.getMemory(); this.ObjectPointer = ObjectPointer; if (ObjectPointer != 0) { try { Descriptor = Memory.ReadUInt(ObjectPointer + DescriptorOffset); ObjectGUID = Memory.ReadUInt64(ObjectPointer + GuidOffset); VirtualMethodTable = Memory.ReadUInt(ObjectPointer); } catch { } } }
/// <summary> /// Initialized the ObjectManager, and attaches it to the selected process ID. /// </summary> /// <param name="wowProc">The wow proc.</param> public static void Initialize(Process wowProc) { if (Initialized) // Nothing to do if we're already initialized. { return; } WowProcess = wowProc; Memory = new BlackMagic(wowProc.Id); try { CurrentManager = Memory.ReadUInt(Memory.ReadUInt(WowBaseAddress + (uint)Offsets.ObjectManager.Tls) + (uint)Offsets.ObjectManager.CurMgr); PlayerGUID = Memory.ReadUInt64(CurrentManager + (uint)Offsets.ObjectManager.LocalGuid); } catch (Exception ex) { Logging.WriteException(Color.Red, ex); } }
public GObjectList(int ProcessIdOfWoW) { bool didit = false; this.ProcessIdOfWoW = ProcessIdOfWoW; while (didit == false) { Memory = new BlackMagic(); //this.form = form; //Lets Open wow for manipulation Memory.OpenProcessAndThread(ProcessIdOfWoW); //Lets find the Pattern - Shynd dwCodeLoc = SPattern.FindPattern(Memory.ProcessHandle, Memory.MainModule, PatternClientConnection, MaskClientConnection, ' '); //Lets find the s_curMgr try { g_clientConnection = Memory.ReadUInt(dwCodeLoc + 0x16); clientConnection = Memory.ReadUInt(g_clientConnection); curMgrOffset = Memory.ReadUInt(dwCodeLoc + 0x1C); //Lets find the CurMgr Offset curMgr = Memory.ReadUInt(clientConnection + curMgrOffset); //clientConnection + CurMgrOffest = Win LocalGUIDVariable = Memory.ReadUInt64(curMgr + LocalGuidOffset); localPlayerObject = getObjectByGUID(LocalGUIDVariable); localPlayer = new GPlayerSelf(this, localPlayerObject); } catch { } Descriptor = new Descriptors(Memory); //Lets start the object refresher objectRefresher = new Refresher(ProcessIdOfWoW); objectRefresher.GameObjectCreated += new EventHandler <GameObjectEventArgs>(addToLists); objectRefresher.GameObjectReleased += new EventHandler <GameObjectEventArgs>(removeFromLists); didit = true; } }
public bool WalkToPoint(float targetX, float targetY, float targetZ, bool value, float currentX, float currentY, float currentZ) { float bodyx = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX); float bodyy = 0; float bodyz = 0; dead = false; if (bodyx != 0) { bodyy = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseY); bodyz = magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseZ); dead = true; } float startingX = currentX; float startingY = currentY; float startingZ = currentZ; bool inCombat = value; float dX = targetX - startingX; float dY = targetY - startingY; float dZ = targetZ - startingZ; float rotation = (float)Math.Atan2(targetY - startingY, targetX - startingX); if (rotation < 0) { rotation = rotation + (2f * (float)Math.PI); } float myRotation = magic.ReadFloat((uint)TbcOffsets.General.PlayerRotation); myRotation = float.Parse(myRotation.ToString("0.0")); rotation = float.Parse(rotation.ToString("0.0")); float angle1; float angle2; float distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ); while ((distance > 3f && distance <= 100f) && !halt) { if ((!settings.IgnoreMobs || !settings.IgnorePlayers) && (!inCombat || magic.ReadUInt(magic.ReadUInt((uint)TbcOffsets.General.PlayerBase) + (uint)TbcOffsets.General.CombatStateOffset) == (int)TbcOffsets.CombatState.InCombat && magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid) != 0)) { if (inCombat) { inCombat = bot.GetCombat.CombatMode(); } else { inCombat = bot.GetCombat.CombatMode(); if (inCombat) { return(true); } } } int playerHealth = objectManager.GetPlayer().Health; if (playerHealth <= 0 && profile.IsGhostSet) { bot.GetOther.ReleaseScript(); dead = true; Thread.Sleep(1000); return(true); } else if (playerHealth <= 0 && !profile.IsGhostSet) { bot.Halt(); } if (dead) { float gX = bodyx - startingX; float gY = bodyy - startingY; float gZ = bodyz - startingZ; if ((float)Math.Sqrt(gX * gX + gY * gY + gZ * gZ) < 30) { keyboardSim.KeyUp(walk); keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); while (magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0) { bot.GetOther.RetrieveScript(); } bot.GetOther.Rebuff(); dead = false; break; } } if (!profile.IgnoreZ && startingZ > targetZ) { if (startingZ - targetZ > 0.3f) { keyboardSim.KeyDown(godown); } else { keyboardSim.KeyUp(godown); } } else if (!profile.IgnoreZ && startingZ < targetZ) { if (targetZ - startingZ > 0.3f) { keyboardSim.KeyDown(goup); } else { keyboardSim.KeyUp(goup); } } if (myRotation != rotation) { if (myRotation >= rotation) { angle1 = myRotation - rotation; angle2 = rotation + (2 * (float)Math.PI - myRotation); if (angle1 < angle2) { if (angle1 > 0.3) { keyboardSim.KeyDown(turnright); keyboardSim.KeyUp(turnleft); } else { keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); } if (angle1 < Math.PI / 2 && distance > 3) { keyboardSim.KeyDown(walk); } } else { if (angle2 > 0.3) { keyboardSim.KeyDown(turnleft); keyboardSim.KeyUp(turnright); } else { keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); } if (angle2 < Math.PI / 2 && distance > 3) { keyboardSim.KeyDown(walk); } } } else if (myRotation < rotation) { angle1 = rotation - myRotation; angle2 = myRotation + (2 * (float)Math.PI - rotation); if (angle1 < angle2) { if (angle1 > 0.3) { keyboardSim.KeyDown(turnleft); keyboardSim.KeyUp(turnright); } else { keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); } if (angle1 < Math.PI / 2 && distance > 3) { keyboardSim.KeyDown(walk); } } else { if (angle2 > 0.3) { keyboardSim.KeyDown(turnright); keyboardSim.KeyUp(turnleft); } else { keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); } if (angle2 < Math.PI / 2 && distance > 3) { keyboardSim.KeyDown(walk); } } } } else { keyboardSim.KeyDown(walk); keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); Random random = new Random(); if (random.Next(10) == 0) { keyboardSim.KeyDown(goup); keyboardSim.KeyUp(goup); } } startingX = magic.ReadFloat((uint)TbcOffsets.General.PlayerX); startingY = magic.ReadFloat((uint)TbcOffsets.General.PlayerY); startingZ = magic.ReadFloat((uint)TbcOffsets.General.PlayerZ); dX = targetX - startingX; dY = targetY - startingY; dZ = targetZ - startingZ; myRotation = magic.ReadFloat((uint)TbcOffsets.General.PlayerRotation); rotation = (float)Math.Atan2(targetY - startingY, targetX - startingX); if (rotation < 0) { rotation = rotation + (2f * (float)Math.PI); } myRotation = float.Parse(myRotation.ToString("0.0")); rotation = float.Parse(rotation.ToString("0.0")); float temp = distance; distance = (float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ); if (temp - distance == 0) { Antistuck(); } } keyboardSim.KeyUp(walk); keyboardSim.KeyUp(turnleft); keyboardSim.KeyUp(turnright); return(false); }
public static Structs.PatternList FindPatternList(Structs.PatternList patternList) { Structs.PatternList newPatternList = new Structs.PatternList(); newPatternList.processName = patternList.processName; uint baseModule = 0; BlackMagic memread = new BlackMagic(); if (memread.OpenProcessAndThread(SProcess.GetProcessFromProcessName(patternList.processName))) { try { // Dump module ProcessModuleCollection modules = Process.GetProcessById(memread.ProcessId).Modules; foreach (ProcessModule o in modules) { Structs.ModuleList m = new Structs.ModuleList(); m.Name = o.ModuleName; m.baseAddressDec = (int)o.BaseAddress; m.baseAddressHex = (o.BaseAddress).ToString("X"); patternList.Modules.Add(m); // Check module base if exist. if (patternList.baseModuleName != "") { if (patternList.baseModuleName.ToLower() == o.ModuleName.ToLower()) { baseModule = (uint)o.BaseAddress; } } } } catch { } foreach (Structs.Pattern p in patternList.Patterns) { try { uint dwCodeLoc = memread.FindPattern(p.pattern, p.mask); uint offset = memread.ReadUInt((uint)((int)dwCodeLoc + p.offsetLocation)); if (offset > 0) { offset = offset - baseModule; dwCodeLoc = dwCodeLoc - baseModule; } if (offset > 0) { // Dump offset p.offset = offset.ToString("X"); p.offsetDec = offset; p.offsetUsedAtDec = (uint)((int)dwCodeLoc + p.offsetLocation); p.offsetUsedAt = ((int)dwCodeLoc + p.offsetLocation).ToString("X"); try { switch (p.type) { case "int64": p.value = Convert.ToString(memread.ReadUInt64(p.offsetDec)); break; case "int": p.value = Convert.ToString(memread.ReadInt(p.offsetDec)); break; case "float": p.value = Convert.ToString(memread.ReadFloat(p.offsetDec)); break; case "string": p.value = Convert.ToString(memread.ReadASCIIString(p.offsetDec, 30)); break; } } catch { p.value = "No Found"; } } else { p.offset = "No Found"; } } catch { p.offset = "No Found"; } newPatternList.Patterns.Add(p); } memread.Close(); } else { MessageBox.Show("Process no found."); } return(patternList); }
public bool CombatMode() { ulong target = magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid); bool stuck = false; //Investigate bool combatSuccessful = false; if (target == 0) { keyboardSim.KeyDown(targetKey); keyboardSim.KeyUp(targetKey); } else { objectManager.PopulateList(); List <WorkWork.Memory.Object> objs = objectManager.GetObjects(); for (int i = 0; i < objs.Count; i++) { WorkWork.Memory.Object obj = objs[i]; int type = obj.Type; if ((type == 4 && !settings.IgnorePlayers) || (type == 3 && !settings.IgnoreMobs)) { ulong guid = obj.Guid; if (target == guid && obj.Health > 0 && !stuck) { if (type == 3) { string name = obj.Name; foreach (String ignoredMob in profile.GetIgnoredMobs()) { if (name == ignoredMob) { stuck = true; keyboardSim.KeyDown(targetKey); keyboardSim.KeyUp(targetKey); } } } foreach (WorkWork.Memory.Object ignoredObjects in ignoredMobs) { if (ignoredObjects.Guid == guid) { stuck = true; keyboardSim.KeyDown(targetKey); keyboardSim.KeyUp(targetKey); } else { foreach (ulong ignoredMobGuid in profile.getIgnoredMobsGuid) { if (guid == ignoredMobGuid) { stuck = true; keyboardSim.KeyDown(targetKey); keyboardSim.KeyUp(targetKey); } } } } var watch = Stopwatch.StartNew(); int startingHP = objectManager.GetPlayer().Health; int startingMP = objectManager.GetPlayer().Mana; int currentCombo = 0; while (obj.Health > 0 && !halt && !stuck) { currentCombo = DpsRotation(obj, currentCombo); if (AutoAttack() && objectManager.GetPlayer().Health > 0) { bot.GetPathing.WalkToMob(obj, 5); } if (watch.ElapsedMilliseconds > averageTime * 3 && averageTime > 0) { ignoredMobs.Add(obj); stuck = true; } if (halt || (objectManager.GetPlayer().Health <= 0) || bot.GetPathing.Dead || magic.ReadFloat((uint)TbcOffsets.General.PlayerCorpseX) != 0) { stuck = true; } } watch.Stop(); if (!stuck) { int counter; int endingHP = objectManager.GetPlayer().Health; if (endingHP < startingHP) { endingHP = startingHP - endingHP; endingHP += endingHP / 2; healthPerMob[hpCounter] = endingHP; hpCounter++; if (hpCounter == 10) { hpCounter = 0; } counter = 0; bot.AverageHealth = 0; foreach (int hp in healthPerMob) { if (hp > 0) { counter++; bot.AverageHealth += hp; } } if (counter > 0) { bot.AverageHealth /= counter; } } if (objectManager.GetPlayer().MaxMana > 0) { int endingMP = objectManager.GetPlayer().Mana; if (endingMP < startingMP) { endingMP = startingMP - endingMP; endingMP += endingMP / 2; manaPerMob[mpCounter] = endingMP; mpCounter++; if (mpCounter == 10) { mpCounter = 0; } counter = 0; bot.AverageMana = 0; foreach (int mp in manaPerMob) { if (mp > 0) { counter++; bot.AverageMana += mp; } } if (counter > 0) { bot.AverageMana /= counter; } } } if (magic.ReadUInt(magic.ReadUInt((uint)TbcOffsets.General.PlayerBase) + (uint)TbcOffsets.General.CombatStateOffset) == (int)TbcOffsets.CombatState.InCombat && magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid) != 0) { CombatMode(); } timePerMob[timeCounter] = watch.ElapsedMilliseconds; timeCounter++; if (timeCounter == 10) { timeCounter = 0; } averageTime = 0; counter = 0; foreach (long temp in timePerMob) { if (temp > 0) { counter++; averageTime += temp; } } if (counter > 0) { averageTime /= counter; } if (objectManager.GetPlayer().Health > 0) { if (settings.Looting) { bot.GetPathing.WalkToMob(obj, 3); bot.GetOther.Interact(); if (settings.Skinning) { bot.GetOther.Interact(); } } combatSuccessful = true; bot.MobsKilled++; statistics.Changed = true; bot.GetOther.Regen(); afterCombatSpells(currentCombo, "aftercombat"); } } break; } else if (target == guid && obj.Health <= 0) { keyboardSim.KeyDown(targetKey); keyboardSim.KeyUp(targetKey); break; } } } } return(combatSuccessful); }
/// <summary> /// Get the bot's char's target's GUID /// </summary> /// <returns>guid</returns> public static ulong ReadTargetGUID() { return(BlackMagic.ReadUInt64(Offsets.localTargetGUID)); }
/// <summary> /// Get the bot's char's GUID /// </summary> /// <returns>the GUID</returns> public static ulong ReadPlayerGUID() { return(BlackMagic.ReadUInt64(Offsets.localPlayerGUID)); }
private void ignoreSBox_Click(object sender, EventArgs e) { ulong target = magic.ReadUInt64((uint)TbcOffsets.General.TargetGuid); newProfile.AddIgnoredMobGuid(target); }