예제 #1
0
        private void UpdateUi(int packetsWaiting = 0)
        {
            _lastTick = DateTime.UtcNow.Ticks;
            var handler        = TickUpdated;
            var currentBoss    = Encounter;
            var timedEncounter = TimedEncounter;

            var entities         = Database.Database.Instance.AllEntity();
            var filteredEntities = entities.Select(entityid => EntityTracker.GetOrNull(entityid)).OfType <NpcEntity>().Where(npc => npc.Info.Boss).ToList();

            if (packetsWaiting > 1500 && filteredEntities.Count > 1)
            {
                Database.Database.Instance.DeleteAllWhenTimeBelow(Encounter);
                entities         = Database.Database.Instance.AllEntity();
                filteredEntities = entities.Select(entityid => EntityTracker.GetOrNull(entityid)).OfType <NpcEntity>().Where(npc => npc.Info.Boss).ToList();
            }

            var    entityInfo = Database.Database.Instance.GlobalInformationEntity(currentBoss, timedEncounter);
            Skills skills     = null;

            if (SendFullDetails)
            {
                skills          = Database.Database.Instance.GetSkills(entityInfo.BeginTime, entityInfo.EndTime);
                SendFullDetails = false;
            }
            var playersInfo = timedEncounter
                ? Database.Database.Instance.PlayerDamageInformation(entityInfo.BeginTime, entityInfo.EndTime)
                : Database.Database.Instance.PlayerDamageInformation(currentBoss);

            var heals = Database.Database.Instance.PlayerHealInformation(entityInfo.BeginTime, entityInfo.EndTime);

            var flash = FlashMessage;

            FlashMessage = null;

            var statsSummary   = new StatsSummary(playersInfo, heals, entityInfo);
            var teradpsHistory = BossLink;
            var chatbox        = Chat.Instance.Get();
            var abnormals      = _abnormalityStorage.Clone(currentBoss, entityInfo.BeginTime, entityInfo.EndTime);

            handler?.Invoke(statsSummary, skills, filteredEntities, timedEncounter, abnormals, teradpsHistory, chatbox, packetsWaiting, flash);
        }
예제 #2
0
        private void UpdateUi(int packetsWaiting = 0)
        {
            if (!NeedInit)
            {
                if (BasicTeraData.Instance.WindowData.EnableChat != MessageFactory.ChatEnabled)
                {
                    MessageFactory.ChatEnabled = BasicTeraData.Instance.WindowData.EnableChat;
                    if (BasicTeraData.Instance.WindowData.EnableChat)
                    {
                        AbnormalityTracker.AbnormalityAdded   += NotifyProcessor.Instance.AbnormalityNotifierAdded;
                        AbnormalityTracker.AbnormalityRemoved += NotifyProcessor.Instance.AbnormalityNotifierRemoved;
                    }
                    else
                    {
                        AbnormalityTracker.AbnormalityAdded   -= NotifyProcessor.Instance.AbnormalityNotifierAdded;
                        AbnormalityTracker.AbnormalityRemoved -= NotifyProcessor.Instance.AbnormalityNotifierRemoved;
                    }
                    PacketProcessing.Update();
                }
                NotifyProcessor.Instance.AbnormalityNotifierMissing();
            }
            _lastTick = DateTime.UtcNow.Ticks;
            var handler        = TickUpdated;
            var currentBoss    = Encounter;
            var timedEncounter = TimedEncounter;

            var entities         = Database.Database.Instance.AllEntity();
            var filteredEntities = entities.Select(entityid => EntityTracker.GetOrNull(entityid)).OfType <NpcEntity>().Where(npc => npc.Info.Boss).ToList();

            if (packetsWaiting > 1500 && filteredEntities.Count > 1)
            {
                Database.Database.Instance.DeleteAllWhenTimeBelow(Encounter);
                entities         = Database.Database.Instance.AllEntity();
                filteredEntities = entities.Select(entityid => EntityTracker.GetOrNull(entityid)).OfType <NpcEntity>().Where(npc => npc.Info.Boss).ToList();
            }

            var entityInfo = Database.Database.Instance.GlobalInformationEntity(currentBoss, timedEncounter);

            if (currentBoss != null)
            {
                long entityHP = 0;
                NotifyProcessor.Instance._lastBosses.TryGetValue(currentBoss.Id, out entityHP);
                var entityDamaged = currentBoss.Info.HP - entityHP;
                entityInfo.TimeLeft = entityDamaged == 0 ? 0 : entityInfo.Interval * entityHP / entityDamaged;
            }
            Skills skills = null;

            if (SendFullDetails)
            {
                skills          = Database.Database.Instance.GetSkills(entityInfo.BeginTime, entityInfo.EndTime);
                SendFullDetails = false;
            }
            var playersInfo = timedEncounter
                ? Database.Database.Instance.PlayerDamageInformation(entityInfo.BeginTime, entityInfo.EndTime)
                : Database.Database.Instance.PlayerDamageInformation(currentBoss);

            if (BasicTeraData.Instance.WindowData.MeterUserOnTop)
            {
                playersInfo = playersInfo.OrderBy(x => MeterPlayers.Contains(x.Source) ? 0 : 1).ThenByDescending(x => x.Amount).ToList();
            }

            var heals = Database.Database.Instance.PlayerHealInformation(entityInfo.BeginTime, entityInfo.EndTime);

            var flash = FlashMessage;

            FlashMessage = null;

            var statsSummary   = new StatsSummary(playersInfo, heals, entityInfo);
            var teradpsHistory = BossLink;
            var chatbox        = Chat.Instance.Get();
            var abnormals      = AbnormalityStorage.Clone(currentBoss, entityInfo.BeginTime, entityInfo.EndTime);

            handler?.Invoke(statsSummary, skills, filteredEntities, timedEncounter, abnormals, teradpsHistory, chatbox, packetsWaiting, flash);
        }