private static void ApplyAbilitySettings(CombatLogEvent @event, CombatLogViewModel viewModel, Settings settings)
        {
            if (!settings.EnableAbilitySettings) return;

            var abilitySetting = settings.AbilitySettings
                              .FirstOrDefault(s => s.AbilityId == @event.Ability.EntityId.ToString() && s.Enabled);

            if (abilitySetting != null)
            {
                if (abilitySetting.Image != null && File.Exists(abilitySetting.Image))
                {
                    viewModel.ImageUrl = abilitySetting.Image;
                }

                if (!string.IsNullOrEmpty(abilitySetting.BorderColor))
                {
                    viewModel.ImageBorderColor = abilitySetting.BorderColor.FromHexToColor();
                }

                if (abilitySetting.Aliases.Any())
                {
                    viewModel.Text = abilitySetting.Aliases.PickRandom();
                }
            }
        }
示例#2
0
 public static bool CanPlay(this EventSetting setting, CombatLogEvent line)
 {
     return setting.IsPlayerDeath(line) ||
            setting.IsPlayerKill(line) ||
            setting.IsEnterCombat(line) ||
            setting.IsExitCombat(line) ||
            setting.IsAbilityActivate(line) ||
            setting.IsAbilityCancel(line) ||
            setting.IsPlayerSurrender(line);
 }
示例#3
0
        public void Handle(CombatLogEvent line)
        {
            var settings = settingsService.Settings;

            if (!settings.EnableSound) return;

            foreach (var eventSetting in settings.EventSettings.Where(x => x.Enabled))
            {
                HandleEventLine(line, eventSetting);
            }
        }
        public CombatLogViewModel Create(CombatLogEvent @event)
        {
            var viewModel = new CombatLogViewModel(@event);
            var settings = settingsService.Settings;

            if (@event.IsAbilityActivate() || @event.IsApplyEffect())
            {
                ApplyLoggerSettings(@event, viewModel, settings);
                ApplyAbilitySettings(@event, viewModel, settings);
            }

            if (settings.EnableCompanionAbilities && @event.IsPlayerCompanion())
            {
                viewModel.ImageBorderColor = settings.CompanionAbilityBorderColor.FromHexToColor();
            }

            ApplyFontSettings(viewModel, settings);

            return viewModel;
        }
示例#5
0
        private void HandleEventLine(CombatLogEvent line, EventSetting setting)
        {
            try
            {
                var canPlay = setting.CanPlay(line);
                var hasSoundFile = !string.IsNullOrEmpty(setting.Sound);

                if (canPlay && hasSoundFile)
                {
                    audioService.Play(setting.Sound);
                }
                else if (canPlay && !hasSoundFile)
                {
                    audioService.Stop();
                }
            }
            catch (Exception e)
            {
                loggerService.Log(e.Message);
            }
        }
示例#6
0
        public CombatLogEvent Parse(string line)
        {
            if (string.IsNullOrEmpty(line))
                throw new ParseException("Line was null.");

            CombatLogEvent = new CombatLogEvent();

            var match = BaseLineRegex.Match(line);

            if (match.Success)
            {
                ProcessTimeStamp(match.Groups["TimeStamp"].Value);
                ProcessAbility(match.Groups["Ability"].Value);
                ProcessEffect(match.Groups["Effect"].Value);
                ProcessValue(match.Groups["Value"].Value);
                ProcessThreat(match.Groups["Threat"].Value);
                ProcessSource(match.Groups["Source"].Value);
                ProcessTarget(match.Groups["Target"].Value);
            }

            ProcessTrackedPlayer();

            return CombatLogEvent;
        }
        private void ApplyLoggerSettings(CombatLogEvent combatLogEvent, CombatLogViewModel viewModel, Settings settings)
        {
            var abilityId = combatLogEvent.Ability.EntityId;

            viewModel.ImageUrl = imageService.GetImageById(abilityId);
            viewModel.IsUnknown = imageService.IsUnknown(abilityId);
            viewModel.ImageBorderColor = Colors.Transparent;
            viewModel.Text = combatLogEvent.Ability.DisplayName;
            viewModel.TextVisibility = settings.EnableAbilityText ? Visibility.Visible : Visibility.Hidden;
            viewModel.TooltipText = $"{combatLogEvent.Ability.EntityId} (Click to copy Ability ID to Clipboard!)";
        }
示例#8
0
        public LogEvent(string originalLine, DateTime timestamp, string eventName, IEnumerator<string> parameters)
        {
            string name = eventName.Replace("_", "").Trim();
            this.originalLine = originalLine;

            //foreach(Type type in Assembly.GetExecutingAssembly().GetTypes()) {
            //    if( type.Namespace == "WowLogAnalyzer.Wow.Logs.Events" ) {
            //        if( StringComparer.InvariantCultureIgnoreCase.Compare(type.Name, name) == 0) {
            //            e = (CombatLogEvent)Activator.CreateInstance(type);
            //            e.Populate(timestamp, new EventReader(parameters));
            //            break;
            //        }
            //    }
            //}
            e = CombatLogEventFactory.CreateEvent(eventName.Trim());
            e.Populate(timestamp, new EventReader(parameters));

            if ( parameters.MoveNext() )
                throw new ApplicationException("Additional unknown parameters for " + name + ".");
        }
 private void Render(CombatLogEvent logLine)
 {
     var viewModel = logViewModelFactory.Create(logLine);
     eventAggregator.PublishOnUIThread(viewModel);
 }
示例#10
0
 public static bool IsPlayerKill(this EventSetting setting, CombatLogEvent line)
 {
     return setting.EffectName == SoundEvent.Kill && (line.IsPlayerKill() || line.IsNpcKill());
 }
示例#11
0
 public static bool IsPlayerSurrender(this EventSetting setting, CombatLogEvent line)
 {
     return line.IsSurrender();
 }
示例#12
0
 public static bool IsPlayerDeath(this EventSetting setting, CombatLogEvent line)
 {
     return setting.EffectName == SoundEvent.Death && line.IsThisPlayerDeath();
 }
示例#13
0
 public static bool IsExitCombat(this EventSetting setting, CombatLogEvent line)
 {
     return setting.EffectName == SoundEvent.ExitCombat && line.IsExitCombat();
 }
示例#14
0
 public static bool IsAbilityCancel(this EventSetting setting, CombatLogEvent line)
 {
     return setting.EffectName == SoundEvent.AbilityCancel &&
            line.IsAbilityCancel() && line.IsThisPlayer() &&
            line.IsAbility(setting.AbilityId);
 }
示例#15
0
 public static bool IsAbilityActivate(this EventSetting setting, CombatLogEvent line)
 {
     return setting.EffectName == SoundEvent.AbilityActivate && line.IsAbilityActivate()
         && setting.AbilityId == line.Ability.EntityId.ToString();
 }
示例#16
0
 public CombatLogEventArgs(CombatLogEvent @event)
 {
     Event = @event;
 }