more checkstyle etc

This commit is contained in:
Lucas
2019-05-17 05:11:02 +02:00
parent 11543b5739
commit 53a82699e4
106 changed files with 7790 additions and 6950 deletions

View File

@@ -100,7 +100,7 @@ public class Notifier
// First check if we are running in launcher // First check if we are running in launcher
this.terminalNotifierAvailable = this.terminalNotifierAvailable =
!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion()) !Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion())
&& isTerminalNotifierAvailable(); && isTerminalNotifierAvailable();
storeIcon(); storeIcon();
} }

View File

@@ -59,7 +59,6 @@ import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginInstantiationException; import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager; import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.config.ConfigPanel;
import net.runelite.client.rs.ClientUpdateCheckMode; import net.runelite.client.rs.ClientUpdateCheckMode;
import net.runelite.client.task.Scheduler; import net.runelite.client.task.Scheduler;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
@@ -86,10 +85,10 @@ public class RuneLite
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles"); public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins"); public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots"); public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
public static RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen(); static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
@Getter @Getter
private static Injector injector; private static Injector injector;
@Inject @Inject
@@ -242,7 +241,7 @@ public class RuneLite
// The submessage is shown in case the connection is slow // The submessage is shown in case the connection is slow
splashScreen.setMessage("Starting RuneLite Injector"); splashScreen.setMessage("Starting RuneLite Injector");
splashScreen.setSubMessage( " "); splashScreen.setSubMessage(" ");
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();

View File

@@ -80,9 +80,12 @@ public class RuneLiteProperties
public String getDiscordAppId() public String getDiscordAppId()
{ {
if (RuneLitePlusPlugin.customPresenceEnabled) { if (RuneLitePlusPlugin.customPresenceEnabled)
{
return properties.getProperty(RuneLitePlusPlugin.rlPlusDiscordApp); return properties.getProperty(RuneLitePlusPlugin.rlPlusDiscordApp);
} else { }
else
{
return properties.getProperty(DISCORD_APP_ID); return properties.getProperty(DISCORD_APP_ID);
} }
} }

View File

@@ -36,12 +36,12 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.events.SessionClose;
import net.runelite.client.events.SessionOpen;
import net.runelite.client.RuneLite; import net.runelite.client.RuneLite;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.SessionClose;
import net.runelite.client.events.SessionOpen;
import net.runelite.client.util.LinkBrowser; import net.runelite.client.util.LinkBrowser;
import net.runelite.client.ws.WSClient; import net.runelite.client.ws.WSClient;
import net.runelite.http.api.account.AccountClient; import net.runelite.http.api.account.AccountClient;

View File

@@ -374,6 +374,7 @@ public class Hooks implements Callbacks
/** /**
* Copy an image * Copy an image
*
* @param src * @param src
* @return * @return
*/ */

View File

@@ -24,29 +24,29 @@
*/ */
package net.runelite.client.config; package net.runelite.client.config;
import lombok.AccessLevel;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import lombok.AccessLevel;
import lombok.Getter;
public class ConfigItemsGroup public class ConfigItemsGroup
{ {
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
private final String group; private final String group;
@Getter(AccessLevel.PUBLIC) @Getter(AccessLevel.PUBLIC)
private Collection<ConfigItemDescriptor> items; private Collection<ConfigItemDescriptor> items;
public ConfigItemsGroup(String group) public ConfigItemsGroup(String group)
{ {
this.group = group; this.group = group;
this.items = new ArrayList<>(); this.items = new ArrayList<>();
} }
public void addItem(ConfigItemDescriptor item) public void addItem(ConfigItemDescriptor item)
{ {
items.add(item); items.add(item);
} }
} }

View File

@@ -364,9 +364,9 @@ public class ConfigManager
} }
itemGroups = itemGroups.stream().sorted((a, b) -> ComparisonChain.start() itemGroups = itemGroups.stream().sorted((a, b) -> ComparisonChain.start()
.compare(a.getGroup(), b.getGroup()) .compare(a.getGroup(), b.getGroup())
.result()) .result())
.collect(Collectors.toList()); .collect(Collectors.toList());
return new ConfigDescriptor(group, itemGroups); return new ConfigDescriptor(group, itemGroups);
} }
@@ -511,22 +511,22 @@ public class ConfigManager
{ {
return Duration.ofMillis(Long.parseLong(str)); return Duration.ofMillis(Long.parseLong(str));
} }
if (type == Map.class) if (type == Map.class)
{ {
Map<String, String> output = new HashMap<>(); Map<String, String> output = new HashMap<>();
str = str.substring(1, str.length() - 1); str = str.substring(1, str.length() - 1);
String[] splitStr = str.split(", "); String[] splitStr = str.split(", ");
for (String s : splitStr) for (String s : splitStr)
{ {
String[] keyVal = s.split("="); String[] keyVal = s.split("=");
if (keyVal.length > 1) if (keyVal.length > 1)
{ {
output.put(keyVal[0], keyVal[1]); output.put(keyVal[0], keyVal[1]);
} }
} }
return output; return output;
} }
return str; return str;
} }

View File

@@ -24,11 +24,10 @@
*/ */
package net.runelite.client.config; package net.runelite.client.config;
import lombok.RequiredArgsConstructor;
import lombok.Getter;
import net.runelite.client.ui.FontManager;
import java.awt.Font; import java.awt.Font;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.client.ui.FontManager;
@Getter @Getter
@RequiredArgsConstructor @RequiredArgsConstructor

View File

@@ -67,7 +67,7 @@ public interface RuneLiteConfig extends Config
keyName = "enablePlugins", keyName = "enablePlugins",
name = "Enable loading of external plugins", name = "Enable loading of external plugins",
description = "Enable loading of external plugins", description = "Enable loading of external plugins",
position = 10 position = 10
) )
default boolean enablePlugins() default boolean enablePlugins()
{ {

View File

@@ -106,7 +106,7 @@ public class DiscordService implements AutoCloseable
discordEventHandlers.joinGame = this::joinGame; discordEventHandlers.joinGame = this::joinGame;
discordEventHandlers.spectateGame = this::spectateGame; discordEventHandlers.spectateGame = this::spectateGame;
discordEventHandlers.joinRequest = this::joinRequest; discordEventHandlers.joinRequest = this::joinRequest;
discordRPC.Discord_Initialize(runeLiteProperties.discordAppID, discordEventHandlers, true, null); discordRPC.Discord_Initialize(RuneLiteProperties.discordAppID, discordEventHandlers, true, null);
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS); executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
} }

View File

@@ -35,248 +35,307 @@ for mouse motion.
package net.runelite.client.flexo; package net.runelite.client.flexo;
import com.github.joonasvali.naturalmouse.api.MouseMotionFactory; import com.github.joonasvali.naturalmouse.api.MouseMotionFactory;
import net.runelite.api.Client; import java.awt.AWTException;
import net.runelite.client.ui.ClientUI; import java.awt.Color;
import sun.awt.ComponentFactory; import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.swing.*; import java.awt.Point;
import java.awt.*; import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.peer.RobotPeer; import java.awt.peer.RobotPeer;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.client.ui.ClientUI;
import sun.awt.ComponentFactory;
public class Flexo extends Robot { public class Flexo extends Robot
public ThreadGroup flexoThreads = new ThreadGroup("flexo"); {
public static boolean isActive; public ThreadGroup flexoThreads = new ThreadGroup("flexo");
public static double scale; public static boolean isActive;
public static Client client; public static double scale;
public static ClientUI clientUI; public static Client client;
public static int fixedWidth = 765; public static ClientUI clientUI;
public static int fixedHeight = 503; public static int fixedWidth = Constants.GAME_FIXED_WIDTH;
public static boolean isStretched; public static int fixedHeight = Constants.GAME_FIXED_HEIGHT;
public static int minDelay = 45; public static boolean isStretched;
public static MouseMotionFactory currentMouseMotionFactory; public static int minDelay = 45;
public boolean pausedIndefinitely = false; public static MouseMotionFactory currentMouseMotionFactory;
private Thread holdKeyThread; public boolean pausedIndefinitely = false;
private RobotPeer peer; private Thread holdKeyThread;
private RobotPeer peer;
public Flexo() throws AWTException { public Flexo() throws AWTException
if (GraphicsEnvironment.isHeadless()) { {
throw new AWTException("headless environment"); if (GraphicsEnvironment.isHeadless())
} {
init(GraphicsEnvironment.getLocalGraphicsEnvironment() throw new AWTException("headless environment");
.getDefaultScreenDevice()); }
} init(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice());
}
private void init(GraphicsDevice screen) throws AWTException { private void init(GraphicsDevice screen) throws AWTException
Toolkit toolkit = Toolkit.getDefaultToolkit(); {
if (toolkit instanceof ComponentFactory) { Toolkit toolkit = Toolkit.getDefaultToolkit();
peer = ((ComponentFactory)toolkit).createRobot(this, screen); if (toolkit instanceof ComponentFactory)
RobotDisposer disposer = new RobotDisposer(peer); {
sun.java2d.Disposer.addRecord(anchor, disposer); peer = ((ComponentFactory) toolkit).createRobot(this, screen);
} RobotDisposer disposer = new RobotDisposer(peer);
} sun.java2d.Disposer.addRecord(anchor, disposer);
}
}
private transient Object anchor = new Object(); private transient Object anchor = new Object();
static class RobotDisposer implements sun.java2d.DisposerRecord { static class RobotDisposer implements sun.java2d.DisposerRecord
private final RobotPeer peer; {
private RobotDisposer(RobotPeer peer) { private final RobotPeer peer;
this.peer = peer;
}
public void dispose() {
if (peer != null) {
peer.dispose();
}
}
}
private void pauseMS(int delayMS) { private RobotDisposer(RobotPeer peer)
long initialMS = System.currentTimeMillis(); {
while (System.currentTimeMillis()<initialMS+delayMS) { this.peer = peer;
try { }
Thread.sleep(10);
} catch (Exception e) {
e.printStackTrace();
}
}
isActive = false;
}
@Override public void dispose()
public synchronized void mouseMove(int x, int y) { {
try { if (peer != null)
//TODO: Must be better way to determine titlebar width {
currentMouseMotionFactory.build(ClientUI.frame.getX()+x+determineHorizontalOffset(), ClientUI.frame.getY()+y+determineVerticalOffset()).move(); peer.dispose();
this.delay(getMinDelay()); }
} catch (InterruptedException e) { }
e.printStackTrace(); }
}
}
public synchronized void mouseMove(Point p) { private void pauseMS(int delayMS)
Point p2 = p; {
mouseMove((int)p.getX(), (int)p.getY()); long initialMS = System.currentTimeMillis();
try { while (System.currentTimeMillis() < initialMS + delayMS)
Thread.sleep(150); {
} catch (InterruptedException e) { try
e.printStackTrace(); {
} Thread.sleep(10);
} }
catch (Exception e)
{
e.printStackTrace();
}
}
isActive = false;
}
@Override @Override
public synchronized void mousePress(int buttonID) { public synchronized void mouseMove(int x, int y)
if (buttonID<1 || buttonID >5) { {
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5."); try
return; {
} //TODO: Must be better way to determine titlebar width
peer.mousePress(InputEvent.getMaskForButton(buttonID)); currentMouseMotionFactory.build(ClientUI.frame.getX() + x + determineHorizontalOffset(), ClientUI.frame.getY() + y + determineVerticalOffset()).move();
this.delay(getMinDelay()); this.delay(getMinDelay());
} }
catch (InterruptedException e)
{
e.printStackTrace();
}
}
public synchronized void mousePressAndRelease(int buttonID) { public synchronized void mouseMove(Point p)
if (buttonID<1 || buttonID >5) { {
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5."); Point p2 = p;
return; mouseMove((int) p.getX(), (int) p.getY());
} try
peer.mousePress(InputEvent.getMaskForButton(buttonID)); {
this.delay(getMinDelay()); Thread.sleep(150);
peer.mouseRelease(InputEvent.getMaskForButton(buttonID)); }
this.delay(getMinDelay()); catch (InterruptedException e)
} {
e.printStackTrace();
}
}
//TODO: Symbols are nut supported at this time @Override
public synchronized void typeMessage(String message) { public synchronized void mousePress(int buttonID)
{
if (buttonID < 1 || buttonID > 5)
{
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
return;
}
peer.mousePress(InputEvent.getMaskForButton(buttonID));
this.delay(getMinDelay());
}
Random r = new Random(); public synchronized void mousePressAndRelease(int buttonID)
char[] charArray = message.toCharArray(); {
for (char c : charArray) { if (buttonID < 1 || buttonID > 5)
keyPress(KeyEvent.getExtendedKeyCodeForChar(c)); {
this.delay(93+r.nextInt(getMinDelay())); Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
} return;
keyPress(KeyEvent.VK_ENTER); }
this.delay(93+r.nextInt(getMinDelay())); peer.mousePress(InputEvent.getMaskForButton(buttonID));
ClientUI.allowInput = true; this.delay(getMinDelay());
} peer.mouseRelease(InputEvent.getMaskForButton(buttonID));
this.delay(getMinDelay());
}
//TODO: Symbols are nut supported at this time
public synchronized void typeMessage(String message)
{
Random r = new Random();
char[] charArray = message.toCharArray();
for (char c : charArray)
{
keyPress(KeyEvent.getExtendedKeyCodeForChar(c));
this.delay(93 + r.nextInt(getMinDelay()));
}
keyPress(KeyEvent.VK_ENTER);
this.delay(93 + r.nextInt(getMinDelay()));
ClientUI.allowInput = true;
}
@Override
public synchronized void mouseRelease(int buttonID)
{
if (buttonID < 1 || buttonID > 5)
{
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
return;
}
peer.mouseRelease(InputEvent.getMaskForButton(buttonID));
this.delay(getMinDelay());
}
@Override private int getMinDelay()
public synchronized void mouseRelease(int buttonID) { {
if (buttonID<1 || buttonID >5) { Random random = new Random();
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5."); int random1 = random.nextInt(minDelay);
return; if (random1 < minDelay / 2)
} {
peer.mouseRelease(InputEvent.getMaskForButton(buttonID)); random1 = random.nextInt(minDelay / 2) + minDelay / 2 + random.nextInt(minDelay / 2);
this.delay(getMinDelay()); }
} return random1;
}
private int getMinDelay() { private int getWheelDelay()
Random random = new Random(); {
int random1 = random.nextInt(minDelay); Random random = new Random();
if (random1 < minDelay/2) int random1 = random.nextInt(minDelay);
random1 = random.nextInt(minDelay/2) + minDelay/2+random.nextInt(minDelay/2); if (random1 < minDelay / 2)
return random1; {
} random1 = random.nextInt(minDelay / 2) + minDelay / 2 + random.nextInt(minDelay / 2);
}
return random1;
}
private int getWheelDelay() { /**
Random random = new Random(); * Rotates the scroll wheel on wheel-equipped mice.
int random1 = random.nextInt(minDelay); *
if (random1 < minDelay/2) * @param wheelAmt number of "notches" to move the mouse wheel
random1 = random.nextInt(minDelay/2) + minDelay/2+random.nextInt(minDelay/2); * Negative values indicate movement up/away from the user,
return random1; * positive values indicate movement down/towards the user.
} * @since 1.4
*/
@Override
public synchronized void mouseWheel(int wheelAmt)
{
for (int i : new int[wheelAmt])
{
peer.mouseWheel(wheelAmt);
this.delay(getWheelDelay());
}
}
/** /**
* Rotates the scroll wheel on wheel-equipped mice. * Presses a given key. The key should be released using the
* * <code>keyRelease</code> method.
* @param wheelAmt number of "notches" to move the mouse wheel * <p>
* Negative values indicate movement up/away from the user, * Key codes that have more than one physical key associated with them
* positive values indicate movement down/towards the user. * (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
* * left or right shift key) will map to the left key.
* @since 1.4 *
*/ * @param keycode Key to press (e.g. <code>KeyEvent.VK_A</code>)
@Override * @throws IllegalArgumentException if <code>keycode</code> is not
public synchronized void mouseWheel(int wheelAmt) { * a valid key
for (int i : new int[wheelAmt]) { * @see #keyRelease(int)
peer.mouseWheel(wheelAmt); * @see java.awt.event.KeyEvent
this.delay(getWheelDelay()); */
} @Override
} public synchronized void keyPress(int keycode)
{
peer.keyPress(keycode);
this.delay(getMinDelay());
}
/** @Override
* Presses a given key. The key should be released using the public synchronized void keyRelease(int keycode)
* <code>keyRelease</code> method. {
* <p> peer.keyRelease(keycode);
* Key codes that have more than one physical key associated with them this.delay(getMinDelay());
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the }
* left or right shift key) will map to the left key.
*
* @param keycode Key to press (e.g. <code>KeyEvent.VK_A</code>)
* @throws IllegalArgumentException if <code>keycode</code> is not
* a valid key
* @see #keyRelease(int)
* @see java.awt.event.KeyEvent
*/
@Override
public synchronized void keyPress(int keycode) {
peer.keyPress(keycode);
this.delay(getMinDelay());
}
@Override public synchronized void holdKey(int keycode, int timeMS)
public synchronized void keyRelease(int keycode) { {
peer.keyRelease(keycode); new Thread(() ->
this.delay(getMinDelay()); {
} peer.keyPress(keycode);
long startTime = System.currentTimeMillis();
while ((startTime + timeMS) > System.currentTimeMillis())
{
}
peer.keyRelease(keycode);
this.delay(getMinDelay());
}).start();
}
public synchronized void holdKey(int keycode, int timeMS) { public synchronized void holdKeyIndefinitely(int keycode)
new Thread(() -> { {
peer.keyPress(keycode); holdKeyThread = new Thread(() ->
long startTime = System.currentTimeMillis(); {
while ((startTime + timeMS) > System.currentTimeMillis()) { } pausedIndefinitely = true;
peer.keyRelease(keycode); peer.keyPress(keycode);
this.delay(getMinDelay()); while (pausedIndefinitely)
}).start(); {
} try
{
Thread.sleep(10);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
peer.keyRelease(keycode);
this.delay(getMinDelay());
});
holdKeyThread.start();
public synchronized void holdKeyIndefinitely(int keycode) { }
holdKeyThread = new Thread(() -> {
pausedIndefinitely = true;
peer.keyPress(keycode);
while (pausedIndefinitely) {
try {
holdKeyThread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
peer.keyRelease(keycode);
this.delay(getMinDelay());
});
holdKeyThread.start();
} @Override
public Color getPixelColor(int x, int y)
{
Color color = new Color(peer.getRGBPixel(x, y));
return color;
}
@Override @Override
public Color getPixelColor(int x, int y) { public void delay(int ms)
Color color = new Color(peer.getRGBPixel(x, y)); {
return color; pauseMS(ms);
} }
@Override public int determineHorizontalOffset()
public void delay(int ms) { {
pauseMS(ms); return clientUI.getCanvasOffset().getX();
} }
public int determineHorizontalOffset() { public int determineVerticalOffset()
return clientUI.getCanvasOffset().getX(); {
} return clientUI.getCanvasOffset().getY();
}
public int determineVerticalOffset() {
return clientUI.getCanvasOffset().getY();
}
} }

View File

@@ -28,163 +28,198 @@
package net.runelite.client.flexo; package net.runelite.client.flexo;
import net.runelite.client.ui.ClientUI; import java.awt.Point;
import java.awt.Rectangle;
import java.awt.*;
import java.util.Random; import java.util.Random;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.runelite.api.Constants;
import net.runelite.client.ui.ClientUI;
public class FlexoMouse { public class FlexoMouse
{
/* /*
Should pass unstretched coords, handles all conversions here. Should pass unstretched coords, handles all conversions here.
*/ */
public static Point getClickPoint(Rectangle rect) public static Point getClickPoint(Rectangle rect)
{ {
if (rect!=null) { if (rect != null)
Random r = new Random(); {
int x = -1; Random r = new Random();
int y = -1; int x = -1;
x = rect.x+r.nextInt(rect.width); int y = -1;
y = rect.y+r.nextInt(rect.height); x = rect.x + r.nextInt(rect.width);
y = rect.y + r.nextInt(rect.height);
if (Flexo.isStretched) { if (Flexo.isStretched)
double wScale; {
double hScale; double wScale;
double hScale;
if (Flexo.client.isResized()) { if (Flexo.client.isResized())
wScale = (Flexo.client.getStretchedDimensions().width / Flexo.client.getRealDimensions().width); {
hScale = (Flexo.client.getStretchedDimensions().height / Flexo.client.getRealDimensions().height); wScale = (Flexo.client.getStretchedDimensions().width / (double) Flexo.client.getRealDimensions().width);
int newX = (int)(x*wScale); hScale = (Flexo.client.getStretchedDimensions().height / (double) Flexo.client.getRealDimensions().height);
int newY = (int)(y*hScale); int newX = (int) (x * wScale);
if (newX>0 && newX< ClientUI.frame.getWidth()) { int newY = (int) (y * hScale);
if (newY>0 && newY< ClientUI.frame.getHeight()) { if (newX > 0 && newX < ClientUI.frame.getWidth())
return new Point(newX, newY); {
} if (newY > 0 && newY < ClientUI.frame.getHeight())
} {
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen."); return new Point(newX, newY);
return null; }
} else { }
if (x>0 && x< ClientUI.frame.getWidth()) { Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen.");
if (y>0 && y< ClientUI.frame.getHeight()) { return null;
return new Point(x, y); }
} else
} {
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen."); if (x > 0 && x < ClientUI.frame.getWidth())
return null; {
} if (y > 0 && y < ClientUI.frame.getHeight())
{
return new Point(x, y);
}
}
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen.");
return null;
}
} else if (!Flexo.client.isResized()) { }
int fixedWidth = 765; else if (!Flexo.client.isResized())
int widthDif = ClientUI.frame.getWidth(); {
final int fixedWidth = Constants.GAME_FIXED_WIDTH;
int widthDif = ClientUI.frame.getWidth();
if (ClientUI.pluginToolbar.isVisible()) { if (ClientUI.pluginToolbar.isVisible())
widthDif -= ClientUI.pluginToolbar.getWidth(); {
} widthDif -= ClientUI.pluginToolbar.getWidth();
if (ClientUI.pluginPanel!=null) }
widthDif -= ClientUI.pluginPanel.getWidth(); if (ClientUI.pluginPanel != null)
{
widthDif -= ClientUI.pluginPanel.getWidth();
}
widthDif -= fixedWidth; widthDif -= fixedWidth;
if (x+(widthDif/2)>0 && x+(widthDif/2)< ClientUI.frame.getWidth()) { if (x + (widthDif / 2) > 0 && x + (widthDif / 2) < ClientUI.frame.getWidth())
if (y>0 && y< ClientUI.frame.getHeight()) { {
return new Point(x, y); if (y > 0 && y < ClientUI.frame.getHeight())
} {
} return new Point(x, y);
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen."); }
return null; }
} Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen.");
else { return null;
if (x>0 && x< ClientUI.frame.getWidth()) { }
if (y>0 && y< ClientUI.frame.getHeight()) { else
return new Point(x, y); {
} if (x > 0 && x < ClientUI.frame.getWidth())
} {
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen."); if (y > 0 && y < ClientUI.frame.getHeight())
return null; {
} return new Point(x, y);
} }
return null; }
} Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen.");
return null;
}
}
return null;
}
public static Rectangle getClickArea(Rectangle rect) public static Rectangle getClickArea(Rectangle rect)
{ {
if (Flexo.isStretched) if (Flexo.isStretched)
{ {
double wScale; double wScale;
double hScale; double hScale;
if (Flexo.client.isResized()) { if (Flexo.client.isResized())
wScale = (Flexo.client.getStretchedDimensions().width / Flexo.client.getRealDimensions().width); {
hScale = (Flexo.client.getStretchedDimensions().height / Flexo.client.getRealDimensions().height); wScale = (Flexo.client.getStretchedDimensions().width / (double) Flexo.client.getRealDimensions().width);
} else { hScale = (Flexo.client.getStretchedDimensions().height / (double) Flexo.client.getRealDimensions().height);
wScale = ((double) Flexo.client.getStretchedDimensions().width) / Flexo.fixedWidth; }
hScale = ((double) Flexo.client.getStretchedDimensions().height) / Flexo.fixedHeight; else
} {
wScale = (Flexo.client.getStretchedDimensions().width) / (double) Flexo.fixedWidth;
hScale = (Flexo.client.getStretchedDimensions().height) / (double) Flexo.fixedHeight;
}
int xPadding = (int)rect.getWidth()/5; int xPadding = (int) rect.getWidth() / 5;
int yPadding = (int)rect.getHeight()/5; int yPadding = (int) rect.getHeight() / 5;
Random r = new Random(); Random r = new Random();
Rectangle clickRect = new Rectangle(); Rectangle clickRect = new Rectangle();
clickRect.width = rect.width-xPadding*2; clickRect.width = rect.width - xPadding * 2;
clickRect.height = rect.height-yPadding*2; clickRect.height = rect.height - yPadding * 2;
clickRect.x = rect.x+xPadding; clickRect.x = rect.x + xPadding;
clickRect.y = rect.y+yPadding; clickRect.y = rect.y + yPadding;
if (clickRect.width>0&&clickRect.height>0) { if (clickRect.width > 0 && clickRect.height > 0)
int x = clickRect.x+r.nextInt(clickRect.width); {
int y = clickRect.y+r.nextInt(clickRect.height); int x = clickRect.x + r.nextInt(clickRect.width);
double tScale = 1 + (Flexo.scale / 100); int y = clickRect.y + r.nextInt(clickRect.height);
double tScale = 1 + (Flexo.scale / 100);
if (Flexo.client.isResized()) { if (Flexo.client.isResized())
return new Rectangle((int)(clickRect.x * wScale), (int)(clickRect.y * wScale), (int)(clickRect.width * wScale), (int)(clickRect.getHeight()*hScale)); {
} else { return new Rectangle((int) (clickRect.x * wScale), (int) (clickRect.y * wScale), (int) (clickRect.width * wScale), (int) (clickRect.getHeight() * hScale));
return new Rectangle((int)(clickRect.x), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight())); }
} else
} {
return new Rectangle(clickRect.x, clickRect.y, clickRect.width, (int) (clickRect.getHeight()));
}
}
} }
//Fixed, not stretched //Fixed, not stretched
else if (!Flexo.client.isResized()) { else if (!Flexo.client.isResized())
int fixedWidth = 765; {
int widthDif = ClientUI.frame.getWidth(); int fixedWidth = 765;
int widthDif = ClientUI.frame.getWidth();
if (ClientUI.pluginToolbar.isVisible()) { if (ClientUI.pluginToolbar.isVisible())
widthDif -= ClientUI.pluginToolbar.getWidth(); {
} widthDif -= ClientUI.pluginToolbar.getWidth();
if (ClientUI.pluginPanel!=null) }
widthDif -= ClientUI.pluginPanel.getWidth(); if (ClientUI.pluginPanel != null)
{
widthDif -= ClientUI.pluginPanel.getWidth();
}
widthDif -= fixedWidth; widthDif -= fixedWidth;
int xPadding = (int)rect.getWidth()/5; int xPadding = (int) rect.getWidth() / 5;
int yPadding = (int)rect.getHeight()/5; int yPadding = (int) rect.getHeight() / 5;
Random r = new Random(); Random r = new Random();
Rectangle clickRect = new Rectangle(); Rectangle clickRect = new Rectangle();
clickRect.width = rect.width-xPadding; clickRect.width = rect.width - xPadding;
clickRect.height = rect.height-yPadding; clickRect.height = rect.height - yPadding;
clickRect.x = rect.x+xPadding; clickRect.x = rect.x + xPadding;
clickRect.y = rect.y+yPadding; clickRect.y = rect.y + yPadding;
if (clickRect.height>0&&clickRect.width>0) { if (clickRect.height > 0 && clickRect.width > 0)
int x = clickRect.x + r.nextInt(clickRect.width); {
int y = clickRect.y + r.nextInt(clickRect.height); int x = clickRect.x + r.nextInt(clickRect.width);
return new Rectangle((int) (clickRect.x), (int) (clickRect.y), (int) (clickRect.width), (int) (clickRect.getHeight())); int y = clickRect.y + r.nextInt(clickRect.height);
} return new Rectangle(clickRect.x, clickRect.y, clickRect.width, (int) (clickRect.getHeight()));
} }
//Resizable, not stretched }
else { //Resizable, not stretched
int xPadding = (int)rect.getWidth()/5; else
int yPadding = (int)rect.getHeight()/5; {
Random r = new Random(); int xPadding = (int) rect.getWidth() / 5;
Rectangle clickRect = new Rectangle(); int yPadding = (int) rect.getHeight() / 5;
clickRect.width = rect.width-xPadding*2; Random r = new Random();
clickRect.height = rect.height-yPadding*2; Rectangle clickRect = new Rectangle();
clickRect.x = rect.x+xPadding; clickRect.width = rect.width - xPadding * 2;
clickRect.y = rect.y+yPadding; clickRect.height = rect.height - yPadding * 2;
if (clickRect.height>0&&clickRect.width>0) { clickRect.x = rect.x + xPadding;
int x = clickRect.x+r.nextInt(clickRect.width); clickRect.y = rect.y + yPadding;
int y = clickRect.y+r.nextInt(clickRect.height); if (clickRect.height > 0 && clickRect.width > 0)
return new Rectangle((int)(clickRect.x), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight())); {
} int x = clickRect.x + r.nextInt(clickRect.width);
} int y = clickRect.y + r.nextInt(clickRect.height);
return new Rectangle(clickRect.x, clickRect.y, clickRect.width, (int) (clickRect.getHeight()));
}
}
return null; return null;
} }
} }

View File

@@ -26,54 +26,258 @@
package net.runelite.client.game; package net.runelite.client.game;
import lombok.Getter; import lombok.Getter;
import static net.runelite.api.NullObjectID.*; import static net.runelite.api.NullObjectID.NULL_25337;
import static net.runelite.api.ObjectID.*; import static net.runelite.api.NullObjectID.NULL_26371;
import static net.runelite.api.NullObjectID.NULL_26375;
import static net.runelite.api.NullObjectID.NULL_26884;
import static net.runelite.api.NullObjectID.NULL_26886;
import static net.runelite.api.NullObjectID.NULL_29868;
import static net.runelite.api.NullObjectID.NULL_29869;
import static net.runelite.api.NullObjectID.NULL_29870;
import static net.runelite.api.NullObjectID.NULL_31823;
import static net.runelite.api.NullObjectID.NULL_31849;
import static net.runelite.api.NullObjectID.NULL_33327;
import static net.runelite.api.NullObjectID.NULL_33328;
import static net.runelite.api.ObjectID.A_WOODEN_LOG;
import static net.runelite.api.ObjectID.BALANCING_LEDGE_23548;
import static net.runelite.api.ObjectID.BIG_WINDOW;
import static net.runelite.api.ObjectID.BOULDER_27990;
import static net.runelite.api.ObjectID.BROKEN_FENCE;
import static net.runelite.api.ObjectID.BROKEN_FENCE_2618;
import static net.runelite.api.ObjectID.BROKEN_RAFT;
import static net.runelite.api.ObjectID.BROKEN_WALL_33344;
import static net.runelite.api.ObjectID.CASTLE_WALL;
import static net.runelite.api.ObjectID.CLIMBING_ROCKS;
import static net.runelite.api.ObjectID.CLIMBING_ROCKS_11948;
import static net.runelite.api.ObjectID.CLIMBING_ROCKS_11949;
import static net.runelite.api.ObjectID.CREVICE_16465;
import static net.runelite.api.ObjectID.CREVICE_16539;
import static net.runelite.api.ObjectID.CREVICE_16543;
import static net.runelite.api.ObjectID.CREVICE_19043;
import static net.runelite.api.ObjectID.CREVICE_30198;
import static net.runelite.api.ObjectID.CREVICE_9739;
import static net.runelite.api.ObjectID.CREVICE_9740;
import static net.runelite.api.ObjectID.CROSSBOW_TREE_17062;
import static net.runelite.api.ObjectID.CRUMBLING_WALL_24222;
import static net.runelite.api.ObjectID.DARK_TUNNEL_10047;
import static net.runelite.api.ObjectID.DENSE_FOREST;
import static net.runelite.api.ObjectID.DENSE_FOREST_3938;
import static net.runelite.api.ObjectID.DENSE_FOREST_3939;
import static net.runelite.api.ObjectID.DENSE_FOREST_3998;
import static net.runelite.api.ObjectID.DENSE_FOREST_3999;
import static net.runelite.api.ObjectID.FALLEN_TREE_33192;
import static net.runelite.api.ObjectID.FENCE_16518;
import static net.runelite.api.ObjectID.GAP;
import static net.runelite.api.ObjectID.GAP_2831;
import static net.runelite.api.ObjectID.GAP_29326;
import static net.runelite.api.ObjectID.HOLE_16520;
import static net.runelite.api.ObjectID.HOLE_30966;
import static net.runelite.api.ObjectID.HOLE_31481;
import static net.runelite.api.ObjectID.HOLE_31482;
import static net.runelite.api.ObjectID.ICE_CHUNKS_31822;
import static net.runelite.api.ObjectID.ICE_CHUNKS_31990;
import static net.runelite.api.ObjectID.JUTTING_WALL_17002;
import static net.runelite.api.ObjectID.LADDER_30938;
import static net.runelite.api.ObjectID.LADDER_30939;
import static net.runelite.api.ObjectID.LADDER_30940;
import static net.runelite.api.ObjectID.LADDER_30941;
import static net.runelite.api.ObjectID.LEAVES;
import static net.runelite.api.ObjectID.LEAVES_3924;
import static net.runelite.api.ObjectID.LEAVES_3925;
import static net.runelite.api.ObjectID.LEDGE_33190;
import static net.runelite.api.ObjectID.LITTLE_BOULDER;
import static net.runelite.api.ObjectID.LOG_BALANCE_16540;
import static net.runelite.api.ObjectID.LOG_BALANCE_16541;
import static net.runelite.api.ObjectID.LOG_BALANCE_16542;
import static net.runelite.api.ObjectID.LOG_BALANCE_16546;
import static net.runelite.api.ObjectID.LOG_BALANCE_16547;
import static net.runelite.api.ObjectID.LOG_BALANCE_16548;
import static net.runelite.api.ObjectID.LOG_BALANCE_20882;
import static net.runelite.api.ObjectID.LOG_BALANCE_20884;
import static net.runelite.api.ObjectID.LOG_BALANCE_23274;
import static net.runelite.api.ObjectID.LOG_BALANCE_3929;
import static net.runelite.api.ObjectID.LOG_BALANCE_3930;
import static net.runelite.api.ObjectID.LOG_BALANCE_3931;
import static net.runelite.api.ObjectID.LOG_BALANCE_3932;
import static net.runelite.api.ObjectID.LOG_BALANCE_3933;
import static net.runelite.api.ObjectID.LOOSE_RAILING;
import static net.runelite.api.ObjectID.LOOSE_RAILING_2186;
import static net.runelite.api.ObjectID.LOOSE_RAILING_28849;
import static net.runelite.api.ObjectID.LOW_FENCE;
import static net.runelite.api.ObjectID.MONKEYBARS_23566;
import static net.runelite.api.ObjectID.MONKEYBARS_23567;
import static net.runelite.api.ObjectID.MYSTERIOUS_PIPE;
import static net.runelite.api.ObjectID.OBSTACLE;
import static net.runelite.api.ObjectID.OBSTACLE_30767;
import static net.runelite.api.ObjectID.OBSTACLE_30962;
import static net.runelite.api.ObjectID.OBSTACLE_30964;
import static net.runelite.api.ObjectID.OBSTACLE_PIPE_16509;
import static net.runelite.api.ObjectID.OBSTACLE_PIPE_16511;
import static net.runelite.api.ObjectID.OBSTACLE_PIPE_23140;
import static net.runelite.api.ObjectID.ORNATE_RAILING;
import static net.runelite.api.ObjectID.ORNATE_RAILING_17000;
import static net.runelite.api.ObjectID.PILE_OF_RUBBLE_23563;
import static net.runelite.api.ObjectID.PILE_OF_RUBBLE_23564;
import static net.runelite.api.ObjectID.PILLAR_31561;
import static net.runelite.api.ObjectID.PILLAR_31809;
import static net.runelite.api.ObjectID.PIPE_21727;
import static net.runelite.api.ObjectID.PIPE_21728;
import static net.runelite.api.ObjectID.ROCKS;
import static net.runelite.api.ObjectID.ROCKSLIDE_33184;
import static net.runelite.api.ObjectID.ROCKSLIDE_33185;
import static net.runelite.api.ObjectID.ROCKSLIDE_33191;
import static net.runelite.api.ObjectID.ROCKS_14106;
import static net.runelite.api.ObjectID.ROCKS_16464;
import static net.runelite.api.ObjectID.ROCKS_16514;
import static net.runelite.api.ObjectID.ROCKS_16515;
import static net.runelite.api.ObjectID.ROCKS_16521;
import static net.runelite.api.ObjectID.ROCKS_16522;
import static net.runelite.api.ObjectID.ROCKS_16523;
import static net.runelite.api.ObjectID.ROCKS_16524;
import static net.runelite.api.ObjectID.ROCKS_16534;
import static net.runelite.api.ObjectID.ROCKS_16535;
import static net.runelite.api.ObjectID.ROCKS_16545;
import static net.runelite.api.ObjectID.ROCKS_16549;
import static net.runelite.api.ObjectID.ROCKS_16550;
import static net.runelite.api.ObjectID.ROCKS_16998;
import static net.runelite.api.ObjectID.ROCKS_16999;
import static net.runelite.api.ObjectID.ROCKS_17042;
import static net.runelite.api.ObjectID.ROCKS_19849;
import static net.runelite.api.ObjectID.ROCKS_2231;
import static net.runelite.api.ObjectID.ROCKS_27984;
import static net.runelite.api.ObjectID.ROCKS_27985;
import static net.runelite.api.ObjectID.ROCKS_27987;
import static net.runelite.api.ObjectID.ROCKS_27988;
import static net.runelite.api.ObjectID.ROCKS_31757;
import static net.runelite.api.ObjectID.ROCKS_31758;
import static net.runelite.api.ObjectID.ROCKS_31759;
import static net.runelite.api.ObjectID.ROCKS_34396;
import static net.runelite.api.ObjectID.ROCKS_34397;
import static net.runelite.api.ObjectID.ROCKS_34741;
import static net.runelite.api.ObjectID.ROCKS_3748;
import static net.runelite.api.ObjectID.ROCKS_3790;
import static net.runelite.api.ObjectID.ROCKS_3791;
import static net.runelite.api.ObjectID.ROCKS_3803;
import static net.runelite.api.ObjectID.ROCKS_3804;
import static net.runelite.api.ObjectID.ROCKS_6673;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26400;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26401;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26402;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26404;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26405;
import static net.runelite.api.ObjectID.ROCKY_HANDHOLDS_26406;
import static net.runelite.api.ObjectID.ROCK_16115;
import static net.runelite.api.ObjectID.ROPESWING_23568;
import static net.runelite.api.ObjectID.ROPESWING_23569;
import static net.runelite.api.ObjectID.ROPE_ANCHOR;
import static net.runelite.api.ObjectID.ROPE_ANCHOR_30917;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21306;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21307;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21308;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21309;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21310;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21311;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21312;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21313;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21314;
import static net.runelite.api.ObjectID.ROPE_BRIDGE_21315;
import static net.runelite.api.ObjectID.RUBBER_CAP_MUSHROOM;
import static net.runelite.api.ObjectID.SPIKEY_CHAIN;
import static net.runelite.api.ObjectID.SPIKEY_CHAIN_16538;
import static net.runelite.api.ObjectID.STAIRS_31485;
import static net.runelite.api.ObjectID.STEPPING_STONES;
import static net.runelite.api.ObjectID.STEPPING_STONES_23646;
import static net.runelite.api.ObjectID.STEPPING_STONES_23647;
import static net.runelite.api.ObjectID.STEPPING_STONE_10663;
import static net.runelite.api.ObjectID.STEPPING_STONE_11768;
import static net.runelite.api.ObjectID.STEPPING_STONE_13504;
import static net.runelite.api.ObjectID.STEPPING_STONE_14917;
import static net.runelite.api.ObjectID.STEPPING_STONE_14918;
import static net.runelite.api.ObjectID.STEPPING_STONE_16466;
import static net.runelite.api.ObjectID.STEPPING_STONE_16513;
import static net.runelite.api.ObjectID.STEPPING_STONE_16533;
import static net.runelite.api.ObjectID.STEPPING_STONE_19040;
import static net.runelite.api.ObjectID.STEPPING_STONE_19042;
import static net.runelite.api.ObjectID.STEPPING_STONE_21738;
import static net.runelite.api.ObjectID.STEPPING_STONE_21739;
import static net.runelite.api.ObjectID.STEPPING_STONE_29728;
import static net.runelite.api.ObjectID.STEPPING_STONE_29729;
import static net.runelite.api.ObjectID.STEPPING_STONE_29730;
import static net.runelite.api.ObjectID.STEPPING_STONE_5948;
import static net.runelite.api.ObjectID.STEPPING_STONE_5949;
import static net.runelite.api.ObjectID.STEPS;
import static net.runelite.api.ObjectID.STEPS_29993;
import static net.runelite.api.ObjectID.STICKS;
import static net.runelite.api.ObjectID.STILE;
import static net.runelite.api.ObjectID.STILE_12982;
import static net.runelite.api.ObjectID.STRANGE_FLOOR;
import static net.runelite.api.ObjectID.STRANGE_FLOOR_16544;
import static net.runelite.api.ObjectID.STRONG_TREE_17074;
import static net.runelite.api.ObjectID.TIGHTGAP;
import static net.runelite.api.ObjectID.TRELLIS_20056;
import static net.runelite.api.ObjectID.TRIPWIRE;
import static net.runelite.api.ObjectID.TUNNEL_30174;
import static net.runelite.api.ObjectID.TUNNEL_30175;
import static net.runelite.api.ObjectID.TUNNEL_30959;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL_16528;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL_16529;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL_16530;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL_19032;
import static net.runelite.api.ObjectID.UNDERWALL_TUNNEL_19036;
import static net.runelite.api.ObjectID.VINE_26880;
import static net.runelite.api.ObjectID.VINE_26882;
import static net.runelite.api.ObjectID.WALL_17047;
import static net.runelite.api.ObjectID.WALL_17049;
import static net.runelite.api.ObjectID.WALL_17050;
import static net.runelite.api.ObjectID.WEATHERED_WALL;
import static net.runelite.api.ObjectID.WEATHERED_WALL_16526;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
@Getter @Getter
public enum AgilityShortcut public enum AgilityShortcut
{ {
GENERIC_SHORTCUT(1, "Shortcut", null, GENERIC_SHORTCUT(1, "Shortcut", null,
// Trollheim // Trollheim
ROCKS_3790, ROCKS_3791, ROCKS_3790, ROCKS_3791,
// Fremennik Slayer Cave // Fremennik Slayer Cave
STEPS_29993, STEPS_29993,
// Fossil Island // Fossil Island
LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, RUBBER_CAP_MUSHROOM, LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, RUBBER_CAP_MUSHROOM,
// Brimhaven dungeon // Brimhaven dungeon
CREVICE_30198, CREVICE_30198,
// Lumbridge // Lumbridge
STILE_12982, STILE_12982,
// Gu'Tanoth Bridge // Gu'Tanoth Bridge
GAP, GAP_2831, GAP, GAP_2831,
// Lumbridge Swamp Caves // Lumbridge Swamp Caves
STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673, STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673,
// Morytania Pirate Ship // Morytania Pirate Ship
ROCK_16115, ROCK_16115,
// Lumber Yard // Lumber Yard
BROKEN_FENCE_2618, BROKEN_FENCE_2618,
// McGrubor's Wood // McGrubor's Wood
LOOSE_RAILING, LOOSE_RAILING,
// Underwater Area Fossil Island // Underwater Area Fossil Island
TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962, TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962,
// Tree Gnome Village // Tree Gnome Village
LOOSE_RAILING_2186, LOOSE_RAILING_2186,
// Burgh de Rott // Burgh de Rott
LOW_FENCE, LOW_FENCE,
// Taverley // Taverley
STILE, STILE,
// Asgarnian Ice Dungeon // Asgarnian Ice Dungeon
STEPS, STEPS,
// Fossil Island Wyvern Cave // Fossil Island Wyvern Cave
STAIRS_31485), STAIRS_31485),
BRIMHAVEN_DUNGEON_MEDIUM_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2698, 9491, 0), PIPE_21727), BRIMHAVEN_DUNGEON_MEDIUM_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2698, 9491, 0), PIPE_21727),
BRIMHAVEN_DUNGEON_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2655, 9573, 0), PIPE_21728), BRIMHAVEN_DUNGEON_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2655, 9573, 0), PIPE_21728),
BRIMHAVEN_DUNGEON_STEPPING_STONES_RETURN(1, "Pipe Squeeze", null, STEPPING_STONE_21739), BRIMHAVEN_DUNGEON_STEPPING_STONES_RETURN(1, "Pipe Squeeze", null, STEPPING_STONE_21739),
BRIMHAVEN_DUNGEON_LOG_BALANCE_RETURN(1, "Log Balance", null, LOG_BALANCE_20884), BRIMHAVEN_DUNGEON_LOG_BALANCE_RETURN(1, "Log Balance", null, LOG_BALANCE_20884),
AGILITY_PYRAMID_ROCKS_WEST(1, "Rocks", null, CLIMBING_ROCKS_11948), AGILITY_PYRAMID_ROCKS_WEST(1, "Rocks", null, CLIMBING_ROCKS_11948),
CAIRN_ISLE_CLIMBING_ROCKS(1, "Rocks", null, CLIMBING_ROCKS), CAIRN_ISLE_CLIMBING_ROCKS(1, "Rocks", null, CLIMBING_ROCKS),
KARAMJA_GLIDER_LOG(1, "Log Balance", new WorldPoint(2906, 3050, 0), A_WOODEN_LOG ), KARAMJA_GLIDER_LOG(1, "Log Balance", new WorldPoint(2906, 3050, 0), A_WOODEN_LOG),
FALADOR_CRUMBLING_WALL(5, "Crumbling Wall", new WorldPoint(2936, 3357, 0), CRUMBLING_WALL_24222 ), FALADOR_CRUMBLING_WALL(5, "Crumbling Wall", new WorldPoint(2936, 3357, 0), CRUMBLING_WALL_24222),
RIVER_LUM_GRAPPLE_WEST(8, "Grapple Broken Raft", new WorldPoint(3245, 3179, 0), BROKEN_RAFT), RIVER_LUM_GRAPPLE_WEST(8, "Grapple Broken Raft", new WorldPoint(3245, 3179, 0), BROKEN_RAFT),
RIVER_LUM_GRAPPLE_EAST(8, "Grapple Broken Raft", new WorldPoint(3258, 3179, 0), BROKEN_RAFT), RIVER_LUM_GRAPPLE_EAST(8, "Grapple Broken Raft", new WorldPoint(3258, 3179, 0), BROKEN_RAFT),
CORSAIR_COVE_ROCKS(10, "Rocks", new WorldPoint(2545, 2871, 0), ROCKS_31757), CORSAIR_COVE_ROCKS(10, "Rocks", new WorldPoint(2545, 2871, 0), ROCKS_31757),
@@ -84,7 +288,7 @@ public enum AgilityShortcut
GOBLIN_VILLAGE_WALL(14, "Wall", new WorldPoint(2925, 3523, 0), TIGHTGAP), GOBLIN_VILLAGE_WALL(14, "Wall", new WorldPoint(2925, 3523, 0), TIGHTGAP),
CORSAIR_COVE_DUNGEON_PILLAR(15, "Pillar Jump", new WorldPoint(1980, 8996, 0), PILLAR_31809), CORSAIR_COVE_DUNGEON_PILLAR(15, "Pillar Jump", new WorldPoint(1980, 8996, 0), PILLAR_31809),
EDGEVILLE_DUNGEON_MONKEYBARS(15, "Monkey Bars", null, MONKEYBARS_23566), EDGEVILLE_DUNGEON_MONKEYBARS(15, "Monkey Bars", null, MONKEYBARS_23566),
TROLLHEIM_ROCKS(15, "Rocks", null, new WorldPoint(2838, 3614, 0), ROCKS_3748), // No fixed world map location, but rocks near death plateau have a requirement of 15 TROLLHEIM_ROCKS(15, "Rocks", null, new WorldPoint(2838, 3614, 0), ROCKS_3748), // No fixed world map location, but rocks near death plateau have a requirement of 15
YANILLE_UNDERWALL_TUNNEL(16, "Underwall Tunnel", new WorldPoint(2574, 3109, 0), HOLE_16520, CASTLE_WALL), YANILLE_UNDERWALL_TUNNEL(16, "Underwall Tunnel", new WorldPoint(2574, 3109, 0), HOLE_16520, CASTLE_WALL),
YANILLE_WATCHTOWER_TRELLIS(18, "Trellis", null, TRELLIS_20056), YANILLE_WATCHTOWER_TRELLIS(18, "Trellis", null, TRELLIS_20056),
COAL_TRUCKS_LOG_BALANCE(20, "Log Balance", new WorldPoint(2598, 3475, 0), LOG_BALANCE_23274), COAL_TRUCKS_LOG_BALANCE(20, "Log Balance", new WorldPoint(2598, 3475, 0), LOG_BALANCE_23274),
@@ -128,7 +332,7 @@ public enum AgilityShortcut
DEEP_WILDERNESS_DUNGEON_CREVICE_SOUTH(46, "Narrow Crevice", new WorldPoint(3045, 10327, 0), CREVICE_19043), DEEP_WILDERNESS_DUNGEON_CREVICE_SOUTH(46, "Narrow Crevice", new WorldPoint(3045, 10327, 0), CREVICE_19043),
TROLLHEIM_HARD_CLIFF_SCRAMBLE(47, "Rocks", new WorldPoint(2902, 3680, 0), ROCKS_16524), TROLLHEIM_HARD_CLIFF_SCRAMBLE(47, "Rocks", new WorldPoint(2902, 3680, 0), ROCKS_16524),
FREMENNIK_LOG_BALANCE(48, "Log Balance", new WorldPoint(2721, 3591, 0), LOG_BALANCE_16540, LOG_BALANCE_16541, LOG_BALANCE_16542), FREMENNIK_LOG_BALANCE(48, "Log Balance", new WorldPoint(2721, 3591, 0), LOG_BALANCE_16540, LOG_BALANCE_16541, LOG_BALANCE_16542),
YANILLE_DUNGEON_PIPE_SQUEEZE(49, "Pipe Squeeze", null, OBSTACLE_PIPE_23140), YANILLE_DUNGEON_PIPE_SQUEEZE(49, "Pipe Squeeze", null, OBSTACLE_PIPE_23140),
ARCEUUS_ESSENCE_MINE_BOULDER(49, "Boulder", new WorldPoint(1774, 3888, 0), BOULDER_27990), ARCEUUS_ESSENCE_MINE_BOULDER(49, "Boulder", new WorldPoint(1774, 3888, 0), BOULDER_27990),
MORYTANIA_STEPPING_STONE(50, "Stepping Stone", new WorldPoint(3418, 3326, 0), STEPPING_STONE_13504), MORYTANIA_STEPPING_STONE(50, "Stepping Stone", new WorldPoint(3418, 3326, 0), STEPPING_STONE_13504),
VARROCK_SEWERS_PIPE_SQUEEZE(51, "Pipe Squeeze", new WorldPoint(3152, 9905, 0), OBSTACLE_PIPE_16511), VARROCK_SEWERS_PIPE_SQUEEZE(51, "Pipe Squeeze", new WorldPoint(3152, 9905, 0), OBSTACLE_PIPE_16511),
@@ -141,7 +345,7 @@ public enum AgilityShortcut
ISAFDAR_FOREST_OBSTACLES(56, "Trap", null, DENSE_FOREST_3938, DENSE_FOREST_3939, DENSE_FOREST_3998, DENSE_FOREST_3999, DENSE_FOREST, LEAVES, LEAVES_3924, LEAVES_3925, STICKS, TRIPWIRE), ISAFDAR_FOREST_OBSTACLES(56, "Trap", null, DENSE_FOREST_3938, DENSE_FOREST_3939, DENSE_FOREST_3998, DENSE_FOREST_3999, DENSE_FOREST, LEAVES, LEAVES_3924, LEAVES_3925, STICKS, TRIPWIRE),
RELEKKA_EAST_FENCE(57, "Fence", new WorldPoint(2688, 3697, 0), BROKEN_FENCE), RELEKKA_EAST_FENCE(57, "Fence", new WorldPoint(2688, 3697, 0), BROKEN_FENCE),
YANILLE_DUNGEON_MONKEY_BARS(57, "Monkey Bars", null, MONKEYBARS_23567), YANILLE_DUNGEON_MONKEY_BARS(57, "Monkey Bars", null, MONKEYBARS_23567),
PHASMATYS_ECTOPOOL_SHORTCUT(58, "Weathered Wall", null , WEATHERED_WALL, WEATHERED_WALL_16526), PHASMATYS_ECTOPOOL_SHORTCUT(58, "Weathered Wall", null, WEATHERED_WALL, WEATHERED_WALL_16526),
ELVEN_OVERPASS_CLIFF_SCRAMBLE(59, "Rocks", new WorldPoint(2345, 3300, 0), ROCKS_16514, ROCKS_16515), ELVEN_OVERPASS_CLIFF_SCRAMBLE(59, "Rocks", new WorldPoint(2345, 3300, 0), ROCKS_16514, ROCKS_16515),
WILDERNESS_GWD_CLIMB_EAST(60, "Rocks", new WorldPoint(2943, 3770, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406), WILDERNESS_GWD_CLIMB_EAST(60, "Rocks", new WorldPoint(2943, 3770, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406),
WILDERNESS_GWD_CLIMB_WEST(60, "Rocks", new WorldPoint(2928, 3760, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406), WILDERNESS_GWD_CLIMB_WEST(60, "Rocks", new WorldPoint(2928, 3760, 0), ROCKY_HANDHOLDS_26400, ROCKY_HANDHOLDS_26401, ROCKY_HANDHOLDS_26402, ROCKY_HANDHOLDS_26404, ROCKY_HANDHOLDS_26405, ROCKY_HANDHOLDS_26406),
@@ -169,22 +373,22 @@ public enum AgilityShortcut
TAVERLEY_DUNGEON_PIPE_BLUE_DRAGON(70, "Pipe Squeeze", new WorldPoint(2886, 9798, 0), OBSTACLE_PIPE_16509), TAVERLEY_DUNGEON_PIPE_BLUE_DRAGON(70, "Pipe Squeeze", new WorldPoint(2886, 9798, 0), OBSTACLE_PIPE_16509),
TAVERLEY_DUNGEON_ROCKS_NORTH(70, "Rocks", new WorldPoint(2887, 9823, 0), ROCKS, ROCKS_14106), TAVERLEY_DUNGEON_ROCKS_NORTH(70, "Rocks", new WorldPoint(2887, 9823, 0), ROCKS, ROCKS_14106),
TAVERLEY_DUNGEON_ROCKS_SOUTH(70, "Rocks", new WorldPoint(2887, 9631, 0), ROCKS, ROCKS_14106), TAVERLEY_DUNGEON_ROCKS_SOUTH(70, "Rocks", new WorldPoint(2887, 9631, 0), ROCKS, ROCKS_14106),
FOSSIL_ISLAND_HARDWOOD_NORTH(70, "Hole" , new WorldPoint(3713, 3827, 0), HOLE_31481, HOLE_31482), FOSSIL_ISLAND_HARDWOOD_NORTH(70, "Hole", new WorldPoint(3713, 3827, 0), HOLE_31481, HOLE_31482),
FOSSIL_ISLAND_HARDWOOD_SOUTH(70, "Hole" , new WorldPoint(3715, 3817, 0), HOLE_31481, HOLE_31482), FOSSIL_ISLAND_HARDWOOD_SOUTH(70, "Hole", new WorldPoint(3715, 3817, 0), HOLE_31481, HOLE_31482),
AL_KHARID_WINDOW(70, "Window", new WorldPoint(3293, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW), AL_KHARID_WINDOW(70, "Window", new WorldPoint(3293, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW),
GWD_SARADOMIN_ROPE_NORTH(70, "Rope Descent", new WorldPoint(2912, 5300, 0), NULL_26371), GWD_SARADOMIN_ROPE_NORTH(70, "Rope Descent", new WorldPoint(2912, 5300, 0), NULL_26371),
GWD_SARADOMIN_ROPE_SOUTH(70, "Rope Descent", new WorldPoint(2951, 5267, 0), NULL_26375), GWD_SARADOMIN_ROPE_SOUTH(70, "Rope Descent", new WorldPoint(2951, 5267, 0), NULL_26375),
SLAYER_TOWER_ADVANCED_CHAIN_FIRST(71, "Spiked Chain (Floor 2)", new WorldPoint(3447, 3578, 0), SPIKEY_CHAIN ), SLAYER_TOWER_ADVANCED_CHAIN_FIRST(71, "Spiked Chain (Floor 2)", new WorldPoint(3447, 3578, 0), SPIKEY_CHAIN),
SLAYER_TOWER_ADVANCED_CHAIN_SECOND(71, "Spiked Chain (Floor 3)", new WorldPoint(3446, 3576, 0), SPIKEY_CHAIN_16538), SLAYER_TOWER_ADVANCED_CHAIN_SECOND(71, "Spiked Chain (Floor 3)", new WorldPoint(3446, 3576, 0), SPIKEY_CHAIN_16538),
STRONGHOLD_SLAYER_CAVE_TUNNEL(72, "Tunnel", new WorldPoint(2431, 9806, 0), TUNNEL_30174, TUNNEL_30175), STRONGHOLD_SLAYER_CAVE_TUNNEL(72, "Tunnel", new WorldPoint(2431, 9806, 0), TUNNEL_30174, TUNNEL_30175),
TROLL_STRONGHOLD_WALL_CLIMB(73, "Rocks", new WorldPoint(2841, 3694, 0), ROCKS_16464), TROLL_STRONGHOLD_WALL_CLIMB(73, "Rocks", new WorldPoint(2841, 3694, 0), ROCKS_16464),
ARCEUUS_ESSENSE_MINE_WEST(73, "Rock Climb", new WorldPoint(1742, 3853, 0), ROCKS_27984, ROCKS_27985 ), ARCEUUS_ESSENSE_MINE_WEST(73, "Rock Climb", new WorldPoint(1742, 3853, 0), ROCKS_27984, ROCKS_27985),
LAVA_DRAGON_ISLE_JUMP(74, "Stepping Stone", new WorldPoint(3200, 3807, 0), STEPPING_STONE_14918), LAVA_DRAGON_ISLE_JUMP(74, "Stepping Stone", new WorldPoint(3200, 3807, 0), STEPPING_STONE_14918),
REVENANT_CAVES_DEMONS_JUMP(75, "Jump", new WorldPoint(3199, 10135, 0), PILLAR_31561), REVENANT_CAVES_DEMONS_JUMP(75, "Jump", new WorldPoint(3199, 10135, 0), PILLAR_31561),
REVENANT_CAVES_ANKOU_EAST(75, "Jump", new WorldPoint(3201, 10195, 0), PILLAR_31561), REVENANT_CAVES_ANKOU_EAST(75, "Jump", new WorldPoint(3201, 10195, 0), PILLAR_31561),
REVENANT_CAVES_ANKOU_NORTH(75, "Jump", new WorldPoint(3180, 10209, 0), PILLAR_31561), REVENANT_CAVES_ANKOU_NORTH(75, "Jump", new WorldPoint(3180, 10209, 0), PILLAR_31561),
ZUL_ANDRA_ISLAND_CROSSING(76, "Stepping Stone", new WorldPoint(2156, 3073, 0), STEPPING_STONE_10663), ZUL_ANDRA_ISLAND_CROSSING(76, "Stepping Stone", new WorldPoint(2156, 3073, 0), STEPPING_STONE_10663),
SHILO_VILLAGE_STEPPING_STONES( 77, "Stepping Stones", new WorldPoint(2863, 2974, 0), STEPPING_STONE_16466), SHILO_VILLAGE_STEPPING_STONES(77, "Stepping Stones", new WorldPoint(2863, 2974, 0), STEPPING_STONE_16466),
KHARAZI_JUNGLE_VINE_CLIMB(79, "Vine", new WorldPoint(2897, 2939, 0), NULL_26884, NULL_26886), KHARAZI_JUNGLE_VINE_CLIMB(79, "Vine", new WorldPoint(2897, 2939, 0), NULL_26884, NULL_26886),
TAVERLEY_DUNGEON_SPIKED_BLADES(80, "Strange Floor", new WorldPoint(2877, 9813, 0), STRANGE_FLOOR), TAVERLEY_DUNGEON_SPIKED_BLADES(80, "Strange Floor", new WorldPoint(2877, 9813, 0), STRANGE_FLOOR),
SLAYER_DUNGEON_CHASM_JUMP(81, "Spiked Blades", new WorldPoint(2770, 10003, 0), STRANGE_FLOOR_16544), SLAYER_DUNGEON_CHASM_JUMP(81, "Spiked Blades", new WorldPoint(2770, 10003, 0), STRANGE_FLOOR_16544),

View File

@@ -36,6 +36,7 @@ import javax.swing.JLabel;
public class AsyncBufferedImage extends BufferedImage public class AsyncBufferedImage extends BufferedImage
{ {
private final List<Runnable> listeners = new CopyOnWriteArrayList<>(); private final List<Runnable> listeners = new CopyOnWriteArrayList<>();
public AsyncBufferedImage(int width, int height, int imageType) public AsyncBufferedImage(int width, int height, int imageType)
{ {
super(width, height, imageType); super(width, height, imageType);

View File

@@ -48,7 +48,116 @@ import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.ItemComposition; import net.runelite.api.ItemComposition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import static net.runelite.api.ItemID.*; import static net.runelite.api.ItemID.AGILITY_CAPE;
import static net.runelite.api.ItemID.AGILITY_CAPET;
import static net.runelite.api.ItemID.AGILITY_CAPET_13341;
import static net.runelite.api.ItemID.AGILITY_CAPE_13340;
import static net.runelite.api.ItemID.BOOTS_OF_LIGHTNESS;
import static net.runelite.api.ItemID.BOOTS_OF_LIGHTNESS_89;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_11861;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13589;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13590;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13601;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13602;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13613;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13614;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13625;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13626;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13637;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13638;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13677;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_13678;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_21076;
import static net.runelite.api.ItemID.GRACEFUL_BOOTS_21078;
import static net.runelite.api.ItemID.GRACEFUL_CAPE;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_11853;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13581;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13582;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13593;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13594;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13605;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13606;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13617;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13618;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13629;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13630;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13669;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_13670;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_21064;
import static net.runelite.api.ItemID.GRACEFUL_CAPE_21066;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_11859;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13587;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13588;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13599;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13600;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13611;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13612;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13623;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13624;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13635;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13636;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13675;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_13676;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_21073;
import static net.runelite.api.ItemID.GRACEFUL_GLOVES_21075;
import static net.runelite.api.ItemID.GRACEFUL_HOOD;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_11851;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13579;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13580;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13591;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13592;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13603;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13604;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13615;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13616;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13627;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13628;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13667;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_13668;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_21061;
import static net.runelite.api.ItemID.GRACEFUL_HOOD_21063;
import static net.runelite.api.ItemID.GRACEFUL_LEGS;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_11857;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13585;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13586;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13597;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13598;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13609;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13610;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13621;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13622;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13633;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13634;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13673;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_13674;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_21070;
import static net.runelite.api.ItemID.GRACEFUL_LEGS_21072;
import static net.runelite.api.ItemID.GRACEFUL_TOP;
import static net.runelite.api.ItemID.GRACEFUL_TOP_11855;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13583;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13584;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13595;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13596;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13607;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13608;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13619;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13620;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13631;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13632;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13671;
import static net.runelite.api.ItemID.GRACEFUL_TOP_13672;
import static net.runelite.api.ItemID.GRACEFUL_TOP_21067;
import static net.runelite.api.ItemID.GRACEFUL_TOP_21069;
import static net.runelite.api.ItemID.MAX_CAPE;
import static net.runelite.api.ItemID.MAX_CAPE_13342;
import static net.runelite.api.ItemID.PENANCE_GLOVES;
import static net.runelite.api.ItemID.PENANCE_GLOVES_10554;
import static net.runelite.api.ItemID.SPOTTED_CAPE;
import static net.runelite.api.ItemID.SPOTTED_CAPE_10073;
import static net.runelite.api.ItemID.SPOTTIER_CAPE;
import static net.runelite.api.ItemID.SPOTTIER_CAPE_10074;
import net.runelite.api.SpritePixels; import net.runelite.api.SpritePixels;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.PostItemComposition; import net.runelite.api.events.PostItemComposition;
@@ -258,6 +367,7 @@ public class ItemManager
/** /**
* Invalidates internal item manager item composition cache (but not client item composition cache) * Invalidates internal item manager item composition cache (but not client item composition cache)
*
* @see Client#getItemCompositionCache() * @see Client#getItemCompositionCache()
*/ */
public void invalidateItemCompositionCache() public void invalidateItemCompositionCache()
@@ -303,6 +413,7 @@ public class ItemManager
/** /**
* Look up an item's stats * Look up an item's stats
*
* @param itemId item id * @param itemId item id
* @return item stats * @return item stats
*/ */
@@ -442,7 +553,7 @@ public class ItemManager
/** /**
* Create item sprite and applies an outline. * Create item sprite and applies an outline.
* *
* @param itemId item id * @param itemId item id
* @param itemQuantity item quantity * @param itemQuantity item quantity
* @param outlineColor outline color * @param outlineColor outline color
* @return image * @return image
@@ -456,7 +567,7 @@ public class ItemManager
/** /**
* Get item outline with a specific color. * Get item outline with a specific color.
* *
* @param itemId item id * @param itemId item id
* @param itemQuantity item quantity * @param itemQuantity item quantity
* @param outlineColor outline color * @param outlineColor outline color
* @return image * @return image

View File

@@ -29,7 +29,411 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import static net.runelite.api.ItemID.*; import static net.runelite.api.ItemID.ABYSSAL_TENTACLE;
import static net.runelite.api.ItemID.ABYSSAL_WHIP;
import static net.runelite.api.ItemID.AHRIMS_HOOD;
import static net.runelite.api.ItemID.AHRIMS_HOOD_100;
import static net.runelite.api.ItemID.AHRIMS_HOOD_25;
import static net.runelite.api.ItemID.AHRIMS_HOOD_50;
import static net.runelite.api.ItemID.AHRIMS_HOOD_75;
import static net.runelite.api.ItemID.AHRIMS_ROBESKIRT;
import static net.runelite.api.ItemID.AHRIMS_ROBESKIRT_100;
import static net.runelite.api.ItemID.AHRIMS_ROBESKIRT_25;
import static net.runelite.api.ItemID.AHRIMS_ROBESKIRT_50;
import static net.runelite.api.ItemID.AHRIMS_ROBESKIRT_75;
import static net.runelite.api.ItemID.AHRIMS_ROBETOP;
import static net.runelite.api.ItemID.AHRIMS_ROBETOP_100;
import static net.runelite.api.ItemID.AHRIMS_ROBETOP_25;
import static net.runelite.api.ItemID.AHRIMS_ROBETOP_50;
import static net.runelite.api.ItemID.AHRIMS_ROBETOP_75;
import static net.runelite.api.ItemID.AHRIMS_STAFF;
import static net.runelite.api.ItemID.AHRIMS_STAFF_100;
import static net.runelite.api.ItemID.AHRIMS_STAFF_25;
import static net.runelite.api.ItemID.AHRIMS_STAFF_50;
import static net.runelite.api.ItemID.AHRIMS_STAFF_75;
import static net.runelite.api.ItemID.AMULET_OF_FURY;
import static net.runelite.api.ItemID.AMULET_OF_FURY_OR;
import static net.runelite.api.ItemID.AMULET_OF_GLORY;
import static net.runelite.api.ItemID.AMULET_OF_GLORY1;
import static net.runelite.api.ItemID.AMULET_OF_GLORY2;
import static net.runelite.api.ItemID.AMULET_OF_GLORY3;
import static net.runelite.api.ItemID.AMULET_OF_GLORY5;
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T;
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T1;
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T2;
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T3;
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T5;
import static net.runelite.api.ItemID.AMULET_OF_TORTURE;
import static net.runelite.api.ItemID.AMULET_OF_TORTURE_OR;
import static net.runelite.api.ItemID.ANCIENT_WYVERN_SHIELD;
import static net.runelite.api.ItemID.ANCIENT_WYVERN_SHIELD_21634;
import static net.runelite.api.ItemID.ANGUISH_ORNAMENT_KIT;
import static net.runelite.api.ItemID.ARCHERS_RING;
import static net.runelite.api.ItemID.ARCHERS_RING_I;
import static net.runelite.api.ItemID.ARMADYL_GODSWORD;
import static net.runelite.api.ItemID.ARMADYL_GODSWORD_OR;
import static net.runelite.api.ItemID.ARMADYL_GODSWORD_ORNAMENT_KIT;
import static net.runelite.api.ItemID.BANDOS_GODSWORD;
import static net.runelite.api.ItemID.BANDOS_GODSWORD_OR;
import static net.runelite.api.ItemID.BANDOS_GODSWORD_ORNAMENT_KIT;
import static net.runelite.api.ItemID.BERSERKER_RING;
import static net.runelite.api.ItemID.BERSERKER_RING_I;
import static net.runelite.api.ItemID.BLACK_MASK;
import static net.runelite.api.ItemID.BLACK_MASK_1;
import static net.runelite.api.ItemID.BLACK_MASK_10_I;
import static net.runelite.api.ItemID.BLACK_MASK_1_I;
import static net.runelite.api.ItemID.BLACK_MASK_2;
import static net.runelite.api.ItemID.BLACK_MASK_2_I;
import static net.runelite.api.ItemID.BLACK_MASK_3;
import static net.runelite.api.ItemID.BLACK_MASK_3_I;
import static net.runelite.api.ItemID.BLACK_MASK_4;
import static net.runelite.api.ItemID.BLACK_MASK_4_I;
import static net.runelite.api.ItemID.BLACK_MASK_5;
import static net.runelite.api.ItemID.BLACK_MASK_5_I;
import static net.runelite.api.ItemID.BLACK_MASK_6;
import static net.runelite.api.ItemID.BLACK_MASK_6_I;
import static net.runelite.api.ItemID.BLACK_MASK_7;
import static net.runelite.api.ItemID.BLACK_MASK_7_I;
import static net.runelite.api.ItemID.BLACK_MASK_8;
import static net.runelite.api.ItemID.BLACK_MASK_8_I;
import static net.runelite.api.ItemID.BLACK_MASK_9;
import static net.runelite.api.ItemID.BLACK_MASK_9_I;
import static net.runelite.api.ItemID.BLACK_MASK_I;
import static net.runelite.api.ItemID.BLACK_SLAYER_HELMET;
import static net.runelite.api.ItemID.BLACK_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.BONECRUSHER_NECKLACE;
import static net.runelite.api.ItemID.BOTTOMLESS_COMPOST_BUCKET;
import static net.runelite.api.ItemID.BOTTOMLESS_COMPOST_BUCKET_22997;
import static net.runelite.api.ItemID.CRAWS_BOW;
import static net.runelite.api.ItemID.CRAWS_BOW_U;
import static net.runelite.api.ItemID.DARK_BOW;
import static net.runelite.api.ItemID.DARK_BOW_12765;
import static net.runelite.api.ItemID.DARK_BOW_12766;
import static net.runelite.api.ItemID.DARK_BOW_12767;
import static net.runelite.api.ItemID.DARK_BOW_12768;
import static net.runelite.api.ItemID.DARK_BOW_20408;
import static net.runelite.api.ItemID.DARK_INFINITY_BOTTOMS;
import static net.runelite.api.ItemID.DARK_INFINITY_COLOUR_KIT;
import static net.runelite.api.ItemID.DARK_INFINITY_HAT;
import static net.runelite.api.ItemID.DARK_INFINITY_TOP;
import static net.runelite.api.ItemID.DHAROKS_GREATAXE;
import static net.runelite.api.ItemID.DHAROKS_GREATAXE_100;
import static net.runelite.api.ItemID.DHAROKS_GREATAXE_25;
import static net.runelite.api.ItemID.DHAROKS_GREATAXE_50;
import static net.runelite.api.ItemID.DHAROKS_GREATAXE_75;
import static net.runelite.api.ItemID.DHAROKS_HELM;
import static net.runelite.api.ItemID.DHAROKS_HELM_100;
import static net.runelite.api.ItemID.DHAROKS_HELM_25;
import static net.runelite.api.ItemID.DHAROKS_HELM_50;
import static net.runelite.api.ItemID.DHAROKS_HELM_75;
import static net.runelite.api.ItemID.DHAROKS_PLATEBODY;
import static net.runelite.api.ItemID.DHAROKS_PLATEBODY_100;
import static net.runelite.api.ItemID.DHAROKS_PLATEBODY_25;
import static net.runelite.api.ItemID.DHAROKS_PLATEBODY_50;
import static net.runelite.api.ItemID.DHAROKS_PLATEBODY_75;
import static net.runelite.api.ItemID.DHAROKS_PLATELEGS;
import static net.runelite.api.ItemID.DHAROKS_PLATELEGS_100;
import static net.runelite.api.ItemID.DHAROKS_PLATELEGS_25;
import static net.runelite.api.ItemID.DHAROKS_PLATELEGS_50;
import static net.runelite.api.ItemID.DHAROKS_PLATELEGS_75;
import static net.runelite.api.ItemID.DRAGONBONE_NECKLACE;
import static net.runelite.api.ItemID.DRAGONFIRE_SHIELD;
import static net.runelite.api.ItemID.DRAGONFIRE_SHIELD_11284;
import static net.runelite.api.ItemID.DRAGONFIRE_WARD;
import static net.runelite.api.ItemID.DRAGONFIRE_WARD_22003;
import static net.runelite.api.ItemID.DRAGON_BOOTS;
import static net.runelite.api.ItemID.DRAGON_BOOTS_G;
import static net.runelite.api.ItemID.DRAGON_BOOTS_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_CHAINBODY_3140;
import static net.runelite.api.ItemID.DRAGON_CHAINBODY_G;
import static net.runelite.api.ItemID.DRAGON_CHAINBODY_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_DEFENDER_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_DEFENDER_T;
import static net.runelite.api.ItemID.DRAGON_FULL_HELM;
import static net.runelite.api.ItemID.DRAGON_FULL_HELM_G;
import static net.runelite.api.ItemID.DRAGON_FULL_HELM_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_KITESHIELD;
import static net.runelite.api.ItemID.DRAGON_KITESHIELD_G;
import static net.runelite.api.ItemID.DRAGON_KITESHIELD_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_LEGSSKIRT_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_PICKAXE;
import static net.runelite.api.ItemID.DRAGON_PICKAXE_12797;
import static net.runelite.api.ItemID.DRAGON_PLATEBODY;
import static net.runelite.api.ItemID.DRAGON_PLATEBODY_G;
import static net.runelite.api.ItemID.DRAGON_PLATEBODY_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_PLATELEGS;
import static net.runelite.api.ItemID.DRAGON_PLATELEGS_G;
import static net.runelite.api.ItemID.DRAGON_PLATESKIRT;
import static net.runelite.api.ItemID.DRAGON_PLATESKIRT_G;
import static net.runelite.api.ItemID.DRAGON_SCIMITAR;
import static net.runelite.api.ItemID.DRAGON_SCIMITAR_OR;
import static net.runelite.api.ItemID.DRAGON_SCIMITAR_ORNAMENT_KIT;
import static net.runelite.api.ItemID.DRAGON_SQ_SHIELD;
import static net.runelite.api.ItemID.DRAGON_SQ_SHIELD_G;
import static net.runelite.api.ItemID.DRAGON_SQ_SHIELD_ORNAMENT_KIT;
import static net.runelite.api.ItemID.ENSOULED_ABYSSAL_HEAD;
import static net.runelite.api.ItemID.ENSOULED_ABYSSAL_HEAD_13508;
import static net.runelite.api.ItemID.ENSOULED_AVIANSIE_HEAD;
import static net.runelite.api.ItemID.ENSOULED_AVIANSIE_HEAD_13505;
import static net.runelite.api.ItemID.ENSOULED_BEAR_HEAD;
import static net.runelite.api.ItemID.ENSOULED_BEAR_HEAD_13463;
import static net.runelite.api.ItemID.ENSOULED_BLOODVELD_HEAD;
import static net.runelite.api.ItemID.ENSOULED_BLOODVELD_HEAD_13496;
import static net.runelite.api.ItemID.ENSOULED_CHAOS_DRUID_HEAD;
import static net.runelite.api.ItemID.ENSOULED_CHAOS_DRUID_HEAD_13472;
import static net.runelite.api.ItemID.ENSOULED_DAGANNOTH_HEAD;
import static net.runelite.api.ItemID.ENSOULED_DAGANNOTH_HEAD_13493;
import static net.runelite.api.ItemID.ENSOULED_DEMON_HEAD;
import static net.runelite.api.ItemID.ENSOULED_DEMON_HEAD_13502;
import static net.runelite.api.ItemID.ENSOULED_DOG_HEAD;
import static net.runelite.api.ItemID.ENSOULED_DOG_HEAD_13469;
import static net.runelite.api.ItemID.ENSOULED_DRAGON_HEAD;
import static net.runelite.api.ItemID.ENSOULED_DRAGON_HEAD_13511;
import static net.runelite.api.ItemID.ENSOULED_ELF_HEAD;
import static net.runelite.api.ItemID.ENSOULED_ELF_HEAD_13481;
import static net.runelite.api.ItemID.ENSOULED_GIANT_HEAD;
import static net.runelite.api.ItemID.ENSOULED_GIANT_HEAD_13475;
import static net.runelite.api.ItemID.ENSOULED_GOBLIN_HEAD;
import static net.runelite.api.ItemID.ENSOULED_GOBLIN_HEAD_13448;
import static net.runelite.api.ItemID.ENSOULED_HORROR_HEAD;
import static net.runelite.api.ItemID.ENSOULED_HORROR_HEAD_13487;
import static net.runelite.api.ItemID.ENSOULED_IMP_HEAD;
import static net.runelite.api.ItemID.ENSOULED_IMP_HEAD_13454;
import static net.runelite.api.ItemID.ENSOULED_KALPHITE_HEAD;
import static net.runelite.api.ItemID.ENSOULED_KALPHITE_HEAD_13490;
import static net.runelite.api.ItemID.ENSOULED_MINOTAUR_HEAD;
import static net.runelite.api.ItemID.ENSOULED_MINOTAUR_HEAD_13457;
import static net.runelite.api.ItemID.ENSOULED_MONKEY_HEAD;
import static net.runelite.api.ItemID.ENSOULED_MONKEY_HEAD_13451;
import static net.runelite.api.ItemID.ENSOULED_OGRE_HEAD;
import static net.runelite.api.ItemID.ENSOULED_OGRE_HEAD_13478;
import static net.runelite.api.ItemID.ENSOULED_SCORPION_HEAD;
import static net.runelite.api.ItemID.ENSOULED_SCORPION_HEAD_13460;
import static net.runelite.api.ItemID.ENSOULED_TROLL_HEAD;
import static net.runelite.api.ItemID.ENSOULED_TROLL_HEAD_13484;
import static net.runelite.api.ItemID.ENSOULED_TZHAAR_HEAD;
import static net.runelite.api.ItemID.ENSOULED_TZHAAR_HEAD_13499;
import static net.runelite.api.ItemID.ENSOULED_UNICORN_HEAD;
import static net.runelite.api.ItemID.ENSOULED_UNICORN_HEAD_13466;
import static net.runelite.api.ItemID.FEROCIOUS_GLOVES;
import static net.runelite.api.ItemID.FROZEN_ABYSSAL_WHIP;
import static net.runelite.api.ItemID.FURY_ORNAMENT_KIT;
import static net.runelite.api.ItemID.GAMES_NECKLACE1;
import static net.runelite.api.ItemID.GAMES_NECKLACE2;
import static net.runelite.api.ItemID.GAMES_NECKLACE3;
import static net.runelite.api.ItemID.GAMES_NECKLACE4;
import static net.runelite.api.ItemID.GAMES_NECKLACE5;
import static net.runelite.api.ItemID.GAMES_NECKLACE6;
import static net.runelite.api.ItemID.GAMES_NECKLACE7;
import static net.runelite.api.ItemID.GAMES_NECKLACE8;
import static net.runelite.api.ItemID.GRANITE_MAUL;
import static net.runelite.api.ItemID.GRANITE_MAUL_12848;
import static net.runelite.api.ItemID.GRANITE_RING;
import static net.runelite.api.ItemID.GRANITE_RING_I;
import static net.runelite.api.ItemID.GREEN_SLAYER_HELMET;
import static net.runelite.api.ItemID.GREEN_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.GUTHANS_CHAINSKIRT;
import static net.runelite.api.ItemID.GUTHANS_CHAINSKIRT_100;
import static net.runelite.api.ItemID.GUTHANS_CHAINSKIRT_25;
import static net.runelite.api.ItemID.GUTHANS_CHAINSKIRT_50;
import static net.runelite.api.ItemID.GUTHANS_CHAINSKIRT_75;
import static net.runelite.api.ItemID.GUTHANS_HELM;
import static net.runelite.api.ItemID.GUTHANS_HELM_100;
import static net.runelite.api.ItemID.GUTHANS_HELM_25;
import static net.runelite.api.ItemID.GUTHANS_HELM_50;
import static net.runelite.api.ItemID.GUTHANS_HELM_75;
import static net.runelite.api.ItemID.GUTHANS_PLATEBODY;
import static net.runelite.api.ItemID.GUTHANS_PLATEBODY_100;
import static net.runelite.api.ItemID.GUTHANS_PLATEBODY_25;
import static net.runelite.api.ItemID.GUTHANS_PLATEBODY_50;
import static net.runelite.api.ItemID.GUTHANS_PLATEBODY_75;
import static net.runelite.api.ItemID.GUTHANS_WARSPEAR;
import static net.runelite.api.ItemID.GUTHANS_WARSPEAR_100;
import static net.runelite.api.ItemID.GUTHANS_WARSPEAR_25;
import static net.runelite.api.ItemID.GUTHANS_WARSPEAR_50;
import static net.runelite.api.ItemID.GUTHANS_WARSPEAR_75;
import static net.runelite.api.ItemID.HYDRA_LEATHER;
import static net.runelite.api.ItemID.HYDRA_SLAYER_HELMET;
import static net.runelite.api.ItemID.HYDRA_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.HYDRA_TAIL;
import static net.runelite.api.ItemID.INFINITY_BOTTOMS;
import static net.runelite.api.ItemID.INFINITY_BOTTOMS_20575;
import static net.runelite.api.ItemID.INFINITY_HAT;
import static net.runelite.api.ItemID.INFINITY_TOP;
import static net.runelite.api.ItemID.INFINITY_TOP_10605;
import static net.runelite.api.ItemID.INFINITY_TOP_20574;
import static net.runelite.api.ItemID.KARILS_COIF;
import static net.runelite.api.ItemID.KARILS_COIF_100;
import static net.runelite.api.ItemID.KARILS_COIF_25;
import static net.runelite.api.ItemID.KARILS_COIF_50;
import static net.runelite.api.ItemID.KARILS_COIF_75;
import static net.runelite.api.ItemID.KARILS_CROSSBOW;
import static net.runelite.api.ItemID.KARILS_CROSSBOW_100;
import static net.runelite.api.ItemID.KARILS_CROSSBOW_25;
import static net.runelite.api.ItemID.KARILS_CROSSBOW_50;
import static net.runelite.api.ItemID.KARILS_CROSSBOW_75;
import static net.runelite.api.ItemID.KARILS_LEATHERSKIRT;
import static net.runelite.api.ItemID.KARILS_LEATHERSKIRT_100;
import static net.runelite.api.ItemID.KARILS_LEATHERSKIRT_25;
import static net.runelite.api.ItemID.KARILS_LEATHERSKIRT_50;
import static net.runelite.api.ItemID.KARILS_LEATHERSKIRT_75;
import static net.runelite.api.ItemID.KARILS_LEATHERTOP;
import static net.runelite.api.ItemID.KARILS_LEATHERTOP_100;
import static net.runelite.api.ItemID.KARILS_LEATHERTOP_25;
import static net.runelite.api.ItemID.KARILS_LEATHERTOP_50;
import static net.runelite.api.ItemID.KARILS_LEATHERTOP_75;
import static net.runelite.api.ItemID.KRAKEN_TENTACLE;
import static net.runelite.api.ItemID.LAVA_BATTLESTAFF;
import static net.runelite.api.ItemID.LAVA_BATTLESTAFF_21198;
import static net.runelite.api.ItemID.LIGHT_INFINITY_BOTTOMS;
import static net.runelite.api.ItemID.LIGHT_INFINITY_COLOUR_KIT;
import static net.runelite.api.ItemID.LIGHT_INFINITY_HAT;
import static net.runelite.api.ItemID.LIGHT_INFINITY_TOP;
import static net.runelite.api.ItemID.MAGIC_SHORTBOW;
import static net.runelite.api.ItemID.MAGIC_SHORTBOW_I;
import static net.runelite.api.ItemID.MAGMA_HELM;
import static net.runelite.api.ItemID.MAGMA_HELM_UNCHARGED;
import static net.runelite.api.ItemID.MALEDICTION_WARD;
import static net.runelite.api.ItemID.MALEDICTION_WARD_12806;
import static net.runelite.api.ItemID.NECKLACE_OF_ANGUISH;
import static net.runelite.api.ItemID.NECKLACE_OF_ANGUISH_OR;
import static net.runelite.api.ItemID.OCCULT_NECKLACE;
import static net.runelite.api.ItemID.OCCULT_NECKLACE_OR;
import static net.runelite.api.ItemID.OCCULT_ORNAMENT_KIT;
import static net.runelite.api.ItemID.ODIUM_WARD;
import static net.runelite.api.ItemID.ODIUM_WARD_12807;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_1;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_2;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_4;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_5;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_6;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_7;
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_8;
import static net.runelite.api.ItemID.PURPLE_SLAYER_HELMET;
import static net.runelite.api.ItemID.PURPLE_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.RED_SLAYER_HELMET;
import static net.runelite.api.ItemID.RED_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.RING_OF_DUELING1;
import static net.runelite.api.ItemID.RING_OF_DUELING2;
import static net.runelite.api.ItemID.RING_OF_DUELING3;
import static net.runelite.api.ItemID.RING_OF_DUELING4;
import static net.runelite.api.ItemID.RING_OF_DUELING5;
import static net.runelite.api.ItemID.RING_OF_DUELING6;
import static net.runelite.api.ItemID.RING_OF_DUELING7;
import static net.runelite.api.ItemID.RING_OF_DUELING8;
import static net.runelite.api.ItemID.RING_OF_SUFFERING;
import static net.runelite.api.ItemID.RING_OF_SUFFERING_I;
import static net.runelite.api.ItemID.RING_OF_SUFFERING_R;
import static net.runelite.api.ItemID.RING_OF_SUFFERING_RI;
import static net.runelite.api.ItemID.RING_OF_THE_GODS;
import static net.runelite.api.ItemID.RING_OF_THE_GODS_I;
import static net.runelite.api.ItemID.RING_OF_WEALTH;
import static net.runelite.api.ItemID.RING_OF_WEALTH_1;
import static net.runelite.api.ItemID.RING_OF_WEALTH_2;
import static net.runelite.api.ItemID.RING_OF_WEALTH_3;
import static net.runelite.api.ItemID.RING_OF_WEALTH_4;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I1;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I2;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I3;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I4;
import static net.runelite.api.ItemID.RING_OF_WEALTH_I5;
import static net.runelite.api.ItemID.SANGUINESTI_STAFF;
import static net.runelite.api.ItemID.SANGUINESTI_STAFF_UNCHARGED;
import static net.runelite.api.ItemID.SARADOMINS_BLESSED_SWORD;
import static net.runelite.api.ItemID.SARADOMINS_TEAR;
import static net.runelite.api.ItemID.SARADOMIN_GODSWORD;
import static net.runelite.api.ItemID.SARADOMIN_GODSWORD_OR;
import static net.runelite.api.ItemID.SARADOMIN_GODSWORD_ORNAMENT_KIT;
import static net.runelite.api.ItemID.SCYTHE_OF_VITUR;
import static net.runelite.api.ItemID.SCYTHE_OF_VITUR_UNCHARGED;
import static net.runelite.api.ItemID.SEERS_RING;
import static net.runelite.api.ItemID.SEERS_RING_I;
import static net.runelite.api.ItemID.SERPENTINE_HELM;
import static net.runelite.api.ItemID.SERPENTINE_HELM_UNCHARGED;
import static net.runelite.api.ItemID.SKILLS_NECKLACE;
import static net.runelite.api.ItemID.SKILLS_NECKLACE1;
import static net.runelite.api.ItemID.SKILLS_NECKLACE2;
import static net.runelite.api.ItemID.SKILLS_NECKLACE3;
import static net.runelite.api.ItemID.SKILLS_NECKLACE5;
import static net.runelite.api.ItemID.SLAYER_HELMET;
import static net.runelite.api.ItemID.SLAYER_HELMET_I;
import static net.runelite.api.ItemID.STEAM_BATTLESTAFF;
import static net.runelite.api.ItemID.STEAM_BATTLESTAFF_12795;
import static net.runelite.api.ItemID.TANZANITE_HELM;
import static net.runelite.api.ItemID.TANZANITE_HELM_UNCHARGED;
import static net.runelite.api.ItemID.THAMMARONS_SCEPTRE;
import static net.runelite.api.ItemID.THAMMARONS_SCEPTRE_U;
import static net.runelite.api.ItemID.TOME_OF_FIRE;
import static net.runelite.api.ItemID.TOME_OF_FIRE_EMPTY;
import static net.runelite.api.ItemID.TORAGS_HAMMERS;
import static net.runelite.api.ItemID.TORAGS_HAMMERS_100;
import static net.runelite.api.ItemID.TORAGS_HAMMERS_25;
import static net.runelite.api.ItemID.TORAGS_HAMMERS_50;
import static net.runelite.api.ItemID.TORAGS_HAMMERS_75;
import static net.runelite.api.ItemID.TORAGS_HELM;
import static net.runelite.api.ItemID.TORAGS_HELM_100;
import static net.runelite.api.ItemID.TORAGS_HELM_25;
import static net.runelite.api.ItemID.TORAGS_HELM_50;
import static net.runelite.api.ItemID.TORAGS_HELM_75;
import static net.runelite.api.ItemID.TORAGS_PLATEBODY;
import static net.runelite.api.ItemID.TORAGS_PLATEBODY_100;
import static net.runelite.api.ItemID.TORAGS_PLATEBODY_25;
import static net.runelite.api.ItemID.TORAGS_PLATEBODY_50;
import static net.runelite.api.ItemID.TORAGS_PLATEBODY_75;
import static net.runelite.api.ItemID.TORAGS_PLATELEGS;
import static net.runelite.api.ItemID.TORAGS_PLATELEGS_100;
import static net.runelite.api.ItemID.TORAGS_PLATELEGS_25;
import static net.runelite.api.ItemID.TORAGS_PLATELEGS_50;
import static net.runelite.api.ItemID.TORAGS_PLATELEGS_75;
import static net.runelite.api.ItemID.TORTURE_ORNAMENT_KIT;
import static net.runelite.api.ItemID.TOXIC_BLOWPIPE;
import static net.runelite.api.ItemID.TOXIC_BLOWPIPE_EMPTY;
import static net.runelite.api.ItemID.TOXIC_STAFF_OF_THE_DEAD;
import static net.runelite.api.ItemID.TOXIC_STAFF_UNCHARGED;
import static net.runelite.api.ItemID.TREASONOUS_RING;
import static net.runelite.api.ItemID.TREASONOUS_RING_I;
import static net.runelite.api.ItemID.TRIDENT_OF_THE_SEAS;
import static net.runelite.api.ItemID.TRIDENT_OF_THE_SEAS_E;
import static net.runelite.api.ItemID.TRIDENT_OF_THE_SWAMP;
import static net.runelite.api.ItemID.TRIDENT_OF_THE_SWAMP_E;
import static net.runelite.api.ItemID.TURQUOISE_SLAYER_HELMET;
import static net.runelite.api.ItemID.TURQUOISE_SLAYER_HELMET_I;
import static net.runelite.api.ItemID.TYRANNICAL_RING;
import static net.runelite.api.ItemID.TYRANNICAL_RING_I;
import static net.runelite.api.ItemID.UNCHARGED_TOXIC_TRIDENT;
import static net.runelite.api.ItemID.UNCHARGED_TOXIC_TRIDENT_E;
import static net.runelite.api.ItemID.UNCHARGED_TRIDENT;
import static net.runelite.api.ItemID.UNCHARGED_TRIDENT_E;
import static net.runelite.api.ItemID.VERACS_BRASSARD;
import static net.runelite.api.ItemID.VERACS_BRASSARD_100;
import static net.runelite.api.ItemID.VERACS_BRASSARD_25;
import static net.runelite.api.ItemID.VERACS_BRASSARD_50;
import static net.runelite.api.ItemID.VERACS_BRASSARD_75;
import static net.runelite.api.ItemID.VERACS_FLAIL;
import static net.runelite.api.ItemID.VERACS_FLAIL_100;
import static net.runelite.api.ItemID.VERACS_FLAIL_25;
import static net.runelite.api.ItemID.VERACS_FLAIL_50;
import static net.runelite.api.ItemID.VERACS_FLAIL_75;
import static net.runelite.api.ItemID.VERACS_HELM;
import static net.runelite.api.ItemID.VERACS_HELM_100;
import static net.runelite.api.ItemID.VERACS_HELM_25;
import static net.runelite.api.ItemID.VERACS_HELM_50;
import static net.runelite.api.ItemID.VERACS_HELM_75;
import static net.runelite.api.ItemID.VERACS_PLATESKIRT;
import static net.runelite.api.ItemID.VERACS_PLATESKIRT_100;
import static net.runelite.api.ItemID.VERACS_PLATESKIRT_25;
import static net.runelite.api.ItemID.VERACS_PLATESKIRT_50;
import static net.runelite.api.ItemID.VERACS_PLATESKIRT_75;
import static net.runelite.api.ItemID.VIGGORAS_CHAINMACE;
import static net.runelite.api.ItemID.VIGGORAS_CHAINMACE_U;
import static net.runelite.api.ItemID.VOLCANIC_ABYSSAL_WHIP;
import static net.runelite.api.ItemID.WARRIOR_RING;
import static net.runelite.api.ItemID.WARRIOR_RING_I;
import static net.runelite.api.ItemID.ZAMORAK_GODSWORD;
import static net.runelite.api.ItemID.ZAMORAK_GODSWORD_OR;
import static net.runelite.api.ItemID.ZAMORAK_GODSWORD_ORNAMENT_KIT;
/** /**
* Converts untradeable items to it's tradeable counterparts * Converts untradeable items to it's tradeable counterparts

View File

@@ -53,7 +53,8 @@ public class NPCManager
/** /**
* Returns health for target NPC based on it's combat level and name * Returns health for target NPC based on it's combat level and name
* @param name npc name *
* @param name npc name
* @param combatLevel npc combat level * @param combatLevel npc combat level
* @return health or null if HP is unknown * @return health or null if HP is unknown
*/ */

View File

@@ -67,8 +67,8 @@ public class ChatboxPanelManager
@Inject @Inject
private ChatboxPanelManager(EventBus eventBus, Client client, ClientThread clientThread, private ChatboxPanelManager(EventBus eventBus, Client client, ClientThread clientThread,
KeyManager keyManager, MouseManager mouseManager, KeyManager keyManager, MouseManager mouseManager,
Provider<ChatboxTextMenuInput> chatboxTextMenuInputProvider, Provider<ChatboxTextInput> chatboxTextInputProvider) Provider<ChatboxTextMenuInput> chatboxTextMenuInputProvider, Provider<ChatboxTextInput> chatboxTextInputProvider)
{ {
this.client = client; this.client = client;
this.clientThread = clientThread; this.clientThread = clientThread;

View File

@@ -33,12 +33,12 @@ import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.FontID; import net.runelite.api.FontID;
import net.runelite.api.widgets.WidgetType;
import net.runelite.api.widgets.JavaScriptCallback; import net.runelite.api.widgets.JavaScriptCallback;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetPositionMode; import net.runelite.api.widgets.WidgetPositionMode;
import net.runelite.api.widgets.WidgetSizeMode; import net.runelite.api.widgets.WidgetSizeMode;
import net.runelite.api.widgets.WidgetTextAlignment; import net.runelite.api.widgets.WidgetTextAlignment;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.input.KeyListener; import net.runelite.client.input.KeyListener;
@Slf4j @Slf4j

View File

@@ -743,7 +743,7 @@ public class ModelOutlineRenderer
* @param outerColor The color of the pixels of the outline furthest away from the model * @param outerColor The color of the pixels of the outline furthest away from the model
*/ */
private void renderOutline(BufferedImage image, int outlineWidth, private void renderOutline(BufferedImage image, int outlineWidth,
Color innerColor, Color outerColor) Color innerColor, Color outerColor)
{ {
int[] imageData = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); int[] imageData = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
List<PixelDistanceAlpha> ps = getPriorityList(outlineWidth); List<PixelDistanceAlpha> ps = getPriorityList(outlineWidth);
@@ -887,8 +887,8 @@ public class ModelOutlineRenderer
* @param outerColor The color of the pixels of the outline furthest away from the model * @param outerColor The color of the pixels of the outline furthest away from the model
*/ */
private void drawModelOutline(Model model, private void drawModelOutline(Model model,
int localX, int localY, int localZ, int orientation, int localX, int localY, int localZ, int orientation,
int outlineWidth, Color innerColor, Color outerColor) int outlineWidth, Color innerColor, Color outerColor)
{ {
if (outlineWidth <= 0) if (outlineWidth <= 0)
{ {

View File

@@ -24,9 +24,8 @@
*/ */
package net.runelite.client.menus; package net.runelite.client.menus;
import net.runelite.api.widgets.WidgetInfo;
import java.awt.Color; import java.awt.Color;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.ui.JagexColors; import net.runelite.client.ui.JagexColors;
import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ColorUtil;

View File

@@ -59,11 +59,11 @@ public class BlackjackPlugin extends Plugin
@Inject @Inject
Client client; Client client;
private static long timeSinceKnockout; private long timeSinceKnockout;
private static long timeSinceAggro; private long timeSinceAggro;
@Getter @Getter
private static long currentGameTick; private long currentGameTick;
@Override @Override
public void configure(Binder binder) public void configure(Binder binder)
@@ -109,7 +109,7 @@ public class BlackjackPlugin extends Plugin
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{ {
String target = menuEntryAdded.getTarget().toLowerCase(); String target = menuEntryAdded.getTarget().toLowerCase();
if ((target.contains("bandit") | target.contains("menaphite thug"))) if ((target.contains("bandit") || target.contains("menaphite thug")))
{ {
Quest quest = Quest.THE_FEUD; Quest quest = Quest.THE_FEUD;
if (quest.getState(client) == QuestState.FINISHED) if (quest.getState(client) == QuestState.FINISHED)

View File

@@ -99,7 +99,7 @@ class CombatLevelOverlay extends Overlay
int prayerLevel = client.getRealSkillLevel(Skill.PRAYER); int prayerLevel = client.getRealSkillLevel(Skill.PRAYER);
// calculate initial required numbers // calculate initial required numbers
double base = DEF_HP_MULT * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2)); double base = DEF_HP_MULT * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2D));
double melee = ATT_STR_MULT * (attackLevel + strengthLevel); double melee = ATT_STR_MULT * (attackLevel + strengthLevel);
double range = RANGE_MAGIC_MULT * Math.floor(rangedLevel * RANGE_MAGIC_LEVEL_MULT); double range = RANGE_MAGIC_MULT * Math.floor(rangedLevel * RANGE_MAGIC_LEVEL_MULT);
double mage = RANGE_MAGIC_MULT * Math.floor(magicLevel * RANGE_MAGIC_LEVEL_MULT); double mage = RANGE_MAGIC_MULT * Math.floor(magicLevel * RANGE_MAGIC_LEVEL_MULT);

View File

@@ -123,7 +123,7 @@ public class PluginListItem extends JPanel
* if there is no configuration associated with the plugin. * if there is no configuration associated with the plugin.
*/ */
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Plugin plugin, PluginDescriptor descriptor, PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Plugin plugin, PluginDescriptor descriptor,
@Nullable Config config, @Nullable ConfigDescriptor configDescriptor) @Nullable Config config, @Nullable ConfigDescriptor configDescriptor)
{ {
this(configPanel, configManager, plugin, config, configDescriptor, this(configPanel, configManager, plugin, config, configDescriptor,
descriptor.name(), descriptor.description(), descriptor.tags()); descriptor.name(), descriptor.description(), descriptor.tags());
@@ -133,13 +133,13 @@ public class PluginListItem extends JPanel
* Creates a new {@code PluginListItem} for a core configuration. * Creates a new {@code PluginListItem} for a core configuration.
*/ */
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Config config, ConfigDescriptor configDescriptor, PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Config config, ConfigDescriptor configDescriptor,
String name, String description, String... tags) String name, String description, String... tags)
{ {
this(configPanel, configManager, null, config, configDescriptor, name, description, tags); this(configPanel, configManager, null, config, configDescriptor, name, description, tags);
} }
private PluginListItem(ConfigPanel configPanel, ConfigManager configManager, @Nullable Plugin plugin, @Nullable Config config, private PluginListItem(ConfigPanel configPanel, ConfigManager configManager, @Nullable Plugin plugin, @Nullable Config config,
@Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags) @Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags)
{ {
this.configPanel = configPanel; this.configPanel = configPanel;
this.configManager = configManager; this.configManager = configManager;

View File

@@ -156,7 +156,7 @@ public class DemonicGorillaPlugin extends Plugin
} }
private void checkGorillaAttackStyleSwitch(DemonicGorilla gorilla, private void checkGorillaAttackStyleSwitch(DemonicGorilla gorilla,
final DemonicGorilla.AttackStyle... protectedStyles) final DemonicGorilla.AttackStyle... protectedStyles)
{ {
if (gorilla.getAttacksUntilSwitch() <= 0 || if (gorilla.getAttacksUntilSwitch() <= 0 ||
gorilla.getNextPosibleAttackStyles().isEmpty()) gorilla.getNextPosibleAttackStyles().isEmpty())

View File

@@ -357,11 +357,11 @@ public class EasyscapePlugin extends Plugin
} }
} }
if (config.getGlory()) if (config.getGlory())
{ {
if (target.toLowerCase().contains("amulet of glory") || target.toLowerCase().contains("amulet of eternal glory")) if (target.toLowerCase().contains("amulet of glory") || target.toLowerCase().contains("amulet of eternal glory"))
{ {
switch (config.getGloryMode()) switch (config.getGloryMode())
{ {
case EDGEVILLE: case EDGEVILLE:
swap(client, GloryMode.EDGEVILLE.toString(), option, target); swap(client, GloryMode.EDGEVILLE.toString(), option, target);

View File

@@ -66,10 +66,7 @@ public class PrayerTracker
} }
if (actor instanceof Player) if (actor instanceof Player)
{ {
if (actor instanceof Player) newTick.get(actor).put("PrayerIcon", ((Player) actor).getOverheadIcon() == null ? -1 : ((Player) actor).getOverheadIcon().ordinal());
{
newTick.get(actor).put("PrayerIcon", ((Player) actor).getOverheadIcon() == null ? -1 : ((Player) actor).getOverheadIcon().ordinal());
}
} }
newTick.get(actor).put("SpotAnim", actor.getGraphic()); newTick.get(actor).put("SpotAnim", actor.getGraphic());
} }

View File

@@ -53,7 +53,7 @@ import org.apache.commons.lang3.ArrayUtils;
) )
public class FriendTaggingPlugin extends Plugin public class FriendTaggingPlugin extends Plugin
{ {
public static ConcurrentHashMap<String, String> taggedFriends = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<String, String> taggedFriends = new ConcurrentHashMap<>();
private static final String CONFIG_GROUP = "friendtagging"; private static final String CONFIG_GROUP = "friendtagging";
private static final int CHARACTER_LIMIT = 30; private static final int CHARACTER_LIMIT = 30;

View File

@@ -718,8 +718,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
} }
public void drawScenePaint(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, public void drawScenePaint(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
SceneTilePaint paint, int tileZ, int tileX, int tileY, SceneTilePaint paint, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY) int zoom, int centerX, int centerY)
{ {
if (paint.getBufferLen() > 0) if (paint.getBufferLen() > 0)
{ {
@@ -744,8 +744,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
} }
public void drawSceneModel(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, public void drawSceneModel(int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z,
SceneTileModel model, int tileZ, int tileX, int tileY, SceneTileModel model, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY) int zoom, int centerX, int centerY)
{ {
if (model.getBufferLen() > 0) if (model.getBufferLen() > 0)
{ {

View File

@@ -214,7 +214,7 @@ class InstanceMapOverlay extends Overlay
* @param graphics graphics to be drawn to * @param graphics graphics to be drawn to
*/ */
private void drawPlayerDot(Graphics2D graphics, Player player, private void drawPlayerDot(Graphics2D graphics, Player player,
Color dotColor, Color outlineColor) Color dotColor, Color outlineColor)
{ {
LocalPoint playerLoc = player.getLocalLocation(); LocalPoint playerLoc = player.getLocalLocation();

View File

@@ -70,8 +70,8 @@ public abstract class InventorySetupContainerPanel extends JPanel
} }
void setContainerSlot(int index, void setContainerSlot(int index,
final InventorySetupSlot containerSlot, final InventorySetupSlot containerSlot,
final ArrayList<InventorySetupItem> items) final ArrayList<InventorySetupItem> items)
{ {
if (index >= items.size() || items.get(index).getId() == -1) if (index >= items.size() || items.get(index).getId() == -1)
{ {
@@ -92,8 +92,8 @@ public abstract class InventorySetupContainerPanel extends JPanel
} }
void highlightDifferentSlotColor(InventorySetupItem savedItem, void highlightDifferentSlotColor(InventorySetupItem savedItem,
InventorySetupItem currItem, InventorySetupItem currItem,
final InventorySetupSlot containerSlot) final InventorySetupSlot containerSlot)
{ {
// important note: do not use item names for comparisons // important note: do not use item names for comparisons
// they are all empty to avoid clientThread usage when highlighting // they are all empty to avoid clientThread usage when highlighting

View File

@@ -285,8 +285,8 @@ public class InventorySetupPluginPanel extends PluginPanel
} }
public void highlightDifferences(final ArrayList<InventorySetupItem> container, public void highlightDifferences(final ArrayList<InventorySetupItem> container,
final InventorySetup setupToCheck, final InventorySetup setupToCheck,
final InventoryID type) final InventoryID type)
{ {
switch (type) switch (type)
{ {

View File

@@ -214,13 +214,9 @@ public class ItemStatPlugin extends Plugin
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL); closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL);
closeButton.setAction(0, "Close"); closeButton.setAction(0, "Close");
closeButton.setOnMouseOverListener((JavaScriptCallback) (ev) -> closeButton.setOnMouseOverListener((JavaScriptCallback) (ev) ->
{ closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL_HOVERED));
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL_HOVERED);
});
closeButton.setOnMouseLeaveListener((JavaScriptCallback) (ev) -> closeButton.setOnMouseLeaveListener((JavaScriptCallback) (ev) ->
{ closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL));
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL);
});
closeButton.setOnOpListener((JavaScriptCallback) (ev) -> resetGEInventory()); closeButton.setOnOpListener((JavaScriptCallback) (ev) -> resetGEInventory());
closeButton.setHasListener(true); closeButton.setHasListener(true);
closeButton.revalidate(); closeButton.revalidate();
@@ -349,7 +345,7 @@ public class ItemStatPlugin extends Plugin
} }
private static Widget createText(Widget parent, String text, int fontId, int textColor, private static Widget createText(Widget parent, String text, int fontId, int textColor,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
final Widget widget = parent.createChild(-1, WidgetType.TEXT); final Widget widget = parent.createChild(-1, WidgetType.TEXT);
widget.setText(text); widget.setText(text);

View File

@@ -60,7 +60,7 @@ public class GraveyardRoom extends MTARoom
@Inject @Inject
private GraveyardRoom(MTAConfig config, Client client, MTAPlugin plugin, private GraveyardRoom(MTAConfig config, Client client, MTAPlugin plugin,
ItemManager itemManager, InfoBoxManager infoBoxManager) ItemManager itemManager, InfoBoxManager infoBoxManager)
{ {
super(config); super(config);
this.client = client; this.client = client;

View File

@@ -266,9 +266,9 @@ public interface PlayerIndicatorsConfig extends Config
description = "The location of the skull icon for skulled players", description = "The location of the skull icon for skulled players",
group = "Target Indicator" group = "Target Indicator"
) )
default PlayerIndicatorsPlugin.minimapSkullLocations skullLocation() default PlayerIndicatorsPlugin.MinimapSkullLocations skullLocation()
{ {
return PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME; return PlayerIndicatorsPlugin.MinimapSkullLocations.AFTER_NAME;
} }
@ConfigItem( @ConfigItem(

View File

@@ -97,7 +97,7 @@ public class PlayerIndicatorsMinimapOverlay extends Overlay
{ {
int width = graphics.getFontMetrics().stringWidth(name); int width = graphics.getFontMetrics().stringWidth(name);
int height = graphics.getFontMetrics().getHeight(); int height = graphics.getFontMetrics().getHeight();
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME)) if (config.skullLocation().equals(PlayerIndicatorsPlugin.MinimapSkullLocations.AFTER_NAME))
{ {
OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX() OverlayUtil.renderImageLocation(graphics, new Point(minimapLocation.getX()
+ width, minimapLocation.getY() - height), + width, minimapLocation.getY() - height),

View File

@@ -217,7 +217,7 @@ public class PlayerIndicatorsOverlay extends Overlay
{ {
int width = graphics.getFontMetrics().stringWidth(name); int width = graphics.getFontMetrics().stringWidth(name);
int height = graphics.getFontMetrics().getHeight(); int height = graphics.getFontMetrics().getHeight();
if (config.skullLocation().equals(PlayerIndicatorsPlugin.minimapSkullLocations.AFTER_NAME)) if (config.skullLocation().equals(PlayerIndicatorsPlugin.MinimapSkullLocations.AFTER_NAME))
{ {
OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX() OverlayUtil.renderImageLocation(graphics, new Point(textLocation.getX()
+ width, textLocation.getY() - height), + width, textLocation.getY() - height),

View File

@@ -365,7 +365,7 @@ public class PlayerIndicatorsPlugin extends Plugin
} }
} }
public enum minimapSkullLocations public enum MinimapSkullLocations
{ {
BEFORE_NAME, BEFORE_NAME,
AFTER_NAME AFTER_NAME

View File

@@ -100,6 +100,7 @@ public class PlayerInfoCustomIndicator extends InfoBox
break; break;
case SPECIAL: case SPECIAL:
currLvl = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 1000.0F; currLvl = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 1000.0F;
break;
case WORLD: case WORLD:
currLvl = 1000; // hacky currLvl = 1000; // hacky
} }

View File

@@ -226,7 +226,7 @@ public class IDAStarMM extends IDAStar
Point locSwap = new Point(locBlank.getX(), locBlank.getY() + 1); Point locSwap = new Point(locBlank.getX(), locBlank.getY() + 1);
swap(locBlank, locSwap); swap(locBlank, locSwap);
} }
else if (distY <= -1) else
{ {
Point locSwap = new Point(locBlank.getX(), locBlank.getY() - 1); Point locSwap = new Point(locBlank.getX(), locBlank.getY() - 1);
swap(locBlank, locSwap); swap(locBlank, locSwap);
@@ -252,7 +252,7 @@ public class IDAStarMM extends IDAStar
Point locSwap = new Point(locBlank.getX() + 1, locBlank.getY()); Point locSwap = new Point(locBlank.getX() + 1, locBlank.getY());
swap(locBlank, locSwap); swap(locBlank, locSwap);
} }
else if (distX <= -1) else
{ {
Point locSwap = new Point(locBlank.getX() - 1, locBlank.getY()); Point locSwap = new Point(locBlank.getX() - 1, locBlank.getY());
swap(locBlank, locSwap); swap(locBlank, locSwap);

View File

@@ -162,6 +162,7 @@ public class PyramidPlunderPlugin extends Plugin
break; break;
case LOADING: case LOADING:
obstacles.clear(); obstacles.clear();
break;
case LOGGED_IN: case LOGGED_IN:
if (!isInRegion()) if (!isInRegion())
{ {

View File

@@ -817,7 +817,7 @@ public class RaidsPlugin extends Plugin
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
if (seconds >= 3600) if (seconds >= 3600)
{ {
builder.append((int) Math.floor(seconds / 3600) + ";"); builder.append((int) Math.floor(seconds / 3600)).append(";");
} }
seconds %= 3600; seconds %= 3600;
if (builder.toString().equals("")) if (builder.toString().equals(""))
@@ -842,7 +842,7 @@ public class RaidsPlugin extends Plugin
tooltip = null; tooltip = null;
return; return;
} }
builder.append("Upper level: " + secondsToTime(upperTime)); builder.append("Upper level: ").append(secondsToTime(upperTime));
if (middleTime == -1) if (middleTime == -1)
{ {
if (lowerTime == -1) if (lowerTime == -1)
@@ -852,12 +852,12 @@ public class RaidsPlugin extends Plugin
} }
else else
{ {
builder.append("</br>Lower level: " + secondsToTime(lowerTime - upperTime)); builder.append("</br>Lower level: ").append(secondsToTime(lowerTime - upperTime));
} }
} }
else else
{ {
builder.append("</br>Middle level: " + secondsToTime(middleTime - upperTime)); builder.append("</br>Middle level: ").append(secondsToTime(middleTime - upperTime));
if (lowerTime == -1) if (lowerTime == -1)
{ {
tooltip = builder.toString(); tooltip = builder.toString();
@@ -865,7 +865,7 @@ public class RaidsPlugin extends Plugin
} }
else else
{ {
builder.append("</br>Lower level: " + secondsToTime(lowerTime - middleTime)); builder.append("</br>Lower level: ").append(secondsToTime(lowerTime - middleTime));
} }
} }
if (raidTime == -1) if (raidTime == -1)
@@ -873,7 +873,7 @@ public class RaidsPlugin extends Plugin
tooltip = builder.toString(); tooltip = builder.toString();
return; return;
} }
builder.append("</br>Olm: " + secondsToTime(raidTime - lowerTime)); builder.append("</br>Olm: ").append(secondsToTime(raidTime - lowerTime));
tooltip = builder.toString(); tooltip = builder.toString();
} }
} }

View File

@@ -44,7 +44,7 @@ public enum ThievingRoomType
this.y = y; this.y = y;
} }
public static ThievingRoomType IdentifyByInstancePoint(InstancePoint point) public static ThievingRoomType identifyByInstancePoint(InstancePoint point)
{ {
for (ThievingRoomType type : ThievingRoomType.values()) for (ThievingRoomType type : ThievingRoomType.values())
{ {

View File

@@ -126,7 +126,7 @@ public class RaidsThievingPlugin extends Plugin
if (obj.getId() == RaidsThievingConstants.EMPTY_TROUGH) if (obj.getId() == RaidsThievingConstants.EMPTY_TROUGH)
{ {
ThievingRoomType type = ThievingRoomType.IdentifyByInstancePoint(absLoc); ThievingRoomType type = ThievingRoomType.identifyByInstancePoint(absLoc);
if (type != null) if (type != null)
{ {

View File

@@ -92,7 +92,7 @@ public class RegenMeterOverlay extends Overlay
g.setColor(RegenMeterOverlay.OVERLAY_COLOR); g.setColor(RegenMeterOverlay.OVERLAY_COLOR);
g.fillOval( g.fillOval(
bounds.x + OFFSET, bounds.x + OFFSET,
bounds.y + (int) (bounds.height / 2 - (DIAMETER) / 2), bounds.y + (int) (bounds.height / 2D - (DIAMETER) / 2D),
(int) DIAMETER, (int) DIAMETER); (int) DIAMETER, (int) DIAMETER);
} }
} }
@@ -112,7 +112,7 @@ public class RegenMeterOverlay extends Overlay
} }
Rectangle bounds = widget.getBounds(); Rectangle bounds = widget.getBounds();
Arc2D.Double arc = new Arc2D.Double(bounds.x + OFFSET, bounds.y + (bounds.height / 2 - DIAMETER / 2), DIAMETER, DIAMETER, 90.d, -360.d * percent, Arc2D.OPEN); Arc2D.Double arc = new Arc2D.Double(bounds.x + OFFSET, bounds.y + (bounds.height / 2D - DIAMETER / 2D), DIAMETER, DIAMETER, 90.d, -360.d * percent, Arc2D.OPEN);
final Stroke STROKE = new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); final Stroke STROKE = new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
g.setStroke(STROKE); g.setStroke(STROKE);
g.setColor(color); g.setColor(color);

View File

@@ -228,11 +228,6 @@ public class RunecraftPlugin extends Plugin
client.setMenuEntries(newEntries); client.setMenuEntries(newEntries);
} }
private int searchIndex(MenuEntry[] entries, String option, String target)
{
return searchIndex(entries, option, target, false);
}
private int searchIndex(MenuEntry[] entries, String option, String target, boolean contains) private int searchIndex(MenuEntry[] entries, String option, String target, boolean contains)
{ {
for (int i = entries.length - 1; i >= 0; i--) for (int i = entries.length - 1; i >= 0; i--)

View File

@@ -100,16 +100,16 @@ class RunedokuOverlay extends Overlay
{ {
if (!util.makeSimple(util.createTable(client)).contains(0)) if (!util.makeSimple(util.createTable(client)).contains(0))
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(widget.getBounds()), Color.GREEN); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(widget.getBounds()), Color.GREEN);
} }
else else
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(widget.getBounds()), util.referenceColors(i)); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(widget.getBounds()), util.referenceColors(i));
} }
} }
else else
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(widget.getBounds()), RED); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(widget.getBounds()), RED);
} }
} }
@@ -134,17 +134,17 @@ class RunedokuOverlay extends Overlay
{ {
if (!util.makeSimple(util.createTable(client)).contains(0)) if (!util.makeSimple(util.createTable(client)).contains(0))
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(squareToHighlight.getBounds()), Color.GREEN); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(squareToHighlight.getBounds()), Color.GREEN);
} }
else else
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(squareToHighlight.getBounds()), util.sudokuPieceToColor(simpleArr.get(iteration))); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(squareToHighlight.getBounds()), util.sudokuPieceToColor(simpleArr.get(iteration)));
} }
iteration++; iteration++;
} }
else else
{ {
OverlayUtil.renderPolygon(graphics, util.RectangleToPolygon(squareToHighlight.getBounds()), RED); OverlayUtil.renderPolygon(graphics, util.rectangleToPolygon(squareToHighlight.getBounds()), RED);
} }
} }

View File

@@ -9,7 +9,7 @@ import net.runelite.api.Client;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetItem; import net.runelite.api.widgets.WidgetItem;
public class RunedokuUtil class RunedokuUtil
{ {
private final RunedokuConfig config; private final RunedokuConfig config;
@@ -20,7 +20,7 @@ public class RunedokuUtil
this.config = config; this.config = config;
} }
protected Color sudokuPieceToColor(int i) Color sudokuPieceToColor(int i)
{ {
switch (i) switch (i)
{ {
@@ -47,7 +47,7 @@ public class RunedokuUtil
} }
} }
protected Color referenceColors(int i) Color referenceColors(int i)
{ {
switch (i) switch (i)
{ {
@@ -80,7 +80,7 @@ public class RunedokuUtil
* @param board * @param board
* @return * @return
*/ */
protected ArrayList<Integer> makeSimple(int[][] board) ArrayList<Integer> makeSimple(int[][] board)
{ {
ArrayList<Integer> list = new ArrayList<>(); ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
@@ -99,7 +99,7 @@ public class RunedokuUtil
* @param rect * @param rect
* @return * @return
*/ */
protected Polygon RectangleToPolygon(Rectangle rect) public static Polygon rectangleToPolygon(Rectangle rect)
{ {
int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x}; int[] xpoints = {rect.x, rect.x + rect.width, rect.x + rect.width, rect.x};
int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height}; int[] ypoints = {rect.y, rect.y, rect.y + rect.height, rect.y + rect.height};
@@ -113,7 +113,7 @@ public class RunedokuUtil
* @return sudoku table that the client currently sees in a 2d array * @return sudoku table that the client currently sees in a 2d array
* @author gazivodag * @author gazivodag
*/ */
protected int[][] createTable(Client client) int[][] createTable(Client client)
{ {
int[][] myArr = new int[9][9]; int[][] myArr = new int[9][9];
Widget sudokuScreen = client.getWidget(288, 131); Widget sudokuScreen = client.getWidget(288, 131);

View File

@@ -52,8 +52,8 @@ import net.runelite.client.ui.ClientUI;
public class RuneLitePlusPlugin extends Plugin public class RuneLitePlusPlugin extends Plugin
{ {
public static boolean customPresenceEnabled = false; public static boolean customPresenceEnabled = false;
public static String rlPlusDiscordApp = "560644885250572289"; public static final String rlPlusDiscordApp = "560644885250572289";
public static String rlDiscordApp = "409416265891971072"; public static final String rlDiscordApp = "409416265891971072";
@Inject @Inject
public RuneLitePlusConfig config; public RuneLitePlusConfig config;

View File

@@ -301,7 +301,8 @@ public class SlayerTaskPanel extends PluginPanel
if (tasks.isEmpty() || isNewAssignment) if (tasks.isEmpty() || isNewAssignment)
{ {
// new task so append it to the front of the list // new task so append it to the front of the list
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() ->
{
TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData); TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData);
newBox.update(true, newData.isPaused(), newData); newBox.update(true, newData.isPaused(), newData);
}); });
@@ -322,7 +323,8 @@ public class SlayerTaskPanel extends PluginPanel
// so this previous task is invalid so delete it then add in the new actually // so this previous task is invalid so delete it then add in the new actually
// correct task // correct task
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() ->
{
tasksContainer.remove(tasks.get(0)); tasksContainer.remove(tasks.get(0));
tasks.remove(0); tasks.remove(0);
TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData); TaskBox newBox = buildBox(slayerPlugin, tasksContainer, newData);

View File

@@ -58,7 +58,7 @@ public class TargetClickboxOverlay extends Overlay
@Inject @Inject
TargetClickboxOverlay(Client client, SlayerConfig config, SlayerPlugin plugin, TargetClickboxOverlay(Client client, SlayerConfig config, SlayerPlugin plugin,
ModelOutlineRenderer modelOutlineRenderer) ModelOutlineRenderer modelOutlineRenderer)
{ {
this.client = client; this.client = client;
this.config = config; this.config = config;

View File

@@ -80,7 +80,8 @@ class TaskBox extends JPanel
container.setLayout(new BorderLayout()); container.setLayout(new BorderLayout());
container.setBackground(ColorScheme.DARKER_GRAY_COLOR); container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() ->
{
BufferedImage taskImg = slayerPlugin.getImageForTask(Task.getTask(taskData.getTaskName())); BufferedImage taskImg = slayerPlugin.getImageForTask(Task.getTask(taskData.getTaskName()));
JLabel taskIcon = new JLabel(new ImageIcon(taskImg)); JLabel taskIcon = new JLabel(new ImageIcon(taskImg));
taskIcon.setHorizontalAlignment(SwingConstants.CENTER); taskIcon.setHorizontalAlignment(SwingConstants.CENTER);

View File

@@ -42,7 +42,8 @@ public class TickCounterOverlay extends Overlay
panelComponent.setBackgroundColor(config.bgColor()); panelComponent.setBackgroundColor(config.bgColor());
elems.add(TitleComponent.builder().text("Combat counter").color(config.titleColor()).build()); elems.add(TitleComponent.builder().text("Combat counter").color(config.titleColor()).build());
List<Entry<String, Integer>> list = new ArrayList<>(plugin.activity.entrySet()); List<Entry<String, Integer>> list = new ArrayList<>(plugin.activity.entrySet());
list.sort((o1, o2) -> { list.sort((o1, o2) ->
{
int value = -Integer.compare(o1.getValue(), o2.getValue()); int value = -Integer.compare(o1.getValue(), o2.getValue());
if (value == 0) if (value == 0)
{ {

View File

@@ -50,7 +50,7 @@ class OverviewTabPanel extends TabContentPanel
private final OverviewItemPanel birdHouseOverview; private final OverviewItemPanel birdHouseOverview;
OverviewTabPanel(ItemManager itemManager, TimeTrackingConfig config, TimeTrackingPanel pluginPanel, OverviewTabPanel(ItemManager itemManager, TimeTrackingConfig config, TimeTrackingPanel pluginPanel,
FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager) FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager)
{ {
this.config = config; this.config = config;
this.farmingTracker = farmingTracker; this.farmingTracker = farmingTracker;

View File

@@ -64,7 +64,7 @@ class TimeTrackingPanel extends PluginPanel
private TabContentPanel activeTabPanel = null; private TabContentPanel activeTabPanel = null;
TimeTrackingPanel(ItemManager itemManager, TimeTrackingConfig config, TimeTrackingPanel(ItemManager itemManager, TimeTrackingConfig config,
FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager) FarmingTracker farmingTracker, BirdHouseTracker birdHouseTracker, ClockManager clockManager)
{ {
super(false); super(false);

View File

@@ -60,7 +60,7 @@ public class FarmingTracker
@Inject @Inject
private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager, private FarmingTracker(Client client, ItemManager itemManager, ConfigManager configManager,
TimeTrackingConfig config, FarmingWorld farmingWorld) TimeTrackingConfig config, FarmingWorld farmingWorld)
{ {
this.client = client; this.client = client;
this.itemManager = itemManager; this.itemManager = itemManager;

View File

@@ -73,7 +73,7 @@ public class BirdHouseTracker
@Inject @Inject
private BirdHouseTracker(Client client, ItemManager itemManager, ConfigManager configManager, private BirdHouseTracker(Client client, ItemManager itemManager, ConfigManager configManager,
TimeTrackingConfig config, Notifier notifier) TimeTrackingConfig config, Notifier notifier)
{ {
this.client = client; this.client = client;
this.itemManager = itemManager; this.itemManager = itemManager;

View File

@@ -121,7 +121,7 @@ public class WhaleWatchersPlugin extends Plugin
{ {
if (config.showDamageCounter()) if (config.showDamageCounter())
{ {
if (!(event.getActor() == client.getLocalPlayer() | if (!(event.getActor() == client.getLocalPlayer() ||
event.getActor() == client.getLocalPlayer().getInteracting())) event.getActor() == client.getLocalPlayer().getInteracting()))
{ {
return; return;

View File

@@ -76,7 +76,7 @@ public class WikiSearchChatboxTextInput extends ChatboxTextInput
@Inject @Inject
public WikiSearchChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread, public WikiSearchChatboxTextInput(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread,
ScheduledExecutorService scheduledExecutorService, @Named("developerMode") final boolean developerMode) ScheduledExecutorService scheduledExecutorService, @Named("developerMode") final boolean developerMode)
{ {
super(chatboxPanelManager, clientThread); super(chatboxPanelManager, clientThread);
this.chatboxPanelManager = chatboxPanelManager; this.chatboxPanelManager = chatboxPanelManager;

View File

@@ -32,17 +32,14 @@ import com.google.common.reflect.TypeToken;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.sigpipe.jbsdiff.InvalidHeaderException; import io.sigpipe.jbsdiff.InvalidHeaderException;
import io.sigpipe.jbsdiff.Patch; import io.sigpipe.jbsdiff.Patch;
import java.applet.Applet; import java.applet.Applet;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.net.URL; import java.net.URL;
import java.nio.file.Files;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.jar.Attributes; import java.util.jar.Attributes;
@@ -53,13 +50,10 @@ import java.util.jar.Manifest;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO; import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO;
import static net.runelite.client.rs.ClientUpdateCheckMode.NONE; import static net.runelite.client.rs.ClientUpdateCheckMode.NONE;
import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA; import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA;
import net.runelite.client.rs.mixins.MixinRunner; import net.runelite.client.rs.mixins.MixinRunner;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Request; import okhttp3.Request;
@@ -72,10 +66,11 @@ public class ClientLoader
{ {
private final ClientConfigLoader clientConfigLoader; private final ClientConfigLoader clientConfigLoader;
private ClientUpdateCheckMode updateCheckMode; private ClientUpdateCheckMode updateCheckMode;
@Inject @Inject
private ClientLoader( private ClientLoader(
@Named("updateCheckMode") final ClientUpdateCheckMode updateCheckMode, @Named("updateCheckMode") final ClientUpdateCheckMode updateCheckMode,
final ClientConfigLoader clientConfigLoader) final ClientConfigLoader clientConfigLoader)
{ {
this.updateCheckMode = updateCheckMode; this.updateCheckMode = updateCheckMode;
this.clientConfigLoader = clientConfigLoader; this.clientConfigLoader = clientConfigLoader;
@@ -100,8 +95,8 @@ public class ClientLoader
String initialJar = config.getInitialJar(); String initialJar = config.getInitialJar();
URL url = new URL(codebase + initialJar); URL url = new URL(codebase + initialJar);
Request request = new Request.Builder() Request request = new Request.Builder()
.url(url) .url(url)
.build(); .build();
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
{ {
@@ -157,7 +152,7 @@ public class ClientLoader
if (!file.getValue().equals(ourHash)) if (!file.getValue().equals(ourHash))
{ {
log.info("{} had a hash mismatch; falling back to vanilla. {} != {}", file.getKey(), log.info("{} had a hash mismatch; falling back to vanilla. {} != {}", file.getKey(),
file.getValue(), ourHash); file.getValue(), ourHash);
log.info("Client is outdated!"); log.info("Client is outdated!");
updateCheckMode = VANILLA; updateCheckMode = VANILLA;
break; break;
@@ -250,8 +245,8 @@ public class ClientLoader
if (e instanceof ClassNotFoundException) if (e instanceof ClassNotFoundException)
{ {
log.error("Unable to load client - class not found. This means you" log.error("Unable to load client - class not found. This means you"
+ " are not running RuneLite with Maven as the client patch" + " are not running RuneLite with Maven as the client patch"
+ " is not in your classpath."); + " is not in your classpath.");
} }
log.error("Error loading RS!", e); log.error("Error loading RS!", e);

View File

@@ -25,8 +25,18 @@
package net.runelite.client.rs.mixins; package net.runelite.client.rs.mixins;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.runelite.client.rs.mixins.transformers.*; import net.runelite.client.rs.mixins.transformers.AppendTransformer;
import net.runelite.client.rs.mixins.transformers.DoNothingTransformer;
import net.runelite.client.rs.mixins.transformers.InjectTransformer;
import net.runelite.client.rs.mixins.transformers.InterfaceTransformer;
import net.runelite.client.rs.mixins.transformers.OverwriteSanityCheck;
import net.runelite.client.rs.mixins.transformers.OverwriteTransformer;
import net.runelite.client.rs.mixins.transformers.PrependTransformer;
import net.runelite.client.rs.mixins.transformers.ProtectTransformer;
import net.runelite.client.rs.mixins.transformers.SanityChecker;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
@@ -34,9 +44,6 @@ import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.Remapper; import org.objectweb.asm.commons.Remapper;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
@RequiredArgsConstructor @RequiredArgsConstructor
public class MixinRunner public class MixinRunner
{ {
@@ -45,7 +52,7 @@ public class MixinRunner
private final Map<String, byte[]> patches; private final Map<String, byte[]> patches;
public Map<String, byte[]> run() public Map<String, byte[]> run()
throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
{ {
runVisitor(InterfaceTransformer.class); runVisitor(InterfaceTransformer.class);
runVisitor(OverwriteTransformer.class); runVisitor(OverwriteTransformer.class);
@@ -78,13 +85,13 @@ public class MixinRunner
} }
private void runVisitor(Class<? extends ClassVisitor> clazz) private void runVisitor(Class<? extends ClassVisitor> clazz)
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException
{ {
runVisitor(clazz, 1); runVisitor(clazz, 1);
} }
private void runVisitor(Class<? extends ClassVisitor> clazz, int flags) private void runVisitor(Class<? extends ClassVisitor> clazz, int flags)
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException
{ {
for (Map.Entry<String, byte[]> entry : classes.entrySet()) for (Map.Entry<String, byte[]> entry : classes.entrySet())
{ {
@@ -98,7 +105,7 @@ public class MixinRunner
ClassNode node = new ClassNode(); ClassNode node = new ClassNode();
cr.accept(node, 0); cr.accept(node, 0);
ClassVisitor inst = clazz.getConstructor(ClassVisitor.class, byte[].class, ClassNode.class).newInstance(cw, ClassVisitor inst = clazz.getConstructor(ClassVisitor.class, byte[].class, ClassNode.class).newInstance(cw,
patch, node); patch, node);
cr.accept(inst, 0); cr.accept(inst, 0);
entry.setValue(cw.toByteArray()); entry.setValue(cw.toByteArray());
@@ -106,13 +113,13 @@ public class MixinRunner
} }
private void runSanityChecker(Class<? extends SanityChecker> clazz) private void runSanityChecker(Class<? extends SanityChecker> clazz)
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException
{ {
runSanityChecker(clazz, 1); runSanityChecker(clazz, 1);
} }
private void runSanityChecker(Class<? extends SanityChecker> clazz, int flags) private void runSanityChecker(Class<? extends SanityChecker> clazz, int flags)
throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException
{ {
for (Map.Entry<String, byte[]> entry : patches.entrySet()) for (Map.Entry<String, byte[]> entry : patches.entrySet())
{ {
@@ -126,7 +133,7 @@ public class MixinRunner
} }
private void recalcMaxes() private void recalcMaxes()
throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException
{ {
runVisitor(DoNothingTransformer.class, 3); runVisitor(DoNothingTransformer.class, 3);
} }

View File

@@ -73,30 +73,30 @@ public class AppendTransformer extends ClassVisitor implements Opcodes
{ {
MethodNode patchMethod = (MethodNode) obj; MethodNode patchMethod = (MethodNode) obj;
if ((patchMethod.access == access && patchMethod.name.equals("append$" + name) && if ((patchMethod.access == access && patchMethod.name.equals("append$" + name) &&
patchMethod.desc.equals(descriptor)) && patchMethod.desc.equals(descriptor)) &&
RefUtils.checkAnnotation(patchMethod, "Append")) RefUtils.checkAnnotation(patchMethod, "Append"))
{ {
MethodVisitor mv = MethodVisitor mv =
new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature, new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature,
exceptions)) exceptions))
{ {
}; };
mv.visitCode(); mv.visitCode();
for (Object obj2 : classNode.methods) for (Object obj2 : classNode.methods)
{ {
MethodNode classMethod = (MethodNode) obj2; MethodNode classMethod = (MethodNode) obj2;
if (classMethod.access == access && classMethod.name.equals(name) && if (classMethod.access == access && classMethod.name.equals(name) &&
classMethod.desc.equals(descriptor)) classMethod.desc.equals(descriptor))
{ {
AbstractInsnNode inode = classMethod.instructions.getLast(); AbstractInsnNode inode = classMethod.instructions.getLast();
while(inode instanceof LabelNode || inode instanceof LineNumberNode) while (inode instanceof LabelNode || inode instanceof LineNumberNode)
{ {
inode = inode.getPrevious(); inode = inode.getPrevious();
} }
if(RefUtils.isReturn(inode.getOpcode(), true)) if (RefUtils.isReturn(inode.getOpcode(), true))
{ {
log.error("[Append] Can't append to {}.{}, requires typed return opcode", className, name); log.error("[Append] Can't append to {}.{}, requires typed return opcode", className, name);
return super.visitMethod(access, name, descriptor, signature, exceptions); return super.visitMethod(access, name, descriptor, signature, exceptions);

View File

@@ -63,8 +63,8 @@ public class InjectTransformer extends ClassVisitor
{ {
return super.visitMethod(access, name, descriptor, signature, exceptions); return super.visitMethod(access, name, descriptor, signature, exceptions);
} }
if (name.startsWith("prepend$") || name.startsWith("append$")|| if (name.startsWith("prepend$") || name.startsWith("append$") ||
(patching && name.startsWith("<"))) (patching && name.startsWith("<")))
{ {
return null; return null;
} }
@@ -76,7 +76,7 @@ public class InjectTransformer extends ClassVisitor
{ {
MethodNode node = (MethodNode) obj; MethodNode node = (MethodNode) obj;
if ((node.access == access && node.name.equals(name) && node.desc.equals(descriptor)) && if ((node.access == access && node.name.equals(name) && node.desc.equals(descriptor)) &&
RefUtils.checkAnnotation(node, "Inject")) RefUtils.checkAnnotation(node, "Inject"))
{ {
mv.visitCode(); mv.visitCode();
node.accept(new MethodReflector(mv)); node.accept(new MethodReflector(mv));
@@ -106,7 +106,7 @@ public class InjectTransformer extends ClassVisitor
if (RefUtils.checkAnnotation(node, "Inject")) if (RefUtils.checkAnnotation(node, "Inject"))
{ {
visitMethod(node.access, node.name, node.desc, node.signature, visitMethod(node.access, node.name, node.desc, node.signature,
(String[]) node.exceptions.toArray(new String[0])); (String[]) node.exceptions.toArray(new String[0]));
} }
} }

View File

@@ -25,15 +25,14 @@
package net.runelite.client.rs.mixins.transformers; package net.runelite.client.rs.mixins.transformers;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import java.util.ArrayList;
import java.util.Arrays;
@Slf4j @Slf4j
public class InterfaceTransformer extends ClassVisitor implements Opcodes public class InterfaceTransformer extends ClassVisitor implements Opcodes
{ {
@@ -53,14 +52,14 @@ public class InterfaceTransformer extends ClassVisitor implements Opcodes
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{ {
className = name; className = name;
if(patch != null) if (patch != null)
{ {
ClassReader reader = new ClassReader(patch); ClassReader reader = new ClassReader(patch);
ClassNode pNode = new ClassNode(); ClassNode pNode = new ClassNode();
reader.accept(pNode, 0); reader.accept(pNode, 0);
if(pNode.interfaces != null && pNode.interfaces.size() != 0) if (pNode.interfaces != null && pNode.interfaces.size() != 0)
{ {
if(interfaces == null) if (interfaces == null)
{ {
interfaces = (String[]) pNode.interfaces.toArray(new String[0]); interfaces = (String[]) pNode.interfaces.toArray(new String[0]);
} }

View File

@@ -25,6 +25,7 @@
package net.runelite.client.rs.mixins.transformers; package net.runelite.client.rs.mixins.transformers;
import java.util.ArrayList;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.util.RefUtils; import net.runelite.client.util.RefUtils;
import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassVisitor;
@@ -33,8 +34,6 @@ import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.MethodNode;
import java.util.ArrayList;
@Slf4j @Slf4j
public class OverwriteSanityCheck extends SanityChecker implements Opcodes public class OverwriteSanityCheck extends SanityChecker implements Opcodes
{ {
@@ -54,20 +53,20 @@ public class OverwriteSanityCheck extends SanityChecker implements Opcodes
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions)
{ {
String check = String.format("%s %s %s %s", className, name, String check = String.format("%s %s %s %s", className, name,
descriptor, access); descriptor, access);
MethodNode methodNode = null; MethodNode methodNode = null;
for (Object obj2 : patchNode.methods) for (Object obj2 : patchNode.methods)
{ {
MethodNode classMethod = (MethodNode) obj2; MethodNode classMethod = (MethodNode) obj2;
if (classMethod.access == access && classMethod.name.equals(name) && if (classMethod.access == access && classMethod.name.equals(name) &&
classMethod.desc.equals(descriptor)) classMethod.desc.equals(descriptor))
{ {
methodNode = classMethod; methodNode = classMethod;
} }
} }
if(methodNode == null) if (methodNode == null)
{ {
log.error("[OverwriteSanity] Failed to find original patch method for {}", check); log.error("[OverwriteSanity] Failed to find original patch method for {}", check);
return super.visitMethod(access, name, descriptor, signature, exceptions); return super.visitMethod(access, name, descriptor, signature, exceptions);

View File

@@ -83,15 +83,15 @@ public class OverwriteTransformer extends ClassVisitor
if (RefUtils.checkAnnotation(patchMethod, "Overwrite")) if (RefUtils.checkAnnotation(patchMethod, "Overwrite"))
{ {
MethodVisitor mv = MethodVisitor mv =
new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature, new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature,
exceptions)) exceptions))
{ {
}; };
mv.visitCode(); mv.visitCode();
patchMethod.accept(new MethodReflector(mv)); patchMethod.accept(new MethodReflector(mv));
mv.visitEnd(); mv.visitEnd();
String s = String.format("%s %s %s %s", className, patchMethod.name, String s = String.format("%s %s %s %s", className, patchMethod.name,
patchMethod.desc, patchMethod.access); patchMethod.desc, patchMethod.access);
OverwriteSanityCheck.methodsUsed.add(s); OverwriteSanityCheck.methodsUsed.add(s);
return mv; return mv;
} }

View File

@@ -70,14 +70,14 @@ public class PrependTransformer extends ClassVisitor
{ {
MethodNode patchMethod = (MethodNode) obj; MethodNode patchMethod = (MethodNode) obj;
if ((patchMethod.access == access && patchMethod.name.equals("prepend$" + name) && if ((patchMethod.access == access && patchMethod.name.equals("prepend$" + name) &&
patchMethod.desc.equals(descriptor)) && patchMethod.desc.equals(descriptor)) &&
RefUtils.checkAnnotation(patchMethod, "Prepend")) RefUtils.checkAnnotation(patchMethod, "Prepend"))
{ {
MethodVisitor mv = MethodVisitor mv =
new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature, new MethodVisitor(Opcodes.ASM6, super.visitMethod(access, name, descriptor, signature,
exceptions)) exceptions))
{ {
}; };
mv.visitCode(); mv.visitCode();
AbstractInsnNode node = patchMethod.instructions.getLast(); AbstractInsnNode node = patchMethod.instructions.getLast();
@@ -97,7 +97,7 @@ public class PrependTransformer extends ClassVisitor
{ {
MethodNode classMethod = (MethodNode) obj2; MethodNode classMethod = (MethodNode) obj2;
if (classMethod.access == access && classMethod.name.equals(name) && if (classMethod.access == access && classMethod.name.equals(name) &&
classMethod.desc.equals(descriptor)) classMethod.desc.equals(descriptor))
{ {
classMethod.accept(new MethodReflector(mv)); classMethod.accept(new MethodReflector(mv));
break; break;

View File

@@ -60,7 +60,7 @@ final class ClientPanel extends JPanel
// and draw anywhere without it leaving artifacts // and draw anywhere without it leaving artifacts
if (client instanceof Client) if (client instanceof Client)
{ {
((Client)client).setGameDrawingMode(2); ((Client) client).setGameDrawingMode(2);
} }
} }
} }

View File

@@ -174,8 +174,8 @@ public class ClientUI
{ {
if (!event.getGroup().equals(CONFIG_GROUP) if (!event.getGroup().equals(CONFIG_GROUP)
&& !(event.getGroup().equals(PLUS_CONFIG_GROUP) && !(event.getGroup().equals(PLUS_CONFIG_GROUP)
&& event.getKey().equals(CONFIG_OPACITY) || && event.getKey().equals(CONFIG_OPACITY) ||
event.getKey().equals(CONFIG_OPACITY_AMOUNT)) || event.getKey().equals(CONFIG_OPACITY_AMOUNT)) ||
event.getKey().equals(CONFIG_CLIENT_MAXIMIZED) || event.getKey().equals(CONFIG_CLIENT_MAXIMIZED) ||
event.getKey().equals(CONFIG_CLIENT_BOUNDS)) event.getKey().equals(CONFIG_CLIENT_BOUNDS))
{ {
@@ -278,7 +278,7 @@ public class ClientUI
return; return;
} }
final Client client = (Client)this.client; final Client client = (Client) this.client;
final ClientThread clientThread = clientThreadProvider.get(); final ClientThread clientThread = clientThreadProvider.get();
// Keep scheduling event until we get our name // Keep scheduling event until we get our name
@@ -615,8 +615,9 @@ public class ClientUI
/** /**
* Changes cursor for client window. Requires ${@link ClientUI#open(RuneLite)} to be called first. * Changes cursor for client window. Requires ${@link ClientUI#open(RuneLite)} to be called first.
* FIXME: This is working properly only on Windows, Linux and Mac are displaying cursor incorrectly * FIXME: This is working properly only on Windows, Linux and Mac are displaying cursor incorrectly
*
* @param image cursor image * @param image cursor image
* @param name cursor name * @param name cursor name
*/ */
public void setCursor(final BufferedImage image, final String name) public void setCursor(final BufferedImage image, final String name)
{ {
@@ -632,6 +633,7 @@ public class ClientUI
/** /**
* Resets client window cursor to default one. * Resets client window cursor to default one.
*
* @see ClientUI#setCursor(BufferedImage, String) * @see ClientUI#setCursor(BufferedImage, String)
*/ */
public void resetCursor() public void resetCursor()
@@ -666,6 +668,7 @@ public class ClientUI
/** /**
* Paint UI related overlays to target graphics * Paint UI related overlays to target graphics
*
* @param graphics target graphics * @param graphics target graphics
*/ */
public void paintOverlays(final Graphics2D graphics) public void paintOverlays(final Graphics2D graphics)
@@ -845,7 +848,7 @@ public class ClientUI
if (config.usernameInTitle() && (client instanceof Client)) if (config.usernameInTitle() && (client instanceof Client))
{ {
final Player player = ((Client)client).getLocalPlayer(); final Player player = ((Client) client).getLocalPlayer();
if (player != null && player.getName() != null) if (player != null && player.getName() != null)
{ {

View File

@@ -57,10 +57,10 @@ public class ContainableFrame extends JFrame
if (containedInScreen) if (containedInScreen)
{ {
Rectangle bounds = this.getGraphicsConfiguration().getBounds(); Rectangle bounds = this.getGraphicsConfiguration().getBounds();
x = Math.max(x, (int)bounds.getX()); x = Math.max(x, (int) bounds.getX());
x = Math.min(x, (int)(bounds.getX() + bounds.getWidth() - this.getWidth())); x = Math.min(x, (int) (bounds.getX() + bounds.getWidth() - this.getWidth()));
y = Math.max(y, (int)bounds.getY()); y = Math.max(y, (int) bounds.getY());
y = Math.min(y, (int)(bounds.getY() + bounds.getHeight() - this.getHeight())); y = Math.min(y, (int) (bounds.getY() + bounds.getHeight() - this.getHeight()));
} }
super.setLocation(x, y); super.setLocation(x, y);
@@ -72,12 +72,12 @@ public class ContainableFrame extends JFrame
if (containedInScreen) if (containedInScreen)
{ {
Rectangle bounds = this.getGraphicsConfiguration().getBounds(); Rectangle bounds = this.getGraphicsConfiguration().getBounds();
width = Math.min(width, width - (int)bounds.getX() + x); width = Math.min(width, width - (int) bounds.getX() + x);
x = Math.max(x, (int)bounds.getX()); x = Math.max(x, (int) bounds.getX());
height = Math.min(height, height - (int)bounds.getY() + y); height = Math.min(height, height - (int) bounds.getY() + y);
y = Math.max(y, (int)bounds.getY()); y = Math.max(y, (int) bounds.getY());
width = Math.min(width, (int)(bounds.getX() + bounds.getWidth()) - x); width = Math.min(width, (int) (bounds.getX() + bounds.getWidth()) - x);
height = Math.min(height, (int)(bounds.getY() + bounds.getHeight()) - y); height = Math.min(height, (int) (bounds.getY() + bounds.getHeight()) - y);
} }
super.setBounds(x, y, width, height); super.setBounds(x, y, width, height);
@@ -86,6 +86,7 @@ public class ContainableFrame extends JFrame
/** /**
* Expand frame by specified value. If the frame is going to be expanded outside of screen push the frame to * Expand frame by specified value. If the frame is going to be expanded outside of screen push the frame to
* the side. * the side.
*
* @param value size to expand frame by * @param value size to expand frame by
*/ */
public void expandBy(final int value) public void expandBy(final int value)
@@ -122,7 +123,7 @@ public class ContainableFrame extends JFrame
if (!isFrameCloseToRightEdge() || isFrameCloseToLeftEdge()) if (!isFrameCloseToRightEdge() || isFrameCloseToLeftEdge())
{ {
// Move the window to the edge // Move the window to the edge
newWindowX = (int)(screenBounds.getX() + screenBounds.getWidth()) - getWidth(); newWindowX = (int) (screenBounds.getX() + screenBounds.getWidth()) - getWidth();
} }
// Expand the window to the left as the user probably don't want the // Expand the window to the left as the user probably don't want the
@@ -141,6 +142,7 @@ public class ContainableFrame extends JFrame
/** /**
* Contract frame by specified value. If new frame size is less than it's minimum size, force the minimum size. * Contract frame by specified value. If new frame size is less than it's minimum size, force the minimum size.
* If the frame was pushed from side before, restore it's original position. * If the frame was pushed from side before, restore it's original position.
*
* @param value value to contract frame by * @param value value to contract frame by
*/ */
public void contractBy(final int value) public void contractBy(final int value)

View File

@@ -33,7 +33,7 @@ import java.util.function.Function;
/** /**
* Grid layout implementation with support for cells with unequal size. * Grid layout implementation with support for cells with unequal size.
* * <p>
* See https://www.javaworld.com/article/2077486/core-java/java-tip-121--flex-your-grid-layout.html * See https://www.javaworld.com/article/2077486/core-java/java-tip-121--flex-your-grid-layout.html
*/ */
public class DynamicGridLayout extends GridLayout public class DynamicGridLayout extends GridLayout
@@ -149,8 +149,9 @@ public class DynamicGridLayout extends GridLayout
/** /**
* Calculate outer size of the layout based on it's children and sizer * Calculate outer size of the layout based on it's children and sizer
*
* @param parent parent component * @param parent parent component
* @param sizer functioning returning dimension of the child component * @param sizer functioning returning dimension of the child component
* @return outer size * @return outer size
*/ */
private Dimension calculateSize(final Container parent, final Function<Component, Dimension> sizer) private Dimension calculateSize(final Container parent, final Function<Component, Dimension> sizer)

View File

@@ -24,11 +24,11 @@
*/ */
package net.runelite.client.ui; package net.runelite.client.ui;
import javax.swing.text.StyleContext;
import java.awt.Font; import java.awt.Font;
import java.awt.FontFormatException; import java.awt.FontFormatException;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.io.IOException; import java.io.IOException;
import javax.swing.text.StyleContext;
public class FontManager public class FontManager
{ {
@@ -48,7 +48,7 @@ public class FontManager
ge.registerFont(font); ge.registerFont(font);
runescapeFont = StyleContext.getDefaultStyleContext() runescapeFont = StyleContext.getDefaultStyleContext()
.getFont(font.getName(), Font.PLAIN, 16); .getFont(font.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeFont); ge.registerFont(runescapeFont);
Font smallFont = Font.createFont(Font.TRUETYPE_FONT, Font smallFont = Font.createFont(Font.TRUETYPE_FONT,
@@ -57,16 +57,16 @@ public class FontManager
ge.registerFont(smallFont); ge.registerFont(smallFont);
runescapeSmallFont = StyleContext.getDefaultStyleContext() runescapeSmallFont = StyleContext.getDefaultStyleContext()
.getFont(smallFont.getName(), Font.PLAIN, 16); .getFont(smallFont.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeSmallFont); ge.registerFont(runescapeSmallFont);
Font boldFont = Font.createFont(Font.TRUETYPE_FONT, Font boldFont = Font.createFont(Font.TRUETYPE_FONT,
FontManager.class.getResourceAsStream("runescape_bold.ttf")) FontManager.class.getResourceAsStream("runescape_bold.ttf"))
.deriveFont(Font.PLAIN, 16); .deriveFont(Font.PLAIN, 16);
ge.registerFont(boldFont); ge.registerFont(boldFont);
runescapeBoldFont = StyleContext.getDefaultStyleContext() runescapeBoldFont = StyleContext.getDefaultStyleContext()
.getFont(boldFont.getName(), Font.PLAIN, 16); .getFont(boldFont.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeBoldFont); ge.registerFont(runescapeBoldFont);
} }
catch (FontFormatException ex) catch (FontFormatException ex)

View File

@@ -24,7 +24,10 @@
*/ */
package net.runelite.client.ui; package net.runelite.client.ui;
import java.awt.*; import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@@ -36,7 +39,6 @@ import javax.swing.JPanel;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicProgressBarUI; import javax.swing.plaf.basic.BasicProgressBarUI;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite; import net.runelite.client.RuneLite;
import net.runelite.client.RuneLiteProperties; import net.runelite.client.RuneLiteProperties;
@@ -64,6 +66,7 @@ public class RuneLiteSplashScreen
/** /**
* This is not done in the constructor in order to avoid processing in case the user chooses to not load * This is not done in the constructor in order to avoid processing in case the user chooses to not load
* the splash screen. * the splash screen.
*
* @param estimatedSteps steps until completion, used for the progress bar * @param estimatedSteps steps until completion, used for the progress bar
*/ */
private void initLayout(final int estimatedSteps) private void initLayout(final int estimatedSteps)
@@ -183,6 +186,7 @@ public class RuneLiteSplashScreen
/** /**
* Set the splash screen to be visible. * Set the splash screen to be visible.
*
* @param estimatedSteps steps until completion, used for the progress bar * @param estimatedSteps steps until completion, used for the progress bar
*/ */
public void open(final int estimatedSteps) public void open(final int estimatedSteps)
@@ -226,7 +230,8 @@ public class RuneLiteSplashScreen
{ {
return; return;
} }
if (progressGoal!=progressBar.getMaximum()) { if (progressGoal != progressBar.getMaximum())
{
panel.remove(progressBar); panel.remove(progressBar);
panel.validate(); panel.validate();
final GridBagConstraints progressConstraints = new GridBagConstraints(); final GridBagConstraints progressConstraints = new GridBagConstraints();

View File

@@ -70,6 +70,7 @@ public class DimmableJPanel extends JPanel
* Dimming sets all parts of this component with darker colors except for the central label * Dimming sets all parts of this component with darker colors except for the central label
* This is useful for showing that progress is paused * This is useful for showing that progress is paused
* Setting dim to false will restore the original colors from before the component was dimmed. * Setting dim to false will restore the original colors from before the component was dimmed.
*
* @param dimmed * @param dimmed
*/ */
public void setDimmed(boolean dimmed) public void setDimmed(boolean dimmed)

View File

@@ -54,7 +54,7 @@ public class ThinProgressBar extends JPanel
public double getPercentage() public double getPercentage()
{ {
return (value * 100) / maximumValue; return (value * 100) / (double) maximumValue;
} }
@Override @Override

View File

@@ -62,6 +62,7 @@ public abstract class Overlay implements LayoutableRenderableEntity
/** /**
* Overlay name, used for saving the overlay, needs to be unique * Overlay name, used for saving the overlay, needs to be unique
*
* @return overlay name * @return overlay name
*/ */
public String getName() public String getName()

View File

@@ -41,8 +41,8 @@ import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.MenuAction; import net.runelite.api.MenuAction;
import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;

View File

@@ -544,7 +544,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
bottomLeftPoint.y) : bottomRightPoint; bottomLeftPoint.y) : bottomRightPoint;
final Point canvasTopRightPoint = isResizeable ? new Point( final Point canvasTopRightPoint = isResizeable ? new Point(
(int)client.getRealDimensions().getWidth(), (int) client.getRealDimensions().getWidth(),
0) : topRightPoint; 0) : topRightPoint;
return new OverlayBounds( return new OverlayBounds(

View File

@@ -37,7 +37,6 @@ import java.awt.image.BufferedImage;
import net.runelite.api.Actor; import net.runelite.api.Actor;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Perspective; import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.TileObject; import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
@@ -77,7 +76,7 @@ public class OverlayUtil
graphics.setColor(color); graphics.setColor(color);
graphics.rotate(angle, center.getX(), center.getY()); graphics.rotate(angle, center.getX(), center.getY());
graphics.drawRect(center.getX() - width / 2, center.getY() - height / 2, width, height); graphics.drawRect(center.getX() - width / 2, center.getY() - height / 2, width, height);
graphics.rotate(-angle , center.getX(), center.getY()); graphics.rotate(-angle, center.getX(), center.getY());
} }
public static void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color) public static void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color)
@@ -261,10 +260,10 @@ public class OverlayUtil
} }
public static void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color, public static void renderActorTextAndImage(Graphics2D graphics, Actor actor, String text, Color color,
BufferedImage image, int yOffset, int xOffset) BufferedImage image, int yOffset, int xOffset)
{ {
Point textLocation = new Point(actor.getConvexHull().getBounds().x + xOffset, Point textLocation = new Point(actor.getConvexHull().getBounds().x + xOffset,
actor.getConvexHull().getBounds().y + yOffset); actor.getConvexHull().getBounds().y + yOffset);
renderImageLocation(graphics, textLocation, image); renderImageLocation(graphics, textLocation, image);
xOffset = image.getWidth() + 1; xOffset = image.getWidth() + 1;

View File

@@ -101,8 +101,8 @@ public class WidgetOverlay extends Overlay
int y = bounds.y; int y = bounds.y;
x = Math.max(parent.x, x); x = Math.max(parent.x, x);
y = Math.max(parent.y, y); y = Math.max(parent.y, y);
x = Math.min((int)parent.getMaxX() - bounds.width, x); x = Math.min((int) parent.getMaxX() - bounds.width, x);
y = Math.min((int)parent.getMaxY() - bounds.height, y); y = Math.min((int) parent.getMaxY() - bounds.height, y);
bounds.setLocation(x, y); bounds.setLocation(x, y);
return bounds; return bounds;
} }
@@ -123,8 +123,8 @@ public class WidgetOverlay extends Overlay
int y = bounds.y; int y = bounds.y;
x = Math.max(parent.x, x); x = Math.max(parent.x, x);
y = Math.max(parent.y, y); y = Math.max(parent.y, y);
x = Math.min((int)parent.getMaxX() - bounds.width, x); x = Math.min((int) parent.getMaxX() - bounds.width, x);
y = Math.min((int)parent.getMaxY() - bounds.height, y); y = Math.min((int) parent.getMaxY() - bounds.height, y);
bounds.setLocation(x, y); bounds.setLocation(x, y);
widget.setOriginalX(0); widget.setOriginalX(0);
widget.setOriginalY(0); widget.setOriginalY(0);

View File

@@ -200,10 +200,7 @@ public class ArrowMinimapOverlay extends Overlay
localPoint = new LocalPoint(localPoint.getX() + 1, localPoint.getY() + 1); localPoint = new LocalPoint(localPoint.getX() + 1, localPoint.getY() + 1);
} }
} }
else localPoint = null;
{
localPoint = npc.getLocalLocation();
}
renderMinimapArrow(graphics, arrowPoint, localPoint, localPlayerPos, worldPlayerPos); renderMinimapArrow(graphics, arrowPoint, localPoint, localPlayerPos, worldPlayerPos);
} }

View File

@@ -29,8 +29,6 @@ import com.google.common.collect.Multimap;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.events.NpcSpawned;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@Singleton @Singleton

View File

@@ -89,7 +89,7 @@ public class BackgroundComponent implements RenderableEntity
final Rectangle insideStroke = new Rectangle(); final Rectangle insideStroke = new Rectangle();
insideStroke.setLocation(rectangle.x + BORDER_OFFSET / 2, rectangle.y + BORDER_OFFSET / 2); insideStroke.setLocation(rectangle.x + BORDER_OFFSET / 2, rectangle.y + BORDER_OFFSET / 2);
insideStroke.setSize(rectangle.width - BORDER_OFFSET - BORDER_OFFSET / 2, insideStroke.setSize(rectangle.width - BORDER_OFFSET - BORDER_OFFSET / 2,
rectangle.height - BORDER_OFFSET - BORDER_OFFSET / 2); rectangle.height - BORDER_OFFSET - BORDER_OFFSET / 2);
graphics.setColor(insideStrokeColor); graphics.setColor(insideStrokeColor);
graphics.draw(insideStroke); graphics.draw(insideStroke);

View File

@@ -32,6 +32,8 @@ import net.runelite.client.ui.overlay.RenderableEntity;
public interface LayoutableRenderableEntity extends RenderableEntity public interface LayoutableRenderableEntity extends RenderableEntity
{ {
Rectangle getBounds(); Rectangle getBounds();
void setPreferredLocation(Point position); void setPreferredLocation(Point position);
void setPreferredSize(Dimension dimension); void setPreferredSize(Dimension dimension);
} }

View File

@@ -61,10 +61,10 @@ public class PanelComponent implements LayoutableRenderableEntity
@Setter @Setter
private Rectangle border = new Rectangle( private Rectangle border = new Rectangle(
ComponentConstants.STANDARD_BORDER, ComponentConstants.STANDARD_BORDER,
ComponentConstants.STANDARD_BORDER, ComponentConstants.STANDARD_BORDER,
ComponentConstants.STANDARD_BORDER, ComponentConstants.STANDARD_BORDER,
ComponentConstants.STANDARD_BORDER); ComponentConstants.STANDARD_BORDER);
@Setter @Setter
private Point gap = new Point(0, 0); private Point gap = new Point(0, 0);
@@ -81,8 +81,8 @@ public class PanelComponent implements LayoutableRenderableEntity
// Calculate panel dimension // Calculate panel dimension
final Dimension dimension = new Dimension( final Dimension dimension = new Dimension(
border.x + childDimensions.width + border.width, border.x + childDimensions.width + border.width,
border.y + childDimensions.height + border.height); border.y + childDimensions.height + border.height);
// Render background // Render background
if (backgroundColor != null) if (backgroundColor != null)
@@ -103,15 +103,15 @@ public class PanelComponent implements LayoutableRenderableEntity
// Create child preferred size // Create child preferred size
final Dimension childPreferredSize = new Dimension( final Dimension childPreferredSize = new Dimension(
preferredSize.width - border.x - border.width, preferredSize.width - border.x - border.width,
preferredSize.height - border.y - border.height); preferredSize.height - border.y - border.height);
// Calculate max width/height for infoboxes // Calculate max width/height for infoboxes
int totalHeight = 0; int totalHeight = 0;
int totalWidth = 0; int totalWidth = 0;
// Render all children // Render all children
for (int i = 0; i < children.size(); i ++) for (int i = 0; i < children.size(); i++)
{ {
final LayoutableRenderableEntity child = children.get(i); final LayoutableRenderableEntity child = children.get(i);
child.setPreferredLocation(new Point(x, y)); child.setPreferredLocation(new Point(x, y));
@@ -136,7 +136,7 @@ public class PanelComponent implements LayoutableRenderableEntity
totalWidth = Math.max(totalWidth, width); totalWidth = Math.max(totalWidth, width);
totalHeight = Math.max(totalHeight, height); totalHeight = Math.max(totalHeight, height);
if (wrapping > 0 && i < children.size() - 1 && (i + 1) % wrapping == 0) if (wrapping > 0 && i < children.size() - 1 && (i + 1) % wrapping == 0)
{ {
switch (orientation) switch (orientation)
{ {

View File

@@ -154,7 +154,7 @@ public class TooltipComponent implements RenderableEntity
// Draw trailing text (after last tag) // Draw trailing text (after last tag)
final TextComponent textComponent = new TextComponent(); final TextComponent textComponent = new TextComponent();
textComponent.setColor(nextColor); textComponent.setColor(nextColor);
textComponent.setText(line.substring(begin, line.length())); textComponent.setText(line.substring(begin));
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent)); textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
textComponent.render(graphics); textComponent.render(graphics);
} }
@@ -194,7 +194,7 @@ public class TooltipComponent implements RenderableEntity
} }
// Include trailing text (after last tag) // Include trailing text (after last tag)
textWidth += metrics.stringWidth(line.substring(begin, line.length())); textWidth += metrics.stringWidth(line.substring(begin));
return textWidth; return textWidth;
} }

View File

@@ -100,7 +100,7 @@ public class InfoBoxManager
public void cull() public void cull()
{ {
boolean culled = false; boolean culled = false;
for (Iterator<InfoBox> it = infoBoxes.iterator(); it.hasNext();) for (Iterator<InfoBox> it = infoBoxes.iterator(); it.hasNext(); )
{ {
InfoBox box = it.next(); InfoBox box = it.next();

View File

@@ -181,6 +181,7 @@ public class WorldMapOverlay extends Overlay
/** /**
* Get the screen coordinates for a WorldPoint on the world map * Get the screen coordinates for a WorldPoint on the world map
*
* @param worldPoint WorldPoint to get screen coordinates of * @param worldPoint WorldPoint to get screen coordinates of
* @return Point of screen coordinates of the center of the world point * @return Point of screen coordinates of the center of the world point
*/ */
@@ -230,8 +231,8 @@ public class WorldMapOverlay extends Overlay
* Gets a clip area which excludes the area of widgets which overlay the world map. * Gets a clip area which excludes the area of widgets which overlay the world map.
* *
* @param baseRectangle The base area to clip from * @param baseRectangle The base area to clip from
* @return An {@link Area} representing <code>baseRectangle</code>, with the area * @return An {@link Area} representing <code>baseRectangle</code>, with the area
* of visible widgets overlaying the world map clipped from it. * of visible widgets overlaying the world map clipped from it.
*/ */
private Area getWorldMapClipArea(Rectangle baseRectangle) private Area getWorldMapClipArea(Rectangle baseRectangle)
{ {

View File

@@ -43,7 +43,7 @@ public class ColorUtil
* Creates a color tag from the given color. * Creates a color tag from the given color.
* *
* @param color The Color to create a tag from. * @param color The Color to create a tag from.
* @return A string of the color tag for the given color. * @return A string of the color tag for the given color.
*/ */
public static String colorTag(Color color) public static String colorTag(Color color)
{ {
@@ -55,7 +55,7 @@ public class ColorUtil
* *
* @param str The string to be colorized. * @param str The string to be colorized.
* @param color The color to be used in the color tag. * @param color The color to be used in the color tag.
* @return The passed str with a prepended color tag. * @return The passed str with a prepended color tag.
*/ */
public static String prependColorTag(final String str, final Color color) public static String prependColorTag(final String str, final Color color)
{ {
@@ -67,7 +67,7 @@ public class ColorUtil
* *
* @param str The string to be colorized. * @param str The string to be colorized.
* @param color The color to be used in the color tag. * @param color The color to be used in the color tag.
* @return The passed str wrapped with opening and closing color tags. * @return The passed str wrapped with opening and closing color tags.
*/ */
public static String wrapWithColorTag(final String str, final Color color) public static String wrapWithColorTag(final String str, final Color color)
{ {
@@ -78,7 +78,7 @@ public class ColorUtil
* Converts a given color to it's hexidecimal equivalent. * Converts a given color to it's hexidecimal equivalent.
* *
* @param color Color to get hexidecimal string from. * @param color Color to get hexidecimal string from.
* @return Hexidecimal string representing the given color, in the form "#abcdef". * @return Hexidecimal string representing the given color, in the form "#abcdef".
*/ */
public static String toHexColor(final Color color) public static String toHexColor(final Color color)
{ {
@@ -91,7 +91,7 @@ public class ColorUtil
* @param a first color * @param a first color
* @param b second color * @param b second color
* @param t factor * @param t factor
* @return interpolated color * @return interpolated color
*/ */
public static Color colorLerp(final Color a, final Color b, final double t) public static Color colorLerp(final Color a, final Color b, final double t)
{ {
@@ -113,7 +113,7 @@ public class ColorUtil
* Gets the RGB hex color code of the passed color. * Gets the RGB hex color code of the passed color.
* *
* @param color The color to get a hex code from. * @param color The color to get a hex code from.
* @return A lower-cased string of the RGB hex code of color. * @return A lower-cased string of the RGB hex code of color.
*/ */
public static String colorToHexCode(final Color color) public static String colorToHexCode(final Color color)
{ {
@@ -124,7 +124,7 @@ public class ColorUtil
* Gets the ARGB hex color code of the passed color. * Gets the ARGB hex color code of the passed color.
* *
* @param color The color to get a hex code from. * @param color The color to get a hex code from.
* @return A lower-cased string of the ARGB hex code of color. * @return A lower-cased string of the ARGB hex code of color.
*/ */
public static String colorToAlphaHexCode(final Color color) public static String colorToAlphaHexCode(final Color color)
{ {
@@ -145,7 +145,7 @@ public class ColorUtil
* Determines if the passed hex string is an alpha hex color. * Determines if the passed hex string is an alpha hex color.
* *
* @param hex The hex to test. * @param hex The hex to test.
* @return boolean * @return boolean
*/ */
public static boolean isAlphaHex(String hex) public static boolean isAlphaHex(String hex)
{ {
@@ -156,7 +156,7 @@ public class ColorUtil
* Determines if the passed hex string is a hex color. * Determines if the passed hex string is a hex color.
* *
* @param hex The hex to test. * @param hex The hex to test.
* @return boolean * @return boolean
*/ */
public static boolean isHex(String hex) public static boolean isHex(String hex)
{ {
@@ -167,7 +167,7 @@ public class ColorUtil
* Limits an int to the rgba value range (0-255) * Limits an int to the rgba value range (0-255)
* *
* @param value The value for the r, g, b, or a. * @param value The value for the r, g, b, or a.
* @return An int between 0 - 255. * @return An int between 0 - 255.
*/ */
public static int constrainValue(int value) public static int constrainValue(int value)
{ {
@@ -178,7 +178,7 @@ public class ColorUtil
* Gets the Color from the passed int string. * Gets the Color from the passed int string.
* *
* @param string The int to get a Color object from. * @param string The int to get a Color object from.
* @return A Color of the int of color. * @return A Color of the int of color.
*/ */
public static Color fromString(String string) public static Color fromString(String string)
{ {
@@ -197,7 +197,7 @@ public class ColorUtil
* Gets the Color from the passed hex string. * Gets the Color from the passed hex string.
* *
* @param hex The hex to get a Color object from. * @param hex The hex to get a Color object from.
* @return A Color of the hex code of color. * @return A Color of the hex code of color.
*/ */
public static Color fromHex(String hex) public static Color fromHex(String hex)
{ {
@@ -230,6 +230,7 @@ public class ColorUtil
/** /**
* Creates color from passed object hash code * Creates color from passed object hash code
*
* @param object object with hashCode * @param object object with hashCode
* @return color * @return color
*/ */

View File

@@ -38,9 +38,9 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Predicate;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.GrayFilter; import javax.swing.GrayFilter;
import java.util.function.Predicate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.IndexedSprite; import net.runelite.api.IndexedSprite;
@@ -56,7 +56,7 @@ public class ImageUtil
* Creates a {@link BufferedImage} from an {@link Image}. * Creates a {@link BufferedImage} from an {@link Image}.
* *
* @param image An Image to be converted to a BufferedImage. * @param image An Image to be converted to a BufferedImage.
* @return A BufferedImage instance of the same given image. * @return A BufferedImage instance of the same given image.
*/ */
public static BufferedImage bufferedImageFromImage(final Image image) public static BufferedImage bufferedImageFromImage(final Image image)
{ {
@@ -78,7 +78,7 @@ public class ImageUtil
* @param image The image to be darkened or brightened. * @param image The image to be darkened or brightened.
* @param offset A signed 8-bit integer value to brighten or darken the image with. * @param offset A signed 8-bit integer value to brighten or darken the image with.
* Values above 0 will brighten, and values below 0 will darken. * Values above 0 will brighten, and values below 0 will darken.
* @return The given image with its brightness adjusted by the given offset. * @return The given image with its brightness adjusted by the given offset.
*/ */
public static BufferedImage grayscaleOffset(final BufferedImage image, final int offset) public static BufferedImage grayscaleOffset(final BufferedImage image, final int offset)
{ {
@@ -104,7 +104,7 @@ public class ImageUtil
* @param image The image to be darkened or brightened. * @param image The image to be darkened or brightened.
* @param percentage The ratio to darken or brighten the given image. * @param percentage The ratio to darken or brighten the given image.
* Values above 1 will brighten, and values below 1 will darken. * Values above 1 will brighten, and values below 1 will darken.
* @return The given image with its brightness scaled by the given percentage. * @return The given image with its brightness scaled by the given percentage.
*/ */
public static BufferedImage grayscaleOffset(final BufferedImage image, final float percentage) public static BufferedImage grayscaleOffset(final BufferedImage image, final float percentage)
{ {
@@ -130,7 +130,7 @@ public class ImageUtil
* @param offset A signed 8-bit integer value to modify the image's alpha component with. * @param offset A signed 8-bit integer value to modify the image's alpha component with.
* Values above 0 will increase transparency, and values below 0 will decrease * Values above 0 will increase transparency, and values below 0 will decrease
* transparency. * transparency.
* @return The given image with its alpha component adjusted by the given offset. * @return The given image with its alpha component adjusted by the given offset.
*/ */
public static BufferedImage alphaOffset(final BufferedImage image, final int offset) public static BufferedImage alphaOffset(final BufferedImage image, final int offset)
{ {
@@ -152,7 +152,7 @@ public class ImageUtil
* @param percentage The ratio to modify the image's alpha component with. * @param percentage The ratio to modify the image's alpha component with.
* Values above 1 will increase transparency, and values below 1 will decrease * Values above 1 will increase transparency, and values below 1 will decrease
* transparency. * transparency.
* @return The given image with its alpha component scaled by the given percentage. * @return The given image with its alpha component scaled by the given percentage.
*/ */
public static BufferedImage alphaOffset(final BufferedImage image, final float percentage) public static BufferedImage alphaOffset(final BufferedImage image, final float percentage)
{ {
@@ -170,7 +170,7 @@ public class ImageUtil
* Creates a grayscale image from the given image. * Creates a grayscale image from the given image.
* *
* @param image The source image to be converted. * @param image The source image to be converted.
* @return A copy of the given imnage, with colors converted to grayscale. * @return A copy of the given imnage, with colors converted to grayscale.
*/ */
public static BufferedImage grayscaleImage(final BufferedImage image) public static BufferedImage grayscaleImage(final BufferedImage image)
{ {
@@ -181,8 +181,8 @@ public class ImageUtil
/** /**
* Re-size a BufferedImage to the given dimensions. * Re-size a BufferedImage to the given dimensions.
* *
* @param image the BufferedImage. * @param image the BufferedImage.
* @param newWidth The width to set the BufferedImage to. * @param newWidth The width to set the BufferedImage to.
* @param newHeight The height to set the BufferedImage to. * @param newHeight The height to set the BufferedImage to.
* @return The BufferedImage with the specified dimensions * @return The BufferedImage with the specified dimensions
*/ */
@@ -198,7 +198,7 @@ public class ImageUtil
* @param image The image whose canvas should be re-sized. * @param image The image whose canvas should be re-sized.
* @param newWidth The width to set the BufferedImage to. * @param newWidth The width to set the BufferedImage to.
* @param newHeight The height to set the BufferedImage to. * @param newHeight The height to set the BufferedImage to.
* @return The BufferedImage centered within canvas of given dimensions. * @return The BufferedImage centered within canvas of given dimensions.
*/ */
public static BufferedImage resizeCanvas(final BufferedImage image, final int newWidth, final int newHeight) public static BufferedImage resizeCanvas(final BufferedImage image, final int newWidth, final int newHeight)
{ {
@@ -217,7 +217,7 @@ public class ImageUtil
* *
* @param image The image to be rotated. * @param image The image to be rotated.
* @param theta The number of radians to rotate the image. * @param theta The number of radians to rotate the image.
* @return The given image, rotated by the given theta. * @return The given image, rotated by the given theta.
*/ */
public static BufferedImage rotateImage(final BufferedImage image, final double theta) public static BufferedImage rotateImage(final BufferedImage image, final double theta)
{ {
@@ -233,7 +233,7 @@ public class ImageUtil
* @param image The image to be flipped. * @param image The image to be flipped.
* @param horizontal Whether the image should be flipped horizontally. * @param horizontal Whether the image should be flipped horizontally.
* @param vertical Whether the image should be flipped vertically. * @param vertical Whether the image should be flipped vertically.
* @return The given image, flipped horizontally and/or vertically. * @return The given image, flipped horizontally and/or vertically.
*/ */
public static BufferedImage flipImage(final BufferedImage image, final boolean horizontal, final boolean vertical) public static BufferedImage flipImage(final BufferedImage image, final boolean horizontal, final boolean vertical)
{ {
@@ -268,7 +268,7 @@ public class ImageUtil
* *
* @param image The image to be outlined. * @param image The image to be outlined.
* @param color The color to use for the outline. * @param color The color to use for the outline.
* @return The BufferedImage with its edges outlined with the given color. * @return The BufferedImage with its edges outlined with the given color.
*/ */
public static BufferedImage outlineImage(final BufferedImage image, final Color color) public static BufferedImage outlineImage(final BufferedImage image, final Color color)
{ {
@@ -282,7 +282,7 @@ public class ImageUtil
* @param image The image to be outlined. * @param image The image to be outlined.
* @param color The color to use for the outline. * @param color The color to use for the outline.
* @param fillCondition The predicate to be consumed by {@link #fillImage(BufferedImage, Color, Predicate) fillImage(BufferedImage, Color, Predicate)} * @param fillCondition The predicate to be consumed by {@link #fillImage(BufferedImage, Color, Predicate) fillImage(BufferedImage, Color, Predicate)}
* @return The BufferedImage with its edges outlined with the given color. * @return The BufferedImage with its edges outlined with the given color.
*/ */
public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition) public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition)
{ {
@@ -296,8 +296,8 @@ public class ImageUtil
* @param image The image to be outlined. * @param image The image to be outlined.
* @param color The color to use for the outline. * @param color The color to use for the outline.
* @param outlineCorners Whether to draw an outline around corners, or only around edges. * @param outlineCorners Whether to draw an outline around corners, or only around edges.
* @return The BufferedImage with its edges--and optionally, corners--outlined * @return The BufferedImage with its edges--and optionally, corners--outlined
* with the given color. * with the given color.
*/ */
public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Boolean outlineCorners) public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Boolean outlineCorners)
{ {
@@ -312,8 +312,8 @@ public class ImageUtil
* @param color The color to use for the outline. * @param color The color to use for the outline.
* @param fillCondition The predicate to be consumed by {@link #fillImage(BufferedImage, Color, Predicate) fillImage(BufferedImage, Color, Predicate)} * @param fillCondition The predicate to be consumed by {@link #fillImage(BufferedImage, Color, Predicate) fillImage(BufferedImage, Color, Predicate)}
* @param outlineCorners Whether to draw an outline around corners, or only around edges. * @param outlineCorners Whether to draw an outline around corners, or only around edges.
* @return The BufferedImage with its edges--and optionally, corners--outlined * @return The BufferedImage with its edges--and optionally, corners--outlined
* with the given color. * with the given color.
*/ */
public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition, final Boolean outlineCorners) public static BufferedImage outlineImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition, final Boolean outlineCorners)
{ {
@@ -347,7 +347,7 @@ public class ImageUtil
* *
* @param c The class to be referenced for resource path. * @param c The class to be referenced for resource path.
* @param path The path, relative to the given class. * @param path The path, relative to the given class.
* @return A {@link BufferedImage} of the loaded image resource from the given path. * @return A {@link BufferedImage} of the loaded image resource from the given path.
*/ */
public static BufferedImage getResourceStreamFromClass(final Class c, final String path) public static BufferedImage getResourceStreamFromClass(final Class c, final String path)
{ {
@@ -369,7 +369,7 @@ public class ImageUtil
* *
* @param image The image which should have its non-transparent pixels filled. * @param image The image which should have its non-transparent pixels filled.
* @param color The color with which to fill pixels. * @param color The color with which to fill pixels.
* @return The given image with all non-transparent pixels set to the given color. * @return The given image with all non-transparent pixels set to the given color.
*/ */
public static BufferedImage fillImage(final BufferedImage image, final Color color) public static BufferedImage fillImage(final BufferedImage image, final Color color)
{ {
@@ -377,14 +377,14 @@ public class ImageUtil
} }
/** /**
* Fills pixels of the given image with the given color based on a given fill condition * Fills pixels of the given image with the given color based on a given fill condition
* predicate. * predicate.
* *
* @param image The image which should have its non-transparent pixels filled. * @param image The image which should have its non-transparent pixels filled.
* @param color The color with which to fill pixels. * @param color The color with which to fill pixels.
* @param fillCondition The condition on which to fill pixels with the given color. * @param fillCondition The condition on which to fill pixels with the given color.
* @return The given image with all pixels fulfilling the fill condition predicate * @return The given image with all pixels fulfilling the fill condition predicate
* set to the given color. * set to the given color.
*/ */
static BufferedImage fillImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition) static BufferedImage fillImage(final BufferedImage image, final Color color, final Predicate<Color> fillCondition)
{ {
@@ -411,7 +411,7 @@ public class ImageUtil
* @param image The image to be adjusted. * @param image The image to be adjusted.
* @param scales An array of scale operations to be performed on the image's color components. * @param scales An array of scale operations to be performed on the image's color components.
* @param offsets An array of offset operations to be performed on the image's color components. * @param offsets An array of offset operations to be performed on the image's color components.
* @return The modified image after applying the given adjustments. * @return The modified image after applying the given adjustments.
*/ */
private static BufferedImage offset(final BufferedImage image, final float[] scales, final float[] offsets) private static BufferedImage offset(final BufferedImage image, final float[] scales, final float[] offsets)
{ {
@@ -421,9 +421,10 @@ public class ImageUtil
/** /**
* Converts the buffered image into a sprite image and returns it * Converts the buffered image into a sprite image and returns it
*
* @param image The image to be converted * @param image The image to be converted
* @param client Current client instance * @param client Current client instance
* @return The buffered image as a sprite image * @return The buffered image as a sprite image
*/ */
public static SpritePixels getImageSpritePixels(BufferedImage image, Client client) public static SpritePixels getImageSpritePixels(BufferedImage image, Client client)
{ {
@@ -455,12 +456,12 @@ public class ImageUtil
/** /**
* Converts an image into an {@code IndexedSprite} instance. * Converts an image into an {@code IndexedSprite} instance.
* * <p>
* The passed in image can only have at max 255 different colors. * The passed in image can only have at max 255 different colors.
* *
* @param image The image to be converted * @param image The image to be converted
* @param client Current client instance * @param client Current client instance
* @return The image as an {@code IndexedSprite} * @return The image as an {@code IndexedSprite}
*/ */
public static IndexedSprite getImageIndexedSprite(BufferedImage image, Client client) public static IndexedSprite getImageIndexedSprite(BufferedImage image, Client client)
{ {

View File

@@ -48,6 +48,7 @@ public class LinkBrowser
/** /**
* Tries to navigate to specified URL in browser. In case operation fails, displays message box with message * Tries to navigate to specified URL in browser. In case operation fails, displays message box with message
* and copies link to clipboard to navigate to. * and copies link to clipboard to navigate to.
*
* @param url url to open * @param url url to open
* @return true if operation was successful * @return true if operation was successful
*/ */
@@ -131,6 +132,7 @@ public class LinkBrowser
/** /**
* Open swing message box with specified message and copy data to clipboard * Open swing message box with specified message and copy data to clipboard
*
* @param message message to show * @param message message to show
*/ */
private static void showMessageBox(final String message, final String data) private static void showMessageBox(final String message, final String data)

View File

@@ -109,8 +109,8 @@ public class MenuUtil
private static MenuEntry findOptionTarget(Stream<MenuEntry> stream, String option, String target) private static MenuEntry findOptionTarget(Stream<MenuEntry> stream, String option, String target)
{ {
Optional<MenuEntry> maybeEntry = stream.filter(e -> Text.standardize(e.getOption()).equals(option) && Optional<MenuEntry> maybeEntry = stream.filter(e -> Text.standardize(e.getOption()).equals(option) &&
Text.standardize(e.getTarget()).equals(target)) Text.standardize(e.getTarget()).equals(target))
/* autism */ .findFirst(); /* autism */.findFirst();
return maybeEntry.orElse(null); return maybeEntry.orElse(null);
} }
@@ -118,8 +118,8 @@ public class MenuUtil
private static MenuEntry findOptionTargetLenient(Stream<MenuEntry> stream, String option, String target) private static MenuEntry findOptionTargetLenient(Stream<MenuEntry> stream, String option, String target)
{ {
Optional<MenuEntry> maybeEntry = stream.filter(e -> Text.standardize(e.getOption()).contains(option) && Optional<MenuEntry> maybeEntry = stream.filter(e -> Text.standardize(e.getOption()).contains(option) &&
Text.standardize(e.getTarget()).contains(target)) Text.standardize(e.getTarget()).contains(target))
/* autism */ .findFirst(); /* autism */.findFirst();
return maybeEntry.orElse(null); return maybeEntry.orElse(null);
} }

View File

@@ -1,79 +1,92 @@
package net.runelite.client.util; package net.runelite.client.util;
import java.awt.Polygon;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import java.awt.*;
public class MiscUtils public class MiscUtils
{ {
private static int[] abovePointsX = { 2944, 3392, 3392, 2944 }; private static int[] abovePointsX = {2944, 3392, 3392, 2944};
private static int[] abovePointsY = { 3523, 3523, 3971, 3971 }; private static int[] abovePointsY = {3523, 3523, 3971, 3971};
private static int[] belowPointsX = { 2944, 2944, 3264, 3264 }; private static int[] belowPointsX = {2944, 2944, 3264, 3264};
private static int[] belowPointsY = { 9918, 10360, 10360, 9918 }; private static int[] belowPointsY = {9918, 10360, 10360, 9918};
private static Polygon abovePoly = new Polygon(abovePointsX, abovePointsY, abovePointsX.length); private static Polygon abovePoly = new Polygon(abovePointsX, abovePointsY, abovePointsX.length);
private static Polygon belowPoly = new Polygon(belowPointsX, belowPointsY, belowPointsX.length); private static Polygon belowPoly = new Polygon(belowPointsX, belowPointsY, belowPointsX.length);
//test replacement so private for now //test replacement so private for now
private static boolean inWildy(WorldPoint point) private static boolean inWildy(WorldPoint point)
{ {
if (point == null) if (point == null)
return false; {
return false;
}
return abovePoly.contains(point.getX(), point.getY()) || belowPoly.contains(point.getX(), point.getY()); return abovePoly.contains(point.getX(), point.getY()) || belowPoly.contains(point.getX(), point.getY());
} }
public static int getWildernessLevelFrom(Client client, WorldPoint point) public static int getWildernessLevelFrom(Client client, WorldPoint point)
{ {
if (client == null) if (client == null)
return 0; {
return 0;
}
if (point == null) if (point == null)
return 0; {
return 0;
}
int x = point.getX(); int x = point.getX();
if (point.getPlane() == 0 && (x < 2940 || x > 3391)) if (point.getPlane() == 0 && (x < 2940 || x > 3391))
return 0; {
return 0;
}
int y = point.getY(); int y = point.getY();
//v underground //v above ground //v underground //v above ground
int wildernessLevel = clamp(y > 6400 ? ((y - 9920) / 8) + 1 : ((y - 3520) / 8) + 1, 0, 56); int wildernessLevel = clamp(y > 6400 ? ((y - 9920) / 8) + 1 : ((y - 3520) / 8) + 1, 0, 56);
if (point.getPlane() > 0) if (point.getPlane() > 0)
if (y < 9920) {
wildernessLevel = 0; if (y < 9920)
{
wildernessLevel = 0;
}
}
if (client.getWorldType().stream().anyMatch(worldType -> worldType == WorldType.PVP || worldType == WorldType.HIGH_RISK)) if (client.getWorldType().stream().anyMatch(worldType -> worldType == WorldType.PVP || worldType == WorldType.HIGH_RISK))
{ {
wildernessLevel += 15; wildernessLevel += 15;
} }
return Math.max(0, wildernessLevel); return Math.max(0, wildernessLevel);
} }
public static int clamp(int val, int min, int max) public static int clamp(int val, int min, int max)
{ {
return Math.max(min, Math.min(max, val)); return Math.max(min, Math.min(max, val));
} }
public static float clamp(float val, float min, float max) public static float clamp(float val, float min, float max)
{ {
return Math.max(min, Math.min(max, val)); return Math.max(min, Math.min(max, val));
} }
public static boolean inWilderness(Client client) public static boolean inWilderness(Client client)
{ {
Player localPlayer = client.getLocalPlayer(); Player localPlayer = client.getLocalPlayer();
if (localPlayer == null) if (localPlayer == null)
return false; {
return false;
}
return inWildy(localPlayer.getWorldLocation()); return inWildy(localPlayer.getWorldLocation());
//return getWildernessLevelFrom(client, localPlayer.getWorldLocation()) > 0; //return getWildernessLevelFrom(client, localPlayer.getWorldLocation()) > 0;
} }
} }

View File

@@ -30,82 +30,84 @@ import org.apache.commons.lang3.ArrayUtils;
public class PvPUtil public class PvPUtil
{ {
/** /**
* Gets the wilderness level based on a world point * Gets the wilderness level based on a world point
* @param point the point in the world to get the wilderness level for *
* @return the int representing the wilderness level * @param point the point in the world to get the wilderness level for
*/ * @return the int representing the wilderness level
public static int getWildernessLevelFrom(WorldPoint point) */
{ public static int getWildernessLevelFrom(WorldPoint point)
int x = point.getX(); {
int y = point.getY(); int x = point.getX();
int y = point.getY();
int underLevel = ((y - 9920) / 8) + 1; int underLevel = ((y - 9920) / 8) + 1;
int upperLevel = ((y - 3520) / 8) + 1; int upperLevel = ((y - 3520) / 8) + 1;
return y > 6400 ? underLevel : upperLevel; return y > 6400 ? underLevel : upperLevel;
} }
/** /**
* Determines if another player is attackable based off of wilderness level and combat levels * Determines if another player is attackable based off of wilderness level and combat levels
* @param client The client of the local player *
* @param player the player to determine attackability * @param client The client of the local player
* @return returns true if the player is attackable, false otherwise * @param player the player to determine attackability
*/ * @return returns true if the player is attackable, false otherwise
public static boolean isAttackable(Client client, Player player) */
{ public static boolean isAttackable(Client client, Player player)
int wildernessLevel = 0; {
if (!(client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType()))) int wildernessLevel = 0;
{ if (!(client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(client.getWorldType())))
return false; {
} return false;
if (WorldType.isPvpWorld(client.getWorldType())) }
{ if (WorldType.isPvpWorld(client.getWorldType()))
if (client.getVar(Varbits.IN_WILDERNESS) != 1) {
{ if (client.getVar(Varbits.IN_WILDERNESS) != 1)
return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) <= 15; {
} return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) <= 15;
wildernessLevel = 15; }
} wildernessLevel = 15;
return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) }
< (getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation())+ wildernessLevel); return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel())
} < (getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation()) + wildernessLevel);
}
public static int calculateRisk(Client client, ItemManager itemManager) public static int calculateRisk(Client client, ItemManager itemManager)
{ {
if (client.getItemContainer(InventoryID.EQUIPMENT) == null) if (client.getItemContainer(InventoryID.EQUIPMENT) == null)
{ {
return 0; return 0;
} }
if (client.getItemContainer(InventoryID.INVENTORY).getItems() == null) if (client.getItemContainer(InventoryID.INVENTORY).getItems() == null)
{ {
return 0; return 0;
} }
Item[] items = ArrayUtils.addAll(Objects.requireNonNull(client.getItemContainer(InventoryID.EQUIPMENT)).getItems(), Item[] items = ArrayUtils.addAll(Objects.requireNonNull(client.getItemContainer(InventoryID.EQUIPMENT)).getItems(),
Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems()); Objects.requireNonNull(client.getItemContainer(InventoryID.INVENTORY)).getItems());
TreeMap<Integer, Item> priceMap = new TreeMap<>(Comparator.comparingInt(Integer::intValue)); TreeMap<Integer, Item> priceMap = new TreeMap<>(Comparator.comparingInt(Integer::intValue));
int wealth = 0; int wealth = 0;
for (Item i : items) for (Item i : items)
{ {
int value = (itemManager.getItemPrice(i.getId()) * i.getQuantity()); int value = (itemManager.getItemPrice(i.getId()) * i.getQuantity());
final ItemComposition itemComposition = itemManager.getItemComposition(i.getId()); final ItemComposition itemComposition = itemManager.getItemComposition(i.getId());
if (!itemComposition.isTradeable() && value == 0) if (!itemComposition.isTradeable() && value == 0)
{ {
value = itemComposition.getPrice() * i.getQuantity(); value = itemComposition.getPrice() * i.getQuantity();
priceMap.put(value, i); priceMap.put(value, i);
} }
else else
{ {
value = itemManager.getItemPrice(i.getId()) * i.getQuantity(); value = itemManager.getItemPrice(i.getId()) * i.getQuantity();
if (i.getId() > 0 && value > 0) if (i.getId() > 0 && value > 0)
{ {
priceMap.put(value, i); priceMap.put(value, i);
} }
} }
wealth += value; wealth += value;
} }
return Integer.parseInt(quantityToRSDecimalStack(priceMap.keySet().stream().mapToInt(Integer::intValue).sum())); return Integer.parseInt(quantityToRSDecimalStack(priceMap.keySet().stream().mapToInt(Integer::intValue).sum()));
} }
} }

View File

@@ -38,7 +38,7 @@ public class RefUtils implements Opcodes
public static boolean isReturn(int opcode, boolean checkType) public static boolean isReturn(int opcode, boolean checkType)
{ {
return (opcode == RETURN && !checkType) || opcode == IRETURN || opcode == LRETURN || opcode == DRETURN || return (opcode == RETURN && !checkType) || opcode == IRETURN || opcode == LRETURN || opcode == DRETURN ||
opcode == ARETURN || opcode == FRETURN; opcode == ARETURN || opcode == FRETURN;
} }
public static boolean isReturn(int opcode) public static boolean isReturn(int opcode)

View File

@@ -173,7 +173,7 @@ public class StackFormatter
* <p> * <p>
* *
* @param quantity The quantity to convert. * @param quantity The quantity to convert.
* @param precise If true, the returned string will have thousandths precision if quantity is larger than 1 million. * @param precise If true, the returned string will have thousandths precision if quantity is larger than 1 million.
* @return The stack size as it would appear in RS, with decimals, * @return The stack size as it would appear in RS, with decimals,
* with K after 100,000 and M after 10,000,000 * with K after 100,000 and M after 10,000,000
*/ */

View File

@@ -81,8 +81,8 @@ public class Text
/** /**
* In addition to removing all tags, replaces nbsp with space, trims string and lowercases it * In addition to removing all tags, replaces nbsp with space, trims string and lowercases it
* @param str The string to standardize
* *
* @param str The string to standardize
* @return The given `str` that is standardized * @return The given `str` that is standardized
*/ */
public static String standardize(String str) public static String standardize(String str)
@@ -166,9 +166,9 @@ public class Text
* converts enum name format from THIS_FORMAT to This Format. * converts enum name format from THIS_FORMAT to This Format.
* *
* @param o an enum * @param o an enum
* @return the enum's name in title case, * @return the enum's name in title case,
* or if it overrides toString, * or if it overrides toString,
* the value returned by toString * the value returned by toString
*/ */
public static String titleCase(Enum o) public static String titleCase(Enum o)
{ {

View File

@@ -18,7 +18,7 @@ public enum WildernessLocation
MAGE_BANK("Mage Bank", new Location(3082, 3960, 3103, 3952), 0), MAGE_BANK("Mage Bank", new Location(3082, 3960, 3103, 3952), 0),
MAGE_ARENA("Mage Arena", new Location(3088, 3949, 3123, 3919), 0), MAGE_ARENA("Mage Arena", new Location(3088, 3949, 3123, 3919), 0),
LEVER("Lever", new Location(3149, 3933, 3162, 3917), 0), LEVER("Lever", new Location(3149, 3933, 3162, 3917), 0),
WEB("Web", new Location(3153, 3961, 3163, 3948), 0), WEB("Web", new Location(3153, 3961, 3163, 3948), 0),
RESOURCE_ARENA("Resource Arena", new Location(3174, 3946, 3195, 3923), 0), RESOURCE_ARENA("Resource Arena", new Location(3174, 3946, 3195, 3923), 0),
AXE_HUT("Axe Hut", new Location(3187, 3962, 3194, 3957), 0), AXE_HUT("Axe Hut", new Location(3187, 3962, 3194, 3957), 0),
SCORPIA("Scorpia", new Location(3216, 3949, 3248, 3935), 0), SCORPIA("Scorpia", new Location(3216, 3949, 3248, 3935), 0),
@@ -46,7 +46,7 @@ public enum WildernessLocation
CHAOS_TEMPLE("Chaos Temple", new Location(3220, 3632, 3255, 3593), 0), CHAOS_TEMPLE("Chaos Temple", new Location(3220, 3632, 3255, 3593), 0),
NINETEEN_OBELISK("19s", new Location(3220, 3672, 3234, 3660), 0), NINETEEN_OBELISK("19s", new Location(3220, 3672, 3234, 3660), 0),
CORP_CAVE("Corp Cave", new Location(3201, 3684, 3219, 3672), 0), CORP_CAVE("Corp Cave", new Location(3201, 3684, 3219, 3672), 0),
THIRTEEN_OBELISK("13s", new Location(3145, 3628, 3168, 3609), 0), THIRTEEN_OBELISK("13s", new Location(3145, 3628, 3168, 3609), 0),
SOUTH_REV_ENTRANCE("Lvl 18 Rev Ent", new Location(3071, 3660, 3092, 3645), 0), SOUTH_REV_ENTRANCE("Lvl 18 Rev Ent", new Location(3071, 3660, 3092, 3645), 0),
GRAVES("Graves", new Location(3128, 3686, 3181, 3658), 0), GRAVES("Graves", new Location(3128, 3686, 3181, 3658), 0),
GRAVEYARD_DRAGS("Graveyard Drags", new Location(3129, 3717, 3172, 3691), 0), GRAVEYARD_DRAGS("Graveyard Drags", new Location(3129, 3717, 3172, 3691), 0),
@@ -70,6 +70,7 @@ public enum WildernessLocation
private final String name; private final String name;
@Getter @Getter
private final WorldArea worldArea; private final WorldArea worldArea;
WildernessLocation(String name, Location location, int plane) WildernessLocation(String name, Location location, int plane)
{ {
this.name = name; this.name = name;
@@ -82,6 +83,7 @@ public enum WildernessLocation
public int y; public int y;
public int width; public int width;
public int height; public int height;
Location(int x, int y, int x1, int y1) Location(int x, int y, int x1, int y1)
{ {
this.x = x; this.x = x;

View File

@@ -35,6 +35,7 @@ public class WorldUtil
/** /**
* Converts http-api world types to runelite-api world types * Converts http-api world types to runelite-api world types
* TODO: Find a better way to handle these to not have duplicate interfaces * TODO: Find a better way to handle these to not have duplicate interfaces
*
* @param apiTypes http-api world types * @param apiTypes http-api world types
* @return runelite-api world types * @return runelite-api world types
*/ */

View File

@@ -34,9 +34,7 @@ import net.runelite.api.ChatMessageType;
import static net.runelite.api.ChatMessageType.GAMEMESSAGE; import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.MessageNode; import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;