Exemplo n.º 1
0
        private async void button6_Click(object sender, EventArgs e)//profit
        {
            SearchInventory search = new SearchInventory();

            //inventory search
            HttpResponseMessage inventory = Api.ClientConfig(textBox1.Text).GetAsync(Uri.EscapeUriString("characters/" + comboBox1.Text + "/inventory")).Result;
            string inventoryResponse      = await inventory.Content.ReadAsStringAsync();

            var items = Items.FromJson(inventoryResponse);

            search.items = items;

            //Vault search
            HttpResponseMessage vault_response = Api.ClientConfig(textBox1.Text).GetAsync("account/materials").Result;
            string vault_value = await vault_response.Content.ReadAsStringAsync();

            var vault = Vault.FromJson(vault_value);

            search.vault = vault;

            //Calculate value
            Calc calc       = new Calc();
            var  vault_calc = calc.Vault(search, market_id, market_sell, market_buy);
            var  inv_calc   = calc.Inventory(search, market_id, market_sell, market_buy);

            int[] value = Monetary(vault_calc.vault_sell + inv_calc.inv_sell - g_tpsell - g_marketsell);
            label9.Text    = value[0].ToString() + "g" + value[1].ToString() + "s" + value[2].ToString() + "c";
            label9.Visible = true;

            value           = Monetary(vault_calc.vault_buy + inv_calc.inv_buy - g_tpbuy - g_marketbuy);
            label10.Text    = value[0].ToString() + "g" + value[1].ToString() + "s" + value[2].ToString() + "c";
            label10.Visible = true;

            /* CALCULO GOLD POR HORA
             * double gold_perhour= (vault_calc.vault_sell + inv_calc.inv_sell - g_tpsell - g_marketsell) / (stopwatch.Elapsed.TotalMinutes / 60);
             * if (!double.IsNaN(gold_perhour))
             * {
             *  value = Monetary(Convert.ToInt64(gold_perhour));
             *  label11.Text = value.ToString();
             *  label11.Visible = true;
             * }
             *
             */
        }
Exemplo n.º 2
0
        private async void button2_Click(object sender, EventArgs e)//track
        {
            SearchInventory search = new SearchInventory();

            //inventory search
            HttpResponseMessage inventory = Api.ClientConfig(textBox1.Text).GetAsync(Uri.EscapeUriString("characters/" + comboBox1.Text + "/inventory")).Result;
            string inventoryResponse      = await inventory.Content.ReadAsStringAsync();

            var items = Items.FromJson(inventoryResponse);

            search.items = items;

            //Vault search
            HttpResponseMessage vault_response = Api.ClientConfig(textBox1.Text).GetAsync("account/materials").Result;
            string vault_value = await vault_response.Content.ReadAsStringAsync();

            var vault = Vault.FromJson(vault_value);

            search.vault = vault;

            //String.Join(",", lst)
            //vendor search
            //var stringue = string.Join(",", search.vendor);
            if (search.vendor != null)
            {
                HttpResponseMessage vendor_response = Api.ClientConfig(textBox1.Text).GetAsync("items?ids=" + string.Join(",", search.vendor)).Result;
                string vendor_response_content      = await vendor_response.Content.ReadAsStringAsync();

                var vendor = Vendor.FromJson(vendor_response_content);
                search.vendor_value = vendor;
            }

            //Calculate value
            Calc calc       = new Calc();
            var  vault_calc = calc.Vault(search, market_id, market_sell, market_buy);
            var  inv_calc   = calc.Inventory(search, market_id, market_sell, market_buy);

            if (search.vendor != null)
            {
                var junk = calc.Vendor(search);
            }
            else
            {
                calc.junk_value = 0;
            }

            //display value
            int[] value = Monetary(vault_calc.vault_sell);
            VaultValue.Text    = value[0].ToString() + "g" + value[1].ToString() + "s" + value[2].ToString() + "c";
            VaultValue.Visible = true;

            value = Monetary(inv_calc.inv_sell);
            InventoryValue.Text    = value[0].ToString() + "g" + value[1].ToString() + "s" + value[2].ToString() + "c";
            InventoryValue.Visible = true;

            g_tpsell     = inv_calc.inv_sell;
            g_tpbuy      = inv_calc.inv_buy;
            g_marketbuy  = vault_calc.vault_buy;
            g_marketsell = vault_calc.vault_sell;

            button6.Enabled = true;
        }