Jump to content
  • Make CustomClass Thread public


    Matenia
    • Version: All Product: WRobot General Type: Suggestion Status: Added

    Hey @Droidz,

    I am working on my own product atm and need to pause the fightclass during regeneration, so that it doesn't interrupt eating/drinking.
    I don't want to unload/reload custom class all the time. It's ineffective and for some developers probably would even create memory leakes because they do not dispose correctly.

    image.png.4e44714727ac51bfc3da9b6499a3a27c.png

    I'd like to access this thread so I can sleep it manually.
    For now, I think I will have to use reflection.



    User Feedback

    Recommended Comments

    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;
    		}

     

    Link to comment
    Share on other sites



    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...