public AbnormalityEvent(bool inGame, bool active, int priority, List <BlackListItem> areaBossBlackList, Dictionary <int, int> ids, List <HotDot.Types> types, AbnormalityTargetType target, AbnormalityTriggerType trigger, int remainingSecondsBeforeTrigger, int rewarnTimeoutSecounds) : base(inGame, active, priority, areaBossBlackList) { Types = types; Ids = ids; Target = target; Trigger = trigger; RemainingSecondBeforeTrigger = remainingSecondsBeforeTrigger; RewarnTimeoutSeconds = rewarnTimeoutSecounds; }
public AbnormalityEvent(bool inGame, bool active, int priority, Dictionary<int,int> areaBossBlackList, Dictionary<int, int> ids, List<HotDot.Types> types, AbnormalityTargetType target, AbnormalityTriggerType trigger, int remainingSecondsBeforeTrigger, int rewarnTimeoutSecounds) : base(inGame, active, priority, areaBossBlackList) { Types = types; Ids = ids; Target = target; Trigger = trigger; RemainingSecondBeforeTrigger = remainingSecondsBeforeTrigger; RewarnTimeoutSeconds = rewarnTimeoutSecounds; }
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)); } } }
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); } } }