Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RSNPC chosen = null;
- int[] gilesniles = {2536, 2537, 2538};
- enum Niles{
- HELM("helmet", 8833),
- BOWL("bowl", 2807),
- SWORD("sword", 8836),
- FISH("fish", 8829),
- BATTLEAXE("battleaxe", 8828),
- SHEARS("shears", 8835),
- SPADE("spade", 8837),
- RING("ring", 8834),
- SHIELD("shield", 8832);
- public static Niles getAnswerByModelId(int id){
- for(Niles n : values()){
- if(n.getModelId() == id){
- return n;
- }
- }
- return null;
- }
- String name;
- int modelId;
- public String getName(){
- return name;
- }
- public int getModelId(){
- return modelId;
- }
- Niles(String name, int modelId){
- this.name=name;
- this.modelId=modelId;
- }
- }
- void solveNiles(){
- println("solving");
- RSInterfaceMaster needsSolving = Interfaces.get(184);
- if(needsSolving != null && !needsSolving.isHidden()){
- int modelId = needsSolving.getChild(7).getModelID();
- println("not null " +modelId);
- Niles answer = Niles.getAnswerByModelId(modelId);
- int correctAnswerChildId = -1;
- if(answer != null){
- println("answer not null");
- for(RSInterfaceChild child : needsSolving.getChildren()){
- if(child.getText().contains(answer.getName())){
- correctAnswerChildId = child.getIndex() + 7;
- }
- }
- }
- if(correctAnswerChildId != -1) {
- println("clicking select");
- needsSolving.getChild(correctAnswerChildId).click("select");
- }
- return;
- }
- if(chosen == null){
- RSNPC[] niles = NPCs.findNearest(gilesniles);
- if(niles != null && niles.length != 0){
- for(RSNPC a : niles){
- if(a.getChatMessage() != null && a.getChatMessage().contains(Player.getRSPlayer().getName())){
- chosen = a;
- }
- }
- }
- }else{
- println("found chosen");
- chosen.click("Talk-to");
- }
- }
- @Override
- public void run() {
- while(true){
- solveNiles();
- sleep(1000);
- }
- //To change body of implemented methods use File | Settings | File Templates.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement