public static void Log(Logger logger, string type, Event e, Expressions exp = null)
 {
     var cleaned = String.Format("{0}:{1}", e.ChatLogEntry.Code, e.ChatLogEntry.Line);
     if (exp != null)
     {
         cleaned = String.Format("{0}:{1}", e.Code, exp.Cleaned);
     }
     var data = String.Format("Unknown {0} Line -> [Type:{1}][Subject:{2}][Direction:{3}] {4}", type, e.Type, e.Subject, e.Direction, cleaned);
     Logging.Log(logger, data);
 }
 private static void ProcessDetrimental(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     var detrimental = Regex.Match("ph", @"^\.$");
     if (detrimental.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Detrimental", e, exp);
 }
        /// <summary>
        /// </summary>
        /// <param name="e"> </param>
        protected override void HandleEvent(Event e)
        {
            Expressions = new Expressions(e);

            if (String.IsNullOrWhiteSpace(e.ChatLogEntry.Line))
            {
                return;
            }
            switch (e.Type)
            {
                case EventType.Defeats:
                    ProcessDefeated(e);
                    break;
                case EventType.Loot:
                    ProcessLoot(e);
                    break;
                default:
                    //ProcessParty(e);
                    break;
            }
        }
 private static void ProcessItems(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     LineHelper.SetTimelineTypes(ref line);
     if (LineHelper.IsIgnored(line))
     {
         return;
     }
     var items = Regex.Match("ph", @"^\.$");
     switch (e.Subject)
     {
         case EventSubject.You:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = You;
                         _lastActionYou = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                         UpdateItems(items, line, exp, FilterType.You);
                     }
                     break;
             }
             break;
         case EventSubject.Pet:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNamePet = line.Source;
                         _lastActionPet = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                     }
                     break;
             }
             break;
         case EventSubject.Party:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNamePartyFrom = line.Source;
                         _lastActionPartyFrom = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                         UpdateItems(items, line, exp, FilterType.Party);
                     }
                     break;
             }
             break;
         case EventSubject.PetParty:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNamePetPartyFrom = line.Source;
                         _lastActionPet = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                     }
                     break;
             }
             break;
         case EventSubject.Alliance:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNameAllianceFrom = line.Source;
                         _lastActionAllianceFrom = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                         UpdateItems(items, line, exp, FilterType.Alliance);
                     }
                     break;
             }
             break;
         case EventSubject.PetAlliance:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNamePetAllianceFrom = line.Source;
                         _lastActionPet = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                     }
                     break;
             }
             break;
         case EventSubject.Other:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNameOtherFrom = line.Source;
                         _lastActionOtherFrom = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                         UpdateItems(items, line, exp, FilterType.Other);
                     }
                     break;
             }
             break;
         case EventSubject.PetOther:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     items = exp.pItems;
                     if (items.Success)
                     {
                         line.Source = Convert.ToString(items.Groups["source"].Value);
                         _lastNamePetOtherFrom = line.Source;
                         _lastActionPet = StringHelper.TitleCase(Convert.ToString(items.Groups["item"].Value));
                     }
                     break;
             }
             break;
         case EventSubject.Engaged:
         case EventSubject.UnEngaged:
             break;
     }
     if (items.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Item", e, exp);
 }
 private static void UpdateItems(Match item, Line line, Expressions exp, FilterType type)
 {
     _type = type;
     try
     {
         switch (type)
         {
             case FilterType.You:
                 line.Action = _lastActionYou;
                 break;
             case FilterType.Pet:
                 line.Action = _lastActionPet;
                 break;
             case FilterType.Party:
                 line.Action = _lastActionPartyHealingFrom;
                 break;
             case FilterType.PetParty:
                 line.Action = _lastActionPetPartyHealingFrom;
                 break;
             case FilterType.Alliance:
                 line.Action = _lastActionAllianceHealingFrom;
                 break;
             case FilterType.PetAlliance:
                 line.Action = _lastActionPetAllianceHealingFrom;
                 break;
             case FilterType.Other:
                 line.Action = _lastActionOtherHealingFrom;
                 break;
             case FilterType.PetOther:
                 line.Action = _lastActionPetOtherHealingFrom;
                 break;
         }
         switch (line.EventDirection)
         {
             case EventDirection.You:
                 line.Target = You;
                 break;
             default:
                 line.Target = line.Source;
                 break;
         }
         if (line.IsEmpty())
         {
             return;
         }
         var playerInstance = ParseControl.Instance.Timeline.GetSetPlayer(line.Source);
         playerInstance.Last20Items.Add(new LineHistory(line));
         if (playerInstance.Last20Items.Count > 20)
         {
             playerInstance.Last20Items.RemoveAt(0);
         }
     }
     catch (Exception ex)
     {
         ParsingLogHelper.Error(Logger, "Item", exp.Event, ex);
     }
 }
 /// <summary>
 /// </summary>
 /// <param name="name"></param>
 /// <param name="exp"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetTaggedName(string name, Expressions exp, TimelineType type)
 {
     if (type == TimelineType.Unknown)
     {
         return name;
     }
     var tag = "???";
     name = name.Trim();
     if (String.IsNullOrWhiteSpace(name))
     {
         return "";
     }
     name = Regex.Replace(name, @"\[[\w]+\]", "")
                 .Trim();
     var petFound = false;
     foreach (var pet in _pets.Where(pet => String.Equals(pet, name, Constants.InvariantComparer)))
     {
         petFound = true;
     }
     switch (type)
     {
         case TimelineType.You:
             tag = exp.YouString;
             break;
         case TimelineType.Party:
             tag = "P";
             break;
         case TimelineType.Alliance:
             tag = "A";
             break;
         case TimelineType.Other:
             tag = "O";
             break;
     }
     return String.Format("[{0}] {1}", tag, name);
 }
Exemplo n.º 7
0
        public static void Process(Event e)
        {
            if (!ParseControl.Instance.FirstActionFound)
            {
                switch (Settings.Default.StoreHistoryEvent)
                {
                    case "Any":
                        ParseControl.Instance.Reset();
                        break;
                    case "Damage Only":
                        if (e.Type == EventType.Damage)
                        {
                            ParseControl.Instance.Reset();
                        }
                        break;
                }
            }

            _lastEventYou = _lastEventYou ?? new Event();
            _lastEventPet = _lastEventPet ?? new Event();
            _lastEventParty = _lastEventParty ?? new Event();
            _lastEventPetParty = _lastEventPetParty ?? new Event();
            _lastEventAlliance = _lastEventAlliance ?? new Event();
            _lastEventPetAlliance = _lastEventPetAlliance ?? new Event();

            _type = FilterType.Unknown;

            var expressions = new Expressions(e);

            switch (Settings.Default.StoreHistoryEvent)
            {
                case "Any":
                    ParseControl.Instance.Timeline.StoreHistoryTimer.Stop();
                    break;
                case "Damage Only":
                    if (e.Type == EventType.Damage)
                    {
                        ParseControl.Instance.Timeline.StoreHistoryTimer.Stop();
                    }
                    break;
            }

            switch (e.Type)
            {
                case EventType.Damage:
                case EventType.Cure:
                    ParseControl.Instance.Timeline.FightingRightNow = true;
                    ParseControl.Instance.Timeline.FightingTimer.Stop();
                    break;
            }

            switch (e.Type)
            {
                case EventType.Damage:
                    ProcessDamage(e, expressions);
                    break;
                case EventType.Failed:
                    ProcessFailed(e, expressions);
                    break;
                case EventType.Actions:
                    ProcessActions(e, expressions);
                    break;
                case EventType.Items:
                    ProcessItems(e, expressions);
                    break;
                case EventType.Cure:
                    ProcessCure(e, expressions);
                    break;
                case EventType.Beneficial:
                    ProcessBeneficial(e, expressions);
                    break;
                case EventType.Detrimental:
                    ProcessDetrimental(e, expressions);
                    break;
            }

            switch (_type)
            {
                case FilterType.You:
                    _lastEventYou = e;
                    break;
                case FilterType.Pet:
                    _lastEventPet = e;
                    break;
                case FilterType.Party:
                    _lastEventParty = e;
                    break;
                case FilterType.PetParty:
                    _lastEventPetParty = e;
                    break;
                case FilterType.Alliance:
                    _lastEventAlliance = e;
                    break;
                case FilterType.PetAlliance:
                    _lastEventPetAlliance = e;
                    break;
            }

            switch (Settings.Default.StoreHistoryEvent)
            {
                case "Any":
                    ParseControl.Instance.Timeline.StoreHistoryTimer.Start();
                    break;
                case "Damage Only":
                    if (e.Type == EventType.Damage)
                    {
                        ParseControl.Instance.Timeline.StoreHistoryTimer.Start();
                    }
                    break;
            }

            switch (e.Type)
            {
                case EventType.Damage:
                case EventType.Cure:
                    ParseControl.Instance.Timeline.FightingTimer.Start();
                    break;
            }
        }
 private static void ProcessCure(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     LineHelper.SetTimelineTypes(ref line);
     if (LineHelper.IsIgnored(line))
     {
         return;
     }
     var cure = Regex.Match("ph", @"^\.$");
     switch (e.Subject)
     {
         case EventSubject.You:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     line.Target = You;
                     break;
             }
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = You;
                 UpdateHealing(cure, line, exp, FilterType.You);
             }
             break;
         case EventSubject.Pet:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNamePet;
                 UpdateHealing(cure, line, exp, FilterType.Pet);
             }
             break;
         case EventSubject.Party:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNamePartyHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.Party);
             }
             break;
         case EventSubject.PetParty:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNamePetPartyHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.PetParty);
             }
             break;
         case EventSubject.Alliance:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNameAllianceHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.Alliance);
             }
             break;
         case EventSubject.PetAlliance:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNamePetAllianceHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.PetAlliance);
             }
             break;
         case EventSubject.Other:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNameOtherHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.Other);
             }
             break;
         case EventSubject.PetOther:
             cure = exp.pCure;
             if (cure.Success)
             {
                 line.Source = _lastNamePetOtherHealingFrom;
                 UpdateHealing(cure, line, exp, FilterType.PetOther);
             }
             break;
     }
     if (cure.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Cure", e, exp);
 }
 private static void UpdateHealing(Match cure, Line line, Expressions exp, FilterType type)
 {
     _type = type;
     try
     {
         if (String.IsNullOrWhiteSpace(line.Source))
         {
             line.Source = Convert.ToString(cure.Groups["source"].Value);
         }
         if (String.IsNullOrWhiteSpace(line.Target))
         {
             line.Target = Convert.ToString(cure.Groups["target"].Value);
         }
         switch (type)
         {
             case FilterType.You:
                 line.Action = _lastActionYou;
                 break;
             case FilterType.Pet:
                 line.Action = _lastActionPet;
                 break;
             case FilterType.Party:
                 line.Action = _lastActionPartyHealingFrom;
                 break;
             case FilterType.PetParty:
                 line.Action = _lastActionPetPartyHealingFrom;
                 break;
             case FilterType.Alliance:
                 line.Action = _lastActionAllianceHealingFrom;
                 break;
             case FilterType.PetAlliance:
                 line.Action = _lastActionPetAllianceHealingFrom;
                 break;
             case FilterType.Other:
                 line.Action = _lastActionOtherHealingFrom;
                 break;
             case FilterType.PetOther:
                 line.Action = _lastActionPetOtherHealingFrom;
                 break;
         }
         line.Amount = cure.Groups["amount"].Success ? Convert.ToDecimal(cure.Groups["amount"].Value) : 0m;
         line.Crit = cure.Groups["crit"].Success;
         line.Modifier = cure.Groups["modifier"].Success ? Convert.ToDecimal(cure.Groups["modifier"].Value) / 100 : 0m;
         switch (line.EventDirection)
         {
             case EventDirection.You:
                 line.Target = You;
                 break;
         }
         line.RecLossType = Convert.ToString(cure.Groups["type"].Value.ToUpperInvariant());
         if (line.IsEmpty())
         {
             return;
         }
         if (line.RecLossType == exp.HealingType)
         {
             ParseControl.Instance.Timeline.GetSetPlayer(line.Source)
                         .SetHealing(line);
         }
     }
     catch (Exception ex)
     {
         ParsingLogHelper.Error(Logger, "Cure", exp.Event, ex);
     }
 }
 private static void UpdateDamageMonster(Match damage, Line line, Expressions exp, FilterType type)
 {
     _type = type;
     try
     {
         line.Hit = true;
         if (String.IsNullOrWhiteSpace(line.Source))
         {
             line.Source = Convert.ToString(damage.Groups["source"].Value);
         }
         if (String.IsNullOrWhiteSpace(line.Target))
         {
             line.Target = Convert.ToString(damage.Groups["target"].Value);
         }
         switch (damage.Groups["source"].Success)
         {
             case true:
                 var lastActionIsAttack = false;
                 switch (type)
                 {
                     case FilterType.You:
                         lastActionIsAttack = _lastActionYouIsAttack;
                         break;
                     case FilterType.Pet:
                         lastActionIsAttack = _lastActionPetIsAttack;
                         break;
                     case FilterType.Party:
                         lastActionIsAttack = _lastActionPartyIsAttack;
                         break;
                     case FilterType.PetParty:
                         lastActionIsAttack = _lastActionPetPartyIsAttack;
                         break;
                     case FilterType.Alliance:
                         lastActionIsAttack = _lastActionAllianceIsAttack;
                         break;
                     case FilterType.PetAlliance:
                         lastActionIsAttack = _lastActionPetAllianceIsAttack;
                         break;
                     case FilterType.Other:
                         lastActionIsAttack = _lastActionOtherIsAttack;
                         break;
                     case FilterType.PetOther:
                         lastActionIsAttack = _lastActionPetOtherIsAttack;
                         break;
                 }
                 line.Action = lastActionIsAttack ? String.Format("{0} [+]", exp.Attack) : exp.Attack;
                 break;
             case false:
                 line.Action = _lastActionMonster;
                 break;
         }
         line.Amount = damage.Groups["amount"].Success ? Convert.ToDecimal(damage.Groups["amount"].Value) : 0m;
         line.Block = damage.Groups["block"].Success;
         line.Crit = damage.Groups["crit"].Success;
         line.Modifier = damage.Groups["modifier"].Success ? Convert.ToDecimal(damage.Groups["modifier"].Value) / 100 : 0m;
         line.Parry = damage.Groups["parry"].Success;
         switch (type)
         {
             case FilterType.Pet:
                 _lastNamePet = line.Target;
                 break;
             case FilterType.Party:
                 _lastNamePartyTo = line.Target;
                 break;
             case FilterType.PetParty:
                 _lastNamePetPartyTo = line.Target;
                 break;
             case FilterType.Alliance:
                 _lastNameAllianceTo = line.Target;
                 break;
             case FilterType.PetAlliance:
                 _lastNamePetAllianceTo = line.Target;
                 break;
             case FilterType.Other:
                 _lastNameOtherTo = line.Target;
                 break;
             case FilterType.PetOther:
                 _lastNamePetOtherTo = line.Target;
                 break;
         }
         if (line.IsEmpty())
         {
             return;
         }
         switch (type)
         {
             default:
                 ParseControl.Instance.Timeline.PublishTimelineEvent(TimelineEventType.PartyMonsterFighting, line.Source);
                 break;
         }
         ParseControl.Instance.Timeline.GetSetPlayer(line.Target)
                     .SetDamageTaken(line);
         ParseControl.Instance.Timeline.GetSetMonster(line.Source)
                     .SetDamage(line);
     }
     catch (Exception ex)
     {
         ParsingLogHelper.Error(Logger, "Damage", exp.Event, ex);
     }
 }
 private static void ProcessDamage(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     LineHelper.SetTimelineTypes(ref line);
     if (LineHelper.IsIgnored(line))
     {
         return;
     }
     var damage = Regex.Match("ph", @"^\.$");
     switch (e.Subject)
     {
         case EventSubject.You:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = You;
                             UpdateDamage(damage, line, exp, FilterType.You);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionYouIsAttack = true;
                                 line.Source = You;
                                 UpdateDamage(damage, line, exp, FilterType.You);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Pet:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNamePet;
                             UpdateDamage(damage, line, exp, FilterType.Pet);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.Pet);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Party:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNamePartyFrom;
                             UpdateDamage(damage, line, exp, FilterType.Party);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPartyIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.Party);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetParty:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNamePetPartyFrom;
                             UpdateDamage(damage, line, exp, FilterType.PetParty);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetPartyIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.PetParty);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Alliance:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameAllianceFrom;
                             UpdateDamage(damage, line, exp, FilterType.Alliance);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionAllianceIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.Alliance);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetAlliance:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNamePetAllianceFrom;
                             UpdateDamage(damage, line, exp, FilterType.PetAlliance);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetAllianceIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.PetAlliance);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Other:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameOtherFrom;
                             UpdateDamage(damage, line, exp, FilterType.Other);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionOtherIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.Other);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetOther:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     damage = exp.pDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNamePetOtherFrom;
                             UpdateDamage(damage, line, exp, FilterType.PetOther);
                             break;
                         case false:
                             damage = exp.pDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetOtherIsAttack = true;
                                 UpdateDamage(damage, line, exp, FilterType.PetOther);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Engaged:
         case EventSubject.UnEngaged:
             switch (e.Direction)
             {
                 case EventDirection.You:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = You;
                             UpdateDamageMonster(damage, line, exp, FilterType.You);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionYouIsAttack = true;
                                 line.Target = You;
                                 UpdateDamageMonster(damage, line, exp, FilterType.You);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Pet:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePet;
                             UpdateDamageMonster(damage, line, exp, FilterType.Pet);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.Pet);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Party:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePartyTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.Party);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPartyIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.Party);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetParty:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetPartyTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.PetParty);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetPartyIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.PetParty);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Alliance:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNameAllianceTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.Alliance);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionAllianceIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.Alliance);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetAlliance:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetAllianceTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.PetAlliance);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetAllianceIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.PetAlliance);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Other:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNameOtherTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.Other);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionOtherIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.Other);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetOther:
                     damage = exp.mDamage;
                     switch (damage.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetOtherTo;
                             UpdateDamageMonster(damage, line, exp, FilterType.PetOther);
                             break;
                         case false:
                             damage = exp.mDamageAuto;
                             if (damage.Success)
                             {
                                 _lastActionPetOtherIsAttack = true;
                                 UpdateDamageMonster(damage, line, exp, FilterType.PetOther);
                             }
                             break;
                     }
                     break;
             }
             break;
     }
     if (damage.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Damage", e, exp);
 }
 private static void ProcessBeneficial(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     LineHelper.SetTimelineTypes(ref line);
     if (LineHelper.IsIgnored(line))
     {
         return;
     }
     var beneficial = Regex.Match("ph", @"^\.$");
     switch (e.Subject)
     {
         case EventSubject.You:
             switch (e.Direction)
             {
                 case EventDirection.Self:
                     line.Target = You;
                     break;
             }
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = You;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.You);
             }
             break;
         case EventSubject.Pet:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNamePet;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.Pet);
             }
             break;
         case EventSubject.Party:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNamePartyFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.Party);
             }
             break;
         case EventSubject.PetParty:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNamePetPartyFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.PetParty);
             }
             break;
         case EventSubject.Alliance:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNameAllianceFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.Alliance);
             }
             break;
         case EventSubject.PetAlliance:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNamePetAllianceFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.PetAlliance);
             }
             break;
         case EventSubject.Other:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNameOtherFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.Other);
             }
             break;
         case EventSubject.PetOther:
             beneficial = exp.pBeneficialGain;
             if (beneficial.Success)
             {
                 line.Source = _lastNamePetOtherFrom;
                 UpdateBeneficialGain(beneficial, line, exp, FilterType.PetOther);
             }
             break;
     }
     if (beneficial.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Beneficial", e, exp);
 }
 private static void UpdateBeneficialGain(Match beneficial, Line line, Expressions exp, FilterType type)
 {
     _type = type;
     try
     {
         if (String.IsNullOrWhiteSpace(line.Source))
         {
             line.Source = Convert.ToString(beneficial.Groups["source"].Value);
         }
         if (String.IsNullOrWhiteSpace(line.Target))
         {
             line.Target = Convert.ToString(beneficial.Groups["target"].Value);
         }
         line.Action = Convert.ToString(beneficial.Groups["status"].Value);
         var isStoneSkin = false;
         foreach (var stoneSkin in MagicBarrierHelper.StoneSkin.Where(stoneSkin => String.Equals(stoneSkin, line.Action, Constants.InvariantComparer)))
         {
             isStoneSkin = true;
         }
         switch (line.EventDirection)
         {
             case EventDirection.You:
                 line.Target = You;
                 break;
         }
         if (line.IsEmpty())
         {
             return;
         }
         if (isStoneSkin)
         {
             var multiplier = 0.1m;
             try
             {
                 var cleanedName = Regex.Replace(line.Source, @"\[[\w]+\]", "")
                                        .Trim();
                 var source = PCWorkerDelegate.GetNPCEntityByName(cleanedName);
                 if (source != null)
                 {
                     multiplier = source.Job == Actor.Job.WHM ? 0.18m : multiplier;
                 }
             }
             catch (Exception ex)
             {
             }
             try
             {
                 var cleanedName = Regex.Replace(line.Target, @"\[[\w]+\]", "")
                                        .Trim();
                 var target = PCWorkerDelegate.GetNPCEntityByName(cleanedName);
                 if (target != null)
                 {
                     line.Amount = target.HPMax * multiplier;
                     ParseControl.Instance.Timeline.GetSetPlayer(line.Source)
                                 .SetupHealingMitigated(line, "stoneskin");
                 }
             }
             catch (Exception ex)
             {
             }
         }
     }
     catch (Exception ex)
     {
         ParsingLogHelper.Error(Logger, "Cure", exp.Event, ex);
     }
 }
 private static void UpdateFailedMonster(Match failed, Line line, Expressions exp, FilterType type)
 {
     _type = type;
     try
     {
         line.Miss = true;
         if (String.IsNullOrWhiteSpace(line.Source))
         {
             line.Source = Convert.ToString(failed.Groups["source"].Value);
         }
         if (String.IsNullOrWhiteSpace(line.Target))
         {
             line.Target = Convert.ToString(failed.Groups["target"].Value);
         }
         switch (failed.Groups["source"].Success)
         {
             case true:
                 line.Action = exp.Attack;
                 break;
             case false:
                 line.Action = _lastActionMonster;
                 break;
         }
         switch (type)
         {
             case FilterType.Pet:
                 _lastNamePet = line.Target;
                 break;
             case FilterType.Party:
                 _lastNamePartyTo = line.Target;
                 break;
             case FilterType.PetParty:
                 _lastNamePetPartyTo = line.Target;
                 break;
             case FilterType.Alliance:
                 _lastNameAllianceTo = line.Target;
                 break;
             case FilterType.PetAlliance:
                 _lastNamePetAllianceTo = line.Target;
                 break;
             case FilterType.Other:
                 _lastNameOtherTo = line.Target;
                 break;
             case FilterType.PetOther:
                 _lastNamePetOtherTo = line.Target;
                 break;
         }
         if (line.IsEmpty())
         {
             return;
         }
         switch (type)
         {
             default:
                 ParseControl.Instance.Timeline.PublishTimelineEvent(TimelineEventType.PartyMonsterFighting, line.Source);
                 break;
         }
         ParseControl.Instance.Timeline.GetSetPlayer(line.Target)
                     .SetDamageTaken(line);
         ParseControl.Instance.Timeline.GetSetMonster(line.Source)
                     .SetDamage(line);
     }
     catch (Exception ex)
     {
         ParsingLogHelper.Error(Logger, "Failed", exp.Event, ex);
     }
 }
 private static void ProcessFailed(Event e, Expressions exp)
 {
     var line = new Line(e.ChatLogEntry)
     {
         EventDirection = e.Direction,
         EventSubject = e.Subject,
         EventType = e.Type
     };
     LineHelper.SetTimelineTypes(ref line);
     if (LineHelper.IsIgnored(line))
     {
         return;
     }
     var failed = Regex.Match("ph", @"^\.$");
     switch (e.Subject)
     {
         case EventSubject.You:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = You;
                             UpdateFailed(failed, line, exp, FilterType.You);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 line.Source = You;
                                 UpdateFailed(failed, line, exp, FilterType.You);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Pet:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNamePet;
                             UpdateFailed(failed, line, exp, FilterType.Pet);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.Pet);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Party:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNamePartyFrom;
                             UpdateFailed(failed, line, exp, FilterType.Party);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.Party);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetParty:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNamePetPartyFrom;
                             UpdateFailed(failed, line, exp, FilterType.PetParty);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.PetParty);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Alliance:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameAllianceFrom;
                             UpdateFailed(failed, line, exp, FilterType.Alliance);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.Alliance);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetAlliance:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNamePetAllianceFrom;
                             UpdateFailed(failed, line, exp, FilterType.PetAlliance);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.PetAlliance);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Other:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameOtherFrom;
                             UpdateFailed(failed, line, exp, FilterType.Other);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.Other);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.PetOther:
             switch (e.Direction)
             {
                 case EventDirection.Engaged:
                 case EventDirection.UnEngaged:
                     failed = exp.pFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNamePetOtherFrom;
                             UpdateFailed(failed, line, exp, FilterType.PetOther);
                             break;
                         case false:
                             failed = exp.pFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailed(failed, line, exp, FilterType.PetOther);
                             }
                             break;
                     }
                     break;
             }
             break;
         case EventSubject.Engaged:
         case EventSubject.UnEngaged:
             switch (e.Direction)
             {
                 case EventDirection.You:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = You;
                             UpdateFailedMonster(failed, line, exp, FilterType.You);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 line.Target = You;
                                 UpdateFailedMonster(failed, line, exp, FilterType.You);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Pet:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePet;
                             UpdateFailedMonster(failed, line, exp, FilterType.Pet);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.Pet);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Party:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePartyTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.Party);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.Party);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetParty:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetPartyTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.PetParty);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.PetParty);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Alliance:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNameAllianceTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.Alliance);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.Alliance);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetAlliance:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetAllianceTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.PetAlliance);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.PetAlliance);
                             }
                             break;
                     }
                     break;
                 case EventDirection.Other:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNameOtherTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.Other);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.Other);
                             }
                             break;
                     }
                     break;
                 case EventDirection.PetOther:
                     failed = exp.mFailed;
                     switch (failed.Success)
                     {
                         case true:
                             line.Source = _lastNameMonster;
                             line.Target = _lastNamePetOtherTo;
                             UpdateFailedMonster(failed, line, exp, FilterType.PetOther);
                             break;
                         case false:
                             failed = exp.mFailedAuto;
                             if (failed.Success)
                             {
                                 UpdateFailedMonster(failed, line, exp, FilterType.PetOther);
                             }
                             break;
                     }
                     break;
             }
             break;
     }
     if (failed.Success)
     {
         return;
     }
     ParsingLogHelper.Log(Logger, "Failed", e, exp);
 }