public override void SetItem(OverlayItemBase item) { this.item = (OverlayStreamBoss)item; this.StartingHealthTextBox.Text = this.item.StartingHealth.ToString(); this.WidthTextBox.Text = this.item.Width.ToString(); this.HeightTextBox.Text = this.item.Height.ToString(); this.TextFontComboBox.Text = this.item.TextFont; this.TextColorComboBox.Text = this.item.TextColor; if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.TextColor)) { this.TextColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.TextColor)).Key; } this.BorderColorComboBox.Text = this.item.BorderColor; if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BorderColor)) { this.BorderColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BorderColor)).Key; } this.BackgroundColorComboBox.Text = this.item.BackgroundColor; if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.BackgroundColor)) { this.BackgroundColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.BackgroundColor)).Key; } this.ProgressColorComboBox.Text = this.item.ProgressColor; if (ColorSchemes.ColorSchemeDictionary.ContainsValue(this.item.ProgressColor)) { this.ProgressColorComboBox.Text = ColorSchemes.ColorSchemeDictionary.FirstOrDefault(c => c.Value.Equals(this.item.ProgressColor)).Key; } this.DamageAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.DamageAnimation); this.NewBossAnimationComboBox.SelectedItem = EnumHelper.GetEnumName(this.item.NewBossAnimation); this.FollowBonusTextBox.Text = this.item.FollowBonus.ToString(); this.HostBonusTextBox.Text = this.item.HostBonus.ToString(); this.SubBonusTextBox.Text = this.item.SubscriberBonus.ToString(); this.DonationBonusTextBox.Text = this.item.DonationBonus.ToString(); this.SparkBonusTextBox.Text = this.item.SparkBonus.ToString(); this.EmberBonusTextBox.Text = this.item.EmberBonus.ToString(); this.HTMLText.Text = this.item.HTMLText; this.command = this.item.NewStreamBossCommand; this.UpdateChangedCommand(); }
private static IEnumerable <CommandBase> GetAllCommands(IChannelSettings settings) { List <CommandBase> commands = new List <CommandBase>(); commands.AddRange(settings.ChatCommands); commands.AddRange(settings.EventCommands); commands.AddRange(settings.InteractiveCommands); commands.AddRange(settings.TimerCommands); commands.AddRange(settings.ActionGroupCommands); commands.AddRange(settings.GameCommands); foreach (UserDataViewModel userData in settings.UserData.Values) { commands.AddRange(userData.CustomCommands); if (userData.EntranceCommand != null) { commands.Add(userData.EntranceCommand); } } foreach (GameCommandBase gameCommand in settings.GameCommands) { commands.AddRange(gameCommand.GetAllInnerCommands()); } foreach (UserCurrencyViewModel currency in settings.Currencies.Values) { if (currency.RankChangedCommand != null) { commands.Add(currency.RankChangedCommand); } } foreach (UserInventoryViewModel inventory in settings.Inventories.Values) { commands.Add(inventory.ItemsBoughtCommand); commands.Add(inventory.ItemsSoldCommand); } foreach (OverlayWidget widget in settings.OverlayWidgets) { if (widget.Item is OverlayStreamBoss) { OverlayStreamBoss item = ((OverlayStreamBoss)widget.Item); if (item.NewStreamBossCommand != null) { commands.Add(item.NewStreamBossCommand); } } else if (widget.Item is OverlayProgressBar) { OverlayProgressBar item = ((OverlayProgressBar)widget.Item); if (item.GoalReachedCommand != null) { commands.Add(item.GoalReachedCommand); } } else if (widget.Item is OverlayTimer) { OverlayTimer item = ((OverlayTimer)widget.Item); if (item.TimerCompleteCommand != null) { commands.Add(item.TimerCompleteCommand); } } } return(commands); }
public OverlayStreamBossControl(OverlayStreamBoss item) : this() { this.item = item; }
public async Task ReplaceCommonSpecialModifiers(UserViewModel user, IEnumerable <string> arguments = null) { foreach (string counter in ChannelSession.Counters.Keys) { this.ReplaceSpecialIdentifier(counter, ChannelSession.Counters[counter].ToString()); } foreach (var kvp in SpecialIdentifierStringBuilder.CustomSpecialIdentifiers) { this.ReplaceSpecialIdentifier(kvp.Key, kvp.Value); } this.ReplaceSpecialIdentifier("timedigits", DateTimeOffset.Now.ToString("HHmm")); this.ReplaceSpecialIdentifier("dayoftheweek", DateTimeOffset.Now.DayOfWeek.ToString()); this.ReplaceSpecialIdentifier("datetime", DateTimeOffset.Now.ToString("g")); this.ReplaceSpecialIdentifier("date", DateTimeOffset.Now.ToString("d")); this.ReplaceSpecialIdentifier("time", DateTimeOffset.Now.ToString("t")); this.ReplaceSpecialIdentifier("linebreak", Environment.NewLine); if (this.ContainsSpecialIdentifier(SpecialIdentifierStringBuilder.TopSpecialIdentifierHeader)) { Dictionary <uint, UserDataViewModel> allUsersDictionary = ChannelSession.Settings.UserData.ToDictionary(); allUsersDictionary.Remove(ChannelSession.Channel.user.id); IEnumerable <UserDataViewModel> allUsers = allUsersDictionary.Select(kvp => kvp.Value); allUsers = allUsers.Where(u => !u.IsCurrencyRankExempt); if (this.ContainsRegexSpecialIdentifier(SpecialIdentifierStringBuilder.TopSparksUsedRegexSpecialIdentifierHeader)) { await this.HandleSparksUsed("weekly", async (amount) => { return(await ChannelSession.Connection.GetWeeklySparksLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleSparksUsed("monthly", async (amount) => { return(await ChannelSession.Connection.GetMonthlySparksLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleSparksUsed("yearly", async (amount) => { return(await ChannelSession.Connection.GetYearlySparksLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleSparksUsed("alltime", async (amount) => { return(await ChannelSession.Connection.GetAllTimeSparksLeaderboard(ChannelSession.Channel, amount)); }); } if (this.ContainsRegexSpecialIdentifier(SpecialIdentifierStringBuilder.TopEmbersUsedRegexSpecialIdentifierHeader)) { await this.HandleEmbersUsed("weekly", async (amount) => { return(await ChannelSession.Connection.GetWeeklyEmbersLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleEmbersUsed("monthly", async (amount) => { return(await ChannelSession.Connection.GetMonthlyEmbersLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleEmbersUsed("yearly", async (amount) => { return(await ChannelSession.Connection.GetYearlyEmbersLeaderboard(ChannelSession.Channel, amount)); }); await this.HandleEmbersUsed("alltime", async (amount) => { return(await ChannelSession.Connection.GetAllTimeEmbersLeaderboard(ChannelSession.Channel, amount)); }); } if (this.ContainsRegexSpecialIdentifier(SpecialIdentifierStringBuilder.TopTimeRegexSpecialIdentifier)) { await this.ReplaceNumberBasedRegexSpecialIdentifier(SpecialIdentifierStringBuilder.TopTimeRegexSpecialIdentifier, (total) => { List <string> timeUserList = new List <string>(); int userPosition = 1; foreach (UserDataViewModel timeUser in allUsers.OrderByDescending(u => u.ViewingMinutes).Take(total)) { timeUserList.Add($"#{userPosition}) {timeUser.UserName} - {timeUser.ViewingTimeShortString}"); userPosition++; } string result = "No users found."; if (timeUserList.Count > 0) { result = string.Join(", ", timeUserList); } return(Task.FromResult(result)); }); } foreach (UserCurrencyViewModel currency in ChannelSession.Settings.Currencies.Values) { if (this.ContainsRegexSpecialIdentifier(currency.TopRegexSpecialIdentifier)) { await this.ReplaceNumberBasedRegexSpecialIdentifier(currency.TopRegexSpecialIdentifier, (total) => { List <string> currencyUserList = new List <string>(); int userPosition = 1; foreach (UserDataViewModel currencyUser in allUsers.OrderByDescending(u => u.GetCurrencyAmount(currency)).Take(total)) { currencyUserList.Add($"#{userPosition}) {currencyUser.UserName} - {currencyUser.GetCurrencyAmount(currency)}"); userPosition++; } string result = "No users found."; if (currencyUserList.Count > 0) { result = string.Join(", ", currencyUserList); } return(Task.FromResult(result)); }); } } } if (this.ContainsSpecialIdentifier(CurrentSongIdentifierHeader) || this.ContainsSpecialIdentifier(NextSongIdentifierHeader)) { if (ChannelSession.Services.SongRequestService != null && ChannelSession.Services.SongRequestService.IsEnabled) { this.ReplaceSongRequestSpecialIdentifiers(CurrentSongIdentifierHeader, await ChannelSession.Services.SongRequestService.GetCurrentlyPlaying()); this.ReplaceSongRequestSpecialIdentifiers(NextSongIdentifierHeader, await ChannelSession.Services.SongRequestService.GetNextTrack()); } } if (this.ContainsSpecialIdentifier(UptimeSpecialIdentifierHeader) || this.ContainsSpecialIdentifier(StartSpecialIdentifierHeader)) { DateTimeOffset startTime = await UptimeChatCommand.GetStartTime(); if (startTime > DateTimeOffset.MinValue) { TimeSpan duration = DateTimeOffset.Now.Subtract(startTime); this.ReplaceSpecialIdentifier(StartSpecialIdentifierHeader + "datetime", startTime.ToString("g")); this.ReplaceSpecialIdentifier(StartSpecialIdentifierHeader + "date", startTime.ToString("d")); this.ReplaceSpecialIdentifier(StartSpecialIdentifierHeader + "time", startTime.ToString("t")); this.ReplaceSpecialIdentifier(UptimeSpecialIdentifierHeader + "total", (int)duration.TotalHours + duration.ToString("\\:mm")); this.ReplaceSpecialIdentifier(UptimeSpecialIdentifierHeader + "hours", ((int)duration.TotalHours).ToString()); this.ReplaceSpecialIdentifier(UptimeSpecialIdentifierHeader + "minutes", duration.ToString("mm")); this.ReplaceSpecialIdentifier(UptimeSpecialIdentifierHeader + "seconds", duration.ToString("ss")); } } if (this.ContainsSpecialIdentifier(QuoteSpecialIdentifierHeader) && ChannelSession.Settings.QuotesEnabled && ChannelSession.Settings.UserQuotes.Count > 0) { UserQuoteViewModel quote = ChannelSession.Settings.UserQuotes.PickRandom(); if (quote != null) { this.ReplaceSpecialIdentifier(QuoteSpecialIdentifierHeader + "random", quote.ToString()); } if (this.ContainsRegexSpecialIdentifier(QuoteNumberRegexSpecialIdentifier)) { await this.ReplaceNumberBasedRegexSpecialIdentifier(QuoteNumberRegexSpecialIdentifier, (index) => { if (index > 0 && index <= ChannelSession.Settings.UserQuotes.Count) { index--; return(Task.FromResult(ChannelSession.Settings.UserQuotes[index].ToString())); } return(Task.FromResult <string>(null)); }); } } if (this.ContainsSpecialIdentifier(CostreamUsersSpecialIdentifier)) { this.ReplaceSpecialIdentifier(CostreamUsersSpecialIdentifier, await CostreamChatCommand.GetCostreamUsers()); } if (ChannelSession.Services.Twitter != null && this.ContainsSpecialIdentifier("tweet")) { IEnumerable <Tweet> tweets = await ChannelSession.Services.Twitter.GetLatestTweets(); if (tweets != null && tweets.Count() > 0) { Tweet latestTweet = tweets.FirstOrDefault(); DateTimeOffset latestTweetLocalTime = latestTweet.DateTime.ToLocalTime(); this.ReplaceSpecialIdentifier("tweetlatesturl", latestTweet.TweetLink); this.ReplaceSpecialIdentifier("tweetlatesttext", latestTweet.Text); this.ReplaceSpecialIdentifier("tweetlatestdatetime", latestTweetLocalTime.ToString("g")); this.ReplaceSpecialIdentifier("tweetlatestdate", latestTweetLocalTime.ToString("d")); this.ReplaceSpecialIdentifier("tweetlatesttime", latestTweetLocalTime.ToString("t")); Tweet streamTweet = tweets.FirstOrDefault(t => t.IsStreamTweet); if (streamTweet != null) { DateTimeOffset streamTweetLocalTime = streamTweet.DateTime.ToLocalTime(); this.ReplaceSpecialIdentifier("tweetstreamurl", streamTweet.TweetLink); this.ReplaceSpecialIdentifier("tweetstreamtext", streamTweet.Text); this.ReplaceSpecialIdentifier("tweetstreamdatetime", streamTweetLocalTime.ToString("g")); this.ReplaceSpecialIdentifier("tweetstreamdate", streamTweetLocalTime.ToString("d")); this.ReplaceSpecialIdentifier("tweetstreamtime", streamTweetLocalTime.ToString("t")); } } } if (ChannelSession.Services.Spotify != null && this.ContainsSpecialIdentifier("spotify")) { SpotifyUserProfile profile = await ChannelSession.Services.Spotify.GetCurrentProfile(); if (profile != null) { this.ReplaceSpecialIdentifier("spotifyprofileurl", profile.Link); } SpotifyCurrentlyPlaying currentlyPlaying = await ChannelSession.Services.Spotify.GetCurrentlyPlaying(); if (currentlyPlaying != null) { this.ReplaceSpecialIdentifier("spotifycurrentlyplaying", currentlyPlaying.ToString()); } } if (ChannelSession.Services.ExtraLife.IsConnected() && this.ContainsSpecialIdentifier(ExtraLifeSpecialIdentifierHeader)) { ExtraLifeTeam team = await ChannelSession.Services.ExtraLife.GetTeam(); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "teamdonationgoal", team.fundraisingGoal.ToString()); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "teamdonationcount", team.numDonations.ToString()); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "teamdonationamount", team.sumDonations.ToString()); ExtraLifeTeamParticipant participant = await ChannelSession.Services.ExtraLife.GetParticipant(); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "userdonationgoal", participant.fundraisingGoal.ToString()); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "userdonationcount", participant.numDonations.ToString()); this.ReplaceSpecialIdentifier(ExtraLifeSpecialIdentifierHeader + "userdonationamount", participant.sumDonations.ToString()); } if (this.ContainsSpecialIdentifier(FeaturedChannelsSpecialIdentifer)) { IEnumerable <ExpandedChannelModel> featuredChannels = await ChannelSession.Connection.GetFeaturedChannels(); if (featuredChannels != null) { this.ReplaceSpecialIdentifier(FeaturedChannelsSpecialIdentifer, string.Join(", ", featuredChannels.Select(c => "@" + c.user.username))); } } if (this.ContainsSpecialIdentifier(StreamSpecialIdentifierHeader)) { ChannelDetailsModel details = await ChannelSession.Connection.GetChannelDetails(ChannelSession.Channel); if (details != null) { this.ReplaceSpecialIdentifier(StreamSpecialIdentifierHeader + "title", details.name); this.ReplaceSpecialIdentifier(StreamSpecialIdentifierHeader + "agerating", details.audience); this.ReplaceSpecialIdentifier(StreamSpecialIdentifierHeader + "viewercount", details.viewersCurrent.ToString()); this.ReplaceSpecialIdentifier(StreamSpecialIdentifierHeader + "followcount", details.numFollowers.ToString()); this.ReplaceSpecialIdentifier(StreamSpecialIdentifierHeader + "subcount", details.numSubscribers.ToString()); } if (this.ContainsSpecialIdentifier(StreamHostCountSpecialIdentifier)) { IEnumerable <ChannelAdvancedModel> hosters = await ChannelSession.Connection.GetHosters(ChannelSession.Channel); if (hosters != null) { this.ReplaceSpecialIdentifier(StreamHostCountSpecialIdentifier, hosters.Count().ToString()); } else { this.ReplaceSpecialIdentifier(StreamHostCountSpecialIdentifier, "0"); } } } if (this.ContainsSpecialIdentifier(MilestoneSpecialIdentifierHeader)) { PatronageStatusModel patronageStatus = await ChannelSession.Connection.GetPatronageStatus(ChannelSession.Channel); if (patronageStatus != null) { PatronagePeriodModel patronagePeriod = await ChannelSession.Connection.GetPatronagePeriod(patronageStatus); if (patronagePeriod != null) { IEnumerable <PatronageMilestoneModel> patronageMilestones = patronagePeriod.milestoneGroups.SelectMany(mg => mg.milestones); PatronageMilestoneModel patronageMilestone = patronageMilestones.FirstOrDefault(m => m.id == patronageStatus.currentMilestoneId); if (patronageMilestone != null) { this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "amount", patronageMilestone.target.ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "remainingamount", (patronageMilestone.target - patronageStatus.patronageEarned).ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "reward", patronageMilestone.DollarAmountText()); } PatronageMilestoneModel patronageNextMilestone = patronageMilestones.FirstOrDefault(m => m.id == (patronageStatus.currentMilestoneId + 1)); if (patronageNextMilestone != null) { this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "nextamount", patronageNextMilestone.target.ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "remainingnextamount", (patronageNextMilestone.target - patronageStatus.patronageEarned).ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "nextreward", patronageNextMilestone.DollarAmountText()); } PatronageMilestoneModel patronageFinalMilestone = patronageMilestones.OrderByDescending(m => m.id).FirstOrDefault(); if (patronageNextMilestone != null) { this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "finalamount", patronageFinalMilestone.target.ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "remainingfinalamount", (patronageFinalMilestone.target - patronageStatus.patronageEarned).ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "finalreward", patronageFinalMilestone.DollarAmountText()); } PatronageMilestoneModel patronageMilestoneHighestEarned = null; IEnumerable <PatronageMilestoneModel> patronageMilestonesEarned = patronageMilestones.Where(m => m.target <= patronageStatus.patronageEarned); if (patronageMilestonesEarned != null && patronageMilestonesEarned.Count() > 0) { patronageMilestoneHighestEarned = patronageMilestonesEarned.OrderByDescending(m => m.reward).FirstOrDefault(); } if (patronageMilestoneHighestEarned != null) { this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "earnedamount", patronageStatus.patronageEarned.ToString()); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "earnedreward", patronageMilestoneHighestEarned.DollarAmountText()); } else { this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "earnedamount", "0"); this.ReplaceSpecialIdentifier(MilestoneSpecialIdentifierHeader + "earnedreward", "0"); } } } } if (this.ContainsSpecialIdentifier(UserSpecialIdentifierHeader)) { await this.HandleUserSpecialIdentifiers(user, string.Empty); } if (arguments != null) { for (int i = 0; i < arguments.Count(); i++) { string currentArgumentSpecialIdentifierHeader = ArgSpecialIdentifierHeader + (i + 1); if (this.ContainsSpecialIdentifier(currentArgumentSpecialIdentifierHeader)) { UserViewModel argUser = await this.GetUserFromArgument(arguments.ElementAt(i)); if (argUser != null) { await this.HandleUserSpecialIdentifiers(argUser, currentArgumentSpecialIdentifierHeader); } this.ReplaceSpecialIdentifier(currentArgumentSpecialIdentifierHeader + "text", arguments.ElementAt(i)); } } this.ReplaceSpecialIdentifier("allargs", string.Join(" ", arguments)); this.ReplaceSpecialIdentifier("argcount", arguments.Count().ToString()); } if (this.ContainsSpecialIdentifier(TargetSpecialIdentifierHeader)) { UserViewModel targetUser = null; if (arguments != null && arguments.Count() > 0) { targetUser = await this.GetUserFromArgument(arguments.ElementAt(0)); } if (targetUser == null) { targetUser = user; } await this.HandleUserSpecialIdentifiers(targetUser, TargetSpecialIdentifierHeader); } if (this.ContainsSpecialIdentifier(StreamerSpecialIdentifierHeader)) { await this.HandleUserSpecialIdentifiers(new UserViewModel(ChannelSession.Channel.user), StreamerSpecialIdentifierHeader); } if (this.ContainsSpecialIdentifier(StreamBossSpecialIdentifierHeader)) { OverlayWidget streamBossWidget = ChannelSession.Settings.OverlayWidgets.FirstOrDefault(w => w.Item is OverlayStreamBoss); if (streamBossWidget != null) { OverlayStreamBoss streamBossOverlay = (OverlayStreamBoss)streamBossWidget.Item; if (streamBossOverlay != null && streamBossOverlay.CurrentBoss != null) { await this.HandleUserSpecialIdentifiers(streamBossOverlay.CurrentBoss, StreamBossSpecialIdentifierHeader); } } } if (this.ContainsSpecialIdentifier(RandomSpecialIdentifierHeader)) { if (this.randomUserSpecialIdentifierGroupID != Guid.Empty && RandomUserSpecialIdentifierGroups.ContainsKey(this.randomUserSpecialIdentifierGroupID)) { if (RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomUser != null && this.ContainsSpecialIdentifier(SpecialIdentifierStringBuilder.RandomSpecialIdentifierHeader + "user")) { await this.HandleUserSpecialIdentifiers(RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomUser, RandomSpecialIdentifierHeader); } if (RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomFollower != null && this.ContainsSpecialIdentifier(SpecialIdentifierStringBuilder.RandomFollowerSpecialIdentifierHeader + "user")) { await this.HandleUserSpecialIdentifiers(RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomFollower, RandomFollowerSpecialIdentifierHeader); } if (RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomSubscriber != null && this.ContainsSpecialIdentifier(SpecialIdentifierStringBuilder.RandomSubscriberSpecialIdentifierHeader + "user")) { await this.HandleUserSpecialIdentifiers(RandomUserSpecialIdentifierGroups[randomUserSpecialIdentifierGroupID].RandomSubscriber, RandomSubscriberSpecialIdentifierHeader); } } if (this.ContainsRegexSpecialIdentifier(RandomNumberRegexSpecialIdentifier)) { await this.ReplaceNumberBasedRegexSpecialIdentifier(RandomNumberRegexSpecialIdentifier, (maxNumber) => { int number = RandomHelper.GenerateRandomNumber(maxNumber) + 1; return(Task.FromResult(number.ToString())); }); } } if (this.ContainsRegexSpecialIdentifier(UnicodeRegexSpecialIdentifier)) { await this.ReplaceNumberBasedRegexSpecialIdentifier(UnicodeRegexSpecialIdentifier, (number) => { char uChar = (char)number; return(Task.FromResult(uChar.ToString())); }); } }
private static IEnumerable <CommandBase> GetAllCommands(IChannelSettings settings) { List <CommandBase> commands = new List <CommandBase>(); commands.AddRange(settings.ChatCommands); commands.AddRange(settings.EventCommands); commands.AddRange(settings.InteractiveCommands); commands.AddRange(settings.TimerCommands); commands.AddRange(settings.ActionGroupCommands); commands.AddRange(settings.GameCommands); foreach (UserDataViewModel userData in settings.UserData.Values) { commands.AddRange(userData.CustomCommands); if (userData.EntranceCommand != null) { commands.Add(userData.EntranceCommand); } } foreach (GameCommandBase gameCommand in settings.GameCommands) { commands.AddRange(gameCommand.GetAllInnerCommands()); } foreach (UserCurrencyViewModel currency in settings.Currencies.Values) { if (currency.RankChangedCommand != null) { commands.Add(currency.RankChangedCommand); } } foreach (UserInventoryViewModel inventory in settings.Inventories.Values) { commands.Add(inventory.ItemsBoughtCommand); commands.Add(inventory.ItemsSoldCommand); } #pragma warning disable CS0612 // Type or member is obsolete foreach (OverlayWidget widget in settings.overlayWidgetsInternal) { if (widget.Item is OverlayStreamBoss) { OverlayStreamBoss item = ((OverlayStreamBoss)widget.Item); if (item.NewStreamBossCommand != null) { commands.Add(item.NewStreamBossCommand); } } else if (widget.Item is OverlayProgressBar) { OverlayProgressBar item = ((OverlayProgressBar)widget.Item); if (item.GoalReachedCommand != null) { commands.Add(item.GoalReachedCommand); } } else if (widget.Item is OverlayTimer) { OverlayTimer item = ((OverlayTimer)widget.Item); if (item.TimerCompleteCommand != null) { commands.Add(item.TimerCompleteCommand); } } } #pragma warning restore CS0612 // Type or member is obsolete foreach (OverlayWidgetModel widget in settings.OverlayWidgets) { if (widget.Item is OverlayStreamBossItemModel) { OverlayStreamBossItemModel item = ((OverlayStreamBossItemModel)widget.Item); if (item.NewStreamBossCommand != null) { commands.Add(item.NewStreamBossCommand); } } else if (widget.Item is OverlayProgressBarItemModel) { OverlayProgressBarItemModel item = ((OverlayProgressBarItemModel)widget.Item); if (item.GoalReachedCommand != null) { commands.Add(item.GoalReachedCommand); } } else if (widget.Item is OverlayTimerItemModel) { OverlayTimerItemModel item = ((OverlayTimerItemModel)widget.Item); if (item.TimerCompleteCommand != null) { commands.Add(item.TimerCompleteCommand); } } } commands.Add(settings.GameQueueUserJoinedCommand); commands.Add(settings.GameQueueUserSelectedCommand); commands.Add(settings.GiveawayStartedReminderCommand); commands.Add(settings.GiveawayUserJoinedCommand); commands.Add(settings.GiveawayWinnerSelectedCommand); commands.Add(settings.ModerationStrike1Command); commands.Add(settings.ModerationStrike2Command); commands.Add(settings.ModerationStrike3Command); commands.Add(settings.SongAddedCommand); commands.Add(settings.SongRemovedCommand); commands.Add(settings.SongPlayedCommand); return(commands.Where(c => c != null)); }
#pragma warning disable CS0612 // Type or member is obsolete public static OverlayItemModelBase ConvertOverlayItem(OverlayItemBase item) { if (item is OverlayTextItem) { OverlayTextItem oItem = (OverlayTextItem)item; return(new OverlayTextItemModel(oItem.Text, oItem.Color, oItem.Size, oItem.Font, oItem.Bold, oItem.Italic, oItem.Underline, oItem.ShadowColor)); } else if (item is OverlayImageItem) { OverlayImageItem oItem = (OverlayImageItem)item; return(new OverlayImageItemModel(oItem.FilePath, oItem.Width, oItem.Height)); } else if (item is OverlayVideoItem) { OverlayVideoItem oItem = (OverlayVideoItem)item; return(new OverlayVideoItemModel(oItem.FilePath, oItem.Width, oItem.Height, oItem.Volume)); } else if (item is OverlayYouTubeItem) { OverlayYouTubeItem oItem = (OverlayYouTubeItem)item; return(new OverlayYouTubeItemModel(oItem.VideoID, oItem.Width, oItem.Height, oItem.StartTime, oItem.Volume)); } else if (item is OverlayWebPageItem) { OverlayWebPageItem oItem = (OverlayWebPageItem)item; return(new OverlayWebPageItemModel(oItem.URL, oItem.Width, oItem.Height)); } else if (item is OverlayHTMLItem) { OverlayHTMLItem oItem = (OverlayHTMLItem)item; return(new OverlayHTMLItemModel(oItem.HTMLText)); } else if (item is OverlayChatMessages) { OverlayChatMessages oItem = (OverlayChatMessages)item; return(new OverlayChatMessagesListItemModel(oItem.HTMLText, oItem.TotalToShow, 0, oItem.TextFont, oItem.Width, oItem.TextSize, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, OverlayItemEffectExitAnimationTypeEnum.None)); } else if (item is OverlayEventList) { OverlayEventList oItem = (OverlayEventList)item; List <OverlayEventListItemTypeEnum> types = new List <OverlayEventListItemTypeEnum>(); foreach (EventListItemTypeEnum type in oItem.ItemTypes) { types.Add((OverlayEventListItemTypeEnum)type); } return(new OverlayEventListItemModel(oItem.HTMLText, types, oItem.TotalToShow, 0, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation)); } else if (item is OverlayGameQueue) { OverlayGameQueue oItem = (OverlayGameQueue)item; return(new OverlayGameQueueListItemModel(oItem.HTMLText, oItem.TotalToShow, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation)); } else if (item is OverlayLeaderboard) { OverlayLeaderboard oItem = (OverlayLeaderboard)item; OverlayLeaderboardListItemModel result = new OverlayLeaderboardListItemModel(oItem.HTMLText, (OverlayLeaderboardListItemTypeEnum)oItem.LeaderboardType, oItem.TotalToShow, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation, null); result.CurrencyID = oItem.CurrencyID; result.LeaderboardDateRange = (OverlayLeaderboardListItemDateRangeEnum)oItem.DateRange; return(result); } else if (item is OverlayProgressBar) { OverlayProgressBar oItem = (OverlayProgressBar)item; OverlayProgressBarItemModel result = new OverlayProgressBarItemModel(oItem.HTMLText, (OverlayProgressBarItemTypeEnum)oItem.ProgressBarType, oItem.ResetAfterDays, oItem.ProgressColor, oItem.BackgroundColor, oItem.TextColor, oItem.TextFont, oItem.Width, oItem.Height, oItem.GoalReachedCommand); result.StartAmount = result.CurrentAmount = oItem.CurrentAmountNumber; result.GoalAmount = oItem.GoalAmountNumber; result.CurrentAmountCustom = oItem.CurrentAmountCustom; result.GoalAmountCustom = oItem.GoalAmountCustom; return(result); } else if (item is OverlaySongRequests) { OverlaySongRequests oItem = (OverlaySongRequests)item; return(new OverlaySongRequestsListItemModel(oItem.HTMLText, oItem.TotalToShow, oItem.TextFont, oItem.Width, oItem.Height, oItem.BorderColor, oItem.BackgroundColor, oItem.TextColor, true, OverlayListItemAlignmentTypeEnum.Top, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.AddEventAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.RemoveEventAnimation)); } else if (item is OverlayStreamBoss) { OverlayStreamBoss oItem = (OverlayStreamBoss)item; return(new OverlayStreamBossItemModel(oItem.HTMLText, oItem.StartingHealth, oItem.Width, oItem.Height, oItem.TextColor, oItem.TextFont, oItem.BorderColor, oItem.BackgroundColor, oItem.ProgressColor, oItem.FollowBonus, oItem.HostBonus, oItem.SubscriberBonus, oItem.DonationBonus, oItem.SparkBonus, oItem.EmberBonus, 1.0, 1.0, (OverlayItemEffectVisibleAnimationTypeEnum)oItem.DamageAnimation, (OverlayItemEffectVisibleAnimationTypeEnum)oItem.NewBossAnimation, oItem.NewStreamBossCommand)); } else if (item is OverlayMixerClip) { OverlayMixerClip oItem = (OverlayMixerClip)item; return(new OverlayStreamClipItemModel(oItem.Width, oItem.Height, oItem.Volume, (OverlayItemEffectEntranceAnimationTypeEnum)oItem.EntranceAnimation, (OverlayItemEffectExitAnimationTypeEnum)oItem.ExitAnimation)); } else if (item is OverlayTimer) { OverlayTimer oItem = (OverlayTimer)item; return(new OverlayTimerItemModel(oItem.HTMLText, oItem.TotalLength, oItem.TextColor, oItem.TextFont, oItem.TextSize, oItem.TimerCompleteCommand)); } else if (item is OverlayTimerTrain) { OverlayTimerTrain oItem = (OverlayTimerTrain)item; return(new OverlayTimerTrainItemModel(oItem.HTMLText, oItem.MinimumSecondsToShow, oItem.TextColor, oItem.TextFont, oItem.TextSize, oItem.FollowBonus, oItem.HostBonus, oItem.SubscriberBonus, oItem.DonationBonus, oItem.SparkBonus, oItem.EmberBonus)); } return(null); }