Skip to content

Economy Bridge

CoreLib provides a shared economy bridge so business modules can use similar configuration for costs, rewards, and formulas.

Common fields

FieldTypeDefaultMeaning
economy.enabledbooleantrueEnable economy costs or rewards.
economy.providerstringautoEconomy provider: auto, vault, or excellenteconomy.
economy.currencystring""Currency ID. Leave blank for the Vault default currency; required for ExcellentEconomy.
economy.base_costnumberBase cost.
economy.cost_formulastringDynamic cost formula, accepting expression variables.
economy.currencieslistMulti-currency list, where supported by the module.

Providers

Provider IDPluginNotes
vaultVaultWorks with any Vault-compatible economy plugin.
excellenteconomyExcellentEconomySupports multiple currencies.

Automatic provider selection

When provider is blank or auto:

ConditionResult
currency is not blankPrefers ExcellentEconomy.
currency is blankUses Vault with its default currency.
An explicit provider is givenLooked up by ID; fails when unavailable.

ExcellentEconomy always requires a non-blank currency, and auto never infers a default ExcellentEconomy currency — set currency explicitly.

Multiple currencies

Some modules can charge several currencies at once:

yaml
economy:
  enabled: true
  currencies:
    - provider: vault
      currency: ''
      amount: 500
    - provider: excellenteconomy
      currency: gems
      amount: 10

That charges 500 of the Vault default currency and 10 ExcellentEconomy gems together.

Some modules also accept items as a currency:

yaml
economy:
  enabled: true
  currencies:
    - provider: vault
      amount: 1000
    - provider: item
      item:
        type: vanilla
        id: EMERALD
      amount: 3

Whether the multi-currency list and the item currency are honoured depends on the calling module.

When the charge happens

The point at which a cost is taken differs per module:

ModuleCharged atNotes
EmakiStrengthenBefore the attempt startsCharged on success and failure alike (configurable).
EmakiForgeOn confirmationTaken after the confirm button is clicked.
EmakiSkillsBefore the castConsumed once requirements pass; a failed cast is not refunded.
EmakiGemOn operation confirmSocket opening, inlay, extraction, and upgrade each configure their own cost.

When configuring, decide explicitly whether a failed attempt still pays, whether cancelling refunds, and whether an insufficient balance blocks the operation (usually it should).

Cost formula forms

yaml
# Linear growth, gentle
cost_formula: '100 + %star% * 50'

# Exponential growth, steep at high levels
cost_formula: '100 * pow(1.5, %star%)'

# Clamped so the cost never goes negative
cost_formula: 'max(10, 100 + %star% * 50 - %bonus%)'

Formula variables are injected by the calling module; Strengthen, for example, supplies %star% and %level%. Avoid negative prices in production, since players can exploit them to farm money.

Economy actions

Action IDParameters
give_moneyrequired amount; provider=auto; currency=""
take_moneyrequired amount; provider=auto; currency=""
set_moneyrequired amount; provider=auto; currency=""
yaml
actions:
  - 'give_money amount=100 provider=vault'
  - 'take_money amount=25.5 provider=excellenteconomy currency=gems'

Check Vault or ExcellentEconomy loading if economy actions do not work.