πŸ•°οΈ Historical snapshot

This page is preserved for project history and is not the current reference. Use Loot, Inventory and Crafting for current information.

Loot, Inventory & Crafting

Server rolls loot, the client picks it up, and the API persists it. Crafting/smelting runs through professions and recipes with server-side XP awards.

The loot β†’ inventory flow

Enemy dies (server) β†’ DropTable weighted roll β†’ WorldItem net-spawned pickup
   β†’ player pickup β†’ InventoryManager.OnItemPickedUp β†’ POST /api/inventory/save
   β†’ item survives relog
  • DropTable β€” ScriptableObject weighted rolls; server-side only. Each DropEntry supports two assignment modes: a LootItemDefinition reference (preferred β€” owns the item ID, world visual prefab, and rarity in one asset) or a legacy itemId string with no visual data. Helper properties ResolvedItemId, ResolvedWorldVisualPrefab, and ResolvedRarity on DropEntry return the values from whichever source is assigned. DropTable.TryGetEntry(string, out DropEntry) looks up an entry by its resolved item ID (case-insensitive).
  • LootItemDefinition β€” ScriptableObject that centralises a single item's data for both the backend and the client. Fields:
  • itemId β€” stable backend inventory item ID; 1–64 lowercase letters, numbers, underscores, or hyphens
  • displayName β€” player-facing name stored in the items database and shown by inventory UI
  • databaseItemType (LootDatabaseItemType) β€” database inventory category; must match the live items.item_type enum. Values: Material, Weapon, ArmorHead, ArmorChest, ArmorLegs, ArmorFeet, ArmorHands, Offhand, Ring, Trinket
  • rarity (ItemRarity) β€” Common, Uncommon, Rare, or Epic. Legendary is not supported by the live database; LootForgeWindow rejects it at validation time.
  • inventoryIcon β€” Sprite shown in the player's inventory bag
  • sellValue β€” base database sell value (minimum 0)
  • crafted β€” whether the database should mark this item as craft-produced
  • worldVisualPrefab β€” model shown in the world for this item (colliders disabled when attached to the pickup)

Drop tables reference this asset so an item's appearance and rarity are authored only once. LootForgeWindow (BCE β–Ά Loot Forge) is the dedicated editor for creating and assigning these assets β€” see Editor Tooling.

  • LootItemCatalog β€” static client/server catalog loaded lazily from Resources/LootForge/Items. LootItemCatalog.Find(itemId) returns the matching LootItemDefinition or null. LootItemCatalog.All returns all loaded definitions. LootItemCatalog.RarityColor(rarity) returns the canonical UI color for a given rarity level. Used by InventoryBagUI and ItemTooltipUI to resolve sprites and display data at runtime.
  • LootPersistenceService β€” server-side service that syncs LootItemDefinition assets to the database. On server start (when CROSSWORLDS_GAME_SERVICE_TOKEN is set), it loads all definitions from Resources/LootForge/Items and posts each to /api/game/items/definitions so the live items table stays in sync with authored content.
  • WorldItem β€” network-spawned pickup prefab (float animation, rarity glow, trigger pickup). Carries a lootRarity SyncVar (hooked to OnLootRarityChanged) that drives the glow color and attached beam tint. AttachLootVisual(prefab) replaces the default Visual child with an item-specific model; AttachLootBeam(prefab) parents a VFX beam to the pickup and recolors all particle systems, lights, and trail/line renderers to match the item's rarity color. AttachLootPresentation(visualPrefab, beamPrefab) calls both. These methods are called on the client by EnemyController.RpcAttachLootPresentation after the pickup spawns. Server-side CmdPickup validates proximity (maximum 3 m) before awarding the item, rejecting out-of-range collection attempts with a server log warning.
  • EnemyController β€” exposes a lootBeamPrefab field (optional VFX attached to each spawned WorldItem; automatically recolored to the item's rarity and destroyed on collection).
  • InventoryManager β€” client REST singleton; stacking AddItem, EquipItem, auto-save. Equip posts /api/inventory/equip β†’ server stat recalc from stat_bonus JSON.
  • InventoryBagUI β€” the player's inventory bag grid. Each slot shows the inventoryIcon sprite from the item's LootItemDefinition when one is available; falls back to a rarity-color-coded icon when no definition is found. Chat input focus blocks inventory keybinds while typing.
  • ItemTooltipUI β€” item tooltip shown on slot hover. Resolves display name, item type line, sell value, and rarity border color from LootItemCatalog when the item has a LootItemDefinition; falls back to ItemCatalogManager (the legacy REST-backed catalog) otherwise.
ℹ️ Kill rewards are atomic

Do not call /api/loot/drop or save-progress on kill β€” /api/combat/kill awards XP + gold + loot in one transaction. See Auth & Game API.

Progression

Level/experience/gold and per-hero mastery are covered on Progression & Hero Mastery (PlayerProgressManager, HeroMasteryManager). DB column is experience, not xp (Database Schema).

ℹ️ Attunements are legacy

Attunement (a CreateAssetMenu(menuName="Legacy/Inventory/…") ScriptableObject β€” a stat-modifier upgrade socketed into gear) is legacy local data; the server-backed inventory does not use it. Don't build new features on it.

Crafting

  • ForgeCraftingPanel β€” Smelt + Craft tabs, progress bar, ingredient-shortage highlighting.
  • ConsumableEffect β€” hp_regen, resist_void, resist_blast, speed, damage_amp (timed).
  • Server: POST /api/craft (transactional, XP award, level-up loop, smelt support), POST /api/professions/award-xp.
  • Seeded content: 5 raw + 5 refined materials, 6 consumables (Void Resist Flask, Iron Warden Blast Kit…), 8 crafted gear items, 19 recipes.
⚠️ Damage-reduction single channel

Consumable resist buffs, ThreatProtocol, and SiegeMode all write the same DR scalar on Health and clobber each other. It needs a ref-counted refactor β€” don't drive-by fix. See Known Issues & Tech Debt.


Related: Database Schema Β· Auth & Game API Β· Enemies, Waves & Bosses