Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package testground;
- import org.osbot.rs07.api.Inventory;
- import org.osbot.rs07.api.map.Area;
- import org.osbot.rs07.api.model.Player;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import org.osbot.rs07.api.map.constants.Banks;
- @ScriptManifest(author = "LKSim", info = "..", logo = "",
- name = "KING's perfect Frogs", version = 1.0)
- public class Executable extends Script{
- private Tasks bot = new Tasks();
- private State currentState = State.IDLE;
- final String Food_Type = "Tuna";
- final int Food_Amount = 5;
- final String Loot_Name = "Big bones"; // Change
- //MONSTER NAMES
- final String TARGET_NAME = "Giant frog"; //Change
- //BANKS
- final Area DRAYNOR_BANK = new Area (3092,3240,3095,3246);
- final int DRAYNOR_BANK_BOOTH_ID = 10355;
- final Area LUM_UPPER_BANK = Banks.LUMBRIDGE_UPPER;
- final int LUM_UPPER_BANK_BOOTH_ID = 18491;
- final Area TARGET_BANK = LUM_UPPER_BANK; //Change
- final int BANK_BOOTH_ID = LUM_UPPER_BANK_BOOTH_ID; //Change
- //MONSTER AREAS
- final Area LUM_CHICKS_NORTH = new Area(3171,3290,3183,3301);
- final Area LUM_COWS_NORTH = new Area(3193,3286,3210,3301);
- final Area LUM_FROGS_SOUTH = new Area(3193,3166,3208,3197);
- final Area TARGET_AREA = LUM_FROGS_SOUTH; //Change
- //PAINT
- @Override
- public void onStart() {
- log("It has begun");
- bot.exchangeContext(getBot());
- }
- @Override
- public void onExit() {
- log("It has ended");
- }
- private enum State{
- IDLE, HEAL, BANK, TRAVEL, ATTACK, LOOT
- };
- @Override
- public int onLoop() throws InterruptedException {
- //Player player = myPlayer();
- Inventory inven = getInventory();
- switch (currentState) {
- case HEAL:
- log("You are currently in the HEAL state");
- bot.eatFood(Food_Type);
- currentState = getState();
- break;
- case BANK:
- log("You are in the BANK state");
- bot.goToTargetArea(TARGET_BANK);
- bot.bankItems(TARGET_BANK, BANK_BOOTH_ID, Food_Type, Food_Amount);
- currentState = getState();
- break;
- case TRAVEL:
- log("You are currently in the TRAVEL state");
- bot.goToTargetArea(TARGET_AREA);
- currentState = getState();
- break;
- case ATTACK:
- log("You are currently in the ATTACK state");
- bot.attackBestTargetableNPC(TARGET_NAME, TARGET_AREA);
- currentState = getState();
- break;
- case LOOT:
- log("You are currently in the LOOT state");
- if (!inven.isFull()) {
- bot.lootClosest(Loot_Name, TARGET_AREA);
- currentState = getState();
- } else {
- currentState = State.ATTACK;
- }
- break;
- case IDLE:
- //log("You are currently in the IDLE state");
- currentState = getState();
- break;
- }
- return random(100,200);
- }
- private State getState() throws InterruptedException{
- Player player = myPlayer();
- Inventory inven = getInventory();
- if (bot.needToEat(Food_Type) && bot.isUnNoted(Food_Type)) {
- log("You need to heal");
- return State.HEAL;
- } else if (!bot.inTargetArea(TARGET_BANK)
- && !bot.isUnNoted(Food_Type) && bot.getHpPercent() < 65) {
- log("You need to bank");
- return State.BANK;
- } else if (!bot.inTargetArea(TARGET_AREA) && !bot.needToEat(Food_Type)) {
- log("You are going to travel");
- return State.TRAVEL;
- } else if (bot.inTargetArea(TARGET_AREA)){
- if (!player.isUnderAttack()) {
- sleep(3000);
- if (bot.lootExists(Loot_Name,TARGET_AREA)) {
- return State.LOOT;
- } else {
- return State.ATTACK;
- }
- } else if (inven.isFull()) {
- if (inven.contains(Food_Type)) {
- bot.dropItem(Food_Type);
- return State.IDLE;
- } else {
- //sleep(3000);
- log("Your Inventory is full, let's bank!");
- //sleep(3000);
- return State.BANK;
- }
- } else if (!inven.isFull() && !player.isUnderAttack()) {
- return State.LOOT;
- } else {
- return State.IDLE;
- }
- }else {
- return State.IDLE;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement