Ejemplo n.º 1
0
        private static LogEventMod ParseMod(string text)
        {
            LogEventMod mod   = 0;
            var         parts = text.ToLower().Split(' ');

            for (int i = 0; i < parts.Length; i++)
            {
                switch (parts[i])
                {
                case "critical":
                    mod |= LogEventMod.Critical;
                    break;

                case "twincast":
                    mod |= LogEventMod.Twincast;
                    break;

                case "lucky":
                    mod |= LogEventMod.Lucky;
                    break;

                default:
                    break;
                }
            }
            return(mod);
        }
Ejemplo n.º 2
0
        private static LogEventMod ParseMod(string text)
        {
            LogEventMod mod   = 0;
            var         parts = text.ToLower().Split(' ');

            for (int i = 0; i < parts.Length; i++)
            {
                switch (parts[i])
                {
                case "flurry":
                    mod |= LogEventMod.Flurry;
                    break;

                case "lucky":
                    mod |= LogEventMod.Lucky;
                    break;

                case "riposte":
                    mod |= LogEventMod.Riposte;
                    break;

                case "strikethrough":
                    mod |= LogEventMod.Strikethrough;
                    break;

                default:
                    break;
                }
            }
            return(mod);
        }
Ejemplo n.º 3
0
        public static LogHealEvent Parse(LogRawEvent e)
        {
            // this short-circuit exit is here strictly as a speed optmization
            if (e.Text.IndexOf("heal", StringComparison.Ordinal) < 0)
            {
                return(null);
            }

            LogEventMod mod = 0;
            var         m   = HealModRegex.Match(e.Text);

            if (m.Success)
            {
                mod = ParseMod(m.Groups[1].Value);
            }

            m = HoTRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHealEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Target = m.Groups[2].Value == "himself" || m.Groups[2].Value == "herself" || m.Groups[2].Value == "itself" ? e.FixName(m.Groups[1].Value) : e.FixName(m.Groups[2].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    FullAmount = m.Groups[4].Success ? Int32.Parse(m.Groups[4].Value) : Int32.Parse(m.Groups[3].Value),
                    Spell = m.Groups[5].Success ? m.Groups[5].Value : null,
                    Mod = mod
                });
            }

            m = HoTRegexNoSource.Match(e.Text);
            if (m.Success)
            {
                return(new LogHealEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = null,
                    Target = e.FixName(m.Groups[1].Value),
                    Amount = Int32.Parse(m.Groups[2].Value),
                    FullAmount = m.Groups[3].Success ? Int32.Parse(m.Groups[3].Value) : Int32.Parse(m.Groups[2].Value),
                    Spell = m.Groups[4].Success ? m.Groups[4].Value : null,
                    Mod = mod
                });
            }

            // InstantRegex will incorrectly capture the obsolete messages
            // the check for the '.' used to exclude them
            m = InstantRegex.Match(e.Text);
            if (m.Success && !m.Groups[1].Value.Contains('.'))
            {
                return(new LogHealEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Target = m.Groups[2].Value == "himself" || m.Groups[2].Value == "herself" || m.Groups[2].Value == "itself" ? e.FixName(m.Groups[1].Value) : e.FixName(m.Groups[2].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    FullAmount = m.Groups[4].Success ? Int32.Parse(m.Groups[4].Value) : Int32.Parse(m.Groups[3].Value),
                    Spell = m.Groups[5].Success ? m.Groups[5].Value : null,
                    Mod = mod
                });
            }

            m = ObsoleteInstantRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHealEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Target = m.Groups[2].Value == "himself" || m.Groups[2].Value == "herself" || m.Groups[2].Value == "itself" ? e.FixName(m.Groups[1].Value) : e.FixName(m.Groups[2].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    FullAmount = m.Groups[4].Success ? Int32.Parse(m.Groups[4].Value) : Int32.Parse(m.Groups[3].Value),
                    Spell = m.Groups[5].Success ? m.Groups[5].Value : null,
                    Mod = mod
                });
            }

            return(null);
        }
Ejemplo n.º 4
0
        public static LogHitEvent Parse(LogRawEvent e)
        {
            // this short-circuit exit is here strictly as a speed optimization
            // this is the slowest parser of all and wasting time here slows down parsing quite a bit
            // "Bob has taken 1 damage" -- minimum possible occurance is at character 15?
            //if (e.Text.Length < 30 || e.Text.IndexOf("damage", 15) < 0)
            if (e.Text.IndexOf("damage", StringComparison.Ordinal) < 0)
            {
                return(null);
            }

            LogEventMod mod = 0;
            var         m   = HitModRegex.Match(e.Text);

            if (m.Success)
            {
                mod = ParseMod(m.Groups[1].Value);
            }

            // rather than parsing self hits, we can use FixName to convert "yourself"
            //m = SelfDamageRegex.Match(e.Text);
            //if (m.Success)
            //{
            //    return new LogHitEvent()
            //    {
            //        Timestamp = e.Timestamp,
            //        Source = e.FixName(m.Groups[1].Value),
            //        Target = e.FixName(m.Groups[1].Value),
            //        Amount = Int32.Parse(m.Groups[2].Value),
            //        Spell = m.Groups[3].Value,
            //        Type = "self"
            //    };
            //}

            m = MeleeHitRegex.Match(e.Text);
            if (m.Success)
            {
                var type = m.Groups[2].Value;
                if (type == "frenzy on" || type == "frenzies on")
                {
                    type = "frenzy";
                }

                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Type = type,
                    //Target = e.FixName(m.Groups[3].Value),
                    Target = m.Groups[3].Value == "himself" || m.Groups[3].Value == "herself" || m.Groups[3].Value == "itself" ? e.FixName(m.Groups[1].Value) : e.FixName(m.Groups[3].Value),
                    Amount = Int32.Parse(m.Groups[4].Value),
                    Mod = mod
                });
            }

            m = NukeDamageRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Target = e.FixName(m.Groups[2].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    Spell = m.Groups[4].Value,
                    Type = "dd",
                    Mod = mod
                });
            }

            m = OwnDoTDamageRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Target = e.FixName(m.Groups[1].Value),
                    Amount = Int32.Parse(m.Groups[2].Value),
                    Source = e.Player,
                    Spell = m.Groups[3].Value,
                    Type = "dot",
                    Mod = mod
                });
            }

            m = OtherDoTDamageRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Target = e.FixName(m.Groups[1].Value),
                    Amount = Int32.Parse(m.Groups[2].Value),
                    Source = e.FixName(m.Groups[4].Value),
                    Spell = m.Groups[3].Value,
                    Type = "dot",
                    Mod = mod
                });
            }

            m = DamageShieldRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[2].Value),
                    Target = e.FixName(m.Groups[1].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    Type = "ds"
                });
            }

            // this is obsolete but doesn't interfere with any current log messages and has minimal impact on parsing performance
            m = ObsoleteNukeDamageRegex.Match(e.Text);
            if (m.Success)
            {
                return(new LogHitEvent()
                {
                    Timestamp = e.Timestamp,
                    Source = e.FixName(m.Groups[1].Value),
                    Target = e.FixName(m.Groups[2].Value),
                    Amount = Int32.Parse(m.Groups[3].Value),
                    Type = "dd",
                    Mod = mod
                });
            }

            return(null);
        }
Ejemplo n.º 5
0
        private static LogEventMod ParseMod(string text)
        {
            LogEventMod mod = 0;

            text = text.ToLower();
            text = text.Replace("double bow shot", "doublebow"); // multi word mod won't split properly
            var parts = text.Split(' ');

            for (int i = 0; i < parts.Length; i++)
            {
                switch (parts[i])
                {
                case "critical":
                case "crippling":
                    mod |= LogEventMod.Critical;
                    break;

                case "twincast":
                case "twinstrike":
                    mod |= LogEventMod.Twincast;
                    break;

                case "lucky":
                    mod |= LogEventMod.Lucky;
                    break;

                case "riposte":
                    mod |= LogEventMod.Riposte;
                    break;

                case "strikethrough":
                    mod |= LogEventMod.Strikethrough;
                    break;

                case "flurry":
                    mod |= LogEventMod.Flurry;
                    break;

                case "finishing":
                    mod |= LogEventMod.Finishing_Blow;
                    break;

                case "doublebow":
                    mod |= LogEventMod.Double_Bow_Shot;
                    break;

                case "headshot":
                    mod |= LogEventMod.Headshot;
                    break;

                case "assassinate":
                    mod |= LogEventMod.Assassinate;
                    break;

                case "decapitate":
                    mod |= LogEventMod.Decapitate;
                    break;

                case "slay":
                    mod |= LogEventMod.Slay_Undead;
                    mod |= LogEventMod.Critical;
                    break;

                case "rampage":
                    mod |= LogEventMod.Rampage;
                    break;

                case "wild":
                    mod |= LogEventMod.Wild_Rampage;
                    break;

                case "locked":
                    mod |= LogEventMod.Locked;
                    break;

                default:
                    break;
                }
            }
            return(mod);
        }