//name is the name we're clearing out -- longer names take longer to delete public void ResetSearchName(string name) { //TODO: Find x/y values int X = 90; int Y = 422; int nameLength = name.Length; send.MouseClick(handle, "left", X, Y); send.SendKeys(handle, "{HOME}"); for (int i = 0; i < nameLength; i++) { send.SendKeys(handle, "{DEL}"); } }
/// <summary> /// Attempts to target a Unit. /// Does not work very well currently. /// TODO: Facade this when Settings are implmented /// </summary> /// <param name="u"></param> private void targetUnit(Unit u) { // Tab targeting method /*if (target!= null && MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID()) * return; // Already targeting * else * { * while (true) * { * try * { * * faceLocation(u.getLocation()); * PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "F"); * Thread.Sleep(200); * if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID()) * this.target = u; * return; * } * catch (Exception ex) { } * } * } */ // Memory write method. Requires macro: '' bound to key 'T'. if (target != null && MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID()) { return; // Already targeting } else { while (true) { try { faceLocation(u.getLocation()); MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xB4E2E0, BitConverter.GetBytes(u.getGUID())); Thread.Sleep(100); PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "T"); Thread.Sleep(200); if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID()) { this.target = u; } return; } catch (Exception ex) { } } } }
/// <summary> /// Attempts to loot the current target. /// Seems to be working fairly well but hijacks the mouse. /// TODO: Facade this when Settings are implmented /// </summary> /// <param name="u"></param> private void LootUnit(Unit u) { while (this.getLocation().getDistance(u.getLocation()) > 4.0f) { moveToLoc(u.getLocation()); Thread.Sleep(200); } Boolean foundInteract = false; if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, 0x00B4E2C8) == u.getGUID()) { foundInteract = true; goto End; } Rectangle r = WoW_Instance.getWindowDimensions(); for (int i = -50; i < 50; i += 25) { for (int j = -25; j < 75; j += 25) { PostMessage.setCursor((i + (r.X + (r.Width / 2))), (j + (r.Y + (r.Height / 2)))); Thread.Sleep(200); if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, 0x00B4E2C8) == u.getGUID()) { PostMessage.setCursor(((i + 3) + (r.X + (r.Width / 2))), ((j + 6) + (r.Y + (r.Height / 2)))); foundInteract = true; goto End; } } } End: if (foundInteract == true) { for (int i = 0; i < 3; i++) { PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "{SHIFTD}"); Thread.Sleep(100); PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "{SHIFTD}"); Thread.Sleep(100); PostMessage.RightClick(); Thread.Sleep(200); } PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "{SHIFTU}"); } }
/// <summary> /// Cast an ability by keypress. /// will not trigger GCD. /// </summary> /// <param name="key"></param> private void castNoGCDByKey(string key) { Thread.Sleep(35); PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, key); if (!this.isCasting()) { int tries = 0; // try and make sure cast went off while (tries < 5) { PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, key); Thread.Sleep(10); tries++; } } }