What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Sudden death of Combatbehaviour during Combat

  • Thread starter Thread starter weischbier
  • Start date Start date
W

weischbier

Guest
So I rewrote my DK part for Singular once more and it turns out totally awesome as long as it worked (3-5k DPS higher)!
BUT all of a sudden it will stop mid fight and then nothing...

Heres my Code:

Code:
using System;
using Singular.Dynamics;
using Singular.Helpers;
using Singular.Managers;
using Singular.Settings;
using Styx;
using Styx.Combat.CombatRoutine;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using TreeSharp;


namespace Singular.ClassSpecific.DeathKnight
{
    public static class Frost
    {
        [Class(WoWClass.DeathKnight)]
        [Spec(TalentSpec.FrostDeathKnight)]
        [Behavior(BehaviorType.Combat)]
        [Context(WoWContext.All)]
        public static Composite Create_Frost_DeathKnightCombat()
        {
            return
                new PrioritySelector(
                    DarkSimulacrum(),
                    Helpers.Common.CreateInterruptSpellCast(ret => CurTarget),
                    Defense(),
                    Outbreak(),
                    PlagueStrike(),
                    DmgCooldown(),
                    Obliterate(1),
                    FrostStrike(1),
                    Obliterate(2),
                    FrostStrike(2),
                    HowlingBlast(1),
                    FrostStrike(3),
                    Obliterate(3),
                    Obliterate(4),
                    Obliterate(5),
                    Obliterate(6),
                    HowlingBlast(2),
                    Obliterate(7),
                    HowlingBlast(3),
                    Obliterate(8),
                    FrostStrike(4),
                    HornOfWinter(2)
                    );
        }


        [Class(WoWClass.DeathKnight)]
        [Behavior(BehaviorType.PreCombatBuffs)]
        [Spec(TalentSpec.FrostDeathKnight)]
        [Context(WoWContext.All)]
        public static Composite Create_Frost_DeathKnightPreCombatBuffs()
        {
            return
                new PrioritySelector(
                    Presence(),
                    HornOfWinter(1)
                    );
        }


        #region Category: Spells


        //internal static bool Keypresser()
        //{
        //    bool IsLeftAltKeyDown = Lua.GetReturnVal<bool>("if IsLeftAltKeyDown() and GetCurrentKeyBoardFocus() == nil then return true end", 0);
        //    return IsLeftAltKeyDown;
        //}


        private static LocalPlayer Me
        {
            get { return StyxWoW.Me; }
        }


        private static WoWUnit CurTarget
        {
            get { return StyxWoW.Me.CurrentTarget; }
        }


        private static WoWUnit Focus
        {
            get { return StyxWoW.Me.FocusedUnit; }
        }


        internal static bool Burst
        {
            get
            {
                return Me.HasAnyAura("Bloodlust", "Time Warp", "Heroism");
            }
        }


        // Offensive Attacks
        internal static Composite DarkSimulacrum()
        {
            return
                new Decorator(
                    ret => Focus != null,
                    new Decorator(
                        ret => Focus.DarkSimThis(),
                        Spell.Buff("Dark Simulacrum", true, ret => Focus,
                                   ret => Me.FocusedUnit.IsCasting &&
                                          (Me.FocusedUnit.CastingSpellId == 108567 ||
                                           Me.FocusedUnit.CastingSpellId == 110887 ||
                                           Me.FocusedUnit.CastingSpellId == 105289 ||
                                           Me.FocusedUnit.CastingSpellId == 110888),
                                   "Dark Simulacrum")
                        )
                    );
        }


        internal static Composite Outbreak()
        {
            return
                new Decorator(
                    ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                    Spell.Buff("Outbreak", true, ret => CurTarget, "Blood Plague", "Frost Fever")
                    );
        }


        internal static Composite PlagueStrike()
        {
            return
                new Decorator(
                    ret =>
                    !CurTarget.HasMyAura("Blood Plague"),
                    Spell.Cast("Plague Strike", ret => CurTarget)
                    );
        }


        internal static Composite Obliterate(int rank)
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => rank == 1 &&
                               ObjectManager.Me.DeathRuneCount >= 1 &&
                               ObjectManager.Me.FrostRuneCount >= 1 &&
                               ObjectManager.Me.UnholyRuneCount >= 1,
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 2 &&
                               (ObjectManager.Me.FrostRuneCount == 2 &&
                                ObjectManager.Me.DeathRuneCount == 2) ||
                               (ObjectManager.Me.UnholyRuneCount == 2 &&
                                ObjectManager.Me.DeathRuneCount == 2) ||
                               (ObjectManager.Me.FrostRuneCount == 2 &&
                                ObjectManager.Me.UnholyRuneCount == 2),
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 3 &&
                               Me.HasMyAura("Killing Machine", 1),
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 4 &&
                               ObjectManager.Me.UnholyRuneCount == 2,
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 5 &&
                               ObjectManager.Me.UnholyRuneCount == 1 &&
                               (GetRuneCooldown(3) < 1 ||
                                GetRuneCooldown(4) < 1),
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 6 &&
                               ObjectManager.Me.UnholyRuneCount == 1 &&
                               (GetRuneCooldown(3) < 1 ||
                                GetRuneCooldown(4) < 1) &&
                               (ObjectManager.Me.DeathRuneCount + 
                               ObjectManager.Me.FrostRuneCount == 1),
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 7 &&
                               Me.CurrentRunicPower >= 90,
                        Spell.Cast("Obliterate", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 8 &&
                               Me.CurrentRunicPower >= 60,
                        Spell.Cast("Obliterate", ret => CurTarget)
                        )
                    );
        }


        internal static Composite HowlingBlast(int rank)
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => rank == 1 &&
                            StyxWoW.Me.HasMyAura("Freezing Fog"),
                        Spell.Cast("Howling Blast", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 2 &&
                            StyxWoW.Me.CurrentRunicPower < 90,
                        Spell.Cast("Howling Blast", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 3 &&
                            StyxWoW.Me.CurrentRunicPower < 60,
                        Spell.Cast("Howling Blast", ret => CurTarget)
                        )
                    );
        }


        internal static Composite FrostStrike(int rank)
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => rank == 1 &&
                               StyxWoW.Me.CurrentRunicPower >= 120,
                        Spell.Cast("Frost Strike", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 2 &&
                               StyxWoW.Me.CurrentRunicPower >= 110,
                        Spell.Cast("Frost Strike", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 3 &&
                               StyxWoW.Me.CurrentRunicPower >= 100,
                        Spell.Cast("Frost Strike", ret => CurTarget)
                        ),
                    new Decorator(
                        ret => rank == 4,
                        Spell.Cast("Frost Strike", ret => CurTarget)
                        )
                    );
        }


        //Buffs/Cooldowns
        internal static Composite DmgCooldown()
        {
            return
                new PrioritySelector(
                    PillarofFrost(),
                    BloodTap(),
                    RaiseDead(),
                    EmpowerRuneWeapon(),
                    Trinket1(),
                    Trinket2(),
                    Tinker9(),
                    Potion()
                    );
        }


        internal static Composite HornOfWinter(int rank)
        {
            return
                new PrioritySelector(
                    new Decorator(ret => rank == 1,
                                  new Decorator(ret => CurTarget != null,
                                                new Decorator(ret => !CurTarget.IsFriendly,
                                                              Spell.BuffSelf(
                                                                  "Horn of Winter",
                                                                  ret =>
                                                                  !StyxWoW.Me.HasAura("Horn of Winter") &&
                                                                  !StyxWoW.Me.HasAura("Battle Shout") &&
                                                                  !StyxWoW.Me.HasAura("Roar of Courage"))))
                        ),
                    new Decorator(ret => rank == 2,
                                  Spell.BuffSelf("Horn of Winter")
                        )
                    );
        }


        internal static Composite Presence()
        {
            return Spell.BuffSelf(
                "Unholy Presence",
                ret =>
                TalentManager.CurrentSpec == TalentSpec.FrostDeathKnight);
        }


        internal static Composite PillarofFrost()
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => SingularSettings.Instance.DeathKnight.UsePillarOfFrost,
                        new PrioritySelector(
                            new Decorator(
                                ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                                Spell.BuffSelf("Pillar of Frost")
                                ),
                            new Decorator(
                                ret => !CurTarget.DontBurstThis(),
                                Spell.BuffSelf("Pillar of Frost")
                                )
                            )
                        )
                    );
        }


        internal static Composite BloodTap()
        {
            return
                new Decorator(
                    ret => ObjectManager.Me.DeathRuneCount < 2 &&
                           GetAllRuneCooldowns(1, 2) > 2,
                    Spell.BuffSelf("Blood Tap")
                    );
        }


        internal static Composite RaiseDead()
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => SingularSettings.Instance.DeathKnight.UseRaiseDead,
                        new PrioritySelector(
                            new Decorator(
                                ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                                new Decorator(
                                    ret => Me.HasMyAura("Pillar of Frost") && Me.HasMyAura("Unholy Strength"),
                                    Spell.Cast("Raise Dead", ret => CurTarget)
                                    )
                                )
                            )
                        )
                    );
        }


        internal static Composite EmpowerRuneWeapon()
        {
            return
                new PrioritySelector(
                    new Decorator(
                        ret => SingularSettings.Instance.DeathKnight.UseEmpowerRuneWeapon,
                        new Decorator(
                            ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                            new Decorator(
                                ret => Me.FrostRuneCount < 1 &&
                                       Me.UnholyRuneCount < 2 &&
                                       Me.DeathRuneCount < 1 &&
                                       Me.CurrentRunicPower < 25 &&
                                       (GetAllRuneCooldowns(1, 2, 3, 4, 5) > 1 ||
                                        GetAllRuneCooldowns(1, 2, 3, 4, 6) > 1 ||
                                        GetAllRuneCooldowns(1, 2, 3, 4, 5, 6) > 1),
                                Spell.Cast("Empower Rune Weapon", ret => CurTarget)
                                )
                            )
                        )
                    );
        }


        //Items/Trinkets/Tinkers
        internal static Composite Trinket1()
        {
            return
                new Decorator(
                    ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                    new Decorator(
                        Item.UseEquippedItem(12)
                        )
                    );
        }


        internal static Composite Trinket2()
        {
            return
                new Decorator(
                    ret => CurTarget.IsBoss() || CurTarget.BurstThis(),
                    new Decorator(
                        Item.UseEquippedItem(13)
                        )
                    );
        }


        internal static Composite Tinker9()
        {
            return
                new Decorator(
                    ret => Me.HasMyAura("Pillar of Frost"),
                    new Decorator(
                        Item.UseEquippedItem(9)
                        )
                    );
        }


        internal static Composite Potion()
        {
            return
                new Decorator(
                    ret => Burst,
                    Item.UseItem(58146)
                    );
        }


        //Defensive Spells
        internal static Composite Defense()
        {
            return
                new PrioritySelector(
                    AntimagicShell(),
                    IceboundFortitude(),
                    GiftoftheNaaru(),
                    Tinker5()
                    );
        }


        internal static Composite Tinker5()
        {
            return
                new Decorator(ret => Me.HealthPercent < 50,
                              Item.UseEquippedItem(5)
                    );
        }


        internal static Composite AntimagicShell()
        {
            return
                new Decorator(
                    ret => Me.HealthPercent < 80,
                    Spell.BuffSelf("Anti-Magic Shell")
                    );
        }


        internal static Composite IceboundFortitude()
        {
            return
                new Decorator(
                    ret => Me.HealthPercent < 60,
                    Spell.BuffSelf("Icebound Fortitude")
                    );
        }


        internal static Composite GiftoftheNaaru()
        {
            return
                new Decorator(
                    ret => Me.HealthPercent < 50,
                    Spell.BuffSelf("Gift of the Naaru")
                    );
        }


        //Test Area
        internal static int GetAllRuneCooldowns(params int[] runes)
        {
            int cooldown = 0;
            foreach (int rune in runes)
            {
                cooldown += GetRuneCooldown(rune);
            }
            return cooldown;
        }


        internal static int GetRuneCooldown(int rune)
        {
            float finish = Lua.GetReturnVal<float>(string.Format("local start, dur, ready = GetRuneCooldown({0}); local finish = start + dur; return finish", rune), 0);
            float time_now = Lua.GetReturnVal<float>("return GetTime()", 0);
            return (int)Math.Round(finish - time_now);
        }


        #endregion
    }
}

This totally worked but suddenly not. I changed nothing and I don't use any addons except DBM.

Here's a log View attachment 37835

Since 5800 was released randomly this error occurs too:

Code:
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> Styx.InvalidObjectPointerException: Der Deskriptor kann auf einem falschen Objekt nicht gelesen werden.
   bei Styx.WoWInternals.WoWObjects.WoWObject.#eve[T](UInt32 field)
   bei Styx.WoWInternals.WoWObjects.WoWObject.#dve[T](Int32 offsetIndex)
   bei Styx.WoWInternals.WoWObjects.WoWUnit.get_Level()
   bei Honorbuddy.MainWindow.#3Uc()
   --- Ende der internen Ausnahmestapel?berwachung ---
   bei System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   bei System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   bei System.Delegate.DynamicInvokeImpl(Object[] args)
   bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

So i hope anybody can help me out here.

greetz

Weischbier</float></float></bool>
 
Last edited by a moderator:
Push!

So Handnavi has noticed that the "lags" occur when he's trying to buff.
But I cannot work with that. There is no bug or something like that.

greetz

Weischbier
 
you could always attach it to the debugger if your using VS2010 pro. thats what i would recommended so you can see what line is tossing the error.
 
From what i can gather, all our CCs started projecting this error in the latest HB
So i'd say it's something within HB, but i can't give any proof

If it's a error within the CCs, i'd love to hear if you find a solution!
 
Last edited:
From what i can gather, all our CCs started projecting this error in the latest HB
So i'd say it's something within HB, but i can't give any proof

If it's a error within the CCs, i'd love to hear if you find a solution!

This error seems like HB has problems retrieving the level of the logged in ??Char??
Code:
Styx.WoWInternals.WoWObjects.WoWUnit.get_Level()

If you follow any of the latest posted logs you can find that error randomly multiple times on random occasions.
 
Last edited by a moderator:
Same here, I can confirm seeing this error here and there with the latest HB.
When using warrior arms singular cc, it also sometimes suddenly stopped doing anything with this error
 
System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> Styx.InvalidObjectPointerException: Der Deskriptor kann auf einem falschen Objekt nicht gelesen werden.

i posted this already in the german section.
it occurs in the log (file or tab) but the bot is working fine.
since the 5800 (and afaik the previous version also)


perhaps a dev can take a look on it.
i also can provide several log files (cause it is in every since trying a clean HB installation after first occurance of this exception)
 
uhm damn, and i thought this is only a problem of holy cow when i debugged it yesterday to find the problem (couldn't find it)
But i'll try with attaching the debugger
 
Can you give me a little heads up how to use that debugger?
Open Visual Studio 2010 (you need pro versione)
Go to Debug, choose Attach,choose the HB process from the list
let it run and wait for an exception ;)
 
From what i can gather, all our CCs started projecting this error in the latest HB
So i'd say it's something within HB, but i can't give any proof

If it's a error within the CCs, i'd love to hear if you find a solution!

I'm not so sure it's the CC, I get this error even when I'm doing AH or general shuffling where I have no CC loaded (on purpose).
I also get it while farming or questing with any CC... I think it's a core HB issue.
 
Confirming that my rogue CC throws the same exception for no apparent reason, but the exception doesn't seem to have an impact as far as combat or raid bot is concerned. I suspect it has something to do with accessing ObjectManager.Me.CurrentTarget.

Code:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Styx.InvalidObjectPointerException: Cannot read a descriptor on an invalid object.
   at Styx.WoWInternals.WoWObjects.WoWObject.#eve[T](UInt32 field)
   at Styx.WoWInternals.WoWObjects.WoWObject.#dve[T](Int32 offsetIndex)
   at Styx.WoWInternals.WoWObjects.WoWUnit.get_Level()
   at Honorbuddy.MainWindow.#3Uc()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
 
Last edited:
GB2 works without problems...
when the exception pops up in the log-tab my farmer has no target.
 
Back
Top