Item Rarity
Item rarities are defined in data/rarety.lua and let you attach a coloured rarity label to any item.
A rarity is referenced from an item using the rarety key in data/items.lua. When the item is displayed the matching rarity name and colour are shown in the tooltip.
Rarity definition#
The file returns a table of key-value pairs. The key is the rarity id used on items, and the value describes how it is displayed.
lua
return {
['common'] = {
name = 'Common',
color = '#FFFFFF',
},
['uncommon'] = {
name = 'Uncommon',
color = '#00FF00',
},
['rare'] = {
name = 'Rare',
color = '#0000FF',
},
['epic'] = {
name = 'Epic',
color = '#800080',
},
['legendary'] = {
name = 'Legendary',
color = '#FFA500',
},
['mythic'] = {
name = 'Mythic',
color = '#FF0000',
},
}- key:
string- The rarity id. This is the value you assign to an item's
raretyfield.
- The rarity id. This is the value you assign to an item's
- name:
string- Display name shown in the item tooltip.
- color:
string- Hex colour (
#RRGGBB) used to render the rarity name.
- Hex colour (
Assigning a rarity to an item#
Add the rarety key to an item in data/items.lua. Its value must match a key defined in data/rarety.lua.
lua
['water'] = {
label = 'Water',
weight = 500,
consume = 0.3,
rarety = 'common'
},- rarety?:
string- The id of a rarity defined in
data/rarety.lua. - If the id does not exist no rarity is displayed.
- The id of a rarity defined in
Note
The key is intentionally spelled rarety to match the field name used internally by the resource. The definitions live in data/rarety.lua.