Merge pull request #2522 from xKylee/upstream

project: upstream + version bump
This commit is contained in:
Kyle
2020-04-26 13:14:24 +01:00
committed by GitHub
28 changed files with 457 additions and 64 deletions

View File

@@ -27,11 +27,24 @@ package net.runelite.client.input;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.client.util.HotkeyListener;
@Singleton
public class KeyManager
{
private final Client client;
@Inject
private KeyManager(@Nullable final Client client)
{
this.client = client;
}
private final List<KeyListener> keyListeners = new CopyOnWriteArrayList<>();
public void registerKeyListener(KeyListener keyListener)
@@ -56,6 +69,11 @@ public class KeyManager
for (KeyListener keyListener : keyListeners)
{
if (!shouldProcess(keyListener))
{
continue;
}
keyListener.keyPressed(keyEvent);
if (keyEvent.isConsumed())
{
@@ -73,6 +91,11 @@ public class KeyManager
for (KeyListener keyListener : keyListeners)
{
if (!shouldProcess(keyListener))
{
continue;
}
keyListener.keyReleased(keyEvent);
if (keyEvent.isConsumed())
{
@@ -90,6 +113,11 @@ public class KeyManager
for (KeyListener keyListener : keyListeners)
{
if (!shouldProcess(keyListener))
{
continue;
}
keyListener.keyTyped(keyEvent);
if (keyEvent.isConsumed())
{
@@ -97,4 +125,26 @@ public class KeyManager
}
}
}
private boolean shouldProcess(final KeyListener keyListener)
{
if (client == null)
{
return true;
}
if (!(keyListener instanceof HotkeyListener))
{
return true;
}
final HotkeyListener hotkeyListener = (HotkeyListener) keyListener;
if (hotkeyListener.isEnabledOnLogin())
{
return true;
}
return client.getGameState() != GameState.LOGIN_SCREEN;
}
}

View File

@@ -397,6 +397,7 @@ public class ClientUI
}
};
sidebarListener.setEnabledOnLogin(true);
keyManager.registerKeyListener(sidebarListener);
final HotkeyListener pluginPanelListener = new HotkeyListener(config::panelToggleKey)

View File

@@ -50,6 +50,7 @@ public abstract class Overlay implements LayoutableRenderableEntity
private OverlayLayer layer = OverlayLayer.UNDER_WIDGETS;
private final List<OverlayMenuEntry> menuEntries = new ArrayList<>();
private boolean resizable;
private boolean resettable = true;
protected Overlay()
{

View File

@@ -355,7 +355,10 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
if (SwingUtilities.isRightMouseButton(mouseEvent))
{
overlayManager.resetOverlay(currentManagedOverlay);
if (currentManagedOverlay.isResettable())
{
overlayManager.resetOverlay(currentManagedOverlay);
}
}
else if (SwingUtilities.isLeftMouseButton(mouseEvent))
{

View File

@@ -53,7 +53,6 @@ public class WidgetOverlay extends Overlay
.put(WidgetInfo.PEST_CONTROL_BOAT_INFO, OverlayPosition.TOP_LEFT)
.put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT)
.put(WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT)
.put(WidgetInfo.PVP_BOUNTY_HUNTER_INFO, OverlayPosition.TOP_RIGHT)
.put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT)
.put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT)
.put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER)

View File

@@ -26,7 +26,9 @@ package net.runelite.client.util;
import java.awt.event.KeyEvent;
import java.util.function.Supplier;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.runelite.client.config.Keybind;
import net.runelite.client.input.KeyListener;
@@ -39,6 +41,10 @@ public abstract class HotkeyListener implements KeyListener
private boolean isConsumingTyped = false;
@Setter
@Getter
private boolean isEnabledOnLogin = false;
@Override
public void keyTyped(KeyEvent e)
{

View File

@@ -417,6 +417,8 @@ public class WeaponMap
StyleMap.put(ItemID.VERACS_FLAIL_25, WeaponStyle.MELEE);
StyleMap.put(ItemID.VERACS_FLAIL_50, WeaponStyle.MELEE);
StyleMap.put(ItemID.VERACS_FLAIL_75, WeaponStyle.MELEE);
StyleMap.put(ItemID.VESTAS_BLIGHTED_LONGSWORD, WeaponStyle.MELEE);
StyleMap.put(ItemID.VESTAS_LONGSWORD_INACTIVE, WeaponStyle.MELEE);
StyleMap.put(ItemID.VIGGORAS_CHAINMACE, WeaponStyle.MELEE);
StyleMap.put(ItemID.VIGGORAS_CHAINMACE_U, WeaponStyle.MELEE);
StyleMap.put(ItemID.VOLCANIC_ABYSSAL_WHIP, WeaponStyle.MELEE);

View File

@@ -9336,7 +9336,8 @@
],
"vestas longsword": [
22613,
23615
23615,
24619
],
"statiuss warhammer": [
22622,
@@ -9730,5 +9731,23 @@
24469,
24472,
24475
],
"antique emblem": [
24565,
24567,
24569,
24571,
24573,
24575,
24577,
24579,
24581,
24583
],
"blighted super restore": [
24598,
24601,
24603,
24605
]
}

View File

@@ -1 +1 @@
08461B2A942D4D792EEB9D9BCCEB9B11256AD8B217B1EAF1BDBA71314F816D6F
1DC252B93DF0D948329C4EAD151FA9406A17D3CF2C5C3EC0317BF4DCD1B3811A

View File

@@ -10,7 +10,7 @@
iload 2
iconst 1
if_icmpeq LABEL8
jump LABEL74
jump LABEL80
LABEL8:
get_varp 1676
iconst 4
@@ -39,81 +39,87 @@ LABEL27:
iload 0
if_settext
LABEL30:
jump LABEL73
jump LABEL79
LABEL31:
get_varbit 4965
iconst 0
if_icmpgt LABEL35
jump LABEL39
jump LABEL45
LABEL35:
sconst "Protection"
iload 0
if_settext
jump LABEL73
LABEL39:
iconst 0
iconst 13
iconst 1
iconst 2
iload 0
if_setposition
jump LABEL79
LABEL45:
iload 1
iconst 0
if_icmpgt LABEL43
jump LABEL54
LABEL43:
if_icmpgt LABEL49
jump LABEL60
LABEL49:
get_varbit 5954
iconst 1
if_icmpeq LABEL47
jump LABEL54
LABEL47:
if_icmpeq LABEL53
jump LABEL60
LABEL53:
sconst "Level: "
iload 1
tostring
join_string 2
iload 0
if_settext
jump LABEL73
LABEL54:
jump LABEL79
LABEL60:
get_varc_int 78
iconst 1
if_icmpeq LABEL58
jump LABEL62
LABEL58:
if_icmpeq LABEL64
jump LABEL68
LABEL64:
sconst "Guarded"
iload 0
if_settext
jump LABEL73
LABEL62:
jump LABEL79
LABEL68:
get_varc_int 78
iconst 2
if_icmpeq LABEL66
jump LABEL70
LABEL66:
if_icmpeq LABEL72
jump LABEL76
LABEL72:
sconst "No PvP"
iload 0
if_settext
jump LABEL73
LABEL70:
jump LABEL79
LABEL76:
sconst "Deadman"
iload 0
if_settext
LABEL73:
jump LABEL88
LABEL74:
LABEL79:
jump LABEL94
LABEL80:
iload 1
iconst 0
if_icmpgt LABEL78
jump LABEL85
LABEL78:
if_icmpgt LABEL84
jump LABEL91
LABEL84:
sconst "Level: "
iload 1
tostring
join_string 2
iload 0
if_settext
jump LABEL88
LABEL85:
jump LABEL94
LABEL91:
sconst ""
iload 0
if_settext
LABEL88:
LABEL94:
iload 1
invoke 387
sconst "wildernessWidgetTextSet" ; set callback name
runelite_callback ; invoke callback
runelite_callback ; invoke callback
return