Merge pull request #3161 from open-osrs/upstream-2004
This commit is contained in:
@@ -25,9 +25,9 @@
|
||||
|
||||
object ProjectVersions {
|
||||
const val launcherVersion = "2.2.0"
|
||||
const val rlVersion = "1.8.17"
|
||||
const val rlVersion = "1.8.18"
|
||||
|
||||
const val openosrsVersion = "4.23.0"
|
||||
const val openosrsVersion = "4.24.0"
|
||||
|
||||
const val rsversion = 204
|
||||
const val cacheversion = 165
|
||||
|
||||
@@ -54,7 +54,7 @@ public class CopyRuneLiteClasses extends AbstractInjector
|
||||
{
|
||||
ClassFile runeliteObjectVanilla = inject.vanilla.findClass(className);
|
||||
|
||||
final ClassFile runeLiteObjectDeob = inject.getDeobfuscated()
|
||||
final ClassFile runeLiteDeob = inject.getDeobfuscated()
|
||||
.findClass(className);
|
||||
|
||||
if (runeliteObjectVanilla == null)
|
||||
@@ -62,11 +62,11 @@ public class CopyRuneLiteClasses extends AbstractInjector
|
||||
runeliteObjectVanilla = new ClassFile(inject.vanilla);
|
||||
runeliteObjectVanilla.setVersion(Opcodes.V1_8);
|
||||
runeliteObjectVanilla.setName(className);
|
||||
runeliteObjectVanilla.setAccess(runeLiteObjectDeob.getAccess());
|
||||
runeliteObjectVanilla.setAccess(runeLiteDeob.getAccess());
|
||||
|
||||
if (runeLiteObjectDeob.getParentClass() != null)
|
||||
if (runeLiteDeob.getParentClass() != null)
|
||||
{
|
||||
ClassFile deobClass = inject.getDeobfuscated().findClass(runeLiteObjectDeob.getParentClass().getName());
|
||||
ClassFile deobClass = inject.getDeobfuscated().findClass(runeLiteDeob.getParentClass().getName());
|
||||
|
||||
if (deobClass != null)
|
||||
{
|
||||
@@ -74,25 +74,30 @@ public class CopyRuneLiteClasses extends AbstractInjector
|
||||
}
|
||||
else
|
||||
{
|
||||
runeliteObjectVanilla.setParentClass(runeLiteObjectDeob.getParentClass());
|
||||
runeliteObjectVanilla.setParentClass(runeLiteDeob.getParentClass());
|
||||
}
|
||||
}
|
||||
|
||||
inject.toVanilla.put(runeLiteObjectDeob, runeliteObjectVanilla);
|
||||
inject.toVanilla.put(runeLiteDeob, runeliteObjectVanilla);
|
||||
|
||||
for (Class interfaze : runeLiteObjectDeob.getInterfaces())
|
||||
for (Class interfaze : runeLiteDeob.getInterfaces())
|
||||
{
|
||||
runeliteObjectVanilla.getInterfaces().addInterface(interfaze);
|
||||
}
|
||||
|
||||
for (Field field : runeLiteObjectDeob.getFields())
|
||||
for (Field field : runeLiteDeob.getFields())
|
||||
{
|
||||
field.setType(InjectUtil.deobToVanilla(inject, field.getType()));
|
||||
runeliteObjectVanilla.addField(field);
|
||||
}
|
||||
|
||||
for (Method method : runeLiteObjectDeob.getMethods())
|
||||
for (Method method : runeLiteDeob.getMethods())
|
||||
{
|
||||
if (className.equals("RuneLiteMenuEntry") && (method.getName().equals("getItemId") || method.getName().equals("getWidget")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
transformMethod(method);
|
||||
runeliteObjectVanilla.addMethod(method);
|
||||
}
|
||||
|
||||
@@ -573,6 +573,14 @@ public interface Client extends OAuthApi, GameEngine
|
||||
*/
|
||||
void setDraggedOnWidget(Widget widget);
|
||||
|
||||
/**
|
||||
* Get the number of client cycles the current dragged widget
|
||||
* has been dragged for.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getDragTime();
|
||||
|
||||
/**
|
||||
* Gets Interface ID of the root widget
|
||||
*/
|
||||
@@ -2084,6 +2092,13 @@ public interface Client extends OAuthApi, GameEngine
|
||||
*/
|
||||
int getSelectedItemIndex();
|
||||
|
||||
/**
|
||||
* Get the selected widget, such as a selected spell or selected item (eg. "Use")
|
||||
* @return the selected widget
|
||||
*/
|
||||
@Nullable
|
||||
Widget getSelectedWidget();
|
||||
|
||||
/**
|
||||
* Returns client item composition cache
|
||||
*/
|
||||
|
||||
@@ -37,9 +37,9 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_GAME_OBJECT(1),
|
||||
/**
|
||||
* Menu action for casting a spell on a tile object (GameObject or GroundObject).
|
||||
* Menu action for using a widget on a tile object (GameObject or GroundObject).
|
||||
*/
|
||||
SPELL_CAST_ON_GAME_OBJECT(2),
|
||||
WIDGET_TARGET_ON_GAME_OBJECT(2),
|
||||
/**
|
||||
* First menu action for a game object.
|
||||
*/
|
||||
@@ -66,9 +66,9 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_NPC(7),
|
||||
/**
|
||||
* Menu action for casting a spell on an NPC.
|
||||
* Menu action for using a widget on an NPC.
|
||||
*/
|
||||
SPELL_CAST_ON_NPC(8),
|
||||
WIDGET_TARGET_ON_NPC(8),
|
||||
/**
|
||||
* First menu action for an NPC.
|
||||
*/
|
||||
@@ -95,18 +95,18 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_PLAYER(14),
|
||||
/**
|
||||
* Menu action for casting a spell on a player.
|
||||
* Menu action for using a widget on a player.
|
||||
*/
|
||||
SPELL_CAST_ON_PLAYER(15),
|
||||
WIDGET_TARGET_ON_PLAYER(15),
|
||||
|
||||
/**
|
||||
* Menu action for using an item on an item on the ground.
|
||||
*/
|
||||
ITEM_USE_ON_GROUND_ITEM(16),
|
||||
/**
|
||||
* Menu action for casting a spell on an item on the ground.
|
||||
* Menu action for using a widget on an item on the ground.
|
||||
*/
|
||||
SPELL_CAST_ON_GROUND_ITEM(17),
|
||||
WIDGET_TARGET_ON_GROUND_ITEM(17),
|
||||
/**
|
||||
* First menu action for an item on the ground.
|
||||
*/
|
||||
@@ -138,13 +138,14 @@ public enum MenuAction
|
||||
*/
|
||||
WIDGET_TYPE_1(24),
|
||||
/**
|
||||
* Interaction with widget (type 2).
|
||||
* Select the widget for targeting other widgets/entites etc.
|
||||
* @see Client#getSelectedWidget()
|
||||
*/
|
||||
WIDGET_TYPE_2(25),
|
||||
WIDGET_TARGET(25),
|
||||
/**
|
||||
* Interaction with widget (type 3).
|
||||
* Performs an ifclose.
|
||||
*/
|
||||
WIDGET_TYPE_3(26),
|
||||
WIDGET_CLOSE(26),
|
||||
/**
|
||||
* Interaction with widget (type 4).
|
||||
*/
|
||||
@@ -154,19 +155,17 @@ public enum MenuAction
|
||||
*/
|
||||
WIDGET_TYPE_5(29),
|
||||
/**
|
||||
* Interaction with widget (type 6).
|
||||
*
|
||||
* This is the continue button on message boxes
|
||||
* Performs a Continue
|
||||
*/
|
||||
WIDGET_TYPE_6(30),
|
||||
WIDGET_CONTINUE(30),
|
||||
/**
|
||||
* Menu action when using an item on another item inside a widget (inventory).
|
||||
* Menu action when using an item on another item
|
||||
*/
|
||||
ITEM_USE_ON_WIDGET_ITEM(31),
|
||||
ITEM_USE_ON_ITEM(31),
|
||||
/**
|
||||
* Menu action when using an item on a widget.
|
||||
* Menu action when using a component on an item
|
||||
*/
|
||||
ITEM_USE_ON_WIDGET(32),
|
||||
WIDGET_USE_ON_ITEM(32),
|
||||
|
||||
/**
|
||||
* First menu action for an item.
|
||||
@@ -229,20 +228,15 @@ public enum MenuAction
|
||||
CC_OP(57),
|
||||
|
||||
/**
|
||||
* Casting a spell / op target on a widget
|
||||
* Using a widget on another widget
|
||||
*/
|
||||
SPELL_CAST_ON_WIDGET(58),
|
||||
WIDGET_TARGET_ON_WIDGET(58),
|
||||
|
||||
/**
|
||||
* Menu action for high priority runelite options
|
||||
*/
|
||||
RUNELITE_HIGH_PRIORITY(999),
|
||||
|
||||
/**
|
||||
* Sub 1000 so it doesn't get sorted down in the list
|
||||
*/
|
||||
PRIO_RUNELITE(666),
|
||||
|
||||
/**
|
||||
* Menu action triggered by examining an object.
|
||||
*/
|
||||
@@ -289,8 +283,13 @@ public enum MenuAction
|
||||
* Menu action for InfoBox menu entries
|
||||
*/
|
||||
RUNELITE_INFOBOX(1504),
|
||||
|
||||
/**
|
||||
* Menu action triggered by following a player.
|
||||
*/
|
||||
FOLLOW(2046),
|
||||
/**
|
||||
* Menu action triggered by sending a trade offer to a player.
|
||||
*/
|
||||
TRADE(2047),
|
||||
|
||||
/**
|
||||
@@ -326,4 +325,4 @@ public enum MenuAction
|
||||
{
|
||||
return map.getOrDefault(id, UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
package net.runelite.api;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
/**
|
||||
* A menu entry in a right-click menu.
|
||||
@@ -93,6 +95,34 @@ public interface MenuEntry
|
||||
*/
|
||||
MenuEntry onClick(Consumer<MenuEntry> callback);
|
||||
|
||||
/**
|
||||
* Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.
|
||||
* @return
|
||||
*/
|
||||
boolean isItemOp();
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item op id
|
||||
* @return 1-5
|
||||
*/
|
||||
int getItemOp();
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item id
|
||||
* @return
|
||||
* @see ItemID
|
||||
* @see NullItemID
|
||||
*/
|
||||
int getItemId();
|
||||
|
||||
/**
|
||||
* Get the widget this menu entry is on, if this is a menu entry
|
||||
* with an associated widget. Such as eg, CC_OP.
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Widget getWidget();
|
||||
|
||||
@Deprecated
|
||||
int getOpcode();
|
||||
@Deprecated
|
||||
|
||||
@@ -449,4 +449,7 @@ public final class ScriptID
|
||||
|
||||
@ScriptArguments(integer = 7)
|
||||
public static final int GROUP_IRONMAN_STORAGE_BUILD = 5269;
|
||||
|
||||
@ScriptArguments(integer = 6)
|
||||
public static final int INVENTORY_DRAWITEM = 6011;
|
||||
}
|
||||
@@ -24,9 +24,12 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
/**
|
||||
* An event where a menu option has been clicked.
|
||||
@@ -39,42 +42,137 @@ import net.runelite.api.MenuEntry;
|
||||
* By default, when there is no action performed when left-clicking,
|
||||
* it seems that this event still triggers with the "Cancel" action.
|
||||
*/
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class MenuOptionClicked
|
||||
{
|
||||
/**
|
||||
* Action parameter 0. Its value depends on the menuAction.
|
||||
* The clicked menu entry
|
||||
*/
|
||||
private int param0;
|
||||
/**
|
||||
* Action parameter 1. Its value depends on the menuAction.
|
||||
*/
|
||||
private int param1;
|
||||
/**
|
||||
* The option text added to the menu.
|
||||
*/
|
||||
private String menuOption;
|
||||
/**
|
||||
* The target of the action.
|
||||
*/
|
||||
private String menuTarget;
|
||||
/**
|
||||
* The action performed.
|
||||
*/
|
||||
private MenuAction menuAction;
|
||||
/**
|
||||
* The ID of the object, actor, or item that the interaction targets.
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* The selected item index at the time of the option click.
|
||||
*/
|
||||
private int selectedItemIndex;
|
||||
private final MenuEntry menuEntry;
|
||||
/**
|
||||
* Whether or not the event has been consumed by a subscriber.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean consumed;
|
||||
|
||||
/**
|
||||
* Action parameter 0. Its value depends on the menuAction.
|
||||
*/
|
||||
public int getParam0()
|
||||
{
|
||||
return menuEntry.getParam0();
|
||||
}
|
||||
|
||||
public void setParam0(int param0)
|
||||
{
|
||||
menuEntry.setParam0(param0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action parameter 1. Its value depends on the menuAction.
|
||||
*/
|
||||
public int getParam1()
|
||||
{
|
||||
return menuEntry.getParam1();
|
||||
}
|
||||
|
||||
public void setParam1(int param1)
|
||||
{
|
||||
menuEntry.setParam1(param1);
|
||||
}
|
||||
|
||||
/**
|
||||
* The option text added to the menu.
|
||||
*/
|
||||
public String getMenuOption()
|
||||
{
|
||||
return menuEntry.getOption();
|
||||
}
|
||||
|
||||
public void setMenuOption(String menuOption)
|
||||
{
|
||||
menuEntry.setOption(menuOption);
|
||||
}
|
||||
|
||||
/**
|
||||
* The target of the action.
|
||||
*/
|
||||
public String getMenuTarget()
|
||||
{
|
||||
return menuEntry.getTarget();
|
||||
}
|
||||
|
||||
public void setMenuTarget(String menuTarget)
|
||||
{
|
||||
menuEntry.setOption(menuTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
* The action performed.
|
||||
*/
|
||||
public MenuAction getMenuAction()
|
||||
{
|
||||
return menuEntry.getType();
|
||||
}
|
||||
|
||||
public void setMenuAction(MenuAction menuAction)
|
||||
{
|
||||
menuEntry.setType(menuAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the object, actor, or item that the interaction targets.
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return menuEntry.getIdentifier();
|
||||
}
|
||||
|
||||
public void setId(int id)
|
||||
{
|
||||
menuEntry.setIdentifier(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.
|
||||
* @return
|
||||
*/
|
||||
public boolean isItemOp()
|
||||
{
|
||||
return menuEntry.isItemOp();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item op id
|
||||
* @return 1-5
|
||||
*/
|
||||
public int getItemOp()
|
||||
{
|
||||
return menuEntry.getItemOp();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item id
|
||||
* @return
|
||||
* @see net.runelite.api.ItemID
|
||||
* @see net.runelite.api.NullItemID
|
||||
*/
|
||||
public int getItemId()
|
||||
{
|
||||
return menuEntry.getItemId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the widget this menu entry is on, if this is a menu entry
|
||||
* with an associated widget. Such as eg, CC_OP.
|
||||
* @return
|
||||
*/
|
||||
public Widget getWidget()
|
||||
{
|
||||
return menuEntry.getWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the event as having been consumed.
|
||||
* <p>
|
||||
@@ -87,6 +185,32 @@ public class MenuOptionClicked
|
||||
this.consumed = true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getActionParam()
|
||||
{
|
||||
return menuEntry.getParam0();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setActionParam(int actionParam)
|
||||
{
|
||||
menuEntry.setParam0(actionParam);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getWidgetId()
|
||||
{
|
||||
return menuEntry.getParam1();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setWidgetId(int widgetId)
|
||||
{
|
||||
menuEntry.setParam1(widgetId);
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public void setMenuEntry(MenuEntry entry)
|
||||
{
|
||||
this.setMenuOption(entry.getOption());
|
||||
@@ -96,28 +220,4 @@ public class MenuOptionClicked
|
||||
this.setParam0(entry.getParam0());
|
||||
this.setParam1(entry.getParam1());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getActionParam()
|
||||
{
|
||||
return param0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setActionParam(int i)
|
||||
{
|
||||
param0 = i;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getWidgetId()
|
||||
{
|
||||
return param1;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setWidgetId(int i)
|
||||
{
|
||||
param1 = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,7 @@ public class InventoryWidgetItemQuery extends WidgetItemQuery
|
||||
WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER,
|
||||
WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER,
|
||||
WidgetInfo.GUIDE_PRICES_INVENTORY_ITEMS_CONTAINER,
|
||||
WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER,
|
||||
WidgetInfo.INVENTORY
|
||||
WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER
|
||||
};
|
||||
|
||||
@Override
|
||||
@@ -69,36 +68,29 @@ public class InventoryWidgetItemQuery extends WidgetItemQuery
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (widgetInfo == WidgetInfo.INVENTORY)
|
||||
{
|
||||
widgetItems.addAll(inventory.getWidgetItems());
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Widget[] children = inventory.getDynamicChildren();
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
Widget child = children[i];
|
||||
boolean isDragged = child.isWidgetItemDragged(child.getItemId());
|
||||
int dragOffsetX = 0;
|
||||
int dragOffsetY = 0;
|
||||
|
||||
if (isDragged)
|
||||
{
|
||||
Point p = child.getWidgetItemDragOffsets();
|
||||
dragOffsetX = p.getX();
|
||||
dragOffsetY = p.getY();
|
||||
}
|
||||
// set bounds to same size as default inventory
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
Rectangle dragBounds = child.getBounds();
|
||||
dragBounds.setBounds(bounds.x + dragOffsetX, bounds.y + dragOffsetY, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds, child, dragBounds));
|
||||
Widget[] children = inventory.getDynamicChildren();
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
Widget child = children[i];
|
||||
boolean isDragged = child.isWidgetItemDragged(child.getItemId());
|
||||
int dragOffsetX = 0;
|
||||
int dragOffsetY = 0;
|
||||
|
||||
if (isDragged)
|
||||
{
|
||||
Point p = child.getWidgetItemDragOffsets();
|
||||
dragOffsetX = p.getX();
|
||||
dragOffsetY = p.getY();
|
||||
}
|
||||
break;
|
||||
// set bounds to same size as default inventory
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
Rectangle dragBounds = child.getBounds();
|
||||
dragBounds.setBounds(bounds.x + dragOffsetX, bounds.y + dragOffsetY, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds, child, dragBounds));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return widgetItems;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class PvPUtil
|
||||
{
|
||||
wildernessLevel += 15;
|
||||
}
|
||||
if (client.getVar(Varbits.IN_WILDERNESS) == 1)
|
||||
if (client.getVarbitValue(Varbits.IN_WILDERNESS) == 1)
|
||||
{
|
||||
wildernessLevel += getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation());
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class RuneLiteProperties
|
||||
public static HttpUrl getPluginHubBase()
|
||||
{
|
||||
String version = System.getProperty(PLUGINHUB_VERSION, properties.getProperty(PLUGINHUB_VERSION));
|
||||
return HttpUrl.parse(properties.get(PLUGINHUB_BASE) + "/" + version);
|
||||
return HttpUrl.get(properties.get(PLUGINHUB_BASE) + "/" + version);
|
||||
}
|
||||
|
||||
public static String getApiBase()
|
||||
|
||||
@@ -50,7 +50,7 @@ import okhttp3.Response;
|
||||
@Slf4j
|
||||
public class ConfigClient
|
||||
{
|
||||
private static final MediaType TEXT_PLAIN = MediaType.parse("text/plain");
|
||||
private static final MediaType TEXT_PLAIN = MediaType.get("text/plain");
|
||||
private static final Gson GSON = RuneLiteAPI.GSON;
|
||||
|
||||
private final OkHttpClient client;
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ExternalPluginClient
|
||||
}
|
||||
catch (NoSuchAlgorithmException | InvalidKeyException | SignatureException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
throw new VerificationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,12 @@ package net.runelite.client.plugins.antidrag;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -49,6 +52,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
tags = {"antidrag", "delay", "inventory", "items"},
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
static final String CONFIG_GROUP = "antiDrag";
|
||||
@@ -136,6 +140,11 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOverriding()
|
||||
{
|
||||
return (!config.onShiftOnly() || shiftHeld) && !ctrlHeld;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
@@ -176,12 +185,52 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
{
|
||||
if ((widgetLoaded.getGroupId() == WidgetID.BANK_GROUP_ID ||
|
||||
if (!isOverriding())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (widgetLoaded.getGroupId() == WidgetID.BANK_GROUP_ID ||
|
||||
widgetLoaded.getGroupId() == WidgetID.BANK_INVENTORY_GROUP_ID ||
|
||||
widgetLoaded.getGroupId() == WidgetID.DEPOSIT_BOX_GROUP_ID) && (!config.onShiftOnly() || shiftHeld) && !ctrlHeld)
|
||||
widgetLoaded.getGroupId() == WidgetID.DEPOSIT_BOX_GROUP_ID)
|
||||
{
|
||||
setBankDragDelay(config.dragDelay());
|
||||
}
|
||||
else if (widgetLoaded.getGroupId() == WidgetID.INVENTORY_GROUP_ID)
|
||||
{
|
||||
setInvDragDelay(config.dragDelay());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onScriptPostFired(ScriptPostFired ev)
|
||||
{
|
||||
if (ev.getScriptId() == ScriptID.INVENTORY_DRAWITEM)
|
||||
{
|
||||
Widget inv = client.getWidget(WidgetInfo.INVENTORY);
|
||||
final int delay = config.dragDelay();
|
||||
boolean overriding = isOverriding();
|
||||
for (Widget child : inv.getDynamicChildren())
|
||||
{
|
||||
// disable [clientscript,inventory_antidrag_update] listener
|
||||
child.setOnMouseRepeatListener((Object[]) null);
|
||||
if (overriding)
|
||||
{
|
||||
child.setDragDeadTime(delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyDragDelay(Widget widget, int delay)
|
||||
{
|
||||
if (widget != null)
|
||||
{
|
||||
for (Widget item : widget.getDynamicChildren())
|
||||
{
|
||||
item.setDragDeadTime(delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setBankDragDelay(int delay)
|
||||
@@ -189,41 +238,32 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
final Widget bankItemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
|
||||
final Widget bankInventoryItemsContainer = client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER);
|
||||
final Widget bankDepositContainer = client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER);
|
||||
if (bankItemContainer != null)
|
||||
{
|
||||
Widget[] items = bankItemContainer.getDynamicChildren();
|
||||
for (Widget item : items)
|
||||
{
|
||||
item.setDragDeadTime(delay);
|
||||
}
|
||||
}
|
||||
if (bankInventoryItemsContainer != null)
|
||||
{
|
||||
Widget[] items = bankInventoryItemsContainer.getDynamicChildren();
|
||||
for (Widget item : items)
|
||||
{
|
||||
item.setDragDeadTime(delay);
|
||||
}
|
||||
}
|
||||
if (bankDepositContainer != null)
|
||||
{
|
||||
Widget[] items = bankDepositContainer.getDynamicChildren();
|
||||
for (Widget item : items)
|
||||
{
|
||||
item.setDragDeadTime(delay);
|
||||
}
|
||||
}
|
||||
|
||||
applyDragDelay(bankItemContainer, delay);
|
||||
applyDragDelay(bankInventoryItemsContainer, delay);
|
||||
applyDragDelay(bankDepositContainer, delay);
|
||||
}
|
||||
|
||||
private void setInvDragDelay(int delay)
|
||||
{
|
||||
final Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
||||
applyDragDelay(inventory, delay);
|
||||
}
|
||||
|
||||
private void setDragDelay()
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
setBankDragDelay(config.dragDelay());
|
||||
final int delay = config.dragDelay();
|
||||
log.debug("Set delay to {}", delay);
|
||||
client.setInventoryDragDelay(delay);
|
||||
setInvDragDelay(delay);
|
||||
setBankDragDelay(delay);
|
||||
}
|
||||
|
||||
private void resetDragDelay()
|
||||
{
|
||||
log.debug("Reset delay to {}", DEFAULT_DELAY);
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
setInvDragDelay(DEFAULT_DELAY);
|
||||
setBankDragDelay(DEFAULT_DELAY);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
@@ -58,6 +59,8 @@ import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -74,6 +77,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
description = "Show information about cannon placement and/or amount of cannonballs",
|
||||
tags = {"combat", "notifications", "ranged", "overlay"}
|
||||
)
|
||||
@Slf4j
|
||||
public class CannonPlugin extends Plugin
|
||||
{
|
||||
private static final Pattern NUMBER_PATTERN = Pattern.compile("([0-9]+)");
|
||||
@@ -284,16 +288,11 @@ public class CannonPlugin extends Plugin
|
||||
}
|
||||
|
||||
// Check if cannonballs are being used on the cannon
|
||||
if (event.getMenuAction() == MenuAction.ITEM_USE_ON_GAME_OBJECT)
|
||||
if (event.getMenuAction() == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
final int idx = event.getSelectedItemIndex();
|
||||
final ItemContainer items = client.getItemContainer(InventoryID.INVENTORY);
|
||||
if (items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final Item item = items.getItem(idx);
|
||||
if (item == null || (item.getId() != ItemID.CANNONBALL && item.getId() != ItemID.GRANITE_CANNONBALL))
|
||||
final Widget selected = client.getSelectedWidget();
|
||||
final int itemId = selected.getItemId();
|
||||
if (itemId != ItemID.CANNONBALL && itemId != ItemID.GRANITE_CANNONBALL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -306,6 +305,7 @@ public class CannonPlugin extends Plugin
|
||||
|
||||
// Store the click location as a WorldPoint to avoid issues with scene loads
|
||||
clickedCannonLocation = WorldPoint.fromScene(client, event.getParam0(), event.getParam1(), client.getPlane());
|
||||
log.debug("Updated cannon location: {}", clickedCannonLocation);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -325,14 +325,8 @@ public class ClueScrollPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean itemClicked = event.getMenuAction() == MenuAction.ITEM_FIRST_OPTION
|
||||
|| event.getMenuAction() == MenuAction.ITEM_SECOND_OPTION
|
||||
|| event.getMenuAction() == MenuAction.ITEM_THIRD_OPTION
|
||||
|| event.getMenuAction() == MenuAction.ITEM_FOURTH_OPTION
|
||||
|| event.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION;
|
||||
final boolean isXMarksTheSpotOrb = event.getId() == ItemID.MYSTERIOUS_ORB_23069;
|
||||
|
||||
if (itemClicked && (isXMarksTheSpotOrb || event.getMenuOption().equals("Read")))
|
||||
final boolean isXMarksTheSpotOrb = event.getItemId() == ItemID.MYSTERIOUS_ORB_23069;
|
||||
if (isXMarksTheSpotOrb || event.getMenuOption().equals("Read"))
|
||||
{
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(event.getId());
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ import okhttp3.Response;
|
||||
public class CrowdsourcingManager
|
||||
{
|
||||
private static final String CROWDSOURCING_BASE = "https://crowdsource.runescape.wiki/runelite";
|
||||
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
||||
private static final MediaType JSON = MediaType.get("application/json; charset=utf-8");
|
||||
|
||||
@Inject
|
||||
private OkHttpClient okHttpClient;
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.Skill;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.crowdsourcing.CrowdsourcingManager;
|
||||
|
||||
@@ -114,7 +115,8 @@ public class CrowdsourcingCooking
|
||||
|| action == MenuAction.GAME_OBJECT_SECOND_OPTION
|
||||
|| action == MenuAction.GAME_OBJECT_THIRD_OPTION
|
||||
|| action == MenuAction.GAME_OBJECT_FOURTH_OPTION
|
||||
|| action == MenuAction.GAME_OBJECT_FIFTH_OPTION)
|
||||
|| action == MenuAction.GAME_OBJECT_FIFTH_OPTION
|
||||
|| action == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
lastGameObjectClicked = menuOptionClicked.getId();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,11 @@ public class CrowdsourcingZMI
|
||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||
{
|
||||
MenuAction action = menuOptionClicked.getMenuAction();
|
||||
|
||||
if (menuOptionClicked.isItemOp())
|
||||
{
|
||||
illegalActionTick = client.getTickCount();
|
||||
return;
|
||||
}
|
||||
switch (action)
|
||||
{
|
||||
case ITEM_FIRST_OPTION:
|
||||
|
||||
@@ -61,7 +61,6 @@ import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
@@ -420,11 +419,18 @@ class DevToolsOverlay extends Overlay
|
||||
return;
|
||||
}
|
||||
|
||||
for (WidgetItem item : inventoryWidget.getWidgetItems())
|
||||
for (Widget item : inventoryWidget.getDynamicChildren())
|
||||
{
|
||||
Rectangle slotBounds = item.getCanvasBounds();
|
||||
Rectangle slotBounds = item.getBounds();
|
||||
int itemId = item.getItemId();
|
||||
|
||||
if (itemId == 6512)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String idText = "" + itemId;
|
||||
|
||||
String idText = "" + item.getId();
|
||||
FontMetrics fm = graphics.getFontMetrics();
|
||||
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
|
||||
|
||||
|
||||
@@ -516,8 +516,8 @@ class WidgetInspector extends DevToolsFrame
|
||||
for (int i = 0; i < menuEntries.length; i++)
|
||||
{
|
||||
MenuEntry entry = menuEntries[i];
|
||||
if (entry.getType() != MenuAction.ITEM_USE_ON_WIDGET
|
||||
&& entry.getType() != MenuAction.SPELL_CAST_ON_WIDGET)
|
||||
if (entry.getType() != MenuAction.WIDGET_USE_ON_ITEM
|
||||
&& entry.getType() != MenuAction.WIDGET_TARGET_ON_WIDGET)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -543,7 +543,7 @@ class WidgetInspector extends DevToolsFrame
|
||||
|
||||
Object getWidgetOrWidgetItemForMenuOption(MenuAction type, int param0, int param1)
|
||||
{
|
||||
if (type == MenuAction.SPELL_CAST_ON_WIDGET)
|
||||
if (type == MenuAction.WIDGET_TARGET_ON_WIDGET)
|
||||
{
|
||||
Widget w = client.getWidget(param1);
|
||||
if (param0 != -1)
|
||||
@@ -553,7 +553,7 @@ class WidgetInspector extends DevToolsFrame
|
||||
|
||||
return w;
|
||||
}
|
||||
else if (type == MenuAction.ITEM_USE_ON_WIDGET)
|
||||
else if (type == MenuAction.WIDGET_USE_ON_ITEM)
|
||||
{
|
||||
Widget w = client.getWidget(param1);
|
||||
return w.getWidgetItem(param0);
|
||||
|
||||
@@ -54,10 +54,7 @@ import lombok.Setter;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
@@ -72,6 +69,7 @@ import net.runelite.api.events.ItemQuantityChanged;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -485,7 +483,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
MenuAction type = MenuAction.of(event.getType());
|
||||
if (type == MenuAction.GROUND_ITEM_FIRST_OPTION || type == MenuAction.GROUND_ITEM_SECOND_OPTION ||
|
||||
type == MenuAction.GROUND_ITEM_THIRD_OPTION || type == MenuAction.GROUND_ITEM_FOURTH_OPTION ||
|
||||
type == MenuAction.GROUND_ITEM_FIFTH_OPTION || type == MenuAction.SPELL_CAST_ON_GROUND_ITEM)
|
||||
type == MenuAction.GROUND_ITEM_FIFTH_OPTION || type == MenuAction.WIDGET_TARGET_ON_GROUND_ITEM)
|
||||
{
|
||||
final int itemId = event.getIdentifier();
|
||||
final int sceneX = event.getActionParam0();
|
||||
@@ -688,28 +686,16 @@ public class GroundItemsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||
{
|
||||
if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_FIFTH_OPTION)
|
||||
if (menuOptionClicked.isItemOp() && menuOptionClicked.getMenuOption().equals("Drop"))
|
||||
{
|
||||
int itemId = menuOptionClicked.getId();
|
||||
int itemId = menuOptionClicked.getItemId();
|
||||
// Keep a queue of recently dropped items to better detect
|
||||
// item spawns that are drops
|
||||
droppedItemQueue.add(itemId);
|
||||
}
|
||||
else if (menuOptionClicked.getMenuAction() == MenuAction.ITEM_USE_ON_GAME_OBJECT)
|
||||
else if (menuOptionClicked.getMenuAction() == MenuAction.WIDGET_TARGET_ON_GAME_OBJECT && client.getSelectedWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
||||
if (inventory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Item clickedItem = inventory.getItem(menuOptionClicked.getSelectedItemIndex());
|
||||
if (clickedItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastUsedItem = clickedItem.getId();
|
||||
lastUsedItem = client.getSelectedWidget().getItemId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class InteractHighlightOverlay extends Overlay
|
||||
switch (menuAction)
|
||||
{
|
||||
case ITEM_USE_ON_GAME_OBJECT:
|
||||
case SPELL_CAST_ON_GAME_OBJECT:
|
||||
case WIDGET_TARGET_ON_GAME_OBJECT:
|
||||
case GAME_OBJECT_FIRST_OPTION:
|
||||
case GAME_OBJECT_SECOND_OPTION:
|
||||
case GAME_OBJECT_THIRD_OPTION:
|
||||
@@ -104,7 +104,7 @@ class InteractHighlightOverlay extends Overlay
|
||||
break;
|
||||
}
|
||||
case ITEM_USE_ON_NPC:
|
||||
case SPELL_CAST_ON_NPC:
|
||||
case WIDGET_TARGET_ON_NPC:
|
||||
case NPC_FIRST_OPTION:
|
||||
case NPC_SECOND_OPTION:
|
||||
case NPC_THIRD_OPTION:
|
||||
@@ -116,7 +116,7 @@ class InteractHighlightOverlay extends Overlay
|
||||
NPC npc = plugin.findNpc(id);
|
||||
if (npc != null && config.npcShowHover() && (npc != plugin.getInteractedTarget() || !config.npcShowInteract()))
|
||||
{
|
||||
Color highlightColor = menuAction == MenuAction.NPC_SECOND_OPTION || menuAction == MenuAction.SPELL_CAST_ON_NPC
|
||||
Color highlightColor = menuAction == MenuAction.NPC_SECOND_OPTION || menuAction == MenuAction.WIDGET_TARGET_ON_NPC
|
||||
? config.npcAttackHoverHighlightColor() : config.npcHoverHighlightColor();
|
||||
modelOutlineRenderer.drawOutline(npc, config.borderWidth(), highlightColor, config.outlineFeather());
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class InteractHighlightPlugin extends Plugin
|
||||
switch (menuOptionClicked.getMenuAction())
|
||||
{
|
||||
case ITEM_USE_ON_GAME_OBJECT:
|
||||
case SPELL_CAST_ON_GAME_OBJECT:
|
||||
case WIDGET_TARGET_ON_GAME_OBJECT:
|
||||
case GAME_OBJECT_FIRST_OPTION:
|
||||
case GAME_OBJECT_SECOND_OPTION:
|
||||
case GAME_OBJECT_THIRD_OPTION:
|
||||
@@ -158,7 +158,7 @@ public class InteractHighlightPlugin extends Plugin
|
||||
break;
|
||||
}
|
||||
case ITEM_USE_ON_NPC:
|
||||
case SPELL_CAST_ON_NPC:
|
||||
case WIDGET_TARGET_ON_NPC:
|
||||
case NPC_FIRST_OPTION:
|
||||
case NPC_SECOND_OPTION:
|
||||
case NPC_THIRD_OPTION:
|
||||
@@ -168,7 +168,7 @@ public class InteractHighlightPlugin extends Plugin
|
||||
int id = menuOptionClicked.getId();
|
||||
interactedObject = null;
|
||||
interactedNpc = findNpc(id);
|
||||
attacked = menuOptionClicked.getMenuAction() == MenuAction.NPC_SECOND_OPTION || menuOptionClicked.getMenuAction() == MenuAction.SPELL_CAST_ON_NPC;
|
||||
attacked = menuOptionClicked.getMenuAction() == MenuAction.NPC_SECOND_OPTION || menuOptionClicked.getMenuAction() == MenuAction.WIDGET_TARGET_ON_NPC;
|
||||
clickTick = client.getTickCount();
|
||||
gameCycle = client.getGameCycle();
|
||||
break;
|
||||
@@ -176,8 +176,11 @@ public class InteractHighlightPlugin extends Plugin
|
||||
// Any menu click which clears an interaction
|
||||
case WALK:
|
||||
case ITEM_USE:
|
||||
case WIDGET_TARGET_ON_WIDGET:
|
||||
case ITEM_USE_ON_GROUND_ITEM:
|
||||
case WIDGET_TARGET_ON_GROUND_ITEM:
|
||||
case ITEM_USE_ON_PLAYER:
|
||||
case WIDGET_TARGET_ON_PLAYER:
|
||||
case ITEM_FIRST_OPTION:
|
||||
case ITEM_SECOND_OPTION:
|
||||
case ITEM_THIRD_OPTION:
|
||||
@@ -190,6 +193,13 @@ public class InteractHighlightPlugin extends Plugin
|
||||
case GROUND_ITEM_FIFTH_OPTION:
|
||||
interactedObject = null;
|
||||
interactedNpc = null;
|
||||
break;
|
||||
default:
|
||||
if (menuOptionClicked.isItemOp())
|
||||
{
|
||||
interactedObject = null;
|
||||
interactedNpc = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,16 +78,13 @@ class InventoryGridOverlay extends Overlay
|
||||
}
|
||||
|
||||
// grid is only supported on bank inventory and inventory
|
||||
Widget inventoryWidget = draggingWidget.isIf3() ?
|
||||
client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER) :
|
||||
client.getWidget(WidgetInfo.INVENTORY);
|
||||
|
||||
// with if3 the dragged widget is a child of the inventory, with if1 it is an item of the inventory (and the same widget)
|
||||
if (inventoryWidget == null || (draggingWidget.isIf3() ? draggingWidget.getParent() != inventoryWidget : draggingWidget != inventoryWidget))
|
||||
if (draggingWidget.getId() != WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId()
|
||||
&& draggingWidget.getId() != WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final Widget inventoryWidget = draggingWidget.getParent();
|
||||
final net.runelite.api.Point mouse = client.getMouseCanvasPosition();
|
||||
final Point mousePoint = new Point(mouse.getX(), mouse.getY());
|
||||
final int draggedItemIndex = draggingWidget.isIf3() ? draggingWidget.getIndex() : client.getIf1DraggedItemIndex();
|
||||
@@ -100,7 +97,7 @@ class InventoryGridOverlay extends Overlay
|
||||
}
|
||||
|
||||
if (draggedItem.getId() == -1
|
||||
|| client.getItemPressedDuration() < config.dragDelay() / Constants.CLIENT_TICK_LENGTH
|
||||
|| (draggingWidget.isIf3() ? client.getDragTime() : client.getItemPressedDuration()) < config.dragDelay() / Constants.CLIENT_TICK_LENGTH
|
||||
|| !hoverActive && initialMousePoint.distance(mousePoint) < DISTANCE_TO_ACTIVATE_HOVER)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -164,42 +164,43 @@ public class InventoryTagsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final int widgetId = firstEntry.getParam1();
|
||||
|
||||
// Inventory item menu
|
||||
if (widgetId == WidgetInfo.INVENTORY.getId())
|
||||
final int itemId;
|
||||
if (firstEntry.getType() == MenuAction.WIDGET_TARGET && firstEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
int itemId = firstEntry.getIdentifier();
|
||||
itemId = firstEntry.getWidget().getItemId();
|
||||
}
|
||||
else if (firstEntry.isItemOp())
|
||||
{
|
||||
itemId = firstEntry.getItemId();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemId == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Set menu to only be Cancel
|
||||
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), 1));
|
||||
|
||||
// Set menu to only be Cancel
|
||||
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), 1));
|
||||
for (final String groupName : GROUPS)
|
||||
{
|
||||
final String group = getTag(itemId);
|
||||
final Color color = getGroupNameColor(groupName);
|
||||
|
||||
for (final String groupName : GROUPS)
|
||||
{
|
||||
final String group = getTag(itemId);
|
||||
final Color color = getGroupNameColor(groupName);
|
||||
|
||||
client.createMenuEntry(-1)
|
||||
.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET)
|
||||
.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)))
|
||||
.setType(MenuAction.RUNELITE)
|
||||
.onClick(e ->
|
||||
client.createMenuEntry(-1)
|
||||
.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET)
|
||||
.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)))
|
||||
.setType(MenuAction.RUNELITE)
|
||||
.onClick(e ->
|
||||
{
|
||||
if (e.getOption().equals(MENU_SET))
|
||||
{
|
||||
if (e.getOption().equals(MENU_SET))
|
||||
{
|
||||
setTag(itemId, groupName);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsetTag(itemId);
|
||||
}
|
||||
});
|
||||
}
|
||||
setTag(itemId, groupName);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsetTag(itemId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,11 +98,20 @@ class ItemPricesOverlay extends Overlay
|
||||
// Tooltip action type handling
|
||||
switch (action)
|
||||
{
|
||||
case ITEM_USE_ON_WIDGET:
|
||||
case WIDGET_TARGET_ON_WIDGET:
|
||||
// Check target widget is the inventory
|
||||
if (menuEntry.getWidget().getId() != WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
break;
|
||||
}
|
||||
// FALLTHROUGH
|
||||
case WIDGET_USE_ON_ITEM:
|
||||
// Require showWhileAlching and Cast High Level Alchemy
|
||||
if (!config.showWhileAlching() || !isAlching)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// FALLTHROUGH
|
||||
case CC_OP:
|
||||
case ITEM_USE:
|
||||
case ITEM_FIRST_OPTION:
|
||||
@@ -110,38 +119,49 @@ class ItemPricesOverlay extends Overlay
|
||||
case ITEM_THIRD_OPTION:
|
||||
case ITEM_FOURTH_OPTION:
|
||||
case ITEM_FIFTH_OPTION:
|
||||
// Item tooltip values
|
||||
switch (groupId)
|
||||
{
|
||||
case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:
|
||||
if (!config.showWhileAlching())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case WidgetID.INVENTORY_GROUP_ID:
|
||||
case WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID:
|
||||
if (config.hideInventory() && !(config.showWhileAlching() && isAlching))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// intentional fallthrough
|
||||
case WidgetID.BANK_GROUP_ID:
|
||||
case WidgetID.BANK_INVENTORY_GROUP_ID:
|
||||
case WidgetID.SEED_VAULT_GROUP_ID:
|
||||
case WidgetID.SEED_VAULT_INVENTORY_GROUP_ID:
|
||||
// Make tooltip
|
||||
final String text = makeValueTooltip(menuEntry);
|
||||
if (text != null)
|
||||
{
|
||||
tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238))));
|
||||
}
|
||||
break;
|
||||
}
|
||||
addTooltip(menuEntry, isAlching, groupId);
|
||||
break;
|
||||
case WIDGET_TARGET:
|
||||
// Check that this is the inventory
|
||||
if (menuEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
addTooltip(menuEntry, isAlching, groupId);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void addTooltip(MenuEntry menuEntry, boolean isAlching, int groupId)
|
||||
{
|
||||
// Item tooltip values
|
||||
switch (groupId)
|
||||
{
|
||||
case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:
|
||||
if (!config.showWhileAlching())
|
||||
{
|
||||
return;
|
||||
}
|
||||
case WidgetID.INVENTORY_GROUP_ID:
|
||||
case WidgetID.POH_TREASURE_CHEST_INVENTORY_GROUP_ID:
|
||||
if (config.hideInventory() && (!config.showWhileAlching() || !isAlching))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// FALLTHROUGH
|
||||
case WidgetID.BANK_GROUP_ID:
|
||||
case WidgetID.BANK_INVENTORY_GROUP_ID:
|
||||
case WidgetID.SEED_VAULT_GROUP_ID:
|
||||
case WidgetID.SEED_VAULT_INVENTORY_GROUP_ID:
|
||||
// Make tooltip
|
||||
final String text = makeValueTooltip(menuEntry);
|
||||
if (text != null)
|
||||
{
|
||||
tooltipManager.add(new Tooltip(ColorUtil.prependColorTag(text, new Color(238, 238, 238))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String makeValueTooltip(MenuEntry menuEntry)
|
||||
{
|
||||
// Disabling both disables all value tooltips
|
||||
|
||||
@@ -85,29 +85,20 @@ public class ItemStatOverlay extends Overlay
|
||||
|
||||
final MenuEntry[] menu = client.getMenuEntries();
|
||||
final int menuSize = menu.length;
|
||||
|
||||
if (menuSize <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final MenuEntry entry = menu[menuSize - 1];
|
||||
final int group = WidgetInfo.TO_GROUP(entry.getParam1());
|
||||
final int child = WidgetInfo.TO_CHILD(entry.getParam1());
|
||||
final Widget widget = client.getWidget(group, child);
|
||||
|
||||
if (widget == null
|
||||
|| !(group == WidgetInfo.INVENTORY.getGroupId()
|
||||
|| group == WidgetInfo.EQUIPMENT.getGroupId()
|
||||
|| group == WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER.getGroupId()
|
||||
|| (config.showStatsInBank()
|
||||
&& ((group == WidgetInfo.BANK_ITEM_CONTAINER.getGroupId() && child == WidgetInfo.BANK_ITEM_CONTAINER.getChildId())
|
||||
|| group == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId()))))
|
||||
final Widget widget = entry.getWidget();
|
||||
if (widget == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int itemId = entry.getIdentifier();
|
||||
final int group = WidgetInfo.TO_GROUP(widget.getId());
|
||||
int itemId = -1;
|
||||
|
||||
if (group == WidgetInfo.EQUIPMENT.getGroupId() ||
|
||||
// For bank worn equipment, check widget parent to differentiate from normal bank items
|
||||
@@ -119,19 +110,17 @@ public class ItemStatOverlay extends Overlay
|
||||
itemId = widgetItem.getItemId();
|
||||
}
|
||||
}
|
||||
else if (group == WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER.getGroupId()
|
||||
|| group == WidgetInfo.BANK_ITEM_CONTAINER.getGroupId()
|
||||
|| group == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId())
|
||||
else if (widget.getId() == WidgetInfo.INVENTORY.getId()
|
||||
|| group == WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER.getGroupId()
|
||||
|| widget.getId() == WidgetInfo.BANK_ITEM_CONTAINER.getId() && config.showStatsInBank()
|
||||
|| group == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getGroupId() && config.showStatsInBank())
|
||||
{
|
||||
int index = entry.getParam0();
|
||||
if (index > -1)
|
||||
{
|
||||
final Widget widgetItem = widget.getChild(index);
|
||||
if (widgetItem != null)
|
||||
{
|
||||
itemId = widgetItem.getItemId();
|
||||
}
|
||||
}
|
||||
itemId = widget.getItemId();
|
||||
}
|
||||
|
||||
if (itemId == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (config.consumableStats())
|
||||
|
||||
@@ -971,19 +971,19 @@ public class LootTrackerPlugin extends Plugin
|
||||
{
|
||||
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, SHADE_CHEST_OBJECTS.get(event.getId())));
|
||||
}
|
||||
else if (isItemOp(event.getMenuAction()))
|
||||
else if (event.isItemOp())
|
||||
{
|
||||
if (event.getMenuOption().equals("Take") && event.getId() == ItemID.SEED_PACK)
|
||||
if (event.getMenuOption().equals("Take") && event.getItemId() == ItemID.SEED_PACK)
|
||||
{
|
||||
onInvChange(collectInvItems(LootRecordType.EVENT, SEEDPACK_EVENT));
|
||||
}
|
||||
else if (event.getMenuOption().equals("Search") && BIRDNEST_IDS.contains(event.getId()))
|
||||
else if (event.getMenuOption().equals("Search") && BIRDNEST_IDS.contains(event.getItemId()))
|
||||
{
|
||||
onInvChange(collectInvItems(LootRecordType.EVENT, BIRDNEST_EVENT));
|
||||
}
|
||||
else if (event.getMenuOption().equals("Open"))
|
||||
{
|
||||
switch (event.getId())
|
||||
switch (event.getItemId())
|
||||
{
|
||||
case ItemID.CASKET:
|
||||
onInvChange(collectInvItems(LootRecordType.EVENT, CASKET_EVENT));
|
||||
@@ -1004,7 +1004,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
case ItemID.SIMPLE_LOCKBOX_25647:
|
||||
case ItemID.ELABORATE_LOCKBOX_25649:
|
||||
case ItemID.ORNATE_LOCKBOX_25651:
|
||||
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, itemManager.getItemComposition(event.getId()).getName()));
|
||||
onInvChange(collectInvAndGroundItems(LootRecordType.EVENT, itemManager.getItemComposition(event.getItemId()).getName()));
|
||||
break;
|
||||
case ItemID.SUPPLY_CRATE_24884:
|
||||
onInvChange(collectInvItems(LootRecordType.EVENT, MAHOGANY_CRATE_EVENT, client.getBoostedSkillLevel(Skill.CONSTRUCTION)));
|
||||
@@ -1014,14 +1014,14 @@ public class LootTrackerPlugin extends Plugin
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (event.getMenuOption().equals("Loot") && IMPLING_JARS.contains(event.getId()))
|
||||
else if (event.getMenuOption().equals("Loot") && IMPLING_JARS.contains(event.getItemId()))
|
||||
{
|
||||
onInvChange(((invItems, groundItems, removedItems) ->
|
||||
{
|
||||
int cnt = removedItems.count(event.getId());
|
||||
int cnt = removedItems.count(event.getItemId());
|
||||
if (cnt > 0)
|
||||
{
|
||||
String name = itemManager.getItemComposition(event.getId()).getName();
|
||||
String name = itemManager.getItemComposition(event.getItemId()).getName();
|
||||
addLoot(name, -1, LootRecordType.EVENT, null, invItems, cnt);
|
||||
}
|
||||
}));
|
||||
@@ -1038,12 +1038,6 @@ public class LootTrackerPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isItemOp(MenuAction menuAction)
|
||||
{
|
||||
final int id = menuAction.getId();
|
||||
return id >= MenuAction.ITEM_FIRST_OPTION.getId() && id <= MenuAction.ITEM_FIFTH_OPTION.getId();
|
||||
}
|
||||
|
||||
private static boolean isNPCOp(MenuAction menuAction)
|
||||
{
|
||||
final int id = menuAction.getId();
|
||||
|
||||
@@ -57,7 +57,6 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuOpened;
|
||||
import net.runelite.api.events.PostItemComposition;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -134,15 +133,6 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_LC = new WidgetMenuOption(SAVE,
|
||||
LEFT_CLICK_MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||
|
||||
private static final Set<MenuAction> ITEM_MENU_TYPES = ImmutableSet.of(
|
||||
MenuAction.ITEM_FIRST_OPTION,
|
||||
MenuAction.ITEM_SECOND_OPTION,
|
||||
MenuAction.ITEM_THIRD_OPTION,
|
||||
MenuAction.ITEM_FOURTH_OPTION,
|
||||
MenuAction.ITEM_FIFTH_OPTION,
|
||||
MenuAction.ITEM_USE
|
||||
);
|
||||
|
||||
private static final List<MenuAction> NPC_MENU_TYPES = ImmutableList.of(
|
||||
MenuAction.NPC_FIRST_OPTION,
|
||||
MenuAction.NPC_SECOND_OPTION,
|
||||
@@ -547,25 +537,27 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
MenuEntry firstEntry = event.getFirstEntry();
|
||||
final MenuEntry firstEntry = event.getFirstEntry();
|
||||
if (firstEntry == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int widgetId = firstEntry.getParam1();
|
||||
if (widgetId != WidgetInfo.INVENTORY.getId())
|
||||
final int itemId;
|
||||
if (firstEntry.getType() == MenuAction.WIDGET_TARGET && firstEntry.getWidget().getId() == WidgetInfo.INVENTORY.getId())
|
||||
{
|
||||
itemId = firstEntry.getWidget().getItemId();
|
||||
}
|
||||
else if (firstEntry.isItemOp())
|
||||
{
|
||||
itemId = firstEntry.getItemId();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int itemId = firstEntry.getIdentifier();
|
||||
if (itemId == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MenuAction activeAction = null;
|
||||
int activeOp = 0;
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||
|
||||
if (configuringShiftClick)
|
||||
@@ -576,7 +568,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
if (shiftClickActionIndex >= 0)
|
||||
{
|
||||
activeAction = MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + shiftClickActionIndex);
|
||||
activeOp = 1 + shiftClickActionIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -584,7 +576,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
Integer config = getItemSwapConfig(true, itemId);
|
||||
if (config != null && config == -1)
|
||||
{
|
||||
activeAction = MenuAction.ITEM_USE;
|
||||
activeOp = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -594,9 +586,9 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
Integer config = getItemSwapConfig(false, itemId);
|
||||
if (config != null)
|
||||
{
|
||||
activeAction = config >= 0
|
||||
? MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + config)
|
||||
: MenuAction.ITEM_USE;
|
||||
activeOp = config >= 0
|
||||
? 1 + config
|
||||
: -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,20 +596,31 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
|
||||
for (MenuEntry entry : entries)
|
||||
{
|
||||
final MenuAction menuAction = entry.getType();
|
||||
|
||||
if (ITEM_MENU_TYPES.contains(menuAction) && entry.getIdentifier() == itemId)
|
||||
if (entry.getType() == MenuAction.WIDGET_TARGET && entry.getWidget().getId() == WidgetInfo.INVENTORY.getId() && entry.getWidget().getItemId() == itemId)
|
||||
{
|
||||
entry.setType(MenuAction.RUNELITE);
|
||||
entry.onClick(e ->
|
||||
{
|
||||
int index = menuAction == MenuAction.ITEM_USE
|
||||
? -1
|
||||
: menuAction.getId() - MenuAction.ITEM_FIRST_OPTION.getId();
|
||||
setItemSwapConfig(configuringShiftClick, itemId, index);
|
||||
log.debug("Set {} item swap for {} to USE", configuringShiftClick ? "shift" : "left", itemId);
|
||||
setItemSwapConfig(configuringShiftClick, itemId, -1);
|
||||
});
|
||||
|
||||
if (activeAction == menuAction)
|
||||
if (activeOp == -1)
|
||||
{
|
||||
entry.setOption("* " + entry.getOption());
|
||||
}
|
||||
}
|
||||
else if (entry.isItemOp() && entry.getItemId() == itemId)
|
||||
{
|
||||
final int itemOp = entry.getItemOp();
|
||||
entry.setType(MenuAction.RUNELITE);
|
||||
entry.onClick(e ->
|
||||
{
|
||||
log.debug("Set {} item swap config for {} to {}", configuringShiftClick ? "shift" : "left", itemId, itemOp - 1);
|
||||
setItemSwapConfig(configuringShiftClick, itemId, itemOp - 1);
|
||||
});
|
||||
|
||||
if (itemOp == activeOp)
|
||||
{
|
||||
entry.setOption("* " + entry.getOption());
|
||||
}
|
||||
@@ -803,15 +806,14 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
private boolean swapBank(MenuEntry menuEntry, MenuAction type)
|
||||
{
|
||||
// This swap needs to happen prior to drag start on click, which happens during
|
||||
// widget ticking and prior to our client tick event. This is because drag start
|
||||
// is what builds the context menu row which is what the eventual click will use
|
||||
|
||||
final int widgetGroupId = WidgetInfo.TO_GROUP(menuEntryAdded.getActionParam1());
|
||||
if (type != MenuAction.CC_OP && type != MenuAction.CC_OP_LOW_PRIORITY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final int widgetGroupId = WidgetInfo.TO_GROUP(menuEntry.getParam1());
|
||||
final boolean isDepositBoxPlayerInventory = widgetGroupId == WidgetID.DEPOSIT_BOX_GROUP_ID;
|
||||
final boolean isChambersOfXericStorageUnitPlayerInventory = widgetGroupId == WidgetID.CHAMBERS_OF_XERIC_STORAGE_UNIT_INVENTORY_GROUP_ID;
|
||||
final boolean isGroupStoragePlayerInventory = widgetGroupId == WidgetID.GROUP_STORAGE_INVENTORY_GROUP_ID;
|
||||
@@ -819,9 +821,9 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
// Deposit- op 1 is the current withdraw amount 1/5/10/x for deposit box interface and chambers of xeric storage unit.
|
||||
// Deposit- op 2 is the current withdraw amount 1/5/10/x for bank interface
|
||||
if (shiftModifier() && config.bankDepositShiftClick() != ShiftDepositMode.OFF
|
||||
&& menuEntryAdded.getType() == MenuAction.CC_OP.getId()
|
||||
&& menuEntryAdded.getIdentifier() == (isDepositBoxPlayerInventory || isGroupStoragePlayerInventory || isChambersOfXericStorageUnitPlayerInventory ? 1 : 2)
|
||||
&& (menuEntryAdded.getOption().startsWith("Deposit-") || menuEntryAdded.getOption().startsWith("Store") || menuEntryAdded.getOption().startsWith("Donate")))
|
||||
&& type == MenuAction.CC_OP
|
||||
&& menuEntry.getIdentifier() == (isDepositBoxPlayerInventory || isGroupStoragePlayerInventory || isChambersOfXericStorageUnitPlayerInventory ? 1 : 2)
|
||||
&& (menuEntry.getOption().startsWith("Deposit-") || menuEntry.getOption().startsWith("Store") || menuEntry.getOption().startsWith("Donate")))
|
||||
{
|
||||
ShiftDepositMode shiftDepositMode = config.bankDepositShiftClick();
|
||||
final int opId = isDepositBoxPlayerInventory ? shiftDepositMode.getIdentifierDepositBox()
|
||||
@@ -830,13 +832,14 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
: shiftDepositMode.getIdentifier();
|
||||
final MenuAction action = opId >= 6 ? MenuAction.CC_OP_LOW_PRIORITY : MenuAction.CC_OP;
|
||||
bankModeSwap(action, opId);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Swap to shift-click withdraw behavior
|
||||
// Deposit- op 1 is the current withdraw amount 1/5/10/x
|
||||
if (shiftModifier() && config.bankWithdrawShiftClick() != ShiftWithdrawMode.OFF
|
||||
&& menuEntryAdded.getType() == MenuAction.CC_OP.getId() && menuEntryAdded.getIdentifier() == 1
|
||||
&& menuEntryAdded.getOption().startsWith("Withdraw"))
|
||||
&& type == MenuAction.CC_OP && menuEntry.getIdentifier() == 1
|
||||
&& menuEntry.getOption().startsWith("Withdraw"))
|
||||
{
|
||||
ShiftWithdrawMode shiftWithdrawMode = config.bankWithdrawShiftClick();
|
||||
final MenuAction action;
|
||||
@@ -852,7 +855,10 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
opId = shiftWithdrawMode.getIdentifier();
|
||||
}
|
||||
bankModeSwap(action, opId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void bankModeSwap(MenuAction entryType, int entryIdentifier)
|
||||
@@ -893,19 +899,15 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean itemOp = menuAction == MenuAction.ITEM_FIRST_OPTION
|
||||
|| menuAction == MenuAction.ITEM_SECOND_OPTION
|
||||
|| menuAction == MenuAction.ITEM_THIRD_OPTION
|
||||
|| menuAction == MenuAction.ITEM_FOURTH_OPTION
|
||||
|| menuAction == MenuAction.ITEM_FIFTH_OPTION
|
||||
|| menuAction == MenuAction.ITEM_USE;
|
||||
final boolean itemOp = menuEntry.isItemOp();
|
||||
// Custom shift-click item swap
|
||||
if (shiftModifier() && itemOp)
|
||||
{
|
||||
// Special case use shift click due to items not actually containing a "Use" option, making
|
||||
// the client unable to perform the swap itself.
|
||||
if (config.shiftClickCustomization() && !option.equals("use"))
|
||||
{
|
||||
Integer customOption = getItemSwapConfig(true, eventId);
|
||||
Integer customOption = getItemSwapConfig(true, menuEntry.getItemId());
|
||||
|
||||
if (customOption != null && customOption == -1)
|
||||
{
|
||||
@@ -921,14 +923,18 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
// Custom left-click item swap
|
||||
if (itemOp)
|
||||
{
|
||||
Integer swapIndex = getItemSwapConfig(false, eventId);
|
||||
Integer swapIndex = getItemSwapConfig(false, menuEntry.getItemId());
|
||||
if (swapIndex != null)
|
||||
{
|
||||
MenuAction swapAction = swapIndex >= 0
|
||||
? MenuAction.of(MenuAction.ITEM_FIRST_OPTION.getId() + swapIndex)
|
||||
: MenuAction.ITEM_USE;
|
||||
final int swapAction = swapIndex >= 0
|
||||
? 1 + swapIndex
|
||||
: -1;
|
||||
|
||||
if (menuAction == swapAction)
|
||||
if (swapAction == -1)
|
||||
{
|
||||
swap(menuEntries, "use", target, index, true);
|
||||
}
|
||||
else if (swapAction == menuEntry.getItemOp())
|
||||
{
|
||||
swap(optionIndexes, menuEntries, index, menuEntries.length - 1);
|
||||
}
|
||||
@@ -986,6 +992,11 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (swapBank(menuEntry, menuAction))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Built-in swaps
|
||||
Collection<Swap> swaps = this.swaps.get(option);
|
||||
for (Swap swap : swaps)
|
||||
|
||||
@@ -49,13 +49,13 @@ class MouseHighlightOverlay extends Overlay
|
||||
*/
|
||||
private static final Set<MenuAction> WIDGET_MENU_ACTIONS = ImmutableSet.of(
|
||||
MenuAction.WIDGET_TYPE_1,
|
||||
MenuAction.WIDGET_TYPE_2,
|
||||
MenuAction.WIDGET_TYPE_3,
|
||||
MenuAction.WIDGET_TARGET,
|
||||
MenuAction.WIDGET_CLOSE,
|
||||
MenuAction.WIDGET_TYPE_4,
|
||||
MenuAction.WIDGET_TYPE_5,
|
||||
MenuAction.WIDGET_TYPE_6,
|
||||
MenuAction.ITEM_USE_ON_WIDGET_ITEM,
|
||||
MenuAction.ITEM_USE_ON_WIDGET,
|
||||
MenuAction.WIDGET_CONTINUE,
|
||||
MenuAction.ITEM_USE_ON_ITEM,
|
||||
MenuAction.WIDGET_USE_ON_ITEM,
|
||||
MenuAction.ITEM_FIRST_OPTION,
|
||||
MenuAction.ITEM_SECOND_OPTION,
|
||||
MenuAction.ITEM_THIRD_OPTION,
|
||||
@@ -68,7 +68,7 @@ class MouseHighlightOverlay extends Overlay
|
||||
MenuAction.WIDGET_FOURTH_OPTION,
|
||||
MenuAction.WIDGET_FIFTH_OPTION,
|
||||
MenuAction.EXAMINE_ITEM,
|
||||
MenuAction.SPELL_CAST_ON_WIDGET,
|
||||
MenuAction.WIDGET_TARGET_ON_WIDGET,
|
||||
MenuAction.CC_OP_LOW_PRIORITY,
|
||||
MenuAction.CC_OP
|
||||
);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
private static final String UNTAG_ALL = "Un-tag-All";
|
||||
|
||||
private static final Set<MenuAction> NPC_MENU_ACTIONS = ImmutableSet.of(MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION,
|
||||
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION, MenuAction.SPELL_CAST_ON_NPC,
|
||||
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION, MenuAction.WIDGET_TARGET_ON_NPC,
|
||||
MenuAction.ITEM_USE_ON_NPC);
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -42,7 +42,7 @@ import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_PLAYER;
|
||||
import static net.runelite.api.MenuAction.SPELL_CAST_ON_PLAYER;
|
||||
import static net.runelite.api.MenuAction.WIDGET_TARGET_ON_PLAYER;
|
||||
import static net.runelite.api.MenuAction.WALK;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.Player;
|
||||
@@ -124,7 +124,7 @@ public class PlayerIndicatorsPlugin extends Plugin
|
||||
MenuAction type = entry.getType();
|
||||
|
||||
if (type == WALK
|
||||
|| type == SPELL_CAST_ON_PLAYER
|
||||
|| type == WIDGET_TARGET_ON_PLAYER
|
||||
|| type == ITEM_USE_ON_PLAYER
|
||||
|| type == PLAYER_FIRST_OPTION
|
||||
|| type == PLAYER_SECOND_OPTION
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.NullItemID;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.SpriteID;
|
||||
@@ -266,8 +267,8 @@ public class WikiPlugin extends Plugin
|
||||
break optarget;
|
||||
case CANCEL:
|
||||
return;
|
||||
case ITEM_USE_ON_WIDGET:
|
||||
case SPELL_CAST_ON_GROUND_ITEM:
|
||||
case WIDGET_USE_ON_ITEM:
|
||||
case WIDGET_TARGET_ON_GROUND_ITEM:
|
||||
{
|
||||
type = "item";
|
||||
id = itemManager.canonicalize(ev.getId());
|
||||
@@ -275,7 +276,7 @@ public class WikiPlugin extends Plugin
|
||||
location = null;
|
||||
break;
|
||||
}
|
||||
case SPELL_CAST_ON_NPC:
|
||||
case WIDGET_TARGET_ON_NPC:
|
||||
{
|
||||
type = "npc";
|
||||
NPC npc = client.getCachedNPCs()[ev.getId()];
|
||||
@@ -285,7 +286,7 @@ public class WikiPlugin extends Plugin
|
||||
location = npc.getWorldLocation();
|
||||
break;
|
||||
}
|
||||
case SPELL_CAST_ON_GAME_OBJECT:
|
||||
case WIDGET_TARGET_ON_GAME_OBJECT:
|
||||
{
|
||||
type = "object";
|
||||
ObjectComposition lc = client.getObjectDefinition(ev.getId());
|
||||
@@ -298,7 +299,7 @@ public class WikiPlugin extends Plugin
|
||||
location = WorldPoint.fromScene(client, ev.getParam0(), ev.getParam1(), client.getPlane());
|
||||
break;
|
||||
}
|
||||
case SPELL_CAST_ON_WIDGET:
|
||||
case WIDGET_TARGET_ON_WIDGET:
|
||||
Widget w = getWidget(ev.getParam1(), ev.getParam0());
|
||||
|
||||
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)
|
||||
@@ -359,16 +360,16 @@ public class WikiPlugin extends Plugin
|
||||
int widgetIndex = event.getActionParam0();
|
||||
int widgetID = event.getActionParam1();
|
||||
|
||||
if (wikiSelected && event.getType() == MenuAction.SPELL_CAST_ON_WIDGET.getId())
|
||||
if (wikiSelected && event.getType() == MenuAction.WIDGET_TARGET_ON_WIDGET.getId())
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
Widget w = getWidget(widgetID, widgetIndex);
|
||||
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)
|
||||
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1 && w.getItemId() != NullItemID.NULL_6512)
|
||||
{
|
||||
for (int ourEntry = menuEntries.length - 1;ourEntry >= 0; ourEntry--)
|
||||
{
|
||||
MenuEntry entry = menuEntries[ourEntry];
|
||||
if (entry.getType() == MenuAction.SPELL_CAST_ON_WIDGET)
|
||||
if (entry.getType() == MenuAction.WIDGET_TARGET_ON_WIDGET)
|
||||
{
|
||||
int id = itemManager.canonicalize(w.getItemId());
|
||||
String name = itemManager.getItemComposition(id).getName();
|
||||
@@ -385,7 +386,7 @@ public class WikiPlugin extends Plugin
|
||||
MenuEntry[] oldEntries = menuEntries;
|
||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length - 1);
|
||||
for (int ourEntry = oldEntries.length - 1;
|
||||
ourEntry >= 2 && oldEntries[oldEntries.length - 1].getType() != MenuAction.SPELL_CAST_ON_WIDGET;
|
||||
ourEntry >= 2 && oldEntries[oldEntries.length - 1].getType() != MenuAction.WIDGET_TARGET_ON_WIDGET;
|
||||
ourEntry--)
|
||||
{
|
||||
menuEntries[ourEntry - 1] = oldEntries[ourEntry];
|
||||
|
||||
@@ -206,7 +206,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
|
||||
private RSConfig downloadConfig() throws IOException
|
||||
{
|
||||
HttpUrl url = HttpUrl.parse(javConfigUrl);
|
||||
HttpUrl url = HttpUrl.get(javConfigUrl);
|
||||
IOException err = null;
|
||||
for (int attempt = 0; attempt < NUM_ATTEMPTS; attempt++)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
@Nonnull
|
||||
private RSConfig downloadFallbackConfig() throws IOException
|
||||
{
|
||||
RSConfig backupConfig = clientConfigLoader.fetch(HttpUrl.parse(RuneLiteProperties.getJavConfigBackup()));
|
||||
RSConfig backupConfig = clientConfigLoader.fetch(HttpUrl.get(RuneLiteProperties.getJavConfigBackup()));
|
||||
|
||||
if (Strings.isNullOrEmpty(backupConfig.getCodeBase()) || Strings.isNullOrEmpty(backupConfig.getInitialJar()) || Strings.isNullOrEmpty(backupConfig.getInitialClass()))
|
||||
{
|
||||
@@ -326,13 +326,13 @@ public class ClientLoader implements Supplier<Applet>
|
||||
if (config.isFallback())
|
||||
{
|
||||
// If we are using the backup config, use our own gamepack and ignore the codebase
|
||||
url = HttpUrl.parse(config.getRuneLiteGamepack());
|
||||
url = HttpUrl.get(config.getRuneLiteGamepack());
|
||||
}
|
||||
else
|
||||
{
|
||||
String codebase = config.getCodeBase();
|
||||
String initialJar = config.getInitialJar();
|
||||
url = HttpUrl.parse(codebase + initialJar);
|
||||
url = HttpUrl.get(codebase + initialJar);
|
||||
}
|
||||
|
||||
for (int attempt = 0; ; attempt++)
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.ui;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.WindowAdapter;
|
||||
@@ -45,7 +44,6 @@ import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLite;
|
||||
@@ -53,6 +51,7 @@ import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.LinkBrowser;
|
||||
import net.runelite.client.util.VerificationException;
|
||||
import org.pushingpixels.substance.internal.SubstanceSynapse;
|
||||
|
||||
@Slf4j
|
||||
public class FatalErrorDialog extends JDialog
|
||||
@@ -70,16 +69,6 @@ public class FatalErrorDialog extends JDialog
|
||||
throw new IllegalStateException("Fatal error during fatal error: " + message);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
UIManager.put("Button.select", ColorScheme.DARKER_GRAY_COLOR);
|
||||
|
||||
try
|
||||
{
|
||||
BufferedImage logo = ImageUtil.loadImageResource(FatalErrorDialog.class, "openosrs_transparent.png");
|
||||
@@ -108,8 +97,9 @@ public class FatalErrorDialog extends JDialog
|
||||
setTitle("Fatal error starting OpenOSRS");
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
Container pane = getContentPane();
|
||||
JPanel pane = (JPanel) getContentPane();
|
||||
pane.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
pane.putClientProperty(SubstanceSynapse.COLORIZATION_FACTOR, 1.0);
|
||||
|
||||
JPanel leftPane = new JPanel();
|
||||
leftPane.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
@@ -130,6 +120,7 @@ public class FatalErrorDialog extends JDialog
|
||||
textArea.setWrapStyleWord(true);
|
||||
textArea.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
textArea.setEditable(false);
|
||||
textArea.setOpaque(false);
|
||||
leftPane.add(textArea, BorderLayout.CENTER);
|
||||
|
||||
pane.add(leftPane, BorderLayout.CENTER);
|
||||
|
||||
@@ -68,8 +68,8 @@ import okhttp3.Response;
|
||||
public class ImageCapture
|
||||
{
|
||||
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
|
||||
private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.parse("https://api.imgur.com/3/image");
|
||||
private static final MediaType JSON = MediaType.parse("application/json");
|
||||
private static final HttpUrl IMGUR_IMAGE_UPLOAD_URL = HttpUrl.get("https://api.imgur.com/3/image");
|
||||
private static final MediaType JSON = MediaType.get("application/json");
|
||||
|
||||
private final Client client;
|
||||
private final Notifier notifier;
|
||||
|
||||
@@ -31,6 +31,11 @@ public class VerificationException extends Exception
|
||||
super(message);
|
||||
}
|
||||
|
||||
public VerificationException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public VerificationException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDDDCCAfSgAwIBAgIJAK8uBanmNQZaMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
|
||||
BAMMEHJ1bmVsaXRlLXBsdWdpbnMwHhcNMTkxMjEyMjEwNzUxWhcNMjUxMjEwMjEw
|
||||
NzUxWjAbMRkwFwYDVQQDDBBydW5lbGl0ZS1wbHVnaW5zMIIBIjANBgkqhkiG9w0B
|
||||
AQEFAAOCAQ8AMIIBCgKCAQEApu11OVANSU+pHaXRxB7fIZapucJ6BT46neicEixs
|
||||
NVPuK/QRVjO/G8F++MXFD/tlZUOEDllDN8uaHBIVwxilqEVYL7oX65Esl7qqC1TZ
|
||||
WGdjiMyYoK3CXWEWB4w+CdB31T7JG2HqH45ZsVs+U9OVWBkNkL5nNQNPOmZFd+3A
|
||||
yCb9nGlO7SxduiHpwh3CV19jY47y8tevyo5qpaBuQeWtu3vbpeer0kbDarwD3xoF
|
||||
yUMPRK518gxRUSmOpsSG5viQ731mKVCUUfIXz91d3s+kJYAjORHS4zJe9s+1dljp
|
||||
oLYNLkaP6m3CmNtC84OxkmognvZTNMbiQ3GQm/BK4sdjPQIDAQABo1MwUTAdBgNV
|
||||
HQ4EFgQUxrkiRXNd0OHPMkqgl9UgV1//OuQwHwYDVR0jBBgwFoAUxrkiRXNd0OHP
|
||||
Mkqgl9UgV1//OuQwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEA
|
||||
StPyblz3aqOM5z2KqHX1B7Z3Q8B58g55YSefpcfwWEc6LT4HCztszcZDteWpV3W2
|
||||
ERfemkGKgsDhQ0qkzIt7tS5eNN3PPj7RZZm7vl5HquQ1vC/33ri/Z3CEKzbW7knt
|
||||
i1iEpx8E9DKb9J9DjdKwNxSomOyCOFUt9YoQJs80xc1mwPDd6aWR3xwvnEUimkm+
|
||||
Dbj7HMOXLeyN810wkeWcT8nC5GhxH3ZAmVExBHsaIOB876RntzshBehjY8s8JQhw
|
||||
R+fT1e8EhYMM9ylYDk1KIWFWrAujjU04lS9tXZ5C2e7fr9R953XN6Y0PNM/taNTU
|
||||
GzwGroJZI02V+1ADO14rRA==
|
||||
-----END CERTIFICATE-----
|
||||
MIIFFTCCAv2gAwIBAgIUHZQhtTfY+I19Gz+JKYfvT6IM55QwDQYJKoZIhvcNAQEL
|
||||
BQAwGjEYMBYGA1UEAwwPcnVuZWxpdGUtcGx1Z2luMB4XDTIyMDQxOTAxMjIzNFoX
|
||||
DTMyMDQxNjAxMjIzNFowGjEYMBYGA1UEAwwPcnVuZWxpdGUtcGx1Z2luMIICIjAN
|
||||
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAw4Dkg5UBgD3X8UtChrnxCYaoe68J
|
||||
uuY+lESNROWb27EAEcLHo/DBbW0q0n6zL4vKjHs4Acsq+Z9kblyXN572851b8hur
|
||||
5CbHq0Uc4r1dUiMCYHjSJ/BkvGKMPs6Yo1CmzXqc9IPV/zoHC+yJH7R6hmIkLWu4
|
||||
CytXvmkIGEvOJoJ+LZyWcifBzX7Aua6IuWHHhTAxEcAxkrBFImfC9wgWD8sL/r2F
|
||||
Xyzo3jkv1LognWFbuMGQYgG+PvO8Ia+p8cko9YZnH3+SQmtr+VPbLD+VOAyDxhH1
|
||||
jX46SsSoB2sIIfCB3oNTERM1Wmy0xL5GYBj8PWOanWQY+rKku07SS8DBirkWRTVB
|
||||
lboNt60Di6FhrPnxTGA8DcxdYAJVZEQOS6ed540Bl40JMEdeMG66PGRDJJlIMyrc
|
||||
3xa8Z6XoKMV0QCv5ETBQwnED3lXsViFDoeC6wCww1ZjOFMwHfk5O6N5CsyJOEoGC
|
||||
Y9LiUwzLkf2po6LGLRrUsiDf/a+nsMUam5Zhmdt6a77wii+cH7oaAAieLk11u1qr
|
||||
Gc43gJtrzBY0thF5QiGtWlGHo7VY32Zlf9GnHkFSTTMdQX66VkWan6y080gr+HVn
|
||||
aP1oN9cxBrfWc0XMBGp+uZf60p7D9gbPQG0bJUF7GDtgcZt+b8NK9u8hnJZVi8oX
|
||||
AmLfUvCZ4Uv/sjMCAwEAAaNTMFEwHQYDVR0OBBYEFEFHyDZIF4aE3o+ChP3/Y6eO
|
||||
VsOQMB8GA1UdIwQYMBaAFEFHyDZIF4aE3o+ChP3/Y6eOVsOQMA8GA1UdEwEB/wQF
|
||||
MAMBAf8wDQYJKoZIhvcNAQELBQADggIBAH3Wm63s7ifC7cIeBLgM4LJxU9Qx1YA4
|
||||
7U2WEoChoeDj4iBs5cAKCBXU9hbw2/Ij8JqYG1sjZGNZjdqzYtjh36K4j+vgTmK5
|
||||
vufXlzC+MUwWt853QIrgWs4c2HO4HnQgsss7UJm3aofVeqEVH9MeHcmKiL/3uQFT
|
||||
DiR31+MxLaQZw0JcmVMGR0WU6eXyi4lkZL82BGwponjaOgB4oxrHRqqrV7I93Y/v
|
||||
GRiRwfcgP0QXORdfDmhtzaY6ay4TX1qzcXH/a78EGk3Bzgg20kh+6r8YRoBpbtM4
|
||||
O4hZKhKtwGDDRHrVHy5gVh3hjAUdb2kdlxjxPocnkIiOWCrX2P5GA5NF6+deRE+B
|
||||
NZO+3VAD40meNlaoVqSnXW2hmeqShWEclNkdyTieSLFTLpsPGIlC7+NYAgc6j9Jc
|
||||
oFdcmdChavHv7UVbgg8Kp1ypfQLThNG9gWf+PByqRrEcCSKG3J1JrKwh8tqOXkNh
|
||||
N5o3ON56H1WFPwkXji3amhkNCVHq13qgCXtPXTRSVcFTtPVrCKB5DSFqHErb73/5
|
||||
WDkj4GYAVeL0+znFYktj/cxD0J8QRgNCVZeFCmxWpuN1WekHzy3C2TjO4We/x1yP
|
||||
9HGVWLvJL8U8tgEO3c3g1OH9Z5SwHhgjNFw1VMfpKngFWp96o/OAJTX9K++5gKwm
|
||||
Y5Hm2HkwTow+
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
@@ -1 +1 @@
|
||||
9B38CB6BF195C49B10D856C5F571AFDEC7BBEF96A4E3532F5B23E9341066144C
|
||||
3218E18002C110E4D44C9CB0C006BD5C052AC1CA8D07B32F2C67CBD866570F06
|
||||
@@ -90,13 +90,13 @@ LABEL60:
|
||||
iload 0
|
||||
iconst 84
|
||||
if_icmpeq LABEL76
|
||||
jump LABEL822
|
||||
jump LABEL809
|
||||
LABEL76:
|
||||
invoke 1984
|
||||
iload 2
|
||||
iconst 0
|
||||
if_icmpgt LABEL81
|
||||
jump LABEL821
|
||||
jump LABEL808
|
||||
LABEL81:
|
||||
iload 3
|
||||
iconst 1
|
||||
@@ -699,7 +699,7 @@ LABEL587:
|
||||
sconst "You are not chatting as a guest in a clan channel at the moment."
|
||||
mes
|
||||
LABEL589:
|
||||
jump LABEL817
|
||||
jump LABEL804
|
||||
LABEL590:
|
||||
iload 5
|
||||
iconst 41
|
||||
@@ -782,7 +782,7 @@ LABEL655:
|
||||
sconst "You are not chatting in the channel of your Clan at the moment."
|
||||
mes
|
||||
LABEL657:
|
||||
jump LABEL817
|
||||
jump LABEL804
|
||||
LABEL658:
|
||||
iload 5
|
||||
iconst 9
|
||||
@@ -842,7 +842,7 @@ LABEL699:
|
||||
iconst -1
|
||||
invoke 5517
|
||||
LABEL705:
|
||||
jump LABEL817
|
||||
jump LABEL804
|
||||
LABEL706:
|
||||
iload 5
|
||||
iconst 2
|
||||
@@ -858,17 +858,17 @@ LABEL710:
|
||||
iconst 0
|
||||
iload 9
|
||||
invoke 5517
|
||||
jump LABEL817
|
||||
jump LABEL804
|
||||
LABEL720:
|
||||
iload 4
|
||||
iconst 1
|
||||
if_icmpeq LABEL724
|
||||
jump LABEL811
|
||||
jump LABEL798
|
||||
LABEL724:
|
||||
iload 2
|
||||
iconst 2
|
||||
if_icmpgt LABEL728
|
||||
jump LABEL804
|
||||
jump LABEL791
|
||||
LABEL728:
|
||||
get_varc_string 335
|
||||
sconst "::toggleroof"
|
||||
@@ -876,80 +876,62 @@ LABEL728:
|
||||
string_indexof_string
|
||||
iconst 0
|
||||
if_icmpeq LABEL735
|
||||
jump LABEL763
|
||||
LABEL735:
|
||||
getremoveroofs
|
||||
iconst 1
|
||||
if_icmpeq LABEL739
|
||||
jump LABEL751
|
||||
LABEL739:
|
||||
iconst 0
|
||||
setremoveroofs
|
||||
get_varbit 12378
|
||||
iconst 0
|
||||
if_icmpeq LABEL745
|
||||
jump LABEL748
|
||||
LABEL745:
|
||||
sconst "Roofs will only be removed selectively."
|
||||
mes
|
||||
jump LABEL750
|
||||
LABEL748:
|
||||
LABEL735:
|
||||
iconst 1
|
||||
3215
|
||||
iconst 1
|
||||
if_icmpeq LABEL740
|
||||
jump LABEL745
|
||||
LABEL740:
|
||||
iconst 0
|
||||
invoke 4583
|
||||
sconst "Roofs will only be removed selectively. This setting will not be saved."
|
||||
mes
|
||||
LABEL750:
|
||||
jump LABEL762
|
||||
LABEL751:
|
||||
jump LABEL749
|
||||
LABEL745:
|
||||
iconst 1
|
||||
setremoveroofs
|
||||
get_varbit 12378
|
||||
iconst 1
|
||||
if_icmpeq LABEL757
|
||||
jump LABEL760
|
||||
LABEL757:
|
||||
sconst "Roofs are now all hidden."
|
||||
mes
|
||||
jump LABEL762
|
||||
LABEL760:
|
||||
invoke 4583
|
||||
sconst "Roofs are now all hidden. This setting will not be saved."
|
||||
mes
|
||||
LABEL762:
|
||||
jump LABEL803
|
||||
LABEL763:
|
||||
LABEL749:
|
||||
jump LABEL790
|
||||
LABEL750:
|
||||
get_varc_string 335
|
||||
sconst "::wiki "
|
||||
iconst 0
|
||||
string_indexof_string
|
||||
iconst 0
|
||||
if_icmpeq LABEL775
|
||||
if_icmpeq LABEL762
|
||||
get_varc_string 335
|
||||
sconst "::wiki"
|
||||
compare
|
||||
iconst 0
|
||||
if_icmpeq LABEL775
|
||||
if_icmpeq LABEL762
|
||||
sconst "runeliteCommand" ; load callback name
|
||||
runelite_callback ; invoke callback
|
||||
jump LABEL778
|
||||
LABEL775:
|
||||
jump LABEL765
|
||||
LABEL762:
|
||||
get_varc_string 335
|
||||
invoke 3299
|
||||
jump LABEL803
|
||||
LABEL778:
|
||||
jump LABEL790
|
||||
LABEL765:
|
||||
get_varc_string 335
|
||||
sconst "::bank"
|
||||
iconst 0
|
||||
string_indexof_string
|
||||
iconst 0
|
||||
if_icmpeq LABEL785
|
||||
jump LABEL792
|
||||
LABEL785:
|
||||
if_icmpeq LABEL772
|
||||
jump LABEL779
|
||||
LABEL772:
|
||||
sconst "Hey, everyone, I just tried to do something very silly!"
|
||||
iconst 0
|
||||
iconst -1
|
||||
iconst 0
|
||||
iconst -1
|
||||
invoke 5517
|
||||
jump LABEL803
|
||||
LABEL792:
|
||||
jump LABEL790
|
||||
LABEL779:
|
||||
get_varc_string 335
|
||||
invoke 224
|
||||
set_varc_string 335
|
||||
@@ -961,97 +943,97 @@ LABEL792:
|
||||
iload 2
|
||||
substring
|
||||
docheat
|
||||
LABEL803:
|
||||
jump LABEL810
|
||||
LABEL804:
|
||||
LABEL790:
|
||||
jump LABEL797
|
||||
LABEL791:
|
||||
get_varc_string 335
|
||||
iconst 0
|
||||
iconst -1
|
||||
iconst 0
|
||||
iconst -1
|
||||
invoke 5517
|
||||
LABEL810:
|
||||
jump LABEL817
|
||||
LABEL811:
|
||||
LABEL797:
|
||||
jump LABEL804
|
||||
LABEL798:
|
||||
get_varc_string 335
|
||||
iconst 0
|
||||
iconst -1
|
||||
iconst 1
|
||||
iload 9
|
||||
invoke 5517
|
||||
LABEL817:
|
||||
LABEL804:
|
||||
get_varc_string 335
|
||||
invoke 77
|
||||
sconst ""
|
||||
set_varc_string 335
|
||||
LABEL821:
|
||||
jump LABEL897
|
||||
LABEL822:
|
||||
LABEL808:
|
||||
jump LABEL884
|
||||
LABEL809:
|
||||
iload 0
|
||||
iconst 104
|
||||
if_icmpeq LABEL826
|
||||
jump LABEL832
|
||||
LABEL826:
|
||||
if_icmpeq LABEL813
|
||||
jump LABEL819
|
||||
LABEL813:
|
||||
iload 3
|
||||
iconst 1
|
||||
if_icmpeq LABEL830
|
||||
jump LABEL831
|
||||
LABEL830:
|
||||
if_icmpeq LABEL817
|
||||
jump LABEL818
|
||||
LABEL817:
|
||||
invoke 75
|
||||
LABEL831:
|
||||
jump LABEL897
|
||||
LABEL832:
|
||||
LABEL818:
|
||||
jump LABEL884
|
||||
LABEL819:
|
||||
iload 0
|
||||
iconst 105
|
||||
if_icmpeq LABEL836
|
||||
jump LABEL842
|
||||
LABEL836:
|
||||
if_icmpeq LABEL823
|
||||
jump LABEL829
|
||||
LABEL823:
|
||||
iload 3
|
||||
iconst 1
|
||||
if_icmpeq LABEL840
|
||||
jump LABEL841
|
||||
LABEL840:
|
||||
if_icmpeq LABEL827
|
||||
jump LABEL828
|
||||
LABEL827:
|
||||
invoke 76
|
||||
LABEL841:
|
||||
jump LABEL897
|
||||
LABEL842:
|
||||
LABEL828:
|
||||
jump LABEL884
|
||||
LABEL829:
|
||||
iload 0
|
||||
iconst 80
|
||||
if_icmpeq LABEL846
|
||||
jump LABEL891
|
||||
LABEL846:
|
||||
if_icmpeq LABEL833
|
||||
jump LABEL878
|
||||
LABEL833:
|
||||
iconst 40697936
|
||||
iconst 1
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL852
|
||||
jump LABEL853
|
||||
LABEL852:
|
||||
if_icmpeq LABEL839
|
||||
jump LABEL840
|
||||
LABEL839:
|
||||
return
|
||||
LABEL853:
|
||||
LABEL840:
|
||||
get_varc_string 356
|
||||
string_length
|
||||
iconst 0
|
||||
if_icmpgt LABEL858
|
||||
jump LABEL878
|
||||
LABEL858:
|
||||
if_icmpgt LABEL845
|
||||
jump LABEL865
|
||||
LABEL845:
|
||||
get_varc_string 356
|
||||
friend_test
|
||||
iconst 1
|
||||
if_icmpeq LABEL863
|
||||
jump LABEL866
|
||||
LABEL863:
|
||||
if_icmpeq LABEL850
|
||||
jump LABEL853
|
||||
LABEL850:
|
||||
get_varc_string 356
|
||||
invoke 107
|
||||
return
|
||||
LABEL866:
|
||||
LABEL853:
|
||||
get_varc_int 60
|
||||
clientclock
|
||||
if_icmpgt LABEL870
|
||||
jump LABEL871
|
||||
LABEL870:
|
||||
if_icmpgt LABEL857
|
||||
jump LABEL858
|
||||
LABEL857:
|
||||
return
|
||||
LABEL871:
|
||||
LABEL858:
|
||||
clientclock
|
||||
iconst 50
|
||||
add
|
||||
@@ -1059,14 +1041,14 @@ LABEL871:
|
||||
sconst "That player was not found on your Friends list."
|
||||
mes
|
||||
return
|
||||
LABEL878:
|
||||
LABEL865:
|
||||
get_varc_int 60
|
||||
clientclock
|
||||
if_icmpgt LABEL882
|
||||
jump LABEL883
|
||||
LABEL882:
|
||||
if_icmpgt LABEL869
|
||||
jump LABEL870
|
||||
LABEL869:
|
||||
return
|
||||
LABEL883:
|
||||
LABEL870:
|
||||
clientclock
|
||||
iconst 50
|
||||
add
|
||||
@@ -1074,8 +1056,8 @@ LABEL883:
|
||||
sconst "You haven't received any messages to which you can reply."
|
||||
mes
|
||||
return
|
||||
jump LABEL897
|
||||
LABEL891:
|
||||
jump LABEL884
|
||||
LABEL878:
|
||||
get_varc_string 335
|
||||
iconst 0
|
||||
iload 0
|
||||
@@ -1087,9 +1069,9 @@ LABEL891:
|
||||
runelite_callback ;
|
||||
if_icmpeq SKIPSETVARC ; skip setting varc with input
|
||||
set_varc_string 335
|
||||
jump LABEL897 ; jump over SKIPSETVARC
|
||||
jump LABEL884 ; jump over SKIPSETVARC
|
||||
SKIPSETVARC:
|
||||
pop_string ; pop message
|
||||
LABEL897:
|
||||
LABEL884:
|
||||
invoke 223
|
||||
return
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
package net.runelite.client.menus;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class TestMenuEntry implements MenuEntry
|
||||
@@ -39,6 +42,12 @@ public class TestMenuEntry implements MenuEntry
|
||||
private int param0;
|
||||
private int param1;
|
||||
private boolean forceLeftClick;
|
||||
@Setter
|
||||
private int itemOp = -1;
|
||||
@Setter
|
||||
private int itemId = -1;
|
||||
@Setter
|
||||
private Widget widget;
|
||||
|
||||
@Override
|
||||
public String getOption()
|
||||
@@ -205,4 +214,29 @@ public class TestMenuEntry implements MenuEntry
|
||||
{
|
||||
return MenuAction.of(this.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemOp()
|
||||
{
|
||||
return itemOp != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemOp()
|
||||
{
|
||||
return itemOp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId()
|
||||
{
|
||||
return itemId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Widget getWidget()
|
||||
{
|
||||
return widget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -164,10 +165,10 @@ public class ClueScrollPluginTest
|
||||
plugin.onGameTick(new GameTick());
|
||||
|
||||
// Simulate clicking on the STASH
|
||||
MenuOptionClicked menuOptionClicked = new MenuOptionClicked();
|
||||
menuOptionClicked.setMenuOption("Search");
|
||||
menuOptionClicked.setMenuTarget("<col=ffff>STASH unit (easy)");
|
||||
menuOptionClicked.setId(NullObjectID.NULL_28983);
|
||||
MenuOptionClicked menuOptionClicked = mock(MenuOptionClicked.class);
|
||||
when(menuOptionClicked.getMenuOption()).thenReturn("Search");
|
||||
lenient().when(menuOptionClicked.getMenuTarget()).thenReturn("<col=ffff>STASH unit (easy)");
|
||||
when(menuOptionClicked.getId()).thenReturn(NullObjectID.NULL_28983);
|
||||
plugin.onMenuOptionClicked(menuOptionClicked);
|
||||
|
||||
// Check that the STASH is stored after withdrawing
|
||||
|
||||
@@ -38,7 +38,6 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -332,14 +331,7 @@ public class MenuEntrySwapperPluginTest
|
||||
menu("Deposit-1", "Abyssal whip", MenuAction.CC_OP, 2),
|
||||
};
|
||||
|
||||
menuEntrySwapperPlugin.onMenuEntryAdded(new MenuEntryAdded(
|
||||
"Deposit-1",
|
||||
"Abyssal whip",
|
||||
MenuAction.CC_OP.getId(),
|
||||
2,
|
||||
-1,
|
||||
-1
|
||||
));
|
||||
menuEntrySwapperPlugin.onClientTick(new ClientTick());
|
||||
|
||||
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
|
||||
verify(client).setMenuEntries(argumentCaptor.capture());
|
||||
@@ -364,14 +356,7 @@ public class MenuEntrySwapperPluginTest
|
||||
menu("Deposit-1", "Rune arrow", MenuAction.CC_OP, 2),
|
||||
};
|
||||
|
||||
menuEntrySwapperPlugin.onMenuEntryAdded(new MenuEntryAdded(
|
||||
"Deposit-1",
|
||||
"Rune arrow",
|
||||
MenuAction.CC_OP.getId(),
|
||||
2,
|
||||
-1,
|
||||
-1
|
||||
));
|
||||
menuEntrySwapperPlugin.onClientTick(new ClientTick());
|
||||
|
||||
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
|
||||
verify(client).setMenuEntries(argumentCaptor.capture());
|
||||
|
||||
@@ -492,7 +492,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Override
|
||||
public AccountType getAccountType()
|
||||
{
|
||||
int varbit = getVar(Varbits.ACCOUNT_TYPE);
|
||||
int varbit = getVarbitValue(Varbits.ACCOUNT_TYPE);
|
||||
|
||||
switch (varbit)
|
||||
{
|
||||
@@ -771,7 +771,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Override
|
||||
public boolean isPrayerActive(Prayer prayer)
|
||||
{
|
||||
return getVar(prayer.getVarbit()) == 1;
|
||||
return getVarbitValue(prayer.getVarbit()) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,6 +949,17 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Override
|
||||
public void setMenuEntries(MenuEntry[] menuEntries)
|
||||
{
|
||||
boolean var2 = false;
|
||||
|
||||
if (client.getTempMenuAction() != null && client.getMenuOptionCount() > 0)
|
||||
{
|
||||
var2 = client.getTempMenuAction().getParam0() == client.getMenuArguments1()[client.getMenuOptionCount() - 1] &&
|
||||
client.getTempMenuAction().getParam1() == client.getMenuArguments2()[client.getMenuOptionCount() - 1] &&
|
||||
client.getTempMenuAction().getOption().equals(client.getMenuOptions()[client.getMenuOptionCount() - 1]) &&
|
||||
client.getTempMenuAction().getIdentifier() == client.getMenuIdentifiers()[client.getMenuOptionCount() - 1] &&
|
||||
client.getTempMenuAction().getOpcode() == client.getMenuOpcodes()[client.getMenuOptionCount() - 1];
|
||||
}
|
||||
|
||||
for (int i = 0; i < menuEntries.length; ++i)
|
||||
{
|
||||
RSRuneLiteMenuEntry menuEntry = (RSRuneLiteMenuEntry) menuEntries[i];
|
||||
@@ -960,6 +971,15 @@ public abstract class RSClientMixin implements RSClient
|
||||
|
||||
client.setMenuOptionCount(menuEntries.length);
|
||||
tmpMenuOptionsCount = menuEntries.length;
|
||||
|
||||
if (var2 && client.getMenuOptionCount() > 0)
|
||||
{
|
||||
client.getTempMenuAction().setParam0(client.getMenuArguments1()[client.getMenuOptionCount() - 1]);
|
||||
client.getTempMenuAction().setParam1(client.getMenuArguments2()[client.getMenuOptionCount() - 1]);
|
||||
client.getTempMenuAction().setOption(client.getMenuOptions()[client.getMenuOptionCount() - 1]);
|
||||
client.getTempMenuAction().setIdentifier(client.getMenuIdentifiers()[client.getMenuOptionCount() - 1]);
|
||||
client.getTempMenuAction().setOpcode(client.getMenuOpcodes()[client.getMenuOptionCount() - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
@@ -1038,6 +1058,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
int menuIdentifier = client.getMenuIdentifiers()[tmpOptionsCount];
|
||||
int menuArgument1 = client.getMenuArguments1()[tmpOptionsCount];
|
||||
int menuArgument2 = client.getMenuArguments2()[tmpOptionsCount];
|
||||
|
||||
if (rl$menuEntries[tmpOptionsCount] == null)
|
||||
{
|
||||
rl$menuEntries[tmpOptionsCount] = newRuneliteMenuEntry(tmpOptionsCount);
|
||||
@@ -1655,15 +1676,67 @@ public abstract class RSClientMixin implements RSClient
|
||||
{
|
||||
RSRuneLiteMenuEntry menuEntry = null;
|
||||
|
||||
for (int i = client.getMenuOptionCount() - 1; i >= 0; --i)
|
||||
int i;
|
||||
for (i = client.getMenuOptionCount() - 1; i >= 0; --i)
|
||||
{
|
||||
if (client.getMenuOptions()[i] == option && client.getMenuTargets()[i] == target && client.getMenuIdentifiers()[i] == id && client.getMenuOpcodes()[i] == opcode)
|
||||
if (client.getMenuOptions()[i].equals(option) && client.getMenuTargets()[i].equals(target) && client.getMenuIdentifiers()[i] == id && client.getMenuOpcodes()[i] == opcode)
|
||||
{
|
||||
menuEntry = rl$menuEntries[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (menuEntry == null && option.equals(target))
|
||||
{
|
||||
if (tmpMenuOptionsCount < 500)
|
||||
{
|
||||
int var10000 = tmpMenuOptionsCount;
|
||||
tmpMenuOptionsCount = (var10000 + 1);
|
||||
i = var10000;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
client.getMenuOpcodes()[i] = opcode;
|
||||
client.getMenuIdentifiers()[i] = id;
|
||||
client.getMenuOptions()[i] = option;
|
||||
client.getMenuTargets()[i] = target;
|
||||
client.getMenuArguments1()[i] = param0;
|
||||
client.getMenuArguments2()[i] = param1;
|
||||
client.getMenuForceLeftClick()[i] = false;
|
||||
menuEntry = rl$menuEntries[i];
|
||||
}
|
||||
|
||||
MenuOptionClicked menuOptionClicked = null;
|
||||
|
||||
if (menuEntry == null)
|
||||
{
|
||||
menuOptionClicked = new MenuOptionClicked(newBareRuneliteMenuEntry());
|
||||
|
||||
if (canvasX != -1 || canvasY != -1)
|
||||
{
|
||||
client.getLogger().warn("Unable to find clicked menu op {} targ {} action {} id {} p0 {} p1 {}", option, target, opcode, id, param0, param1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
menuOptionClicked = new MenuOptionClicked(menuEntry);
|
||||
|
||||
client.getCallbacks().post(menuOptionClicked);
|
||||
|
||||
if (menuEntry.getConsumer() != null)
|
||||
{
|
||||
menuEntry.getConsumer().accept(menuEntry);
|
||||
}
|
||||
|
||||
if (menuOptionClicked.isConsumed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The RuneScape client may deprioritize an action in the menu by incrementing the opcode with 2000,
|
||||
* undo it here so we can get the correct opcode
|
||||
@@ -1675,27 +1748,6 @@ public abstract class RSClientMixin implements RSClient
|
||||
opcode -= 2000;
|
||||
}
|
||||
|
||||
final MenuOptionClicked menuOptionClicked = new MenuOptionClicked();
|
||||
menuOptionClicked.setParam0(param0);
|
||||
menuOptionClicked.setMenuOption(option);
|
||||
menuOptionClicked.setMenuTarget(target);
|
||||
menuOptionClicked.setMenuAction(MenuAction.of(opcode));
|
||||
menuOptionClicked.setId(id);
|
||||
menuOptionClicked.setParam1(param1);
|
||||
menuOptionClicked.setSelectedItemIndex(client.getSelectedItemSlot());
|
||||
|
||||
client.getCallbacks().post(menuOptionClicked);
|
||||
|
||||
if (menuEntry != null && menuEntry.getConsumer() != null)
|
||||
{
|
||||
menuEntry.getConsumer().accept(menuEntry);
|
||||
}
|
||||
|
||||
if (menuOptionClicked.isConsumed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (printMenuActions)
|
||||
{
|
||||
client.getLogger().info(
|
||||
@@ -1704,6 +1756,14 @@ public abstract class RSClientMixin implements RSClient
|
||||
menuOptionClicked.getMenuAction(), opcode + (decremented ? 2000 : 0),
|
||||
menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), canvasX, canvasY
|
||||
);
|
||||
|
||||
if (menuEntry != null)
|
||||
{
|
||||
client.getLogger().info(
|
||||
"|MenuEntry|: Idx={} MenuOption={} MenuTarget={} Id={} MenuAction={} Param0={} Param1={} Consumer={} IsItemOp={} ItemOp={} ItemID={} Widget={}",
|
||||
menuEntry.getIdx(), menuEntry.getOption(), menuEntry.getTarget(), menuEntry.getIdentifier(), menuEntry.getType(), menuEntry.getParam0(), menuEntry.getParam1(), menuEntry.getConsumer(), menuEntry.isItemOp(), menuEntry.getItemOp(), menuEntry.getItemId(), menuEntry.getWidget()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
copy$menuAction(menuOptionClicked.getParam0(), menuOptionClicked.getParam1(),
|
||||
@@ -2944,5 +3004,22 @@ public abstract class RSClientMixin implements RSClient
|
||||
client.setLowMemory(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Widget getSelectedWidget()
|
||||
{
|
||||
int selectedSpellWidget = client.getSelectedSpellWidget();
|
||||
int selectedSpellChildIndex = client.getSelectedSpellChildIndex();
|
||||
|
||||
Widget widget = client.getWidget(selectedSpellWidget);
|
||||
|
||||
if (widget != null && selectedSpellChildIndex > -1)
|
||||
{
|
||||
return widget.getChild(selectedSpellChildIndex);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2018, OpenOSRS
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSRuneLiteMenuEntry;
|
||||
|
||||
@Mixin(RSRuneLiteMenuEntry.class)
|
||||
public abstract class RuneLiteMenuEntryMixin implements RSRuneLiteMenuEntry
|
||||
{
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getItemId()
|
||||
{
|
||||
MenuAction menuAction = this.getType();
|
||||
if (menuAction == MenuAction.CC_OP || menuAction == MenuAction.CC_OP_LOW_PRIORITY)
|
||||
{
|
||||
int param1 = this.getParam1();
|
||||
int param0 = this.getParam0();
|
||||
if (param1 == 9764864)
|
||||
{
|
||||
Widget widget = client.getWidget(param1);
|
||||
if (param0 != -1)
|
||||
{
|
||||
widget = widget.getChild(param0);
|
||||
return widget.getItemId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Widget getWidget()
|
||||
{
|
||||
MenuAction menuAction = this.getType();
|
||||
if (menuAction == MenuAction.CC_OP || menuAction == MenuAction.CC_OP_LOW_PRIORITY)
|
||||
{
|
||||
int param1 = this.getParam1();
|
||||
int param0 = this.getParam0();
|
||||
if (param1 == 9764864)
|
||||
{
|
||||
Widget widget = client.getWidget(param1);
|
||||
if (param0 != -1)
|
||||
{
|
||||
widget = widget.getChild(param0);
|
||||
}
|
||||
|
||||
return widget;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -194,6 +194,10 @@ public interface RSClient extends RSGameEngine, Client
|
||||
@Override
|
||||
void setDraggedOnWidget(Widget widget);
|
||||
|
||||
@Import("widgetDragDuration")
|
||||
@Override
|
||||
int getDragTime();
|
||||
|
||||
@Import("Widget_interfaceComponents")
|
||||
RSWidget[][] getWidgets();
|
||||
|
||||
@@ -329,6 +333,9 @@ public interface RSClient extends RSGameEngine, Client
|
||||
@Override
|
||||
void setMenuOptionCount(int menuOptionCount);
|
||||
|
||||
@Import("tempMenuAction")
|
||||
RSMenuAction getTempMenuAction();
|
||||
|
||||
@Import("menuActions")
|
||||
String[] getMenuOptions();
|
||||
|
||||
|
||||
@@ -28,18 +28,33 @@ import net.runelite.mapping.Import;
|
||||
|
||||
public interface RSMenuAction
|
||||
{
|
||||
@Import("action")
|
||||
String getOption();
|
||||
|
||||
@Import("action")
|
||||
void setOption(String yes);
|
||||
|
||||
@Import("opcode")
|
||||
int getOpcode();
|
||||
|
||||
@Import("opcode")
|
||||
void setOpcode(int yes);
|
||||
|
||||
@Import("identifier")
|
||||
int getIdentifier();
|
||||
|
||||
@Import("identifier")
|
||||
void setIdentifier(int yes);
|
||||
|
||||
@Import("param0")
|
||||
int getParam0();
|
||||
|
||||
@Import("param0")
|
||||
void setParam0(int yes);
|
||||
|
||||
@Import("param1")
|
||||
int getParam1();
|
||||
|
||||
@Import("param1")
|
||||
void setParam1(int yes);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import java.util.function.Consumer;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class RuneLiteMenuEntry implements MenuEntry
|
||||
{
|
||||
@@ -322,6 +324,70 @@ public class RuneLiteMenuEntry implements MenuEntry
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemOp()
|
||||
{
|
||||
MenuAction var1 = this.getType();
|
||||
if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY) {
|
||||
int var2 = this.getIdentifier();
|
||||
int var3 = this.getParam1();
|
||||
if (var3 == 9764864) {
|
||||
switch(var2) {
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
return true;
|
||||
case 5:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemOp()
|
||||
{
|
||||
MenuAction var1 = this.getType();
|
||||
if (var1 == MenuAction.CC_OP || var1 == MenuAction.CC_OP_LOW_PRIORITY) {
|
||||
int var2 = this.getIdentifier();
|
||||
int var3 = this.getParam1();
|
||||
if (var3 == 9764864) {
|
||||
switch(var2) {
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 2;
|
||||
case 4:
|
||||
return 3;
|
||||
case 5:
|
||||
default:
|
||||
break;
|
||||
case 6:
|
||||
return 4;
|
||||
case 7:
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidget()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
@@ -346,6 +412,5 @@ public class RuneLiteMenuEntry implements MenuEntry
|
||||
public String toString()
|
||||
{
|
||||
return "MenuEntryImpl(getOption=" + this.getOption() + ", getTarget=" + this.getTarget() + ", getIdentifier=" + this.getIdentifier() + ", getType=" + this.getType() + ", getParam0=" + this.getParam0() + ", getParam1=" + this.getParam1() + ", isForceLeftClick=" + this.isForceLeftClick() + ", isDeprioritized=" + this.isDeprioritized() + ")";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user