OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Interface IEconomyProvider

Namespace: OpenMod.Extensions.Economy.Abstractions
Assembly: OpenMod.Extensions.Economy.Abstractions.dll
Syntax
public interface IEconomyProvider

Properties

| Improve this Doc View Source

CurrencyName

Gets the name of the currency, e.g. "Dollar".

Declaration
string CurrencyName { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

CurrencySymbol

Gets the symbol of the currency, e.g. "$".

Declaration
string CurrencySymbol { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

GetBalanceAsync(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>
| Improve this Doc View Source

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
| Improve this Doc View Source

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

Extension Methods

DisposeHelper.DisposeSyncOrAsync(Object)