예제 #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 updateMainForm()
        {
            CookieAwareWebClient client = new CookieAwareWebClient(this.cookie);
            List <String>        info   = SourceParser.PlayerStateInfo(client.DownloadString(CoinBrawl.CHARACTER));

            info.Add(SourceParser.ParseArenaPoints(client.DownloadString(CoinBrawl.ARENA_RANK)));
            Player.updatePlayer(info);
        }