Exemple #1
0
        internal ParsedEvtcLog(int evtcVersion, FightData fightData, AgentData agentData, SkillData skillData,
                               List <CombatItem> combatItems, List <Player> playerList, IReadOnlyDictionary <uint, AbstractExtensionHandler> extensions, long evtcLogDuration, EvtcParserSettings parserSettings, ParserController operation)
        {
            FightData      = fightData;
            AgentData      = agentData;
            SkillData      = skillData;
            PlayerList     = playerList;
            ParserSettings = parserSettings;
            _operation     = operation;
            var friendlies = new List <AbstractSingleActor>();

            friendlies.AddRange(playerList);
            friendlies.AddRange(fightData.Logic.NonPlayerFriendlies);
            Friendlies = friendlies;
            //
            FriendliesListBySpec = friendlies.GroupBy(x => x.Spec).ToDictionary(x => x.Key, x => x.ToList());
            PlayerAgents         = new HashSet <AgentItem>(playerList.Select(x => x.AgentItem));
            FriendlyAgents       = new HashSet <AgentItem>(friendlies.Select(x => x.AgentItem));
            _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Combat Events");
            CombatData = new CombatData(combatItems, FightData, AgentData, SkillData, playerList, operation, extensions, evtcVersion);
            operation.UpdateProgressWithCancellationCheck("Checking CM");
            FightData.SetCM(CombatData, AgentData);
            operation.UpdateProgressWithCancellationCheck("Setting Fight Name");
            FightData.SetFightName(CombatData, AgentData);
            //
            _operation.UpdateProgressWithCancellationCheck("Checking Success");
            FightData.Logic.CheckSuccess(CombatData, AgentData, FightData, PlayerAgents);
            if (FightData.FightDuration <= ParserSettings.TooShortLimit)
            {
                throw new TooShortException(FightData.FightDuration, ParserSettings.TooShortLimit);
            }
            if (ParserSettings.SkipFailedTries && !FightData.Success)
            {
                throw new SkipException();
            }
            _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Log Meta Data");
            LogData = new LogData(evtcVersion, CombatData, evtcLogDuration, playerList, extensions, operation);
            //
            _operation.UpdateProgressWithCancellationCheck("Creating Buff Container");
            Buffs = new BuffsContainer(LogData.GW2Build, CombatData, operation);
            _operation.UpdateProgressWithCancellationCheck("Creating Damage Modifier Container");
            DamageModifiers = new DamageModifiersContainer(LogData.GW2Build, fightData.Logic.Mode, parserSettings);
            _operation.UpdateProgressWithCancellationCheck("Creating Mechanic Data");
            MechanicData = FightData.Logic.GetMechanicData();
            _operation.UpdateProgressWithCancellationCheck("Creating General Statistics Container");
            StatisticsHelper = new StatisticsHelper(CombatData, PlayerList, Buffs);
        }
 public ParsedLog(string buildVersion, FightData fightData, AgentData agentData, SkillData skillData,
                  List <CombatItem> combatItems, List <Player> playerList, long evtcLogDuration, ParserSettings parserSettings)
 {
     FightData      = fightData;
     AgentData      = agentData;
     SkillData      = skillData;
     PlayerList     = playerList;
     ParserSettings = parserSettings;
     //
     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, evtcLogDuration);
     //
     UpdateFightData();
     //
     Buffs           = new BuffsContainer(LogData.GW2Version);
     DamageModifiers = new DamageModifiersContainer(LogData.GW2Version);
     MechanicData    = FightData.Logic.GetMechanicData();
     Statistics      = new GeneralStatistics(CombatData, PlayerList, Buffs);
 }
Exemple #3
0
 public ParsedLog(string buildVersion, FightData fightData, AgentData agentData, SkillData skillData,
                  List <CombatItem> combatItems, List <Player> playerList, long evtcLogDuration, ParserSettings parserSettings, OperationController operation)
 {
     FightData      = fightData;
     AgentData      = agentData;
     SkillData      = skillData;
     PlayerList     = playerList;
     ParserSettings = parserSettings;
     _operation     = operation;
     //
     PlayerListBySpec = playerList.GroupBy(x => x.Prof).ToDictionary(x => x.Key, x => x.ToList());
     PlayerAgents     = new HashSet <AgentItem>(playerList.Select(x => x.AgentItem));
     _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Combat Events");
     CombatData = new CombatData(combatItems, FightData, AgentData, SkillData, playerList);
     _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Log Meta Data");
     LogData = new LogData(buildVersion, CombatData, evtcLogDuration);
     _operation.UpdateProgressWithCancellationCheck("GW2 Build " + LogData.GW2Version);
     //
     _operation.UpdateProgressWithCancellationCheck("Checking Success");
     FightData.Logic.CheckSuccess(CombatData, AgentData, FightData, PlayerAgents);
     if (FightData.FightEnd <= 2200)
     {
         throw new TooShortException();
     }
     if (ParserSettings.SkipFailedTries && !FightData.Success)
     {
         throw new SkipException();
     }
     _operation.UpdateProgressWithCancellationCheck("Checking CM");
     FightData.SetCM(CombatData, AgentData, FightData);
     //
     _operation.UpdateProgressWithCancellationCheck("Creating Buff Container");
     Buffs = new BuffsContainer(LogData.GW2Version);
     _operation.UpdateProgressWithCancellationCheck("Creating Damage Modifier Container");
     DamageModifiers = new DamageModifiersContainer(LogData.GW2Version);
     _operation.UpdateProgressWithCancellationCheck("Creating Mechanic Data");
     MechanicData = FightData.Logic.GetMechanicData();
     _operation.UpdateProgressWithCancellationCheck("Creating General Statistics Container");
     Statistics = new GeneralStatistics(CombatData, PlayerList, Buffs);
 }
Exemple #4
0
        private static object[] GetDMGDtoItem(SkillItem skill, List <AbstractHealthDamageEvent> damageLogs, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBoons, BuffsContainer boons, PhaseData phase)
        {
            int totaldamage       = 0,
                mindamage         = int.MaxValue,
                maxdamage         = int.MinValue,
                hits              = 0,
                crit              = 0,
                critDamage        = 0,
                connectedHits     = 0,
                flank             = 0,
                againstMoving     = 0,
                glance            = 0,
                shieldDamage      = 0;
            bool IsIndirectDamage = false;

            foreach (AbstractHealthDamageEvent dl in damageLogs)
            {
                IsIndirectDamage = IsIndirectDamage || dl is NonDirectHealthDamageEvent;
                int curdmg = dl.HealthDamage;
                totaldamage += curdmg;
                hits        += dl.DoubleProcHit ? 0 : 1;
                if (dl.HasHit)
                {
                    if (curdmg < mindamage)
                    {
                        mindamage = curdmg;
                    }
                    if (curdmg > maxdamage)
                    {
                        maxdamage = curdmg;
                    }
                    connectedHits++;
                    if (dl.HasCrit)
                    {
                        crit++;
                        critDamage += dl.HealthDamage;
                    }
                    if (dl.HasGlanced)
                    {
                        glance++;
                    }

                    if (dl.IsFlanking)
                    {
                        flank++;
                    }
                    if (dl.AgainstMoving)
                    {
                        againstMoving++;
                    }
                }

                shieldDamage += dl.ShieldDamage;
            }
            if (IsIndirectDamage)
            {
                if (!usedBoons.ContainsKey(skill.ID))
                {
                    if (boons.BuffsByIds.TryGetValue(skill.ID, out Buff buff))
                    {
                        usedBoons.Add(buff.ID, buff);
                    }
                    else
                    {
                        SkillItem aux     = skill;
                        var       auxBoon = new Buff(aux.Name, aux.ID, aux.Icon);
                        usedBoons.Add(auxBoon.ID, auxBoon);
                    }
                }
            }
            else
            {
                if (!usedSkills.ContainsKey(skill.ID))
                {
                    usedSkills.Add(skill.ID, skill);
                }
            }

            long timeCasting = 0;
            int  casts = 0, timeWasted = 0, timeSaved = 0;

            if (!IsIndirectDamage && castLogsBySkill != null && castLogsBySkill.TryGetValue(skill, out List <AbstractCastEvent> clList))
            {
                foreach (AbstractCastEvent cl in clList)
                {
                    if (phase.InInterval(cl.Time))
                    {
                        casts++;
                        switch (cl.Status)
                        {
                        case AbstractCastEvent.AnimationStatus.Interrupted:
                            timeWasted += cl.SavedDuration;
                            break;

                        case AbstractCastEvent.AnimationStatus.Reduced:
                            timeSaved += cl.SavedDuration;
                            break;
                        }
                    }
                    timeCasting += Math.Min(cl.EndTime, phase.End) - Math.Max(cl.Time, phase.Start);
                }
            }
            object[] skillItem =
            {
                IsIndirectDamage,
                skill.ID,
                totaldamage,
                mindamage == int.MaxValue ? 0 : mindamage,
                maxdamage == int.MinValue ? 0 : maxdamage,
                IsIndirectDamage ? 0 : casts,
                connectedHits,
                IsIndirectDamage ? 0 : crit,
                IsIndirectDamage ? 0 : flank,
                IsIndirectDamage ? 0 : glance,
                IsIndirectDamage ? 0 : -timeWasted / 1000.0,
                IsIndirectDamage ? 0 : timeSaved / 1000.0,
                shieldDamage,
                IsIndirectDamage ? 0 : critDamage,
                hits,
                IsIndirectDamage ? 0 : timeCasting,
                againstMoving
            };
            return(skillItem);
        }
        private static object[] GetHealingToItem(SkillItem skill, List <EXTAbstractHealingEvent> healingLogs, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBoons, BuffsContainer boons, PhaseData phase)
        {
            int totalhealing       = 0,
                totaldownedhealing = 0,
                minhealing         = int.MaxValue,
                maxhealing         = int.MinValue,
                hits = 0;
            bool isIndirectHealing = false;

            foreach (EXTAbstractHealingEvent dl in healingLogs)
            {
                isIndirectHealing = isIndirectHealing || dl is EXTNonDirectHealingEvent;
                int curdmg = dl.HealingDone;
                totalhealing += curdmg;
                hits++;
                if (curdmg < minhealing)
                {
                    minhealing = curdmg;
                }
                if (curdmg > maxhealing)
                {
                    maxhealing = curdmg;
                }
                if (dl.AgainstDowned)
                {
                    totaldownedhealing += dl.HealingDone;
                }
            }
            if (isIndirectHealing)
            {
                if (!usedBoons.ContainsKey(skill.ID))
                {
                    if (boons.BuffsByIds.TryGetValue(skill.ID, out Buff buff))
                    {
                        usedBoons.Add(buff.ID, buff);
                    }
                    else
                    {
                        SkillItem aux     = skill;
                        var       auxBoon = new Buff(aux.Name, aux.ID, aux.Icon);
                        usedBoons.Add(auxBoon.ID, auxBoon);
                    }
                }
            }
            else
            {
                if (!usedSkills.ContainsKey(skill.ID))
                {
                    usedSkills.Add(skill.ID, skill);
                }
            }
            if (castLogsBySkill != null && castLogsBySkill.ContainsKey(skill))
            {
                isIndirectHealing = false;
            }
            long timeCasting = 0;
            int  casts = 0, timeWasted = 0, timeSaved = 0;

            if (!isIndirectHealing && castLogsBySkill != null && castLogsBySkill.TryGetValue(skill, out List <AbstractCastEvent> clList))
            {
                foreach (AbstractCastEvent cl in clList)
                {
                    if (phase.InInterval(cl.Time))
                    {
                        casts++;
                        switch (cl.Status)
                        {
                        case AbstractCastEvent.AnimationStatus.Interrupted:
                            timeWasted += cl.SavedDuration;
                            break;

                        case AbstractCastEvent.AnimationStatus.Reduced:
                            timeSaved += cl.SavedDuration;
                            break;
                        }
                    }
                    timeCasting += Math.Min(cl.EndTime, phase.End) - Math.Max(cl.Time, phase.Start);
                }
            }
            object[] skillItem =
            {
                isIndirectHealing,
                skill.ID,
                totalhealing,
                minhealing == int.MaxValue ? 0 : minhealing,
                maxhealing == int.MinValue ? 0 : maxhealing,
                isIndirectHealing ? 0 : casts,
                isIndirectHealing ? 0 : -timeWasted / 1000.0,
                isIndirectHealing ? 0 : timeSaved / 1000.0,
                hits,
                isIndirectHealing ? 0 : timeCasting,
                totaldownedhealing
            };
            return(skillItem);
        }
        private static object[] GetDMGDtoItem(SkillItem skill, List <AbstractHealthDamageEvent> damageLogs, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <SkillItem, List <AbstractBreakbarDamageEvent> > breakbarLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBoons, BuffsContainer boons, PhaseData phase)
        {
            int totaldamage       = 0,
                mindamage         = int.MaxValue,
                maxdamage         = int.MinValue,
                hits              = 0,
                crit              = 0,
                critDamage        = 0,
                connectedHits     = 0,
                flank             = 0,
                againstMoving     = 0,
                glance            = 0,
                shieldDamage      = 0;
            bool IsIndirectDamage = false;

            foreach (AbstractHealthDamageEvent dl in damageLogs)
            {
                IsIndirectDamage = IsIndirectDamage || dl is NonDirectHealthDamageEvent;
                int curdmg = dl.HealthDamage;
                totaldamage += curdmg;
                hits        += dl.DoubleProcHit ? 0 : 1;
                if (dl.HasHit)
                {
                    if (curdmg < mindamage)
                    {
                        mindamage = curdmg;
                    }
                    if (curdmg > maxdamage)
                    {
                        maxdamage = curdmg;
                    }
                    connectedHits++;
                    if (dl.HasCrit)
                    {
                        crit++;
                        critDamage += dl.HealthDamage;
                    }
                    if (dl.HasGlanced)
                    {
                        glance++;
                    }

                    if (dl.IsFlanking)
                    {
                        flank++;
                    }
                    if (dl.AgainstMoving)
                    {
                        againstMoving++;
                    }
                }

                shieldDamage += dl.ShieldDamage;
            }
            if (IsIndirectDamage)
            {
                if (!usedBoons.ContainsKey(skill.ID))
                {
                    if (boons.BuffsByIds.TryGetValue(skill.ID, out Buff buff))
                    {
                        usedBoons.Add(buff.ID, buff);
                    }
                    else
                    {
                        SkillItem aux     = skill;
                        var       auxBoon = new Buff(aux.Name, aux.ID, aux.Icon);
                        usedBoons.Add(auxBoon.ID, auxBoon);
                    }
                }
            }
            else
            {
                if (!usedSkills.ContainsKey(skill.ID))
                {
                    usedSkills.Add(skill.ID, skill);
                }
            }

            long timeCasting = 0;
            int  casts = 0, timeWasted = 0, timeSaved = 0;

            if (!IsIndirectDamage && castLogsBySkill != null && castLogsBySkill.TryGetValue(skill, out List <AbstractCastEvent> clList))
            {
                (timeCasting, casts, timeSaved, timeWasted) = GetCastValues(clList, phase);
                castLogsBySkill.Remove(skill);
            }
            double breakbarDamage = 0.0;

            if (breakbarLogsBySkill.TryGetValue(skill, out List <AbstractBreakbarDamageEvent> brList))
            {
                breakbarDamage = brList.Sum(x => x.BreakbarDamage);
                breakbarLogsBySkill.Remove(skill);
            }
            object[] skillItem =
            {
                IsIndirectDamage,
                skill.ID,
                totaldamage,
                mindamage == int.MaxValue ? 0 : mindamage,
                maxdamage == int.MinValue ? 0 : maxdamage,
                IsIndirectDamage ? 0 : casts,
                connectedHits,
                IsIndirectDamage ? 0 : crit,
                IsIndirectDamage ? 0 : flank,
                IsIndirectDamage ? 0 : glance,
                IsIndirectDamage ? 0 : -timeWasted / 1000.0,
                IsIndirectDamage ? 0 : timeSaved / 1000.0,
                shieldDamage,
                IsIndirectDamage ? 0 : critDamage,
                hits,
                IsIndirectDamage ? 0 : timeCasting,
                againstMoving,
                Math.Round(breakbarDamage, 1)
            };
            return(skillItem);
        }
        public static object[] GetDMGDtoItem(KeyValuePair <SkillItem, List <AbstractDamageEvent> > entry, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBoons, BuffsContainer 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.BuffsByIds.TryGetValue(entry.Key.ID, out Buff buff))
                    {
                        usedBoons.Add(buff.ID, buff);
                    }
                    else
                    {
                        SkillItem aux     = entry.Key;
                        var       auxBoon = new Buff(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)
                {
                    switch (cl.Status)
                    {
                    case AbstractCastEvent.AnimationStatus.Iterrupted:
                        timeswasted += cl.SavedDuration;
                        break;

                    case AbstractCastEvent.AnimationStatus.Reduced:
                        timessaved += cl.SavedDuration;
                        break;
                    }
                }
            }
            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);
        }
 public PlayerData(StatsContainer stats, BuffsContainer buffs)
 {
     Stats = stats;
     Buffs = buffs;
 }
        internal ParsedEvtcLog(int evtcVersion, FightData fightData, AgentData agentData, SkillData skillData,
                               List <CombatItem> combatItems, List <Player> playerList, IReadOnlyDictionary <uint, AbstractExtensionHandler> extensions, long evtcLogDuration, EvtcParserSettings parserSettings, ParserController operation)
        {
            FightData      = fightData;
            AgentData      = agentData;
            SkillData      = skillData;
            PlayerList     = playerList;
            PlayerAgents   = new HashSet <AgentItem>(PlayerList.Select(x => x.AgentItem));
            ParserSettings = parserSettings;
            _operation     = operation;
            if (parserSettings.AnonymousPlayer)
            {
                operation.UpdateProgressWithCancellationCheck("Anonymous players");
                for (int i = 0; i < PlayerList.Count; i++)
                {
                    PlayerList[i].Anonymize(i + 1);
                }
                IReadOnlyList <AgentItem> allPlayerAgents = agentData.GetAgentByType(AgentItem.AgentType.Player);
                int playerOffset = PlayerList.Count;
                foreach (AgentItem playerAgent in allPlayerAgents)
                {
                    if (!PlayerAgents.Contains(playerAgent))
                    {
                        string character = "Player " + playerOffset;
                        string account   = "Account " + (playerOffset++);
                        playerAgent.OverrideName(character + "\0:" + account + "\01");
                    }
                }
            }
            //
            _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Combat Events");
            CombatData = new CombatData(combatItems, FightData, AgentData, SkillData, PlayerList, operation, extensions, evtcVersion);
            if (parserSettings.AnonymousPlayer)
            {
                operation.UpdateProgressWithCancellationCheck("Anonymous guilds");
                IReadOnlyList <AgentItem> allPlayerAgents = agentData.GetAgentByType(AgentItem.AgentType.Player);
                foreach (AgentItem playerAgent in allPlayerAgents)
                {
                    foreach (GuildEvent guildEvent in CombatData.GetGuildEvents(playerAgent))
                    {
                        guildEvent.Anonymize();
                    }
                }
            }
            //
            operation.UpdateProgressWithCancellationCheck("Checking CM");
            FightData.SetEncounterMode(CombatData, AgentData);
            operation.UpdateProgressWithCancellationCheck("Setting Fight Name");
            FightData.SetFightName(CombatData, AgentData);
            //
            var friendlies = new List <AbstractSingleActor>();

            friendlies.AddRange(PlayerList);
            friendlies.AddRange(fightData.Logic.NonPlayerFriendlies);
            Friendlies           = friendlies;
            FriendliesListBySpec = friendlies.GroupBy(x => x.Spec).ToDictionary(x => x.Key, x => x.ToList());
            FriendlyAgents       = new HashSet <AgentItem>(Friendlies.Select(x => x.AgentItem));
            //
            _operation.UpdateProgressWithCancellationCheck("Checking Success");
            FightData.Logic.CheckSuccess(CombatData, AgentData, FightData, PlayerAgents);
            if (FightData.FightDuration <= ParserSettings.TooShortLimit)
            {
                throw new TooShortException(FightData.FightDuration, ParserSettings.TooShortLimit);
            }
            if (ParserSettings.SkipFailedTries && !FightData.Success)
            {
                throw new SkipException();
            }
            _operation.UpdateProgressWithCancellationCheck("Creating GW2EI Log Meta Data");
            LogData = new LogData(evtcVersion, CombatData, evtcLogDuration, playerList, extensions, operation);
            //
            _operation.UpdateProgressWithCancellationCheck("Creating Buff Container");
            Buffs = new BuffsContainer(LogData.GW2Build, CombatData, operation);
            _operation.UpdateProgressWithCancellationCheck("Creating Damage Modifier Container");
            DamageModifiers = new DamageModifiersContainer(LogData.GW2Build, fightData.Logic.Mode, parserSettings);
            _operation.UpdateProgressWithCancellationCheck("Creating Mechanic Data");
            MechanicData = FightData.Logic.GetMechanicData();
            _operation.UpdateProgressWithCancellationCheck("Creating General Statistics Container");
            StatisticsHelper = new StatisticsHelper(CombatData, PlayerList, Buffs);
        }