Docs

Formulas, costs and conditions

Formulas

Almost every numeric option accepts a formula in quotes, so one value scales with the level without writing a table:

yaml
cost: "2500 * 1.18 ^ {level}"
duration-seconds: "10 + {level} * 4"
chance: "min(25, 0.05 + {level} * 0.0045)"
amount: "random(50, 150) * (1 + {level} / 20)"
ElementDetails
Operators+ - * / % (remainder) ^ (power) and parentheses
Functionsmin(a, b), max(a, b), floor(x), ceil(x), round(x), abs(x), sqrt(x), log(x) (base 10), ln(x), clamp(x, low, high), random(low, high)
VariablesIn braces. Each option lists the ones it has: {level}, {tier}, {pickaxe_level}, {intervals}, {blocks} and others

A formula with a variable that doesn't exist uses 0 for that variable.

Percentages and bonuses

  • Stat bonuses are fractions: 0.02 is +2%, 1.0 is +100%.
  • Chances (chance, apply-chance, [chance=25]) are percentages from 0 to 100.

Costs

Prices can be written in any of these ways:

yaml
cost: "tokens:250000"

cost:
  - "tokens:250000"
  - "gems:50"

cost:
  money: 500000
  tokens: 5000

Each id is a currency from currencies.yml or one of its aliases. An empty cost is free.

Items as a cost

yaml
cost:
  tokens: 5000
  items:
    - "DIAMOND:16"
    - material: NETHER_STAR
      amount: 1
      name: "&bBoss Star"

With name, only items with that name count, so you can charge crate or boss items. In list form "item DIAMOND 16" also works.

The player sees the cost in each currency's format, and payment is all or nothing: if something is missing, nothing is charged.


Conditions

Menus (requirement, click-requirement, glow, [if ...] in lore) compare two values:

yaml
requirement: "{has_mine} = true"
glow: "{level} >= {max_level}"
lore:
  - "[if {next_cost} > 0] &7Cost: &e{next_cost}"

Operators: =, !=, <, >, <=, >=. If both sides are numbers they are compared as numbers; otherwise as text, ignoring case.


Times

Commands that take a time accept seconds or combined units: 90, 30m, 1h30m, 2d.

Formulas, costs and conditions | PulsePrison Core Docs