botutils: mouse clicks now assert not on client thread. Added a delayed mouse click and implemented a handleMouseClick() that will click a point if it is within the viewport, otherwise clicks a random point in the center screen. Executor now sits within botUtils and injects the client executor.

allplugins: updated to utilise the mouse changes in bot utils.
Banks: Removed some IDs that weren't immediately accessible around Varrock West Bank
Powerskiller: add option to logout when missing required items
This commit is contained in:
illumineawake 2020-07-29 19:09:30 +10:00
parent 3c34fce993
commit 1f74f05043
27 changed files with 374 additions and 317 deletions

View File

@ -25,7 +25,7 @@ import ProjectVersions.openosrsVersion
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "3.0.0"
version = "3.1.0"
project.extra["PluginName"] = "BotUtils"
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"

View File

@ -2,6 +2,7 @@ package net.runelite.client.plugins.botutils;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import static net.runelite.api.NullObjectID.NULL_34810;
import net.runelite.api.ObjectID;
public class Banks
@ -12,7 +13,6 @@ public class Banks
ObjectID.BANK_BOOTH_10357,
ObjectID.BANK_BOOTH_10517,
ObjectID.BANK_CHEST_10562,
ObjectID.BANK_BOOTH_10583,
ObjectID.BANK_BOOTH_10584,
ObjectID.BANK,
ObjectID.BANK_BOOTH_11338,
@ -31,6 +31,7 @@ public class Banks
ObjectID.BANK_BOOTH_20328,
ObjectID.BANK_CHEST_21301,
ObjectID.BANK_BOOTH_22819,
NULL_34810,
ObjectID.BANK_BOOTH_24101,
ObjectID.BANK_BOOTH_24347,
ObjectID.BANK_BOOTH_25808,
@ -78,7 +79,7 @@ public class Banks
ObjectID.BANK_BOX,
ObjectID.BANK_BOX_31949,
ObjectID.BANK_CHEST_34343,
ObjectID.BANK_DEPOSIT_BOX,
ObjectID.BANK_DEPOSIT_BOX, //Varrock West Bank Deposit Box
ObjectID.BANK_DEPOSIT_CHEST,
ObjectID.BANK_DEPOSIT_BOX_25937,
ObjectID.BANK_DEPOSIT_BOX_26254,
@ -102,7 +103,6 @@ public class Banks
ObjectID.BANK_BOOTH_10357,
ObjectID.BANK_BOOTH_10517,
ObjectID.BANK_CHEST_10562,
ObjectID.BANK_BOOTH_10583,
ObjectID.BANK_BOOTH_10584,
ObjectID.BANK,
ObjectID.BANK_BOOTH_11338,
@ -121,6 +121,7 @@ public class Banks
ObjectID.BANK_BOOTH_20328,
ObjectID.BANK_CHEST_21301,
ObjectID.BANK_BOOTH_22819,
NULL_34810,
ObjectID.BANK_BOOTH_24101,
ObjectID.BANK_BOOTH_24347,
ObjectID.BANK_BOOTH_25808,
@ -171,7 +172,7 @@ public class Banks
ObjectID.BANK_BOX,
ObjectID.BANK_BOX_31949,
ObjectID.BANK_CHEST_34343,
ObjectID.BANK_DEPOSIT_BOX,
ObjectID.BANK_DEPOSIT_BOX, //Varrock West Bank Deposit Box
ObjectID.BANK_DEPOSIT_CHEST,
ObjectID.BANK_DEPOSIT_BOX_25937,
ObjectID.BANK_DEPOSIT_BOX_26254,

View File

@ -12,7 +12,9 @@ import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
@ -97,9 +99,11 @@ public class BotUtils extends Plugin
@Inject
private OSBGrandExchangeClient osbGrandExchangeClient;
@Inject
ExecutorService executorService;
MenuEntry targetMenu;
protected static final java.util.Random random = new java.util.Random();
ExecutorService executorService;
private OSBGrandExchangeResult osbGrandExchangeResult;
public boolean randomEvent;
@ -590,14 +594,15 @@ public class BotUtils extends Plugin
*/
public void click(Rectangle rectangle)
{
//assert !client.isClientThread();
assert !client.isClientThread();
Point point = getClickPoint(rectangle);
click(point);
}
public void click(Point p)
{
//assert !client.isClientThread();
assert !client.isClientThread();
if (client.isStretchedEnabled())
{
@ -618,14 +623,15 @@ public class BotUtils extends Plugin
public void moveClick(Rectangle rectangle)
{
//assert !client.isClientThread();
assert !client.isClientThread();
Point point = getClickPoint(rectangle);
moveClick(point);
}
public void moveClick(Point p)
{
//assert !client.isClientThread();
assert !client.isClientThread();
if (client.isStretchedEnabled())
{
@ -660,14 +666,15 @@ public class BotUtils extends Plugin
public void moveMouseEvent(Rectangle rectangle)
{
//assert !client.isClientThread();
assert !client.isClientThread();
Point point = getClickPoint(rectangle);
moveClick(point);
}
public void moveMouseEvent(Point p)
{
//assert !client.isClientThread();
assert !client.isClientThread();
if (client.isStretchedEnabled())
{
@ -705,14 +712,84 @@ public class BotUtils extends Plugin
public void clickRandomPoint(int min, int max)
{
assert !client.isClientThread();
Point point = new Point(getRandomIntBetweenRange(min, max), getRandomIntBetweenRange(min, max));
click(point);
}
public void clickRandomPointCenter(int min, int max)
{
assert !client.isClientThread();
Point point = new Point(client.getCenterX() + getRandomIntBetweenRange(min, max), client.getCenterY() + getRandomIntBetweenRange(min, max));
click(point);
moveClick(point);
}
public void delayClickRandomPointCenter(int min, int max, long delay)
{
executorService.submit(() ->
{
try
{
sleep(delay);
clickRandomPointCenter(min, max);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
/*
*
* if given Point is in the viewport, click on the Point otherwise click a random point in the centre of the screen
*
* */
public void handleMouseClick(Point point)
{
assert !client.isClientThread();
final int viewportHeight = client.getViewportHeight();
final int viewportWidth = client.getViewportWidth();
if (point.getX() > viewportWidth || point.getY() > viewportHeight || point.getX() < 0 || point.getY() < 0)
{
clickRandomPointCenter(-200, 200);
return;
}
moveClick(point);
}
public void handleMouseClick(Rectangle rectangle)
{
assert !client.isClientThread();
Point point = getClickPoint(rectangle);
handleMouseClick(point);
}
public void delayMouseClick(Point point, long delay)
{
executorService.submit(() ->
{
try
{
sleep(delay);
handleMouseClick(point);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
public void delayMouseClick(Rectangle rectangle, long delay)
{
Point point = getClickPoint(rectangle);
delayMouseClick(point, delay);
}
/**
@ -752,6 +829,8 @@ public class BotUtils extends Plugin
//enables run if below given minimum energy with random positive variation
public void handleRun(int minEnergy, int randMax)
{
assert client.isClientThread();
if (client.getEnergy() > (minEnergy + getRandomIntBetweenRange(0, randMax)) ||
client.getVar(Varbits.RUN_SLOWED_DEPLETION_ACTIVE) != 0)
{
@ -761,16 +840,23 @@ public class BotUtils extends Plugin
}
if (!isRunEnabled())
{
enableRun();
Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_RUN_ORB);
if (runOrb != null)
{
enableRun(runOrb.getBounds());
}
}
}
}
public void enableRun()
public void enableRun(Rectangle runOrbBounds)
{
log.info("enabling run");
targetMenu = new MenuEntry("Toggle Run", "", 1, 57, -1, 10485782, false);
clickRandomPointCenter(-100, 100);
executorService.submit(() ->
{
targetMenu = new MenuEntry("Toggle Run", "", 1, 57, -1, 10485782, false);
delayMouseClick(runOrbBounds, getRandomIntBetweenRange(10, 250));
});
}
//Checks if Stamina enhancement is active and if stamina potion is in inventory
@ -794,7 +880,7 @@ public class BotUtils extends Plugin
{
log.info("using stamina potion");
targetMenu = new MenuEntry("", "", staminaPotion.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), staminaPotion.getIndex(), 9764864, false);
clickRandomPointCenter(-100, 100);
delayMouseClick(staminaPotion.getCanvasBounds(), getRandomIntBetweenRange(5, 200));
return true;
}
return false;
@ -803,7 +889,15 @@ public class BotUtils extends Plugin
public void logout()
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 11927560, false);
clickRandomPointCenter(-100, 100);
Widget logoutWidget = client.getWidget(WidgetInfo.LOGOUT_BUTTON);
if (logoutWidget != null)
{
delayMouseClick(logoutWidget.getBounds(), getRandomIntBetweenRange(5, 200));
}
else
{
executorService.submit(() -> clickRandomPointCenter(-200, 200));
}
}
/**
@ -863,6 +957,25 @@ public class BotUtils extends Plugin
return null;
}
public Collection<Integer> getAllInventoryItemIDs()
{
Collection<WidgetItem> inventoryItems = getAllInventoryItems();
if (inventoryItems != null)
{
Set<Integer> inventoryIDs = new HashSet<>();
for (WidgetItem item : inventoryItems)
{
if (inventoryIDs.contains(item.getId()))
{
continue;
}
inventoryIDs.add(item.getId());
}
return inventoryIDs;
}
return null;
}
public WidgetItem getInventoryWidgetItem(int id)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
@ -897,29 +1010,7 @@ public class BotUtils extends Plugin
return null;
}
public MenuEntry getInventoryItemMenu(ItemManager itemManager, String menuOption, int opcode)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (inventoryWidget != null)
{
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
for (WidgetItem item : items)
{
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
for (String action : menuActions)
{
if (action != null && action.equals(menuOption))
{
MenuEntry menuEntry = new MenuEntry("", "", item.getId(), opcode, item.getIndex(), 9764864, false);
return menuEntry;
}
}
}
}
return null;
}
public MenuEntry getInventoryItemMenu(ItemManager itemManager, String menuOption, int opcode, Collection<Integer> ignoreIDs)
public WidgetItem getInventoryItemMenu(ItemManager itemManager, String menuOption, int opcode, Collection<Integer> ignoreIDs)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (inventoryWidget != null)
@ -928,14 +1019,15 @@ public class BotUtils extends Plugin
for (WidgetItem item : items)
{
if (ignoreIDs.contains(item.getId()))
{
continue;
}
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
for (String action : menuActions)
{
if (action != null && action.equals(menuOption))
{
MenuEntry menuEntry = new MenuEntry("", "", item.getId(), opcode, item.getIndex(), 9764864, false);
return menuEntry;
return item;
}
}
}
@ -1075,6 +1167,14 @@ public class BotUtils extends Plugin
return false;
}
public void dropItem(WidgetItem item)
{
assert !client.isClientThread();
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false);
moveClick(item.getCanvasBounds());
}
public void dropItems(Collection<Integer> ids, boolean dropAll, int minDelayBetween, int maxDelayBetween)
{
if (isBankOpen() || isDepositBoxOpen())
@ -1094,10 +1194,11 @@ public class BotUtils extends Plugin
{
log.info("dropping item: " + item.getId());
sleep(minDelayBetween, maxDelayBetween);
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false);
clickRandomPointCenter(-100, 100);
dropItem(item);
if (!dropAll)
{
break;
}
}
}
iterating = false;
@ -1125,16 +1226,17 @@ public class BotUtils extends Plugin
iterating = true;
for (WidgetItem item : inventoryItems)
{
if (ids.contains(item.getId())) //6512 is empty widget slot
if (ids.contains(item.getId()))
{
log.info("not dropping item: " + item.getId());
continue;
}
sleep(minDelayBetween, maxDelayBetween);
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false);
clickRandomPointCenter(-100, 100);
dropItem(item);
if (!dropAll)
break;
{
break;
}
}
iterating = false;
}
@ -1153,29 +1255,8 @@ public class BotUtils extends Plugin
log.info("can't drop item, bank is open");
return;
}
Collection<WidgetItem> inventoryItems = getAllInventoryItems();
executorService.submit(() ->
{
try
{
iterating = true;
for (WidgetItem item : inventoryItems)
{
log.info("dropping item: " + item.getId());
sleep(minDelayBetween, maxDelayBetween);
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false);
clickRandomPointCenter(-100, 100);
if (!dropAll)
break;
}
iterating = false;
}
catch (Exception e)
{
iterating = false;
e.printStackTrace();
}
});
Collection<Integer> inventoryItems = getAllInventoryItemIDs();
dropItems(inventoryItems, dropAll, minDelayBetween, maxDelayBetween);
}
/**
@ -1199,7 +1280,13 @@ public class BotUtils extends Plugin
return;
}
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), 11, 786434, false); //close bank
clickRandomPointCenter(-100, 100);
Widget bankCloseWidget = client.getWidget(WidgetInfo.BANK_PIN_EXIT_BUTTON);
if (bankCloseWidget != null)
{
executorService.submit(() -> handleMouseClick(bankCloseWidget.getBounds()));
return;
}
clickRandomPointCenter(-200, 200);
}
public int getBankMenuOpcode(int bankID)
@ -1347,17 +1434,26 @@ public class BotUtils extends Plugin
{
return;
}
if (isDepositBoxOpen())
executorService.submit(() ->
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 12582916, false); //deposit all in bank interface
clickRandomPointCenter(-100, 100);
return;
}
else
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 786473, false); //deposit all in bank interface
clickRandomPointCenter(-100, 100);
}
Widget depositInventoryWidget = client.getWidget(WidgetInfo.BANK_DEPOSIT_INVENTORY);
if (isDepositBoxOpen())
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 12582916, false); //deposit all in bank interface
}
else
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 786473, false); //deposit all in bank interface
}
if ((depositInventoryWidget != null))
{
handleMouseClick(depositInventoryWidget.getBounds());
}
else
{
clickRandomPointCenter(-200, 200);
}
});
}
public void depositAllExcept(Collection<Integer> ids)
@ -1378,8 +1474,8 @@ public class BotUtils extends Plugin
if (!ids.contains(item.getId()) && item.getId() != 6512 && !depositedItems.contains(item.getId())) //6512 is empty widget slot
{
log.info("depositing item: " + item.getId());
depositAllOfItem(item.getId());
sleep(80, 170);
depositAllOfItem(item);
sleep(80, 200);
depositedItems.add(item.getId());
}
}
@ -1394,21 +1490,10 @@ public class BotUtils extends Plugin
});
}
/*public void depositAllOfItem(WidgetItem itemWidget)
public void depositAllOfItem(WidgetItem item)
{
if (!isBankOpen() && !isDepositBoxOpen())
{
return;
}
boolean depositBox = isDepositBoxOpen();
targetMenu = new MenuEntry("", "", (depositBox) ? 1 : 2, MenuOpcode.CC_OP.getId(), itemWidget.getIndex(),
(depositBox) ? 12582914 : 983043, false);
clickRandomPointCenter(-100, 100);
}*/
assert !client.isClientThread();
public void depositAllOfItem(int itemID)
{
WidgetItem item = getInventoryWidgetItem(itemID);
if (!isBankOpen() && !isDepositBoxOpen())
{
return;
@ -1416,7 +1501,7 @@ public class BotUtils extends Plugin
boolean depositBox = isDepositBoxOpen();
targetMenu = new MenuEntry("", "", (depositBox) ? 1 : 2, MenuOpcode.CC_OP.getId(), item.getIndex(),
(depositBox) ? 12582914 : 983043, false);
clickRandomPointCenter(-100, 100);
moveClick(item.getCanvasBounds());
}
public void depositAllOfItems(Collection<Integer> itemIDs)
@ -1437,7 +1522,7 @@ public class BotUtils extends Plugin
if (itemIDs.contains(item.getId()) && !depositedItems.contains(item.getId())) //6512 is empty widget slot
{
log.info("depositing item: " + item.getId());
depositAllOfItem(item.getId());
depositAllOfItem(item);
sleep(80, 170);
depositedItems.add(item.getId());
}
@ -1455,8 +1540,11 @@ public class BotUtils extends Plugin
public void withdrawAllItem(Widget bankItemWidget)
{
targetMenu = new MenuEntry("Withdraw-All", "", 1, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
clickRandomPointCenter(-100, 100);
executorService.submit(() ->
{
targetMenu = new MenuEntry("Withdraw-All", "", 1, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
clickRandomPointCenter(-200, 200);
});
}
public void withdrawAllItem(int bankItemID)
@ -1464,8 +1552,7 @@ public class BotUtils extends Plugin
Widget item = getBankItemWidget(bankItemID);
if (item != null)
{
targetMenu = new MenuEntry("Withdraw-All", "", 1, MenuOpcode.CC_OP.getId(), item.getIndex(), 786444, false);
clickRandomPointCenter(-100, 100);
withdrawAllItem(item);
}
else
{
@ -1475,8 +1562,11 @@ public class BotUtils extends Plugin
public void withdrawItem(Widget bankItemWidget)
{
targetMenu = new MenuEntry("", "", 2, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
clickRandomPointCenter(-100, 100);
executorService.submit(() ->
{
targetMenu = new MenuEntry("", "", 2, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
clickRandomPointCenter(-200, 200);
});
}
public void withdrawItem(int bankItemID)
@ -1484,8 +1574,7 @@ public class BotUtils extends Plugin
Widget item = getBankItemWidget(bankItemID);
if (item != null)
{
targetMenu = new MenuEntry("", "", 2, MenuOpcode.CC_OP.getId(), item.getIndex(), 786444, false);
clickRandomPointCenter(-100, 100);
withdrawItem(item);
}
}
@ -1668,5 +1757,4 @@ public class BotUtils extends Plugin
}
targetMenu = null;
}
}

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "1.0.3"
version = "1.1.0"
project.extra["PluginName"] = "Combination Runecrafter Plugin"
project.extra["PluginDescription"] = "Illumine - Combination Runecrafting plugin"

View File

@ -31,8 +31,6 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@ -50,6 +48,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@ -94,9 +93,6 @@ public class CombinationRunecrafterPlugin extends Plugin
@Inject
private CombinationRunecrafterOverlay overlay;
@Inject
ExecutorService executorService;
MenuEntry targetMenu;
Instant botTimer;
Player player;
@ -114,6 +110,7 @@ public class CombinationRunecrafterPlugin extends Plugin
Set<Integer> DUEL_RINGS = Set.of(ItemID.RING_OF_DUELING2, ItemID.RING_OF_DUELING3, ItemID.RING_OF_DUELING4, ItemID.RING_OF_DUELING5, ItemID.RING_OF_DUELING6, ItemID.RING_OF_DUELING7, ItemID.RING_OF_DUELING8);
Set<Integer> BINDING_NECKLACE = Set.of(ItemID.BINDING_NECKLACE);
Set<Integer> STAMINA_POTIONS = Set.of(ItemID.STAMINA_POTION1, ItemID.STAMINA_POTION2, ItemID.STAMINA_POTION3, ItemID.STAMINA_POTION4);
Set<Integer> TIARAS = Set.of(ItemID.FIRE_TIARA);
List<Integer> REQUIRED_ITEMS = new ArrayList<>();
boolean startBot;
@ -180,32 +177,30 @@ public class CombinationRunecrafterPlugin extends Plugin
return;
}
log.info("button {} pressed!", configButtonClicked.getKey());
switch (configButtonClicked.getKey())
if (configButtonClicked.getKey().equals("startButton"))
{
case "startButton":
if (!startBot)
{
startBot = true;
botTimer = Instant.now();
initCounters();
state = null;
necklaceState = null;
targetMenu = null;
setTalisman = false;
createdRuneTypeID = config.getRunecraftingType().getCreatedRuneID();
talismanID = config.getRunecraftingType().getTalismanID();
materialRuneID = config.getRunecraftingType().getMaterialRuneID();
essenceTypeID = config.getEssence().getId();
REQUIRED_ITEMS = List.of(talismanID, materialRuneID, essenceTypeID);
updatePrices();
botTimer = Instant.now();
overlayManager.add(overlay);
}
else
{
shutDown();
}
break;
if (!startBot)
{
startBot = true;
botTimer = Instant.now();
initCounters();
state = null;
necklaceState = null;
targetMenu = null;
setTalisman = false;
createdRuneTypeID = config.getRunecraftingType().getCreatedRuneID();
talismanID = config.getRunecraftingType().getTalismanID();
materialRuneID = config.getRunecraftingType().getMaterialRuneID();
essenceTypeID = config.getEssence().getId();
REQUIRED_ITEMS = List.of(talismanID, materialRuneID, essenceTypeID);
updatePrices();
botTimer = Instant.now();
overlayManager.add(overlay);
}
else
{
shutDown();
}
}
}
@ -325,11 +320,9 @@ public class CombinationRunecrafterPlugin extends Plugin
return 0;
}
private void sleepDelay()
private long sleepDelay()
{
sleepLength = utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
log.info("Sleeping for {}ms", sleepLength);
utils.sleep(sleepLength);
return utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
}
private int tickDelay()
@ -339,33 +332,18 @@ public class CombinationRunecrafterPlugin extends Plugin
return tickLength;
}
private void handleMouseClick()
private void teleportRingOfDueling(int menuIdentifier)
{
executorService.submit(() ->
targetMenu = new MenuEntry("", "", menuIdentifier, MenuOpcode.CC_OP.getId(), -1,
25362455, false);
Widget ringWidget = client.getWidget(WidgetInfo.EQUIPMENT_RING);
if (ringWidget != null)
{
try
{
sleepDelay();
utils.clickRandomPointCenter(-100, 100);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
private void teleportCastleWars()
{
if (utils.isItemEquipped(DUEL_RINGS) || utils.isItemEquipped(Set.of(ItemID.RING_OF_DUELING1)))
{
targetMenu = new MenuEntry("", "", 3, MenuOpcode.CC_OP.getId(), -1,
25362455, false);
handleMouseClick();
utils.delayMouseClick(ringWidget.getBounds(), sleepDelay());
}
else
{
log.info("Need to teleport but don't have a ring of dueling");
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
}
}
@ -427,7 +405,11 @@ public class CombinationRunecrafterPlugin extends Plugin
utils.handleRun(20, 30);
return MOVING;
}
if (!utils.isItemEquipped(TIARAS))
{
utils.sendGameMessage("Fire Tiara not equipped. Stopping.");
return OUT_OF_ITEM;
}
mysteriousRuins = utils.findNearestGameObject(34817); //Mysterious Ruins
fireAltar = utils.findNearestGameObject(ObjectID.ALTAR_34764);
bankChest = utils.findNearestGameObject(ObjectID.BANK_CHEST_4483);
@ -537,37 +519,35 @@ public class CombinationRunecrafterPlugin extends Plugin
case ENTER_MYSTERIOUS_RUINS:
targetMenu = new MenuEntry("", "", 34817, MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(),
mysteriousRuins.getSceneMinLocation().getX(), mysteriousRuins.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(mysteriousRuins.getConvexHull().getBounds(), sleepDelay());
timeout = tickDelay();
break;
case TELEPORT_CASTLE_WARS:
teleportCastleWars();
teleportRingOfDueling(3);
timeout = tickDelay();
break;
case SET_TALISMAN:
WidgetItem airTalisman = utils.getInventoryWidgetItem(talismanID);
targetMenu = new MenuEntry("Use", "Use", talismanID, MenuOpcode.ITEM_USE.getId(),
airTalisman.getIndex(), 9764864, false);
handleMouseClick();
utils.delayMouseClick(airTalisman.getCanvasBounds(), sleepDelay());
setTalisman = true;
break;
case USE_FIRE_ALTAR:
targetMenu = new MenuEntry("Use", "<col=ff9040>Air talisman<col=ffffff> -> <col=ffff>Altar",
fireAltar.getId(), MenuOpcode.ITEM_USE_ON_GAME_OBJECT.getId(), fireAltar.getSceneMinLocation().getX(),
fireAltar.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(fireAltar.getConvexHull().getBounds(), sleepDelay());
timeout = tickDelay();
break;
case OPEN_BANK:
targetMenu = new MenuEntry("", "", bankChest.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(),
bankChest.getSceneMinLocation().getX(), bankChest.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(bankChest.getConvexHull().getBounds(), sleepDelay());
timeout = tickDelay();
break;
case TELEPORT_DUEL_ARENA:
targetMenu = new MenuEntry("", "", 2, MenuOpcode.CC_OP.getId(), -1,
25362455, false);
handleMouseClick();
teleportRingOfDueling(2);
timeout = tickDelay();
break;
case DEPOSIT_ALL:
@ -585,7 +565,7 @@ public class CombinationRunecrafterPlugin extends Plugin
}
targetMenu = new MenuEntry("", "", 9, MenuOpcode.CC_OP_LOW_PRIORITY.getId(),
useableItem.getIndex(), 983043, false);
handleMouseClick();
utils.delayMouseClick(useableItem.getCanvasBounds(), sleepDelay());
}
break;
case WITHDRAW_ITEM:
@ -601,6 +581,7 @@ public class CombinationRunecrafterPlugin extends Plugin
utils.logout();
}
startBot = false;
shutDown();
break;
}
beforeLoc = player.getLocalLocation();

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "1.9.5"
version = "2.0.0"
project.extra["PluginName"] = "Magic Splasher"
project.extra["PluginDescription"] = "Illumine automated magic splasher"

View File

@ -27,7 +27,6 @@ package net.runelite.client.plugins.magicsplasher;
import com.google.inject.Provides;
import java.time.Instant;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Inject;
@ -47,6 +46,8 @@ import net.runelite.api.events.ConfigButtonClicked;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.queries.NPCQuery;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@ -100,7 +101,6 @@ public class MagicSplasherPlugin extends Plugin
Player player;
NPC splashNPC;
WidgetItem targetItem;
ExecutorService executorService;
int npcID = -1;
int itemID = -1;
@ -121,8 +121,6 @@ public class MagicSplasherPlugin extends Plugin
@Override
protected void shutDown()
{
if (executorService != null)
executorService.shutdown();
overlayManager.remove(overlay);
startSplasher = false;
selectedSpell = null;
@ -156,7 +154,6 @@ public class MagicSplasherPlugin extends Plugin
botTimer = Instant.now();
state = null;
targetMenu = null;
executorService = Executors.newSingleThreadExecutor();
botTimer = Instant.now();
initVals();
overlayManager.add(overlay);
@ -205,11 +202,9 @@ public class MagicSplasherPlugin extends Plugin
}
}
private void sleepDelay()
private long sleepDelay()
{
sleepLength = utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
log.debug("Sleeping for {}ms", sleepLength);
utils.sleep(sleepLength);
return utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
}
private int tickDelay()
@ -219,26 +214,18 @@ public class MagicSplasherPlugin extends Plugin
return tickLength;
}
private void handleMouseClick()
{
executorService.submit(() ->
{
try
{
sleepDelay();
utils.clickRandomPointCenter(-100, 100);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
private void openSpellBook()
{
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 10551356, false); //open spellbook
handleMouseClick();
Widget spellBookWidget = client.getWidget(WidgetInfo.SPELLBOOK);
if (spellBookWidget != null)
{
utils.delayMouseClick(spellBookWidget.getBounds(), sleepDelay());
}
else
{
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
}
}
private NPC findNPC()
@ -275,7 +262,7 @@ public class MagicSplasherPlugin extends Plugin
timeout = 5 + tickDelay();
break;
}
handleMouseClick();
utils.delayMouseClick(splashNPC.getConvexHull().getBounds(), sleepDelay());
}
public MagicSplasherState getState()
@ -399,10 +386,7 @@ public class MagicSplasherPlugin extends Plugin
startSplasher = false;
if (config.logout())
{
executorService.submit(() ->
{
utils.logout();
});
}
return;
}

View File

@ -1 +1 @@
[{"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"BotUtils","description":"Illumine - Utils required for plugins to function with added automation","id":"botutils-plugin","releases":[{"date":"2020-07-27","sha512sum":"11B62D7C45836DC10CB66E1100AAA0183A22D2C07E73E56D70C08389B9BA80B1C87C7D305931FFFECFFD1CE5657B559152105DBC91C208807EACEDE869A0030D","version":"3.0.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-3.0.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Combination Runecrafter Plugin","description":"Illumine - Combination Runecrafting plugin","id":"combinationrunecrafterplugin-plugin","releases":[{"date":"2020-07-27","sha512sum":"2F0F1289799517C95EA6A3DB6F3EA088F0AB9A560A286EF841AEB92D26A393E23242DED3068309CC2FEEFFDEFB3021F3EB4671BCF23669E224396903C07EB2D3","version":"1.0.3","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.0.3.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Magic Splasher","description":"Illumine automated magic splasher","id":"magicsplasher-plugin","releases":[{"date":"2020-07-27","sha512sum":"9552353CF2934BB960936994AC7D616B132FEB81B5E54DC180BE45A05DCF059347F3FD4E4FBB90EA1036E26AFD0911EEF30B011149525A14B37C64B60E23F5F9","version":"1.9.5","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-1.9.5.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Power Skiller","description":"Illumine auto power skiller plugin","id":"powerskiller-plugin","releases":[{"date":"2020-07-27","sha512sum":"699582FD9FFEC687CBE6C94C719D5DE6F95B85172FF77EF268D63DC0752992248E3A01C01E63C30589F5318948334B6055A3687E1C6DB6FDD54ECD27D7E650D2","version":"3.4.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-3.4.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Quick Eater","description":"Illumine - auto eat food below configured HP","id":"quickeater-plugin","releases":[{"date":"2020-07-27","sha512sum":"A13C2B4EF80BD5E48D202566F6C1E44E41C2540D315F6CE3372AF09024975427C4F2615A3B437CC5A57F438919E2969264E796DF7391978CFED3EB6874D2BE4E","version":"1.9.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-1.9.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Rooftop Agility","description":"Illumine automated rooftop agility plugin","id":"rooftopagility-plugin","releases":[{"date":"2020-07-27","sha512sum":"A0A2DED3B7C1A37DCAC862F47B2DCA4C5D22B29F1B302E7B85F1AED9C9001C9A901E8C386B4665AE1FC890EB5A8A2DE3A92F679DC99998F365FDECA3CBDFDF40","version":"2.8.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-2.8.0.jar?raw=true","requires":"0.0.1"}]}]
[{"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"BotUtils","description":"Illumine - Utils required for plugins to function with added automation","id":"botutils-plugin","releases":[{"date":"2020-07-29","sha512sum":"A3B9EA93A56AA7BD40188601B159EBDA981FBE2F17A7C336D39955709077A336608F765023A7FEB3234BC6FEACC3AA5580C758A6B790A5F3551A822CFBDDF2CB","version":"3.1.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-3.1.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Combination Runecrafter Plugin","description":"Illumine - Combination Runecrafting plugin","id":"combinationrunecrafterplugin-plugin","releases":[{"date":"2020-07-29","sha512sum":"FE90ABCEC3100D97DB79C10D794F46F2BB1E82E06138469B1BF569FA499898FC71E6086EBE4D2D42215DA16326F0FA79FD80446AA2E25575E6D74930212D7EC6","version":"1.1.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.1.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Magic Splasher","description":"Illumine automated magic splasher","id":"magicsplasher-plugin","releases":[{"date":"2020-07-29","sha512sum":"321D2548E4F5769397FEEF4508A0B50814512487A92AB63938636CDD6BBE5900BA6238148B5A024D7877A49563368E9368B931D29C67C8DAB13A58D58CA421F4","version":"2.0.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-2.0.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Power Skiller","description":"Illumine auto power skiller plugin","id":"powerskiller-plugin","releases":[{"date":"2020-07-29","sha512sum":"E12D4BED034D1E5A95C3F1B02927E879ACA2C5CD52E626DA02BBF83414B141E03C7DB9FC8E199862FC315CDBBE9F261104225A12AF6EFE3F771CD4C5CA457DCD","version":"3.5.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-3.5.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Quick Eater","description":"Illumine - auto eat food below configured HP","id":"quickeater-plugin","releases":[{"date":"2020-07-29","sha512sum":"34F7EF109BF3EFD92CB5A1FB158F38D3CF7CD296E9566D04D02C180B405EFD475F6C9D16B4D83398D49D93B4D700DA5E1537936DB993A2C2BDAD3D948A078088","version":"2.0.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-2.0.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/YUHHsE","provider":"illumine","name":"Rooftop Agility","description":"Illumine automated rooftop agility plugin","id":"rooftopagility-plugin","releases":[{"date":"2020-07-29","sha512sum":"515D0AF1FDCCD0982703D04DFE61B0E49972DE64B5C9E543F614FE2776364259AAF96876092ACF1118D6DDC4AA554BE5D3D2252E2D25DA98A68A77E6A7DCA144","version":"2.9.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-2.9.0.jar?raw=true","requires":"0.0.1"}]}]

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "3.4.0"
version = "3.5.0"
project.extra["PluginName"] = "Power Skiller"
project.extra["PluginDescription"] = "Illumine auto power skiller plugin"

View File

@ -306,6 +306,18 @@ public interface PowerSkillerConfiguration extends Config
return "";
}
@ConfigItem(
keyName = "logout",
name = "Logout when out of required IDs",
description = "Bot will logout if required items are not in inventory, e.g. fishing bait.",
position = 101,
hide = "dropInventory"
)
default boolean logout()
{
return true;
}
@ConfigItem(
keyName = "items",
name = "Item IDs to drop/not drop or Bank",

View File

@ -28,10 +28,7 @@ package net.runelite.client.plugins.powerskiller;
import com.google.inject.Provides;
import java.time.Instant;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@ -45,8 +42,12 @@ import net.runelite.api.MenuOpcode;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.*;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.ConfigButtonClicked;
import net.runelite.api.events.NpcDefinitionChanged;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
@ -103,7 +104,6 @@ public class PowerSkillerPlugin extends Plugin
LocalPoint beforeLoc;
Player player;
WorldArea DENSE_ESSENCE_AREA = new WorldArea(new WorldPoint(1754, 3845, 0), new WorldPoint(1770, 3862, 0));
private ExecutorService executorService;
int timeout = 0;
long sleepLength;
@ -131,8 +131,6 @@ public class PowerSkillerPlugin extends Plugin
protected void shutDown()
{
overlayManager.remove(overlay);
if (executorService != null)
executorService.shutdown();
state = null;
timeout = 0;
botTimer = null;
@ -161,7 +159,6 @@ public class PowerSkillerPlugin extends Plugin
state = null;
targetMenu = null;
botTimer = Instant.now();
executorService = Executors.newSingleThreadExecutor();
setLocation();
getConfigValues();
overlayManager.add(overlay);
@ -231,11 +228,9 @@ public class PowerSkillerPlugin extends Plugin
}
}
private void sleepDelay()
private long sleepDelay()
{
sleepLength = utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
log.debug("Sleeping for {}ms", sleepLength);
utils.sleep(sleepLength);
return utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
}
private int tickDelay()
@ -245,29 +240,13 @@ public class PowerSkillerPlugin extends Plugin
return tickLength;
}
private void handleMouseClick()
{
executorService.submit(() ->
{
try
{
sleepDelay();
utils.clickRandomPointCenter(-100, 100);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
private void interactNPC()
{
targetNPC = utils.findNearestNpcWithin(skillLocation, config.locationRadius(), objectIds);
if (targetNPC != null)
{
targetMenu = new MenuEntry("", "", targetNPC.getIndex(), MenuOpcode.NPC_FIRST_OPTION.getId(), 0, 0, false);
handleMouseClick();
utils.delayMouseClick(targetNPC.getConvexHull().getBounds(), sleepDelay());
}
else
{
@ -298,7 +277,7 @@ public class PowerSkillerPlugin extends Plugin
{
targetMenu = new MenuEntry("", "", targetObject.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(),
targetObject.getSceneMinLocation().getX(), targetObject.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(targetObject.getConvexHull().getBounds(), sleepDelay());
}
else
{
@ -339,7 +318,7 @@ public class PowerSkillerPlugin extends Plugin
targetMenu = new MenuEntry("", "", bank.getId(),
utils.getBankMenuOpcode(bank.getId()), bank.getSceneMinLocation().getX(),
bank.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(bank.getConvexHull().getBounds(), sleepDelay());
}
else
{
@ -397,7 +376,7 @@ public class PowerSkillerPlugin extends Plugin
if (config.type() == PowerSkillerType.DENSE_ESSENCE)
{
return (DENSE_ESSENCE_AREA.distanceTo(client.getLocalPlayer().getWorldLocation()) == 0) ?
FIND_GAME_OBJECT: WAIT_DENSE_ESSENCE;
FIND_GAME_OBJECT : WAIT_DENSE_ESSENCE;
}
return (config.type() == PowerSkillerType.GAME_OBJECT) ?
FIND_GAME_OBJECT : FIND_NPC;
@ -411,30 +390,30 @@ public class PowerSkillerPlugin extends Plugin
player = client.getLocalPlayer();
if (client != null && player != null && startPowerSkiller && skillLocation != null)
{
utils.handleRun(30, 20);
state = getState();
beforeLoc = player.getLocalLocation();
switch (state)
{
case TIMEOUT:
utils.handleRun(30, 20);
timeout--;
return;
break;
case DROP_ALL:
utils.dropInventory(true,config.sleepMin(), config.sleepMax());
return;
utils.dropInventory(true, config.sleepMin(), config.sleepMax());
break;
case DROP_EXCEPT:
utils.dropAllExcept(itemIds, true, config.sleepMin(), config.sleepMax());
return;
break;
case DROP_ITEMS:
utils.dropItems(itemIds, true, config.sleepMin(), config.sleepMax());
return;
break;
case FIND_GAME_OBJECT:
interactObject();
return;
break;
case FIND_NPC:
interactNPC();
npcMoved = false;
return;
break;
case FIND_BANK:
openBank();
break;
@ -447,22 +426,21 @@ public class PowerSkillerPlugin extends Plugin
case DEPOSIT_ITEMS:
utils.depositAllOfItems(itemIds);
break;
case ANIMATING:
timeout = tickDelay();
return;
case MISSING_ITEMS:
startPowerSkiller = false;
utils.sendGameMessage("Missing required items IDs: " + requiredIds.toString() + " from inventory. Stopping.");
return;
if (config.logout())
{
utils.logout();
}
break;
case ANIMATING:
case MOVING:
timeout = 2 + tickDelay();
return;
utils.handleRun(30, 20);
timeout = tickDelay();
break;
}
}
else
{
return;
}
}
@Subscribe
@ -483,7 +461,7 @@ public class PowerSkillerPlugin extends Plugin
{
log.debug("MenuEntry string event: " + targetMenu.toString());
event.setMenuEntry(targetMenu);
timeout = 2 + tickDelay();
timeout = tickDelay();
targetMenu = null; //this allow the player to interact with the client without their clicks being overridden
}
}
@ -540,7 +518,8 @@ public class PowerSkillerPlugin extends Plugin
{
itemIds.addAll(requiredIds);
}
if (utils.inventoryContainsExcept(itemIds)) {
if (utils.inventoryContainsExcept(itemIds))
{
utils.dropAllExcept(itemIds, false, config.sleepMin(), config.sleepMax());
}
return;

View File

@ -11,7 +11,6 @@ public enum PowerSkillerState
DROP_EXCEPT,
DROP_ITEMS,
FIND_BANK,
FIND_DENSE_ESSENCE,
FIND_GAME_OBJECT,
FIND_NPC,
INVALID_DROP_IDS,

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "1.9.0"
version = "2.0.0"
project.extra["PluginName"] = "Quick Eater"
project.extra["PluginDescription"] = "Illumine - auto eat food below configured HP"

View File

@ -26,7 +26,6 @@
package net.runelite.client.plugins.quickeater;
import com.google.inject.Provides;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
@ -37,11 +36,9 @@ import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.api.TileObject;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.queries.GameObjectQuery;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@ -84,8 +81,7 @@ public class QuickEaterPlugin extends Plugin
MenuEntry targetMenu;
Player player;
private Set<Integer> DRINK_SET = Set.of(ItemID.JUG_OF_WINE, ItemID.SARADOMIN_BREW1, ItemID.SARADOMIN_BREW2,
ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW4);
private Set<Integer> DRINK_SET = Set.of(ItemID.JUG_OF_WINE, ItemID.SARADOMIN_BREW1, ItemID.SARADOMIN_BREW2, ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW4);
private int timeout;
private int drinkEnergy;
@ -142,21 +138,24 @@ public class QuickEaterPlugin extends Plugin
{
return;
}
if (utils.getInventoryItemMenu(itemManager, "Eat", 33,
Set.of(ItemID.DWARVEN_ROCK_CAKE, ItemID.DWARVEN_ROCK_CAKE_7510)) != null)
WidgetItem eatItem = utils.getInventoryItemMenu(itemManager, "Eat", 33,
Set.of(ItemID.DWARVEN_ROCK_CAKE, ItemID.DWARVEN_ROCK_CAKE_7510));
if (eatItem != null)
{
targetMenu = utils.getInventoryItemMenu(itemManager, "Eat", 33);
utils.clickRandomPointCenter(-100, 100);
targetMenu = new MenuEntry("", "", eatItem.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), eatItem.getIndex(),
9764864, false);
utils.delayMouseClick(eatItem.getCanvasBounds(),utils.getRandomIntBetweenRange(5, 300));
return;
}
if (utils.inventoryContains(DRINK_SET))
{
WidgetItem item = utils.getInventoryWidgetItem(DRINK_SET);
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), item.getIndex(), 9764864, false);
utils.clickRandomPointCenter(-100, 100);
WidgetItem drinkItem = utils.getInventoryWidgetItem(DRINK_SET);
targetMenu = new MenuEntry("", "", drinkItem.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), drinkItem.getIndex(),
9764864, false);
utils.delayMouseClick(drinkItem.getCanvasBounds(),utils.getRandomIntBetweenRange(5, 300));
return;
}
utils.sendGameMessage("Health is below theshold but we're out of food");
utils.sendGameMessage("Health is below threshold but we're out of food");
}
@Subscribe

Binary file not shown.

BIN
release/botutils-3.1.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "2.8.0"
version = "2.9.0"
project.extra["PluginName"] = "Rooftop Agility"
project.extra["PluginDescription"] = "Illumine automated rooftop agility plugin"

View File

@ -31,14 +31,33 @@ import java.time.Instant;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.*;
import net.runelite.api.Client;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.*;
import net.runelite.api.DecorativeObject;
import net.runelite.api.events.ConfigButtonClicked;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.ItemDespawned;
import net.runelite.api.events.ItemSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.GameState;
import net.runelite.api.GameObject;
import net.runelite.api.GroundObject;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.api.Tile;
import net.runelite.api.TileItem;
import net.runelite.api.Varbits;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@ -98,7 +117,7 @@ public class RooftopAgilityPlugin extends Plugin
WidgetItem alchItem;
GameObject priffPortal;
Set<Integer> inventoryItems = new HashSet<>();
private ExecutorService executorService;
private final Set<Integer> REGION_IDS = Set.of(9781, 12853, 12597, 12084, 12339, 12338, 10806, 10297, 10553, 13358, 13878, 10547, 13105, 9012, 9013, 12895, 13151);
private final Set<Integer> PORTAL_IDS = Set.of(36241, 36242, 36243, 36244, 36245, 36246);
@ -127,8 +146,6 @@ public class RooftopAgilityPlugin extends Plugin
@Override
protected void shutDown()
{
if (executorService != null)
executorService.shutdown();
overlayManager.remove(overlay);
markOfGraceTile = null;
markOfGrace = null;
@ -164,7 +181,6 @@ public class RooftopAgilityPlugin extends Plugin
startAgility = true;
state = null;
targetMenu = null;
executorService = Executors.newSingleThreadExecutor();
botTimer = Instant.now();
restockBank = config.bankRestock();
inventoryItems.addAll(Set.of(ItemID.NATURE_RUNE, ItemID.MARK_OF_GRACE));
@ -200,11 +216,9 @@ public class RooftopAgilityPlugin extends Plugin
}
}
private void sleepDelay()
private long sleepDelay()
{
sleepLength = utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
log.debug("Sleeping for {}ms", sleepLength);
utils.sleep(sleepLength);
return utils.randomDelay(config.sleepWeightedDistribution(), config.sleepMin(), config.sleepMax(), config.sleepDeviation(), config.sleepTarget());
}
private int tickDelay()
@ -214,22 +228,6 @@ public class RooftopAgilityPlugin extends Plugin
return tickLength;
}
private void handleMouseClick()
{
executorService.submit(() ->
{
try
{
sleepDelay();
utils.clickRandomPointCenter(-100, 100);
}
catch (RuntimeException e)
{
e.printStackTrace();
}
});
}
public long getMarksPH()
{
Duration timeSinceStart = Duration.between(botTimer, Instant.now());
@ -261,7 +259,15 @@ public class RooftopAgilityPlugin extends Plugin
{
targetMenu = new MenuEntry("Cast", "<col=00ff00>High Level Alchemy</col>", 0,
MenuOpcode.WIDGET_TYPE_2.getId(), -1, 14286887, false);
handleMouseClick();
Widget spellWidget = client.getWidget(WidgetInfo.SPELL_HIGH_LEVEL_ALCHEMY);
if (spellWidget != null)
{
utils.delayMouseClick(spellWidget.getBounds(), sleepDelay());
}
else
{
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
}
setHighAlch = true;
}
else
@ -272,7 +278,7 @@ public class RooftopAgilityPlugin extends Plugin
MenuOpcode.ITEM_USE_ON_WIDGET.getId(),
alchItem.getIndex(), 9764864,
false);
handleMouseClick();
utils.delayMouseClick(alchItem.getCanvasBounds(), sleepDelay());
alchTimeout = 4 + tickDelay();
}
}
@ -296,7 +302,7 @@ public class RooftopAgilityPlugin extends Plugin
if (client.getVarbitValue(Varbits.BANK_NOTE_FLAG.getId()) != 1)
{
targetMenu = new MenuEntry("Note", "", 1, MenuOpcode.CC_OP.getId(), -1, 786455, false);
handleMouseClick();
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
return;
}
if ((!utils.bankContains(ItemID.NATURE_RUNE, 1) && !utils.inventoryContains(ItemID.NATURE_RUNE)) ||
@ -349,7 +355,7 @@ public class RooftopAgilityPlugin extends Plugin
targetMenu = new MenuEntry("", "", bankBooth.getId(),
MenuOpcode.GAME_OBJECT_SECOND_OPTION.getId(), bankBooth.getSceneMinLocation().getX(),
bankBooth.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(bankBooth.getConvexHull().getBounds(), sleepDelay());
timeout = tickDelay();
}
}
@ -373,7 +379,7 @@ public class RooftopAgilityPlugin extends Plugin
if (decObstacle != null)
{
targetMenu = new MenuEntry("", "", decObstacle.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(), decObstacle.getLocalLocation().getSceneX(), decObstacle.getLocalLocation().getSceneY(), false);
handleMouseClick();
utils.delayMouseClick(decObstacle.getConvexHull().getBounds(), sleepDelay());
return;
}
}
@ -383,7 +389,7 @@ public class RooftopAgilityPlugin extends Plugin
if (groundObstacle != null)
{
targetMenu = new MenuEntry("", "", groundObstacle.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(), groundObstacle.getLocalLocation().getSceneX(), groundObstacle.getLocalLocation().getSceneY(), false);
handleMouseClick();
utils.delayMouseClick(groundObstacle.getConvexHull().getBounds(), sleepDelay());
return;
}
}
@ -391,7 +397,7 @@ public class RooftopAgilityPlugin extends Plugin
if (objObstacle != null)
{
targetMenu = new MenuEntry("", "", objObstacle.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(), objObstacle.getSceneMinLocation().getX(), objObstacle.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(objObstacle.getConvexHull().getBounds(), sleepDelay());
return;
}
}
@ -520,7 +526,7 @@ public class RooftopAgilityPlugin extends Plugin
case MARK_OF_GRACE:
log.debug("Picking up mark of grace");
targetMenu = new MenuEntry("", "", ItemID.MARK_OF_GRACE, 20, markOfGraceTile.getSceneLocation().getX(), markOfGraceTile.getSceneLocation().getY(), false);
handleMouseClick();
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
break;
case FIND_OBSTACLE:
findObstacle();
@ -536,14 +542,22 @@ public class RooftopAgilityPlugin extends Plugin
case CAST_CAMELOT_TELEPORT:
targetMenu = new MenuEntry("", "", 2, MenuOpcode.CC_OP.getId(), -1,
14286879, false);
handleMouseClick();
Widget spellWidget = client.getWidget(WidgetInfo.SPELL_CAMELOT_TELEPORT);
if (spellWidget != null)
{
utils.delayMouseClick(spellWidget.getBounds(), sleepDelay());
}
else
{
utils.delayClickRandomPointCenter(-200, 200, sleepDelay());
}
timeout = 2 + tickDelay();
break;
case PRIFF_PORTAL:
log.info("Using Priff portal");
targetMenu = new MenuEntry("", "", priffPortal.getId(), MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId(),
priffPortal.getSceneMinLocation().getX(), priffPortal.getSceneMinLocation().getY(), false);
handleMouseClick();
utils.delayMouseClick(priffPortal.getConvexHull().getBounds(), sleepDelay());
break;
}
}