public ParsedLog(LogData logData, FightData fightData, AgentData agentData, SkillData skillData, CombatData combatData, List <Player> playerList, Target target) { _container = new ParsedEvtcContainer(logData, fightData, agentData, skillData, combatData, playerList); // FightData.SetSuccess(_container); if (FightData.FightDuration <= 2200) { throw new TooShortException(); } if (Properties.Settings.Default.SkipFailedTries && !FightData.Success) { throw new SkipException(); } CombatData.Update(FightData.FightEnd); FightData.SetCM(_container); // Boons = new BoonsContainer(logData.GW2Version); BoonSourceFinder = Boon.GetBoonSourceFinder(logData.GW2Version, Boons); DamageModifiers = new DamageModifiersContainer(logData.GW2Version); MechanicData = new MechanicData(fightData); FightData.Logic.ComputeMechanics(this); Statistics = new Statistics(this); LegacyTarget = target; }
public DamageLogCondition(long time, CombatItem c, BoonsContainer boons) : base(time, c) { Damage = c.BuffDmg; IsIndirectDamage = true; if (boons.BoonsByIds.TryGetValue(c.SkillID, out Boon boon)) { IsCondi = (boon.Nature == Boon.BoonNature.Condition); } }
public ParsedEvtcContainer(LogData logData, FightData fightData, AgentData agentData, SkillData skillData, CombatData combatData, List <Player> playerList) { LogData = logData; FightData = fightData; AgentData = agentData; SkillData = skillData; CombatData = combatData; PlayerList = playerList; Boons = new BoonsContainer(logData.GW2Version); DamageModifiers = new DamageModifiersContainer(logData.GW2Version); PlayerListBySpec = playerList.GroupBy(x => x.Prof).ToDictionary(x => x.Key, x => x.ToList()); PlayerIDs = new HashSet <ushort>(playerList.Select(x => x.InstID)); }
public ParsedLog(string buildVersion, FightData fightData, AgentData agentData, SkillData skillData, List <CombatItem> combatItems, List <Player> playerList) { FightData = fightData; AgentData = agentData; SkillData = skillData; PlayerList = playerList; // PlayerListBySpec = playerList.GroupBy(x => x.Prof).ToDictionary(x => x.Key, x => x.ToList()); PlayerAgents = new HashSet <AgentItem>(playerList.Select(x => x.AgentItem)); CombatData = new CombatData(combatItems, FightData, AgentData, SkillData, playerList); LogData = new LogData(buildVersion, CombatData, combatItems); // UpdateFightData(); // Boons = new BoonsContainer(LogData.GW2Version); DamageModifiers = new DamageModifiersContainer(LogData.GW2Version); MechanicData = FightData.Logic.GetMechanicData(); Statistics = new Statistics(CombatData, AgentData, FightData, PlayerList, Boons); }
public static object[] GetDMGDtoItem(KeyValuePair <SkillItem, List <AbstractDamageEvent> > entry, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Boon> usedBoons, BoonsContainer boons) { int totaldamage = 0, mindamage = int.MaxValue, maxdamage = int.MinValue, hits = 0, crit = 0, flank = 0, glance = 0, shieldDamage = 0; bool IsIndirectDamage = false; foreach (AbstractDamageEvent dl in entry.Value.Where(x => !x.HasDowned)) { IsIndirectDamage = IsIndirectDamage || dl is NonDirectDamageEvent; int curdmg = dl.Damage; totaldamage += curdmg; if (curdmg < mindamage) { mindamage = curdmg; } if (curdmg > maxdamage) { maxdamage = curdmg; } hits++; if (dl.HasCrit) { crit++; } if (dl.HasGlanced) { glance++; } if (dl.IsFlanking) { flank++; } shieldDamage += dl.ShieldDamage; } if (IsIndirectDamage) { if (!usedBoons.ContainsKey(entry.Key.ID)) { if (boons.BoonsByIds.TryGetValue(entry.Key.ID, out Boon buff)) { usedBoons.Add(buff.ID, buff); } else { SkillItem aux = entry.Key; Boon auxBoon = new Boon(aux.Name, entry.Key.ID, aux.Icon); usedBoons.Add(auxBoon.ID, auxBoon); } } } else { if (!usedSkills.ContainsKey(entry.Key.ID)) { usedSkills.Add(entry.Key.ID, entry.Key); } } int casts = 0, timeswasted = 0, timessaved = 0; if (!IsIndirectDamage && castLogsBySkill != null && castLogsBySkill.TryGetValue(entry.Key, out List <AbstractCastEvent> clList)) { casts = clList.Count; foreach (AbstractCastEvent cl in clList) { if (cl.Interrupted) { timeswasted += cl.ActualDuration; } else if (cl.ReducedAnimation && cl.ActualDuration < cl.ExpectedDuration) { timessaved += cl.ExpectedDuration - cl.ActualDuration; } } } object[] skillItem = { IsIndirectDamage, entry.Key.ID, totaldamage, mindamage == int.MaxValue ? 0 : mindamage, maxdamage == int.MinValue ? 0 : maxdamage, IsIndirectDamage ? 0 : casts, hits, IsIndirectDamage ? 0 : crit, IsIndirectDamage ? 0 : flank, IsIndirectDamage ? 0 : glance, IsIndirectDamage ? 0 : timeswasted / 1000.0, IsIndirectDamage ? 0 : timessaved / 1000.0, shieldDamage, }; return(skillItem); }
/// <summary> /// Checks the combat data and gets buffs that were present during the fight /// </summary> private void SetPresentBoons(HashSet <long> skillIDs, List <Player> players, CombatData combatData, BoonsContainer boons) { // Main boons foreach (Boon boon in boons.GetBoonList()) { if (skillIDs.Contains(boon.ID)) { PresentBoons.Add(boon); } } // Main Conditions foreach (Boon boon in boons.GetCondiBoonList()) { if (skillIDs.Contains(boon.ID)) { PresentConditions.Add(boon); } } // Important class specific boons foreach (Boon boon in boons.GetOffensiveTableList()) { if (skillIDs.Contains(boon.ID)) { PresentOffbuffs.Add(boon); } } foreach (Boon boon in boons.GetDefensiveTableList()) { if (skillIDs.Contains(boon.ID)) { PresentDefbuffs.Add(boon); } } // All class specific boons Dictionary <long, Boon> remainingBuffsByIds = boons.GetRemainingBuffsList().GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault()); foreach (Player player in players) { PresentPersonalBuffs[player.InstID] = new HashSet <Boon>(); foreach (CombatItem item in 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)) { PresentPersonalBuffs[player.InstID].Add(boon); } } } }
public static object[] GetDMGDtoItem(KeyValuePair <long, List <DamageLog> > entry, Dictionary <long, List <CastLog> > castLogsBySkill, SkillData skillData, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Boon> usedBoons, BoonsContainer boons) { int totaldamage = 0, mindamage = int.MaxValue, maxdamage = int.MinValue, hits = 0, crit = 0, flank = 0, glance = 0; bool IsIndirectDamage = false; foreach (DamageLog dl in entry.Value) { if (dl.Result == ParseEnum.Result.Downed) { continue; } IsIndirectDamage = dl.IsIndirectDamage; int curdmg = dl.Damage; totaldamage += curdmg; if (curdmg < mindamage) { mindamage = curdmg; } if (curdmg > maxdamage) { maxdamage = curdmg; } hits++; if (dl.Result == ParseEnum.Result.Crit) { crit++; } if (dl.Result == ParseEnum.Result.Glance) { glance++; } if (dl.IsFlanking) { flank++; } } if (IsIndirectDamage) { if (!usedBoons.ContainsKey(entry.Key)) { if (boons.BoonsByIds.TryGetValue(entry.Key, out Boon buff)) { usedBoons.Add(buff.ID, buff); } else { SkillItem aux = skillData.Get(entry.Key); Boon auxBoon = new Boon(aux.Name, entry.Key, aux.Icon); usedBoons.Add(auxBoon.ID, auxBoon); } } } else { if (!usedSkills.ContainsKey(entry.Key)) { usedSkills.Add(entry.Key, skillData.Get(entry.Key)); } } int casts = 0, timeswasted = 0, timessaved = 0; if (!IsIndirectDamage && castLogsBySkill != null && castLogsBySkill.TryGetValue(entry.Key, out List <CastLog> clList)) { casts = clList.Count; foreach (CastLog cl in clList) { if (cl.EndActivation == ParseEnum.Activation.CancelCancel) { timeswasted += cl.ActualDuration; } if (cl.EndActivation == ParseEnum.Activation.CancelFire && cl.ActualDuration < cl.ExpectedDuration) { timessaved += cl.ExpectedDuration - cl.ActualDuration; } } } object[] skillItem = { IsIndirectDamage, entry.Key, totaldamage, mindamage == int.MaxValue ? 0 : mindamage, maxdamage == int.MinValue ? 0 : maxdamage, IsIndirectDamage ? 0 : casts, hits, IsIndirectDamage ? 0 : crit, IsIndirectDamage ? 0 : flank, IsIndirectDamage ? 0 : glance, IsIndirectDamage ? 0 : timeswasted / 1000.0, IsIndirectDamage ? 0 : -timessaved / 1000.0 }; return(skillItem); }
public Statistics(CombatData combatData, AgentData agentData, FightData fightData, List <Player> players, BoonsContainer boons) { HashSet <long> skillIDs = combatData.GetSkills(); // Main boons foreach (Boon boon in boons.BoonsByNature[BoonNature.Boon]) { if (skillIDs.Contains(boon.ID)) { PresentBoons.Add(boon); } } // Main Conditions foreach (Boon boon in boons.BoonsByNature[BoonNature.Condition]) { if (skillIDs.Contains(boon.ID)) { PresentConditions.Add(boon); } } // Important class specific boons foreach (Boon boon in boons.BoonsByNature[BoonNature.OffensiveBuffTable]) { if (skillIDs.Contains(boon.ID)) { PresentOffbuffs.Add(boon); } } foreach (Boon boon in boons.BoonsByNature[BoonNature.DefensiveBuffTable]) { if (skillIDs.Contains(boon.ID)) { PresentDefbuffs.Add(boon); } } // All class specific boons Dictionary <long, Boon> remainingBuffsByIds = boons.BoonsByNature[BoonNature.GraphOnlyBuff].GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault()); foreach (Player player in players) { PresentPersonalBuffs[player.InstID] = new HashSet <Boon>(); foreach (AbstractBuffEvent item in combatData.GetBoonDataByDst(player.AgentItem)) { if (item is BuffApplyEvent && item.To == player.AgentItem && remainingBuffsByIds.TryGetValue(item.BuffID, out Boon boon)) { PresentPersonalBuffs[player.InstID].Add(boon); } } } }