Exemple #1
0
 static public D3InventoryStuff getInstance()
 {
     if (instance == null)
     {
         instance = new D3InventoryStuff();
     }
     return(instance);
 }
Exemple #2
0
        private void Run()
        {
            money_calc = new MoneyCalculator();
            Random   rnd                   = new Random();
            int      pause_counter         = 0;
            int      runs_without_rest     = rnd.Next(40, 60);
            int      run_counter           = 0;
            DateTime last_reconnect        = DateTime.Now;
            int      next_reconnect_random = rnd.Next(0, 10);
            DateTime start                 = DateTime.Now;

            while (running && run_counter < maximum_runs)
            {
                run_counter++;
                pause_counter++;
                checkRest(ref rnd, ref pause_counter, ref runs_without_rest, run_counter);

                if (main.getInstance().getPW() != "")
                {
                    checkReconnect(ref rnd, ref last_reconnect, ref next_reconnect_random);
                }

                if (!openGame(ref rnd, run_counter))
                {
                    return;
                }

                System.Threading.Thread.Sleep(main.getInstance().getStartDelay());
                route(ref rnd, run_time, run_counter);

                if (main.getInstance().getStoreToStash())
                {
                    storeRoute(ref rnd, run_counter);
                }

                if (do_money_calc)
                {
                    int gold = D3InventoryStuff.getInstance().getGold(module_name);
                    if (gold != -1)
                    {
                        money_calc.add(new MoneyTime(DateTime.Now, gold));
                    }
                }

                updateAtMain(money_calc);

                closeGame(ref rnd);
            }

            emergencyStop("Stopped at run " + run_counter + "/" + maximum_runs + "!", run_counter);
        }
Exemple #3
0
        protected override void storeRoute(ref Random rnd, int run_number)
        {
            if (!GameStateChecker.getInstance().current_game_state.ingame_flags.inTown)
            {
                return;
            }

            run_was = possibleRuns.invalid;
            Tools.LeftClick(rnd.Next(452, 480), rnd.Next(150, 185), true, 100, 200, true);

            //3 sec max waiting for stash open
            TimeSpan max   = new TimeSpan(0, 0, 3);
            DateTime start = DateTime.Now;

            for (int i = 0; !GameStateChecker.getInstance().current_game_state.ingame_flags.isStashOpen; i++)
            {
                if (DateTime.Now - start >= max)
                {
                    return;
                }

                System.Threading.Thread.Sleep(500);
            }
            int free_slots = 0;

            if ((free_slots = D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, false)) <= 20)
            {
                int clicks = D3InventoryStuff.getInstance().rightClickToAllFullPositions(module_name);
                writeToMainLog(free_slots + " free slots were left. Stored items to stash with " + clicks + " clicks at inventory.");
                finished_store_runs++;
                this.free_slots = D3InventoryStuff.getInstance().getNumberOfFreeInventorySlots(module_name, true);
            }
            else
            {
                this.free_slots = free_slots;
            }

            return;
        }
Exemple #4
0
 private void button15_Click(object sender, EventArgs e)
 {
     D3InventoryStuff.writeEmtyInvColors();
 }
 static public D3InventoryStuff getInstance()
 {
     if (instance == null)
         instance = new D3InventoryStuff();
     return instance;
 }
Exemple #6
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 { }
        }