Various
Nothing real interesting. lol.
This commit is contained in:
@@ -40,6 +40,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.github.joonasvali.naturalmouse.api.MouseMotionFactory;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.plugins.flexo.FlexoOverlay;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import sun.awt.ComponentFactory;
|
||||
@@ -122,6 +123,10 @@ public class Flexo extends java.awt.Robot{
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void mouseMove(Point p) {
|
||||
mouseMove((int)p.getX(), (int)p.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void mousePress(int buttonID) {
|
||||
if (buttonID<1 || buttonID >5) {
|
||||
|
||||
@@ -6,13 +6,81 @@ import net.runelite.client.ui.ClientUI;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FlexoMouse {
|
||||
|
||||
/*
|
||||
Should pass unstretched coords, handles all conversions here.
|
||||
*/
|
||||
public static net.runelite.api.Point getClickPoint(Rectangle rect)
|
||||
public static Point getClickPoint(Rectangle rect)
|
||||
{
|
||||
if (rect!=null) {
|
||||
Random r = new Random();
|
||||
int x = -1;
|
||||
int y = -1;
|
||||
x = rect.x+r.nextInt(rect.width);
|
||||
y = rect.y+r.nextInt(rect.height);
|
||||
|
||||
if (Flexo.isStretched) {
|
||||
double wScale;
|
||||
double hScale;
|
||||
|
||||
if (Flexo.client.isResized()) {
|
||||
wScale = (Flexo.client.getStretchedDimensions().width / Flexo.client.getRealDimensions().width);
|
||||
hScale = (Flexo.client.getStretchedDimensions().height / Flexo.client.getRealDimensions().height);
|
||||
int newX = (int)(x*wScale);
|
||||
int newY = (int)(y*hScale);
|
||||
if (newX>0 && newX<ClientUI.frame.getWidth()) {
|
||||
if (newY>0 && newY<ClientUI.frame.getHeight()) {
|
||||
return new Point(newX, newY);
|
||||
}
|
||||
}
|
||||
Logger.getAnonymousLogger().warning("[RuneLit]Flexo - Off screen point attempted. Split the step, or rotate the screen.");
|
||||
return null;
|
||||
} else {
|
||||
if (x>0 && x<ClientUI.frame.getWidth()) {
|
||||
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;
|
||||
int widthDif = ClientUI.frame.getWidth();
|
||||
|
||||
if (ClientUI.pluginToolbar.isVisible()) {
|
||||
widthDif -= ClientUI.pluginToolbar.getWidth();
|
||||
}
|
||||
if (ClientUI.pluginPanel!=null)
|
||||
widthDif -= ClientUI.pluginPanel.getWidth();
|
||||
|
||||
widthDif -= fixedWidth;
|
||||
if (x+(widthDif/2)>0 && x+(widthDif/2)<ClientUI.frame.getWidth()) {
|
||||
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 (x>0 && x<ClientUI.frame.getWidth()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Rectangle getClickArea(Rectangle rect)
|
||||
{
|
||||
if (Flexo.isStretched)
|
||||
{
|
||||
@@ -27,22 +95,24 @@ public class FlexoMouse {
|
||||
hScale = ((double)Flexo.client.getStretchedDimensions().height) / Flexo.fixedHeight;
|
||||
}
|
||||
|
||||
int xPadding = (int)rect.getWidth()/8;
|
||||
int yPadding = (int)rect.getHeight()/8;
|
||||
int xPadding = (int)rect.getWidth()/5;
|
||||
int yPadding = (int)rect.getHeight()/5;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding;
|
||||
clickRect.height = rect.height-yPadding;
|
||||
clickRect.width = rect.width-xPadding*2;
|
||||
clickRect.height = rect.height-yPadding*2;
|
||||
clickRect.x = rect.x+xPadding;
|
||||
clickRect.y = rect.y+yPadding;
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
double tScale = 1 + (Flexo.scale / 100);
|
||||
if (clickRect.width>0&&clickRect.height>0) {
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
double tScale = 1 + (Flexo.scale / 100);
|
||||
|
||||
if (Flexo.client.isResized()) {
|
||||
return new net.runelite.api.Point( (int)(x * wScale * tScale), (int)(y * hScale * tScale));
|
||||
} else {
|
||||
return new net.runelite.api.Point( (int)(x * wScale), (int)(y * hScale));
|
||||
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), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,31 +128,119 @@ public class FlexoMouse {
|
||||
widthDif -= ClientUI.pluginPanel.getWidth();
|
||||
|
||||
widthDif -= fixedWidth;
|
||||
int xPadding = (int)rect.getWidth()/8;
|
||||
int yPadding = (int)rect.getHeight()/8;
|
||||
int xPadding = (int)rect.getWidth()/5;
|
||||
int yPadding = (int)rect.getHeight()/5;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding;
|
||||
clickRect.height = rect.height-yPadding;
|
||||
clickRect.x = rect.x+xPadding+(widthDif/2);
|
||||
clickRect.y = rect.y+yPadding;
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
return new net.runelite.api.Point(x, y);
|
||||
if (clickRect.height>0&&clickRect.width>0) {
|
||||
int x = clickRect.x + r.nextInt(clickRect.width);
|
||||
int y = clickRect.y + r.nextInt(clickRect.height);
|
||||
return new Rectangle((int) (clickRect.x), (int) (clickRect.y), (int) (clickRect.width), (int) (clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
//Resizable, not stretched
|
||||
else {
|
||||
int xPadding = (int)rect.getWidth()/8;
|
||||
int yPadding = (int)rect.getHeight()/8;
|
||||
int xPadding = (int)rect.getWidth()/5;
|
||||
int yPadding = (int)rect.getHeight()/5;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding*2;
|
||||
clickRect.height = rect.height-yPadding*2;
|
||||
clickRect.x = rect.x+xPadding;
|
||||
clickRect.y = rect.y+yPadding;
|
||||
if (clickRect.height>0&&clickRect.width>0) {
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
return new Rectangle((int)(clickRect.x), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Rectangle getGroundItemClickArea(Rectangle rect)
|
||||
{
|
||||
if (Flexo.isStretched)
|
||||
{
|
||||
double wScale;
|
||||
double hScale;
|
||||
|
||||
if (Flexo.client.isResized()) {
|
||||
wScale = (Flexo.client.getStretchedDimensions().width / Flexo.client.getRealDimensions().width);
|
||||
hScale = (Flexo.client.getStretchedDimensions().height / Flexo.client.getRealDimensions().height);
|
||||
} else {
|
||||
wScale = ((double)Flexo.client.getStretchedDimensions().width) / Flexo.fixedWidth;
|
||||
hScale = ((double)Flexo.client.getStretchedDimensions().height) / Flexo.fixedHeight;
|
||||
}
|
||||
|
||||
int xPadding = (int)rect.getWidth()/(int)wScale*3;
|
||||
int yPadding = (int)rect.getHeight()/(int)hScale*3;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding*2;
|
||||
clickRect.height = rect.height-yPadding*2;
|
||||
clickRect.x = rect.x+xPadding;
|
||||
clickRect.y = rect.y+yPadding;
|
||||
if (clickRect.width>0&&clickRect.height>0) {
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
double tScale = 1 + (Flexo.scale / 100);
|
||||
|
||||
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), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Fixed, not stretched
|
||||
else if (!Flexo.client.isResized()) {
|
||||
int fixedWidth = 765;
|
||||
int widthDif = ClientUI.frame.getWidth();
|
||||
|
||||
if (ClientUI.pluginToolbar.isVisible()) {
|
||||
widthDif -= ClientUI.pluginToolbar.getWidth();
|
||||
}
|
||||
if (ClientUI.pluginPanel!=null)
|
||||
widthDif -= ClientUI.pluginPanel.getWidth();
|
||||
|
||||
widthDif -= fixedWidth;
|
||||
int xPadding = (int)rect.getWidth()/3;
|
||||
int yPadding = (int)rect.getHeight()/3;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding;
|
||||
clickRect.height = rect.height-yPadding;
|
||||
clickRect.x = rect.x+xPadding+(widthDif/2);
|
||||
clickRect.y = rect.y+yPadding;
|
||||
if (clickRect.height>0&&clickRect.width>0) {
|
||||
int x = clickRect.x + r.nextInt(clickRect.width);
|
||||
int y = clickRect.y + r.nextInt(clickRect.height);
|
||||
return new Rectangle((int) (clickRect.x), (int) (clickRect.y), (int) (clickRect.width), (int) (clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
//Resizable, not stretched
|
||||
else {
|
||||
int xPadding = (int)rect.getWidth()/3;
|
||||
int yPadding = (int)rect.getHeight()/3;
|
||||
Random r = new Random();
|
||||
Rectangle clickRect = new Rectangle();
|
||||
clickRect.width = rect.width-xPadding*2;
|
||||
clickRect.height = rect.height-yPadding*2;
|
||||
clickRect.x = rect.x+xPadding;
|
||||
clickRect.y = rect.y+yPadding;
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
return new Point(x, y);
|
||||
if (clickRect.height>0&&clickRect.width>0) {
|
||||
int x = clickRect.x+r.nextInt(clickRect.width);
|
||||
int y = clickRect.y+r.nextInt(clickRect.height);
|
||||
return new Rectangle((int)(clickRect.x), (int)(clickRect.y), (int)(clickRect.width), (int)(clickRect.getHeight()));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.runelite.client.flexo;
|
||||
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.client.plugins.flexo.FlexoOverlay;
|
||||
|
||||
@@ -13,4 +14,10 @@ public class FlexoUtils {
|
||||
return clickArea;
|
||||
}
|
||||
|
||||
public static Rectangle getGameObjectClickArea(GameObject item) {
|
||||
Rectangle clickArea = item.getClickbox().getBounds();
|
||||
FlexoOverlay.clickArea = clickArea;
|
||||
return clickArea;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public
|
||||
class GroundItem
|
||||
{
|
||||
private int id;
|
||||
|
||||
@@ -158,7 +158,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
private Notifier notifier;
|
||||
|
||||
@Getter
|
||||
private final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
|
||||
public static final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
|
||||
private final Map<Integer, Color> priceChecks = new LinkedHashMap<>();
|
||||
private LoadingCache<String, Boolean> highlightedItems;
|
||||
private LoadingCache<String, Boolean> hiddenItems;
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ClientUI
|
||||
private static final String CONFIG_CLIENT_MAXIMIZED = "clientMaximized";
|
||||
private static final int CLIENT_WELL_HIDDEN_MARGIN = 160;
|
||||
private static final int CLIENT_WELL_HIDDEN_MARGIN_TOP = 10;
|
||||
public static boolean allowInput = false;
|
||||
public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runelite.png");
|
||||
|
||||
@Getter
|
||||
|
||||
Reference in New Issue
Block a user