mirror of
https://github.com/2006-Scape/Script-Factory.git
synced 2026-07-02 16:49:10 +00:00
Adds a Login Handler to login after DC
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
package scriptfactory.Strategies;
|
||||||
|
|
||||||
|
import org.parabot.environment.api.utils.Time;
|
||||||
|
import org.parabot.environment.input.Keyboard;
|
||||||
|
import org.parabot.environment.input.Mouse;
|
||||||
|
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||||
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
public class LoginHandler{
|
||||||
|
|
||||||
|
private Point point = new Point(432, 282);
|
||||||
|
private Point point2 = new Point(328, 324);
|
||||||
|
|
||||||
|
public void execute() {
|
||||||
|
if (Game.isLoggedIn() && Game.getOpenInterfaceId() == 15812) {
|
||||||
|
Mouse.getInstance().click(point2);
|
||||||
|
}
|
||||||
|
if (!Game.isLoggedIn()) {
|
||||||
|
Time.sleep(new SleepCondition() {
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return Game.isLoggedIn();
|
||||||
|
}
|
||||||
|
}, 5000);
|
||||||
|
Mouse.getInstance().click(point);
|
||||||
|
Time.sleep(1000);
|
||||||
|
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
|
||||||
|
Time.sleep(1000);
|
||||||
|
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package scriptfactory.Strategies;
|
package scriptfactory.Strategies;
|
||||||
|
|
||||||
|
|
||||||
|
import org.rev317.min.api.methods.Game;
|
||||||
import scriptfactory.Actions.Action;
|
import scriptfactory.Actions.Action;
|
||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
import scriptfactory.VarsMethods;
|
import scriptfactory.VarsMethods;
|
||||||
@@ -13,6 +14,7 @@ import java.util.ArrayList;
|
|||||||
public class RunLoop implements Strategy {
|
public class RunLoop implements Strategy {
|
||||||
|
|
||||||
private ActionExecutor actionExecutor;
|
private ActionExecutor actionExecutor;
|
||||||
|
private LoginHandler loginHandler = new LoginHandler();
|
||||||
|
|
||||||
public RunLoop(ArrayList<Action> actions)
|
public RunLoop(ArrayList<Action> actions)
|
||||||
{
|
{
|
||||||
@@ -27,6 +29,9 @@ public class RunLoop implements Strategy {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
VarsMethods.calculateGainedXP();
|
VarsMethods.calculateGainedXP();
|
||||||
|
if(!Game.isLoggedIn() || Game.getOpenBackDialogId() == 15812){
|
||||||
|
loginHandler.execute();
|
||||||
|
}
|
||||||
actionExecutor.execute();
|
actionExecutor.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user