public override List <InstantCastEvent> ComputeInstantCast(CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var res     = new List <InstantCastEvent>();
            var applies = combatData.GetBuffData(BuffID).OfType <BuffApplyEvent>().GroupBy(x => x.By).ToDictionary(x => x.Key, x => x.ToList());

            foreach (KeyValuePair <AgentItem, List <BuffApplyEvent> > pair in applies)
            {
                long lastTime = int.MinValue;
                foreach (BuffApplyEvent bae in pair.Value)
                {
                    if (bae.Time - lastTime < ICD)
                    {
                        lastTime = bae.Time;
                        continue;
                    }
                    if (_triggerCondition != null)
                    {
                        if (_triggerCondition(bae, combatData))
                        {
                            lastTime = bae.Time;
                            res.Add(new InstantCastEvent(bae.Time, skillData.Get(SkillID), bae.By));
                        }
                    }
                    else
                    {
                        lastTime = bae.Time;
                        res.Add(new InstantCastEvent(bae.Time, skillData.Get(SkillID), bae.By));
                    }
                }
            }

            return(res);
        }
Пример #2
0
        public override List <InstantCastEvent> ComputeInstantCast(CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var res     = new List <InstantCastEvent>();
            var damages = combatData.GetDamageData(_damageSkillID).GroupBy(x => x.From).ToDictionary(x => x.Key, x => x.ToList());

            foreach (KeyValuePair <AgentItem, List <AbstractDamageEvent> > pair in damages)
            {
                long lastTime = int.MinValue;
                foreach (AbstractDamageEvent de in pair.Value)
                {
                    if (de.Time - lastTime < ICD)
                    {
                        lastTime = de.Time;
                        continue;
                    }
                    if (_triggerCondition != null)
                    {
                        if (_triggerCondition(de, combatData))
                        {
                            lastTime = de.Time;
                            res.Add(new InstantCastEvent(de.Time, skillData.Get(SkillID), de.From));
                        }
                    }
                    else
                    {
                        lastTime = de.Time;
                        res.Add(new InstantCastEvent(de.Time, skillData.Get(SkillID), de.From));
                    }
                }
            }
            return(res);
        }
Пример #3
0
 public WeaponSwapEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData, long offset) : base(evtcItem, agentData, skillData, offset)
 {
     SwappedTo        = (int)evtcItem.DstAgent;
     Skill            = skillData.Get(SkillItem.WeaponSwapId);
     ExpectedDuration = 50;
     ActualDuration   = 50;
 }
Пример #4
0
        public static void WriteCastingItemIcon(StreamWriter sw, CastLog cl, SkillData skillList, PhaseData phase, bool last)
        {
            SkillItem   skill    = skillList.Get(cl.SkillId);
            GW2APISkill skillApi = skill?.ApiSkill;
            float       offset   = (cl.Time - phase.Start) / 1000f;

            if ((skillApi != null && skillApi.slot != "Weapon_1") || skillApi == null)
            {
                sw.Write("{" +
                         "source: '" + skill.Icon + "'," +
                         "xref: 'x'," +
                         "yref: 'y'," +
                         "x: " + Math.Max(offset, 0.0f) + "," +
                         "y: 0," +
                         "sizex: 1.1," +
                         "sizey: 1.1," +
                         "xanchor: 'left'," +
                         "yanchor: 'bottom'" +
                         "}");
            }

            if (!last)
            {
                sw.Write(",");
            }
        }
Пример #5
0
        public AbstractBuffEvent(CombatItem evtcItem, SkillData skillData, long offset) : base(evtcItem.LogTime, offset)
        {
#if DEBUG
            OriginalCombatEvent = evtcItem;
#endif
            BuffSkill = skillData.Get(evtcItem.SkillID);
        }
Пример #6
0
 public AbstractCastEvent(CombatItem startEvtcItem, AgentData agentData, SkillData skillData, long offset) : base(startEvtcItem.LogTime, offset)
 {
     Skill            = skillData.Get(startEvtcItem.SkillID);
     Caster           = agentData.GetAgentByInstID(startEvtcItem.SrcInstid, startEvtcItem.LogTime);
     UnderQuickness   = startEvtcItem.IsActivation == ParseEnum.Activation.Quickness;
     ExpectedDuration = startEvtcItem.Value;
     MasterCaster     = startEvtcItem.SrcMasterInstid > 0 ? agentData.GetAgentByInstID(startEvtcItem.SrcMasterInstid, startEvtcItem.LogTime) : null;
 }
 internal WeaponSwapEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem, agentData, skillData)
 {
     Status           = AnimationStatus.Instant;
     SwappedTo        = (int)evtcItem.DstAgent;
     Skill            = skillData.Get(SkillIDs.WeaponSwap);
     ActualDuration   = 0;
     ExpectedDuration = 0;
 }
Пример #8
0
 public void Invalidate(SkillData skillData)
 {
     if (BuffID != ProfHelper.NoBuff)
     {
         _originalBuffID = BuffID;
         BuffSkill       = skillData.Get(ProfHelper.NoBuff);
     }
 }
        private Dictionary <long, List <JsonSkill> > BuildRotation(List <CastLog> cls)
        {
            Dictionary <long, List <JsonSkill> > res = new Dictionary <long, List <JsonSkill> >();
            SkillData skillList = _log.SkillData;

            foreach (CastLog cl in cls)
            {
                SkillItem   skill     = skillList.Get(cl.SkillId);
                GW2APISkill skillApi  = skill?.ApiSkill;
                string      skillName = skill.Name;
                _skillNames[cl.SkillId] = skillName;
                JsonSkill jSkill = new JsonSkill
                {
                    Time     = (int)cl.Time,
                    Duration = cl.ActualDuration
                };
                if (_devMode)
                {
                    if (!_skillIcons.ContainsKey(cl.SkillId))
                    {
                        string skillIcon = skill.Icon;
                        if (skillIcon.Length > 0)
                        {
                            _skillIcons[cl.SkillId] = skillIcon;
                        }
                    }
                    int timeGained = 0;
                    if (cl.EndActivation == ParseEnum.Activation.CancelFire && cl.ActualDuration < cl.ExpectedDuration)
                    {
                        timeGained = cl.ExpectedDuration - cl.ActualDuration;
                    }
                    else if (cl.EndActivation == ParseEnum.Activation.CancelCancel)
                    {
                        timeGained = -cl.ActualDuration;
                    }
                    jSkill.ED = new JsonSkill.JsonExtraSkill()
                    {
                        UQ = cl.StartActivation == ParseEnum.Activation.Quickness ? 1 : 0,
                        TS = timeGained,
                        A  = skillApi != null && skillApi.slot == "Weapon_1" ? 1 : 0
                    };
                }
                if (res.TryGetValue(cl.SkillId, out var list))
                {
                    list.Add(jSkill);
                }
                else
                {
                    res[cl.SkillId] = new List <JsonSkill>()
                    {
                        jSkill
                    };
                }
            }

            return(res);
        }
Пример #10
0
 internal AbstractDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData) : base(evtcItem.Time)
 {
     From              = agentData.GetAgent(evtcItem.SrcAgent);
     To                = agentData.GetAgent(evtcItem.DstAgent);
     Skill             = skillData.Get(evtcItem.SkillID);
     IsOverNinety      = evtcItem.IsNinety > 0;
     AgainstUnderFifty = evtcItem.IsFifty > 0;
     IsMoving          = evtcItem.IsMoving > 0;
     IsFlanking        = evtcItem.IsFlanking > 0;
     IFF               = evtcItem.IFF;
 }
Пример #11
0
        public override List <InstantCastEvent> ComputeInstantCast(CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var res = new List <InstantCastEvent>();

            if (!combatData.HasEXTBarrier)
            {
                return(res);
            }
            var heals = combatData.EXTBarrierCombatData.GetBarrierData(_damageSkillID).GroupBy(x => x.From).ToDictionary(x => x.Key, x => x.ToList());

            foreach (KeyValuePair <AgentItem, List <EXTAbstractBarrierEvent> > pair in heals)
            {
                long lastTime = int.MinValue;
                if (!HealingStatsExtensionHandler.SanitizeForSrc(pair.Value))
                {
                    continue;
                }
                foreach (EXTAbstractBarrierEvent de in pair.Value)
                {
                    if (de.Time - lastTime < ICD)
                    {
                        lastTime = de.Time;
                        continue;
                    }
                    if (_triggerCondition != null)
                    {
                        if (_triggerCondition(de, combatData))
                        {
                            lastTime = de.Time;
                            res.Add(new InstantCastEvent(de.Time, skillData.Get(SkillID), de.From));
                        }
                    }
                    else
                    {
                        lastTime = de.Time;
                        res.Add(new InstantCastEvent(de.Time, skillData.Get(SkillID), de.From));
                    }
                }
            }
            return(res);
        }
        public static IReadOnlyList <AnimatedCastEvent> ComputeFlowingResolveCastEvents(Player willbender, CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var       res     = new List <AnimatedCastEvent>();
            SkillItem skill   = skillData.Get(FlowingResolveSkill);
            var       applies = combatData.GetBuffData(FlowingResolveEffect).OfType <BuffApplyEvent>().Where(x => x.To == willbender.AgentItem).ToList();

            foreach (BuffApplyEvent bae in applies)
            {
                res.Add(new AnimatedCastEvent(willbender.AgentItem, skill, bae.Time - 440, 500));
            }
            return(res);
        }
        public override List <InstantCastEvent> ComputeInstantCast(CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var res = new List <InstantCastEvent>();

            foreach (AgentItem playerAgent in agentData.GetAgentByType(AgentItem.AgentType.Player))
            {
                IReadOnlyList <WeaponSwapEvent> swaps = combatData.GetWeaponSwapData(playerAgent);
                long lastTime = int.MinValue;
                foreach (WeaponSwapEvent swap in swaps)
                {
                    if (swap.SwappedTo != _swappedTo)
                    {
                        continue;
                    }
                    if (swap.Time - lastTime < ICD)
                    {
                        lastTime = swap.Time;
                        continue;
                    }
                    if (_triggerCondition != null)
                    {
                        if (_triggerCondition(swap, combatData, skillData))
                        {
                            lastTime = swap.Time;
                            res.Add(new InstantCastEvent(swap.Time, skillData.Get(SkillID), swap.Caster));
                        }
                    }
                    else
                    {
                        lastTime = swap.Time;
                        res.Add(new InstantCastEvent(swap.Time, skillData.Get(SkillID), swap.Caster));
                    }
                }
            }
            return(res);
        }
        public override List <InstantCastEvent> ComputeInstantCast(CombatData combatData, SkillData skillData, AgentData agentData)
        {
            var             res             = new List <InstantCastEvent>();
            EffectGUIDEvent effectGUIDEvent = combatData.GetEffectGUIDEvent(_effectGUID);

            if (effectGUIDEvent != null)
            {
                Dictionary <AgentItem, List <EffectEvent> > effects = GetEffectEventDict(effectGUIDEvent, combatData);
                foreach (KeyValuePair <AgentItem, List <EffectEvent> > pair in effects)
                {
                    long lastTime = int.MinValue;
                    foreach (EffectEvent effectEvent in pair.Value)
                    {
                        if (effectEvent.Time - lastTime < ICD)
                        {
                            lastTime = effectEvent.Time;
                            continue;
                        }
                        if (_triggerCondition != null)
                        {
                            if (_triggerCondition(effectEvent, combatData))
                            {
                                lastTime = effectEvent.Time;
                                res.Add(new InstantCastEvent(effectEvent.Time, skillData.Get(SkillID), GetAgent(effectEvent)));
                            }
                        }
                        else
                        {
                            lastTime = effectEvent.Time;
                            res.Add(new InstantCastEvent(effectEvent.Time, skillData.Get(SkillID), GetAgent(effectEvent)));
                        }
                    }
                }
            }
            return(res);
        }
Пример #15
0
        public static List <InstantCastEvent> TranslateMirageCloak(List <AbstractBuffEvent> buffs, SkillData skillData)
        {
            var  res        = new List <InstantCastEvent>();
            long cloakStart = 0;

            foreach (AbstractBuffEvent ba in buffs.Where(x => x is BuffApplyEvent))
            {
                if (ba.Time - cloakStart > 10)
                {
                    var dodgeLog = new InstantCastEvent(ba.Time, skillData.Get(SkillItem.MirageCloakDodgeId), ba.To.GetFinalMaster());
                    res.Add(dodgeLog);
                    cloakStart = ba.Time;
                }
            }
            return(res);
        }
Пример #16
0
        public AbstractDamageEvent(CombatItem evtcItem, AgentData agentData, SkillData skillData, long offset) : base(evtcItem.LogTime, offset)
        {
#if DEBUG
            OriginalCombatEvent = evtcItem;
#endif
            From              = agentData.GetAgentByInstID(evtcItem.SrcInstid, evtcItem.LogTime);
            MasterFrom        = evtcItem.SrcMasterInstid > 0 ? agentData.GetAgentByInstID(evtcItem.SrcMasterInstid, evtcItem.LogTime) : null;
            To                = agentData.GetAgentByInstID(evtcItem.DstInstid, evtcItem.LogTime);
            MasterTo          = evtcItem.DstMasterInstid > 0 ? agentData.GetAgentByInstID(evtcItem.DstMasterInstid, evtcItem.LogTime) : null;
            Skill             = skillData.Get(evtcItem.SkillID);
            IsOverNinety      = evtcItem.IsNinety > 0;
            AgainstUnderFifty = evtcItem.IsFifty > 0;
            IsMoving          = evtcItem.IsMoving > 0;
            IsFlanking        = evtcItem.IsFlanking > 0;
            IFF               = evtcItem.IFF;
        }
Пример #17
0
        public static List <AnimatedCastEvent> TranslateMirageCloak(List <AbstractBuffEvent> buffs, SkillData skillData)
        {
            List <AnimatedCastEvent> res = new List <AnimatedCastEvent>();
            long cloakStart = 0;

            foreach (AbstractBuffEvent ba in buffs.Where(x => x is BuffApplyEvent))
            {
                if (ba.Time - cloakStart > 10)
                {
                    AnimatedCastEvent dodgeLog = new AnimatedCastEvent(ba.Time, skillData.Get(SkillItem.DodgeId), 50, ba.To);
                    res.Add(dodgeLog);
                    cloakStart = ba.Time;
                }
            }
            return(res);
        }
Пример #18
0
        private List <JsonDamageDist> BuildDamageDist(List <DamageLog> dls)
        {
            List <JsonDamageDist> res = new List <JsonDamageDist>();
            Dictionary <long, List <DamageLog> > dict = dls.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());
            SkillData skillList = _log.SkillData;

            foreach (KeyValuePair <long, List <DamageLog> > pair in dict)
            {
                if (pair.Value.Count == 0)
                {
                    continue;
                }
                SkillItem skill = skillList.Get(pair.Key);
                if (pair.Value.First().IsIndirectDamage)
                {
                    if (!_buffDesc.ContainsKey("b" + pair.Key))
                    {
                        if (Boon.BoonsByIds.TryGetValue(pair.Key, out Boon buff))
                        {
                            _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(buff);
                        }
                        else
                        {
                            Boon auxBoon = new Boon(skill.Name, pair.Key, skill.Icon);
                            _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(auxBoon);
                        }
                    }
                }
                else
                {
                    if (!_skillDesc.ContainsKey("s" + pair.Key))
                    {
                        _skillDesc["s" + pair.Key] = new JsonLog.SkillDesc(skill);
                    }
                }
                List <DamageLog> filteredList = pair.Value.Where(x => x.Result != ParseEnum.Result.Downed).ToList();
                if (filteredList.Count == 0)
                {
                    continue;
                }
                string prefix = filteredList.First().IsIndirectDamage ? "b" : "s";
                res.Add(new JsonDamageDist(filteredList, filteredList.First().IsCondi, pair.Key));
            }

            return(res);
        }
Пример #19
0
        private Dictionary <string, List <JsonSkill> > BuildRotation(List <CastLog> cls)
        {
            Dictionary <string, List <JsonSkill> > res = new Dictionary <string, List <JsonSkill> >();
            SkillData skillList = _log.SkillData;

            foreach (CastLog cl in cls)
            {
                SkillItem   skill     = skillList.Get(cl.SkillId);
                GW2APISkill skillApi  = skill?.ApiSkill;
                string      skillName = skill.Name;
                _skillNames["s" + cl.SkillId] = skillName;
                int timeGained = 0;
                if (cl.EndActivation == ParseEnum.Activation.CancelFire && cl.ActualDuration < cl.ExpectedDuration)
                {
                    timeGained = cl.ExpectedDuration - cl.ActualDuration;
                }
                else if (cl.EndActivation == ParseEnum.Activation.CancelCancel)
                {
                    timeGained = -cl.ActualDuration;
                }
                JsonSkill jSkill = new JsonSkill
                {
                    time       = (int)cl.Time,
                    duration   = cl.ActualDuration,
                    timeGained = timeGained,
                    autoAttack = skillApi != null && skillApi.Slot == "Weapon_1",
                    quickness  = cl.StartActivation == ParseEnum.Activation.Quickness
                };
                if (res.TryGetValue("s" + cl.SkillId, out var list))
                {
                    list.Add(jSkill);
                }
                else
                {
                    res["s" + cl.SkillId] = new List <JsonSkill>()
                    {
                        jSkill
                    };
                }
            }

            return(res);
        }
Пример #20
0
        private Dictionary <string, JsonDamageDist> BuildDamageDist(List <DamageLog> dls)
        {
            Dictionary <string, JsonDamageDist>  res  = new Dictionary <string, JsonDamageDist>();
            Dictionary <long, List <DamageLog> > dict = dls.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());
            SkillData skillList = _log.SkillData;

            foreach (KeyValuePair <long, List <DamageLog> > pair in dict)
            {
                if (pair.Value.Count == 0)
                {
                    continue;
                }
                SkillItem skill = skillList.Get(pair.Key);
                if (!pair.Value.First().IsCondi&& skill != null)
                {
                    if (!_skillNames.ContainsKey("s" + pair.Key))
                    {
                        _skillNames["s" + pair.Key] = skill.Name;
                    }
                }
                List <DamageLog> filteredList = pair.Value.Where(x => x.Result != ParseEnum.Result.Downed).ToList();
                if (filteredList.Count == 0)
                {
                    continue;
                }
                string prefix = filteredList.First().IsCondi ? "b" : "s";
                res[prefix + pair.Key] = new JsonDamageDist()
                {
                    hits   = filteredList.Count,
                    damage = filteredList.Sum(x => x.Damage),
                    min    = filteredList.Min(x => x.Damage),
                    max    = filteredList.Max(x => x.Damage),
                    flank  = filteredList.Count(x => x.IsFlanking),
                    crit   = filteredList.Count(x => x.Result == ParseEnum.Result.Crit),
                    glance = filteredList.Count(x => x.Result == ParseEnum.Result.Glance),
                };
            }

            return(res);
        }
        private Dictionary <long, JsonDamageDist> BuildDamageDist(List <DamageLog> dls)
        {
            Dictionary <long, JsonDamageDist>    res  = new Dictionary <long, JsonDamageDist>();
            Dictionary <long, List <DamageLog> > dict = dls.GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());
            SkillData skillList = _log.SkillData;

            foreach (KeyValuePair <long, List <DamageLog> > pair in dict)
            {
                if (pair.Value.Count == 0)
                {
                    continue;
                }
                SkillItem skill = skillList.Get(pair.Key);
                if (pair.Value.First().IsCondi == 0 && skill != null)
                {
                    if (!_skillNames.ContainsKey(pair.Key))
                    {
                        _skillNames[pair.Key] = skill.Name;
                    }
                    if (_devMode && !_skillIcons.ContainsKey(pair.Key))
                    {
                        _skillIcons[pair.Key] = skill.Icon;
                    }
                }
                res[pair.Key] = new JsonDamageDist()
                {
                    Hits   = pair.Value.Count,
                    Damage = pair.Value.Sum(x => x.Damage),
                    Condi  = pair.Value.First().IsCondi,
                    Min    = pair.Value.Min(x => x.Damage),
                    Max    = pair.Value.Max(x => x.Damage),
                    Flank  = pair.Value.Count(x => x.IsFlanking > 0),
                    Crit   = pair.Value.Count(x => x.Result == ParseEnum.Result.Crit),
                    Glance = pair.Value.Count(x => x.Result == ParseEnum.Result.Glance),
                };
            }

            return(res);
        }
Пример #22
0
        private List <JsonRotation> BuildRotation(List <CastLog> cls)
        {
            Dictionary <long, List <JsonSkill> > dict = new Dictionary <long, List <JsonSkill> >();
            SkillData skillList = _log.SkillData;

            foreach (CastLog cl in cls)
            {
                SkillItem skill     = skillList.Get(cl.SkillId);
                string    skillName = skill.Name;
                if (!_skillDesc.ContainsKey("s" + cl.SkillId))
                {
                    _skillDesc["s" + cl.SkillId] = new JsonLog.SkillDesc(skill);
                }
                JsonSkill jSkill = new JsonSkill(cl);
                if (dict.TryGetValue(cl.SkillId, out var list))
                {
                    list.Add(jSkill);
                }
                else
                {
                    dict[cl.SkillId] = new List <JsonSkill>()
                    {
                        jSkill
                    };
                }
            }
            List <JsonRotation> res = new List <JsonRotation>();

            foreach (var pair in dict)
            {
                res.Add(new JsonRotation()
                {
                    Id     = pair.Key,
                    Skills = pair.Value
                });
            }
            return(res);
        }
Пример #23
0
        public static List <AbstractBuffEvent> TransformVirtuosoBladeStorage(IReadOnlyList <AbstractBuffEvent> buffs, AgentItem a, SkillData skillData)
        {
            var res      = new List <AbstractBuffEvent>();
            var bladeIDs = new HashSet <long>
            {
                VirtuosoBlade1,
                VirtuosoBlade2,
                VirtuosoBlade3,
                VirtuosoBlade4,
                VirtuosoBlade5,
            };
            var       blades = buffs.Where(x => bladeIDs.Contains(x.BuffID)).ToList();
            SkillItem skill  = skillData.Get(VirtuosoBlades);
            var       lastAddedBuffInstance = new Dictionary <long, uint>();

            foreach (AbstractBuffEvent blade in blades)
            {
                if (blade is BuffApplyEvent bae)
                {
                    res.Add(new BuffApplyEvent(a, a, bae.Time, bae.AppliedDuration, skill, bae.BuffInstance, true));
                    lastAddedBuffInstance[blade.BuffID] = bae.BuffInstance;
                }
                else if (blade is BuffRemoveAllEvent brae)
                {
                    if (!lastAddedBuffInstance.TryGetValue(blade.BuffID, out uint remmovedInstance))
                    {
                        remmovedInstance = 0;
                    }
                    res.Add(new BuffRemoveSingleEvent(a, a, brae.Time, brae.RemovedDuration, skill, true, remmovedInstance));
                }
                else if (blade is BuffRemoveSingleEvent brse)
                {
                    res.Add(new BuffRemoveSingleEvent(a, a, brse.Time, brse.RemovedDuration, skill, true, brse.BuffInstance));
                }
            }
            return(res);
        }
Пример #24
0
        public override List <AbstractBuffEvent> SpecialBuffEventProcess(Dictionary <AgentItem, List <AbstractBuffEvent> > buffsByDst, Dictionary <long, List <AbstractBuffEvent> > buffsById, SkillData skillData)
        {
            NPC mainTarget = Targets.Find(x => x.ID == (int)ParseEnum.TargetIDS.Xera);

            if (mainTarget == null)
            {
                throw new InvalidOperationException("Error Encountered: Xera not found");
            }
            var res = new List <AbstractBuffEvent>();

            if (_specialSplit != 0)
            {
                res.Add(new BuffRemoveAllEvent(mainTarget.AgentItem, mainTarget.AgentItem, _specialSplit, int.MaxValue, skillData.Get(762), 1, int.MaxValue));
                res.Add(new BuffRemoveManualEvent(mainTarget.AgentItem, mainTarget.AgentItem, _specialSplit, int.MaxValue, skillData.Get(762)));
            }
            return(res);
        }
Пример #25
0
        public override List <AbstractBuffEvent> SpecialBuffEventProcess(Dictionary <AgentItem, List <AbstractBuffEvent> > buffsByDst, Dictionary <long, List <AbstractBuffEvent> > buffsById, SkillData skillData)
        {
            NPC target = Targets.Find(x => x.ID == (int)ParseEnum.TargetIDS.Deimos);

            if (target == null)
            {
                throw new InvalidOperationException("Deimos not found");
            }
            var res = new List <AbstractBuffEvent>();

            if (buffsById.TryGetValue(38224, out List <AbstractBuffEvent> list))
            {
                foreach (AbstractBuffEvent bfe in list)
                {
                    if (bfe is BuffApplyEvent ba)
                    {
                        AbstractBuffEvent removal = list.FirstOrDefault(x => x is BuffRemoveAllEvent && x.Time > bfe.Time && x.Time < bfe.Time + 30000);
                        if (removal == null)
                        {
                            res.Add(new BuffRemoveAllEvent(GeneralHelper.UnknownAgent, target.AgentItem, ba.Time + ba.AppliedDuration, 0, skillData.Get(38224), 1, 0));
                            res.Add(new BuffRemoveManualEvent(GeneralHelper.UnknownAgent, target.AgentItem, ba.Time + ba.AppliedDuration, 0, skillData.Get(38224)));
                        }
                    }
                    else if (bfe is BuffRemoveAllEvent)
                    {
                        AbstractBuffEvent apply = list.FirstOrDefault(x => x is BuffApplyEvent && x.Time <bfe.Time && x.Time> bfe.Time - 30000);
                        if (apply == null)
                        {
                            res.Add(new BuffApplyEvent(GeneralHelper.UnknownAgent, target.AgentItem, bfe.Time - 10000, 10000, skillData.Get(38224), uint.MaxValue, true));
                        }
                    }
                }
            }
            return(res);
        }
        public static List <AbstractBuffEvent> TransformWeaverAttunements(IReadOnlyList <AbstractBuffEvent> buffs, Dictionary <long, List <AbstractBuffEvent> > buffsByID, AgentItem a, SkillData skillData)
        {
            var res         = new List <AbstractBuffEvent>();
            var attunements = new HashSet <long>
            {
                5585,
                5586,
                5575,
                5580
            };

            // not useful for us

            /*const long fireAir = 45162;
             * const long fireEarth = 42756;
             * const long fireWater = 45502;
             * const long waterAir = 46418;
             * const long waterEarth = 42792;
             * const long airEarth = 45683;*/

            var weaverAttunements = new HashSet <long>
            {
                FireMajor,
                FireMinor,
                WaterMajor,
                WaterMinor,
                AirMajor,
                AirMinor,
                EarthMajor,
                EarthMinor,

                FireDual,
                WaterDual,
                AirDual,
                EarthDual,

                /*fireAir,
                 * fireEarth,
                 * fireWater,
                 * waterAir,
                 * waterEarth,
                 * airEarth,*/
            };
            // first we get rid of standard attunements
            var toClean = new HashSet <long>();
            var attuns  = buffs.Where(x => attunements.Contains(x.BuffID)).ToList();

            foreach (AbstractBuffEvent c in attuns)
            {
                toClean.Add(c.BuffID);
                c.Invalidate(skillData);
            }
            // get all weaver attunements ids and group them by time
            var weaverAttuns = buffs.Where(x => weaverAttunements.Contains(x.BuffID)).ToList();

            if (weaverAttuns.Count == 0)
            {
                return(res);
            }
            Dictionary <long, List <AbstractBuffEvent> > groupByTime = GroupByTime(weaverAttuns);
            long prevID = 0;

            foreach (KeyValuePair <long, List <AbstractBuffEvent> > pair in groupByTime)
            {
                var  applies = pair.Value.OfType <BuffApplyEvent>().ToList();
                long curID   = TranslateWeaverAttunement(applies);
                foreach (AbstractBuffEvent c in pair.Value)
                {
                    toClean.Add(c.BuffID);
                    c.Invalidate(skillData);
                }
                if (curID == 0)
                {
                    continue;
                }
                uint curInstanceID = applies.First().BuffInstance;
                res.Add(new BuffApplyEvent(a, a, pair.Key, int.MaxValue, skillData.Get(curID), curInstanceID, true));
                if (prevID != 0)
                {
                    res.Add(new BuffRemoveManualEvent(a, a, pair.Key, int.MaxValue, skillData.Get(prevID)));
                    res.Add(new BuffRemoveAllEvent(a, a, pair.Key, int.MaxValue, skillData.Get(prevID), 1, int.MaxValue));
                }
                prevID = curID;
            }
            foreach (long buffID in toClean)
            {
                buffsByID[buffID].RemoveAll(x => x.BuffID == NoBuff);
            }
            return(res);
        }
Пример #27
0
        internal override List <AbstractBuffEvent> SpecialBuffEventProcess(CombatData combatData, SkillData skillData)
        {
            AbstractSingleActor mainTarget = GetMainTarget();

            if (mainTarget == null)
            {
                throw new MissingKeyActorsException("Xera not found");
            }
            var res = new List <AbstractBuffEvent>();

            if (_xeraSecondPhaseStartTime != 0)
            {
                res.Add(new BuffRemoveAllEvent(mainTarget.AgentItem, mainTarget.AgentItem, _xeraSecondPhaseStartTime, int.MaxValue, skillData.Get(762), 1, int.MaxValue));
                res.Add(new BuffRemoveManualEvent(mainTarget.AgentItem, mainTarget.AgentItem, _xeraSecondPhaseStartTime, int.MaxValue, skillData.Get(762)));
            }
            return(res);
        }
Пример #28
0
 public AbstractCastEvent(CombatItem startItem, AgentData agentData, SkillData skillData) : base(startItem.Time)
 {
     Skill  = skillData.Get(startItem.SkillID);
     Caster = agentData.GetAgent(startItem.SrcAgent);
 }
        public static List <AbstractBuffEvent> TransformWeaverAttunements(List <AbstractBuffEvent> buffs, AgentItem a, SkillData skillData)
        {
            var res         = new List <AbstractBuffEvent>();
            var attunements = new HashSet <long>
            {
                5585,
                5586,
                5575,
                5580
            };

            // not useful for us

            /*const long fireAir = 45162;
             * const long fireEarth = 42756;
             * const long fireWater = 45502;
             * const long waterAir = 46418;
             * const long waterEarth = 42792;
             * const long airEarth = 45683;*/

            var weaverAttunements = new HashSet <long>
            {
                FireMajor,
                FireMinor,
                WaterMajor,
                WaterMinor,
                AirMajor,
                AirMinor,
                EarthMajor,
                EarthMinor,

                FireDual,
                WaterDual,
                AirDual,
                EarthDual,

                /*fireAir,
                 * fireEarth,
                 * fireWater,
                 * waterAir,
                 * waterEarth,
                 * airEarth,*/
            };
            // first we get rid of standard attunements
            var attuns = buffs.Where(x => attunements.Contains(x.BuffID)).ToList();

            foreach (AbstractBuffEvent c in attuns)
            {
                c.Invalidate(skillData);
            }
            // get all weaver attunements ids and group them by time
            var weaverAttuns = buffs.Where(x => weaverAttunements.Contains(x.BuffID)).ToList();

            if (weaverAttuns.Count == 0)
            {
                return(res);
            }
            var groupByTime = new Dictionary <long, List <AbstractBuffEvent> >();

            foreach (AbstractBuffEvent c in weaverAttuns)
            {
                long key = groupByTime.Keys.FirstOrDefault(x => Math.Abs(x - c.Time) < GeneralHelper.ServerDelayConstant);
                if (key != 0)
                {
                    groupByTime[key].Add(c);
                }
                else
                {
                    groupByTime[c.Time] = new List <AbstractBuffEvent>
                    {
                        c
                    };
                }
            }
            long prevID = 0;

            foreach (KeyValuePair <long, List <AbstractBuffEvent> > pair in groupByTime)
            {
                var  applies = pair.Value.OfType <BuffApplyEvent>().ToList();
                long curID   = TranslateWeaverAttunement(applies);
                foreach (AbstractBuffEvent c in pair.Value)
                {
                    c.Invalidate(skillData);
                }
                if (curID == 0)
                {
                    continue;
                }
                uint curInstanceID = applies.First().BuffInstance;
                res.Add(new BuffApplyEvent(a, a, pair.Key, int.MaxValue, skillData.Get(curID), curInstanceID, true));
                if (prevID != 0)
                {
                    res.Add(new BuffRemoveManualEvent(a, a, pair.Key, int.MaxValue, skillData.Get(prevID)));
                    res.Add(new BuffRemoveAllEvent(a, a, pair.Key, int.MaxValue, skillData.Get(prevID), 1, int.MaxValue));
                }
                prevID = curID;
            }
            return(res);
        }
        public static object[] GetDMGDtoItem(KeyValuePair <long, List <DamageLog> > entry, Dictionary <long, List <CastLog> > castLogsBySkill, SkillData skillData, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Boon> usedBoons)
        {
            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 (Boon.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,
                casts,
                hits,
                crit,
                flank,
                glance,
                timeswasted / 1000.0,
                -timessaved / 1000.0
            };
            return(skillItem);
        }