public static void AssignModuleTo([Group(1)] string targetUser, [Group(2)] string queries, string user) { if (TwitchPlaySettings.data.AnarchyMode) { IRCConnection.SendMessage($"{user}, assigning modules is not allowed in anarchy mode."); return; } var query = queries.SplitFull(' ', ',', ';'); var denied = new List <string>(); foreach (var module in TwitchGame.Instance.Modules.Where(m => !m.Solved && GameRoom.Instance.IsCurrentBomb(m.BombID) && query.Any(q => q.EqualsIgnoreCase(m.Code))).Take(TwitchPlaySettings.data.ModuleClaimLimit)) { if ((module.PlayerName != user || !module.ClaimQueue.Any(q => q.UserNickname != targetUser)) && !UserAccess.HasAccess(user, AccessLevel.Mod, true)) { denied.Add(module.Code); } else { ModuleCommands.Assign(module, user, targetUser); } } if (denied.Count == 1) { IRCConnection.SendMessage($"{user}, since you’re not a moderator, {denied.First()} has not been reassigned.", user, false); } else if (denied.Count > 1) { IRCConnection.SendMessage($"{user}, since you’re not a moderator, {denied.Take(denied.Count - 1).Join(", ")} and {denied.Last()} have not been reassigned.", user, false); } }
public static void AssignModuleTo([Group(1)] string targetUser, [Group(2)] string queries, string user) { var query = queries.Split(new[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (var module in TwitchGame.Instance.Modules.Where(m => !m.Solved && GameRoom.Instance.IsCurrentBomb(m.BombID) && query.Any(q => q.EqualsIgnoreCase(m.Code))).Take(TwitchPlaySettings.data.ModuleClaimLimit)) { ModuleCommands.Assign(module, user, targetUser); } }