Example #1
0
        /// <summary>
        /// Merge data from another participant into this participant.
        /// </summary>
        public void Merge(FightParticipant p, int intervalOffset = 0, int timeOffset = 0)
        {
            OutboundMissCount   += p.OutboundMissCount;
            OutboundHitCount    += p.OutboundHitCount;
            OutboundHitSum      += p.OutboundHitSum;
            OutboundStrikeCount += p.OutboundStrikeCount;

            InboundMissCount  += p.InboundMissCount;
            InboundHitCount   += p.InboundHitCount;
            InboundHitSum     += p.InboundHitSum;
            InboundMeleeCount += p.InboundMeleeCount;
            InboundMeleeSum   += p.InboundMeleeSum;
            InboundRiposteSum += p.InboundRiposteSum;
            //InboundSpellCount += p.InboundSpellCount;
            //InboundSpellSum += p.InboundSpellSum;
            InboundStrikeCount += p.InboundStrikeCount;

            OutboundHealSum    += p.OutboundHealSum;
            InboundHealSum     += p.InboundHealSum;
            InboundFullHealSum += p.InboundFullHealSum;

            DeathCount += p.DeathCount;

            // merge intervals starting at 'intervalOffset' base
            for (var i = 0; i < p.DPS.Count; i++)
            {
                while (DPS.Count <= intervalOffset + i)
                {
                    DPS.Add(0);
                }
                DPS[intervalOffset + i] += p.DPS[i];
            }

            for (var i = 0; i < p.TankDPS.Count; i++)
            {
                while (TankDPS.Count <= intervalOffset + i)
                {
                    TankDPS.Add(0);
                }
                TankDPS[intervalOffset + i] += p.TankDPS[i];
            }

            for (var i = 0; i < p.HPS.Count; i++)
            {
                while (HPS.Count <= intervalOffset + i)
                {
                    HPS.Add(0);
                }
                HPS[intervalOffset + i] += p.HPS[i];
            }

            for (var i = 0; i < p.InboundHPS.Count; i++)
            {
                while (InboundHPS.Count <= intervalOffset + i)
                {
                    InboundHPS.Add(0);
                }
                InboundHPS[intervalOffset + i] += p.InboundHPS[i];
            }


            foreach (var at in p.AttackTypes)
            {
                var _at = AttackTypes.FirstOrDefault(x => x.Type == at.Type);
                if (_at == null)
                {
                    _at      = new FightHit();
                    _at.Type = at.Type;
                    AttackTypes.Add(_at);
                }
                _at.Merge(at);
            }

            foreach (var dt in p.DefenseTypes)
            {
                var _dt = DefenseTypes.FirstOrDefault(x => x.Type == dt.Type);
                if (_dt == null)
                {
                    _dt      = new FightMiss();
                    _dt.Type = dt.Type;
                    DefenseTypes.Add(_dt);
                }
                _dt.Merge(dt);
            }

            foreach (var h in p.Heals)
            {
                var _h = Heals.FirstOrDefault(x => x.Target == h.Target);
                if (_h == null)
                {
                    _h        = new FightHeal();
                    _h.Target = h.Target;
                    Heals.Add(_h);
                }
                _h.Merge(h);
            }

            foreach (var s in p.Spells)
            {
                var _s = Spells.FirstOrDefault(x => x.Name == s.Name && x.Type == s.Type);
                if (_s == null)
                {
                    _s      = new FightSpell();
                    _s.Type = s.Type;
                    _s.Name = s.Name;
                    //_s.Times =  // todo
                    Spells.Add(_s);
                }
                _s.Merge(s);
            }

            // disabled - merging buffs will create duplicates if fights overlap and include the same buff
            // it would be better to recreate buffs after merging
            p.Buffs.Clear();

            // >= 0 avoids any pre fight buffs
            //foreach (var b in p.Buffs.Where(x => x.Time >= 0))
            //{
            //    if (timeOffset == 0)
            //        Buffs.Add(b);
            //    else
            //        Buffs.Add(new FightBuff { Name = b.Name, Time = b.Time + timeOffset });
            //}
        }
Example #2
0
        public void AddHeal(LogHealEvent heal, int interval = -1)
        {
            if (FirstAction == null)
            {
                FirstAction = heal.Timestamp;
            }
            LastAction = heal.Timestamp;

            // promised heals appear as self heals
            // we may want to ignore them for self healing stats
            //var promised = heal.Source == Name && heal.Target == Name && heal.Spell != null && heal.Spell.StartsWith("Promised");

            //if (heal.Source == Name && heal.Target == Name)
            //{
            //    SelfHealSum += heal.Amount;
            //}

            if (heal.Source == Name)
            {
                OutboundHealSum     += heal.Amount;
                OutboundFullHealSum += heal.FullAmount;

                var h = Heals.FirstOrDefault(x => x.Target == heal.Target);
                if (h == null)
                {
                    h        = new FightHeal();
                    h.Target = heal.Target;
                    Heals.Add(h);
                }
                h.HitCount   += 1;
                h.HitSum     += heal.Amount;
                h.FullHitSum += heal.FullAmount;

                // should we label unknown heals as lifetap or unknown?
                var spell = AddSpell(heal.Spell ?? "Lifetap", "heal");
                spell.HitCount   += 1;
                spell.HitSum     += heal.Amount;
                spell.FullHitSum += heal.FullAmount;

                if (heal.Mod.HasFlag(LogEventMod.Critical))
                {
                    spell.CritCount += 1;
                    spell.CritSum   += heal.Amount;
                }

                if (heal.Mod.HasFlag(LogEventMod.Twincast))
                {
                    spell.TwinCount += 1;
                }

                if (interval >= 0)
                {
                    while (HPS.Count <= interval)
                    {
                        HPS.Add(0);
                    }
                    HPS[interval] += heal.Amount;
                }
            }

            if (heal.Target == Name)
            {
                InboundHealSum     += heal.Amount;
                InboundFullHealSum += heal.FullAmount;

                if (interval >= 0)
                {
                    while (InboundHPS.Count <= interval)
                    {
                        InboundHPS.Add(0);
                    }
                    InboundHPS[interval] += heal.Amount;
                }
            }
        }