Ejemplo n.º 1
0
        private async void PopulateItemBox()
        {
            pnlInv.AutoScroll           = false;
            pnlInv.VerticalScroll.Value = 0;
            float plat_total = 0;

            pnlInv.Controls.Clear();
            for (int i = 0; i < Math.Ceiling((decimal)inventory.Count / (decimal)7.0); ++i)
            {
                for (int ii = 0; ii < Math.Min(7, (inventory.Count - i * 7)); ++ii)
                {
                    String item_name = await dh.GetItemProperty(inventory[i * 7 + ii].Item1, "item_name");

                    float price = await dh.GetItemPrice(inventory[i * 7 + ii].Item1);

                    if (item_name == "" || price == 0)
                    {
                        CreateNewItemDisplay(new Point(10 + ii * 150, 10 + i * 150), inventory[i * 7 + ii].Item1, 0, 0, true);
                        continue;
                    }
                    CreateNewItemDisplay(new Point(10 + ii * 150, 10 + i * 150), item_name, (int)inventory[i * 7 + ii].Item2, price);
                    plat_total += (int)inventory[i * 7 + ii].Item2 * price;
                }
            }
            lblPTotal.Text    = "Plat Total: " + plat_total.ToString();
            pnlInv.AutoScroll = true;
        }
        private async void InitMods()
        {
            if (System.IO.File.Exists("mod_list.txt"))
            {
                String[] names = System.IO.File.ReadAllLines("mod_list.txt");
                for (int i = 0; i < names.GetLength(0); ++i)
                {
                    String name = names[i];
                    lblStatus.Text = "Getting " + name + " data";
                    lblStatus.Refresh();
                    String rarity = await dh.GetItemProperty(name, "rarity");

                    lblStatus.Text = "Getting " + name + " price";
                    lblStatus.Refresh();
                    float price = await dh.GetItemPrice(name, "avg_price");

                    float min = 0;
                    float max = 0;
                    if (price != 0)
                    {
                        min = await dh.GetItemPrice(name, "min_price");

                        max = await dh.GetItemPrice(name, "max_price");
                    }

                    mods.Add(new Tuple <String, String, float, float, float>(name, rarity, price, min, max));
                }
            }
            lblStatus.Text = "";
            UpdatePanel();
        }