Prices
Buy and Sell Prices
A product's buy is the price of one lot, and its sell what the shop pays for one. A product without buy is not for sale; without sell, or with zero, it is not bought back. Every price is in the product's currency: its own currency, else its shop's, else default-currency in config.yml, else XCore's main currency or the economy registered with Vault.
On top of the base price come the price groups, the boosters, the sales, the offer of a rotating shop and the multiplier of a sell wand, and for a dynamic product, wherever demand has taken it.
/xshop price <shop> <product> shows all of it for one product: the base prices and the lot, where its market stands (the change, the pressure and the range), what it costs and pays you now, its stock, and the two bounds it is never bought under and never sold over.
Price Groups
modifiers:
vip:
buy: -5% # pays five percent less
sell: +10% # is paid ten percent more
mvp:
buy: -10%
sell: +20%
A group is given by the permission xshop.modifier.<name>: xshop.modifier.vip. A player in several gets the best of each, the deepest discount and the highest bonus; they do not add up. A name is made of letters, digits, _ and -, 32 at most. A change can also be written as the multiplier itself: x0.9. A group can only lower buy prices and raise sell prices: a surcharge is ignored, with a warning in the console.
The deepest discount any group gives counts in every item's floor: the lowest price the most favoured player can buy at is the most the shop ever pays back.
Boosters
/xshop boost give Steve 1h +50% # +50% when selling, for an hour
/xshop boost give Steve 2h +25% -10% # and ten percent off when buying
/xshop boost give Steve 1d +100% 0 ores # in the ores shop only
/xshop boost list
/xshop boost remove Steve
A booster is for one player, for a while: the selling bonus first, then the buying change (0 for none), then the one shop it is limited to. It works for a player who is offline, found by name, starts at once and is kept in the database, so it survives a restart; the player is told when they are online. Of several boosters, the best of each side counts.
That makes boosters easy to sell in a store: the store runs /xshop boost give <player> 1h +50% from the console when it is bought. The dashboard's Events page gives them too, and %xshop_booster% shows a player what is left of theirs.
A booster, like a sale, can only lower buy prices and raise sell prices: a change the other way is refused, by the command as by the dashboard.
Sales for Everyone
/xshop event start weekend 2d -20% 0 # 20% off for two days, selling unchanged
/xshop event start harvest 6h 0 +25% farming # the farming shop pays 25% more for six hours
/xshop event list
/xshop event stop weekend
An event is for everyone: the buying change first, then the selling one, then the one shop it is limited to. Its name is made of letters, digits, _ and -, 32 at most. Its start and end are announced to everyone who can open the shop (events.announce), and to Discord with discord.events and a webhook. The list of shops shows it, so does the shop's info item, and %xshop_event% gives its name. When several run, the deepest discount and the highest bonus count. A sale can only lower buy prices and raise sell prices: /xshop event start and the dashboard refuse a surcharge.
The dashboard's Events page starts and stops them as well.
Sales by the Clock
events:
scheduled:
weekend:
days: [SATURDAY, SUNDAY]
from: "00:00"
to: "23:59"
buy: -20% # prices twenty percent off
sell: +0%
shops: [] # empty: every shop
happy-hour:
from: "18:00"
to: "20:00"
sell: +25%
shops: [farming, food]
daysleft out means every day. The hours are read intime-zone, written as"18:00".- An event that runs past midnight is written as two, one on each side of it. One that ends before it starts is left out, and the console says why.
- They run while the clock says so, on every server that has them in its
config.yml, and are announced like the others. Nothing is stored: they cannot be stopped by command, only taken out of the file. - A surcharge, a
buychange above 0 or asellchange below 0, is ignored, with a warning in the console.
How They Combine
Within a kind, the best one counts: two price groups give the better of the two, not both. The kinds multiply: price group, booster, sale, the offer of a rotating shop, and for a sale the wand in hand. A VIP paid 10% more, with a booster of +50% and a sale of +25%, sells at 1.1 × 1.5 × 1.25 = 2.06 times the price.
guarantees:
max-sell-multiplier: 2.0
The selling side stops there: whatever the bonuses come to beyond max-sell-multiplier is ignored, so that player is paid twice the price, not 2.06 times. The same number decides how deep a sale may go: see Buying Back Never Pays.
Dynamic Prices
cobblestone:
buy: 1
sell: 0.25
dynamic: true # the defaults of config.yml
diamond:
buy: 80
sell: 20
dynamic: { range: 20%, volume: 600, recovery: 6h }
| Key | Default | Description |
|---|---|---|
range | 30% | How far the price can move from its base, up and down |
up, down | the range | Each side on its own: up: 50% and down: 10%. down stays under 95%, so a price never reaches zero |
volume | 2000 | How many units bought, net of those sold, bring the price about three quarters of the way to its highest. Small for a rare item, large for cobblestone |
recovery | 6h | How long the pressure takes to halve once players leave the product alone; never keeps it where it is |
enabled | true | false turns the section off and fixes the price |
The defaults are those of dynamic-pricing.defaults in config.yml.
How the price moves
A dynamic product has a pressure: zero at rest, one more for every unit bought, one less for every unit sold. Its price is the base times 1 + r × tanh(pressure ÷ volume), where r is up above the base and down below it: smooth, always rising with the pressure, and never past its bounds. With a range of 20% and a volume of 600, buying 600 diamonds more than were sold takes them from 80 to about 92, and selling as many takes them to about 68.
Each unit of a large purchase pays the price it has when its turn comes, worked out as the area under the curve rather than unit by unit: 64 bought at once cost what 64 bought one at a time would, rounding aside. At rest, a product costs exactly the price in its file.
Left alone, the pressure halves every recovery: for a small move that brings the price about halfway back to its base, less for a price pushed near the end of its range. That is worked out when the price is read, from the moment the pressure was last written: no task runs it, and two servers reading the same product a second apart show the same price.
Watching it
- A price that has moved by more than half a percent shows ▲ or ▼ in the menu
- The dashboard's Market page lists every dynamic product with its prices now, its change, its range and its pressure, and draws its curve from a point an hour, kept for
logs.price-history-days(30) /xshop market reset <shop> <product>puts a price back to its base, and so does Reset the price on the dashboard
dynamic-pricing:
defaults:
range: 30%
volume: 2000
recovery: 6h
# Between a click and the moment the trade is written, other trades can move a dynamic
# price. A purchase that would then cost this much more than at the click, or a sale
# that would pay this much less, is refused and the menu refreshed.
slippage: 2%Buying Back Never Pays
For every item the shop both sells and buys back, in each currency, XShop works out two numbers:
- The floor: the lowest price one unit can ever be bought for, sales aside. It is the cheapest product that sells the item, in any shop, at the bottom of its dynamic range, with the deepest discount a price group gives.
- The ceiling: the most one unit can ever be sold back for. It is the best product that buys the item, at the top of its range, with every bonus at
max-sell-multiplier, and never above the floor.
No sale pays more than the ceiling, and no purchase costs less than it, not even during a sale. Buying a unit and selling it back therefore loses money or breaks even, whatever the order, the moment, the rank or the bonus. That is tested: a random walk of thousands of purchases, sales and waits, with every bonus at its maximum, never comes out ahead.
What it changes
- A sell price above what the item can be bought for pays the floor at most. The console names the product and the audit lists it (Sell price capped).
- A dynamic product whose sell price, at the top of its range, would pass the lowest the item can be bought for is held there (Range capped, a note in the audit).
- The same item in two shops: the floor is the cheaper of the two, for both. One shop selling it at 10 and another buying it back at 12 is the same hole as a sell price above a buy price, and closed the same way.
- One balance, two names. When XCore's economy is the one behind Vault,
currency: vaultand XCore's primary currency move the same money, and count as one currency for the floor and the ceiling. - A sale goes no deeper than the ceiling. With
max-sell-multiplier: 2.0and an item bought back at a quarter of its price, a sale can take 50% off it; asked for more, the price stays at the ceiling on that item, and the audit says on how many products the sale was limited (Sale limited). Raise the multiplier and bonuses can go higher, but sales go less deep.
The guarantee is about one item bought and sold back as it is. Making something else out of it, planks out of a log, is what the audit is for.
Rounding
Every amount is rounded the server's way: up for what a player pays, down for what a player receives, at the precision of the currency (the decimals of an XCore currency, two for another plugin's economy). No sequence of trades can be made to pay by the fractions rounding leaves behind.
- A positive price is never free: it costs at least the smallest amount the currency counts.
- A sale that would pay nothing is not made, and the items stay where they are.
- The dashboard's Change prices rounds the same way: buy prices up, sell prices down.