use prim ctor and fixed warnings: InRaid and Insurance callbacks

This commit is contained in:
CWX
2025-01-18 13:11:20 +00:00
parent 71f2af285b
commit dcec73af02
2 changed files with 15 additions and 42 deletions
+4 -15
View File
@@ -1,28 +1,17 @@
using Core.Annotations;
using Core.Controllers;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.InRaid;
using Core.Utils;
namespace Core.Callbacks;
[Injectable]
public class InraidCallbacks
{
protected InRaidController _inRaidController;
protected HttpResponseUtil _httpResponseUtil;
public InraidCallbacks
(
InRaidController inRaidController,
HttpResponseUtil httpResponseUtil
public class InraidCallbacks(
InRaidController _inRaidController,
HttpResponseUtil _httpResponseUtil
)
{
_inRaidController = inRaidController;
_httpResponseUtil = httpResponseUtil;
}
{
/// <summary>
/// Handle client/location/getLocalloot
/// Store active map in profile + applicationContext
+11 -27
View File
@@ -2,10 +2,8 @@
using Core.Controllers;
using Core.DI;
using Core.Models.Eft.Common;
using Core.Models.Eft.HttpResponse;
using Core.Models.Eft.Insurance;
using Core.Models.Eft.ItemEvent;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Servers;
using Core.Services;
@@ -15,29 +13,15 @@ namespace Core.Callbacks;
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.InsuranceCallbacks)]
[Injectable(InjectableTypeOverride = typeof(InsuranceCallbacks))]
public class InsuranceCallbacks : OnUpdate
{
protected InsuranceController _insuranceController;
protected InsuranceService _insuranceService;
protected HttpResponseUtil _httpResponseUtil;
protected ConfigServer _configServer;
private InsuranceConfig _insuranceConfig;
public InsuranceCallbacks
(
InsuranceController insuranceController,
InsuranceService insuranceService,
HttpResponseUtil httpResponseUtil,
ConfigServer configServer
public class InsuranceCallbacks(
InsuranceController _insuranceController,
InsuranceService _insuranceService,
HttpResponseUtil _httpResponseUtil,
ConfigServer _configServer
)
{
_insuranceController = insuranceController;
_insuranceService = insuranceService;
_httpResponseUtil = httpResponseUtil;
_configServer = configServer;
_insuranceConfig = configServer.GetConfig<InsuranceConfig>();
}
: OnUpdate
{
private InsuranceConfig _insuranceConfig = _configServer.GetConfig<InsuranceConfig>();
/// <summary>
/// Handle client/insurance/items/list/cost
@@ -65,16 +49,16 @@ public class InsuranceCallbacks : OnUpdate
throw new NotImplementedException();
}
public async Task<bool> OnUpdate(long timeSinceLastRun)
public Task<bool> OnUpdate(long timeSinceLastRun)
{
if (timeSinceLastRun > Math.Max(_insuranceConfig.RunIntervalSeconds, 1))
{
// _insuranceController.ProcessReturn();
// TODO: InsuranceController is not implemented rn
return true;
return Task.FromResult(true);
}
return false;
return Task.FromResult(false);
}
public string GetRoute()