Dynamic Price

Enable Math Feature

Change your config.yml file:

  • For 1.2.8 user: Change check-math: false to check-math: true.

  • For 1.2.9+ user: Change

math:
  # Enabled base math calculate?
  # Will support + - * / only.
  enabled: false

to

math:
  # Enabled base math calculate?
  # Will support + - * / only.
  enabled: true
  • Change

placeholder:
  data:
    can-used-in-amount: false

to

placeholder:
  data:
    can-used-in-amount: true

Set dynamic value for your product configs

Open one of your shop configs, find the product you want to enable dynamic price.

Like I want to enable for this product:

  A:
    display-name: 'Custom Name!'
      price-mode: ALL
    product-mode: CLASSIC_ALL
    products:
      1:
        material: sea_lantern
    buy-prices:
      1:
        economy-type: exp
        amount: '5+{buy-times-server}*0.2-{sell-times-server}*0.1'
        max-amount: 15
        min-amount: 1
        start-apply: 0
        placeholder: '{amount} Exp'
    sell-prices:
      1:
        economy-type: exp
        amount: '5+{buy-times-server}*0.2-{sell-times-server}*0.1'
        max-amount: 15
        min-amount: 1
        start-apply: 0
        placeholder: '{amount} Exp'

First, you need set price-mode to ALL or ANY.

Set amount option to the value I set here, it is a math string, if your math is not good, let me explain it:

  • 5 is base price, which means the start price.

  • 0.2 is each time one player buy one this product, then the price will plus this value.

  • 0.1 is each time one player sell one this product, then the price will delete this value.

We also added max-amount and min-amount option, to avoid price is too high or too low.

Set buy / sell limits for your products

Please view Shops page for info.

Reset dynamic price

Many people ask this question, and I feel that the person asking this question simply does not understand the essence of UltimateShop. The dynamic price is determined by a formula, so you cannot reset the price directly. To reset the price, the variables used in your formula must be reset. If you use variables such as {buy-times-server} exactly as described in this section, they can be reset.

You can reset the buy times or sell times by commands or auto reset feature, you can find them at Commands page and Shops page.

Last updated