/// <summary> /// Checks the combat data and gets buffs that were present during the fight /// </summary> private void SetPresentBoons() { HashSet <long> skillIDs = _log.CombatData.GetSkills(); // Main boons foreach (Boon boon in Boon.GetBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentBoons.Add(boon); } } // Main Conditions foreach (Boon boon in Boon.GetCondiBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentConditions.Add(boon); } } // Important class specific boons foreach (Boon boon in Boon.GetOffensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentOffbuffs.Add(boon); } } foreach (Boon boon in Boon.GetDefensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentDefbuffs.Add(boon); } } // All class specific boons Dictionary <long, Boon> remainingBuffsByIds = Boon.GetRemainingBuffsList().GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault()); var players = _log.PlayerList; foreach (Player player in players) { _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>(); foreach (CombatItem item in _log.CombatData.GetBoonDataByDst(player.InstID, player.FirstAware, player.LastAware)) { if (item.DstInstid == player.InstID && item.IsBuffRemove == ParseEnum.BuffRemove.None && remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon)) { _statistics.PresentPersonalBuffs[player.InstID].Add(boon); } } } }
protected void SetBoonStatus(ParsedLog log) { BoonPoints = new Dictionary <long, BoonsGraphModel>(); BoonMap toUse = GetBoonMap(log); long dur = log.FightData.FightDuration; int fightDuration = (int)(dur) / 1000; BoonsGraphModel boonPresenceGraph = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfBoonsID]); BoonsGraphModel condiPresenceGraph = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfConditionsID]); HashSet <long> boonIds = new HashSet <long>(Boon.GetBoonList().Select(x => x.ID)); HashSet <long> condiIds = new HashSet <long>(Boon.GetCondiBoonList().Select(x => x.ID)); InitBoonStatusData(log); long death = GetDeath(log, 0, dur); foreach (Boon boon in TrackedBoons) { long boonid = boon.ID; if (toUse.TryGetValue(boonid, out List <BoonLog> logs) && logs.Count != 0) { if (BoonPoints.ContainsKey(boonid)) { continue; } BoonSimulator simulator = boon.CreateSimulator(log); simulator.Simulate(logs, dur); if (death > 0 && GetCastLogs(log, death + 5000, dur).Count == 0) { simulator.Trim(death); } else { simulator.Trim(dur); } bool updateBoonPresence = boonIds.Contains(boonid); bool updateCondiPresence = condiIds.Contains(boonid); List <BoonsGraphModel.SegmentWithSources> graphSegments = new List <BoonsGraphModel.SegmentWithSources>(); foreach (BoonSimulationItem simul in simulator.GenerationSimulation) { SetBoonStatusGenerationData(log, simul, boonid); BoonsGraphModel.SegmentWithSources segment = simul.ToSegment(); if (graphSegments.Count == 0) { graphSegments.Add(new BoonsGraphModel.SegmentWithSources(0, segment.Start, 0, GeneralHelper.UnknownAgent)); } else if (graphSegments.Last().End != segment.Start) { graphSegments.Add(new BoonsGraphModel.SegmentWithSources(graphSegments.Last().End, segment.Start, 0, GeneralHelper.UnknownAgent)); } graphSegments.Add(segment); } SetBoonStatusCleanseWasteData(log, simulator, boonid, updateCondiPresence); if (graphSegments.Count > 0) { graphSegments.Add(new BoonsGraphModel.SegmentWithSources(graphSegments.Last().End, dur, 0, GeneralHelper.UnknownAgent)); } else { graphSegments.Add(new BoonsGraphModel.SegmentWithSources(0, dur, 0, GeneralHelper.UnknownAgent)); } BoonPoints[boonid] = new BoonsGraphModel(boon, graphSegments); if (updateBoonPresence || updateCondiPresence) { List <BoonsGraphModel.Segment> segmentsToFill = updateBoonPresence ? boonPresenceGraph.BoonChart : condiPresenceGraph.BoonChart; bool firstPass = segmentsToFill.Count == 0; foreach (BoonsGraphModel.Segment seg in BoonPoints[boonid].BoonChart) { long start = seg.Start; long end = seg.End; int value = seg.Value > 0 ? 1 : 0; if (firstPass) { segmentsToFill.Add(new BoonsGraphModel.Segment(start, end, value)); } else { for (int i = 0; i < segmentsToFill.Count; i++) { BoonsGraphModel.Segment curSeg = segmentsToFill[i]; long curEnd = curSeg.End; long curStart = curSeg.Start; int curVal = curSeg.Value; if (curStart > end) { break; } if (curEnd < start) { continue; } if (end <= curEnd) { curSeg.End = start; segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, end, curVal + value)); segmentsToFill.Insert(i + 2, new BoonsGraphModel.Segment(end, curEnd, curVal)); break; } else { curSeg.End = start; segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, curEnd, curVal + value)); start = curEnd; i++; } } } } if (updateBoonPresence) { boonPresenceGraph.FuseSegments(); } else { condiPresenceGraph.FuseSegments(); } } } } BoonPoints[Boon.NumberOfBoonsID] = boonPresenceGraph; BoonPoints[Boon.NumberOfConditionsID] = condiPresenceGraph; }
/// <summary> /// Checks the combat data and gets buffs that were present during the fight /// </summary> private void SetPresentBoons() { List <CombatItem> combatList = _log.CombatData.AllCombatItems; var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID)); // Main boons foreach (Boon boon in Boon.GetBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentBoons.Add(boon); } } // Main Conditions foreach (Boon boon in Boon.GetCondiBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentConditions.Add(boon); } } // Important class specific boons foreach (Boon boon in Boon.GetOffensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentOffbuffs.Add(boon); } } foreach (Boon boon in Boon.GetDefensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentDefbuffs.Add(boon); } } var players = _log.PlayerList; Dictionary <ushort, Player> playersById = new Dictionary <ushort, Player>(); foreach (Player player in players) { _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>(); playersById.Add(player.InstID, player); } // All class specific boons List <Boon> remainingBuffs = new List <Boon>(Boon.GetRemainingBuffsList()); remainingBuffs.AddRange(Boon.GetConsumableList()); Dictionary <long, Boon> remainingBuffsByIds = remainingBuffs.GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault()); foreach (CombatItem item in combatList) { if (playersById.TryGetValue(item.DstInstid, out Player player)) { if (remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon)) { _statistics.PresentPersonalBuffs[player.InstID].Add(boon); } } } }
/// <summary> /// Checks the combat data and gets buffs that were present during the fight /// </summary> private void SetPresentBoons() { List <CombatItem> combatList = _log.CombatData.AllCombatItems; var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID)); if (_settings.PlayerBoonsUniversal) { // Main boons foreach (Boon boon in Boon.GetBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentBoons.Add(boon); } } // Main Conditions foreach (Boon boon in Boon.GetCondiBoonList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentConditions.Add(boon); } } } if (_settings.PlayerBoonsImpProf) { // Important class specific boons foreach (Boon boon in Boon.GetOffensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentOffbuffs.Add(boon); } } foreach (Boon boon in Boon.GetDefensiveTableList()) { if (skillIDs.Contains(boon.ID)) { _statistics.PresentDefbuffs.Add(boon); } } } var players = _log.PlayerList; if (_settings.PlayerBoonsAllProf) { var playersById = new Dictionary <ushort, Player>(); foreach (var player in players) { _statistics.PresentPersonalBuffs[player.InstID] = new List <Boon>(); playersById.Add(player.InstID, player); } // All class specific boons var remainingBoons = new List <Boon>(Boon.GetRemainingBuffsList()); remainingBoons.AddRange(Boon.GetConsumableList()); var classSpecificBoonsById = new Dictionary <long, Boon>(); foreach (var boon in remainingBoons) { if (boon.ID == -1) { continue; } classSpecificBoonsById.Add(boon.ID, boon); } foreach (var item in combatList) { if (playersById.TryGetValue(item.DstInstid, out Player player)) { if (classSpecificBoonsById.TryGetValue(item.SkillID, out Boon boon)) { _statistics.PresentPersonalBuffs[player.InstID].Add(boon); } } } } foreach (Player player in players) { player.BoonToTrack.AddRange(_statistics.PresentBoons); player.BoonToTrack.AddRange(_statistics.PresentConditions); player.BoonToTrack.AddRange(_statistics.PresentOffbuffs); player.BoonToTrack.AddRange(_statistics.PresentDefbuffs); if (_settings.PlayerBoonsAllProf) { player.BoonToTrack.AddRange(_statistics.PresentPersonalBuffs[player.InstID]); } } // target boons foreach (Target target in _log.FightData.Logic.Targets) { target.BoonToTrack.AddRange(_statistics.PresentBoons); target.BoonToTrack.AddRange(_statistics.PresentConditions); foreach (Boon boon in Boon.BoonsBySource[Boon.BoonSource.Enemy]) { if (_log.CombatData.BoonData.ContainsKey(boon.ID)) { target.BoonToTrack.Add(boon); } } } }