Show / Hide Table of Contents

Class ItemManager

Manager for handling all custom data added to the game related to items.
Inheritance
System.Object
ItemManager
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Jotunn.Managers
Assembly: Jotunn.dll
Syntax
public class ItemManager : IManager

Properties

| Improve this Doc View Source

Instance

The singleton instance of this manager.
Declaration
public static ItemManager Instance { get; }
Property Value
Type Description
ItemManager

Methods

| Improve this Doc View Source

AddItem(CustomItem)

Add a CustomItem to the game.
Checks if the custom item is valid and unique and adds it to the list of custom items.
Also adds the prefab of the custom item to the PrefabManager.
Custom items are added to the current on every .
Declaration
public bool AddItem(CustomItem customItem)
Parameters
Type Name Description
CustomItem customItem The custom item to add.
Returns
Type Description
System.Boolean true if the custom item was added to the manager.
| Improve this Doc View Source

AddItemConversion(CustomItemConversion)

Add a new item conversion
Declaration
public bool AddItemConversion(CustomItemConversion itemConversion)
Parameters
Type Name Description
CustomItemConversion itemConversion Item conversion details
Returns
Type Description
System.Boolean Whether the addition was successful or not
| Improve this Doc View Source

AddRecipe(CustomRecipe)

Add a CustomRecipe to the game.
Checks if the custom recipe is unique and adds it to the list of custom recipes.
Custom recipes are added to the current on every .
Declaration
public bool AddRecipe(CustomRecipe customRecipe)
Parameters
Type Name Description
CustomRecipe customRecipe The custom recipe to add.
Returns
Type Description
System.Boolean true if the custom recipe was added to the manager.
| Improve this Doc View Source

AddRecipesFromJson(String)

Adds recipes defined in a JSON file at given path, relative to BepInEx/plugins
Declaration
public void AddRecipesFromJson(string path)
Parameters
Type Name Description
System.String path JSON file path, relative to BepInEx/plugins folder
| Improve this Doc View Source

AddStatusEffect(CustomStatusEffect)

Add a CustomStatusEffect to the game.
Checks if the custom status effect is unique and adds it to the list of custom status effects.
Custom status effects are added to the current on every .
Declaration
public bool AddStatusEffect(CustomStatusEffect customStatusEffect)
Parameters
Type Name Description
CustomStatusEffect customStatusEffect The custom status effect to add.
Returns
Type Description
System.Boolean true if the custom status effect was added to the manager.
| Improve this Doc View Source

GetItem(String)

Get a custom item by its name.
Declaration
public CustomItem GetItem(string itemName)
Parameters
Type Name Description
System.String itemName Name of the item to search.
Returns
Type Description
CustomItem
| Improve this Doc View Source

GetRecipe(String)

Get a custom recipe by its name.
Declaration
public CustomRecipe GetRecipe(string recipeName)
Parameters
Type Name Description
System.String recipeName Name of the recipe to search.
Returns
Type Description
CustomRecipe
| Improve this Doc View Source

Init()

Registers all hooks.
Declaration
public void Init()
| Improve this Doc View Source

RegisterItemInObjectDB(GameObject)

Register a single item in the current ObjectDB. Also adds the prefab to the PrefabManager and if necessary.
No mock references are fixed.
Declaration
public void RegisterItemInObjectDB(GameObject prefab)
Parameters
Type Name Description
GameObject prefab with an component to add to the
| Improve this Doc View Source

RemoveItem(CustomItem)

Remove a custom item by its ref. Removes the custom recipe, too.
Declaration
public void RemoveItem(CustomItem item)
Parameters
Type Name Description
CustomItem item CustomItem to remove.
| Improve this Doc View Source

RemoveItem(String)

Remove a custom item by its name. Removes the custom recipe, too.
Declaration
public void RemoveItem(string itemName)
Parameters
Type Name Description
System.String itemName Name of the item to remove.
| Improve this Doc View Source

RemoveRecipe(CustomRecipe)

Remove a custom recipe by its ref. Removes it from the manager and the , if instantiated.
Declaration
public void RemoveRecipe(CustomRecipe recipe)
Parameters
Type Name Description
CustomRecipe recipe CustomRecipe to remove.
| Improve this Doc View Source

RemoveRecipe(String)

Remove a custom recipe by its name. Removes it from the manager and the , if instantiated.
Declaration
public void RemoveRecipe(string recipeName)
Parameters
Type Name Description
System.String recipeName Name of the recipe to remove.

Events

| Improve this Doc View Source

OnItemsRegistered

Event that gets fired after all items were added to the ObjectDB. Your code will execute every time a new ObjectDB is created (on every game start). If you want to execute just once you will need to unregister from the event after execution.
Declaration
public static event Action OnItemsRegistered
Event Type
Type Description
System.Action
| Improve this Doc View Source

OnItemsRegisteredFejd

Event that gets fired after all items were added to the ObjectDB on the FejdStartup screen. Your code will execute every time a new ObjectDB is copied (on every menu start). If you want to execute just once you will need to unregister from the event after execution.
Declaration
public static event Action OnItemsRegisteredFejd
Event Type
Type Description
System.Action
| Improve this Doc View Source

OnVanillaItemsAvailable

Event that gets fired after the vanilla items are in memory and available for cloning. Your code will execute every time a new ObjectDB is copied (on every menu start). If you want to execute just once you will need to unregister from the event after execution.
Declaration
[Obsolete("Use PrefabManager.OnVanillaPrefabsAvailable instead")]
public static event Action OnVanillaItemsAvailable
Event Type
Type Description
System.Action

Extension Methods

PrefabExtension.FixReferences(Object)
  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾