private static void HandleCombatLogPvP(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            switch (e.Event)
            {
                case "SPELL_CAST_SUCCESS":

                    //Logging.Write(LogLevel.Diagnostic, "Debug: {0} SPELL_CAST_SUCCESS {1} - {2} - {3} - {4} - {5}",
                    //              e.SourceName, e.SpellName,
                    //              e.SpellId, e.Timestamp, e.FireTimeStamp, e.DestName);

                    if (!IsEnemy(e.SourceUnit))
                    {
                        return;
                    }

                    if ((e.SpellId == 60192 || e.SpellId == 1499))
                    {
                        Logging.Write(LogLevel.Diagnostic, "Found Hunter Drop {0} - {1}", e.SpellName,
                                      e.SpellId);
                        LastTrapEvent = DateTime.Now;
                    }

                    if (InterruptSpellHS.Contains(e.SpellId))
                    {
                        Logging.Write(LogLevel.Diagnostic, "InterruptonCooldownUnit Add {0} - {1} - {2} - {3} ",
                                      e.SourceUnit.SafeName,
                                      e.SpellName,
                                      e.SpellId,
                                      InterruptSpellCooldown(e.SpellId) - 1000);

                        if (e.DestGuid == MeGuid)
                        {
                            Logging.Write(LogLevel.Diagnostic, "Incoming SPELL_CAST_SUCCESS {0} - {1} Stop Casting",
                                          e.SpellName,
                                          e.SpellId);
                            if (!MeHasAura(131558))
                            {
                                SpellManager.StopCasting();
                            }
                        }

                        InterruptonCooldownUnitAdd(e.SourceUnit, InterruptSpellCooldown(e.SpellId) - 1000);
                    }
                    break;

                    //case "SPELL_CAST_START":

                    //    Logging.Write(LogLevel.Diagnostic, "Debug: {0} SPELL_CAST_START {1} - {2} - {3} - {4} - {5}",
                    //                  e.SourceName,
                    //                  e.SpellName,
                    //                  e.SpellId,
                    //                  e.DestName,
                    //                  e.DestGuid,
                    //                  e.DestGuidStr);

                    //    //if (InterruptSpellHS.Contains(e.SpellId) &&
                    //    //    IsEnemy(e.SourceUnit))
                    //    //{
                    //    //    InterruptonCooldownUnitAdd(e.SourceUnit, InterruptSpellCooldown(e.SpellId - 1000));

                    //    //    if (e.SourceUnit.CurrentTarget != null &&
                    //    //        e.SourceUnit.CurrentTarget == Me &&
                    //    //        !MeHasAura(131558))
                    //    //    {
                    //    //        Logging.Write(LogLevel.Diagnostic, "Incoming SPELL_CAST_START {0} - {1} Stop Casting",
                    //    //                      e.SpellName, e.SpellId);

                    //    //        SpellManager.StopCasting();
                    //    //    }
                    //    //}
                    //    break;
            }
        }
Esempio n. 2
0
        private static void HandleEvadeBuggedMob(LuaEventArgs args, CombatLogEventArgs e)
        {
            WoWUnit unit = e.DestUnit;
            ulong   guid = e.DestGuid;

            if (unit == null && StyxWoW.Me.CurrentTarget != null)
            {
                unit = StyxWoW.Me.CurrentTarget;
                guid = StyxWoW.Me.CurrentTargetGuid;
                Logging.Write("Evade: bugged mob guid:{0}, so assuming current target instead", args.Args[7]);
            }

            if (unit != null)
            {
                if (!MobsThatEvaded.ContainsKey(unit.Guid))
                {
                    MobsThatEvaded.Add(unit.Guid, 0);
                }

                MobsThatEvaded[unit.Guid]++;
                if (MobsThatEvaded[unit.Guid] <= 5)
                {
                    Logging.Write("Mob {0} has evaded {1} times.  Keeping an eye on {2:X0} for now!", unit.Name,
                                  MobsThatEvaded[unit.Guid], unit.Guid);
                }
                else
                {
                    const int secondsToBlacklist = 60;

                    if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                    {
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Previously blacklisted {2:X0} for {3} seconds!",
                                      unit.Name, MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                    }
                    else
                    {
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Blacklisting {2:X0} for {3} seconds!", unit.Name,
                                      MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                        Blacklist.Add(unit.Guid, BlacklistFlags.Combat, TimeSpan.FromSeconds(secondsToBlacklist));
                        if (!Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                        {
                            Logging.Write(Colors.Pink, "error: blacklist does not contain entry for {0} so adding {1}",
                                          unit.Name, unit.Guid);
                        }
                    }

                    if (BotPoi.Current.Guid == unit.Guid)
                    {
                        Logging.Write("EvadeHandling: Current BotPOI type={0} is Evading, clearing now...",
                                      BotPoi.Current.Type);
                        BotPoi.Clear("Singular recognized Evade bugged mob");
                    }

                    if (StyxWoW.Me.CurrentTargetGuid == guid)
                    {
                        foreach (var target in Targeting.Instance.TargetList)
                        {
                            if (target != null &&
                                target.IsValid &&
                                target.IsAlive &&
                                !Blacklist.Contains(target, BlacklistFlags.Combat))
                            {
                                Logging.Write(Colors.Pink, "Setting target to {0} to get off evade bugged mob!",
                                              target.Name);
                                target.Target();
                                return;
                            }
                        }

                        Logging.Write(Colors.Pink,
                                      "BotBase has 0 entries in Target list not blacklisted -- nothing else we can do at this point!");
                        // StyxWoW.Me.ClearTarget();
                    }
                }
            }

            /// line below was originally in Evade logic, but commenting to avoid Sleeps
            // StyxWoW.SleepForLagDuration();
        }
Esempio n. 3
0
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            if (e.SourceGuid != StyxWoW.Me.Guid)
            {
                return;
            }

            //Logging.Write("[CombatLog] " + e.Event + " - " + e.SourceName + " - " + e.Spell.Name);

            switch (e.Event)
            {
            default:
                Logging.Write("[CombatLog] filter out this event -- " + e.Event + " - " + e.SourceName + " - " +
                              e.Spell.Name);
                break;

            // spell_cast_failed only passes filter in Singular debug mode
            case "SPELL_CAST_FAILED":
                CastFailReason = e.Args[14].ToString();

                if (CastFailReason != "Your target is dead" &&
                    CastFailReason != "No target" &&
                    CastFailReason != "Not yet recovered")
                {
                    Logging.Write(LogLevel.Diagnostic,
                                  "[CombatLog] {0} {1}#{2} failure: '{3}'",
                                  e.Event,
                                  e.Spell.Name,
                                  e.SpellId,
                                  CastFailReason);
                }

                //if (CastFailReason != LocalizedAnotheractionisinprogress)
                //{
                //    Classname.CastFailed = true;
                //}

                //if (e.Args[14].ToString() == LocalizedLineOfSightError)
                //{
                //    LastLineOfSightError = DateTime.Now;
                //    Logging.Write("[CombatLog] cast fail due to los reported at {0}",
                //                  LastLineOfSightError.ToString("HH:mm:ss.fff"));
                //}
                //else if (StyxWoW.Me.Class == WoWClass.Druid && SingularRoutine.IsQuestBotActive)
                //{
                //    if (LocalizedShapeshiftErrors.Contains(e.Args[14].ToString()))
                //    {
                //        LastShapeshiftError = DateTime.Now;
                //        Logging.Write(
                //            "[CombatLog] cast fail due to shapeshift error while questing reported at {0}",
                //            LastShapeshiftError.ToString("HH:mm:ss.fff"));
                //    }
                //}
                break;

            //case "SPELL_AURA_APPLIED":
            //    Classname.LastCastSpell = e.SpellName;
            //    Classname.LastCastTime = DateTime.Now;
            //    //    break;
            //case "SPELL_CAST_START":
            //    Classname.LastCastSpell = e.SpellName;
            //    Classname.LastCastTime = DateTime.Now;
            //    break;
            //case "SPELL_CAST_SUCCESS":
            //    Classname.LastCastSpell = e.SpellName;
            //    Classname.LastCastTime = DateTime.Now;

            // Update the last spell we cast. So certain classes can 'switch' their logic around.
            //Spell.LastSpellCast = e.SpellName;
            //Logging.Write("Successfully cast " + Spell.LastSpellCast);

            // following commented block should not be needed since rewrite of Pet summon
            //
            // Force a wait for all summoned minions. This prevents double-casting it.
            //if (StyxWoW.Me.Class == WoWClass.Warlock && e.SpellName.StartsWith("Summon "))
            //{
            //    StyxWoW.SleepForLagDuration();
            //}
            //break;

            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    HandleEvadeBuggedMob(args, e);
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logging.Write("{0} is immune to Physical spell school", unit.Name);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                // Why log misses?  Because users of classes with DoTs testing on training dummies
                // .. that they don't have enough +Hit for will get DoT spam.  This allows easy
                // .. diagnosis of false reports of rotation issues where a user simply isn't geared
                // .. this happens more at the beginning of an expansion especially
                Logging.Write(
                    "[CombatLog] {0} {1}#{2} {3}",
                    e.Event,
                    e.Spell.Name,
                    e.SpellId,
                    e.Args[14]
                    );

                if (e.Args[14].ToString() == "EVADE")
                {
                    HandleEvadeBuggedMob(args, e);
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        Logging.Write("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                    }
                }
                break;
            }
        }
        private static void HandleCombatLogPvP(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            switch (e.Event)
            {
            case "SPELL_CAST_SUCCESS":

                //Logging.Write(LogLevel.Diagnostic, "Debug: {0} SPELL_CAST_SUCCESS {1} - {2} - {3} - {4} - {5}",
                //              e.SourceName, e.SpellName,
                //              e.SpellId, e.Timestamp, e.FireTimeStamp, e.DestName);

                if (!IsEnemy(e.SourceUnit))
                {
                    return;
                }

                if ((e.SpellId == 60192 || e.SpellId == 1499))
                {
                    Logging.Write(LogLevel.Diagnostic, "Found Hunter Drop {0} - {1}", e.SpellName,
                                  e.SpellId);
                    LastTrapEvent = DateTime.Now;
                }

                if (InterruptSpellHS.Contains(e.SpellId))
                {
                    Logging.Write(LogLevel.Diagnostic, "InterruptonCooldownUnit Add {0} - {1} - {2} - {3} ",
                                  e.SourceUnit.SafeName,
                                  e.SpellName,
                                  e.SpellId,
                                  InterruptSpellCooldown(e.SpellId) - 1000);

                    if (e.DestGuid == MeGuid)
                    {
                        Logging.Write(LogLevel.Diagnostic, "Incoming SPELL_CAST_SUCCESS {0} - {1} Stop Casting",
                                      e.SpellName,
                                      e.SpellId);
                        if (!MeHasAura(131558))
                        {
                            SpellManager.StopCasting();
                        }
                    }

                    InterruptonCooldownUnitAdd(e.SourceUnit, InterruptSpellCooldown(e.SpellId) - 1000);
                }
                break;

                //case "SPELL_CAST_START":

                //    Logging.Write(LogLevel.Diagnostic, "Debug: {0} SPELL_CAST_START {1} - {2} - {3} - {4} - {5}",
                //                  e.SourceName,
                //                  e.SpellName,
                //                  e.SpellId,
                //                  e.DestName,
                //                  e.DestGuid,
                //                  e.DestGuidStr);

                //    //if (InterruptSpellHS.Contains(e.SpellId) &&
                //    //    IsEnemy(e.SourceUnit))
                //    //{
                //    //    InterruptonCooldownUnitAdd(e.SourceUnit, InterruptSpellCooldown(e.SpellId - 1000));

                //    //    if (e.SourceUnit.CurrentTarget != null &&
                //    //        e.SourceUnit.CurrentTarget == Me &&
                //    //        !MeHasAura(131558))
                //    //    {
                //    //        Logging.Write(LogLevel.Diagnostic, "Incoming SPELL_CAST_START {0} - {1} Stop Casting",
                //    //                      e.SpellName, e.SpellId);

                //    //        SpellManager.StopCasting();
                //    //    }
                //    //}
                //    break;
            }
        }
        private static void HandleEvadeBuggedMob(LuaEventArgs args, CombatLogEventArgs e)
        {
            WoWUnit unit = e.DestUnit;
            ulong guid = e.DestGuid;

            if (unit == null && StyxWoW.Me.CurrentTarget != null)
            {
                unit = StyxWoW.Me.CurrentTarget;
                guid = StyxWoW.Me.CurrentTargetGuid;
                Logging.Write("Evade: bugged mob guid:{0}, so assuming current target instead", args.Args[7]);
            }

            if (unit != null)
            {
                if (!MobsThatEvaded.ContainsKey(unit.Guid))
                    MobsThatEvaded.Add(unit.Guid, 0);

                MobsThatEvaded[unit.Guid]++;
                if (MobsThatEvaded[unit.Guid] <= 5)
                {
                    Logging.Write("Mob {0} has evaded {1} times.  Keeping an eye on {2:X0} for now!", unit.Name,
                                  MobsThatEvaded[unit.Guid], unit.Guid);
                }
                else
                {
                    const int secondsToBlacklist = 60;

                    if (Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Previously blacklisted {2:X0} for {3} seconds!",
                                      unit.Name, MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                    else
                    {
                        Logging.Write(Colors.LightGoldenrodYellow,
                                      "Mob {0} has evaded {1} times. Blacklisting {2:X0} for {3} seconds!", unit.Name,
                                      MobsThatEvaded[unit.Guid], unit.Guid, secondsToBlacklist);
                        Blacklist.Add(unit.Guid, BlacklistFlags.Combat, TimeSpan.FromSeconds(secondsToBlacklist));
                        if (!Blacklist.Contains(unit.Guid, BlacklistFlags.Combat))
                        {
                            Logging.Write(Colors.Pink, "error: blacklist does not contain entry for {0} so adding {1}",
                                          unit.Name, unit.Guid);
                        }
                    }

                    if (BotPoi.Current.Guid == unit.Guid)
                    {
                        Logging.Write("EvadeHandling: Current BotPOI type={0} is Evading, clearing now...",
                                      BotPoi.Current.Type);
                        BotPoi.Clear("Singular recognized Evade bugged mob");
                    }

                    if (StyxWoW.Me.CurrentTargetGuid == guid)
                    {
                        foreach (var target in Targeting.Instance.TargetList)
                        {
                            if (target != null &&
                                target.IsValid &&
                                target.IsAlive &&
                                !Blacklist.Contains(target, BlacklistFlags.Combat))
                            {
                                Logging.Write(Colors.Pink, "Setting target to {0} to get off evade bugged mob!",
                                              target.Name);
                                target.Target();
                                return;
                            }
                        }

                        Logging.Write(Colors.Pink,
                                      "BotBase has 0 entries in Target list not blacklisted -- nothing else we can do at this point!");
                        // StyxWoW.Me.ClearTarget();
                    }
                }
            }

            /// line below was originally in Evade logic, but commenting to avoid Sleeps
            // StyxWoW.SleepForLagDuration();
        }
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);
            if (e.SourceGuid != StyxWoW.Me.Guid)
                return;

            //Logging.Write("[CombatLog] " + e.Event + " - " + e.SourceName + " - " + e.Spell.Name);

            switch (e.Event)
            {
                default:
                    Logging.Write("[CombatLog] filter out this event -- " + e.Event + " - " + e.SourceName + " - " +
                                  e.Spell.Name);
                    break;

                    // spell_cast_failed only passes filter in Singular debug mode
                case "SPELL_CAST_FAILED":
                    CastFailReason = e.Args[14].ToString();

                    if (CastFailReason != "Your target is dead" &&
                        CastFailReason != "No target" &&
                        CastFailReason != "Not yet recovered")
                    {
                    Logging.Write(LogLevel.Diagnostic,
                                  "[CombatLog] {0} {1}#{2} failure: '{3}'",
                                  e.Event,
                                  e.Spell.Name,
                                  e.SpellId,
                                  CastFailReason);
                    }

                    //if (CastFailReason != LocalizedAnotheractionisinprogress)
                    //{
                    //    Classname.CastFailed = true;
                    //}

                    //if (e.Args[14].ToString() == LocalizedLineOfSightError)
                    //{
                    //    LastLineOfSightError = DateTime.Now;
                    //    Logging.Write("[CombatLog] cast fail due to los reported at {0}",
                    //                  LastLineOfSightError.ToString("HH:mm:ss.fff"));
                    //}
                    //else if (StyxWoW.Me.Class == WoWClass.Druid && SingularRoutine.IsQuestBotActive)
                    //{
                    //    if (LocalizedShapeshiftErrors.Contains(e.Args[14].ToString()))
                    //    {
                    //        LastShapeshiftError = DateTime.Now;
                    //        Logging.Write(
                    //            "[CombatLog] cast fail due to shapeshift error while questing reported at {0}",
                    //            LastShapeshiftError.ToString("HH:mm:ss.fff"));
                    //    }
                    //}
                    break;

                    //case "SPELL_AURA_APPLIED":
                    //    Classname.LastCastSpell = e.SpellName;
                    //    Classname.LastCastTime = DateTime.Now;
                    //    //    break;
                    //case "SPELL_CAST_START":
                    //    Classname.LastCastSpell = e.SpellName;
                    //    Classname.LastCastTime = DateTime.Now;
                    //    break;
                    //case "SPELL_CAST_SUCCESS":
                    //    Classname.LastCastSpell = e.SpellName;
                    //    Classname.LastCastTime = DateTime.Now;

                    // Update the last spell we cast. So certain classes can 'switch' their logic around.
                    //Spell.LastSpellCast = e.SpellName;
                    //Logging.Write("Successfully cast " + Spell.LastSpellCast);

                    // following commented block should not be needed since rewrite of Pet summon
                    //
                    // Force a wait for all summoned minions. This prevents double-casting it.
                    //if (StyxWoW.Me.Class == WoWClass.Warlock && e.SpellName.StartsWith("Summon "))
                    //{
                    //    StyxWoW.SleepForLagDuration();
                    //}
                    //break;

                case "SWING_MISSED":
                    if (e.Args[11].ToString() == "EVADE")
                    {
                        HandleEvadeBuggedMob(args, e);
                    }
                    else if (e.Args[11].ToString() == "IMMUNE")
                    {
                        WoWUnit unit = e.DestUnit;
                        if (unit != null && !unit.IsPlayer)
                        {
                            Logging.Write("{0} is immune to Physical spell school", unit.Name);
                        }
                    }
                    break;

                case "SPELL_MISSED":
                case "RANGE_MISSED":
                    // Why log misses?  Because users of classes with DoTs testing on training dummies
                    // .. that they don't have enough +Hit for will get DoT spam.  This allows easy
                    // .. diagnosis of false reports of rotation issues where a user simply isn't geared
                    // .. this happens more at the beginning of an expansion especially
                    Logging.Write(
                        "[CombatLog] {0} {1}#{2} {3}",
                        e.Event,
                        e.Spell.Name,
                        e.SpellId,
                        e.Args[14]
                        );

                    if (e.Args[14].ToString() == "EVADE")
                    {
                        HandleEvadeBuggedMob(args, e);
                    }
                    else if (e.Args[14].ToString() == "IMMUNE")
                    {
                        WoWUnit unit = e.DestUnit;
                        if (unit != null && !unit.IsPlayer)
                        {
                            Logging.Write("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        }
                    }
                    break;
            }
        }