Home
Mod provides API for money operations, which can be used by other mods or as standalone provider of basic player's accounts.
EconomyHandler interface provides this functions:
- bool newAccount(string account, Dictionary<string, object> additionalInfoNewAccount = null)
- try to create new account with provided id and additional info in dict
- bool updateAccount(string account, Dictionary<string, object> additionalInfoUpdateAccount = null)
- change selected by implementation parameters of already existent account
- bool deleteAccount(string account)
- remove account
- decimal getBalance(string account)
- return balance of account, -1 if not found
- OperationResult withdraw(string account, decimal quantity)
- try to take selected value from currentBalance of account
- OperationResult deposit(string account, decimal quantity)
- try to add value to currentBalance
- OperationResult depositFromAToB(string accountA, string accountB, decimal quantity)
- withdraw + deposit
- bool accountExist(string account)
- check for account
For now RealMoneyEconomyHandler[needs some update of harmony patches to work without initilization from another mod] and VirtualMoneyEconomyHandler implementations of EconomyHandler are available, to select them you'll need to set value of config's SELECTED_ECONOMY_HANDLER to "REAL_MONEY" or "VIRTUAL_MONEY".
If you want to init one of them from your mod set value to "" for example and create instance of one of implementations.
VirtualMoneyEconomyHandler provides few commands:
- /deposit - check active slot and if it's currency take and deposit it on your account
- /withdraw NUMBER - try to withdraw from your account
- /pay PLAYERNAME NUMBER - try to find another player by name and pay selected amount
In config's COINS_VALUES_TO_CODE you set value for some item through code, by default it is {1, "gear-rusty"}