mirror of
https://github.com/2006-Scape/Parabot-Randoms.git
synced 2026-07-07 16:49:11 +00:00
Merge pull request #25 from Parabot/feature/mouse-on-screen
[FEATURE] Added Mouse on screen random
This commit is contained in:
@@ -4,6 +4,7 @@ import org.parabot.core.Context;
|
|||||||
import org.parabot.environment.randoms.Random;
|
import org.parabot.environment.randoms.Random;
|
||||||
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
import org.parabot.randoms.dreamscape.SerialBanAvoider;
|
||||||
import org.parabot.randoms.elkoy.LogoutDisabler;
|
import org.parabot.randoms.elkoy.LogoutDisabler;
|
||||||
|
import org.parabot.randoms.elkoy.MouseOnScreen;
|
||||||
import org.parabot.randoms.elkoy.QuestionSolver;
|
import org.parabot.randoms.elkoy.QuestionSolver;
|
||||||
import org.parabot.randoms.pkhonor.*;
|
import org.parabot.randoms.pkhonor.*;
|
||||||
|
|
||||||
@@ -27,9 +28,10 @@ public class Core {
|
|||||||
// Dreamscape
|
// Dreamscape
|
||||||
randoms.add(new SerialBanAvoider());
|
randoms.add(new SerialBanAvoider());
|
||||||
|
|
||||||
//Elkoy
|
// Elkoy
|
||||||
//randoms.add(new QuestionSolver());
|
//randoms.add(new QuestionSolver());
|
||||||
randoms.add(new LogoutDisabler());
|
randoms.add(new LogoutDisabler());
|
||||||
|
randoms.add(new MouseOnScreen());
|
||||||
|
|
||||||
org.parabot.core.Core.verbose("Possible randoms:");
|
org.parabot.core.Core.verbose("Possible randoms:");
|
||||||
for (Random random : 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