mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-10-01 02:17:25 +00:00
[CLASS UPDATE] Added and modified Methods
Made all methods Static and added #setActivePrayers and #getActivePrayers
This commit is contained in:
@@ -3,6 +3,8 @@ package org.rev317.min.api.methods;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author JKetelaar, Fryslan
|
||||
* TODO Set the actual level requirements
|
||||
@@ -12,8 +14,11 @@ public class Prayer {
|
||||
|
||||
public interface Book {
|
||||
public int getSetting();
|
||||
|
||||
public int getAction();
|
||||
|
||||
public int getLevel();
|
||||
|
||||
public String getName();
|
||||
}
|
||||
|
||||
@@ -172,11 +177,11 @@ public class Prayer {
|
||||
}
|
||||
|
||||
|
||||
public boolean isEnabled(Book book){
|
||||
public static boolean isEnabled(Book book) {
|
||||
return Game.getSetting(book.getSetting()) == 1;
|
||||
}
|
||||
|
||||
public void enable(final Book book) {
|
||||
public static void enable(final Book book) {
|
||||
if (!isEnabled(book)) {
|
||||
Menu.sendAction(169, -1, -1, book.getAction());
|
||||
Time.sleep(new SleepCondition() {
|
||||
@@ -188,7 +193,7 @@ public class Prayer {
|
||||
}
|
||||
}
|
||||
|
||||
public void disable(final Book book) {
|
||||
public static void disable(final Book book) {
|
||||
if (isEnabled(book)) {
|
||||
Menu.sendAction(169, -1, -1, book.getAction());
|
||||
Time.sleep(new SleepCondition() {
|
||||
@@ -199,4 +204,34 @@ public class Prayer {
|
||||
}, 1500);
|
||||
}
|
||||
}
|
||||
|
||||
public static Book[] getActivePrayers() {
|
||||
ArrayList<Book> prayers = new ArrayList<>();
|
||||
for (Book normal : Normal.values()) {
|
||||
if (isEnabled(normal)) {
|
||||
prayers.add(normal);
|
||||
}
|
||||
}
|
||||
for (Book curse : Curse.values()) {
|
||||
if (isEnabled(curse)) {
|
||||
prayers.add(curse);
|
||||
}
|
||||
}
|
||||
return prayers.toArray(new Book[prayers.size()]);
|
||||
}
|
||||
|
||||
public static void setActivePrayers(Book[] prayers) {
|
||||
for (Book book : prayers) {
|
||||
for (Book normal : Normal.values()) {
|
||||
if (!isEnabled(normal) && normal.equals(book)) {
|
||||
enable(normal);
|
||||
}
|
||||
}
|
||||
for (Book curse : Curse.values()) {
|
||||
if (!isEnabled(curse) && curse.equals(book)) {
|
||||
enable(curse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user