Class ItemCreator
Provides convenient static methods for creating custom items. Use CreateBuilder() for flexible configuration or CreateItem(string, string, string, ItemCategory, int, float, float, LegalStatus, FullRank?, Sprite, Equippable) for quick creation.
public static class ItemCreator
- Inheritance
-
ItemCreator
- Inherited Members
Remarks
All items in Schedule One are storable items (StorableItemDefinition), so both methods create the same type.
Methods
CloneFrom(StorableItemDefinition)
Creates a new storable item builder by cloning an existing storable item wrapper.
public static StorableItemDefinitionBuilder CloneFrom(StorableItemDefinition source)
Parameters
sourceStorableItemDefinitionThe storable item definition to clone.
Returns
- StorableItemDefinitionBuilder
A builder pre-configured with the source item properties.
Exceptions
- ArgumentNullException
Thrown if the source definition is null.
CloneFrom(string)
Creates a new storable item builder by cloning an existing item by ID.
public static StorableItemDefinitionBuilder CloneFrom(string sourceItemId)
Parameters
sourceItemIdstringThe ID of the item to clone.
Returns
- StorableItemDefinitionBuilder
A builder pre-configured with the source item properties.
Exceptions
- ArgumentException
Thrown if the source item ID is not found or is not a storable item.
CreateBuilder()
Creates a new builder for composing an item definition with full flexibility. Use fluent methods to configure the item, then call Build() to register it.
public static StorableItemDefinitionBuilder CreateBuilder()
Returns
- StorableItemDefinitionBuilder
A new StorableItemDefinitionBuilder instance for fluent configuration.
Examples
var item = ItemCreator.CreateBuilder()
.WithBasicInfo("my_tool", "Custom Tool", "A custom tool", ItemCategory.Tools)
.WithStackLimit(5)
.WithPricing(25f, 0.3f)
.Build();
CreateEquippableBuilder()
Creates a new equippable builder for creating custom equippable components. Use this to create equippable behavior that can be attached to items.
public static EquippableBuilder CreateEquippableBuilder()
Returns
- EquippableBuilder
A new EquippableBuilder instance.
Examples
var equippable = ItemCreator.CreateEquippableBuilder()
.CreateBasicEquippable("MyEquippable")
.WithInteraction(canInteract: true, canPickup: true)
.Build();
CreateItem(string, string, string, ItemCategory, int, float, float, LegalStatus, FullRank?, Sprite, Equippable)
Creates an item with common parameters in a single call. The item is automatically registered with the game's registry.
public static StorableItemDefinition CreateItem(string id, string name, string description, ItemCategory category, int stackLimit = 10, float basePurchasePrice = 10, float resellMultiplier = 0.5, LegalStatus legalStatus = LegalStatus.Legal, FullRank? requiredRank = null, Sprite icon = null, Equippable equippable = null)
Parameters
idstringUnique identifier for the item (e.g., "my_custom_tool").
namestringDisplay name shown in UI.
descriptionstringItem description shown in tooltips.
categoryItemCategoryItem category for inventory organization.
stackLimitintMaximum quantity per inventory slot (default: 10).
basePurchasePricefloatBase price when buying from shops (default: 10).
resellMultiplierfloatFraction of purchase price recovered when selling (default: 0.5).
legalStatusLegalStatusWhether the item is legal or illegal (default: Legal).
requiredRankFullRank?The player rank required to purchase the item, null if no rank required (default: null).
iconSpriteOptional sprite to use as the item icon.
equippableEquippableOptional equippable component to attach.
Returns
- StorableItemDefinition
A wrapper around the created item definition.
Examples
var item = ItemCreator.CreateItem(
id: "my_tool",
name: "Custom Tool",
description: "A custom tool for crafting",
category: ItemCategory.Tools,
stackLimit: 5,
basePurchasePrice: 25f
);