From 424e3234dfded5c381362a548b1f471f813cb3fe Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 24 Jan 2025 09:37:32 +0000 Subject: [PATCH] partially implemented `MatchLocationService` --- .../Core/Services/MatchLocationService.cs | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Libraries/Core/Services/MatchLocationService.cs b/Libraries/Core/Services/MatchLocationService.cs index dabbaad2..78080cca 100644 --- a/Libraries/Core/Services/MatchLocationService.cs +++ b/Libraries/Core/Services/MatchLocationService.cs @@ -1,12 +1,41 @@ -using SptCommon.Annotations; +using System.Text.Json.Serialization; +using SptCommon.Annotations; namespace Core.Services; [Injectable(InjectionType.Singleton)] public class MatchLocationService { - public void DeleteGroup(object info) + protected Dictionary _locations = new(); + + /// + /// DisbandRaidGroup + /// + /// + public void DeleteGroup(DeleteGroupRequest request) { - throw new NotImplementedException(); + // 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 Groups { get; set; } + } + + public class DeleteGroupRequest + { + [JsonPropertyName("groupId")] + public string GroupId { get; set; } } }