Class PotionRecipe
Implements a potion recipe to support equality comparison, hashing, and string output. Internally the recipe is just an array of item template IDs abstracted to an Ingredient type. A recipe can be constructed from any Ingredient[] array or int[] array of item template IDs.
Namespace: DaggerfallWorkshop.Game.MagicAndEffects
Assembly: Assembly-CSharp.dll
Syntax
public class PotionRecipe : IEqualityComparer<PotionRecipe.Ingredient[]>
Constructors
| Improve this Doc View SourcePotionRecipe()
Default constructor.
Declaration
public PotionRecipe()
PotionRecipe(List<Int32>)
Ingredient[] array constructor - for finding and comparisons.
Declaration
public PotionRecipe(List<int> ids)
Parameters
Type | Name | Description |
---|---|---|
List<Int32> | ids | Ingredient ids list. |
PotionRecipe(String, Int32, EffectSettings, PotionRecipe.Ingredient[])
Ingredient[] array constructor.
Declaration
public PotionRecipe(string displayNameKey, int price, EffectSettings settings, params PotionRecipe.Ingredient[] ingredients)
Parameters
Type | Name | Description |
---|---|---|
String | displayNameKey | Potion name key to use for this recipe. |
Int32 | price | Value of potion in gp. |
EffectSettings | settings | Settings for this potion recipe. |
PotionRecipe.Ingredient[] | ingredients | Ingredient array. |
PotionRecipe(String, Int32, EffectSettings, Int32[])
int[] array of item template IDs constructor.
Declaration
public PotionRecipe(string displayNameKey, int price, EffectSettings settings, params int[] ids)
Parameters
Type | Name | Description |
---|---|---|
String | displayNameKey | |
Int32 | price | Value of potion in gp. |
EffectSettings | settings | Settings for this potion recipe. |
Int32[] | ids | Array of item template IDs. |
Fields
| Improve this Doc View SourceclassicRecipeKeys
Declaration
public static readonly int[] classicRecipeKeys
Field Value
Type | Description |
---|---|
Int32[] |
Properties
| Improve this Doc View SourceCustomDisplayName
Custom display name of this potion recipe. If set, this property will be returned by DisplayName.
Declaration
public string CustomDisplayName { get; set; }
Property Value
Type | Description |
---|---|
String |
DisplayName
Declaration
public string DisplayName { get; }
Property Value
Type | Description |
---|---|
String |
DisplayNameKey
The display name of this potion recipe.
Declaration
public string DisplayNameKey { get; set; }
Property Value
Type | Description |
---|---|
String |
Ingredients
Gets or sets potion recipe ingredients. Ingredients must be sorted by id.
Declaration
public PotionRecipe.Ingredient[] Ingredients { get; set; }
Property Value
Type | Description |
---|---|
PotionRecipe.Ingredient[] |
Price
The price of this potion recipe.
Declaration
public int Price { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
SecondaryEffects
Retrieves a list of secondary effect keys.
Declaration
public List<string> SecondaryEffects { get; }
Property Value
Type | Description |
---|---|
List<String> |
Settings
Gets or sets effect settings for this recipe.
Declaration
public EffectSettings Settings { get; set; }
Property Value
Type | Description |
---|---|
EffectSettings |
TextureRecord
The texture record from archive 205 to use for this potion, default = 11.
Declaration
public int TextureRecord { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAddSecondaryEffect(String)
Adds secondary effects to this potion recipe.
Declaration
public void AddSecondaryEffect(string effectKey)
Parameters
Type | Name | Description |
---|---|---|
String | effectKey | The EffectKey of the effect to add. |
Equals(PotionRecipe.Ingredient[])
Compare a recipe with this one.
Declaration
public bool Equals(PotionRecipe.Ingredient[] ingredients)
Parameters
Type | Name | Description |
---|---|---|
PotionRecipe.Ingredient[] | ingredients | Other recipe. |
Returns
Type | Description |
---|---|
Boolean | True if other recipe equal with this one. |
Equals(PotionRecipe.Ingredient[], PotionRecipe.Ingredient[])
Compare two recipes for equality.
Declaration
public bool Equals(PotionRecipe.Ingredient[] ingredients1, PotionRecipe.Ingredient[] ingredients2)
Parameters
Type | Name | Description |
---|---|---|
PotionRecipe.Ingredient[] | ingredients1 | First recipe. |
PotionRecipe.Ingredient[] | ingredients2 | Second recipe. |
Returns
Type | Description |
---|---|
Boolean | True if recipes are equal. |
Equals(Object)
Compare another PotionRecipe class with this one.
Declaration
public override bool Equals(object other)
Parameters
Type | Name | Description |
---|---|---|
Object | other | Other potion recipe class. |
Returns
Type | Description |
---|---|
Boolean | True if both recipes are equal. |
Overrides
| Improve this Doc View SourceGetDisplayName()
Declaration
public string GetDisplayName()
Returns
Type | Description |
---|---|
String |
GetHashCode()
Gets hash code for this recipe.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Hash code. |
Overrides
| Improve this Doc View SourceGetHashCode(PotionRecipe.Ingredient[])
Gets a hash code for recipe from ingredients. Note: Using hash code calculation from: https://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode
Declaration
public int GetHashCode(PotionRecipe.Ingredient[] ingredients)
Parameters
Type | Name | Description |
---|---|---|
PotionRecipe.Ingredient[] | ingredients | Ingredients. |
Returns
Type | Description |
---|---|
Int32 | Hash code. |
HasRecipe()
Checks if recipe is defined.
Declaration
public bool HasRecipe()
Returns
Type | Description |
---|---|
Boolean | True if recipe has at least one ingredient. |
ToString()
Gets string listing all ingredients.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | Ingredient list. |