Exemplo n.º 1
0
        private void EndNewGameResponce(IAsyncResult AR)
        {
            try
            {
                HttpWebResponse httpResponce = (HttpWebResponse)_httpRequest.EndGetResponse(AR);
                using (StreamReader sr = new StreamReader(httpResponce.GetResponseStream()))
                {
                    lastResponce = sr.ReadToEnd();
                    Data         = Deserialize <GameData>(lastResponce);
                }
                httpResponce.Close();

                clearSquares();
                currentBetStreak = 0;

                if (Data == null)
                {
                    throw new Exception("Deserialize failed, object is null.");
                }
                if (Data.status != "success")
                {
                    throw new Exception("Json Error: " + Data.message);
                }
                ClearLog(notFirstClear);
                notFirstClear = true;
                Log("=[Game Started]=");
                Log("Type: {0} | Bombs: {1}", Data.gametype, Data.num_mines);
                int betSquare = getNextSquare();
                Log("betting square {0}", betSquare);
                PrepRequest("https://satoshimines.com/action/checkboard.php");
                byte[] betResponce =
                    Bcodes("game_hash={0}&guess={1}&v04=1" + postExtention, Data.game_hash, betSquare);
                getPostResponce(betResponce, EndBetResponce);
            }
            catch (Exception ex)
            {
                if (GameConfig.ShowExceptionWindow)
                {
                    using (ExceptionForm except = new ExceptionForm(ex.ToString(), new Dictionary <string, string>
                    {
                        { "BetBase", BasebetCost.ToString() },
                        { "LastResounce", lastResponce },
                        { "LastSent", lastSent }
                    }))
                    {
                        except.ShowDialog();
                    }
                }
                Log("Failed to start new game.");
                running = false;
                BSta(true);
            }
        }
Exemplo n.º 2
0
 void StartGame()
 {
     try
     {
         button1.Enabled = true;
         running         = true;
         button1.Text    = "Stop after game.";
         PrepRequest("https://satoshimines.com/action/newgame.php");
         byte[] newGameresponce = Bcodes("player_hash={0}&bet={1}&num_mines={2}" + postExtention, GameConfig.PlayerHash, GameConfig.BetCost.ToString("0.000000", new CultureInfo("en-US")),
                                         GameConfig.BombCount);
         getPostResponce(newGameresponce, EndNewGameResponce);
     }
     catch (Exception ex)
     {
         Log("Failed to start game.");
         if (GameConfig.ShowExceptionWindow)
         {
             using (ExceptionForm except = new ExceptionForm(ex.ToString()))
             {
                 except.ShowDialog();
             }
         }
     }
 }
Exemplo n.º 3
0
        private void EndBetResponce(IAsyncResult AR)
        {
            try
            {
                BetData         bd;
                HttpWebResponse httpResponce = (HttpWebResponse)_httpRequest.EndGetResponse(AR);
                using (StreamReader sr = new StreamReader(httpResponce.GetResponseStream()))
                {
                    bd = Deserialize <BetData>(sr.ReadToEnd());
                }
                if (bd == null || bd.status != "success")
                {
                    throw new Exception();
                }



                if (bd.outcome == "bomb")
                {
                    bombSquare(bd.guess);
                    AddLoss();
                    Log("Bomb. Loss: {0}", bd.stake);
                    string[] bmbz = bd.bombs.Split('-');
                    if (GameConfig.ShowGameBombs)
                    {
                        foreach (string s in bmbz)
                        {
                            int bS;
                            if (int.TryParse(s, out bS))
                            {
                                FadebombSquare(bS);
                            }
                        }
                    }

                    if (GameConfig.CheckForSquareRepeat)
                    {
                        if (SquareRepeatData == null)
                        {
                            SquareRepeatData = new int[bmbz.Length];
                            int sint;
                            for (int i = 0; i < SquareRepeatData.Length; i++)
                            {
                                SquareRepeatData[i] = 0;
                            }
                        }
                        else
                        {
                            for (int i = 0; i < SquareRepeatData.Length; i++)
                            {
                                if (bmbz.Contains(i.ToString()))
                                {
                                    SquareRepeatData[i]++;
                                }
                                else
                                {
                                    SquareRepeatData[i] = 0;
                                }
                                if (SquareRepeatData[i] >= 5)
                                {
                                    running = false;
                                    MessageBox.Show(string.Format("Square {0} has been a bomb 5 times", i));
                                }
                            }
                        }
                    }

                    bool ShouldStop = false;
                    var  data       = BalanceStopShouldStop(out ShouldStop);

                    CheckLastGame();

                    if (GameConfig.StopAfterLoss && !running)
                    {
                        Log("Stop After loss is enabled... Stopping...");
                        SaveLogDisk();
                        notFirstClear = false;
                        running       = false;
                        BSta(true);
                    }
                    else if (ShouldStop && running)
                    {
                        Log("Balance level met ({0} bits)... Stopping...", data.balance);
                        SaveLogDisk();
                        notFirstClear = false;
                        running       = false;
                        BSta(true);
                    }
                    else
                    {
                        if (GameConfig.ResetBetMultiplyer)
                        {
                            if (MultiplyDeadlineTracker >= GameConfig.ResetBetMultiplyerDeadline)
                            {
                                Log("Resetting bet cost from {0} to {1}", GameConfig.BetCost, BasebetCost);
                                GameConfig.BetCost      = BasebetCost;
                                MultiplyDeadlineTracker = 0;
                            }
                            else
                            {
                                if (multiplyOnLoss != 1)
                                {
                                    Log("Betting increced from {0} to {1}", GameConfig.BetCost, GameConfig.BetCost * multiplyOnLoss);
                                    GameConfig.BetCost = GameConfig.BetCost * multiplyOnLoss;
                                    MultiplyDeadlineTracker++;
                                }
                            }
                        }
                        else
                        {
                            if (multiplyOnLoss != 1)
                            {
                                Log("Betting increced from {0} to {1}", GameConfig.BetCost, GameConfig.BetCost * multiplyOnLoss);
                                GameConfig.BetCost = GameConfig.BetCost * multiplyOnLoss;
                            }
                        }

                        //string url = string.Format("https://satoshimines.com/s/{0}/{1}/", bd.game_id, bd.random_string);
                        //Log("Url: {0}", url);
                        Log("");

                        PrepRequest("https://satoshimines.com/action/newgame.php");
                        byte[] newGameresponce =
                            Bcodes("player_hash={0}&bet={1}&num_mines={2}" + postExtention, GameConfig.PlayerHash, GameConfig.BetCost.ToString("0.000000", new CultureInfo("en-US")),
                                   GameConfig.BombCount);

                        CheckWait();
                        if (running)
                        {
                            getPostResponce(newGameresponce, EndNewGameResponce);
                        }
                        else
                        {
                            BSta(true);
                        }
                    }
                }
                else
                {
                    Log("Found {0} bits", bd.outcome);
                    glowSquare(bd.guess);
                    int betSquare = getNextSquare();
                    currentBetStreak++;
                    if (currentBetStreak >= GameConfig.BetAmmount)
                    {
                        GameConfig.BetCost      = BasebetCost;
                        MultiplyDeadlineTracker = 0;
                        Log("Cashing out...");
                        PrepRequest("https://satoshimines.com/action/cashout.php");
                        byte[] cashoutResponce =
                            Bcodes("game_hash={0}", Data.game_hash);

                        getPostResponce(cashoutResponce, endCashoutResponce);
                    }
                    else
                    {
                        Log("betting square {0}", betSquare);
                        PrepRequest("https://satoshimines.com/action/checkboard.php");
                        byte[] betResponce =
                            Bcodes("game_hash={0}&guess={1}&v04=1" + postExtention, Data.game_hash, betSquare);
                        getPostResponce(betResponce, EndBetResponce);
                    }
                }
            }
            catch (Exception ex)
            {
                if (GameConfig.ShowExceptionWindow)
                {
                    using (ExceptionForm except = new ExceptionForm(ex.ToString()))
                    {
                        except.ShowDialog();
                    }
                }
                Log("Failed bet.");
                PrepRequest("https://satoshimines.com/action/checkboard.php");
                int    betSquare   = getNextSquare();
                byte[] betResponce =
                    Bcodes("game_hash={0}&guess={1}&v04=1", Data.game_hash, betSquare);
                getPostResponce(betResponce, EndBetResponce);
            }
        }
Exemplo n.º 4
0
        private void endCashoutResponce(IAsyncResult AR)
        {
            try
            {
                CashOutData     cd;
                HttpWebResponse httpResponce = (HttpWebResponse)_httpRequest.EndGetResponse(AR);
                using (StreamReader sr = new StreamReader(httpResponce.GetResponseStream()))
                {
                    lastResponce = sr.ReadToEnd();
                    cd           = Deserialize <CashOutData>(lastResponce);
                }
                httpResponce.Close();
                if (cd == null || cd.status != "success")
                {
                    throw new Exception();
                }
                if (GameConfig.ShowGameBombs)
                {
                    string[] bmbz = cd.mines.Split('-');
                    foreach (string s in bmbz)
                    {
                        int bS;
                        if (int.TryParse(s, out bS))
                        {
                            FadebombSquare(bS);
                        }
                    }
                }
                Log(cd.message);
                string url = string.Format("https://satoshimines.com/s/{0}/{1}/", cd.game_id, cd.random_string);
                Log("Url: {0}", url);
                AddWin();
                bool ShouldStop = false;
                var  data       = BalanceStopShouldStop(out ShouldStop);

                if (GameConfig.StopAfterWin && running)
                {
                    Log("Stop After win is enabled... Stopping...");
                    SaveLogDisk();
                    notFirstClear = false;
                    running       = false;
                }
                else if (ShouldStop && !running)
                {
                    Log("Balance level met ({0} bits)... Stopping...", data.balance);
                    SaveLogDisk();
                    notFirstClear = false;
                    running       = false;
                }

                CheckLastGame();

                Log("");
                int betSquare = getNextSquare();
                PrepRequest("https://satoshimines.com/action/newgame.php");
                byte[] newGameresponce =
                    Bcodes("player_hash={0}&bet={1}&num_mines={2}" + postExtention, GameConfig.PlayerHash, GameConfig.BetCost.ToString("0.000000", new CultureInfo("en-US")),
                           GameConfig.BombCount);
                if (running)
                {
                    CheckWait();
                    getPostResponce(newGameresponce, EndNewGameResponce);
                }
                else
                {
                    BSta(true);
                }
            }
            catch (Exception ex)
            {
                if (GameConfig.ShowExceptionWindow)
                {
                    using (ExceptionForm except = new ExceptionForm(ex.ToString()))
                    {
                        except.ShowDialog();
                    }
                }
                Log("Failed to cashout.");
                BSta(true);
            }
        }