Beispiel #1
0
        internal void S_REQUEST_CONTRACT(Tera.Game.Messages.S_REQUEST_CONTRACT message)
        {
            if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
            {
                if (message.Type == Tera.Game.Messages.S_REQUEST_CONTRACT.RequestType.PartyInvite)
                {
                    NetworkController.Instance.FlashMessage = DefaultNotifyAction(
                        LP.PartyInvite + ": " + message.Sender,
                        message.Sender
                        );
                }
                else if (message.Type == Tera.Game.Messages.S_REQUEST_CONTRACT.RequestType.TradeRequest)
                {
                    NetworkController.Instance.FlashMessage = DefaultNotifyAction(
                        LP.Trading + ": " + message.Sender,
                        message.Sender
                        );
                }
                else if (!Enum.IsDefined(typeof(Tera.Game.Messages.S_REQUEST_CONTRACT.RequestType), (int)message.Type))

                {
                    NetworkController.Instance.FlashMessage = DefaultNotifyAction(
                        LP.ContactTry,
                        LP.ContactTry
                        );
                }
            }
        }
Beispiel #2
0
 private void MatchingSuccess()
 {
     if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
     {
         PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.PartyMatchingSuccess, LP.PartyMatchingSuccess, EventType.MatchingSuccess));
     }
 }
        public void UpdateKeyboard(object o, EventArgs args)
        {
            var teraWindowActive  = TeraWindow.IsTeraActive();
            var meterWindowActive = TeraWindow.IsMeterActive();

            if (KeyboardHook.Instance.SetHotkeys(teraWindowActive))
            {
                StayTopMost();
            }

            if (!BasicTeraData.Instance.WindowData.AlwaysVisible)
            {
                if (!teraWindowActive && !meterWindowActive)
                {
                    HideWindow(); //Visibility = Visibility.Hidden;
                    ForceWindowVisibilityHidden = true;
                }

                if ((meterWindowActive || teraWindowActive) && (BasicTeraData.Instance.WindowData.InvisibleUi && Controls.Count > 0 ||
                                                                !BasicTeraData.Instance.WindowData.InvisibleUi))
                {
                    ForceWindowVisibilityHidden = false;
                    ShowWindow(); //Visibility = Visibility.Visible;
                }
            }
            else
            {
                ForceWindowVisibilityHidden = false;
            }
        }
Beispiel #4
0
 private void MatchingSuccess()
 {
     if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
     {
         NetworkController.Instance.FlashMessage = DefaultNotifyAction(LP.PartyMatchingSuccess, LP.PartyMatchingSuccess);
     }
 }
Beispiel #5
0
 internal void S_TRADE_BROKER_DEAL_SUGGESTED(S_TRADE_BROKER_DEAL_SUGGESTED message)
 {
     if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
     {
         PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.Trading + ": " + message.PlayerName,
                                                                       LP.SellerPrice + ": " + Tera.Game.Messages.S_TRADE_BROKER_DEAL_SUGGESTED.Gold(message.SellerPrice) + Environment.NewLine + LP.OfferedPrice +
                                                                       ": " + Tera.Game.Messages.S_TRADE_BROKER_DEAL_SUGGESTED.Gold(message.OfferedPrice), EventType.Broker));
     }
 }
Beispiel #6
0
        internal void SkillReset(int skillId, CrestType type)
        {
            if (type != CrestType.Reset)
            {
                return;
            }
            var meterUser = NetworkController.Instance.EntityTracker.MeterUser;
            var bossIds   = _lastBosses.Where(x => x.Value > 0).Select(x => x.Key).ToList();

            if (meterUser == null || !bossIds.Any())
            {
                return;
            }
            var teraActive = TeraWindow.IsTeraActive();
            var bossList   = bossIds.Select(x => (NpcEntity)NetworkController.Instance.EntityTracker.GetOrNull(x)).ToList();

            foreach (var e in BasicTeraData.Instance.EventsData.Cooldown)
            {
                if (NetworkController.Instance.FlashMessage != null && NetworkController.Instance.FlashMessage.Priority >= e.Key.Priority)
                {
                    continue;
                }
                if (e.Key.InGame != teraActive)
                {
                    continue;
                }
                var cooldownEvent = (CooldownEvent)e.Key;
                if (cooldownEvent.SkillId != skillId)
                {
                    continue;
                }

                foreach (var a in e.Value)
                {
                    if (a.GetType() != typeof(NotifyAction))
                    {
                        continue;
                    }
                    var notifyAction = ((NotifyAction)a).Clone();
                    var skill        = BasicTeraData.Instance.SkillDatabase.GetOrNull(meterUser, skillId);
                    if (notifyAction.Balloon != null)
                    {
                        notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{skill_name}", skill?.Name ?? skillId.ToString());
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{skill_name}", skill?.Name ?? skillId.ToString());
                    }
                    if (notifyAction.Sound != null && notifyAction.Sound.GetType() == typeof(TextToSpeech))
                    {
                        var textToSpeech = (TextToSpeech)notifyAction.Sound;
                        textToSpeech.Text = textToSpeech.Text.Replace("{skill_name}", skill?.Name ?? skillId.ToString());
                    }
                    NetworkController.Instance.FlashMessage = new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, e.Key.Priority);
                }
            }
        }
Beispiel #7
0
 public void UpdateKeyboard(object o, EventArgs args)
 {
     if (!_keyboardInitialized)
     {
         KeyboardHook.Instance.RegisterKeyboardHook();
         _keyboardInitialized = true;
     }
     else
     {
         KeyboardHook.Instance.SetHotkeys(TeraWindow.IsTeraActive());
     }
 }
Beispiel #8
0
        internal void S_OTHER_USER_APPLY_PARTY(S_OTHER_USER_APPLY_PARTY message)
        {
            if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
            {
                PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(message.PlayerName + " " + LP.ApplyToYourParty,
                                                                              LP.Class + ": " + LP.ResourceManager.GetString(message.PlayerClass.ToString(), LP.Culture) + Environment.NewLine + LP.Lvl + ": " + message.Lvl +
                                                                              Environment.NewLine, EventType.OtherUserApply));
            }

            if (BasicTeraData.Instance.WindowData.CopyInspect)
            {
                var thread = new Thread(() => CopyPaste.CopyInspect(message.PlayerName));
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
        }
Beispiel #9
0
 internal void S_REQUEST_CONTRACT(S_REQUEST_CONTRACT message)
 {
     if (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive())
     {
         if (message.Type == Tera.Game.Messages.S_REQUEST_CONTRACT.RequestType.PartyInvite)
         {
             PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.PartyInvite + ": " + message.Sender, message.Sender, EventType.PartyInvite));
         }
         else if (message.Type == Tera.Game.Messages.S_REQUEST_CONTRACT.RequestType.TradeRequest)
         {
             PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.Trading + ": " + message.Sender, message.Sender, EventType.Trade));
         }
         else if (!Enum.IsDefined(typeof(S_REQUEST_CONTRACT.RequestType), (int)message.Type))
         {
             PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.ContactTry, LP.ContactTry, EventType.GenericContract));
         }
     }
 }
Beispiel #10
0
        public void UpdateKeyboard(object o, EventArgs args)
        {
            var teraWindowActive  = TeraWindow.IsTeraActive();
            var meterWindowActive = TeraWindow.IsMeterActive();

            if (!_keyboardInitialized)
            {
                KeyboardHook.Instance.RegisterKeyboardHook();
                _keyboardInitialized = true;
            }
            else
            {
                if (KeyboardHook.Instance.SetHotkeys(teraWindowActive))
                {
                    StayTopMost();
                }
            }

            if (!BasicTeraData.Instance.WindowData.AlwaysVisible)
            {
                if (!teraWindowActive && !meterWindowActive)
                {
                    Visibility = Visibility.Hidden;
                    _forceWindowVisibilityHidden = true;
                }

                if ((meterWindowActive || teraWindowActive) && ((BasicTeraData.Instance.WindowData.InvisibleUI && Controls.Count > 0) || !BasicTeraData.Instance.WindowData.InvisibleUI))
                {
                    _forceWindowVisibilityHidden = false;
                    Visibility = Visibility.Visible;
                }
            }
            else
            {
                _forceWindowVisibilityHidden = false;
            }
        }
Beispiel #11
0
 internal void S_CHECK_TO_READY_PARTY(S_CHECK_TO_READY_PARTY message)
 {
     if (message.Count == 1 && (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive()))
     {
         PacketProcessor.Instance.FlashMessage.Add(DefaultNotifyAction(LP.CombatReadyCheck, LP.CombatReadyCheck, EventType.ReadyCheck));
     }
 }
Beispiel #12
0
        private void AbnormalityNotifierCommon(EntityId target, int abnormalityId, AbnormalityTriggerType trigger, int stack)
        {
            var meterUser = PacketProcessor.Instance.EntityTracker.MeterUser;

            if (meterUser == null)
            {
                return;
            }
            if (PacketProcessor.Instance.AbnormalityStorage.DeadOrJustResurrected(PacketProcessor.Instance.PlayerTracker.Me()))
            {
                return;
            }
            var bossIds    = _lastBosses.Where(x => x.Value > 0).Select(x => x.Key).ToList();
            var teraActive = TeraWindow.IsTeraActive();
            var bossList   = bossIds.Select(x => (NpcEntity)PacketProcessor.Instance.EntityTracker.GetOrNull(x)).ToList();

            foreach (var e in BasicTeraData.Instance.EventsData.AddedRemovedAbnormalities)
            {
                if (!(bossIds.Any() || e.Key.OutOfCombat))
                {
                    continue;
                }
                var player           = meterUser;
                var abnormalityEvent = (AbnormalityEvent)e.Key;
                if (abnormalityEvent.InGame != teraActive)
                {
                    continue;
                }
                if (abnormalityEvent.Trigger != trigger)
                {
                    continue;
                }
                if (!abnormalityEvent.Ids.ContainsKey(abnormalityId))
                {
                    continue;
                }
                if (abnormalityEvent.Ids[abnormalityId] > stack)
                {
                    continue;
                }
                if (bossList.Any(
                        x => x != null && e.Key.AreaBossBlackList.Any(y => y.AreaId == x.Info.HuntingZoneId && (y.BossId == -1 || y.BossId == x.Info.TemplateId))))
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Boss && !bossIds.Contains(target))
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.MyBoss && _lastBossMeterUser != target)
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Self && meterUser.Id != target)
                {
                    continue;
                }
                if ((abnormalityEvent.Target == AbnormalityTargetType.Party || abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded) &&
                    BasicTeraData.Instance.WindowData.DisablePartyEvent)
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Party)
                {
                    player = PacketProcessor.Instance.EntityTracker.GetOrNull(target) as UserEntity;
                    if (player == null || !PacketProcessor.Instance.PlayerTracker.PartyList().Contains(player))
                    {
                        continue;
                    }
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded)
                {
                    player = PacketProcessor.Instance.EntityTracker.GetOrNull(target) as UserEntity;
                    if (player == null || !PacketProcessor.Instance.PlayerTracker.PartyList().Contains(player) || meterUser.Id == player.Id)
                    {
                        continue;
                    }
                }

                if (player.OutOfRange)
                {
                    continue;
                }
                var maxHp = bossList.FirstOrDefault(x => x.Id == target)?.Info.HP ?? 0;
                _lastBosses.TryGetValue(target, out long curHp);
                var percHp = maxHp == 0 ? 0 : curHp * 100 / maxHp;
                var nextHp = percHp <= 10 ? 0 : percHp - 10;
                foreach (var a in e.Value)
                {
                    if (a.GetType() != typeof(NotifyAction))
                    {
                        continue;
                    }
                    var notifyAction = ((NotifyAction)a).Clone();
                    var abnormality  = BasicTeraData.Instance.HotDotDatabase.Get(abnormalityId);
                    if (notifyAction.Balloon != null)
                    {
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{boss_hp}", percHp.ToString());
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{next_hp}", nextHp.ToString());
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{abnormality_name}", abnormality.Name);
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{stack}", stack.ToString());
                        if (player != null)
                        {
                            notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{player_name}", player.Name);
                            notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{player_name}", player.Name);
                        }
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{boss_hp}", percHp.ToString());
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{next_hp}", nextHp.ToString());
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{abnormality_name}", abnormality.Name);
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{stack}", stack.ToString());

                        notifyAction.Balloon.EventType = EventType.AddRemoveAb;
                        notifyAction.Balloon.Icon      = abnormality.EffectIcon;
                    }
                    if (notifyAction.Sound != null && notifyAction.Sound.GetType() == typeof(TextToSpeech))
                    {
                        var textToSpeech = (TextToSpeech)notifyAction.Sound;
                        if (player != null)
                        {
                            textToSpeech.Text = textToSpeech.Text.Replace("{player_name}", player.Name);
                        }
                        textToSpeech.Text = textToSpeech.Text.Replace("{boss_hp}", percHp.ToString());
                        textToSpeech.Text = textToSpeech.Text.Replace("{next_hp}", nextHp.ToString());
                        textToSpeech.Text = textToSpeech.Text.Replace("{abnormality_name}", abnormality.Name);
                        textToSpeech.Text = textToSpeech.Text.Replace("{stack}", stack.ToString());
                    }
                    PacketProcessor.Instance.FlashMessage.Add(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, e.Key.Priority));
                }
            }
        }
Beispiel #13
0
        internal void AbnormalityNotifierMissing()
        {
            if (!BasicTeraData.Instance.WindowData.EnableChat)
            {
                return;
            }
            var meterUser = PacketProcessor.Instance.EntityTracker.MeterUser;

            if (meterUser == null)
            {
                return;
            }
            if (PacketProcessor.Instance.AbnormalityStorage.DeadOrJustResurrected(PacketProcessor.Instance.PlayerTracker.Me()))
            {
                return;
            }
            var bossIds    = _lastBosses.Where(x => x.Value > 0).Select(x => x.Key).ToList();
            var teraActive = TeraWindow.IsTeraActive();
            var time       = DateTime.Now;
            var bossList   = bossIds.Select(x => (NpcEntity)PacketProcessor.Instance.EntityTracker.GetOrNull(x)).ToList();

            foreach (var e in BasicTeraData.Instance.EventsData.MissingAbnormalities)
            {
                if (!(bossIds.Any() || e.Key.OutOfCombat))
                {
                    continue;
                }
                var entitiesIdToCheck = new List <EntityId>();
                var abnormalityEvent  = (AbnormalityEvent)e.Key;
                if (abnormalityEvent.InGame != teraActive)
                {
                    continue;
                }
                if (bossList.Any(
                        x => x != null && e.Key.AreaBossBlackList.Any(y => y.AreaId == x.Info.HuntingZoneId && (y.BossId == -1 || y.BossId == x.Info.TemplateId))))
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Self)
                {
                    entitiesIdToCheck.Add(meterUser.Id);
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Boss)
                {
                    entitiesIdToCheck.AddRange(bossIds);
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.MyBoss)
                {
                    if (_lastBossMeterUser == null || _lastBossHpMeterUser == 0)
                    {
                        continue;
                    }
                    entitiesIdToCheck.Add(_lastBossMeterUser.Value);
                }
                if ((abnormalityEvent.Target == AbnormalityTargetType.Party || abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded) &&
                    BasicTeraData.Instance.WindowData.DisablePartyEvent)
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Party)
                {
                    foreach (var player in PacketProcessor.Instance.PlayerTracker.PartyList())
                    {
                        if (player.OutOfRange)
                        {
                            continue;
                        }
                        if (PacketProcessor.Instance.AbnormalityStorage.DeadOrJustResurrected(PacketProcessor.Instance.PlayerTracker.GetOrUpdate(player)))
                        {
                            continue;
                        }
                        entitiesIdToCheck.Add(player.Id);
                    }
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded)
                {
                    foreach (var player in PacketProcessor.Instance.PlayerTracker.PartyList())
                    {
                        if (player == meterUser)
                        {
                            continue;
                        }
                        if (player.OutOfRange)
                        {
                            continue;
                        }
                        if (PacketProcessor.Instance.AbnormalityStorage.DeadOrJustResurrected(PacketProcessor.Instance.PlayerTracker.GetOrUpdate(player)))
                        {
                            continue;
                        }
                        entitiesIdToCheck.Add(player.Id);
                    }
                }


                foreach (var entityIdToCheck in entitiesIdToCheck)
                {
                    if (!e.Key.NextChecks.ContainsKey(entityIdToCheck))
                    {
                        abnormalityEvent.NextChecks[entityIdToCheck] = time.AddSeconds(abnormalityEvent.RewarnTimeoutSeconds > 20 ? 0 : abnormalityEvent.RewarnTimeoutSeconds);
                    }
                    if (time <= e.Key.NextChecks[entityIdToCheck])
                    {
                        continue;
                    }

                    TimeSpan?abnormalityTimeLeft    = null;
                    var      noAbnormalitiesMissing = false;
                    var      stack = 0;

                    foreach (var id in abnormalityEvent.Ids)
                    {
                        var timeLeft = PacketProcessor.Instance.AbnormalityTracker.AbnormalityTimeLeft(entityIdToCheck, id.Key, id.Value);
                        if (timeLeft >= abnormalityEvent.RemainingSecondBeforeTrigger * TimeSpan.TicksPerSecond)
                        {
                            noAbnormalitiesMissing = true;
                            break;
                        }
                        if (timeLeft != -1 && (abnormalityTimeLeft != null && timeLeft > abnormalityTimeLeft.Value.Ticks || abnormalityTimeLeft == null))
                        {
                            abnormalityTimeLeft = TimeSpan.FromTicks(timeLeft);
                        }
                        if (id.Value > 0)
                        {
                            stack = Math.Max(stack, PacketProcessor.Instance.AbnormalityTracker.Stack(entityIdToCheck, id.Key));
                        }
                    }

                    if (noAbnormalitiesMissing)
                    {
                        continue;
                    }

                    foreach (var type in abnormalityEvent.Types)
                    {
                        var timeLeft = PacketProcessor.Instance.AbnormalityTracker.AbnormalityTimeLeft(entityIdToCheck, type);
                        if (timeLeft >= abnormalityEvent.RemainingSecondBeforeTrigger * TimeSpan.TicksPerSecond)
                        {
                            noAbnormalitiesMissing = true;
                            break;
                        }
                        if (timeLeft != -1 && (abnormalityTimeLeft != null && timeLeft > abnormalityTimeLeft.Value.Ticks || abnormalityTimeLeft == null))
                        {
                            abnormalityTimeLeft = TimeSpan.FromTicks(timeLeft);
                        }
                    }

                    if (noAbnormalitiesMissing)
                    {
                        continue;
                    }
                    if (abnormalityEvent.Trigger == AbnormalityTriggerType.Ending && (abnormalityTimeLeft == null || abnormalityTimeLeft.Value.Ticks <= 0))
                    {
                        continue;
                    }

                    abnormalityEvent.NextChecks[entityIdToCheck] = time.AddSeconds(abnormalityEvent.RewarnTimeoutSeconds);

                    foreach (var a in e.Value)
                    {
                        if (a.GetType() != typeof(NotifyAction))
                        {
                            continue;
                        }
                        var notifyAction = ((NotifyAction)a).Clone();
                        var player       = PacketProcessor.Instance.EntityTracker.GetOrNull(entityIdToCheck) as UserEntity;
                        if (notifyAction.Sound != null && notifyAction.Sound.GetType() == typeof(TextToSpeech))
                        {
                            var textToSpeech = (TextToSpeech)notifyAction.Sound;
                            if (player != null)
                            {
                                textToSpeech.Text = textToSpeech.Text.Replace("{player_name}", player.Name);
                            }

                            if (abnormalityEvent.Ids.Count > 0)
                            {
                                var abName = BasicTeraData.Instance.HotDotDatabase.Get(abnormalityEvent.Ids.First().Key)?.Name ?? "Unknown abnormality missing";
                                textToSpeech.Text = textToSpeech.Text.Replace("{abnormality_name}", abName);
                            }
                            else
                            {
                                textToSpeech.Text = textToSpeech.Text.Replace("{abnormality_name}", LP.NoCrystalBind);
                            }

                            textToSpeech.Text = textToSpeech.Text.Replace("{time_left}", abnormalityTimeLeft?.Seconds.ToString() ?? "0");
                            textToSpeech.Text = textToSpeech.Text.Replace("{stack}", stack.ToString());
                        }

                        if (notifyAction.Balloon != null)
                        {
                            if (abnormalityEvent.Ids.Count > 0)
                            {
                                var abName = BasicTeraData.Instance.HotDotDatabase.Get(abnormalityEvent.Ids.First().Key)?.Name ?? "Unknown abnormality missing";
                                var icon   = BasicTeraData.Instance.HotDotDatabase.Get(abnormalityEvent.Ids.First().Key)?.EffectIcon;
                                notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{abnormality_name}", abName);
                                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{abnormality_name}", abName);
                                notifyAction.Balloon.Icon      = icon;
                            }
                            else
                            {
                                notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{abnormality_name}", LP.NoCrystalBind);
                                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{abnormality_name}", LP.NoCrystalBind);
                                notifyAction.Balloon.Icon      = "icon_items.q_closedspace_stone_05_tex";
                            }
                            notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{player_name}", player?.Name);
                            notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{stack}", stack.ToString());
                            notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{stack}", stack.ToString());
                            notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{player_name}", player?.Name);

                            if (abnormalityTimeLeft.HasValue)
                            {
                                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{time_left}",
                                                                                                        abnormalityTimeLeft.Value.ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture));
                                notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{time_left}",
                                                                                                      abnormalityTimeLeft.Value.ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture));
                            }
                            else
                            {
                                notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{time_left}", "0");
                                notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{time_left}", "0");
                            }
                        }
                        PacketProcessor.Instance.FlashMessage.Add(new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, e.Key.Priority));
                    }
                    break;
                }
            }
        }
Beispiel #14
0
 internal void S_CHECK_TO_READY_PARTY(Tera.Game.Messages.S_CHECK_TO_READY_PARTY message)
 {
     if (message.Count == 1 && (BasicTeraData.Instance.WindowData.ShowAfkEventsIngame || !TeraWindow.IsTeraActive()))
     {
         NetworkController.Instance.FlashMessage = DefaultNotifyAction(
             LP.CombatReadyCheck,
             LP.CombatReadyCheck
             );
     }
 }
Beispiel #15
0
        private void AbnormalityNotifierCommon(EntityId target, int abnormalityId, AbnormalityTriggerType trigger, int stack)
        {
            var meterUser = NetworkController.Instance.EntityTracker.MeterUser;
            var bossIds   = _lastBosses.Where(x => x.Value > 0).Select(x => x.Key).ToList();

            if (meterUser == null || !bossIds.Any())
            {
                return;
            }
            var teraActive = TeraWindow.IsTeraActive();
            var bossList   = bossIds.Select(x => (NpcEntity)NetworkController.Instance.EntityTracker.GetOrNull(x)).ToList();

            foreach (var e in BasicTeraData.Instance.EventsData.AddedRemovedAbnormalities)
            {
                UserEntity player = meterUser;
                if (NetworkController.Instance.FlashMessage != null && NetworkController.Instance.FlashMessage.Priority > e.Key.Priority)
                {
                    continue;
                }
                var abnormalityEvent = (AbnormalityEvent)e.Key;
                if (abnormalityEvent.InGame != teraActive)
                {
                    continue;
                }
                if (abnormalityEvent.Trigger != trigger)
                {
                    continue;
                }
                if (!abnormalityEvent.Ids.ContainsKey(abnormalityId))
                {
                    continue;
                }
                if (abnormalityEvent.Ids[abnormalityId] > stack)
                {
                    continue;
                }
                if (bossList.Any(x =>
                                 x != null && e.Key.AreaBossBlackList.Any(y => y.AreaId == x.Info.HuntingZoneId && (y.BossId == -1 || y.BossId == x.Info.TemplateId))
                                 ))
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Boss && !bossIds.Contains(target))
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.MyBoss && _lastBossMeterUser != target)
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Self && meterUser.Id != target)
                {
                    continue;
                }
                if ((abnormalityEvent.Target == AbnormalityTargetType.Party || abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded) && BasicTeraData.Instance.WindowData.DisablePartyEvent)
                {
                    continue;
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.Party)
                {
                    player = NetworkController.Instance.EntityTracker.GetOrNull(target) as UserEntity;
                    if (player == null || !NetworkController.Instance.PlayerTracker.PartyList().Contains(player))
                    {
                        continue;
                    }
                }
                if (abnormalityEvent.Target == AbnormalityTargetType.PartySelfExcluded)
                {
                    player = NetworkController.Instance.EntityTracker.GetOrNull(target) as UserEntity;
                    if (player == null || !NetworkController.Instance.PlayerTracker.PartyList().Contains(player) || meterUser.Id == player.Id)
                    {
                        continue;
                    }
                }

                if (player.OutOfRange)
                {
                    continue;
                }

                foreach (var a in e.Value)
                {
                    if (a.GetType() != typeof(NotifyAction))
                    {
                        continue;
                    }
                    var notifyAction = ((NotifyAction)a).Clone();
                    var abnormality  = BasicTeraData.Instance.HotDotDatabase.Get(abnormalityId);
                    if (notifyAction.Balloon != null)
                    {
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{abnormality_name}", abnormality.Name);
                        notifyAction.Balloon.BodyText = notifyAction.Balloon.BodyText.Replace("{stack}", stack.ToString());
                        if (player != null)
                        {
                            notifyAction.Balloon.BodyText  = notifyAction.Balloon.BodyText.Replace("{player_name}", player.Name);
                            notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{player_name}", player.Name);
                        }
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{abnormality_name}", abnormality.Name);
                        notifyAction.Balloon.TitleText = notifyAction.Balloon.TitleText.Replace("{stack}", stack.ToString());
                    }
                    if (notifyAction.Sound != null && notifyAction.Sound.GetType() == typeof(TextToSpeech))
                    {
                        var textToSpeech = (TextToSpeech)notifyAction.Sound;
                        if (player != null)
                        {
                            textToSpeech.Text = textToSpeech.Text.Replace("{player_name}", player.Name);
                        }
                        textToSpeech.Text = textToSpeech.Text.Replace("{abnormality_name}", abnormality.Name);
                        textToSpeech.Text = textToSpeech.Text.Replace("{stack}", stack.ToString());
                    }
                    NetworkController.Instance.FlashMessage = new NotifyFlashMessage(notifyAction.Sound, notifyAction.Balloon, e.Key.Priority);
                }
            }
        }
Beispiel #16
0
        public void Update(UiUpdateMessage nmessage)
        {
            void ChangeUi(UiUpdateMessage message)
            {
                RefreshClickThrou();
                Scroller.MaxHeight = BasicTeraData.Instance.WindowData.NumberOfPlayersDisplayed * 30;
                UpdateComboboxEncounter(message.Entities, message.StatsSummary.EntityInformation.Entity);
                _entityStats.Update(message.StatsSummary.EntityInformation, message.Abnormals);
                _windowHistory.Update(message.BossHistory);
                _chatbox?.Update(message.Chatbox);
                _popupNotification.AddNotification(message.Flash);

                PartyDps.Content = FormatHelpers.Instance.FormatValue(message.StatsSummary.EntityInformation.Interval == 0
                                       ? message.StatsSummary.EntityInformation.TotalDamage
                                       : message.StatsSummary.EntityInformation.TotalDamage * TimeSpan.TicksPerSecond / message.StatsSummary.EntityInformation.Interval) +
                                   LP.PerSecond;
                var visiblePlayerStats = new HashSet <Player>();
                var statsDamage        = message.StatsSummary.PlayerDamageDealt;
                var statsHeal          = message.StatsSummary.PlayerHealDealt;

                foreach (var playerStats in statsDamage)
                {
                    PlayerStats playerStatsControl;
                    Controls.TryGetValue(playerStats.Source, out playerStatsControl);
                    if (playerStats.Amount == 0)
                    {
                        continue;
                    }

                    visiblePlayerStats.Add(playerStats.Source);
                    if (playerStatsControl != null)
                    {
                        continue;
                    }
                    playerStatsControl = new PlayerStats(playerStats, statsHeal.FirstOrDefault(x => x.Source == playerStats.Source), message.StatsSummary.EntityInformation,
                                                         message.Skills, message.Abnormals.Get(playerStats.Source));
                    Controls.Add(playerStats.Source, playerStatsControl);
                }
                DXrender?.Draw(statsDamage.ToClassInfo(message.StatsSummary.EntityInformation.TotalDamage, message.StatsSummary.EntityInformation.Interval));

                var invisibleControls = Controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList();

                foreach (var invisibleControl in invisibleControls)
                {
                    Controls[invisibleControl.Key].CloseSkills();
                    Controls.Remove(invisibleControl.Key);
                }


                SGrid.Visibility    = !_hideGeneralData ? Visibility.Visible : Visibility.Collapsed;
                TotalDamage.Content = FormatHelpers.Instance.FormatValue(message.StatsSummary.EntityInformation.TotalDamage);

                if (BasicTeraData.Instance.WindowData.ShowTimeLeft && message.StatsSummary.EntityInformation.TimeLeft > 0)
                {
                    var interval = TimeSpan.FromSeconds(message.StatsSummary.EntityInformation.TimeLeft / TimeSpan.TicksPerSecond);
                    Timer.Content    = interval.ToString(@"mm\:ss");
                    Timer.Foreground = Brushes.LightCoral;
                }
                else
                {
                    var interval = TimeSpan.FromSeconds(message.StatsSummary.EntityInformation.Interval / TimeSpan.TicksPerSecond);
                    Timer.Content = interval.ToString(@"mm\:ss");
                    if (message.StatsSummary.EntityInformation.Interval == 0 && BasicTeraData.Instance.WindowData.ShowTimeLeft)
                    {
                        Timer.Foreground = Brushes.LightCoral;
                    }
                    else
                    {
                        Timer.Foreground = Brushes.White;
                    }
                }
                Players.Items.Clear();

                foreach (var item in statsDamage)
                {
                    if (!Controls.ContainsKey(item.Source))
                    {
                        continue;
                    }
                    if (Players.Items.Contains(Controls[item.Source]))
                    {
                        BasicTeraData.LogError(
                            "duplicate playerinfo: \r\n" + string.Join("\r\n ", statsDamage.Select(x => x.Source.ToString() + " ->  " + x.Amount)), false, true);
                        continue;
                    }
                    Players.Items.Add(Controls[item.Source]);
                    Controls[item.Source].Repaint(item, statsHeal.FirstOrDefault(x => x.Source == item.Source), message.StatsSummary.EntityInformation, message.Skills,
                                                  message.Abnormals.Get(item.Source), message.TimedEncounter);
                }

                if (BasicTeraData.Instance.WindowData.InvisibleUi && !_paused)
                {
                    if (Controls.Count > 0 && !ForceWindowVisibilityHidden && Visibility != Visibility.Visible)
                    {
                        ShowWindow();
                    }                                                                                                             //Visibility = Visibility.Visible; }
                    if (Controls.Count == 0 && Visibility != Visibility.Hidden)
                    {
                        HideWindow();
                    }                                                                             //Visibility = Visibility.Hidden; }
                }
                else if (!ForceWindowVisibilityHidden && Visibility != Visibility.Visible)
                {
                    ShowWindow();
                }                                                                                            //Visibility = Visibility.Visible; }
                if (TeraWindow.IsTeraActive() && BasicTeraData.Instance.WindowData.Topmost)
                {
                    StayTopMost();
                }
                if (BasicTeraData.Instance.WindowData.RealtimeGraphEnabled)
                {
                    GraphViewModel.Update(message);
                    Graph.Visibility = Visibility.Visible;
                }
                else
                {
                    Graph.Visibility = Visibility.Collapsed;
                    GraphViewModel.Reset();
                }
            }

            Dispatcher.Invoke((PacketProcessor.UpdateUiHandler)ChangeUi, nmessage);
        }