Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Diagnostics;
- using System.Text;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.Windows.Forms;
- using ReadWriteMemory;
- namespace Yes
- {
- public partial class Form1 : Form
- {
- [DllImport("user32.dll", EntryPoint = "SetWindowPos", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
- public static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
- [DllImport("user32.dll", SetLastError = true)]
- static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
- private const int downclick = 0x201;
- private const int upclick = 0x202;
- static int sleep_time_1;
- static int sleep_time_2;
- static bool is_buying = false;
- static bool is_running = false;
- static int proc_id;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- new Thread(RefreshThread).Start();
- proc_id = Convert.ToInt32(ExtractNumbers(comboBox1.SelectedItem.ToString()));
- sleep_time_1 = Convert.ToInt32(textBox1.Text)*1000;
- sleep_time_2 = Convert.ToInt32(textBox2.Text)*1000;
- is_running = true;
- SetWindowPos(Process.GetProcessById(Convert.ToInt32(ExtractNumbers(comboBox1.SelectedItem.ToString()))).MainWindowHandle, (IntPtr)null, 0, 0, 500, 500, 0u);
- }
- #region AH_ITEMS_EXIST
- private int PRICE_BUYOUT_1()
- {
- //AH_ITEM_1_BUYOUT 0x00FA3DB0, 0xC , 0xD8
- ProcessMemory memory_ = new ProcessMemory(proc_id);
- memory_.StartProcess();
- int price = memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ImageAddress() + 0x00FC7590)) + 0xC) + 0xD8);
- return price;
- }
- private int PRICE_BUYOUT_2()
- {
- //AH_ITEM_2_BUYOUT 0x00FA3DB0, 0xC , 0xD8
- ProcessMemory memory_ = new ProcessMemory(proc_id);
- memory_.StartProcess();
- int price = 1;
- return price;
- }
- private int PRICE_BUYOUT_3()
- {
- //AH_ITEM_3_BUYOUT 0x00FA3DB0, 0xC , 0xD8
- ProcessMemory memory_ = new ProcessMemory(proc_id);
- memory_.StartProcess();
- int price = memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ImageAddress() + 0x00FA3DB0)) + 0xC) + 0xD8);
- return price;
- }
- private int PRICE_BUYOUT_4()
- {
- //AH_ITEM_4_BUYOUT 0x00FA3DB0, 0xC , 0xD8
- ProcessMemory memory_ = new ProcessMemory(proc_id);
- memory_.StartProcess();
- int price = memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ImageAddress() + 0x00FA3DB0)) + 0xC) + 0xD8);
- return price;
- }
- private int PRICE_BUYOUT_5()
- {
- //AH_ITEM_5_BUYOUT 0x00FA3DB0, 0xC , 0xD8
- ProcessMemory memory_ = new ProcessMemory(proc_id);
- memory_.StartProcess();
- int price = memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ReadInt(memory_.ImageAddress() + 0x00FA3DB0)) + 0xC) + 0xD8);
- return price;
- }
- #endregion
- #region AH_BUY_ITEMS
- void BUY_ITEM_1()
- {
- IntPtr handle = Process.GetProcessById(proc_id).MainWindowHandle;
- int X = new Random().Next(270, 714);
- int Y = new Random().Next(173,182);
- IntPtr lParam = (IntPtr)((Y << 16) | X);
- IntPtr wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- /////////////////////////////////////////////////////////////
- Thread.Sleep(new Random().Next(10, 90));
- X = new Random().Next(620, 724);
- Y = new Random().Next(481, 492);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- Thread.Sleep(new Random().Next(10, 90));
- X = new Random().Next(292, 401);
- Y = new Random().Next(389, 408);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- Thread.Sleep(new Random().Next(1000,3500));
- X = new Random().Next(351, 441);
- Y = new Random().Next(245, 265);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- /////////////////////////////////////////////////////////////
- }
- void BUY_ITEM_2()
- {
- IntPtr handle = Process.GetProcessById(proc_id).MainWindowHandle;
- int X = new Random().Next(270, 714);
- int Y = new Random().Next(194, 212);
- IntPtr lParam = (IntPtr)((Y << 16) | X);
- IntPtr wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- /////////////////////////////////////////////////////////////
- Thread.Sleep(new Random().Next(10, 90));
- X = new Random().Next(620, 724);
- Y = new Random().Next(481, 492);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- Thread.Sleep(new Random().Next(10, 90));
- X = new Random().Next(292, 401);
- Y = new Random().Next(389, 408);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- Thread.Sleep(new Random().Next(1000, 3500));
- X = new Random().Next(351, 441);
- Y = new Random().Next(245, 265);
- lParam = (IntPtr)((Y << 16) | X);
- wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- /////////////////////////////////////////////////////////////
- }
- #endregion
- private void Form1_Load(object sender, EventArgs e)
- {
- Process[] p = Process.GetProcessesByName("Diablo III");
- foreach (Process proc in p)
- { comboBox1.Items.Add("Proc ID:" + proc.Id); }
- }
- static string ExtractNumbers(string expr)
- {
- return string.Join(null, System.Text.RegularExpressions.Regex.Split(expr, "[^\\d]"));
- }
- private void SimulateMouseClick(int x_pos, int y_pos)
- {
- IntPtr handle = Process.GetProcessById(proc_id).MainWindowHandle;
- int X = x_pos;
- int Y = y_pos;
- IntPtr lParam = (IntPtr)((Y << 16) | X);
- IntPtr wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- }
- void RefreshThread()
- {
- while (true)
- {
- while (is_running & !is_buying)
- {
- Thread.Sleep(new Random().Next(sleep_time_1+1,sleep_time_2));
- //SEARCH X=104~209
- //SEARCH Y =459~474
- IntPtr handle = Process.GetProcessById(proc_id).MainWindowHandle;
- int X = new Random().Next(111, 209);
- int Y = new Random().Next(457, 473);
- IntPtr lParam = (IntPtr)((Y << 16) | X);
- IntPtr wParam = IntPtr.Zero;
- PostMessage(handle, downclick, wParam, lParam);
- PostMessage(handle, upclick, wParam, lParam);
- Thread.Sleep(new Random().Next(100,300));
- if (PRICE_BUYOUT_1() != 0)
- {
- is_buying = true;
- BUY_ITEM_1();
- is_buying = false;
- }
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Environment.Exit(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement