Cabal Common Library Doc SpecialMarkets

From Elite Wiki

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.