コード例 #1
0
        private CombatLogParticipant ProcessParticipant(string entity)
        {
            string name;

            var participant = new CombatLogParticipant(CombatLogParticipant.EmptyParticipantName, entityId: 0)
            {
                IsPlayer = entity.StartsWith("@")
            };

            if (participant.IsPlayer)
            {
                name = MatchByPlayer(entity, participant);
            }
            else // NPC
            {
                name = MatchByNPC(entity, participant);
            }

            if (!string.IsNullOrEmpty(name))
            {
                participant.DisplayName = name;
            }

            return participant;
        }
コード例 #2
0
        private static string MatchByNPC(string entity, CombatLogParticipant participant)
        {
            var match = NpcRegex.Match(entity);

            if (match.Success)
            {
                participant.EntityId = Convert.ToInt64(match.Groups[2].Value);
                participant.UniqueId = Convert.ToInt64(match.Groups[3].Value);
                return match.Groups[1].Value;
            }

            return null;
        }
コード例 #3
0
        private static string MatchByPlayer(string entity, CombatLogParticipant participant)
        {
            if (entity.EndsWith("}"))
            {
                var match = CompanionRegex.Match(entity.Substring(1));

                if (match.Success)
                {
                    participant.IsPlayerCompanion = true;
                    participant.CompanionOwner = match.Groups[1].Value;
                    participant.EntityId = Convert.ToInt64(match.Groups[3].Value);
                    return match.Groups[2].Value;
                }
            }
            else
            {
                return entity.Substring(1);
            }

            return null;
        }