Implemented IsMoneyTpl

This commit is contained in:
Chomp
2025-01-13 11:00:13 +00:00
parent 85b53c5fa9
commit 007dd48b37
+25 -2
View File
@@ -1,10 +1,24 @@
using Core.Annotations;
using Core.Annotations;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
namespace Core.Helpers;
[Injectable]
public class PaymentHelper
{
private readonly ConfigServer _configServer;
private readonly InventoryConfig _inventoryConfig;
public PaymentHelper(
ConfigServer configServer)
{
_configServer = configServer;
_inventoryConfig = _configServer.GetConfig<InventoryConfig>(ConfigTypes.INVENTORY);
}
/// <summary>
/// Is the passed in tpl money (also checks custom currencies in inventoryConfig.customMoneyTpls)
/// </summary>
@@ -12,7 +26,16 @@ public class PaymentHelper
/// <returns></returns>
public bool IsMoneyTpl(string tpl)
{
throw new NotImplementedException();
var moneyTypes = new List<string>
{
Money.DOLLARS,
Money.ROUBLES,
Money.GP,
};
moneyTypes.AddRange(_inventoryConfig.CustomMoneyTpls);
return moneyTypes.Contains(tpl);
}
/// <summary>