From ae1db2e1a149efcebe13d6a3f4272cbb03aa5cbb Mon Sep 17 00:00:00 2001 From: Sarah Faey Date: Fri, 9 Dec 2022 23:05:46 +0100 Subject: [PATCH] only SignedUp users are now randomized --- Lieb/Data/RaidRandomizerService.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Lieb/Data/RaidRandomizerService.cs b/Lieb/Data/RaidRandomizerService.cs index 21dc09f..2130734 100644 --- a/Lieb/Data/RaidRandomizerService.cs +++ b/Lieb/Data/RaidRandomizerService.cs @@ -55,7 +55,7 @@ namespace Lieb.Data private void RandomizeClasses(Raid raid) { - foreach (RaidSignUp signUp in raid.SignUps.Where(s => s.RaidRole.IsRandomSignUpRole)) + foreach (RaidSignUp signUp in raid.SignUps.Where(s => s.RaidRole.IsRandomSignUpRole && s.SignUpType == SignUpType.SignedUp)) { HashSet possibleClasses = new HashSet(); foreach (Equipped build in signUp.GuildWars2Account.EquippedBuilds.Where(b => b.GuildWars2Build.UseInRandomRaid)) @@ -79,7 +79,7 @@ namespace Lieb.Data private void RandomizeEliteSpecs(Raid raid) { - foreach (RaidSignUp signUp in raid.SignUps.Where(s => s.RaidRole.IsRandomSignUpRole)) + foreach (RaidSignUp signUp in raid.SignUps.Where(s => s.RaidRole.IsRandomSignUpRole && s.SignUpType == SignUpType.SignedUp)) { HashSet possibleEliteSpecs = new HashSet(); foreach (Equipped build in signUp.GuildWars2Account.EquippedBuilds.Where(b => b.GuildWars2Build.UseInRandomRaid)) @@ -103,10 +103,17 @@ namespace Lieb.Data private void RandomizeWithBoons(Raid raid) { - int noGroups = (raid.SignUps.Where(s => s.SignUpType != SignUpType.Flex && s.SignUpType != SignUpType.SignedOff).Count() / 5) +1; + //reset signUps to move Maybes and Backups back to Random + RaidRole randomRole = raid.Roles.FirstOrDefault(r => r.IsRandomSignUpRole); + foreach (RaidSignUp signUp in raid.SignUps) + { + signUp.RaidRole = randomRole; + } + + int noGroups = (raid.SignUps.Where(s => s.SignUpType == SignUpType.SignedUp).Count() / 5) +1; HashSet signedUpAccounts = raid.SignUps.Where(s => s.GuildWars2Account != null && s.GuildWars2Account.EquippedBuilds.Where(b => b.GuildWars2Build.UseInRandomRaid).Count() > 0 - && s.SignUpType != SignUpType.Flex && s.SignUpType != SignUpType.SignedOff) + && s.SignUpType == SignUpType.SignedUp) .Select(s => s.GuildWars2Account).ToHashSet(); List> possibleBoonCombinations = GetPossibleBoonCombinations(signedUpAccounts);