Difference between revisions of "Cabal Common Library Doc SpecialMarkets"
m (calculator for developers added) |
Cholmondely (talk | contribs) m (Retagged!) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
− | This is the main class for the special markets with its members. | + | {{OXPNote|The market will be turned into a 'Black market' for v1.7.1. For standard goods we already have cims [[New Cargoes]]. More options will become available to handle equipment and special goods. By the time of writing only 1 OXP is affected ([[Vector OXP|Vector]])}} |
+ | This is the main class for the special markets with its members and part of the [[Cabal_Common_Library]]. | ||
The script gives another option for trading in special goods and calculates prices and availabilities for inserted items. | The script gives another option for trading in special goods and calculates prices and availabilities for inserted items. | ||
A calculator (OpenOffice format) for OXP developers is available: [http://www.box.com/s/68r3dqmv9sn605gy3up8 CCL_SpecialMarkets_Calc.zip] (21.3 KB). | A calculator (OpenOffice format) for OXP developers is available: [http://www.box.com/s/68r3dqmv9sn605gy3up8 CCL_SpecialMarkets_Calc.zip] (21.3 KB). | ||
+ | |||
+ | CCL_SM cargo only takes up hold space as either "entire hold useSpecialCargo" or as an awardContract cargo delivery contract for one of the standard 17. If it's neither "block" nor "contract" it takes up no space. | ||
== Functions == | == Functions == | ||
Line 61: | Line 64: | ||
---- | ---- | ||
− | [[Category: | + | [[Category:OXP API's]] |
Latest revision as of 14:09, 20 September 2023
Overview
This is the main class for the special markets with its members and part of the Cabal_Common_Library.
The script gives another option for trading in special goods and calculates prices and availabilities for inserted items.
A calculator (OpenOffice format) for OXP developers is available: CCL_SpecialMarkets_Calc.zip (21.3 KB).
CCL_SM cargo only takes up hold space as either "entire hold useSpecialCargo" or as an awardContract cargo delivery contract for one of the standard 17. If it's neither "block" nor "contract" it takes up no space.
Functions
registerLocation()
worldScripts.Cabal_Common_SpecialMarkets.registerLocation(obj); |
Scripts can specify systems where items can be bought or sold. Only one object with a few properties has to be passed.
Properties of obj:
- item
- String. Required. Unique Name. Max length 40 chars.
- galaxy
- Array. Required. Galaxy [0...7].
- buyID
- Array. Required. System.IDs [0...255].
- sellID
- Array. Required. System.IDs. If sold (and no contract) callback [0...255].
- stationID
- Array. Required. Specified stations for buy and sell, e.g. [["main"],["MyStation"]].
- cb
- String. Required. worldScript name for callback.
- cbb
- String. Required. Function that handles the delivery if !contract.
- priceclass
- Number. Required. Base priceclass. The higher the lower the production. [5...100].
- refresh
- Number. Required. Units produced every day [0...1].
- desc
- String. Required. Description.
- block
- Boolean. Blocks cargohold on purchase. If true disables contract.
- contract
- String. If !block it turns it into a cargo contract to a random system in sellID.
- offset
- Number. Sell multiplier for calculated price [1.3...5]. Default 1.3.
- avail
- Number. Starting availability [0...25]. Higher values will lower the prices. Default 0.
- times
- Number. Start time [clock.days-1000...clock.days]. Default clock.days.
- decrease
- Number. Affects prices and produced units over time [0.01...0.5]. Default 0.1.
- legal
- Boolean. Legality of this item. Default true.
- model
- String. Role. Default "cargopod".
- oneShot
- Boolean. One shot deal. If true item will be removed after selling.
Returns:
- success
- Boolean. True on success.
removeTradeItem()
worldScripts.Cabal_Common_SpecialMarkets.removeTradeItem(item); |
Removes the specified item.
Parameters:
- item
- String. Item to be removed.
Returns:
- nothing.
checkPSHold()
worldScripts.Cabal_Common_SpecialMarkets.checkPSHold(item); |
Convenience check if player has a specific item in his hold.
Parameters:
- item
- String. Item to be checked.
Returns:
- n
- Number. Amount.