Files
SPT-Server-Build/Libraries/SPTarkov.Server.Core/Services/MatchLocationService.cs
T
2025-06-28 12:53:21 +01:00

42 lines
1.1 KiB
C#

using System.Text.Json.Serialization;
using SPTarkov.DI.Annotations;
namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class MatchLocationService
{
protected readonly Dictionary<string, MatchGroup> _locations = new();
/// <summary>
/// DisbandRaidGroup
/// </summary>
/// <param name="request"></param>
public void DeleteGroup(DeleteGroupRequest request)
{
// Find group by id by iterating over all locations and looking for it by groupId
foreach (var locationKvP in _locations)
{
var matchingGroup = _locations[locationKvP.Key]
.Groups.FirstOrDefault(groupKvP => groupKvP == request.GroupId);
if (matchingGroup != null)
{
_locations[locationKvP.Key].Groups.Remove(request.GroupId);
return;
}
}
}
public class MatchGroup
{
[JsonPropertyName("groups")]
public List<string> Groups { get; set; }
}
public class DeleteGroupRequest
{
[JsonPropertyName("groupId")]
public string GroupId { get; set; }
}
}