rust经济学插件

很多插件都需要依托这个插件。

基本经济系统和经济API

经济学是一个基本的经济学系统,其他插件可以通过使用提供的 API 来使用它。就其本身而言,此插件仅提供列出的功能并且没有商店。

权限

该插件使用权限系统。要分配权限,请使用oxide.grant <user or group> <name or steam id> <permission>. 要删除权限,请使用oxide.revoke <user or group> <name or steam id> <permission>.

  • economics.balance— 允许玩家balance对其他玩家使用命令
  • economics.deposit— 允许玩家使用deposit命令
  • economics.depositall— 允许玩家使用deposit命令向所有玩家存款
  • economics.setbalance— 允许玩家使用setbalance命令
  • economics.setbalanceall— 允许玩家使用setbalance命令为所有玩家设置金钱
  • economics.transfer— 允许玩家使用transfer命令
  • economics.transferall— 允许玩家使用transfer命令将金额转移给所有连接的玩家
  • economics.withdraw— 允许玩家使用withdraw命令
  • economics.withdrawall— 允许玩家使用withdraw命令从所有玩家提取金额
  • economics.wipe— 允许玩家使用ecowipe命令擦除数据

命令

该插件使用相同的语法提供聊天和控制台命令。在聊天中使用命令时,请在其前面加上正斜杠:`/`。

  • balance
    检查您的余额(不需要或使用许可)
  • balance <player name or id>
    检查 [name] 玩家余额(需要economics.balance)
  • deposit <player name or id | *> <amount>
    将 [金额] 存入 [名称] 玩家(需要economics.deposit)
  • setbalance <player name or id | *> <amount>
    将 [name] 玩家的余额设置为 [amount] (需要economics.setbalance)
  • transfer <player name or id | *> <amount>
    将 [金额] 转移给 [名称] 玩家(需要economics.transfer)
  • withdraw <player name or id | *> <amount>
    从 [name] 玩家处提取 [amount] (需要economics.withdraw)
  • ecowipe
    擦除所有保存的经济学数据,包括余额(需要经济学.wipe)

注意:上述命令用法中的星号(*)表示所有玩家;谨慎使用。为所有玩家使用 * 需要关联 *All 权限。

配置

可以在目录Economics下的文件中配置设置和选项config。建议使用编辑器和验证器来避免格式​​问题和语法错误。

{
  "Allow negative balance for accounts": false,
  "Balance limit for accounts (0 to disable)": 0,
  "Negative balance limit for accounts (0 to disable)": 0,
  "Remove unused accounts": true,
  "Log transactions to file": false,
  "Starting account balance (0 or higher)": 1000,
  "Wipe balances on new save file": false
}

注意: wipe on new save 选项目前仅适用于RustHurtworld

本土化

默认消息位于目录Economics下的文件中lang/en。要添加对另一种语言的支持,请创建一个新的语言文件夹(例如de德语)(如果尚未创建),将默认语言文件复制到新文件夹,然后自定义消息。

{
  "CommandBalance": "balance",
  "CommandDeposit": "deposit",
  "CommandSetBalance": "SetBalance",
  "CommandTransfer": "transfer",
  "CommandWithdraw": "withdraw",
  "CommandWipe": "ecowipe",
  "DataSaved": "Economics data saved!",
  "DataWiped": "Economics data wiped!",
  "DepositedToAll": "Deposited {0:C} total ({1:C} each) to {2} player(s)",
  "LogDeposit": "{0:C} deposited to {1}",
  "LogSetBalance": "{0:C} set as balance for {1}",
  "LogTransfer": "{0:C} transferred to {1} from {2}",
  "LogWithdrawl": "{0:C} withdrawn from {1}",
  "NegativeBalance": "Balance can not be negative!",
  "NotAllowed": "You are not allowed to use the '{0}' command",
  "NoPlayersFound": "No players found with name or ID '{0}'",
  "PlayerBalance": "Balance for {0}: {1:C}",
  "PlayerLacksMoney": "'{0}' does not have enough money!",
  "PlayersFound": "Multiple players were found, please specify: {0}",
  "ReceivedFrom": "You have received {0} from {1}",
  "SetBalanceForAll": "Balance set to {0:C} for {1} player(s)",
  "TransactionFailed": "Transaction failed! Make sure amount is above 0",
  "TransferredTo": "{0} transferred to {1}",
  "TransferredToAll": "Transferred {0:C} total ({1:C} each) to {2} player(s)",
  "TransferToSelf": "You can not transfer money yourself!",
  "UsageBalance": "{0} - check your balance",
  "UsageBalanceOthers": "{0} <player name or id> - check balance of a player",
  "UsageDeposit": "{0} <player name or id> <amount> - deposit amount to player",
  "UsageSetBalance": "Usage: {0} <player name or id> <amount> - set balance for player",
  "UsageTransfer": "Usage: {0} <player name or id> <amount> - transfer money to player",
  "UsageWithdraw": "Usage: {0} <player name or id> <amount> - withdraw money from player",
  "UsageWipe": "Usage: {0} - wipe all economics data",
  "YouLackMoney": "You do not have enough money!",
  "YouLostMoney": "You lost: {0:C}",
  "YouReceivedMoney": "You received: {0:C}",
  "YourBalance": "Your balance is: {0:C}",
  "WithdrawnForAll": "Withdrew {0:C} total ({1:C} each) from {2} player(s)",
  "ZeroAmount": "Amount cannot be zero"
}

对于开发者

API 方法

private double Balance(string playerId)
private double Balance(ulong playerId)

private bool Deposit(string playerId, double amount)
private bool Deposit(ulong playerId, double amount)

private bool SetBalance(string playerId, double amount)
private bool SetBalance(ulong playerId, double amount)

private bool Transfer(string playerId, string targetId, double amount)
private bool Transfer(ulong playerId, string targetId, double amount)

private bool Withdraw(string playerId, double amount)
private bool Withdraw(ulong playerId, double amount)

挂钩

private void OnEconomicsBalanceUpdated(string playerId, double amount)

当玩家的账户余额发生变化时调用。

private OnEconomicsDeposit(string playerId, double amount)

当存款到玩家的账户时调用。

private void OnEconomicsWithdrawl(string playerId, double amount)

当从玩家的账户提款时调用。

private void OnEconomicsTransfer(string playerId, string targetId, double amount)

在玩家账户之间进行转账时调用。

private void OnEconomicsDataWiped()

在擦除所有经济数据时调用。

private void OnEconomicsDataWiped(IPlayer player)

当特定玩家的经济数据时调用。

学分

  • Nogrod,用于此插件的原始 C# 版本
  • Bombardir,用于此插件的原始 Lua 版本
© 版权声明
THE END
苦逼小编求支持
点赞13赞赏 分享
相关推荐
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容