Ejemplo n.º 1
0
        public static void AddStateChangeEvent(CombatItem stateChangeEvent, AgentData agentData, SkillData skillData, MetaEventsContainer metaDataEvents, StatusEventsContainer statusEvents, List <RewardEvent> rewardEvents, List <WeaponSwapEvent> wepSwaps, List <AbstractBuffEvent> buffEvents)
        {
            switch (stateChangeEvent.IsStateChange)
            {
            case ArcDPSEnums.StateChange.EnterCombat:
                var enterCombatEvt = new EnterCombatEvent(stateChangeEvent, agentData);
                Add(statusEvents.EnterCombatEvents, enterCombatEvt.Src, enterCombatEvt);
                break;

            case ArcDPSEnums.StateChange.ExitCombat:
                var exitCombatEvt = new ExitCombatEvent(stateChangeEvent, agentData);
                Add(statusEvents.ExitCombatEvents, exitCombatEvt.Src, exitCombatEvt);
                break;

            case ArcDPSEnums.StateChange.ChangeUp:
                var aliveEvt = new AliveEvent(stateChangeEvent, agentData);
                Add(statusEvents.AliveEvents, aliveEvt.Src, aliveEvt);
                break;

            case ArcDPSEnums.StateChange.ChangeDead:
                var deadEvt = new DeadEvent(stateChangeEvent, agentData);
                Add(statusEvents.DeadEvents, deadEvt.Src, deadEvt);
                break;

            case ArcDPSEnums.StateChange.ChangeDown:
                var downEvt = new DownEvent(stateChangeEvent, agentData);
                Add(statusEvents.DownEvents, downEvt.Src, downEvt);
                break;

            case ArcDPSEnums.StateChange.Spawn:
                var spawnEvt = new SpawnEvent(stateChangeEvent, agentData);
                Add(statusEvents.SpawnEvents, spawnEvt.Src, spawnEvt);
                break;

            case ArcDPSEnums.StateChange.Despawn:
                var despawnEvt = new DespawnEvent(stateChangeEvent, agentData);
                Add(statusEvents.DespawnEvents, despawnEvt.Src, despawnEvt);
                break;

            case ArcDPSEnums.StateChange.HealthUpdate:
                var healthEvt = new HealthUpdateEvent(stateChangeEvent, agentData);
                Add(statusEvents.HealthUpdateEvents, healthEvt.Src, healthEvt);
                break;

            case ArcDPSEnums.StateChange.BarrierUpdate:
                var barrierEvt = new BarrierUpdateEvent(stateChangeEvent, agentData);
                Add(statusEvents.BarrierUpdateEvents, barrierEvt.Src, barrierEvt);
                break;

            case ArcDPSEnums.StateChange.InstanceStart:
                metaDataEvents.InstanceStartEvent = new InstanceStartEvent(stateChangeEvent);
                break;

            case ArcDPSEnums.StateChange.LogStart:
                if (stateChangeEvent.Value == 0 || stateChangeEvent.BuffDmg == 0)
                {
                    return;
                }
                metaDataEvents.LogStartEvent = new LogStartEvent(stateChangeEvent);
                break;

            case ArcDPSEnums.StateChange.LogEnd:
                if (stateChangeEvent.Value == 0 || stateChangeEvent.BuffDmg == 0)
                {
                    return;
                }
                metaDataEvents.LogEndEvent = new LogEndEvent(stateChangeEvent);
                break;

            case ArcDPSEnums.StateChange.MaxHealthUpdate:
                var maxHealthEvt = new MaxHealthUpdateEvent(stateChangeEvent, agentData);
                Add(statusEvents.MaxHealthUpdateEvents, maxHealthEvt.Src, maxHealthEvt);
                break;

            case ArcDPSEnums.StateChange.PointOfView:
                if (stateChangeEvent.SrcAgent == 0)
                {
                    return;
                }
                metaDataEvents.PointOfViewEvent = new PointOfViewEvent(stateChangeEvent, agentData);
                break;

            case ArcDPSEnums.StateChange.Language:
                metaDataEvents.LanguageEvent = new LanguageEvent(stateChangeEvent);
                break;

            case ArcDPSEnums.StateChange.GWBuild:
                if (stateChangeEvent.SrcAgent == 0)
                {
                    return;
                }
                metaDataEvents.BuildEvent = new BuildEvent(stateChangeEvent);
                break;

            case ArcDPSEnums.StateChange.ShardId:
                metaDataEvents.ShardEvents.Add(new ShardEvent(stateChangeEvent));
                break;

            case ArcDPSEnums.StateChange.Reward:
#if !NO_REWARDS
                rewardEvents.Add(new RewardEvent(stateChangeEvent));
#endif
                break;

            case ArcDPSEnums.StateChange.TeamChange:
                var tcEvt = new TeamChangeEvent(stateChangeEvent, agentData);
                Add(statusEvents.TeamChangeEvents, tcEvt.Src, tcEvt);
                break;

            case ArcDPSEnums.StateChange.AttackTarget:
                var aTEvt = new AttackTargetEvent(stateChangeEvent, agentData);
                Add(statusEvents.AttackTargetEvents, aTEvt.Src, aTEvt);
                break;

            case ArcDPSEnums.StateChange.Targetable:
                var tarEvt = new TargetableEvent(stateChangeEvent, agentData);
                Add(statusEvents.TargetableEvents, tarEvt.Src, tarEvt);
                break;

            case ArcDPSEnums.StateChange.MapID:
                metaDataEvents.MapIDEvents.Add(new MapIDEvent(stateChangeEvent));
                break;

            case ArcDPSEnums.StateChange.Guild:
                var gEvt = new GuildEvent(stateChangeEvent, agentData);
                Add(metaDataEvents.GuildEvents, gEvt.Src, gEvt);
                break;

            case ArcDPSEnums.StateChange.BuffInfo:
            case ArcDPSEnums.StateChange.BuffFormula:
                if (metaDataEvents.BuffInfoEvents.TryGetValue(stateChangeEvent.SkillID, out BuffInfoEvent buffInfoEvent))
                {
                    buffInfoEvent.CompleteBuffInfoEvent(stateChangeEvent);
                }
                else
                {
                    buffInfoEvent = new BuffInfoEvent(stateChangeEvent);
                    metaDataEvents.BuffInfoEvents[stateChangeEvent.SkillID] = buffInfoEvent;
                }
                if (stateChangeEvent.IsStateChange == ArcDPSEnums.StateChange.BuffInfo)
                {
                    if (metaDataEvents.BuffInfoEventsByCategory.TryGetValue(buffInfoEvent.Category, out List <BuffInfoEvent> bdEvtList))
                    {
                        bdEvtList.Add(buffInfoEvent);
                    }
                    else
                    {
                        metaDataEvents.BuffInfoEventsByCategory[buffInfoEvent.Category] = new List <BuffInfoEvent> {
                            buffInfoEvent
                        };
                    }
                }
                break;

            case ArcDPSEnums.StateChange.SkillInfo:
            case ArcDPSEnums.StateChange.SkillTiming:
                if (metaDataEvents.SkillInfoEvents.TryGetValue(stateChangeEvent.SkillID, out SkillInfoEvent skillInfoEvent))
                {
                    skillInfoEvent.CompleteSkillInfoEvent(stateChangeEvent);
                }
                else
                {
                    skillInfoEvent = new SkillInfoEvent(stateChangeEvent);
                    metaDataEvents.SkillInfoEvents[stateChangeEvent.SkillID] = skillInfoEvent;
                }
                break;

            case ArcDPSEnums.StateChange.BreakbarState:
                var bSEvt = new BreakbarStateEvent(stateChangeEvent, agentData);
                Add(statusEvents.BreakbarStateEvents, bSEvt.Src, bSEvt);
                break;

            case ArcDPSEnums.StateChange.BreakbarPercent:
                var bPEvt = new BreakbarPercentEvent(stateChangeEvent, agentData);
                Add(statusEvents.BreakbarPercentEvents, bPEvt.Src, bPEvt);
                break;

            case ArcDPSEnums.StateChange.Error:
                metaDataEvents.ErrorEvents.Add(new ErrorEvent(stateChangeEvent));
                break;

            case ArcDPSEnums.StateChange.Tag:
                // Getting ready in case this becomes an actual state event
                _ = new TagEvent(stateChangeEvent, agentData);
                //Add(metaDataEvents.TagEvents, tagEvt.Src, tagEvt);
                break;

            case ArcDPSEnums.StateChange.Velocity:
                var velEvt = new VelocityEvent(stateChangeEvent, agentData);
                Add(statusEvents.MovementEvents, velEvt.Src, velEvt);
                break;

            case ArcDPSEnums.StateChange.Rotation:
                var rotEvt = new RotationEvent(stateChangeEvent, agentData);
                Add(statusEvents.MovementEvents, rotEvt.Src, rotEvt);
                break;

            case ArcDPSEnums.StateChange.Position:
                var posEvt = new PositionEvent(stateChangeEvent, agentData);
                Add(statusEvents.MovementEvents, posEvt.Src, posEvt);
                break;

            case ArcDPSEnums.StateChange.WeaponSwap:
                wepSwaps.Add(new WeaponSwapEvent(stateChangeEvent, agentData, skillData));
                break;

            case ArcDPSEnums.StateChange.StackActive:
                buffEvents.Add(new BuffStackActiveEvent(stateChangeEvent, agentData, skillData));
                break;

            case ArcDPSEnums.StateChange.StackReset:
                buffEvents.Add(new BuffStackResetEvent(stateChangeEvent, agentData, skillData));
                break;

            case ArcDPSEnums.StateChange.BuffInitial:
                buffEvents.Add(new BuffApplyEvent(stateChangeEvent, agentData, skillData));
                break;

            default:
                break;
            }
        }
 internal BuffRemoveSingleEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     _iff           = evtcItem.IFF;
     BuffInstance   = evtcItem.Pad;
     _removedActive = evtcItem.IsShields > 0;
 }
 internal AbstractBuffStackEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, skillData)
 {
     To = agentData.GetAgent(evtcItem.SrcAgent);
 }
 internal NonDirectBreakbarDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     BreakbarDamage = evtcItem.BuffDmg / 10.0;
 }
 internal NonDirectBreakbarDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     BreakbarDamage = evtcItem.BuffDmg / 10.0;
     _cycle         = GetBuffCycle(evtcItem.IsOffcycle);
 }
        public static List <AbstractDamageEvent> CreateDamageEvents(List <CombatItem> damageEvents, AgentData agentData, SkillData skillData)
        {
            var res = new List <AbstractDamageEvent>();

            foreach (CombatItem c in damageEvents)
            {
                if ((c.IsBuff != 0 && c.Value == 0))
                {
                    res.Add(new NonDirectDamageEvent(c, agentData, skillData));
                }
                else if (c.IsBuff == 0)
                {
                    res.Add(new DirectDamageEvent(c, agentData, skillData));
                }
            }
            return(res);
        }
Ejemplo n.º 7
0
 public bool IsDodge(SkillData skillData) => IsAnimatedDodge(skillData) || ID == MirageCloakDodge;
 internal BuffRemoveAllEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     _lastRemovedDuration = evtcItem.BuffDmg;
     RemovedStacks        = evtcItem.Result;
 }
        private void EIDamageParse(SkillData skillData, FightData fightData)
        {
            var toAdd = new List <AbstractHealthDamageEvent>();

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

            foreach (AbstractHealthDamageEvent de in toAdd)
            {
                if (_damageTakenData.TryGetValue(de.To, out List <AbstractHealthDamageEvent> damageTakenList))
                {
                    damageTakenList.Add(de);
                }
                else
                {
                    _damageTakenData[de.To] = new List <AbstractHealthDamageEvent>()
                    {
                        de
                    };
                }
                dstToSort.Add(de.To);
                if (_damageData.TryGetValue(de.From, out List <AbstractHealthDamageEvent> damageDoneList))
                {
                    damageDoneList.Add(de);
                }
                else
                {
                    _damageData[de.From] = new List <AbstractHealthDamageEvent>()
                    {
                        de
                    };
                }
                srcToSort.Add(de.From);
                if (_damageDataById.TryGetValue(de.SkillId, out List <AbstractHealthDamageEvent> damageDoneByIDList))
                {
                    damageDoneByIDList.Add(de);
                }
                else
                {
                    _damageDataById[de.SkillId] = new List <AbstractHealthDamageEvent>()
                    {
                        de
                    };
                }
                idsToSort.Add(de.SkillId);
            }
            foreach (long buffID in idsToSort)
            {
                _damageDataById[buffID] = _damageDataById[buffID].OrderBy(x => x.Time).ToList();
            }
            foreach (AgentItem a in dstToSort)
            {
                _damageTakenData[a] = _damageTakenData[a].OrderBy(x => x.Time).ToList();
            }
            foreach (AgentItem a in srcToSort)
            {
                _damageData[a] = _damageData[a].OrderBy(x => x.Time).ToList();
            }
        }
Ejemplo n.º 10
0
        public static void AddDirectDamageEvent(CombatItem damageEvent, List <AbstractHealthDamageEvent> hpDamage, List <AbstractBreakbarDamageEvent> brkBarDamage, AgentData agentData, SkillData skillData)
        {
            ArcDPSEnums.PhysicalResult result = ArcDPSEnums.GetPhysicalResult(damageEvent.Result);
            switch (result)
            {
            case ArcDPSEnums.PhysicalResult.BreakbarDamage:
                brkBarDamage.Add(new DirectBreakbarDamageEvent(damageEvent, agentData, skillData));
                break;

            case ArcDPSEnums.PhysicalResult.Activation:
            case ArcDPSEnums.PhysicalResult.Unknown:
                break;

            default:
                hpDamage.Add(new DirectHealthDamageEvent(damageEvent, agentData, skillData, result));
                break;
            }
        }
Ejemplo n.º 11
0
        public static void AddIndirectDamageEvent(CombatItem damageEvent, List <AbstractHealthDamageEvent> hpDamage, List <AbstractBreakbarDamageEvent> brkBarDamage, AgentData agentData, SkillData skillData)
        {
            ArcDPSEnums.ConditionResult result = ArcDPSEnums.GetConditionResult(damageEvent.Result);
            switch (result)
            {
            /*case ArcDPSEnums.ConditionResult.BreakbarDamage:
             *  brkBarDamage.Add(new NonDirectBreakbarDamageEvent(c, agentData, skillData));
             *  break;*/
            case ArcDPSEnums.ConditionResult.Unknown:
                break;

            default:
                hpDamage.Add(new NonDirectHealthDamageEvent(damageEvent, agentData, skillData, result));
                break;
            }
        }
Ejemplo n.º 12
0
        public static List <AnimatedCastEvent> CreateCastEvents(Dictionary <ulong, List <CombatItem> > castEventsBySrcAgent, AgentData agentData, SkillData skillData, FightData fightData)
        {
            var res = new List <AnimatedCastEvent>();

            foreach (KeyValuePair <ulong, List <CombatItem> > pairBySrcAgent in castEventsBySrcAgent)
            {
                var resBySrcAgent = new List <AnimatedCastEvent>();
                var castEventsBySrcAgentBySkillID = pairBySrcAgent.Value.GroupBy(x => x.SkillID).ToDictionary(x => x.Key, x => x.ToList());
                foreach (KeyValuePair <uint, List <CombatItem> > pairBySrcAgentBySkillID in castEventsBySrcAgentBySkillID)
                {
                    var        resBySrcAgentBySkillID = new List <AnimatedCastEvent>();
                    CombatItem startItem = null;
                    foreach (CombatItem c in pairBySrcAgentBySkillID.Value)
                    {
                        if (c.StartCasting())
                        {
                            // missing end
                            if (startItem != null)
                            {
                                resBySrcAgentBySkillID.Add(new AnimatedCastEvent(startItem, agentData, skillData, fightData.LogEnd));
                            }
                            startItem = c;
                        }
                        else if (c.EndCasting())
                        {
                            if (startItem != null && startItem.SkillID == c.SkillID)
                            {
                                resBySrcAgentBySkillID.Add(new AnimatedCastEvent(startItem, agentData, skillData, c));
                                startItem = null;
                            }
                            // missing start
                            else
                            {
                                var toCheck = new AnimatedCastEvent(agentData, skillData, c);
                                // we are only interested in animations started before log starts
                                if (toCheck.Time < fightData.LogStart)
                                {
                                    resBySrcAgentBySkillID.Add(toCheck);
                                }
                            }
                        }
                    }
                    // missing end
                    if (startItem != null)
                    {
                        resBySrcAgentBySkillID.Add(new AnimatedCastEvent(startItem, agentData, skillData, fightData.LogEnd));
                    }
                    resBySrcAgentBySkillID.RemoveAll(x => x.ActualDuration <= 1);
                    resBySrcAgent.AddRange(resBySrcAgentBySkillID);
                }
                resBySrcAgent = resBySrcAgent.OrderBy(x => x.Time).ToList();
                // sanitize
                for (int i = 0; i < resBySrcAgent.Count - 1; i++)
                {
                    resBySrcAgent[i].CutAt(resBySrcAgent[i + 1].Time + ParserHelper.ServerDelayConstant);
                }
                res.AddRange(resBySrcAgent);
            }
            res = res.OrderBy(x => x.Time).ToList();
            return(res);
        }
Ejemplo n.º 13
0
        public static void AddBuffRemoveEvent(CombatItem buffEvent, List <AbstractBuffEvent> buffEvents, AgentData agentData, SkillData skillData)
        {
            switch (buffEvent.IsBuffRemove)
            {
            case ArcDPSEnums.BuffRemove.Single:
                buffEvents.Add(new BuffRemoveSingleEvent(buffEvent, agentData, skillData));
                break;

            case ArcDPSEnums.BuffRemove.All:
                buffEvents.Add(new BuffRemoveAllEvent(buffEvent, agentData, skillData));
                break;

            case ArcDPSEnums.BuffRemove.Manual:
                buffEvents.Add(new BuffRemoveManualEvent(buffEvent, agentData, skillData));
                break;
            }
        }
Ejemplo n.º 14
0
 public static void AddBuffApplyEvent(CombatItem buffEvent, List <AbstractBuffEvent> buffEvents, AgentData agentData, SkillData skillData)
 {
     if (buffEvent.IsOffcycle > 0)
     {
         buffEvents.Add(new BuffExtensionEvent(buffEvent, agentData, skillData));
     }
     else
     {
         buffEvents.Add(new BuffApplyEvent(buffEvent, agentData, skillData));
     }
 }
        public static List <AbstractBuffEvent> CreateBuffEvents(List <CombatItem> buffEvents, AgentData agentData, SkillData skillData)
        {
            var res = new List <AbstractBuffEvent>();

            foreach (CombatItem c in buffEvents)
            {
                switch (c.IsStateChange)
                {
                case ArcDPSEnums.StateChange.StackActive:
                    res.Add(new BuffStackActiveEvent(c, agentData, skillData));
                    break;

                case ArcDPSEnums.StateChange.StackReset:
                    res.Add(new BuffStackResetEvent(c, agentData, skillData));
                    break;

                default:
                    switch (c.IsBuffRemove)
                    {
                    case ArcDPSEnums.BuffRemove.None:
                        if (c.IsOffcycle > 0)
                        {
                            res.Add(new BuffExtensionEvent(c, agentData, skillData));
                        }
                        else
                        {
                            res.Add(new BuffApplyEvent(c, agentData, skillData));
                        }
                        break;

                    case ArcDPSEnums.BuffRemove.Single:
                        res.Add(new BuffRemoveSingleEvent(c, agentData, skillData));
                        break;

                    case ArcDPSEnums.BuffRemove.All:
                        res.Add(new BuffRemoveAllEvent(c, agentData, skillData));
                        break;

                    case ArcDPSEnums.BuffRemove.Manual:
                        res.Add(new BuffRemoveManualEvent(c, agentData, skillData));
                        break;
                    }
                    break;
                }
            }
            return(res);
        }
 internal BuffRemoveManualEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
 }
        public static List <AnimatedCastEvent> CreateCastEvents(List <CombatItem> castEvents, AgentData agentData, SkillData skillData)
        {
            var res = new List <AnimatedCastEvent>();
            var castEventsBySrcAgent = castEvents.GroupBy(x => x.SrcAgent).ToDictionary(x => x.Key, x => x.ToList());

            foreach (KeyValuePair <ulong, List <CombatItem> > pair in castEventsBySrcAgent)
            {
                CombatItem startItem = null;
                foreach (CombatItem c in pair.Value)
                {
                    if (c.IsActivation.StartCasting())
                    {
                        // missing end
                        if (startItem != null)
                        {
                            res.Add(new AnimatedCastEvent(startItem, agentData, skillData, c.Time));
                        }
                        startItem = c;
                    }
                    else if (c.IsActivation.EndCasting())
                    {
                        if (startItem != null && startItem.SkillID == c.SkillID)
                        {
                            res.Add(new AnimatedCastEvent(startItem, c, agentData, skillData));
                            startItem = null;
                        }
                    }
                }
            }
            res.Sort((x, y) => x.Time.CompareTo(y.Time));
            return(res);
        }
 internal BuffExtensionEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     _oldValue       = evtcItem.OverstackValue - evtcItem.Value;
     _durationChange = evtcItem.Value;
 }
 internal AbstractBuffApplyEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, skillData)
 {
     By           = agentData.GetAgent(evtcItem.SrcAgent);
     To           = agentData.GetAgent(evtcItem.DstAgent);
     BuffInstance = evtcItem.Pad;
 }
        private void EICastParse(List <Player> players, SkillData skillData, FightData fightData, AgentData agentData)
        {
            List <AbstractCastEvent> toAdd = fightData.Logic.SpecialCastEventProcess(_animatedCastData, _weaponSwapData, _animatedCastDataById, skillData);

            toAdd.AddRange(ProfHelper.ComputeInstantCastEvents(players, this, skillData, agentData));
            //
            var castIDsToSort       = new HashSet <long>();
            var castAgentsToSort    = new HashSet <AgentItem>();
            var wepSwapAgentsToSort = new HashSet <AgentItem>();
            var instantAgentsToSort = new HashSet <AgentItem>();

            foreach (AbstractCastEvent cast in toAdd)
            {
                if (cast is AnimatedCastEvent ace)
                {
                    if (_animatedCastData.TryGetValue(ace.Caster, out List <AnimatedCastEvent> list1))
                    {
                        list1.Add(ace);
                    }
                    else
                    {
                        _animatedCastData[ace.Caster] = new List <AnimatedCastEvent>()
                        {
                            ace
                        };
                    }
                    castAgentsToSort.Add(ace.Caster);
                    if (_animatedCastDataById.TryGetValue(ace.SkillId, out List <AnimatedCastEvent> list2))
                    {
                        list2.Add(ace);
                    }
                    else
                    {
                        _animatedCastDataById[cast.SkillId] = new List <AnimatedCastEvent>()
                        {
                            ace
                        };
                    }
                    castIDsToSort.Add(cast.SkillId);
                }
                if (cast is WeaponSwapEvent wse)
                {
                    if (_weaponSwapData.TryGetValue(wse.Caster, out List <WeaponSwapEvent> list1))
                    {
                        list1.Add(wse);
                    }
                    else
                    {
                        _weaponSwapData[wse.Caster] = new List <WeaponSwapEvent>()
                        {
                            wse
                        };
                    }
                    wepSwapAgentsToSort.Add(wse.Caster);
                }
                if (cast is InstantCastEvent ice)
                {
                    if (_instantCastData.TryGetValue(ice.Caster, out List <InstantCastEvent> list1))
                    {
                        list1.Add(ice);
                    }
                    else
                    {
                        _instantCastData[ice.Caster] = new List <InstantCastEvent>()
                        {
                            ice
                        };
                    }
                    instantAgentsToSort.Add(ice.Caster);
                }
            }
            foreach (long buffID in castIDsToSort)
            {
                _animatedCastDataById[buffID].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
            foreach (AgentItem a in castAgentsToSort)
            {
                _animatedCastData[a].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
            foreach (AgentItem a in wepSwapAgentsToSort)
            {
                _weaponSwapData[a].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
            foreach (AgentItem a in instantAgentsToSort)
            {
                _instantCastData[a].Sort((x, y) => x.Time.CompareTo(y.Time));
            }
        }
Ejemplo n.º 21
0
 public bool IsAnimatedDodge(SkillData skillData) => ID == skillData.DodgeId || VindicatorHelper.IsVindicatorDodge(ID);
        internal CombatData(List <CombatItem> allCombatItems, FightData fightData, AgentData agentData, SkillData skillData, List <Player> players, ParserController operation)
        {
            _skillIds = new HashSet <long>();
            var castCombatEvents = new Dictionary <ulong, List <CombatItem> >();
            var buffEvents       = new List <AbstractBuffEvent>();
            var wepSwaps         = new List <WeaponSwapEvent>();
            var brkDamageData    = new List <AbstractBreakbarDamageEvent>();
            var damageData       = new List <AbstractHealthDamageEvent>();

            operation.UpdateProgressWithCancellationCheck("Creating EI Combat Data");
            foreach (CombatItem combatItem in allCombatItems)
            {
                _skillIds.Add(combatItem.SkillID);
                if (combatItem.IsStateChange != ArcDPSEnums.StateChange.None)
                {
                    CombatEventFactory.AddStateChangeEvent(combatItem, agentData, skillData, _metaDataEvents, _statusEvents, _rewardEvents, wepSwaps, buffEvents);
                }
                else if (combatItem.IsActivation != ArcDPSEnums.Activation.None)
                {
                    if (castCombatEvents.TryGetValue(combatItem.SrcAgent, out List <CombatItem> list))
                    {
                        list.Add(combatItem);
                    }
                    else
                    {
                        castCombatEvents[combatItem.SrcAgent] = new List <CombatItem>()
                        {
                            combatItem
                        };
                    }
                }
                else if (combatItem.IsBuffRemove != ArcDPSEnums.BuffRemove.None)
                {
                    CombatEventFactory.AddBuffRemoveEvent(combatItem, buffEvents, agentData, skillData);
                }
                else
                {
                    if (combatItem.IsBuff != 0 && combatItem.BuffDmg == 0 && combatItem.Value > 0)
                    {
                        CombatEventFactory.AddBuffApplyEvent(combatItem, buffEvents, agentData, skillData);
                    }
                    else if (combatItem.IsBuff == 0)
                    {
                        CombatEventFactory.AddDirectDamageEvent(combatItem, damageData, brkDamageData, agentData, skillData);
                    }
                    else if (combatItem.IsBuff != 0 && combatItem.Value == 0)
                    {
                        CombatEventFactory.AddIndirectDamageEvent(combatItem, damageData, brkDamageData, agentData, skillData);
                    }
                }
            }
            //HasStackIDs = buffEvents.Any(x => x is BuffStackActiveEvent || x is BuffStackResetEvent);
            HasMovementData       = _statusEvents.MovementEvents.Count > 1;
            HasBreakbarDamageData = brkDamageData.Any();
            //
            operation.UpdateProgressWithCancellationCheck("Combining SkillInfo with SkillData");
            skillData.CombineWithSkillInfo(_metaDataEvents.SkillInfoEvents);
            //
            operation.UpdateProgressWithCancellationCheck("Creating Cast Events");
            List <AnimatedCastEvent> animatedCastData = CombatEventFactory.CreateCastEvents(castCombatEvents, 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());
            _instantCastData      = new Dictionary <AgentItem, List <InstantCastEvent> >();
            _animatedCastDataById = animatedCastData.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());
            //
            operation.UpdateProgressWithCancellationCheck("Creating Buff Events");
            _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
            operation.UpdateProgressWithCancellationCheck("Creating Damage Events");
            _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());
            _breakbarDamageData      = brkDamageData.GroupBy(x => x.From).ToDictionary(x => x.Key, x => x.ToList());
            _breakbarDamageTakenData = brkDamageData.GroupBy(x => x.To).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, agentData, fightData, operation);
            _buffRemoveAllData = _buffData.ToDictionary(x => x.Key, x => x.Value.OfType <BuffRemoveAllEvent>().ToList());
        }
 internal BuffStackResetEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     BuffInstance     = evtcItem.Pad;
     _resetToDuration = evtcItem.Value;
 }
        private void EIDamageParse(SkillData skillData, FightData fightData)
        {
            var toAdd = new List <AbstractHealthDamageEvent>();

            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 (AbstractHealthDamageEvent de in toAdd)
            {
                if (_damageTakenData.TryGetValue(de.To, out List <AbstractHealthDamageEvent> list1))
                {
                    list1.Add(de);
                }
                else
                {
                    _damageTakenData[de.To] = new List <AbstractHealthDamageEvent>()
                    {
                        de
                    };
                }
                dstToSort.Add(de.To);
                if (_damageData.TryGetValue(de.From, out List <AbstractHealthDamageEvent> list3))
                {
                    list1.Add(de);
                }
                else
                {
                    _damageData[de.From] = new List <AbstractHealthDamageEvent>()
                    {
                        de
                    };
                }
                srcToSort.Add(de.To);
                if (_damageDataById.TryGetValue(de.SkillId, out List <AbstractHealthDamageEvent> list2))
                {
                    list2.Add(de);
                }
                else
                {
                    _damageDataById[de.SkillId] = new List <AbstractHealthDamageEvent>()
                    {
                        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));
            }
        }
 internal AbstractBuffEvent(CombatItem evtcItem, SkillData skillData) : base(evtcItem.Time)
 {
     BuffSkill = skillData.Get(evtcItem.SkillID);
 }
 internal AbstractHealthDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
 }
 internal NonDirectHealthDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData, ArcDPSEnums.ConditionResult result) : base(evtcItem, agentData, skillData)
 {
     HealthDamage = evtcItem.BuffDmg;
     IsAbsorbed   = result == ArcDPSEnums.ConditionResult.InvulByBuff ||
                    result == ArcDPSEnums.ConditionResult.InvulByPlayerSkill1 ||
                    result == ArcDPSEnums.ConditionResult.InvulByPlayerSkill2 ||
                    result == ArcDPSEnums.ConditionResult.InvulByPlayerSkill3;
     HasHit        = result == ArcDPSEnums.ConditionResult.ExpectedToHit;
     ShieldDamage  = evtcItem.IsShields > 0 ? HealthDamage : 0;
     _cycle        = GetBuffCycle(evtcItem.IsOffcycle);
     AgainstDowned = evtcItem.Pad1 == 1;
 }
        public static List <WeaponSwapEvent> CreateWeaponSwapEvents(List <CombatItem> swapEvents, AgentData agentData, SkillData skillData)
        {
            var res = new List <WeaponSwapEvent>();

            foreach (CombatItem swapEvent in swapEvents)
            {
                res.Add(new WeaponSwapEvent(swapEvent, agentData, skillData));
            }
            return(res);
        }
        internal AnimatedCastEvent(CombatItem startItem, CombatItem endItem, AgentData agentData, SkillData skillData) : this(startItem, agentData, skillData)
        {
            ActualDuration        = endItem.Value;
            _scaledActualDuration = endItem.BuffDmg;
            if (Skill.ID == SkillItem.DodgeId)
            {
                ExpectedDuration      = 750;
                ActualDuration        = 750;
                _scaledActualDuration = 0;
            }
            double nonScaledToScaledRatio = 1.0;

            if (_scaledActualDuration > 0)
            {
                nonScaledToScaledRatio = (double)_scaledActualDuration / ActualDuration;
                if (nonScaledToScaledRatio > 1.0)
                {
                    // faster
                    Acceleration = (nonScaledToScaledRatio - 1.0) / 0.66;
                }
                else
                {
                    Acceleration = -(1.0 - nonScaledToScaledRatio) / 0.5;
                }
                Acceleration = Math.Max(Math.Min(Acceleration, 1.0), -1.0);
            }
            switch (endItem.IsActivation)
            {
            case ArcDPSEnums.Activation.CancelCancel:
                Status        = AnimationStatus.Iterrupted;
                SavedDuration = -ActualDuration;
                break;

            case ArcDPSEnums.Activation.Reset:
                Status = AnimationStatus.Full;
                break;

            case ArcDPSEnums.Activation.CancelFire:
                int nonScaledExpectedDuration = (int)Math.Round(ExpectedDuration / nonScaledToScaledRatio);
                SavedDuration = Math.Max(nonScaledExpectedDuration - ActualDuration, 0);
                Status        = AnimationStatus.Reduced;
                break;
            }
        }
        public static List <AnimatedCastEvent> CreateCastEvents(Dictionary <ulong, List <CombatItem> > castEventsBySrcAgent, AgentData agentData, SkillData skillData)
        {
            var res = new List <AnimatedCastEvent>();

            foreach (KeyValuePair <ulong, List <CombatItem> > pair in castEventsBySrcAgent)
            {
#if DEBUG
                AgentItem a = agentData.GetAgent(pair.Key);
#endif
                CombatItem startItem = null;
                foreach (CombatItem c in pair.Value)
                {
                    if (c.IsActivation.StartCasting())
                    {
                        // missing end
                        if (startItem != null)
                        {
                            res.Add(new AnimatedCastEvent(startItem, agentData, skillData, c.Time));
                        }
                        startItem = c;
                    }
                    else if (c.IsActivation.EndCasting())
                    {
                        if (startItem != null && startItem.SkillID == c.SkillID)
                        {
                            res.Add(new AnimatedCastEvent(startItem, agentData, skillData, c));
                            startItem = null;
                        }
                        // missing start
                        else
                        {
                            var toCheck = new AnimatedCastEvent(agentData, skillData, c);
                            // only keep if list is empty as we are only interested in animations started before log starts
                            if (!res.Any())
                            {
                                res.Add(toCheck);
                            }
                        }
                    }
                }
                // missing end
                if (startItem != null)
                {
                    res.Add(new AnimatedCastEvent(startItem, agentData, skillData, long.MaxValue));
                }
            }
            res.Sort((x, y) => x.Time.CompareTo(y.Time));
            return(res);
        }