Merge pull request #3198 from open-osrs/upstream-1505
This commit is contained in:
@@ -236,8 +236,9 @@ public class WorldPoint
|
||||
|
||||
// find instance chunks using the template point. there might be more than one.
|
||||
List<WorldPoint> worldPoints = new ArrayList<>();
|
||||
final int z = worldPoint.getPlane();
|
||||
int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
|
||||
for (int z = 0; z < instanceTemplateChunks.length; z++)
|
||||
{
|
||||
for (int x = 0; x < instanceTemplateChunks[z].length; ++x)
|
||||
{
|
||||
for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y)
|
||||
@@ -246,17 +247,20 @@ public class WorldPoint
|
||||
int rotation = chunkData >> 1 & 0x3;
|
||||
int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
|
||||
int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
|
||||
int plane = chunkData >> 24 & 0x3;
|
||||
if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE
|
||||
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE)
|
||||
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE
|
||||
&& plane == worldPoint.getPlane())
|
||||
{
|
||||
WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)),
|
||||
client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)),
|
||||
worldPoint.getPlane());
|
||||
z);
|
||||
p = rotate(p, rotation);
|
||||
worldPoints.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return worldPoints;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public class GroundMarkerPlugin extends Plugin
|
||||
|
||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, selectedSceneTile.getLocalLocation());
|
||||
final int regionId = worldPoint.getRegionID();
|
||||
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), null, null);
|
||||
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), null, null);
|
||||
final boolean exists = getPoints(regionId).contains(point);
|
||||
|
||||
client.createMenuEntry(-1)
|
||||
@@ -302,7 +302,7 @@ public class GroundMarkerPlugin extends Plugin
|
||||
WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint);
|
||||
|
||||
int regionId = worldPoint.getRegionID();
|
||||
GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor(), null);
|
||||
GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), config.markerColor(), null);
|
||||
log.debug("Updating point: {} - {}", point, worldPoint);
|
||||
|
||||
List<GroundMarkerPoint> groundMarkerPoints = new ArrayList<>(getPoints(regionId));
|
||||
@@ -326,7 +326,7 @@ public class GroundMarkerPlugin extends Plugin
|
||||
WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, localPoint);
|
||||
final int regionId = worldPoint.getRegionID();
|
||||
|
||||
GroundMarkerPoint searchPoint = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), null, null);
|
||||
GroundMarkerPoint searchPoint = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), null, null);
|
||||
Collection<GroundMarkerPoint> points = getPoints(regionId);
|
||||
GroundMarkerPoint existing = points.stream()
|
||||
.filter(p -> p.equals(searchPoint))
|
||||
@@ -342,7 +342,7 @@ public class GroundMarkerPlugin extends Plugin
|
||||
{
|
||||
input = Strings.emptyToNull(input);
|
||||
|
||||
GroundMarkerPoint newPoint = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), existing.getColor(), input);
|
||||
GroundMarkerPoint newPoint = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane(), existing.getColor(), input);
|
||||
points.remove(searchPoint);
|
||||
points.add(newPoint);
|
||||
savePoints(regionId, points);
|
||||
|
||||
@@ -685,7 +685,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
.onClick(e ->
|
||||
{
|
||||
final String message = new ChatMessageBuilder()
|
||||
.append("The default left click option for '").append(composition.getName()).append("' ")
|
||||
.append("The default left click option for '").append(Text.removeTags(composition.getName())).append("' ")
|
||||
.append("has been set to '").append(actions[menuIdx]).append("'.")
|
||||
.build();
|
||||
|
||||
@@ -774,7 +774,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
.onClick(e ->
|
||||
{
|
||||
final String message = new ChatMessageBuilder()
|
||||
.append("The default left click option for '").append(composition.getName()).append("' ")
|
||||
.append("The default left click option for '").append(Text.removeTags(composition.getName())).append("' ")
|
||||
.append("has been set to '").append(actions[menuIdx]).append("'.")
|
||||
.build();
|
||||
|
||||
@@ -799,7 +799,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
.onClick(e ->
|
||||
{
|
||||
final String message = new ChatMessageBuilder()
|
||||
.append("The default left click option for '").append(composition.getName()).append("' ")
|
||||
.append("The default left click option for '").append(Text.removeTags(composition.getName())).append("' ")
|
||||
.append("has been reset.")
|
||||
.build();
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ public class ClientUI
|
||||
}
|
||||
|
||||
// Update config
|
||||
updateFrameConfig(true);
|
||||
updateFrameConfig(false);
|
||||
|
||||
// Create hide sidebar button
|
||||
|
||||
@@ -614,6 +614,8 @@ public class ClientUI
|
||||
|
||||
// Show frame
|
||||
frame.setVisible(true);
|
||||
// On macos setResizable needs to be called after setVisible
|
||||
frame.setResizable(!config.lockWindowSize());
|
||||
frame.toFront();
|
||||
requestFocus();
|
||||
log.info("Showing frame {}", frame);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import java.awt.Dimension;
|
||||
@@ -64,7 +63,6 @@ public class OverlayManager
|
||||
private static final String OVERLAY_CONFIG_PREFERRED_SIZE = "_preferredSize";
|
||||
private static final String RUNELITE_CONFIG_GROUP_NAME = RuneLiteConfig.class.getAnnotation(ConfigGroup.class).value();
|
||||
|
||||
@VisibleForTesting
|
||||
static final Comparator<Overlay> OVERLAY_COMPARATOR = (a, b) ->
|
||||
{
|
||||
final OverlayPosition aPos = MoreObjects.firstNonNull(a.getPreferredPosition(), a.getPosition());
|
||||
@@ -82,7 +80,7 @@ public class OverlayManager
|
||||
// For non-dynamic overlays, higher priority means
|
||||
// draw *earlier* so that they are closer to their
|
||||
// defined position.
|
||||
return aPos == OverlayPosition.DYNAMIC
|
||||
return aPos == OverlayPosition.DYNAMIC || aPos == OverlayPosition.DETACHED
|
||||
? a.getPriority().compareTo(b.getPriority())
|
||||
: b.getPriority().compareTo(a.getPriority());
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Ints;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
@@ -40,6 +41,7 @@ import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@@ -541,22 +543,24 @@ public class OverlayRenderer extends MouseAdapter
|
||||
{
|
||||
synchronized (overlayManager)
|
||||
{
|
||||
for (Overlay overlay : overlayManager.getOverlays())
|
||||
{
|
||||
if (overlay.getPosition() == OverlayPosition.DYNAMIC || overlay.getPosition() == OverlayPosition.TOOLTIP)
|
||||
{
|
||||
// render order is roughly: under -> manual -> above -> always on top
|
||||
final List<OverlayLayer> layerOrder = ImmutableList.of(OverlayLayer.UNDER_WIDGETS, OverlayLayer.MANUAL, OverlayLayer.ABOVE_WIDGETS, OverlayLayer.ALWAYS_ON_TOP);
|
||||
return overlayManager.getOverlays()
|
||||
.stream()
|
||||
// ABOVE_SCENE overlays aren't managed
|
||||
.filter(c -> layerOrder.contains(c.getLayer()))
|
||||
// never allow moving dynamic or tooltip overlays
|
||||
continue;
|
||||
.filter(c -> c.getPosition() != OverlayPosition.DYNAMIC && c.getPosition() != OverlayPosition.TOOLTIP)
|
||||
.sorted(
|
||||
Comparator.<Overlay>comparingInt(c -> layerOrder.indexOf(c.getLayer()))
|
||||
.thenComparing(OverlayManager.OVERLAY_COMPARATOR)
|
||||
// pick order is reversed from render order
|
||||
.reversed()
|
||||
)
|
||||
.filter(o -> o.getBounds().contains(mousePoint))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
final Rectangle bounds = overlay.getBounds();
|
||||
if (bounds.contains(mousePoint))
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,14 +42,16 @@ public class WidgetOverlay extends Overlay
|
||||
public static Collection<WidgetOverlay> createOverlays(final OverlayManager overlayManager, final Client client)
|
||||
{
|
||||
return Arrays.asList(
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_CHATBOX_PARENT, OverlayPosition.DETACHED),
|
||||
// classic resizable
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_CHATBOX_PARENT, OverlayPosition.DETACHED, OverlayPriority.HIGH),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_CHATBOX_PARENT, OverlayPosition.DETACHED, OverlayPriority.HIGH),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_PARENT, OverlayPosition.DETACHED),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_CHATBOX_PARENT, OverlayPosition.DETACHED),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_WIDGET, OverlayPosition.DETACHED, OverlayPriority.MED),
|
||||
// modern resizable
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_TABS1, OverlayPosition.DETACHED),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_TABS2, OverlayPosition.DETACHED),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_PARENT, OverlayPosition.DETACHED),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET, OverlayPosition.CANVAS_TOP_RIGHT),
|
||||
new WidgetOverlay(client, WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET, OverlayPosition.DETACHED, OverlayPriority.MED),
|
||||
// The client forces the oxygen bar below the xp tracker, so set its priority lower
|
||||
new WidgetOverlay(client, WidgetInfo.FOSSIL_ISLAND_OXYGENBAR, OverlayPosition.TOP_CENTER, OverlayPriority.HIGH),
|
||||
new XpTrackerWidgetOverlay(overlayManager, client, WidgetInfo.EXPERIENCE_TRACKER_WIDGET, OverlayPosition.TOP_RIGHT),
|
||||
|
||||
Reference in New Issue
Block a user