project: Update iUtils and botutils
This commit is contained in:
parent
a454e72b4b
commit
5756e0bb00
|
@ -23,7 +23,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "4.9.3"
|
||||
version = "5.0.0"
|
||||
|
||||
project.extra["PluginName"] = "BotUtils"
|
||||
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"
|
||||
|
|
|
@ -38,8 +38,8 @@ import net.runelite.api.InventoryID;
|
|||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
|
@ -75,7 +75,6 @@ import net.runelite.client.eventbus.Subscribe;
|
|||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import static net.runelite.client.plugins.botutils.Banks.ALL_BANKS;
|
||||
import net.runelite.http.api.ge.GrandExchangeClient;
|
||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
||||
|
@ -95,7 +94,6 @@ import org.pf4j.Extension;
|
|||
@Extension
|
||||
@PluginDescriptor(
|
||||
name = "BotUtils",
|
||||
type = PluginType.UTILITY,
|
||||
description = "Illumine bot utilities",
|
||||
hidden = false
|
||||
)
|
||||
|
@ -1061,7 +1059,7 @@ public class BotUtils extends Plugin
|
|||
coordX = localPoint.getSceneX() + getRandomIntBetweenRange(-Math.abs(rand), Math.abs(rand));
|
||||
coordY = localPoint.getSceneY() + getRandomIntBetweenRange(-Math.abs(rand), Math.abs(rand));
|
||||
walkAction = true;
|
||||
targetMenu = new MenuEntry("Walk here", "", 0, MenuOpcode.WALK.getId(),
|
||||
targetMenu = new MenuEntry("Walk here", "", 0, MenuAction.WALK.getId(),
|
||||
0, 0, false);
|
||||
delayMouseClick(new Point(0, 0), delay);
|
||||
}
|
||||
|
@ -1074,7 +1072,7 @@ public class BotUtils extends Plugin
|
|||
coordX = localPoint.getSceneX() + getRandomIntBetweenRange(-Math.abs(rand), Math.abs(rand));
|
||||
coordY = localPoint.getSceneY() + getRandomIntBetweenRange(-Math.abs(rand), Math.abs(rand));
|
||||
walkAction = true;
|
||||
targetMenu = new MenuEntry("Walk here", "", 0, MenuOpcode.WALK.getId(),
|
||||
targetMenu = new MenuEntry("Walk here", "", 0, MenuAction.WALK.getId(),
|
||||
0, 0, false);
|
||||
delayMouseClick(new Point(0, 0), delay);
|
||||
}
|
||||
|
@ -1310,7 +1308,7 @@ public class BotUtils extends Plugin
|
|||
if (staminaPotion != null)
|
||||
{
|
||||
log.info("using stamina potion");
|
||||
targetMenu = new MenuEntry("", "", staminaPotion.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), staminaPotion.getIndex(), 9764864, false);
|
||||
targetMenu = new MenuEntry("", "", staminaPotion.getId(), MenuAction.ITEM_FIRST_OPTION.getId(), staminaPotion.getIndex(), 9764864, false);
|
||||
delayMouseClick(staminaPotion.getCanvasBounds(), getRandomIntBetweenRange(5, 200));
|
||||
return true;
|
||||
}
|
||||
|
@ -1320,7 +1318,7 @@ public class BotUtils extends Plugin
|
|||
public void logout()
|
||||
{
|
||||
int param1 = (client.getWidget(WidgetInfo.LOGOUT_BUTTON) != null) ? 11927560 : 4522007;
|
||||
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, param1, false);
|
||||
targetMenu = new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, param1, false);
|
||||
Widget logoutWidget = client.getWidget(WidgetInfo.LOGOUT_BUTTON);
|
||||
if (logoutWidget != null)
|
||||
{
|
||||
|
@ -1494,7 +1492,7 @@ public class BotUtils extends Plugin
|
|||
{
|
||||
continue;
|
||||
}
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && action.equals(menuOption))
|
||||
|
@ -1515,7 +1513,7 @@ public class BotUtils extends Plugin
|
|||
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
|
||||
for (WidgetItem item : items)
|
||||
{
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && menuOptions.contains(action))
|
||||
|
@ -1536,7 +1534,7 @@ public class BotUtils extends Plugin
|
|||
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
|
||||
for (WidgetItem item : items)
|
||||
{
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && action.equals(menuOption))
|
||||
|
@ -1736,7 +1734,7 @@ public class BotUtils extends Plugin
|
|||
{
|
||||
assert !client.isClientThread();
|
||||
|
||||
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false);
|
||||
targetMenu = new MenuEntry("", "", item.getId(), MenuAction.ITEM_FIFTH_OPTION.getId(), item.getIndex(), 9764864, false);
|
||||
click(item.getCanvasBounds());
|
||||
}
|
||||
|
||||
|
@ -1878,7 +1876,7 @@ public class BotUtils extends Plugin
|
|||
log.info("interacting inventory item: {}", item.getId());
|
||||
sleep(minDelayBetween, maxDelayBetween);
|
||||
setModifiedMenuEntry(new MenuEntry("", "", item1.getId(), opcode, item1.getIndex(), WidgetInfo.INVENTORY.getId(),
|
||||
false), item.getId(), item.getIndex(), MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId());
|
||||
false), item.getId(), item.getIndex(), MenuAction.ITEM_USE_ON_WIDGET_ITEM.getId());
|
||||
click(item1.getCanvasBounds());
|
||||
if (!interactAll)
|
||||
{
|
||||
|
@ -1975,7 +1973,7 @@ public class BotUtils extends Plugin
|
|||
{
|
||||
return;
|
||||
}
|
||||
targetMenu = new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), 11, 786434, false); //close bank
|
||||
targetMenu = new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), 11, 786434, false); //close bank
|
||||
Widget bankCloseWidget = client.getWidget(WidgetInfo.BANK_PIN_EXIT_BUTTON);
|
||||
if (bankCloseWidget != null)
|
||||
{
|
||||
|
@ -1987,8 +1985,8 @@ public class BotUtils extends Plugin
|
|||
|
||||
public int getBankMenuOpcode(int bankID)
|
||||
{
|
||||
return Banks.BANK_CHECK_BOX.contains(bankID) ? MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() :
|
||||
MenuOpcode.GAME_OBJECT_SECOND_OPTION.getId();
|
||||
return Banks.BANK_CHECK_BOX.contains(bankID) ? MenuAction.GAME_OBJECT_FIRST_OPTION.getId() :
|
||||
MenuAction.GAME_OBJECT_SECOND_OPTION.getId();
|
||||
}
|
||||
|
||||
//doesn't NPE
|
||||
|
@ -2000,7 +1998,7 @@ public class BotUtils extends Plugin
|
|||
|
||||
for (Item item : bankItemContainer.getItems())
|
||||
{
|
||||
if (itemManager.getItemDefinition(item.getId()).getName().equalsIgnoreCase(itemName))
|
||||
if (itemManager.getItemComposition(item.getId()).getName().equalsIgnoreCase(itemName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -2047,7 +2045,7 @@ public class BotUtils extends Plugin
|
|||
|
||||
for (Item item : bankItemContainer.getItems())
|
||||
{
|
||||
if (itemManager.getItemDefinition(item.getId()).getName().equalsIgnoreCase(itemName) && item.getQuantity() >= minStackAmount)
|
||||
if (itemManager.getItemComposition(item.getId()).getName().equalsIgnoreCase(itemName) && item.getQuantity() >= minStackAmount)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -2165,11 +2163,11 @@ public class BotUtils extends Plugin
|
|||
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
|
||||
targetMenu = new MenuEntry("", "", 1, MenuAction.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
|
||||
targetMenu = new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, 786473, false); //deposit all in bank interface
|
||||
}
|
||||
if ((depositInventoryWidget != null))
|
||||
{
|
||||
|
@ -2225,7 +2223,7 @@ public class BotUtils extends Plugin
|
|||
return;
|
||||
}
|
||||
boolean depositBox = isDepositBoxOpen();
|
||||
targetMenu = new MenuEntry("", "", (depositBox) ? 1 : 8, MenuOpcode.CC_OP.getId(), item.getIndex(),
|
||||
targetMenu = new MenuEntry("", "", (depositBox) ? 1 : 8, MenuAction.CC_OP.getId(), item.getIndex(),
|
||||
(depositBox) ? 12582914 : 983043, false);
|
||||
click(item.getCanvasBounds());
|
||||
}
|
||||
|
@ -2281,7 +2279,7 @@ public class BotUtils extends Plugin
|
|||
}
|
||||
boolean depositBox = isDepositBoxOpen();
|
||||
|
||||
targetMenu = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 2 : 3, MenuOpcode.CC_OP.getId(), item.getIndex(),
|
||||
targetMenu = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 2 : 3, MenuAction.CC_OP.getId(), item.getIndex(),
|
||||
(depositBox) ? 12582914 : 983043, false);
|
||||
delayMouseClick(item.getCanvasBounds(), getRandomIntBetweenRange(0, 50));
|
||||
}
|
||||
|
@ -2299,7 +2297,7 @@ public class BotUtils extends Plugin
|
|||
{
|
||||
executorService.submit(() ->
|
||||
{
|
||||
targetMenu = new MenuEntry("Withdraw-All", "", 7, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
|
||||
targetMenu = new MenuEntry("Withdraw-All", "", 7, MenuAction.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
|
||||
clickRandomPointCenter(-200, 200);
|
||||
});
|
||||
}
|
||||
|
@ -2321,7 +2319,7 @@ public class BotUtils extends Plugin
|
|||
{
|
||||
executorService.submit(() ->
|
||||
{
|
||||
targetMenu = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 1 : 2, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
|
||||
targetMenu = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 1 : 2, MenuAction.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false);
|
||||
setMenuEntry(targetMenu);
|
||||
clickRandomPointCenter(-200, 200);
|
||||
});
|
||||
|
@ -2358,7 +2356,7 @@ public class BotUtils extends Plugin
|
|||
identifier = 6;
|
||||
break;
|
||||
}
|
||||
targetMenu = new MenuEntry("", "", identifier, MenuOpcode.CC_OP.getId(), item.getIndex(), 786444, false);
|
||||
targetMenu = new MenuEntry("", "", identifier, MenuAction.CC_OP.getId(), item.getIndex(), 786444, false);
|
||||
setMenuEntry(targetMenu);
|
||||
delayClickRandomPointCenter(-200, 200, 50);
|
||||
if (identifier == 6)
|
||||
|
@ -2381,26 +2379,21 @@ public class BotUtils extends Plugin
|
|||
public OSBGrandExchangeResult getOSBItem(int itemId)
|
||||
{
|
||||
log.debug("Looking up OSB item price {}", itemId);
|
||||
osbGrandExchangeClient.lookupItem(itemId)
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
try
|
||||
{
|
||||
if (osbresult != null && osbresult.getOverall_average() > 0)
|
||||
final OSBGrandExchangeResult result = osbGrandExchangeClient.lookupItem(itemId);
|
||||
if (result != null && result.getOverall_average() > 0)
|
||||
{
|
||||
osbGrandExchangeResult = osbresult;
|
||||
return result;
|
||||
}
|
||||
},
|
||||
(e) -> log.debug("Error getting price of item {}", itemId, e)
|
||||
);
|
||||
if (osbGrandExchangeResult != null)
|
||||
{
|
||||
return osbGrandExchangeResult;
|
||||
}
|
||||
else
|
||||
catch (IOException e)
|
||||
{
|
||||
log.debug("Error getting price of item {}", itemId, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* RANDOM EVENT FUNCTIONS
|
||||
|
@ -2596,7 +2589,7 @@ public class BotUtils extends Plugin
|
|||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getOpcode() == MenuOpcode.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
if (event.getOpcode() == MenuAction.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getParam1() == 11927560 || event.getParam1() == 4522007 || event.getParam1() == 24772686))
|
||||
{
|
||||
return;
|
||||
|
@ -2614,8 +2607,8 @@ public class BotUtils extends Plugin
|
|||
@Subscribe
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getOpcode() == MenuOpcode.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getParam1() == 11927560 || event.getParam1() == 4522007 || event.getParam1() == 24772686))
|
||||
if (event.getMenuAction() == MenuAction.CC_OP && (event.getWidgetId() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getWidgetId() == 11927560 || event.getWidgetId() == 4522007 || event.getWidgetId() == 24772686))
|
||||
{
|
||||
//Either logging out or world-hopping which is handled by 3rd party plugins so let them have priority
|
||||
log.info("Received world-hop/login related click. Giving them priority");
|
||||
|
@ -2631,7 +2624,7 @@ public class BotUtils extends Plugin
|
|||
consumeClick = false;
|
||||
return;
|
||||
}
|
||||
if (event.getOption().equals("Walk here") && walkAction)
|
||||
if (event.getMenuOption().equals("Walk here") && walkAction)
|
||||
{
|
||||
log.debug("Walk action");
|
||||
walkTile(coordX, coordY);
|
||||
|
|
|
@ -67,7 +67,6 @@ subprojects {
|
|||
implementation(group = "com.google.guava", name = "guava", version = "29.0-jre")
|
||||
implementation(group = "com.google.inject", name = "guice", version = "4.2.3", classifier = "no_aop")
|
||||
implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.0")
|
||||
implementation(group = "io.reactivex.rxjava3", name = "rxjava", version = "3.0.6")
|
||||
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
|
||||
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
|
||||
implementation(group = "org.pf4j", name = "pf4j", version = "3.4.1")
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
object ProjectVersions {
|
||||
const val openosrsVersion = "3.5.4"
|
||||
const val apiVersion = "0.0.1"
|
||||
const val openosrsVersion = "4.0.0"
|
||||
const val apiVersion = "^1.0.0"
|
||||
}
|
||||
|
||||
object Libraries {
|
||||
|
@ -38,7 +38,6 @@ object Libraries {
|
|||
const val okhttp3 = "4.2.2"
|
||||
const val pf4j = "3.2.0"
|
||||
const val slf4j = "1.7.30"
|
||||
const val rxjava = "2.2.14"
|
||||
}
|
||||
|
||||
const val apacheCommonsText = "org.apache.commons:commons-text:${Versions.apacheCommonsText}"
|
||||
|
@ -48,6 +47,5 @@ object Libraries {
|
|||
const val okhttp3 = "com.squareup.okhttp3:okhttp:${Versions.okhttp3}"
|
||||
const val pf4j = "org.pf4j:pf4j:${Versions.pf4j}"
|
||||
const val slf4j = "org.slf4j:slf4j-api:${Versions.slf4j}"
|
||||
const val rxjava = "io.reactivex.rxjava2:rxjava:${Versions.rxjava}"
|
||||
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "2.3.6"
|
||||
version = "3.0.0"
|
||||
|
||||
project.extra["PluginName"] = "iUtils"
|
||||
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"
|
||||
|
|
|
@ -12,8 +12,8 @@ import net.runelite.api.Client;
|
|||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.queries.BankItemQuery;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
@ -74,7 +74,7 @@ public class BankUtils
|
|||
{
|
||||
return;
|
||||
}
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), 11, 786434, false)); //close bank
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), 11, 786434, false)); //close bank
|
||||
Widget bankCloseWidget = client.getWidget(WidgetInfo.BANK_PIN_EXIT_BUTTON);
|
||||
if (bankCloseWidget != null)
|
||||
{
|
||||
|
@ -86,8 +86,8 @@ public class BankUtils
|
|||
|
||||
public int getBankMenuOpcode(int bankID)
|
||||
{
|
||||
return Banks.BANK_CHECK_BOX.contains(bankID) ? MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() :
|
||||
MenuOpcode.GAME_OBJECT_SECOND_OPTION.getId();
|
||||
return Banks.BANK_CHECK_BOX.contains(bankID) ? MenuAction.GAME_OBJECT_FIRST_OPTION.getId() :
|
||||
MenuAction.GAME_OBJECT_SECOND_OPTION.getId();
|
||||
}
|
||||
|
||||
//doesn't NPE
|
||||
|
@ -99,7 +99,7 @@ public class BankUtils
|
|||
|
||||
for (Item item : bankItemContainer.getItems())
|
||||
{
|
||||
if (itemManager.getItemDefinition(item.getId()).getName().equalsIgnoreCase(itemName))
|
||||
if (itemManager.getItemComposition(item.getId()).getName().equalsIgnoreCase(itemName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class BankUtils
|
|||
|
||||
for (Item item : bankItemContainer.getItems())
|
||||
{
|
||||
if (itemManager.getItemDefinition(item.getId()).getName().equalsIgnoreCase(itemName) && item.getQuantity() >= minStackAmount)
|
||||
if (itemManager.getItemComposition(item.getId()).getName().equalsIgnoreCase(itemName) && item.getQuantity() >= minStackAmount)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -241,11 +241,11 @@ public class BankUtils
|
|||
Widget depositInventoryWidget = client.getWidget(WidgetInfo.BANK_DEPOSIT_INVENTORY);
|
||||
if (isDepositBoxOpen())
|
||||
{
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 12582916, false)); //deposit all in bank interface
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, 12582916, false)); //deposit all in bank interface
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, 786473, false)); //deposit all in bank interface
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, 786473, false)); //deposit all in bank interface
|
||||
}
|
||||
if ((depositInventoryWidget != null))
|
||||
{
|
||||
|
@ -299,7 +299,7 @@ public class BankUtils
|
|||
return;
|
||||
}
|
||||
boolean depositBox = isDepositBoxOpen();
|
||||
menu.setEntry(new MenuEntry("", "", (depositBox) ? 1 : 8, MenuOpcode.CC_OP.getId(), item.getIndex(),
|
||||
menu.setEntry(new MenuEntry("", "", (depositBox) ? 1 : 8, MenuAction.CC_OP.getId(), item.getIndex(),
|
||||
(depositBox) ? 12582914 : 983043, false));
|
||||
mouse.handleMouseClick(item.getCanvasBounds());
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ public class BankUtils
|
|||
}
|
||||
boolean depositBox = isDepositBoxOpen();
|
||||
|
||||
menu.setEntry(new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 2 : 3, MenuOpcode.CC_OP.getId(), item.getIndex(),
|
||||
menu.setEntry(new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 2 : 3, MenuAction.CC_OP.getId(), item.getIndex(),
|
||||
(depositBox) ? 12582914 : 983043, false));
|
||||
mouse.delayMouseClick(item.getCanvasBounds(), calc.getRandomIntBetweenRange(0, 50));
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ public class BankUtils
|
|||
{
|
||||
executorService.submit(() ->
|
||||
{
|
||||
menu.setEntry(new MenuEntry("Withdraw-All", "", 7, MenuOpcode.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false));
|
||||
menu.setEntry(new MenuEntry("Withdraw-All", "", 7, MenuAction.CC_OP.getId(), bankItemWidget.getIndex(), 786444, false));
|
||||
mouse.clickRandomPointCenter(-200, 200);
|
||||
});
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ public class BankUtils
|
|||
|
||||
public void withdrawItem(Widget bankItemWidget)
|
||||
{
|
||||
MenuEntry entry = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 1 : 2, MenuOpcode.CC_OP.getId(),
|
||||
MenuEntry entry = new MenuEntry("", "", (client.getVarbitValue(6590) == 0) ? 1 : 2, MenuAction.CC_OP.getId(),
|
||||
bankItemWidget.getIndex(), 786444, false);
|
||||
utils.doActionClientTick(entry, bankItemWidget.getBounds(), 0);
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ public class BankUtils
|
|||
identifier = 6;
|
||||
break;
|
||||
}
|
||||
menu.setEntry(new MenuEntry("", "", identifier, MenuOpcode.CC_OP.getId(), item.getIndex(), 786444, false));
|
||||
menu.setEntry(new MenuEntry("", "", identifier, MenuAction.CC_OP.getId(), item.getIndex(), 786444, false));
|
||||
mouse.delayClickRandomPointCenter(-200, 200, 50);
|
||||
if (identifier == 6)
|
||||
{
|
||||
|
|
|
@ -6,8 +6,8 @@ import javax.inject.Singleton;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
|
@ -57,13 +57,13 @@ public class InterfaceUtils
|
|||
final int INCREMENT = 4;
|
||||
int styleParam = BASE_PARAM + (index * INCREMENT);
|
||||
|
||||
return new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, styleParam, false);
|
||||
return new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, styleParam, false);
|
||||
}
|
||||
|
||||
public void logout()
|
||||
{
|
||||
int param1 = (client.getWidget(WidgetInfo.LOGOUT_BUTTON) != null) ? 11927560 : 4522007;
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuOpcode.CC_OP.getId(), -1, param1, false));
|
||||
menu.setEntry(new MenuEntry("", "", 1, MenuAction.CC_OP.getId(), -1, param1, false));
|
||||
Widget logoutWidget = client.getWidget(WidgetInfo.LOGOUT_BUTTON);
|
||||
if (logoutWidget != null)
|
||||
{
|
||||
|
|
|
@ -17,8 +17,8 @@ import net.runelite.api.GameState;
|
|||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.queries.InventoryItemQuery;
|
||||
import net.runelite.api.queries.InventoryWidgetItemQuery;
|
||||
|
@ -227,7 +227,7 @@ public class InventoryUtils
|
|||
{
|
||||
continue;
|
||||
}
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && action.equals(menuOption))
|
||||
|
@ -248,7 +248,7 @@ public class InventoryUtils
|
|||
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
|
||||
for (WidgetItem item : items)
|
||||
{
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && menuOptions.contains(action))
|
||||
|
@ -269,7 +269,7 @@ public class InventoryUtils
|
|||
Collection<WidgetItem> items = inventoryWidget.getWidgetItems();
|
||||
for (WidgetItem item : items)
|
||||
{
|
||||
String[] menuActions = itemManager.getItemDefinition(item.getId()).getInventoryActions();
|
||||
String[] menuActions = itemManager.getItemComposition(item.getId()).getInventoryActions();
|
||||
for (String action : menuActions)
|
||||
{
|
||||
if (action != null && action.equals(menuOption))
|
||||
|
@ -443,7 +443,7 @@ public class InventoryUtils
|
|||
{
|
||||
assert !client.isClientThread();
|
||||
|
||||
menu.setEntry(new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_DROP.getId(), item.getIndex(), 9764864, false));
|
||||
menu.setEntry(new MenuEntry("", "", item.getId(), MenuAction.ITEM_FIFTH_OPTION.getId(), item.getIndex(), 9764864, false));
|
||||
mouse.click(item.getCanvasBounds());
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ public class InventoryUtils
|
|||
log.info("interacting inventory item: {}", item.getId());
|
||||
sleep(minDelayBetween, maxDelayBetween);
|
||||
menu.setModifiedEntry(new MenuEntry("", "", item1.getId(), opcode, item1.getIndex(), WidgetInfo.INVENTORY.getId(),
|
||||
false), item.getId(), item.getIndex(), MenuOpcode.ITEM_USE_ON_WIDGET_ITEM.getId());
|
||||
false), item.getId(), item.getIndex(), MenuAction.ITEM_USE_ON_WIDGET_ITEM.getId());
|
||||
mouse.click(item1.getCanvasBounds());
|
||||
if (!interactAll)
|
||||
{
|
||||
|
|
|
@ -12,11 +12,11 @@ import net.runelite.api.Constants;
|
|||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.ItemLayer;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Scene;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.TileItemPile;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.WallObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
@ -224,7 +224,7 @@ public class ObjectUtils
|
|||
|
||||
private TileItem findItemAtTile(Tile tile, int id)
|
||||
{
|
||||
TileItemPile tileItemPile = tile.getItemLayer();
|
||||
ItemLayer tileItemPile = tile.getItemLayer();
|
||||
if (tileItemPile != null)
|
||||
{
|
||||
TileItem tileItem = (TileItem) tileItemPile.getBottom();
|
||||
|
|
|
@ -13,8 +13,8 @@ import net.runelite.api.InventoryID;
|
|||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
@ -169,7 +169,7 @@ public class PlayerUtils
|
|||
if (staminaPotion != null)
|
||||
{
|
||||
log.info("using stamina potion");
|
||||
menu.setEntry(new MenuEntry("", "", staminaPotion.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(),
|
||||
menu.setEntry(new MenuEntry("", "", staminaPotion.getId(), MenuAction.ITEM_FIRST_OPTION.getId(),
|
||||
staminaPotion.getIndex(), 9764864, false));
|
||||
mouse.delayMouseClick(staminaPotion.getCanvasBounds(), calc.getRandomIntBetweenRange(5, 200));
|
||||
return true;
|
||||
|
|
|
@ -9,8 +9,8 @@ import javax.inject.Inject;
|
|||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
@ -72,7 +72,7 @@ public class WalkUtils
|
|||
coordY = localPoint.getSceneY() + calc.getRandomIntBetweenRange(-Math.abs(rand), Math.abs(rand));
|
||||
log.info("Coord values: {}, {}", coordX, coordY);
|
||||
walkAction = true;
|
||||
menu.setEntry(new MenuEntry("Walk here", "", 0, MenuOpcode.WALK.getId(),
|
||||
menu.setEntry(new MenuEntry("Walk here", "", 0, MenuAction.WALK.getId(),
|
||||
0, 0, false));
|
||||
mouse.delayMouseClick(new Point(0, 0), delay);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ package net.runelite.client.plugins.iutils;
|
|||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -18,8 +19,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.TileObject;
|
||||
|
@ -38,7 +39,6 @@ import net.runelite.client.config.ConfigManager;
|
|||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.http.api.ge.GrandExchangeClient;
|
||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeResult;
|
||||
|
@ -51,7 +51,6 @@ import org.pf4j.Extension;
|
|||
@Extension
|
||||
@PluginDescriptor(
|
||||
name = "iUtils",
|
||||
type = PluginType.UTILITY,
|
||||
description = "Illumine plugin utilities",
|
||||
hidden = false
|
||||
)
|
||||
|
@ -453,26 +452,22 @@ public class iUtils extends Plugin
|
|||
public OSBGrandExchangeResult getOSBItem(int itemId)
|
||||
{
|
||||
log.debug("Looking up OSB item price {}", itemId);
|
||||
osbGrandExchangeClient.lookupItem(itemId)
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
|
||||
try
|
||||
{
|
||||
if (osbresult != null && osbresult.getOverall_average() > 0)
|
||||
final OSBGrandExchangeResult result = osbGrandExchangeClient.lookupItem(itemId);
|
||||
if (result != null && result.getOverall_average() > 0)
|
||||
{
|
||||
osbGrandExchangeResult = osbresult;
|
||||
return result;
|
||||
}
|
||||
},
|
||||
(e) -> log.debug("Error getting price of item {}", itemId, e)
|
||||
);
|
||||
if (osbGrandExchangeResult != null)
|
||||
{
|
||||
return osbGrandExchangeResult;
|
||||
}
|
||||
else
|
||||
catch (IOException e)
|
||||
{
|
||||
log.debug("Error getting price of item {}", itemId, e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//Ganom's
|
||||
public int[] stringToIntArray(String string)
|
||||
|
@ -581,7 +576,7 @@ public class iUtils extends Plugin
|
|||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getOpcode() == MenuOpcode.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
if (event.getOpcode() == MenuAction.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getParam1() == 11927560 || event.getParam1() == 4522007 || event.getParam1() == 24772686))
|
||||
{
|
||||
return;
|
||||
|
@ -599,8 +594,8 @@ public class iUtils extends Plugin
|
|||
@Subscribe
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getOpcode() == MenuOpcode.CC_OP.getId() && (event.getParam1() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getParam1() == 11927560 || event.getParam1() == 4522007 || event.getParam1() == 24772686))
|
||||
if (event.getMenuAction() == MenuAction.CC_OP && (event.getWidgetId() == WidgetInfo.WORLD_SWITCHER_LIST.getId() ||
|
||||
event.getWidgetId() == 11927560 || event.getWidgetId() == 4522007 || event.getWidgetId() == 24772686))
|
||||
{
|
||||
//Either logging out or world-hopping which is handled by 3rd party plugins so let them have priority
|
||||
log.info("Received world-hop/login related click. Giving them priority");
|
||||
|
@ -646,7 +641,7 @@ public class iUtils extends Plugin
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!event.isConsumed() && !action.delayedActions.isEmpty() && event.getOption().equals("Walk here"))
|
||||
if (!event.isConsumed() && !action.delayedActions.isEmpty() && event.getMenuOption().equals("Walk here"))
|
||||
{
|
||||
log.info("Consuming a NULL MOC event");
|
||||
event.consume();
|
||||
|
|
Loading…
Reference in New Issue