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 SourceInstance
The singleton instance of this manager.
Declaration
public static ItemManager Instance { get; }
Property Value
Type | Description |
---|---|
ItemManager |
Methods
| Improve this Doc View SourceAddItem(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 .
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
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. |
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 |
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 .
Checks if the custom recipe is unique and adds it to the list of custom recipes.
Custom recipes are added to the current
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. |
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 |
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 .
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
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. |
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 |
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 |
Init()
Registers all hooks.
Declaration
public void Init()
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.
No mock references are fixed.
Declaration
public void RegisterItemInObjectDB(GameObject prefab)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab |
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. |
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. |
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. |
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 SourceOnItemsRegistered
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 |
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 |
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 |