Interface IEconomyProvider
Namespace: OpenMod.Extensions.Economy.Abstractions
Assembly: OpenMod.Extensions.Economy.Abstractions.dll
Syntax
public interface IEconomyProvider
Properties
| Improve this Doc View SourceCurrencyName
Gets the name of the currency, e.g. "Dollar".
Declaration
string CurrencyName { get; }
Property Value
Type | Description |
---|---|
System.String |
CurrencySymbol
Gets the symbol of the currency, e.g. "$".
Declaration
string CurrencySymbol { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGetBalanceAsync(String, String)
Gets the balance of an user.
Declaration
Task<decimal> GetBalanceAsync(string ownerId, string ownerType)
Parameters
Type | Name | Description |
---|---|---|
System.String | ownerId | The ID of the owner. |
System.String | ownerType | The actor type of the owner. |
Returns
Type | Description |
---|---|
Task<System.Decimal> |
SetBalanceAsync(String, String, Decimal)
Sets balance for a user.
Declaration
Task SetBalanceAsync(string ownerId, string ownerType, decimal balance)
Parameters
Type | Name | Description |
---|---|---|
System.String | ownerId | The ID of the owner. |
System.String | ownerType | The actor type of the owner. |
System.Decimal | balance | The balance to set to. |
Returns
Type | Description |
---|---|
Task |
UpdateBalanceAsync(String, String, Decimal, Nullable<String>)
Creates a transaction and updates the balance of a user.
Declaration
Task<decimal> UpdateBalanceAsync(string ownerId, string ownerType, decimal changeAmount, string? reason)
Parameters
Type | Name | Description |
---|---|---|
System.String | ownerId | The ID of the owner. |
System.String | ownerType | The actor type of the owner. |
System.Decimal | changeAmount | The amount to add or remove. |
System.Nullable<System.String> | reason | The optional reason for this transaction. |
Returns
Type | Description |
---|---|
Task<System.Decimal> |
Exceptions
Type | Condition |
---|---|
NotEnoughBalanceException | if the balance would become negative |