Difference between revisions of "NewCargoesAPI/Pricing"
(New Cargoes API for major price changes) |
Cholmondely (talk | contribs) m (Retagged!) |
||
(One intermediate revision by one other user not shown) | |||
Line 31: | Line 31: | ||
Otherwise return false. | Otherwise return false. | ||
+ | |||
+ | ---- | ||
+ | [[Category:OXP API's]] |
Latest revision as of 13:48, 20 September 2023
Any world script registered as providing trading price fluctuation definitions for New Cargoes through registerPriceChange must contain all of these functions.
Look at the Scripts/cargotyperegional.js script of the New Cargoes OXP for a simple example.
Required functions
priceChange
int priceChange(CargoID good, Context context)
Returns a multiplier to the price of the specified good, in the current system. This multiplier will be applied to all price calculations done in the current system, for all stations.
Return 1 if no special multiplier applies.
context will be one of "FLUX_EXPORT", "FLUX_IMPORT" or "FLUX_MISC", depending on whether the good is an export, an import, or neither. A good may in theory be all three at different stations in the same system.
priceGossip
String? priceGossip
If you wish there to be gossip in the trader bars of this system about these price modifications, return it here. Gossip should be at most 80 characters in length, and start with the string "* ".
Otherwise return false.