Jump to content

Matenia

Elite user
  • Posts

    2226
  • Joined

  • Last visited

Bug Report Comments posted by Matenia

  1. It's not related to either code snippets - although they both stop working.
    I've determined it only happens with one fightclass. However, the fightclass itself does not touch movement. 

    I think it might be related to Lua because in combat I've gotten the Lua error "stackoverflow, table too big to unpack".

  2. //This is how I handle it in my very own fight mechanism:
    
    _fightStartTs = DateTime.Now;
    			// chase target if necessary, otherwise wait
    			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && _target.IsAlive && _fightTrigger && !_target.IsTapDenied)
    			{
    				KeepTarget(_targetGuid);
    				//MoveAwayFromEnemies(); // needs to know if enemy is caster
    				KiteIfNecessary(_target);
    				SwimUpForAir();
    				PotionUser.UsePotions();
    				ChaseTarget(_target, () => ClassRotation.Range);
    				HandleEvade(_target);
    				EscapeIfNecessary();
    				Thread.Sleep(150);
    			}
    
    private static void SwimUpForAir()
    		{
    			if (AntiDrown.NeedsAirInCombat)
    			{
    				AntiDrown.GaspForAir();
    			}
    		}
    
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using robotManager.FiniteStateMachine;
    using SmartRobot.Bot.Helpers;
    using wManager.Wow.Enums;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    
    namespace SmartRobot.Bot.States
    {
    	public class AntiDrown : State
    	{
    		private static DateTime _breathExpires = DateTime.MaxValue;
    
    		static AntiDrown()
    		{
    			EventsLuaWithArgs.OnEventsLuaStringWithArgs += AntiDrownEventHandler;
    		}
    
    		public override string DisplayName => "AntiDrown";
    
    		private bool NeedsAir => DateTime.Now.AddSeconds(30) > _breathExpires;
    		
    		public static bool NeedsAirInCombat => DateTime.Now.AddSeconds(15) > _breathExpires;
    
    		public static bool IsBreathing => _breathExpires != DateTime.MaxValue;
    
    		public override bool NeedToRun => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause
    		                                  && ObjectManager.Me.IsSwimming
    		                                  && NeedsAir;
    
    		~AntiDrown()
    		{
    			EventsLuaWithArgs.OnEventsLuaStringWithArgs -= AntiDrownEventHandler;
    		}
    
    		private static void AntiDrownEventHandler(string id, List<string> args)
    		{
    			if ((id == "MIRROR_TIMER_START") & (args[0] == "BREATH"))
    			{
    				//sets BreathExpires to be in the future by x milliseconds
    				var expiryDate = DateTime.Now.AddMilliseconds(double.Parse(args[1]));
    				_breathExpires = expiryDate;
    
    				if (!ObjectManager.Me.HaveBuff("Water Breathing"))
    				{
    					ItemsManager.UseItem(5996);
    				}
    			}
    
    			if (id == "MIRROR_TIMER_STOP")
    			{
    				_breathExpires = DateTime.MaxValue;
    			}
    		}
    
    		public override void Run()
    		{
    			GaspForAir();
    		}
    
    		public static void GaspForAir()
    		{
    			Logger.Info("Swimming up for air");
    			MovementManager.StopMove();
    			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && ObjectManager.Me.IsSwimming)
    			{
    				Move.JumpOrAscend(Move.MoveAction.DownKey, 1000);
    				Thread.Sleep(500);
    			}
    
    			// wait at surface
    			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && !Common.IsAttackedByNpc)
    			{
    				Thread.Sleep(500);
    			}
    		}
    	}
    }

    Hope it helps for inspiration.

  3. Warmane, correct? I swear this happened with people where changing focus target/casting on focus would stop working after a while. I had complaints about that with some of my fightclasses.

  4. Yeah, I figured if I'm suspending the CustomClassThread while it's writing to client memory (not allowing it finish whatever work it was doing) it would either deadlock wRobot or the wow client itself (through directx endscene), while I was testing some things.

    I decided it's time I write my own customclass implementation that allows me to properly pause it from an outside thread and provides more customizability than what wRobot currently offers. 

    Thanks for the insight though, that was very helpful.

  5. I think it has do to with me suspending CustomClass.Thread, like this:

    
    private void FightClassWaitForRegen()
    {
      List<Thread> threadsToSleep = new List<Thread>();
      threadsToSleep.Add(CustomClass.CustomClassThread);
    
      var fightClassSleepThread = SleepFightClassThread(threadsToSleep);
      WaitUntilRegenerated(threadsToSleep);
      fightClassSleepThread.Abort();
    }
    
    private Thread SleepFightClassThread(List<Thread> threadsToSleep)
    		{
    			Thread fightClassSleepThread = new Thread(() =>
    			{
    				try
    				{
    					foreach (var thread in threadsToSleep)
    					{
    						thread.Suspend();
    					}
    
    					while (Conditions.InGameAndConnectedAndAliveAndProductStarted && !Common.IsAttackedByNpc)
    					{
    						Thread.Sleep(500);
    					}
    				}
    				finally
    				{
    					foreach (var thread in threadsToSleep)
    					{
    						thread.Resume();
    					}
    				}
    			});
    			fightClassSleepThread.Start();
    			return fightClassSleepThread;
    		}

     

  6. Similar issue:
    Wow stays unfrozen, but wRobot (interface too) is frozen.
    When I force-kill wRobot.exe process, WoW throws this error:

    ERROR #132 (0x85100084) Fatal Exception
    Program:	F:\Games\WoW 3.3.5\Wow.exe
    Exception:	0x80000004 (SINGLE_STEP) at 0023:66D54590

    I think it happens when wRobot targets itself (or others) using Interact.InteractGameObject

  7. Also if you know a better way to pause fightclass thread than this, let me know:

    private Thread SleepFightClassThread(List<Thread> threadsToSleep)
    		{
    			Thread fightClassSleepThread = new Thread(() =>
    			{
    				try
    				{
    					foreach (var thread in threadsToSleep)
    					{
    						thread.Suspend();
    					}
    
    					while (Conditions.InGameAndConnectedAndAliveAndProductStarted && !Common.IsAttackedByNpc)
    					{
    						Thread.Sleep(500);
    					}
    				}
    				finally
    				{
    					foreach (var thread in threadsToSleep)
    					{
    						thread.Resume();
    					}
    				}
    			});
    			fightClassSleepThread.Start();
    			return fightClassSleepThread;
    		}

     

  8. Hello @Droidz,

    I found the issue, I think. It's a multi threading issue, I think.
    If you call Lua.LuaDoString twice within the same framelock there are some Lua variables that get restored to their incorrect state.
     

    Pseudo code:

    -- first thread
    local _protectedFunctionSave = protectedFunction;
    protectedFunction = function(abc)
    	return expectedValueForAntiCheat;
    end
    -- do actual lua code here
    -- !first thread
    
    -- before this function is restored another thread comes and does this
    -- second thread:
    local _protectedFunctionSave = protectedFunction; -- this is now the wrong function we are saving
    protectedFunction = function(abc)
    	return expectedValueForAntiCheat;
    end
    -- !second thread
    
    -- first thread
    protectedFunction = _protectedFunctionSave; -- original is restored correctly
    -- !first thread
    
    -- second thread
    -- do actual lua code here
    protectedFunction = _protectedFunctionSave; -- wrong function is restored and breaks client a bit
    -- !second thread

    Is this possible? If yes, maybe thread-lock Lua class?

  9. Update: It seems this actually works... It's weird, sometimes it seemed to break. 
    I'd write the mouseover guid, call Lua.LuaDoString($"CastSpellByName('{name}', 'mouseover')") and nothing happens. It seems almost like the WoW client breaks for a bit. Happens on Warmane only I guess and I can't really reproduce it.

  10. You're starting an encrypted profile with what I can only assume is maybe a trial version of wRobot. Anyway, it's more up to the profile than Droidz to fix this (which was created by a user who has since left).

×
×
  • Create New...