diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java index 745d64594b..b9981d49f9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsConfig.java @@ -28,20 +28,74 @@ import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.ConfigSection; +import net.runelite.client.config.Range; -@ConfigGroup("inventorytags") +@ConfigGroup(InventoryTagsConfig.GROUP) public interface InventoryTagsConfig extends Config { - enum DisplayMode - { - OUTLINE, - UNDERLINE - } - String GROUP = "inventorytags"; + @ConfigSection( + name = "Tag display mode", + description = "How tags are displayed in the inventory", + position = 0 + ) + String tagStyleSection = "tagStyleSection"; + @ConfigItem( position = 0, + keyName = "showTagOutline", + name = "Outline", + description = "Configures whether or not item tags show be outlined", + section = tagStyleSection + ) + default boolean showTagOutline() + { + return true; + } + + @ConfigItem( + position = 1, + keyName = "tagUnderline", + name = "Underline", + description = "Configures whether or not item tags should be underlined", + section = tagStyleSection + ) + default boolean showTagUnderline() + { + return false; + } + + @ConfigItem( + position = 2, + keyName = "tagFill", + name = "Fill", + description = "Configures whether or not item tags should be filled", + section = tagStyleSection + ) + default boolean showTagFill() + { + return false; + } + + @Range( + max = 255 + ) + @ConfigItem( + position = 3, + keyName = "fillOpacity", + name = "Fill opacity", + description = "Configures the opacity of the tag \"Fill\"", + section = tagStyleSection + ) + default int fillOpacity() + { + return 50; + } + + @ConfigItem( + position = 1, keyName = "groupColor1", name = "Group 1 Color", description = "Color of the Tag" @@ -52,7 +106,7 @@ public interface InventoryTagsConfig extends Config } @ConfigItem( - position = 1, + position = 2, keyName = "groupColor2", name = "Group 2 Color", description = "Color of the Tag" @@ -63,7 +117,7 @@ public interface InventoryTagsConfig extends Config } @ConfigItem( - position = 2, + position = 3, keyName = "groupColor3", name = "Group 3 Color", description = "Color of the Tag" @@ -74,7 +128,7 @@ public interface InventoryTagsConfig extends Config } @ConfigItem( - position = 3, + position = 4, keyName = "groupColor4", name = "Group 4 Color", description = "Color of the Tag" @@ -85,7 +139,7 @@ public interface InventoryTagsConfig extends Config } @ConfigItem( - position = 4, + position = 5, keyName = "groupColor5", name = "Group 5 Color", description = "Color of the Tag" @@ -96,7 +150,7 @@ public interface InventoryTagsConfig extends Config } @ConfigItem( - position = 5, + position = 6, keyName = "groupColor6", name = "Group 6 Color", description = "Color of the Tag" @@ -105,15 +159,4 @@ public interface InventoryTagsConfig extends Config { return new Color(0, 255, 255); } - - @ConfigItem( - position = 6, - keyName = "displayMode", - name = "Display mode", - description = "How tags are displayed in the inventory" - ) - default DisplayMode getDisplayMode() - { - return DisplayMode.OUTLINE; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java index 03857e185c..4b9e471fab 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java @@ -24,21 +24,26 @@ */ package net.runelite.client.plugins.inventorytags; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import java.awt.Color; import java.awt.Graphics2D; +import java.awt.Image; import java.awt.Rectangle; import java.awt.image.BufferedImage; import javax.inject.Inject; import net.runelite.api.widgets.WidgetItem; import net.runelite.client.game.ItemManager; -import net.runelite.client.plugins.inventorytags.InventoryTagsConfig.DisplayMode; import net.runelite.client.ui.overlay.WidgetItemOverlay; +import net.runelite.client.util.ColorUtil; +import net.runelite.client.util.ImageUtil; public class InventoryTagsOverlay extends WidgetItemOverlay { private final ItemManager itemManager; private final InventoryTagsPlugin plugin; private final InventoryTagsConfig config; + private final Cache fillCache; @Inject private InventoryTagsOverlay(ItemManager itemManager, InventoryTagsPlugin plugin, InventoryTagsConfig config) @@ -48,6 +53,10 @@ public class InventoryTagsOverlay extends WidgetItemOverlay this.config = config; showOnEquipment(); showOnInventory(); + fillCache = CacheBuilder.newBuilder() + .concurrencyLevel(1) + .maximumSize(32) + .build(); } @Override @@ -57,16 +66,22 @@ public class InventoryTagsOverlay extends WidgetItemOverlay if (group != null) { final Color color = plugin.getGroupNameColor(group); - final DisplayMode displayMode = config.getDisplayMode(); if (color != null) { Rectangle bounds = widgetItem.getCanvasBounds(); - if (displayMode == DisplayMode.OUTLINE) + if (config.showTagOutline()) { final BufferedImage outline = itemManager.getItemOutline(itemId, widgetItem.getQuantity(), color); graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null); } - else + + if (config.showTagFill()) + { + final Image image = getFillImage(color, widgetItem.getId(), widgetItem.getQuantity()); + graphics.drawImage(image, (int) bounds.getX(), (int) bounds.getY(), null); + } + + if (config.showTagUnderline()) { int heightOffSet = (int) bounds.getY() + (int) bounds.getHeight() + 2; graphics.setColor(color); @@ -75,4 +90,22 @@ public class InventoryTagsOverlay extends WidgetItemOverlay } } } + + private Image getFillImage(Color color, int itemId, int qty) + { + long key = (((long) itemId) << 32) | qty; + Image image = fillCache.getIfPresent(key); + if (image == null) + { + final Color fillColor = ColorUtil.colorWithAlpha(color, config.fillOpacity()); + image = ImageUtil.fillImage(itemManager.getImage(itemId, qty, false), fillColor); + fillCache.put(key, image); + } + return image; + } + + void invalidateCache() + { + fillCache.invalidateAll(); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java index 77a0548287..cdbf26a845 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsPlugin.java @@ -39,6 +39,7 @@ import net.runelite.api.events.WidgetMenuOptionClicked; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigChanged; import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.WidgetMenuOption; import net.runelite.client.plugins.Plugin; @@ -147,6 +148,15 @@ public class InventoryTagsPlugin extends Plugin editorMode = false; } + @Subscribe + public void onConfigChanged(ConfigChanged configChanged) + { + if (configChanged.getGroup().equals(InventoryTagsConfig.GROUP)) + { + overlay.invalidateCache(); + } + } + @Subscribe public void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java index 799dd098ef..65f41baf67 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java @@ -60,7 +60,7 @@ import net.runelite.client.ws.WSClient; @PluginDescriptor( name = "Special Attack Counter", - description = "Track DWH, Arclight, Darklight, and BGS special attacks used on NPCs", + description = "Track special attacks used on NPCs", tags = {"combat", "npcs", "overlay"}, enabledByDefault = false ) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java index e3cd82cfc6..a566f7680b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialWeapon.java @@ -37,7 +37,13 @@ enum SpecialWeapon ARCLIGHT("Arclight", ItemID.ARCLIGHT, false, SpecialCounterConfig::arclightThreshold), DARKLIGHT("Darklight", ItemID.DARKLIGHT, false, SpecialCounterConfig::darklightThreshold), BANDOS_GODSWORD("Bandos Godsword", ItemID.BANDOS_GODSWORD, true, SpecialCounterConfig::bandosGodswordThreshold), - BANDOS_GODSWORD_OR("Bandos Godsword", ItemID.BANDOS_GODSWORD_OR, true, SpecialCounterConfig::bandosGodswordThreshold); + BANDOS_GODSWORD_OR("Bandos Godsword", ItemID.BANDOS_GODSWORD_OR, true, SpecialCounterConfig::bandosGodswordThreshold), + BARRELCHEST_ANCHOR("Barrelchest Anchor", ItemID.BARRELCHEST_ANCHOR, true, (c) -> 0), + BONE_DAGGER("Bone Dagger", ItemID.BONE_DAGGER, true, (c) -> 0), + BONE_DAGGER_P("Bone Dagger (p)", ItemID.BONE_DAGGER_P, true, (c) -> 0), + BONE_DAGGER_P8876("Bone Dagger (p+)", ItemID.BONE_DAGGER_P_8876, true, (c) -> 0), + BONE_DAGGER_P8878("Bone Dagger (p++)", ItemID.BONE_DAGGER_P_8878, true, (c) -> 0), + DORGESHUUN_CROSSBOW("Dorgeshuun Crossbow", ItemID.DORGESHUUN_CROSSBOW, true, (c) -> 0); private final String name; private final int itemID; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java index 8ec93c1b18..1d54c85935 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesOverlay.java @@ -39,7 +39,7 @@ import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.components.ComponentOrientation; import net.runelite.client.ui.overlay.components.ImageComponent; -public class TeamCapesOverlay extends OverlayPanel +class TeamCapesOverlay extends OverlayPanel { private final TeamCapesPlugin plugin; private final TeamCapesConfig config; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java index 103129d64f..c36b7ddd76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/teamcapes/TeamCapesPlugin.java @@ -25,21 +25,24 @@ package net.runelite.client.plugins.teamcapes; import com.google.inject.Provides; -import java.time.temporal.ChronoUnit; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.inject.Inject; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import net.runelite.api.GameState; import net.runelite.api.Player; +import net.runelite.api.events.PlayerChanged; +import net.runelite.api.events.PlayerDespawned; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.task.Schedule; import net.runelite.client.ui.overlay.OverlayManager; @PluginDescriptor( @@ -48,19 +51,26 @@ import net.runelite.client.ui.overlay.OverlayManager; tags = {"overlay", "players"}, enabledByDefault = false ) +@Slf4j public class TeamCapesPlugin extends Plugin { @Inject private Client client; + @Inject + private ClientThread clientThread; + @Inject private OverlayManager overlayManager; @Inject private TeamCapesOverlay overlay; - // Hashmap of team capes: Key is the teamCape #, Value is the count of teamcapes in the area. - private Map teams = new HashMap<>(); + // Team number -> Number of players + @Getter(AccessLevel.PACKAGE) + private Map teams = new LinkedHashMap<>(); + // Player -> Team number + private final Map playerTeam = new HashMap<>(); @Provides TeamCapesConfig provideConfig(ConfigManager configManager) @@ -72,6 +82,8 @@ public class TeamCapesPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(overlay); + + clientThread.invokeLater(() -> client.getPlayers().forEach(this::update)); } @Override @@ -79,48 +91,61 @@ public class TeamCapesPlugin extends Plugin { overlayManager.remove(overlay); teams.clear(); + playerTeam.clear(); } - @Schedule( - period = 1800, - unit = ChronoUnit.MILLIS - ) - public void update() + @Subscribe + public void onPlayerChanged(PlayerChanged playerChanged) { - if (client.getGameState() != GameState.LOGGED_IN) + Player player = playerChanged.getPlayer(); + update(player); + } + + private void update(Player player) + { + int oldTeam = playerTeam.getOrDefault(player, 0); + if (oldTeam == player.getTeam()) { return; } - List players = client.getPlayers(); - teams.clear(); - for (Player player : players) + + log.debug("{} has changed teams: {} -> {}", player.getName(), oldTeam, player.getTeam()); + + if (oldTeam > 0) { - int team = player.getTeam(); - if (team > 0) - { - if (teams.containsKey(team)) - { - teams.put(team, teams.get(team) + 1); - } - else - { - teams.put(team, 1); - } - } + teams.computeIfPresent(oldTeam, (key, value) -> value > 1 ? value - 1 : null); + playerTeam.remove(player); } + if (player.getTeam() > 0) + { + teams.merge(player.getTeam(), 1, Integer::sum); + playerTeam.put(player, player.getTeam()); + } + + sort(); + } + + @Subscribe + public void onPlayerDespawned(PlayerDespawned playerDespawned) + { + Player player = playerDespawned.getPlayer(); + Integer team = playerTeam.remove(player); + if (team != null) + { + teams.computeIfPresent(team, (key, value) -> value > 1 ? value - 1 : null); + sort(); + } + } + + private void sort() + { // Sort teams by value in descending order and then by key in ascending order, limited to 5 entries teams = teams.entrySet().stream() - .sorted( - Comparator.comparing(Map.Entry::getValue, Comparator.reverseOrder()) - .thenComparingInt(Map.Entry::getKey) - ) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); + .sorted( + Comparator.comparing(Map.Entry::getValue, Comparator.reverseOrder()) + .thenComparingInt(Map.Entry::getKey) + ) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); } - - public Map getTeams() - { - return teams; - } - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixConfig.java new file mode 100644 index 0000000000..936a14db20 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixConfig.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2020, cgati + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.tearsofguthix; + +import java.awt.Color; +import net.runelite.client.config.Alpha; +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; +import net.runelite.client.util.ColorUtil; + +@ConfigGroup("tearsofguthix") +public interface TearsOfGuthixConfig extends Config +{ + @ConfigItem( + keyName = "showGreenTearsTimer", + name = "Enable Green Tears Timer", + description = "Configures whether to display a timer for green tears or not", + position = 1 + ) + default boolean showGreenTearsTimer() + { + return true; + } + + @Alpha + @ConfigItem( + keyName = "blueTearsColor", + name = "Blue Tears Color", + description = "Color of Blue Tears timer", + position = 2 + ) + default Color getBlueTearsColor() + { + return ColorUtil.colorWithAlpha(Color.CYAN, 100); + } + + @Alpha + @ConfigItem( + keyName = "greenTearsColor", + name = "Green Tears Color", + description = "Color of Green Tears timer", + position = 3 + ) + default Color getGreenTearsColor() + { + return ColorUtil.colorWithAlpha(Color.GREEN, 100); + } + +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java index 87148caef7..63964d5541 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixOverlay.java @@ -36,17 +36,18 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.ProgressPieComponent; +import net.runelite.client.util.ColorUtil; class TearsOfGuthixOverlay extends Overlay { - private static final Color CYAN_ALPHA = new Color(Color.CYAN.getRed(), Color.CYAN.getGreen(), Color.CYAN.getBlue(), 100); - private static final Color GREEN_ALPHA = new Color(Color.GREEN.getRed(), Color.GREEN.getGreen(), Color.GREEN.getBlue(), 100); private static final Duration MAX_TIME = Duration.ofSeconds(9); + private final TearsOfGuthixConfig config; private final TearsOfGuthixPlugin plugin; @Inject - private TearsOfGuthixOverlay(TearsOfGuthixPlugin plugin) + private TearsOfGuthixOverlay(TearsOfGuthixConfig config, TearsOfGuthixPlugin plugin) { + this.config = config; this.plugin = plugin; setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_SCENE); @@ -55,8 +56,24 @@ class TearsOfGuthixOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { + if (plugin.getStreams().isEmpty()) + { + return null; + } + + Color blueTearsFill = config.getBlueTearsColor(); + Color greenTearsFill = config.getGreenTearsColor(); + Color blueTearsBorder = ColorUtil.colorWithAlpha(blueTearsFill, 255); + Color greenTearsBorder = ColorUtil.colorWithAlpha(greenTearsFill, 255); + plugin.getStreams().forEach((object, timer) -> { + if ((object.getId() == ObjectID.GREEN_TEARS || object.getId() == ObjectID.GREEN_TEARS_6666) + && !config.showGreenTearsTimer()) + { + return; + } + final Point position = object.getCanvasLocation(100); if (position == null) @@ -70,14 +87,14 @@ class TearsOfGuthixOverlay extends Overlay if (object.getId() == ObjectID.BLUE_TEARS || object.getId() == ObjectID.BLUE_TEARS_6665) { - progressPie.setFill(CYAN_ALPHA); - progressPie.setBorderColor(Color.CYAN); + progressPie.setFill(blueTearsFill); + progressPie.setBorderColor(blueTearsBorder); } else if (object.getId() == ObjectID.GREEN_TEARS || object.getId() == ObjectID.GREEN_TEARS_6666) { - progressPie.setFill(GREEN_ALPHA); - progressPie.setBorderColor(Color.GREEN); + progressPie.setFill(greenTearsFill); + progressPie.setBorderColor(greenTearsBorder); } progressPie.setPosition(position); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java index 899182b500..5b315bb142 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/tearsofguthix/TearsOfGuthixPlugin.java @@ -28,6 +28,7 @@ import java.time.Instant; import java.util.HashMap; import java.util.Map; import javax.inject.Inject; +import com.google.inject.Provides; import lombok.Getter; import net.runelite.api.Client; import net.runelite.api.DecorativeObject; @@ -35,6 +36,7 @@ import net.runelite.api.ObjectID; import net.runelite.api.events.DecorativeObjectDespawned; import net.runelite.api.events.DecorativeObjectSpawned; import net.runelite.api.events.GameStateChanged; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -61,6 +63,12 @@ public class TearsOfGuthixPlugin extends Plugin @Getter private final Map streams = new HashMap<>(); + @Provides + TearsOfGuthixConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(TearsOfGuthixConfig.class); + } + @Override protected void startUp() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java index c32a8c598a..2a956da851 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java @@ -89,11 +89,22 @@ public interface XpGlobesConfig extends Config return false; } + @ConfigItem( + keyName = "showVirtualLevel", + name = "Show virtual level", + description = "Shows virtual level if over 99 in a skill and Hide maxed skill is not checked", + position = 5 + ) + default boolean showVirtualLevel() + { + return false; + } + @ConfigItem( keyName = "enableCustomArcColor", name = "Enable custom arc color", description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.", - position = 5 + position = 6 ) default boolean enableCustomArcColor() { @@ -105,7 +116,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress arc color", name = "Progress arc color", description = "Change the color of the progress arc in the xp orb", - position = 6 + position = 7 ) default Color progressArcColor() { @@ -117,7 +128,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress orb outline color", name = "Progress orb outline color", description = "Change the color of the progress orb outline", - position = 7 + position = 8 ) default Color progressOrbOutLineColor() { @@ -129,7 +140,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress orb background color", name = "Progress orb background color", description = "Change the color of the progress orb background", - position = 8 + position = 9 ) default Color progressOrbBackgroundColor() { @@ -140,7 +151,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress arc width", name = "Progress arc width", description = "Change the stroke width of the progress arc", - position = 9 + position = 10 ) @Units(Units.PIXELS) default int progressArcStrokeWidth() @@ -152,7 +163,7 @@ public interface XpGlobesConfig extends Config keyName = "Orb size", name = "Size of orbs", description = "Change the size of the xp orbs", - position = 10 + position = 11 ) @Units(Units.PIXELS) default int xpOrbSize() @@ -164,7 +175,7 @@ public interface XpGlobesConfig extends Config keyName = "Orb duration", name = "Duration of orbs", description = "Change the duration the xp orbs are visible", - position = 11 + position = 12 ) @Units(Units.SECONDS) default int xpOrbDuration() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java index 46b514151e..39b947616a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesPlugin.java @@ -106,9 +106,17 @@ public class XpGlobesPlugin extends Plugin return; } - if (config.hideMaxed() && currentLevel >= Experience.MAX_REAL_LEVEL) + if (currentLevel >= Experience.MAX_REAL_LEVEL) { - return; + if (config.hideMaxed()) + { + return; + } + + if (config.showVirtualLevel()) + { + currentLevel = Experience.getLevelForXp(currentXp); + } } if (cachedGlobe != null) diff --git a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java index 3efeabcfa4..3fb1da78d8 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ImageUtil.java @@ -395,8 +395,9 @@ public class ImageUtil { for (int y = 0; y < filledImage.getHeight(); y++) { - final Color pixelColor = new Color(image.getRGB(x, y), true); - if (pixelColor.getAlpha() == 0) + int pixel = image.getRGB(x, y); + int a = pixel >>> 24; + if (a == 0) { continue; } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png index 3e41077561..0209db1f97 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/abyssal_sire.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png index 3032e57ec4..3b708b7522 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/alchemical_hydra.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png index ba5c55efae..89ebe418dc 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/barrows_chests.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png index 8cebd91ecf..e64276d9ca 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/bryophyta.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png index 6f307a26d5..691ec6acf6 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/callisto.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png index 4f7ef937cd..8d08024783 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/cerberus.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png index a7240d11f0..58c4625bf1 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png index c298966a16..a35a701cee 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chambers_of_xeric_challenge_mode.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png index cc36114993..fb104c32d4 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_elemental.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png index 73e680aef6..b27a010935 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/chaos_fanatic.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png index e207d7e791..bec91f5bc1 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/commander_zilyana.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png index cd113c8ad9..5656d06d7f 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/corporeal_beast.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png index 53d758bf8e..9a5f9ce8ac 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/crazy_archaeologist.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png index 6b5543b5e1..18e004e18b 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_prime.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png index fc2bcbc3a0..1b73c2d416 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_rex.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png index 044291cc4a..721bd215e4 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/dagannoth_supreme.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png index 8dfae8c2fb..daf19da7a6 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/deranged_archaeologist.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png index 1d8e4334fa..f26ca05eca 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/general_graardor.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png index f814bbd2d5..5fb3f328e8 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/giant_mole.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png index 98606aed11..ec6a4238d2 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/grotesque_guardians.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png index dffc71404c..0c104674db 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/hespori.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png index a6b77f9426..956e3a502d 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kalphite_queen.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png index 3bc8a77466..7efce3fe35 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/king_black_dragon.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png index c42e5d3fc9..a7b00aaae7 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kraken.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png index 74b9eae788..0ef3398abf 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kreearra.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png index dfe129ae77..6b36fb211c 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/kril_tsutsaroth.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png index 3d2c0a4606..0666325dfa 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/mimic.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/nightmare.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/nightmare.png index 22907bb92f..f8edd9b211 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/nightmare.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/nightmare.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png index 8c9ea13036..1ec992e6cd 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/obor.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png index e74c398976..c8428aa984 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/sarachnis.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png index eeb6310454..db4c0ff988 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/scorpia.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png index cd96bbcca0..6821a71a1e 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/skotizo.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png index 9553dde2c1..a1b7fd687f 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_corrupted_gauntlet.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png index e34fbe3d15..d24830e178 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/the_gauntlet.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png index 0d05a8ab1e..6202518873 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/theatre_of_blood.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png index 7869a9a817..84614459a4 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/thermonuclear_smoke_devil.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png index 8b3262cd8b..c227671ec8 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tzkal_zuk.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png index 6ccee5515e..000dee3fed 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/tztok_jad.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png index df08980743..438d315334 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/venenatis.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png index 383d30a119..cfc9d47a03 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vetion.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png index 03bcc75ed4..696669c353 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/vorkath.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png index eb1d8f47bb..4546d90a52 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/wintertodt.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png index c4d6e21be0..f2bdac1cea 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zalcano.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png index 83d939a1ac..7e2dc8807f 100644 Binary files a/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png and b/runelite-client/src/main/resources/net/runelite/client/plugins/hiscore/bosses/zulrah.png differ diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/xpglobes/XpGlobesPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/xpglobes/XpGlobesPluginTest.java new file mode 100644 index 0000000000..bfc5de4b0d --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/xpglobes/XpGlobesPluginTest.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2021, Wright + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.xpglobes; + +import com.google.inject.Guice; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import javax.inject.Inject; +import net.runelite.api.Experience; +import net.runelite.api.Skill; +import net.runelite.api.events.StatChanged; +import net.runelite.client.plugins.xptracker.XpTrackerService; +import net.runelite.client.ui.overlay.OverlayManager; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.when; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class XpGlobesPluginTest +{ + private static final int VIRTUAL_LEVEL_TOTAL_XP = Experience.getXpForLevel(Experience.MAX_REAL_LEVEL + 1); + + @Inject + private XpGlobesPlugin xpGlobesPlugin; + + @Mock + @Bind + private OverlayManager overlayManager; + + @Mock + @Bind + private XpGlobesOverlay xpGlobesOverlay; + + @Mock + @Bind + private XpTrackerService xpTrackerService; + + @Mock + @Bind + private XpGlobesConfig xpGlobesConfig; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + + statChanged(VIRTUAL_LEVEL_TOTAL_XP, Skill.AGILITY); + assertTrue(xpGlobesPlugin.getXpGlobes().isEmpty()); + } + + @Test + public void testVirtualLevelInGlobeIsNotShownByDefault() + { + when(xpGlobesConfig.showVirtualLevel()).thenReturn(false); + + statChanged(VIRTUAL_LEVEL_TOTAL_XP + 1, Skill.AGILITY); + + assertEquals(Experience.MAX_REAL_LEVEL, xpGlobesPlugin.getXpGlobes().get(0).getCurrentLevel()); + } + + @Test + public void testVirtualLevelInGlobeIsShownWhenConfigured() + { + when(xpGlobesConfig.showVirtualLevel()).thenReturn(true); + + statChanged(VIRTUAL_LEVEL_TOTAL_XP + 1, Skill.AGILITY); + + assertEquals(Experience.getLevelForXp(VIRTUAL_LEVEL_TOTAL_XP + 1), xpGlobesPlugin.getXpGlobes().get(0).getCurrentLevel()); + } + + @Test + public void testGlobeIsNotShownWhenHideMaxAndShowVirtualLevelConfigured() + { + when(xpGlobesConfig.hideMaxed()).thenReturn(true); + lenient().when(xpGlobesConfig.showVirtualLevel()).thenReturn(true); + + statChanged(VIRTUAL_LEVEL_TOTAL_XP + 1, Skill.AGILITY); + + assertTrue(xpGlobesPlugin.getXpGlobes().isEmpty()); + } + + @Test + public void testGlobeIsNotShownWhenHideMaxConfigured() + { + when(xpGlobesConfig.hideMaxed()).thenReturn(true); + + statChanged(VIRTUAL_LEVEL_TOTAL_XP + 1, Skill.AGILITY); + + assertTrue(xpGlobesPlugin.getXpGlobes().isEmpty()); + } + + @Test + public void testGlobeIsShownOnXpGainBelowMaxWhenHideMaxConfigured() + { + lenient().when(xpGlobesConfig.hideMaxed()).thenReturn(true); + + int totalXp = 1; + statChanged(totalXp, Skill.FARMING); + assertTrue(xpGlobesPlugin.getXpGlobes().isEmpty()); + + statChanged(totalXp + 150, Skill.FARMING); + + assertEquals(Experience.getLevelForXp(totalXp + 150), xpGlobesPlugin.getXpGlobes().get(0).getCurrentLevel()); + } + + @Test + public void testStatChangesFromBoostDoNotAffectXpGlobes() + { + statChanged(VIRTUAL_LEVEL_TOTAL_XP, Skill.AGILITY, 5); + + assertTrue(xpGlobesPlugin.getXpGlobes().isEmpty()); + } + + private void statChanged(int totalXp, Skill skill) + { + statChanged(totalXp, skill, 0); + } + + private void statChanged(int totalXp, Skill skill, int boostedLevel) + { + // A statChanged event uses the max real level + int statChangedLevel = Math.min(Experience.getLevelForXp(totalXp), Experience.MAX_REAL_LEVEL); + + StatChanged firstStatChangedEvent = new StatChanged( + skill, + totalXp, + statChangedLevel, + boostedLevel + ); + + // The first xp change is cached + xpGlobesPlugin.onStatChanged(firstStatChangedEvent); + } +}