Skip to main content

Item Data Structure

Items are defined in JSON manifests and loaded at runtime. Items are now organized into separate files by type for better maintainability.
Item data is managed in packages/shared/src/data/items.ts and loaded from world/assets/manifests/items/ directory.

Data Loading

Items are NOT hardcoded. The ITEMS map is populated at runtime from multiple manifest files:

Manifest Organization

Items are split into separate files by category:

Directory-Based Loading

Items are organized by category in packages/server/world/assets/manifests/items/:
  • weapons.json - Swords, axes, bows, etc.
  • armor.json - Helmets, bodies, legs, boots, gloves, shields, capes, amulets, rings
  • tools.json - Hatchets, pickaxes, fishing rods, hammer, tinderbox
  • resources.json - Ores, bars, logs, raw fish
  • food.json - Cooked food, raw food, burnt food
  • misc.json - Coins, junk items, quest items
Atomic Loading: All 6 category files must exist or the system falls back to legacy items.json. Duplicate Detection: The loader validates that no item ID appears in multiple category files.

Item Schema

Each item has the following structure:

Tier-Based Requirements

Items with a tier property automatically derive level requirements from tier-requirements.json:
The TierDataProvider maps tiers to skill requirements, eliminating redundant requirement definitions.

Item Types

Tier-Based Equipment System

Items now use a centralized tier system defined in tier-requirements.json. Instead of hardcoding level requirements in each item, equipment references a tier:
The system automatically looks up requirements from tier-requirements.json:

Melee Tiers

Tool Tiers

This centralized approach ensures OSRS-accurate requirements and makes it easy to add new tiers without modifying individual items.

Item Rarity


Equipment Stats

For weapons and armor:

Skill Requirements

Items can require skill levels to use:

Weapon Types


Attack Speed

Weapons have different attack speeds:

Helper Functions

Item Type Detection

The item-helpers.ts module provides utilities for detecting item types:

Primary Action Detection

Get Item by ID

Get Items by Type

Get Items by Skill Requirement

Get Items by Level Requirement


Shop Items

Items available in general stores:

Noted Items

Items can have “noted” variants for efficient storage:

Example Item Definitions

Weapon (weapons.json)

Tool (tools.json)

Tools include a tool object specifying the skill and priority. The tier system automatically derives level requirements:
The tier: "bronze" automatically gives this tool attack: 1 and woodcutting: 1 requirements from tier-requirements.json. Tools with equipSlot: "weapon" can be equipped and used for combat.

Resource (resources.json)

Consumable (food.json)

Consumables can include inventoryActions to define OSRS-style context menu actions:
The first action in inventoryActions becomes the left-click default. If not specified, the system uses heuristic detection based on item properties (food → Eat, potions → Drink, etc.).

Context Menu Color Coding

Context menus use OSRS-accurate color coding for entity names:
Examples:
  • “Eat Shrimp” (orange)
  • “Attack Goblin” (yellow)
  • “Mine Copper rocks” (cyan)
  • “Trade Shop keeper” (yellow)

Currency (misc.json)


Adding New Items

1

Choose the right manifest file

  • Weapons → items/weapons.json
  • Armor → items/armor.json
  • Tools → items/tools.json
  • Resources (ores, logs, bars, raw fish) → items/resources.json
  • Food → items/food.json
  • Currency, junk → items/misc.json
2

Add entry with proper structure

Follow the examples above. For tiered equipment, specify the tier field instead of hardcoding requirements.
3

Create 3D Model (optional)

Generate model in 3D Asset Forge if needed
4

Restart Server

Server must restart to reload manifests
DO NOT add item data directly to items.ts. Keep all content in JSON manifests for data-driven design.

Tool Priority System

Tools use a priority system to determine which tool to use when multiple are available:
For example:
  • Bronze hatchet: priority 1
  • Iron hatchet: priority 2
  • Steel hatchet: priority 3
  • Rune hatchet: priority 6
The system automatically selects the highest priority tool the player has equipped or in inventory.

Inventory Actions System

Items can define explicit context menu actions using the inventoryActions array. This is the OSRS-accurate approach where actions are stored per-item in the manifest.
Key Features:
  • First action becomes the left-click default
  • Actions appear in context menu in the order specified
  • “Cancel” is always added automatically as the last option
  • Manifest-defined actions take priority over heuristic detection

Common Action Patterns

Action Handlers

The following actions have built-in handlers in InventoryActionDispatcher:
  • Eat: Sends useItem packet → server validates eat delay (3 ticks) → consumes food → heals player
  • Drink: Sends useItem packet → server validates → applies potion effects
  • Wield: Sends equipItem network message (weapons/shields)
  • Wear: Sends equipItem network message (armor)
  • Bury: Sends buryBones network message
  • Use: Enters targeting mode for item-on-item/item-on-object interactions
  • Drop: Calls world.network.dropItem()
  • Examine: Shows examine text in chat and toast
  • Cancel: Closes context menu (always added automatically)

Heuristic Fallback

If inventoryActions is not specified, the system uses type detection helpers from item-helpers.ts:
Detection Rules:
  • Food: type: "consumable" + healAmount > 0 + not potion
  • Potions: type: "consumable" + id.includes("potion")
  • Weapons: equipSlot: "weapon" or equipSlot: "2h" or weaponType defined
  • Shields: equipSlot: "shield"
  • Armor: equipable: true + not weapon/shield
  • Bones: id === "bones" or id.endsWith("_bones")
  • Noted Items: Always use “use” action (cannot eat/equip noted items)
Manifest-defined inventoryActions take priority over heuristic detection. This allows custom actions for special items.

Equipment Slots

Items equip to specific slots:
The game now includes full armor sets across all equipment slots. Melee armor (bronze through rune) includes helmets, platebodies, platelegs, boots, gloves, and shields. Ranged armor includes leather and dragonhide pieces. Magic armor includes wizard and mystic robes with boots and gloves.