Skip to content

ComputerCraft Integration

techno-sam edited this page Aug 7, 2024 · 9 revisions

Caution

This is a 1.0.7 feature and currently is not in any public release

The following peripherals become available to CC:Tweaked when Numismatics is installed:


Brass Depositor and Vendor

Method Description
setCoinAmount(String coinName, int amount) Sets the price with the coinName provided and amount
setTotalPrice(int spurAmount) Sets the total price
getTotalPrice() Get the total price
getPrice(String coinName) Get the price with the coinName provided

setCoinAmount(String coinName, int amount)

Set's the price for the attached block, you can control what amount is set for each coin by using the coin names.

setTotalPrice(int spurAmount)

Set's the total price for the attached block in spurs.

getTotalPrice()

Get the total price of the attached block in spurs.

Returns

  • number The total price in spurs

getPrice(String coinName)

Get the price of the attached block in the coinName provided.

Returns

  • number The total price in the provided coinName


Salepoint

Inherits all methods from Vendors/Depositors

Method Description
getSaleObject() Gets the object for sale
getTransaction() Gets the current active transaction
startTransaction(String accountID, String authorizationID, int count) Starts a new transaction
cancelTransaction() Cancels the current transaction, if any

getSaleObject()

Gets the object for sale.

Throws an error if the salepoint is not initialized.

Returns

  • table The sale object

  • Example:

    {
        "type": "ITEM",
        "filter": ...
    }

getTransaction()

Gets the current active transaction.

Throws an error if there is not an active transaction.

Returns

  • table The transaction object

  • Example:

    {
        "object": ..., -- equivalent to getSaleObject()
        "unitPrice": 42, -- the total price, in spurs, per unit
        "targetCount": 20, -- how many units the transaction will eventually sell
        "currentCount": 12 -- how many units the transaction has already sold
    }

startTransaction(String accountID, String authorizationID, int count)

Starts a new transaction, which will attempt to sell count units to the Sub Account specified by accountID and authorizationID.

Throws an error if the account is not found, the Sub Account isn't authorized, the salepoint is not configured, or the salepoint is already processing a transaction

cancelTransaction()

Cancels the current transaction, if any.



Bank Terminal

Method Description
getBalance(String accountID) Gets the balance (in spurs) of the specified account
getMaxAvailableWithdrawal(String accountID, String authorizationID) Gets the maximum number of spurs that can be withdrawn from the specified account
transfer(String fromAccountID, String fromAuthorizationID, String toAccountID, int amount) Transfer amount spurs between the specified accounts
getAccounts() Gets a list of UUIDs for all accounts
getAccountLabel(String accountID) Gets the label of the specified account
getSubAccountLabel(String accountID, String authorizationID) Gets the label of the specified Sub Account inside of the specified account
isPlayerOwned(String accountID) Check whether a player or a Blaze Banker owns the specified account

getBalance(String accountID)

Get the balance of the specified account.

Throws an error if the account is not found.

Returns

  • number The balance of the account in spurs

getMaxAvailableWithdrawal(String accountID, String authorizationID)

Get the maximum number of spurs that can be withdrawn from the specified account.

The Sub Account specified by authorizationID must be set to Authorization Type Anybody, otherwise the amount will be 0.

Throws an error if the account is not found or if the Sub Account isn't authorized

Returns

  • number The maximum number of spurs that can be withdrawn from the account (the minimum of the account balance and remaining spend limit, if applicable)

transfer(String fromAccountID, String fromAuthorizationID, String toAccountID, int amount)

Transfer amount spurs between the specified accounts.

The Sub Account specified by fromAuthorizationID must be set to Authorization Type Anybody.

Throws an error if accounts are not found, if the Sub Account isn't authorized, or if there is insufficient balance.

getAccounts()

Gets a list of UUIDs for all accounts.

Returns

  • list of UUIDs for all accounts.

getAccountLabel(String accountID)

Get the label of the specified account.

Throws an error if the account is not found.

Returns

  • string the name of the specified account

getSubAccountLabel(String accountID, String authorizationID)

Get the label of the specified Sub Account inside of the specified account.

Authorization type must be set to Anybody, otherwise will throw an error.

Returns

  • string the name of the specified Sub Account

isPlayerOwned(String accountID)

Check whether a player or a Blaze Banker owns the specified account.

Returns

  • bool true if account is player-owned, false if account is Blaze Banker-owned.