Jump to content

WorldHopping


cattycatcat

Recommended Posts

Hello so i have problem with worldhopping

   (I'm not good at conditional sleep so please help me to solve it smile.png   )

if(store.isOpen()) {
			Item test1 = getStore().getItem("Item");
			 if (test1 != null && getStore().getAmount("Item") > 0) {
				 getStore().buy("Item", 5);
			 }
		}
		Item test2 = getStore().getItem("Item2");
		 if (test2 != null && getStore().getAmount("Item2") > 0) {
			 getStore().buy("Item2", 5);
	  }
		 if (getStore().isOpen()) {
             getStore().close();
             new ConditionalSleep(5500, 6000) {
                 public boolean condition() throws InterruptedException {
                     return !getStore().isOpen();
                 }
             }.sleep();
             getWorlds().hopToP2PWorld();
             new ConditionalSleep(15000, 25000) {
                 public boolean condition() throws InterruptedException {
                     return myPlayer().exists();
                 }
             }.sleep();
	}
}
    
}

The problem is after world hop it starts to eat all my cpu.So if sombody could help me that would be great biggrin.png

Edited by cattycatcat
Link to comment
Share on other sites

myPlayer() might be null, try checking if it's not null in the ConditionalSleep

 

Also, you can define the amount of time the ConditionalSleep loop waits between each iteration like so:

(2nd parameter of the constructor)

new ConditionalSleep(random(15000, 25000), random(300,800)) {
  public boolean condition() throws InterruptedException {
    return condition;
  }
}.sleep();
Edited by btsfan
Link to comment
Share on other sites

Untested:

boolean hop = false;
int oldWorld = -1;

if (hop) {
			
	if (getStore().isOpen()) {
		getStore().close();
		return 300;
	}
			
	getWorlds().hopToP2PWorld();
			
	if (oldWorld != getWorlds().getCurrentWorld())
		hop = false;
			
	return 300;
			
}

if (!getStore().isOpen()) {
	// open store
	return 300;
}

String item1Name = "Item1";
String item2Name = "Item2";
Item item1 = getStore().getItem(item1Name);
Item item2 = getStore().getItem(item2Name);

if (item1 != null && getStore().getAmount(item1Name) > 0) {
	getStore().buy(item1Name, 5);
	return 300;
}

if (item2 != null && getStore().getAmount(item2Name) > 0) {
	getStore().buy(item2Name, 5);
	return 300;
}

hop = true;
oldWorld = getWorlds().getCurrentWorld();

Hope you get the gist of it :)

Also use HHopper doge.png

Edited by House
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...