Exemplo n.º 1
0
        private List <JsonPlayerBuffs> BuildPlayerBuffGenerations(List <Dictionary <long, Statistics.FinalBuffs> > statUptimes, Player player)
        {
            var uptimes = new List <JsonPlayerBuffs>();
            int phases  = _phases.Count;

            foreach (var pair in statUptimes[0])
            {
                Boon buff = Boon.BoonsByIds[pair.Key];
                if (!_buffDesc.ContainsKey("b" + pair.Key))
                {
                    _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(buff);
                }
                List <JsonPlayerBuffsData> data = new List <JsonPlayerBuffsData>();
                for (int i = 0; i < _phases.Count; i++)
                {
                    data.Add(new JsonPlayerBuffsData(statUptimes[i][pair.Key], true));
                }
                JsonPlayerBuffs jsonBuffs = new JsonPlayerBuffs()
                {
                    BuffData = data,
                    Id       = pair.Key
                };
                uptimes.Add(jsonBuffs);
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            return(uptimes);
        }
Exemplo n.º 2
0
 public Consumable(Boon item, long time, int duration)
 {
     Buff     = item;
     Time     = time;
     Duration = duration;
     Stack    = 1;
 }
Exemplo n.º 3
0
 public ParsedLog(LogData logData, FightData fightData, AgentData agentData, SkillData skillData,
                  CombatData combatData, List <Player> playerList, Target target)
 {
     _container = new ParsedEvtcContainer(logData, fightData, agentData, skillData, combatData, playerList);
     //
     FightData.SetSuccess(_container);
     if (FightData.FightDuration <= 2200)
     {
         throw new TooShortException();
     }
     if (Properties.Settings.Default.SkipFailedTries && !FightData.Success)
     {
         throw new SkipException();
     }
     CombatData.Update(FightData.FightEnd);
     FightData.SetCM(_container);
     //
     Boons            = new BoonsContainer(logData.GW2Version);
     BoonSourceFinder = Boon.GetBoonSourceFinder(logData.GW2Version, Boons);
     DamageModifiers  = new DamageModifiersContainer(logData.GW2Version);
     MechanicData     = new MechanicData(fightData);
     FightData.Logic.ComputeMechanics(this);
     Statistics   = new Statistics(this);
     LegacyTarget = target;
 }
Exemplo n.º 4
0
 public void Add(Boon boon)
 {
     if (ContainsKey(boon.ID))
     {
         return;
     }
     this[boon.ID] = new List <BoonLog>();
 }
Exemplo n.º 5
0
 public void Add(Boon boon)
 {
     if (ContainsKey(boon.ID))
     {
         return;
     }
     this[boon.ID] = new List <AbstractBuffEvent>();
 }
        private Dictionary <long, JsonBossBuffs> BuildBossBuffs(Dictionary <long, Statistics.FinalBossBoon>[] statBoons, Boss boss)
        {
            int phases = _statistics.Phases.Count;
            var boons  = new Dictionary <long, JsonBossBuffs>();

            var boonsFound    = new List <long>();
            var boonsNotFound = new List <long>();

            for (int phaseIndex = 0; phaseIndex < phases; phaseIndex++)
            {
                foreach (var boon in statBoons[phaseIndex])
                {
                    _buffNames[boon.Key] = Boon.BoonsByIds[boon.Key].Name;
                    if (_devMode)
                    {
                        Boon buff = Boon.BoonsByIds[boon.Key];
                        _buffData[boon.Key] = new BuffDesc()
                        {
                            Icon     = buff.Link,
                            Stacking = buff.Type == Boon.BoonType.Intensity ? 1 : 0,
                            Table    = buff.Nature == Boon.BoonNature.Boon ? 0 : (buff.Nature == Boon.BoonNature.Condition ? 1 : (buff.Nature == Boon.BoonNature.OffensiveBuffTable ? 2 : (buff.Nature == Boon.BoonNature.DefensiveBuffTable ? 3 : -1)))
                        };
                    }
                    if (boonsFound.Contains(boon.Key))
                    {
                        MakePhaseBossBoon(boons[boon.Key], phaseIndex, boon.Value);
                    }
                    else if (!boonsNotFound.Contains(boon.Key))
                    {
                        if (ContainsBossBoon(boon.Key, statBoons))
                        {
                            boonsFound.Add(boon.Key);

                            boons[boon.Key] = new JsonBossBuffs(phases);
                            MakePhaseBossBoon(boons[boon.Key], phaseIndex, boon.Value);
                            if (boss.GetBoonGraphs(_log).TryGetValue(boon.Key, out var bgm))
                            {
                                foreach (BoonsGraphModel.Segment seg in bgm.BoonChart)
                                {
                                    boons[boon.Key].States.Add(new int[2] {
                                        (int)seg.Start,
                                        seg.Value
                                    });
                                }
                            }
                        }
                        else
                        {
                            boonsNotFound.Add(boon.Key);
                        }
                    }
                }
            }

            return(boons);
        }
Exemplo n.º 7
0
        // Boons

        public static BoonSummaryViewModel BoonSummary(Boon boon)
        {
            return(new BoonSummaryViewModel
            {
                Id = boon.Id,
                Level = boon.Level.Name,
                Debtor = CharacterSummary(boon.Debtor),
                Creditor = CharacterSummary(boon.Creditor)
            });
        }
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            HashSet <long> skillIDs = _log.CombatData.GetSkills();

            // Main boons
            foreach (Boon boon in Boon.GetBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentBoons.Add(boon);
                }
            }
            // Main Conditions
            foreach (Boon boon in Boon.GetCondiBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentConditions.Add(boon);
                }
            }

            // Important class specific boons
            foreach (Boon boon in Boon.GetOffensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentOffbuffs.Add(boon);
                }
            }

            foreach (Boon boon in Boon.GetDefensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentDefbuffs.Add(boon);
                }
            }

            // All class specific boons
            Dictionary <long, Boon> remainingBuffsByIds = Boon.GetRemainingBuffsList().GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault());
            var players = _log.PlayerList;

            foreach (Player player in players)
            {
                _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>();
                foreach (CombatItem item in _log.CombatData.GetBoonDataByDst(player.InstID, player.FirstAware, player.LastAware))
                {
                    if (item.DstInstid == player.InstID && item.IsBuffRemove == ParseEnum.BuffRemove.None && remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon))
                    {
                        _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                    }
                }
            }
        }
Exemplo n.º 9
0
        protected override void SetBoonStatusGenerationData(ParsedLog log, BoonSimulationItem simul, long boonid)
        {
            List <PhaseData> phases = log.FightData.GetPhases(log);
            Boon             boon   = log.Boons.BoonsByIds[boonid];

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                Add(_buffPresence[i], boonid, simul.GetClampedDuration(phase.Start, phase.End));
                simul.SetBoonDistributionItem(_boonDistribution[i], phase.Start, phase.End, boonid, log);
            }
        }
Exemplo n.º 10
0
        private List <JsonPlayerBuffs> BuildPlayerBuffUptimes(List <Dictionary <long, Statistics.FinalBuffs> > statUptimes, Player player)
        {
            var uptimes = new List <JsonPlayerBuffs>();
            int phases  = _phases.Count;

            foreach (var pair in statUptimes[0])
            {
                Boon buff = Boon.BoonsByIds[pair.Key];
                if (!_buffDesc.ContainsKey("b" + pair.Key))
                {
                    _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(buff);
                }
                if (buff.Nature == Boon.BoonNature.GraphOnlyBuff && buff.Source == Boon.ProfToEnum(player.Prof))
                {
                    if (player.GetBoonDistribution(_log, 0).GetUptime(pair.Key) > 0)
                    {
                        if (_personalBuffs.TryGetValue(player.Prof, out var list) && !list.Contains(pair.Key))
                        {
                            list.Add(pair.Key);
                        }
                        else
                        {
                            _personalBuffs[player.Prof] = new HashSet <long>()
                            {
                                pair.Key
                            };
                        }
                    }
                }
                List <JsonPlayerBuffsData> data = new List <JsonPlayerBuffsData>();
                for (int i = 0; i < _phases.Count; i++)
                {
                    data.Add(new JsonPlayerBuffsData(statUptimes[i][pair.Key], false));
                }
                JsonPlayerBuffs jsonBuffs = new JsonPlayerBuffs()
                {
                    States   = BuildBuffStates(player.GetBoonGraphs(_log)[pair.Key]),
                    BuffData = data,
                    Id       = pair.Key
                };
                uptimes.Add(jsonBuffs);
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            return(uptimes);
        }
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void setPresentBoons()
        {
            List <SkillItem> s_list = log.getSkillData().getSkillList();

            if (settings.PlayerBoonsUniversal)
            {//Main boons
                foreach (Boon boon in Boon.getBoonList())
                {
                    if (s_list.Exists(x => x.getID() == boon.getID()))
                    {
                        statistics.present_boons.Add(boon);
                    }
                }
            }
            if (settings.PlayerBoonsImpProf)
            {//Important Class specefic boons
                foreach (Boon boon in Boon.getOffensiveTableList())
                {
                    if (s_list.Exists(x => x.getID() == boon.getID()))
                    {
                        statistics.present_offbuffs.Add(boon);
                    }
                }
                foreach (Boon boon in Boon.getDefensiveTableList())
                {
                    if (s_list.Exists(x => x.getID() == boon.getID()))
                    {
                        statistics.present_defbuffs.Add(boon);
                    }
                }
            }
            List <CombatItem> c_list = log.getCombatData().getCombatList();

            foreach (Player p in log.getPlayerList())
            {
                statistics.present_personnal[p.getInstid()] = new List <Boon>();
                if (settings.PlayerBoonsAllProf)
                {//All class specefic boons
                    foreach (Boon boon in Boon.getRemainingBuffsList())
                    {
                        if (c_list.Exists(x => x.getSkillID() == boon.getID() && x.getDstInstid() == p.getInstid()))
                        {
                            statistics.present_personnal[p.getInstid()].Add(boon);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
 public static BoonDetailViewModel BoonDetail(Boon boon)
 {
     return(new BoonDetailViewModel()
     {
         Id = boon.Id,
         Level = boon.Level.Name,
         Registrar = CharacterSummary(boon.Registrar),
         Creditor = CharacterSummary(boon.Creditor),
         Debtor = CharacterSummary(boon.Debtor),
         RegistrationCause = boon.RegistrationCause,
         RegistrationDate = boon.RegistrationDate.ToString(),
         ExpenditureCause = boon.ExpenditureCause,
         ExpenditureDate = boon.ExpenditureDate.ToString(),
         Stipulations = boon.Stipulations
     });
 }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        private List <JsonDamageDist> BuildDamageDist(List <AbstractDamageEvent> dls)
        {
            List <JsonDamageDist> res = new List <JsonDamageDist>();
            Dictionary <SkillItem, List <AbstractDamageEvent> > dict = dls.GroupBy(x => x.Skill).ToDictionary(x => x.Key, x => x.ToList());

            foreach (KeyValuePair <SkillItem, List <AbstractDamageEvent> > pair in dict)
            {
                if (pair.Value.Count == 0)
                {
                    continue;
                }
                SkillItem skill    = pair.Key;
                bool      indirect = pair.Value.Exists(x => x is NonDirectDamageEvent);
                if (indirect)
                {
                    if (!_buffDesc.ContainsKey("b" + pair.Key))
                    {
                        if (_log.Boons.BoonsByIds.TryGetValue(pair.Key.ID, out Boon buff))
                        {
                            _buffDesc["b" + pair.Key] = new JsonLog.BuffDesc(buff);
                        }
                        else
                        {
                            Boon auxBoon = new Boon(skill.Name, pair.Key.ID, 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 <AbstractDamageEvent> filteredList = pair.Value.Where(x => !x.HasDowned).ToList();
                if (filteredList.Count == 0)
                {
                    continue;
                }
                string prefix = indirect ? "b" : "s";
                res.Add(new JsonDamageDist(filteredList, indirect, pair.Key.ID));
            }
            return(res);
        }
Exemplo n.º 15
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            // Dummy Character Init
            Character Chosimba = new Character("Chosimba", 1000, 500);

            CharactersLoaded.Add(Chosimba);

            Boon Speedy = new classes.Boon("Speedy", "GO FAST MAN", Boon.Target.Speed, 10.0, true, false, DateTime.Now.AddMinutes(10));
            Boon Cozy   = new Boon("Cozy Lava", "Feelin' comfy in a warm, molten blanket.", Boon.Target.Health, 15.0, false, false, DateTime.Now.AddSeconds(5));
            Boon Ants   = new Boon("FIRE ANTS!", "Itchy as all hell...", Boon.Target.Health, 30.0, false, true, DateTime.Now.AddSeconds(10));

            Chosimba.ApplyBoon(Speedy);
            Chosimba.ApplyBoon(Cozy);
            Chosimba.ApplyBoon(Ants);

            // Start Server Tick
            startSlowpoke();
        }
        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.º 17
0
        /// <summary>
        /// Parses skill related data
        /// </summary>
        private void parseSkillData(Stream stream)
        {
            var apiController = new GW2APIController();

            using (var reader = CreateReader(stream))
            {
                // 4 bytes: player count
                int skill_count = reader.ReadInt32();
                //TempData["Debug"] += "Skill Count:" + skill_count.ToString();
                // 68 bytes: each skill
                for (int i = 0; i < skill_count; i++)
                {
                    // 4 bytes: skill ID
                    int skill_id = reader.ReadInt32();

                    // 64 bytes: name
                    var name = ParseHelper.getString(stream, 64);
                    if (skill_id != 0 && int.TryParse(name, out int n) && n == skill_id)
                    {
                        //was it a known boon?
                        foreach (Boon b in Boon.getBoonList())
                        {
                            if (skill_id == b.getID())
                            {
                                name = b.getName();
                            }
                        }
                    }
                    //Save

                    var skill = new SkillItem(skill_id, name);

                    skill.SetGW2APISkill(apiController);
                    skill_data.addItem(skill);
                }
            }
        }
Exemplo n.º 18
0
        private void SetConsumablesList(ParsedLog log)
        {
            List <Boon> consumableList = Boon.GetConsumableList();

            _consumeList = new List <Consumable>();
            long fightDuration = log.FightData.FightDuration;

            foreach (Boon consumable in consumableList)
            {
                foreach (CombatItem c in log.CombatData.GetBoonData(consumable.ID))
                {
                    if (c.IsBuffRemove != ParseEnum.BuffRemove.None || (c.IsBuff != 18 && c.IsBuff != 1) || AgentItem.InstID != c.DstInstid)
                    {
                        continue;
                    }
                    long time = 0;
                    if (c.IsBuff != 18)
                    {
                        time = log.FightData.ToFightSpace(c.Time);
                    }
                    if (time <= fightDuration)
                    {
                        Consumable existing = _consumeList.Find(x => x.Time == time && x.Buff.ID == consumable.ID);
                        if (existing != null)
                        {
                            existing.Stack++;
                        }
                        else
                        {
                            _consumeList.Add(new Consumable(consumable, time, c.Value));
                        }
                    }
                }
            }
            _consumeList.Sort((x, y) => x.Time.CompareTo(y.Time));
        }
Exemplo n.º 19
0
 public BuffDamageModifier(Boon buff, string name, string tooltip, DamageSource damageSource, double gainPerStack, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer, string url, DamageLogChecker dlChecker) : base(name, tooltip, damageSource, gainPerStack, srctype, compareType, src, url, gainComputer, dlChecker)
 {
     BuffsChecker = new BuffsTrackerSingle(buff);
 }
Exemplo n.º 20
0
 // Constructor
 public BoonsGraphModel(Boon boon)
 {
     Boon = boon;
 }
Exemplo n.º 21
0
 public BoonsGraphModel(Boon boon, List <SegmentWithSources> boonChartWithSource)
 {
     Boon = boon;
     _boonChartWithSource = boonChartWithSource;
     FuseFromSegmentsWithSource();
 }
Exemplo n.º 22
0
        private Dictionary <string, JsonBuffs> BuildBuffUptime(Dictionary <long, Statistics.FinalBuffs>[] statUptimes, Player player)
        {
            var uptimes = new Dictionary <string, JsonBuffs>();
            int phases  = _statistics.Phases.Count;

            var boonsFound    = new HashSet <long>();
            var boonsNotFound = new HashSet <long>();

            for (int phaseIndex = 0; phaseIndex < phases; phaseIndex++)
            {
                foreach (var boon in statUptimes[phaseIndex])
                {
                    Boon buff = Boon.BoonsByIds[boon.Key];
                    _buffNames["b" + boon.Key] = buff.Name;
                    if (buff.Nature == Boon.BoonNature.GraphOnlyBuff && buff.Source == Boon.ProfToEnum(player.Prof))
                    {
                        if (player.GetBoonDistribution(_log, 0).GetUptime(boon.Key) > 0)
                        {
                            if (_personalBuffs.TryGetValue(player.Prof, out var list) && !list.Contains(boon.Key))
                            {
                                list.Add(boon.Key);
                            }
                            else
                            {
                                _personalBuffs[player.Prof] = new HashSet <long>()
                                {
                                    boon.Key
                                };
                            }
                        }
                    }
                    if (boonsFound.Contains(boon.Key))
                    {
                        MakePhaseBoon(uptimes["b" + boon.Key], phaseIndex, boon.Value);
                    }
                    else if (!boonsNotFound.Contains(boon.Key))
                    {
                        if (ContainsBoon(boon.Key, statUptimes))
                        {
                            boonsFound.Add(boon.Key);

                            uptimes["b" + boon.Key] = new JsonBuffs(phases);
                            MakePhaseBoon(uptimes["b" + boon.Key], phaseIndex, boon.Value);
                            if (player.GetBoonGraphs(_log).TryGetValue(boon.Key, out var bgm))
                            {
                                uptimes["b" + boon.Key].states = BuildBuffStates(bgm);
                            }
                        }
                        else
                        {
                            boonsNotFound.Add(boon.Key);
                        }
                    }
                }
            }

            if (!uptimes.Any())
            {
                return(null);
            }

            foreach (var boon in uptimes)
            {
                RemoveZeroArrays(boon.Value);
            }

            return(uptimes);
        }
Exemplo n.º 23
0
 public BuffDesc(Boon item)
 {
     Name     = item.Name;
     Icon     = item.Link;
     Stacking = item.Type == Boon.BoonType.Intensity;
 }
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            List <CombatItem> combatList = _log.CombatData.AllCombatItems;
            var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID));

            // Main boons
            foreach (Boon boon in Boon.GetBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentBoons.Add(boon);
                }
            }
            // Main Conditions
            foreach (Boon boon in Boon.GetCondiBoonList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentConditions.Add(boon);
                }
            }

            // Important class specific boons
            foreach (Boon boon in Boon.GetOffensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentOffbuffs.Add(boon);
                }
            }

            foreach (Boon boon in Boon.GetDefensiveTableList())
            {
                if (skillIDs.Contains(boon.ID))
                {
                    _statistics.PresentDefbuffs.Add(boon);
                }
            }

            var players = _log.PlayerList;
            Dictionary <ushort, Player> playersById = new Dictionary <ushort, Player>();

            foreach (Player player in players)
            {
                _statistics.PresentPersonalBuffs[player.InstID] = new HashSet <Boon>();
                playersById.Add(player.InstID, player);
            }
            // All class specific boons
            List <Boon> remainingBuffs = new List <Boon>(Boon.GetRemainingBuffsList());

            remainingBuffs.AddRange(Boon.GetConsumableList());
            Dictionary <long, Boon> remainingBuffsByIds = remainingBuffs.GroupBy(x => x.ID).ToDictionary(x => x.Key, x => x.ToList().FirstOrDefault());

            foreach (CombatItem item in combatList)
            {
                if (playersById.TryGetValue(item.DstInstid, out Player player))
                {
                    if (remainingBuffsByIds.TryGetValue(item.SkillID, out Boon boon))
                    {
                        _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                    }
                }
            }
        }
        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);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Checks the combat data and gets buffs that were present during the fight
        /// </summary>
        private void SetPresentBoons()
        {
            List <CombatItem> combatList = _log.CombatData.AllCombatItems;
            var skillIDs = new HashSet <long>(combatList.Select(x => x.SkillID));

            if (_settings.PlayerBoonsUniversal)
            {
                // Main boons
                foreach (Boon boon in Boon.GetBoonList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentBoons.Add(boon);
                    }
                }
                // Main Conditions
                foreach (Boon boon in Boon.GetCondiBoonList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentConditions.Add(boon);
                    }
                }
            }

            if (_settings.PlayerBoonsImpProf)
            {
                // Important class specific boons
                foreach (Boon boon in Boon.GetOffensiveTableList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentOffbuffs.Add(boon);
                    }
                }

                foreach (Boon boon in Boon.GetDefensiveTableList())
                {
                    if (skillIDs.Contains(boon.ID))
                    {
                        _statistics.PresentDefbuffs.Add(boon);
                    }
                }
            }

            var players = _log.PlayerList;

            if (_settings.PlayerBoonsAllProf)
            {
                var playersById = new Dictionary <ushort, Player>();
                foreach (var player in players)
                {
                    _statistics.PresentPersonalBuffs[player.InstID] = new List <Boon>();
                    playersById.Add(player.InstID, player);
                }
                // All class specific boons
                var remainingBoons = new List <Boon>(Boon.GetRemainingBuffsList());
                remainingBoons.AddRange(Boon.GetConsumableList());
                var classSpecificBoonsById = new Dictionary <long, Boon>();
                foreach (var boon in remainingBoons)
                {
                    if (boon.ID == -1)
                    {
                        continue;
                    }

                    classSpecificBoonsById.Add(boon.ID, boon);
                }

                foreach (var item in combatList)
                {
                    if (playersById.TryGetValue(item.DstInstid, out Player player))
                    {
                        if (classSpecificBoonsById.TryGetValue(item.SkillID, out Boon boon))
                        {
                            _statistics.PresentPersonalBuffs[player.InstID].Add(boon);
                        }
                    }
                }
            }
            foreach (Player player in players)
            {
                player.BoonToTrack.AddRange(_statistics.PresentBoons);
                player.BoonToTrack.AddRange(_statistics.PresentConditions);
                player.BoonToTrack.AddRange(_statistics.PresentOffbuffs);
                player.BoonToTrack.AddRange(_statistics.PresentDefbuffs);
                if (_settings.PlayerBoonsAllProf)
                {
                    player.BoonToTrack.AddRange(_statistics.PresentPersonalBuffs[player.InstID]);
                }
            }
            // target boons
            foreach (Target target in _log.FightData.Logic.Targets)
            {
                target.BoonToTrack.AddRange(_statistics.PresentBoons);
                target.BoonToTrack.AddRange(_statistics.PresentConditions);
                foreach (Boon boon in Boon.BoonsBySource[Boon.BoonSource.Enemy])
                {
                    if (_log.CombatData.BoonData.ContainsKey(boon.ID))
                    {
                        target.BoonToTrack.Add(boon);
                    }
                }
            }
        }
Exemplo n.º 27
0
        protected void SetBoonStatus(ParsedLog log)
        {
            BoonPoints = new Dictionary <long, BoonsGraphModel>();
            BoonMap         toUse              = GetBoonMap(log);
            long            dur                = log.FightData.FightDuration;
            int             fightDuration      = (int)(dur) / 1000;
            BoonsGraphModel boonPresenceGraph  = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfBoonsID]);
            BoonsGraphModel condiPresenceGraph = new BoonsGraphModel(Boon.BoonsByIds[Boon.NumberOfConditionsID]);
            HashSet <long>  boonIds            = new HashSet <long>(Boon.GetBoonList().Select(x => x.ID));
            HashSet <long>  condiIds           = new HashSet <long>(Boon.GetCondiBoonList().Select(x => x.ID));

            InitBoonStatusData(log);

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

            foreach (Boon boon in TrackedBoons)
            {
                long boonid = boon.ID;
                if (toUse.TryGetValue(boonid, out List <BoonLog> logs) && logs.Count != 0)
                {
                    if (BoonPoints.ContainsKey(boonid))
                    {
                        continue;
                    }
                    BoonSimulator simulator = boon.CreateSimulator(log);
                    simulator.Simulate(logs, dur);
                    if (death > 0 && GetCastLogs(log, death + 5000, dur).Count == 0)
                    {
                        simulator.Trim(death);
                    }
                    else
                    {
                        simulator.Trim(dur);
                    }
                    bool updateBoonPresence  = boonIds.Contains(boonid);
                    bool updateCondiPresence = condiIds.Contains(boonid);
                    List <BoonsGraphModel.SegmentWithSources> graphSegments = new List <BoonsGraphModel.SegmentWithSources>();
                    foreach (BoonSimulationItem simul in simulator.GenerationSimulation)
                    {
                        SetBoonStatusGenerationData(log, simul, boonid);
                        BoonsGraphModel.SegmentWithSources segment = simul.ToSegment();
                        if (graphSegments.Count == 0)
                        {
                            graphSegments.Add(new BoonsGraphModel.SegmentWithSources(0, segment.Start, 0, GeneralHelper.UnknownAgent));
                        }
                        else if (graphSegments.Last().End != segment.Start)
                        {
                            graphSegments.Add(new BoonsGraphModel.SegmentWithSources(graphSegments.Last().End, segment.Start, 0, GeneralHelper.UnknownAgent));
                        }
                        graphSegments.Add(segment);
                    }
                    SetBoonStatusCleanseWasteData(log, simulator, boonid, updateCondiPresence);
                    if (graphSegments.Count > 0)
                    {
                        graphSegments.Add(new BoonsGraphModel.SegmentWithSources(graphSegments.Last().End, dur, 0, GeneralHelper.UnknownAgent));
                    }
                    else
                    {
                        graphSegments.Add(new BoonsGraphModel.SegmentWithSources(0, dur, 0, GeneralHelper.UnknownAgent));
                    }
                    BoonPoints[boonid] = new BoonsGraphModel(boon, graphSegments);
                    if (updateBoonPresence || updateCondiPresence)
                    {
                        List <BoonsGraphModel.Segment> segmentsToFill = updateBoonPresence ? boonPresenceGraph.BoonChart : condiPresenceGraph.BoonChart;
                        bool firstPass = segmentsToFill.Count == 0;
                        foreach (BoonsGraphModel.Segment seg in BoonPoints[boonid].BoonChart)
                        {
                            long start = seg.Start;
                            long end   = seg.End;
                            int  value = seg.Value > 0 ? 1 : 0;
                            if (firstPass)
                            {
                                segmentsToFill.Add(new BoonsGraphModel.Segment(start, end, value));
                            }
                            else
                            {
                                for (int i = 0; i < segmentsToFill.Count; i++)
                                {
                                    BoonsGraphModel.Segment curSeg = segmentsToFill[i];
                                    long curEnd   = curSeg.End;
                                    long curStart = curSeg.Start;
                                    int  curVal   = curSeg.Value;
                                    if (curStart > end)
                                    {
                                        break;
                                    }
                                    if (curEnd < start)
                                    {
                                        continue;
                                    }
                                    if (end <= curEnd)
                                    {
                                        curSeg.End = start;
                                        segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, end, curVal + value));
                                        segmentsToFill.Insert(i + 2, new BoonsGraphModel.Segment(end, curEnd, curVal));
                                        break;
                                    }
                                    else
                                    {
                                        curSeg.End = start;
                                        segmentsToFill.Insert(i + 1, new BoonsGraphModel.Segment(start, curEnd, curVal + value));
                                        start = curEnd;
                                        i++;
                                    }
                                }
                            }
                        }
                        if (updateBoonPresence)
                        {
                            boonPresenceGraph.FuseSegments();
                        }
                        else
                        {
                            condiPresenceGraph.FuseSegments();
                        }
                    }
                }
            }
            BoonPoints[Boon.NumberOfBoonsID]      = boonPresenceGraph;
            BoonPoints[Boon.NumberOfConditionsID] = condiPresenceGraph;
        }
Exemplo n.º 28
0
 public BoonMap(Boon boon)
 {
     this[boon.ID] = new List <BoonLog>();
 }
Exemplo n.º 29
0
        public static object[] GetDMGDtoItem(KeyValuePair <SkillItem, List <AbstractDamageEvent> > entry, Dictionary <SkillItem, List <AbstractCastEvent> > castLogsBySkill, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Boon> usedBoons, BoonsContainer boons)
        {
            int totaldamage       = 0,
                mindamage         = int.MaxValue,
                maxdamage         = int.MinValue,
                hits              = 0,
                crit              = 0,
                flank             = 0,
                glance            = 0,
                shieldDamage      = 0;
            bool IsIndirectDamage = false;

            foreach (AbstractDamageEvent dl in entry.Value.Where(x => !x.HasDowned))
            {
                IsIndirectDamage = IsIndirectDamage || dl is NonDirectDamageEvent;
                int curdmg = dl.Damage;
                totaldamage += curdmg;
                if (curdmg < mindamage)
                {
                    mindamage = curdmg;
                }
                if (curdmg > maxdamage)
                {
                    maxdamage = curdmg;
                }
                hits++;
                if (dl.HasCrit)
                {
                    crit++;
                }
                if (dl.HasGlanced)
                {
                    glance++;
                }
                if (dl.IsFlanking)
                {
                    flank++;
                }
                shieldDamage += dl.ShieldDamage;
            }
            if (IsIndirectDamage)
            {
                if (!usedBoons.ContainsKey(entry.Key.ID))
                {
                    if (boons.BoonsByIds.TryGetValue(entry.Key.ID, out Boon buff))
                    {
                        usedBoons.Add(buff.ID, buff);
                    }
                    else
                    {
                        SkillItem aux     = entry.Key;
                        Boon      auxBoon = new Boon(aux.Name, entry.Key.ID, aux.Icon);
                        usedBoons.Add(auxBoon.ID, auxBoon);
                    }
                }
            }
            else
            {
                if (!usedSkills.ContainsKey(entry.Key.ID))
                {
                    usedSkills.Add(entry.Key.ID, entry.Key);
                }
            }

            int casts = 0, timeswasted = 0, timessaved = 0;

            if (!IsIndirectDamage && castLogsBySkill != null && castLogsBySkill.TryGetValue(entry.Key, out List <AbstractCastEvent> clList))
            {
                casts = clList.Count;
                foreach (AbstractCastEvent cl in clList)
                {
                    if (cl.Interrupted)
                    {
                        timeswasted += cl.ActualDuration;
                    }
                    else if (cl.ReducedAnimation && cl.ActualDuration < cl.ExpectedDuration)
                    {
                        timessaved += cl.ExpectedDuration - cl.ActualDuration;
                    }
                }
            }
            object[] skillItem =
            {
                IsIndirectDamage,
                entry.Key.ID,
                totaldamage,
                mindamage == int.MaxValue ? 0 : mindamage,
                maxdamage == int.MinValue ? 0 : maxdamage,
                IsIndirectDamage ? 0 : casts,
                hits,
                IsIndirectDamage ? 0 : crit,
                IsIndirectDamage ? 0 : flank,
                IsIndirectDamage ? 0 : glance,
                IsIndirectDamage ? 0 : timeswasted / 1000.0,
                IsIndirectDamage ? 0 : timessaved / 1000.0,
                shieldDamage,
            };
            return(skillItem);
        }
Exemplo n.º 30
0
 public DamageLogDamageModifier(Boon boon, string tooltip, long id, DamageSource damageSource, DamageType srctype, DamageType compareType, ModifierSource src, GainComputer gainComputer) : base(boon.Name, tooltip, damageSource, double.PositiveInfinity, srctype, compareType, src, boon.Link, gainComputer)
 {
     DLChecker = (dl => dl.SkillId == id);
 }