Jump to content

Molly and Pinball hooks (1.8.2 do not work for me)


darkxor

Recommended Posts

As for me, 1.8.2 has broken Molly and Pinball not fixed. Maybe, its only for me.

I wrote hooks to fix randoms:

class PinballRandomHook extends RandomBehaviourHook
	{
		public PinballRandomHook(int arg0) {
			super(arg0);
		}
	
		@Override
		public int onLoop() throws InterruptedException
		{	
			RandomEventSolver pinball = randomManager.forId(randomManager.PINBALL);
			int ret = pinball.onLoop();

			RS2Interface parent = client.getInterface(263);
			if(parent==null)
				return ret;
			RS2InterfaceChild child = parent.getChild(1);
			if(child==null)
				return ret;
			String message = child.getMessage();
			if(!message.equals("Score: 10"))
				return ret;
			
			RS2Object caveExit = closestObjectForName("Cave Exit");
			if(caveExit==null){
				log("Pinball: no Cave Exit");
				return ret;
			}
			if(distance(caveExit) > 4){
				Position exitPos = caveExit.getPosition();
				Position myPos = client.getMyPlayer().getPosition();
				int x = exitPos.getX();
				if(x - myPos.getX() > 3)
					x = myPos.getX() + 3;
				if(x - myPos.getX() < -3)
					x = myPos.getX() - 3;
				int y = exitPos.getY();
				if(y - myPos.getY() > 3)
					y = myPos.getY() + 3;
				if(y - myPos.getY() < -3)
					y = myPos.getY() - 3;
				client.rotateCameraPitch(random(60, 67));
				boolean walked = walk(new Position(x,y,0));
			}
			return ret;
		}
	}
	
	class MollyRandomHook extends RandomBehaviourHook
	{
		public MollyRandomHook(int arg0) {
			super(arg0);
		}
		
		@Override
		public int onLoop() throws InterruptedException
		{	
			RandomEventSolver molly = randomManager.forId(randomManager.MOLLY);
			int ret = molly.onLoop();
			
			RS2Interface parent = client.getInterface(240);
			if(parent!=null)
				return ret;
			
			client.rotateCameraPitch(random(60, 67));
			return ret;
		}
	}

and this code add in onStart():

RandomBehaviourHook hook = new PinballRandomHook(randomManager.PINBALL);
randomManager.registerHook(hook);
RandomBehaviourHook hook = new MollyRandomHook(randomManager.MOLLY);
randomManager.registerHook(hook);
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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