Jump to content
This site uses cookies! Learn More

This site uses cookies!

By continuing to use this site, you agree to allow us to store cookies on your computer. :)

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

     

    Share this comment


    Link to comment
    Share on other sites


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...