barrows: Remove chest value option (#1337)

This commit is contained in:
Owain van Brakel
2019-08-15 05:14:19 +02:00
committed by Ganom
parent a94fffbec5
commit 2c5fceb70f
2 changed files with 5 additions and 62 deletions

View File

@@ -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()
{

View File

@@ -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;