Difference between revisions of "Cabal Common Library Doc SpecialMarkets"
From Elite Wiki
m (documentation added) |
m (added note about changes) |
||
(4 intermediate revisions by the same user 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). |
||
== Functions == |
== Functions == |
||
Line 14: | Line 17: | ||
:;buyID:Array. Required. System.IDs [0...255]. |
:;buyID:Array. Required. System.IDs [0...255]. |
||
:;sellID:Array. Required. System.IDs. If sold (and no contract) callback [0...255]. |
:;sellID:Array. Required. System.IDs. If sold (and no contract) callback [0...255]. |
||
− | :;stationID:Array. Required. |
+ | :;stationID:Array. Required. Specified stations for buy and sell, e.g. [["main"],["MyStation"]]. |
:;cb:String. Required. worldScript name for callback. |
:;cb:String. Required. worldScript name for callback. |
||
:;cbb:String. Required. Function that handles the delivery if !contract. |
:;cbb:String. Required. Function that handles the delivery if !contract. |
||
Line 45: | Line 48: | ||
'''Returns:''' |
'''Returns:''' |
||
:;nothing. |
:;nothing. |
||
+ | |||
+ | |||
+ | === checkPSHold() === |
||
+ | {{CodeEx|codeex=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. |
||
---- |
---- |
Latest revision as of 13:19, 14 February 2013
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).
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.