using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Servers; using SptCommon.Annotations; namespace Core.Helpers; [Injectable] public class PaymentHelper(ConfigServer _configServer) { protected bool _addedCustomMoney; protected InventoryConfig _inventoryConfig = _configServer.GetConfig(); protected List _moneyTpls = [Money.DOLLARS, Money.EUROS, Money.ROUBLES, Money.GP]; /// /// Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls) /// /// /// public bool IsMoneyTpl(string tpl) { if (!_addedCustomMoney) { _moneyTpls.AddRange(_inventoryConfig.CustomMoneyTpls); _addedCustomMoney = true; } return _moneyTpls.Contains(tpl); } /// /// Gets currency TPL from TAG /// /// /// public string GetCurrency(CurrencyType? currency) { return currency switch { CurrencyType.EUR => Money.EUROS, CurrencyType.USD => Money.DOLLARS, CurrencyType.RUB => Money.ROUBLES, CurrencyType.GP => Money.GP, _ => "" }; } }