From 2c5fceb70fa3bab09028403d4253d48dad4ece8e Mon Sep 17 00:00:00 2001 From: Owain van Brakel Date: Thu, 15 Aug 2019 05:14:19 +0200 Subject: [PATCH] barrows: Remove chest value option (#1337) --- .../client/plugins/barrows/BarrowsConfig.java | 19 ++------ .../client/plugins/barrows/BarrowsPlugin.java | 48 +------------------ 2 files changed, 5 insertions(+), 62 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..4c8f2a3dfb 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 @@ -54,22 +54,11 @@ public interface BarrowsConfig extends Config return true; } - @ConfigItem( - keyName = "showChestValue", - name = "Show Value of Chests", - description = "Configure whether to show total exchange value of chest when opened", - position = 2 - ) - default boolean showChestValue() - { - return true; - } - @ConfigItem( keyName = "brotherLocColor", name = "Brother location color", description = "Change the color of the name displayed on the minimap", - position = 3 + position = 2 ) default Color brotherLocColor() { @@ -80,7 +69,7 @@ public interface BarrowsConfig extends Config keyName = "deadBrotherLocColor", name = "Dead Brother loc. color", description = "Change the color of the name displayed on the minimap for a dead brother", - position = 4 + position = 3 ) default Color deadBrotherLocColor() { @@ -91,7 +80,7 @@ public interface BarrowsConfig extends Config keyName = "showPuzzleAnswer", name = "Show Puzzle Answer", description = "Configures if the puzzle answer should be shown.", - position = 5 + position = 4 ) default boolean showPuzzleAnswer() { @@ -102,7 +91,7 @@ public interface BarrowsConfig extends Config keyName = "showPrayerDrainTimer", name = "Show Prayer Drain Timer", description = "Configure whether or not a countdown until the next prayer drain is displayed", - position = 6 + position = 5 ) default boolean showPrayerDrainTimer() { 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 e630d08389..21dceac0df 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 @@ -35,13 +35,9 @@ import javax.inject.Inject; import javax.inject.Singleton; 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; @@ -58,13 +54,8 @@ import net.runelite.api.events.WidgetLoaded; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetID; import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.chat.ChatColorType; -import net.runelite.client.chat.ChatMessageBuilder; -import net.runelite.client.chat.ChatMessageManager; -import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; -import net.runelite.client.game.ItemManager; import net.runelite.client.game.SpriteManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -72,7 +63,6 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; import net.runelite.client.ui.overlay.infobox.LoopTimer; -import net.runelite.client.util.StackFormatter; @PluginDescriptor( name = "Barrows Brothers", @@ -126,18 +116,12 @@ public class BarrowsPlugin extends Plugin @Inject private Client client; - @Inject - private ItemManager itemManager; - @Inject private SpriteManager spriteManager; @Inject private InfoBoxManager infoBoxManager; - @Inject - private ChatMessageManager chatMessageManager; - @Inject private BarrowsConfig config; @@ -154,7 +138,6 @@ public class BarrowsPlugin extends Plugin private boolean showMinimap; @Getter(AccessLevel.PACKAGE) private boolean showBrotherLoc; - private boolean showChestValue; @Getter(AccessLevel.PACKAGE) private Color brotherLocColor; @Getter(AccessLevel.PACKAGE) @@ -230,7 +213,6 @@ public class BarrowsPlugin extends Plugin { this.showMinimap = config.showMinimap(); this.showBrotherLoc = config.showBrotherLoc(); - this.showChestValue = config.showChestValue(); this.brotherLocColor = config.brotherLocColor(); this.deadBrotherLocColor = config.deadBrotherLocColor(); this.showPuzzleAnswer = config.showPuzzleAnswer(); @@ -317,35 +299,7 @@ public class BarrowsPlugin extends Plugin private void onWidgetLoaded(WidgetLoaded event) { - if (event.getGroupId() == WidgetID.BARROWS_REWARD_GROUP_ID && this.showChestValue) - { - ItemContainer barrowsRewardContainer = client.getItemContainer(InventoryID.BARROWS_REWARD); - Item[] items = new Item[0]; - if (barrowsRewardContainer != null) - { - items = barrowsRewardContainer.getItems(); - } - long chestPrice = 0; - - for (Item item : items) - { - long itemStack = (long) itemManager.getItemPrice(item.getId()) * (long) item.getQuantity(); - chestPrice += itemStack; - } - - final ChatMessageBuilder message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Your chest is worth around ") - .append(StackFormatter.formatNumber(chestPrice)) - .append(" coins.") - .append(ChatColorType.NORMAL); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.ITEM_EXAMINE) - .runeLiteFormattedMessage(message.build()) - .build()); - } - else if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID) + if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID) { final int answer = client.getWidget(WidgetInfo.BARROWS_FIRST_PUZZLE).getModelId() - 3; puzzleAnswer = null;