コード例 #1
0
        void LogCombatEvent(SwingTypeEnum st, LogLineEventArgs logInfo, CombatEvent ce, string special = "")
        {
            MasterSwing ms = new MasterSwing(
                                (int)st,
                                ce.critical,
                                special,
                                new Dnum(ce.hitValue),
                                logInfo.detectedTime,
                                ActGlobals.oFormActMain.GlobalTimeSorter,
                                ce.ability,
                                ce.sourceName,
                                ce.damageType,
                                ce.targetName);

            ms.Tags.Add("ActionResult", ce.result);
            ms.Tags.Add("ActionSlotType", ce.abilitySlotType);
            ms.Tags.Add("PowerType", ce.powerType);

            ActGlobals.oFormActMain.AddCombatAction(ms);
        }
コード例 #2
0
        public bool CheckReflected(CombatEvent ce, out string abilityOut)
        {
            abilityOut = "";

            if (reflects.Count == 0) return false;

            string ability = "";
            string key = ce.sourceName + ':' + ce.sourceType + ':' + ce.ability;
            if (reflects.TryGetValue(key, out ability))
            {
                reflects.Remove(key);
                abilityOut = ability;
                return true;
            }

            return false;
        }
コード例 #3
0
        private CombatEvent FixNames(CombatEvent ce)
        {
            if ((ce.targetName.Length == 0) || (ce .sourceName.Length == 0))
            {
                CombatEvent.Builder b = CombatEvent.Builder.Build(ce);

                if (ce.targetName.Length == 0) b.Target(unk, "None");
                if (ce.sourceName.Length == 0) b.Source(unk, "None");

                return b.Done();
            }
            else
            {
                return ce;
            }
        }
コード例 #4
0
 public void AddReflected(CombatEvent ce)
 {
     if ((ce.sourceType != ce.targetType) ||
          (ce.sourceName != ce.targetName))
     {
         // An attack has been relfected.
         reflects.Add(ce.targetName + ':' + ce.targetType + ':' + ce.ability, ce.ability);
     }
     else
     {
         // source == target
         // Indicates the ability activated that will perform the reflect.  ie:
         // *CMBT:Reflected:Defensive Posture:NormalAbility:Lodur Darkbane:Player:Lodur Darkbane:Player:0:Invalid:Generic
     }
 }
コード例 #5
0
            public static Builder Build(CombatEvent ce)
            {
                Builder b = new Builder();

                b.result = ce.result;
                b.ability = ce.ability;
                b.abilitySlotType = ce.abilitySlotType;
                b.sourceName = ce.sourceName;
                b.sourceType = ce.sourceType;
                b.targetName = ce.targetName;
                b.targetType = ce.targetType;
                b.hitValue = ce.hitValue;
                b.powerType = ce.powerType;
                b.damageType = ce.damageType;
                b.critical = ce.critical;
                b.type = ce.type;
                b.actionResult = ce.actionResult;

                return b;
            }
コード例 #6
0
        private void ProcessCombat(LogLineEventArgs logInfo, CombatEvent ce)
        {
            ce = FixNames(ce);

            switch (ce.type)
            {
                case CombatEvent.Type.Damage:
                    logInfo.detectedType = Color.Red.ToArgb();

                    if (ce.actionResult == CombatEvent.ActionResult.ACTION_RESULT_FALL_DAMAGE)
                    {
                        // Falling damage does not start combat.
                        if (!ActGlobals.oFormActMain.InCombat) return;

                        // TODO:  Need to test falling damage.
                    }

                    if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                    {
                        // TODO get the ability that triggers the reflect if possible..
                        string ability = "";

                        if (reflectionTracker.CheckReflected(ce, out ability))
                        {
                            CombatEvent new_ce = CombatEvent.Builder.Build(ce)
                                .Ability("Reflected: " + ce.ability)
                                .Done();

                            LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, new_ce, "");
                        }
                        else
                        {
                            if ( (damageShielded != null) &&
                                 (damageShielded.targetName == ce.targetName) &&
                                 (damageShielded.sourceName == ce.sourceName) )
                            {
                                int shieled = 0;
                                int damage = 0;

                                if (damageShielded.hitValue < ce.hitValue)
                                {
                                    damage = ce.hitValue - damageShielded.hitValue;
                                    shieled = damageShielded.hitValue;
                                }
                                else
                                {
                                    damage = 0;
                                    shieled = ce.hitValue;
                                }

                                CombatEvent ds_ce = CombatEvent.Builder.Build(damageShielded)
                                    .Source(damageShielded.targetName, damageShielded.targetType)
                                    .HitValue(shieled)
                                    .DamageType("Damage Shield")
                                    .Done();

                                LogCombatEvent(SwingTypeEnum.Healing, logInfo, ds_ce, ce.ability);
                                LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, ce, "Shielded: " + shieled.ToString());
                            }
                            else
                            {
                                LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, ce);
                            }

                            damageShielded = null;
                        }
                    }
                    break;
                case CombatEvent.Type.MissLike:
                    logInfo.detectedType = Color.DarkRed.ToArgb();

                    if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                    {
                        string special = ce.result;
                        LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, ce, special);
                    }
                    break;
                case CombatEvent.Type.Heal:
                    logInfo.detectedType = Color.Green.ToArgb();
                    if (ActGlobals.oFormActMain.InCombat)
                    {
                        if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                        {
                            CombatEvent heal_ce = null;
                            if (ce.actionResult == CombatEvent.ActionResult.ACTION_RESULT_HOT_TICK)
                            {
                                heal_ce = CombatEvent.Builder.Build(ce).DamageType("HoT").Done();
                            }
                            else
                            {
                                CombatEvent.Builder b = CombatEvent.Builder.Build(ce).DamageType("Heal");
                                if (ce.ability == "Mutagen") b = b.Ability("Mutagen Heal");
                                heal_ce = b.Done();
                            }

                            LogCombatEvent(SwingTypeEnum.Healing, logInfo, heal_ce);
                        }
                    }
                    break;
                case CombatEvent.Type.Death:
                    logInfo.detectedType = Color.Fuchsia.ToArgb();

                    // TODO: right names...
                    ActGlobals.oFormSpellTimers.RemoveTimerMods(ce.targetName);
                    ActGlobals.oFormSpellTimers.DispellTimerMods(ce.targetName);

                    if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                    {
                        MasterSwing ms =
                            new MasterSwing((int)SwingTypeEnum.NonMelee, false, "",
                                Dnum.Death, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter,
                                "Killing", ce.sourceName, "Death", ce.targetName);

                        ms.Tags.Add("ActionResult", ce.result);
                        ms.Tags.Add("ActionSlotType", ce.abilitySlotType);
                        ms.Tags.Add("PowerType", ce.powerType);

                        ActGlobals.oFormActMain.AddCombatAction(ms);
                    }
                    break;
                case CombatEvent.Type.Other:
                    logInfo.detectedType = Color.Blue.ToArgb();

                    switch (ce.actionResult)
                    {
                        case CombatEvent.ActionResult.ACTION_RESULT_POWER_ENERGIZE:

                            logInfo.detectedType = Color.Gold.ToArgb();
                            if (ActGlobals.oFormActMain.InCombat)
                            {
                                if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                                {
                                    // TODO: Magicka vs Stamina handling... Special case off ability name?
                                    //       ce.powerType -> Magicka for both magicka and stamina restoring.
                                    if (ce.ability == "Absorb Stamina")
                                    {
                                        // NOTE: Only statmina case handled.
                                        LogCombatEvent(SwingTypeEnum.StaminaHealing, logInfo, ce);
                                    }
                                    else
                                    {
                                        LogCombatEvent(SwingTypeEnum.MagickaHealing, logInfo, ce);
                                    }
                                }
                            }
                            break;

                        case CombatEvent.ActionResult.ACTION_RESULT_REFLECTED:
                            logInfo.detectedType = Color.LightPink.ToArgb();

                            if (!ActGlobals.oFormActMain.InCombat)
                            {
                                if ((ce.sourceType == ce.targetType) && (ce.sourceName == ce.targetName)) break;
                            }

                            if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                            {
                                reflectionTracker.AddReflected(ce);
                            }
                            break;
                        case CombatEvent.ActionResult.ACTION_RESULT_BLOCKED_DAMAGE:
                            logInfo.detectedType = Color.Red.ToArgb();

                            // TODO: possibly make this a CombatEvent.Type.Damage instead of a special case.
                            //       Add a special field to CombatEvent?
                            if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                            {
                                // Block does 50% damage by default.
                                LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, ce, "Blocked");
                            }
                            break;
                        case CombatEvent.ActionResult.ACTION_RESULT_DAMAGE_SHIELDED:
                            logInfo.detectedType = Color.Green.ToArgb();

                            // DamageShielded = The number of damage shield points used by the next Damage line
                            // Damage = The damage hit ( need to subtract shielded damage )

                            if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                            {
                                damageShielded = ce;
                            }
                            break;
                    }

                    // if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, ce.sourceName, ce.targetName))
                    // {
                    //     LogCombatEvent(SwingTypeEnum.NonMelee, logInfo, ce);
                    // }
                    break;
            }
        }
コード例 #7
0
 private void OnLogFileChanged(bool IsImport, string NewLogFileName)
 {
     // TODO: Sure we will need this hook soon enough
     reflectionTracker.Clear();
     damageShielded = null;
 }
コード例 #8
0
 private void OnCombatEnd(bool isImport, CombatToggleEventArgs encounterInfo)
 {
     // TODO: Sure we will need this hook soon enough
     reflectionTracker.Clear();
     damageShielded = null;
 }