private void calculateDPS()
        {
            foreach (Player player in log.getPlayerList())
            {
                Statistics.FinalDPS[] phaseDps = new Statistics.FinalDPS[phases.Count];
                for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++)
                {
                    phaseDps[phaseIndex] = getFinalDPS(player, phaseIndex);
                }

                statistics.dps[player] = phaseDps;
            }

            Statistics.FinalDPS[] phaseBossDps = new Statistics.FinalDPS[phases.Count];
            for (int phaseIndex = 0; phaseIndex < phases.Count; phaseIndex++)
            {
                phaseBossDps[phaseIndex] = getFinalDPS(log.getBoss(), phaseIndex);
            }

            statistics.bossDps = phaseBossDps;
        }
        /// <summary>
        /// Calculate a statistic from a log
        /// </summary>
        /// <param name="log">log to calculate stats from</param>
        /// <returns></returns>
        public Statistics calculateStatistics(ParsedLog log, Switches switches)
        {
            statistics = new Statistics();

            this.log = log;

            phases = log.getBoss().getPhases(log, settings.ParsePhases);

            if (switches.calculateDPS)
            {
                calculateDPS();
            }
            if (switches.calculateStats)
            {
                calculateStats();
            }
            if (switches.calculateDefense)
            {
                calculateDefenses();
            }
            if (switches.calculateSupport)
            {
                calculateSupport();
            }
            if (switches.calculateBoons)
            {
                setPresentBoons();
                calculateBoons();
            }

            if (switches.calculateConditions)
            {
                calculateConditions();
            }
            // WIP

            /*if (settings.PlayerRot)
             * {
             *  foreach (Player p in log.getPlayerList())
             *  {
             *      p.getRotation(log, settings.PlayerRotIcons);
             *  }
             *  log.getBoss().getRotation(log, settings.PlayerRotIcons);
             * }*/

            return(statistics);
        }
Exemplo n.º 3
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));
        }