import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.ui.Spells;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
@ScriptManifest( name="Shitty Script", author = "OsPlay", version = 0.0, logo = "", info = "Spaghetti code!")
abstract class Telegrab extends Script {
    public boolean EXIT = false;
    public Area AREA_TO_EXIT = new Area(1,1,1,1);
    public Area AREA_2_TO_EXIT = new Area(1,1,1,1);
    public List<Integer> LIST_OF_WORLDS = new ArrayList<>();
    @Override
    public void onStart() throws InterruptedException {
        String list = JOptionPane.showInputDialog("WORLD TO HOP: AK 509,510,511...");
        for (String world :
                list.split(",")) {
            LIST_OF_WORLDS.add(Integer.parseInt(world));
        }
    }
    private boolean tryToGetTheRune() throws InterruptedException {
        GroundItem natureRune = getGroundItems().closest("Nature rune");
        if(natureRune == null) return false;
        //open magic!
        getMagic();
        sleep(random(500,1000));
        // Can't because lvl
        if(!getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB)) return false;
        sleep(random(500,1000));
        //cast magic
        if(!natureRune.interact("Cast")) return false;
        return true;
    }
    private boolean checkItems() {
        // you have space in the inventory.
        if(getInventory().isFull()) return false;
        // check for law rune.
        if(getInventory().getAmount("Law rune") < 1) return false;
        // check for air rune.
        if(getInventory().getAmount("Air rune") < 1) return false;
        return true;
    }
}