public static Position pos = new Position(3018, 5013, 0);
public void grabWine() {
if ((System.currentTimeMillis() - wineTimer) > 3000) {
if (getMagic().isSpellSelected()) {
GroundItem wine = getGroundItems().closest("Wine of zamorak");
if (wine != null && wine.isVisible()) {
winePosition = wine.getPosition();
if (wine.interact("Cast")) {
wineTimer = System.currentTimeMillis();
amountOfWines++;
}
} else if (winePosition.isVisible(getBot())) {
Rectangle rect = pos.getPolygon(getBot()).getBounds();
getMouse().move(rect.x + (rect.width / 2), rect.y);
} else {
log("Moving camera to wine");
getCamera().toEntity(wine);
}
} else {
log("Spell not selected, Select telegrab");
getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB);
}
} else {
if (getMagic().isSpellSelected()) {
GroundItem wine = getGroundItems().closest("Wine of zamorak");
if (wine != null && wine.isVisible()) {
winePosition = wine.getPosition();
log("Wine is visible and spell selected");
} else if (winePosition.isVisible(getBot())) {
Rectangle rect = pos.getPolygon(getBot()).getBounds();
getMouse().move(rect.x + (rect.width / 2), rect.y);
} else {
log("Moving camera to wine");
getCamera().toEntity(wine);
}
} else if (!getMagic().isSpellSelected()) {
log("Spell not selected, Select telegrab");
getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB);
}
}
}
Hi guys, Trying to hover over a table item. However, with the code above hovers on the tile below the table as the wine is considered a ground item. Any way around this? Thanks for any help