private async Task BackgroundDonationCheck() { Dictionary <int, StreamlabsDonation> donationsReceived = new Dictionary <int, StreamlabsDonation>(); foreach (StreamlabsDonation donation in await this.GetDonations()) { donationsReceived[donation.ID] = donation; } while (!this.cancellationTokenSource.Token.IsCancellationRequested) { try { foreach (StreamlabsDonation slDonation in await this.GetDonations()) { if (!donationsReceived.ContainsKey(slDonation.ID)) { donationsReceived[slDonation.ID] = slDonation; UserDonationModel donation = slDonation.ToGenericDonation(); await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.StreamlabsDonation); } } } catch (Exception ex) { MixItUp.Base.Util.Logger.Log(ex); } await Task.Delay(10000); } }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { UserViewModel user = donation.User; if (!this.userDonations.ContainsKey(user)) { this.userDonations[user] = donation.Copy(); this.userDonations[user].Amount = 0.0; } this.userDonations[user].Amount += donation.Amount; List <OverlayListIndividualItemModel> items = new List <OverlayListIndividualItemModel>(); var orderedUsers = this.userDonations.OrderByDescending(kvp => kvp.Value.Amount); for (int i = 0; i < this.TotalToShow && i < orderedUsers.Count(); i++) { var kvp = orderedUsers.ElementAt(i); OverlayListIndividualItemModel item = OverlayListIndividualItemModel.CreateAddItem(kvp.Key.UserName, kvp.Key, i + 1, this.HTML); item.Hash = kvp.Value.AmountText; } await this.AddLeaderboardItems(items); this.SendUpdateRequired(); }
public static void DonationOccurred(UserDonationModel donation) { if (GlobalEvents.OnDonationOccurred != null) { GlobalEvents.OnDonationOccurred(null, donation); } }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { UserViewModel user = donation.User; if (!this.userDonations.ContainsKey(user.ID)) { this.userDonations[user.ID] = donation.Copy(); this.userDonations[user.ID].Amount = 0.0; } this.userDonations[user.ID].Amount += donation.Amount; List <OverlayLeaderboardItem> items = new List <OverlayLeaderboardItem>(); var orderedUsers = this.userDonations.OrderByDescending(kvp => kvp.Value.Amount); for (int i = 0; i < orderedUsers.Count() && items.Count() < this.TotalToShow; i++) { var kvp = orderedUsers.ElementAt(i); UserDataModel userData = ChannelSession.Settings.GetUserData(kvp.Key); if (userData != null) { items.Add(new OverlayLeaderboardItem(new UserViewModel(userData), kvp.Value.AmountText)); } } await this.ProcessLeaderboardItems(items); this.SendUpdateRequired(); }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { if (this.MinimumAmountRequiredToShow == 0.0 || donation.Amount >= this.MinimumAmountRequiredToShow) { await this.AddEvent(donation.UserName + ": " + donation.AmountText); } }
public static async Task ProcessDonationEvent(EventTypeEnum type, UserDonationModel donation, Dictionary <string, string> additionalSpecialIdentifiers = null) { EventTrigger trigger = new EventTrigger(type, donation.User); trigger.User.Data.TotalAmountDonated += donation.Amount; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationUserData] = trigger.User.ID; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationAmountData] = donation.AmountText; trigger.SpecialIdentifiers = donation.GetSpecialIdentifiers(); if (additionalSpecialIdentifiers != null) { foreach (var kvp in additionalSpecialIdentifiers) { trigger.SpecialIdentifiers[kvp.Key] = kvp.Value; } } await ChannelSession.Services.Events.PerformEvent(trigger); foreach (StreamPassModel streamPass in ChannelSession.Settings.StreamPass.Values) { streamPass.AddAmount(donation.User.Data, (int)Math.Ceiling(streamPass.DonationBonus * donation.Amount)); } try { GlobalEvents.DonationOccurred(donation); } catch (Exception ex) { Logger.Log(ex); } }
public static async Task ProcessDonationEventCommand(UserDonationModel donation, OtherEventTypeEnum eventType, Dictionary <string, string> additionalSpecialIdentifiers = null) { GlobalEvents.DonationOccurred(donation); UserViewModel user = new UserViewModel(0, donation.UserName); UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName); if (userModel != null) { user = new UserViewModel(userModel); } EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(eventType)); if (command != null) { Dictionary <string, string> specialIdentifiers = donation.GetSpecialIdentifiers(); if (additionalSpecialIdentifiers != null) { foreach (var kvp in additionalSpecialIdentifiers) { specialIdentifiers[kvp.Key] = kvp.Value; } } await command.Perform(user, arguments : null, extraSpecialIdentifiers : specialIdentifiers); } }
protected override async Task ProcessReceivedPacket(string packetJSON) { if (!string.IsNullOrEmpty(packetJSON)) { GawkBoxAlert alert = JsonConvert.DeserializeObject <GawkBoxAlert>(packetJSON); if (alert != null && alert.Gifts.Count > 0) { UserDonationModel donation = alert.ToGenericDonation(); GlobalEvents.DonationOccurred(donation); UserViewModel user = new UserViewModel(0, donation.UserName); UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName); if (userModel != null) { user = new UserViewModel(userModel); } EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.GawkBoxDonation)); if (command != null) { command.AddSpecialIdentifier("donationsource", EnumHelper.GetEnumName(donation.Source)); command.AddSpecialIdentifier("donationamount", donation.AmountText); command.AddSpecialIdentifier("donationmessage", donation.Message); command.AddSpecialIdentifier("donationimage", donation.ImageLink); await command.Perform(user); } } } }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel e) { if (this.giveawayEnabled && this.selectedWinner == null) { if ((ChannelSession.Settings.GiveawayGawkBoxTrigger && e.Source == UserDonationSourceEnum.GawkBox) || (ChannelSession.Settings.GiveawayStreamlabsTrigger && e.Source == UserDonationSourceEnum.Streamlabs) || (ChannelSession.Settings.GiveawayTiltifyTrigger && e.Source == UserDonationSourceEnum.Tiltify)) { UserModel userModel = await ChannelSession.Connection.GetUser(e.UserName); if (userModel != null) { UserViewModel user = new UserViewModel(userModel); if (!this.enteredUsersDictionary.ContainsKey(user.ID)) { this.enteredUsersDictionary[user.ID] = new GiveawayUser() { User = user, Entries = 0 }; } this.enteredUsersDictionary[user.ID].DonationAmount += e.Amount; int newEntryAmount = 0; if (ChannelSession.Settings.GiveawayDonationAmount > 0.0) { if (ChannelSession.Settings.GiveawayDonationRequiredAmount && this.enteredUsersDictionary[user.ID].DonationAmount >= ChannelSession.Settings.GiveawayDonationAmount) { newEntryAmount = 1; } else { newEntryAmount = (int)(this.enteredUsersDictionary[user.ID].DonationAmount / ChannelSession.Settings.GiveawayDonationAmount); } } else { newEntryAmount = 1; } if (newEntryAmount > this.enteredUsersDictionary[user.ID].Entries) { await ChannelSession.Chat.Whisper(user.UserName, "You've gotten an entry into the giveaway, stay tuned to see who wins!"); } this.enteredUsersDictionary[user.ID].Entries = newEntryAmount; await this.Dispatcher.BeginInvoke(new Action(() => { this.enteredUsers.Clear(); foreach (GiveawayUser gUser in this.enteredUsersDictionary.Values) { this.enteredUsers.Add(gUser); } })); } } } }
private void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { if (!this.donations.ContainsKey(donation.User.ID)) { this.donations[donation.User.ID] = 0; this.AddUserForRole(donation.User); } this.donations[donation.User.ID] += donation.Amount; }
private void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { if (!this.userDonations.ContainsKey(donation.UserName)) { this.userDonations[donation.UserName] = donation.Copy(); this.userDonations[donation.UserName].Amount = 0.0; } this.userDonations[donation.UserName].Amount += donation.Amount; this.refreshDonations = true; }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel e) { if (this.timeLeft > 0 && this.selectedWinner == null) { if ((ChannelSession.Settings.GiveawayGawkBoxTrigger && e.Source == UserDonationSourceEnum.GawkBox) || (ChannelSession.Settings.GiveawayStreamlabsTrigger && e.Source == UserDonationSourceEnum.Streamlabs) || (ChannelSession.Settings.GiveawayTiltifyTrigger && e.Source == UserDonationSourceEnum.Tiltify)) { UserModel userModel = await ChannelSession.Connection.GetUser(e.UserName); if (userModel != null) { UserViewModel user = new UserViewModel(userModel); if (!this.enteredUsers.ContainsKey(user.ID)) { this.enteredUsers[user.ID] = new GiveawayUser() { User = user, Entries = 0 }; } GiveawayUser giveawayUser = this.enteredUsers[user.ID]; giveawayUser.DonationAmount += e.Amount; int newEntryAmount = 0; if (ChannelSession.Settings.GiveawayDonationAmount > 0.0) { if (ChannelSession.Settings.GiveawayDonationRequiredAmount && giveawayUser.DonationAmount >= ChannelSession.Settings.GiveawayDonationAmount) { newEntryAmount = 1; } else { newEntryAmount = (int)(giveawayUser.DonationAmount / ChannelSession.Settings.GiveawayDonationAmount); } } else { newEntryAmount = 1; } newEntryAmount = Math.Min(newEntryAmount, ChannelSession.Settings.GiveawayMaximumEntries); if (newEntryAmount > giveawayUser.Entries) { await ChannelSession.Chat.Whisper(user.UserName, "You've gotten an entry into the giveaway, stay tuned to see who wins!"); } giveawayUser.Entries = newEntryAmount; await this.RefreshUserList(); } } } }
public override async Task Connect() { await base.Connect(); this.SocketReceiveWrapper("connect", (data) => { this.Connected = true; }); this.SocketReceiveWrapper("new-event", (data) => { if (data != null) { TipeeeStreamResponse response = SerializerHelper.DeserializeFromString <TipeeeStreamResponse>(data.ToString()); if (response.Event.Type.Equals("donation")) { this.service.DonationOccurred(response.Event); Task.Run(async() => { UserDonationModel donation = response.Event.ToGenericDonation(); await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.TipeeeStreamDonation); }); } } }); this.SocketReceiveWrapper("error", (errorData) => { MixItUp.Base.Util.Logger.Log(errorData.ToString()); this.service.WebSocketDisconnectedOccurred(); }); this.SocketReceiveWrapper("disconnect", (errorData) => { MixItUp.Base.Util.Logger.Log(errorData.ToString()); this.service.WebSocketDisconnectedOccurred(); }); JObject joinRoomJObj = new JObject(); joinRoomJObj["room"] = this.apiKey; joinRoomJObj["username"] = this.username; this.SocketSendWrapper("join-room", joinRoomJObj); for (int i = 0; i < 10 && !this.Connected; i++) { await Task.Delay(1000); } if (this.Connected) { this.service.WebSocketConnectedOccurred(); } }
private async Task BackgroundDonationCheck(CancellationToken token) { foreach (StreamElementsDonation seDonation in await this.GetDonations()) { if (!donationsReceived.ContainsKey(seDonation._id)) { donationsReceived[seDonation._id] = seDonation; UserDonationModel donation = seDonation.ToGenericDonation(); await EventService.ProcessDonationEvent(EventTypeEnum.StreamElementsDonation, donation); } } }
protected override async Task ProcessReceivedPacket(string packetJSON) { if (!string.IsNullOrEmpty(packetJSON)) { GawkBoxAlert alert = JsonConvert.DeserializeObject <GawkBoxAlert>(packetJSON); if (alert != null && alert.Gifts.Count > 0) { UserDonationModel donation = alert.ToGenericDonation(); await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.GawkBoxDonation); } } }
private async Task BackgroundDonationCheck() { Dictionary <string, ExtraLifeDonation> donationsReceived = new Dictionary <string, ExtraLifeDonation>(); IEnumerable <ExtraLifeDonation> donations = (this.includeTeamDonations) ? await this.GetTeamDonations() : await this.GetParticipantDonations(); foreach (ExtraLifeDonation donation in donations) { if (!string.IsNullOrEmpty(donation.donorID)) { donationsReceived[donation.donorID] = donation; } } while (!this.cancellationTokenSource.Token.IsCancellationRequested) { try { donations = (this.includeTeamDonations) ? await this.GetTeamDonations() : await this.GetParticipantDonations(); foreach (ExtraLifeDonation elDonation in donations) { if (!string.IsNullOrEmpty(elDonation.donorID) && !donationsReceived.ContainsKey(elDonation.donorID)) { donationsReceived[elDonation.donorID] = elDonation; UserDonationModel donation = elDonation.ToGenericDonation(); GlobalEvents.DonationOccurred(donation); UserViewModel user = new UserViewModel(0, donation.UserName); UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName); if (userModel != null) { user = new UserViewModel(userModel); } EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.ExtraLifeDonation)); if (command != null) { await command.Perform(user, arguments : null, extraSpecialIdentifiers : donation.GetSpecialIdentifiers()); } } } } catch (Exception ex) { MixItUp.Base.Util.Logger.Log(ex); } await Task.Delay(20000); } }
private async Task BackgroundDonationCheck(CancellationToken token) { IEnumerable <ExtraLifeDonation> donations = (ChannelSession.Settings.ExtraLifeIncludeTeamDonations) ? await this.GetTeamDonations() : await this.GetParticipantDonations(); foreach (ExtraLifeDonation elDonation in donations) { if (!string.IsNullOrEmpty(elDonation.donationID) && !donationsReceived.ContainsKey(elDonation.donationID) && elDonation.CreatedDate > this.startTime) { donationsReceived[elDonation.donationID] = elDonation; UserDonationModel donation = elDonation.ToGenericDonation(); await EventService.ProcessDonationEvent(EventTypeEnum.ExtraLifeDonation, donation); } } }
public override async Task Connect() { await base.Connect(); this.SocketReceiveWrapper("connect", (data) => { this.Connected = true; }); this.SocketReceiveWrapper("realTimeTreat", (data) => { if (data != null) { TreatStreamEvent tsEvent = SerializerHelper.DeserializeFromString <TreatStreamEvent>(data.ToString()); if (tsEvent != null) { this.service.DonationOccurred(tsEvent); Task.Run(async() => { UserDonationModel donation = tsEvent.ToGenericDonation(); await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.TreatStreamDonation); }); } } }); this.SocketReceiveWrapper("error", (errorData) => { MixItUp.Base.Util.Logger.Log(errorData.ToString()); this.service.WebSocketDisconnectedOccurred(); }); this.SocketReceiveWrapper("disconnect", (errorData) => { MixItUp.Base.Util.Logger.Log(errorData.ToString()); this.service.WebSocketDisconnectedOccurred(); }); for (int i = 0; i < 10 && !this.Connected; i++) { await Task.Delay(1000); } if (this.Connected) { this.service.WebSocketConnectedOccurred(); } }
private async Task BackgroundDonationCheck() { Dictionary <int, StreamlabsDonation> donationsReceived = new Dictionary <int, StreamlabsDonation>(); foreach (StreamlabsDonation donation in await this.GetDonations()) { donationsReceived[donation.ID] = donation; } while (!this.cancellationTokenSource.Token.IsCancellationRequested) { try { foreach (StreamlabsDonation slDonation in await this.GetDonations()) { if (!donationsReceived.ContainsKey(slDonation.ID)) { donationsReceived[slDonation.ID] = slDonation; UserDonationModel donation = slDonation.ToGenericDonation(); GlobalEvents.DonationOccurred(donation); UserViewModel user = new UserViewModel(0, donation.UserName); UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName); if (userModel != null) { user = new UserViewModel(userModel); } EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.StreamlabsDonation)); if (command != null) { command.AddSpecialIdentifier("donationsource", EnumHelper.GetEnumName(donation.Source)); command.AddSpecialIdentifier("donationamount", donation.AmountText); command.AddSpecialIdentifier("donationmessage", donation.Message); command.AddSpecialIdentifier("donationimage", donation.ImageLink); await command.Perform(user); } } } } catch (Exception ex) { MixItUp.Base.Util.Logger.Log(ex); } await Task.Delay(10000); } }
private async Task BackgroundDonationCheck() { int currentCampaign = 0; TiltifyCampaign campaign = null; Dictionary <int, TiltifyDonation> donationsReceived = new Dictionary <int, TiltifyDonation>(); while (!this.cancellationTokenSource.Token.IsCancellationRequested) { try { if (ChannelSession.Settings.TiltifyCampaign != currentCampaign) { currentCampaign = ChannelSession.Settings.TiltifyCampaign; donationsReceived.Clear(); IEnumerable <TiltifyCampaign> campaigns = await this.GetCampaigns(this.user); campaign = campaigns.FirstOrDefault(c => c.ID.Equals(currentCampaign)); if (campaign != null) { foreach (TiltifyDonation donation in await this.GetCampaignDonations(campaign)) { donationsReceived[donation.ID] = donation; } } } if (campaign != null) { foreach (TiltifyDonation tDonation in await this.GetCampaignDonations(campaign)) { if (!donationsReceived.ContainsKey(tDonation.ID)) { donationsReceived[tDonation.ID] = tDonation; UserDonationModel donation = tDonation.ToGenericDonation(); await EventCommand.ProcessDonationEventCommand(donation, OtherEventTypeEnum.TiltifyDonation); } } } } catch (Exception ex) { MixItUp.Base.Util.Logger.Log(ex); } await Task.Delay(10000); } }
private async Task BackgroundDonationCheck(CancellationToken token) { if (!token.IsCancellationRequested) { if (this.fundraiser != null) { foreach (JustGivingDonation jgDonation in await this.GetRecentDonations(this.fundraiser)) { if (!donationsReceived.ContainsKey(jgDonation.id)) { donationsReceived[jgDonation.id] = jgDonation; UserDonationModel donation = jgDonation.ToGenericDonation(); if (donation.DateTime > this.startTime) { await EventService.ProcessDonationEvent(EventTypeEnum.JustGivingDonation, donation); } } } } } }
public static async Task ProcessDonationEvent(EventTypeEnum type, UserDonationModel donation, List <string> arguments = null, Dictionary <string, string> additionalSpecialIdentifiers = null) { CommandParametersModel parameters = new CommandParametersModel(donation.User, donation.Platform, arguments, donation.GetSpecialIdentifiers()); if (additionalSpecialIdentifiers != null) { foreach (var kvp in additionalSpecialIdentifiers) { parameters.SpecialIdentifiers[kvp.Key] = kvp.Value; } } foreach (StreamPassModel streamPass in ChannelSession.Settings.StreamPass.Values) { if (parameters.User.HasPermissionsTo(streamPass.Permission)) { streamPass.AddAmount(donation.User.Data, (int)Math.Ceiling(streamPass.DonationBonus * donation.Amount)); } } parameters.User.Data.TotalAmountDonated += donation.Amount; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationUserData] = parameters.User.ID; ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationAmountData] = donation.AmountText; await ChannelSession.Services.Alerts.AddAlert(new AlertChatMessageViewModel(StreamingPlatformTypeEnum.All, parameters.User, string.Format("{0} Donated {1}", parameters.User.FullDisplayName, donation.AmountText), ChannelSession.Settings.AlertDonationColor)); await ChannelSession.Services.Events.PerformEvent(type, parameters); try { GlobalEvents.DonationOccurred(donation); } catch (Exception ex) { Logger.Log(ex); } }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { await this.ReduceHealth(donation.User, (donation.Amount * this.DonationBonus)); }
private void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { this.CurrentAmountNumber += donation.Amount; }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { await this.AddSeconds(donation.Amount *this.DonationBonus); }
private async Task BackgroundDonationCheck() { int currentCampaign = 0; TiltifyCampaign campaign = null; Dictionary <int, TiltifyDonation> donationsReceived = new Dictionary <int, TiltifyDonation>(); while (!this.cancellationTokenSource.Token.IsCancellationRequested) { try { if (ChannelSession.Settings.TiltifyCampaign != currentCampaign) { currentCampaign = ChannelSession.Settings.TiltifyCampaign; donationsReceived.Clear(); IEnumerable <TiltifyCampaign> campaigns = await this.GetCampaigns(this.user); campaign = campaigns.FirstOrDefault(c => c.ID.Equals(currentCampaign)); if (campaign != null) { foreach (TiltifyDonation donation in await this.GetCampaignDonations(campaign)) { donationsReceived[donation.ID] = donation; } } } if (campaign != null) { foreach (TiltifyDonation tDonation in await this.GetCampaignDonations(campaign)) { if (!donationsReceived.ContainsKey(tDonation.ID)) { donationsReceived[tDonation.ID] = tDonation; UserDonationModel donation = tDonation.ToGenericDonation(); GlobalEvents.DonationOccurred(donation); UserViewModel user = new UserViewModel(0, donation.UserName); UserModel userModel = await ChannelSession.Connection.GetUser(user.UserName); if (userModel != null) { user = new UserViewModel(userModel); } EventCommand command = ChannelSession.Constellation.FindMatchingEventCommand(EnumHelper.GetEnumName(OtherEventTypeEnum.TiltifyDonation)); if (command != null) { command.AddSpecialIdentifier("donationsource", EnumHelper.GetEnumName(donation.Source)); command.AddSpecialIdentifier("donationamount", donation.AmountText); command.AddSpecialIdentifier("donationmessage", donation.Message); command.AddSpecialIdentifier("donationimage", donation.ImageLink); await command.Perform(user); } } } } } catch (Exception ex) { MixItUp.Base.Util.Logger.Log(ex); } await Task.Delay(10000); } }
private async void PlayButton_Click(object sender, RoutedEventArgs e) { this.PlayButton.Visibility = Visibility.Collapsed; this.StopButton.Visibility = Visibility.Visible; this.EditButton.IsEnabled = false; this.DeleteButton.IsEnabled = false; this.EnableDisableToggleSwitch.IsEnabled = false; CommandBase command = this.GetCommandFromCommandButtons <CommandBase>(this); if (command != null) { UserViewModel currentUser = await ChannelSession.GetCurrentUser(); Dictionary <string, string> extraSpecialIdentifiers = new Dictionary <string, string>(); if (command is EventCommand) { EventCommand eventCommand = command as EventCommand; switch (eventCommand.EventType) { case Mixer.Base.Clients.ConstellationEventTypeEnum.channel__id__hosted: extraSpecialIdentifiers["hostviewercount"] = "123"; break; case Mixer.Base.Clients.ConstellationEventTypeEnum.channel__id__resubscribed: extraSpecialIdentifiers["usersubmonths"] = "5"; break; } switch (eventCommand.OtherEventType) { case OtherEventTypeEnum.GameWispSubscribed: case OtherEventTypeEnum.GameWispResubscribed: extraSpecialIdentifiers["subscribemonths"] = "999"; extraSpecialIdentifiers["subscribetier"] = "Test Tier"; extraSpecialIdentifiers["subscribeamount"] = "$12.34"; break; case OtherEventTypeEnum.StreamlabsDonation: case OtherEventTypeEnum.GawkBoxDonation: case OtherEventTypeEnum.TiltifyDonation: case OtherEventTypeEnum.ExtraLifeDonation: case OtherEventTypeEnum.TipeeeStreamDonation: case OtherEventTypeEnum.TreatStreamDonation: case OtherEventTypeEnum.StreamJarDonation: UserDonationModel donation = new UserDonationModel() { Amount = 12.34, Message = "Test donation message", ImageLink = currentUser.AvatarLink }; switch (eventCommand.OtherEventType) { case OtherEventTypeEnum.StreamlabsDonation: donation.Source = UserDonationSourceEnum.Streamlabs; break; case OtherEventTypeEnum.GawkBoxDonation: donation.Source = UserDonationSourceEnum.GawkBox; break; case OtherEventTypeEnum.TiltifyDonation: donation.Source = UserDonationSourceEnum.Tiltify; break; case OtherEventTypeEnum.ExtraLifeDonation: donation.Source = UserDonationSourceEnum.ExtraLife; break; case OtherEventTypeEnum.TipeeeStreamDonation: donation.Source = UserDonationSourceEnum.TipeeeStream; break; case OtherEventTypeEnum.TreatStreamDonation: donation.Source = UserDonationSourceEnum.TreatStream; break; case OtherEventTypeEnum.StreamJarDonation: donation.Source = UserDonationSourceEnum.StreamJar; break; } foreach (var kvp in donation.GetSpecialIdentifiers()) { extraSpecialIdentifiers[kvp.Key] = kvp.Value; } extraSpecialIdentifiers["donationtype"] = "Pizza"; break; case OtherEventTypeEnum.PatreonSubscribed: extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierNameSpecialIdentifier] = "Super Tier"; extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierAmountSpecialIdentifier] = "12.34"; extraSpecialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierImageSpecialIdentifier] = "https://xforgeassets002.xboxlive.com/xuid-2535473787585366-public/b7a1d715-3a9e-4bdd-a030-32f9e2e0f51e/0013_lots-o-stars_256.png"; break; case OtherEventTypeEnum.TwitterStreamTweetRetweet: break; case OtherEventTypeEnum.MixerSkillUsed: extraSpecialIdentifiers["skillname"] = "Lots of stars"; extraSpecialIdentifiers["skilltype"] = EnumHelper.GetEnumName(SkillTypeEnum.Sticker); extraSpecialIdentifiers["skillcosttype"] = "Embers"; extraSpecialIdentifiers["skillcost"] = "50"; extraSpecialIdentifiers["skillimage"] = "https://xforgeassets002.xboxlive.com/xuid-2535473787585366-public/b7a1d715-3a9e-4bdd-a030-32f9e2e0f51e/0013_lots-o-stars_256.png"; extraSpecialIdentifiers["skillissparks"] = false.ToString(); extraSpecialIdentifiers["skillisembers"] = true.ToString(); extraSpecialIdentifiers["skillmessage"] = "Hello World!"; break; case OtherEventTypeEnum.MixerMilestoneReached: extraSpecialIdentifiers["milestoneamount"] = "100"; extraSpecialIdentifiers["milestoneremainingamount"] = "100"; extraSpecialIdentifiers["milestonereward"] = "$10.00"; extraSpecialIdentifiers["milestonenextamount"] = "100"; extraSpecialIdentifiers["milestonenextremainingamount"] = "100"; extraSpecialIdentifiers["milestonenextreward"] = "$10.00"; extraSpecialIdentifiers["milestonefinalamount"] = "100"; extraSpecialIdentifiers["milestonefinalremainingamount"] = "100"; extraSpecialIdentifiers["milestonefinalreward"] = "$10.00"; extraSpecialIdentifiers["milestoneearnedamount"] = "100"; extraSpecialIdentifiers["milestoneearnedreward"] = "$10.00"; break; case OtherEventTypeEnum.MixerSparksUsed: extraSpecialIdentifiers["sparkamount"] = "10"; break; case OtherEventTypeEnum.MixerEmbersUsed: extraSpecialIdentifiers["emberamount"] = "10"; break; } } else if (command is InteractiveCommand) { InteractiveCommand iCommand = (InteractiveCommand)command; extraSpecialIdentifiers["mixplaycontrolid"] = iCommand.Name; extraSpecialIdentifiers["mixplaycontrolcost"] = "123"; } else if (command is CustomCommand) { if (command.Name.Equals(InventoryWindow.ItemsBoughtCommandName) || command.Name.Equals(InventoryWindow.ItemsSoldCommandName)) { extraSpecialIdentifiers["itemtotal"] = "5"; extraSpecialIdentifiers["itemname"] = "Chocolate Bars"; extraSpecialIdentifiers["itemcost"] = "500"; extraSpecialIdentifiers["currencyname"] = "CURRENCY_NAME"; } } await command.PerformAndWait(currentUser, new List <string>() { "@" + currentUser.UserName }, extraSpecialIdentifiers); if (command is PermissionsCommandBase) { PermissionsCommandBase permissionCommand = (PermissionsCommandBase)command; permissionCommand.ResetCooldown(await ChannelSession.GetCurrentUser()); } this.SwitchToPlay(); } this.RaiseEvent(new RoutedEventArgs(CommandButtonsControl.PlayClickedEvent, this)); }
private async void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel donation) { await this.AddEvent(donation.Username, string.Format("Donated {0}", donation.AmountText)); }
private void GlobalEvents_OnDonationOccurred(object sender, UserDonationModel e) { this.DonationsTracker.OnStatisticEventOccurred(e.Username, e.Amount); }
public static Dictionary <string, string> GetEventTestSpecialIdentifiers(EventTypeEnum eventType) { Dictionary <string, string> specialIdentifiers = CommandModelBase.GetGeneralTestSpecialIdentifiers(); switch (eventType) { case EventTypeEnum.TwitchChannelRaided: specialIdentifiers["hostviewercount"] = "123"; specialIdentifiers["raidviewercount"] = "123"; break; case EventTypeEnum.TwitchChannelSubscribed: specialIdentifiers["message"] = "Test Message"; specialIdentifiers["usersubplanname"] = "Plan Name"; specialIdentifiers["usersubplan"] = "Tier 1"; break; case EventTypeEnum.TwitchChannelResubscribed: specialIdentifiers["message"] = "Test Message"; specialIdentifiers["usersubplanname"] = "Plan Name"; specialIdentifiers["usersubplan"] = "Tier 1"; specialIdentifiers["usersubmonths"] = "5"; specialIdentifiers["usersubstreak"] = "3"; break; case EventTypeEnum.TwitchChannelSubscriptionGifted: specialIdentifiers["usersubplanname"] = "Plan Name"; specialIdentifiers["usersubplan"] = "Tier 1"; specialIdentifiers["usersubmonthsgifted"] = "3"; specialIdentifiers["isanonymous"] = "false"; break; case EventTypeEnum.TwitchChannelMassSubscriptionsGifted: specialIdentifiers["subsgiftedamount"] = "5"; specialIdentifiers["subsgiftedlifetimeamount"] = "100"; specialIdentifiers["usersubplan"] = "Tier 1"; specialIdentifiers["isanonymous"] = "false"; break; case EventTypeEnum.TwitchChannelBitsCheered: specialIdentifiers["bitsamount"] = "10"; specialIdentifiers["Message"] = "Test Message"; break; case EventTypeEnum.TwitchChannelPointsRedeemed: specialIdentifiers["rewardname"] = "Test Reward"; specialIdentifiers["rewardcost"] = "100"; specialIdentifiers["message"] = "Test Message"; break; case EventTypeEnum.ChatUserTimeout: specialIdentifiers["timeoutlength"] = "5m"; break; case EventTypeEnum.StreamlabsDonation: case EventTypeEnum.TiltifyDonation: case EventTypeEnum.ExtraLifeDonation: case EventTypeEnum.TipeeeStreamDonation: case EventTypeEnum.TreatStreamDonation: case EventTypeEnum.StreamJarDonation: case EventTypeEnum.JustGivingDonation: case EventTypeEnum.StreamElementsDonation: UserDonationModel donation = new UserDonationModel() { Amount = 12.34, Message = "Test donation message", ImageLink = genericImage }; switch (eventType) { case EventTypeEnum.StreamlabsDonation: donation.Source = UserDonationSourceEnum.Streamlabs; break; case EventTypeEnum.TiltifyDonation: donation.Source = UserDonationSourceEnum.Tiltify; break; case EventTypeEnum.ExtraLifeDonation: donation.Source = UserDonationSourceEnum.ExtraLife; break; case EventTypeEnum.TipeeeStreamDonation: donation.Source = UserDonationSourceEnum.TipeeeStream; break; case EventTypeEnum.TreatStreamDonation: donation.Source = UserDonationSourceEnum.TreatStream; break; case EventTypeEnum.StreamJarDonation: donation.Source = UserDonationSourceEnum.StreamJar; break; case EventTypeEnum.JustGivingDonation: donation.Source = UserDonationSourceEnum.JustGiving; break; case EventTypeEnum.StreamElementsDonation: donation.Source = UserDonationSourceEnum.StreamElements; break; } foreach (var kvp in donation.GetSpecialIdentifiers()) { specialIdentifiers[kvp.Key] = kvp.Value; } if (eventType == EventTypeEnum.TreatStreamDonation) { specialIdentifiers["donationtype"] = "Pizza"; } break; case EventTypeEnum.PatreonSubscribed: specialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierNameSpecialIdentifier] = "Super Tier"; specialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierAmountSpecialIdentifier] = "12.34"; specialIdentifiers[SpecialIdentifierStringBuilder.PatreonTierImageSpecialIdentifier] = genericImage; break; case EventTypeEnum.StreamlootsCardRedeemed: specialIdentifiers["streamlootscardname"] = "Test Card"; specialIdentifiers["streamlootscardimage"] = "https://res.cloudinary.com/streamloots/image/upload/f_auto,c_scale,w_250,q_90/static/e19c7bf6-ca3e-49a8-807e-b2e9a1a47524/en_dl_character.png"; specialIdentifiers["streamlootscardvideo"] = "https://cdn.streamloots.com/uploads/5c645b78666f31002f2979d1/3a6bf1dc-7d61-4f93-be0a-f5dc1d0d33b6.webm"; specialIdentifiers["streamlootscardsound"] = "https://static.streamloots.com/b355d1ef-d931-4c16-a48f-8bed0076401b/alerts/default.mp3"; specialIdentifiers["streamlootsmessage"] = "Test Message"; break; case EventTypeEnum.StreamlootsPackPurchased: case EventTypeEnum.StreamlootsPackGifted: specialIdentifiers["streamlootspurchasequantity"] = "1"; break; } return(specialIdentifiers); }