public void KillTarget() { UInt64 targetGuid = mainwow.Connection.ReadUInt64((uint)mainwow.Connection.MainModule.BaseAddress + MemoryOffsets.GlobalInfoTargetGUID); if (targetGuid != 0) { WoWUnit target = new WoWUnit(targetGuid); target.RefreshFromList(allUnits); target.Refresh(mainwow); mainPlayer.Refresh(mainwow); MoveToCommand(target.Position); if (Vector3.Distance(target.Position, mainPlayer.Position) > 100) { return; } while (Vector3.Distance(target.Position, mainPlayer.Position) > 25) { MoveToCommand(target.Position); System.Threading.Thread.Sleep(50); target.Refresh(mainwow); mainPlayer.Refresh(mainwow); } ; SendKey.Send(ConstController.WindowsVirtualKey.K_W, "World of Warcraft"); while (mainwow.Connection.ReadUInt((uint)mainwow.Connection.MainModule.BaseAddress + MemoryOffsets.GlobalInfoTargetGUID) != 0) { SendKey.Send(ConstController.WindowsVirtualKey.K_1, "World of Warcraft"); System.Threading.Thread.Sleep(50); } } }
public SCSearchItemFrm() { InitializeComponent(); // remove context menu // this.ContextMenuStrip.Items.Clear(); this.Visible = false; KeySender = new SendKey(GetKey); }
public SCSearchLabourCodeFrm() { InitializeComponent(); // remove context menu // this.ContextMenuStrip.Items.Clear(); this.Visible = false; KeySender = new SendKey(GetKey); //MessageBox.Show(this.objectMode.ToString()); }
protected override void OnFixedUpdate() { base.OnFixedUpdate(); if (_Controller.Tracking.isValid) { var device = SteamVR_Controller.Input((int)_Controller.Tracking.index); if (device.GetPressDown(EVRButtonId.k_EButton_SteamVR_Trigger)) { if (_FocusCount == 0) { VRLog.Info("Search for handle"); _Handle = FindNextHandle(); } if (_Handle) { _Handle.gameObject.SendMessage("Select"); _Handle.gameObject.SendMessage("Activate", 1); var maestroHandle = GetMaestroHandle(_Handle.gameObject); var changedField = maestroHandle.GetType().BaseType.GetField("_changed", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); changedField.SetValue(maestroHandle, true); _Dummy.position = _Handle.position; _Dummy.rotation = _Handle.rotation; _Dragging = true; } } if (_Handle && _Dragging) { if (device.GetPress(EVRButtonId.k_EButton_SteamVR_Trigger)) { _Handle.position = _Dummy.position; _Handle.rotation = _Dummy.rotation; } if (device.GetPressUp(EVRButtonId.k_EButton_SteamVR_Trigger)) { _Handle.gameObject.SendMessage("Deselect"); _Dragging = false; } } if (_Handle && device.GetPressDown(EVRButtonId.k_EButton_SteamVR_Touchpad)) { _Handle.gameObject.SendMessage("Reset"); } if (device.GetPressDown(EVRButtonId.k_EButton_Grip)) { SendKey.Send(Keys.F9, false); } } }
public bool SearchForTarget() { SendKey.Send(ConstController.WindowsVirtualKey.VK_TAB, "World of Warcraft"); System.Threading.Thread.Sleep(100); UInt64 targetGuid = mainwow.Connection.ReadUInt64((uint)mainwow.Connection.MainModule.BaseAddress + MemoryOffsets.GlobalInfoTargetGUID); if (targetGuid != 0) { return(true); } else { return(false); } }
public void MainAutoFishingThread() { //初始化鱼漂位置变量 Point cursorPosition = new Point(0, 0); while (true) { Thread.Sleep(500); if (!string.IsNullOrEmpty(MacroKey)) { SendKey?.Invoke(this, new SendKeyEventArgs(MacroKey)); Thread.Sleep(MacroWaitTime); } //发送按键开始钓鱼 //SendKeys.Send(keyTextBox.Text); SendKey?.Invoke(this, new SendKeyEventArgs(Key)); //等待鱼漂稳定 Thread.Sleep(2000); //如果当前鼠标就在鱼漂位置,则不进行查找 if (!IsFishingCursor()) { //每次寻找3次鱼漂 for (int i = 0; i < 3; i++) { cursorPosition = GetFishingCursorPosition(); if (cursorPosition.X != 0 && cursorPosition.Y != 0) { break; } } //找了3次还没有,跳出本次循环 if (cursorPosition.X == 0 && cursorPosition.Y == 0) { continue; } } //找到了之后,将鱼漂移动到最左上位置,方便截图 Point bufPoint = MoveToFishingLeftTop(cursorPosition); //找到了之后,快速监听鼠标向右100向下100的范围内,是否有纯白色出现(水花判断) int waterListenAllTime = 0; //监听水花总时长 int waterListenSleep = 10; //监听水花每次Sleep时长 int waterListenMax = 20000; //监听水花最大时长 25秒 int imgWidth = 100; int imgHeight = 100; while (waterListenAllTime <= waterListenMax) { //创建图像,用于保存截图 Image img = new Bitmap(imgWidth, imgHeight); Graphics imgGraphics = Graphics.FromImage(img); //设置截屏区域 //开始位置为鼠标位置,截取高宽为100的图片 imgGraphics.CopyFromScreen ( bufPoint, new Point(0, 0), new Size(imgWidth, imgHeight) ); //判断是否有水花 Bitmap bitmap = (Bitmap)img; bool isFind = false; int findTimes = 0; int findTimesMax = 5; for (int i = 0; i < imgWidth; i++) { if (isFind) { break; } for (int n = 0; n < imgHeight; n++) { var pixel = bitmap.GetPixel(i, n); if (pixel.R == 255 & pixel.B == 255 && pixel.G == 255) { findTimes++; if (findTimes >= findTimesMax) { isFind = true; break; } } } } //查询到了水花 if (isFind) { Thread.Sleep(750); //在鱼上钩后先等鱼漂不再晃动 SetCursorPos(cursorPosition.X, cursorPosition.Y); //重新移动鼠标到鱼漂位置 mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); Thread.Sleep(500); //将鼠标位置向左上角移动(10,10),以防上一次鼠标点击时没有自动拾取物品 SetCursorPos(cursorPosition.X - 10, cursorPosition.Y - 10); mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); } //释放 bitmap.Dispose(); imgGraphics.Dispose(); img.Dispose(); if (isFind) { break; } waterListenAllTime += waterListenSleep; Thread.Sleep(waterListenSleep); } } }