package com.RunnerKing.bots.div_bot;
import com.runemate.game.api.hybrid.entities.GameObject;
import com.runemate.game.api.hybrid.entities.Item;
import com.runemate.game.api.hybrid.entities.Npc;
import com.runemate.game.api.hybrid.entities.Player;
import com.runemate.game.api.hybrid.local.Camera;
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory;
import com.runemate.game.api.hybrid.location.navigation.basic.ViewportPath;
import com.runemate.game.api.hybrid.region.GameObjects;
import com.runemate.game.api.hybrid.region.Npcs;
import com.runemate.game.api.hybrid.region.Players;
import com.runemate.game.api.script.Execution;
import com.runemate.game.api.script.framework.LoopingBot;
import com.runemate.game.api.script.framework.listeners.InventoryListener;
import java.awt.event.ItemEvent;
import java.util.regex.Pattern;
public class DivBot extends LoopingBot implements InventoryListener{
private Npc wisp;
private GameObject rift;
@Override
public void onStart(String... args) {
setLoopDelay(100,200);
getEventDispatcher().addListener(this);
System.out.println(getEventDispatcher().getListeners());
}
@Override
public void onItemRemoved(ItemEvent event){}
@Override
public void onItemAdded(ItemEvent event){}
@Override
public void onLoop() {
final Player me = Players.getLocal();
wisp = Npcs.newQuery().names("Gleaming wisp").reachable().results().nearest();
rift = GameObjects.newQuery().names(Pattern.compile("^Energy")).results().nearest();
if(Inventory.isFull()){
if(me.getAnimationId() != -1){
System.out.println("Dumping");
}else{
if(rift != null){
if(rift.getPosition().distanceTo(me.getPosition()) > 5){
Camera.turnTo(rift);
}
rift.interact("Convert to enhanced experience");
Execution.delayWhile(()->Inventory.containsAnyOf("Enriched gleaming memory", "Gleaming memory"), 45000);
}else{
System.out.println("Cant find rift");
}
}
}else{
if(me.getTarget() != null || me.getAnimationId() != -1){
System.out.println("Harvesting");
}else{
if(wisp.getPosition().distanceTo(me.getPosition()) > 5){
Camera.turnTo(wisp);
}
wisp.interact("Harvest");
Execution.delayUntil(()-> me.getAnimationId() != -1, 2000);
}
}
}
}