Jump to content

Stronghold of Security solver


PolishCivil

Recommended Posts


import dependencies.api.ATMethodProvider;

import org.osbot.rs07.api.ui.MediaType;

import org.osbot.rs07.api.ui.RS2Interface;

import org.osbot.rs07.api.ui.RS2InterfaceChild;

import org.osbot.rs07.utility.Condition;

import java.util.Arrays;

/**

* Created by PolishCivil on 5/16/2014.

*/

public class Questions {

private static final int[] ANSWER_INTERFACES = new int[]{230, 228};

private static final int[] QUESTION_INTERFACES = new int[]{243, 242, 244, 241};

private static final String[] CORRECT_ANSWERS = new String[]

{

"Nobody",

"Don't tell them anything and ignore them.",

"Talk to any banker in RuneScape.",

"Nothing",

"Memorable",

"Politely tell them no and then use the 'Report Abuse' button.",

"Don't tell them anything and inform Jagex through the game website.",

"No, it might steal my password.",

"Don't give him my password.",

"To recover my account if i don't remember my password.",

"Nowhere",

"No",

"To help me recover my password if I forget it or if it is stolen.",

"Recovering your account if you forget your password.",

"Game Inbox on the RuneScape website."

};

public static Condition getAnySosQuestion(final ATMethodProvider methodProvider) {

return new Condition() {

@Override

public boolean evaluate() {

for (int interId : QUESTION_INTERFACES) {

RS2Interface rs2Interface = methodProvider.interfaces.get(interId);

if (rs2Interface != null && rs2Interface.isValid()) {

RS2InterfaceChild child = rs2Interface.getChild(0);

if (child != null && child.getDisabledMediaType() == MediaType.NPC_HEAD && child.getDisabledMediaId() > 0) {

return true;

}

}

}

for (int interId : ANSWER_INTERFACES) {

RS2Interface rs2Interface = methodProvider.interfaces.get(interId);

if (rs2Interface != null && rs2Interface.isValid()) {

return true;

}

}

return false;

}

};

}

public static boolean solve(ATMethodProvider methodProvider) {

RS2Interface validInterface = null;

for (int interId : QUESTION_INTERFACES) {

RS2Interface rs2Interface = methodProvider.interfaces.get(interId);

if (rs2Interface != null && rs2Interface.isValid()) {

RS2InterfaceChild child = rs2Interface.getChild(0);

if (child != null && child.getDisabledMediaType() == MediaType.NPC_HEAD && child.getDisabledMediaId() > 0) {

validInterface = rs2Interface;

break;

}

}

}

if (validInterface != null) {

methodProvider.dialogues.clickContinue();

return solve(methodProvider);

} else {

for (int interId : ANSWER_INTERFACES) {

RS2Interface rs2Interface = methodProvider.interfaces.get(interId);

if (rs2Interface != null && rs2Interface.isValid()) {

validInterface = rs2Interface;

}

}

if (validInterface != null) {

RS2InterfaceChild[] children = validInterface.getChildren();

for (RS2InterfaceChild child : children) {

if (Arrays.asList(CORRECT_ANSWERS).contains(child.getMessage())) {

methodProvider.clickOnChild(child);

return solve(methodProvider);

}

}

} else {

return false;

}

}

return true;

}

}

  • Like 2
Link to comment
Share on other sites

can't we just search for interface text? Nevertheless, nice release.

   public boolean interfaceHandler()
    {
        List localList;
        if ((localList = interfaces.containingText(new String[] {
                "click to continue",
                "nobody",
                "don't tell them anything and ignore them.",
                "talk to any banker in RuneScape.",
                "nothing",
                "memorable",
                "politely tell them no and then use the 'Report Abuse' button.",
                "don't tell them anything and inform Jagex through the game website.",
                "no, it might steal my password.",
                "don't give him my password.",
                "to recover my account if i don't remember my password.",
                "nowhere",
                "no",
                "to help me recover my password if I forget it or if it is stolen.",
                "recovering your account if you forget your password.",
                "game Inbox on the RuneScape website."
                
        })).isEmpty())
            return false;
        return ((RS2InterfaceChild)localList.get(0)).interact();

    }
Edited by Th3
  • Like 1
Link to comment
Share on other sites

 

can't we just search for interface text? Nevertheless, nice release.

   public boolean interfaceHandler()
    {
        List localList;
        if ((localList = interfaces.containingText(new String[] {
                "click to continue",
                "nobody",
                "don't tell them anything and ignore them.",
                "talk to any banker in RuneScape.",
                "nothing",
                "memorable",
                "politely tell them no and then use the 'Report Abuse' button.",
                "don't tell them anything and inform Jagex through the game website.",
                "no, it might steal my password.",
                "don't give him my password.",
                "to recover my account if i don't remember my password.",
                "nowhere",
                "no",
                "to help me recover my password if I forget it or if it is stolen.",
                "recovering your account if you forget your password.",
                "game Inbox on the RuneScape website."
                
        })).isEmpty())
            return false;
        return ((RS2InterfaceChild)localList.get(0)).interact();

    }

 

It will search every interface which is slow.

 

  • Like 1
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...