Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.osbot.rs07.api.Dialogues;
- import org.osbot.rs07.api.Inventory;
- import org.osbot.rs07.api.Walking;
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.map.Position;
- import org.osbot.rs07.api.map.constants.Banks;
- import org.osbot.rs07.api.model.NPC;
- import org.osbot.rs07.api.model.RS2Object;
- import org.osbot.rs07.api.ui.RS2Widget;
- import org.osbot.rs07.script.MethodProvider;
- public class BarbarianActions {
- /**
- * Run Method for Barbarian Fishing
- * @param m
- */
- public static void run(MethodProvider m) {
- Inventory inventory = m.getInventory();
- String tool = BarbarianActions.tool();
- BarbarianActions.Start(m);
- if (m.dialogues.isPendingContinuation()) {
- BarbarianActions.inDialogue(m);
- } else {
- if (!inventory.isFull() && !m.myPlayer().isAnimating() && inventory.contains(tool)) {
- BarbarianActions.isIdle(m);
- }
- if (m.inventory.isFull()) {
- if (inventory.isFull() && Global.fireEnable == true && inventory.contains("Raw trout", "Raw salmon")) {
- BarbarianActions.fireEnabled(m);
- } else {
- if (Global.bank == true) {
- BarbarianActions.enableBank(m);;
- } else {
- if (Global.cooking == false) {
- BarbarianActions.drop(m);
- }
- }
- }
- }
- }
- }
- /**
- * Type of Fishing
- * @return
- */
- public static String type() {
- String fishtype = null;
- if (Global.fishingType == Global.Fishing.NET) {
- fishtype = "Small Net";
- } else {
- if (Global.fishingType == Global.Fishing.FROD) {
- fishtype = "Bait";
- } else {
- if (Global.fishingType == Global.Fishing.FFROD) {
- fishtype = "Lure";
- }
- }
- }
- return fishtype;
- }
- /**
- * Tool used to fish with
- * @return
- */
- public static String tool() {
- String tool = null;
- if (Global.fishingType == Global.Fishing.NET) {
- tool = "Small fishing Net";
- } else {
- if (Global.fishingType == Global.Fishing.FROD) {
- tool = "Fishing rod";
- } else {
- if (Global.fishingType == Global.Fishing.FFROD) {
- tool = "Fly fishing rod";
- }}}
- return tool;
- }
- /**
- * fireEnabled Method
- * @param m
- */
- public static void fireEnabled (MethodProvider m) {
- Inventory inventory = m.getInventory();
- RS2Object fire = m.getObjects().closest("Fire");
- RS2Widget w = m.getWidgets().get(270, 14);
- if (Global.cooking == true) {
- if (inventory.isFull() && !m.myPlayer().isAnimating()) {
- BarbarianActions.isIdle(m);
- }
- } else {
- if (inventory.isFull()) {
- //if inventory item is selected click on fire
- if(inventory.isItemSelected() && Global.cooking == false){
- fire.interact("Use");
- m.logger.info("Cooking fish");
- } else {
- //otherwise click on raw shrimps / raw anchovies
- inventory.interact("Use", "Raw trout", "Raw salmon");
- }
- if (w != null) {
- w.interact();
- Global.cooking = true;
- }
- }
- }
- }
- /**
- * Dropping Method
- * @param m
- */
- public static void drop(MethodProvider m) {
- Inventory inventory = m.getInventory();
- m.bot.getLogger().info("Dropping Fish.");
- if (m.inventory.isFull()) {
- inventory.dropAll("Raw trout", "Raw salmon", "Burnt fish", "Trout", "Salmon");
- }
- }
- /**
- * Full inventory Method
- * @param m
- */
- public static void fullInventory(MethodProvider m) {
- Inventory inventory = m.getInventory();
- RS2Object bank = m.getObjects().closest("Bank booth");
- Area b = new Area(3092, 3246, 3097, 3240);
- Walking walking = m.getWalking();
- //if bank is enabled, go to bank and bank
- if (Global.bank == true) {
- if (m.bank.isOpen() && inventory.isFull()) {
- m.bank.depositAll("Raw shrimps", "Raw anchovies", "Raw herring", "Raw sardine");
- } else {
- if (!b.contains(m.myPosition())){
- walking.walk(new Position(3092, 3244, 0));
- } else {
- if (bank.hasAction("Bank")) {
- bank.interact("Bank");
- m.bot.getLogger().info("Banking");
- }
- }
- }
- }
- else {
- //else drop all fish and continue fishing
- m.bot.getLogger().info("Dropping Fish.");
- inventory.dropAll("Burnt shrimp", "Raw shrimps", "Burnt fish", "Shrimps", "Anchovies", "Raw anchovies", "Raw herring", "Raw sardine");
- }
- }
- public static void hasTool(MethodProvider m) {
- String fishtype = BarbarianActions.type();
- Inventory inventory = m.getInventory();
- NPC fish = m.getNpcs().closest("Rod Fishing spot");
- if (inventory.isFull()) {
- } else {
- fish.interact(fishtype);
- Global.isFishing = true;
- m.bot.getLogger().info("Fishing");
- }
- }
- /**
- * In dialogue Method
- * @param m
- */
- public static void inDialogue(MethodProvider m) {
- Dialogues dialogue = m.getDialogues();
- dialogue.clickContinue();
- Global.isFishing = false;
- Global.cooking = false;
- m.bot.getLogger().info("Continuing Dialogue");
- }
- /**
- * Idle Method
- * @param m
- */
- public static void isIdle(MethodProvider m) {
- Global.isFishing = false;
- Global.cooking = false;
- }
- public static void Start(MethodProvider m) {
- Area fishSpot = new Area(new int[][]{{ 3107, 3436 }, { 3110, 3436 },{ 3110, 3430 },{ 3104, 3426 },{ 3104, 3424 },{ 3102, 3424 },{ 3101, 3424 },{ 3101, 3435 },{ 3101, 3436 }});
- Inventory inventory = m.getInventory();
- Walking walking = m.getWalking();
- String tool = BarbarianActions.tool();
- Area bank = new Area(3090, 3499, 3098, 3488);
- if (fishSpot.contains(m.myPosition()) && inventory.isFull() && !inventory.contains("Raw trout") && !inventory.contains("Raw salmon")) {
- Global.cooking = false;
- }
- if (bank.contains(m.myPosition()) && inventory.isFull() && inventory.contains(tool) && inventory.contains("Feather") && inventory.contains("Raw salmon") && inventory.contains("Raw trout")) {
- BarbarianActions.inBank(m);
- } else {
- if (fishSpot.contains(m.myPosition()) && inventory.contains(tool) && Global.isFishing == false && inventory.contains("Feather") || fishSpot.contains(m.myPosition()) && inventory.contains(tool) && Global.isFishing == false && inventory.contains("Fishing bait")){
- BarbarianActions.hasTool(m);
- } else {
- if (!inventory.contains(tool)) {
- walking.webWalk(new Position(3093, 3492, 0));
- } else {
- if (!fishSpot.contains(m.myPosition())) {
- walking.webWalk(new Position(3107, 3433, 0));
- }
- }
- }
- }
- }
- public static void enableBank(MethodProvider m) {
- Area fishSpot = new Area(new int[][]{{ 3107, 3436 }, { 3110, 3436 },{ 3110, 3430 },{ 3104, 3426 },{ 3104, 3424 },{ 3102, 3424 },{ 3101, 3424 },{ 3101, 3435 },{ 3101, 3436 }});
- Inventory inventory = m.getInventory();
- Walking walking = m.getWalking();
- if (fishSpot.contains(m.myPosition()) && inventory.contains("Raw trout") && inventory.contains("Raw salmon") ) {
- walking.webWalk(new Position(3093, 3493, 0));
- }
- }
- public static void inBank(MethodProvider m) {
- Area BANKZ = new Area(3090, 3499, 3098, 3488);
- Inventory inventory = m.getInventory();
- // Walking walking = m.getWalking();
- // String tool = BarbarianActions.tool();
- RS2Object bank = m.getObjects().closest("Bank booth");
- if (m.bank.isOpen() && inventory.isFull()) {
- m.bank.depositAll("Raw trout", "Raw salmon");
- } else {
- if (BANKZ.contains(m.myPosition())){
- if (bank.hasAction("Bank")) {
- bank.interact("Bank");
- m.bot.getLogger().info("Banking");
- }
- }
- }
- }
- public static void Banking(MethodProvider m) {
- Area fishSpot = new Area(new int[][]{{ 3107, 3436 }, { 3110, 3436 },{ 3110, 3430 },{ 3104, 3426 },{ 3104, 3424 },{ 3102, 3424 },{ 3101, 3424 },{ 3101, 3435 },{ 3101, 3436 }});
- Inventory inventory = m.getInventory();
- Walking walking = m.getWalking();
- String tool = BarbarianActions.tool();
- Area BANK = Banks.EDGEVILLE;
- RS2Object bank = m.getObjects().closest("Bank booth");
- if (fishSpot.contains(m.myPosition()) && inventory.contains("Raw trout", "Raw salmon")) {
- walking.walk(new Position(3093, 3493, 0));
- }
- if (!inventory.isFull() && inventory.contains(tool) && Global.isFishing == false && inventory.contains("Feather") || !inventory.isFull() && inventory.contains(tool) && Global.isFishing == false && inventory.contains("Fishing bait")){
- walking.webWalk(new Position(3107, 3433, 0));
- } else {
- if (inventory.contains(tool) && inventory.isFull()) {
- if (m.bank.isOpen() && inventory.isFull()) {
- m.bank.depositAll("Raw trout", "Raw salmon");
- } else {
- if (!BANK.contains(m.myPosition())){
- walking.walk(new Position(3093, 3493, 0));
- } else {
- if (bank.hasAction("Bank")) {
- bank.interact("Bank");
- m.bot.getLogger().info("Banking");
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement