Exemplo n.º 1
0
        public static D3Stuff getInstance()
        {
            if (instance == null)
                instance = new D3Stuff();

            return instance;
        }
Exemplo n.º 2
0
 public void init(bool silent = false)
 {
     instance = new D3Stuff();
     
     if(!silent)
         main.getInstance().writeToLog(module_name, "Reloaded!");
 }
Exemplo n.º 3
0
        static public void simulateMouseClick(int X, int Y)
        {
            IntPtr handle = D3Stuff.getInstance().getD3WinHandle();
            IntPtr lParam = (IntPtr)((Y << 16) | X);
            IntPtr wParam = IntPtr.Zero;

            PostMessage(handle, DOWNCLICK, wParam, lParam);
            PostMessage(handle, UPCLICK, wParam, lParam);
        }
Exemplo n.º 4
0
        public void init(bool silent = false)
        {
            instance = new D3Stuff();

            if (!silent)
            {
                main.getInstance().writeToLog(module_name, "Reloaded!");
            }
        }
Exemplo n.º 5
0
        public static D3Stuff getInstance()
        {
            if (instance == null)
            {
                instance = new D3Stuff();
            }

            return(instance);
        }
Exemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         D3Stuff.getInstance().init();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message, "error");
     }
 }
Exemplo n.º 7
0
        static public Point ConvertToScreenPixel(Point point)
        {
            Rectangle rect;

            GetWindowRect(D3Stuff.getInstance().getD3WinHandle(), out rect);

            Point ret = new Point();

            ret.X = rect.Location.X + point.X + adjust_bot_point.X;
            ret.Y = rect.Location.Y + point.Y + adjust_bot_point.Y;

            return(ret);
        }
Exemplo n.º 8
0
        static public Bitmap D3ScreenShot()
        {
            Rectangle rect;

            GetWindowRect(D3Stuff.getInstance().getD3WinHandle(), out rect);

            try
            {
                Bitmap   b = new Bitmap(rect.Width - rect.X, rect.Height - rect.Y);
                Graphics g = Graphics.FromImage(b);
                g.CopyFromScreen(rect.X, rect.Y, 0, 0, b.Size);
                g.Dispose();
                return(b);
            }
            catch
            {
                #if DEBUG
                main.getInstance().writeToLog("error", "fail at screenshot!");
                #endif
                System.Threading.Thread.Sleep(500); //to avoid mass message
                return(null);
            }
        }
Exemplo n.º 9
0
        static public bool launchDiablo3(String module_name)
        {
            if (!main.getInstance().validD3Path())
            {
                main.getInstance().writeToLog(module_name, "Can't start Diablo 3! (No valid exe path)");
                return(false);
            }

            System.Diagnostics.Process.Start(main.getInstance().getD3Exepath(), "-launch");

            int max_seconds = main.getInstance().getMaxLaunchWaittime();

            for (int i = 0; i < max_seconds; i++)
            {
                System.Threading.Thread.Sleep(1000);

                try
                {
                    D3Stuff.getInstance().init(true);
                }
                catch { continue; }

                if (D3Stuff.getInstance().getD3WinHandle() != new IntPtr(0))
                {
                    SetWindowPos(D3Stuff.getInstance().getD3WinHandle(), 0, 0, 0, 0, 0, SWP_NOSIZE);
                }

                if (GameStateChecker.getInstance().current_game_state.game_state == GameState.GameStates.LoginScreen)
                {
                    main.getInstance().writeToLog(module_name, "Diablo 3 started!");
                    return(true);
                }
            }

            main.getInstance().writeToLog(module_name, "Can't start Diablo 3! (Was waiting " + max_seconds + " seconds)");
            return(false);
        }
Exemplo n.º 10
0
        public main()
        {
            int this_will_create_an_unque_hash = 100;

            this_will_create_an_unque_hash++;
            if (!System.IO.Directory.Exists(config_dir))
            {
                System.IO.Directory.CreateDirectory(config_dir);
            }

            config_path = System.IO.Path.Combine(config_dir, config_file);

            instance = this;
            try
            {
                System.IO.File.Delete("PlankesProjectsUpdater.exe");
            }
            catch { }

            InitializeComponent();

            this.Text = "PlankesD3BotTool v" + new VersionChecker().getVersion().ToString().Replace(',', '.');

            try
            {
                D3Stuff.getInstance();
                loaded_d3_mem = true;
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "error");
            }


            loaded_d3_mem = true; // if we dont want to start the tool without D3, move to Debug
#if DEBUG
            b_testButton.Visible = true;
#endif

            try
            {
                c_check_at_start_up.Checked = Convert.ToBoolean(new MyXML(config_path).read(check_at_startup_key));

                if (c_check_at_start_up.Checked)
                {
                    new VersionChecker(true).RunAsync();
                }
            }
            catch { }

            try
            {
                D3_exe = new MyXML(config_path).read(D3_exe_key);
            }
            catch { }

            if (System.IO.Path.GetFileName(D3_exe) == "Diablo III.exe" && System.IO.File.Exists(D3_exe))
            {
                b_d3_exe.BackColor = Color.Green;
            }
        }
Exemplo n.º 11
0
        private void main_Load(object sender, EventArgs e)
        {
            PixelColors.getinstance();
            GameStateChecker.getInstance().start();

            writeToLog(module_name, D3Stuff.getInstance().getModuleName() + " loaded!");

            //load bot options
            MyXML xml = new MyXML(config_path);

            try
            {
                n_restart_delay.Value = Convert.ToDecimal(xml.read(restart_delay));
            }
            catch { }

            try
            {
                n_max_waittime.Value = Convert.ToDecimal(xml.read(max_waittime));
            }
            catch { }
            try
            {
                n_max_d3_restarts.Value = Convert.ToDecimal(xml.read(max_restarts));
            }
            catch { }

            try
            {
                n_start_delay.Value = Convert.ToDecimal(xml.read(start_delay));
            }
            catch { }
            try
            {
                n_login_trys.Value = Convert.ToDecimal(xml.read(login_trys));
            }
            catch { }
            try
            {
                c_demonHunter.Checked = Convert.ToBoolean(xml.read(demon_hunter));
            }
            catch { }
            try
            {
                c_remember_pass.Checked = Convert.ToBoolean(xml.read(remember_pass));
                if (c_remember_pass.Checked)
                {
                    String dec_pass = xml.read(encrypted_pass);

                    for (int i = 0; i < enc_times; i++)
                    {
                        dec_pass = Cypher.Decrypt(dec_pass);
                    }

                    t_pw.Text = dec_pass;
                }
            }
            catch { }
            try
            {
                Tools.adjust_bot_point.X = Convert.ToInt32(xml.read(adjust_point_x));
                Tools.adjust_bot_point.Y = Convert.ToInt32(xml.read(adjust_point_y));
            }
            catch { }

            //inithealthBot();
            try
            {
                D3InventoryStuff.getInstance();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }

            initHailiesBot();
            initNxtBot();
            initLoginBot();

            lvlBot = new B_levelBot();

            r_log.Text += "------------------------------" + Environment.NewLine;

            r_log.SelectionStart = r_log.Text.Length;
            r_log.ScrollToCaret();

            finished_init = true;

            try
            {
                if (xml.read("first_start") == "")
                {
                    MessageBox.Show("You are using this tool for the first time. Please adjust the bots with the \"" + b_adjust_bot.Text + "\" button.");
                    xml.write("first_start", "!");
                }
            }
            catch { }
        }