Exemplo n.º 1
0
        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.ToDouble(cure.Groups["amount"].Value) : 0;
                line.Crit     = cure.Groups["crit"].Success;
                line.Modifier = cure.Groups["modifier"].Success ? Convert.ToDouble(cure.Groups["modifier"].Value) / 100 : 0;
                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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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 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]+\]", string.Empty).Trim();
                        ActorItem source      = XIVInfoViewModel.Instance.CurrentPCs.FirstOrDefault(kvp => kvp.Value.Name.Equals(cleanedName, Constants.InvariantComparer)).Value;
                        if (source != null)
                        {
                            multiplier = source.Job == Actor.Job.WHM
                                             ? 0.18m
                                             : multiplier;
                        }
                    }
                    catch (Exception ex) {
                        Logging.Log(Logger, new LogItem(ex, true));
                    }

                    try {
                        var       cleanedName = Regex.Replace(line.Target, @"\[[\w]+\]", string.Empty).Trim();
                        ActorItem target      = XIVInfoViewModel.Instance.CurrentPCs.FirstOrDefault(kvp => kvp.Value.Name.Equals(cleanedName, Constants.InvariantComparer)).Value;
                        if (target != null)
                        {
                            line.Amount = (double)(target.HPMax * multiplier);
                            ParseControl.Instance.Timeline.GetSetPlayer(line.Source).SetupHealingMitigated(line, "stoneskin");
                        }
                    }
                    catch (Exception ex) {
                        Logging.Log(Logger, new LogItem(ex, true));
                    }
                }
            }
            catch (Exception ex) {
                ParsingLogHelper.Error(Logger, "Cure", exp.Event, ex);
            }
        }
        private static void ProcessBeneficial(Event e, Expressions exp)
        {
            var line = new Line(e.ChatLogItem)
            {
                EventDirection = e.Direction,
                EventSubject   = e.Subject,
                EventType      = e.Type
            };

            LineHelper.SetTimelineTypes(ref line);
            if (LineHelper.IsIgnored(line))
            {
                return;
            }

            Match 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 UpdateDamageMonster(Match damage, Line line, Expressions exp, FilterType type)
        {
            _type = type;
            try {
                line.Hit       = true;
                line.DirectHit = damage.Groups["direct"].Success;

                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);
                }

                var lastActionIsAttack = false;

                switch (damage.Groups["source"].Success)
                {
                case true:
                    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;
                    }

                    break;

                case false:
                    line.Action = _lastActionMonster;
                    break;
                }

                line.Action = lastActionIsAttack
                                  ? $"{exp.Attack} [+]"
                                  : exp.Attack;
                line.Action = line.DirectHit
                                  ? $"{line.Action} [→]"
                                  : line.Action;

                line.Amount = damage.Groups["amount"].Success
                                  ? Convert.ToDouble(damage.Groups["amount"].Value)
                                  : 0;
                line.Block    = damage.Groups["block"].Success;
                line.Crit     = damage.Groups["crit"].Success;
                line.Modifier = damage.Groups["modifier"].Success
                                    ? Convert.ToDouble(damage.Groups["modifier"].Value) / 100
                                    : 0;
                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.ChatLogItem)
            {
                EventDirection = e.Direction,
                EventSubject   = e.Subject,
                EventType      = e.Type,
            };

            LineHelper.SetTimelineTypes(ref line);
            if (LineHelper.IsIgnored(line))
            {
                return;
            }

            Match 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);
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        private static void ProcessFailed(Event e, Expressions exp)
        {
            var line = new Line(e.ChatLogItem)
            {
                EventDirection = e.Direction,
                EventSubject   = e.Subject,
                EventType      = e.Type
            };

            LineHelper.SetTimelineTypes(ref line);
            if (LineHelper.IsIgnored(line))
            {
                return;
            }

            Match 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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// </summary>
 /// <param name="e"> </param>
 protected override void HandleUnknownEvent(Event e)
 {
     ParsingLogHelper.Log(Logger, "UnknownEvent", e);
 }