upstream: merge

upstream: merge
This commit is contained in:
xKylee
2020-01-15 13:54:02 +00:00
12 changed files with 84 additions and 44 deletions

View File

@@ -228,9 +228,9 @@ public enum MenuOpcode
PLAYER_EIGTH_OPTION(51), PLAYER_EIGTH_OPTION(51),
/** /**
* Default menu action for a widget. * Menu action for normal priority child component actions.
*/ */
WIDGET_DEFAULT(57), CC_OP(57),
/** /**
* Casting a spell / op target on a widget * Casting a spell / op target on a widget
@@ -263,10 +263,9 @@ public enum MenuOpcode
*/ */
CANCEL(1006), CANCEL(1006),
/** /**
* Menu action triggered by either examining item in bank, examining * Menu action for low priority child component actions.
* item in inventory while having bank open, or examining equipped item.
*/ */
EXAMINE_ITEM_BANK_EQ(1007), CC_OP_LOW_PRIORITY(1007),
/** /**
* Menu action injected by runelite for its menu items. * Menu action injected by runelite for its menu items.

View File

@@ -601,7 +601,7 @@ public class TabInterface
if ((event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId() if ((event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|| event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId()) || event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId())
&& event.getMenuOpcode() == MenuOpcode.EXAMINE_ITEM_BANK_EQ && event.getMenuOpcode() == MenuOpcode.CC_OP_LOW_PRIORITY
&& (event.getOption().equalsIgnoreCase("withdraw-x") && (event.getOption().equalsIgnoreCase("withdraw-x")
|| event.getOption().equalsIgnoreCase("deposit-x"))) || event.getOption().equalsIgnoreCase("deposit-x")))
{ {

View File

@@ -63,12 +63,6 @@ import net.runelite.client.util.MiscUtils;
) )
public class CameraPlugin extends Plugin implements KeyListener, MouseListener public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{ {
/**
* The largest (most zoomed in) value that can be used without the client crashing.
* <p>
* Larger values trigger an overflow in the engine's fov to scale code.
*/
private static final int INNER_ZOOM_LIMIT = 1004;
private static final int DEFAULT_ZOOM_INCREMENT = 25; private static final int DEFAULT_ZOOM_INCREMENT = 25;
private static final String LOOK_NORTH = "Look North"; private static final String LOOK_NORTH = "Look North";
private static final String LOOK_SOUTH = "Look South"; private static final String LOOK_SOUTH = "Look South";
@@ -79,6 +73,17 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
// flags used to store the mousedown states // flags used to store the mousedown states
private boolean rightClick; private boolean rightClick;
private boolean middleClick; private boolean middleClick;
private boolean innerLimit;
private boolean relaxCameraPitch;
private boolean rightClickMovesCamera;
private boolean ignoreExamine;
private boolean middleClickMenu;
private boolean compassLook;
private ControlFunction controlFunction;
private int outerLimit;
private int ctrlZoomValue;
private int zoomIncrement;
/** /**
* Whether or not the current menu has any non-ignored menu entries * Whether or not the current menu has any non-ignored menu entries
*/ */
@@ -91,7 +96,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
private ClientThread clientThread; private ClientThread clientThread;
@Inject @Inject
private CameraConfig cameraConfig; private CameraConfig config;
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@@ -112,7 +117,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
middleClick = false; middleClick = false;
menuHasEntries = false; menuHasEntries = false;
client.setCameraPitchRelaxerEnabled(cameraConfig.relaxCameraPitch()); client.setCameraPitchRelaxerEnabled(this.relaxCameraPitch);
keyManager.registerKeyListener(this); keyManager.registerKeyListener(this);
mouseManager.registerMouseListener(this); mouseManager.registerMouseListener(this);
} }
@@ -129,7 +134,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
@Subscribe @Subscribe
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{ {
if (menuEntryAdded.getOpcode() == MenuOpcode.WIDGET_DEFAULT.getId() && menuEntryAdded.getOption().equals(LOOK_NORTH) && cameraConfig.compassLook()) if (menuEntryAdded.getOpcode() == MenuOpcode.CC_OP.getId() && menuEntryAdded.getOption().equals(LOOK_NORTH) && this.compassLook)
{ {
MenuEntry[] menuEntries = client.getMenuEntries(); MenuEntry[] menuEntries = client.getMenuEntries();
int len = menuEntries.length; int len = menuEntries.length;
@@ -153,7 +158,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
m.setOption(option); m.setOption(option);
m.setTarget(lookNorth.getTarget()); m.setTarget(lookNorth.getTarget());
m.setIdentifier(identifier); m.setIdentifier(identifier);
m.setOpcode(MenuOpcode.WIDGET_DEFAULT.getId()); m.setOpcode(MenuOpcode.CC_OP.getId());
m.setParam0(lookNorth.getParam0()); m.setParam0(lookNorth.getParam0());
m.setParam1(lookNorth.getParam1()); m.setParam1(lookNorth.getParam1());
return m; return m;
@@ -172,32 +177,32 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
int[] intStack = client.getIntStack(); int[] intStack = client.getIntStack();
int intStackSize = client.getIntStackSize(); int intStackSize = client.getIntStackSize();
if (!controlDown && "scrollWheelZoom".equals(event.getEventName()) && cameraConfig.controlFunction() == ControlFunction.CONTROL_TO_ZOOM) if (!controlDown && "scrollWheelZoom".equals(event.getEventName()) && this.controlFunction == ControlFunction.CONTROL_TO_ZOOM)
{ {
intStack[intStackSize - 1] = 1; intStack[intStackSize - 1] = 1;
} }
if ("innerZoomLimit".equals(event.getEventName()) && cameraConfig.innerLimit()) if ("innerZoomLimit".equals(event.getEventName()) && this.innerLimit)
{ {
intStack[intStackSize - 1] = INNER_ZOOM_LIMIT; intStack[intStackSize - 1] = config.INNER_ZOOM_LIMIT;
return; return;
} }
if ("outerZoomLimit".equals(event.getEventName())) if ("outerZoomLimit".equals(event.getEventName()))
{ {
int outerLimit = MiscUtils.clamp(cameraConfig.outerLimit(), CameraConfig.OUTER_LIMIT_MIN, CameraConfig.OUTER_LIMIT_MAX); int outerLimit = MiscUtils.clamp(this.outerLimit, CameraConfig.OUTER_LIMIT_MIN, CameraConfig.OUTER_LIMIT_MAX);
int outerZoomLimit = 128 - outerLimit; int outerZoomLimit = 128 - outerLimit;
intStack[intStackSize - 1] = outerZoomLimit; intStack[intStackSize - 1] = outerZoomLimit;
return; return;
} }
if ("scrollWheelZoomIncrement".equals(event.getEventName()) && cameraConfig.zoomIncrement() != DEFAULT_ZOOM_INCREMENT) if ("scrollWheelZoomIncrement".equals(event.getEventName()) && this.zoomIncrement != DEFAULT_ZOOM_INCREMENT)
{ {
intStack[intStackSize - 1] = cameraConfig.zoomIncrement(); intStack[intStackSize - 1] = this.zoomIncrement;
return; return;
} }
if (cameraConfig.innerLimit()) if (this.innerLimit)
{ {
// This lets the options panel's slider have an exponential rate // This lets the options panel's slider have an exponential rate
final double exponent = 2.d; final double exponent = 2.d;
@@ -233,9 +238,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
} }
@Subscribe @Subscribe
private void onConfigChanged(ConfigChanged ev) private void onConfigChanged(ConfigChanged event)
{ {
client.setCameraPitchRelaxerEnabled(cameraConfig.relaxCameraPitch()); if (!event.getGroup().equals("zoom"))
{
return;
}
client.setCameraPitchRelaxerEnabled(this.relaxCameraPitch);
updateConfig();
} }
@Override @Override
@@ -259,9 +269,9 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{ {
controlDown = false; controlDown = false;
if (cameraConfig.controlFunction() == ControlFunction.CONTROL_TO_RESET) if (this.controlFunction == ControlFunction.CONTROL_TO_RESET)
{ {
final int zoomValue = MiscUtils.clamp(cameraConfig.ctrlZoomValue(), cameraConfig.OUTER_LIMIT_MIN, INNER_ZOOM_LIMIT); final int zoomValue = MiscUtils.clamp(this.ctrlZoomValue, config.OUTER_LIMIT_MIN, config.INNER_ZOOM_LIMIT);
clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue)); clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue));
} }
} }
@@ -283,8 +293,8 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
case EXAMINE_NPC: case EXAMINE_NPC:
case EXAMINE_ITEM_GROUND: case EXAMINE_ITEM_GROUND:
case EXAMINE_ITEM: case EXAMINE_ITEM:
case EXAMINE_ITEM_BANK_EQ: case CC_OP_LOW_PRIORITY:
if (cameraConfig.ignoreExamine()) if (this.ignoreExamine)
{ {
break; break;
} }
@@ -314,7 +324,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
@Override @Override
public MouseEvent mousePressed(MouseEvent mouseEvent) public MouseEvent mousePressed(MouseEvent mouseEvent)
{ {
if (SwingUtilities.isRightMouseButton(mouseEvent) && cameraConfig.rightClickMovesCamera()) if (SwingUtilities.isRightMouseButton(mouseEvent) && this.rightClickMovesCamera)
{ {
boolean oneButton = client.getVar(VarPlayer.MOUSE_BUTTONS) == 1; boolean oneButton = client.getVar(VarPlayer.MOUSE_BUTTONS) == 1;
// Only move the camera if there is nothing at the menu, or if // Only move the camera if there is nothing at the menu, or if
@@ -336,7 +346,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
MouseEvent.BUTTON2); MouseEvent.BUTTON2);
} }
} }
else if (SwingUtilities.isMiddleMouseButton((mouseEvent)) && cameraConfig.middleClickMenu()) else if (SwingUtilities.isMiddleMouseButton((mouseEvent)) && this.middleClickMenu)
{ {
// Set the middleClick flag to true so we can release it later in mouseReleased() // Set the middleClick flag to true so we can release it later in mouseReleased()
middleClick = true; middleClick = true;
@@ -426,4 +436,18 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
return mouseEvent; return mouseEvent;
} }
// endregion // endregion
private void updateConfig()
{
this. innerLimit = config.innerLimit();
this.relaxCameraPitch = config.relaxCameraPitch();
this.rightClickMovesCamera = config.rightClickMovesCamera();
this.ignoreExamine = config.ignoreExamine();
this.middleClickMenu = config.middleClickMenu();
this.compassLook = config.compassLook();
this.controlFunction = config.controlFunction();
this.outerLimit = config.outerLimit();
this.ctrlZoomValue = config.ctrlZoomValue();
this.zoomIncrement = config.zoomIncrement();
}
} }

View File

@@ -133,7 +133,7 @@ public class ExaminePlugin extends Plugin
type = ExamineType.ITEM; type = ExamineType.ITEM;
id = event.getIdentifier(); id = event.getIdentifier();
break; break;
case EXAMINE_ITEM_BANK_EQ: case CC_OP_LOW_PRIORITY:
{ {
type = ExamineType.ITEM_BANK_EQ; type = ExamineType.ITEM_BANK_EQ;
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0()); int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());

View File

@@ -55,10 +55,6 @@ public class GroundItem
@Nonnull @Nonnull
private LootType lootType; private LootType lootType;
/**
* Is dropped by me
*/
private boolean isDropped;
@Nullable @Nullable
private Instant spawnTime; private Instant spawnTime;

View File

@@ -869,8 +869,7 @@ public class GroundItemsPlugin extends Plugin
.isAlwaysPrivate(client.isInInstancedRegion() || (!itemComposition.isTradeable() && realItemId != COINS)) .isAlwaysPrivate(client.isInInstancedRegion() || (!itemComposition.isTradeable() && realItemId != COINS))
.isOwnedByPlayer(tile.getWorldLocation().equals(playerLocation)) .isOwnedByPlayer(tile.getWorldLocation().equals(playerLocation))
.ticks(durationTicks) .ticks(durationTicks)
.lootType(LootType.UNKNOWN) .lootType(dropped ? LootType.DROPPED : LootType.UNKNOWN)
.isDropped(dropped)
.spawnTime(Instant.now()) .spawnTime(Instant.now())
.build(); .build();

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.grounditems;
enum LootType enum LootType
{ {
UNKNOWN, UNKNOWN,
DROPPED,
PVP, PVP,
PVM PVM
} }

View File

@@ -102,7 +102,7 @@ class ItemPricesOverlay extends Overlay
{ {
break; break;
} }
case WIDGET_DEFAULT: case CC_OP:
case ITEM_USE: case ITEM_USE:
case ITEM_FIRST_OPTION: case ITEM_FIRST_OPTION:
case ITEM_SECOND_OPTION: case ITEM_SECOND_OPTION:

View File

@@ -2007,4 +2007,17 @@ public interface MenuEntrySwapperConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
keyName = "bankEquipItem",
name = "Left Click 'Equip' In Bank Screen",
description = "Enables Left Click 'Equip' In Bank When Pressing The Hotkey",
position = 6,
section = "hotkeySwapping"
)
default boolean bankEquipItem()
{
return false;
}
} }

View File

@@ -264,6 +264,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean bankWearItem; private boolean bankWearItem;
private boolean bankEatItem; private boolean bankEatItem;
private boolean bankDrinkItem; private boolean bankDrinkItem;
private boolean bankEquipItem;
private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod) private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod)
{ {
@Override @Override
@@ -1497,7 +1498,10 @@ public class MenuEntrySwapperPlugin extends Plugin
{ {
menuManager.addPriorityEntry(new BankComparableEntry("drink", "", false)); menuManager.addPriorityEntry(new BankComparableEntry("drink", "", false));
} }
if (this.bankEquipItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("equip", "", false));
}
if (this.swapClimbUpDown) if (this.swapClimbUpDown)
{ {
menuManager.addPriorityEntry("climb-up").setPriority(100); menuManager.addPriorityEntry("climb-up").setPriority(100);
@@ -1518,6 +1522,8 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.removePriorityEntry(new BankComparableEntry("wear", "", false)); menuManager.removePriorityEntry(new BankComparableEntry("wear", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("eat", "", false)); menuManager.removePriorityEntry(new BankComparableEntry("eat", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("drink", "", false)); menuManager.removePriorityEntry(new BankComparableEntry("drink", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("equip", "", false));
loadCustomSwaps("", customShiftSwaps); loadCustomSwaps("", customShiftSwaps);
eventBus.unregister(HOTKEY); eventBus.unregister(HOTKEY);
} }
@@ -1753,6 +1759,7 @@ public class MenuEntrySwapperPlugin extends Plugin
this.bankWearItem = config.bankWearItem(); this.bankWearItem = config.bankWearItem();
this.bankEatItem = config.bankEatItem(); this.bankEatItem = config.bankEatItem();
this.bankDrinkItem = config.bankDrinkItem(); this.bankDrinkItem = config.bankDrinkItem();
this.bankEquipItem = config.bankEquipItem();
} }
private void addBuySellEntries() private void addBuySellEntries()

View File

@@ -145,12 +145,13 @@ class MouseHighlightOverlay extends Overlay
private boolean shouldNotRenderMenuAction(int type) private boolean shouldNotRenderMenuAction(int type)
{ {
return type == MenuOpcode.RUNELITE_OVERLAY.getId() return type == MenuOpcode.RUNELITE_OVERLAY.getId()
|| type == MenuOpcode.CC_OP_LOW_PRIORITY.getId()
|| (!plugin.isRightClickTooltipEnabled() && isMenuActionRightClickOnly(type)); || (!plugin.isRightClickTooltipEnabled() && isMenuActionRightClickOnly(type));
} }
private boolean isMenuActionRightClickOnly(int type) private boolean isMenuActionRightClickOnly(int type)
{ {
return type == MenuOpcode.EXAMINE_ITEM_BANK_EQ.getId(); return type == MenuOpcode.CC_OP_LOW_PRIORITY.getId();
} }
} }

View File

@@ -819,13 +819,13 @@ public class SuppliesTrackerPlugin extends Plugin
case ITEM_THIRD_OPTION: case ITEM_THIRD_OPTION:
case ITEM_FOURTH_OPTION: case ITEM_FOURTH_OPTION:
case ITEM_FIFTH_OPTION: case ITEM_FIFTH_OPTION:
case EXAMINE_ITEM_BANK_EQ: case CC_OP_LOW_PRIORITY:
case WIDGET_FIRST_OPTION: case WIDGET_FIRST_OPTION:
case WIDGET_SECOND_OPTION: case WIDGET_SECOND_OPTION:
case WIDGET_THIRD_OPTION: case WIDGET_THIRD_OPTION:
case WIDGET_FOURTH_OPTION: case WIDGET_FOURTH_OPTION:
case WIDGET_FIFTH_OPTION: case WIDGET_FIFTH_OPTION:
case WIDGET_DEFAULT: case CC_OP:
break; break;
default: default:
return; return;