Ejemplo n.º 1
0
        private void setConsumablesList(ParsedLog log)
        {
            List <Boon> foodBoon       = Boon.getFoodList();
            List <Boon> utilityBoon    = Boon.getUtilityList();
            long        time_start     = log.getBossData().getFirstAware();
            long        fight_duration = log.getBossData().getLastAware() - time_start;

            foreach (CombatItem c in log.getCombatList())
            {
                if (c.isBuff() != 18 && c.isBuff() != 1)
                {
                    continue;
                }

                if (foodBoon.FirstOrDefault(x => x.getID() == c.getSkillID()) == null && utilityBoon.FirstOrDefault(x => x.getID() == c.getSkillID()) == null)
                {
                    continue;
                }
                long time = c.getTime() - time_start;
                if (agent.getInstid() == c.getDstInstid())
                {
                    consumeList.Add(c);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void setCastLogs(ParsedLog log)
        {
            long    time_start = log.getBossData().getFirstAware();
            CastLog curCastLog = null;

            foreach (CombatItem c in log.getCastData())
            {
                if (!(c.getTime() > log.getBossData().getFirstAware() && c.getTime() < log.getBossData().getLastAware()))
                {
                    continue;
                }
                ParseEnum.StateChange state = c.isStateChange();
                if (state == ParseEnum.StateChange.Normal)
                {
                    if (agent.getInstid() == c.getSrcInstid())//selecting player as caster
                    {
                        if (c.isActivation().IsCasting())
                        {
                            long time = c.getTime() - time_start;
                            curCastLog = new CastLog(time, c.getSkillID(), c.getValue(), c.isActivation());
                            cast_logs.Add(curCastLog);
                        }
                        else
                        {
                            if (curCastLog != null)
                            {
                                if (curCastLog.getID() == c.getSkillID())
                                {
                                    curCastLog.setEndStatus(c.getValue(), c.isActivation());
                                    curCastLog = null;
                                }
                            }
                        }
                    }
                }
                else if (state == ParseEnum.StateChange.WeaponSwap)
                {                                              //Weapon swap
                    if (agent.getInstid() == c.getSrcInstid()) //selecting player as caster
                    {
                        if ((int)c.getDstAgent() == 4 || (int)c.getDstAgent() == 5)
                        {
                            long    time    = c.getTime() - time_start;
                            CastLog swapLog = new CastLog(time, -2, (int)c.getDstAgent(), c.isActivation());
                            cast_logs.Add(swapLog);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected override void setFilteredLogs(ParsedLog log)
        {
            long time_start = log.getBossData().getFirstAware();
            long min_time   = Math.Max(time_start, agent.getFirstAware());
            long max_time   = Math.Min(log.getBossData().getLastAware(), agent.getLastAware());

            foreach (CombatItem c in log.getDamageData())
            {
                if (agent.getInstid() == c.getSrcInstid() && c.getTime() > min_time && c.getTime() < max_time)//selecting player
                {
                    long time = c.getTime() - time_start;
                    addDamageLog(time, log.getBossData().getInstid(), c, damage_logsFiltered);
                }
            }
        }
Ejemplo n.º 4
0
        protected override void setDamagetakenLogs(ParsedLog log)
        {
            long time_start = log.getBossData().getFirstAware();

            foreach (CombatItem c in log.getDamageTakenData())
            {
                if (agent.getInstid() == c.getDstInstid() && c.getTime() > log.getBossData().getFirstAware() && c.getTime() < log.getBossData().getLastAware())  //selecting player as target
                {
                    long time = c.getTime() - time_start;
                    foreach (AgentItem item in log.getAgentData().getAllAgentsList())
                    {//selecting all
                        addDamageTakenLog(time, item.getInstid(), c);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        // Public methods
        public int[] getCleanses(ParsedLog log, long start, long end)
        {
            long time_start = log.getBossData().getFirstAware();

            int[] cleanse = { 0, 0 };
            foreach (CombatItem c in log.getCombatList().Where(x => x.isStateChange() == ParseEnum.StateChange.Normal && x.isBuff() == 1 && x.getTime() >= (start + time_start) && x.getTime() <= (end + time_start)))
            {
                if (c.isActivation() == ParseEnum.Activation.None)
                {
                    if (agent.getInstid() == c.getDstInstid() && c.getIFF() == ParseEnum.IFF.Friend && (c.isBuffremove() != ParseEnum.BuffRemove.None))
                    {
                        long time = c.getTime() - time_start;
                        if (time > 0)
                        {
                            if (Boon.getCondiBoonList().Exists(x => x.getID() == c.getSkillID()))
                            {
                                cleanse[0]++;
                                cleanse[1] += c.getBuffDmg();
                            }
                        }
                    }
                }
            }
            return(cleanse);
        }
Ejemplo n.º 6
0
        protected override void setDamageLogs(ParsedLog log)
        {
            long time_start = log.getBossData().getFirstAware();
            long min_time   = Math.Max(time_start, agent.getFirstAware());
            long max_time   = Math.Min(log.getBossData().getLastAware(), agent.getLastAware());

            foreach (CombatItem c in log.getDamageData())
            {
                if (agent.getInstid() == c.getSrcInstid() && c.getTime() > min_time && c.getTime() < max_time)//selecting minion as caster
                {
                    long time = c.getTime() - time_start;
                    foreach (AgentItem item in log.getAgentData().getNPCAgentList())
                    {//selecting all
                        addDamageLog(time, item.getInstid(), c, damage_logs);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public CSVBuilder(ParsedLog log, SettingsContainer settings, Statistics statistics)
        {
            boss_data = log.getBossData();
            p_list    = log.getPlayerList();

            this.settings       = settings;
            HTMLHelper.settings = settings;

            this.statistics = statistics;
        }
Ejemplo n.º 8
0
        public long getDeath(ParsedLog log, long start, long end)
        {
            long       offset = log.getBossData().getFirstAware();
            CombatItem dead   = log.getCombatList().FirstOrDefault(x => x.getSrcInstid() == agent.getInstid() && x.isStateChange() == ParseEnum.StateChange.ChangeDead && x.getTime() >= start + offset && x.getTime() <= end + offset);

            if (dead != null && dead.getTime() > 0)
            {
                return(dead.getTime());
            }
            return(0);
        }
Ejemplo n.º 9
0
        protected override void setFilteredLogs(ParsedLog log)
        {
            long time_start = log.getBossData().getFirstAware();

            foreach (CombatItem c in log.getDamageData())
            {
                if (agent.getInstid() == c.getSrcInstid() && c.getTime() > log.getBossData().getFirstAware() && c.getTime() < log.getBossData().getLastAware())
                {
                    long time = c.getTime() - time_start;
                    addDamageLog(time, log.getBossData().getInstid(), c, damage_logsFiltered);
                }
            }
            Dictionary <string, Minions> min_list = getMinions(log);

            foreach (Minions mins in min_list.Values)
            {
                damage_logsFiltered.AddRange(mins.getDamageLogs(log.getBossData().getInstid(), log, 0, log.getBossData().getAwareDuration()));
            }
            damage_logsFiltered.Sort((x, y) => x.getTime() < y.getTime() ? -1 : 1);
        }
Ejemplo n.º 10
0
        protected override void setCastLogs(ParsedLog log)
        {
            long    time_start = log.getBossData().getFirstAware();
            CastLog curCastLog = null;

            long min_time = Math.Max(time_start, agent.getFirstAware());
            long max_time = Math.Min(log.getBossData().getLastAware(), agent.getLastAware());

            foreach (CombatItem c in log.getCastData())
            {
                if (!(c.getTime() > min_time && c.getTime() < max_time))
                {
                    continue;
                }
                ParseEnum.StateChange state = c.isStateChange();
                if (state == ParseEnum.StateChange.Normal)
                {
                    if (agent.getInstid() == c.getSrcInstid())//selecting player as caster
                    {
                        if (c.isActivation().IsCasting())
                        {
                            long time = c.getTime() - time_start;
                            curCastLog = new CastLog(time, c.getSkillID(), c.getValue(), c.isActivation());
                        }
                        else
                        {
                            if (curCastLog != null)
                            {
                                if (curCastLog.getID() == c.getSkillID())
                                {
                                    curCastLog = new CastLog(curCastLog.getTime(), curCastLog.getID(), curCastLog.getExpDur(), curCastLog.startActivation(), c.getValue(), c.isActivation());
                                    cast_logs.Add(curCastLog);
                                    curCastLog = null;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void setRotation(ParsedLog log, bool icons)
        {
            List <CastLog> cls = getCastLogs(log, 0, log.getBossData().getAwareDuration());

            foreach (CastLog cl in cls)
            {
                RotationItem rot = new RotationItem();
                rot.findName(log.getSkillData(), cl.getID());
                rot.setDuration(cl.getActDur());
                rot.setEndStatus(cl.endActivation());
                rot.setStartStatus(cl.startActivation());
            }
        }
Ejemplo n.º 12
0
        protected override void setDamageLogs(ParsedLog log)
        {
            long time_start = log.getBossData().getFirstAware();

            foreach (CombatItem c in log.getDamageData())
            {
                if (agent.getInstid() == c.getSrcInstid() && c.getTime() > log.getBossData().getFirstAware() && c.getTime() < log.getBossData().getLastAware())//selecting player or minion as caster
                {
                    long time = c.getTime() - time_start;
                    foreach (AgentItem item in log.getAgentData().getNPCAgentList())
                    {//selecting all
                        addDamageLog(time, item.getInstid(), c, damage_logs);
                    }
                }
            }
            Dictionary <string, Minions> min_list = getMinions(log);

            foreach (Minions mins in min_list.Values)
            {
                damage_logs.AddRange(mins.getDamageLogs(0, log, 0, log.getBossData().getAwareDuration()));
            }
            damage_logs.Sort((x, y) => x.getTime() < y.getTime() ? -1 : 1);
        }
Ejemplo n.º 13
0
 public List <PhaseData> getPhases(ParsedLog log, bool getAllPhases)
 {
     if (phases.Count == 0)
     {
         if (!getAllPhases)
         {
             long fight_dur = log.getBossData().getAwareDuration();
             phases.Add(new PhaseData(0, fight_dur));
             phases[0].setName("Full Fight");
             getCastLogs(log, 0, fight_dur);
             return(phases);
         }
         setPhases(log);
     }
     return(phases);
 }
Ejemplo n.º 14
0
        // private getters
        private BoonMap getBoonMap(ParsedLog log, List <Boon> to_track)
        {
            BoonMap boon_map = new BoonMap();

            boon_map.add(to_track);
            // Fill in Boon Map
            long time_start = log.getBossData().getFirstAware();

            foreach (CombatItem c in log.getBoonData())
            {
                if (!boon_map.ContainsKey(c.getSkillID()))
                {
                    continue;
                }
                long   time = c.getTime() - time_start;
                ushort dst  = c.isBuffremove() == ParseEnum.BuffRemove.None ? c.getDstInstid() : c.getSrcInstid();
                if (agent.getInstid() == dst && time > 0 && time < log.getBossData().getAwareDuration())
                {
                    ushort src = c.getSrcMasterInstid() > 0 ? c.getSrcMasterInstid() : c.getSrcInstid();
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        boon_map[c.getSkillID()].Add(new BoonLog(time, src, c.getValue(), 0));
                    }
                    else if (Boon.removePermission(c.getSkillID(), c.isBuffremove(), c.getIFF()))
                    {
                        if (c.isBuffremove() == ParseEnum.BuffRemove.All)//All
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                            {
                                BoonLog curBL = loglist[cnt];
                                if (curBL.getTime() + curBL.getValue() > time)
                                {
                                    long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                    loglist[cnt].addValue(-subtract);
                                    // add removed as overstack
                                    loglist[cnt].addOverstack((ushort)subtract);
                                }
                            }
                        }
                        else if (c.isBuffremove() == ParseEnum.BuffRemove.Single)//Single
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            int            cnt     = loglist.Count() - 1;
                            BoonLog        curBL   = loglist[cnt];
                            if (curBL.getTime() + curBL.getValue() > time)
                            {
                                long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                loglist[cnt].addValue(-subtract);
                                // add removed as overstack
                                loglist[cnt].addOverstack((ushort)subtract);
                            }
                        }
                        else if (c.isBuffremove() == ParseEnum.BuffRemove.Manual)//Manuel
                        {
                            List <BoonLog> loglist = boon_map[c.getSkillID()];
                            for (int cnt = loglist.Count() - 1; cnt >= 0; cnt--)
                            {
                                BoonLog curBL = loglist[cnt];
                                long    ctime = curBL.getTime() + curBL.getValue();
                                if (ctime > time)
                                {
                                    long subtract = (curBL.getTime() + curBL.getValue()) - time;
                                    loglist[cnt].addValue(-subtract);
                                    // add removed as overstack
                                    loglist[cnt].addOverstack((ushort)subtract);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(boon_map);
        }
        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);
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Gets the points for the boss dps graph for a given player
 /// </summary>
 /// <param name="p">The player</param>
 /// <returns></returns>
 public static List <Point> getBossDPSGraph(ParsedLog log, AbstractPlayer p, int phase_index, GraphMode mode)
 {
     return(getDPSGraph(log, p, phase_index, log.getBossData().getInstid(), mode));
 }
Ejemplo n.º 17
0
        private void setBoonDistribution(ParsedLog log, List <PhaseData> phases, List <Boon> to_track)
        {
            BoonMap to_use         = getBoonMap(log, to_track);
            long    dur            = log.getBossData().getAwareDuration();
            int     fight_duration = (int)(dur) / 1000;
            // Init boon presence points
            BoonsGraphModel boon_presence_points = new BoonsGraphModel("Number of Boons");

            for (int i = 0; i <= fight_duration; i++)
            {
                boon_presence_points.getBoonChart().Add(new Point(i, 0));
            }
            for (int i = 0; i < phases.Count; i++)
            {
                boon_distribution.Add(new BoonDistribution());
                boon_presence.Add(new Dictionary <int, long>());
            }

            var toFill         = new Point[dur + 1];
            var toFillPresence = new Point[dur + 1];

            long death = getDeath(log, 0, dur);

            foreach (Boon boon in to_track)
            {
                int boonid = boon.getID();
                if (to_use.TryGetValue(boonid, out var logs) && logs.Count != 0)
                {
                    if (boon_distribution[0].ContainsKey(boonid))
                    {
                        continue;
                    }
                    var simulator = boon.CreateSimulator();
                    simulator.simulate(logs, dur);
                    if (death > 0 && getCastLogs(log, death + 1, fight_duration).Count > 0)
                    {
                        simulator.trim(death - log.getBossData().getFirstAware());
                    }
                    else
                    {
                        simulator.trim(dur);
                    }
                    var simulation = simulator.getSimulationResult();
                    foreach (var simul in simulation)
                    {
                        for (int i = 0; i < phases.Count; i++)
                        {
                            var phase        = phases[i];
                            var presenceDict = boon_presence[i];
                            if (!boon_distribution[i].TryGetValue(boonid, out var distrib))
                            {
                                distrib = new Dictionary <ushort, OverAndValue>();
                                boon_distribution[i].Add(boonid, distrib);
                            }
                            Add(presenceDict, boonid, simul.getItemDuration(phase.getStart(), phase.getEnd()));
                            foreach (ushort src in simul.getSrc())
                            {
                                if (distrib.TryGetValue(src, out var toModify))
                                {
                                    toModify.value     += simul.getDuration(src, phase.getStart(), phase.getEnd());
                                    toModify.overstack += simul.getOverstack(src, phase.getStart(), phase.getEnd());
                                    distrib[src]        = toModify;
                                }
                                else
                                {
                                    distrib.Add(src, new OverAndValue(
                                                    simul.getDuration(src, phase.getStart(), phase.getEnd()),
                                                    simul.getOverstack(src, phase.getStart(), phase.getEnd())));
                                }
                            }
                        }
                    }
                    // Graphs
                    // full precision
                    for (int i = 0; i <= dur; i++)
                    {
                        toFill[i]         = new Point(i, 0);
                        toFillPresence[i] = new Point(i, 0);
                    }
                    foreach (var simul in simulation)
                    {
                        int start = (int)simul.getStart();
                        int end   = (int)simul.getEnd();

                        bool present = simul.getItemDuration() > 0;
                        for (int i = start; i <= end; i++)
                        {
                            toFill[i]         = new Point(i, simul.getStack(i));
                            toFillPresence[i] = new Point(i, present ? 1 : 0);
                        }
                    }
                    // reduce precision to seconds
                    var reducedPrecision   = new List <Point>(capacity: fight_duration + 1);
                    var boonPresence       = boon_presence_points.getBoonChart();
                    var updateBoonPresence = Boon.getBoonList().Any(x => x.getID() == boonid);
                    for (int i = 0; i <= fight_duration; i++)
                    {
                        reducedPrecision.Add(new Point(i, toFill[1000 * i].Y));
                        if (updateBoonPresence)
                        {
                            boonPresence[i] = new Point(i, boonPresence[i].Y + toFillPresence[1000 * i].Y);
                        }
                    }
                    boon_points[boonid] = new BoonsGraphModel(boon.getName(), reducedPrecision);
                }
            }
            boon_points[-2] = boon_presence_points;
        }
Ejemplo n.º 18
0
        // Private Methods
        private void setPhases(ParsedLog log)
        {
            long fight_dur = log.getBossData().getAwareDuration();

            phases.Add(new PhaseData(0, fight_dur));
            phases[0].setName("Full Fight");
            long start = 0;
            long end   = 0;

            getCastLogs(log, 0, fight_dur);
            switch (log.getBossData().getID())
            {
            case 0x3C4E:
                // Invul check
                List <CombatItem> invulsVG = log.getBoonData().Where(x => x.getSkillID() == 757 && getInstid() == x.getDstInstid()).ToList();
                for (int i = 0; i < invulsVG.Count; i++)
                {
                    CombatItem c = invulsVG[i];
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        end = c.getTime() - log.getBossData().getFirstAware();
                        phases.Add(new PhaseData(start, end));
                        if (i == invulsVG.Count - 1)
                        {
                            cast_logs.Add(new CastLog(end, -5, (int)(fight_dur - end), ParseEnum.Activation.None, (int)(fight_dur - end), ParseEnum.Activation.None));
                        }
                    }
                    else
                    {
                        start = c.getTime() - log.getBossData().getFirstAware();
                        cast_logs.Add(new CastLog(end, -5, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x3C45:
                // Ghostly protection check
                List <CastLog> clsG = cast_logs.Where(x => x.getID() == 31759).ToList();
                foreach (CastLog cl in clsG)
                {
                    end = cl.getTime();
                    phases.Add(new PhaseData(start, end));
                    start = end + cl.getActDur();
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x3C0F:
                // Invul check
                List <CombatItem> invulsSab = log.getBoonData().Where(x => x.getSkillID() == 757 && getInstid() == x.getDstInstid()).ToList();
                for (int i = 0; i < invulsSab.Count; i++)
                {
                    CombatItem c = invulsSab[i];
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        end = c.getTime() - log.getBossData().getFirstAware();
                        phases.Add(new PhaseData(start, end));
                        if (i == invulsSab.Count - 1)
                        {
                            cast_logs.Add(new CastLog(end, -5, (int)(fight_dur - end), ParseEnum.Activation.None, (int)(fight_dur - end), ParseEnum.Activation.None));
                        }
                    }
                    else
                    {
                        start = c.getTime() - log.getBossData().getFirstAware();
                        cast_logs.Add(new CastLog(end, -5, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x3EF3:
                // Special buff cast check
                CombatItem  heat_wave    = log.getCombatList().Find(x => x.getSkillID() == 34526);
                List <long> phase_starts = new List <long>();
                if (heat_wave != null)
                {
                    phase_starts.Add(heat_wave.getTime() - log.getBossData().getFirstAware());
                    CombatItem down_pour = log.getCombatList().Find(x => x.getSkillID() == 34554);
                    if (down_pour != null)
                    {
                        phase_starts.Add(down_pour.getTime() - log.getBossData().getFirstAware());
                        CastLog abo = cast_logs.Find(x => x.getID() == 34427);
                        if (abo != null)
                        {
                            phase_starts.Add(abo.getTime());
                        }
                    }
                }
                foreach (long t in phase_starts)
                {
                    end = t;
                    phases.Add(new PhaseData(start, end));
                    // make sure stuff from the precedent phase mix witch each other
                    start = t + 1;
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                string[] namesMat = new string[] { "Fire Phase", "Ice Phase", "Storm Phase", "Abomination Phase" };
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName(namesMat[i - 1]);
                }
                break;

            case 0x3F6B:
                // Main phases
                List <CastLog> clsKC = cast_logs.Where(x => x.getID() == 35048).ToList();
                foreach (CastLog cl in clsKC)
                {
                    end = cl.getTime();
                    phases.Add(new PhaseData(start, end));
                    start = end + cl.getActDur();
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                    start = fight_dur;
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                // add burn phases
                int offset = phases.Count;
                List <CombatItem> orbItems = log.getBoonData().Where(x => x.getDstInstid() == agent.getInstid() && x.getSkillID() == 35096).ToList();
                // Get number of orbs and filter the list
                List <CombatItem>      orbItemsFiltered = new List <CombatItem>();
                Dictionary <long, int> orbs             = new Dictionary <long, int>();
                foreach (CombatItem c in orbItems)
                {
                    long time = c.getTime() - log.getBossData().getFirstAware();
                    if (!orbs.ContainsKey(time))
                    {
                        orbs[time] = 0;
                    }
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        orbs[time] = orbs[time] + 1;
                    }
                    if (orbItemsFiltered.Count > 0)
                    {
                        CombatItem last = orbItemsFiltered.Last();
                        if (last.getTime() != c.getTime())
                        {
                            orbItemsFiltered.Add(c);
                        }
                    }
                    else
                    {
                        orbItemsFiltered.Add(c);
                    }
                }
                foreach (CombatItem c in orbItemsFiltered)
                {
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        start = c.getTime() - log.getBossData().getFirstAware();
                    }
                    else
                    {
                        end = c.getTime() - log.getBossData().getFirstAware();
                        phases.Add(new PhaseData(start, end));
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                    start = fight_dur;
                }
                for (int i = offset; i < phases.Count; i++)
                {
                    phases[i].setName("Burn " + (i - offset + 1) + " (" + orbs[phases[i].getStart()] + " orbs)");
                }
                phases.Sort((x, y) => (x.getStart() < y.getStart()) ? -1 : 1);
                break;

            case 0x3F76:
                // split happened
                if (phaseData.Count == 2)
                {
                    end = phaseData[0] - log.getBossData().getFirstAware();
                    phases.Add(new PhaseData(start, end));
                    start = phaseData[1] - log.getBossData().getFirstAware();
                    cast_logs.Add(new CastLog(end, -5, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x4324:
                // Determined check
                List <CombatItem> invulsSam = log.getBoonData().Where(x => x.getSkillID() == 762 && getInstid() == x.getDstInstid()).ToList();
                // Samarog receives determined twice and its removed twice, filter it
                List <CombatItem> invulsSamFiltered = new List <CombatItem>();
                foreach (CombatItem c in invulsSam)
                {
                    if (invulsSamFiltered.Count > 0)
                    {
                        CombatItem last = invulsSamFiltered.Last();
                        if (last.getTime() != c.getTime())
                        {
                            invulsSamFiltered.Add(c);
                        }
                    }
                    else
                    {
                        invulsSamFiltered.Add(c);
                    }
                }
                for (int i = 0; i < invulsSamFiltered.Count; i++)
                {
                    CombatItem c = invulsSamFiltered[i];
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        end = c.getTime() - log.getBossData().getFirstAware();
                        phases.Add(new PhaseData(start, end));
                        if (i == invulsSamFiltered.Count - 1)
                        {
                            cast_logs.Add(new CastLog(end, -5, (int)(fight_dur - end), ParseEnum.Activation.None, (int)(fight_dur - end), ParseEnum.Activation.None));
                        }
                    }
                    else
                    {
                        start = c.getTime() - log.getBossData().getFirstAware();
                        cast_logs.Add(new CastLog(end, -5, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x4302:
                // Determined + additional data on inst change
                CombatItem invulDei = log.getBoonData().Find(x => x.getSkillID() == 762 && x.isBuffremove() == ParseEnum.BuffRemove.None && x.getDstInstid() == getInstid());
                if (invulDei != null)
                {
                    end = invulDei.getTime() - log.getBossData().getFirstAware();
                    phases.Add(new PhaseData(start, end));
                    start = (phaseData.Count == 1 ? phaseData[0] - log.getBossData().getFirstAware() : fight_dur);
                    cast_logs.Add(new CastLog(end, -6, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            case 0x4BFA:
                CombatItem invulDhuum = log.getBoonData().Find(x => x.getSkillID() == 762 && x.isBuffremove() != ParseEnum.BuffRemove.None && x.getSrcInstid() == getInstid());
                if (invulDhuum != null)
                {
                    end = invulDhuum.getTime() - log.getBossData().getFirstAware();
                    phases.Add(new PhaseData(start, end));
                    start = end + 1;
                    CastLog shield = cast_logs.Find(x => x.getID() == 47396);
                    if (shield != null)
                    {
                        end = shield.getTime();
                        phases.Add(new PhaseData(start, end));
                        start = shield.getTime() + shield.getActDur();
                        if (start < fight_dur - 5000)
                        {
                            phases.Add(new PhaseData(start, fight_dur));
                        }
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                string[] namesDh = new string[] { "Roleplay", "Main Fight", "Ritual" };
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName(namesDh[i - 1]);
                }
                break;

            case 0x427D:
            case 0x4284:
            case 0x4234:
            case 0x44E0:
            case 0x461D:
            case 0x455F:
                List <CombatItem> invulsBoss         = log.getBoonData().Where(x => x.getSkillID() == 762 && agent.getInstid() == x.getDstInstid()).ToList();
                List <CombatItem> invulsBossFiltered = new List <CombatItem>();
                foreach (CombatItem c in invulsBoss)
                {
                    if (invulsBossFiltered.Count > 0)
                    {
                        CombatItem last = invulsBossFiltered.Last();
                        if (last.getTime() != c.getTime())
                        {
                            invulsBossFiltered.Add(c);
                        }
                    }
                    else
                    {
                        invulsBossFiltered.Add(c);
                    }
                }
                for (int i = 0; i < invulsBossFiltered.Count; i++)
                {
                    CombatItem c = invulsBossFiltered[i];
                    if (c.isBuffremove() == ParseEnum.BuffRemove.None)
                    {
                        end = c.getTime() - log.getBossData().getFirstAware();
                        phases.Add(new PhaseData(start, end));
                        if (i == invulsBossFiltered.Count - 1)
                        {
                            cast_logs.Add(new CastLog(end, -5, (int)(fight_dur - end), ParseEnum.Activation.None, (int)(fight_dur - end), ParseEnum.Activation.None));
                        }
                    }
                    else
                    {
                        start = c.getTime() - log.getBossData().getFirstAware();
                        cast_logs.Add(new CastLog(end, -5, (int)(start - end), ParseEnum.Activation.None, (int)(start - end), ParseEnum.Activation.None));
                    }
                }
                if (fight_dur - start > 5000 && start >= phases.Last().getEnd())
                {
                    phases.Add(new PhaseData(start, fight_dur));
                }
                for (int i = 1; i < phases.Count; i++)
                {
                    phases[i].setName("Phase " + i);
                }
                break;

            default:
                break;;
            }
        }
Ejemplo n.º 19
0
        // Private Methods
        private void EstimateWeapons(ParsedLog log)
        {
            string[]         weapons   = new string[4];//first 2 for first set next 2 for second set
            List <SkillItem> s_list    = log.getSkillData().getSkillList();
            List <CastLog>   casting   = getCastLogs(log, 0, log.getBossData().getAwareDuration());
            int            swapped     = 0;//4 for first set and 5 for next
            long           swappedTime = 0;
            List <CastLog> swaps       = casting.Where(x => x.getID() == -2).Take(2).ToList();

            // If the player never swapped, assume they are on their first set
            if (swaps.Count == 0)
            {
                swapped = 4;
            }
            // if the player swapped once, check on which set they started
            else if (swaps.Count == 1)
            {
                swapped = swaps.First().getExpDur() == 4 ? 5 : 4;
            }
            foreach (CastLog cl in casting)
            {
                GW2APISkill apiskill = null;
                SkillItem   skill    = s_list.FirstOrDefault(x => x.getID() == cl.getID());
                if (skill != null)
                {
                    apiskill = skill.GetGW2APISkill();
                }
                if (apiskill != null && cl.getTime() > swappedTime)
                {
                    if (apiskill.type == "Weapon" && apiskill.professions.Count() > 0 && (apiskill.categories == null || (apiskill.categories.Count() == 1 && apiskill.categories[0] == "Phantasm")))
                    {
                        if (apiskill.weapon_type == "Greatsword" || apiskill.weapon_type == "Staff" || apiskill.weapon_type == "Rifle" || apiskill.weapon_type == "Longbow" || apiskill.weapon_type == "Shortbow" || apiskill.weapon_type == "Hammer")
                        {
                            if (swapped == 4 && (weapons[0] == null && weapons[1] == null))
                            {
                                weapons[0] = apiskill.weapon_type;
                                weapons[1] = "2Hand";
                                continue;
                            }
                            else if (swapped == 5 && (weapons[2] == null && weapons[3] == null))
                            {
                                weapons[2] = apiskill.weapon_type;
                                weapons[3] = "2Hand";
                                continue;
                            }
                            continue;
                        }//2 handed
                        if (apiskill.weapon_type == "Focus" || apiskill.weapon_type == "Shield" || apiskill.weapon_type == "Torch" || apiskill.weapon_type == "Warhorn")
                        {
                            if (swapped == 4 && (weapons[1] == null))
                            {
                                weapons[1] = apiskill.weapon_type;
                                continue;
                            }
                            else if (swapped == 5 && (weapons[3] == null))
                            {
                                weapons[3] = apiskill.weapon_type;
                                continue;
                            }
                            continue;
                        }//OffHand
                        if (apiskill.weapon_type == "Axe" || apiskill.weapon_type == "Dagger" || apiskill.weapon_type == "Mace" || apiskill.weapon_type == "Pistol" || apiskill.weapon_type == "Sword" || apiskill.weapon_type == "Scepter")
                        {
                            if (apiskill.slot == "Weapon_1" || apiskill.slot == "Weapon_2" || apiskill.slot == "Weapon_3")
                            {
                                if (swapped == 4 && (weapons[0] == null))
                                {
                                    weapons[0] = apiskill.weapon_type;
                                    continue;
                                }
                                else if (swapped == 5 && (weapons[2] == null))
                                {
                                    weapons[2] = apiskill.weapon_type;
                                    continue;
                                }
                                continue;
                            }
                            if (apiskill.slot == "Weapon_4" || apiskill.slot == "Weapon_5")
                            {
                                if (swapped == 4 && (weapons[1] == null))
                                {
                                    weapons[1] = apiskill.weapon_type;
                                    continue;
                                }
                                else if (swapped == 5 && (weapons[3] == null))
                                {
                                    weapons[3] = apiskill.weapon_type;
                                    continue;
                                }
                                continue;
                            }
                        }// 1 handed
                    }
                }
                else if (cl.getID() == -2)
                {
                    //wepswap
                    swapped     = cl.getExpDur();
                    swappedTime = cl.getTime();
                    continue;
                }
                if (weapons[0] != null && weapons[1] != null && weapons[2] != null && weapons[3] != null)
                {
                    break;
                }
            }
            weapons_array = weapons;
        }