Table of Contents

Class Money

Namespace
S1API.Money
Assembly
S1API.dll

Provides static access to financial operations, including methods for managing cash balance, creating online transactions, and calculating net worth.

public static class Money
Inheritance
Money
Inherited Members

Methods

AddNetworthCalculation(Action<object>)

Registers a callback to be invoked during net worth calculation.

public static void AddNetworthCalculation(Action<object> callback)

Parameters

callback Action<object>

The callback to be executed when net worth is calculated. It receives an object as its parameter.

ChangeCashBalance(float, bool, bool)

Adjusts the cash balance by the specified amount.

public static void ChangeCashBalance(float amount, bool visualizeChange = true, bool playCashSound = false)

Parameters

amount float

The amount to modify the cash balance by. Positive values increase the balance, and negative values decrease it.

visualizeChange bool

Indicates whether the cash change should be visualized on the HUD.

playCashSound bool

Indicates whether a sound effect should be played to signify the cash adjustment.

CreateCashInstance(float)

Creates a new cash instance with the specified balance.

public static CashInstance CreateCashInstance(float amount)

Parameters

amount float

The initial amount of cash to set in the instance.

Returns

CashInstance

A newly created instance of cash with the specified balance.

CreateOnlineTransaction(string, float, float, string)

Creates an online transaction.

public static void CreateOnlineTransaction(string transactionName, float unitAmount, float quantity, string transactionNote)

Parameters

transactionName string

The name of the transaction.

unitAmount float

The monetary amount per unit involved in the transaction.

quantity float

The number of units in the transaction.

transactionNote string

An optional note or description for the transaction.

GetCashBalance()

Retrieves the current cash balance.

public static float GetCashBalance()

Returns

float

The current cash balance as a floating-point value.

GetNetWorth()

Retrieves the total net worth, including all cash and online balances combined.

public static float GetNetWorth()

Returns

float

The total net worth as a floating-point value.

GetOnlineBalance()

Retrieves the current online balance.

public static float GetOnlineBalance()

Returns

float

The current amount of online balance.

RemoveNetworthCalculation(Action<object>)

Removes a previously registered networth calculation callback.

public static void RemoveNetworthCalculation(Action<object> callback)

Parameters

callback Action<object>

The callback to be removed from the networth calculation updates.

Events

OnBalanceChanged

Event triggered whenever there is a change in the balance, including cash balance or online transactions.

public static event Action? OnBalanceChanged

Event Type

Action