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
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
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
| Currency | Input | Output |
|---|---|---|
| Transmute | Normal | Magic (1-2 mods) |
| Alteration | Magic | Magic (reroll mods) |
| Regal | Magic | Rare (add 1 mod) |
| Chaos | Rare | Rare (reroll all mods) |
| Exalt | Rare | Rare (add 1 mod) |
| Jeweller | Any | Reroll socket count |
| Fusing | Any | Reroll socket links |
| Chromatic | Any | Reroll socket colors |
BaseTypeRegistryGrain
Singleton registry for item base type definitions.
Key: string ("default")
Methods
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
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
| Method | Description |
|---|---|
RecordEventAsync() | Log an event |
GetHistoryAsync() | Get full history |
Event Types
| Event | Description |
|---|---|
Created | Item was generated |
Traded | Item changed ownership |
Modified | Currency was applied |
Equipped | Item was equipped |
Dropped | Item was dropped/destroyed |