Ejemplo n.º 1
0
        public CombatData(List <CombatItem> allCombatItems, FightData fightData, AgentData agentData, SkillData skillData, List <Player> players)
        {
            _skillIds = new HashSet <long>(allCombatItems.Select(x => (long)x.SkillID));
            IEnumerable <CombatItem> noStateActiBuffRem = allCombatItems.Where(x => x.IsStateChange == ParseEnum.StateChange.None && x.IsActivation == ParseEnum.Activation.None && x.IsBuffRemove == ParseEnum.BuffRemove.None);

            // movement events
            _movementData = CombatEventFactory.CreateMovementEvents(allCombatItems.Where(x =>
                                                                                         x.IsStateChange == ParseEnum.StateChange.Position ||
                                                                                         x.IsStateChange == ParseEnum.StateChange.Velocity ||
                                                                                         x.IsStateChange == ParseEnum.StateChange.Rotation).ToList(), agentData);
            HasMovementData = _movementData.Count > 1;
            // state change events
            CombatEventFactory.CreateStateChangeEvents(allCombatItems, _metaDataEvents, _statusEvents, _rewardEvents, agentData);
            // activation events
            List <AnimatedCastEvent> animatedCastData = CombatEventFactory.CreateCastEvents(allCombatItems.Where(x => x.IsActivation != ParseEnum.Activation.None).ToList(), agentData, skillData);
            List <WeaponSwapEvent>   wepSwaps         = CombatEventFactory.CreateWeaponSwapEvents(allCombatItems.Where(x => x.IsStateChange == ParseEnum.StateChange.WeaponSwap).ToList(), agentData, skillData);

            _weaponSwapData   = wepSwaps.GroupBy(x => x.Caster).ToDictionary(x => x.Key, x => x.ToList());
            _animatedCastData = animatedCastData.GroupBy(x => x.Caster).ToDictionary(x => x.Key, x => x.ToList());
            var allCastEvents = new List <AbstractCastEvent>(animatedCastData);

            allCastEvents.AddRange(wepSwaps);
            _castDataById = allCastEvents.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());
            // buff remove event
            var buffCombatEvents = allCombatItems.Where(x => x.IsBuffRemove != ParseEnum.BuffRemove.None && x.IsBuff != 0).ToList();

            buffCombatEvents.AddRange(noStateActiBuffRem.Where(x => x.IsBuff != 0 && x.BuffDmg == 0 && x.Value > 0));
            buffCombatEvents.AddRange(allCombatItems.Where(x => x.IsStateChange == ParseEnum.StateChange.BuffInitial));
            buffCombatEvents.Sort((x, y) => x.Time.CompareTo(y.Time));
            List <AbstractBuffEvent> buffEvents = CombatEventFactory.CreateBuffEvents(buffCombatEvents, agentData, skillData);

            _buffDataByDst = buffEvents.GroupBy(x => x.To).ToDictionary(x => x.Key, x => x.ToList());
            _buffData      = buffEvents.GroupBy(x => x.BuffID).ToDictionary(x => x.Key, x => x.ToList());
            // damage events
            List <AbstractDamageEvent> damageData = CombatEventFactory.CreateDamageEvents(noStateActiBuffRem.Where(x => (x.IsBuff != 0 && x.Value == 0) || (x.IsBuff == 0)).ToList(), agentData, skillData);

            _damageData      = damageData.GroupBy(x => x.From).ToDictionary(x => x.Key, x => x.ToList());
            _damageTakenData = damageData.GroupBy(x => x.To).ToDictionary(x => x.Key, x => x.ToList());
            _damageDataById  = damageData.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            /*healing_data = allCombatItems.Where(x => x.getDstInstid() != 0 && x.isStateChange() == ParseEnum.StateChange.Normal && x.getIFF() == ParseEnum.IFF.Friend && x.isBuffremove() == ParseEnum.BuffRemove.None &&
             *                           ((x.isBuff() == 1 && x.getBuffDmg() > 0 && x.getValue() == 0) ||
             *                           (x.isBuff() == 0 && x.getValue() > 0))).ToList();
             *
             * healing_received_data = allCombatItems.Where(x => x.isStateChange() == ParseEnum.StateChange.Normal && x.getIFF() == ParseEnum.IFF.Friend && x.isBuffremove() == ParseEnum.BuffRemove.None &&
             *                              ((x.isBuff() == 1 && x.getBuffDmg() > 0 && x.getValue() == 0) ||
             *                                  (x.isBuff() == 0 && x.getValue() >= 0))).ToList();*/
            EIExtraEventProcess(players, skillData, fightData);
            _buffRemoveAllData = _buffData.ToDictionary(x => x.Key, x => x.Value.OfType <BuffRemoveAllEvent>().ToList());
        }
Ejemplo n.º 2
0
        private void EIDamageParse(SkillData skillData, FightData fightData)
        {
            var toAdd = new List <AbstractDamageEvent>();

            toAdd.AddRange(fightData.Logic.SpecialDamageEventProcess(_damageData, _damageTakenData, _damageDataById, skillData));
            var idsToSort = new HashSet <long>();
            var dstToSort = new HashSet <AgentItem>();
            var srcToSort = new HashSet <AgentItem>();

            foreach (AbstractDamageEvent de in toAdd)
            {
                if (_damageTakenData.TryGetValue(de.To, out List <AbstractDamageEvent> list1))
                {
                    list1.Add(de);
                }
                else
                {
                    _damageTakenData[de.To] = new List <AbstractDamageEvent>()
                    {
                        de
                    };
                }
                dstToSort.Add(de.To);
                if (_damageData.TryGetValue(de.From, out List <AbstractDamageEvent> list3))
                {
                    list1.Add(de);
                }
                else
                {
                    _damageData[de.From] = new List <AbstractDamageEvent>()
                    {
                        de
                    };
                }
                srcToSort.Add(de.To);
                if (_damageDataById.TryGetValue(de.SkillId, out List <AbstractDamageEvent> list2))
                {
                    list2.Add(de);
                }
                else
                {
                    _damageDataById[de.SkillId] = new List <AbstractDamageEvent>()
                    {
                        de
                    };
                }
                idsToSort.Add(de.SkillId);
            }
            foreach (long buffID in idsToSort)
            {
                _damageDataById[buffID].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
            foreach (AgentItem a in dstToSort)
            {
                _damageTakenData[a].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
            foreach (AgentItem a in srcToSort)
            {
                _damageData[a].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
        }
Ejemplo n.º 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);
 }