barrows plugin: remove minimap

Removed at Jagex's request
This commit is contained in:
Adam
2019-10-28 16:14:10 -04:00
parent bc5838f019
commit 151ea90b2f
3 changed files with 2 additions and 240 deletions

View File

@@ -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",

View File

@@ -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<NPC> 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<Player> 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())

View File

@@ -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<Integer> 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<Integer> BARROWS_LADDERS = Sets.newHashSet(NullObjectID.NULL_20675, NullObjectID.NULL_20676, NullObjectID.NULL_20677);
private static final ImmutableList<WidgetInfo> 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<WallObject> walls = new HashSet<>();
@Getter(AccessLevel.PACKAGE)
private final Set<GameObject> 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)