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(); }
private void loadStateInfo() { //Label Player player = Player.getPlayer(); levelValue.Text = player.getLevel(); atkValue.Text = player.getAttack(); defValue.Text = player.getDefense(); staminaValue.Text = player.getStamina(); tokensValue.Text = player.getTokens(); goldValue.Text = player.getGold(); satoshiValue.Text = player.getSatoshi(); bitconAddressTextBox.Text = player.getBitCoinAddress(); arenapointsValue.Text = player.getArenaPoints(); //Button stamina_btn.Enabled = player.canUpgradeStamina(); stamina_btn.Text = Player.UPGRADE + player.upgradeStaminaGold() + Player.GOLD_LABEL; tokens_btn.Enabled = player.canUpgradeTokens(); tokens_btn.Text = Player.UPGRADE + player.upgradeTokensGold() + Player.GOLD_LABEL; atk_btn.Enabled = player.canUpgradeAttack(); atk_btn.Text = Player.UPGRADE + player.upgradeAttackGold() + Player.GOLD_LABEL; def_btn.Enabled = player.canUpgradeDefense(); def_btn.Text = Player.UPGRADE + player.upgradeDefenseGold() + Player.GOLD_LABEL; }
private void checkToken() { while (autoBattle) { updateMainForm(); if (SourceParser.ParseAvailableTokens(Player.getPlayer().getTokens()).Equals(Player.EMPTY)) { autoBattle = false; } } tokenThread.Join(); }
private void button1_Click(object sender, EventArgs e) { if (userName.TextLength == 0 || userPassword.TextLength == 0) { MessageBox.Show("Must input user account/password"); return; } var cookieJar = new CookieContainer(); CookieAwareWebClient client = new CookieAwareWebClient(cookieJar); System.Net.ServicePointManager.Expect100Continue = false; client.Method = CookieAwareWebClient.POST; String response = String.Empty; String token = SourceParser.ParseAuthenticationToken(client.DownloadString(CoinBrawl.SIGN_IN)); String postData = String.Format("utf8={0}&authenticity_token={1}&user%5Bemail%5D={2}&user%5Bpassword%5D={3}&commit={4}", CoinBrawl.UTF8, token, userName.Text, userPassword.Text, CoinBrawl.COMMIT_SIGN_IN); try { response = client.UploadString(CoinBrawl.SIGN_IN, postData); } catch (WebException ex) { MessageBox.Show("A ntework error occurred\nPlease try again later or reopen the program"); } if (response.Contains(CoinBrawl.LOGIN_SUCCESS)) { MessageBox.Show("Login successfully"); Player player = Player.getPlayer(); player.setAuthenticityToken(token); mainForm mForm = new mainForm(); mForm.cookie = client.CookieContainer; this.Visible = false; mForm.Visible = true; } else { MessageBox.Show("Invalid email or passowrd"); } }