Inheritance: GeckoElement
コード例 #1
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        void DoBet(double dBalance)
        {
            if (!stop && !gckBrowser.IsBusy && !(withdraw || invest ||reset))
            {
                double betresult = dBalance - PreviousBalance;
                if (betresult > 0)
                {
                    if (LargestWin < betresult)
                        LargestWin = betresult;
                }
                else if (betresult < 0)
                {
                    if (LargestLoss < -betresult)
                        LargestLoss = -betresult;
                }

                if (LargestBet < Lastbet)
                    LargestBet = Lastbet;

                //if its a win
                if (dBalance > PreviousBalance && !(withdraw || invest || reset))
                {

                    if (PreviousBalance != 0)
                    {

                        if (rdbWinMaxMultiplier.Checked && Winstreak >= WinMaxMultiplies)
                        {
                            WinMultiplier = 1;
                        }
                        else if (rdbWinDevider.Checked && Winstreak % WinDevidecounter == 0 && Winstreak > 0)
                        {
                            WinMultiplier *= WinDevider;
                        }
                        else if (rdbWinReduce.Checked && Winstreak == WinDevidecounter && Winstreak > 0)
                        {
                            WinMultiplier *= WinDevider;
                        }
                        if (Winstreak == 0)
                        {
                            currentprofit = 0;
                        }
                        currentprofit += (Lastbet*(99/Chance))-Lastbet;
                        Lastbet *= WinMultiplier;
                        if (Winstreak == 0)
                        {
                            Lastbet = MinBet;
                            try
                            {
                                GeckoInputElement gie = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_chance").DomObject);
                                gie.Value = Chance.ToString().Replace(',', '.');
                            }
                            catch
                            {

                            }
                        }
                        Wins++;
                        Winstreak++;
                        if (chkResetBetWins.Checked && Winstreak % nudResetWins.Value == 0)
                        {
                            Lastbet = MinBet;
                        }
                        if (chkChangeWinStreak.Checked && (Winstreak == nudChangeWinStreak.Value))
                        {
                            Lastbet = (double)nudChangeWinStreakTo.Value;
                        }
                        if (chkChangeChanceWin.Checked && (Winstreak == nudChangeChanceWinStreak.Value))
                        {
                            try
                            {
                                GeckoInputElement gie = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_chance").DomObject);
                                gie.Value = nudChangeChanceWinTo.Value.ToString().Replace(',', '.');
                            }
                            catch
                            {

                            }
                        }
                        if (Winstreak >= nudLastStreakWin.Value)
                            laststreakwin = Winstreak;

                        if (currentprofit > ((double)nudStopWinBtcStreak.Value) && chkStopWinBtcStreak.Checked)
                        {
                            Stop();
                        }
                        if (Winstreak >= nudStopWinStreak.Value && chkStopWinStreak.Checked)
                        {
                            Stop();
                        }
                        if (profit >= (double)nudStopWinBtc.Value && chkStopWinBtc.Checked)
                        {
                            Stop();
                        }
                        if (Losestreak != 0)
                        {
                            double avglosecalc = avgloss * numlosesreaks;
                            avglosecalc += Losestreak;
                            avglosecalc /= ++numlosesreaks;
                            avgloss = avglosecalc;
                            double avgbetcalc = avgstreak * numstreaks;
                            avgbetcalc -= Losestreak;
                            avgbetcalc /= ++numstreaks;
                            avgstreak = avgbetcalc;
                            if (Losestreak > WorstStreak3)
                            {
                                WorstStreak3 = Losestreak;
                                if (Losestreak > WorstStreak2)
                                {
                                    WorstStreak3 = WorstStreak2;
                                    WorstStreak2 = Losestreak;
                                    if (Losestreak > WorstStreak)
                                    {
                                        WorstStreak2 = WorstStreak;
                                        WorstStreak = Losestreak;
                                    }
                                }
                            }
                        }
                        Losestreak = 0;

                    }
                    /*else
                    {
                        dPreviousBalance = dBalance;
                    }*/
                    //Lastbet = MinBet;
                    if (stoponwin)
                    {
                        Stop();
                    }
                    iMultiplyCounter = 0;

                    Multiplier = dparse(txtMultiplier.Text);

                    if (chkReverse.Checked)
                    {
                        if (rdbReverseWins.Checked && Winstreak % reversebets == 0)
                        {
                            high = !high;
                        }
                    }
                }

                    //if its a loss
                else if (dBalance < PreviousBalance && !(withdraw || invest || reset))
                {
                    //do i use this line?
                    iMultiplyCounter++;

                    //stop multiplying if at max or if it goes below 1
                    if (rdbMaxMultiplier.Checked && Losestreak >= MaxMultiplies)
                    {
                        Multiplier = 1;
                    }
                    else if (rdbDevider.Checked && Losestreak % Devidecounter == 0 && Losestreak > 0)
                    {
                        Multiplier *= Devider;
                        if (Multiplier < 1)
                            Multiplier = 1;
                    }
                        //adjust multiplier according to devider
                    else if (rdbReduce.Checked && Losestreak == Devidecounter && Losestreak > 0)
                    {
                        Multiplier *= Devider;
                    }
                    //reset current profit when switching from a winning streak to a losing streak
                    if (Losestreak == 0)
                    {
                        currentprofit = 0;
                    }

                    //adjust profit
                    currentprofit -= Lastbet;
                    //set new bet size
                    Lastbet *= Multiplier;

                    //increase losses and losestreak
                    Losses++;
                    Losestreak++;

                    //reset bet to minimum if applicable
                    if (chkResetBetLoss.Checked && Losestreak % nudResetBetLoss.Value == 0)
                    {
                        Lastbet = MinBet;
                    }
                    //update last losing streak if it is above the specified value to show in the stats
                    if (Losestreak >= nudLastStreakLose.Value)
                        laststreaklose = Losestreak;

                    //switch high low if applied in the zig zag tab
                    if (chkReverse.Checked)
                    {
                        if (rdbReverseLoss.Checked && Losestreak % reversebets == 0)
                        {
                            high = !high;
                        }
                    }

                    //change bet after a certain losing streak
                    if (chkChangeLoseStreak.Checked && (Losestreak == nudChangeLoseStreak.Value))
                    {
                        Lastbet = (double)nudChangeLoseStreakTo.Value;
                    }

                    //change chance after a certain losing streak
                    if (chkChangeChanceLose.Checked && (Losestreak == nudChangeChanceLoseStreak.Value))
                    {
                        try
                        {
                            GeckoInputElement gie = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_chance").DomObject);
                            gie.Value = nudChangeChanceLoseTo.Value.ToString().Replace(',', '.');
                        }
                        catch
                        {

                        }
                    }

                    //stop conditions:
                    //stop if lose streak is higher than specified
                    if (Losestreak >= nudStopLossStreak.Value && chkStopLossStreak.Checked)
                    {
                        Stop();
                    }

                    //stop if current profit drops below specified value/ loss is larger than specified value
                    if (currentprofit <= (0.0 - (double)nudStopLossBtcStreal.Value) && chkStopLossBtcStreak.Checked)
                    {
                        Stop();
                    }

                    // stop if total profit/total loss is below/above certain value
                    if (profit <= 0.0-(double)nudStopLossBtc.Value && chkStopLossBtc.Checked)
                    {
                        Stop();
                    }

                    //when switching from win streak to lose streak, calculate some stats
                    if (Winstreak != 0)
                    {
                        double avgwincalc = avgwin * numwinstreasks;
                        avgwincalc += Winstreak;
                        avgwincalc /= ++numwinstreasks;
                        avgwin = avgwincalc;
                        double avgbetcalc = avgstreak * numstreaks;
                        avgbetcalc += Winstreak;
                        avgbetcalc /= ++numstreaks;
                        avgstreak = avgbetcalc;
                        if (Winstreak > BestStreak3)
                        {
                            BestStreak3 = Winstreak;
                            if (Winstreak > BestStreak2)
                            {
                                BestStreak3 = BestStreak2;
                                BestStreak2 = Winstreak;
                                if (Winstreak > BestStreak)
                                {
                                    BestStreak2 = BestStreak;
                                    BestStreak = Winstreak;
                                }
                            }
                        }
                    }

                    //reset win streak
                    Winstreak = 0;

                    //sounds
                    if (Sound && SoundStreak && Losestreak > SoundStreakCount)
                        playalarm();
                    //email
                    if (Emails.Streak && Losestreak > Emails.StreakSize)
                        Emails.SendStreak(Losestreak, Emails.StreakSize, dBalance);

                    //update worst streaks
                    if (Losestreak > WorstStreak)
                        WorstStreak = Losestreak;

                    //reset win multplier
                    WinMultiplier = dparse(txtWinMultiplier.Text);

                }
                if (chkReverse.Checked)
                {
                    if (rdbReverseBets.Checked && (Wins+Losses) % reversebets == 0 )
                    {
                        high = !high;
                    }
                }

                if (dBalance > Limit && chkLimit.Checked)
                {

                    if (rdbStop.Checked)
                    {
                        Stop();
                    }
                    else if (rdbWithdraw.Checked)
                    {
                        withdraw = true;
                        waiter = 0;

                    }
                    else if (rdbInvest.Checked)
                    {
                        waiter = 0;
                        invest = true;

                    }
                }
                if (dBalance - Lastbet < LowerLimit && chkLowerLimit.Checked)
                {
                    TrayIcon.BalloonTipText = "Balance lower than " + txtLowerLimit + "\nStopping Bets...";
                    TrayIcon.ShowBalloonTip(1000);
                    Stop();
                    if (Sound && SoundLow)
                        playalarm();
                    TrayIcon.BalloonTipText = "easydice has Stopped Betting\nThe next bet will will have put your Balance below your lower limit";

                    if (Emails.Lower)
                        Emails.SendLowLimit(dBalance, LowerLimit, Lastbet);
                }

                if ( Wins!=0 && Losses!=0 && chkResetSeed.Checked)
                {
                    if ( ((rdbResetSeedBets.Checked && (Wins+Losses) % nudResetSeed.Value == 0) ||
                       (rdbResetSeedWins.Checked && Wins % nudResetSeed.Value == 0 && Losestreak==0)||
                       (rdbResetSeedLosses.Checked && Losses % nudResetSeed.Value == 0 && Winstreak == 0)) && !withdrew)
                    {
                        waiter = 0;
                        reset = true;
                        ResetSeed();
                    }

                }

                if ((dBalance != PreviousBalance || withdrew) && !stop)
                {
                    PlaceBet();
                    dPreviousBalance = dBalance;
                    try
                    {
                        UpdateStats();
                    }
                    catch
                    {

                    }
                    withdrew = false;
                }

            }
        }
コード例 #2
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        void Withdraw()
        {
            if (waiter == 0)
            {
                gckBrowser.Navigate("javascript:clicked_action_withdraw();");
            }
            if (waiter == 11)
            {
                GeckoInputElement gieAddress = new GeckoInputElement(gckBrowser.Document.GetElementById("wd_address").DomObject);
                GeckoInputElement gieAmount = new GeckoInputElement(gckBrowser.Document.GetElementById("wd_amount").DomObject);
                gieAddress.Value = txtTo.Text;
                gieAmount.Value = txtAmount.Text;

            }
            if (waiter == 20)
            {
                gckBrowser.Navigate("javascript:socket.emit('withdraw',csrf,'" + txtTo.Text + "','" + txtAmount.Text + "',0)");
            }

            if (waiter == 30)
            {

                if (txtSecretURL.Text != "")
                {
                    gckBrowser.Navigate(txtSecretURL.Text);
                }
                else
                {
                    gckBrowser.Navigate("http://just-dice.com");
                }
            }
            if (waiter == 100)
            {
                waiter = -1; withdraw = false;
                TrayIcon.BalloonTipText = "Withdraw " + txtAmount.Text + "Complete\nRestarting Bets";
                TrayIcon.ShowBalloonTip(1000);
                try
                {
                    if (Sound && SoundWithdraw)
                    {
                        if (ching == "")
                        {
                            (new SoundPlayer(@"media\withdraw.wav")).Play();
                        }
                        else
                        {
                            if (ching.Substring(ching.LastIndexOf(".")).ToLower() == "mp3")
                            {
                                WindowsMediaPlayer player = new WindowsMediaPlayer();
                                player.URL = ching;
                                player.controls.play();
                            }
                            else
                            {
                                (new SoundPlayer(ching)).Play();
                            }
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Failed to play CHING, pelase make sure file exists");
                }
                withdrew = true;
                Emails.SendWithdraw(Amount, PreviousBalance-Amount, txtTo.Text);
                StartBalance -= Amount;
                Start();
            }

            waiter++;
        }
コード例 #3
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
 private void button1_Click_1(object sender, EventArgs e)
 {
     GeckoInputElement gieUser = new GeckoInputElement(gckBrowser.Document.GetElementById("username").DomObject);
     GeckoInputElement giePass = new GeckoInputElement(gckBrowser.Document.GetElementById("password").DomObject);
     GeckoInputElement gieSubmit = new GeckoInputElement(gckBrowser.Document.GetElementsByTagName("submit")[0].DomObject);
     gieUser.Value = username;
     giePass.Value = password;
     gieSubmit.click();
     GeckoElement gksubmit = gckBrowser.Document.Body;
 }
コード例 #4
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        private void tmrSiteProfit_Tick(object sender, EventArgs e)
        {
            try
            {
                GeckoInputElement gieBalance = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("sprofitraw")[0].DomObject);
                string sBalance = gieBalance.InnerHtml.Replace(",", "");
                double siteBalance = dparse(sBalance);
                if (siteBalance != 0)
                    writesiteprofit(DateTime.Now, siteBalance);
            }
            catch
            {

            }
        }
コード例 #5
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        private void txtChance_Leave(object sender, EventArgs e)
        {
            testInputs();
            try
            {
                GeckoInputElement gie = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_chance").DomObject);
                gie.Value = Chance.ToString().Replace(',', '.');
            }
            catch
            {

            }
        }
コード例 #6
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        private void tmrCheckInvest_Tick(object sender, EventArgs e)
        {
            #region invest hour

            if (chkHour.Checked)
            {
                if ((lastinvest - DateTime.Now).Hours > nudHours.Value)
                {
                    if (waiter == 0)
                    {
                        gckBrowser.Navigate("javascript:socket.emit('invest',csrf,'" + ((decimal)Getbalance() * (decimal)nudInvestHour.Value / (decimal)100.0).ToString() + "',0)");
                    }
                    if (waiter == 2)
                    {
                        gckBrowser.Navigate("http://Just-dice.com");
                        lastinvest = DateTime.Now;
                        waiter = -1;
                    }
                    waiter++;
                }
            }
            #endregion
            #region divest profit
            if (chkDivestProf.Checked)
            {
                string sBalance="999999";
                try
                {
                    GeckoInputElement gieBalance = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("investment")[0].DomObject);
                     sBalance = gieBalance.InnerHtml;
                }
                    catch
                {

                }
                    decimal curinvested = 0;
                    if (decimal.TryParse(sBalance, out curinvested) || divesting)
                    {
                        if ((PrincipleInvest / curinvested) < 1 || divesting)
                        {
                            if ((PrincipleInvest / curinvested * 100) > nudProfitPer.Value || divesting)
                            {
                                if (waiter == 0)
                                {
                                    gckBrowser.Navigate("javascript:socket.emit('divest',csrf,'" + ((curinvested * nudProfitPer.Value) / 100).ToString() + "',0)");
                                    divesting = true;
                                }
                                else if (waiter == 2)
                                {
                                    gckBrowser.Navigate("http://Just-dice.com");
                                    waiter = -1;
                                    divesting = false;
                                }
                                waiter++;
                            }
                        }
                    }
            }
            #endregion

            #region site profit
            if (chkSiteProfit.Checked)
            {
                string sBalance = "s";
                decimal NewProfit = 0;
                try
                {
                    GeckoInputElement gieBalance = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("sprofitraw")[0].DomObject);
                    sBalance = gieBalance.InnerHtml;

                }
                catch
                {

                }
                if (decimal.TryParse(sBalance, out NewProfit) || divesting2)
                {
                    decimal oldprofit = SitelowestProfits;

                        if (oldprofit < 0 && NewProfit < 0)
                        {
                            if (oldprofit / NewProfit < 1)
                            {
                                if ((oldprofit / NewProfit) * 100m > nudTotalDivestPer.Value)
                                {

                                    if (waiter == 0)
                                    {
                                        gckBrowser.Navigate("javascript:socket.emit(\"divest\",csrf,\"all\",divest_code.val()");
                                        divesting2 = true;
                                    }

                                }
                            }

                        }
                        if (oldprofit > 0 && NewProfit > 0)
                        {
                            if (NewProfit / oldprofit < 1)
                            {
                                if ((NewProfit / oldprofit) * 100m > nudTotalDivestPer.Value)
                                {

                                    if (waiter == 0)
                                    {
                                        gckBrowser.Navigate("javascript:socket.emit(\"divest\",csrf,\"all\",divest_code.val()");
                                        divesting2 = true;
                                    }

                                }
                            }
                        }

                        if (waiter == 2 && divesting2)
                        {
                            gckBrowser.Navigate("http://Just-dice.com");
                            waiter = -1;
                            divesting = false;
                        }
                    if (divesting2)
                        waiter++;

                }
            }
            if ((DateTime.Now - lastprofit).Hours >= 1)
            {
                string sBalance = "s";
                decimal NewProfit = 0;
                try
                {
                    GeckoInputElement gieBalance = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("sprofitraw")[0].DomObject);
                    sBalance = gieBalance.InnerHtml;
                }
                catch
                {

                }
                if (decimal.TryParse(sBalance, out NewProfit))
                {
                    if (NewProfit < SitelowestProfits)
                    {
                        SitelowestProfits3 = SitelowesProfits2;
                        sitelowrecorded3 = sitelowrecorded2;
                        SitelowesProfits2 = SitelowestProfits;
                        sitelowrecorded2 = sitelowrecorded;
                        SitelowestProfits = NewProfit;
                        sitelowrecorded = DateTime.Now;

                    }
                }
            }
            #endregion
        }
コード例 #7
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        private void tmBetting_Tick(object sender, EventArgs e)
        {
            bool valid = true;
            if (chkBotSpeed.Checked)
            {
                if ((DateAndTime.Now - dtLastBet).Ticks < new TimeSpan(0, 0, 0, 0, (int)((decimal)1000.0 / nudBotSpeed.Value)).Ticks)
                {
                    valid = false;
                }
            }
            double dBalance = PreviousBalance;
            if (valid)
            {
                dBalance = Getbalance();

            }
                if (dBalance != PreviousBalance && dBalance != -1 || withdrew)
                {
                    if (PreviousBalance == 0)
                        StartBalance = dBalance;
                    PreviousBalance = dBalance;

                    try
                    {

                        GeckoInputElement giebets = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("bets")[0].DomObject);
                        string bets = giebets.InnerHtml.Replace(",","");
                        double dbets = dparse(bets);
                        GeckoInputElement gieprofit = new GeckoInputElement(gckBrowser.Document.GetElementsByClassName("myprofit")[0].DomObject);
                        string myprofit = gieprofit.InnerHtml.Replace(",", "");
                        double dprof = dparse(myprofit);

                        writeprofitbet((int)dbets, dprof);
                        writeprofittime(DateTime.Now, dprof);
                        writecurrentprofitbet(Wins + Losses, profit);
                        writecurrentprofittime(DateAndTime.Now, profit);
                        writebankrollbet((int)dbets, dBalance);
                        writebankrolltime(DateTime.Now, dBalance);
                    }
                    catch
                    {

                    }

                }
                else if (dBalance == PreviousBalance && dBalance != -1 || withdrew)
                {
                    if ((DateTime.Now - dtLastBet).Seconds + ((DateTime.Now - dtLastBet).Minutes * 60) > 120 && !stop)
                    {

                        if (txtSecretURL.Text != "")
                        {
                            gckBrowser.Navigate(txtSecretURL.Text);
                        }
                        else
                        {
                            gckBrowser.Navigate("http://just-dice.com");
                        }
                        dtLastBet = DateTime.Now;
                        restartcounter = 0;
                    }
                    if (restartcounter == 30 && !stop)
                    {
                        Start();
                    }
                    if (restartcounter < 50)
                    {
                        restartcounter++;
                    }
                }
                if (withdraw)
                {
                    Withdraw();
                }
                if (invest)
                {
                    Invest();
                }
                if (reset)
                {
                    ResetSeed();
                }
        }
コード例 #8
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        void PlaceBet()
        {
            try
            {
                GeckoInputElement gieChance = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_chance").DomObject);
                gieChance.TextContent = txtChance.Text;
                GeckoInputElement gieBet = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_bet").DomObject);
                gieBet.Value = Lastbet.ToString("0.00000000").Replace(',', '.');
                if (high)
                gckBrowser.Navigate("javascript:clicked_action_bet_hi()");
                else
                    gckBrowser.Navigate("javascript:clicked_action_bet_lo()");
                dtLastBet = DateTime.Now;
            }
            catch
            {

            }
        }
コード例 #9
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        void Login()
        {
            try
            {
                GeckoInputElement gieUser = new GeckoInputElement(gckBrowser.Document.GetElementById("username").DomObject);
                GeckoInputElement giePass = new GeckoInputElement(gckBrowser.Document.GetElementsByName("password")[0].DomObject);

                GeckoInputElement gieSubmit = null;
                foreach (GeckoElement gie in gckBrowser.Document.GetElementsByTagName("input"))
                {
                    if (gie.GetAttribute("type") == "submit")
                    {
                        gieSubmit = new GeckoInputElement(gie.DomObject);
                        break;
                    }
                }

                gieUser.Value = username;
                giePass.Value = password;
                if (autologin)
                    gieSubmit.click();
                loggedin = true;
            }
            catch
            {
                loggedin = false;
            }
        }
コード例 #10
0
ファイル: cEasyBot.cs プロジェクト: EasyDice/EasyDice
        double Getbalance()
        {
            try
            {
                GeckoInputElement gieBalance = new GeckoInputElement(gckBrowser.Document.GetElementById("pct_balance").DomObject);
                string sBalance = gieBalance.Value;

                double dBalance = dparse(sBalance);
                return dBalance;
            }
            catch
            {
                return -1;
            }
        }