Skip to content

Statistics โ€‹

Statistics are displayed in the description area of the active item, under the description. They are defined in the statistics list of an item.

All the statistics

lua
menu:addItem({
  title = "Cattleman revolver",
  icon = "holsters_left",
  statistics = {
    { label = "Manufacturer", value = "Cattleman" },
    { label = "Damage", type = "bar", value = { 6, 8 } },
    { label = "Range", type = "bar-style", value = { "active", "active", "active fgold", "possible fgold", "", "", "" } },
    { label = "Accuracy", type = "weapon-bar", value = { 65, 100 } },
    { label = "Upgrade", type = "weapon-bar", value = { max = 100, bars = { { value = 50 }, { value = 70, color = "#d4af37" } } } },
    { label = "Condition", type = "icon", value = { "star", "star", { icon = "star", opacity = 0.3 } } },
    { label = "Repair", type = "price", value = { money = 2.5 } },
  },
})
TypeDisplays
TextA text on the right
bar10 bars, like the statistics of the weapons
bar-styleAny number of bars, with a style per bar
iconA list of icons
weapon-barA progress bar, with one or several segments
priceA price

Common keys โ€‹

KeyTypeDescription
labelstringThe text on the left. HTML is allowed
typestringThe type of statistic. Not needed for a text
valueanyThe value, depending on the type
classstringCSS classes of the statistic, like penalty for a bar Optional
translateLabelbooleanUse label as a key of the translations Optional default: false
translateValuebooleanUse value as a key of the translations (text only) Optional default: false

Text โ€‹

When value is a string or a number, it's displayed on the right. HTML is allowed.

lua
statistics = {
  { label = "Manufacturer", value = "Cattleman" },
  { label = "Ammo", value = "<span style='color:#d4af37'>12</span> / 36" },
}

Text statistics

Bar โ€‹

10 bars. value is {active, possible}:

  • active: the number of white bars,
  • possible: the number of grey bars, up to this number Optional. It's useful to show the result of an upgrade.
lua
statistics = {
  { label = "Damage", type = "bar", value = { 6 } },
  { label = "Fire rate", type = "bar", value = { 4, 7 } },
}

Bar statistics

With class = "penalty", the possible bars are red: the statistic goes down.

lua
{ label = "Reload speed", type = "bar", value = { 3, 6 }, class = "penalty" }

Bar statistic with a penalty

Bar style โ€‹

Any number of bars, with a style per bar. value is a list of CSS classes, one per bar. The classes can be combined:

ClassEffect
""Empty bar
activeWhite bar
possibleGrey bar
fgoldGold color
fredRed color
lua
{
  label = "Range",
  type = "bar-style",
  value = { "active", "active fgold", "active fred", "possible", "possible fred", "", "" },
}

Bar-style statistic

Icon โ€‹

A list of icons. Each entry is an icon name, or a table {icon = name, opacity = 0.0 to 1.0}.

lua
statistics = {
  { label = "Health", type = "icon", value = { "player_health", "player_health", { icon = "player_health", opacity = 0.3 } } },
  { label = "Stamina", type = "icon", value = { { icon = "player_stamina", opacity = 1 }, { icon = "player_stamina", opacity = 0.5 } } },
}

Icon statistics

Weapon bar โ€‹

The progress bar of the weapon statistics of the game. value is {current, max}.

lua
{ label = "Accuracy", type = "weapon-bar", value = { 65, 100 } }

Weapon-bar statistic

Several segments โ€‹

To display several segments, like the result of an upgrade, value is a table:

KeyTypeDescription
maxnumberThe value of a full bar
barstableThe segments, from left to right
bars[].valuenumberWhere the segment ends. The values are cumulative: each segment starts where the previous one ends
bars[].colorstringThe CSS color of the segment Optional default: white
bars[].opacitynumberThe opacity of the segment, from 0 to 1 Optional default: 1
lua
statistics = {
  {
    label = "Upgrade",
    type = "weapon-bar",
    value = {
      max = 100,
      bars = {
        { value = 40 }, -- white from 0 to 40
        { value = 60, color = "#27ae60" }, -- green from 40 to 60
        { value = 75, color = "#27ae60", opacity = 0.4 }, -- light green from 60 to 75
      },
    },
  },
  {
    label = "Downgrade",
    type = "weapon-bar",
    value = { max = 100, bars = { { value = 45 }, { value = 70, color = "#c0392b" } } },
  },
}

Weapon-bar statistics with several segments

Price โ€‹

value is a price, in any format described in Prices.

lua
statistics = {
  { label = "Repair", type = "price", value = { money = 2.5 } },
  { label = "Upgrade", type = "price", value = { { money = 10 }, { gold = 1 } } },
}

Price statistics

Last updated: