mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-04 08:39:24 +00:00
[FEATURE] Added Mouse on screen random
Thanks to @fryslan
This commit is contained in:
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||
import org.parabot.randoms.elkoy.LogoutDisabler;
|
||||
import org.parabot.randoms.elkoy.MouseOnScreen;
|
||||
import org.parabot.randoms.elkoy.QuestionSolver;
|
||||
import org.parabot.randoms.pkhonor.*;
|
||||
|
||||
@@ -27,9 +28,10 @@ public class Core {
|
||||
// Dreamscape
|
||||
randoms.add(new SerialBanAvoider());
|
||||
|
||||
//Elkoy
|
||||
// Elkoy
|
||||
//randoms.add(new QuestionSolver());
|
||||
randoms.add(new LogoutDisabler());
|
||||
randoms.add(new MouseOnScreen());
|
||||
|
||||
org.parabot.core.Core.verbose("Possible randoms:");
|
||||
for (Random random : randoms) {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.parabot.randoms.elkoy;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.environment.input.Mouse;
|
||||
import org.parabot.environment.randoms.Random;
|
||||
import org.parabot.environment.randoms.RandomType;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author JKetelaar, Fryslan
|
||||
*/
|
||||
public class MouseOnScreen implements Random {
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return !onScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
int x = org.parabot.environment.api.utils.Random.between(100, Context.getInstance().getApplet().getWidth());
|
||||
int y = org.parabot.environment.api.utils.Random.between(100, Context.getInstance().getApplet().getHeight());
|
||||
Mouse.getInstance().moveMouse(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Mouse on screen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return "Elkoy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomType getRandomType() {
|
||||
return RandomType.SCRIPT;
|
||||
}
|
||||
|
||||
private boolean onScreen(){
|
||||
Point loc = Mouse.getInstance().getPoint();
|
||||
return Context.getInstance().getApplet().contains(loc);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user