Skip to content

Commit

Permalink
Console command to add random potion recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Interkarma committed Oct 11, 2023
1 parent 3113e38 commit 96e06f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -1701,7 +1701,7 @@ private static class AddInventoryItem
{
public static readonly string name = "add";
public static readonly string description = "Adds n inventory items to the character, based on the given keyword. n = 1 by default";
public static readonly string usage = "add (book|weapon|armor|cloth|ingr|relig|soul|gold|magic|drug|map|torch|potion|painting) [n]";
public static readonly string usage = "add (book|weapon|armor|cloth|ingr|relig|soul|gold|magic|drug|map|torch|potion|recipe|painting) [n]";

public static string Execute(params string[] args)
{
Expand Down Expand Up @@ -1773,6 +1773,9 @@ public static string Execute(params string[] args)
case "potion":
newItem = ItemBuilder.CreateRandomPotion();
break;
case "recipe":
newItem = ItemBuilder.CreateRandomRecipe();
break;
case "painting":
newItem = ItemBuilder.CreateItem(ItemGroups.Paintings, (int)Paintings.Painting);
break;
Expand Down
7 changes: 7 additions & 0 deletions Assets/Scripts/Game/Items/ItemBuilder.cs
Expand Up @@ -761,6 +761,13 @@ public static DaggerfallUnityItem CreateRandomPotion(int stackSize = 1)
return CreatePotion(recipeKeys[recipeIdx]);
}

public static DaggerfallUnityItem CreateRandomRecipe(int stackSize = 1)
{
List<int> recipeKeys = GameManager.Instance.EntityEffectBroker.GetPotionRecipeKeys();
int recipeIdx = UnityEngine.Random.Range(0, recipeKeys.Count);
return new DaggerfallUnityItem(ItemGroups.MiscItems, 4) { PotionRecipeKey = recipeKeys[recipeIdx], stackCount = stackSize };
}

/// <summary>
/// Creates a random (classic) potion
/// </summary>
Expand Down

0 comments on commit 96e06f3

Please sign in to comment.