protected virtual void Refresh() { // Update labels goldLabel.Text = GameManager.Instance.PlayerEntity.GetGoldAmount().ToString(); // Add ingredient items to list and gather recipes - from inventory and wagon ingredients.Clear(); List <DaggerfallUnityItem> recipeItems = new List <DaggerfallUnityItem>(); foreach (ItemCollection playerItems in new ItemCollection[] { GameManager.Instance.PlayerEntity.Items, GameManager.Instance.PlayerEntity.WagonItems }) { for (int i = 0; i < playerItems.Count; i++) { DaggerfallUnityItem item = playerItems.GetItem(i); if (item.IsIngredient && !item.IsEnchanted) { ingredients.AddItem(item.Clone()); } else if (item.IsPotionRecipe) { recipeItems.Add(item); } } } RefreshIngredientsList(); ingredientsListScroller.Items = ingredientsList; // Clear cauldron and assign to scroller cauldron.Clear(); cauldronListScroller.Items = cauldron; // Populate picker from recipe items recipes.Clear(); recipePicker.ListBox.ClearItems(); foreach (DaggerfallUnityItem recipeItem in recipeItems) { PotionRecipe potionRecipe = GameManager.Instance.EntityEffectBroker.GetPotionRecipe(recipeItem.PotionRecipeKey); if (!recipes.Contains(potionRecipe)) { recipes.Add(potionRecipe); } } recipes.Sort((x, y) => (x.DisplayName.CompareTo(y.DisplayName))); foreach (PotionRecipe potionRecipe in recipes) { recipePicker.ListBox.AddItem(potionRecipe.DisplayName); } }
void AddToCauldron(DaggerfallUnityItem item) { if (cauldron.Count < 8) { if (item.stackCount == 1) { cauldron.Add(item); ingredients.Remove(item); } else { item.stackCount--; DaggerfallUnityItem newItem = item.Clone(); newItem.stackCount = 1; cauldron.Add(newItem); } ingredientsListScroller.Items = ingredients; cauldronListScroller.Items = cauldron; } }