Skip to main content

Rarity System & Slot Presentation

Rarity System & Slot Presentation

Opt-in rarity, metadata override and current levels.

Applies to: Nord Inventory v2.0.0

Item Rarities

Nord Inventory includes an opt-in rarity presentation system for item definitions and individual item instances.

Important: rarity is disabled by default

An item only has rarity when its definition explicitly contains a valid rarity value, or when an individual instance provides metadata.rarity and metadata overrides are enabled.

This item has no rarity:

['water'] = {
    label = 'Water',
    weight = 500
}

This item has rarity enabled:

['special_key'] = {
    label = 'Special Key',
    weight = 5,
    rarity = 'rare'
}

Config.Rarities.Default is only the level selected when rarity is enabled in Admin Studio. It is not automatically applied to all items.

Slot presentation

When rarity is enabled on an item:

  • The slot border and subtle inner tint use the rarity color.
  • A compact rarity icon appears in the slot corner.
  • The rarity name is not shown on the slot.
  • Hotbar and item feedback use the same icon/color identity.
  • The Item Information modal can still show the readable rarity label.

Creating rarity levels, icons and colors

Edit config/rarities.lua:

Config.Rarities.Levels = {
    rare = {
        label = 'Rare',
        color = '#4f8cff',
        icon = 'fa-gem',
        order = 3
    },

    mythic = {
        label = 'Mythic',
        color = '#ff4fd8',
        icon = 'fa-star',
        order = 6
    }
}

icon uses a Font Awesome Free Solid icon class. Examples:

fa-circle
fa-leaf
fa-gem
fa-star
fa-crown
fa-diamond
fa-wand-magic-sparkles

New configured levels automatically appear in Admin Studio → Item Management → Rarity.

Admin Studio

Rarity now has its own page in the item editor.

The page contains:

  • An explicit Enable rarity toggle.
  • A live slot preview.
  • Rarity level cards showing each configured icon and color.
  • The current color and level information.

New items start with rarity disabled.

Runtime registration

exports.nord_inventory:RegisterItem('special_key', {
    label = 'Special Key',
    weight = 5,
    rarity = 'legendary'
})

To register an item without rarity, simply omit the field.

Instance rarity override

When Config.Rarities.AllowMetadataOverride = true, a specific item instance may provide its own rarity:

exports.nord_inventory:AddItem(source, 'special_key', 1, {
    rarity = 'legendary'
})

This lets one physical instance have a rarity identity without requiring another item definition.

Rarity remains presentation-first

Rarity does not automatically change:

  • damage
  • weight
  • price
  • durability
  • drop chance
  • crafting output

Other resources may read the rarity value and build gameplay rules on top of it if desired.

Slot background behavior

When rarity is enabled on an item, the slot background itself uses the configured rarity color.

Rarity does not control:

  • durability bar color;
  • validity/expiry bar color;
  • interaction/selected border color;
  • item label color;
  • item image.

Those remain controlled by the player's normal inventory customization.

The implementation intentionally avoids CSS color-mix() for the slot background so the result remains reliable in FiveM CEF builds.

Slot opacity integration

When a rarity is enabled on an item, the slot uses the same transparency/opacity system as the player inventory editor.

This means:

  • the rarity changes only the slot color;
  • the slot still respects the player's configured slotOpacity;
  • the border still uses the player's normal border/interation styling;
  • the durability bar keeps using the player's lifecycle colors.

In practice, the normal slot background:

rgb(8 8 13 / var(--user-slot-opacity))

is replaced by the rarity color equivalent:

rgb(R G B / var(--user-slot-opacity))

So the opacity behavior remains the same and only the base color comes from the rarity definition.

Slot opacity behavior with rarity

The rarity slot background keeps its rarity color/tint, but all of its background layers now obey the same player Slot opacity slider used by normal slots.

This means:

  • lowering Slot opacity also lowers the visibility of rarity backgrounds;
  • raising Slot opacity makes rarity backgrounds stronger;
  • the rarity color remains visible;
  • the durability bar remains independent.

Current configured levels

  • common
  • uncommon
  • rare
  • epic
  • legendary