Jump to content
  • [TBC] Bot enters regen state during ObjectManager.Me.InCombat


    Matenia
    • Version: All Product: WRobot General Type: Bug Status: Not a Bug

    Sometimes, you are still in combat with some mobs. However the bot will still enter combat state. This happens for example if you polymorph one attacker or if you call Fight.StopFight() (maybe because you want to cancel the fightclass to run away from the fight).

    The bot should not try to enter regen while still in combat and the bot should STOP regen if it's being attacked.



    User Feedback

    Recommended Comments

    Matenia

    Posted (edited)

    Example screenshot of this: 

    kENkfsx.jpg

    Quote

    [D] 10:54:43 - successfully casted: Ice Barrier
    10:54:44 - [Regen] Use drink Conjured Sparkling Water
    10:54:58 - [Regen] Finished
    10:54:59 - [Fight] Player attack before being attacked by Rock Stalker (lvl 58)
    [D] 10:55:30 - [MovementManager] Avoid wall: StrafeLeft
    [D] 10:55:32 - [MovementManager] Current pos: -7508,243 ; 1112,508 ; -1,46689 ; "None" - Target pos: -7504,142 ; 1107,832 ; -0,9357554 ; "None" Continent: Kalimdor Tile: 29.91405_46.07796
    [D] 10:55:32 - [StuckResolver] Started.
    [D] 10:55:35 - [StuckResolver] Done - Stuck count updated, new value: 13.
    [D] 10:55:37 - [Fight] Mob seem bugged
    [D] 10:55:38 - [Fight] Fight stopped
    10:55:38 - [Resurrect] Player dead

    This is a log of it just standing around and not fighting back. Potentially, this could be caused by me, but I don't think so.
    What could cause stucking in MovementManager when there is not even any walls around?

    Edited by Matenia
    Matenia

    Posted (edited)

    For testing, I tried using this code (calling start and stop from a plugin).
    But nothing is ever logged, so I think ObjectManager.Me.InCombat is incorrectly returning false. It should be the same as this.

     

    public static bool AffectingCombat(this WoWLocalPlayer me)
    {
      return Lua.LuaDoString<bool>(@"return (UnitAffectingCombat(""player"") ~= nil)");
    }
    public class RegenStop
    {
    
        private static WoWLocalPlayer Me = ObjectManager.Me;
        private static Engine engine;
        private static Regeneration regeneration = new Regeneration();
    
        public static void Start()
        {
            FiniteStateMachineEvents.OnStartEngine += (Engine engine) => {
                RegenStop.engine = engine;
            };
            FiniteStateMachineEvents.OnRunState += AntiRegenEventHandler;
            FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += AntiRegenEventHandler;
        }
    
        public static void Stop()
        {
            FiniteStateMachineEvents.OnRunState -= AntiRegenEventHandler;
            FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState -= AntiRegenEventHandler;
        }
    
        private static void AntiRegenEventHandler(Engine engine, State state, CancelEventArgs cancelable)
        {
            if (state.DisplayName == "Regeneration" && Me.InCombat)
            {
    
                Logging.WriteDebug("cancelling regen while in combat");
                cancelable.Cancel = true;
    
                RegenStop.engine.RemoveStateByName("Regeneration");
                ReenableRegen();
            }
        }
    
        private static async void ReenableRegen()
        {
            await Task.Delay(10000);
            engine.AddState(regeneration);
        }
    }

     

    Edited by Matenia


    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...