From 151ea90b2fbf95ab1abf68a6300a7486ad118294 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 16:14:10 -0400 Subject: [PATCH] barrows plugin: remove minimap Removed at Jagex's request --- .../client/plugins/barrows/BarrowsConfig.java | 11 -- .../plugins/barrows/BarrowsOverlay.java | 134 +----------------- .../client/plugins/barrows/BarrowsPlugin.java | 97 +------------ 3 files changed, 2 insertions(+), 240 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java index 663e03fbb3..fe6a657e5e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsConfig.java @@ -32,17 +32,6 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("barrows") public interface BarrowsConfig extends Config { - @ConfigItem( - keyName = "showMinimap", - name = "Show Minimap in tunnels", - description = "Configures whether or not the minimap is displayed", - position = 0 - ) - default boolean showMinimap() - { - return true; - } - @ConfigItem( keyName = "showBrotherLoc", name = "Show Brothers location", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java index 4ecdebccf3..d430ef0c01 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsOverlay.java @@ -28,16 +28,9 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Rectangle; -import java.util.List; import javax.inject.Inject; import net.runelite.api.Client; -import net.runelite.api.GameObject; -import net.runelite.api.NPC; -import net.runelite.api.NPCComposition; -import net.runelite.api.ObjectComposition; import net.runelite.api.Perspective; -import net.runelite.api.Player; -import net.runelite.api.WallObject; import net.runelite.api.coords.LocalPoint; import net.runelite.api.widgets.Widget; import net.runelite.client.ui.overlay.Overlay; @@ -65,59 +58,9 @@ class BarrowsOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - Player local = client.getLocalPlayer(); - final Color npcColor = getMinimapDotColor(1); - final Color playerColor = getMinimapDotColor(2); Widget puzzleAnswer = plugin.getPuzzleAnswer(); - // tunnels are only on z=0 - if (!plugin.getWalls().isEmpty() && client.getPlane() == 0 && config.showMinimap()) - { - // NPC dots - graphics.setColor(npcColor); - final List npcs = client.getNpcs(); - for (NPC npc : npcs) - { - final NPCComposition composition = npc.getComposition(); - - if (composition != null && !composition.isMinimapVisible()) - { - continue; - } - - net.runelite.api.Point minimapLocation = npc.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Player dots - graphics.setColor(playerColor); - final List players = client.getPlayers(); - for (Player player : players) - { - if (player == local) - { - // Skip local player as we draw square for it later - continue; - } - - net.runelite.api.Point minimapLocation = player.getMinimapLocation(); - if (minimapLocation != null) - { - graphics.fillOval(minimapLocation.getX(), minimapLocation.getY(), 4, 4); - } - } - - // Render barrows walls/doors - renderObjects(graphics, local); - - // Local player square - graphics.setColor(playerColor); - graphics.fillRect(local.getMinimapLocation().getX(), local.getMinimapLocation().getY(), 3, 3); - } - else if (config.showBrotherLoc()) + if (config.showBrotherLoc()) { renderBarrowsBrothers(graphics); } @@ -132,81 +75,6 @@ class BarrowsOverlay extends Overlay return null; } - private void renderObjects(Graphics2D graphics, Player localPlayer) - { - LocalPoint localLocation = localPlayer.getLocalLocation(); - for (WallObject wall : plugin.getWalls()) - { - LocalPoint location = wall.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderWalls(graphics, wall); - } - } - - for (GameObject ladder : plugin.getLadders()) - { - LocalPoint location = ladder.getLocalLocation(); - if (localLocation.distanceTo(location) <= MAX_DISTANCE) - { - renderLadders(graphics, ladder); - } - } - } - - private void renderWalls(Graphics2D graphics, WallObject wall) - { - net.runelite.api.Point minimapLocation = wall.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectComposition objectComp = client.getObjectDefinition(wall.getId()); - ObjectComposition impostor = objectComp.getImpostorIds() != null ? objectComp.getImpostor() : null; - - if (impostor != null && impostor.getActions()[0] != null) - { - graphics.setColor(Color.green); - } - else - { - graphics.setColor(Color.gray); - } - - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 3, 3); - } - - /** - * Get minimap dot color from client - * @param typeIndex index of minimap dot type (1 npcs, 2 players) - * @return color - */ - private Color getMinimapDotColor(int typeIndex) - { - final int pixel = client.getMapDots()[typeIndex].getPixels()[1]; - return new Color(pixel); - } - - private void renderLadders(Graphics2D graphics, GameObject ladder) - { - net.runelite.api.Point minimapLocation = ladder.getMinimapLocation(); - - if (minimapLocation == null) - { - return; - } - - ObjectComposition objectComp = client.getObjectDefinition(ladder.getId()); - - if (objectComp.getImpostorIds() != null && objectComp.getImpostor() != null) - { - graphics.setColor(Color.orange); - graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 6, 6); - } - } - private void renderBarrowsBrothers(Graphics2D graphics) { for (BarrowsBrothers brother : BarrowsBrothers.values()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java index 2d4db73d12..77619ba55a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java @@ -25,33 +25,19 @@ package net.runelite.client.plugins.barrows; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; import com.google.inject.Provides; import java.time.temporal.ChronoUnit; -import java.util.HashSet; -import java.util.Set; import javax.inject.Inject; -import lombok.AccessLevel; import lombok.Getter; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import net.runelite.api.GameObject; import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; -import net.runelite.api.NullObjectID; -import net.runelite.api.ObjectID; import net.runelite.api.SpriteID; -import net.runelite.api.WallObject; import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.GameObjectChanged; -import net.runelite.api.events.GameObjectDespawned; -import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WallObjectChanged; -import net.runelite.api.events.WallObjectDespawned; -import net.runelite.api.events.WallObjectSpawned; import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; @@ -75,21 +61,10 @@ import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( name = "Barrows Brothers", description = "Show helpful information for the Barrows minigame", - tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"} + tags = {"combat", "minigame", "bosses", "pve", "pvm"} ) public class BarrowsPlugin extends Plugin { - @Getter(AccessLevel.PACKAGE) - private static final Set BARROWS_WALLS = Sets.newHashSet - ( - ObjectID.DOOR_20678, NullObjectID.NULL_20681, NullObjectID.NULL_20682, NullObjectID.NULL_20683, NullObjectID.NULL_20684, NullObjectID.NULL_20685, NullObjectID.NULL_20686, NullObjectID.NULL_20687, - NullObjectID.NULL_20688, NullObjectID.NULL_20689, NullObjectID.NULL_20690, NullObjectID.NULL_20691, NullObjectID.NULL_20692, NullObjectID.NULL_20693, NullObjectID.NULL_20694, NullObjectID.NULL_20695, - NullObjectID.NULL_20696, ObjectID.DOOR_20697, NullObjectID.NULL_20700, NullObjectID.NULL_20701, NullObjectID.NULL_20702, NullObjectID.NULL_20703, NullObjectID.NULL_20704, NullObjectID.NULL_20705, - NullObjectID.NULL_20706, NullObjectID.NULL_20707, NullObjectID.NULL_20708, NullObjectID.NULL_20709, NullObjectID.NULL_20710, NullObjectID.NULL_20711, NullObjectID.NULL_20712, NullObjectID.NULL_20713, - NullObjectID.NULL_20714, NullObjectID.NULL_20715, NullObjectID.NULL_20728, NullObjectID.NULL_20730 - ); - - private static final Set BARROWS_LADDERS = Sets.newHashSet(NullObjectID.NULL_20675, NullObjectID.NULL_20676, NullObjectID.NULL_20677); private static final ImmutableList POSSIBLE_SOLUTIONS = ImmutableList.of( WidgetInfo.BARROWS_PUZZLE_ANSWER1, WidgetInfo.BARROWS_PUZZLE_ANSWER2, @@ -99,12 +74,6 @@ public class BarrowsPlugin extends Plugin private static final long PRAYER_DRAIN_INTERVAL_MS = 18200; private static final int CRYPT_REGION_ID = 14231; - @Getter(AccessLevel.PACKAGE) - private final Set walls = new HashSet<>(); - - @Getter(AccessLevel.PACKAGE) - private final Set ladders = new HashSet<>(); - private LoopTimer barrowsPrayerDrainTimer; private boolean wasInCrypt = false; @@ -156,8 +125,6 @@ public class BarrowsPlugin extends Plugin { overlayManager.remove(barrowsOverlay); overlayManager.remove(brotherOverlay); - walls.clear(); - ladders.clear(); puzzleAnswer = null; wasInCrypt = false; stopPrayerDrainTimer(); @@ -185,66 +152,6 @@ public class BarrowsPlugin extends Plugin } } - @Subscribe - public void onWallObjectSpawned(WallObjectSpawned event) - { - WallObject wallObject = event.getWallObject(); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - public void onWallObjectChanged(WallObjectChanged event) - { - WallObject previous = event.getPrevious(); - WallObject wallObject = event.getWallObject(); - - walls.remove(previous); - if (BARROWS_WALLS.contains(wallObject.getId())) - { - walls.add(wallObject); - } - } - - @Subscribe - public void onWallObjectDespawned(WallObjectDespawned event) - { - WallObject wallObject = event.getWallObject(); - walls.remove(wallObject); - } - - @Subscribe - public void onGameObjectSpawned(GameObjectSpawned event) - { - GameObject gameObject = event.getGameObject(); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - public void onGameObjectChanged(GameObjectChanged event) - { - GameObject previous = event.getPrevious(); - GameObject gameObject = event.getGameObject(); - - ladders.remove(previous); - if (BARROWS_LADDERS.contains(gameObject.getId())) - { - ladders.add(gameObject); - } - } - - @Subscribe - public void onGameObjectDespawned(GameObjectDespawned event) - { - GameObject gameObject = event.getGameObject(); - ladders.remove(gameObject); - } - @Subscribe public void onGameStateChanged(GameStateChanged event) { @@ -252,8 +159,6 @@ public class BarrowsPlugin extends Plugin { wasInCrypt = isInCrypt(); // on region changes the tiles get set to null - walls.clear(); - ladders.clear(); puzzleAnswer = null; } else if (event.getGameState() == GameState.LOGGED_IN)