Add hover functions
This commit is contained in:
parent
ab50d739c1
commit
aaee43be4c
@ -1,17 +1,26 @@
|
||||
package io.reisub.dreambot.util;
|
||||
|
||||
import org.dreambot.api.input.Mouse;
|
||||
import org.dreambot.api.input.mouse.destination.impl.MiniMapTileDestination;
|
||||
import org.dreambot.api.methods.Calculations;
|
||||
import org.dreambot.api.methods.MethodContext;
|
||||
import org.dreambot.api.methods.interactive.Players;
|
||||
import org.dreambot.api.methods.map.Tile;
|
||||
import org.dreambot.api.methods.skills.Skill;
|
||||
import org.dreambot.api.methods.skills.Skills;
|
||||
import org.dreambot.api.wrappers.interactive.Entity;
|
||||
import org.dreambot.api.wrappers.interactive.GameObject;
|
||||
import org.dreambot.api.wrappers.interactive.Player;
|
||||
import org.w3c.dom.css.Rect;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Util {
|
||||
private static final String VERSION = "1.0.0";
|
||||
private static final Map<String, Rectangle> hoverMap = new HashMap<>();
|
||||
|
||||
public static String getVersion() {
|
||||
return VERSION;
|
||||
@ -114,4 +123,40 @@ public class Util {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Rectangle getHoverEntry(String name) {
|
||||
return hoverMap.get(name);
|
||||
}
|
||||
|
||||
public static void addHoverEntry(String name, Rectangle dest) {
|
||||
hoverMap.putIfAbsent(name, dest);
|
||||
}
|
||||
|
||||
public static void addHoverEntry(String name, Tile dest, boolean minimap) {
|
||||
Rectangle rect;
|
||||
|
||||
if (minimap) {
|
||||
MiniMapTileDestination td = new MiniMapTileDestination(dest);
|
||||
rect = td.getBoundingBox();
|
||||
} else {
|
||||
rect = dest.getTileReference().getBoundaryObject().getBoundingBox();
|
||||
}
|
||||
|
||||
addHoverEntry(name, rect);
|
||||
}
|
||||
|
||||
public static void addHoverEntry(String name, Tile dest) {
|
||||
addHoverEntry(name, dest, false);
|
||||
}
|
||||
|
||||
public static void addHoverEntry(String name, Entity dest) {
|
||||
addHoverEntry(name, dest.getBoundingBox());
|
||||
}
|
||||
|
||||
public static void hover(String name) {
|
||||
Rectangle dest = getHoverEntry(name);
|
||||
if (dest != null) {
|
||||
Mouse.move(dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user