예제 #1
0
        private void ParseDamageReceived(CombatMessage msg, Match m)
        {
            msg.CombatType = CombatLogType.DamageTaken;
            string source = m.Groups[1].Value;
            uint   points = 0;

            if (!UInt32.TryParse(m.Groups[2].Value, out points))
            {
                points    = 0;
                msg.State = ChatMessageState.ParsingError;
                return;
            }
            string type      = m.Groups[3].Value.Trim();
            uint   blocked   = 0;
            string blockedby = "";

            if (m.Groups.Count > 4)
            {
                if (!UInt32.TryParse(m.Groups[4].Value, out blocked))
                {
                    blocked   = 0;
                    msg.State = ChatMessageState.ParsingError;
                    return;
                }
                blockedby = m.Groups[5].Value.Trim();
            }

            msg.State  = ChatMessageState.Parsed;
            msg.Damage = new Damage(points, blocked, blockedby, source, Damage.Player, StringToType(type));
            SplitTargetAbility(msg.Damage);
        }
예제 #2
0
 /// <summary>
 /// Adds a new chat log message.
 /// </summary>
 /// <param name="msg">Message to parse and add.</param>
 public void Add(ChatMessage msg)
 {
     chatlog.Add(msg);
     if (msg.IsCombat)
     {
         CombatMessage c = msg as CombatMessage;
         combatlog.Add(c);
     }
 }
예제 #3
0
파일: EnglishParser.cs 프로젝트: n0la/dclog
        public ChatMessage Parse(ChatMessage msg)
        {
            Match m = null;
              ChatMessage result = msg;
              CombatMessage combat;

              if ( (m = damagedone.Match(msg.Text)).Success )
              {
            combat = new CombatMessage(msg);
            ParseDamageDone(combat, m);
            result = combat;
              }
              else if ((m = damagedonedr.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            ParseDamageDone(combat, m);
            result = combat;
              }
              else if ((m = damagervd.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            ParseDamageReceived(combat, m);
            result = combat;
              }
              else if ((m = damagervddr.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            ParseDamageReceived(combat, m);
            result = combat;
              }
              else if ((m = damage.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            ParseDamageReceived(combat, m);
            result = combat;
              }
              else if ((m = damageno.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            ParseNoDamage(combat, m);
            result = combat;
              }
              else if ((m = killed.Match(msg.Text)).Success)
              {
            combat = new CombatMessage(msg);
            combat.CombatType = CombatLogType.TargetKilled;
            combat.Target = m.Groups[1].Value;
            combat.State = ChatMessageState.Parsed;
            result = combat;
              }
              return result;
        }
예제 #4
0
        public ChatMessage Parse(ChatMessage msg)
        {
            Match         m      = null;
            ChatMessage   result = msg;
            CombatMessage combat;

            if ((m = damagedone.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseDamageDone(combat, m);
                result = combat;
            }
            else if ((m = damagedonedr.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseDamageDone(combat, m);
                result = combat;
            }
            else if ((m = damagervd.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseDamageReceived(combat, m);
                result = combat;
            }
            else if ((m = damagervddr.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseDamageReceived(combat, m);
                result = combat;
            }
            else if ((m = damage.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseDamageReceived(combat, m);
                result = combat;
            }
            else if ((m = damageno.Match(msg.Text)).Success)
            {
                combat = new CombatMessage(msg);
                ParseNoDamage(combat, m);
                result = combat;
            }
            else if ((m = killed.Match(msg.Text)).Success)
            {
                combat            = new CombatMessage(msg);
                combat.CombatType = CombatLogType.TargetKilled;
                combat.Target     = m.Groups[1].Value;
                combat.State      = ChatMessageState.Parsed;
                result            = combat;
            }
            return(result);
        }
예제 #5
0
        /// <summary>
        /// Parses no damage combat logs in form of
        /// "XXX hit you but did no damage; Y points of damage were blocked by damage reduction."
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="m"></param>
        private void ParseNoDamage(CombatMessage msg, Match m)
        {
            msg.CombatType = CombatLogType.DamageTaken;
            string source  = m.Groups[1].Value;
            uint   blocked = 0;

            if (!UInt32.TryParse(m.Groups[2].Value, out blocked))
            {
                blocked   = 0;
                msg.State = ChatMessageState.ParsingError;
                return;
            }
            string blockedby = m.Groups[3].Value;

            msg.State  = ChatMessageState.Parsed;
            msg.Damage = new Damage(0, blocked, blockedby, source, Damage.Player, DamageType.Unknown);
        }
예제 #6
0
파일: EnglishParser.cs 프로젝트: n0la/dclog
        /// <summary>
        /// Parses no damage combat logs in form of
        /// "XXX hit you but did no damage; Y points of damage were blocked by damage reduction."
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="m"></param>
        private void ParseNoDamage(CombatMessage msg, Match m)
        {
            msg.CombatType = CombatLogType.DamageTaken;
              string source = m.Groups[1].Value;
              uint blocked = 0;
              if (!UInt32.TryParse(m.Groups[2].Value, out blocked))
              {
            blocked = 0;
            msg.State = ChatMessageState.ParsingError;
            return;
              }
              string blockedby = m.Groups[3].Value;

              msg.State = ChatMessageState.Parsed;
              msg.Damage = new Damage(0, blocked, blockedby, source, Damage.Player, DamageType.Unknown);
        }
예제 #7
0
파일: EnglishParser.cs 프로젝트: n0la/dclog
        private void ParseDamageReceived(CombatMessage msg, Match m)
        {
            msg.CombatType = CombatLogType.DamageTaken;
              string source = m.Groups[1].Value;
              uint points = 0;

              if (!UInt32.TryParse(m.Groups[2].Value, out points))
              {
            points = 0;
            msg.State = ChatMessageState.ParsingError;
            return;
              }
              string type = m.Groups[3].Value.Trim();
              uint blocked = 0;
              string blockedby = "";

              if (m.Groups.Count > 4)
              {
            if (!UInt32.TryParse(m.Groups[4].Value, out blocked))
            {
              blocked = 0;
              msg.State = ChatMessageState.ParsingError;
              return;
            }
            blockedby = m.Groups[5].Value.Trim();
              }

              msg.State = ChatMessageState.Parsed;
              msg.Damage = new Damage(points, blocked, blockedby, source, Damage.Player, StringToType(type));
              SplitTargetAbility(msg.Damage);
        }