public void calculateConditions()
        {
            statistics.bossConditions = new Dictionary <int, Statistics.FinalBossBoon> [phases.Count];
            List <Boon> boon_to_track = Boon.getCondiBoonList();

            boon_to_track.AddRange(Boon.getBoonList());
            for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++)
            {
                List <PhaseData> phases           = log.getBoss().getPhases(log, settings.ParsePhases);
                BoonDistribution boonDistribution = log.getBoss().getBoonDistribution(log, phases, boon_to_track, phaseIndex);
                Dictionary <int, Statistics.FinalBossBoon> rates = new Dictionary <int, Statistics.FinalBossBoon>();

                PhaseData phase         = phases[phaseIndex];
                long      fightDuration = phase.getDuration();

                foreach (Boon boon in Boon.getCondiBoonList())
                {
                    Statistics.FinalBossBoon condition = new Statistics.FinalBossBoon();
                    rates[boon.getID()] = condition;
                    if (boonDistribution.ContainsKey(boon.getID()))
                    {
                        if (boon.getType() == Boon.BoonType.Duration)
                        {
                            condition.boonType = Boon.BoonType.Duration;
                            condition.uptime   = Math.Round(100.0 * boonDistribution.getUptime(boon.getID()) / fightDuration, 1);
                        }
                        else if (boon.getType() == Boon.BoonType.Intensity)
                        {
                            condition.boonType = Boon.BoonType.Intensity;
                            condition.uptime   = Math.Round((double)boonDistribution.getUptime(boon.getID()) / fightDuration, 1);
                        }

                        rates[boon.getID()] = condition;
                    }
                }

                statistics.bossConditions[phaseIndex] = rates;
            }
        }
Exemplo n.º 2
0
        public static List <Point> getDPSGraph(ParsedLog log, AbstractPlayer p, int phase_index, ushort dstid, GraphMode mode)
        {
            int asked_id = (phase_index + "_" + dstid + "_" + mode).GetHashCode();

            if (p.getDPSGraph(asked_id).Count > 0)
            {
                return(p.getDPSGraph(asked_id));
            }

            List <Point>     dmgList     = new List <Point>();
            List <Point>     dmgList10s  = new List <Point>();
            List <Point>     dmgList30s  = new List <Point>();
            PhaseData        phase       = log.getBoss().getPhases(log, settings.ParsePhases)[phase_index];
            List <DamageLog> damage_logs = p.getDamageLogs(dstid, log, phase.getStart(), phase.getEnd());
            // fill the graph, full precision
            List <double> dmgListFull = new List <double>();

            for (int i = 0; i <= phase.getDuration(); i++)
            {
                dmgListFull.Add(0.0);
            }
            int total_time   = 1;
            int total_damage = 0;

            foreach (DamageLog dl in damage_logs)
            {
                int time = (int)(dl.getTime() - phase.getStart());
                // fill
                for (; total_time < time; total_time++)
                {
                    dmgListFull[total_time] = total_damage;
                }
                total_damage           += dl.getDamage();
                dmgListFull[total_time] = total_damage;
            }
            // fill
            for (; total_time <= phase.getDuration(); total_time++)
            {
                dmgListFull[total_time] = total_damage;
            }
            dmgList.Add(new Point(0, 0));
            dmgList10s.Add(new Point(0, 0));
            dmgList30s.Add(new Point(0, 0));
            for (int i = 1; i <= phase.getDuration("s"); i++)
            {
                int limit_id = 0;
                dmgList.Add(new Point(i, (int)Math.Round((dmgListFull[1000 * i] - dmgListFull[1000 * limit_id]) / (i - limit_id))));
                if (settings.Show10s)
                {
                    limit_id = Math.Max(i - 10, 0);
                    dmgList10s.Add(new Point(i, (int)Math.Round((dmgListFull[1000 * i] - dmgListFull[1000 * limit_id]) / (i - limit_id))));
                }
                if (settings.Show30s)
                {
                    limit_id = Math.Max(i - 30, 0);
                    dmgList30s.Add(new Point(i, (int)Math.Round((dmgListFull[1000 * i] - dmgListFull[1000 * limit_id]) / (i - limit_id))));
                }
            }
            int id = (phase_index + "_" + dstid + "_" + GraphMode.Full).GetHashCode();

            p.addDPSGraph(id, dmgList);
            if (settings.Show10s)
            {
                id = (phase_index + "_" + dstid + "_" + GraphMode.s10).GetHashCode();
                p.addDPSGraph(id, dmgList10s);
            }
            if (settings.Show30s)
            {
                id = (phase_index + "_" + dstid + "_" + GraphMode.s30).GetHashCode();
                p.addDPSGraph(id, dmgList30s);
            }
            return(p.getDPSGraph(asked_id));
        }
        private Statistics.FinalDPS getFinalDPS(AbstractPlayer player, int phaseIndex)
        {
            Statistics.FinalDPS final = new Statistics.FinalDPS();

            PhaseData phase = phases[phaseIndex];

            double phaseDuration = (phase.getDuration()) / 1000.0;

            double damage = 0.0;
            double dps    = 0.0;

            // All DPS
            damage = player.getDamageLogs(0, log, phase.getStart(),
                                          phase.getEnd())
                     .Sum(x => x.getDamage());
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.allDps    = (int)dps;
            final.allDamage = (int)damage;

            // All Condi DPS
            damage = player.getDamageLogs(0, log, phase.getStart(),
                                          phase.getEnd())
                     .Where(x => x.isCondi() > 0).Sum(x => x.getDamage());
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.allCondiDps    = (int)dps;
            final.allCondiDamage = (int)damage;

            // All Power DPS
            damage = final.allDamage - damage;
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.allPowerDps    = (int)dps;
            final.allPowerDamage = (int)damage;

            // Boss DPS
            damage = player.getDamageLogs(log.getBossData().getInstid(), log,
                                          phase.getStart(), phase.getEnd()).Sum(x => x.getDamage());
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.bossDps    = (int)dps;
            final.bossDamage = (int)damage;


            // Boss Condi DPS
            damage = player.getDamageLogs(log.getBossData().getInstid(), log,
                                          phase.getStart(), phase.getEnd()).Where(x => x.isCondi() > 0).Sum(x => x.getDamage());
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.bossCondiDps    = (int)dps;
            final.bossCondiDamage = (int)dps;

            // Boss Power DPS
            damage = final.bossDamage - damage;
            if (phaseDuration > 0)
            {
                dps = damage / phaseDuration;
            }

            final.bossPowerDps    = (int)dps;
            final.bossPowerDamage = (int)damage;

            return(final);
        }