Exemple #1
0
        public static void ManualExport(NpcEntity entity, AbnormalityStorage abnormality, Dest type)
        {
            if (entity == null)
            {
                return;
            }
            var stats = GenerateStats(entity, abnormality);

            if (stats == null)
            {
                return;
            }
            var sendThread = new Thread(() =>
            {
                if (type.HasFlag(Dest.Site) && NetworkController.Instance.BossLink.Any(x => x.Value == entity && x.Key.StartsWith("!")))
                {
                    DpsServers.Where(x => NetworkController.Instance.BossLink.Where(y => y.Value == entity && y.Key.StartsWith("!"))
                                     .Select(y => y.Key.Substring(1, y.Key.IndexOf(" ", StringComparison.Ordinal) - 1))
                                     .Contains(x.Guid.ToString())).ToList().ForEach(x => x.CheckAndSendFightData(stats.BaseStats, entity));
                }
                if (type.HasFlag(Dest.Excel))
                {
                    ExcelExport.ExcelSave(stats,
                                          stats.BaseStats.members.Select(x => x.playerName)
                                          .FirstOrDefault(x => NetworkController.Instance.MeterPlayers.Select(z => z.Name).Contains(x)), type.HasFlag(Dest.Manual));
                }
            });

            sendThread.Start();
        }
Exemple #2
0
        public static void Export(SDespawnNpc despawnNpc, AbnormalityStorage abnormality)
        {
            var stats = GenerateStats(despawnNpc, abnormality);

            if (stats == null)
            {
                return;
            }
            var sendThread = new Thread(() => {
                ToTeraDpsApi(stats.BaseStats, despawnNpc);
                ExcelExport.ExcelSave(stats);
                ToAnonymousStatistics(stats.BaseStats);
            });

            sendThread.Start();
        }
Exemple #3
0
        public static void Export(NpcEntity entity, AbnormalityStorage abnormality)
        {
            if (entity == null)
            {
                return;
            }
            var stats = GenerateStats(entity, abnormality);

            if (stats == null)
            {
                return;
            }
            var sendThread = new Thread(() =>
            {
                ExcelExport.ExcelSave(stats);
            });

            sendThread.Start();
        }
Exemple #4
0
        public static void AutomatedExport(NpcEntity entity, AbnormalityStorage abnormality)
        {
            if (entity == null)
            {
                return;
            }
            var stats = GenerateStats(entity, abnormality);

            if (stats == null)
            {
                return;
            }

            var sendThread = new Thread(() =>
            {
                ToTeraDpsApi(stats.BaseStats, entity);
                ToPrivateServer(stats.BaseStats, entity);
                ExcelExport.ExcelSave(stats, NetworkController.Instance.EntityTracker.MeterUser.Name);
                ToAnonymousStatistics(stats.BaseStats);
            });

            sendThread.Start();
        }
Exemple #5
0
        public static void AutomatedExport(NpcEntity entity, AbnormalityStorage abnormality)
        {
            if (entity == null)
            {
                return;
            }
            var stats = GenerateStats(entity, abnormality);

            if (stats == null)
            {
                return;
            }

            var sendThread = new Thread(() =>
            {
                DpsServers.Where(x => !x.AnonymousUpload).ToList().ForEach(x => x.CheckAndSendFightData(stats.BaseStats, entity));
                ExcelExport.ExcelSave(stats, NetworkController.Instance.EntityTracker.MeterUser.Name);
                Anonymize(stats.BaseStats);
                DpsServers.Where(x => x.AnonymousUpload).ToList().ForEach(x => x.CheckAndSendFightData(stats.BaseStats, entity));
            });

            sendThread.Start();
        }
Exemple #6
0
        public static void Export(SDespawnNpc despawnNpc, AbnormalityStorage abnormality)
        {
            if (!despawnNpc.Dead)
            {
                return;
            }

            var entity = (NpcEntity)DamageTracker.Instance.GetEntity(despawnNpc.Npc);

            var stats = GenerateStats(entity, abnormality);

            if (stats == null)
            {
                return;
            }
            var sendThread = new Thread(() =>
            {
                ToTeraDpsApi(stats.BaseStats, despawnNpc);
                ExcelExport.ExcelSave(stats, NetworkController.Instance.EntityTracker.MeterUser.Name);
                ToAnonymousStatistics(stats.BaseStats);
            });

            sendThread.Start();
        }
        public static void ToTeraDpsApi(SDespawnNpc despawnNpc, AbnormalityStorage abnormals)
        {
            if (!BasicTeraData.Instance.WindowData.Excel &&
                (string.IsNullOrEmpty(BasicTeraData.Instance.WindowData.TeraDpsToken) || string.IsNullOrEmpty(BasicTeraData.Instance.WindowData.TeraDpsUser)))
            {
                return;
            }

            if (!despawnNpc.Dead)
            {
                return;
            }

            var entity = DamageTracker.Instance.GetEntity(despawnNpc.Npc);

            if (!entity.IsBoss)
            {
                return;
            }

            bool timedEncounter = false;

            //Nightmare desolarus
            if (entity.NpcE.Info.HuntingZoneId == 759 && entity.NpcE.Info.TemplateId == 1003)
            {
                timedEncounter = true;
            }

            var interval = DamageTracker.Instance.Interval(entity);

            if (interval == 0)
            {
                return;
            }
            var stats       = DamageTracker.Instance.GetPlayerStats();
            var firstHit    = DamageTracker.Instance.FirstHit(entity);
            var lastHit     = DamageTracker.Instance.LastHit(entity);
            var entities    = DamageTracker.Instance.GetEntityStats();
            var totaldamage = DamageTracker.Instance.TotalDamage(entity, timedEncounter);
            var partyDps    = DamageTracker.Instance.PartyDps(entity, timedEncounter);

            var teradpsData = new EncounterBase();

            teradpsData.areaId        = entity.NpcE.Info.HuntingZoneId + "";
            teradpsData.bossId        = entity.NpcE.Info.TemplateId + "";
            teradpsData.fightDuration = interval + "";
            teradpsData.partyDps      = partyDps + "";

            foreach (var debuff in abnormals.Get(entity.NpcE))
            {
                long percentage = (debuff.Value.Duration(firstHit, lastHit) * 100 / interval);
                if (percentage == 0)
                {
                    continue;
                }
                teradpsData.debuffUptime.Add(new KeyValuePair <string, string>(
                                                 debuff.Key.Id + "", percentage + ""
                                                 ));
            }

            foreach (var user in stats)
            {
                var teradpsUser = new Members();
                var damage      = user.Dealt.Damage(entity, timedEncounter);
                teradpsUser.playerTotalDamage = damage + "";

                if (damage <= 0)
                {
                    continue;
                }

                var buffs = abnormals.Get(user.Player);
                teradpsUser.playerClass                 = user.Class.ToString();
                teradpsUser.playerName                  = user.Name;
                teradpsUser.playerServer                = BasicTeraData.Instance.Servers.GetServerName(user.Player.ServerId);
                teradpsUser.playerAverageCritRate       = user.Dealt.CritRate(entity, timedEncounter) + "";
                teradpsUser.playerDps                   = user.Dealt.GlobalDps(entity, timedEncounter, interval) + "";
                teradpsUser.playerTotalDamagePercentage = user.Dealt.DamageFraction(entity, totaldamage, timedEncounter) + "";

                var death = buffs.Death;
                teradpsUser.playerDeaths        = death.Count(firstHit, lastHit) + "";
                teradpsUser.playerDeathDuration = death.Duration(firstHit, lastHit) + "";

                foreach (var buff in buffs.Times)
                {
                    long percentage = (buff.Value.Duration(user.Dealt.GetFirstHit(entity), user.Dealt.GetLastHit(entity)) * 100 / interval);
                    if (percentage == 0)
                    {
                        continue;
                    }
                    teradpsUser.buffUptime.Add(new KeyValuePair <string, string>(
                                                   buff.Key.Id + "", percentage + ""
                                                   ));
                }
                Dictionary <Skills.Skill.Skill, SkillStats> notimedskills;
                if (timedEncounter)
                {
                    notimedskills = NoTimedSkills(user.Dealt.GetSkillsByTime(entity));
                }
                else
                {
                    notimedskills = NoTimedSkills(user.Dealt.GetSkills(entity));
                }

                foreach (var skill in notimedskills)
                {
                    var skillLog    = new SkillLog();
                    var skilldamage = skill.Value.Damage;

                    skillLog.skillAverageCrit   = skill.Value.DmgAverageCrit + "";
                    skillLog.skillAverageWhite  = skill.Value.DmgAverageHit + "";
                    skillLog.skillCritRate      = skill.Value.CritRateDmg + "";
                    skillLog.skillDamagePercent = skill.Value.DamagePercentage(entity, timedEncounter) + "";
                    skillLog.skillHighestCrit   = skill.Value.DmgBiggestCrit + "";
                    skillLog.skillHits          = skill.Value.HitsDmg + "";
                    skillLog.skillId            = skill.Key.SkillId.ElementAt(0) + "";
                    skillLog.skillLowestCrit    = skill.Value.DmgLowestCrit + "";
                    skillLog.skillTotalDamage   = skilldamage + "";

                    if (skilldamage == 0)
                    {
                        continue;
                    }
                    teradpsUser.skillLog.Add(skillLog);
                }
                teradpsData.members.Add(teradpsUser);
            }

            if (BasicTeraData.Instance.WindowData.Excel)
            {
                var excelThread = new Thread(() => ExcelExport.ExcelSave(teradpsData));
                excelThread.Start();
            }
            if (string.IsNullOrEmpty(BasicTeraData.Instance.WindowData.TeraDpsToken) || string.IsNullOrEmpty(BasicTeraData.Instance.WindowData.TeraDpsUser))
            {
                return;
            }
            string json       = JsonConvert.SerializeObject(teradpsData);
            var    sendThread = new Thread(() => Send(entity, json, 3));

            sendThread.Start();
            var jsonThread = new Thread(() => JsonExport(json));

            jsonThread.Start();
        }