Skip to main content

Item Grains

Grains that manage inventory, item generation, and item type registries.

CharacterInventoryGrain​

Manages a character's bag and equipment.

Key: Guid (characterId) + string (seasonId)

State​

public class CharacterInventoryState
{
public InventoryGrid BagGrid { get; set; } // Grid positions
public Dictionary<Guid, Item> BagItems { get; set; } // Items in bag
public Dictionary<EquipmentSlot, Item> Equipped { get; set; }
}

Methods​

MethodDescription
GetBagGridAsync()Get bag grid state
GetBagItemsAsync()Get all bag items
GetEquippedAsync()Get equipped items
AddItemAsync()Add item to bag
RemoveItemAsync()Remove item from bag
MoveBagItemAsync()Move item position
EquipAsync()Equip from bag
UnequipAsync()Unequip to bag
GetStatsAsync()Calculate total stats

Grid System​


AccountStashGrain​

Shared stash tabs accessible by all characters on an account.

Key: Guid (accountId) + string (seasonId)

Methods​

MethodDescription
GetTabsAsync()Get all stash tabs
GetTabItemsAsync()Get items in a tab
AddItemAsync()Add item to stash
RemoveItemAsync()Remove item from stash
MoveItemAsync()Move item position
TransferItemAsync()Move between tabs

ItemGeneratorGrain​

Stateless worker for generating random items.

Key: long (any value - stateless workers have multiple instances)

Methods​

MethodDescription
GenerateAsync(baseTypeId, rarity)Generate item with rarity
GenerateUniqueAsync(uniqueId)Generate specific unique item
TransmuteAsync(item)Normal → Magic
AlterAsync(item)Reroll magic item
RegalAsync(item)Magic → Rare
ChaosAsync(item)Reroll rare item
ExaltAsync(item)Add modifier to rare
JewellerAsync(item)Reroll sockets
FusingAsync(item)Reroll socket links
ChromaticAsync(item)Reroll socket colors

Item Generation Flow​

Currency Effects​

CurrencyInputOutput
TransmuteNormalMagic (1-2 mods)
AlterationMagicMagic (reroll mods)
RegalMagicRare (add 1 mod)
ChaosRareRare (reroll all mods)
ExaltRareRare (add 1 mod)
JewellerAnyReroll socket count
FusingAnyReroll socket links
ChromaticAnyReroll socket colors

BaseTypeRegistryGrain​

Singleton registry for item base type definitions.

Key: string ("default")

Methods​

MethodDescription
GetAllAsync()Get all base types
GetAsync(id)Get specific base type
GetByCategoryAsync()Filter by category
GetBySlotAsync()Filter by equipment slot
RegisterAsync()Add new base type
UpdateAsync()Update base type
DeleteAsync()Remove base type
ExistsAsync()Check if exists

ModifierRegistryGrain​

Singleton registry for modifier (affix) definitions.

Key: string ("default")

Methods​

MethodDescription
GetAllAsync()Get all modifiers
GetPrefixesAsync()Get prefix modifiers
GetSuffixesAsync()Get suffix modifiers
GetByTagAsync()Filter by item tag
RegisterAsync()Add new modifier

ItemHistoryGrain​

Tracks the complete history of an item for audit/provenance.

Key: Guid (itemId)

Methods​

MethodDescription
RecordEventAsync()Log an event
GetHistoryAsync()Get full history

Event Types​

EventDescription
CreatedItem was generated
TradedItem changed ownership
ModifiedCurrency was applied
EquippedItem was equipped
DroppedItem was dropped/destroyed