private void Instance_EventsGenerationStatus(object sender, StatsGenerationEvent e) { switch (e.State) { case "COMPLETED": case "NONPC": case "NODATA": AddParse(e.Type, sender as ISummaryBuilder, e.CombinedStats); break; } }
private void Instance_EventsGenerationStatus(object sender, StatsGenerationEvent e) { Dispatcher.InvokeAsync(() => { switch (e.State) { case "STARTED": (Application.Current.MainWindow as MainWindow).Busy(true); title.Content = "Calculating DPS..."; dataGrid.ItemsSource = null; ChildGrids.Clear(); timeChooser.Value = 0; timeChooser.MaxValue = 0; timeChooser.IsEnabled = false; break; case "COMPLETED": CurrentStats = e.CombinedStats; CurrentGroups = e.Groups; CurrentGroupCount = e.UniqueGroupCount; if (CurrentStats == null) { title.Content = NODATA_TABLE_LABEL; } else { title.Content = CurrentStats.FullTitle; UpdateView(); timeChooser.IsEnabled = true; timeChooser.Value = Convert.ToInt64(CurrentStats.RaidStats.TotalSeconds); timeChooser.MaxValue = Convert.ToInt64(CurrentStats.RaidStats.MaxTime); } if (!MainWindow.IsBaneDamageEnabled) { title.Content += " (Not Including Banes)"; } (Application.Current.MainWindow as MainWindow).Busy(false); UpdateDataGridMenuItems(); break; case "NONPC": case "NODATA": CurrentStats = null; title.Content = e.State == "NONPC" ? DEFAULT_TABLE_LABEL : NODATA_TABLE_LABEL; (Application.Current.MainWindow as MainWindow).Busy(false); UpdateDataGridMenuItems(); break; } }); }
private void Instance_EventsGenerationStatus(object sender, StatsGenerationEvent e) { Dispatcher.InvokeAsync(() => { switch (e.State) { case "STARTED": (Application.Current.MainWindow as MainWindow).Busy(true); title.Content = "Calculating DPS..."; dataGrid.ItemsSource = null; ChildGrids.Clear(); break; case "COMPLETED": CurrentStats = e.CombinedStats as CombinedStats; CurrentGroups = e.Groups; CurrentGroupCount = e.UniqueGroupCount; if (CurrentStats == null) { title.Content = NODATA_TABLE_LABEL; } else { title.Content = CurrentStats.FullTitle; var view = CollectionViewSource.GetDefaultView(CurrentStats.StatsList); dataGrid.ItemsSource = SetFilter(view); } if (!MainWindow.IsBaneDamageEnabled) { title.Content += " (Not Including Banes)"; } (Application.Current.MainWindow as MainWindow).Busy(false); UpdateDataGridMenuItems(); break; case "NONPC": case "NODATA": CurrentStats = null; title.Content = e.State == "NONPC" ? DEFAULT_TABLE_LABEL : NODATA_TABLE_LABEL; (Application.Current.MainWindow as MainWindow).Busy(false); UpdateDataGridMenuItems(); break; } }); }
private void FireCompletedEvent(GenerateStatsOptions options, CombinedStats combined, List <List <ActionBlock> > groups) { if (options.RequestSummaryData) { // generating new stats var genEvent = new StatsGenerationEvent() { Type = Labels.HEALPARSE, State = "COMPLETED", CombinedStats = combined }; genEvent.Groups.AddRange(groups); EventsGenerationStatus?.Invoke(this, genEvent); } }
private void Instance_EventsGenerationStatus(object sender, StatsGenerationEvent e) { Dispatcher.InvokeAsync(() => { switch (e.State) { case "STARTED": title.Content = "Calculating HPS..."; dataGrid.ItemsSource = null; break; case "COMPLETED": CurrentStats = e.CombinedStats as CombinedStats; CurrentGroups = e.Groups; if (CurrentStats == null) { title.Content = NODATA_TABLE_LABEL; } else { title.Content = CurrentStats.FullTitle; var view = CollectionViewSource.GetDefaultView(CurrentStats.StatsList); dataGrid.ItemsSource = SetFilter(view); } if (!MainWindow.IsAoEHealingEnabled) { title.Content += " (Not Including AE Healing)"; } UpdateDataGridMenuItems(); break; case "NONPC": case "NODATA": CurrentStats = null; title.Content = e.State == "NONPC" ? DEFAULT_TABLE_LABEL : NODATA_TABLE_LABEL; UpdateDataGridMenuItems(); break; } }); }
private void ComputeTankingStats(GenerateStatsOptions options) { lock (TankingGroupIds) { CombinedStats combined = null; Dictionary <string, PlayerStats> individualStats = new Dictionary <string, PlayerStats>(); if (RaidTotals != null) { // always start over RaidTotals.Total = 0; try { FireChartEvent(options, "UPDATE"); if (options.RequestSummaryData) { TankingGroups.ForEach(group => { group.ForEach(block => { block.Actions.ForEach(action => { if (action is DamageRecord record) { if (options.DamageType == 0 || (options.DamageType == 1 && IsMelee(record)) || (options.DamageType == 2 && !IsMelee(record))) { RaidTotals.Total += record.Total; PlayerStats stats = StatsUtil.CreatePlayerStats(individualStats, record.Defender); StatsUtil.UpdateStats(stats, record); PlayerSubStats subStats = StatsUtil.CreatePlayerSubStats(stats.SubStats, record.SubType, record.Type); StatsUtil.UpdateStats(subStats, record); } } }); }); }); RaidTotals.DPS = (long)Math.Round(RaidTotals.Total / RaidTotals.TotalSeconds, 2); Parallel.ForEach(individualStats.Values, stats => { StatsUtil.UpdateAllStatsTimeRanges(stats, PlayerTimeRanges, PlayerSubTimeRanges); StatsUtil.UpdateCalculations(stats, RaidTotals); }); combined = new CombinedStats { RaidStats = RaidTotals, TargetTitle = (Selected.Count > 1 ? "Combined (" + Selected.Count + "): " : "") + Title, TimeTitle = string.Format(CultureInfo.CurrentCulture, StatsUtil.TIME_FORMAT, RaidTotals.TotalSeconds), TotalTitle = string.Format(CultureInfo.CurrentCulture, StatsUtil.TOTAL_FORMAT, StatsUtil.FormatTotals(RaidTotals.Total), " Tanked ", StatsUtil.FormatTotals(RaidTotals.DPS)) }; combined.StatsList.AddRange(individualStats.Values.AsParallel().OrderByDescending(item => item.Total)); combined.FullTitle = StatsUtil.FormatTitle(combined.TargetTitle, combined.TimeTitle, combined.TotalTitle); combined.ShortTitle = StatsUtil.FormatTitle(combined.TargetTitle, combined.TimeTitle, ""); for (int i = 0; i < combined.StatsList.Count; i++) { combined.StatsList[i].Rank = Convert.ToUInt16(i + 1); combined.UniqueClasses[combined.StatsList[i].ClassName] = 1; } } } catch (Exception ex) { LOG.Error(ex); } if (options.RequestSummaryData) { // generating new stats var genEvent = new StatsGenerationEvent() { Type = Labels.TANKPARSE, State = "COMPLETED", CombinedStats = combined }; genEvent.Groups.AddRange(TankingGroups); genEvent.UniqueGroupCount = TankingGroupIds.Count; EventsGenerationStatus?.Invoke(this, genEvent); } } } }
private void ComputeHealingStats(GenerateStatsOptions options) { lock (HealingGroups) { if (RaidTotals != null) { CombinedStats combined = null; Dictionary <string, PlayerStats> individualStats = new Dictionary <string, PlayerStats>(); // always start over RaidTotals.Total = 0; try { FireChartEvent(options, "UPDATE"); if (options.RequestSummaryData) { HealingGroups.ForEach(group => { group.ForEach(block => { block.Actions.ForEach(action => { if (action is HealRecord record) { RaidTotals.Total += record.Total; PlayerStats stats = StatsUtil.CreatePlayerStats(individualStats, record.Healer); StatsUtil.UpdateStats(stats, record); var spellStatName = record.SubType ?? Labels.SELFHEAL; PlayerSubStats spellStats = StatsUtil.CreatePlayerSubStats(stats.SubStats, spellStatName, record.Type); StatsUtil.UpdateStats(spellStats, record); var healedStatName = record.Healed; PlayerSubStats healedStats = StatsUtil.CreatePlayerSubStats(stats.SubStats2, healedStatName, record.Type); StatsUtil.UpdateStats(healedStats, record); } }); }); }); RaidTotals.DPS = (long)Math.Round(RaidTotals.Total / RaidTotals.TotalSeconds, 2); Parallel.ForEach(individualStats.Values, stats => UpdateStats(stats, HealerSpellTimeRanges, HealerHealedTimeRanges)); combined = new CombinedStats { RaidStats = RaidTotals, TargetTitle = (Selected.Count > 1 ? "Combined (" + Selected.Count + "): " : "") + Title, TimeTitle = string.Format(CultureInfo.CurrentCulture, StatsUtil.TIME_FORMAT, RaidTotals.TotalSeconds), TotalTitle = string.Format(CultureInfo.CurrentCulture, StatsUtil.TOTAL_FORMAT, StatsUtil.FormatTotals(RaidTotals.Total), " Heals ", StatsUtil.FormatTotals(RaidTotals.DPS)) }; combined.StatsList.AddRange(individualStats.Values.AsParallel().OrderByDescending(item => item.Total)); combined.FullTitle = StatsUtil.FormatTitle(combined.TargetTitle, combined.TimeTitle, combined.TotalTitle); combined.ShortTitle = StatsUtil.FormatTitle(combined.TargetTitle, combined.TimeTitle, ""); for (int i = 0; i < combined.StatsList.Count; i++) { combined.StatsList[i].Rank = Convert.ToUInt16(i + 1); combined.UniqueClasses[combined.StatsList[i].ClassName] = 1; } } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception ex) #pragma warning restore CA1031 // Do not catch general exception types { if (ex is ArgumentNullException || ex is NullReferenceException || ex is ArgumentOutOfRangeException || ex is ArgumentException || ex is OutOfMemoryException) { LOG.Error(ex); } } if (options.RequestSummaryData) { // generating new stats var genEvent = new StatsGenerationEvent() { Type = Labels.HEALPARSE, State = "COMPLETED", CombinedStats = combined }; genEvent.Groups.AddRange(HealingGroups); EventsGenerationStatus?.Invoke(this, genEvent); } } } }
private void Instance_EventsGenerationStatus(object sender, StatsGenerationEvent e) { Dispatcher.InvokeAsync(() => { if (e.Type == Labels.HEALPARSE && e.State == "COMPLETED") { (Application.Current.MainWindow as MainWindow).Busy(true); if (CurrentStats != null) { HealingStatsManager.Instance.PopulateHealing(CurrentStats); dataGrid.Items?.Refresh(); if (!MainWindow.IsAoEHealingEnabled) { title.Content = CurrentStats.FullTitle + " (Not Including AE Healing)"; } else { title.Content = CurrentStats.FullTitle; } } Helpers.SetBusy(false); } else if (e.Type == Labels.TANKPARSE) { switch (e.State) { case "STARTED": Helpers.SetBusy(true); title.Content = "Calculating Tanking DPS..."; dataGrid.ItemsSource = null; break; case "COMPLETED": CurrentStats = e.CombinedStats as CombinedStats; CurrentGroups = e.Groups; if (CurrentStats == null) { title.Content = NODATA_TABLE_LABEL; } else { title.Content = CurrentStats.FullTitle; HealingStatsManager.Instance.PopulateHealing(CurrentStats); var view = CollectionViewSource.GetDefaultView(CurrentStats.StatsList); dataGrid.ItemsSource = SetFilter(view); } if (!MainWindow.IsAoEHealingEnabled) { title.Content += " (Not Including AE Healing)"; } Helpers.SetBusy(false); UpdateDataGridMenuItems(); break; case "NONPC": case "NODATA": CurrentStats = null; title.Content = e.State == "NONPC" ? DEFAULT_TABLE_LABEL : NODATA_TABLE_LABEL; Helpers.SetBusy(false); UpdateDataGridMenuItems(); break; } } }); }