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),
/**
* 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
@@ -263,10 +263,9 @@ public enum MenuOpcode
*/
CANCEL(1006),
/**
* Menu action triggered by either examining item in bank, examining
* item in inventory while having bank open, or examining equipped item.
* Menu action for low priority child component actions.
*/
EXAMINE_ITEM_BANK_EQ(1007),
CC_OP_LOW_PRIORITY(1007),
/**
* 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()
|| 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("deposit-x")))
{

View File

@@ -63,12 +63,6 @@ import net.runelite.client.util.MiscUtils;
)
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 String LOOK_NORTH = "Look North";
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
private boolean rightClick;
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
*/
@@ -91,7 +96,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
private ClientThread clientThread;
@Inject
private CameraConfig cameraConfig;
private CameraConfig config;
@Inject
private KeyManager keyManager;
@@ -112,7 +117,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
middleClick = false;
menuHasEntries = false;
client.setCameraPitchRelaxerEnabled(cameraConfig.relaxCameraPitch());
client.setCameraPitchRelaxerEnabled(this.relaxCameraPitch);
keyManager.registerKeyListener(this);
mouseManager.registerMouseListener(this);
}
@@ -129,7 +134,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
@Subscribe
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();
int len = menuEntries.length;
@@ -153,7 +158,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
m.setOption(option);
m.setTarget(lookNorth.getTarget());
m.setIdentifier(identifier);
m.setOpcode(MenuOpcode.WIDGET_DEFAULT.getId());
m.setOpcode(MenuOpcode.CC_OP.getId());
m.setParam0(lookNorth.getParam0());
m.setParam1(lookNorth.getParam1());
return m;
@@ -172,32 +177,32 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
int[] intStack = client.getIntStack();
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;
}
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;
}
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;
intStack[intStackSize - 1] = outerZoomLimit;
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;
}
if (cameraConfig.innerLimit())
if (this.innerLimit)
{
// This lets the options panel's slider have an exponential rate
final double exponent = 2.d;
@@ -233,9 +238,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
}
@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
@@ -259,9 +269,9 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{
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));
}
}
@@ -283,8 +293,8 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
case EXAMINE_NPC:
case EXAMINE_ITEM_GROUND:
case EXAMINE_ITEM:
case EXAMINE_ITEM_BANK_EQ:
if (cameraConfig.ignoreExamine())
case CC_OP_LOW_PRIORITY:
if (this.ignoreExamine)
{
break;
}
@@ -314,7 +324,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
@Override
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;
// 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);
}
}
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()
middleClick = true;
@@ -426,4 +436,18 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
return mouseEvent;
}
// 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;
id = event.getIdentifier();
break;
case EXAMINE_ITEM_BANK_EQ:
case CC_OP_LOW_PRIORITY:
{
type = ExamineType.ITEM_BANK_EQ;
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());

View File

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

View File

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

View File

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

View File

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

View File

@@ -2007,4 +2007,17 @@ public interface MenuEntrySwapperConfig extends Config
{
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 bankEatItem;
private boolean bankDrinkItem;
private boolean bankEquipItem;
private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod)
{
@Override
@@ -1497,7 +1498,10 @@ public class MenuEntrySwapperPlugin extends Plugin
{
menuManager.addPriorityEntry(new BankComparableEntry("drink", "", false));
}
if (this.bankEquipItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("equip", "", false));
}
if (this.swapClimbUpDown)
{
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("eat", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("drink", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("equip", "", false));
loadCustomSwaps("", customShiftSwaps);
eventBus.unregister(HOTKEY);
}
@@ -1753,6 +1759,7 @@ public class MenuEntrySwapperPlugin extends Plugin
this.bankWearItem = config.bankWearItem();
this.bankEatItem = config.bankEatItem();
this.bankDrinkItem = config.bankDrinkItem();
this.bankEquipItem = config.bankEquipItem();
}
private void addBuySellEntries()

View File

@@ -145,12 +145,13 @@ class MouseHighlightOverlay extends Overlay
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));
}
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_FOURTH_OPTION:
case ITEM_FIFTH_OPTION:
case EXAMINE_ITEM_BANK_EQ:
case CC_OP_LOW_PRIORITY:
case WIDGET_FIRST_OPTION:
case WIDGET_SECOND_OPTION:
case WIDGET_THIRD_OPTION:
case WIDGET_FOURTH_OPTION:
case WIDGET_FIFTH_OPTION:
case WIDGET_DEFAULT:
case CC_OP:
break;
default:
return;