Exemplo n.º 1
0
        private void RefreshLists()
        {
            string old_enemy = enemySearch.Text;

            int old_index_a = allMats.SelectedIndex;
            int old_index_e = enemyList.SelectedIndex;

            allMats.DataSource = null;

            for (int i = 0; i < rbuttons.Count; i++)
            {
                if (rbuttons[i].Checked)
                {
                    SortLoot(_state.Player.Loot.FilterLoot(i + 1));
                    break;
                }
            }

            // this is separate because we can't filter "all loot"
            if (allButton.Checked)
            {
                SortLoot(_state.Player.Loot.EnemyLoot);
            }

            enemyList.DataSource = null;
            enemyList.DataSource = index;
            enemySearch.Clear();
            enemySearch.Text        = old_enemy;
            enemyList.SelectedIndex = old_index_e;

            _state.HandleSelectedIndex(allMats, old_index_a);
        }
Exemplo n.º 2
0
        private void RemoveRecipeFromList(Recipes.Recipe selected, int s_index)
        {
            _state.Player.Loot.Recipes.Remove(selected);

            recipeList.DataSource = null;

            if (_state.Player.Loot.Wishlist.Contains(selected))
            {
                _state.Player.Loot.Wishlist.Remove(selected);
            }

            var display = _state.Player.Loot.Recipes.FindAll(r => r.Result != null);

            if (display != null && display.Count > 0)
            {
                for (int i = 0; i < rbuttons.Count; i++)
                {
                    if (rbuttons[i].Checked)
                    {
                        FindPiece(i);
                    }
                }

                if (allButton.Checked)
                {
                    recipeList.DataSource = display;
                }

                if (wlistButton.Checked)
                {
                    recipeList.DataSource = _state.Player.Loot.Wishlist;
                }

                if (recipeList.Items.Count > 0)
                {
                    _state.HandleSelectedIndex(recipeList, s_index);
                }
                else
                {
                    ClearDisplayBox();
                }
            }
            else
            {
                ClearDisplayBox();
            }
        }
Exemplo n.º 3
0
        private void PurchaseButton_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                string selected = VendorWares.SelectedItem.ToString();
                long   cost     = costs[selected];

                if (_state.Player.Wallet.Coins - cost < 0)
                {
                    VendorTextBox.Text = vendorDialog[vendor][2];
                }
                else
                {
                    int s_index = VendorWares.SelectedIndex;
                    _state.Player.Wallet.Coins -= cost;
                    if (selected.Contains("Charm"))
                    {
                        var charm = charms.Find(c => c.ToString().Equals(selected));
                        _state.Player.Inventory.AddArmor(charm);
                        charms.Remove(charm);
                        wares_charms.Remove(charm.ToString());
                    }
                    else
                    {
                        // wares = num_dungeonTypes - 1
                        // we're going to use the dungeonType later to access our key index so we have to add by 1
                        int index = wares_keys.IndexOf(selected);
                        _state.Player.Wallet.Keys[index + 1]++;
                    }

                    VendorTextBox.Text = vendorDialog[vendor][1];
                    UpdatePlayerCoins(_state.Player.Wallet.Coins);
                    UpdateVendorDisplay();

                    _state.HandleSelectedIndex(VendorWares, s_index);
                    _state.Save.SaveGame(_state.Player);
                }
            }
            catch (NullReferenceException)
            {
                allRadio.Checked = true;
            }
        }