With the player economy coming along, the relatively fixed prices of trading guild shops are not desirable on the player trading network, as they may lock prices outside of equilibrium.
To fix this, there are three main solutions:
- remove trading guild shops
- don't allow trading guild shops on the trading network
- allow the trading guild to adjust their prices more or less freely
This will elaborate one possible way of option 3.
displayed price per item = (shop credits+1) / stock of item
price per item during transaction=( shop credits+1 ) / stock of item after transaction
This is a very simple way to calculate local and global prices, as it only considers variables of the current shop, and not from the global trading network. However, despite this, the prices will still get in line with the global prices, as players will sell to the shop more often if the prices are above the average network prices, increasing the shop's stock, and reducing the shop's credits, which will lower the price. If the price is lower than the network's prices, players will more often buy from the shop, reducing stock and increasing credits, which will increase the price.
Adding 1 to the shop credits is to prevent the edge case of the shop having no credits stored, which would result in all prices falling to 0 instantly.
This has the advantage that the calculation of the price is very cheap to do, and the price can also be cached until the next transaction occurs. And when the price of multiple shops needs to be calculated, it can also be done in 1 thread per shop, as no shared data is required.