Swizzbeat Posted May 18, 2014 Posted May 18, 2014 (edited) Implementation for people to use in their scripts to support quick prayer. Probably a more viable option just to have users select using quick prayers instead of manually selecting/having the bot turn on the prayers they need. import org.osbot.script.Script; import org.osbot.script.rs2.ui.RS2Interface; import org.osbot.script.rs2.ui.RS2InterfaceChild; import org.osbot.script.rs2.ui.Tab; /** * Created with IntelliJ IDEA * User: Anthony * Date: 5/18/2014 */ public class QuickPrayerController { private final Script sI; public QuickPrayerController(final Script sI) { this.sI = sI; } /** * Checks if orbs are currently enabled for the player * * @return whether orbs are enabled or not */ public boolean areOrbsEnabled() { return sI.client.getConfig(1055) == 16; } /** * Toggles data orbs on or off * * @param off whether to toggle off * @return successful or unable to complete operation * @throws InterruptedException */ public boolean toggleOrbs(boolean off) throws InterruptedException { boolean returnValue = false; if (!areOrbsEnabled() == off) { returnValue = false; } else { if (!sI.currentTab().equals(Tab.SETTINGS)) { sI.openTab(Tab.SETTINGS); } if (sI.currentTab().equals(Tab.SETTINGS)) { final RS2Interface parent = sI.client.getInterface(261); if (parent != null) { final RS2InterfaceChild child = parent.getChild(9); if (child != null && child.isVisible()) { returnValue = child.interact(); } } } } return returnValue; } /** * Checks if quick prayer is turned on * * @return whether quick prayer is activated or not */ public boolean isQuickPrayerOn() { return sI.client.getConfig(83) > 0; } /** * Toggles quick prayer on or off * * @param off whether to toggle off * @return successful or unable to complete operation * @throws InterruptedException */ public boolean toggleQuickPrayer(boolean off) throws InterruptedException { boolean returnValue = false; if (!areOrbsEnabled() || !isQuickPrayerOn() == off) { returnValue = false; } else { final RS2Interface parent = sI.client.getInterface(548); if (parent != null) { final RS2InterfaceChild child = parent.getChild(85); if (child != null && child.isVisible()) { returnValue = child.interact(); } } } return returnValue; } } Edited May 18, 2014 by Swizzbeat 2
Deffiliate Posted May 18, 2014 Posted May 18, 2014 Wow, i didn't even know 07 had Quick prays.... Guess this renders my Prayer class useless. Thx will be using
Dog_ Posted May 18, 2014 Posted May 18, 2014 (edited) But it's final? but it's not static final u only DO_DIS for constants final yeh, no Edited May 18, 2014 by Rawr 2
Swizzbeat Posted May 18, 2014 Author Posted May 18, 2014 but it's not static final u only DO_DIS for constants yeh, no Whoops thanks
Botre Posted May 18, 2014 Posted May 18, 2014 (edited) yeh, no I'm sorry Nah I'm not OT: nice one swizzle Edited May 18, 2014 by Botrepreneur
Pandemic Posted May 18, 2014 Posted May 18, 2014 Looks good I'd get rid of a lot of unnecessary brackets, and I don't know why you are using returnValue variable, just return that (you aren't doing anything after checking anyways). 1
Pseudo Posted May 18, 2014 Posted May 18, 2014 But it's final? The final keyword doesn't necessarily make it a constant.
Swizzbeat Posted May 18, 2014 Author Posted May 18, 2014 Looks good I'd get rid of a lot of unnecessary brackets, and I don't know why you are using returnValue variable, just return that (you aren't doing anything after checking anyways). I prefer brackets because in my opinion it looks neater as compared to just having an indented block to show scope, and I'm using a variable to hold the return value because apparently it's the conventionally correct thing to do with in the business world. Mine as well start now :p The final keyword doesn't necessarily make it a constant. Yeah I've had bad assumptions due to learning Java on my own. cleared it up for me
TheScrub Posted May 25, 2014 Posted May 25, 2014 i released a full prayer api include section method of quick prayers in the snippets before have a look