Пример #1
0
        public static string GetSource(MasterSwing Data)
        {
            //return Data.Special;
            int posSeparator = Data.Special.IndexOf(':');

            return(Data.Special.Substring(posSeparator + 1, Data.Special.Length - posSeparator - 1));
        }
Пример #2
0
        public static bool ParseDeath(LogLineEventArgs logInfo)
        {
            Match m = RegexCache.Death.Match(logInfo.logLine);

            if (!m.Success)
            {
                m = RegexCache.Death2.Match(logInfo.logLine);
            }
            if (m.Success)
            {
                string actor     = m.Groups["actorname"].Success ? TranslateName(m.Groups["actorname"].Value) : "";
                string target    = m.Groups["targetname"].Success ? m.Groups["targetname"].Value : "";
                string skillname = "Killing";

                MasterSwing ms = new MasterSwing((int)SwingTypeEnum.Melee, false, Dnum.Death, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, skillname, actor, "", target);

                // only log death if currently in combat.
                if (ActGlobals.oFormActMain.InCombat)
                {
                    if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, actor, target))
                    {
                        ActGlobals.oFormActMain.AddCombatAction(ms);
                    }
                }

                return(true);
            }

            return(false);
        }
Пример #3
0
        public static int MasterSwingCompareBaseDamage(MasterSwing Left, MasterSwing Right)
        {
            int    intLeft, intRight;
            String strLeft  = Left.Damage.DamageString2;
            String strRight = Right.Damage.DamageString2;

            if (!Int32.TryParse(strLeft, out intLeft))
            {
                if (strLeft.Equals("Miss"))
                {
                    intLeft = -1;
                }
                else
                {
                    intLeft = -2;
                }
            }
            if (!Int32.TryParse(strRight, out intRight))
            {
                if (strRight.Equals("Miss"))
                {
                    intRight = -1;
                }
                else
                {
                    intRight = -2;
                }
            }
            return(intLeft.CompareTo(intRight));
        }
Пример #4
0
        public static bool ParseDoTTick(LogLineEventArgs logInfo)
        {
            Match m = RegexCache.DamageDoTTick.Match(logInfo.logLine);

            if (!m.Success)
            {
                return(false);
            }

            string actor = m.Groups["actorname"].Success ? TranslateName(m.Groups["actorname"].Value) :
                           m.Groups["actorname2"].Success ? TranslateName(m.Groups["actorname2"].Value) : "";
            string target    = m.Groups["targetname"].Success ? TranslateName(m.Groups["targetname"].Value) : "";
            string amount    = m.Groups["amount"].Success ? m.Groups["amount"].Value : "";
            string skillname = CleanupSkill(m.Groups["type"].Success ? m.Groups["type"].Value :
                                            m.Groups["type2"].Success ? m.Groups["type2"].Value :
                                            m.Groups["type3"].Success ? m.Groups["type3"].Value :
                                            m.Groups["type4"].Success ? m.Groups["type4"].Value : "");

            if (string.IsNullOrWhiteSpace(actor))
            {
                actor = "unknown";
            }

            MasterSwing ms = new MasterSwing((int)SwingTypeEnum.NonMelee, false, int.Parse(amount), logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, skillname, actor, "", target);

            if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, actor, target))
            {
                ActGlobals.oFormActMain.AddCombatAction(ms);
            }

            return(true);
        }
Пример #5
0
        public static string GetType(MasterSwing Data)
        {
            //return Data.Special;
            int posSeparator = Data.AttackType.IndexOf("] ");

            if (posSeparator != -1)
            {
                return(Data.AttackType.Substring(posSeparator + 1));
            }
            else
            {
                return(Data.AttackType);
            }
        }
Пример #6
0
        public static int GetBaseDamage(MasterSwing Data)
        {
            int i;

            if (Int32.TryParse(Data.Damage.DamageString2, out i))
            {
                // return i.ToString(GetIntCommas());
                return(i);
            }
            else
            {
                // return Data.Damage.Number.ToString(GetIntCommas());
                return(Data.Damage.Number);
            }
        }
Пример #7
0
        public static int GetResistance(MasterSwing Data)
        {
            float i;

            if (float.TryParse(Data.Damage.DamageString2, out i))
            {
                if (i == 0)
                {
                    return(0);
                }
                return((int)((1 - (Data.Damage.Number / i)) * 100));
            }
            else
            {
                return(0);
            }
        }
Пример #8
0
        public static bool ParseDamage(LogLineEventArgs logInfo)
        {
            Match m = RegexCache.Damage.Match(logInfo.logLine);

            if (!m.Success)
            {
                m = RegexCache.DamagePassive.Match(logInfo.logLine);
            }
            if (m.Success)
            {
                string actor     = m.Groups["actorname"].Success ? TranslateName(m.Groups["actorname"].Value) : "";
                string target    = m.Groups["targetname"].Success ? TranslateName(m.Groups["targetname"].Value) : "";
                string amount    = m.Groups["amount"].Success ? m.Groups["amount"].Value : "";
                string swingtype = m.Groups["swingtype"].Success ? m.Groups["swingtype"].Value : "";

                string        skill     = "attack";
                SwingTypeEnum swingType = SwingTypeEnum.Melee;
                if (m.Groups["type"].Success)
                {
                    skill = CleanupSkill(m.Groups["type"].Value);
                    if (skill == "non-melee")
                    {
                        if (_LastNonMeleeSkillused.ContainsKey(actor))
                        {
                            skill = _LastNonMeleeSkillused[actor];
                        }

                        swingType = SwingTypeEnum.NonMelee;
                    }
                }


                MasterSwing ms = new MasterSwing((int)swingType, false, int.Parse(amount), logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, skill, actor, "", target);

                if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, actor, target))
                {
                    ActGlobals.oFormActMain.AddCombatAction(ms);
                }

                return(true);
            }

            return(false);
        }
Пример #9
0
        public static int GetDamage(MasterSwing Data)
        {
            //return Data.Special;
            int    i;
            int    posSeparator = Data.Special.IndexOf(':');
            string damage       = (Data.Damage).ToString();

            if (Int32.TryParse(damage, out i))
            {
                //return i.ToString(GetIntCommas());
                return(i);
            }
            else
            if (damage == "No Damage")
            {
                return(0);
            }
            return(Data.Damage);
        }
Пример #10
0
        public static int GetResistance(MasterSwing Left, MasterSwing Right)
        {
            float  intLeft, intRight;
            String strLeft  = Left.Damage.DamageString2;
            String strRight = Right.Damage.DamageString2;

            if (!float.TryParse(strLeft, out intLeft))
            {
                intLeft = Left.Damage.Number;
            }
            if (!float.TryParse(strRight, out intRight))
            {
                intRight = Right.Damage.Number;
            }
            intLeft  = (int)(((1 - (Left.Damage.Number / intLeft)) * 100));
            intRight = (int)(((1 - (Right.Damage.Number / intRight)) * 100));

            return(intLeft.CompareTo(intRight));
        }
Пример #11
0
        public static string GetAttackTypeSwingType(AttackType Data)
        {
            int                swingType   = 100;
            List <int>         swingTypes  = new List <int>();
            List <MasterSwing> cachedItems = new List <MasterSwing>(Data.Items);

            for (int i = 0; i < cachedItems.Count; i++)
            {
                MasterSwing s = cachedItems[i];
                if (swingTypes.Contains(s.SwingType) == false)
                {
                    swingTypes.Add(s.SwingType);
                }
            }
            if (swingTypes.Count == 1)
            {
                swingType = swingTypes[0];
            }

            return(swingType.ToString());
        }
Пример #12
0
        public static bool ParseMiss(LogLineEventArgs logInfo)
        {
            Match m = RegexCache.Miss.Match(logInfo.logLine);

            if (m.Success)
            {
                string actor     = m.Groups["actorname"].Success ? TranslateName(m.Groups["actorname"].Value) : "";
                string target    = m.Groups["targetname"].Success ? TranslateName(m.Groups["targetname"].Value) : "";
                string skillname = "attack";
                string misstype  = m.Groups["dodge"].Success ? "dodge" :
                                   m.Groups["parry"].Success ? "parry" :
                                   m.Groups["riposte"].Success ? "riposte" : "";
                MasterSwing ms = new MasterSwing((int)SwingTypeEnum.Melee, false, misstype, Dnum.Miss, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, skillname, actor, "", target);

                if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, actor, target))
                {
                    ActGlobals.oFormActMain.AddCombatAction(ms);
                }

                return(true);
            }

            return(false);
        }
Пример #13
0
        void oFormActMain_BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            Action aAction = new Action();
            string logLine = logInfo.logLine;
            string[] tmp = logInfo.logLine.Split(',');

            if (tmp[0].Equals("timestamp"))
                return;
            try
            {
                aAction.timestamp = Convert.ToUInt32(tmp[0]);
                aAction.instanceID = Convert.ToUInt16(tmp[1]);
                aAction.sourceID = Convert.ToUInt32(tmp[2]);
                aAction.sourceName = tmp[3];
                aAction.targetID = Convert.ToUInt32(tmp[4]);
                aAction.targetName = tmp[5];
                aAction.attackID = Convert.ToUInt32(tmp[6]);
                aAction.damage = Convert.ToInt32(tmp[7]);
                aAction.isJA = (Convert.ToInt32(tmp[8]) == 1);
                aAction.isCrit = (Convert.ToInt32(tmp[9]) == 1);
                aAction.isMultiHit = (Convert.ToInt32(tmp[10]) == 1);
                aAction.isMisc = (Convert.ToInt32(tmp[11]) == 1);
                aAction.isMisc2 = (Convert.ToInt32(tmp[12]) == 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message + "\n" + logLine);
                return;
            }

            //TODO: deal with when the first thing they do is counter
            if (aAction.targetID == 0 ||
                (aAction.instanceID == 0 && currInstID == 0xFFFF))
                return;

            DateTime time = ActGlobals.oFormActMain.LastKnownTime;
            int gts = ActGlobals.oFormActMain.GlobalTimeSorter;
            if (aAction.instanceID == 0)
                aAction.instanceID = currInstID;
            SwingTypeEnum e;

            string sourceName = aAction.sourceName + "_" + aAction.sourceID.ToString();
            string targetName = aAction.targetName + "_" + aAction.targetID.ToString();

            string actionType = aAction.attackID.ToString();
            string damageType = aAction.attackID.ToString();

            if (aAction.damage < 0 && aAction.isMisc)
                e = SwingTypeEnum.Healing;
            else
                e = SwingTypeEnum.Melee;

            Dnum dmg = new Dnum(aAction.damage) * ((e == SwingTypeEnum.Healing) ? -1 : 1);

            if (skillDict.ContainsKey(aAction.attackID))
            {
                actionType = skillDict[aAction.attackID].Name;
                damageType = skillDict[aAction.attackID].Type;
            }

            MasterSwing ms = new MasterSwing(
                Convert.ToInt32(e),
                aAction.isCrit,
                "",
                dmg,
                time,
                gts,
                actionType,
                sourceName,
                damageType,
                targetName
                );

            if (aAction.instanceID != currInstID)
            {
                currInstID = aAction.instanceID;
                ActGlobals.oFormActMain.ChangeZone(aAction.instanceID.ToString());
            }

            if (ActGlobals.oFormActMain.SetEncounter(time, sourceName, targetName))
                ActGlobals.oFormActMain.AddCombatAction(ms);
        }
        // Wrapper around AddCombatAction to add extra Tags that are used in the NW plugin.
        private void AddCombatActionNW(
            int swingType, bool critical, bool flank, string special, string attacker, string theAttackType, 
            Dnum damage, float realDamage, float baseDamage,
            DateTime time, int timeSorter, string victim, string theDamageType)
        {
            MasterSwing ms = new MasterSwing(swingType, critical, special, damage, time, timeSorter, theAttackType, attacker, theDamageType, victim);

            ms.Tags.Add("DamageF", realDamage);
            ms.Tags.Add("BaseDamage", baseDamage);
            ms.Tags.Add("Flank", flank);

            if (baseDamage > 0)
            {
                float eff = realDamage / baseDamage;
                ms.Tags.Add("Effectiveness", eff);
            }

            ActGlobals.oFormActMain.AddCombatAction(ms);
        }
        private void ProcessActionShields(ParsedLine l)
        {
            int magAdj = (int)Math.Round(l.mag);
            int magBaseAdj = (int)Math.Round(l.magBase);

            // Shielding goes first and acts like a heal to cancel coming damage.  Attacker has his own damage line.  example:

            // 13:07:02:10:48:49.1::Neston,P[200243656@6371989 Neston@adamtech],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Forgemaster's Flame,Pn.Lbf9ic,Shield,,-349.348,-154.608
            // 13:07:02:10:48:49.1::SorXian,P[201063397@7511146 SorXian@sorxian],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Entangling Force,Pn.Oonws91,Shield,,-559.613,-247.663
            // 13:07:02:10:48:49.1::Neston,P[200243656@6371989 Neston@adamtech],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Forgemaster's Flame,Pn.Lbf9ic,Radiant,,154.608,349.348
            // 13:07:02:10:48:49.1::SorXian,P[201063397@7511146 SorXian@sorxian],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Entangling Force,Pn.Oonws91,Arcane,,247.663,559.613

            // NOTE:
            // Notice that the mag and magBase numbers are swap in the shield line verse the damage line.
            // Therefore the amount shield == magBase ???
            // The mag is meaningless ???
            // If mag > magBase on the attack is all damage not shielded ???  (ie high armor pen)

            // NOTE:
            // NW Patch on 7/17/2013 changed shield to report blocked damage in the mag field.
            // 13:07:18:10:25:54.2::Miner,C[1445 Mindflayer_Duergarminerthrall],,*,Largoevo,P[201228983@6531604 Largoevo@largoevo],Melee Attack,Pn.M7kie6,Shield,,-242.837,0
            // Actuall not sure on this....

            //
            // Target prevented damage.
            //

            l.logInfo.detectedType = l.critical ? Color.Green.ToArgb() : Color.DarkGreen.ToArgb();

            ProcessNamesOST(l);

            // Use encounter names attacker and target here.  This allows filtering
            // Hostile action triggered.  Use SetEncounter().
            if (ActGlobals.oFormActMain.SetEncounter(l.logInfo.detectedTime, l.encAttackerName, l.encTargetName))
            {
                // Put the attacker and the attack type in the special field.
                string special = l.unitAttackerName + " : " + l.attackType;

                Dnum shielded = null;
                float mag = 0;
                float magBase = 0;

                // This is just weird...
                if (l.magBase == 0) // Don't use magBaseAdj here.  Rounded to zero is not zero.
                {
                    shielded = new Dnum( -magAdj );
                    mag = -l.mag;
                    magBase = -l.magBase;
                }
                else
                {
                    shielded = new Dnum(-magBaseAdj);
                    mag = -l.magBase;
                    magBase = -l.mag;
                }

                // SwingType = Heal
                // special = attacker
                // attacker & victim = target
                MasterSwing ms = new MasterSwing(
                    (int)SwingTypeEnum.Healing,
                    l.critical, special, shielded, l.logInfo.detectedTime, l.ts, l.type, l.unitTargetName, l.type, l.unitTargetName);

                ms.Tags.Add("DamageF", mag);
                ms.Tags.Add("Flank", l.flank);

                ActGlobals.oFormActMain.AddCombatAction(ms);

                unmatchedShieldLines.AddShield(ms, l);
            }
        }
 private int MasterSwingCompareSpecial(MasterSwing Left, MasterSwing Right)
 {
     return Left.Special.CompareTo(Right.Special);
 }
        private string GetCellDataEffectiveness(MasterSwing Data)
        {
            object effObj;

            if (Data.Tags.TryGetValue("Effectiveness", out effObj))
            {
                float d = (float)effObj;
                return d.ToString("P1");
            }

            return "";
        }
 private string GetSqlDataShieldP(MasterSwing Data)
 {
     return GetShieldPValue(Data).ToString("P1");
 }
        private string GetSqlDataEffectiveness(MasterSwing Data)
        {
            object effObj;

            if (Data.Tags.TryGetValue("Effectiveness", out effObj))
            {
                double d = (float)effObj;
                return d.ToString();
            }

            return "0";
        }
        private string GetSqlDataBaseDamage(MasterSwing Data)
        {
            object damBaseObj;

            if (Data.Tags.TryGetValue("BaseDamage", out damBaseObj))
            {
                float d = (float)damBaseObj;
                return d.ToString();
            }

            return "0";
        }
 protected string GetSqlDataSpecial(MasterSwing Data)
 {
     return Data.Special;
 }
        private string GetCellDataTag(MasterSwing data, string tag)
        {
            object d = null;
            if (data.Tags.TryGetValue(tag, out d))
            {
                return (string)d;
            }

            return "";
        }
        private string GetCellDataBaseDamage(MasterSwing Data)
        {
            object damBaseObj;

            if (Data.Tags.TryGetValue("BaseDamage", out damBaseObj))
            {
                float d = (float)damBaseObj;
                if (d == 0) return "";
                return d.ToString("F1");
            }

            return "";
        }
 private int MasterSwingCompareDmgToShield(MasterSwing Left, MasterSwing Right)
 {
     return GetDmgToShieldValue(Left).CompareTo(GetDmgToShieldValue(Right));
 }
        private string GetCellDataDamage(MasterSwing Data)
        {
            object d;
            if (Data.Tags.TryGetValue("DamageF", out d))
            {
                float df = (float)d;
                if (df > 0.0)
                {
                    return df.ToString("F1");
                }
            }

            return Data.Damage.ToString();
        }
        private int MasterSwingCompareFlank(MasterSwing Left, MasterSwing Right)
        {
            object val;
            bool leftFlank = false;
            bool rightFlank = false;

            if (Left.Tags.TryGetValue("Flank", out val))
            {
                leftFlank = (bool)val;
            }

            if (Right.Tags.TryGetValue("Flank", out val))
            {
                rightFlank = (bool)val;
            }

            return leftFlank.CompareTo(rightFlank);
        }
 private float GetShieldPValue(MasterSwing Data)
 {
     object d;
     if (Data.Tags.TryGetValue("ShieldP", out d))
     {
         float df = (float)d;
         return df;
     }
     else
     {
         return 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);
        }
 private string GetSqlDataDmgToShield(MasterSwing Data)
 {
     return GetDmgToShieldValue(Data).ToString("F1");
 }
Пример #30
0
 public static int GetBaseDamage(MasterSwing Data)
 {
     int i;
     if (Int32.TryParse(Data.Damage.DamageString2, out i))
         // return i.ToString(GetIntCommas());
         return i;
     else
         // return Data.Damage.Number.ToString(GetIntCommas());
         return Data.Damage.Number;
 }
        private string GetSqlDataFlank(MasterSwing Data)
        {
            object val;
            bool flank = false;

            if (Data.Tags.TryGetValue("Flank", out val))
            {
                flank = (bool)val;
            }

            return flank.ToString(usCulture)[0].ToString();
        }
Пример #32
0
 public static int MasterSwingCompareBaseDamage(MasterSwing Left, MasterSwing Right)
 {
     int intLeft, intRight;
     String strLeft = Left.Damage.DamageString2;
     String strRight = Right.Damage.DamageString2;
     if (!Int32.TryParse(strLeft, out intLeft))
         if (strLeft.Equals("Miss"))
             intLeft = -1;
         else
             intLeft = -2;
     if (!Int32.TryParse(strRight, out intRight))
         if (strRight.Equals("Miss"))
             intRight = -1;
         else
             intRight = -2;
     return intLeft.CompareTo(intRight);
 }
 private string GetSqlDataSpecial(MasterSwing Data)
 {
     return Data.Special;
 }
Пример #34
0
 public static int GetResistance(MasterSwing Data)
 {
     float i;
     if (float.TryParse(Data.Damage.DamageString2, out i))
     {
         if (i == 0) return 0;
         return ((int)((1 - (Data.Damage.Number / i)) * 100));
     }
     else
         return 0;
 }
        private int MasterSwingCompareEffectiveness(MasterSwing Left, MasterSwing Right)
        {
            object l;
            object r;

            bool lvalid = Left.Tags.TryGetValue("Effectiveness", out l);
            bool rvalid = Right.Tags.TryGetValue("Effectiveness", out r);

            if (lvalid && rvalid)
            {
                float dl = (float)l;
                float dr = (float)r;

                return dl.CompareTo(dr);
            }
            else
            {
                if (lvalid) { return 1; }
                else if (rvalid) { return -1; }
                else { return 0; }
            }
        }
Пример #36
0
        public static int GetResistance(MasterSwing Left, MasterSwing Right)
        {
            float intLeft, intRight;
            String strLeft = Left.Damage.DamageString2;
            String strRight = Right.Damage.DamageString2;
            if (!float.TryParse(strLeft, out intLeft))
                intLeft = Left.Damage.Number;
            if (!float.TryParse(strRight, out intRight))
                intRight = Right.Damage.Number;
            intLeft = (int)(((1 - (Left.Damage.Number / intLeft)) * 100));
            intRight = (int)(((1 - (Right.Damage.Number / intRight)) * 100));

            return intLeft.CompareTo(intRight);
        }
 private int MasterSwingCompareShieldP(MasterSwing Left, MasterSwing Right)
 {
     return GetShieldPValue(Left).CompareTo(GetShieldPValue(Right));
 }
Пример #38
0
 public static string GetSource(MasterSwing Data)
 {
     //return Data.Special;
     int posSeparator = Data.Special.IndexOf(':');
     return Data.Special.Substring(posSeparator + 1, Data.Special.Length - posSeparator - 1);
 }
        private void ProcessAction(ParsedLine l)
        {
            l.logInfo.detectedType = Color.Gray.ToArgb();

            if (l.type == "HitPoints")
            {
                ProcessActionHeals(l);
            }
            else if (l.type == "Shield")
            {
                ProcessActionShields(l);
            }
            else if (l.type == "AttribModExpire") // Cleanse
            {
                ProcessActionCleanse(l);
            }
            else if (l.type == "Power")
            {
                ProcessActionPower(l);
            }
            else if (l.showPowerDisplayName)
            {
                // Non-damaging effects.
                ProcessActionSPDN(l);
            }
            else
            {
                // What is left should all be damage.
                ProcessActionDamage(l);
            }

            // add action Killing
            if (l.kill)
            {
                l.logInfo.detectedType = Color.Fuchsia.ToArgb();

                // Clean from last MM hit.
                // The Kill can come right before a proc.  Ordering isssue.
                // magicMissileLastHit.Remove(l.tgtInt);

                // TODO: use tgtDsp or unitTargetName?
                ActGlobals.oFormSpellTimers.RemoveTimerMods(l.tgtDsp);
                ActGlobals.oFormSpellTimers.DispellTimerMods(l.tgtDsp);

                // No "Killing : Flank" ever.  Doesn't make sense since there is no damage in the kill tracking.
                // And it messes up the kill counts.
                // AddCombatActionHostile(l, l.swingType, l.critical, l.special, "Killing", Dnum.Death, l.type);

                // Use encounter names attacker and target here.  This allows filtering
                if (ActGlobals.oFormActMain.SetEncounter(l.logInfo.detectedTime, l.encAttackerName, l.encTargetName))
                {
                    MasterSwing ms =
                        new MasterSwing(l.swingType, l.critical, l.special, Dnum.Death, l.logInfo.detectedTime, l.ts,
                            "Killing", l.unitAttackerName, "Death", l.unitTargetName);
                    ms.Tags.Add("Flank", l.flank);
                    ActGlobals.oFormActMain.AddCombatAction(ms);
                }
            }
        }
Пример #40
0
 public static string GetType(MasterSwing Data)
 {
     //return Data.Special;
     int posSeparator = Data.AttackType.IndexOf("] ");
     if (posSeparator != -1)
         return Data.AttackType.Substring(posSeparator + 1);
     else
         return Data.AttackType;
 }
        public void AddShield(MasterSwing ms, ParsedLine line)
        {
            ShieldLine sl = new ShieldLine();
            sl.ms = ms;
            sl.line = line;

            active.AddLast(sl);
        }
Пример #42
0
 public static int GetDamage(MasterSwing Data)
 {
     //return Data.Special;
     int i;
     int posSeparator = Data.Special.IndexOf(':');
     string damage = (Data.Damage).ToString();
     if (Int32.TryParse(damage, out i))
         //return i.ToString(GetIntCommas());
         return i;
     else
         if (damage == "No Damage")
             return 0;
     return Data.Damage;
 }
Пример #43
0
        public static void BeforeLogLineRead(bool isImport, Advanced_Combat_Tracker.LogLineEventArgs logInfo)
        {
            string l = logInfo.logLine;

            try
            {
                DateTime timestamp = ParseLogDateTime(l);

                char[]   dt       = { '\t' };
                string[] logParts = l.Split(dt);
                int      flag     = Convert.ToInt32(logParts[2], 16);
                if (flag > 7)
                {
                    return;
                }

                l = logParts[7];

                Match m;

                // open
                m = regex_open.Match(l);
                if (m.Success)
                {
                    string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";
                    encounter = target;
                    Advanced_Combat_Tracker.ActGlobals.oFormActMain.SetEncounter(timestamp, encounter, encounter);
                    // DQX_ACT_Plugin.LogParserMessage("Open: "+target);
                    NameClass.Clear();
                    return;
                }

                // close
                m = regex_close.Match(l);
                if (m.Success)
                {
                    // Advanced_Combat_Tracker.ActGlobals.oFormActMain.ChangeZone("test");
                    Advanced_Combat_Tracker.ActGlobals.oFormActMain.EndCombat(true);
                    // DQX_ACT_Plugin.LogParserMessage("Close: ");
                    return;
                }

                // action
                if (!l.StartsWith(" →"))
                {
                    m = regex_action.Match(l);
                    if (m.Success)
                    {
                        actor  = m.Groups["actor"].Success ? DecodeString(m.Groups["actor"].Value) : "";
                        action = m.Groups["action"].Success ? DecodeString(m.Groups["action"].Value) : "";
                        if (!NameClass.ContainsKey(actor))
                        {
                            if (SkillClass.ContainsKey(action))
                            {
                                NameClass.Add(actor, SkillClass[action]);
                            }
                        }
                        return;
                    }
                    m = regex_action2.Match(l);
                    if (m.Success)
                    {
                        actor  = "不明";
                        action = m.Groups["action"].Success ? DecodeString(m.Groups["action"].Value) : "";
                        return;
                    }

                    // death
                    m = regex_dead2.Match(l);
                    if (m.Success)
                    {
                        string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";
                        Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(
                            (int)Advanced_Combat_Tracker.SwingTypeEnum.Healing,
                            false,
                            "",
                            "不明",
                            "Death",
                            Advanced_Combat_Tracker.Dnum.Death,
                            timestamp,
                            Advanced_Combat_Tracker.ActGlobals.oFormActMain.GlobalTimeSorter,
                            target,
                            "");
                        return;
                    }
                    return;
                }

                if (!Advanced_Combat_Tracker.ActGlobals.oFormActMain.InCombat)
                {
                    return;
                }

                // crit
                m = regex_crit.Match(l);
                if (m.Success)
                {
                    isCritical = true;
                    return;
                }

                // damage
                m = regex_hit.Match(l);
                if (m.Success)
                {
                    string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";

                    // if (Advanced_Combat_Tracker.ActGlobals.oFormActMain.SetEncounter(timestamp, actor, encounter))
                    {
                        MasterSwing ms = new MasterSwing(
                            (int)Advanced_Combat_Tracker.SwingTypeEnum.NonMelee,
                            isCritical,
                            "",
                            new Advanced_Combat_Tracker.Dnum(int.Parse(m.Groups["damage"].Value, System.Globalization.NumberStyles.AllowThousands)),
                            timestamp,
                            Advanced_Combat_Tracker.ActGlobals.oFormActMain.GlobalTimeSorter,
                            action,
                            actor,
                            "",
                            target);

                        Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(ms);

                        var e = false;
                        foreach (var a in Allies)
                        {
                            if (a.Name == ms.Attacker)
                            {
                                e = true;
                                break;
                            }
                        }
                        if (ms.Attacker == encounter)
                        {
                            e = true;
                        }
                        if (!e)
                        {
                            CombatantData cd = ms.ParentEncounter.GetCombatant(ms.Attacker);
                            Allies.Add(cd);
                        }
                        ms.ParentEncounter.SetAllies(Allies);
                    }

                    isCritical = false;
                    return;
                }

                // miss
                m = regex_miss.Match(l);
                if (m.Success)
                {
                    string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";

                    //          if (Advanced_Combat_Tracker.ActGlobals.oFormActMain.SetEncounter(timestamp, actor, encounter))
                    {
                        Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(
                            (int)Advanced_Combat_Tracker.SwingTypeEnum.NonMelee,
                            isCritical,
                            "",
                            actor,
                            action,
                            Advanced_Combat_Tracker.Dnum.Miss,
                            timestamp,
                            Advanced_Combat_Tracker.ActGlobals.oFormActMain.GlobalTimeSorter,
                            target,
                            "");
                    }
                    isCritical = false;
                    return;
                }

                // heal
                m = regex_heal.Match(l);
                if (m.Success)
                {
                    string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";

                    //          if (Advanced_Combat_Tracker.ActGlobals.oFormActMain.SetEncounter(timestamp, actor, encounter))
                    {
                        MasterSwing ms = new MasterSwing(
                            (int)Advanced_Combat_Tracker.SwingTypeEnum.Healing,
                            isCritical,
                            "",
                            new Advanced_Combat_Tracker.Dnum(int.Parse(m.Groups["damage"].Value, System.Globalization.NumberStyles.AllowThousands)),
                            timestamp,
                            Advanced_Combat_Tracker.ActGlobals.oFormActMain.GlobalTimeSorter,
                            action,
                            actor,
                            "",
                            target);

                        Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(ms);

                        var e = false;
                        foreach (var a in Allies)
                        {
                            if (a.Name == ms.Attacker)
                            {
                                e = true;
                                break;
                            }
                        }
                        if (ms.Attacker == encounter)
                        {
                            e = true;
                        }
                        if (!e)
                        {
                            CombatantData cd = ms.ParentEncounter.GetCombatant(ms.Attacker);
                            Allies.Add(cd);
                        }
                        ms.ParentEncounter.SetAllies(Allies);
                    }

                    isCritical = false;
                    return;
                }

                // death
                m = regex_dead.Match(l);
                if (m.Success)
                {
                    string target = m.Groups["target"].Success ? DecodeString(m.Groups["target"].Value) : "";
                    //          if (Advanced_Combat_Tracker.ActGlobals.oFormActMain.SetEncounter(timestamp, actor, encounter))
                    {
                        Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(
                            (int)Advanced_Combat_Tracker.SwingTypeEnum.Healing,
                            isCritical,
                            "",
                            actor,
                            "Death",
                            Advanced_Combat_Tracker.Dnum.Death,
                            timestamp,
                            Advanced_Combat_Tracker.ActGlobals.oFormActMain.GlobalTimeSorter,
                            target,
                            "");
                    }
                    isCritical = false;
                    return;
                }
            }
            catch (Exception ex)
            {
                string exception = ex.ToString().Replace(Environment.NewLine, " ");
                if (ex.InnerException != null)
                {
                    exception += " " + ex.InnerException.ToString().Replace(Environment.NewLine, " ");
                }

                DQX_ACT_Plugin.LogParserMessage("Error [LogParse.BeforeLogLineRead] " + exception + " " + logInfo.logLine);
            }

            // For debugging
            // if (!string.IsNullOrWhiteSpace(l))
            //   DQX_ACT_Plugin.LogParserMessage("Unhandled Line: " + logInfo.logLine);
        }
        void BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            //Debug.WriteLine(logInfo.originalLogLine);
            //Debug.WriteLine(logInfo.logLine);

            try
            {
                string[] logComponents = logInfo.originalLogLine.Split('|');

                if (logComponents[0] == "00")
                {
                }
                // e.g. 02|2021-01-26T17:12:16.7800000+09:00|102ddfef|Hoge Fuga|a13ccee9756841e80f90f3a2498e4fd1
                else if (logComponents[0] == "02")
                {
                    // Get character name
                    ActGlobalsExtension.MyName = logComponents[3];
                }
                // e.g. 21|2021-04-24T21:09:58.0530000+09:00|1029D1FC|Hoge Fuga|8CF|Aeolian Edge|400038E8|Eden's Promise|4F710203|74390000|53D|9F8000|53D|9F8000|11B|8CF8000|0|0|0|0|0|0|0|0|26289953|63981880|0|10000|0|1000|-0.01531982|-75.02869|75|3.13421|90796|148446|10000|10000|0|1000|3.017035|-71.21938|74.99991|0.4098789|0000105C|0|e1d390585909d0237d8553a257999349
                else if (logComponents[0] == "21")
                {
                    //// Upate actors
                    //var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    //actor.Id = logComponents[2];
                    //actor.Name = logComponents[3];
                    //if (long.TryParse(logComponents[34], out long actorHp)) actor.Hp = actorHp;
                    //if (long.TryParse(logComponents[35], out long actorMaxHp)) actor.MaxHp = actorMaxHp;
                    //if (long.TryParse(logComponents[36], out long actorMp)) actor.Mp = actorMp;
                    //if (long.TryParse(logComponents[37], out long actorMaxMp)) actor.MaxMp = actorMaxMp;
                    //ActGlobalsExtension.CurrentActors[actor.Id] = actor;

                    //var target = ActGlobalsExtension.CurrentActors.GetValue(logComponents[6], new Actor());
                    //target.Id = logComponents[6];
                    //target.Name = logComponents[7];
                    //if (long.TryParse(logComponents[24], out long targetHp)) target.Hp = targetHp;
                    //if (long.TryParse(logComponents[25], out long targetMaxHp)) target.MaxHp = targetMaxHp;
                    //if (long.TryParse(logComponents[26], out long targetMp)) target.Mp = targetMp;
                    //if (long.TryParse(logComponents[27], out long targetMaxMp)) target.MaxMp = targetMaxMp;
                    //ActGlobalsExtension.CurrentActors[target.Id] = target;
                }
                // e.g. 22|2021-04-24T21:33:58.2180000+09:00|1027A809|Hoge Fuga|83|Cure III|10329758|Hoge Fuga|10004|FD800000|1B|838000|0|0|0|0|0|0|0|0|0|0|0|0|8854|148314|10000|10000|0|1000|0.1677856|-69.71857|75|-0.05412173|7269|134545|9925|10000|0|1000|-0.3510132|-69.0166|75|0.1415596|00002F96|1|eeabc872634d29aea376df30c9faf4d4
                else if (logComponents[0] == "22")
                {
                    //// Upate actors
                    //var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    //actor.Id = logComponents[2];
                    //actor.Name = logComponents[3];
                    //if (long.TryParse(logComponents[34], out long actorHp)) actor.Hp = actorHp;
                    //if (long.TryParse(logComponents[35], out long actorMaxHp)) actor.MaxHp = actorMaxHp;
                    //if (long.TryParse(logComponents[36], out long actorMp)) actor.Mp = actorMp;
                    //if (long.TryParse(logComponents[37], out long actorMaxMp)) actor.MaxMp = actorMaxMp;
                    //ActGlobalsExtension.CurrentActors[actor.Id] = actor;

                    //var target = ActGlobalsExtension.CurrentActors.GetValue(logComponents[6], new Actor());
                    //target.Id = logComponents[6];
                    //target.Name = logComponents[7];
                    //if (long.TryParse(logComponents[24], out long targetHp)) target.Hp = targetHp;
                    //if (long.TryParse(logComponents[25], out long targetMaxHp)) target.MaxHp = targetMaxHp;
                    //if (long.TryParse(logComponents[26], out long targetMp)) target.Mp = targetMp;
                    //if (long.TryParse(logComponents[27], out long targetMaxMp)) target.MaxMp = targetMaxMp;
                    //ActGlobalsExtension.CurrentActors[target.Id] = target;
                }
                // e.g. 24|2021-04-24T21:09:58.0530000+09:00|102CEDF1|Hoge Fuga|HoT|0|1335|71559|134501|8000|10000|0|1000|10.58232|-85.01506|74.99805|-2.90611||0866bc95d8ca26aefe03700f6d4d428e
                else if (logComponents[0] == "24")
                {
                    //// Upate actors
                    //var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    //actor.Id = logComponents[2];
                    //actor.Name = logComponents[3];
                    //if (long.TryParse(logComponents[7], out long actorHp)) actor.Hp = actorHp;
                    //if (long.TryParse(logComponents[8], out long actorMaxHp)) actor.MaxHp = actorMaxHp;
                    //if (long.TryParse(logComponents[9], out long actorMp)) actor.Mp = actorMp;
                    //if (long.TryParse(logComponents[10], out long actorMaxMp)) actor.MaxMp = actorMaxMp;
                    //ActGlobalsExtension.CurrentActors[actor.Id] = actor;
                }
                // e.g. 26|2021-01-14T03:41:25.5060000+09:00|31|Medicated|30.00|102D7D99|Hoge Fuga|102D7D99|Hoge Fuga|2897|116600|116600||2cd0b18ecd384c46125530c91782c4be
                else if (logComponents[0] == "26")
                {
                    if (PluginMain.Shared.EnabledDetectBuffsDuringNonCombat)
                    {
                        // Add swings to history
                        if (logComponents[2] == "31" && logComponents[6] == logComponents[8])
                        {
                            var item = ActGlobalsExtension.MedicatedItems.Where(x => x.Id == logComponents[9]).FirstOrDefault();
                            var name = ActGlobalsExtension.ConvertClientNameToActName(logComponents[6]);

                            if (item != null &&
                                (!ActGlobals.oFormActMain.InCombat ||
                                 ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetCombatant(name) == null))       // If target character is NOT present in active encounter
                            {
                                var medicatedBuffId = ActGlobalsExtension.Buffs
                                                      .Where(x => x.Group == BuffGroup.Medicated).Select(x => x.Id).FirstOrDefault() ?? "";

                                MasterSwing swing = new MasterSwing(SwingType.Buff, false, Dnum.Unknown, DateTime.Parse(logComponents[1]), 0, logComponents[3], name, "", name);
                                swing.Tags.Add(SwingTag.Potency, 0);
                                //swing.Tags.Add("Job", "");
                                swing.Tags.Add(SwingTag.ActorID, logComponents[5]);
                                swing.Tags.Add(SwingTag.TargetID, logComponents[7]);
                                swing.Tags.Add(SwingTag.SkillID, item.SkillId);
                                swing.Tags.Add(SwingTag.BuffID, medicatedBuffId);
                                swing.Tags.Add(SwingTag.BuffDuration, double.Parse(logComponents[4]));
                                swing.Tags.Add(SwingTag.BuffByte1, item.BuffByte);
                                swing.Tags.Add(SwingTag.BuffByte2, "00");
                                swing.Tags.Add(SwingTag.BuffByte3, "00");

                                buffSwingHistory.Add(swing);
                            }
                        }
                    }
                }
                // e.g. 33|2021-01-23T16:34:42.9370000+09:00|8003757B|40000006|14E3|14|00|00|4f1194ca3def5c41059c5e69ffc7689a
                else if (logComponents[0] == "33")
                {
                    if (PluginMain.Shared.EnabledEndCombatWhenRestartContent)
                    {
                        if (ActGlobals.oFormActMain.InCombat && logComponents[3] == "40000006")
                        {
                            ActGlobals.oFormActMain.EndCombat(true);
                        }
                    }
                }
                // e.g. 36|2021-04-03T00:56:34.5320000+09:00|0000|2|6b09eaac147276ef6797f3ebe8b87cec
                else if (logComponents[0] == "36")
                {
                    if (PluginMain.Shared.EnabledEndCombatWhenRestartContent)
                    {
                        // Support for E12S
                        if (ActGlobals.oFormActMain.InCombat && logComponents[2] == "0000" && logComponents[3] == "2")
                        {
                            if (ActGlobalsExtension.CurrentActors.Values.Where(x => e12sBossNames.Contains(x.Name) && x.Hp <= 1).Any())
                            {
                                ActGlobals.oFormActMain.EndCombat(true);
                            }
                        }
                    }
                }
                // e.g. 37|2021-04-24T21:06:22.5290000+09:00|400038E8|Hoge Fuga|000009CA|50301450|63981880|0|10000|0||-0.01531982|-75.02869|75|-3.127499||913874a8e32f15768231b642f7ce089f
                else if (logComponents[0] == "37")
                {
                    // Upate actors
                    var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    actor.Id   = logComponents[2];
                    actor.Name = logComponents[3];
                    if (long.TryParse(logComponents[5], out long actorHp))
                    {
                        actor.Hp = actorHp;
                    }
                    if (long.TryParse(logComponents[6], out long actorMaxHp))
                    {
                        actor.MaxHp = actorMaxHp;
                    }
                    if (long.TryParse(logComponents[7], out long actorMp))
                    {
                        actor.Mp = actorMp;
                    }
                    if (long.TryParse(logComponents[8], out long actorMaxMp))
                    {
                        actor.MaxMp = actorMaxMp;
                    }
                    ActGlobalsExtension.CurrentActors[actor.Id] = actor;

                    // Support for E12S
                    if (e12sBossNames.Contains(actor.Name) && actor.Hp <= 1)
                    {
                        if (!ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Tags.ContainsKey(EncounterTag.EndTime))
                        {
                            ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Tags[EncounterTag.EndTime] = logInfo.detectedTime;
                        }
                    }
                }
                // e.g. 38|2021-04-24T23:20:37.4140000+09:00|1024B79F|Hoge Fuga|004A4A25|88344|88344|10000|10000|197|0|539.3408|322.6061|-19.50564|-2.613231|0600|70|0||da6f6b8f2442147780d67917209e55ef
                else if (logComponents[0] == "38")
                {
                    // Upate actors
                    var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    actor.Id   = logComponents[2];
                    actor.Name = logComponents[3];
                    if (long.TryParse(logComponents[5], out long actorHp))
                    {
                        actor.Hp = actorHp;
                    }
                    if (long.TryParse(logComponents[6], out long actorMaxHp))
                    {
                        actor.MaxHp = actorMaxHp;
                    }
                    if (long.TryParse(logComponents[7], out long actorMp))
                    {
                        actor.Mp = actorMp;
                    }
                    if (long.TryParse(logComponents[8], out long actorMaxMp))
                    {
                        actor.MaxMp = actorMaxMp;
                    }
                    ActGlobalsExtension.CurrentActors[actor.Id] = actor;
                }
                // e.g. 39|2021-04-24T21:06:22.4850000+09:00|400038ED|Hoge Fuga|127121|127121|10000|10000|0|0|-0.04577637|-75.08972|75|0.2127874||0999f8bf116f6727c045b0d6c88dc848
                else if (logComponents[0] == "39")
                {
                    // Upate actors
                    var actor = ActGlobalsExtension.CurrentActors.GetValue(logComponents[2], new Actor());
                    actor.Id   = logComponents[2];
                    actor.Name = logComponents[3];
                    if (long.TryParse(logComponents[4], out long actorHp))
                    {
                        actor.Hp = actorHp;
                    }
                    if (long.TryParse(logComponents[5], out long actorMaxHp))
                    {
                        actor.MaxHp = actorMaxHp;
                    }
                    if (long.TryParse(logComponents[6], out long actorMp))
                    {
                        actor.Mp = actorMp;
                    }
                    if (long.TryParse(logComponents[7], out long actorMaxMp))
                    {
                        actor.MaxMp = actorMaxMp;
                    }
                    ActGlobalsExtension.CurrentActors[actor.Id] = actor;
                }

                // Detect medicated buff during non-combat
                // TODO: Apply all buffs
                if (PluginMain.Shared.EnabledDetectBuffsDuringNonCombat)
                {
                    if (ActGlobals.oFormActMain.InCombat)
                    {
                        // Insert swings to ACT
                        foreach (var swing in Enumerable.Reverse(buffSwingHistory))
                        {
                            swing.Tags[SwingTag.BuffDuration] = (double)swing.Tags[SwingTag.BuffDuration] - (DateTime.Now - swing.Time).Ticks / TimeSpan.TicksPerSecond;
                            ActGlobals.oFormActMain.AddCombatAction(swing);

                            buffSwingHistory.Remove(swing);
                        }
                    }

                    // Remove expired swings
                    foreach (var swing in Enumerable.Reverse(buffSwingHistory))
                    {
                        if ((DateTime.Now - swing.Time).Ticks / TimeSpan.TicksPerSecond > (double)swing.Tags[SwingTag.BuffDuration])
                        {
                            buffSwingHistory.Remove(swing);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
Пример #45
0
        void oFormActMain_BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            Action aAction = new Action();
            string logLine = logInfo.logLine;

            string[] tmp = logInfo.logLine.Split(',');

            if (tmp[0].Equals("timestamp"))
            {
                return;
            }
            try
            {
                aAction.timestamp  = Convert.ToUInt32(tmp[0]);
                aAction.instanceID = Convert.ToUInt16(tmp[1]);
                aAction.sourceID   = Convert.ToUInt32(tmp[2]);
                aAction.sourceName = tmp[3];
                aAction.targetID   = Convert.ToUInt32(tmp[4]);
                aAction.targetName = tmp[5];
                aAction.attackID   = Convert.ToUInt32(tmp[6]);
                aAction.damage     = Convert.ToInt32(tmp[7]);
                aAction.isJA       = (Convert.ToInt32(tmp[8]) == 1);
                aAction.isCrit     = (Convert.ToInt32(tmp[9]) == 1);
                aAction.isMultiHit = (Convert.ToInt32(tmp[10]) == 1);
                aAction.isMisc     = (Convert.ToInt32(tmp[11]) == 1);
                aAction.isMisc2    = (Convert.ToInt32(tmp[12]) == 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message + "\n" + logLine);
                return;
            }

            //TODO: deal with when the first thing they do is counter
            if (aAction.targetID == 0 ||
                (aAction.instanceID == 0 && currInstID == 0xFFFF))
            {
                return;
            }

            DateTime time = ActGlobals.oFormActMain.LastKnownTime;
            int      gts  = ActGlobals.oFormActMain.GlobalTimeSorter;

            if (aAction.instanceID == 0)
            {
                aAction.instanceID = currInstID;
            }
            SwingTypeEnum e;

            string sourceName = aAction.sourceName == "YOU" ? "YOU" : aAction.sourceName + "_" + aAction.sourceID.ToString();
            string targetName = aAction.targetName == "YOU" ? "YOU" : aAction.targetName + "_" + aAction.targetID.ToString();

            string actionType = aAction.attackID.ToString();
            string damageType = aAction.attackID.ToString();

            if (aAction.damage < 0 && aAction.isMisc)
            {
                e = SwingTypeEnum.Healing;
            }
            else
            {
                e = SwingTypeEnum.Melee;
            }

            Dnum dmg = new Dnum(aAction.damage) * ((e == SwingTypeEnum.Healing) ? -1 : 1);

            if (skillDict.ContainsKey(aAction.attackID))
            {
                actionType = skillDict[aAction.attackID].Name;
                damageType = skillDict[aAction.attackID].Type;
            }

            MasterSwing ms = new MasterSwing(
                Convert.ToInt32(e),
                aAction.isCrit,
                "",
                dmg,
                time,
                gts,
                actionType,
                sourceName,
                damageType,
                targetName
                );

            if (aAction.instanceID != currInstID)
            {
                currInstID = aAction.instanceID;
                ActGlobals.oFormActMain.ChangeZone(aAction.instanceID.ToString());
            }

            if (ActGlobals.oFormActMain.SetEncounter(time, sourceName, targetName))
            {
                ActGlobals.oFormActMain.AddCombatAction(ms);
            }
        }
        void AfterCombatAction(bool isImport, CombatActionEventArgs actionInfo)
        {
            if (PluginMain.Shared.EnabledSimulateFFLogsParses)
            {
                var targetId = (string)actionInfo.tags.GetValue(SwingTag.TargetID);
                var target   = ActGlobalsExtension.CurrentActors.GetValue(targetId);
                if (target != null && !actionInfo.cancelAction)
                {
                    // Damage Action
                    if (actionInfo.swingType == SwingType.Attack || actionInfo.swingType == SwingType.DamageSkill || actionInfo.swingType == SwingType.Dot)
                    {
                        var damage   = actionInfo.damage.Number;
                        var overkill = Math.Min(damage, Math.Max(damage - target.Hp, 0));
                        if (overkill > 0)
                        {
                            actionInfo.combatAction.Tags[SwingTag.Overkill] = overkill.ToString();
                        }
                        else
                        {
                            actionInfo.combatAction.Tags.Remove(SwingTag.Overkill);
                        }
                        target.Hp -= (damage - overkill);
                        ActGlobalsExtension.CurrentActors[targetId] = target;
                    }
                    // Healing Action
                    if (actionInfo.swingType == SwingType.HealSkill || actionInfo.swingType == SwingType.Hot)
                    {
                        var healing  = actionInfo.damage.Number;
                        var overheal = 0L;
                        if (actionInfo.theDamageType != DamageType.DamageShield && actionInfo.theDamageType != DamageType.Absorb)
                        {
                            overheal = Math.Min(healing, Math.Max((target.Hp + healing) - target.MaxHp, 0));
                        }
                        if (overheal > 0)
                        {
                            actionInfo.combatAction.Tags[SwingTag.Overheal] = overheal.ToString();
                        }
                        else
                        {
                            actionInfo.combatAction.Tags.Remove(SwingTag.Overheal);
                        }
                        if (actionInfo.theDamageType != DamageType.DamageShield)
                        {
                            target.Hp += (healing - overheal);
                            ActGlobalsExtension.CurrentActors[targetId] = target;
                        }

                        // support for Emergency Tactics
                        if (emergencyTacticsNames.Contains(actionInfo.theAttackType))
                        {
                            var emergencyTacticsBuff = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetAllies()
                                                       .SelectMany(x => x.Items[DamageTypeData.OutgoingBuffDebuff].Items)
                                                       .Where(x => emergencyTacticsNames.Contains(x.Key))
                                                       .SelectMany(x => x.Value.Items)
                                                       .OrderByDescending(x => x.Time).FirstOrDefault();
                            if (emergencyTacticsBuff != null && actionInfo.theDamageType == DamageType.Absorb)
                            {
                                var origin = actionInfo.combatAction;

                                // Add new swing
                                var swing = new MasterSwing(
                                    origin.SwingType,
                                    origin.Critical,
                                    origin.Damage.Number,
                                    origin.Time,
                                    origin.TimeSorter,
                                    origin.AttackType,
                                    emergencyTacticsBuff.Attacker,
                                    "",
                                    origin.Victim);
                                swing.Tags.Add(SwingTag.Job, emergencyTacticsBuff.Tags.GetValue(SwingTag.Job));
                                swing.Tags.Add(SwingTag.ActorID, emergencyTacticsBuff.Tags.GetValue(SwingTag.ActorID));
                                swing.Tags.Add(SwingTag.TargetID, origin.Tags.GetValue(SwingTag.TargetID));
                                swing.Tags.Add(SwingTag.Overheal, origin.Tags.GetValue(SwingTag.Overheal));
                                ActGlobals.oFormActMain.AddCombatAction(swing);

                                origin.Damage.SetNum(0);
                                origin.Tags[SwingTag.Overheal] = 0;
                            }
                        }
                    }
                }
            }
        }