botutils: added set of bank IDs and ignore parameter for return menu action

powerskiller: support for banking at nearest bank
quickeater: now ignores rock cakes and will drink sara brews or jugs of wine
This commit is contained in:
illumineawake 2020-07-22 22:25:54 +10:00
parent e46c360321
commit 92ed3a79a7
15 changed files with 160 additions and 20 deletions

View File

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

View File

@ -405,7 +405,7 @@ public class BotUtils extends Plugin
}
@Nullable
public GameObject findNearestBank(Collection<Integer> bankIDs)
public GameObject findNearestBank()
{
assert client.isClientThread();
@ -932,6 +932,30 @@ public class BotUtils extends Plugin
return null;
}
public MenuEntry getInventoryItemMenu(ItemManager itemManager, String menuOption, int opcode, Collection<Integer> ignoreIDs)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (inventoryWidget != null)
{
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
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 null;
}
public WidgetItem getInventoryWidgetItemMenu(ItemManager itemManager, String menuOption, int opcode)
{
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
@ -1392,6 +1416,40 @@ public class BotUtils extends Plugin
clickRandomPointCenter(-100, 100);
}
public void depositAllOfItems(Collection<Integer> itemIDs)
{
if (!isBankOpen())
{
return;
}
Collection<WidgetItem> inventoryItems = getAllInventoryItems();
List<Integer> depositedItems = new ArrayList<>();
executorService.submit(() ->
{
try
{
iterating = true;
for (WidgetItem item : inventoryItems)
{
if (itemIDs.contains(item.getId()) && !depositedItems.contains(item.getId())) //6512 is empty widget slot
{
log.info("depositing item: " + item.getId());
depositAllOfItem(item);
sleep(80, 170);
depositedItems.add(item.getId());
}
}
iterating = false;
depositedItems.clear();
}
catch (Exception e)
{
iterating = false;
e.printStackTrace();
}
});
}
public void withdrawAllItem(Widget bankItemWidget)
{
targetMenu = new MenuEntry("Withdraw-All", "", 1, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);

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-22","sha512sum":"EC791D781F9EA056FE8B1B25E2905BB44F0D95371779800121CCDF61703EA55A395009D7D8B4D951D78443B9633E406E2EF8C60BE0D4E178D552F5781336508F","version":"2.8.5","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-2.8.5.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-22","sha512sum":"21A41E8B101F34BCF497A73325922142151C4B5A8987FB964ABD5BB89F7CCF0F74A7C5493B03C15DA49BAB57F3648DB7FE27B2919E6E16DE708A15EE01169657","version":"1.0.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.0.1.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-22","sha512sum":"7159B20AD740A3580E7DE5A518DE0E6394258C8185C91F346BD78F47DDE5CBB153A33754B7B9EAD7585FB4A1F98E1F759B4409057EE12EBD9431085621F337FF","version":"1.9.3","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-1.9.3.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-22","sha512sum":"9E3A7C2CC590F7E36DD3B09CE7CEBC58171F1E729170D4E1D5A86A2690E50419708A306DFE1456740AD81C9816745C6397125D65D8B96C07BE8A6956921AF4F2","version":"2.9.3","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-2.9.3.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-22","sha512sum":"299DAF1DB8EEB3F9A8E5033F2228788B3366F5718AD199E299789E51C49D6ACCF604FB07D347ED678D1D3CA2D7A63A4F4D3FA78A1054EBEB831AF4745E20B0F7","version":"1.7.2","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-1.7.2.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-22","sha512sum":"D3454D07E055B6115200D36ADB22202B30BB245080B674E0AB2CF365B40A3B2B207413367C1EEFC11C1B37FCD36494D609DD59B50776437300F5DD2E17A2FAF2","version":"2.6.4","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-2.6.4.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-22","sha512sum":"0ED1238294D1B46055A87EBC4BCEF29609A46D76AFD97B49CA1C90730DF82CF3B25C30BA40869D42675B9D3537A68918C3CC22C48DB9752A6DA344A38E8DAE4D","version":"2.9.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-2.9.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-22","sha512sum":"21A41E8B101F34BCF497A73325922142151C4B5A8987FB964ABD5BB89F7CCF0F74A7C5493B03C15DA49BAB57F3648DB7FE27B2919E6E16DE708A15EE01169657","version":"1.0.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.0.1.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-22","sha512sum":"7159B20AD740A3580E7DE5A518DE0E6394258C8185C91F346BD78F47DDE5CBB153A33754B7B9EAD7585FB4A1F98E1F759B4409057EE12EBD9431085621F337FF","version":"1.9.3","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-1.9.3.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-22","sha512sum":"1C830D6EF55F2D43F317F6DB9632FB073E367D7DD1A166C918C198422634856D6200EC8986078290D573CD3DCA2AF194B78302491E40941E8814EEC8200B2246","version":"3.0.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-3.0.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-22","sha512sum":"2EB0E288B76990E40A62D4A54901A4E563A83393CD08394267744E1E167375F38F2FAEDDB5FE73BE1128F2EDB913133DC481A737339AE4AADCC52C354FE8CF51","version":"1.8.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-1.8.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-22","sha512sum":"D3454D07E055B6115200D36ADB22202B30BB245080B674E0AB2CF365B40A3B2B207413367C1EEFC11C1B37FCD36494D609DD59B50776437300F5DD2E17A2FAF2","version":"2.6.4","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-2.6.4.jar?raw=true","requires":"0.0.1"}]}]

View File

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

View File

@ -271,9 +271,20 @@ public interface PowerSkillerConfiguration extends Config
return "";
}
@ConfigItem(
keyName = "bankItems",
name = "Bank gathered items (Beta)",
description = "Enable to bank your items instead of drop",
position = 89
)
default boolean bankItems()
{
return false;
}
@ConfigItem(
keyName = "dropInventory",
name = "Drop entire inventory",
name = "Drop/Bank entire inventory",
description = "Enable to drop your entire inventory",
position = 90
)
@ -296,8 +307,8 @@ public interface PowerSkillerConfiguration extends Config
@ConfigItem(
keyName = "items",
name = "Item IDs to drop/not drop",
description = "Separate with comma, enable below option to not drop these IDs.",
name = "Item IDs to drop/not drop or Bank",
description = "Separate with comma, enable below option to not drop/bank these IDs.",
position = 110,
hide = "dropInventory"
)
@ -308,8 +319,8 @@ public interface PowerSkillerConfiguration extends Config
@ConfigItem(
keyName = "dropExcept",
name = "Drop all except above IDs",
description = "Enable to drop all items except the given IDs",
name = "Drop/Bank all except above IDs",
description = "Enable to drop/Bank all items except the given IDs",
position = 120,
hide = "dropInventory"
)

View File

@ -257,6 +257,44 @@ public class PowerSkillerPlugin extends Plugin
}
}
private PowerSkillerState getBankState()
{
if (!utils.isBankOpen())
{
return FIND_BANK;
}
if(config.dropInventory() && !utils.inventoryEmpty())
{
return DEPOSIT_ALL;
}
if(config.dropExcept())
{
return DEPOSIT_EXCEPT;
}
if(utils.inventoryContains(itemIds))
{
return DEPOSIT_ITEMS;
}
return BANK_NOT_FOUND;
}
private void openBank()
{
GameObject bank = utils.findNearestBank();
if (bank != null)
{
targetMenu = new MenuEntry("", "", bank.getId(),
MenuOpcode.GAME_OBJECT_SECOND_OPTION.getId(), bank.getSceneMinLocation().getX(),
bank.getSceneMinLocation().getY(), false);
handleMouseClick();
}
else
{
utils.sendGameMessage("Bank not found, stopping");
startPowerSkiller = false;
}
}
public PowerSkillerState getState()
{
if (timeout > 0)
@ -271,8 +309,17 @@ public class PowerSkillerPlugin extends Plugin
{
return MISSING_ITEMS;
}
if (utils.isMoving(beforeLoc))
{
timeout = 2 + tickDelay();
return MOVING;
}
if (utils.inventoryFull())
{
if(config.bankItems())
{
return getBankState();
}
if (config.dropInventory())
{
return DROP_ALL;
@ -287,11 +334,6 @@ public class PowerSkillerPlugin extends Plugin
}
return (!utils.inventoryContains(itemIds)) ? INVALID_DROP_IDS : DROP_ITEMS;
}
if (utils.isMoving(beforeLoc))
{
timeout = 2 + tickDelay();
return MOVING;
}
if (client.getLocalPlayer().getAnimation() == -1 || npcMoved)
{
return (config.type() == PowerSkillerType.GAME_OBJECT) ?
@ -330,6 +372,18 @@ public class PowerSkillerPlugin extends Plugin
interactNPC();
npcMoved = false;
return;
case FIND_BANK:
openBank();
break;
case DEPOSIT_ALL:
utils.depositAll();
break;
case DEPOSIT_EXCEPT:
utils.depositAllExcept(requiredIds);
break;
case DEPOSIT_ITEMS:
utils.depositAllOfItems(itemIds);
break;
case ANIMATING:
timeout = tickDelay();
return;

View File

@ -3,9 +3,14 @@ package net.runelite.client.plugins.powerskiller;
public enum PowerSkillerState
{
ANIMATING,
BANK_NOT_FOUND,
DEPOSIT_ALL,
DEPOSIT_EXCEPT,
DEPOSIT_ITEMS,
DROP_ALL,
DROP_EXCEPT,
DROP_ITEMS,
FIND_BANK,
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.7.2"
version = "1.8.0"
project.extra["PluginName"] = "Quick Eater"
project.extra["PluginDescription"] = "Illumine - auto eat food below configured HP"

View File

@ -26,15 +26,20 @@
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;
import net.runelite.api.Client;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.Skill;
import net.runelite.api.TileObject;
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;
import net.runelite.client.game.ItemManager;
@ -52,7 +57,7 @@ import org.pf4j.Extension;
name = "Quick Eater",
enabledByDefault = false,
description = "Illumine - auto eat food below configured HP",
tags = {"illumine","auto","bot","eat","food"},
tags = {"illumine", "auto", "bot", "eat", "food"},
type = PluginType.UTILITY
)
@Slf4j
@ -75,6 +80,9 @@ public class QuickEaterPlugin extends Plugin
MenuEntry targetMenu;
private Set<Integer> DRINK_SET = Set.of(ItemID.JUG_OF_WINE, ItemID.SARADOMIN_BREW1, ItemID.SARADOMIN_BREW2,
ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW4);
@Provides
QuickEaterConfiguration provideConfig(ConfigManager configManager)
{
@ -101,16 +109,20 @@ public class QuickEaterPlugin extends Plugin
{
return;
}
if (utils.getInventoryItemMenu(itemManager, "Eat", 33) != null)
if (utils.getInventoryItemMenu(itemManager, "Eat", 33, Set.of(ItemID.ROCK_CAKE)) != null)
{
targetMenu = utils.getInventoryItemMenu(itemManager, "Eat", 33);
utils.clickRandomPointCenter(-100, 100);
TileObject tileObject = new GameObjectQuery().idEquals(12345).result(client).nearestTo(client.getLocalPlayer());
return;
}
else
if (utils.inventoryContains(DRINK_SET))
{
utils.sendGameMessage("Health is below theshold but we're out of food");
WidgetItem item = utils.getInventoryWidgetItem(DRINK_SET);
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), item.getIndex(), 9764864, false);
utils.clickRandomPointCenter(-100, 100);
return;
}
utils.sendGameMessage("Health is below theshold but we're out of food");
}
@Subscribe

Binary file not shown.

BIN
release/botutils-2.9.0.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.