예제 #1
0
        private void persistantBattle()
        {
            String result = String.Empty;
            String points = String.Empty;
            CookieAwareWebClient client = new CookieAwareWebClient(this.cookie);

            points = SourceParser.ParseArenaPoints(client.DownloadString(CoinBrawl.ARENA_RANK));
            setBattleResultText("Battle Start:" + DateTime.Now.ToString("HH:mm:ss tt")
                                + NEW_LINE + "Your current Arena Points: " + points + NEW_LINE, Color.Black);
            while (autoBattle)
            {
                client.clickFight = false;
                points            = SourceParser.ParseArenaPoints(client.DownloadString(CoinBrawl.ARENA_RANK));
                List <String> enemyList = SourceParser.BattleInfo(client.DownloadString(CoinBrawl.ARENA));
                String        postData  = String.Format("battle%5Bdefender_id%5D={0}&token={1}", enemyList[1], enemyList[0]);
                client.Method     = CookieAwareWebClient.POST;
                client.clickFight = true;
                client.CSRF_Token = SourceParser.ParseCSRFToken(client.DownloadString(CoinBrawl.ARENA));
                client.UploadString(CoinBrawl.BATTELS, postData);
                client.clickFight = false;
                if (points.Equals(SourceParser.ParseArenaPoints(client.DownloadString(CoinBrawl.ARENA_RANK))))
                {
                    result += CoinBrawl.LOSE_BATTLE + NEW_LINE;
                    setBattleResultText(result, Color.Red);
                }
                else
                {
                    result += CoinBrawl.WIN_BATTLE + NEW_LINE;
                    setBattleResultText(result, Color.Green);
                }
            }
            setBattleResultText("Battle Stop:" + DateTime.Now.ToString("HH:mm:ss tt"), Color.Black);
            battleThread.Join();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Player player = Player.getPlayer();

            player.setBitCoinAddress(bitconAddressTextBox.Text);
            CookieAwareWebClient client = new CookieAwareWebClient(this.cookie);
            String postData             = String.Format("utf8={0}&_method={1}&authenticity_token={2}&user%5Bbitcoin_address%5D={3}&commit={4}",
                                                        CoinBrawl.UTF8, CoinBrawl.METHOD_PATCH, SourceParser.ParseCSRFToken(client.DownloadString(CoinBrawl.CHARACTER)), player.getBitCoinAddress(), CoinBrawl.COMMIT_SAVE);

            client.Method    = CookieAwareWebClient.POST;
            client.clickSave = true;
            try
            {
                client.UploadString(CoinBrawl.USER + player.getUserID(), postData);
                MessageBox.Show("You have successfully updated your bitcoin address");
            }
            catch (WebException ex)
            {
                //
                MessageBox.Show("Fail to updat your bitcoin address");
                //
            }
            updateMainForm();
            loadStateInfo();
        }