From ac27e8d17f734770514fbf4dbd1f5689a611783f Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:16:05 +0100 Subject: [PATCH 01/11] loot tracker: rename price to gePrice --- .../client/plugins/loottracker/LootTrackerBox.java | 12 ++++++------ .../client/plugins/loottracker/LootTrackerItem.java | 2 +- .../client/plugins/loottracker/LootTrackerPanel.java | 2 +- .../plugins/loottracker/LootTrackerPlugin.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 2e89f8af60..55892d8e34 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -261,7 +261,7 @@ class LootTrackerBox extends JPanel continue; } - totalPrice += entry.getPrice(); + totalPrice += entry.getGePrice(); int quantity = 0; for (final LootTrackerItem i : items) @@ -277,9 +277,9 @@ class LootTrackerBox extends JPanel if (quantity > 0) { int newQuantity = entry.getQuantity() + quantity; - long pricePerItem = entry.getPrice() == 0 ? 0 : (entry.getPrice() / entry.getQuantity()); + long gePricePerItem = entry.getGePrice() == 0 ? 0 : (entry.getGePrice() / entry.getQuantity()); - items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, pricePerItem * newQuantity, entry.isIgnored())); + items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, entry.isIgnored())); } else { @@ -287,7 +287,7 @@ class LootTrackerBox extends JPanel } } - items.sort((i1, i2) -> Long.compare(i2.getPrice(), i1.getPrice())); + items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); // Calculates how many rows need to be display to fit all items final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; @@ -352,8 +352,8 @@ class LootTrackerBox extends JPanel { final String name = item.getName(); final int quantity = item.getQuantity(); - final long price = item.getPrice(); + final long gePrice = item.getGePrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(price) + ") " + ignoredLabel; + return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(gePrice) + ") " + ignoredLabel; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java index feb1504681..1ecf28a229 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java @@ -38,7 +38,7 @@ class LootTrackerItem @Getter private final int quantity; @Getter - private final long price; + private final long gePrice; @Getter @Setter private boolean ignored; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index 9dc783bab8..a4f21447f5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -613,7 +613,7 @@ class LootTrackerPanel extends PluginPanel continue; } - overallGp += item.getPrice(); + overallGp += item.getGePrice(); } if (present > 0) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index edec90e676..cc021c3650 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -636,14 +636,14 @@ public class LootTrackerPlugin extends Plugin { final ItemComposition itemComposition = itemManager.getItemComposition(itemId); final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - final long price = (long) itemManager.getItemPrice(realItemId) * (long) quantity; + final long gePrice = (long) itemManager.getItemPrice(realItemId) * (long) quantity; final boolean ignored = ignoredItems.contains(itemComposition.getName()); return new LootTrackerItem( itemId, itemComposition.getName(), quantity, - price, + gePrice, ignored); } From 2e6138b6f615c5d32060ca33e3c9beaafe94bf87 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:23:20 +0100 Subject: [PATCH 02/11] loot tracker: add HA prices Co-authored-by: Erik Rahka --- .../plugins/loottracker/LootTrackerBox.java | 22 ++++++++++--- .../loottracker/LootTrackerConfig.java | 10 ++++++ .../plugins/loottracker/LootTrackerItem.java | 2 ++ .../plugins/loottracker/LootTrackerPanel.java | 13 +++++--- .../loottracker/LootTrackerPlugin.java | 3 ++ .../loottracker/LootTrackerPriceType.java | 31 +++++++++++++++++++ 6 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 55892d8e34..6438e82c60 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -69,6 +69,7 @@ class LootTrackerBox extends JPanel private final ItemManager itemManager; @Getter(AccessLevel.PACKAGE) private final String id; + private final LootTrackerPriceType priceType; @Getter private final List records = new ArrayList<>(); @@ -82,12 +83,14 @@ class LootTrackerBox extends JPanel final String id, @Nullable final String subtitle, final boolean hideIgnoredItems, + final LootTrackerPriceType priceType, final BiConsumer onItemToggle) { this.id = id; this.itemManager = itemManager; this.onItemToggle = onItemToggle; this.hideIgnoredItems = hideIgnoredItems; + this.priceType = priceType; setLayout(new BorderLayout(0, 1)); setBorder(new EmptyBorder(5, 0, 0, 0)); @@ -261,7 +264,7 @@ class LootTrackerBox extends JPanel continue; } - totalPrice += entry.getGePrice(); + totalPrice += priceType == LootTrackerPriceType.HIGH_ALCHEMY ? entry.getHaPrice() : entry.getGePrice(); int quantity = 0; for (final LootTrackerItem i : items) @@ -278,8 +281,9 @@ class LootTrackerBox extends JPanel { int newQuantity = entry.getQuantity() + quantity; long gePricePerItem = entry.getGePrice() == 0 ? 0 : (entry.getGePrice() / entry.getQuantity()); + long haPricePerItem = entry.getHaPrice() == 0 ? 0 : (entry.getHaPrice() / entry.getQuantity()); - items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, entry.isIgnored())); + items.add(new LootTrackerItem(entry.getId(), entry.getName(), newQuantity, gePricePerItem * newQuantity, haPricePerItem * newQuantity, entry.isIgnored())); } else { @@ -287,7 +291,14 @@ class LootTrackerBox extends JPanel } } - items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); + if (priceType == LootTrackerPriceType.HIGH_ALCHEMY) + { + items.sort((i1, i2) -> Long.compare(i2.getHaPrice(), i1.getHaPrice())); + } + else + { + items.sort((i1, i2) -> Long.compare(i2.getGePrice(), i1.getGePrice())); + } // Calculates how many rows need to be display to fit all items final int rowSize = ((items.size() % ITEMS_PER_ROW == 0) ? 0 : 1) + items.size() / ITEMS_PER_ROW; @@ -353,7 +364,10 @@ class LootTrackerBox extends JPanel final String name = item.getName(); final int quantity = item.getQuantity(); final long gePrice = item.getGePrice(); + final long haPrice = item.getHaPrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(gePrice) + ") " + ignoredLabel; + return "" + name + " x " + quantity + ignoredLabel + + "
GE: " + QuantityFormatter.quantityToStackSize(gePrice) + + "
HA: " + QuantityFormatter.quantityToStackSize(haPrice) + ""; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index bba5994d89..1b212ae81b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -49,6 +49,16 @@ public interface LootTrackerConfig extends Config ) void setIgnoredItems(String key); + @ConfigItem( + keyName = "priceType", + name = "Price Type", + description = "What type of price to use for calculating value." + ) + default LootTrackerPriceType priceType() + { + return LootTrackerPriceType.GRAND_EXCHANGE; + } + @ConfigItem( keyName = "saveLoot", name = "Submit loot tracker data", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java index 1ecf28a229..81aedb3a4a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerItem.java @@ -40,6 +40,8 @@ class LootTrackerItem @Getter private final long gePrice; @Getter + private final long haPrice; + @Getter @Setter private boolean ignored; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index a4f21447f5..59e23dbd96 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -518,7 +518,8 @@ class LootTrackerPanel extends PluginPanel overallPanel.setVisible(true); // Create box - final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), hideIgnoredItems, plugin::toggleItem); + final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), + hideIgnoredItems, config.priceType(), plugin::toggleItem); box.combine(record); // Create popup menu @@ -594,7 +595,8 @@ class LootTrackerPanel extends PluginPanel private void updateOverall() { long overallKills = 0; - long overallGp = 0; + long overallGe = 0; + long overallHa = 0; for (LootTrackerRecord record : records) { @@ -613,7 +615,8 @@ class LootTrackerPanel extends PluginPanel continue; } - overallGp += item.getGePrice(); + overallGe += item.getGePrice(); + overallHa += item.getHaPrice(); } if (present > 0) @@ -623,7 +626,9 @@ class LootTrackerPanel extends PluginPanel } overallKillsLabel.setText(htmlLabel("Total count: ", overallKills)); - overallGpLabel.setText(htmlLabel("Total value: ", overallGp)); + overallGpLabel.setText(htmlLabel("Total value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); + overallGpLabel.setToolTipText("Total GE price: " + QuantityFormatter.formatNumber(overallGe) + + "
Total HA price: " + QuantityFormatter.formatNumber(overallHa) + ""); updateCollapseText(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index cc021c3650..e1fbfb307c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -54,6 +54,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.InventoryID; import net.runelite.api.ItemComposition; @@ -637,6 +638,7 @@ public class LootTrackerPlugin extends Plugin final ItemComposition itemComposition = itemManager.getItemComposition(itemId); final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; final long gePrice = (long) itemManager.getItemPrice(realItemId) * (long) quantity; + final long haPrice = (long) Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER) * (long) quantity; final boolean ignored = ignoredItems.contains(itemComposition.getName()); return new LootTrackerItem( @@ -644,6 +646,7 @@ public class LootTrackerPlugin extends Plugin itemComposition.getName(), quantity, gePrice, + haPrice, ignored); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java new file mode 100644 index 0000000000..e23ad8c2f2 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPriceType.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2019 Hydrox6 + * 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.loottracker; + +public enum LootTrackerPriceType +{ + GRAND_EXCHANGE, + HIGH_ALCHEMY +} From 5b236b920ee3330d72dc1da25e64a973dcf27b3e Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 19 Oct 2019 03:25:42 +0100 Subject: [PATCH 03/11] loot tracker: add price type display --- .../client/plugins/loottracker/LootTrackerBox.java | 11 ++++++++++- .../client/plugins/loottracker/LootTrackerConfig.java | 10 ++++++++++ .../client/plugins/loottracker/LootTrackerPanel.java | 10 ++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 6438e82c60..24e521d3be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -70,6 +70,7 @@ class LootTrackerBox extends JPanel @Getter(AccessLevel.PACKAGE) private final String id; private final LootTrackerPriceType priceType; + private final boolean showPriceType; @Getter private final List records = new ArrayList<>(); @@ -84,6 +85,7 @@ class LootTrackerBox extends JPanel @Nullable final String subtitle, final boolean hideIgnoredItems, final LootTrackerPriceType priceType, + final boolean showPriceType, final BiConsumer onItemToggle) { this.id = id; @@ -91,6 +93,7 @@ class LootTrackerBox extends JPanel this.onItemToggle = onItemToggle; this.hideIgnoredItems = hideIgnoredItems; this.priceType = priceType; + this.showPriceType = showPriceType; setLayout(new BorderLayout(0, 1)); setBorder(new EmptyBorder(5, 0, 0, 0)); @@ -184,7 +187,13 @@ class LootTrackerBox extends JPanel { buildItems(); - priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); + String priceTypeString = " "; + if (showPriceType) + { + priceTypeString = priceType == LootTrackerPriceType.HIGH_ALCHEMY ? "HA: " : "GE: "; + } + + priceLabel.setText(priceTypeString + QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp"); final long kills = getTotalKills(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index 1b212ae81b..55fee8a6c4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -59,6 +59,16 @@ public interface LootTrackerConfig extends Config return LootTrackerPriceType.GRAND_EXCHANGE; } + @ConfigItem( + keyName = "showPriceType", + name = "Show Price Type", + description = "Whether to show a GE: or HA: next to the total values in the tracker" + ) + default boolean showPriceType() + { + return false; + } + @ConfigItem( keyName = "saveLoot", name = "Submit loot tracker data", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index 59e23dbd96..6001df2923 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -519,7 +519,7 @@ class LootTrackerPanel extends PluginPanel // Create box final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), - hideIgnoredItems, config.priceType(), plugin::toggleItem); + hideIgnoredItems, config.priceType(), config.showPriceType(), plugin::toggleItem); box.combine(record); // Create popup menu @@ -625,8 +625,14 @@ class LootTrackerPanel extends PluginPanel } } + String priceType = ""; + if (config.showPriceType()) + { + priceType = config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? "HA " : "GE "; + } + overallKillsLabel.setText(htmlLabel("Total count: ", overallKills)); - overallGpLabel.setText(htmlLabel("Total value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); + overallGpLabel.setText(htmlLabel("Total " + priceType + "value: ", config.priceType() == LootTrackerPriceType.HIGH_ALCHEMY ? overallHa : overallGe)); overallGpLabel.setToolTipText("Total GE price: " + QuantityFormatter.formatNumber(overallGe) + "
Total HA price: " + QuantityFormatter.formatNumber(overallHa) + ""); updateCollapseText(); From 6a3264e68b0ba4e9ef5096d19065b2bf68beebc9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:51:42 -0400 Subject: [PATCH 04/11] client: remove Cerberus plugin Removed at Jagex's request --- .../plugins/cerberus/CerberusGhost.java | 70 ----------- .../plugins/cerberus/CerberusOverlay.java | 77 ------------ .../plugins/cerberus/CerberusPlugin.java | 115 ------------------ .../plugins/cerberus/CerberusPluginTest.java | 92 -------------- 4 files changed, 354 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java delete mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java deleted file mode 100644 index 744085c9a4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusGhost.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import com.google.common.collect.ImmutableMap; -import java.util.Map; -import java.util.Optional; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import net.runelite.api.NPC; -import net.runelite.api.NpcID; -import net.runelite.api.Skill; - -@Getter -@RequiredArgsConstructor -public enum CerberusGhost -{ - RANGE(NpcID.SUMMONED_SOUL, Skill.RANGED), - MAGE(NpcID.SUMMONED_SOUL_5868, Skill.MAGIC), - MELEE(NpcID.SUMMONED_SOUL_5869, Skill.ATTACK); - - private final int npcId; - private final Skill type; - - private static final Map MAP; - - static - { - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - - for (final CerberusGhost ghost : values()) - { - builder.put(ghost.getNpcId(), ghost); - } - - MAP = builder.build(); - } - - /** - * Try to identify if NPC is ghost - * @param npc npc - * @return optional ghost - */ - public static Optional fromNPC(final NPC npc) - { - return npc == null ? Optional.empty() : Optional.ofNullable(MAP.get(npc.getId())); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java deleted file mode 100644 index 2f384fcd80..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusOverlay.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import javax.inject.Singleton; -import net.runelite.client.game.SkillIconManager; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.ComponentOrientation; -import net.runelite.client.ui.overlay.components.ImageComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; - -@Singleton -public class CerberusOverlay extends Overlay -{ - private final CerberusPlugin plugin; - private final SkillIconManager iconManager; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - CerberusOverlay(final CerberusPlugin plugin, final SkillIconManager iconManager) - { - this.plugin = plugin; - this.iconManager = iconManager; - setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(ComponentOrientation.HORIZONTAL); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.getGhosts().isEmpty()) - { - return null; - } - - panelComponent.getChildren().clear(); - - // Ghosts are already sorted - plugin.getGhosts().stream() - // Iterate only through the correct amount of ghosts - .limit(CerberusGhost.values().length) - .forEach(npc -> CerberusGhost - .fromNPC(npc) - .ifPresent(ghost -> panelComponent - .getChildren() - .add(new ImageComponent(iconManager.getSkillImage(ghost.getType()))))); - - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java deleted file mode 100644 index 47f1adbec4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.cerberus; - -import com.google.common.collect.ComparisonChain; -import java.util.ArrayList; -import java.util.List; -import javax.inject.Inject; -import javax.inject.Singleton; -import lombok.Getter; -import net.runelite.api.GameState; -import net.runelite.api.NPC; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.OverlayManager; - -@PluginDescriptor( - name = "Cerberus", - description = "Show what to pray against the summoned souls", - tags = {"bosses", "combat", "ghosts", "prayer", "pve", "overlay", "souls"} -) -@Singleton -public class CerberusPlugin extends Plugin -{ - @Getter - private final List ghosts = new ArrayList<>(); - - @Inject - private OverlayManager overlayManager; - - @Inject - private CerberusOverlay overlay; - - @Override - protected void startUp() throws Exception - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() throws Exception - { - overlayManager.remove(overlay); - ghosts.clear(); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - GameState gameState = event.getGameState(); - if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.HOPPING || gameState == GameState.CONNECTION_LOST) - { - ghosts.clear(); - } - } - - @Subscribe - public void onNpcSpawned(final NpcSpawned event) - { - final NPC npc = event.getNpc(); - CerberusGhost.fromNPC(npc).ifPresent(ghost -> ghosts.add(npc)); - } - - @Subscribe - public void onNpcDespawned(final NpcDespawned event) - { - ghosts.remove(event.getNpc()); - } - - @Subscribe - public void onGameTick(GameTick gameTick) - { - if (ghosts.isEmpty()) - { - return; - } - - ghosts.sort((a, b) -> ComparisonChain.start() - // First, sort by the southernmost ghost (e.g with lowest y) - .compare(a.getLocalLocation().getY(), b.getLocalLocation().getY()) - // Then, sort by the westernmost ghost (e.g with lowest x) - .compare(a.getLocalLocation().getX(), b.getLocalLocation().getX()) - // This will give use the current wave and order of the ghosts based on - // what ghost will attack first - .result()); - } -} diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java deleted file mode 100644 index e4289fa2f2..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/cerberus/CerberusPluginTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.cerberus; - -import com.google.inject.Guice; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.util.Arrays; -import java.util.List; -import javax.inject.Inject; -import net.runelite.api.NPC; -import net.runelite.api.coords.LocalPoint; -import net.runelite.api.events.GameTick; -import net.runelite.client.ui.overlay.OverlayManager; -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class CerberusPluginTest -{ - @Mock - @Bind - OverlayManager overlayManager; - - @Inject - CerberusPlugin cerberusPlugin; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - } - - @Test - public void testOnGameTick() - { - List ghosts = cerberusPlugin.getGhosts(); - ghosts.addAll(Arrays.asList( - mockNpc(new LocalPoint(0, 0)), - mockNpc(new LocalPoint(1, 0)), - mockNpc(new LocalPoint(0, 5)), - mockNpc(new LocalPoint(2, 0)), - mockNpc(new LocalPoint(2, 5)), - mockNpc(new LocalPoint(1, 5)) - )); - cerberusPlugin.onGameTick(new GameTick()); - - // Expected sort is by lowest y first, then by lowest x - assertEquals(ghosts.get(0).getLocalLocation(), new LocalPoint(0, 0)); - assertEquals(ghosts.get(1).getLocalLocation(), new LocalPoint(1, 0)); - assertEquals(ghosts.get(2).getLocalLocation(), new LocalPoint(2, 0)); - - assertEquals(ghosts.get(3).getLocalLocation(), new LocalPoint(0, 5)); - assertEquals(ghosts.get(4).getLocalLocation(), new LocalPoint(1, 5)); - assertEquals(ghosts.get(5).getLocalLocation(), new LocalPoint(2, 5)); - } - - private static NPC mockNpc(LocalPoint localPoint) - { - NPC npc = mock(NPC.class); - when(npc.getLocalLocation()).thenReturn(localPoint); - return npc; - } -} \ No newline at end of file From 54bb0f803fb3133c83f090586b84445053055715 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:52:29 -0400 Subject: [PATCH 05/11] client: remove reorderprayers plugin Removed at Jagex's request --- .../reorderprayers/PrayerTabState.java | 32 -- .../reorderprayers/ReorderPrayersConfig.java | 73 --- .../reorderprayers/ReorderPrayersPlugin.java | 453 ------------------ 3 files changed, 558 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java deleted file mode 100644 index 993a74f917..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/PrayerTabState.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.reorderprayers; - -public enum PrayerTabState -{ - NONE, - PRAYERS, - QUICK_PRAYERS -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java deleted file mode 100644 index 7a73dae268..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersConfig.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.reorderprayers; - -import net.runelite.api.Prayer; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup(ReorderPrayersPlugin.CONFIG_GROUP_KEY) -public interface ReorderPrayersConfig extends Config -{ - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "Unlock Prayer Reordering", - description = "Configures whether or not you can reorder the prayers", - position = 1 - ) - default boolean unlockPrayerReordering() - { - return false; - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_UNLOCK_REORDERING_KEY, - name = "", - description = "" - ) - void unlockPrayerReordering(boolean unlock); - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "Prayer Order", - description = "Configures the order of the prayers", - hidden = true, - position = 2 - ) - default String prayerOrder() - { - return ReorderPrayersPlugin.prayerOrderToString(Prayer.values()); - } - - @ConfigItem( - keyName = ReorderPrayersPlugin.CONFIG_PRAYER_ORDER_KEY, - name = "", - description = "" - ) - void prayerOrder(String prayerOrder); - -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java deleted file mode 100644 index 0c85f32c8e..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/reorderprayers/ReorderPrayersPlugin.java +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * 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.reorderprayers; - -import com.google.common.collect.ImmutableList; -import com.google.inject.Provides; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.HashTable; -import net.runelite.api.Prayer; -import net.runelite.api.WidgetNode; -import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.DraggingWidgetChanged; -import net.runelite.api.events.GameStateChanged; -import net.runelite.api.events.WidgetLoaded; -import net.runelite.api.events.WidgetMenuOptionClicked; -import net.runelite.api.widgets.Widget; -import static net.runelite.api.widgets.WidgetConfig.DRAG; -import static net.runelite.api.widgets.WidgetConfig.DRAG_ON; -import net.runelite.api.widgets.WidgetID; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.menus.MenuManager; -import net.runelite.client.menus.WidgetMenuOption; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; - -@PluginDescriptor( - name = "Reorder Prayers", - description = "Reorder the prayers displayed on the Prayer panel" -) -public class ReorderPrayersPlugin extends Plugin -{ - - static final String CONFIG_GROUP_KEY = "reorderprayers"; - - static final String CONFIG_UNLOCK_REORDERING_KEY = "unlockPrayerReordering"; - - static final String CONFIG_PRAYER_ORDER_KEY = "prayerOrder"; - - private static final int PRAYER_WIDTH = 34; - - private static final int PRAYER_HEIGHT = 34; - - private static final int PRAYER_X_OFFSET = 37; - - private static final int PRAYER_Y_OFFSET = 37; - - private static final int QUICK_PRAYER_SPRITE_X_OFFSET = 2; - - private static final int QUICK_PRAYER_SPRITE_Y_OFFSET = 2; - - private static final int PRAYER_COLUMN_COUNT = 5; - - private static final int PRAYER_COUNT = Prayer.values().length; - - private static final List PRAYER_WIDGET_INFO_LIST = ImmutableList.of( - WidgetInfo.PRAYER_THICK_SKIN, - WidgetInfo.PRAYER_BURST_OF_STRENGTH, - WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, - WidgetInfo.PRAYER_SHARP_EYE, - WidgetInfo.PRAYER_MYSTIC_WILL, - WidgetInfo.PRAYER_ROCK_SKIN, - WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, - WidgetInfo.PRAYER_IMPROVED_REFLEXES, - WidgetInfo.PRAYER_RAPID_RESTORE, - WidgetInfo.PRAYER_RAPID_HEAL, - WidgetInfo.PRAYER_PROTECT_ITEM, - WidgetInfo.PRAYER_HAWK_EYE, - WidgetInfo.PRAYER_MYSTIC_LORE, - WidgetInfo.PRAYER_STEEL_SKIN, - WidgetInfo.PRAYER_ULTIMATE_STRENGTH, - WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, - WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, - WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, - WidgetInfo.PRAYER_PROTECT_FROM_MELEE, - WidgetInfo.PRAYER_EAGLE_EYE, - WidgetInfo.PRAYER_MYSTIC_MIGHT, - WidgetInfo.PRAYER_RETRIBUTION, - WidgetInfo.PRAYER_REDEMPTION, - WidgetInfo.PRAYER_SMITE, - WidgetInfo.PRAYER_PRESERVE, - WidgetInfo.PRAYER_CHIVALRY, - WidgetInfo.PRAYER_PIETY, - WidgetInfo.PRAYER_RIGOUR, - WidgetInfo.PRAYER_AUGURY - ); - - private static final List QUICK_PRAYER_CHILD_IDS = ImmutableList.of( - WidgetID.QuickPrayer.THICK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.BURST_OF_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.CLARITY_OF_THOUGHT_CHILD_ID, - WidgetID.QuickPrayer.SHARP_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_WILL_CHILD_ID, - WidgetID.QuickPrayer.ROCK_SKIN_CHILD_ID, - WidgetID.QuickPrayer.SUPERHUMAN_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.IMPROVED_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.RAPID_RESTORE_CHILD_ID, - WidgetID.QuickPrayer.RAPID_HEAL_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_ITEM_CHILD_ID, - WidgetID.QuickPrayer.HAWK_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_LORE_CHILD_ID, - WidgetID.QuickPrayer.STEEL_SKIN_CHILD_ID, - WidgetID.QuickPrayer.ULTIMATE_STRENGTH_CHILD_ID, - WidgetID.QuickPrayer.INCREDIBLE_REFLEXES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MAGIC_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MISSILES_CHILD_ID, - WidgetID.QuickPrayer.PROTECT_FROM_MELEE_CHILD_ID, - WidgetID.QuickPrayer.EAGLE_EYE_CHILD_ID, - WidgetID.QuickPrayer.MYSTIC_MIGHT_CHILD_ID, - WidgetID.QuickPrayer.RETRIBUTION_CHILD_ID, - WidgetID.QuickPrayer.REDEMPTION_CHILD_ID, - WidgetID.QuickPrayer.SMITE_CHILD_ID, - WidgetID.QuickPrayer.PRESERVE_CHILD_ID, - WidgetID.QuickPrayer.CHIVALRY_CHILD_ID, - WidgetID.QuickPrayer.PIETY_CHILD_ID, - WidgetID.QuickPrayer.RIGOUR_CHILD_ID, - WidgetID.QuickPrayer.AUGURY_CHILD_ID - ); - - private static final String LOCK = "Lock"; - - private static final String UNLOCK = "Unlock"; - - private static final String MENU_TARGET = "Reordering"; - - private static final WidgetMenuOption FIXED_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption FIXED_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK = new WidgetMenuOption(LOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, - MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB); - - @Inject - private Client client; - - @Inject - private ReorderPrayersConfig config; - - @Inject - private MenuManager menuManager; - - private Prayer[] prayerOrder; - - static String prayerOrderToString(Prayer[] prayerOrder) - { - return Arrays.stream(prayerOrder) - .map(Prayer::name) - .collect(Collectors.joining(",")); - } - - private static Prayer[] stringToPrayerOrder(String string) - { - return Arrays.stream(string.split(",")) - .map(Prayer::valueOf) - .toArray(Prayer[]::new); - } - - private static int getPrayerIndex(Widget widget) - { - int x = widget.getOriginalX() / PRAYER_X_OFFSET; - int y = widget.getOriginalY() / PRAYER_Y_OFFSET; - return x + y * PRAYER_COLUMN_COUNT; - } - - private static void setWidgetPosition(Widget widget, int x, int y) - { - widget.setRelativeX(x); - widget.setRelativeY(y); - widget.setOriginalX(x); - widget.setOriginalY(y); - } - - @Provides - ReorderPrayersConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(ReorderPrayersConfig.class); - } - - @Override - protected void startUp() throws Exception - { - refreshPrayerTabOption(); - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - reorderPrayers(); - } - - @Override - protected void shutDown() throws Exception - { - clearPrayerTabMenus(); - prayerOrder = Prayer.values(); - reorderPrayers(false); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - if (event.getGameState() == GameState.LOGGED_IN) - { - reorderPrayers(); - } - } - - @Subscribe - public void onConfigChanged(ConfigChanged event) - { - if (event.getGroup().equals(CONFIG_GROUP_KEY)) - { - if (event.getKey().equals(CONFIG_PRAYER_ORDER_KEY)) - { - prayerOrder = stringToPrayerOrder(config.prayerOrder()); - } - else if (event.getKey().equals(CONFIG_UNLOCK_REORDERING_KEY)) - { - refreshPrayerTabOption(); - } - reorderPrayers(); - } - } - - @Subscribe - public void onWidgetLoaded(WidgetLoaded event) - { - if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - reorderPrayers(); - } - } - - @Subscribe - public void onDraggingWidgetChanged(DraggingWidgetChanged event) - { - // is dragging widget and mouse button released - if (event.isDraggingWidget() && client.getMouseCurrentButton() == 0) - { - Widget draggedWidget = client.getDraggedWidget(); - Widget draggedOnWidget = client.getDraggedOnWidget(); - if (draggedWidget != null && draggedOnWidget != null) - { - int draggedGroupId = WidgetInfo.TO_GROUP(draggedWidget.getId()); - int draggedOnGroupId = WidgetInfo.TO_GROUP(draggedOnWidget.getId()); - if (draggedGroupId != WidgetID.PRAYER_GROUP_ID || draggedOnGroupId != WidgetID.PRAYER_GROUP_ID - || draggedOnWidget.getWidth() != PRAYER_WIDTH || draggedOnWidget.getHeight() != PRAYER_HEIGHT) - { - return; - } - // reset dragged on widget to prevent sending a drag widget packet to the server - client.setDraggedOnWidget(null); - - int fromPrayerIndex = getPrayerIndex(draggedWidget); - int toPrayerIndex = getPrayerIndex(draggedOnWidget); - - Prayer tmp = prayerOrder[toPrayerIndex]; - prayerOrder[toPrayerIndex] = prayerOrder[fromPrayerIndex]; - prayerOrder[fromPrayerIndex] = tmp; - - save(); - } - } - } - - @Subscribe - public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event) - { - if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_PRAYER_TAB - || event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_PRAYER_TAB) - { - config.unlockPrayerReordering(event.getMenuOption().equals(UNLOCK)); - } - } - - private void clearPrayerTabMenus() - { - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - menuManager.removeManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.removeManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - - private void refreshPrayerTabOption() - { - clearPrayerTabMenus(); - if (config.unlockPrayerReordering()) - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_LOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_LOCK); - } - else - { - menuManager.addManagedCustomMenu(FIXED_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_PRAYER_TAB_UNLOCK); - menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_PRAYER_TAB_UNLOCK); - } - } - - private PrayerTabState getPrayerTabState() - { - HashTable componentTable = client.getComponentTable(); - for (WidgetNode widgetNode : componentTable.getNodes()) - { - if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) - { - return PrayerTabState.PRAYERS; - } - else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) - { - return PrayerTabState.QUICK_PRAYERS; - } - } - return PrayerTabState.NONE; - } - - private void save() - { - config.prayerOrder(prayerOrderToString(prayerOrder)); - } - - private void reorderPrayers() - { - reorderPrayers(config.unlockPrayerReordering()); - } - - private void reorderPrayers(boolean unlocked) - { - if (client.getGameState() != GameState.LOGGED_IN) - { - return; - } - - PrayerTabState prayerTabState = getPrayerTabState(); - - if (prayerTabState == PrayerTabState.PRAYERS) - { - List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream() - .map(client::getWidget) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - Widget prayerWidget = prayerWidgets.get(prayer.ordinal()); - - int widgetConfig = prayerWidget.getClickMask(); - if (unlocked) - { - // allow dragging of this widget - widgetConfig |= DRAG; - // allow this widget to be dragged on - widgetConfig |= DRAG_ON; - } - else - { - // remove drag flag - widgetConfig &= ~DRAG; - // remove drag on flag - widgetConfig &= ~DRAG_ON; - } - prayerWidget.setClickMask(widgetConfig); - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - int widgetX = x * PRAYER_X_OFFSET; - int widgetY = y * PRAYER_Y_OFFSET; - setWidgetPosition(prayerWidget, widgetX, widgetY); - } - } - else if (prayerTabState == PrayerTabState.QUICK_PRAYERS) - { - Widget prayersContainer = client.getWidget(WidgetInfo.QUICK_PRAYER_PRAYERS); - if (prayersContainer == null) - { - return; - } - Widget[] prayerWidgets = prayersContainer.getDynamicChildren(); - if (prayerWidgets == null || prayerWidgets.length != PRAYER_COUNT * 3) - { - return; - } - - for (int index = 0; index < prayerOrder.length; index++) - { - Prayer prayer = prayerOrder[index]; - - int x = index % PRAYER_COLUMN_COUNT; - int y = index / PRAYER_COLUMN_COUNT; - - Widget prayerWidget = prayerWidgets[QUICK_PRAYER_CHILD_IDS.get(prayer.ordinal())]; - setWidgetPosition(prayerWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - - int childId = PRAYER_COUNT + 2 * prayer.ordinal(); - - Widget prayerSpriteWidget = prayerWidgets[childId]; - setWidgetPosition(prayerSpriteWidget, - QUICK_PRAYER_SPRITE_X_OFFSET + x * PRAYER_X_OFFSET, - QUICK_PRAYER_SPRITE_Y_OFFSET + y * PRAYER_Y_OFFSET); - - Widget prayerToggleWidget = prayerWidgets[childId + 1]; - setWidgetPosition(prayerToggleWidget, x * PRAYER_X_OFFSET, y * PRAYER_Y_OFFSET); - } - } - } - -} From 543ce78710f1b078d3385ecdf80f49b12cde02d0 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:54:21 -0400 Subject: [PATCH 06/11] opponentinfo: remove Opponent's opponent Removed at Jagex's request --- .../opponentinfo/OpponentInfoConfig.java | 11 --------- .../opponentinfo/OpponentInfoOverlay.java | 23 ------------------- 2 files changed, 34 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java index 9f08e128af..6adb3af1f2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoConfig.java @@ -53,17 +53,6 @@ public interface OpponentInfoConfig extends Config return HitpointsDisplayStyle.HITPOINTS; } - @ConfigItem( - keyName = "showOpponentsOpponent", - name = "Show opponent's opponent", - description = "Toggle showing opponent's opponent if within a multi-combat area", - position = 2 - ) - default boolean showOpponentsOpponent() - { - return true; - } - @ConfigItem( keyName = "showOpponentsInMenu", name = "Show opponents in menu", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java index f7945a5646..45c40cf939 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java @@ -37,7 +37,6 @@ import net.runelite.api.Client; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.NPC; import net.runelite.api.Player; -import net.runelite.api.Varbits; import net.runelite.client.game.HiscoreManager; import net.runelite.client.game.NPCManager; import net.runelite.client.ui.overlay.Overlay; @@ -69,7 +68,6 @@ class OpponentInfoOverlay extends Overlay private int lastRatio = 0; private int lastHealthScale = 0; private String opponentName; - private String opponentsOpponentName; @Inject private OpponentInfoOverlay( @@ -128,17 +126,6 @@ class OpponentInfoOverlay extends Overlay } } } - - final Actor opponentsOpponent = opponent.getInteracting(); - if (opponentsOpponent != null - && (opponentsOpponent != client.getLocalPlayer() || client.getVar(Varbits.MULTICOMBAT_AREA) == 1)) - { - opponentsOpponentName = Text.removeTags(opponentsOpponent.getName()); - } - else - { - opponentsOpponentName = null; - } } if (opponentName == null) @@ -218,16 +205,6 @@ class OpponentInfoOverlay extends Overlay panelComponent.getChildren().add(progressBarComponent); } - // Opponents opponent - if (opponentsOpponentName != null && opponentInfoConfig.showOpponentsOpponent()) - { - textWidth = Math.max(textWidth, fontMetrics.stringWidth(opponentsOpponentName)); - panelComponent.setPreferredSize(new Dimension(textWidth, 0)); - panelComponent.getChildren().add(TitleComponent.builder() - .text(opponentsOpponentName) - .build()); - } - return panelComponent.render(graphics); } } From e2c72a676751f731a93b0b98a92663c08e742cfc Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:55:44 -0400 Subject: [PATCH 07/11] corp plugin: remove dark core attack deprioritization Removed at Jagex's request --- .../client/plugins/corp/CorpConfig.java | 11 ------- .../client/plugins/corp/CorpPlugin.java | 32 ------------------- 2 files changed, 43 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java index 4b2fe5bb9c..13475f7c44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpConfig.java @@ -31,17 +31,6 @@ import net.runelite.client.config.ConfigItem; @ConfigGroup("corp") public interface CorpConfig extends Config { - @ConfigItem( - keyName = "leftClickCore", - name = "Left click walk on core", - description = "Prioritizes Walk here over Attack on the Dark energy core", - position = 1 - ) - default boolean leftClickCore() - { - return true; - } - @ConfigItem( keyName = "showDamage", name = "Show damage overlay", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java index 627c9091e8..9ad661094c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/corp/CorpPlugin.java @@ -35,16 +35,12 @@ import net.runelite.api.Actor; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; -import net.runelite.api.MenuAction; -import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET; -import net.runelite.api.MenuEntry; import net.runelite.api.NPC; import net.runelite.api.NpcID; import net.runelite.api.Varbits; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.client.chat.ChatColorType; @@ -65,10 +61,6 @@ import net.runelite.client.ui.overlay.OverlayManager; @Slf4j public class CorpPlugin extends Plugin { - private static final int NPC_SECTION_ACTION = MenuAction.NPC_SECOND_OPTION.getId(); - private static final String ATTACK = "Attack"; - private static final String DARK_ENERGY_CORE = "Dark energy core"; - @Getter(AccessLevel.PACKAGE) private NPC corp; @@ -224,28 +216,4 @@ public class CorpPlugin extends Plugin players.add(source); } - - @Subscribe - public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded) - { - if (menuEntryAdded.getType() != NPC_SECTION_ACTION - || !config.leftClickCore() || !menuEntryAdded.getOption().equals(ATTACK)) - { - return; - } - - final int npcIndex = menuEntryAdded.getIdentifier(); - final NPC npc = client.getCachedNPCs()[npcIndex]; - if (npc == null || !npc.getName().equals(DARK_ENERGY_CORE)) - { - return; - } - - // since this is the menu entry add event, this is the last menu entry - MenuEntry[] menuEntries = client.getMenuEntries(); - MenuEntry menuEntry = menuEntries[menuEntries.length - 1]; - - menuEntry.setType(NPC_SECTION_ACTION + MENU_ACTION_DEPRIORITIZE_OFFSET); - client.setMenuEntries(menuEntries); - } } From bc5838f0194f6ad75aa69be0743f13ef3afd564a Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Oct 2019 13:58:22 -0400 Subject: [PATCH 08/11] menuentryswapper: remove pickpocket swap Removed at Jagex's request --- .../menuentryswapper/MenuEntrySwapperConfig.java | 10 ---------- .../menuentryswapper/MenuEntrySwapperPlugin.java | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 13f780a823..28229152f1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -202,16 +202,6 @@ public interface MenuEntrySwapperConfig extends Config return HouseAdvertisementMode.VIEW; } - @ConfigItem( - keyName = "swapPickpocket", - name = "Pickpocket", - description = "Swap Talk-to with Pickpocket" - ) - default boolean swapPickpocket() - { - return true; - } - @ConfigItem( keyName = "swapPay", name = "Pay", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 91fddefb66..eabce50cf3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -371,11 +371,6 @@ public class MenuEntrySwapperPlugin extends Plugin if (option.equals("talk-to")) { - if (config.swapPickpocket() && shouldSwapPickpocket(target)) - { - swap("pickpocket", option, target, index); - } - if (config.swapAbyssTeleport() && target.contains("mage of zamorak")) { swap("teleport", option, target, index); @@ -638,11 +633,6 @@ public class MenuEntrySwapperPlugin extends Plugin } } - private static boolean shouldSwapPickpocket(String target) - { - return !target.startsWith("villager") && !target.startsWith("bandit") && !target.startsWith("menaphite thug"); - } - @Subscribe public void onClientTick(ClientTick clientTick) { From 151ea90b2fbf95ab1abf68a6300a7486ad118294 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Oct 2019 16:14:10 -0400 Subject: [PATCH 09/11] 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) From 55346c7d2be388edbe16e3527e0567b724ae13e2 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 30 Oct 2019 16:45:22 +0000 Subject: [PATCH 10/11] Release 1.5.37 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 6a683c0e03..e355391bfe 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index ca731fa5a2..d8ed86bfd6 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 95fcd5d703..6f32c3c191 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 3e232bdfa2..52bc773799 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 16b8e5144e..b4deda4435 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 Web Service diff --git a/pom.xml b/pom.xml index 916d842e82..fbe2464789 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.37 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index c10f81c453..08d3f7c90b 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index b687358a57..620355d3a2 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 021c41e297..4e5dd0dd4e 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index ebf7d9280f..9dd0bf267a 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index e6219a3749..957e7b6d6d 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37-SNAPSHOT + 1.5.37 script-assembler-plugin From ca58d24c7fe8c946465374d2ff8f3e2e240bd043 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Wed, 30 Oct 2019 16:45:29 +0000 Subject: [PATCH 11/11] Bump for 1.5.38-SNAPSHOT --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index e355391bfe..8abbbf789c 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index d8ed86bfd6..56849519e9 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 6f32c3c191..ac77ad1b00 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 52bc773799..cc418be40b 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index b4deda4435..49a3c8e21c 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index fbe2464789..e0932e7c09 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.37 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 08d3f7c90b..4a6e08e602 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 620355d3a2..9c42616649 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 4e5dd0dd4e..f09264a9c0 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 9dd0bf267a..1dae652ba0 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 957e7b6d6d..51dec4da8a 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.37 + 1.5.38-SNAPSHOT script-assembler-plugin