Class EntityEffectBroker
Enumerates available magic effects and coordinates their instantiation. Also coordinates "magic rounds" at 5-second intervals for all entity EntityEffectManager components active in scene.
Namespace: DaggerfallWorkshop.Game.MagicAndEffects
Assembly: Assembly-CSharp.dll
Syntax
public class EntityEffectBroker : MonoBehaviour
Constructors
| Improve this Doc View SourceEntityEffectBroker()
Declaration
public EntityEffectBroker()
Fields
| Improve this Doc View SourceCurrentSpellVersion
Declaration
public const int CurrentSpellVersion = 1
Field Value
Type | Description |
---|---|
Int32 |
ElementFlags_All
Declaration
public const ElementTypes ElementFlags_All = ElementTypes.Fire | ElementTypes.Cold | ElementTypes.Poison | ElementTypes.Shock | ElementTypes.Magic
Field Value
Type | Description |
---|---|
ElementTypes |
ElementFlags_MagicOnly
Declaration
public const ElementTypes ElementFlags_MagicOnly = ElementTypes.Magic
Field Value
Type | Description |
---|---|
ElementTypes |
ElementFlags_None
Declaration
public const ElementTypes ElementFlags_None = ElementTypes.None
Field Value
Type | Description |
---|---|
ElementTypes |
MagicCraftingFlags_All
Declaration
public const MagicCraftingStations MagicCraftingFlags_All = MagicCraftingStations.SpellMaker | MagicCraftingStations.PotionMaker | MagicCraftingStations.ItemMaker
Field Value
Type | Description |
---|---|
MagicCraftingStations |
MagicCraftingFlags_None
Declaration
public const MagicCraftingStations MagicCraftingFlags_None = MagicCraftingStations.None
Field Value
Type | Description |
---|---|
MagicCraftingStations |
MinimumSupportedSpellVersion
Declaration
public const int MinimumSupportedSpellVersion = 1
Field Value
Type | Description |
---|---|
Int32 |
TargetFlags_All
Declaration
public const TargetTypes TargetFlags_All = TargetTypes.CasterOnly | TargetTypes.ByTouch | TargetTypes.SingleTargetAtRange | TargetTypes.AreaAroundCaster | TargetTypes.AreaAtRange
Field Value
Type | Description |
---|---|
TargetTypes |
TargetFlags_None
Declaration
public const TargetTypes TargetFlags_None = TargetTypes.None
Field Value
Type | Description |
---|---|
TargetTypes |
TargetFlags_Other
Declaration
public const TargetTypes TargetFlags_Other = TargetTypes.ByTouch | TargetTypes.SingleTargetAtRange | TargetTypes.AreaAroundCaster | TargetTypes.AreaAtRange
Field Value
Type | Description |
---|---|
TargetTypes |
TargetFlags_Self
Declaration
public const TargetTypes TargetFlags_Self = TargetTypes.CasterOnly
Field Value
Type | Description |
---|---|
TargetTypes |
Properties
| Improve this Doc View SourceMagicRoundsSinceStartup
Gets the number of game-minute "magic rounds" since startup. Reset to current game time when player loads a game or starts a new game.
Declaration
public int MagicRoundsSinceStartup { get; }
Property Value
Type | Description |
---|---|
Int32 |
StandardSpells
The list of standard spells (aka circinate spells), taken from SPELLS.STD and potentially modified (or added to) by mods
Declaration
public IEnumerable<SpellRecord.SpellRecordData> StandardSpells { get; }
Property Value
Type | Description |
---|---|
IEnumerable<SpellRecord.SpellRecordData> |
SyntheticTimeIncrease
Gets or sets flag stating if time was just increased synthetically. Should only be raised by fast travel and prison time. Some time-based effects do not operate during these increases, e.g. the "item deteriorates" side-effect This flag is lowered at the end of each magic update.
Declaration
public bool SyntheticTimeIncrease { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceAllEffectsImplemented(SpellRecord.SpellRecordData)
Checks if all classic effects map to an implemented IEntityEffect template.
Declaration
public bool AllEffectsImplemented(SpellRecord.SpellRecordData spellRecordData)
Parameters
Type | Name | Description |
---|---|---|
SpellRecord.SpellRecordData | spellRecordData | Classic spell record data. |
Returns
Type | Description |
---|---|
Boolean | True if all classic effects map to an effect template. |
ClassicEffectRecordToEffectEntry(SpellRecord.EffectRecordData, out EffectEntry)
Generate EffectEntry from classic EffectRecordData.
Declaration
public bool ClassicEffectRecordToEffectEntry(SpellRecord.EffectRecordData effectRecordData, out EffectEntry effectEntryOut)
Parameters
Type | Name | Description |
---|---|---|
SpellRecord.EffectRecordData | effectRecordData | Classic effect record data. |
EffectEntry | effectEntryOut |
Returns
Type | Description |
---|---|
Boolean | EffectEntry. |
ClassicEffectRecordToEffectSettings(SpellRecord.EffectRecordData, Boolean, Boolean, Boolean)
Generate EffectSettings from classic EffectRecordData.
Declaration
public EffectSettings ClassicEffectRecordToEffectSettings(SpellRecord.EffectRecordData effectRecordData, bool supportDuration, bool supportChance, bool supportMagnitude)
Parameters
Type | Name | Description |
---|---|---|
SpellRecord.EffectRecordData | effectRecordData | Classic effect record data. |
Boolean | supportDuration | |
Boolean | supportChance | |
Boolean | supportMagnitude |
Returns
Type | Description |
---|---|
EffectSettings | EffectSettings. |
ClassicElementIndexToElementType(Int32)
Maps classic element index to ElementTypes enum.
Declaration
public ElementTypes ClassicElementIndexToElementType(int elementIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | elementIndex | Classic element index. |
Returns
Type | Description |
---|---|
ElementTypes | ElementTypes. |
ClassicSpellRecordDataToEffectBundleSettings(SpellRecord.SpellRecordData, BundleTypes, out EffectBundleSettings)
Generate EffectBundleSettings from classic SpellRecordData.
Declaration
public bool ClassicSpellRecordDataToEffectBundleSettings(SpellRecord.SpellRecordData spellRecordData, BundleTypes bundleType, out EffectBundleSettings effectBundleSettingsOut)
Parameters
Type | Name | Description |
---|---|---|
SpellRecord.SpellRecordData | spellRecordData | Classic spell record data. |
BundleTypes | bundleType | Type of bundle to create. |
EffectBundleSettings | effectBundleSettingsOut | Effect bundle created by conversion. |
Returns
Type | Description |
---|---|
Boolean | True if successful, otherwise false. |
ClassicTargetIndexToTargetType(Int32)
Maps classic target index to TargetTypes.
Declaration
public TargetTypes ClassicTargetIndexToTargetType(int targetIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | targetIndex | Classic target index. |
Returns
Type | Description |
---|---|
TargetTypes | TargetTypes. |
CloneEffect(IEntityEffect)
Clone an effect and its settings.
Declaration
public IEntityEffect CloneEffect(IEntityEffect effect)
Parameters
Type | Name | Description |
---|---|---|
IEntityEffect | effect | Effect to clone. |
Returns
Type | Description |
---|---|
IEntityEffect | Interface to cloned effect. |
GetClassicSpellRecord(Int32, out SpellRecord.SpellRecordData)
Gets classic spell record data.
Declaration
public bool GetClassicSpellRecord(int id, out SpellRecord.SpellRecordData spellOut)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | ID of spell. |
SpellRecord.SpellRecordData | spellOut | Spell record data (if found). |
Returns
Type | Description |
---|---|
Boolean | True if spell found, otherwise false. |
GetCustomSpellBundleOffer(String)
Gets a specific custom spell bundle offer.
Declaration
public EntityEffectBroker.CustomSpellBundleOffer GetCustomSpellBundleOffer(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key |
Returns
Type | Description |
---|---|
EntityEffectBroker.CustomSpellBundleOffer |
GetCustomSpellBundleOffers(EntityEffectBroker.CustomSpellBundleOfferUsage)
Gets all custom spell bundle offers based on usage.
Declaration
public EntityEffectBroker.CustomSpellBundleOffer[] GetCustomSpellBundleOffers(EntityEffectBroker.CustomSpellBundleOfferUsage usage = EntityEffectBroker.CustomSpellBundleOfferUsage.All)
Parameters
Type | Name | Description |
---|---|---|
EntityEffectBroker.CustomSpellBundleOfferUsage | usage |
Returns
Type | Description |
---|---|
EntityEffectBroker.CustomSpellBundleOffer[] |
GetCustomSpellBundles(EntityEffectBroker.CustomSpellBundleOfferUsage)
Gets all custom spell bundles based on usage.
Declaration
public EffectBundleSettings[] GetCustomSpellBundles(EntityEffectBroker.CustomSpellBundleOfferUsage usage = EntityEffectBroker.CustomSpellBundleOfferUsage.All)
Parameters
Type | Name | Description |
---|---|---|
EntityEffectBroker.CustomSpellBundleOfferUsage | usage |
Returns
Type | Description |
---|---|
EffectBundleSettings[] |
GetEffectPotionRecipe(IEntityEffect, Int32)
Gets PotionRecipe from IEntityEffect. Effect must allow the potion maker crafting station and define potion recipes.
Declaration
public PotionRecipe GetEffectPotionRecipe(IEntityEffect effect, int variant = 0)
Parameters
Type | Name | Description |
---|---|---|
IEntityEffect | effect | Input effect. |
Int32 | variant | Variant index, if more than one exists. |
Returns
Type | Description |
---|---|
PotionRecipe | PotionRecipe if the effect has one, otherwise null. |
GetEffectPotionRecipeCount(IEntityEffect)
Gets number of potion properties assigned to this effect. Effect must allow the potion maker crafting station and define potion recipes. Effect
Declaration
public int GetEffectPotionRecipeCount(IEntityEffect effect)
Parameters
Type | Name | Description |
---|---|---|
IEntityEffect | effect | Input effect. |
Returns
Type | Description |
---|---|
Int32 | Number of recipes for this effect. |
GetEffectTemplate(Int32)
Gets interface to effect template from classic key.
Declaration
public IEntityEffect GetEffectTemplate(int classicKey)
Parameters
Type | Name | Description |
---|---|---|
Int32 | classicKey | Classic key. |
Returns
Type | Description |
---|---|
IEntityEffect | Interface to effect template only (has default effect settings). |
GetEffectTemplate(String)
Gets interface to effect template. Use this to query properties to all effects with this key.
Declaration
public IEntityEffect GetEffectTemplate(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | Effect key. |
Returns
Type | Description |
---|---|
IEntityEffect | Interface to effect template only (has default effect settings). |
GetEffectTemplateFromClassicEffectRecordData(SpellRecord.EffectRecordData)
Gets effect template from classic effect record data, if one is available.
Declaration
public IEntityEffect GetEffectTemplateFromClassicEffectRecordData(SpellRecord.EffectRecordData effectRecordData)
Parameters
Type | Name | Description |
---|---|---|
SpellRecord.EffectRecordData | effectRecordData | Classic effect record data. |
Returns
Type | Description |
---|---|
IEntityEffect | IEntityEffect of template found or null if no matching template found. |
GetEffectTemplates(String, MagicCraftingStations)
Gets interface to all effect templates belonging to group name.
Declaration
public List<IEntityEffect> GetEffectTemplates(string groupName, MagicCraftingStations craftingStations = MagicCraftingStations.SpellMaker | MagicCraftingStations.PotionMaker | MagicCraftingStations.ItemMaker)
Parameters
Type | Name | Description |
---|---|---|
String | groupName | The group name to collect effects from. |
MagicCraftingStations | craftingStations | Filter by allowed magic crafting stations. |
Returns
Type | Description |
---|---|
List<IEntityEffect> | List of effect templates. |
GetEnchantmentEffectTemplates(Boolean)
Gets all registered item maker effects. Only classes exposing MagicCraftingStations.ItemMaker in properties will be returned.
Declaration
public List<IEntityEffect> GetEnchantmentEffectTemplates(bool sortAlpha = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | sortAlpha | True to sort enchantment names by alpha. |
Returns
Type | Description |
---|---|
List<IEntityEffect> | List of item enchantment templates. |
GetGroupNames(Boolean, MagicCraftingStations)
Gets group names of registered effects.
Declaration
public string[] GetGroupNames(bool sortAlpha = true, MagicCraftingStations craftingStations = MagicCraftingStations.SpellMaker | MagicCraftingStations.PotionMaker | MagicCraftingStations.ItemMaker)
Parameters
Type | Name | Description |
---|---|---|
Boolean | sortAlpha | True to sort group names by alpha. |
MagicCraftingStations | craftingStations | Filter by allowed magic crafting stations. |
Returns
Type | Description |
---|---|
String[] | Array of group names. |
GetPotionRecipe(Int32)
Gets PotionRecipe from effect that matches the recipeKey provided.
Declaration
public PotionRecipe GetPotionRecipe(int recipeKey)
Parameters
Type | Name | Description |
---|---|---|
Int32 | recipeKey | Hashcode of a set of ingredients. |
Returns
Type | Description |
---|---|
PotionRecipe | PotionRecipe if the key matches one from an effect, otherwise null. |
GetPotionRecipeEffect(PotionRecipe)
Gets IEntityEffect from PotionRecipe.
Declaration
public IEntityEffect GetPotionRecipeEffect(PotionRecipe recipe)
Parameters
Type | Name | Description |
---|---|---|
PotionRecipe | recipe | Input recipe. |
Returns
Type | Description |
---|---|
IEntityEffect | IEntityEffect if this recipe is linked to an effect, otherwise null. |
GetPotionRecipeKeys()
Get recipeKeys for all registered potion recipes.
Declaration
public List<int> GetPotionRecipeKeys()
Returns
Type | Description |
---|---|
List<Int32> | List of int recipeKeys |
GetSubGroupNames(String, Boolean, MagicCraftingStations)
Gets subgroup names of registered effects.
Declaration
public string[] GetSubGroupNames(string groupName, bool sortAlpha = true, MagicCraftingStations craftingStations = MagicCraftingStations.SpellMaker | MagicCraftingStations.PotionMaker | MagicCraftingStations.ItemMaker)
Parameters
Type | Name | Description |
---|---|---|
String | groupName | The group name to collect subgroups of. |
Boolean | sortAlpha | True to sort subgroup names by alpha. |
MagicCraftingStations | craftingStations | Filter by allowed magic crafting stations. |
Returns
Type | Description |
---|---|
String[] | Array of subgroup names. |
HasEffectTemplate(Int32)
Determine if a classic key exists in the templates dictionary.
Declaration
public bool HasEffectTemplate(int classicKey)
Parameters
Type | Name | Description |
---|---|---|
Int32 | classicKey | Classic key for template. |
Returns
Type | Description |
---|---|
Boolean | True if template exists. |
HasEffectTemplate(String)
Determine if a key exists in the templates dictionary.
Declaration
public bool HasEffectTemplate(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | Key for template. |
Returns
Type | Description |
---|---|
Boolean | True if template exists. |
InstantiateEffect(EffectEntry)
Creates a new instance of effect with specified settings. Use this to create a new effect with unique settings for actual use.
Declaration
public IEntityEffect InstantiateEffect(EffectEntry effectEntry)
Parameters
Type | Name | Description |
---|---|---|
EffectEntry | effectEntry | EffectEntry with effect settings. |
Returns
Type | Description |
---|---|
IEntityEffect | Interface to new effect instance. |
InstantiateEffect(String, EffectSettings)
Creates a new instance of effect with specified settings. Use this to create a new effect with unique settings for actual use.
Declaration
public IEntityEffect InstantiateEffect(string key, EffectSettings settings)
Parameters
Type | Name | Description |
---|---|---|
String | key | Effect key. |
EffectSettings | settings | Effect settings. |
Returns
Type | Description |
---|---|
IEntityEffect | Interface to new effect instance. |
LogRecipeIngredientUsage()
Logs a summary of how many recipes ingredients are used in so new recipes can choose to use little used ingredients. Intended for mod devs, used by invoking 'ingredUsage' console command.
Declaration
public void LogRecipeIngredientUsage()
RaiseOnEndSyntheticTimeIncreaseEvent()
Declaration
protected virtual void RaiseOnEndSyntheticTimeIncreaseEvent()
RaiseOnNewMagicRoundEvent()
Declaration
protected virtual void RaiseOnNewMagicRoundEvent()
RaiseOnRegisterCustomEffectsEvent()
Declaration
protected virtual void RaiseOnRegisterCustomEffectsEvent()
RegisterCustomSpellBundleOffer(EntityEffectBroker.CustomSpellBundleOffer)
Register a custom spell bundle from pre-made settings.
Declaration
public void RegisterCustomSpellBundleOffer(EntityEffectBroker.CustomSpellBundleOffer offer)
Parameters
Type | Name | Description |
---|---|---|
EntityEffectBroker.CustomSpellBundleOffer | offer | Offer settings. |
RegisterEffectTemplate(BaseEntityEffect, Boolean)
Register new effect template with broker. Also maps classic key and potion recipes defined by effect.
Declaration
public bool RegisterEffectTemplate(BaseEntityEffect effect, bool allowReplacement = false)
Parameters
Type | Name | Description |
---|---|---|
BaseEntityEffect | effect | New effect to register. |
Boolean | allowReplacement | Allow replacement of existing effect with this key. |
Returns
Type | Description |
---|---|
Boolean | True if successful. |
StartGameBehaviour_OnStartGame(Object, EventArgs)
Declaration
public void StartGameBehaviour_OnStartGame(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | |
EventArgs | e |
Events
| Improve this Doc View SourceOnEndSyntheticTimeIncrease
Declaration
public static event EntityEffectBroker.OnEndSyntheticTimeIncreaseEventHandler OnEndSyntheticTimeIncrease
Event Type
Type | Description |
---|---|
EntityEffectBroker.OnEndSyntheticTimeIncreaseEventHandler |
OnNewMagicRound
Declaration
public static event EntityEffectBroker.OnNewMagicRoundEventHandler OnNewMagicRound
Event Type
Type | Description |
---|---|
EntityEffectBroker.OnNewMagicRoundEventHandler |
OnRegisterCustomEffects
Declaration
public static event EntityEffectBroker.OnRegisterCustomEffectsEventHandler OnRegisterCustomEffects
Event Type
Type | Description |
---|---|
EntityEffectBroker.OnRegisterCustomEffectsEventHandler |